Mercurial > hg > Members > kono > Proof > ZF-in-agda
annotate src/BAlgebra.agda @ 1280:a496dbb74a5f
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 06 Apr 2023 11:50:41 +0900 |
parents | 5f1572d1f19a |
children | 437e48221ed5 |
rev | line source |
---|---|
1280 | 1 {-# OPTIONS --allow-unsolved-metas #-} |
2 | |
431 | 3 open import Level |
4 open import Ordinals | |
1124 | 5 module BAlgebra {n : Level } (O : Ordinals {n}) where |
431 | 6 |
7 open import zf | |
8 open import logic | |
9 import OrdUtil | |
10 import OD | |
11 import ODUtil | |
12 import ODC | |
13 | |
14 open import Relation.Nullary | |
15 open import Relation.Binary | |
16 open import Data.Empty | |
17 open import Relation.Binary | |
18 open import Relation.Binary.Core | |
19 open import Relation.Binary.PropositionalEquality | |
20 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ; _+_ to _n+_ ) | |
21 | |
22 open inOrdinal O | |
23 open Ordinals.Ordinals O | |
24 open Ordinals.IsOrdinals isOrdinal | |
25 open Ordinals.IsNext isNext | |
26 open OrdUtil O | |
27 open ODUtil O | |
28 | |
29 open OD O | |
30 open OD.OD | |
31 open ODAxiom odAxiom | |
32 open HOD | |
33 | |
34 open _∧_ | |
35 open _∨_ | |
36 open Bool | |
37 | |
1123 | 38 L\L=0 : { L : HOD } → L \ L ≡ od∅ |
39 L\L=0 {L} = ==→o≡ ( record { eq→ = lem0 ; eq← = lem1 } ) where | |
40 lem0 : {x : Ordinal} → odef (L \ L) x → odef od∅ x | |
41 lem0 {x} ⟪ lx , ¬lx ⟫ = ⊥-elim (¬lx lx) | |
42 lem1 : {x : Ordinal} → odef od∅ x → odef (L \ L) x | |
43 lem1 {x} lt = ⊥-elim ( ¬∅∋ (subst (λ k → odef od∅ k) (sym &iso) lt )) | |
44 | |
1151
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
45 L\Lx=x : { L x : HOD } → x ⊆ L → L \ ( L \ x ) ≡ x |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
46 L\Lx=x {L} {x} x⊆L = ==→o≡ ( record { eq→ = lem03 ; eq← = lem04 } ) where |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
47 lem03 : {z : Ordinal} → odef (L \ (L \ x)) z → odef x z |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
48 lem03 {z} ⟪ Lz , Lxz ⟫ with ODC.∋-p O x (* z) |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
49 ... | yes y = subst (λ k → odef x k ) &iso y |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
50 ... | no n = ⊥-elim ( Lxz ⟪ Lz , ( subst (λ k → ¬ odef x k ) &iso n ) ⟫ ) |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
51 lem04 : {z : Ordinal} → odef x z → odef (L \ (L \ x)) z |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
52 lem04 {z} xz with ODC.∋-p O L (* z) |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
53 ... | yes y = ⟪ subst (λ k → odef L k ) &iso y , ( λ p → proj2 p xz ) ⟫ |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
54 ... | no n = ⊥-elim ( n (subst (λ k → odef L k ) (sym &iso) ( x⊆L xz) )) |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
55 |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
56 L\0=L : { L : HOD } → L \ od∅ ≡ L |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
57 L\0=L {L} = ==→o≡ ( record { eq→ = lem05 ; eq← = lem06 } ) where |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
58 lem05 : {x : Ordinal} → odef (L \ od∅) x → odef L x |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
59 lem05 {x} ⟪ Lx , _ ⟫ = Lx |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
60 lem06 : {x : Ordinal} → odef L x → odef (L \ od∅) x |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
61 lem06 {x} Lx = ⟪ Lx , (λ lt → ¬x<0 lt) ⟫ |
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
62 |
1182 | 63 ∨L\X : { L X : HOD } → {x : Ordinal } → odef L x → odef X x ∨ odef (L \ X) x |
64 ∨L\X {L} {X} {x} Lx with ODC.∋-p O X (* x) | |
65 ... | yes y = case1 ( subst (λ k → odef X k ) &iso y ) | |
66 ... | no n = case2 ⟪ Lx , subst (λ k → ¬ odef X k) &iso n ⟫ | |
67 | |
1241 | 68 \-⊆ : { P A B : HOD } → A ⊆ P → ( A ⊆ B → ( P \ B ) ⊆ ( P \ A )) ∧ (( P \ B ) ⊆ ( P \ A ) → A ⊆ B ) |
69 \-⊆ {P} {A} {B} A⊆P = ⟪ ( λ a<b {x} pbx → ⟪ proj1 pbx , (λ ax → proj2 pbx (a<b ax)) ⟫ ) , lem07 ⟫ where | |
70 lem07 : (P \ B) ⊆ (P \ A) → A ⊆ B | |
71 lem07 pba {x} ax with ODC.p∨¬p O (odef B x) | |
72 ... | case1 bx = bx | |
73 ... | case2 ¬bx = ⊥-elim ( proj2 ( pba ⟪ A⊆P ax , ¬bx ⟫ ) ax ) | |
1151
8a071bf52407
Finite intersection property to Compact done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1150
diff
changeset
|
74 |
451 | 75 [a-b]∩b=0 : { A B : HOD } → (A \ B) ∩ B ≡ od∅ |
76 [a-b]∩b=0 {A} {B} = ==→o≡ record { eq← = λ lt → ⊥-elim ( ¬∅∋ (subst (λ k → odef od∅ k) (sym &iso) lt )) | |
77 ; eq→ = λ {x} lt → ⊥-elim (proj2 (proj1 lt ) (proj2 lt)) } | |
78 | |
480 | 79 U-F=∅→F⊆U : {F U : HOD} → ((x : Ordinal) → ¬ ( odef F x ∧ ( ¬ odef U x ))) → F ⊆ U |
1096 | 80 U-F=∅→F⊆U {F} {U} not = gt02 where |
480 | 81 gt02 : { x : Ordinal } → odef F x → odef U x |
82 gt02 {x} fx with ODC.∋-p O U (* x) | |
83 ... | yes y = subst (λ k → odef U k ) &iso y | |
84 ... | no n = ⊥-elim ( not x ⟪ fx , subst (λ k → ¬ odef U k ) &iso n ⟫ ) | |
85 | |
431 | 86 ∪-Union : { A B : HOD } → Union (A , B) ≡ ( A ∪ B ) |
87 ∪-Union {A} {B} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where | |
88 lemma1 : {x : Ordinal} → odef (Union (A , B)) x → odef (A ∪ B) x | |
1096 | 89 lemma1 {x} record { owner = owner ; ao = abo ; ox = ox } with pair=∨ (subst₂ (λ j k → odef (j , k ) owner) (sym *iso) (sym *iso) abo ) |
90 ... | case1 a=o = case1 (subst (λ k → odef k x ) ( begin | |
91 * owner ≡⟨ cong (*) (sym a=o) ⟩ | |
92 * (& A) ≡⟨ *iso ⟩ | |
93 A ∎ ) ox ) where open ≡-Reasoning | |
94 ... | case2 b=o = case2 (subst (λ k → odef k x ) (trans (cong (*) (sym b=o)) *iso ) ox) | |
431 | 95 lemma2 : {x : Ordinal} → odef (A ∪ B) x → odef (Union (A , B)) x |
96 lemma2 {x} (case1 A∋x) = subst (λ k → odef (Union (A , B)) k) &iso ( IsZF.union→ isZF (A , B) (* x) A | |
97 ⟪ case1 refl , d→∋ A A∋x ⟫ ) | |
98 lemma2 {x} (case2 B∋x) = subst (λ k → odef (Union (A , B)) k) &iso ( IsZF.union→ isZF (A , B) (* x) B | |
99 ⟪ case2 refl , d→∋ B B∋x ⟫ ) | |
100 | |
101 ∩-Select : { A B : HOD } → Select A ( λ x → ( A ∋ x ) ∧ ( B ∋ x ) ) ≡ ( A ∩ B ) | |
102 ∩-Select {A} {B} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where | |
103 lemma1 : {x : Ordinal} → odef (Select A (λ x₁ → (A ∋ x₁) ∧ (B ∋ x₁))) x → odef (A ∩ B) x | |
104 lemma1 {x} lt = ⟪ proj1 lt , subst (λ k → odef B k ) &iso (proj2 (proj2 lt)) ⟫ | |
105 lemma2 : {x : Ordinal} → odef (A ∩ B) x → odef (Select A (λ x₁ → (A ∋ x₁) ∧ (B ∋ x₁))) x | |
106 lemma2 {x} lt = ⟪ proj1 lt , ⟪ d→∋ A (proj1 lt) , d→∋ B (proj2 lt) ⟫ ⟫ | |
107 | |
108 dist-ord : {p q r : HOD } → p ∩ ( q ∪ r ) ≡ ( p ∩ q ) ∪ ( p ∩ r ) | |
109 dist-ord {p} {q} {r} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where | |
110 lemma1 : {x : Ordinal} → odef (p ∩ (q ∪ r)) x → odef ((p ∩ q) ∪ (p ∩ r)) x | |
111 lemma1 {x} lt with proj2 lt | |
112 lemma1 {x} lt | case1 q∋x = case1 ⟪ proj1 lt , q∋x ⟫ | |
113 lemma1 {x} lt | case2 r∋x = case2 ⟪ proj1 lt , r∋x ⟫ | |
114 lemma2 : {x : Ordinal} → odef ((p ∩ q) ∪ (p ∩ r)) x → odef (p ∩ (q ∪ r)) x | |
115 lemma2 {x} (case1 p∩q) = ⟪ proj1 p∩q , case1 (proj2 p∩q ) ⟫ | |
116 lemma2 {x} (case2 p∩r) = ⟪ proj1 p∩r , case2 (proj2 p∩r ) ⟫ | |
117 | |
118 dist-ord2 : {p q r : HOD } → p ∪ ( q ∩ r ) ≡ ( p ∪ q ) ∩ ( p ∪ r ) | |
119 dist-ord2 {p} {q} {r} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where | |
120 lemma1 : {x : Ordinal} → odef (p ∪ (q ∩ r)) x → odef ((p ∪ q) ∩ (p ∪ r)) x | |
121 lemma1 {x} (case1 cp) = ⟪ case1 cp , case1 cp ⟫ | |
122 lemma1 {x} (case2 cqr) = ⟪ case2 (proj1 cqr) , case2 (proj2 cqr) ⟫ | |
123 lemma2 : {x : Ordinal} → odef ((p ∪ q) ∩ (p ∪ r)) x → odef (p ∪ (q ∩ r)) x | |
124 lemma2 {x} lt with proj1 lt | proj2 lt | |
125 lemma2 {x} lt | case1 cp | _ = case1 cp | |
126 lemma2 {x} lt | _ | case1 cp = case1 cp | |
127 lemma2 {x} lt | case2 cq | case2 cr = case2 ⟪ cq , cr ⟫ | |
128 | |
1280 | 129 record IsBooleanAlgebra {n : Level} ( L : Set n) |
130 ( _==_ : L → L → Set n ) | |
431 | 131 ( b1 : L ) |
132 ( b0 : L ) | |
133 ( -_ : L → L ) | |
134 ( _+_ : L → L → L ) | |
135 ( _x_ : L → L → L ) : Set (suc n) where | |
136 field | |
1280 | 137 +-assoc : {a b c : L } → (a + ( b + c )) == ((a + b) + c) |
138 x-assoc : {a b c : L } → (a x ( b x c )) == ((a x b) x c) | |
139 +-sym : {a b : L } → (a + b) == (b + a) | |
140 -sym : {a b : L } → (a x b) == (b x a) | |
141 +-aab : {a b : L } → (a + ( a x b )) == a | |
142 x-aab : {a b : L } → (a x ( a + b )) == a | |
143 +-dist : {a b c : L } → (a + ( b x c )) == (( a + b ) x ( a + c )) | |
144 x-dist : {a b c : L } → (a x ( b + c )) == (( a x b ) + ( a x c )) | |
145 a+0 : {a : L } → (a + b0) == a | |
146 ax1 : {a : L } → (a x b1) == a | |
147 a+-a1 : {a : L } → (a + ( - a )) == b1 | |
148 ax-a0 : {a : L } → (a x ( - a )) == b0 | |
431 | 149 |
1280 | 150 record BooleanAlgebra {n : Level} ( L : Set n) : Set (suc n) where |
431 | 151 field |
1280 | 152 _=b=_ : L → L → Set n |
431 | 153 b1 : L |
154 b0 : L | |
155 -_ : L → L | |
156 _+_ : L → L → L | |
157 _x_ : L → L → L | |
1280 | 158 isBooleanAlgebra : IsBooleanAlgebra L _=b=_ b1 b0 -_ _+_ _x_ |
159 | |
160 record PowerP (P : HOD) : Set (suc n) where | |
161 constructor ⟦_,_⟧ | |
162 field | |
163 hod : HOD | |
164 x⊆P : hod ⊆ P | |
165 | |
166 open PowerP | |
167 | |
168 HODBA : (P : HOD) → BooleanAlgebra (PowerP P) | |
169 HODBA P = record { _=b=_ = λ x y → hod x ≡ hod y ; b1 = ⟦ P , (λ x → x) ⟧ ; b0 = ⟦ od∅ , (λ x → ⊥-elim (¬x<0 x)) ⟧ | |
170 ; -_ = λ x → ⟦ P \ hod x , proj1 ⟧ | |
171 ; _+_ = λ x y → ⟦ hod x ∪ hod y , ? ⟧ ; _x_ = λ x y → ⟦ hod x ∩ hod y , (λ lt → x⊆P x (proj1 lt)) ⟧ | |
172 ; isBooleanAlgebra = record { | |
173 +-assoc = λ {a} {b} {c} → ==→o≡ record { eq→ = ? ; eq← = ? } | |
174 ; x-assoc = λ {a} {b} {c} → ==→o≡ record { eq→ = λ lt → ⟪ ⟪ proj1 lt , proj1 (proj2 lt) ⟫ , proj2 (proj2 lt) ⟫ | |
175 ; eq← = λ lt → ⟪ proj1 (proj1 lt) , ⟪ proj2 (proj1 lt) , proj2 lt ⟫ ⟫ } | |
176 ; +-sym = ? | |
177 ; -sym = λ {a} {b} → ==→o≡ record { eq→ = λ lt → ⟪ proj2 lt , proj1 lt ⟫ ; eq← = λ lt → ⟪ proj2 lt , proj1 lt ⟫ } | |
178 ; +-aab = λ {a} {b} → ==→o≡ record { eq→ = ? ; eq← = case1 } | |
179 ; x-aab = λ {a} {b} → ==→o≡ record { eq→ = proj1 ; eq← = λ ax → ⟪ ax , case1 ax ⟫ } | |
180 ; +-dist = dist-ord2 | |
181 ; x-dist = dist-ord | |
182 ; a+0 = ? | |
183 ; ax1 = ? | |
184 ; a+-a1 = ? | |
185 ; ax-a0 = ? } } | |
186 |