annotate src/zorn.agda @ 567:4d8a54e2861e

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