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