Mercurial > hg > Members > kono > Proof > ZF-in-agda
annotate src/zorn.agda @ 572:427e36467a18
ZChain is monotonic on x, should be in record ZFChain
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 02 May 2022 23:23:12 +0900 |
parents | 2ade91846f57 |
children | 9ec37757a5a5 |
rev | line source |
---|---|
478 | 1 {-# OPTIONS --allow-unsolved-metas #-} |
508 | 2 open import Level hiding ( suc ; zero ) |
431 | 3 open import Ordinals |
552 | 4 open import Relation.Binary |
5 open import Relation.Binary.Core | |
6 open import Relation.Binary.PropositionalEquality | |
497 | 7 import OD |
552 | 8 module zorn {n : Level } (O : Ordinals {n}) (_<_ : (x y : OD.HOD O ) → Set n ) (PO : IsStrictPartialOrder _≡_ _<_ ) where |
431 | 9 |
560 | 10 -- |
11 -- Zorn-lemma : { A : HOD } | |
12 -- → o∅ o< & A | |
13 -- → ( ( B : HOD) → (B⊆A : B ⊆ A) → IsTotalOrderSet B → SUP A B ) -- SUP condition | |
14 -- → Maximal A | |
15 -- | |
16 | |
431 | 17 open import zf |
477 | 18 open import logic |
19 -- open import partfunc {n} O | |
20 | |
21 open import Relation.Nullary | |
22 open import Data.Empty | |
23 import BAlgbra | |
431 | 24 |
555 | 25 open import Data.Nat hiding ( _<_ ; _≤_ ) |
26 open import Data.Nat.Properties | |
27 open import nat | |
28 | |
431 | 29 |
30 open inOrdinal O | |
31 open OD O | |
32 open OD.OD | |
33 open ODAxiom odAxiom | |
477 | 34 import OrdUtil |
35 import ODUtil | |
431 | 36 open Ordinals.Ordinals O |
37 open Ordinals.IsOrdinals isOrdinal | |
38 open Ordinals.IsNext isNext | |
39 open OrdUtil O | |
477 | 40 open ODUtil O |
41 | |
42 | |
43 import ODC | |
44 | |
45 | |
46 open _∧_ | |
47 open _∨_ | |
48 open Bool | |
431 | 49 |
50 | |
51 open HOD | |
52 | |
560 | 53 -- |
54 -- Partial Order on HOD ( possibly limited in A ) | |
55 -- | |
56 | |
571 | 57 _<<_ : (x y : Ordinal ) → Set n -- Set n order |
570 | 58 x << y = * x < * y |
59 | |
60 POO : IsStrictPartialOrder _≡_ _<<_ | |
61 POO = record { isEquivalence = record { refl = refl ; sym = sym ; trans = trans } | |
62 ; trans = IsStrictPartialOrder.trans PO | |
63 ; irrefl = λ x=y x<y → IsStrictPartialOrder.irrefl PO (cong (*) x=y) x<y | |
64 ; <-resp-≈ = record { fst = λ {x} {y} {y1} y=y1 xy1 → subst (λ k → x << k ) y=y1 xy1 ; snd = λ {x} {x1} {y} x=x1 x1y → subst (λ k → k << x ) x=x1 x1y } } | |
65 | |
528
8facdd7cc65a
TransitiveClosure with x <= f x is possible
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
527
diff
changeset
|
66 _≤_ : (x y : HOD) → Set (Level.suc n) |
8facdd7cc65a
TransitiveClosure with x <= f x is possible
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
527
diff
changeset
|
67 x ≤ y = ( x ≡ y ) ∨ ( x < y ) |
8facdd7cc65a
TransitiveClosure with x <= f x is possible
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
527
diff
changeset
|
68 |
554 | 69 ≤-ftrans : {x y z : HOD} → x ≤ y → y ≤ z → x ≤ z |
70 ≤-ftrans {x} {y} {z} (case1 refl ) (case1 refl ) = case1 refl | |
71 ≤-ftrans {x} {y} {z} (case1 refl ) (case2 y<z) = case2 y<z | |
72 ≤-ftrans {x} {_} {z} (case2 x<y ) (case1 refl ) = case2 x<y | |
73 ≤-ftrans {x} {y} {z} (case2 x<y) (case2 y<z) = case2 ( IsStrictPartialOrder.trans PO x<y y<z ) | |
74 | |
556 | 75 <-irr : {a b : HOD} → (a ≡ b ) ∨ (a < b ) → b < a → ⊥ |
76 <-irr {a} {b} (case1 a=b) b<a = IsStrictPartialOrder.irrefl PO (sym a=b) b<a | |
77 <-irr {a} {b} (case2 a<b) b<a = IsStrictPartialOrder.irrefl PO refl | |
78 (IsStrictPartialOrder.trans PO b<a a<b) | |
490 | 79 |
561 | 80 ptrans = IsStrictPartialOrder.trans PO |
81 | |
492 | 82 open _==_ |
83 open _⊆_ | |
84 | |
530 | 85 -- |
560 | 86 -- Closure of ≤-monotonic function f has total order |
530 | 87 -- |
88 | |
89 ≤-monotonic-f : (A : HOD) → ( Ordinal → Ordinal ) → Set (Level.suc n) | |
90 ≤-monotonic-f A f = (x : Ordinal ) → odef A x → ( * x ≤ * (f x) ) ∧ odef A (f x ) | |
91 | |
560 | 92 -- immieate-f : (A : HOD) → ( f : Ordinal → Ordinal ) → Set n |
93 -- immieate-f A f = { x y : Ordinal } → odef A x → odef A y → ¬ ( ( * x < * y ) ∧ ( * y < * (f x )) ) | |
556 | 94 |
551 | 95 data FClosure (A : HOD) (f : Ordinal → Ordinal ) (s : Ordinal) : Ordinal → Set n where |
554 | 96 init : odef A s → FClosure A f s s |
555 | 97 fsuc : (x : Ordinal) ( p : FClosure A f s x ) → FClosure A f s (f x) |
554 | 98 |
556 | 99 A∋fc : {A : HOD} (s : Ordinal) {y : Ordinal } (f : Ordinal → Ordinal) (mf : ≤-monotonic-f A f) → (fcy : FClosure A f s y ) → odef A y |
100 A∋fc {A} s f mf (init as) = as | |
101 A∋fc {A} s f mf (fsuc y fcy) = proj2 (mf y ( A∋fc {A} s f mf fcy ) ) | |
555 | 102 |
556 | 103 s≤fc : {A : HOD} (s : Ordinal ) {y : Ordinal } (f : Ordinal → Ordinal) (mf : ≤-monotonic-f A f) → (fcy : FClosure A f s y ) → * s ≤ * y |
104 s≤fc {A} s {.s} f mf (init x) = case1 refl | |
105 s≤fc {A} s {.(f x)} f mf (fsuc x fcy) with proj1 (mf x (A∋fc s f mf fcy ) ) | |
106 ... | case1 x=fx = subst (λ k → * s ≤ * k ) (*≡*→≡ x=fx) ( s≤fc {A} s f mf fcy ) | |
107 ... | case2 x<fx with s≤fc {A} s f mf fcy | |
108 ... | case1 s≡x = case2 ( subst₂ (λ j k → j < k ) (sym s≡x) refl x<fx ) | |
109 ... | case2 s<x = case2 ( IsStrictPartialOrder.trans PO s<x x<fx ) | |
555 | 110 |
557 | 111 fcn : {A : HOD} (s : Ordinal) { x : Ordinal} {f : Ordinal → Ordinal} → (mf : ≤-monotonic-f A f) → FClosure A f s x → ℕ |
112 fcn s mf (init as) = zero | |
558 | 113 fcn {A} s {x} {f} mf (fsuc y p) with proj1 (mf y (A∋fc s f mf p)) |
114 ... | case1 eq = fcn s mf p | |
115 ... | case2 y<fy = suc (fcn s mf p ) | |
557 | 116 |
558 | 117 fcn-inject : {A : HOD} (s : Ordinal) { x y : Ordinal} {f : Ordinal → Ordinal} → (mf : ≤-monotonic-f A f) |
118 → (cx : FClosure A f s x ) (cy : FClosure A f s y ) → fcn s mf cx ≡ fcn s mf cy → * x ≡ * y | |
559 | 119 fcn-inject {A} s {x} {y} {f} mf cx cy eq = fc00 (fcn s mf cx) (fcn s mf cy) eq cx cy refl refl where |
120 fc00 : (i j : ℕ ) → i ≡ j → {x y : Ordinal } → (cx : FClosure A f s x ) (cy : FClosure A f s y ) → i ≡ fcn s mf cx → j ≡ fcn s mf cy → * x ≡ * y | |
121 fc00 zero zero refl (init _) (init x₁) i=x i=y = refl | |
568 | 122 fc00 zero zero refl (init as) (fsuc y cy) i=x i=y with proj1 (mf y (A∋fc s f mf cy ) ) |
123 ... | case1 y=fy = subst (λ k → * s ≡ k ) y=fy ( fc00 zero zero refl (init as) cy i=x i=y ) | |
124 fc00 zero zero refl (fsuc x cx) (init as) i=x i=y with proj1 (mf x (A∋fc s f mf cx ) ) | |
125 ... | case1 x=fx = subst (λ k → k ≡ * s ) x=fx ( fc00 zero zero refl cx (init as) i=x i=y ) | |
559 | 126 fc00 zero zero refl (fsuc x cx) (fsuc y cy) i=x i=y with proj1 (mf x (A∋fc s f mf cx ) ) | proj1 (mf y (A∋fc s f mf cy ) ) |
127 ... | case1 x=fx | case1 y=fy = subst₂ (λ j k → j ≡ k ) x=fx y=fy ( fc00 zero zero refl cx cy i=x i=y ) | |
128 fc00 (suc i) (suc j) i=j {.(f x)} {.(f y)} (fsuc x cx) (fsuc y cy) i=x j=y with proj1 (mf x (A∋fc s f mf cx ) ) | proj1 (mf y (A∋fc s f mf cy ) ) | |
129 ... | case1 x=fx | case1 y=fy = subst₂ (λ j k → j ≡ k ) x=fx y=fy ( fc00 (suc i) (suc j) i=j cx cy i=x j=y ) | |
130 ... | case1 x=fx | case2 y<fy = subst (λ k → k ≡ * (f y)) x=fx (fc02 x cx i=x) where | |
131 fc02 : (x1 : Ordinal) → (cx1 : FClosure A f s x1 ) → suc i ≡ fcn s mf cx1 → * x1 ≡ * (f y) | |
132 fc02 .(f x1) (fsuc x1 cx1) i=x1 with proj1 (mf x1 (A∋fc s f mf cx1 ) ) | |
560 | 133 ... | case1 eq = trans (sym eq) ( fc02 x1 cx1 i=x1 ) -- derefence while f x ≡ x |
559 | 134 ... | case2 lt = subst₂ (λ j k → * (f j) ≡ * (f k )) &iso &iso ( cong (λ k → * ( f (& k ))) fc04) where |
135 fc04 : * x1 ≡ * y | |
136 fc04 = fc00 i j (cong pred i=j) cx1 cy (cong pred i=x1) (cong pred j=y) | |
137 ... | case2 x<fx | case1 y=fy = subst (λ k → * (f x) ≡ k ) y=fy (fc03 y cy j=y) where | |
138 fc03 : (y1 : Ordinal) → (cy1 : FClosure A f s y1 ) → suc j ≡ fcn s mf cy1 → * (f x) ≡ * y1 | |
139 fc03 .(f y1) (fsuc y1 cy1) j=y1 with proj1 (mf y1 (A∋fc s f mf cy1 ) ) | |
140 ... | case1 eq = trans ( fc03 y1 cy1 j=y1 ) eq | |
141 ... | case2 lt = subst₂ (λ j k → * (f j) ≡ * (f k )) &iso &iso ( cong (λ k → * ( f (& k ))) fc05) where | |
142 fc05 : * x ≡ * y1 | |
143 fc05 = fc00 i j (cong pred i=j) cx cy1 (cong pred i=x) (cong pred j=y1) | |
144 ... | case2 x₁ | case2 x₂ = subst₂ (λ j k → * (f j) ≡ * (f k) ) &iso &iso (cong (λ k → * (f (& k))) (fc00 i j (cong pred i=j) cx cy (cong pred i=x) (cong pred j=y))) | |
557 | 145 |
146 fcn-< : {A : HOD} (s : Ordinal ) { x y : Ordinal} {f : Ordinal → Ordinal} → (mf : ≤-monotonic-f A f) | |
147 → (cx : FClosure A f s x ) (cy : FClosure A f s y ) → fcn s mf cx Data.Nat.< fcn s mf cy → * x < * y | |
558 | 148 fcn-< {A} s {x} {y} {f} mf cx cy x<y = fc01 (fcn s mf cy) cx cy refl x<y where |
149 fc01 : (i : ℕ ) → {y : Ordinal } → (cx : FClosure A f s x ) (cy : FClosure A f s y ) → (i ≡ fcn s mf cy ) → fcn s mf cx Data.Nat.< i → * x < * y | |
150 fc01 (suc i) {y} cx (fsuc y1 cy) i=y (s≤s x<i) with proj1 (mf y1 (A∋fc s f mf cy ) ) | |
151 ... | case1 y=fy = subst (λ k → * x < k ) y=fy ( fc01 (suc i) {y1} cx cy i=y (s≤s x<i) ) | |
152 ... | case2 y<fy with <-cmp (fcn s mf cx ) i | |
153 ... | tri> ¬a ¬b c = ⊥-elim ( nat-≤> x<i c ) | |
154 ... | tri≈ ¬a b ¬c = subst (λ k → k < * (f y1) ) (fcn-inject s mf cy cx (sym (trans b (cong pred i=y) ))) y<fy | |
155 ... | tri< a ¬b ¬c = IsStrictPartialOrder.trans PO fc02 y<fy where | |
156 fc03 : suc i ≡ suc (fcn s mf cy) → i ≡ fcn s mf cy | |
157 fc03 eq = cong pred eq | |
158 fc02 : * x < * y1 | |
159 fc02 = fc01 i cx cy (fc03 i=y ) a | |
557 | 160 |
559 | 161 fcn-cmp : {A : HOD} (s : Ordinal) { x y : Ordinal } (f : Ordinal → Ordinal) (mf : ≤-monotonic-f A f) |
554 | 162 → (cx : FClosure A f s x) → (cy : FClosure A f s y ) → Tri (* x < * y) (* x ≡ * y) (* y < * x ) |
559 | 163 fcn-cmp {A} s {x} {y} f mf cx cy with <-cmp ( fcn s mf cx ) (fcn s mf cy ) |
164 ... | tri< a ¬b ¬c = tri< fc11 (λ eq → <-irr (case1 (sym eq)) fc11) (λ lt → <-irr (case2 fc11) lt) where | |
165 fc11 : * x < * y | |
166 fc11 = fcn-< {A} s {x} {y} {f} mf cx cy a | |
167 ... | tri≈ ¬a b ¬c = tri≈ (λ lt → <-irr (case1 (sym fc10)) lt) fc10 (λ lt → <-irr (case1 fc10) lt) where | |
168 fc10 : * x ≡ * y | |
169 fc10 = fcn-inject {A} s {x} {y} {f} mf cx cy b | |
170 ... | tri> ¬a ¬b c = tri> (λ lt → <-irr (case2 fc12) lt) (λ eq → <-irr (case1 eq) fc12) fc12 where | |
171 fc12 : * y < * x | |
172 fc12 = fcn-< {A} s {y} {x} {f} mf cy cx c | |
173 | |
562 | 174 fcn-imm : {A : HOD} (s : Ordinal) { x y : Ordinal } (f : Ordinal → Ordinal) (mf : ≤-monotonic-f A f) |
175 → (cx : FClosure A f s x) → (cy : FClosure A f s y ) → ¬ ( ( * x < * y ) ∧ ( * y < * (f x )) ) | |
563 | 176 fcn-imm {A} s {x} {y} f mf cx cy ⟪ x<y , y<fx ⟫ = fc21 where |
177 fc20 : fcn s mf cy Data.Nat.< suc (fcn s mf cx) → (fcn s mf cy ≡ fcn s mf cx) ∨ ( fcn s mf cy Data.Nat.< fcn s mf cx ) | |
178 fc20 y<sx with <-cmp ( fcn s mf cy ) (fcn s mf cx ) | |
179 ... | tri< a ¬b ¬c = case2 a | |
180 ... | tri≈ ¬a b ¬c = case1 b | |
181 ... | tri> ¬a ¬b c = ⊥-elim ( nat-≤> y<sx (s≤s c)) | |
182 fc17 : {x y : Ordinal } → (cx : FClosure A f s x) → (cy : FClosure A f s y ) → suc (fcn s mf cx) ≡ fcn s mf cy → * (f x ) ≡ * y | |
183 fc17 {x} {y} cx cy sx=y = fc18 (fcn s mf cy) cx cy refl sx=y where | |
184 fc18 : (i : ℕ ) → {y : Ordinal } → (cx : FClosure A f s x ) (cy : FClosure A f s y ) → (i ≡ fcn s mf cy ) → suc (fcn s mf cx) ≡ i → * (f x) ≡ * y | |
185 fc18 (suc i) {y} cx (fsuc y1 cy) i=y sx=i with proj1 (mf y1 (A∋fc s f mf cy ) ) | |
186 ... | case1 y=fy = subst (λ k → * (f x) ≡ k ) y=fy ( fc18 (suc i) {y1} cx cy i=y sx=i) -- dereference | |
187 ... | case2 y<fy = subst₂ (λ j k → * (f j) ≡ * (f k) ) &iso &iso (cong (λ k → * (f (& k) ) ) fc19) where | |
188 fc19 : * x ≡ * y1 | |
189 fc19 = fcn-inject s mf cx cy (cong pred ( trans sx=i i=y )) | |
190 fc21 : ⊥ | |
191 fc21 with <-cmp (suc ( fcn s mf cx )) (fcn s mf cy ) | |
192 ... | tri< a ¬b ¬c = <-irr (case2 y<fx) (fc22 a) where -- suc ncx < ncy | |
193 cxx : FClosure A f s (f x) | |
194 cxx = fsuc x cx | |
195 fc16 : (x : Ordinal ) → (cx : FClosure A f s x) → (fcn s mf cx ≡ fcn s mf (fsuc x cx)) ∨ ( suc (fcn s mf cx ) ≡ fcn s mf (fsuc x cx)) | |
568 | 196 fc16 x (init as) with proj1 (mf s as ) |
563 | 197 ... | case1 _ = case1 refl |
198 ... | case2 _ = case2 refl | |
199 fc16 .(f x) (fsuc x cx ) with proj1 (mf (f x) (A∋fc s f mf (fsuc x cx)) ) | |
200 ... | case1 _ = case1 refl | |
201 ... | case2 _ = case2 refl | |
202 fc22 : (suc ( fcn s mf cx )) Data.Nat.< (fcn s mf cy ) → * (f x) < * y | |
203 fc22 a with fc16 x cx | |
204 ... | case1 eq = fcn-< s mf cxx cy (subst (λ k → k Data.Nat.< fcn s mf cy ) eq (<-trans a<sa a)) | |
205 ... | case2 eq = fcn-< s mf cxx cy (subst (λ k → k Data.Nat.< fcn s mf cy ) eq a ) | |
206 ... | tri≈ ¬a b ¬c = <-irr (case1 (fc17 cx cy b)) y<fx | |
207 ... | tri> ¬a ¬b c with fc20 c -- ncy < suc ncx | |
208 ... | case1 y=x = <-irr (case1 ( fcn-inject s mf cy cx y=x )) x<y | |
209 ... | case2 y<x = <-irr (case2 x<y) (fcn-< s mf cy cx y<x ) | |
210 | |
562 | 211 |
560 | 212 -- open import Relation.Binary.Properties.Poset as Poset |
213 | |
214 IsTotalOrderSet : ( A : HOD ) → Set (Level.suc n) | |
215 IsTotalOrderSet A = {a b : HOD} → odef A (& a) → odef A (& b) → Tri (a < b) (a ≡ b) (b < a ) | |
216 | |
567 | 217 ⊆-IsTotalOrderSet : { A B : HOD } → B ⊆ A → IsTotalOrderSet A → IsTotalOrderSet B |
568 | 218 ⊆-IsTotalOrderSet {A} {B} B⊆A T ax ay = T (incl B⊆A ax) (incl B⊆A ay) |
567 | 219 |
568 | 220 _⊆'_ : ( A B : HOD ) → Set n |
221 _⊆'_ A B = {x : Ordinal } → odef A x → odef B x | |
560 | 222 |
223 -- | |
224 -- inductive maxmum tree from x | |
225 -- tree structure | |
226 -- | |
554 | 227 |
567 | 228 record HasPrev (A B : HOD) {x : Ordinal } (xa : odef A x) ( f : Ordinal → Ordinal ) : Set n where |
533 | 229 field |
534 | 230 y : Ordinal |
541 | 231 ay : odef B y |
534 | 232 x=fy : x ≡ f y |
529 | 233 |
570 | 234 record IsSup (A B : HOD) {x : Ordinal } (xa : odef A x) : Set n where |
567 | 235 field |
571 | 236 x<sup : {y : Ordinal} → odef B y → (y ≡ x ) ∨ (y << x ) |
568 | 237 |
238 record ZChain ( A : HOD ) {x : Ordinal} (ax : odef A x) ( f : Ordinal → Ordinal ) (mf : ≤-monotonic-f A f ) | |
239 (sup : (C : HOD ) → ( C ⊆' A) → IsTotalOrderSet C → Ordinal) ( z : Ordinal ) : Set (Level.suc n) where | |
240 field | |
241 chain : HOD | |
242 chain⊆A : chain ⊆' A | |
243 chain∋x : odef chain x | |
244 initial : {y : Ordinal } → odef chain y → * x ≤ * y | |
245 f-total : IsTotalOrderSet chain | |
246 f-next : {a : Ordinal } → odef chain a → odef chain (f a) | |
247 f-immediate : { x y : Ordinal } → odef chain x → odef chain y → ¬ ( ( * x < * y ) ∧ ( * y < * (f x )) ) | |
248 is-max : {a b : Ordinal } → (ca : odef chain a ) → b o< osuc z → (ab : odef A b) | |
570 | 249 → HasPrev A chain ab f ∨ IsSup A chain ab -- ((sup chain chain⊆A f-total) ≡ b ) |
568 | 250 → * a < * b → odef chain b |
251 | |
252 record Maximal ( A : HOD ) : Set (Level.suc n) where | |
253 field | |
254 maximal : HOD | |
255 A∋maximal : A ∋ maximal | |
256 ¬maximal<x : {x : HOD} → A ∋ x → ¬ maximal < x -- A is Partial, use negative | |
567 | 257 |
508 | 258 record SUP ( A B : HOD ) : Set (Level.suc n) where |
503 | 259 field |
260 sup : HOD | |
261 A∋maximal : A ∋ sup | |
262 x<sup : {x : HOD} → B ∋ x → (x ≡ sup ) ∨ (x < sup ) -- B is Total, use positive | |
263 | |
533 | 264 SupCond : ( A B : HOD) → (B⊆A : B ⊆ A) → IsTotalOrderSet B → Set (Level.suc n) |
265 SupCond A B _ _ = SUP A B | |
266 | |
497 | 267 Zorn-lemma : { A : HOD } |
464 | 268 → o∅ o< & A |
568 | 269 → ( ( B : HOD) → (B⊆A : B ⊆' A) → IsTotalOrderSet B → SUP A B ) -- SUP condition |
497 | 270 → Maximal A |
552 | 271 Zorn-lemma {A} 0<A supP = zorn00 where |
568 | 272 supO : (C : HOD ) → C ⊆' A → IsTotalOrderSet C → Ordinal |
566 | 273 supO C C⊆A TC = & ( SUP.sup ( supP C C⊆A TC )) |
569 | 274 postulate |
275 --- irrelevance of ⊆' and compare | |
276 sup== : {C C1 : HOD } → C ≡ C1 → {c : C ⊆' A } {c1 : C1 ⊆' A } → {t : IsTotalOrderSet C } {t1 : IsTotalOrderSet C1 } | |
277 → SUP.sup ( supP C c t ) ≡ SUP.sup ( supP C1 c1 t1 ) | |
571 | 278 <-irr0 : {a b : HOD} → A ∋ a → A ∋ b → (a ≡ b ) ∨ (a < b ) → b < a → ⊥ |
279 <-irr0 {a} {b} A∋a A∋b = <-irr | |
537 | 280 z07 : {y : Ordinal} → {P : Set n} → odef A y ∧ P → y o< & A |
281 z07 {y} p = subst (λ k → k o< & A) &iso ( c<→o< (subst (λ k → odef A k ) (sym &iso ) (proj1 p ))) | |
530 | 282 s : HOD |
283 s = ODC.minimal O A (λ eq → ¬x<0 ( subst (λ k → o∅ o< k ) (=od∅→≡o∅ eq) 0<A )) | |
568 | 284 as : A ∋ * ( & s ) |
285 as = subst (λ k → odef A (& k) ) (sym *iso) ( ODC.x∋minimal O A (λ eq → ¬x<0 ( subst (λ k → o∅ o< k ) (=od∅→≡o∅ eq) 0<A )) ) | |
547 | 286 s<A : & s o< & A |
568 | 287 s<A = c<→o< (subst (λ k → odef A (& k) ) *iso as ) |
530 | 288 HasMaximal : HOD |
537 | 289 HasMaximal = record { od = record { def = λ x → odef A x ∧ ( (m : Ordinal) → odef A m → ¬ (* x < * m)) } ; odmax = & A ; <odmax = z07 } |
290 no-maximum : HasMaximal =h= od∅ → (x : Ordinal) → odef A x ∧ ((m : Ordinal) → odef A m → odef A x ∧ (¬ (* x < * m) )) → ⊥ | |
291 no-maximum nomx x P = ¬x<0 (eq→ nomx {x} ⟪ proj1 P , (λ m ma p → proj2 ( proj2 P m ma ) p ) ⟫ ) | |
532 | 292 Gtx : { x : HOD} → A ∋ x → HOD |
537 | 293 Gtx {x} ax = record { od = record { def = λ y → odef A y ∧ (x < (* y)) } ; odmax = & A ; <odmax = z07 } |
294 z08 : ¬ Maximal A → HasMaximal =h= od∅ | |
295 z08 nmx = record { eq→ = λ {x} lt → ⊥-elim ( nmx record {maximal = * x ; A∋maximal = subst (λ k → odef A k) (sym &iso) (proj1 lt) | |
296 ; ¬maximal<x = λ {y} ay → subst (λ k → ¬ (* x < k)) *iso (proj2 lt (& y) ay) } ) ; eq← = λ {y} lt → ⊥-elim ( ¬x<0 lt )} | |
297 x-is-maximal : ¬ Maximal A → {x : Ordinal} → (ax : odef A x) → & (Gtx (subst (λ k → odef A k ) (sym &iso) ax)) ≡ o∅ → (m : Ordinal) → odef A m → odef A x ∧ (¬ (* x < * m)) | |
298 x-is-maximal nmx {x} ax nogt m am = ⟪ subst (λ k → odef A k) &iso (subst (λ k → odef A k ) (sym &iso) ax) , ¬x<m ⟫ where | |
299 ¬x<m : ¬ (* x < * m) | |
300 ¬x<m x<m = ∅< {Gtx (subst (λ k → odef A k ) (sym &iso) ax)} {* m} ⟪ subst (λ k → odef A k) (sym &iso) am , subst (λ k → * x < k ) (cong (*) (sym &iso)) x<m ⟫ (≡o∅→=od∅ nogt) | |
543 | 301 |
560 | 302 -- Uncountable ascending chain by axiom of choice |
530 | 303 cf : ¬ Maximal A → Ordinal → Ordinal |
532 | 304 cf nmx x with ODC.∋-p O A (* x) |
305 ... | no _ = o∅ | |
306 ... | yes ax with is-o∅ (& ( Gtx ax )) | |
538 | 307 ... | yes nogt = -- no larger element, so it is maximal |
308 ⊥-elim (no-maximum (z08 nmx) x ⟪ subst (λ k → odef A k) &iso ax , x-is-maximal nmx (subst (λ k → odef A k ) &iso ax) nogt ⟫ ) | |
532 | 309 ... | no not = & (ODC.minimal O (Gtx ax) (λ eq → not (=od∅→≡o∅ eq))) |
537 | 310 is-cf : (nmx : ¬ Maximal A ) → {x : Ordinal} → odef A x → odef A (cf nmx x) ∧ ( * x < * (cf nmx x) ) |
311 is-cf nmx {x} ax with ODC.∋-p O A (* x) | |
312 ... | no not = ⊥-elim ( not (subst (λ k → odef A k ) (sym &iso) ax )) | |
313 ... | yes ax with is-o∅ (& ( Gtx ax )) | |
314 ... | yes nogt = ⊥-elim (no-maximum (z08 nmx) x ⟪ subst (λ k → odef A k) &iso ax , x-is-maximal nmx (subst (λ k → odef A k ) &iso ax) nogt ⟫ ) | |
315 ... | no not = ODC.x∋minimal O (Gtx ax) (λ eq → not (=od∅→≡o∅ eq)) | |
530 | 316 cf-is-<-monotonic : (nmx : ¬ Maximal A ) → (x : Ordinal) → odef A x → ( * x < * (cf nmx x) ) ∧ odef A (cf nmx x ) |
537 | 317 cf-is-<-monotonic nmx x ax = ⟪ proj2 (is-cf nmx ax ) , proj1 (is-cf nmx ax ) ⟫ |
530 | 318 cf-is-≤-monotonic : (nmx : ¬ Maximal A ) → ≤-monotonic-f A ( cf nmx ) |
532 | 319 cf-is-≤-monotonic nmx x ax = ⟪ case2 (proj1 ( cf-is-<-monotonic nmx x ax )) , proj2 ( cf-is-<-monotonic nmx x ax ) ⟫ |
543 | 320 |
568 | 321 zsup : ( f : Ordinal → Ordinal ) → (mf : ≤-monotonic-f A f) → (zc : ZChain A as f mf supO (& A) ) → SUP A (ZChain.chain zc) |
533 | 322 zsup f mf zc = supP (ZChain.chain zc) (ZChain.chain⊆A zc) ( ZChain.f-total zc ) |
568 | 323 A∋zsup : (nmx : ¬ Maximal A ) (zc : ZChain A as (cf nmx) (cf-is-≤-monotonic nmx) supO (& A) ) |
533 | 324 → A ∋ * ( & ( SUP.sup (zsup (cf nmx) (cf-is-≤-monotonic nmx) zc ) )) |
325 A∋zsup nmx zc = subst (λ k → odef A (& k )) (sym *iso) ( SUP.A∋maximal (zsup (cf nmx) (cf-is-≤-monotonic nmx) zc ) ) | |
568 | 326 sp0 : ( f : Ordinal → Ordinal ) → (mf : ≤-monotonic-f A f ) (zc : ZChain A (subst (λ k → odef A k ) &iso as ) f mf supO (& A) ) → SUP A (ZChain.chain zc) |
566 | 327 sp0 f mf zc = supP (ZChain.chain zc) (ZChain.chain⊆A zc) (ZChain.f-total zc) |
543 | 328 zc< : {x y z : Ordinal} → {P : Set n} → (x o< y → P) → x o< z → z o< y → P |
329 zc< {x} {y} {z} {P} prev x<z z<y = prev (ordtrans x<z z<y) | |
330 | |
331 --- | |
560 | 332 --- the maximum chain has fix point of any ≤-monotonic function |
543 | 333 --- |
571 | 334 fixpoint : ( f : Ordinal → Ordinal ) → (mf : ≤-monotonic-f A f ) (zc : ZChain A (subst (λ k → odef A k ) &iso as ) f mf supO (& A) ) |
546 | 335 → f (& (SUP.sup (sp0 f mf zc ))) ≡ & (SUP.sup (sp0 f mf zc )) |
571 | 336 fixpoint f mf zc = z14 where |
538 | 337 chain = ZChain.chain zc |
338 sp1 = sp0 f mf zc | |
565 | 339 z10 : {a b : Ordinal } → (ca : odef chain a ) → b o< osuc (& A) → (ab : odef A b ) |
570 | 340 → HasPrev A chain ab f ∨ IsSup A chain {b} ab -- (supO chain (ZChain.chain⊆A zc) (ZChain.f-total zc) ≡ b ) |
538 | 341 → * a < * b → odef chain b |
342 z10 = ZChain.is-max zc | |
543 | 343 z11 : & (SUP.sup sp1) o< & A |
344 z11 = c<→o< ( SUP.A∋maximal sp1) | |
538 | 345 z12 : odef chain (& (SUP.sup sp1)) |
346 z12 with o≡? (& s) (& (SUP.sup sp1)) | |
347 ... | yes eq = subst (λ k → odef chain k) eq ( ZChain.chain∋x zc ) | |
569 | 348 ... | no ne = z10 {& s} {& (SUP.sup sp1)} ( ZChain.chain∋x zc ) (ordtrans z11 <-osuc ) (SUP.A∋maximal sp1) |
570 | 349 (case2 z19 ) z13 where |
538 | 350 z13 : * (& s) < * (& (SUP.sup sp1)) |
566 | 351 z13 with SUP.x<sup sp1 ( ZChain.chain∋x zc ) |
538 | 352 ... | case1 eq = ⊥-elim ( ne (cong (&) eq) ) |
353 ... | case2 lt = subst₂ (λ j k → j < k ) (sym *iso) (sym *iso) lt | |
570 | 354 z19 : IsSup A chain {& (SUP.sup sp1)} (SUP.A∋maximal sp1) |
571 | 355 z19 = record { x<sup = z20 } where |
356 z20 : {y : Ordinal} → odef chain y → (y ≡ & (SUP.sup sp1)) ∨ (y << & (SUP.sup sp1)) | |
357 z20 {y} zy with SUP.x<sup sp1 (subst (λ k → odef chain k ) (sym &iso) zy) | |
570 | 358 ... | case1 y=p = case1 (subst (λ k → k ≡ _ ) &iso ( cong (&) y=p )) |
359 ... | case2 y<p = case2 (subst (λ k → * y < k ) (sym *iso) y<p ) | |
360 -- λ {y} zy → subst (λ k → (y ≡ & k ) ∨ (y << & k)) ? (SUP.x<sup sp1 ? ) } | |
538 | 361 z14 : f (& (SUP.sup (sp0 f mf zc))) ≡ & (SUP.sup (sp0 f mf zc)) |
552 | 362 z14 with ZChain.f-total zc (subst (λ k → odef chain k) (sym &iso) (ZChain.f-next zc z12 )) z12 |
538 | 363 ... | tri< a ¬b ¬c = ⊥-elim z16 where |
364 z16 : ⊥ | |
365 z16 with proj1 (mf (& ( SUP.sup sp1)) ( SUP.A∋maximal sp1 )) | |
366 ... | case1 eq = ⊥-elim (¬b (subst₂ (λ j k → j ≡ k ) refl *iso (sym eq) )) | |
367 ... | case2 lt = ⊥-elim (¬c (subst₂ (λ j k → k < j ) refl *iso lt )) | |
368 ... | tri≈ ¬a b ¬c = subst ( λ k → k ≡ & (SUP.sup sp1) ) &iso ( cong (&) b ) | |
369 ... | tri> ¬a ¬b c = ⊥-elim z17 where | |
370 z15 : (* (f ( & ( SUP.sup sp1 ))) ≡ SUP.sup sp1) ∨ (* (f ( & ( SUP.sup sp1 ))) < SUP.sup sp1) | |
566 | 371 z15 = SUP.x<sup sp1 (subst (λ k → odef chain k ) (sym &iso) (ZChain.f-next zc z12 )) |
538 | 372 z17 : ⊥ |
373 z17 with z15 | |
374 ... | case1 eq = ¬b eq | |
375 ... | case2 lt = ¬a lt | |
560 | 376 |
377 -- ZChain contradicts ¬ Maximal | |
378 -- | |
571 | 379 -- ZChain forces fix point on any ≤-monotonic function (fixpoint) |
560 | 380 -- ¬ Maximal create cf which is a <-monotonic function by axiom of choice. This contradicts fix point of ZChain |
381 -- | |
568 | 382 z04 : (nmx : ¬ Maximal A ) → (zc : ZChain A (subst (λ k → odef A k ) &iso as ) (cf nmx) (cf-is-≤-monotonic nmx) supO (& A)) → ⊥ |
571 | 383 z04 nmx zc = <-irr0 {* (cf nmx c)} {* c} (subst (λ k → odef A k ) (sym &iso) (proj1 (is-cf nmx (SUP.A∋maximal sp1)))) |
384 (subst (λ k → odef A (& k)) (sym *iso) (SUP.A∋maximal sp1) ) | |
385 (case1 ( cong (*)( fixpoint (cf nmx) (cf-is-≤-monotonic nmx ) zc ))) -- x ≡ f x ̄ | |
386 (proj1 (cf-is-<-monotonic nmx c (SUP.A∋maximal sp1))) where -- x < f x | |
546 | 387 sp1 = sp0 (cf nmx) (cf-is-≤-monotonic nmx) zc |
538 | 388 c = & (SUP.sup sp1) |
548 | 389 |
560 | 390 -- |
547 | 391 -- create all ZChains under o< x |
560 | 392 -- |
546 | 393 ind : ( f : Ordinal → Ordinal ) → (mf : ≤-monotonic-f A f ) → (x : Ordinal) → |
547 | 394 ((z : Ordinal) → z o< x → {y : Ordinal} → (ya : odef A y) → ZChain A ya f mf supO z ) → { y : Ordinal } → (ya : odef A y) → ZChain A ya f mf supO x |
395 ind f mf x prev {y} ay with Oprev-p x | |
548 | 396 ... | yes op = zc4 where |
560 | 397 -- |
398 -- we have previous ordinal to use induction | |
399 -- | |
530 | 400 px = Oprev.oprev op |
547 | 401 zc0 : ZChain A ay f mf supO (Oprev.oprev op) |
402 zc0 = prev px (subst (λ k → px o< k) (Oprev.oprev=x op) <-osuc ) ay | |
569 | 403 zc0-b<x : (b : Ordinal ) → b o< x → b o< osuc px |
404 zc0-b<x b lt = subst (λ k → b o< k ) (sym (Oprev.oprev=x op)) lt | |
405 | |
547 | 406 zc4 : ZChain A ay f mf supO x |
565 | 407 zc4 with ODC.∋-p O A (* x) |
568 | 408 ... | no noax = -- ¬ A ∋ p, just skip |
560 | 409 record { chain = ZChain.chain zc0 ; chain⊆A = ZChain.chain⊆A zc0 ; initial = ZChain.initial zc0 |
554 | 410 ; f-total = ZChain.f-total zc0 ; f-next = ZChain.f-next zc0 |
551 | 411 ; f-immediate = ZChain.f-immediate zc0 ; chain∋x = ZChain.chain∋x zc0 ; is-max = zc11 } where -- no extention |
568 | 412 zc11 : {a b : Ordinal} → odef (ZChain.chain zc0) a → b o< osuc x → (ab : odef A b) → |
570 | 413 HasPrev A (ZChain.chain zc0) ab f ∨ IsSup A (ZChain.chain zc0) ab → |
551 | 414 * a < * b → odef (ZChain.chain zc0) b |
568 | 415 zc11 {a} {b} za b<ox ab P a<b with osuc-≡< b<ox |
416 ... | case1 eq = ⊥-elim ( noax (subst (λ k → odef A k) (trans eq (sym &iso)) ab ) ) | |
569 | 417 ... | case2 lt = ZChain.is-max zc0 za (zc0-b<x b lt) ab P a<b |
568 | 418 ... | yes ax with ODC.p∨¬p O ( HasPrev A (ZChain.chain zc0) ax f ) -- we have to check adding x preserve is-max ZChain A ay f mf supO x |
549 | 419 ... | case1 pr = zc9 where -- we have previous A ∋ z < x , f z ≡ x, so chain ∋ f z ≡ x because of f-next |
551 | 420 chain = ZChain.chain zc0 |
568 | 421 zc17 : {a b : Ordinal} → odef (ZChain.chain zc0) a → b o< osuc x → (ab : odef A b) → |
570 | 422 HasPrev A (ZChain.chain zc0) ab f ∨ IsSup A (ZChain.chain zc0) ab → |
551 | 423 * a < * b → odef (ZChain.chain zc0) b |
568 | 424 zc17 {a} {b} za b<ox ab P a<b with osuc-≡< b<ox |
569 | 425 ... | case2 lt = ZChain.is-max zc0 za (zc0-b<x b lt) ab P a<b |
567 | 426 ... | case1 b=x = subst (λ k → odef chain k ) (trans (sym (HasPrev.x=fy pr )) (trans &iso (sym b=x)) ) ( ZChain.f-next zc0 (HasPrev.ay pr)) |
549 | 427 zc9 : ZChain A ay f mf supO x |
428 zc9 = record { chain = ZChain.chain zc0 ; chain⊆A = ZChain.chain⊆A zc0 ; f-total = ZChain.f-total zc0 ; f-next = ZChain.f-next zc0 | |
554 | 429 ; initial = ZChain.initial zc0 ; f-immediate = ZChain.f-immediate zc0 ; chain∋x = ZChain.chain∋x zc0 ; is-max = zc17 } -- no extention |
570 | 430 ... | case2 ¬fy<x with ODC.p∨¬p O (IsSup A (ZChain.chain zc0) ax ) |
571 | 431 ... | case1 is-sup = -- x is a sup of zc0 |
432 record { chain = schain ; chain⊆A = s⊆A ; f-total = scmp ; f-next = scnext | |
433 ; initial = scinit ; f-immediate = simm ; chain∋x = case1 (ZChain.chain∋x zc0) ; is-max = s-ismax } where | |
570 | 434 sup0 : SUP A (ZChain.chain zc0) |
571 | 435 sup0 = record { sup = * x ; A∋maximal = ax ; x<sup = x21 } where |
436 x21 : {y : HOD} → ZChain.chain zc0 ∋ y → (y ≡ * x) ∨ (y < * x) | |
437 x21 {y} zy with IsSup.x<sup is-sup zy | |
438 ... | case1 y=x = case1 ( subst₂ (λ j k → j ≡ * k ) *iso &iso ( cong (*) y=x) ) | |
439 ... | case2 y<x = case2 (subst₂ (λ j k → j < * k ) *iso &iso y<x ) | |
570 | 440 sp : HOD |
561 | 441 sp = SUP.sup sup0 |
570 | 442 x=sup : x ≡ & sp |
443 x=sup = sym &iso | |
551 | 444 chain = ZChain.chain zc0 |
561 | 445 sc<A : {y : Ordinal} → odef chain y ∨ FClosure A f (& sp) y → y o< & A |
569 | 446 sc<A {y} (case1 zx) = subst (λ k → k o< (& A)) &iso ( c<→o< (ZChain.chain⊆A zc0 (subst (λ k → odef chain k) (sym &iso) zx ))) |
561 | 447 sc<A {y} (case2 fx) = subst (λ k → k o< (& A)) &iso ( c<→o< (subst (λ k → odef A k ) (sym &iso) (A∋fc (& sp) f mf fx )) ) |
552 | 448 schain : HOD |
561 | 449 schain = record { od = record { def = λ x → odef chain x ∨ (FClosure A f (& sp) x) } ; odmax = & A ; <odmax = λ {y} sy → sc<A {y} sy } |
450 A∋schain : {x : HOD } → schain ∋ x → A ∋ x | |
569 | 451 A∋schain (case1 zx ) = ZChain.chain⊆A zc0 zx |
561 | 452 A∋schain {y} (case2 fx ) = A∋fc (& sp) f mf fx |
569 | 453 s⊆A : schain ⊆' A |
454 s⊆A {x} (case1 zx) = ZChain.chain⊆A zc0 zx | |
455 s⊆A {x} (case2 fx) = A∋fc (& sp) f mf fx | |
561 | 456 cmp : {a b : HOD} (za : odef chain (& a)) (fb : FClosure A f (& sp) (& b)) → Tri (a < b) (a ≡ b) (b < a ) |
457 cmp {a} {b} za fb with SUP.x<sup sup0 za | s≤fc (& sp) f mf fb | |
458 ... | case1 sp=a | case1 sp=b = tri≈ (λ lt → <-irr (case1 (sym eq)) lt ) eq (λ lt → <-irr (case1 eq) lt ) where | |
459 eq : a ≡ b | |
460 eq = trans sp=a (subst₂ (λ j k → j ≡ k ) *iso *iso sp=b ) | |
461 ... | case1 sp=a | case2 sp<b = tri< a<b (λ eq → <-irr (case1 (sym eq)) a<b ) (λ lt → <-irr (case2 a<b) lt ) where | |
462 a<b : a < b | |
463 a<b = subst (λ k → k < b ) (sym sp=a) (subst₂ (λ j k → j < k ) *iso *iso sp<b ) | |
464 ... | case2 a<sp | case1 sp=b = tri< a<b (λ eq → <-irr (case1 (sym eq)) a<b ) (λ lt → <-irr (case2 a<b) lt ) where | |
465 a<b : a < b | |
466 a<b = subst (λ k → a < k ) (trans sp=b *iso ) (subst (λ k → a < k ) (sym *iso) a<sp ) | |
467 ... | case2 a<sp | case2 sp<b = tri< a<b (λ eq → <-irr (case1 (sym eq)) a<b ) (λ lt → <-irr (case2 a<b) lt ) where | |
468 a<b : a < b | |
469 a<b = ptrans (subst (λ k → a < k ) (sym *iso) a<sp ) ( subst₂ (λ j k → j < k ) refl *iso sp<b ) | |
470 scmp : {a b : HOD} → odef schain (& a) → odef schain (& b) → Tri (a < b) (a ≡ b) (b < a ) | |
471 scmp (case1 za) (case1 zb) = ZChain.f-total zc0 za zb | |
472 scmp {a} {b} (case1 za) (case2 fb) = cmp za fb | |
473 scmp (case2 fa) (case1 zb) with cmp zb fa | |
474 ... | tri< a ¬b ¬c = tri> ¬c (λ eq → ¬b (sym eq)) a | |
475 ... | tri≈ ¬a b ¬c = tri≈ ¬c (sym b) ¬a | |
476 ... | tri> ¬a ¬b c = tri< c (λ eq → ¬b (sym eq)) ¬a | |
477 scmp (case2 fa) (case2 fb) = subst₂ (λ a b → Tri (a < b) (a ≡ b) (b < a ) ) *iso *iso (fcn-cmp (& sp) f mf fa fb) | |
478 scnext : {a : Ordinal} → odef schain a → odef schain (f a) | |
479 scnext {x} (case1 zx) = case1 (ZChain.f-next zc0 zx) | |
480 scnext {x} (case2 sx) = case2 ( fsuc x sx ) | |
481 scinit : {x : Ordinal} → odef schain x → * y ≤ * x | |
482 scinit {x} (case1 zx) = ZChain.initial zc0 zx | |
483 scinit {x} (case2 sx) with (s≤fc (& sp) f mf sx ) | SUP.x<sup sup0 (subst (λ k → odef chain k ) (sym &iso) ( ZChain.chain∋x zc0 ) ) | |
562 | 484 ... | case1 sp=x | case1 y=sp = case1 (trans y=sp (subst (λ k → k ≡ * x ) *iso sp=x ) ) |
485 ... | case1 sp=x | case2 y<sp = case2 (subst (λ k → * y < k ) (trans (sym *iso) sp=x) y<sp ) | |
486 ... | case2 sp<x | case1 y=sp = case2 (subst (λ k → k < * x ) (trans *iso (sym y=sp )) sp<x ) | |
487 ... | case2 sp<x | case2 y<sp = case2 (ptrans y<sp (subst (λ k → k < * x ) *iso sp<x) ) | |
488 A∋za : {a : Ordinal } → odef chain a → odef A a | |
569 | 489 A∋za za = ZChain.chain⊆A zc0 za |
562 | 490 za<sup : {a : Ordinal } → odef chain a → ( * a ≡ sp ) ∨ ( * a < sp ) |
491 za<sup za = SUP.x<sup sup0 (subst (λ k → odef chain k ) (sym &iso) za ) | |
492 simm : {a b : Ordinal} → odef schain a → odef schain b → ¬ (* a < * b) ∧ (* b < * (f a)) | |
493 simm {a} {b} (case1 za) (case1 zb) = ZChain.f-immediate zc0 za zb | |
494 simm {a} {b} (case1 za) (case2 sb) p with proj1 (mf a (A∋za za) ) | |
495 ... | case1 eq = <-irr (case2 (subst (λ k → * b < k ) (sym eq) (proj2 p))) (proj1 p) | |
496 ... | case2 a<fa with za<sup ( ZChain.f-next zc0 za ) | s≤fc (& sp) f mf sb | |
497 ... | case1 fa=sp | case1 sp=b = <-irr (case1 (trans fa=sp (trans (sym *iso) sp=b )) ) ( proj2 p ) | |
498 ... | case2 fa<sp | case1 sp=b = <-irr (case2 fa<sp) (subst (λ k → k < * (f a) ) (trans (sym sp=b) *iso) (proj2 p ) ) | |
499 ... | case1 fa=sp | case2 sp<b = <-irr (case2 (proj2 p )) (subst (λ k → k < * b) (sym fa=sp) (subst (λ k → k < * b ) *iso sp<b ) ) | |
500 ... | case2 fa<sp | case2 sp<b = <-irr (case2 (proj2 p )) (ptrans fa<sp (subst (λ k → k < * b ) *iso sp<b ) ) | |
501 simm {a} {b} (case2 sa) (case1 zb) p with proj1 (mf a ( subst (λ k → odef A k) &iso ( A∋schain (case2 (subst (λ k → FClosure A f (& sp) k ) (sym &iso) sa) )) ) ) | |
502 ... | case1 eq = <-irr (case2 (subst (λ k → * b < k ) (sym eq) (proj2 p))) (proj1 p) | |
503 ... | case2 b<fb with s≤fc (& sp) f mf sa | za<sup zb | |
504 ... | case1 sp=a | case1 b=sp = <-irr (case1 (trans b=sp (trans (sym *iso) sp=a )) ) (proj1 p ) | |
505 ... | case1 sp=a | case2 b<sp = <-irr (case2 (subst (λ k → * b < k ) (trans (sym *iso) sp=a) b<sp ) ) (proj1 p ) | |
506 ... | case2 sp<a | case1 b=sp = <-irr (case2 (subst ( λ k → k < * a ) (trans *iso (sym b=sp)) sp<a )) (proj1 p ) | |
507 ... | case2 sp<a | case2 b<sp = <-irr (case2 (ptrans b<sp (subst (λ k → k < * a) *iso sp<a ))) (proj1 p ) | |
564 | 508 simm {a} {b} (case2 sa) (case2 sb) p = fcn-imm {A} (& sp) {a} {b} f mf sa sb p |
571 | 509 s-ismax : {a b : Ordinal} → odef schain a → b o< osuc x → (ab : odef A b) |
510 → HasPrev A schain ab f ∨ IsSup A schain ab | |
569 | 511 → * a < * b → odef schain b |
571 | 512 s-ismax {a} {b} sa b<ox ab p a<b with osuc-≡< b<ox -- b is x? |
513 ... | case1 b=x = case2 (subst (λ k → FClosure A f (& sp) k ) (sym (trans b=x x=sup )) (init (SUP.A∋maximal sup0) )) | |
514 s-ismax {a} {b} (case1 za) b<ox ab (case1 p) a<b | case2 b<x = z21 p where -- has previous | |
568 | 515 z21 : HasPrev A schain ab f → odef schain b |
567 | 516 z21 record { y = y ; ay = (case1 zy) ; x=fy = x=fy } = |
569 | 517 case1 (ZChain.is-max zc0 za (zc0-b<x b b<x) ab (case1 record { y = y ; ay = zy ; x=fy = x=fy }) a<b ) |
567 | 518 z21 record { y = y ; ay = (case2 sy) ; x=fy = x=fy } = subst (λ k → odef schain k) (sym x=fy) (case2 (fsuc y sy) ) |
571 | 519 s-ismax {a} {b} (case1 za) b<ox ab (case2 p) a<b | case2 b<x = case1 (ZChain.is-max zc0 za (zc0-b<x b b<x) ab (case2 z22) a<b ) where -- previous sup |
520 z22 : IsSup A (ZChain.chain zc0) ab | |
521 z22 = record { x<sup = λ {y} zy → IsSup.x<sup p (case1 zy ) } | |
522 s-ismax {a} {b} (case2 sa) b<ox ab (case1 p) a<b | case2 b<x with HasPrev.ay p | |
523 ... | case1 zy = case1 (subst (λ k → odef chain k ) (sym (HasPrev.x=fy p)) (ZChain.f-next zc0 zy )) -- in previous closure of f | |
524 ... | case2 sy = case2 (subst (λ k → FClosure A f (& (* x)) k ) (sym (HasPrev.x=fy p)) (fsuc (HasPrev.y p) sy )) -- in current closure of f | |
572
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
525 s-ismax {a} {b} (case2 sa) b<ox ab (case2 p) a<b | case2 b<x = case1 z23 where -- sup o< x is already in zc0 |
571 | 526 z24 : IsSup A schain ab → IsSup A (ZChain.chain zc0) ab |
527 z24 p = record { x<sup = λ {y} zy → IsSup.x<sup p (case1 zy ) } | |
572
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
528 z23 : odef chain b |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
529 z23 with IsSup.x<sup (z24 p) ( ZChain.chain∋x zc0 ) |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
530 ... | case1 y=b = subst (λ k → odef chain k ) y=b ( ZChain.chain∋x zc0 ) |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
531 ... | case2 y<b = ZChain.is-max zc0 (ZChain.chain∋x zc0 ) (zc0-b<x b b<x) ab (case2 (z24 p)) y<b |
560 | 532 ... | case2 ¬x=sup = -- x is not f y' nor sup of former ZChain from y |
533 record { chain = ZChain.chain zc0 ; chain⊆A = ZChain.chain⊆A zc0 ; f-total = ZChain.f-total zc0 ; f-next = ZChain.f-next zc0 | |
565 | 534 ; initial = ZChain.initial zc0 ; f-immediate = ZChain.f-immediate zc0 ; chain∋x = ZChain.chain∋x zc0 ; is-max = z18 } where -- no extention |
568 | 535 z18 : {a b : Ordinal} → odef (ZChain.chain zc0) a → b o< osuc x → (ab : odef A b) → |
570 | 536 HasPrev A (ZChain.chain zc0) ab f ∨ IsSup A (ZChain.chain zc0) ab → |
552 | 537 * a < * b → odef (ZChain.chain zc0) b |
568 | 538 z18 {a} {b} za b<x ab p a<b with osuc-≡< b<x |
569 | 539 ... | case2 lt = ZChain.is-max zc0 za (zc0-b<x b lt) ab p a<b |
565 | 540 ... | case1 b=x with p |
567 | 541 ... | case1 pr = ⊥-elim ( ¬fy<x record {y = HasPrev.y pr ; ay = HasPrev.ay pr ; x=fy = trans (trans &iso (sym b=x) ) (HasPrev.x=fy pr ) } ) |
571 | 542 ... | case2 b=sup = ⊥-elim ( ¬x=sup record { |
543 x<sup = λ {y} zy → subst (λ k → (y ≡ k) ∨ (y << k)) (trans b=x (sym &iso)) (IsSup.x<sup b=sup zy) } ) | |
572
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
544 ... | no ¬ox = record { chain = Uz ; chain⊆A = Uz⊆A ; f-total = u-total ; f-next = u-next |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
545 ; initial = u-initial ; f-immediate = {!!} ; chain∋x = {!!} ; is-max = {!!} } where --- limit ordinal case |
554 | 546 record UZFChain (z : Ordinal) : Set n where -- Union of ZFChain from y which has maximality o< x |
553 | 547 field |
548 u : Ordinal | |
549 u<x : u o< x | |
572
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
550 chain∋z : odef (ZChain.chain (prev u u<x {y} ay )) z |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
551 Uz⊆A : {z : Ordinal} → UZFChain z → odef A z |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
552 Uz⊆A {z} u = ZChain.chain⊆A ( prev (UZFChain.u u) (UZFChain.u<x u) {y} ay ) (UZFChain.chain∋z u) |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
553 uzc : {z : Ordinal} → (u : UZFChain z) → ZChain A ay f mf supO (UZFChain.u u) |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
554 uzc {z} u = prev (UZFChain.u u) (UZFChain.u<x u) {y} ay |
554 | 555 Uz : HOD |
572
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
556 Uz = record { od = record { def = λ y → UZFChain y } ; odmax = & A |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
557 ; <odmax = λ lt → subst (λ k → k o< & A ) &iso (c<→o< (subst (λ k → odef A k ) (sym &iso) (Uz⊆A lt))) } |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
558 u-next : {z : Ordinal} → odef Uz z → odef Uz (f z) |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
559 u-next {z} u = record { u = UZFChain.u u ; u<x = UZFChain.u<x u ; chain∋z = ZChain.f-next ( uzc u ) (UZFChain.chain∋z u) } |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
560 u-initial : {z : Ordinal} → odef Uz z → * y ≤ * z |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
561 u-initial {z} u = ZChain.initial ( uzc u ) (UZFChain.chain∋z u) |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
562 u-chain∋x : odef Uz y |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
563 u-chain∋x = {!!} |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
564 Uz-mono : { a b : Ordinal } → (ua : odef Uz a) (ub : odef Uz b ) → a o< b → ZChain.chain (uzc ua) ⊆' ZChain.chain (uzc ub) |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
565 Uz-mono {a} {b} ua ub a<b ca = ZChain.is-max (uzc ub) (ZChain.chain∋x (uzc ub)) {!!} {!!} {!!} {!!} where |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
566 z30 : odef A b |
427e36467a18
ZChain is monotonic on x, should be in record ZFChain
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
571
diff
changeset
|
567 z30 = (ZChain.chain⊆A (uzc ub) (UZFChain.chain∋z ub)) |
554 | 568 u-total : IsTotalOrderSet Uz |
553 | 569 u-total {x} {y} ux uy = {!!} |
560 | 570 --- ux ⊆ uy ∨ uy ⊆ ux |
553 | 571 |
551 | 572 zorn00 : Maximal A |
573 zorn00 with is-o∅ ( & HasMaximal ) -- we have no Level (suc n) LEM | |
574 ... | no not = record { maximal = ODC.minimal O HasMaximal (λ eq → not (=od∅→≡o∅ eq)) ; A∋maximal = zorn01 ; ¬maximal<x = zorn02 } where | |
575 -- yes we have the maximal | |
576 zorn03 : odef HasMaximal ( & ( ODC.minimal O HasMaximal (λ eq → not (=od∅→≡o∅ eq)) ) ) | |
577 zorn03 = ODC.x∋minimal O HasMaximal (λ eq → not (=od∅→≡o∅ eq)) | |
578 zorn01 : A ∋ ODC.minimal O HasMaximal (λ eq → not (=od∅→≡o∅ eq)) | |
579 zorn01 = proj1 zorn03 | |
580 zorn02 : {x : HOD} → A ∋ x → ¬ (ODC.minimal O HasMaximal (λ eq → not (=od∅→≡o∅ eq)) < x) | |
581 zorn02 {x} ax m<x = proj2 zorn03 (& x) ax (subst₂ (λ j k → j < k) (sym *iso) (sym *iso) m<x ) | |
582 ... | yes ¬Maximal = ⊥-elim ( z04 nmx zorn04) where | |
583 -- if we have no maximal, make ZChain, which contradict SUP condition | |
584 nmx : ¬ Maximal A | |
585 nmx mx = ∅< {HasMaximal} zc5 ( ≡o∅→=od∅ ¬Maximal ) where | |
586 zc5 : odef A (& (Maximal.maximal mx)) ∧ (( y : Ordinal ) → odef A y → ¬ (* (& (Maximal.maximal mx)) < * y)) | |
587 zc5 = ⟪ Maximal.A∋maximal mx , (λ y ay mx<y → Maximal.¬maximal<x mx (subst (λ k → odef A k ) (sym &iso) ay) (subst (λ k → k < * y) *iso mx<y) ) ⟫ | |
588 zorn03 : ( f : Ordinal → Ordinal ) → (mf : ≤-monotonic-f A f ) → (ya : odef A (& s)) → ZChain A ya f mf supO (& A) | |
589 zorn03 f mf = TransFinite {λ z → {y : Ordinal } → (ya : odef A y ) → ZChain A ya f mf supO z } (ind f mf) (& A) | |
568 | 590 zorn04 : ZChain A (subst (λ k → odef A k ) &iso as ) (cf nmx) (cf-is-≤-monotonic nmx) supO (& A) |
591 zorn04 = zorn03 (cf nmx) (cf-is-≤-monotonic nmx) (subst (λ k → odef A k ) &iso as ) | |
551 | 592 |
516 | 593 -- usage (see filter.agda ) |
594 -- | |
497 | 595 -- _⊆'_ : ( A B : HOD ) → Set n |
596 -- _⊆'_ A B = (x : Ordinal ) → odef A x → odef B x | |
482 | 597 |
497 | 598 -- MaximumSubset : {L P : HOD} |
599 -- → o∅ o< & L → o∅ o< & P → P ⊆ L | |
600 -- → IsPartialOrderSet P _⊆'_ | |
601 -- → ( (B : HOD) → B ⊆ P → IsTotalOrderSet B _⊆'_ → SUP P B _⊆'_ ) | |
602 -- → Maximal P (_⊆'_) | |
603 -- MaximumSubset {L} {P} 0<L 0<P P⊆L PO SP = Zorn-lemma {P} {_⊆'_} 0<P PO SP |