431
|
1 {-# OPTIONS --allow-unsolved-metas #-}
|
|
2 open import Level
|
|
3 open import Ordinals
|
|
4 module OD {n : Level } (O : Ordinals {n} ) where
|
|
5
|
|
6 open import zf
|
|
7 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ )
|
|
8 open import Relation.Binary.PropositionalEquality hiding ( [_] )
|
|
9 open import Data.Nat.Properties
|
|
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
|
|
20 open Ordinals.IsOrdinals isOrdinal
|
|
21 open Ordinals.IsNext isNext
|
|
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
|
|
38 eq→ : ∀ { x : Ordinal } → def a x → def b x
|
|
39 eq← : ∀ { x : Ordinal } → def b x → def a x
|
|
40
|
|
41 ==-refl : { x : OD } → x == x
|
|
42 ==-refl {x} = record { eq→ = λ x → x ; eq← = λ x → x }
|
|
43
|
|
44 open _==_
|
|
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
|
|
49 ==-sym : { x y : OD } → x == y → y == x
|
|
50 ==-sym x=y = record { eq→ = λ {m} t → eq← x=y t ; eq← = λ {m} t → eq→ x=y t }
|
|
51
|
|
52
|
|
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
|
|
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 --
|
|
65 -- In classical Set Theory, HOD is used, as a subset of OD,
|
|
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
|
|
92 record ODAxiom : Set (suc n) where
|
|
93 field
|
|
94 -- HOD is isomorphic to Ordinal (by means of Goedel number)
|
|
95 & : HOD → Ordinal
|
|
96 * : Ordinal → HOD
|
|
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
|
|
102 sup-o : (A : HOD) → ( ( x : Ordinal ) → def (od A) x → Ordinal ) → Ordinal
|
|
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 ψ
|
|
104 -- possible order restriction
|
|
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.
|
|
115 -- Only Select has non minimum odmax.
|
|
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) → ⊥
|
|
123 ¬OD-order & * c<→o< = osuc-< <-osuc (c<→o< {Ords} OneObj )
|
|
124
|
|
125 -- Open supreme upper bound leads a contradition, so we use domain restriction on sup
|
|
126 ¬open-sup : ( sup-o : (Ordinal → Ordinal ) → Ordinal) → ((ψ : Ordinal → Ordinal ) → (x : Ordinal) → ψ x o< sup-o ψ ) → ⊥
|
|
127 ¬open-sup sup-o sup-o< = o<> <-osuc (sup-o< next-ord (sup-o next-ord)) where
|
|
128 next-ord : Ordinal → Ordinal
|
|
129 next-ord x = osuc x
|
|
130
|
|
131 -- Ordinal in OD ( and ZFSet ) Transitive Set
|
|
132 Ord : ( a : Ordinal ) → HOD
|
|
133 Ord a = record { od = record { def = λ y → y o< a } ; odmax = a ; <odmax = lemma } where
|
|
134 lemma : {x : Ordinal} → x o< a → x o< a
|
|
135 lemma {x} lt = lt
|
|
136
|
|
137 od∅ : HOD
|
|
138 od∅ = Ord o∅
|
|
139
|
|
140 odef : HOD → Ordinal → Set n
|
|
141 odef A x = def ( od A ) x
|
|
142
|
|
143 _∋_ : ( a x : HOD ) → Set n
|
|
144 _∋_ a x = odef a ( & x )
|
|
145
|
|
146 -- _c<_ : ( x a : HOD ) → Set n
|
|
147 -- x c< a = a ∋ x
|
|
148
|
|
149 d→∋ : ( a : HOD ) { x : Ordinal} → odef a x → a ∋ (* x)
|
|
150 d→∋ a lt = subst (λ k → odef a k ) (sym &iso) lt
|
|
151
|
|
152 -- odef-subst : {Z : HOD } {X : Ordinal }{z : HOD } {x : Ordinal }→ odef Z X → Z ≡ z → X ≡ x → odef z x
|
|
153 -- odef-subst df refl refl = df
|
|
154
|
|
155 otrans : {a x y : Ordinal } → odef (Ord a) x → odef (Ord x) y → odef (Ord a) y
|
|
156 otrans x<a y<x = ordtrans y<x x<a
|
|
157
|
|
158 -- If we have reverse of c<→o<, everything becomes Ordinal
|
|
159 ∈→c<→HOD=Ord : ( o<→c< : {x y : Ordinal } → x o< y → odef (* y) x ) → {x : HOD } → x ≡ Ord (& x)
|
|
160 ∈→c<→HOD=Ord o<→c< {x} = ==→o≡ ( record { eq→ = lemma1 ; eq← = lemma2 } ) where
|
|
161 lemma1 : {y : Ordinal} → odef x y → odef (Ord (& x)) y
|
|
162 lemma1 {y} lt = subst ( λ k → k o< & x ) &iso (c<→o< {* y} {x} (d→∋ x lt))
|
|
163 lemma2 : {y : Ordinal} → odef (Ord (& x)) y → odef x y
|
|
164 lemma2 {y} lt = subst (λ k → odef k y ) *iso (o<→c< {y} {& x} lt )
|
|
165
|
|
166 -- avoiding lv != Zero error
|
|
167 orefl : { x : HOD } → { y : Ordinal } → & x ≡ y → & x ≡ y
|
|
168 orefl refl = refl
|
|
169
|
|
170 ==-iso : { x y : HOD } → od (* (& x)) == od (* (& y)) → od x == od y
|
|
171 ==-iso {x} {y} eq = record {
|
|
172 eq→ = λ {z} d → lemma ( eq→ eq (subst (λ k → odef k z ) (sym *iso) d )) ;
|
|
173 eq← = λ {z} d → lemma ( eq← eq (subst (λ k → odef k z ) (sym *iso) d )) }
|
|
174 where
|
|
175 lemma : {x : HOD } {z : Ordinal } → odef (* (& x)) z → odef x z
|
|
176 lemma {x} {z} d = subst (λ k → odef k z) (*iso) d
|
|
177
|
|
178 =-iso : {x y : HOD } → (od x == od y) ≡ (od (* (& x)) == od y)
|
|
179 =-iso {_} {y} = cong ( λ k → od k == od y ) (sym *iso)
|
|
180
|
|
181 ord→== : { x y : HOD } → & x ≡ & y → od x == od y
|
|
182 ord→== {x} {y} eq = ==-iso (lemma (& x) (& y) (orefl eq)) where
|
|
183 lemma : ( ox oy : Ordinal ) → ox ≡ oy → od (* ox) == od (* oy)
|
|
184 lemma ox ox refl = ==-refl
|
|
185
|
|
186 o≡→== : { x y : Ordinal } → x ≡ y → od (* x) == od (* y)
|
|
187 o≡→== {x} {.x} refl = ==-refl
|
|
188
|
556
|
189 *≡*→≡ : { x y : Ordinal } → * x ≡ * y → x ≡ y
|
|
190 *≡*→≡ eq = subst₂ (λ j k → j ≡ k ) &iso &iso ( cong (&) eq )
|
|
191
|
|
192 &≡&→≡ : { x y : HOD } → & x ≡ & y → x ≡ y
|
|
193 &≡&→≡ eq = subst₂ (λ j k → j ≡ k ) *iso *iso ( cong (*) eq )
|
|
194
|
431
|
195 o∅≡od∅ : * (o∅ ) ≡ od∅
|
|
196 o∅≡od∅ = ==→o≡ lemma where
|
|
197 lemma0 : {x : Ordinal} → odef (* o∅) x → odef od∅ x
|
|
198 lemma0 {x} lt with c<→o< {* x} {* o∅} (subst (λ k → odef (* o∅) k ) (sym &iso) lt)
|
|
199 ... | t = subst₂ (λ j k → j o< k ) &iso &iso t
|
|
200 lemma1 : {x : Ordinal} → odef od∅ x → odef (* o∅) x
|
|
201 lemma1 {x} lt = ⊥-elim (¬x<0 lt)
|
|
202 lemma : od (* o∅) == od od∅
|
|
203 lemma = record { eq→ = lemma0 ; eq← = lemma1 }
|
|
204
|
|
205 ord-od∅ : & (od∅ ) ≡ o∅
|
|
206 ord-od∅ = sym ( subst (λ k → k ≡ & (od∅ ) ) &iso (cong ( λ k → & k ) o∅≡od∅ ) )
|
|
207
|
|
208 ≡o∅→=od∅ : {x : HOD} → & x ≡ o∅ → od x == od od∅
|
|
209 ≡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))))
|
|
210 ; eq← = λ {y} lt → ⊥-elim ( ¬x<0 lt )}
|
|
211
|
|
212 =od∅→≡o∅ : {x : HOD} → od x == od od∅ → & x ≡ o∅
|
|
213 =od∅→≡o∅ {x} eq = trans (cong (λ k → & k ) (==→o≡ {x} {od∅} eq)) ord-od∅
|
|
214
|
448
|
215 ≡od∅→=od∅ : {x : HOD} → x ≡ od∅ → od x == od od∅
|
|
216 ≡od∅→=od∅ {x} eq = ≡o∅→=od∅ (subst (λ k → & x ≡ k ) ord-od∅ ( cong & eq ) )
|
|
217
|
431
|
218 ∅0 : record { def = λ x → Lift n ⊥ } == od od∅
|
|
219 eq→ ∅0 {w} (lift ())
|
|
220 eq← ∅0 {w} lt = lift (¬x<0 lt)
|
|
221
|
|
222 ∅< : { x y : HOD } → odef x (& y ) → ¬ ( od x == od od∅ )
|
|
223 ∅< {x} {y} d eq with eq→ (==-trans eq (==-sym ∅0) ) d
|
|
224 ∅< {x} {y} d eq | lift ()
|
450
|
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
|
|
238 -- the pair
|
|
239 _,_ : HOD → HOD → HOD
|
|
240 x , y = record { od = record { def = λ t → (t ≡ & x ) ∨ ( t ≡ & y ) } ; odmax = omax (& x) (& y) ; <odmax = lemma } where
|
|
241 lemma : {t : Ordinal} → (t ≡ & x) ∨ (t ≡ & y) → t o< omax (& x) (& y)
|
|
242 lemma {t} (case1 refl) = omax-x _ _
|
|
243 lemma {t} (case2 refl) = omax-y _ _
|
|
244
|
|
245 pair<y : {x y : HOD } → y ∋ x → & (x , x) o< osuc (& y)
|
|
246 pair<y {x} {y} y∋x = ⊆→o≤ lemma where
|
|
247 lemma : {z : Ordinal} → def (od (x , x)) z → def (od y) z
|
|
248 lemma (case1 refl) = y∋x
|
|
249 lemma (case2 refl) = y∋x
|
|
250
|
|
251 -- another possible restriction. We reqest no minimality on odmax, so it may arbitrary larger.
|
|
252 odmax<& : { x y : HOD } → x ∋ y → Set n
|
|
253 odmax<& {x} {y} x∋y = odmax x o< & x
|
|
254
|
|
255 in-codomain : (X : HOD ) → ( ψ : HOD → HOD ) → OD
|
|
256 in-codomain X ψ = record { def = λ x → ¬ ( (y : Ordinal ) → ¬ ( odef X y ∧ ( x ≡ & (ψ (* y ))))) }
|
|
257
|
|
258 _∩_ : ( A B : HOD ) → HOD
|
|
259 A ∩ B = record { od = record { def = λ x → odef A x ∧ odef B x }
|
|
260 ; odmax = omin (odmax A) (odmax B) ; <odmax = λ y → min1 (<odmax A (proj1 y)) (<odmax B (proj2 y))}
|
|
261
|
|
262 record _⊆_ ( A B : HOD ) : Set (suc n) where
|
|
263 field
|
|
264 incl : { x : HOD } → A ∋ x → B ∋ x
|
|
265
|
|
266 open _⊆_
|
|
267 infixr 220 _⊆_
|
|
268
|
|
269 -- if we have & (x , x) ≡ osuc (& x), ⊆→o≤ → c<→o<
|
|
270 ⊆→o≤→c<→o< : ({x : HOD} → & (x , x) ≡ osuc (& x) )
|
|
271 → ({y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → & y o< osuc (& z) )
|
|
272 → {x y : HOD } → def (od y) ( & x ) → & x o< & y
|
|
273 ⊆→o≤→c<→o< peq ⊆→o≤ {x} {y} y∋x with trio< (& x) (& y)
|
|
274 ⊆→o≤→c<→o< peq ⊆→o≤ {x} {y} y∋x | tri< a ¬b ¬c = a
|
|
275 ⊆→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 )))
|
|
276 ⊆→o≤→c<→o< peq ⊆→o≤ {x} {y} y∋x | tri> ¬a ¬b c =
|
|
277 ⊥-elim ( o<> (⊆→o≤ {x , x} {y} y⊆x,x ) lemma1 ) where
|
|
278 lemma : {z : Ordinal} → (z ≡ & x) ∨ (z ≡ & x) → & x ≡ z
|
|
279 lemma (case1 refl) = refl
|
|
280 lemma (case2 refl) = refl
|
|
281 y⊆x,x : {z : Ordinal} → def (od (x , x)) z → def (od y) z
|
|
282 y⊆x,x {z} lt = subst (λ k → def (od y) k ) (lemma lt) y∋x
|
|
283 lemma1 : osuc (& y) o< & (x , x)
|
|
284 lemma1 = subst (λ k → osuc (& y) o< k ) (sym (peq {x})) (osucc c )
|
|
285
|
|
286 ε-induction : { ψ : HOD → Set (suc n)}
|
|
287 → ( {x : HOD } → ({ y : HOD } → x ∋ y → ψ y ) → ψ x )
|
|
288 → (x : HOD ) → ψ x
|
|
289 ε-induction {ψ} ind x = subst (λ k → ψ k ) *iso (ε-induction-ord (osuc (& x)) <-osuc ) where
|
|
290 induction : (ox : Ordinal) → ((oy : Ordinal) → oy o< ox → ψ (* oy)) → ψ (* ox)
|
|
291 induction ox prev = ind ( λ {y} lt → subst (λ k → ψ k ) *iso (prev (& y) (o<-subst (c<→o< lt) refl &iso )))
|
|
292 ε-induction-ord : (ox : Ordinal) { oy : Ordinal } → oy o< ox → ψ (* oy)
|
|
293 ε-induction-ord ox {oy} lt = TransFinite {λ oy → ψ (* oy)} induction oy
|
|
294
|
|
295 Select : (X : HOD ) → ((x : HOD ) → Set n ) → HOD
|
|
296 Select X ψ = record { od = record { def = λ x → ( odef X x ∧ ψ ( * x )) } ; odmax = odmax X ; <odmax = λ y → <odmax X (proj1 y) }
|
|
297
|
|
298 Replace : HOD → (HOD → HOD) → HOD
|
|
299 Replace X ψ = record { od = record { def = λ x → (x o< sup-o X (λ y X∋y → & (ψ (* y)))) ∧ def (in-codomain X ψ) x }
|
|
300 ; odmax = rmax ; <odmax = rmax<} where
|
|
301 rmax : Ordinal
|
|
302 rmax = sup-o X (λ y X∋y → & (ψ (* y)))
|
|
303 rmax< : {y : Ordinal} → (y o< rmax) ∧ def (in-codomain X ψ) y → y o< rmax
|
|
304 rmax< lt = proj1 lt
|
|
305
|
|
306 --
|
|
307 -- If we have LEM, Replace' is equivalent to Replace
|
|
308 --
|
|
309 in-codomain' : (X : HOD ) → ((x : HOD) → X ∋ x → HOD) → OD
|
|
310 in-codomain' X ψ = record { def = λ x → ¬ ( (y : Ordinal ) → ¬ ( odef X y ∧ ((lt : odef X y) → x ≡ & (ψ (* y ) (d→∋ X lt) )))) }
|
|
311 Replace' : (X : HOD) → ((x : HOD) → X ∋ x → HOD) → HOD
|
|
312 Replace' X ψ = record { od = record { def = λ x → (x o< sup-o X (λ y X∋y → & (ψ (* y) (d→∋ X X∋y) ))) ∧ def (in-codomain' X ψ) x }
|
|
313 ; odmax = rmax ; <odmax = rmax< } where
|
|
314 rmax : Ordinal
|
|
315 rmax = sup-o X (λ y X∋y → & (ψ (* y) (d→∋ X X∋y)))
|
|
316 rmax< : {y : Ordinal} → (y o< rmax) ∧ def (in-codomain' X ψ) y → y o< rmax
|
|
317 rmax< lt = proj1 lt
|
|
318
|
|
319 Union : HOD → HOD
|
|
320 Union U = record { od = record { def = λ x → ¬ (∀ (u : Ordinal ) → ¬ ((odef U u) ∧ (odef (* u) x))) }
|
|
321 ; odmax = osuc (& U) ; <odmax = umax< } where
|
|
322 umax< : {y : Ordinal} → ¬ ((u : Ordinal) → ¬ def (od U) u ∧ def (od (* u)) y) → y o< osuc (& U)
|
|
323 umax< {y} not = lemma (FExists _ lemma1 not ) where
|
|
324 lemma0 : {x : Ordinal} → def (od (* x)) y → y o< x
|
|
325 lemma0 {x} x<y = subst₂ (λ j k → j o< k ) &iso &iso (c<→o< (d→∋ (* x) x<y ))
|
|
326 lemma2 : {x : Ordinal} → def (od U) x → x o< & U
|
|
327 lemma2 {x} x<U = subst (λ k → k o< & U ) &iso (c<→o< (d→∋ U x<U))
|
|
328 lemma1 : {x : Ordinal} → def (od U) x ∧ def (od (* x)) y → ¬ (& U o< y)
|
|
329 lemma1 {x} lt u<y = o<> u<y (ordtrans (lemma0 (proj2 lt)) (lemma2 (proj1 lt)) )
|
|
330 lemma : ¬ ((& U) o< y ) → y o< osuc (& U)
|
|
331 lemma not with trio< y (& U)
|
|
332 lemma not | tri< a ¬b ¬c = ordtrans a <-osuc
|
|
333 lemma not | tri≈ ¬a refl ¬c = <-osuc
|
|
334 lemma not | tri> ¬a ¬b c = ⊥-elim (not c)
|
|
335 _∈_ : ( A B : HOD ) → Set n
|
|
336 A ∈ B = B ∋ A
|
|
337
|
|
338 OPwr : (A : HOD ) → HOD
|
|
339 OPwr A = Ord ( sup-o (Ord (osuc (& A))) ( λ x A∋x → & ( A ∩ (* x)) ) )
|
|
340
|
|
341 Power : HOD → HOD
|
|
342 Power A = Replace (OPwr (Ord (& A))) ( λ x → A ∩ x )
|
|
343 -- {_} : ZFSet → ZFSet
|
|
344 -- { x } = ( x , x ) -- better to use (x , x) directly
|
|
345
|
|
346 union→ : (X z u : HOD) → (X ∋ u) ∧ (u ∋ z) → Union X ∋ z
|
|
347 union→ X z u xx not = ⊥-elim ( not (& u) ( ⟪ proj1 xx
|
|
348 , subst ( λ k → odef k (& z)) (sym *iso) (proj2 xx) ⟫ ))
|
|
349 union← : (X z : HOD) (X∋z : Union X ∋ z) → ¬ ( (u : HOD ) → ¬ ((X ∋ u) ∧ (u ∋ z )))
|
|
350 union← X z UX∋z = FExists _ lemma UX∋z where
|
|
351 lemma : {y : Ordinal} → odef X y ∧ odef (* y) (& z) → ¬ ((u : HOD) → ¬ (X ∋ u) ∧ (u ∋ z))
|
|
352 lemma {y} xx not = not (* y) ⟪ d→∋ X (proj1 xx) , proj2 xx ⟫
|
|
353
|
|
354 data infinite-d : ( x : Ordinal ) → Set n where
|
|
355 iφ : infinite-d o∅
|
|
356 isuc : {x : Ordinal } → infinite-d x →
|
|
357 infinite-d (& ( Union (* x , (* x , * x ) ) ))
|
|
358
|
|
359 -- ω can be diverged in our case, since we have no restriction on the corresponding ordinal of a pair.
|
|
360 -- We simply assumes infinite-d y has a maximum.
|
|
361 --
|
|
362 -- This means that many of OD may not be HODs because of the & mapping divergence.
|
|
363 -- We should have some axioms to prevent this such as & x o< next (odmax x).
|
|
364 --
|
|
365 -- postulate
|
|
366 -- ωmax : Ordinal
|
|
367 -- <ωmax : {y : Ordinal} → infinite-d y → y o< ωmax
|
|
368 --
|
|
369 -- infinite : HOD
|
|
370 -- infinite = record { od = record { def = λ x → infinite-d x } ; odmax = ωmax ; <odmax = <ωmax }
|
|
371
|
|
372 infinite : HOD
|
|
373 infinite = record { od = record { def = λ x → infinite-d x } ; odmax = next o∅ ; <odmax = lemma } where
|
|
374 u : (y : Ordinal ) → HOD
|
|
375 u y = Union (* y , (* y , * y))
|
|
376 -- next< : {x y z : Ordinal} → x o< next z → y o< next x → y o< next z
|
|
377 lemma8 : {y : Ordinal} → & (* y , * y) o< next (odmax (* y , * y))
|
|
378 lemma8 = ho<
|
|
379 --- (x,y) < next (omax x y) < next (osuc y) = next y
|
|
380 lemmaa : {x y : HOD} → & x o< & y → & (x , y) o< next (& y)
|
|
381 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< )
|
|
382 lemma81 : {y : Ordinal} → & (* y , * y) o< next (& (* y))
|
|
383 lemma81 {y} = nexto=n (subst (λ k → & (* y , * y) o< k ) (cong (λ k → next k) (omxx _)) lemma8)
|
|
384 lemma9 : {y : Ordinal} → & (* y , (* y , * y)) o< next (& (* y , * y))
|
|
385 lemma9 = lemmaa (c<→o< (case1 refl))
|
|
386 lemma71 : {y : Ordinal} → & (* y , (* y , * y)) o< next (& (* y))
|
|
387 lemma71 = next< lemma81 lemma9
|
|
388 lemma1 : {y : Ordinal} → & (u y) o< next (osuc (& (* y , (* y , * y))))
|
|
389 lemma1 = ho<
|
|
390 --- main recursion
|
|
391 lemma : {y : Ordinal} → infinite-d y → y o< next o∅
|
|
392 lemma {o∅} iφ = x<nx
|
|
393 lemma (isuc {y} x) = next< (lemma x) (next< (subst (λ k → & (* y , (* y , * y)) o< next k) &iso lemma71 ) (nexto=n lemma1))
|
|
394
|
|
395 empty : (x : HOD ) → ¬ (od∅ ∋ x)
|
|
396 empty x = ¬x<0
|
|
397
|
|
398 _=h=_ : (x y : HOD) → Set n
|
|
399 x =h= y = od x == od y
|
|
400
|
|
401 pair→ : ( x y t : HOD ) → (x , y) ∋ t → ( t =h= x ) ∨ ( t =h= y )
|
|
402 pair→ x y t (case1 t≡x ) = case1 (subst₂ (λ j k → j =h= k ) *iso *iso (o≡→== t≡x ))
|
|
403 pair→ x y t (case2 t≡y ) = case2 (subst₂ (λ j k → j =h= k ) *iso *iso (o≡→== t≡y ))
|
|
404
|
|
405 pair← : ( x y t : HOD ) → ( t =h= x ) ∨ ( t =h= y ) → (x , y) ∋ t
|
|
406 pair← x y t (case1 t=h=x) = case1 (cong (λ k → & k ) (==→o≡ t=h=x))
|
|
407 pair← x y t (case2 t=h=y) = case2 (cong (λ k → & k ) (==→o≡ t=h=y))
|
|
408
|
|
409 o<→c< : {x y : Ordinal } → x o< y → (Ord x) ⊆ (Ord y)
|
|
410 o<→c< lt = record { incl = λ z → ordtrans z lt }
|
|
411
|
|
412 ⊆→o< : {x y : Ordinal } → (Ord x) ⊆ (Ord y) → x o< osuc y
|
|
413 ⊆→o< {x} {y} lt with trio< x y
|
|
414 ⊆→o< {x} {y} lt | tri< a ¬b ¬c = ordtrans a <-osuc
|
|
415 ⊆→o< {x} {y} lt | tri≈ ¬a b ¬c = subst ( λ k → k o< osuc y) (sym b) <-osuc
|
|
416 ⊆→o< {x} {y} lt | tri> ¬a ¬b c with (incl lt) (o<-subst c (sym &iso) refl )
|
|
417 ... | ttt = ⊥-elim ( o<¬≡ refl (o<-subst ttt &iso refl ))
|
|
418
|
|
419 ψiso : {ψ : HOD → Set n} {x y : HOD } → ψ x → x ≡ y → ψ y
|
|
420 ψiso {ψ} t refl = t
|
|
421 selection : {ψ : HOD → Set n} {X y : HOD} → ((X ∋ y) ∧ ψ y) ⇔ (Select X ψ ∋ y)
|
|
422 selection {ψ} {X} {y} = ⟪
|
|
423 ( λ cond → ⟪ proj1 cond , ψiso {ψ} (proj2 cond) (sym *iso) ⟫ )
|
|
424 , ( λ select → ⟪ proj1 select , ψiso {ψ} (proj2 select) *iso ⟫ )
|
|
425 ⟫
|
|
426
|
|
427 selection-in-domain : {ψ : HOD → Set n} {X y : HOD} → Select X ψ ∋ y → X ∋ y
|
|
428 selection-in-domain {ψ} {X} {y} lt = proj1 ((proj2 (selection {ψ} {X} )) lt)
|
|
429
|
|
430 sup-c< : (ψ : HOD → HOD) → {X x : HOD} → X ∋ x → & (ψ x) o< (sup-o X (λ y X∋y → & (ψ (* y))))
|
|
431 sup-c< ψ {X} {x} lt = subst (λ k → & (ψ k) o< _ ) *iso (sup-o< X lt )
|
|
432 replacement← : {ψ : HOD → HOD} (X x : HOD) → X ∋ x → Replace X ψ ∋ ψ x
|
|
433 replacement← {ψ} X x lt = ⟪ sup-c< ψ {X} {x} lt , lemma ⟫ where
|
|
434 lemma : def (in-codomain X ψ) (& (ψ x))
|
|
435 lemma not = ⊥-elim ( not ( & x ) ⟪ lt , cong (λ k → & (ψ k)) (sym *iso)⟫ )
|
|
436 replacement→ : {ψ : HOD → HOD} (X x : HOD) → (lt : Replace X ψ ∋ x) → ¬ ( (y : HOD) → ¬ (x =h= ψ y))
|
|
437 replacement→ {ψ} X x lt = contra-position lemma (lemma2 (proj2 lt)) where
|
|
438 lemma2 : ¬ ((y : Ordinal) → ¬ odef X y ∧ ((& x) ≡ & (ψ (* y))))
|
|
439 → ¬ ((y : Ordinal) → ¬ odef X y ∧ (* (& x) =h= ψ (* y)))
|
|
440 lemma2 not not2 = not ( λ y d → not2 y ⟪ proj1 d , lemma3 (proj2 d)⟫) where
|
|
441 lemma3 : {y : Ordinal } → (& x ≡ & (ψ (* y))) → (* (& x) =h= ψ (* y))
|
|
442 lemma3 {y} eq = subst (λ k → * (& x) =h= k ) *iso (o≡→== eq )
|
|
443 lemma : ( (y : HOD) → ¬ (x =h= ψ y)) → ( (y : Ordinal) → ¬ odef X y ∧ (* (& x) =h= ψ (* y)) )
|
|
444 lemma not y not2 = not (* y) (subst (λ k → k =h= ψ (* y)) *iso ( proj2 not2 ))
|
|
445
|
|
446 ---
|
|
447 --- Power Set
|
|
448 ---
|
|
449 --- First consider ordinals in HOD
|
|
450 ---
|
|
451 --- A ∩ x = record { def = λ y → odef A y ∧ odef x y } subset of A
|
|
452 --
|
|
453 --
|
|
454 ∩-≡ : { a b : HOD } → ({x : HOD } → (a ∋ x → b ∋ x)) → a =h= ( b ∩ a )
|
|
455 ∩-≡ {a} {b} inc = record {
|
|
456 eq→ = λ {x} x<a → ⟪ (subst (λ k → odef b k ) &iso (inc (d→∋ a x<a))) , x<a ⟫ ;
|
|
457 eq← = λ {x} x<a∩b → proj2 x<a∩b }
|
|
458 --
|
|
459 -- Transitive Set case
|
|
460 -- we have t ∋ x → Ord a ∋ x means t is a subset of Ord a, that is (Ord a) ∩ t =h= t
|
|
461 -- OPwr (Ord a) is a sup of (Ord a) ∩ t, so OPwr (Ord a) ∋ t
|
|
462 -- OPwr A = Ord ( sup-o ( λ x → & ( A ∩ (* x )) ) )
|
|
463 --
|
|
464 ord-power← : (a : Ordinal ) (t : HOD) → ({x : HOD} → (t ∋ x → (Ord a) ∋ x)) → OPwr (Ord a) ∋ t
|
|
465 ord-power← a t t→A = subst (λ k → odef (OPwr (Ord a)) k ) (lemma1 lemma-eq) lemma where
|
|
466 lemma-eq : ((Ord a) ∩ t) =h= t
|
|
467 eq→ lemma-eq {z} w = proj2 w
|
|
468 eq← lemma-eq {z} w = ⟪ subst (λ k → odef (Ord a) k ) &iso ( t→A (d→∋ t w)) , w ⟫
|
|
469 lemma1 : {a : Ordinal } { t : HOD }
|
|
470 → (eq : ((Ord a) ∩ t) =h= t) → & ((Ord a) ∩ (* (& t))) ≡ & t
|
|
471 lemma1 {a} {t} eq = subst (λ k → & ((Ord a) ∩ k) ≡ & t ) (sym *iso) (cong (λ k → & k ) (==→o≡ eq ))
|
|
472 lemma2 : (& t) o< (osuc (& (Ord a)))
|
|
473 lemma2 = ⊆→o≤ {t} {Ord a} (λ {x} x<t → subst (λ k → def (od (Ord a)) k) &iso (t→A (d→∋ t x<t)))
|
|
474 lemma : & ((Ord a) ∩ (* (& t)) ) o< sup-o (Ord (osuc (& (Ord a)))) (λ x lt → & ((Ord a) ∩ (* x)))
|
|
475 lemma = sup-o< _ lemma2
|
|
476
|
|
477 --
|
|
478 -- Every set in HOD is a subset of Ordinals, so make OPwr (Ord (& A)) first
|
|
479 -- then replace of all elements of the Power set by A ∩ y
|
|
480 --
|
|
481 -- Power A = Replace (OPwr (Ord (& A))) ( λ y → A ∩ y )
|
|
482
|
|
483 -- we have oly double negation form because of the replacement axiom
|
|
484 --
|
|
485 power→ : ( A t : HOD) → Power A ∋ t → {x : HOD} → t ∋ x → ¬ ¬ (A ∋ x)
|
|
486 power→ A t P∋t {x} t∋x = FExists _ lemma5 lemma4 where
|
|
487 a = & A
|
|
488 lemma2 : ¬ ( (y : HOD) → ¬ (t =h= (A ∩ y)))
|
|
489 lemma2 = replacement→ {λ x → A ∩ x} (OPwr (Ord (& A))) t P∋t
|
|
490 lemma3 : (y : HOD) → t =h= ( A ∩ y ) → ¬ ¬ (A ∋ x)
|
|
491 lemma3 y eq not = not (proj1 (eq→ eq t∋x))
|
|
492 lemma4 : ¬ ((y : Ordinal) → ¬ (t =h= (A ∩ * y)))
|
|
493 lemma4 not = lemma2 ( λ y not1 → not (& y) (subst (λ k → t =h= ( A ∩ k )) (sym *iso) not1 ))
|
|
494 lemma5 : {y : Ordinal} → t =h= (A ∩ * y) → ¬ ¬ (odef A (& x))
|
|
495 lemma5 {y} eq not = (lemma3 (* y) eq) not
|
|
496
|
|
497 power← : (A t : HOD) → ({x : HOD} → (t ∋ x → A ∋ x)) → Power A ∋ t
|
|
498 power← A t t→A = ⟪ lemma1 , lemma2 ⟫ where
|
|
499 a = & A
|
|
500 lemma0 : {x : HOD} → t ∋ x → Ord a ∋ x
|
|
501 lemma0 {x} t∋x = c<→o< (t→A t∋x)
|
|
502 lemma3 : OPwr (Ord a) ∋ t
|
|
503 lemma3 = ord-power← a t lemma0
|
|
504 lemma4 : (A ∩ * (& t)) ≡ t
|
|
505 lemma4 = let open ≡-Reasoning in begin
|
|
506 A ∩ * (& t)
|
|
507 ≡⟨ cong (λ k → A ∩ k) *iso ⟩
|
|
508 A ∩ t
|
|
509 ≡⟨ sym (==→o≡ ( ∩-≡ {t} {A} t→A )) ⟩
|
|
510 t
|
|
511 ∎
|
|
512 sup1 : Ordinal
|
|
513 sup1 = sup-o (Ord (osuc (& (Ord (& A))))) (λ x A∋x → & ((Ord (& A)) ∩ (* x)))
|
|
514 lemma9 : def (od (Ord (Ordinals.osuc O (& (Ord (& A)))))) (& (Ord (& A)))
|
|
515 lemma9 = <-osuc
|
|
516 lemmab : & ((Ord (& A)) ∩ (* (& (Ord (& A) )))) o< sup1
|
|
517 lemmab = sup-o< (Ord (osuc (& (Ord (& A))))) lemma9
|
|
518 lemmad : Ord (osuc (& A)) ∋ t
|
|
519 lemmad = ⊆→o≤ (λ {x} lt → subst (λ k → def (od A) k ) &iso (t→A (d→∋ t lt)))
|
|
520 lemmac : ((Ord (& A)) ∩ (* (& (Ord (& A) )))) =h= Ord (& A)
|
|
521 lemmac = record { eq→ = lemmaf ; eq← = lemmag } where
|
|
522 lemmaf : {x : Ordinal} → def (od ((Ord (& A)) ∩ (* (& (Ord (& A)))))) x → def (od (Ord (& A))) x
|
|
523 lemmaf {x} lt = proj1 lt
|
|
524 lemmag : {x : Ordinal} → def (od (Ord (& A))) x → def (od ((Ord (& A)) ∩ (* (& (Ord (& A)))))) x
|
|
525 lemmag {x} lt = ⟪ lt , subst (λ k → def (od k) x) (sym *iso) lt ⟫
|
|
526 lemmae : & ((Ord (& A)) ∩ (* (& (Ord (& A))))) ≡ & (Ord (& A))
|
|
527 lemmae = cong (λ k → & k ) ( ==→o≡ lemmac)
|
|
528 lemma7 : def (od (OPwr (Ord (& A)))) (& t)
|
|
529 lemma7 with osuc-≡< lemmad
|
|
530 lemma7 | case2 lt = ordtrans (c<→o< lt) (subst (λ k → k o< sup1) lemmae lemmab )
|
|
531 lemma7 | case1 eq with osuc-≡< (⊆→o≤ {* (& t)} {* (& (Ord (& t)))} (λ {x} lt → lemmah lt )) where
|
|
532 lemmah : {x : Ordinal } → def (od (* (& t))) x → def (od (* (& (Ord (& t))))) x
|
|
533 lemmah {x} lt = subst (λ k → def (od k) x ) (sym *iso) (subst (λ k → k o< (& t))
|
|
534 &iso
|
|
535 (c<→o< (subst₂ (λ j k → def (od j) k) *iso (sym &iso) lt )))
|
|
536 lemma7 | case1 eq | case1 eq1 = subst (λ k → k o< sup1) (trans lemmae lemmai) lemmab where
|
|
537 lemmai : & (Ord (& A)) ≡ & t
|
|
538 lemmai = let open ≡-Reasoning in begin
|
|
539 & (Ord (& A))
|
|
540 ≡⟨ sym (cong (λ k → & (Ord k)) eq) ⟩
|
|
541 & (Ord (& t))
|
|
542 ≡⟨ sym &iso ⟩
|
|
543 & (* (& (Ord (& t))))
|
|
544 ≡⟨ sym eq1 ⟩
|
|
545 & (* (& t))
|
|
546 ≡⟨ &iso ⟩
|
|
547 & t
|
|
548 ∎
|
|
549 lemma7 | case1 eq | case2 lt = ordtrans lemmaj (subst (λ k → k o< sup1) lemmae lemmab ) where
|
|
550 lemmak : & (* (& (Ord (& t)))) ≡ & (Ord (& A))
|
|
551 lemmak = let open ≡-Reasoning in begin
|
|
552 & (* (& (Ord (& t))))
|
|
553 ≡⟨ &iso ⟩
|
|
554 & (Ord (& t))
|
|
555 ≡⟨ cong (λ k → & (Ord k)) eq ⟩
|
|
556 & (Ord (& A))
|
|
557 ∎
|
|
558 lemmaj : & t o< & (Ord (& A))
|
|
559 lemmaj = subst₂ (λ j k → j o< k ) &iso lemmak lt
|
|
560 lemma1 : & t o< sup-o (OPwr (Ord (& A))) (λ x lt → & (A ∩ (* x)))
|
|
561 lemma1 = subst (λ k → & k o< sup-o (OPwr (Ord (& A))) (λ x lt → & (A ∩ (* x))))
|
|
562 lemma4 (sup-o< (OPwr (Ord (& A))) lemma7 )
|
|
563 lemma2 : def (in-codomain (OPwr (Ord (& A))) (_∩_ A)) (& t)
|
|
564 lemma2 not = ⊥-elim ( not (& t) ⟪ lemma3 , lemma6 ⟫ ) where
|
|
565 lemma6 : & t ≡ & (A ∩ * (& t))
|
|
566 lemma6 = cong ( λ k → & k ) (==→o≡ (subst (λ k → t =h= (A ∩ k)) (sym *iso) ( ∩-≡ {t} {A} t→A )))
|
|
567
|
|
568
|
|
569 extensionality0 : {A B : HOD } → ((z : HOD) → (A ∋ z) ⇔ (B ∋ z)) → A =h= B
|
|
570 eq→ (extensionality0 {A} {B} eq ) {x} d = odef-iso {A} {B} (sym &iso) (proj1 (eq (* x))) d
|
|
571 eq← (extensionality0 {A} {B} eq ) {x} d = odef-iso {B} {A} (sym &iso) (proj2 (eq (* x))) d
|
|
572
|
|
573 extensionality : {A B w : HOD } → ((z : HOD ) → (A ∋ z) ⇔ (B ∋ z)) → (w ∋ A) ⇔ (w ∋ B)
|
|
574 proj1 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) ( ==→o≡ (extensionality0 {A} {B} eq) ) d
|
|
575 proj2 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) (sym ( ==→o≡ (extensionality0 {A} {B} eq) )) d
|
|
576
|
|
577 infinity∅ : infinite ∋ od∅
|
|
578 infinity∅ = subst (λ k → odef infinite k ) lemma iφ where
|
|
579 lemma : o∅ ≡ & od∅
|
|
580 lemma = let open ≡-Reasoning in begin
|
|
581 o∅
|
|
582 ≡⟨ sym &iso ⟩
|
|
583 & ( * o∅ )
|
|
584 ≡⟨ cong ( λ k → & k ) o∅≡od∅ ⟩
|
|
585 & od∅
|
|
586 ∎
|
|
587 infinity : (x : HOD) → infinite ∋ x → infinite ∋ Union (x , (x , x ))
|
|
588 infinity x lt = subst (λ k → odef infinite k ) lemma (isuc {& x} lt) where
|
|
589 lemma : & (Union (* (& x) , (* (& x) , * (& x))))
|
|
590 ≡ & (Union (x , (x , x)))
|
|
591 lemma = cong (λ k → & (Union ( k , ( k , k ) ))) *iso
|
|
592
|
|
593 isZF : IsZF (HOD ) _∋_ _=h=_ od∅ _,_ Union Power Select Replace infinite
|
|
594 isZF = record {
|
|
595 isEquivalence = record { refl = ==-refl ; sym = ==-sym; trans = ==-trans }
|
|
596 ; pair→ = pair→
|
|
597 ; pair← = pair←
|
|
598 ; union→ = union→
|
|
599 ; union← = union←
|
|
600 ; empty = empty
|
|
601 ; power→ = power→
|
|
602 ; power← = power←
|
|
603 ; extensionality = λ {A} {B} {w} → extensionality {A} {B} {w}
|
|
604 ; ε-induction = ε-induction
|
|
605 ; infinity∅ = infinity∅
|
|
606 ; infinity = infinity
|
|
607 ; selection = λ {X} {ψ} {y} → selection {X} {ψ} {y}
|
|
608 ; replacement← = replacement←
|
|
609 ; replacement→ = λ {ψ} → replacement→ {ψ}
|
|
610 }
|
|
611
|
|
612 HOD→ZF : ZF
|
|
613 HOD→ZF = record {
|
|
614 ZFSet = HOD
|
|
615 ; _∋_ = _∋_
|
|
616 ; _≈_ = _=h=_
|
|
617 ; ∅ = od∅
|
|
618 ; _,_ = _,_
|
|
619 ; Union = Union
|
|
620 ; Power = Power
|
|
621 ; Select = Select
|
|
622 ; Replace = Replace
|
|
623 ; infinite = infinite
|
|
624 ; isZF = isZF
|
|
625 }
|
|
626
|
|
627
|