Mercurial > hg > Members > kono > Proof > ZF-in-agda
annotate BAlgbra.agda @ 424:cc7909f86841
remvoe TransFinifte1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 01 Aug 2020 23:37:10 +0900 |
parents | 9984cdd88da3 |
children |
rev | line source |
---|---|
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 open import Level |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 open import Ordinals |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 module BAlgbra {n : Level } (O : Ordinals {n}) where |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 open import zf |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 open import logic |
424 | 7 import OrdUtil |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 import OD |
424 | 9 import ODUtil |
276 | 10 import ODC |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 open import Relation.Nullary |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 open import Relation.Binary |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 open import Data.Empty |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 open import Relation.Binary |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 open import Relation.Binary.Core |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 open import Relation.Binary.PropositionalEquality |
422 | 18 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ; _+_ to _n+_ ) |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 open inOrdinal O |
424 | 21 open Ordinals.Ordinals O |
22 open Ordinals.IsOrdinals isOrdinal | |
23 open Ordinals.IsNext isNext | |
24 open OrdUtil O | |
25 open ODUtil O | |
26 | |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 open OD O |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 open OD.OD |
277
d9d3654baee1
seperate choice from LEM
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
276
diff
changeset
|
29 open ODAxiom odAxiom |
331 | 30 open HOD |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 open _∧_ |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 open _∨_ |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 open Bool |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 |
360 | 36 --_∩_ : ( A B : HOD ) → HOD |
37 --A ∩ B = record { od = record { def = λ x → odef A x ∧ odef B x } ; | |
38 -- odmax = omin (odmax A) (odmax B) ; <odmax = λ y → min1 (<odmax A (proj1 y)) (<odmax B (proj2 y)) } | |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 |
329 | 40 _∪_ : ( A B : HOD ) → HOD |
331 | 41 A ∪ B = record { od = record { def = λ x → odef A x ∨ odef B x } ; |
42 odmax = omax (odmax A) (odmax B) ; <odmax = lemma } where | |
43 lemma : {y : Ordinal} → odef A y ∨ odef B y → y o< omax (odmax A) (odmax B) | |
44 lemma {y} (case1 a) = ordtrans (<odmax A a) (omax-x _ _) | |
45 lemma {y} (case2 b) = ordtrans (<odmax B b) (omax-y _ _) | |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 |
329 | 47 _\_ : ( A B : HOD ) → HOD |
331 | 48 A \ B = record { od = record { def = λ x → odef A x ∧ ( ¬ ( odef B x ) ) }; odmax = odmax A ; <odmax = λ y → <odmax A (proj1 y) } |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 |
329 | 50 ∪-Union : { A B : HOD } → Union (A , B) ≡ ( A ∪ B ) |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 ∪-Union {A} {B} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where |
331 | 52 lemma1 : {x : Ordinal} → odef (Union (A , B)) x → odef (A ∪ B) x |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 lemma1 {x} lt = lemma3 lt where |
422 | 54 lemma4 : {y : Ordinal} → odef (A , B) y ∧ odef (* y) x → ¬ (¬ ( odef A x ∨ odef B x) ) |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 lemma4 {y} z with proj1 z |
422 | 56 lemma4 {y} z | case1 refl = double-neg (case1 ( subst (λ k → odef k x ) *iso (proj2 z)) ) |
57 lemma4 {y} z | case2 refl = double-neg (case2 ( subst (λ k → odef k x ) *iso (proj2 z)) ) | |
424 | 58 lemma3 : (((u : Ordinal ) → ¬ odef (A , B) u ∧ odef (* u) x) → ⊥) → odef (A ∪ B) x |
276 | 59 lemma3 not = ODC.double-neg-eilm O (FExists _ lemma4 not) -- choice |
331 | 60 lemma2 : {x : Ordinal} → odef (A ∪ B) x → odef (Union (A , B)) x |
422 | 61 lemma2 {x} (case1 A∋x) = subst (λ k → odef (Union (A , B)) k) &iso ( IsZF.union→ isZF (A , B) (* x) A |
62 ⟪ case1 refl , d→∋ A A∋x ⟫ ) | |
63 lemma2 {x} (case2 B∋x) = subst (λ k → odef (Union (A , B)) k) &iso ( IsZF.union→ isZF (A , B) (* x) B | |
64 ⟪ case2 refl , d→∋ B B∋x ⟫ ) | |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 |
376 | 66 ∩-Select : { A B : HOD } → Select A ( λ x → ( A ∋ x ) ∧ ( B ∋ x ) ) ≡ ( A ∩ B ) |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 ∩-Select {A} {B} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where |
376 | 68 lemma1 : {x : Ordinal} → odef (Select A (λ x₁ → (A ∋ x₁) ∧ (B ∋ x₁))) x → odef (A ∩ B) x |
422 | 69 lemma1 {x} lt = ⟪ proj1 lt , subst (λ k → odef B k ) &iso (proj2 (proj2 lt)) ⟫ |
376 | 70 lemma2 : {x : Ordinal} → odef (A ∩ B) x → odef (Select A (λ x₁ → (A ∋ x₁) ∧ (B ∋ x₁))) x |
422 | 71 lemma2 {x} lt = ⟪ proj1 lt , ⟪ d→∋ A (proj1 lt) , d→∋ B (proj2 lt) ⟫ ⟫ |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 |
329 | 73 dist-ord : {p q r : HOD } → p ∩ ( q ∪ r ) ≡ ( p ∩ q ) ∪ ( p ∩ r ) |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 dist-ord {p} {q} {r} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where |
331 | 75 lemma1 : {x : Ordinal} → odef (p ∩ (q ∪ r)) x → odef ((p ∩ q) ∪ (p ∩ r)) x |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 lemma1 {x} lt with proj2 lt |
422 | 77 lemma1 {x} lt | case1 q∋x = case1 ⟪ proj1 lt , q∋x ⟫ |
78 lemma1 {x} lt | case2 r∋x = case2 ⟪ proj1 lt , r∋x ⟫ | |
331 | 79 lemma2 : {x : Ordinal} → odef ((p ∩ q) ∪ (p ∩ r)) x → odef (p ∩ (q ∪ r)) x |
422 | 80 lemma2 {x} (case1 p∩q) = ⟪ proj1 p∩q , case1 (proj2 p∩q ) ⟫ |
81 lemma2 {x} (case2 p∩r) = ⟪ proj1 p∩r , case2 (proj2 p∩r ) ⟫ | |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 |
329 | 83 dist-ord2 : {p q r : HOD } → p ∪ ( q ∩ r ) ≡ ( p ∪ q ) ∩ ( p ∪ r ) |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 dist-ord2 {p} {q} {r} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where |
331 | 85 lemma1 : {x : Ordinal} → odef (p ∪ (q ∩ r)) x → odef ((p ∪ q) ∩ (p ∪ r)) x |
422 | 86 lemma1 {x} (case1 cp) = ⟪ case1 cp , case1 cp ⟫ |
87 lemma1 {x} (case2 cqr) = ⟪ case2 (proj1 cqr) , case2 (proj2 cqr) ⟫ | |
331 | 88 lemma2 : {x : Ordinal} → odef ((p ∪ q) ∩ (p ∪ r)) x → odef (p ∪ (q ∩ r)) x |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 lemma2 {x} lt with proj1 lt | proj2 lt |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 lemma2 {x} lt | case1 cp | _ = case1 cp |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 lemma2 {x} lt | _ | case1 cp = case1 cp |
422 | 92 lemma2 {x} lt | case2 cq | case2 cr = case2 ⟪ cq , cr ⟫ |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 record IsBooleanAlgebra ( L : Set n) |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 ( b1 : L ) |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 ( b0 : L ) |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
97 ( -_ : L → L ) |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
98 ( _+_ : L → L → L ) |
422 | 99 ( _x_ : L → L → L ) : Set (suc n) where |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100 field |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 +-assoc : {a b c : L } → a + ( b + c ) ≡ (a + b) + c |
422 | 102 x-assoc : {a b c : L } → a x ( b x c ) ≡ (a x b) x c |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103 +-sym : {a b : L } → a + b ≡ b + a |
422 | 104 -sym : {a b : L } → a x b ≡ b x a |
423 | 105 +-aab : {a b : L } → a + ( a x b ) ≡ a |
422 | 106 x-aab : {a b : L } → a x ( a + b ) ≡ a |
423 | 107 +-dist : {a b c : L } → a + ( b x c ) ≡ ( a x b ) + ( a x c ) |
422 | 108 x-dist : {a b c : L } → a x ( b + c ) ≡ ( a + b ) x ( a + c ) |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 a+0 : {a : L } → a + b0 ≡ a |
422 | 110 ax1 : {a : L } → a x b1 ≡ a |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 a+-a1 : {a : L } → a + ( - a ) ≡ b1 |
422 | 112 ax-a0 : {a : L } → a x ( - a ) ≡ b0 |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113 |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 record BooleanAlgebra ( L : Set n) : Set (suc n) where |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115 field |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116 b1 : L |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 b0 : L |
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118 -_ : L → L |
422 | 119 _+_ : L → L → L |
120 _x_ : L → L → L | |
121 isBooleanAlgebra : IsBooleanAlgebra L b1 b0 -_ _+_ _x_ | |
272
985a1af11bce
separate ordered pair and Boolean Algebra
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
122 |