653
|
1 open import Level
|
431
|
2 module ordinal where
|
|
3
|
|
4 open import logic
|
|
5 open import nat
|
653
|
6 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; _⊔_ to _n⊔_ )
|
431
|
7 open import Data.Empty
|
|
8 open import Relation.Binary.PropositionalEquality
|
|
9 open import Relation.Binary.Definitions
|
653
|
10 open import Data.Nat.Properties as NP
|
431
|
11 open import Relation.Nullary
|
|
12 open import Relation.Binary.Core
|
|
13
|
|
14 ----
|
|
15 --
|
|
16 -- Countable Ordinals
|
|
17 --
|
|
18
|
653
|
19 data OrdinalD {n : Level} : (lv : ℕ) → Set n where
|
|
20 Φ : (lv : ℕ) → OrdinalD lv
|
|
21 OSuc : (lv : ℕ) → OrdinalD {n} lv → OrdinalD lv
|
431
|
22
|
|
23 record Ordinal {n : Level} : Set n where
|
|
24 constructor ordinal
|
|
25 field
|
653
|
26 lv : ℕ
|
431
|
27 ord : OrdinalD {n} lv
|
|
28
|
653
|
29 data _d<_ {n : Level} : {lx ly : ℕ} → OrdinalD {n} lx → OrdinalD {n} ly → Set n where
|
|
30 Φ< : {lx : ℕ} → {x : OrdinalD {n} lx} → Φ lx d< OSuc lx x
|
|
31 s< : {lx : ℕ} → {x y : OrdinalD {n} lx} → x d< y → OSuc lx x d< OSuc lx y
|
431
|
32
|
|
33 open Ordinal
|
|
34
|
|
35 _o<_ : {n : Level} ( x y : Ordinal ) → Set n
|
|
36 _o<_ x y = (lv x < lv y ) ∨ ( ord x d< ord y )
|
|
37
|
653
|
38 s<refl : {n : Level } {lx : ℕ } { x : OrdinalD {n} lx } → x d< OSuc lx x
|
431
|
39 s<refl {n} {lv} {Φ lv} = Φ<
|
|
40 s<refl {n} {lv} {OSuc lv x} = s< s<refl
|
|
41
|
653
|
42 trio<> : {n : Level} → {lx : ℕ} {x : OrdinalD {n} lx } { y : OrdinalD lx } → y d< x → x d< y → ⊥
|
431
|
43 trio<> {n} {lx} {.(OSuc lx _)} {.(OSuc lx _)} (s< s) (s< t) = trio<> s t
|
|
44 trio<> {n} {lx} {.(OSuc lx _)} {.(Φ lx)} Φ< ()
|
|
45
|
|
46 d<→lv : {n : Level} {x y : Ordinal {n}} → ord x d< ord y → lv x ≡ lv y
|
|
47 d<→lv Φ< = refl
|
|
48 d<→lv (s< lt) = refl
|
|
49
|
|
50 o∅ : {n : Level} → Ordinal {n}
|
|
51 o∅ = record { lv = Zero ; ord = Φ Zero }
|
|
52
|
|
53 open import Relation.Binary.HeterogeneousEquality using (_≅_;refl)
|
|
54
|
|
55 ordinal-cong : {n : Level} {x y : Ordinal {n}} →
|
|
56 lv x ≡ lv y → ord x ≅ ord y → x ≡ y
|
|
57 ordinal-cong refl refl = refl
|
|
58
|
653
|
59 ≡→¬d< : {n : Level} → {lv : ℕ} → {x : OrdinalD {n} lv } → x d< x → ⊥
|
431
|
60 ≡→¬d< {n} {lx} {OSuc lx y} (s< t) = ≡→¬d< t
|
|
61
|
653
|
62 trio<≡ : {n : Level} → {lx : ℕ} {x : OrdinalD {n} lx } { y : OrdinalD lx } → x ≡ y → x d< y → ⊥
|
431
|
63 trio<≡ refl = ≡→¬d<
|
|
64
|
653
|
65 trio>≡ : {n : Level} → {lx : ℕ} {x : OrdinalD {n} lx } { y : OrdinalD lx } → x ≡ y → y d< x → ⊥
|
431
|
66 trio>≡ refl = ≡→¬d<
|
|
67
|
653
|
68 triOrdd : {n : Level} → {lx : ℕ} → Trichotomous _≡_ ( _d<_ {n} {lx} {lx} )
|
431
|
69 triOrdd {_} {lv} (Φ lv) (Φ lv) = tri≈ ≡→¬d< refl ≡→¬d<
|
|
70 triOrdd {_} {lv} (Φ lv) (OSuc lv y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< )
|
|
71 triOrdd {_} {lv} (OSuc lv x) (Φ lv) = tri> (λ lt → trio<> lt Φ<) (λ ()) Φ<
|
|
72 triOrdd {_} {lv} (OSuc lv x) (OSuc lv y) with triOrdd x y
|
|
73 triOrdd {_} {lv} (OSuc lv x) (OSuc lv y) | tri< a ¬b ¬c = tri< (s< a) (λ tx=ty → trio<≡ tx=ty (s< a) ) ( λ lt → trio<> lt (s< a) )
|
|
74 triOrdd {_} {lv} (OSuc lv x) (OSuc lv x) | tri≈ ¬a refl ¬c = tri≈ ≡→¬d< refl ≡→¬d<
|
|
75 triOrdd {_} {lv} (OSuc lv x) (OSuc lv y) | tri> ¬a ¬b c = tri> ( λ lt → trio<> lt (s< c) ) (λ tx=ty → trio>≡ tx=ty (s< c) ) (s< c)
|
|
76
|
|
77 osuc : {n : Level} ( x : Ordinal {n} ) → Ordinal {n}
|
|
78 osuc record { lv = lx ; ord = ox } = record { lv = lx ; ord = OSuc lx ox }
|
|
79
|
|
80 <-osuc : {n : Level} { x : Ordinal {n} } → x o< osuc x
|
|
81 <-osuc {n} {record { lv = lx ; ord = Φ .lx }} = case2 Φ<
|
|
82 <-osuc {n} {record { lv = lx ; ord = OSuc .lx ox }} = case2 ( s< s<refl )
|
|
83
|
|
84 o<¬≡ : {n : Level } { ox oy : Ordinal {suc n}} → ox ≡ oy → ox o< oy → ⊥
|
|
85 o<¬≡ {_} {ox} {ox} refl (case1 lt) = =→¬< lt
|
|
86 o<¬≡ {_} {ox} {ox} refl (case2 (s< lt)) = trio<≡ refl lt
|
|
87
|
|
88 ¬x<0 : {n : Level} → { x : Ordinal {suc n} } → ¬ ( x o< o∅ {suc n} )
|
|
89 ¬x<0 {n} {x} (case1 ())
|
|
90 ¬x<0 {n} {x} (case2 ())
|
|
91
|
|
92 o<> : {n : Level} → {x y : Ordinal {n} } → y o< x → x o< y → ⊥
|
|
93 o<> {n} {x} {y} (case1 x₁) (case1 x₂) = nat-<> x₁ x₂
|
|
94 o<> {n} {x} {y} (case1 x₁) (case2 x₂) = nat-≡< (sym (d<→lv x₂)) x₁
|
|
95 o<> {n} {x} {y} (case2 x₁) (case1 x₂) = nat-≡< (sym (d<→lv x₁)) x₂
|
|
96 o<> {n} {record { lv = lv₁ ; ord = .(OSuc lv₁ _) }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) (case2 ())
|
|
97 o<> {n} {record { lv = lv₁ ; ord = .(OSuc lv₁ _) }} {record { lv = .lv₁ ; ord = .(OSuc lv₁ _) }} (case2 (s< y<x)) (case2 (s< x<y)) =
|
|
98 o<> (case2 y<x) (case2 x<y)
|
|
99
|
653
|
100 orddtrans : {n : Level} {lx : ℕ} {x y z : OrdinalD {n} lx } → x d< y → y d< z → x d< z
|
431
|
101 orddtrans {_} {lx} {.(Φ lx)} {.(OSuc lx _)} {.(OSuc lx _)} Φ< (s< y<z) = Φ<
|
|
102 orddtrans {_} {lx} {.(OSuc lx _)} {.(OSuc lx _)} {.(OSuc lx _)} (s< x<y) (s< y<z) = s< ( orddtrans x<y y<z )
|
|
103
|
|
104 osuc-≡< : {n : Level} { a x : Ordinal {n} } → x o< osuc a → (x ≡ a ) ∨ (x o< a)
|
|
105 osuc-≡< {n} {a} {x} (case1 lt) = case2 (case1 lt)
|
|
106 osuc-≡< {n} {record { lv = lv₁ ; ord = Φ .lv₁ }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) = case1 refl
|
|
107 osuc-≡< {n} {record { lv = lv₁ ; ord = OSuc .lv₁ ord₁ }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) = case2 (case2 Φ<)
|
|
108 osuc-≡< {n} {record { lv = lv₁ ; ord = Φ .lv₁ }} {record { lv = .lv₁ ; ord = .(OSuc lv₁ _) }} (case2 (s< ()))
|
|
109 osuc-≡< {n} {record { lv = la ; ord = OSuc la oa }} {record { lv = la ; ord = (OSuc la ox) }} (case2 (s< lt)) with
|
|
110 osuc-≡< {n} {record { lv = la ; ord = oa }} {record { lv = la ; ord = ox }} (case2 lt )
|
|
111 ... | case1 refl = case1 refl
|
|
112 ... | case2 (case2 x) = case2 (case2( s< x) )
|
|
113 ... | case2 (case1 x) = ⊥-elim (¬a≤a x)
|
|
114
|
|
115 osuc-< : {n : Level} { x y : Ordinal {n} } → y o< osuc x → x o< y → ⊥
|
|
116 osuc-< {n} {x} {y} y<ox x<y with osuc-≡< y<ox
|
|
117 osuc-< {n} {x} {x} y<ox (case1 x₁) | case1 refl = ⊥-elim (¬a≤a x₁)
|
|
118 osuc-< {n} {x} {x} (case1 x₂) (case2 x₁) | case1 refl = ⊥-elim (¬a≤a x₂)
|
|
119 osuc-< {n} {x} {x} (case2 x₂) (case2 x₁) | case1 refl = ≡→¬d< x₁
|
|
120 osuc-< {n} {x} {y} y<ox (case1 x₂) | case2 (case1 x₁) = nat-<> x₂ x₁
|
|
121 osuc-< {n} {x} {y} y<ox (case1 x₂) | case2 (case2 x₁) = nat-≡< (sym (d<→lv x₁)) x₂
|
|
122 osuc-< {n} {x} {y} y<ox (case2 x<y) | case2 y<x = o<> (case2 x<y) y<x
|
|
123
|
|
124
|
|
125 ordtrans : {n : Level} {x y z : Ordinal {n} } → x o< y → y o< z → x o< z
|
|
126 ordtrans {n} {x} {y} {z} (case1 x₁) (case1 x₂) = case1 ( <-trans x₁ x₂ )
|
|
127 ordtrans {n} {x} {y} {z} (case1 x₁) (case2 x₂) with d<→lv x₂
|
|
128 ... | refl = case1 x₁
|
|
129 ordtrans {n} {x} {y} {z} (case2 x₁) (case1 x₂) with d<→lv x₁
|
|
130 ... | refl = case1 x₂
|
|
131 ordtrans {n} {x} {y} {z} (case2 x₁) (case2 x₂) with d<→lv x₁ | d<→lv x₂
|
|
132 ... | refl | refl = case2 ( orddtrans x₁ x₂ )
|
|
133
|
|
134 trio< : {n : Level } → Trichotomous {suc n} _≡_ _o<_
|
|
135 trio< a b with <-cmp (lv a) (lv b)
|
|
136 trio< a b | tri< a₁ ¬b ¬c = tri< (case1 a₁) (λ refl → ¬b (cong ( λ x → lv x ) refl ) ) lemma1 where
|
|
137 lemma1 : ¬ (Suc (lv b) ≤ lv a) ∨ (ord b d< ord a)
|
|
138 lemma1 (case1 x) = ¬c x
|
|
139 lemma1 (case2 x) = ⊥-elim (nat-≡< (sym ( d<→lv x )) a₁ )
|
|
140 trio< a b | tri> ¬a ¬b c = tri> lemma1 (λ refl → ¬b (cong ( λ x → lv x ) refl ) ) (case1 c) where
|
|
141 lemma1 : ¬ (Suc (lv a) ≤ lv b) ∨ (ord a d< ord b)
|
|
142 lemma1 (case1 x) = ¬a x
|
|
143 lemma1 (case2 x) = ⊥-elim (nat-≡< (sym ( d<→lv x )) c )
|
|
144 trio< a b | tri≈ ¬a refl ¬c with triOrdd ( ord a ) ( ord b )
|
|
145 trio< record { lv = .(lv b) ; ord = x } b | tri≈ ¬a refl ¬c | tri< a ¬b ¬c₁ = tri< (case2 a) (λ refl → ¬b (lemma1 refl )) lemma2 where
|
|
146 lemma1 : (record { lv = _ ; ord = x }) ≡ b → x ≡ ord b
|
|
147 lemma1 refl = refl
|
|
148 lemma2 : ¬ (Suc (lv b) ≤ lv b) ∨ (ord b d< x)
|
|
149 lemma2 (case1 x) = ¬a x
|
|
150 lemma2 (case2 x) = trio<> x a
|
|
151 trio< record { lv = .(lv b) ; ord = x } b | tri≈ ¬a refl ¬c | tri> ¬a₁ ¬b c = tri> lemma2 (λ refl → ¬b (lemma1 refl )) (case2 c) where
|
|
152 lemma1 : (record { lv = _ ; ord = x }) ≡ b → x ≡ ord b
|
|
153 lemma1 refl = refl
|
|
154 lemma2 : ¬ (Suc (lv b) ≤ lv b) ∨ (x d< ord b)
|
|
155 lemma2 (case1 x) = ¬a x
|
|
156 lemma2 (case2 x) = trio<> x c
|
|
157 trio< record { lv = .(lv b) ; ord = x } b | tri≈ ¬a refl ¬c | tri≈ ¬a₁ refl ¬c₁ = tri≈ lemma1 refl lemma1 where
|
|
158 lemma1 : ¬ (Suc (lv b) ≤ lv b) ∨ (ord b d< ord b)
|
|
159 lemma1 (case1 x) = ¬a x
|
|
160 lemma1 (case2 x) = ≡→¬d< x
|
|
161
|
|
162
|
|
163 open _∧_
|
|
164
|
|
165 TransFinite : {n m : Level} → { ψ : Ordinal {suc n} → Set m }
|
653
|
166 → ( ∀ (lx : ℕ ) → ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x ) → ψ ( record { lv = lx ; ord = Φ lx } ) )
|
|
167 → ( ∀ (lx : ℕ ) → (x : OrdinalD lx ) → ( (y : Ordinal {suc n} ) → y o< ordinal lx (OSuc lx x) → ψ y ) → ψ ( record { lv = lx ; ord = OSuc lx x } ) )
|
431
|
168 → ∀ (x : Ordinal) → ψ x
|
|
169 TransFinite {n} {m} {ψ} caseΦ caseOSuc x = proj1 (TransFinite1 (lv x) (ord x) ) where
|
653
|
170 TransFinite1 : (lx : ℕ) (ox : OrdinalD lx ) → ψ (ordinal lx ox) ∧ ( ( (x : Ordinal {suc n} ) → x o< ordinal lx ox → ψ x ) )
|
431
|
171 TransFinite1 Zero (Φ 0) = ⟪ caseΦ Zero lemma , lemma1 ⟫ where
|
|
172 lemma : (x : Ordinal) → x o< ordinal Zero (Φ Zero) → ψ x
|
|
173 lemma x (case1 ())
|
|
174 lemma x (case2 ())
|
|
175 lemma1 : (x : Ordinal) → x o< ordinal Zero (Φ Zero) → ψ x
|
|
176 lemma1 x (case1 ())
|
|
177 lemma1 x (case2 ())
|
|
178 TransFinite1 (Suc lx) (Φ (Suc lx)) = ⟪ caseΦ (Suc lx) (λ x → lemma (lv x) (ord x)) , (λ x → lemma (lv x) (ord x)) ⟫ where
|
653
|
179 lemma0 : (ly : ℕ) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal lx (Φ lx) → ψ (ordinal ly oy)
|
431
|
180 lemma0 ly oy lt = proj2 ( TransFinite1 lx (Φ lx) ) (ordinal ly oy) lt
|
653
|
181 lemma : (ly : ℕ) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal (Suc lx) (Φ (Suc lx)) → ψ (ordinal ly oy)
|
431
|
182 lemma lx1 ox1 (case1 lt) with <-∨ lt
|
|
183 lemma lx (Φ lx) (case1 lt) | case1 refl = proj1 ( TransFinite1 lx (Φ lx) )
|
|
184 lemma lx (Φ lx) (case1 lt) | case2 lt1 = lemma0 lx (Φ lx) (case1 lt1)
|
|
185 lemma lx (OSuc lx ox1) (case1 lt) | case1 refl = caseOSuc lx ox1 lemma2 where
|
|
186 lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx) ∨ (ord y d< OSuc lx ox1) → ψ y
|
|
187 lemma2 y lt1 with osuc-≡< lt1
|
|
188 lemma2 y lt1 | case1 refl = lemma lx ox1 (case1 a<sa)
|
|
189 lemma2 y lt1 | case2 t = proj2 (TransFinite1 lx ox1) y t
|
|
190 lemma lx1 (OSuc lx1 ox1) (case1 lt) | case2 lt1 = caseOSuc lx1 ox1 lemma2 where
|
|
191 lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx1) ∨ (ord y d< OSuc lx1 ox1) → ψ y
|
|
192 lemma2 y lt2 with osuc-≡< lt2
|
|
193 lemma2 y lt2 | case1 refl = lemma lx1 ox1 (ordtrans lt2 (case1 lt))
|
|
194 lemma2 y lt2 | case2 (case1 lt3) = proj2 (TransFinite1 lx (Φ lx)) y (case1 (<-trans lt3 lt1 ))
|
|
195 lemma2 y lt2 | case2 (case2 lt3) with d<→lv lt3
|
|
196 ... | refl = proj2 (TransFinite1 lx (Φ lx)) y (case1 lt1)
|
|
197 TransFinite1 lx (OSuc lx ox) = ⟪ caseOSuc lx ox lemma , lemma ⟫ where
|
|
198 lemma : (y : Ordinal) → y o< ordinal lx (OSuc lx ox) → ψ y
|
|
199 lemma y lt with osuc-≡< lt
|
|
200 lemma y lt | case1 refl = proj1 ( TransFinite1 lx ox )
|
|
201 lemma y lt | case2 lt1 = proj2 ( TransFinite1 lx ox ) y lt1
|
|
202
|
1009
|
203 OrdIrr : {n : Level } {x y : Ordinal {suc n} } {lt lt1 : x o< y} → lt ≡ lt1
|
|
204 OrdIrr {n} {ordinal lv₁ ord₁} {ordinal lv₂ ord₂} {case1 x} {case1 x₁} = cong case1 (NP.<-irrelevant _ _ )
|
|
205 OrdIrr {n} {ordinal lv₁ ord₁} {ordinal lv₂ ord₂} {case1 x} {case2 x₁} = ⊥-elim ( nat-≡< ( d<→lv x₁ ) x )
|
|
206 OrdIrr {n} {ordinal lv₁ ord₁} {ordinal lv₂ ord₂} {case2 x} {case1 x₁} = ⊥-elim ( nat-≡< ( d<→lv x ) x₁ )
|
|
207 OrdIrr {n} {ordinal lv₁ .(Φ lv₁)} {ordinal .lv₁ .(OSuc lv₁ _)} {case2 Φ<} {case2 Φ<} = refl
|
|
208 OrdIrr {n} {ordinal lv₁ (OSuc lv₁ a)} {ordinal .lv₁ (OSuc lv₁ b)} {case2 (s< x)} {case2 (s< x₁)} = cong (λ k → case2 (s< k)) (lemma1 _ _ x x₁) where
|
653
|
209 lemma1 : {lx : ℕ} (a b : OrdinalD {suc n} lx) → (x y : a d< b ) → x ≡ y
|
612
|
210 lemma1 {lx} .(Φ lx) .(OSuc lx _) Φ< Φ< = refl
|
|
211 lemma1 {lx} (OSuc lx a) (OSuc lx b) (s< x) (s< y) = cong s< (lemma1 {lx} a b x y )
|
653
|
212
|
|
213 TransFinite3 : {n m : Level} { ψ : Ordinal {suc n} → Set m }
|
|
214 → ( (x : Ordinal {suc n}) → ( (y : Ordinal {suc n} ) → y o< x → ψ y ) → ψ x )
|
|
215 → ∀ (x : Ordinal {suc n} ) → ψ x
|
|
216 TransFinite3 {n} {m} {ψ} ind x = TransFinite {n} {m} {ψ} caseΦ caseOSuc x where
|
|
217 caseΦ : (lx : ℕ) → ((x₁ : Ordinal {suc n}) → x₁ o< ordinal lx (Φ lx) → ψ x₁) →
|
|
218 ψ (record { lv = lx ; ord = Φ lx })
|
|
219 caseΦ lx prev = ind (ordinal lx (Φ lx) ) prev
|
|
220 caseOSuc : (lx : ℕ) (x₁ : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x₁) → ψ y) →
|
|
221 ψ (record { lv = lx ; ord = OSuc lx x₁ })
|
|
222 caseOSuc lx ox prev = ind (ordinal lx (OSuc lx ox)) prev
|
|
223
|
|
224 -- TP : {n m l : Level} → {Q : Ordinal {suc n} → Set m} {P : { x y : Ordinal {suc n} } → Q x → Q y → Set l}
|
|
225 -- → ( ind : (x : Ordinal {suc n}) → ( (y : Ordinal {suc n} ) → y o< x → Q y ) → Q x )
|
|
226 -- → ( (x : Ordinal {suc n} ) → ( prev : (y : Ordinal {suc n} ) → y o< x → Q y ) → {y : Ordinal {suc n}} → (y<x : y o< x) → P (prev y y<x) (ind x prev) )
|
|
227 -- → {x z : Ordinal {suc n} } → (z≤x : z o< osuc x ) → P (TransFinite3 {n} {m} { λ x → Q x } {!!} x ) {!!} -- P (TransFinite {?} ind z) (TransFinite {?} ind x )
|
|
228 -- TP = ?
|
612
|
229
|
653
|
230
|
431
|
231 open import Ordinals
|
|
232
|
|
233 C-Ordinal : {n : Level} → Ordinals {suc n}
|
|
234 C-Ordinal {n} = record {
|
|
235 Ordinal = Ordinal {suc n}
|
|
236 ; o∅ = o∅
|
|
237 ; osuc = osuc
|
|
238 ; _o<_ = _o<_
|
|
239 ; next = next
|
|
240 ; isOrdinal = record {
|
|
241 ordtrans = ordtrans
|
|
242 ; trio< = trio<
|
|
243 ; ¬x<0 = ¬x<0
|
|
244 ; <-osuc = <-osuc
|
|
245 ; osuc-≡< = osuc-≡<
|
|
246 ; TransFinite = TransFinite2
|
612
|
247 ; o<-irr = OrdIrr
|
431
|
248 ; Oprev-p = Oprev-p
|
|
249 } ;
|
|
250 isNext = record {
|
|
251 x<nx = x<nx
|
|
252 ; osuc<nx = λ {x} {y} → osuc<nx {x} {y}
|
|
253 ; ¬nx<nx = ¬nx<nx
|
|
254 }
|
|
255 } where
|
|
256 next : Ordinal {suc n} → Ordinal {suc n}
|
|
257 next (ordinal lv ord) = ordinal (Suc lv) (Φ (Suc lv))
|
|
258 x<nx : { y : Ordinal } → (y o< next y )
|
|
259 x<nx = case1 a<sa
|
|
260 osuc<nx : { x y : Ordinal } → x o< next y → osuc x o< next y
|
|
261 osuc<nx (case1 lt) = case1 lt
|
|
262 ¬nx<nx : {x y : Ordinal} → y o< x → x o< next y → ¬ ((z : Ordinal) → ¬ (x ≡ osuc z))
|
|
263 ¬nx<nx {x} {y} = lemma2 x where
|
|
264 lemma2 : (x : Ordinal) → y o< x → x o< next y → ¬ ((z : Ordinal) → ¬ x ≡ osuc z)
|
|
265 lemma2 (ordinal Zero (Φ 0)) (case2 ()) (case1 (s≤s z≤n)) not
|
|
266 lemma2 (ordinal Zero (OSuc 0 dx)) (case2 Φ<) (case1 (s≤s z≤n)) not = not _ refl
|
|
267 lemma2 (ordinal Zero (OSuc 0 dx)) (case2 (s< x)) (case1 (s≤s z≤n)) not = not _ refl
|
|
268 lemma2 (ordinal (Suc lx) (OSuc (Suc lx) ox)) y<x (case1 (s≤s (s≤s lt))) not = not _ refl
|
|
269 lemma2 (ordinal (Suc lx) (Φ (Suc lx))) (case1 x) (case1 (s≤s (s≤s lt))) not = lemma3 x lt where
|
653
|
270 lemma3 : {n l : ℕ} → (Suc (Suc n) ≤ Suc l) → l ≤ n → ⊥
|
431
|
271 lemma3 (s≤s sn≤l) (s≤s l≤n) = lemma3 sn≤l l≤n
|
|
272 open Oprev
|
|
273 Oprev-p : (x : Ordinal) → Dec ( Oprev (Ordinal {suc n}) osuc x )
|
|
274 Oprev-p (ordinal lv (Φ lv)) = no (λ not → lemma (oprev not) (oprev=x not) ) where
|
|
275 lemma : (x : Ordinal) → osuc x ≡ (ordinal lv (Φ lv)) → ⊥
|
|
276 lemma x ()
|
|
277 Oprev-p (ordinal lv (OSuc lv ox)) = yes record { oprev = ordinal lv ox ; oprev=x = refl }
|
|
278 ord1 : Set (suc n)
|
|
279 ord1 = Ordinal {suc n}
|
|
280 TransFinite2 : { ψ : ord1 → Set (suc (suc n)) }
|
|
281 → ( (x : ord1) → ( (y : ord1 ) → y o< x → ψ y ) → ψ x )
|
|
282 → ∀ (x : ord1) → ψ x
|
653
|
283 TransFinite2 {ψ} ind x = TransFinite {n} {suc (suc n)} {ψ} caseΦ caseOSuc x where
|
|
284 caseΦ : (lx : ℕ) → ((x₁ : Ordinal) → x₁ o< ordinal lx (Φ lx) → ψ x₁) →
|
431
|
285 ψ (record { lv = lx ; ord = Φ lx })
|
653
|
286 caseΦ lx prev = ind (ordinal lx (Φ lx) ) prev
|
|
287 caseOSuc : (lx : ℕ) (x₁ : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x₁) → ψ y) →
|
431
|
288 ψ (record { lv = lx ; ord = OSuc lx x₁ })
|
653
|
289 caseOSuc lx ox prev = ind (ordinal lx (OSuc lx ox)) prev
|
431
|
290
|
|
291
|
450
|
292 -- H-Ordinal : {n : Level} → Ordinals {suc n} → Ordinals {suc n} → Ordinals {suc n}
|
|
293 -- H-Ordinal {n} O1 O2 = record {
|
|
294 -- Ordinal = Ordinals.Ordinal O1 ∧ Ordinals.Ordinal O2
|
|
295 -- }
|
|
296 -- We may have an oridinal as proper subset of an ordinal
|
|
297 -- then the internal ordinal become a set in the outer ordinal
|