1091
|
1 {-# OPTIONS --allow-unsolved-metas #-}
|
431
|
2 open import Level
|
|
3 open import Ordinals
|
|
4 module OD {n : Level } (O : Ordinals {n} ) where
|
|
5
|
|
6 open import zf
|
1091
|
7 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ )
|
431
|
8 open import Relation.Binary.PropositionalEquality hiding ( [_] )
|
1091
|
9 open import Data.Nat.Properties
|
431
|
10 open import Data.Empty
|
1175
|
11 open import Data.Unit
|
431
|
12 open import Relation.Nullary
|
|
13 open import Relation.Binary hiding (_⇔_)
|
|
14 open import Relation.Binary.Core hiding (_⇔_)
|
|
15
|
|
16 open import logic
|
|
17 import OrdUtil
|
|
18 open import nat
|
|
19
|
|
20 open Ordinals.Ordinals O
|
1091
|
21 open Ordinals.IsOrdinals isOrdinal
|
|
22 open Ordinals.IsNext isNext
|
431
|
23 open OrdUtil O
|
|
24
|
|
25 -- Ordinal Definable Set
|
|
26
|
|
27 record OD : Set (suc n ) where
|
|
28 field
|
|
29 def : (x : Ordinal ) → Set n
|
|
30
|
|
31 open OD
|
|
32
|
|
33 open _∧_
|
|
34 open _∨_
|
|
35 open Bool
|
|
36
|
|
37 record _==_ ( a b : OD ) : Set n where
|
|
38 field
|
1091
|
39 eq→ : ∀ { x : Ordinal } → def a x → def b x
|
|
40 eq← : ∀ { x : Ordinal } → def b x → def a x
|
431
|
41
|
|
42 ==-refl : { x : OD } → x == x
|
|
43 ==-refl {x} = record { eq→ = λ x → x ; eq← = λ x → x }
|
|
44
|
1091
|
45 open _==_
|
431
|
46
|
|
47 ==-trans : { x y z : OD } → x == y → y == z → x == z
|
|
48 ==-trans x=y y=z = record { eq→ = λ {m} t → eq→ y=z (eq→ x=y t) ; eq← = λ {m} t → eq← x=y (eq← y=z t) }
|
|
49
|
1091
|
50 ==-sym : { x y : OD } → x == y → y == x
|
431
|
51 ==-sym x=y = record { eq→ = λ {m} t → eq← x=y t ; eq← = λ {m} t → eq→ x=y t }
|
|
52
|
|
53
|
1091
|
54 ⇔→== : { x y : OD } → ( {z : Ordinal } → (def x z ⇔ def y z)) → x == y
|
|
55 eq→ ( ⇔→== {x} {y} eq ) {z} m = proj1 eq m
|
|
56 eq← ( ⇔→== {x} {y} eq ) {z} m = proj2 eq m
|
431
|
57
|
|
58 -- next assumptions are our axiom
|
|
59 --
|
|
60 -- OD is an equation on Ordinals, so it contains Ordinals. If these Ordinals have one-to-one
|
|
61 -- correspondence to the OD then the OD looks like a ZF Set.
|
|
62 --
|
|
63 -- If all ZF Set have supreme upper bound, the solutions of OD have to be bounded, i.e.
|
|
64 -- bbounded ODs are ZF Set. Unbounded ODs are classes.
|
|
65 --
|
1091
|
66 -- In classical Set Theory, HOD is used, as a subset of OD,
|
431
|
67 -- HOD = { x | TC x ⊆ OD }
|
|
68 -- where TC x is a transitive clusure of x, i.e. Union of all elemnts of all subset of x.
|
|
69 -- This is not possible because we don't have V yet. So we assumes HODs are bounded OD.
|
|
70 --
|
|
71 -- We also assumes HODs are isomorphic to Ordinals, which is ususally proved by Goedel number tricks.
|
|
72 -- There two contraints on the HOD order, one is ∋, the other one is ⊂.
|
|
73 -- ODs have an ovbious maximum, but Ordinals are not, but HOD has no maximum because there is an aribtrary
|
|
74 -- bound on each HOD.
|
|
75 --
|
|
76 -- In classical Set Theory, sup is defined by Uion, since we are working on constructive logic,
|
|
77 -- we need explict assumption on sup.
|
|
78 --
|
|
79 -- ==→o≡ is necessary to prove axiom of extensionality.
|
|
80
|
|
81 -- Ordinals in OD , the maximum
|
|
82 Ords : OD
|
1175
|
83 Ords = record { def = λ x → Lift n ⊤ }
|
431
|
84
|
|
85 record HOD : Set (suc n) where
|
|
86 field
|
|
87 od : OD
|
|
88 odmax : Ordinal
|
|
89 <odmax : {y : Ordinal} → def od y → y o< odmax
|
|
90
|
|
91 open HOD
|
|
92
|
1218
|
93 open import Relation.Binary.HeterogeneousEquality as HE using (_≅_ )
|
|
94
|
1091
|
95 record ODAxiom : Set (suc n) where
|
431
|
96 field
|
|
97 -- HOD is isomorphic to Ordinal (by means of Goedel number)
|
1091
|
98 & : HOD → Ordinal
|
|
99 * : Ordinal → HOD
|
431
|
100 c<→o< : {x y : HOD } → def (od y) ( & x ) → & x o< & y
|
|
101 ⊆→o≤ : {y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → & y o< osuc (& z)
|
|
102 *iso : {x : HOD } → * ( & x ) ≡ x
|
|
103 &iso : {x : Ordinal } → & ( * x ) ≡ x
|
|
104 ==→o≡ : {x y : HOD } → (od x == od y) → x ≡ y
|
1097
|
105 sup-o : (A : HOD) → ( ( x : Ordinal ) → def (od A) x → Ordinal ) → Ordinal -- required in Replace
|
1091
|
106 sup-o≤ : (A : HOD) → { ψ : ( x : Ordinal ) → def (od A) x → Ordinal } → ∀ {x : Ordinal } → (lt : def (od A) x ) → ψ x lt o≤ sup-o A ψ
|
1218
|
107 ∋-irr : {X : HOD} {x : Ordinal } → (a b : def (od X) x) → a ≅ b
|
1097
|
108 -- possible order restriction (required in the axiom of infinite )
|
431
|
109 ho< : {x : HOD} → & x o< next (odmax x)
|
|
110
|
|
111 postulate odAxiom : ODAxiom
|
|
112 open ODAxiom odAxiom
|
|
113
|
|
114 -- odmax minimality
|
|
115 --
|
|
116 -- since we have ==→o≡ , so odmax have to be unique. We should have odmaxmin in HOD.
|
|
117 -- We can calculate the minimum using sup but it is tedius.
|
1091
|
118 -- Only Select has non minimum odmax.
|
431
|
119 -- We have the same problem on 'def' itself, but we leave it.
|
|
120
|
|
121 odmaxmin : Set (suc n)
|
|
122 odmaxmin = (y : HOD) (z : Ordinal) → ((x : Ordinal)→ def (od y) x → x o< z) → odmax y o< osuc z
|
|
123
|
|
124 -- OD ⇔ Ordinal leads a contradiction, so we need bounded HOD
|
|
125 ¬OD-order : ( & : OD → Ordinal ) → ( * : Ordinal → OD ) → ( { x y : OD } → def y ( & x ) → & x o< & y) → ⊥
|
1175
|
126 ¬OD-order & * c<→o< = o≤> <-osuc (c<→o< {Ords} (lift tt) )
|
431
|
127
|
|
128 -- Ordinal in OD ( and ZFSet ) Transitive Set
|
1091
|
129 Ord : ( a : Ordinal ) → HOD
|
431
|
130 Ord a = record { od = record { def = λ y → y o< a } ; odmax = a ; <odmax = lemma } where
|
|
131 lemma : {x : Ordinal} → x o< a → x o< a
|
|
132 lemma {x} lt = lt
|
|
133
|
1091
|
134 od∅ : HOD
|
|
135 od∅ = Ord o∅
|
431
|
136
|
|
137 odef : HOD → Ordinal → Set n
|
|
138 odef A x = def ( od A ) x
|
|
139
|
|
140 _∋_ : ( a x : HOD ) → Set n
|
|
141 _∋_ a x = odef a ( & x )
|
|
142
|
|
143 -- _c<_ : ( x a : HOD ) → Set n
|
1091
|
144 -- x c< a = a ∋ x
|
431
|
145
|
|
146 d→∋ : ( a : HOD ) { x : Ordinal} → odef a x → a ∋ (* x)
|
|
147 d→∋ a lt = subst (λ k → odef a k ) (sym &iso) lt
|
|
148
|
|
149 -- odef-subst : {Z : HOD } {X : Ordinal }{z : HOD } {x : Ordinal }→ odef Z X → Z ≡ z → X ≡ x → odef z x
|
|
150 -- odef-subst df refl refl = df
|
|
151
|
|
152 otrans : {a x y : Ordinal } → odef (Ord a) x → odef (Ord x) y → odef (Ord a) y
|
|
153 otrans x<a y<x = ordtrans y<x x<a
|
|
154
|
|
155 -- If we have reverse of c<→o<, everything becomes Ordinal
|
|
156 ∈→c<→HOD=Ord : ( o<→c< : {x y : Ordinal } → x o< y → odef (* y) x ) → {x : HOD } → x ≡ Ord (& x)
|
|
157 ∈→c<→HOD=Ord o<→c< {x} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where
|
|
158 lemma1 : {y : Ordinal} → odef x y → odef (Ord (& x)) y
|
|
159 lemma1 {y} lt = subst ( λ k → k o< & x ) &iso (c<→o< {* y} {x} (d→∋ x lt))
|
|
160 lemma2 : {y : Ordinal} → odef (Ord (& x)) y → odef x y
|
|
161 lemma2 {y} lt = subst (λ k → odef k y ) *iso (o<→c< {y} {& x} lt )
|
|
162
|
|
163 -- avoiding lv != Zero error
|
|
164 orefl : { x : HOD } → { y : Ordinal } → & x ≡ y → & x ≡ y
|
|
165 orefl refl = refl
|
|
166
|
|
167 ==-iso : { x y : HOD } → od (* (& x)) == od (* (& y)) → od x == od y
|
|
168 ==-iso {x} {y} eq = record {
|
1091
|
169 eq→ = λ {z} d → lemma ( eq→ eq (subst (λ k → odef k z ) (sym *iso) d )) ;
|
|
170 eq← = λ {z} d → lemma ( eq← eq (subst (λ k → odef k z ) (sym *iso) d )) }
|
431
|
171 where
|
|
172 lemma : {x : HOD } {z : Ordinal } → odef (* (& x)) z → odef x z
|
1091
|
173 lemma {x} {z} d = subst (λ k → odef k z) (*iso) d
|
431
|
174
|
|
175 =-iso : {x y : HOD } → (od x == od y) ≡ (od (* (& x)) == od y)
|
|
176 =-iso {_} {y} = cong ( λ k → od k == od y ) (sym *iso)
|
|
177
|
|
178 ord→== : { x y : HOD } → & x ≡ & y → od x == od y
|
|
179 ord→== {x} {y} eq = ==-iso (lemma (& x) (& y) (orefl eq)) where
|
|
180 lemma : ( ox oy : Ordinal ) → ox ≡ oy → od (* ox) == od (* oy)
|
|
181 lemma ox ox refl = ==-refl
|
|
182
|
|
183 o≡→== : { x y : Ordinal } → x ≡ y → od (* x) == od (* y)
|
|
184 o≡→== {x} {.x} refl = ==-refl
|
|
185
|
556
|
186 *≡*→≡ : { x y : Ordinal } → * x ≡ * y → x ≡ y
|
|
187 *≡*→≡ eq = subst₂ (λ j k → j ≡ k ) &iso &iso ( cong (&) eq )
|
|
188
|
|
189 &≡&→≡ : { x y : HOD } → & x ≡ & y → x ≡ y
|
|
190 &≡&→≡ eq = subst₂ (λ j k → j ≡ k ) *iso *iso ( cong (*) eq )
|
|
191
|
1091
|
192 o∅≡od∅ : * (o∅ ) ≡ od∅
|
431
|
193 o∅≡od∅ = ==→o≡ lemma where
|
|
194 lemma0 : {x : Ordinal} → odef (* o∅) x → odef od∅ x
|
|
195 lemma0 {x} lt with c<→o< {* x} {* o∅} (subst (λ k → odef (* o∅) k ) (sym &iso) lt)
|
|
196 ... | t = subst₂ (λ j k → j o< k ) &iso &iso t
|
|
197 lemma1 : {x : Ordinal} → odef od∅ x → odef (* o∅) x
|
|
198 lemma1 {x} lt = ⊥-elim (¬x<0 lt)
|
|
199 lemma : od (* o∅) == od od∅
|
|
200 lemma = record { eq→ = lemma0 ; eq← = lemma1 }
|
|
201
|
1091
|
202 ord-od∅ : & (od∅ ) ≡ o∅
|
431
|
203 ord-od∅ = sym ( subst (λ k → k ≡ & (od∅ ) ) &iso (cong ( λ k → & k ) o∅≡od∅ ) )
|
|
204
|
|
205 ≡o∅→=od∅ : {x : HOD} → & x ≡ o∅ → od x == od od∅
|
|
206 ≡o∅→=od∅ {x} eq = record { eq→ = λ {y} lt → ⊥-elim ( ¬x<0 {y} (subst₂ (λ j k → j o< k ) &iso eq ( c<→o< {* y} {x} (d→∋ x lt))))
|
1091
|
207 ; eq← = λ {y} lt → ⊥-elim ( ¬x<0 lt )}
|
431
|
208
|
1091
|
209 =od∅→≡o∅ : {x : HOD} → od x == od od∅ → & x ≡ o∅
|
431
|
210 =od∅→≡o∅ {x} eq = trans (cong (λ k → & k ) (==→o≡ {x} {od∅} eq)) ord-od∅
|
|
211
|
448
|
212 ≡od∅→=od∅ : {x : HOD} → x ≡ od∅ → od x == od od∅
|
|
213 ≡od∅→=od∅ {x} eq = ≡o∅→=od∅ (subst (λ k → & x ≡ k ) ord-od∅ ( cong & eq ) )
|
|
214
|
1091
|
215 ∅0 : record { def = λ x → Lift n ⊥ } == od od∅
|
431
|
216 eq→ ∅0 {w} (lift ())
|
|
217 eq← ∅0 {w} lt = lift (¬x<0 lt)
|
|
218
|
|
219 ∅< : { x y : HOD } → odef x (& y ) → ¬ ( od x == od od∅ )
|
|
220 ∅< {x} {y} d eq with eq→ (==-trans eq (==-sym ∅0) ) d
|
|
221 ∅< {x} {y} d eq | lift ()
|
450
|
222
|
1223
|
223 ¬x∋y→x≡od∅ : { x : HOD } → ({y : Ordinal } → ¬ odef x y ) → x ≡ od∅
|
|
224 ¬x∋y→x≡od∅ {x} nxy = ==→o≡ record { eq→ = λ {y} lt → ⊥-elim (nxy lt) ; eq← = λ {y} lt → ⊥-elim (¬x<0 lt) }
|
|
225
|
1148
|
226 0<P→ne : { x : HOD } → o∅ o< & x → ¬ ( od x == od od∅ )
|
|
227 0<P→ne {x} 0<x eq = ⊥-elim ( o<¬≡ (sym (=od∅→≡o∅ eq)) 0<x )
|
|
228
|
688
|
229 ∈∅< : { x : HOD } {y : Ordinal } → odef x y → o∅ o< (& x)
|
|
230 ∈∅< {x} {y} d with trio< o∅ (& x)
|
|
231 ... | tri< a ¬b ¬c = a
|
|
232 ... | tri≈ ¬a b ¬c = ⊥-elim ( ∅< {x} {* y} (subst (λ k → odef x k ) (sym &iso) d ) ( ≡o∅→=od∅ (sym b) ) )
|
|
233 ... | tri> ¬a ¬b c = ⊥-elim ( ¬x<0 c )
|
|
234
|
431
|
235 ∅6 : { x : HOD } → ¬ ( x ∋ x ) -- no Russel paradox
|
|
236 ∅6 {x} x∋x = o<¬≡ refl ( c<→o< {x} {x} x∋x )
|
|
237
|
|
238 odef-iso : {A B : HOD } {x y : Ordinal } → x ≡ y → (odef A y → odef B y) → odef A x → odef B x
|
|
239 odef-iso refl t = t
|
|
240
|
|
241 is-o∅ : ( x : Ordinal ) → Dec ( x ≡ o∅ )
|
|
242 is-o∅ x with trio< x o∅
|
|
243 is-o∅ x | tri< a ¬b ¬c = no ¬b
|
|
244 is-o∅ x | tri≈ ¬a b ¬c = yes b
|
|
245 is-o∅ x | tri> ¬a ¬b c = no ¬b
|
|
246
|
1091
|
247 odef< : {b : Ordinal } { A : HOD } → odef A b → b o< & A
|
|
248 odef< {b} {A} ab = subst (λ k → k o< & A) &iso ( c<→o< (subst (λ k → odef A k ) (sym &iso ) ab))
|
|
249
|
|
250 odef∧< : {A : HOD } {y : Ordinal} {n : Level } → {P : Set n} → odef A y ∧ P → y o< & A
|
|
251 odef∧< {A } {y} p = subst (λ k → k o< & A) &iso ( c<→o< (subst (λ k → odef A k ) (sym &iso ) (proj1 p )))
|
|
252
|
431
|
253 -- the pair
|
1091
|
254 _,_ : HOD → HOD → HOD
|
431
|
255 x , y = record { od = record { def = λ t → (t ≡ & x ) ∨ ( t ≡ & y ) } ; odmax = omax (& x) (& y) ; <odmax = lemma } where
|
|
256 lemma : {t : Ordinal} → (t ≡ & x) ∨ (t ≡ & y) → t o< omax (& x) (& y)
|
|
257 lemma {t} (case1 refl) = omax-x _ _
|
|
258 lemma {t} (case2 refl) = omax-y _ _
|
|
259
|
|
260 pair<y : {x y : HOD } → y ∋ x → & (x , x) o< osuc (& y)
|
|
261 pair<y {x} {y} y∋x = ⊆→o≤ lemma where
|
|
262 lemma : {z : Ordinal} → def (od (x , x)) z → def (od y) z
|
|
263 lemma (case1 refl) = y∋x
|
|
264 lemma (case2 refl) = y∋x
|
|
265
|
688
|
266 -- another possible restriction. We require no minimality on odmax, so it may arbitrary larger.
|
431
|
267 odmax<& : { x y : HOD } → x ∋ y → Set n
|
|
268 odmax<& {x} {y} x∋y = odmax x o< & x
|
|
269
|
1091
|
270 in-codomain : (X : HOD ) → ( ψ : HOD → HOD ) → OD
|
431
|
271 in-codomain X ψ = record { def = λ x → ¬ ( (y : Ordinal ) → ¬ ( odef X y ∧ ( x ≡ & (ψ (* y ))))) }
|
|
272
|
1091
|
273 _∩_ : ( A B : HOD ) → HOD
|
431
|
274 A ∩ B = record { od = record { def = λ x → odef A x ∧ odef B x }
|
|
275 ; odmax = omin (odmax A) (odmax B) ; <odmax = λ y → min1 (<odmax A (proj1 y)) (<odmax B (proj2 y))}
|
|
276
|
1096
|
277 _⊆_ : ( A B : HOD) → Set n
|
|
278 _⊆_ A B = { x : Ordinal } → odef A x → odef B x
|
431
|
279
|
|
280 infixr 220 _⊆_
|
|
281
|
|
282 -- if we have & (x , x) ≡ osuc (& x), ⊆→o≤ → c<→o<
|
|
283 ⊆→o≤→c<→o< : ({x : HOD} → & (x , x) ≡ osuc (& x) )
|
|
284 → ({y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → & y o< osuc (& z) )
|
1091
|
285 → {x y : HOD } → def (od y) ( & x ) → & x o< & y
|
431
|
286 ⊆→o≤→c<→o< peq ⊆→o≤ {x} {y} y∋x with trio< (& x) (& y)
|
|
287 ⊆→o≤→c<→o< peq ⊆→o≤ {x} {y} y∋x | tri< a ¬b ¬c = a
|
|
288 ⊆→o≤→c<→o< peq ⊆→o≤ {x} {y} y∋x | tri≈ ¬a b ¬c = ⊥-elim ( o<¬≡ (peq {x}) (pair<y (subst (λ k → k ∋ x) (sym ( ==→o≡ {x} {y} (ord→== b))) y∋x )))
|
|
289 ⊆→o≤→c<→o< peq ⊆→o≤ {x} {y} y∋x | tri> ¬a ¬b c =
|
|
290 ⊥-elim ( o<> (⊆→o≤ {x , x} {y} y⊆x,x ) lemma1 ) where
|
|
291 lemma : {z : Ordinal} → (z ≡ & x) ∨ (z ≡ & x) → & x ≡ z
|
|
292 lemma (case1 refl) = refl
|
|
293 lemma (case2 refl) = refl
|
|
294 y⊆x,x : {z : Ordinal} → def (od (x , x)) z → def (od y) z
|
1091
|
295 y⊆x,x {z} lt = subst (λ k → def (od y) k ) (lemma lt) y∋x
|
431
|
296 lemma1 : osuc (& y) o< & (x , x)
|
1091
|
297 lemma1 = subst (λ k → osuc (& y) o< k ) (sym (peq {x})) (osucc c )
|
431
|
298
|
|
299 ε-induction : { ψ : HOD → Set (suc n)}
|
|
300 → ( {x : HOD } → ({ y : HOD } → x ∋ y → ψ y ) → ψ x )
|
|
301 → (x : HOD ) → ψ x
|
|
302 ε-induction {ψ} ind x = subst (λ k → ψ k ) *iso (ε-induction-ord (osuc (& x)) <-osuc ) where
|
|
303 induction : (ox : Ordinal) → ((oy : Ordinal) → oy o< ox → ψ (* oy)) → ψ (* ox)
|
1091
|
304 induction ox prev = ind ( λ {y} lt → subst (λ k → ψ k ) *iso (prev (& y) (o<-subst (c<→o< lt) refl &iso )))
|
431
|
305 ε-induction-ord : (ox : Ordinal) { oy : Ordinal } → oy o< ox → ψ (* oy)
|
|
306 ε-induction-ord ox {oy} lt = TransFinite {λ oy → ψ (* oy)} induction oy
|
|
307
|
1109
|
308 ε-induction0 : { ψ : HOD → Set n}
|
|
309 → ( {x : HOD } → ({ y : HOD } → x ∋ y → ψ y ) → ψ x )
|
|
310 → (x : HOD ) → ψ x
|
|
311 ε-induction0 {ψ} ind x = subst (λ k → ψ k ) *iso (ε-induction-ord (osuc (& x)) <-osuc ) where
|
|
312 induction : (ox : Ordinal) → ((oy : Ordinal) → oy o< ox → ψ (* oy)) → ψ (* ox)
|
|
313 induction ox prev = ind ( λ {y} lt → subst (λ k → ψ k ) *iso (prev (& y) (o<-subst (c<→o< lt) refl &iso )))
|
|
314 ε-induction-ord : (ox : Ordinal) { oy : Ordinal } → oy o< ox → ψ (* oy)
|
|
315 ε-induction-ord ox {oy} lt = inOrdinal.TransFinite0 O {λ oy → ψ (* oy)} induction oy
|
|
316
|
1091
|
317 -- Open supreme upper bound leads a contradition, so we use domain restriction on sup
|
|
318 ¬open-sup : ( sup-o : (Ordinal → Ordinal ) → Ordinal) → ((ψ : Ordinal → Ordinal ) → (x : Ordinal) → ψ x o< sup-o ψ ) → ⊥
|
|
319 ¬open-sup sup-o sup-o< = o<> <-osuc (sup-o< next-ord (sup-o next-ord)) where
|
|
320 next-ord : Ordinal → Ordinal
|
|
321 next-ord x = osuc x
|
|
322
|
|
323 Select : (X : HOD ) → ((x : HOD ) → Set n ) → HOD
|
431
|
324 Select X ψ = record { od = record { def = λ x → ( odef X x ∧ ψ ( * x )) } ; odmax = odmax X ; <odmax = λ y → <odmax X (proj1 y) }
|
|
325
|
1095
|
326 _=h=_ : (x y : HOD) → Set n
|
|
327 x =h= y = od x == od y
|
|
328
|
|
329 record Own (A : HOD) (x : Ordinal) : Set n where
|
|
330 field
|
|
331 owner : Ordinal
|
|
332 ao : odef A owner
|
|
333 ox : odef (* owner) x
|
|
334
|
|
335 Union : HOD → HOD
|
|
336 Union U = record { od = record { def = λ x → Own U x } ; odmax = osuc (& U) ; <odmax = umax } where
|
|
337 umax : {y : Ordinal} → Own U y → y o< osuc (& U)
|
|
338 umax {y} uy = o<→≤ ( ordtrans (odef< (Own.ox uy)) (subst (λ k → k o< & U) (sym &iso) umax1) ) where
|
|
339 umax1 : Own.owner uy o< & U
|
|
340 umax1 = odef< (Own.ao uy)
|
|
341
|
|
342 union→ : (X z u : HOD) → (X ∋ u) ∧ (u ∋ z) → Union X ∋ z
|
|
343 union→ X z u xx = record { owner = & u ; ao = proj1 xx ; ox = subst (λ k → odef k (& z)) (sym *iso) (proj2 xx) }
|
|
344 union← : (X z : HOD) (X∋z : Union X ∋ z) → ¬ ( (u : HOD ) → ¬ ((X ∋ u) ∧ (u ∋ z )))
|
|
345 union← X z UX∋z not = ⊥-elim ( not (* (Own.owner UX∋z)) ⟪ subst (λ k → odef X k) (sym &iso) ( Own.ao UX∋z) , Own.ox UX∋z ⟫ )
|
|
346
|
|
347 record Replaced (A : HOD) (ψ : Ordinal → Ordinal ) (x : Ordinal ) : Set n where
|
|
348 field
|
|
349 z : Ordinal
|
|
350 az : odef A z
|
|
351 x=ψz : x ≡ ψ z
|
|
352
|
1091
|
353 Replace : HOD → (HOD → HOD) → HOD
|
1095
|
354 Replace X ψ = record { od = record { def = λ x → Replaced X (λ z → & (ψ (* z))) x } ; odmax = rmax ; <odmax = rmax< } where
|
431
|
355 rmax : Ordinal
|
1095
|
356 rmax = osuc ( sup-o X (λ y X∋y → & (ψ (* y) )) )
|
|
357 rmax< : {y : Ordinal} → Replaced X (λ z → & (ψ (* z))) y → y o< rmax
|
|
358 rmax< {y} lt = subst (λ k → k o< rmax) r01 ( sup-o≤ X (Replaced.az lt) ) where
|
|
359 r01 : & (ψ ( * (Replaced.z lt ) )) ≡ y
|
|
360 r01 = sym (Replaced.x=ψz lt )
|
|
361
|
|
362 replacement← : {ψ : HOD → HOD} (X x : HOD) → X ∋ x → Replace X ψ ∋ ψ x
|
|
363 replacement← {ψ} X x lt = record { z = & x ; az = lt ; x=ψz = cong (λ k → & (ψ k)) (sym *iso) }
|
|
364 replacement→ : {ψ : HOD → HOD} (X x : HOD) → (lt : Replace X ψ ∋ x) → ¬ ( (y : HOD) → ¬ (x =h= ψ y))
|
|
365 replacement→ {ψ} X x lt eq = eq (* (Replaced.z lt)) (ord→== (Replaced.x=ψz lt))
|
431
|
366
|
|
367 --
|
1091
|
368 -- If we have LEM, Replace' is equivalent to Replace
|
431
|
369 --
|
1095
|
370
|
|
371 record Replaced1 (A : HOD) (ψ : (x : Ordinal ) → odef A x → Ordinal ) (x : Ordinal ) : Set n where
|
|
372 field
|
|
373 z : Ordinal
|
|
374 az : odef A z
|
|
375 x=ψz : x ≡ ψ z az
|
431
|
376
|
1218
|
377 Replace' : (X : HOD) → ((x : HOD) → X ∋ x → HOD) → HOD
|
1095
|
378 Replace' X ψ = record { od = record { def = λ x → Replaced1 X (λ z xz → & (ψ (* z) (subst (λ k → odef X k) (sym &iso) xz) )) x } ; odmax = rmax ; <odmax = rmax< } where
|
|
379 rmax : Ordinal
|
|
380 rmax = osuc ( sup-o X (λ y X∋y → & (ψ (* y) (d→∋ X X∋y) )) )
|
|
381 rmax< : {y : Ordinal} → Replaced1 X (λ z xz → & (ψ (* z) (subst (λ k → odef X k) (sym &iso) xz) )) y → y o< rmax
|
|
382 rmax< {y} lt = subst (λ k → k o< rmax) r01 ( sup-o≤ X (Replaced1.az lt) ) where
|
|
383 r01 : & (ψ ( * (Replaced1.z lt ) ) (subst (λ k → odef X k) (sym &iso) (Replaced1.az lt) )) ≡ y
|
|
384 r01 = sym (Replaced1.x=ψz lt )
|
|
385
|
1218
|
386
|
|
387 Replace'-iso : (X : HOD) → (ψ : (x : HOD) → X ∋ x → HOD) →
|
|
388 Replace' (* (& X)) (λ y xy → ψ y (subst (λ k → k ∋ y ) *iso xy) ) ≡ Replace' X ( λ y xy → ψ y xy )
|
|
389 Replace'-iso X ψ = ==→o≡ record { eq→ = ri0 ; eq← = ri1 } where
|
|
390 ri2 : {z : Ordinal } (a b : X ∋ (* z)) → & (ψ (* z) a) ≡ & (ψ (* z) b)
|
|
391 ri2 {z} a b = cong (λ k → & (ψ (* z) k)) ( HE.≅-to-≡ ( ∋-irr {X} {& (* z)} a b ) )
|
|
392 ri0 : {x : Ordinal}
|
|
393 → Replaced1 (* (& X)) (λ z xz → & (ψ (* z) (subst (λ k → k ∋ * z) *iso (subst (odef (* (& X))) (sym &iso) xz)))) x
|
|
394 → Replaced1 X (λ z xz → & (ψ (* z) (subst (odef X) (sym &iso) xz))) x
|
|
395 ri0 {x} record { z = z ; az = az ; x=ψz = refl } = record { z = z ; az = subst (λ k → odef k z) *iso az
|
|
396 ; x=ψz = ri2 (subst (λ k → k ∋ * z) *iso (subst (odef (* (& X))) (sym &iso) az))
|
|
397 (subst (odef X) (sym &iso) (subst (λ k → odef k z) *iso az) ) }
|
|
398 ri1 : {x : Ordinal}
|
|
399 → Replaced1 X (λ z xz → & (ψ (* z) (subst (odef X) (sym &iso) xz))) x
|
|
400 → Replaced1 (* (& X)) (λ z xz → & (ψ (* z) (subst (λ k → k ∋ * z) *iso (subst (odef (* (& X))) (sym &iso) xz)))) x
|
|
401 ri1 {x} record { z = z ; az = az ; x=ψz = refl } = record { z = z ; az = subst (λ k → odef k z) (sym *iso) az
|
|
402 ; x=ψz = ri2 (subst (λ k → odef X k) (sym &iso) az ) -- brain damaged below
|
|
403 (subst (λ k → k ∋ * z) *iso (subst (odef (* (& X))) (sym &iso) (subst (λ k → odef k z) (sym *iso) az))) }
|
|
404
|
|
405
|
1095
|
406 -- replacement←1 : {ψ : HOD → HOD} (X x : HOD) → X ∋ x → Replace1 X ψ ∋ ψ x
|
|
407 -- replacement←1 {ψ} X x lt = record { z = & x ; az = lt ; x=ψz = cong (λ k → & (ψ k)) (sym *iso) }
|
|
408 -- replacement→1 : {ψ : HOD → HOD} (X x : HOD) → (lt : Replace1 X ψ ∋ x) → ¬ ( (y : HOD) → ¬ (x =h= ψ y))
|
|
409 -- replacement→1 {ψ} X x lt eq = eq (* (Replaced.z lt)) (ord→== (Replaced.x=ψz lt))
|
|
410
|
431
|
411 _∈_ : ( A B : HOD ) → Set n
|
|
412 A ∈ B = B ∋ A
|
|
413
|
1095
|
414 Power : HOD → HOD
|
|
415 Power A = record { od = record { def = λ x → ( ( z : Ordinal) → odef (* x) z → odef A z ) } ; odmax = osuc (& A)
|
|
416 ; <odmax = p00 } where
|
|
417 p00 : {y : Ordinal} → ((z : Ordinal) → odef (* y) z → odef A z) → y o< osuc (& A)
|
|
418 p00 {y} y⊆A = p01 where
|
|
419 p01 : y o≤ & A
|
|
420 p01 = subst (λ k → k o≤ & A) &iso ( ⊆→o≤ (λ {x} yx → y⊆A x yx ))
|
431
|
421
|
1095
|
422 power→ : ( A t : HOD) → Power A ∋ t → {x : HOD} → t ∋ x → A ∋ x
|
|
423 power→ A t P∋t {x} t∋x = P∋t (& x) (subst (λ k → odef k (& x) ) (sym *iso) t∋x )
|
|
424
|
|
425 power← : (A t : HOD) → ({x : HOD} → (t ∋ x → A ∋ x)) → Power A ∋ t
|
|
426 power← A t t⊆A z xz = subst (λ k → odef A k ) &iso ( t⊆A (subst₂ (λ j k → odef j k) *iso (sym &iso) xz ))
|
|
427
|
1180
|
428 Intersection : (X : HOD ) → HOD -- ∩ X
|
1186
|
429 Intersection X = record { od = record { def = λ x → (x o≤ & X ) ∧ ( {y : Ordinal} → odef X y → odef (* y) x )} ; odmax = osuc (& X) ; <odmax = λ lt → proj1 lt }
|
1180
|
430
|
|
431
|
431
|
432 -- {_} : ZFSet → ZFSet
|
|
433 -- { x } = ( x , x ) -- better to use (x , x) directly
|
|
434
|
|
435
|
|
436 data infinite-d : ( x : Ordinal ) → Set n where
|
|
437 iφ : infinite-d o∅
|
|
438 isuc : {x : Ordinal } → infinite-d x →
|
|
439 infinite-d (& ( Union (* x , (* x , * x ) ) ))
|
|
440
|
|
441 -- ω can be diverged in our case, since we have no restriction on the corresponding ordinal of a pair.
|
|
442 -- We simply assumes infinite-d y has a maximum.
|
1091
|
443 --
|
431
|
444 -- This means that many of OD may not be HODs because of the & mapping divergence.
|
|
445 -- We should have some axioms to prevent this such as & x o< next (odmax x).
|
1091
|
446 --
|
1097
|
447 -- Since we have Ord (next o∅), we don't need this, but ZF axiom requires this and ho<
|
431
|
448
|
1091
|
449 infinite : HOD
|
431
|
450 infinite = record { od = record { def = λ x → infinite-d x } ; odmax = next o∅ ; <odmax = lemma } where
|
|
451 u : (y : Ordinal ) → HOD
|
|
452 u y = Union (* y , (* y , * y))
|
|
453 -- next< : {x y z : Ordinal} → x o< next z → y o< next x → y o< next z
|
|
454 lemma8 : {y : Ordinal} → & (* y , * y) o< next (odmax (* y , * y))
|
|
455 lemma8 = ho<
|
1091
|
456 --- (x,y) < next (omax x y) < next (osuc y) = next y
|
431
|
457 lemmaa : {x y : HOD} → & x o< & y → & (x , y) o< next (& y)
|
|
458 lemmaa {x} {y} x<y = subst (λ k → & (x , y) o< k ) (sym nexto≡) (subst (λ k → & (x , y) o< next k ) (sym (omax< _ _ x<y)) ho< )
|
|
459 lemma81 : {y : Ordinal} → & (* y , * y) o< next (& (* y))
|
|
460 lemma81 {y} = nexto=n (subst (λ k → & (* y , * y) o< k ) (cong (λ k → next k) (omxx _)) lemma8)
|
|
461 lemma9 : {y : Ordinal} → & (* y , (* y , * y)) o< next (& (* y , * y))
|
|
462 lemma9 = lemmaa (c<→o< (case1 refl))
|
|
463 lemma71 : {y : Ordinal} → & (* y , (* y , * y)) o< next (& (* y))
|
|
464 lemma71 = next< lemma81 lemma9
|
|
465 lemma1 : {y : Ordinal} → & (u y) o< next (osuc (& (* y , (* y , * y))))
|
|
466 lemma1 = ho<
|
|
467 --- main recursion
|
|
468 lemma : {y : Ordinal} → infinite-d y → y o< next o∅
|
|
469 lemma {o∅} iφ = x<nx
|
|
470 lemma (isuc {y} x) = next< (lemma x) (next< (subst (λ k → & (* y , (* y , * y)) o< next k) &iso lemma71 ) (nexto=n lemma1))
|
|
471
|
|
472 empty : (x : HOD ) → ¬ (od∅ ∋ x)
|
1091
|
473 empty x = ¬x<0
|
431
|
474
|
1091
|
475 pair→ : ( x y t : HOD ) → (x , y) ∋ t → ( t =h= x ) ∨ ( t =h= y )
|
431
|
476 pair→ x y t (case1 t≡x ) = case1 (subst₂ (λ j k → j =h= k ) *iso *iso (o≡→== t≡x ))
|
|
477 pair→ x y t (case2 t≡y ) = case2 (subst₂ (λ j k → j =h= k ) *iso *iso (o≡→== t≡y ))
|
|
478
|
1091
|
479 pair← : ( x y t : HOD ) → ( t =h= x ) ∨ ( t =h= y ) → (x , y) ∋ t
|
431
|
480 pair← x y t (case1 t=h=x) = case1 (cong (λ k → & k ) (==→o≡ t=h=x))
|
|
481 pair← x y t (case2 t=h=y) = case2 (cong (λ k → & k ) (==→o≡ t=h=y))
|
|
482
|
1091
|
483 o<→c< : {x y : Ordinal } → x o< y → (Ord x) ⊆ (Ord y)
|
1096
|
484 o<→c< lt {z} ox = ordtrans ox lt
|
431
|
485
|
|
486 ⊆→o< : {x y : Ordinal } → (Ord x) ⊆ (Ord y) → x o< osuc y
|
1091
|
487 ⊆→o< {x} {y} lt with trio< x y
|
431
|
488 ⊆→o< {x} {y} lt | tri< a ¬b ¬c = ordtrans a <-osuc
|
|
489 ⊆→o< {x} {y} lt | tri≈ ¬a b ¬c = subst ( λ k → k o< osuc y) (sym b) <-osuc
|
1096
|
490 ⊆→o< {x} {y} lt | tri> ¬a ¬b c with lt (o<-subst c (sym &iso) refl )
|
431
|
491 ... | ttt = ⊥-elim ( o<¬≡ refl (o<-subst ttt &iso refl ))
|
|
492
|
|
493 ψiso : {ψ : HOD → Set n} {x y : HOD } → ψ x → x ≡ y → ψ y
|
|
494 ψiso {ψ} t refl = t
|
|
495 selection : {ψ : HOD → Set n} {X y : HOD} → ((X ∋ y) ∧ ψ y) ⇔ (Select X ψ ∋ y)
|
|
496 selection {ψ} {X} {y} = ⟪
|
|
497 ( λ cond → ⟪ proj1 cond , ψiso {ψ} (proj2 cond) (sym *iso) ⟫ )
|
|
498 , ( λ select → ⟪ proj1 select , ψiso {ψ} (proj2 select) *iso ⟫ )
|
|
499 ⟫
|
|
500
|
1091
|
501 selection-in-domain : {ψ : HOD → Set n} {X y : HOD} → Select X ψ ∋ y → X ∋ y
|
431
|
502 selection-in-domain {ψ} {X} {y} lt = proj1 ((proj2 (selection {ψ} {X} )) lt)
|
|
503
|
1007
|
504 sup-c≤ : (ψ : HOD → HOD) → {X x : HOD} → X ∋ x → & (ψ x) o≤ (sup-o X (λ y X∋y → & (ψ (* y))))
|
|
505 sup-c≤ ψ {X} {x} lt = subst (λ k → & (ψ k) o< _ ) *iso (sup-o≤ X lt )
|
|
506
|
431
|
507 ---
|
|
508 --- Power Set
|
|
509 ---
|
|
510 --- First consider ordinals in HOD
|
|
511 ---
|
|
512 --- A ∩ x = record { def = λ y → odef A y ∧ odef x y } subset of A
|
|
513 --
|
|
514 --
|
|
515 ∩-≡ : { a b : HOD } → ({x : HOD } → (a ∋ x → b ∋ x)) → a =h= ( b ∩ a )
|
|
516 ∩-≡ {a} {b} inc = record {
|
|
517 eq→ = λ {x} x<a → ⟪ (subst (λ k → odef b k ) &iso (inc (d→∋ a x<a))) , x<a ⟫ ;
|
|
518 eq← = λ {x} x<a∩b → proj2 x<a∩b }
|
|
519
|
|
520 extensionality0 : {A B : HOD } → ((z : HOD) → (A ∋ z) ⇔ (B ∋ z)) → A =h= B
|
1091
|
521 eq→ (extensionality0 {A} {B} eq ) {x} d = odef-iso {A} {B} (sym &iso) (proj1 (eq (* x))) d
|
|
522 eq← (extensionality0 {A} {B} eq ) {x} d = odef-iso {B} {A} (sym &iso) (proj2 (eq (* x))) d
|
431
|
523
|
|
524 extensionality : {A B w : HOD } → ((z : HOD ) → (A ∋ z) ⇔ (B ∋ z)) → (w ∋ A) ⇔ (w ∋ B)
|
|
525 proj1 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) ( ==→o≡ (extensionality0 {A} {B} eq) ) d
|
1091
|
526 proj2 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) (sym ( ==→o≡ (extensionality0 {A} {B} eq) )) d
|
431
|
527
|
1091
|
528 infinity∅ : infinite ∋ od∅
|
|
529 infinity∅ = subst (λ k → odef infinite k ) lemma iφ where
|
431
|
530 lemma : o∅ ≡ & od∅
|
|
531 lemma = let open ≡-Reasoning in begin
|
|
532 o∅
|
|
533 ≡⟨ sym &iso ⟩
|
|
534 & ( * o∅ )
|
|
535 ≡⟨ cong ( λ k → & k ) o∅≡od∅ ⟩
|
|
536 & od∅
|
|
537 ∎
|
|
538 infinity : (x : HOD) → infinite ∋ x → infinite ∋ Union (x , (x , x ))
|
|
539 infinity x lt = subst (λ k → odef infinite k ) lemma (isuc {& x} lt) where
|
|
540 lemma : & (Union (* (& x) , (* (& x) , * (& x))))
|
|
541 ≡ & (Union (x , (x , x)))
|
1091
|
542 lemma = cong (λ k → & (Union ( k , ( k , k ) ))) *iso
|
431
|
543
|
|
544 isZF : IsZF (HOD ) _∋_ _=h=_ od∅ _,_ Union Power Select Replace infinite
|
|
545 isZF = record {
|
|
546 isEquivalence = record { refl = ==-refl ; sym = ==-sym; trans = ==-trans }
|
|
547 ; pair→ = pair→
|
|
548 ; pair← = pair←
|
|
549 ; union→ = union→
|
|
550 ; union← = union←
|
|
551 ; empty = empty
|
1091
|
552 ; power→ = power→
|
|
553 ; power← = power←
|
|
554 ; extensionality = λ {A} {B} {w} → extensionality {A} {B} {w}
|
431
|
555 ; ε-induction = ε-induction
|
|
556 ; infinity∅ = infinity∅
|
|
557 ; infinity = infinity
|
|
558 ; selection = λ {X} {ψ} {y} → selection {X} {ψ} {y}
|
|
559 ; replacement← = replacement←
|
|
560 ; replacement→ = λ {ψ} → replacement→ {ψ}
|
1091
|
561 }
|
431
|
562
|
1091
|
563 HOD→ZF : ZF
|
|
564 HOD→ZF = record {
|
|
565 ZFSet = HOD
|
|
566 ; _∋_ = _∋_
|
|
567 ; _≈_ = _=h=_
|
431
|
568 ; ∅ = od∅
|
|
569 ; _,_ = _,_
|
|
570 ; Union = Union
|
|
571 ; Power = Power
|
|
572 ; Select = Select
|
|
573 ; Replace = Replace
|
|
574 ; infinite = infinite
|
1091
|
575 ; isZF = isZF
|
|
576 }
|
431
|
577
|
1091
|
578
|