Mercurial > hg > Members > kono > Proof > ZF-in-agda
annotate ordinal-definable.agda @ 95:f3da2c87cee0
clean up
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 08 Jun 2019 17:33:09 +0900 |
parents | 4659a815b70d |
children | f239ffc27fd0 |
rev | line source |
---|---|
16 | 1 open import Level |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
2 module ordinal-definable where |
3 | 3 |
14
e11e95d5ddee
separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
11
diff
changeset
|
4 open import zf |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
5 open import ordinal |
3 | 6 |
23 | 7 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) |
14
e11e95d5ddee
separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
11
diff
changeset
|
8 open import Relation.Binary.PropositionalEquality |
e11e95d5ddee
separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
11
diff
changeset
|
9 open import Data.Nat.Properties |
6 | 10 open import Data.Empty |
11 open import Relation.Nullary | |
12 open import Relation.Binary | |
13 open import Relation.Binary.Core | |
14 | |
27 | 15 -- Ordinal Definable Set |
11 | 16 |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
17 record OD {n : Level} : Set (suc n) where |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
18 field |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
19 def : (x : Ordinal {n} ) → Set n |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
20 |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
21 open OD |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
22 open import Data.Unit |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
23 |
44
fcac01485f32
od→lv : {n : Level} → OD {n} → Nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
24 open Ordinal |
fcac01485f32
od→lv : {n : Level} → OD {n} → Nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
25 |
43
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
26 record _==_ {n : Level} ( a b : OD {n} ) : Set n where |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
27 field |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
28 eq→ : ∀ { x : Ordinal {n} } → def a x → def b x |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
29 eq← : ∀ { x : Ordinal {n} } → def b x → def a x |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
30 |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
31 id : {n : Level} {A : Set n} → A → A |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
32 id x = x |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
33 |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
34 eq-refl : {n : Level} { x : OD {n} } → x == x |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
35 eq-refl {n} {x} = record { eq→ = id ; eq← = id } |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
36 |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
37 open _==_ |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
38 |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
39 eq-sym : {n : Level} { x y : OD {n} } → x == y → y == x |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
40 eq-sym eq = record { eq→ = eq← eq ; eq← = eq→ eq } |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
41 |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
42 eq-trans : {n : Level} { x y z : OD {n} } → x == y → y == z → x == z |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
43 eq-trans x=y y=z = record { eq→ = λ t → eq→ y=z ( eq→ x=y t) ; eq← = λ t → eq← x=y ( eq← y=z t) } |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
44 |
40 | 45 od∅ : {n : Level} → OD {n} |
46 od∅ {n} = record { def = λ _ → Lift n ⊥ } | |
47 | |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
48 postulate |
95 | 49 od→ord : {n : Level} → OD {n} → Ordinal {n} |
50 ord→od : {n : Level} → Ordinal {n} → OD {n} | |
51 c<→o< : {n : Level} {x y : OD {n} } → def y ( od→ord x ) → od→ord x o< od→ord y | |
52 o<→c< : {n : Level} {x y : Ordinal {n} } → x o< y → def (ord→od y) x | |
53 oiso : {n : Level} {x : OD {n}} → ord→od ( od→ord x ) ≡ x | |
54 diso : {n : Level} {x : Ordinal {n}} → od→ord ( ord→od x ) ≡ x | |
55 sup-o : {n : Level } → ( Ordinal {n} → Ordinal {n}) → Ordinal {n} | |
56 sup-o< : {n : Level } → ( ψ : Ordinal {n} → Ordinal {n}) → ∀ {x : Ordinal {n}} → ψ x o< sup-o ψ | |
57 | |
58 _∋_ : { n : Level } → ( a x : OD {n} ) → Set n | |
59 _∋_ {n} a x = def a ( od→ord x ) | |
60 | |
61 _c<_ : { n : Level } → ( x a : OD {n} ) → Set n | |
62 x c< a = a ∋ x | |
63 | |
64 _c≤_ : {n : Level} → OD {n} → OD {n} → Set (suc n) | |
65 a c≤ b = (a ≡ b) ∨ ( b ∋ a ) | |
66 | |
67 def-subst : {n : Level } {Z : OD {n}} {X : Ordinal {n} }{z : OD {n}} {x : Ordinal {n} }→ def Z X → Z ≡ z → X ≡ x → def z x | |
68 def-subst df refl refl = df | |
69 | |
70 sup-od : {n : Level } → ( OD {n} → OD {n}) → OD {n} | |
71 sup-od ψ = ord→od ( sup-o ( λ x → od→ord (ψ (ord→od x ))) ) | |
72 | |
73 sup-c< : {n : Level } → ( ψ : OD {n} → OD {n}) → ∀ {x : OD {n}} → def ( sup-od ψ ) (od→ord ( ψ x )) | |
74 sup-c< {n} ψ {x} = def-subst {n} {_} {_} {sup-od ψ} {od→ord ( ψ x )} | |
75 ( o<→c< ( sup-o< ( λ y → od→ord (ψ (ord→od y ))) {od→ord x } )) refl (cong ( λ k → od→ord (ψ k) ) oiso) | |
46 | 76 |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
77 ∅1 : {n : Level} → ( x : OD {n} ) → ¬ ( x c< od∅ {n} ) |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
78 ∅1 {n} x (lift ()) |
28 | 79 |
37 | 80 ∅3 : {n : Level} → { x : Ordinal {n}} → ( ∀(y : Ordinal {n}) → ¬ (y o< x ) ) → x ≡ o∅ {n} |
81 | 81 ∅3 {n} {x} = TransFinite {n} c2 c3 x where |
30
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
82 c0 : Nat → Ordinal {n} → Set n |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
83 c0 lx x = (∀(y : Ordinal {n}) → ¬ (y o< x)) → x ≡ o∅ {n} |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
84 c2 : (lx : Nat) → c0 lx (record { lv = lx ; ord = Φ lx } ) |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
85 c2 Zero not = refl |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
86 c2 (Suc lx) not with not ( record { lv = lx ; ord = Φ lx } ) |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
87 ... | t with t (case1 ≤-refl ) |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
88 c2 (Suc lx) not | t | () |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
89 c3 : (lx : Nat) (x₁ : OrdinalD lx) → c0 lx (record { lv = lx ; ord = x₁ }) → c0 lx (record { lv = lx ; ord = OSuc lx x₁ }) |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
90 c3 lx (Φ .lx) d not with not ( record { lv = lx ; ord = Φ lx } ) |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
91 ... | t with t (case2 Φ< ) |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
92 c3 lx (Φ .lx) d not | t | () |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
93 c3 lx (OSuc .lx x₁) d not with not ( record { lv = lx ; ord = OSuc lx x₁ } ) |
34 | 94 ... | t with t (case2 (s< s<refl ) ) |
30
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
95 c3 lx (OSuc .lx x₁) d not | t | () |
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
96 |
69 | 97 transitive : {n : Level } { z y x : OD {suc n} } → z ∋ y → y ∋ x → z ∋ x |
98 transitive {n} {z} {y} {x} z∋y x∋y with ordtrans ( c<→o< {suc n} {x} {y} x∋y ) ( c<→o< {suc n} {y} {z} z∋y ) | |
36 | 99 ... | t = lemma0 (lemma t) where |
95 | 100 lemma : ( od→ord x ) o< ( od→ord z ) → def ( ord→od ( od→ord z )) ( od→ord x) |
36 | 101 lemma xo<z = o<→c< xo<z |
95 | 102 lemma0 : def ( ord→od ( od→ord z )) ( od→ord x) → def z (od→ord x) |
103 lemma0 dz = def-subst {suc n} { ord→od ( od→ord z )} { od→ord x} dz (oiso) refl | |
36 | 104 |
41 | 105 record Minimumo {n : Level } (x : Ordinal {n}) : Set (suc n) where |
106 field | |
107 mino : Ordinal {n} | |
108 min<x : mino o< x | |
109 | |
57 | 110 ∅5 : {n : Level} → { x : Ordinal {n} } → ¬ ( x ≡ o∅ {n} ) → o∅ {n} o< x |
111 ∅5 {n} {record { lv = Zero ; ord = (Φ .0) }} not = ⊥-elim (not refl) | |
112 ∅5 {n} {record { lv = Zero ; ord = (OSuc .0 ord) }} not = case2 Φ< | |
113 ∅5 {n} {record { lv = (Suc lv) ; ord = ord }} not = case1 (s≤s z≤n) | |
37 | 114 |
46 | 115 ord-iso : {n : Level} {y : Ordinal {n} } → record { lv = lv (od→ord (ord→od y)) ; ord = ord (od→ord (ord→od y)) } ≡ record { lv = lv y ; ord = ord y } |
116 ord-iso = cong ( λ k → record { lv = lv k ; ord = ord k } ) diso | |
44
fcac01485f32
od→lv : {n : Level} → OD {n} → Nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
117 |
51 | 118 -- avoiding lv != Zero error |
119 orefl : {n : Level} → { x : OD {n} } → { y : Ordinal {n} } → od→ord x ≡ y → od→ord x ≡ y | |
120 orefl refl = refl | |
121 | |
122 ==-iso : {n : Level} → { x y : OD {n} } → ord→od (od→ord x) == ord→od (od→ord y) → x == y | |
123 ==-iso {n} {x} {y} eq = record { | |
124 eq→ = λ d → lemma ( eq→ eq (def-subst d (sym oiso) refl )) ; | |
125 eq← = λ d → lemma ( eq← eq (def-subst d (sym oiso) refl )) } | |
126 where | |
127 lemma : {x : OD {n} } {z : Ordinal {n}} → def (ord→od (od→ord x)) z → def x z | |
128 lemma {x} {z} d = def-subst d oiso refl | |
129 | |
57 | 130 =-iso : {n : Level } {x y : OD {suc n} } → (x == y) ≡ (ord→od (od→ord x) == y) |
131 =-iso {_} {_} {y} = cong ( λ k → k == y ) (sym oiso) | |
132 | |
51 | 133 ord→== : {n : Level} → { x y : OD {n} } → od→ord x ≡ od→ord y → x == y |
134 ord→== {n} {x} {y} eq = ==-iso (lemma (od→ord x) (od→ord y) (orefl eq)) where | |
135 lemma : ( ox oy : Ordinal {n} ) → ox ≡ oy → (ord→od ox) == (ord→od oy) | |
136 lemma ox ox refl = eq-refl | |
137 | |
138 o≡→== : {n : Level} → { x y : Ordinal {n} } → x ≡ y → ord→od x == ord→od y | |
139 o≡→== {n} {x} {.x} refl = eq-refl | |
140 | |
141 >→¬< : {x y : Nat } → (x < y ) → ¬ ( y < x ) | |
142 >→¬< (s≤s x<y) (s≤s y<x) = >→¬< x<y y<x | |
143 | |
144 c≤-refl : {n : Level} → ( x : OD {n} ) → x c≤ x | |
145 c≤-refl x = case1 refl | |
146 | |
54 | 147 o<→o> : {n : Level} → { x y : OD {n} } → (x == y) → (od→ord x ) o< ( od→ord y) → ⊥ |
52 | 148 o<→o> {n} {x} {y} record { eq→ = xy ; eq← = yx } (case1 lt) with |
95 | 149 yx (def-subst {n} {ord→od (od→ord y)} {od→ord x} (o<→c< (case1 lt )) oiso refl ) |
52 | 150 ... | oyx with o<¬≡ (od→ord x) (od→ord x) refl (c<→o< oyx ) |
151 ... | () | |
152 o<→o> {n} {x} {y} record { eq→ = xy ; eq← = yx } (case2 lt) with | |
95 | 153 yx (def-subst {n} {ord→od (od→ord y)} {od→ord x} (o<→c< (case2 lt )) oiso refl ) |
52 | 154 ... | oyx with o<¬≡ (od→ord x) (od→ord x) refl (c<→o< oyx ) |
155 ... | () | |
156 | |
79 | 157 ==→o≡ : {n : Level} → { x y : Ordinal {suc n} } → ord→od x == ord→od y → x ≡ y |
158 ==→o≡ {n} {x} {y} eq with trio< {n} x y | |
159 ==→o≡ {n} {x} {y} eq | tri< a ¬b ¬c = ⊥-elim ( o<→o> eq (o<-subst a (sym ord-iso) (sym ord-iso ))) | |
160 ==→o≡ {n} {x} {y} eq | tri≈ ¬a b ¬c = b | |
161 ==→o≡ {n} {x} {y} eq | tri> ¬a ¬b c = ⊥-elim ( o<→o> (eq-sym eq) (o<-subst c (sym ord-iso) (sym ord-iso ))) | |
162 | |
90 | 163 ≡-def : {n : Level} → { x : Ordinal {suc n} } → x ≡ od→ord (record { def = λ z → z o< x } ) |
164 ≡-def {n} {x} = ==→o≡ {n} (subst (λ k → ord→od x == k ) (sym oiso) lemma ) where | |
165 lemma : ord→od x == record { def = λ z → z o< x } | |
95 | 166 eq→ lemma {w} z = subst₂ (λ k j → k o< j ) diso refl (subst (λ k → (od→ord ( ord→od w)) o< k ) diso t ) where |
167 t : (od→ord ( ord→od w)) o< (od→ord (ord→od x)) | |
168 t = c<→o< {suc n} {ord→od w} {ord→od x} (def-subst {suc n} {_} {_} {ord→od x} {_} z refl (sym diso)) | |
169 eq← lemma {w} z = def-subst {suc n} {_} {_} {ord→od x} {w} ( o<→c< {suc n} {_} {_} z ) refl refl | |
90 | 170 |
171 od≡-def : {n : Level} → { x : Ordinal {suc n} } → ord→od x ≡ record { def = λ z → z o< x } | |
172 od≡-def {n} {x} = subst (λ k → ord→od x ≡ k ) oiso (cong ( λ k → ord→od k ) (≡-def {n} {x} )) | |
173 | |
91 | 174 ∋→o< : {n : Level} → { a x : OD {suc n} } → a ∋ x → od→ord x o< od→ord a |
175 ∋→o< {n} {a} {x} lt = t where | |
176 t : (od→ord x) o< (od→ord a) | |
177 t = c<→o< {suc n} {x} {a} lt | |
178 | |
179 o<∋→ : {n : Level} → { a x : OD {suc n} } → od→ord x o< od→ord a → a ∋ x | |
95 | 180 o<∋→ {n} {a} {x} lt = subst₂ (λ k j → def k j ) oiso refl t where |
181 t : def (ord→od (od→ord a)) (od→ord x) | |
91 | 182 t = o<→c< {suc n} {od→ord x} {od→ord a} lt |
183 | |
80 | 184 o∅≡od∅ : {n : Level} → ord→od (o∅ {suc n}) ≡ od∅ {suc n} |
185 o∅≡od∅ {n} with trio< {n} (o∅ {suc n}) (od→ord (od∅ {suc n} )) | |
186 o∅≡od∅ {n} | tri< a ¬b ¬c = ⊥-elim (lemma a) where | |
187 lemma : o∅ {suc n } o< (od→ord (od∅ {suc n} )) → ⊥ | |
188 lemma lt with def-subst (o<→c< lt) oiso refl | |
189 lemma lt | lift () | |
190 o∅≡od∅ {n} | tri≈ ¬a b ¬c = trans (cong (λ k → ord→od k ) b ) oiso | |
191 o∅≡od∅ {n} | tri> ¬a ¬b c = ⊥-elim (¬x<0 c) | |
192 | |
51 | 193 o<→¬== : {n : Level} → { x y : OD {n} } → (od→ord x ) o< ( od→ord y) → ¬ (x == y ) |
52 | 194 o<→¬== {n} {x} {y} lt eq = o<→o> eq lt |
51 | 195 |
196 o<→¬c> : {n : Level} → { x y : OD {n} } → (od→ord x ) o< ( od→ord y) → ¬ (y c< x ) | |
81 | 197 o<→¬c> {n} {x} {y} olt clt = o<> olt (c<→o< clt ) where |
51 | 198 |
199 o≡→¬c< : {n : Level} → { x y : OD {n} } → (od→ord x ) ≡ ( od→ord y) → ¬ x c< y | |
200 o≡→¬c< {n} {x} {y} oeq lt = o<¬≡ (od→ord x) (od→ord y) (orefl oeq ) (c<→o< lt) | |
201 | |
202 tri-c< : {n : Level} → Trichotomous _==_ (_c<_ {suc n}) | |
203 tri-c< {n} x y with trio< {n} (od→ord x) (od→ord y) | |
95 | 204 tri-c< {n} x y | tri< a ¬b ¬c = tri< (def-subst (o<→c< a) oiso refl) (o<→¬== a) ( o<→¬c> a ) |
51 | 205 tri-c< {n} x y | tri≈ ¬a b ¬c = tri≈ (o≡→¬c< b) (ord→== b) (o≡→¬c< (sym b)) |
95 | 206 tri-c< {n} x y | tri> ¬a ¬b c = tri> ( o<→¬c> c) (λ eq → o<→¬== c (eq-sym eq ) ) (def-subst (o<→c< c) oiso refl) |
51 | 207 |
54 | 208 c<> : {n : Level } { x y : OD {suc n}} → x c< y → y c< x → ⊥ |
209 c<> {n} {x} {y} x<y y<x with tri-c< x y | |
210 c<> {n} {x} {y} x<y y<x | tri< a ¬b ¬c = ¬c y<x | |
211 c<> {n} {x} {y} x<y y<x | tri≈ ¬a b ¬c = o<→o> b ( c<→o< x<y ) | |
212 c<> {n} {x} {y} x<y y<x | tri> ¬a ¬b c = ¬a x<y | |
213 | |
60 | 214 ∅< : {n : Level} → { x y : OD {n} } → def x (od→ord y ) → ¬ ( x == od∅ {n} ) |
215 ∅< {n} {x} {y} d eq with eq→ eq d | |
216 ∅< {n} {x} {y} d eq | lift () | |
57 | 217 |
78
9a7a64b2388c
infinite and replacement begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
77
diff
changeset
|
218 ∅6 : {n : Level} → { x : OD {suc n} } → ¬ ( x ∋ x ) -- no Russel paradox |
9a7a64b2388c
infinite and replacement begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
77
diff
changeset
|
219 ∅6 {n} {x} x∋x = c<> {n} {x} {x} x∋x x∋x |
51 | 220 |
76 | 221 def-iso : {n : Level} {A B : OD {n}} {x y : Ordinal {n}} → x ≡ y → (def A y → def B y) → def A x → def B x |
222 def-iso refl t = t | |
223 | |
53 | 224 is-∋ : {n : Level} → ( x y : OD {suc n} ) → Dec ( x ∋ y ) |
225 is-∋ {n} x y with tri-c< x y | |
226 is-∋ {n} x y | tri< a ¬b ¬c = no ¬c | |
227 is-∋ {n} x y | tri≈ ¬a b ¬c = no ¬c | |
228 is-∋ {n} x y | tri> ¬a ¬b c = yes c | |
229 | |
57 | 230 is-o∅ : {n : Level} → ( x : Ordinal {suc n} ) → Dec ( x ≡ o∅ {suc n} ) |
231 is-o∅ {n} record { lv = Zero ; ord = (Φ .0) } = yes refl | |
232 is-o∅ {n} record { lv = Zero ; ord = (OSuc .0 ord₁) } = no ( λ () ) | |
233 is-o∅ {n} record { lv = (Suc lv₁) ; ord = ord } = no (λ()) | |
234 | |
45
33860eb44e47
od∅' {n} = ord→od (o∅ {n})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
235 open _∧_ |
33860eb44e47
od∅' {n} = ord→od (o∅ {n})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
236 |
66 | 237 ¬∅=→∅∈ : {n : Level} → { x : OD {suc n} } → ¬ ( x == od∅ {suc n} ) → x ∋ od∅ {suc n} |
238 ¬∅=→∅∈ {n} {x} ne = def-subst (lemma (od→ord x) (subst (λ k → ¬ (k == od∅ {suc n} )) (sym oiso) ne )) oiso refl where | |
239 lemma : (ox : Ordinal {suc n}) → ¬ (ord→od ox == od∅ {suc n} ) → ord→od ox ∋ od∅ {suc n} | |
240 lemma ox ne with is-o∅ ox | |
241 lemma ox ne | yes refl with ne ( ord→== lemma1 ) where | |
242 lemma1 : od→ord (ord→od o∅) ≡ od→ord od∅ | |
80 | 243 lemma1 = cong ( λ k → od→ord k ) o∅≡od∅ |
66 | 244 lemma o∅ ne | yes refl | () |
95 | 245 lemma ox ne | no ¬p = subst ( λ k → def (ord→od ox) (od→ord k) ) o∅≡od∅ (o<→c< (subst (λ k → k o< ox ) (sym diso) (∅5 ¬p)) ) |
69 | 246 |
79 | 247 -- open import Relation.Binary.HeterogeneousEquality as HE using (_≅_ ) |
94 | 248 -- postulate f-extensionality : { n : Level} → Relation.Binary.PropositionalEquality.Extensionality (suc n) (suc (suc n)) |
59
d13d1351a1fa
lemma = cong₂ (λ x not → minimul x not ) oiso { }6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
249 |
95 | 250 Def : {n : Level} → OD {suc n} → OD {suc n} |
251 Def {n} X = record { def = λ y → ∀ (x : Ordinal {suc n} ) → def X x → def (ord→od y) x } | |
89 | 252 |
253 | |
54 | 254 OD→ZF : {n : Level} → ZF {suc (suc n)} {suc n} |
40 | 255 OD→ZF {n} = record { |
54 | 256 ZFSet = OD {suc n} |
43
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
257 ; _∋_ = _∋_ |
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
258 ; _≈_ = _==_ |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
259 ; ∅ = od∅ |
28 | 260 ; _,_ = _,_ |
261 ; Union = Union | |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
262 ; Power = Power |
28 | 263 ; Select = Select |
264 ; Replace = Replace | |
81 | 265 ; infinite = ord→od ( record { lv = Suc Zero ; ord = Φ 1 } ) |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
266 ; isZF = isZF |
28 | 267 } where |
54 | 268 Replace : OD {suc n} → (OD {suc n} → OD {suc n} ) → OD {suc n} |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
269 Replace X ψ = sup-od ψ |
54 | 270 Select : OD {suc n} → (OD {suc n} → Set (suc n) ) → OD {suc n} |
271 Select X ψ = record { def = λ x → ( def X x ∧ ψ ( ord→od x )) } | |
272 _,_ : OD {suc n} → OD {suc n} → OD {suc n} | |
84 | 273 x , y = record { def = λ z → z o< (omax (od→ord x) (od→ord y)) } |
54 | 274 Union : OD {suc n} → OD {suc n} |
71
d088eb66564e
add osuc ( next larger element of Ordinal )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
70
diff
changeset
|
275 Union U = record { def = λ y → osuc y o< (od→ord U) } |
77 | 276 -- power : ∀ X ∃ A ∀ t ( t ∈ A ↔ ( ∀ {x} → t ∋ x → X ∋ x ) |
54 | 277 Power : OD {suc n} → OD {suc n} |
94 | 278 Power X = record { def = λ y → ∀ (x : Ordinal {suc n} ) → def (ord→od y) x → def X x } |
54 | 279 ZFSet = OD {suc n} |
280 _∈_ : ( A B : ZFSet ) → Set (suc n) | |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
281 A ∈ B = B ∋ A |
54 | 282 _⊆_ : ( A B : ZFSet ) → ∀{ x : ZFSet } → Set (suc n) |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
283 _⊆_ A B {x} = A ∋ x → B ∋ x |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
284 _∩_ : ( A B : ZFSet ) → ZFSet |
43
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
285 A ∩ B = Select (A , B) ( λ x → ( A ∋ x ) ∧ (B ∋ x) ) |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
286 _∪_ : ( A B : ZFSet ) → ZFSet |
43
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
287 A ∪ B = Select (A , B) ( λ x → (A ∋ x) ∨ ( B ∋ x ) ) |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
288 infixr 200 _∈_ |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
289 infixr 230 _∩_ _∪_ |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
290 infixr 220 _⊆_ |
81 | 291 isZF : IsZF (OD {suc n}) _∋_ _==_ od∅ _,_ Union Power Select Replace (ord→od ( record { lv = Suc Zero ; ord = Φ 1} )) |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
292 isZF = record { |
43
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
293 isEquivalence = record { refl = eq-refl ; sym = eq-sym; trans = eq-trans } |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
294 ; pair = pair |
72 | 295 ; union-u = union-u |
296 ; union→ = union→ | |
297 ; union← = union← | |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
298 ; empty = empty |
76 | 299 ; power→ = power→ |
300 ; power← = power← | |
301 ; extensionality = extensionality | |
30
3b0fdb95618e
problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
29
diff
changeset
|
302 ; minimul = minimul |
51 | 303 ; regularity = regularity |
78
9a7a64b2388c
infinite and replacement begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
77
diff
changeset
|
304 ; infinity∅ = infinity∅ |
93 | 305 ; infinity = λ _ → infinity |
55
9c0a5e28a572
regurality elimination case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
306 ; selection = λ {ψ} {X} {y} → selection {ψ} {X} {y} |
93 | 307 ; replacement = replacement |
29
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
308 } where |
fce60b99dc55
posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
309 open _∧_ |
41 | 310 open Minimumo |
54 | 311 pair : (A B : OD {suc n} ) → ((A , B) ∋ A) ∧ ((A , B) ∋ B) |
87 | 312 proj1 (pair A B ) = omax-x {n} (od→ord A) (od→ord B) |
313 proj2 (pair A B ) = omax-y {n} (od→ord A) (od→ord B) | |
54 | 314 empty : (x : OD {suc n} ) → ¬ (od∅ ∋ x) |
43
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
315 empty x () |
94 | 316 --- Power X = record { def = λ t → ∀ (x : Ordinal {suc n} ) → def (ord→od t) x → def X x } |
76 | 317 power→ : (A t : OD) → Power A ∋ t → {x : OD} → t ∋ x → A ∋ x |
95 | 318 power→ A t P∋t {x} t∋x = {!!} |
77 | 319 power← : (A t : OD) → ({x : OD} → (t ∋ x → A ∋ x)) → Power A ∋ t |
95 | 320 power← A t t→A z _ = {!!} |
70 | 321 union-u : (X z : OD {suc n}) → Union X ∋ z → OD {suc n} |
72 | 322 union-u X z U>z = ord→od ( osuc ( od→ord z ) ) |
323 union-lemma-u : {X z : OD {suc n}} → (U>z : Union X ∋ z ) → union-u X z U>z ∋ z | |
324 union-lemma-u {X} {z} U>z = lemma <-osuc where | |
325 lemma : {oz ooz : Ordinal {suc n}} → oz o< ooz → def (ord→od ooz) oz | |
95 | 326 lemma {oz} {ooz} lt = def-subst {suc n} {ord→od ooz} (o<→c< lt) refl refl |
73 | 327 union→ : (X z u : OD) → (X ∋ u) ∧ (u ∋ z) → Union X ∋ z |
72 | 328 union→ X y u xx with trio< ( od→ord u ) ( osuc ( od→ord y )) |
74
819da8c08f05
ordinal atomical successor?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
329 union→ X y u xx | tri< a ¬b ¬c with osuc-< a (c<→o< (proj2 xx)) |
819da8c08f05
ordinal atomical successor?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
330 union→ X y u xx | tri< a ¬b ¬c | () |
73 | 331 union→ X y u xx | tri≈ ¬a b ¬c = lemma b (c<→o< (proj1 xx )) where |
332 lemma : {oX ou ooy : Ordinal {suc n}} → ou ≡ ooy → ou o< oX → ooy o< oX | |
333 lemma refl lt = lt | |
334 union→ X y u xx | tri> ¬a ¬b c = ordtrans {suc n} {osuc ( od→ord y )} {od→ord u} {od→ord X} c ( c<→o< (proj1 xx )) | |
72 | 335 union← : (X z : OD) (X∋z : Union X ∋ z) → (X ∋ union-u X z X∋z) ∧ (union-u X z X∋z ∋ z ) |
95 | 336 union← X z X∋z = record { proj1 = def-subst {suc n} {_} {_} {X} {od→ord (union-u X z X∋z)} (o<→c< X∋z) oiso (sym diso) ; proj2 = union-lemma-u X∋z } |
54 | 337 ψiso : {ψ : OD {suc n} → Set (suc n)} {x y : OD {suc n}} → ψ x → x ≡ y → ψ y |
338 ψiso {ψ} t refl = t | |
339 selection : {ψ : OD → Set (suc n)} {X y : OD} → ((X ∋ y) ∧ ψ y) ⇔ (Select X ψ ∋ y) | |
340 selection {ψ} {X} {y} = record { | |
341 proj1 = λ cond → record { proj1 = proj1 cond ; proj2 = ψiso {ψ} (proj2 cond) (sym oiso) } | |
342 ; proj2 = λ select → record { proj1 = proj1 select ; proj2 = ψiso {ψ} (proj2 select) oiso } | |
343 } | |
93 | 344 replacement : {ψ : OD → OD} (X x : OD) → Replace X ψ ∋ ψ x |
345 replacement {ψ} X x = sup-c< ψ {x} | |
60 | 346 ∅-iso : {x : OD} → ¬ (x == od∅) → ¬ ((ord→od (od→ord x)) == od∅) |
347 ∅-iso {x} neq = subst (λ k → ¬ k) (=-iso {n} ) neq | |
54 | 348 minimul : (x : OD {suc n} ) → ¬ (x == od∅ )→ OD {suc n} |
68 | 349 minimul x not = od∅ |
57 | 350 regularity : (x : OD) (not : ¬ (x == od∅)) → |
351 (x ∋ minimul x not) ∧ (Select (minimul x not) (λ x₁ → (minimul x not ∋ x₁) ∧ (x ∋ x₁)) == od∅) | |
66 | 352 proj1 (regularity x not ) = ¬∅=→∅∈ not |
353 proj2 (regularity x not ) = record { eq→ = reg ; eq← = λ () } where | |
354 reg : {y : Ordinal} → def (Select (minimul x not) (λ x₂ → (minimul x not ∋ x₂) ∧ (x ∋ x₂))) y → def od∅ y | |
355 reg {y} t with proj1 t | |
356 ... | x∈∅ = x∈∅ | |
76 | 357 extensionality : {A B : OD {suc n}} → ((z : OD) → (A ∋ z) ⇔ (B ∋ z)) → A == B |
358 eq→ (extensionality {A} {B} eq ) {x} d = def-iso {suc n} {A} {B} (sym diso) (proj1 (eq (ord→od x))) d | |
359 eq← (extensionality {A} {B} eq ) {x} d = def-iso {suc n} {B} {A} (sym diso) (proj2 (eq (ord→od x))) d | |
89 | 360 xx-union : {x : OD {suc n}} → (x , x) ≡ record { def = λ z → z o< osuc (od→ord x) } |
361 xx-union {x} = cong ( λ k → record { def = λ z → z o< k } ) (omxx (od→ord x)) | |
362 xxx-union : {x : OD {suc n}} → (x , (x , x)) ≡ record { def = λ z → z o< osuc (osuc (od→ord x))} | |
363 xxx-union {x} = cong ( λ k → record { def = λ z → z o< k } ) lemma where | |
91 | 364 lemma1 : {x : OD {suc n}} → od→ord x o< od→ord (x , x) |
365 lemma1 {x} = c<→o< ( proj1 (pair x x ) ) | |
366 lemma2 : {x : OD {suc n}} → od→ord (x , x) ≡ osuc (od→ord x) | |
367 lemma2 = trans ( cong ( λ k → od→ord k ) xx-union ) (sym ≡-def) | |
89 | 368 lemma : {x : OD {suc n}} → omax (od→ord x) (od→ord (x , x)) ≡ osuc (osuc (od→ord x)) |
91 | 369 lemma {x} = trans ( sym ( omax< (od→ord x) (od→ord (x , x)) lemma1 ) ) ( cong ( λ k → osuc k ) lemma2 ) |
90 | 370 uxxx-union : {x : OD {suc n}} → Union (x , (x , x)) ≡ record { def = λ z → osuc z o< osuc (osuc (od→ord x)) } |
371 uxxx-union {x} = cong ( λ k → record { def = λ z → osuc z o< k } ) lemma where | |
372 lemma : od→ord (x , (x , x)) ≡ osuc (osuc (od→ord x)) | |
91 | 373 lemma = trans ( cong ( λ k → od→ord k ) xxx-union ) (sym ≡-def ) |
374 uxxx-2 : {x : OD {suc n}} → record { def = λ z → osuc z o< osuc (osuc (od→ord x)) } == record { def = λ z → z o< osuc (od→ord x) } | |
375 eq→ ( uxxx-2 {x} ) {m} lt = proj1 (osuc2 m (od→ord x)) lt | |
376 eq← ( uxxx-2 {x} ) {m} lt = proj2 (osuc2 m (od→ord x)) lt | |
377 uxxx-ord : {x : OD {suc n}} → od→ord (Union (x , (x , x))) ≡ osuc (od→ord x) | |
378 uxxx-ord {x} = trans (cong (λ k → od→ord k ) uxxx-union) (==→o≡ (subst₂ (λ j k → j == k ) (sym oiso) (sym od≡-def ) uxxx-2 )) | |
379 omega = record { lv = Suc Zero ; ord = Φ 1 } | |
78
9a7a64b2388c
infinite and replacement begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
77
diff
changeset
|
380 infinite : OD {suc n} |
91 | 381 infinite = ord→od ( omega ) |
382 infinity∅ : ord→od ( omega ) ∋ od∅ {suc n} | |
95 | 383 infinity∅ = def-subst {suc n} {_} {o∅} {infinite} {od→ord od∅} |
384 (o<→c< ( case1 (s≤s z≤n ))) refl (subst ( λ k → ( k ≡ od→ord od∅ )) diso (cong (λ k → od→ord k) o∅≡od∅ )) | |
91 | 385 infinite∋x : (x : OD) → infinite ∋ x → od→ord x o< omega |
386 infinite∋x x lt = subst (λ k → od→ord x o< k ) diso t where | |
387 t : od→ord x o< od→ord (ord→od (omega)) | |
388 t = ∋→o< {n} {infinite} {x} lt | |
389 infinite∋uxxx : (x : OD) → osuc (od→ord x) o< omega → infinite ∋ Union (x , (x , x )) | |
390 infinite∋uxxx x lt = o<∋→ t where | |
391 t : od→ord (Union (x , (x , x))) o< od→ord (ord→od (omega)) | |
392 t = subst (λ k → od→ord (Union (x , (x , x))) o< k ) (sym diso ) ( subst ( λ k → k o< omega ) ( sym (uxxx-ord {x} ) ) lt ) | |
78
9a7a64b2388c
infinite and replacement begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
77
diff
changeset
|
393 infinity : (x : OD) → infinite ∋ x → infinite ∋ Union (x , (x , x )) |
91 | 394 infinity x lt = infinite∋uxxx x ( lemma (od→ord x) (infinite∋x x lt )) where |
395 lemma : (ox : Ordinal {suc n} ) → ox o< omega → osuc ox o< omega | |
396 lemma record { lv = Zero ; ord = (Φ .0) } (case1 (s≤s x)) = case1 (s≤s z≤n) | |
397 lemma record { lv = Zero ; ord = (OSuc .0 ord₁) } (case1 (s≤s x)) = case1 (s≤s z≤n) | |
398 lemma record { lv = (Suc lv₁) ; ord = (Φ .(Suc lv₁)) } (case1 (s≤s ())) | |
399 lemma record { lv = (Suc lv₁) ; ord = (OSuc .(Suc lv₁) ord₁) } (case1 (s≤s ())) | |
400 lemma record { lv = 1 ; ord = (Φ 1) } (case2 c2) with d<→lv c2 | |
401 lemma record { lv = (Suc Zero) ; ord = (Φ .1) } (case2 ()) | refl | |
78
9a7a64b2388c
infinite and replacement begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
77
diff
changeset
|
402 |