478
|
1 {-# OPTIONS --allow-unsolved-metas #-}
|
508
|
2 open import Level hiding ( suc ; zero )
|
431
|
3 open import Ordinals
|
497
|
4 import OD
|
|
5 module zorn {n : Level } (O : Ordinals {n}) (_<_ : (x y : OD.HOD O ) → Set n ) where
|
431
|
6
|
|
7 open import zf
|
477
|
8 open import logic
|
|
9 -- open import partfunc {n} O
|
|
10
|
|
11 open import Relation.Nullary
|
|
12 open import Relation.Binary
|
|
13 open import Data.Empty
|
431
|
14 open import Relation.Binary
|
|
15 open import Relation.Binary.Core
|
477
|
16 open import Relation.Binary.PropositionalEquality
|
|
17 import BAlgbra
|
431
|
18
|
|
19
|
|
20 open inOrdinal O
|
|
21 open OD O
|
|
22 open OD.OD
|
|
23 open ODAxiom odAxiom
|
477
|
24 import OrdUtil
|
|
25 import ODUtil
|
431
|
26 open Ordinals.Ordinals O
|
|
27 open Ordinals.IsOrdinals isOrdinal
|
|
28 open Ordinals.IsNext isNext
|
|
29 open OrdUtil O
|
477
|
30 open ODUtil O
|
|
31
|
|
32
|
|
33 import ODC
|
|
34
|
|
35
|
|
36 open _∧_
|
|
37 open _∨_
|
|
38 open Bool
|
431
|
39
|
|
40
|
|
41 open HOD
|
|
42
|
508
|
43 record Element (A : HOD) : Set (Level.suc n) where
|
469
|
44 field
|
|
45 elm : HOD
|
|
46 is-elm : A ∋ elm
|
|
47
|
|
48 open Element
|
|
49
|
509
|
50 _<A_ : {A : HOD} → (x y : Element A ) → Set n
|
|
51 x <A y = elm x < elm y
|
|
52 _≡A_ : {A : HOD} → (x y : Element A ) → Set (Level.suc n)
|
|
53 x ≡A y = elm x ≡ elm y
|
|
54
|
508
|
55 IsPartialOrderSet : ( A : HOD ) → Set (Level.suc n)
|
509
|
56 IsPartialOrderSet A = IsStrictPartialOrder (_≡A_ {A}) _<A_
|
490
|
57
|
492
|
58 open _==_
|
|
59 open _⊆_
|
|
60
|
495
|
61 isA : { A B : HOD } → B ⊆ A → (x : Element B) → Element A
|
|
62 isA B⊆A x = record { elm = elm x ; is-elm = incl B⊆A (is-elm x) }
|
494
|
63
|
497
|
64 ⊆-IsPartialOrderSet : { A B : HOD } → B ⊆ A → IsPartialOrderSet A → IsPartialOrderSet B
|
|
65 ⊆-IsPartialOrderSet {A} {B} B⊆A PA = record {
|
|
66 isEquivalence = record { refl = refl ; sym = sym ; trans = trans } ; trans = λ {x} {y} {z} → trans1 {x} {y} {z}
|
498
|
67 ; irrefl = λ {x} {y} → irrefl1 {x} {y} ; <-resp-≈ = resp0
|
493
|
68 } where
|
495
|
69 _<B_ : (x y : Element B ) → Set n
|
|
70 x <B y = elm x < elm y
|
|
71 trans1 : {x y z : Element B} → x <B y → y <B z → x <B z
|
|
72 trans1 {x} {y} {z} x<y y<z = IsStrictPartialOrder.trans PA {isA B⊆A x} {isA B⊆A y} {isA B⊆A z} x<y y<z
|
|
73 irrefl1 : {x y : Element B} → elm x ≡ elm y → ¬ ( x <B y )
|
|
74 irrefl1 {x} {y} x=y x<y = IsStrictPartialOrder.irrefl PA {isA B⊆A x} {isA B⊆A y} x=y x<y
|
|
75 open import Data.Product
|
|
76 resp0 : ({x y z : Element B} → elm y ≡ elm z → x <B y → x <B z) × ({x y z : Element B} → elm y ≡ elm z → y <B x → z <B x)
|
|
77 resp0 = Data.Product._,_ (λ {x} {y} {z} → proj₁ (IsStrictPartialOrder.<-resp-≈ PA) {isA B⊆A x } {isA B⊆A y }{isA B⊆A z })
|
|
78 (λ {x} {y} {z} → proj₂ (IsStrictPartialOrder.<-resp-≈ PA) {isA B⊆A x } {isA B⊆A y }{isA B⊆A z })
|
492
|
79
|
497
|
80 -- open import Relation.Binary.Properties.Poset as Poset
|
496
|
81
|
508
|
82 IsTotalOrderSet : ( A : HOD ) → Set (Level.suc n)
|
509
|
83 IsTotalOrderSet A = IsStrictTotalOrder (_≡A_ {A}) _<A_
|
490
|
84
|
469
|
85 me : { A a : HOD } → A ∋ a → Element A
|
|
86 me {A} {a} lt = record { elm = a ; is-elm = lt }
|
|
87
|
504
|
88 A∋x-irr : (A : HOD) {x y : HOD} → x ≡ y → (A ∋ x) ≡ (A ∋ y )
|
|
89 A∋x-irr A {x} {y} refl = refl
|
|
90
|
506
|
91 me-elm-refl : (A : HOD) → (x : Element A) → elm (me {A} (d→∋ A (is-elm x))) ≡ elm x
|
|
92 me-elm-refl A record { elm = ex ; is-elm = ax } = *iso
|
504
|
93
|
|
94 open import Relation.Binary.HeterogeneousEquality as HE using (_≅_ )
|
|
95
|
526
|
96 -- Don't use Element other than Order, you'll be in a trouble
|
517
|
97 -- postulate -- may be proved by transfinite induction and functional extentionality
|
|
98 -- ∋x-irr : (A : HOD) {x y : HOD} → x ≡ y → (ax : A ∋ x) (ay : A ∋ y ) → ax ≅ ay
|
|
99 -- odef-irr : (A : OD) {x y : Ordinal} → x ≡ y → (ax : def A x) (ay : def A y ) → ax ≅ ay
|
504
|
100
|
517
|
101 -- is-elm-irr : (A : HOD) → {x y : Element A } → elm x ≡ elm y → is-elm x ≅ is-elm y
|
|
102 -- is-elm-irr A {x} {y} eq = ∋x-irr A eq (is-elm x) (is-elm y )
|
504
|
103
|
|
104 El-irr2 : (A : HOD) → {x y : Element A } → elm x ≡ elm y → is-elm x ≅ is-elm y → x ≡ y
|
|
105 El-irr2 A {x} {y} refl HE.refl = refl
|
|
106
|
517
|
107 -- El-irr : {A : HOD} → {x y : Element A } → elm x ≡ elm y → x ≡ y
|
|
108 -- El-irr {A} {x} {y} eq = El-irr2 A eq ( is-elm-irr A eq )
|
504
|
109
|
526
|
110 record Set≈ (A B : Ordinal ) : Set n where
|
|
111 field
|
|
112 fun← : {x : Ordinal } → odef (* A) x → Ordinal
|
|
113 fun→ : {x : Ordinal } → odef (* B) x → Ordinal
|
|
114 funB : {x : Ordinal } → ( lt : odef (* A) x ) → odef (* B) ( fun← lt )
|
|
115 funA : {x : Ordinal } → ( lt : odef (* B) x ) → odef (* A) ( fun→ lt )
|
|
116 fiso← : {x : Ordinal } → ( lt : odef (* B) x ) → fun← ( funA lt ) ≡ x
|
|
117 fiso→ : {x : Ordinal } → ( lt : odef (* A) x ) → fun→ ( funB lt ) ≡ x
|
|
118
|
|
119 open Set≈
|
|
120 record OS≈ {A B : HOD} (TA : IsTotalOrderSet A ) (TB : IsTotalOrderSet B ) : Set (Level.suc n) where
|
|
121 field
|
|
122 iso : Set≈ (& A) (& B)
|
|
123 fmap : {x y : Ordinal} → (ax : odef A x) → (ay : odef A y) → * x < * y
|
|
124 → * (fun← iso (subst (λ k → odef k x) (sym *iso) ax)) < * (fun← iso (subst (λ k → odef k y) (sym *iso) ay))
|
|
125
|
|
126 Cut< : ( A x : HOD ) → HOD
|
|
127 Cut< A x = record { od = record { def = λ y → ( odef A y ) ∧ ( x < * y ) } ; odmax = & A
|
|
128 ; <odmax = λ lt → subst (λ k → k o< & A) &iso (c<→o< (subst (λ k → odef A k ) (sym &iso) (proj1 lt))) }
|
|
129
|
|
130 Cut<TA : {A : HOD} → (TA : IsTotalOrderSet A ) ( x : HOD )→ IsTotalOrderSet ( Cut< A x )
|
|
131 Cut<TA {A} TA x = record { isEquivalence = record { refl = refl ; trans = trans ; sym = sym }
|
|
132 ; trans = λ {x} {y} {z} → IsStrictTotalOrder.trans TA {me (proj1 (is-elm x))} {me (proj1 (is-elm y))} {me (proj1 (is-elm z))} ;
|
|
133 compare = λ x y → IsStrictTotalOrder.compare TA (me (proj1 (is-elm x))) (me (proj1 (is-elm y))) }
|
|
134
|
|
135 triTO : {A B : HOD} (TA : IsTotalOrderSet A ) (TB : IsTotalOrderSet B ) → {!!}
|
|
136 triTO = {!!}
|
|
137
|
508
|
138 record ZChain ( A : HOD ) (y : Ordinal) : Set (Level.suc n) where
|
464
|
139 field
|
497
|
140 max : HOD
|
|
141 A∋max : A ∋ max
|
|
142 y<max : y o< & max
|
|
143 chain : HOD
|
|
144 chain⊆A : chain ⊆ A
|
|
145 total : IsTotalOrderSet chain
|
|
146 chain-max : (x : HOD) → chain ∋ x → (x ≡ max ) ∨ ( x < max )
|
498
|
147
|
|
148 data IChain (A : HOD) : Ordinal → Set n where
|
|
149 ifirst : {ox : Ordinal} → odef A ox → IChain A ox
|
|
150 inext : {ox oy : Ordinal} → odef A oy → * ox < * oy → IChain A ox → IChain A oy
|
|
151
|
506
|
152 -- * ox < .. < * oy
|
|
153 ic-connect : {A : HOD} {oy : Ordinal} → (ox : Ordinal) → (iy : IChain A oy) → Set n
|
|
154 ic-connect {A} ox (ifirst {oy} ay) = Lift n ⊥
|
|
155 ic-connect {A} ox (inext {oy} {oz} ay y<z iz) = (ox ≡ oy) ∨ ic-connect ox iz
|
|
156
|
|
157 ic→odef : {A : HOD} {ox : Ordinal} → IChain A ox → odef A ox
|
|
158 ic→odef {A} {ox} (ifirst ax) = ax
|
|
159 ic→odef {A} {ox} (inext ax x<y ic) = ax
|
|
160
|
521
|
161 ic→< : {A : HOD} → IsPartialOrderSet A → (x : Ordinal) → odef A x → {y : Ordinal} → (iy : IChain A y) → ic-connect {A} {y} x iy → * x < * y
|
506
|
162 ic→< {A} PO x ax {y} (ifirst ay) ()
|
|
163 ic→< {A} PO x ax {y} (inext ay x<y iy) (case1 refl) = x<y
|
|
164 ic→< {A} PO x ax {y} (inext {oy} ay x<y iy) (case2 ic) = IsStrictPartialOrder.trans PO
|
|
165 {me (subst (λ k → odef A k) (sym &iso) ax )} {me (subst (λ k → odef A k) (sym &iso) (ic→odef {A} {oy} iy) ) } {me (subst (λ k → odef A k) (sym &iso) ay) }
|
|
166 (ic→< {A} PO x ax iy ic ) x<y
|
|
167
|
|
168 record IChained (A : HOD) (x y : Ordinal) : Set n where
|
|
169 field
|
|
170 iy : IChain A y
|
|
171 ic : ic-connect x iy
|
498
|
172
|
523
|
173 IChainSet : (A : HOD) {x : Ordinal} → odef A x → HOD
|
|
174 IChainSet A {x} ax = record { od = record { def = λ y → odef A y ∧ IChained A x y }
|
498
|
175 ; odmax = & A ; <odmax = λ {y} lt → subst (λ k → k o< & A) &iso (c<→o< (subst (λ k → odef A k) (sym &iso) (proj1 lt))) }
|
|
176
|
523
|
177 IChainSet⊆A : {A : HOD} → {x : Ordinal } → (ax : odef A x ) → IChainSet A ax ⊆ A
|
512
|
178 IChainSet⊆A {A} x = record { incl = λ {oy} y → proj1 y }
|
|
179
|
521
|
180 ¬IChained-refl : (A : HOD) {x : Ordinal} → IsPartialOrderSet A → ¬ IChained A x x
|
|
181 ¬IChained-refl A {x} PO record { iy = iy ; ic = ic } = IsStrictPartialOrder.irrefl PO
|
|
182 {me (subst (λ k → odef A k ) (sym &iso) ic0) } {me (subst (λ k → odef A k ) (sym &iso) ic0) } refl (ic→< {A} PO x ic0 iy ic ) where
|
|
183 ic0 : odef A x
|
|
184 ic0 = ic→odef {A} iy
|
|
185
|
498
|
186 -- there is a y, & y > & x
|
|
187
|
501
|
188 record OSup> (A : HOD) {x : Ordinal} (ax : A ∋ * x) : Set n where
|
498
|
189 field
|
501
|
190 y : Ordinal
|
523
|
191 icy : odef (IChainSet A ax ) y
|
501
|
192 y>x : x o< y
|
498
|
193
|
505
|
194 record IChainSup> (A : HOD) {x : Ordinal} (ax : A ∋ * x) : Set n where
|
|
195 field
|
|
196 y : Ordinal
|
|
197 A∋y : odef A y
|
|
198 y>x : * x < * y
|
|
199
|
498
|
200 -- finite IChain
|
|
201
|
523
|
202 ic→A∋y : (A : HOD) {x y : Ordinal} (ax : A ∋ * x) → odef (IChainSet A ax) y → A ∋ * y
|
511
|
203 ic→A∋y A {x} {y} ax ⟪ ay , _ ⟫ = subst (λ k → odef A k) (sym &iso) ay
|
|
204
|
525
|
205 record InfiniteChain (A : HOD) (max : Ordinal) {x : Ordinal} (ax : A ∋ * x) : Set n where
|
498
|
206 field
|
523
|
207 chain<x : (y : Ordinal ) → odef (IChainSet A ax) y → y o< max
|
|
208 c-infinite : (y : Ordinal ) → (cy : odef (IChainSet A ax) y )
|
511
|
209 → IChainSup> A (ic→A∋y A ax cy)
|
509
|
210
|
510
|
211 open import Data.Nat hiding (_<_)
|
|
212 import Data.Nat.Properties as NP
|
|
213 open import nat
|
|
214
|
514
|
215 data Chain (A : HOD) (s : Ordinal) (next : Ordinal → Ordinal ) : ( x : Ordinal ) → Set n where
|
513
|
216 cfirst : odef A s → Chain A s next s
|
514
|
217 csuc : (x : Ordinal ) → (ax : odef A x ) → Chain A s next x → odef A (next x) → Chain A s next (next x )
|
512
|
218
|
514
|
219 ct∈A : (A : HOD ) (s : Ordinal) → (next : Ordinal → Ordinal ) → {x : Ordinal} → Chain A s next x → odef A x
|
513
|
220 ct∈A A s next {x} (cfirst x₁) = x₁
|
514
|
221 ct∈A A s next {.(next x )} (csuc x ax t anx) = anx
|
509
|
222
|
517
|
223 --
|
|
224 -- extract single chain from countable infinite chains
|
|
225 --
|
514
|
226 ChainClosure : (A : HOD) (s : Ordinal) → (next : Ordinal → Ordinal ) → HOD
|
513
|
227 ChainClosure A s next = record { od = record { def = λ x → Chain A s next x } ; odmax = & A ; <odmax = cc01 } where
|
|
228 cc01 : {y : Ordinal} → Chain A s next y → y o< & A
|
|
229 cc01 {y} cy = subst (λ k → k o< & A ) &iso ( c<→o< (subst (λ k → odef A k ) (sym &iso) ( ct∈A A s next cy ) ) )
|
509
|
230
|
514
|
231 cton0 : (A : HOD ) (s : Ordinal) → (next : Ordinal → Ordinal ) {y : Ordinal } → Chain A s next y → ℕ
|
513
|
232 cton0 A s next (cfirst _) = zero
|
|
233 cton0 A s next (csuc x ax z _) = suc (cton0 A s next z)
|
514
|
234 cton : (A : HOD ) (s : Ordinal) → (next : Ordinal → Ordinal ) → Element (ChainClosure A s next) → ℕ
|
513
|
235 cton A s next y = cton0 A s next (is-elm y)
|
510
|
236
|
525
|
237 cinext : (A : HOD) {x max : Ordinal } → (ax : A ∋ * x ) → (ifc : InfiniteChain A max ax ) → Ordinal → Ordinal
|
523
|
238 cinext A ax ifc y with ODC.∋-p O (IChainSet A ax) (* y)
|
525
|
239 ... | yes ics-y = IChainSup>.y ( InfiniteChain.c-infinite ifc y (subst (λ k → odef (IChainSet A ax) k) &iso ics-y ))
|
514
|
240 ... | no _ = o∅
|
|
241
|
522
|
242 InFCSet : (A : HOD) → {x max : Ordinal} (ax : A ∋ * x)
|
525
|
243 → (ifc : InfiniteChain A max ax ) → HOD
|
523
|
244 InFCSet A {x} ax ifc = ChainClosure (IChainSet A ax) x (cinext A ax ifc )
|
509
|
245
|
525
|
246 InFCSet⊆A : (A : HOD) → {x max : Ordinal} (ax : A ∋ * x) → (ifc : InfiniteChain A max ax ) → InFCSet A ax ifc ⊆ A
|
523
|
247 InFCSet⊆A A {x} ax ifc = record { incl = λ {y} lt → incl (IChainSet⊆A ax) (
|
|
248 ct∈A (IChainSet A ax) x (cinext A ax ifc) lt ) }
|
512
|
249
|
525
|
250 cinext→IChainSup : (A : HOD) {x max : Ordinal } → (ax : A ∋ * x ) → (ifc : InfiniteChain A max ax ) → (y : Ordinal )
|
|
251 → (ay1 : IChainSet A ax ∋ * y ) → IChainSup> A (subst (odef A) (sym &iso) (proj1 (subst (λ k → odef (IChainSet A ax) k) &iso ay1)))
|
|
252 cinext→IChainSup A {x} ax ifc y ay with ODC.∋-p O (IChainSet A ax) (* y)
|
|
253 ... | no not = ⊥-elim ( not ay )
|
|
254 ... | yes ay1 = InfiniteChain.c-infinite ifc y (subst (λ k → odef (IChainSet A ax) k) &iso ay )
|
|
255
|
522
|
256 ChainClosure-is-total : (A : HOD) → {x max : Ordinal} (ax : A ∋ * x)
|
509
|
257 → IsPartialOrderSet A
|
525
|
258 → (ifc : InfiniteChain A max ax )
|
509
|
259 → IsTotalOrderSet ( InFCSet A ax ifc )
|
|
260 ChainClosure-is-total A {x} ax PO ifc = record { isEquivalence = IsStrictPartialOrder.isEquivalence IPO
|
|
261 ; trans = λ {x} {y} {z} → IsStrictPartialOrder.trans IPO {x} {y} {z} ; compare = cmp } where
|
|
262 IPO : IsPartialOrderSet (InFCSet A ax ifc )
|
512
|
263 IPO = ⊆-IsPartialOrderSet record { incl = λ {y} lt → incl (InFCSet⊆A A {x} ax ifc) lt} PO
|
523
|
264 B = IChainSet A ax
|
514
|
265 cnext = cinext A ax ifc
|
513
|
266 ct02 : {oy : Ordinal} → (y : Chain B x cnext oy ) → A ∋ * oy
|
523
|
267 ct02 y = incl (IChainSet⊆A {A} ax) (subst (λ k → odef (IChainSet A ax) k) (sym &iso) (ct∈A B x cnext y) )
|
513
|
268 ct-inject : {ox oy : Ordinal} → (x1 : Chain B x cnext ox ) → (y : Chain B x cnext oy )
|
|
269 → (cton0 B x cnext x1) ≡ (cton0 B x cnext y) → ox ≡ oy
|
|
270 ct-inject {ox} {ox} (cfirst x) (cfirst x₁) refl = refl
|
514
|
271 ct-inject {.(cnext x₀ )} {.(cnext x₃ )} (csuc x₀ ax x₁ x₂) (csuc x₃ ax₁ y x₄) eq = cong cnext ct05 where
|
513
|
272 ct06 : {x y : ℕ} → suc x ≡ suc y → x ≡ y
|
|
273 ct06 refl = refl
|
|
274 ct05 : x₀ ≡ x₃
|
|
275 ct05 = ct-inject x₁ y (ct06 eq)
|
|
276 ct-monotonic : {ox oy : Ordinal} → (x1 : Chain B x cnext ox ) → (y : Chain B x cnext oy )
|
|
277 → (cton0 B x cnext x1) Data.Nat.< (cton0 B x cnext y) → * ox < * oy
|
|
278 ct-monotonic {ox} {oy} x1 (csuc oy1 ay y _) (s≤s lt) with NP.<-cmp ( cton0 B x cnext x1 ) ( cton0 B x cnext y )
|
514
|
279 ... | tri< a ¬b ¬c = ct07 where
|
|
280 ct07 : * ox < * (cnext oy1)
|
523
|
281 ct07 with ODC.∋-p O (IChainSet A ax) (* oy1)
|
|
282 ... | no not = ⊥-elim ( not (subst (λ k → odef (IChainSet A ax) k ) (sym &iso) ay ) )
|
514
|
283 ... | yes ay1 = IsStrictPartialOrder.trans PO {me (ct02 x1) } {me (ct02 y)} {me ct031 } (ct-monotonic x1 y a ) ct011 where
|
525
|
284 ct031 : A ∋ * (IChainSup>.y (InfiniteChain.c-infinite ifc oy1 (subst (λ k → odef (IChainSet A ax) k) &iso ay1 ) ))
|
514
|
285 ct031 = subst (λ k → odef A k ) (sym &iso) (
|
525
|
286 IChainSup>.A∋y (InfiniteChain.c-infinite ifc oy1 (subst (λ k → odef (IChainSet A ax) k) &iso ay1 )) )
|
|
287 ct011 : * oy1 < * ( IChainSup>.y (InfiniteChain.c-infinite ifc oy1 (subst (λ k → odef (IChainSet A ax) k) &iso ay1 )) )
|
|
288 ct011 = IChainSup>.y>x (InfiniteChain.c-infinite ifc oy1 (subst (λ k → odef (IChainSet A ax) k) &iso ay1 ))
|
517
|
289 ... | tri≈ ¬a b ¬c = ct11 where
|
|
290 ct11 : * ox < * (cnext oy1)
|
523
|
291 ct11 with ODC.∋-p O (IChainSet A ax) (* oy1)
|
|
292 ... | no not = ⊥-elim ( not (subst (λ k → odef (IChainSet A ax) k ) (sym &iso) ay ) )
|
517
|
293 ... | yes ay1 = subst (λ k → * k < _) (sym (ct-inject _ _ b)) ct011 where
|
525
|
294 ct011 : * oy1 < * ( IChainSup>.y (InfiniteChain.c-infinite ifc oy1 (subst (λ k → odef (IChainSet A ax) k) &iso ay1 )) )
|
|
295 ct011 = IChainSup>.y>x (InfiniteChain.c-infinite ifc oy1 (subst (λ k → odef (IChainSet A ax) k) &iso ay1 ))
|
517
|
296 ... | tri> ¬a ¬b c = ⊥-elim ( nat-≤> lt c )
|
|
297 ct12 : {y z : Element (ChainClosure B x cnext) } → elm y ≡ elm z → elm y < elm z → ⊥
|
|
298 ct12 {y} {z} y=z y<z = IsStrictPartialOrder.irrefl IPO {y} {z} y=z y<z
|
|
299 ct13 : {y z : Element (ChainClosure B x cnext) } → elm y < elm z → elm z < elm y → ⊥
|
|
300 ct13 {y} {z} y<z y>z = IsStrictPartialOrder.irrefl IPO {y} {y} refl ( IsStrictPartialOrder.trans IPO {y} {z} {y} y<z y>z )
|
|
301 ct17 : (x1 : Element (ChainClosure B x cnext)) → Chain B x cnext (& (elm x1))
|
|
302 ct17 x1 = is-elm x1
|
509
|
303 cmp : Trichotomous _ _
|
513
|
304 cmp x1 y with NP.<-cmp (cton B x cnext x1) (cton B x cnext y)
|
517
|
305 ... | tri< a ¬b ¬c = tri< ct04 ct14 ct15 where
|
513
|
306 ct04 : elm x1 < elm y
|
|
307 ct04 = subst₂ (λ j k → j < k ) *iso *iso (ct-monotonic (is-elm x1) (is-elm y) a)
|
517
|
308 ct14 : ¬ elm x1 ≡ elm y
|
|
309 ct14 eq = ct12 {x1} {y} eq (subst₂ (λ j k → j < k ) *iso *iso (ct-monotonic (is-elm x1) (is-elm y) a ) )
|
|
310 ct15 : ¬ (elm y < elm x1)
|
|
311 ct15 lt = ct13 {y} {x1} lt (subst₂ (λ j k → j < k ) *iso *iso (ct-monotonic (is-elm x1) (is-elm y) a ) )
|
|
312 ... | tri≈ ¬a b ¬c = tri≈ (ct12 {x1} {y} ct16) ct16 (ct12 {y} {x1} (sym ct16)) where
|
|
313 ct16 : elm x1 ≡ elm y
|
|
314 ct16 = subst₂ (λ j k → j ≡ k ) *iso *iso (cong (*) (ct-inject {& (elm x1)} {& (elm y)} (is-elm x1) (is-elm y) b ))
|
|
315 ... | tri> ¬a ¬b c = tri> ct15 ct14 ct04 where
|
|
316 ct04 : elm y < elm x1
|
|
317 ct04 = subst₂ (λ j k → j < k ) *iso *iso (ct-monotonic (is-elm y) (is-elm x1) c)
|
|
318 ct14 : ¬ elm x1 ≡ elm y
|
|
319 ct14 eq = ct12 {y} {x1} (sym eq) (subst₂ (λ j k → j < k ) *iso *iso (ct-monotonic (is-elm y) (is-elm x1) c ) )
|
|
320 ct15 : ¬ (elm x1 < elm y)
|
|
321 ct15 lt = ct13 {x1} {y} lt (subst₂ (λ j k → j < k ) *iso *iso (ct-monotonic (is-elm y) (is-elm x1) c ) )
|
509
|
322
|
501
|
323
|
502
|
324 record IsFC (A : HOD) {x : Ordinal} (ax : A ∋ * x) (y : Ordinal) : Set n where
|
501
|
325 field
|
523
|
326 icy : odef (IChainSet A ax) y
|
520
|
327 c-finite : ¬ IChainSup> A (subst (λ k → odef A k ) (sym &iso) (proj1 icy) )
|
497
|
328
|
508
|
329 record Maximal ( A : HOD ) : Set (Level.suc n) where
|
503
|
330 field
|
|
331 maximal : HOD
|
|
332 A∋maximal : A ∋ maximal
|
|
333 ¬maximal<x : {x : HOD} → A ∋ x → ¬ maximal < x -- A is Partial, use negative
|
|
334
|
|
335 --
|
|
336 -- possible three cases in a limit ordinal step
|
|
337 --
|
507
|
338 -- case 1) < goes > x (will contradic in the transfinite induction )
|
503
|
339 -- case 2) no > x in some chain ( maximal )
|
507
|
340 -- case 3) countably infinite chain below x (will be prohibited by sup condtion )
|
503
|
341 --
|
|
342 Zorn-lemma-3case : { A : HOD }
|
498
|
343 → o∅ o< & A
|
|
344 → IsPartialOrderSet A
|
525
|
345 → (x : Ordinal ) → (ax : odef A x) → OSup> A (d→∋ A ax) ∨ Maximal A ∨ InfiniteChain A x (d→∋ A ax)
|
523
|
346 Zorn-lemma-3case {A} 0<A PO x ax = zc2 where
|
499
|
347 Gtx : HOD
|
523
|
348 Gtx = record { od = record { def = λ y → odef ( IChainSet A ax ) y ∧ ( x o< y ) } ; odmax = & A
|
501
|
349 ; <odmax = λ lt → subst (λ k → k o< & A) &iso (c<→o< (d→∋ A (proj1 (proj1 lt)))) }
|
|
350 HG : HOD
|
523
|
351 HG = record { od = record { def = λ y → odef A y ∧ IsFC A (d→∋ A ax ) y } ; odmax = & A
|
501
|
352 ; <odmax = λ lt → subst (λ k → k o< & A) &iso (c<→o< (d→∋ A (proj1 lt) )) }
|
525
|
353 zc2 : OSup> A (d→∋ A ax) ∨ Maximal A ∨ InfiniteChain A x (d→∋ A ax )
|
499
|
354 zc2 with is-o∅ (& Gtx)
|
504
|
355 ... | no not = case1 record { y = & y ; icy = zc4 ; y>x = proj2 zc3 } where
|
|
356 y : HOD
|
|
357 y = ODC.minimal O Gtx (λ eq → not (=od∅→≡o∅ eq))
|
523
|
358 zc3 : odef ( IChainSet A ax ) (& y) ∧ ( x o< (& y ))
|
504
|
359 zc3 = ODC.x∋minimal O Gtx (λ eq → not (=od∅→≡o∅ eq))
|
523
|
360 zc4 : odef (IChainSet A (subst (OD.def (od A)) (sym &iso) ax)) (& y)
|
|
361 zc4 = ⟪ proj1 (proj1 zc3) , (subst (λ k → IChained A k (& y)) (sym &iso) (proj2 (proj1 zc3))) ⟫
|
501
|
362 ... | yes nogt with is-o∅ (& HG)
|
505
|
363 ... | no finite-chain = case2 (case1 record { maximal = y ; A∋maximal = proj1 zc3 ; ¬maximal<x = zc4 } ) where
|
504
|
364 y : HOD
|
505
|
365 y = ODC.minimal O HG (λ eq → finite-chain (=od∅→≡o∅ eq))
|
523
|
366 zc3 : odef A (& y) ∧ IsFC A (d→∋ A ax ) (& y)
|
505
|
367 zc3 = ODC.x∋minimal O HG (λ eq → finite-chain (=od∅→≡o∅ eq))
|
504
|
368 zc4 : {z : HOD} → A ∋ z → ¬ (y < z)
|
523
|
369 zc4 {z} az y<z = IsFC.c-finite (proj2 zc3) record { y = & z ; A∋y = az ; y>x = subst₂ (λ j k → j < k ) (sym *iso) (sym *iso) y<z }
|
|
370 ... | yes inifite = case2 (case2 record { c-infinite = zc91 ; chain<x = zc10 } ) where
|
518
|
371 B : HOD
|
523
|
372 B = IChainSet A ax -- (me (subst (OD.def (od A)) (sym &iso) (is-elm x)))
|
|
373 B1 : HOD
|
|
374 B1 = IChainSet A (subst (OD.def (od A)) (sym &iso) ax)
|
518
|
375 Nx : (y : Ordinal) → odef A y → HOD
|
520
|
376 Nx y ay = record { od = record { def = λ x → odef A x ∧ ( * y < * x ) } ; odmax = & A
|
518
|
377 ; <odmax = λ lt → subst (λ k → k o< & A) &iso (c<→o< (d→∋ A (proj1 lt))) }
|
523
|
378 zc10 : (y : Ordinal) → odef (IChainSet A (subst (OD.def (od A)) (sym &iso) ax)) y → y o< x
|
521
|
379 zc10 oy icsy = zc21 where
|
523
|
380 zc20 : (y : HOD) → (IChainSet A ax) ∋ y → x o< & y → ⊥
|
521
|
381 zc20 y icsy lt = ¬A∋x→A≡od∅ Gtx ⟪ icsy , lt ⟫ nogt
|
523
|
382 zc22 : IChainSet A ax ∋ * oy
|
|
383 zc22 = ⟪ subst (λ k → odef A k) (sym &iso) (proj1 icsy) , subst₂ (λ j k → IChained A j k ) &iso (sym &iso) (proj2 icsy) ⟫
|
|
384 zc21 : oy o< x
|
|
385 zc21 with trio< oy x
|
521
|
386 ... | tri< a ¬b ¬c = a
|
523
|
387 ... | tri≈ ¬a b ¬c = ⊥-elim (¬IChained-refl A PO (subst₂ (λ j k → IChained A j k ) &iso b (proj2 icsy)) )
|
|
388 ... | tri> ¬a ¬b c = ⊥-elim ( zc20 (* oy) zc22 (subst (λ k → x o< k) (sym &iso) c ))
|
|
389 zc91 : (y : Ordinal) (cy : odef B1 y) → IChainSup> A (ic→A∋y A (subst (OD.def (od A)) (sym &iso) ax) cy)
|
|
390 zc91 y cy with is-o∅ (& (Nx y (proj1 cy) ))
|
519
|
391 ... | yes no-next = ⊥-elim zc16 where
|
523
|
392 zc18 : ¬ IChainSup> A (subst (odef A) (sym &iso) (proj1 (subst (λ k → odef (IChainSet A (d→∋ A ax)) k) (sym &iso) cy)))
|
520
|
393 zc18 ics = ¬A∋x→A≡od∅ (Nx y (proj1 cy) ) ⟪ subst (λ k → odef A k ) (sym &iso) (IChainSup>.A∋y ics)
|
|
394 , subst₂ (λ j k → j < k ) *iso (cong (*) (sym &iso))( IChainSup>.y>x ics) ⟫ no-next
|
523
|
395 zc17 : IsFC A {x} (d→∋ A ax) (& (* y))
|
|
396 zc17 = record { icy = subst (λ k → odef (IChainSet A (d→∋ A ax)) k) (sym &iso) cy ; c-finite = zc18 }
|
519
|
397 zc16 : ⊥
|
|
398 zc16 = ¬A∋x→A≡od∅ HG ⟪ subst (λ k → odef A k ) (sym &iso) (proj1 cy ) , zc17 ⟫ inifite
|
520
|
399 ... | no not = record { y = & zc13 ; A∋y = proj1 zc12 ; y>x = proj2 zc12 } where
|
519
|
400 zc13 = ODC.minimal O (Nx y (proj1 cy)) (λ eq → not (=od∅→≡o∅ eq ))
|
520
|
401 zc12 : odef A (& zc13 ) ∧ ( * y < * ( & zc13 ))
|
519
|
402 zc12 = ODC.x∋minimal O (Nx y (proj1 cy)) (λ eq → not (=od∅→≡o∅ eq ))
|
499
|
403
|
517
|
404 all-climb-case : { A : HOD } → (0<A : o∅ o< & A) → IsPartialOrderSet A
|
523
|
405 → (( x : Ordinal ) → (ax : odef A (& (* x))) → OSup> A ax )
|
524
|
406 → (x : HOD) ( ax : A ∋ x )
|
525
|
407 → InfiniteChain A (& A) (d→∋ A ax)
|
524
|
408 all-climb-case {A} 0<A PO climb x ax = record { c-infinite = ac00 ; chain<x = ac01 } where
|
523
|
409 B = IChainSet A ax
|
524
|
410 ac01 : (y : Ordinal) → odef (IChainSet A (d→∋ A ax)) y → y o< & A
|
522
|
411 ac01 y ⟪ ay , _ ⟫ = subst (λ k → k o< & A ) &iso (c<→o< (subst (λ k → odef A k ) (sym &iso) ay) )
|
523
|
412 ac00 : (y : Ordinal) (cy : odef (IChainSet A (d→∋ A ax)) y) → IChainSup> A (ic→A∋y A (d→∋ A ax) cy)
|
|
413 ac00 y cy = record { y = z ; A∋y = az ; y>x = y<z} where
|
|
414 ay : odef A (& (* y))
|
|
415 ay = subst (λ k → odef A k) (sym &iso) (proj1 cy)
|
522
|
416 z : Ordinal
|
523
|
417 z = OSup>.y ( climb y ay)
|
522
|
418 az : odef A z
|
523
|
419 az = subst (λ k → odef A k) &iso ( incl (IChainSet⊆A {A} ay ) (subst (λ k → odef (IChainSet A ay) k ) (sym &iso) (OSup>.icy ( climb y ay))))
|
|
420 icy : odef (IChainSet A ay ) z
|
|
421 icy = OSup>.icy ( climb y ay )
|
|
422 y<z : * y < * z
|
|
423 y<z = ic→< {A} PO y (subst (λ k → odef A k) &iso ay) (IChained.iy (proj2 icy))
|
|
424 (subst (λ k → ic-connect k (IChained.iy (proj2 icy))) &iso (IChained.ic (proj2 icy)))
|
522
|
425
|
526
|
426
|
|
427 record Indirect< {x z : HOD} (x<z : x < z ) : Set (Level.suc n) where
|
|
428 field
|
|
429 y y1 : HOD
|
|
430 =∨< : ( y ≡ y1 ) ∨ ( y < y1 )
|
|
431 dirct : ¬ ( (x < y ) ∧ ( y1 < z ))
|
|
432
|
|
433 record NChain ( A : HOD ) (f : { x : HOD} → A ∋ x → HOD) (min : HOD) : Set (Level.suc n) where
|
|
434 field
|
|
435 N : HOD
|
|
436 N⊆A : N ⊆ A
|
|
437 nmin : N ∋ min
|
|
438 is-min : (x : HOD) → N ∋ x → ( min ≡ x ) ∨ ( min < x )
|
|
439 total : IsTotalOrderSet N
|
|
440 A∋fx : { x : HOD} → (ax : A ∋ x ) → A ∋ f ax
|
|
441 atomic : { x y : HOD } → (nx : N ∋ x) → (x<y : x < y) → ¬ Indirect< x<y → y ≡ f (incl N⊆A nx )
|
|
442
|
508
|
443 record SUP ( A B : HOD ) : Set (Level.suc n) where
|
503
|
444 field
|
|
445 sup : HOD
|
|
446 A∋maximal : A ∋ sup
|
|
447 x<sup : {x : HOD} → B ∋ x → (x ≡ sup ) ∨ (x < sup ) -- B is Total, use positive
|
|
448
|
526
|
449 record Zfixpoint (A : HOD ) (f : { x : HOD} → A ∋ x → HOD) : Set (Level.suc n) where
|
|
450 field
|
|
451 fx : HOD
|
|
452 afx : A ∋ fx
|
|
453 is-fx : fx ≡ f afx
|
|
454
|
|
455 Zorn-fixpoint : { A : HOD }
|
|
456 → o∅ o< & A
|
|
457 → IsPartialOrderSet A
|
|
458 → ( ( B : HOD) → (B⊆A : B ⊆ A) → IsTotalOrderSet B → SUP A B ) -- SUP condition
|
|
459 → (f : { x : HOD} → A ∋ x → HOD ) → ( A∋fx : {x : HOD} (ax : A ∋ x ) → A ∋ f ax )
|
|
460 → (f≤ : {x : HOD} → (ax : A ∋ x ) → (x ≡ f ax ) ∨ (x < f ax ))
|
|
461 → Zfixpoint A f
|
|
462 Zorn-fixpoint = {!!}
|
|
463
|
|
464 record Zmono (A : HOD ) : Set (Level.suc n) where
|
|
465 field
|
|
466 f : { x : HOD} → A ∋ x → HOD
|
|
467 A∋fx : { x : HOD} → (ax : A ∋ x ) → A ∋ f ax
|
|
468 monotonic : { x y : HOD} → (ax : A ∋ x ) → x < f ax
|
|
469
|
|
470 Zorn-monotonic : { A : HOD }
|
|
471 → o∅ o< & A
|
|
472 → IsPartialOrderSet A
|
|
473 → ¬ ( Maximal A )
|
|
474 → Zmono A
|
|
475 Zorn-monotonic = {!!}
|
|
476
|
497
|
477 Zorn-lemma : { A : HOD }
|
464
|
478 → o∅ o< & A
|
497
|
479 → IsPartialOrderSet A
|
|
480 → ( ( B : HOD) → (B⊆A : B ⊆ A) → IsTotalOrderSet B → SUP A B ) -- SUP condition
|
|
481 → Maximal A
|
507
|
482 Zorn-lemma {A} 0<A PO supP = zorn04 where
|
493
|
483 z01 : {a b : HOD} → A ∋ a → A ∋ b → (a ≡ b ) ∨ (a < b ) → b < a → ⊥
|
496
|
484 z01 {a} {b} A∋a A∋b (case1 a=b) b<a = IsStrictPartialOrder.irrefl PO {me A∋b} {me A∋a} (sym a=b) b<a
|
524
|
485 z01 {a} {b} A∋a A∋b (case2 a<b) b<a = IsStrictPartialOrder.irrefl PO {me A∋b} {me A∋b} refl
|
|
486 (IsStrictPartialOrder.trans PO {me A∋b} {me A∋a} {me A∋b} b<a a<b)
|
|
487 s = ODC.minimal O A (λ eq → ¬x<0 (subst (_o<_ o∅) (=od∅→≡o∅ eq) 0<A))
|
|
488 sa = ODC.x∋minimal O A (λ eq → ¬x<0 (subst (_o<_ o∅) (=od∅→≡o∅ eq) 0<A))
|
525
|
489 z02 : {x max : Ordinal } → (ax : A ∋ * x ) → InfiniteChain A max ax → ⊥
|
524
|
490 z02 {x} {max} ax ifc = zc5 ifc where
|
|
491 FC : HOD
|
|
492 FC = IChainSet A ax
|
525
|
493 zc6 : (ifc : InfiniteChain A max ax) → ¬ SUP A (InFCSet A ax ifc)
|
|
494 zc6 ifc sup = z01 nxa (SUP.A∋maximal sup) (SUP.x<sup sup {!!} ) {!!} where
|
524
|
495 nx : Ordinal
|
|
496 nx = cinext A ax ifc (& (SUP.sup sup))
|
525
|
497 zc7 : A ∋ * (& (SUP.sup sup))
|
|
498 zc7 = subst (λ k → odef A k ) (cong (&) (sym *iso)) (SUP.A∋maximal sup)
|
|
499 sup-ics : odef (IChainSet A ax) (& (SUP.sup sup))
|
526
|
500 sup-ics = {!!} -- SUP.A∋maximal sup
|
525
|
501 ncsup : (z : Ordinal) → (az : odef (IChainSet A ax) z) → IChainSup> A {z} (subst (odef A) (sym &iso) (proj1 az))
|
|
502 ncsup z az = InfiniteChain.c-infinite ifc z az
|
524
|
503 nxa : A ∋ * nx
|
525
|
504 nxa = {!!} -- cinext∈A A ax ifc (& (SUP.sup sup)) {!!}
|
|
505 zc5 : InfiniteChain A max ax → ⊥
|
|
506 zc5 ifc = zc6 ifc ( supP (InFCSet A ax ifc) (InFCSet⊆A A {x} ax ifc) ( ChainClosure-is-total A {x} ax PO ifc ))
|
526
|
507 z03 : {x : Ordinal } → (ax : A ∋ * x ) → InfiniteChain A (& A) ax → ⊥
|
|
508 z03 {x} ax ifc = {!!}
|
478
|
509 -- ZChain is not compatible with the SUP condition
|
497
|
510 ind : (x : Ordinal) → ((y : Ordinal) → y o< x → ZChain A y ∨ Maximal A )
|
|
511 → ZChain A x ∨ Maximal A
|
|
512 ind x prev with Oprev-p x
|
477
|
513 ... | yes op with ODC.∋-p O A (* x)
|
498
|
514 ... | no ¬Ax = zc1 where
|
476
|
515 -- we have previous ordinal and ¬ A ∋ x, use previous Zchain
|
471
|
516 px = Oprev.oprev op
|
498
|
517 zc1 : ZChain A x ∨ Maximal A
|
497
|
518 zc1 with prev px (subst (λ k → px o< k) (Oprev.oprev=x op) <-osuc)
|
498
|
519 ... | case2 x = case2 x -- we have the Maximal
|
|
520 ... | case1 z with trio< x (& (ZChain.max z))
|
|
521 ... | tri< a ¬b ¬c = case1 record { max = ZChain.max z ; y<max = a }
|
|
522 ... | tri≈ ¬a b ¬c = {!!} -- x = max so ¬ A ∋ max
|
|
523 ... | tri> ¬a ¬b c = {!!} -- can't happen
|
503
|
524 ... | yes ax = zc4 where -- we have previous ordinal and A ∋ x
|
472
|
525 px = Oprev.oprev op
|
503
|
526 zc1 : OSup> A (subst (OD.def (od A)) (sym &iso) ax) → ZChain A x ∨ Maximal A
|
|
527 zc1 os with prev px (subst (λ k → px o< k) (Oprev.oprev=x op) <-osuc)
|
498
|
528 ... | case2 x = case2 x
|
507
|
529 ... | case1 x = {!!}
|
503
|
530 zc4 : ZChain A x ∨ Maximal A
|
523
|
531 zc4 with Zorn-lemma-3case 0<A PO x {!!}
|
|
532 ... | case1 y>x = zc1 {!!}
|
503
|
533 ... | case2 (case1 x) = case2 x
|
522
|
534 ... | case2 (case2 ex) = ⊥-elim (zc5 {!!} ) where
|
503
|
535 FC : HOD
|
523
|
536 FC = IChainSet A ax
|
525
|
537 B : InfiniteChain A x ax → HOD
|
511
|
538 B ifc = InFCSet A ax ifc
|
525
|
539 zc6 : (ifc : InfiniteChain A x ax ) → ¬ SUP A (B ifc)
|
503
|
540 zc6 = {!!}
|
525
|
541 FC-is-total : (ifc : InfiniteChain A x ax) → IsTotalOrderSet (B ifc)
|
511
|
542 FC-is-total ifc = ChainClosure-is-total A ax PO ifc
|
525
|
543 B⊆A : (ifc : InfiniteChain A x ax) → B ifc ⊆ A
|
511
|
544 B⊆A = {!!}
|
525
|
545 ifc : InfiniteChain A x (subst (OD.def (od A)) (sym &iso) ax) → InfiniteChain A x ax
|
517
|
546 ifc record { c-infinite = c-infinite } = record { c-infinite = {!!} } where
|
512
|
547 ifc01 : {!!} -- me (subst (OD.def (od A)) (sym &iso) ax)
|
|
548 ifc01 = {!!}
|
|
549 -- (y : Ordinal) → odef (IChainSet (me (subst (OD.def (od A)) (sym &iso) ax))) y → y o< & (* x₁)
|
|
550 -- (y : Ordinal) → odef (IChainSet (me ax)) y → y o< x₁
|
525
|
551 zc5 : InfiniteChain A x (subst (OD.def (od A)) (sym &iso) ax) → ⊥
|
511
|
552 zc5 x = zc6 (ifc x) ( supP (B (ifc x)) (B⊆A (ifc x)) (FC-is-total (ifc x) ))
|
497
|
553 ind x prev | no ¬ox with trio< (& A) x --- limit ordinal case
|
483
|
554 ... | tri< a ¬b ¬c = {!!} where
|
497
|
555 zc1 : ZChain A (& A)
|
|
556 zc1 with prev (& A) a
|
|
557 ... | t = {!!}
|
483
|
558 ... | tri≈ ¬a b ¬c = {!!} where
|
478
|
559 ... | tri> ¬a ¬b c with ODC.∋-p O A (* x)
|
|
560 ... | no ¬Ax = {!!} where
|
507
|
561 ... | yes ax = {!!}
|
497
|
562 zorn03 : (x : Ordinal) → ZChain A x ∨ Maximal A
|
507
|
563 zorn03 x = TransFinite ind x
|
497
|
564 zorn04 : Maximal A
|
|
565 zorn04 with zorn03 (& A)
|
507
|
566 ... | case1 chain = ⊥-elim ( o<> (c<→o< {ZChain.max chain} {A} (ZChain.A∋max chain)) (ZChain.y<max chain) )
|
497
|
567 ... | case2 m = m
|
464
|
568
|
516
|
569 -- usage (see filter.agda )
|
|
570 --
|
497
|
571 -- _⊆'_ : ( A B : HOD ) → Set n
|
|
572 -- _⊆'_ A B = (x : Ordinal ) → odef A x → odef B x
|
482
|
573
|
497
|
574 -- MaximumSubset : {L P : HOD}
|
|
575 -- → o∅ o< & L → o∅ o< & P → P ⊆ L
|
|
576 -- → IsPartialOrderSet P _⊆'_
|
|
577 -- → ( (B : HOD) → B ⊆ P → IsTotalOrderSet B _⊆'_ → SUP P B _⊆'_ )
|
|
578 -- → Maximal P (_⊆'_)
|
|
579 -- MaximumSubset {L} {P} 0<L 0<P P⊆L PO SP = Zorn-lemma {P} {_⊆'_} 0<P PO SP
|