Mercurial > hg > Members > kono > Proof > ZF-in-agda
annotate src/OrdUtil.agda @ 923:85f6238a38db
use supf of zchain for (nmx : ¬ Maximal A ) → ⊥
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 19 Oct 2022 08:41:42 +0900 |
parents | 2d8ce664ae31 |
children | a8d6ac036d88 |
rev | line source |
---|---|
431 | 1 open import Level |
2 open import Ordinals | |
3 module OrdUtil {n : Level} (O : Ordinals {n} ) where | |
4 | |
5 open import logic | |
6 open import nat | |
815 | 7 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) |
431 | 8 open import Data.Empty |
9 open import Relation.Binary.PropositionalEquality | |
10 open import Relation.Nullary | |
11 open import Relation.Binary hiding (_⇔_) | |
12 | |
13 open Ordinals.Ordinals O | |
815 | 14 open Ordinals.IsOrdinals isOrdinal |
15 open Ordinals.IsNext isNext | |
431 | 16 |
815 | 17 o<-dom : { x y : Ordinal } → x o< y → Ordinal |
431 | 18 o<-dom {x} _ = x |
19 | |
815 | 20 o<-cod : { x y : Ordinal } → x o< y → Ordinal |
431 | 21 o<-cod {_} {y} _ = y |
22 | |
23 o<-subst : {Z X z x : Ordinal } → Z o< X → Z ≡ z → X ≡ x → z o< x | |
24 o<-subst df refl refl = df | |
25 | |
26 o<¬≡ : { ox oy : Ordinal } → ox ≡ oy → ox o< oy → ⊥ | |
27 o<¬≡ {ox} {oy} eq lt with trio< ox oy | |
28 o<¬≡ {ox} {oy} eq lt | tri< a ¬b ¬c = ¬b eq | |
29 o<¬≡ {ox} {oy} eq lt | tri≈ ¬a b ¬c = ¬a lt | |
30 o<¬≡ {ox} {oy} eq lt | tri> ¬a ¬b c = ¬b eq | |
31 | |
32 o<> : {x y : Ordinal } → y o< x → x o< y → ⊥ | |
33 o<> {ox} {oy} lt tl with trio< ox oy | |
34 o<> {ox} {oy} lt tl | tri< a ¬b ¬c = ¬c lt | |
35 o<> {ox} {oy} lt tl | tri≈ ¬a b ¬c = ¬a tl | |
36 o<> {ox} {oy} lt tl | tri> ¬a ¬b c = ¬a tl | |
37 | |
830 | 38 o≤> : { x y : Ordinal } → y o< osuc x → x o< y → ⊥ |
39 o≤> {x} {y} y<ox x<y with osuc-≡< y<ox | |
40 o≤> {x} {y} y<ox x<y | case1 refl = o<¬≡ refl x<y | |
41 o≤> {x} {y} y<ox x<y | case2 y<x = o<> x<y y<x | |
431 | 42 |
815 | 43 |
712 | 44 open _∧_ |
45 | |
46 ¬p<x<op : { p b : Ordinal } → ¬ ( (p o< b ) ∧ (b o< osuc p ) ) | |
47 ¬p<x<op {p} {b} P with osuc-≡< (proj2 P) | |
815 | 48 ... | case1 eq = o<¬≡ (sym eq) (proj1 P) |
49 ... | case2 lt = o<> lt (proj1 P) | |
712 | 50 |
715 | 51 b<x→0<x : { p b : Ordinal } → p o< b → o∅ o< b |
52 b<x→0<x {p} {b} p<b with trio< o∅ b | |
53 ... | tri< a ¬b ¬c = a | |
54 ... | tri≈ ¬a 0=b ¬c = ⊥-elim ( ¬x<0 ( subst (λ k → p o< k) (sym 0=b) p<b ) ) | |
55 ... | tri> ¬a ¬b c = ⊥-elim ( ¬x<0 c ) | |
56 | |
815 | 57 ob<x : {b x : Ordinal} (lim : ¬ (Oprev Ordinal osuc x ) ) (b<x : b o< x ) → osuc b o< x |
58 ob<x {b} {x} lim b<x with trio< (osuc b) x | |
59 ... | tri< a ¬b ¬c = a | |
60 ... | tri≈ ¬a ob=x ¬c = ⊥-elim ( lim record { oprev = b ; oprev=x = ob=x } ) | |
61 ... | tri> ¬a ¬b c = ⊥-elim ( ¬p<x<op ⟪ b<x , c ⟫ ) | |
62 | |
744 | 63 |
815 | 64 pxo<x : {x : Ordinal} (op : Oprev Ordinal osuc x) → Oprev.oprev op o< x |
65 pxo<x {x} op with trio< (Oprev.oprev op) x | |
66 ... | tri< a ¬b ¬c = a | |
67 ... | tri≈ ¬a b ¬c = ⊥-elim ( o<¬≡ (trans b (sym (Oprev.oprev=x op))) <-osuc ) | |
68 ... | tri> ¬a ¬b c = ⊥-elim ( o<> c (subst₂ (λ j k → j o< k ) refl (Oprev.oprev=x op) <-osuc ) ) | |
69 | |
70 pxo≤x : {x : Ordinal} (op : Oprev Ordinal osuc x) → Oprev.oprev op o< osuc x | |
71 pxo≤x {x} op = ordtrans (pxo<x {x} op ) <-osuc | |
72 | |
850 | 73 |
815 | 74 osucc : {ox oy : Ordinal } → oy o< ox → osuc oy o< osuc ox |
431 | 75 osucc {ox} {oy} oy<ox with trio< (osuc oy) ox |
76 osucc {ox} {oy} oy<ox | tri< a ¬b ¬c = ordtrans a <-osuc | |
77 osucc {ox} {oy} oy<ox | tri≈ ¬a refl ¬c = <-osuc | |
78 osucc {ox} {oy} oy<ox | tri> ¬a ¬b c with osuc-≡< c | |
79 osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case1 eq = ⊥-elim (o<¬≡ (sym eq) oy<ox) | |
80 osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case2 lt = ⊥-elim (o<> lt oy<ox) | |
81 | |
815 | 82 osucprev : {ox oy : Ordinal } → osuc oy o< osuc ox → oy o< ox |
431 | 83 osucprev {ox} {oy} oy<ox with trio< oy ox |
84 osucprev {ox} {oy} oy<ox | tri< a ¬b ¬c = a | |
85 osucprev {ox} {oy} oy<ox | tri≈ ¬a b ¬c = ⊥-elim (o<¬≡ (cong (λ k → osuc k) b) oy<ox ) | |
86 osucprev {ox} {oy} oy<ox | tri> ¬a ¬b c = ⊥-elim (o<> (osucc c) oy<ox ) | |
87 | |
653 | 88 ordtrans≤-< : {ox oy oz : Ordinal } → ox o< osuc oy → oy o< oz → ox o< oz |
89 ordtrans≤-< {ox} {oy} {oz} x≤y y<z with osuc-≡< x≤y | |
90 ... | case1 x=y = subst ( λ k → k o< oz ) (sym x=y) y<z | |
91 ... | case2 x<y = ordtrans x<y y<z | |
92 | |
732
ddeb107b6f71
bchain can be reached from upwords by f. so it is worng.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
715
diff
changeset
|
93 ordtrans<-≤ : {ox oy oz : Ordinal } → ox o< oy → oy o< osuc oz → ox o< oz |
ddeb107b6f71
bchain can be reached from upwords by f. so it is worng.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
715
diff
changeset
|
94 ordtrans<-≤ {ox} {oy} {oz} x<y y≤z with osuc-≡< y≤z |
ddeb107b6f71
bchain can be reached from upwords by f. so it is worng.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
715
diff
changeset
|
95 ... | case1 x=y = subst ( λ k → ox o< k ) (x=y) x<y |
ddeb107b6f71
bchain can be reached from upwords by f. so it is worng.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
715
diff
changeset
|
96 ... | case2 y<z = ordtrans x<y y<z |
ddeb107b6f71
bchain can be reached from upwords by f. so it is worng.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
715
diff
changeset
|
97 |
789 | 98 o∅≤z : {z : Ordinal } → o∅ o< (osuc z) |
99 o∅≤z {z} = b<x→0<x ( <-osuc ) | |
431 | 100 |
101 osuc2 : ( x y : Ordinal ) → ( osuc x o< osuc (osuc y )) ⇔ (x o< osuc y) | |
102 proj2 (osuc2 x y) lt = osucc lt | |
103 proj1 (osuc2 x y) ox<ooy with osuc-≡< ox<ooy | |
104 proj1 (osuc2 x y) ox<ooy | case1 ox=oy = o<-subst <-osuc refl ox=oy | |
815 | 105 proj1 (osuc2 x y) ox<ooy | case2 ox<oy = ordtrans <-osuc ox<oy |
431 | 106 |
538 | 107 o≡? : (x y : Ordinal) → Dec ( x ≡ y ) |
108 o≡? x y with trio< x y | |
109 ... | tri< a ¬b ¬c = no ¬b | |
110 ... | tri≈ ¬a b ¬c = yes b | |
111 ... | tri> ¬a ¬b c = no ¬b | |
112 | |
431 | 113 _o≤_ : Ordinal → Ordinal → Set n |
114 a o≤ b = a o< osuc b -- (a ≡ b) ∨ ( a o< b ) | |
115 | |
653 | 116 o<→≤ : {a b : Ordinal} → a o< b → a o≤ b |
117 o<→≤ {a} {b} lt with trio< a (osuc b) | |
118 ... | tri< a₁ ¬b ¬c = a₁ | |
119 ... | tri≈ ¬a b₁ ¬c = ⊥-elim (¬a (ordtrans lt <-osuc ) ) | |
120 ... | tri> ¬a ¬b c = ⊥-elim (¬a (ordtrans lt <-osuc ) ) | |
121 | |
611 | 122 -- o<-irr : { x y : Ordinal } → { lt lt1 : x o< y } → lt ≡ lt1 |
431 | 123 |
124 xo<ab : {oa ob : Ordinal } → ( {ox : Ordinal } → ox o< oa → ox o< ob ) → oa o< osuc ob | |
125 xo<ab {oa} {ob} a→b with trio< oa ob | |
126 xo<ab {oa} {ob} a→b | tri< a ¬b ¬c = ordtrans a <-osuc | |
127 xo<ab {oa} {ob} a→b | tri≈ ¬a refl ¬c = <-osuc | |
128 xo<ab {oa} {ob} a→b | tri> ¬a ¬b c = ⊥-elim ( o<¬≡ refl (a→b c ) ) | |
129 | |
130 maxα : Ordinal → Ordinal → Ordinal | |
131 maxα x y with trio< x y | |
132 maxα x y | tri< a ¬b ¬c = y | |
133 maxα x y | tri> ¬a ¬b c = x | |
134 maxα x y | tri≈ ¬a refl ¬c = x | |
135 | |
136 omin : Ordinal → Ordinal → Ordinal | |
137 omin x y with trio< x y | |
138 omin x y | tri< a ¬b ¬c = x | |
139 omin x y | tri> ¬a ¬b c = y | |
140 omin x y | tri≈ ¬a refl ¬c = x | |
141 | |
142 min1 : {x y z : Ordinal } → z o< x → z o< y → z o< omin x y | |
143 min1 {x} {y} {z} z<x z<y with trio< x y | |
144 min1 {x} {y} {z} z<x z<y | tri< a ¬b ¬c = z<x | |
145 min1 {x} {y} {z} z<x z<y | tri≈ ¬a refl ¬c = z<x | |
146 min1 {x} {y} {z} z<x z<y | tri> ¬a ¬b c = z<y | |
147 | |
148 -- | |
149 -- max ( osuc x , osuc y ) | |
150 -- | |
151 | |
815 | 152 omax : ( x y : Ordinal ) → Ordinal |
431 | 153 omax x y with trio< x y |
154 omax x y | tri< a ¬b ¬c = osuc y | |
155 omax x y | tri> ¬a ¬b c = osuc x | |
156 omax x y | tri≈ ¬a refl ¬c = osuc x | |
157 | |
158 omax< : ( x y : Ordinal ) → x o< y → osuc y ≡ omax x y | |
159 omax< x y lt with trio< x y | |
160 omax< x y lt | tri< a ¬b ¬c = refl | |
161 omax< x y lt | tri≈ ¬a b ¬c = ⊥-elim (¬a lt ) | |
162 omax< x y lt | tri> ¬a ¬b c = ⊥-elim (¬a lt ) | |
163 | |
164 omax≤ : ( x y : Ordinal ) → x o≤ y → osuc y ≡ omax x y | |
165 omax≤ x y le with trio< x y | |
166 omax≤ x y le | tri< a ¬b ¬c = refl | |
167 omax≤ x y le | tri≈ ¬a refl ¬c = refl | |
168 omax≤ x y le | tri> ¬a ¬b c with osuc-≡< le | |
169 omax≤ x y le | tri> ¬a ¬b c | case1 eq = ⊥-elim (¬b eq) | |
170 omax≤ x y le | tri> ¬a ¬b c | case2 x<y = ⊥-elim (¬a x<y) | |
171 | |
172 omax≡ : ( x y : Ordinal ) → x ≡ y → osuc y ≡ omax x y | |
173 omax≡ x y eq with trio< x y | |
174 omax≡ x y eq | tri< a ¬b ¬c = ⊥-elim (¬b eq ) | |
175 omax≡ x y eq | tri≈ ¬a refl ¬c = refl | |
176 omax≡ x y eq | tri> ¬a ¬b c = ⊥-elim (¬b eq ) | |
177 | |
178 omax-x : ( x y : Ordinal ) → x o< omax x y | |
179 omax-x x y with trio< x y | |
180 omax-x x y | tri< a ¬b ¬c = ordtrans a <-osuc | |
181 omax-x x y | tri> ¬a ¬b c = <-osuc | |
182 omax-x x y | tri≈ ¬a refl ¬c = <-osuc | |
183 | |
184 omax-y : ( x y : Ordinal ) → y o< omax x y | |
185 omax-y x y with trio< x y | |
186 omax-y x y | tri< a ¬b ¬c = <-osuc | |
187 omax-y x y | tri> ¬a ¬b c = ordtrans c <-osuc | |
188 omax-y x y | tri≈ ¬a refl ¬c = <-osuc | |
189 | |
190 omxx : ( x : Ordinal ) → omax x x ≡ osuc x | |
191 omxx x with trio< x x | |
192 omxx x | tri< a ¬b ¬c = ⊥-elim (¬b refl ) | |
193 omxx x | tri> ¬a ¬b c = ⊥-elim (¬b refl ) | |
194 omxx x | tri≈ ¬a refl ¬c = refl | |
195 | |
196 omxxx : ( x : Ordinal ) → omax x (omax x x ) ≡ osuc (osuc x) | |
197 omxxx x = trans ( cong ( λ k → omax x k ) (omxx x )) (sym ( omax< x (osuc x) <-osuc )) | |
198 | |
199 open _∧_ | |
200 | |
625 | 201 o≤-refl0 : { i j : Ordinal } → i ≡ j → i o≤ j |
202 o≤-refl0 {i} {j} eq = subst (λ k → i o< osuc k ) eq <-osuc | |
203 | |
204 o≤-refl : { i : Ordinal } → i o≤ i | |
205 o≤-refl {i} = subst (λ k → i o< osuc k ) refl <-osuc | |
206 | |
674 | 207 o≤? : (x y : Ordinal) → Dec ( x o≤ y ) |
208 o≤? x y with trio< x y | |
209 ... | tri< a ¬b ¬c = yes (ordtrans a <-osuc) | |
210 ... | tri≈ ¬a b ¬c = yes (o≤-refl0 b) | |
830 | 211 ... | tri> ¬a ¬b c = no (λ n → o≤> n c ) |
674 | 212 |
683 | 213 o¬≤→< : {x z : Ordinal} → ¬ (x o< osuc z) → z o< x |
214 o¬≤→< {x} {z} not with trio< z x | |
215 ... | tri< a ¬b ¬c = a | |
216 ... | tri≈ ¬a b ¬c = ⊥-elim (not (o≤-refl0 (sym b))) | |
217 ... | tri> ¬a ¬b c = ⊥-elim (not (o<→≤ c )) | |
218 | |
850 | 219 b≤px∨b=x : {b x : Ordinal } → (op : Oprev Ordinal osuc x ) → b o≤ x → (b o≤ (Oprev.oprev op) ) ∨ (b ≡ x ) |
220 b≤px∨b=x {b} {x} op b≤x with trio< b (Oprev.oprev op) | |
221 ... | tri< a ¬b ¬c = case1 (o<→≤ a) | |
222 ... | tri≈ ¬a b ¬c = case1 (o≤-refl0 b) | |
223 ... | tri> ¬a ¬b px<b with osuc-≡< b≤x | |
224 ... | case1 eq = case2 eq | |
225 ... | case2 b<x = ⊥-elim ( ¬p<x<op ⟪ px<b , subst (λ k → b o< k ) (sym (Oprev.oprev=x op)) b<x ⟫ ) | |
226 | |
431 | 227 OrdTrans : Transitive _o≤_ |
228 OrdTrans a≤b b≤c with osuc-≡< a≤b | osuc-≡< b≤c | |
229 OrdTrans a≤b b≤c | case1 refl | case1 refl = <-osuc | |
230 OrdTrans a≤b b≤c | case1 refl | case2 a≤c = ordtrans a≤c <-osuc | |
231 OrdTrans a≤b b≤c | case2 a≤c | case1 refl = ordtrans a≤c <-osuc | |
232 OrdTrans a≤b b≤c | case2 a<b | case2 b<c = ordtrans (ordtrans a<b b<c) <-osuc | |
233 | |
234 OrdPreorder : Preorder n n n | |
235 OrdPreorder = record { Carrier = Ordinal | |
815 | 236 ; _≈_ = _≡_ |
431 | 237 ; _∼_ = _o≤_ |
238 ; isPreorder = record { | |
239 isEquivalence = record { refl = refl ; sym = sym ; trans = trans } | |
625 | 240 ; reflexive = o≤-refl0 |
815 | 241 ; trans = OrdTrans |
431 | 242 } |
243 } | |
244 | |
815 | 245 FExists : {m l : Level} → ( ψ : Ordinal → Set m ) |
431 | 246 → {p : Set l} ( P : { y : Ordinal } → ψ y → ¬ p ) |
247 → (exists : ¬ (∀ y → ¬ ( ψ y ) )) | |
248 → ¬ p | |
815 | 249 FExists {m} {l} ψ {p} P = contra-position ( λ p y ψy → P {y} ψy p ) |
431 | 250 |
251 nexto∅ : {x : Ordinal} → o∅ o< next x | |
252 nexto∅ {x} with trio< o∅ x | |
253 nexto∅ {x} | tri< a ¬b ¬c = ordtrans a x<nx | |
254 nexto∅ {x} | tri≈ ¬a b ¬c = subst (λ k → k o< next x) (sym b) x<nx | |
255 nexto∅ {x} | tri> ¬a ¬b c = ⊥-elim ( ¬x<0 c ) | |
256 | |
257 next< : {x y z : Ordinal} → x o< next z → y o< next x → y o< next z | |
258 next< {x} {y} {z} x<nz y<nx with trio< y (next z) | |
259 next< {x} {y} {z} x<nz y<nx | tri< a ¬b ¬c = a | |
260 next< {x} {y} {z} x<nz y<nx | tri≈ ¬a b ¬c = ⊥-elim (¬nx<nx x<nz (subst (λ k → k o< next x) b y<nx) | |
261 (λ w nz=ow → o<¬≡ nz=ow (subst₂ (λ j k → j o< k ) (sym nz=ow) nz=ow (osuc<nx (subst (λ k → w o< k ) (sym nz=ow) <-osuc) )))) | |
262 next< {x} {y} {z} x<nz y<nx | tri> ¬a ¬b c = ⊥-elim (¬nx<nx x<nz (ordtrans c y<nx ) | |
263 (λ w nz=ow → o<¬≡ (sym nz=ow) (osuc<nx (subst (λ k → w o< k ) (sym nz=ow) <-osuc )))) | |
264 | |
265 osuc< : {x y : Ordinal} → osuc x ≡ y → x o< y | |
815 | 266 osuc< {x} {y} refl = <-osuc |
431 | 267 |
815 | 268 nexto=n : {x y : Ordinal} → x o< next (osuc y) → x o< next y |
431 | 269 nexto=n {x} {y} x<noy = next< (osuc<nx x<nx) x<noy |
270 | |
815 | 271 nexto≡ : {x : Ordinal} → next x ≡ next (osuc x) |
272 nexto≡ {x} with trio< (next x) (next (osuc x) ) | |
431 | 273 -- next x o< next (osuc x ) -> osuc x o< next x o< next (osuc x) -> next x ≡ osuc z -> z o o< next x -> osuc z o< next x -> next x o< next x |
274 nexto≡ {x} | tri< a ¬b ¬c = ⊥-elim (¬nx<nx (osuc<nx x<nx ) a | |
275 (λ z eq → o<¬≡ (sym eq) (osuc<nx (osuc< (sym eq))))) | |
276 nexto≡ {x} | tri≈ ¬a b ¬c = b | |
277 -- next (osuc x) o< next x -> osuc x o< next (osuc x) o< next x -> next (osuc x) ≡ osuc z -> z o o< next (osuc x) ... | |
278 nexto≡ {x} | tri> ¬a ¬b c = ⊥-elim (¬nx<nx (ordtrans <-osuc x<nx) c | |
279 (λ z eq → o<¬≡ (sym eq) (osuc<nx (osuc< (sym eq))))) | |
280 | |
281 next-is-limit : {x y : Ordinal} → ¬ (next x ≡ osuc y) | |
282 next-is-limit {x} {y} eq = o<¬≡ (sym eq) (osuc<nx y<nx) where | |
283 y<nx : y o< next x | |
284 y<nx = osuc< (sym eq) | |
285 | |
286 omax<next : {x y : Ordinal} → x o< y → omax x y o< next y | |
287 omax<next {x} {y} x<y = subst (λ k → k o< next y ) (omax< _ _ x<y ) (osuc<nx x<nx) | |
288 | |
289 x<ny→≡next : {x y : Ordinal} → x o< y → y o< next x → next x ≡ next y | |
815 | 290 x<ny→≡next {x} {y} x<y y<nx with trio< (next x) (next y) |
431 | 291 x<ny→≡next {x} {y} x<y y<nx | tri< a ¬b ¬c = -- x < y < next x < next y ∧ next x = osuc z |
815 | 292 ⊥-elim ( ¬nx<nx y<nx a (λ z eq → o<¬≡ (sym eq) (osuc<nx (subst (λ k → z o< k ) (sym eq) <-osuc )))) |
431 | 293 x<ny→≡next {x} {y} x<y y<nx | tri≈ ¬a b ¬c = b |
294 x<ny→≡next {x} {y} x<y y<nx | tri> ¬a ¬b c = -- x < y < next y < next x | |
815 | 295 ⊥-elim ( ¬nx<nx (ordtrans x<y x<nx) c (λ z eq → o<¬≡ (sym eq) (osuc<nx (subst (λ k → z o< k ) (sym eq) <-osuc )))) |
431 | 296 |
297 ≤next : {x y : Ordinal} → x o≤ y → next x o≤ next y | |
298 ≤next {x} {y} x≤y with trio< (next x) y | |
299 ≤next {x} {y} x≤y | tri< a ¬b ¬c = ordtrans a (ordtrans x<nx <-osuc ) | |
300 ≤next {x} {y} x≤y | tri≈ ¬a refl ¬c = (ordtrans x<nx <-osuc ) | |
301 ≤next {x} {y} x≤y | tri> ¬a ¬b c with osuc-≡< x≤y | |
625 | 302 ≤next {x} {y} x≤y | tri> ¬a ¬b c | case1 refl = o≤-refl -- x = y < next x |
815 | 303 ≤next {x} {y} x≤y | tri> ¬a ¬b c | case2 x<y = o≤-refl0 (x<ny→≡next x<y c) -- x ≤ y < next x |
431 | 304 |
305 x<ny→≤next : {x y : Ordinal} → x o< next y → next x o≤ next y | |
306 x<ny→≤next {x} {y} x<ny with trio< x y | |
307 x<ny→≤next {x} {y} x<ny | tri< a ¬b ¬c = ≤next (ordtrans a <-osuc ) | |
815 | 308 x<ny→≤next {x} {y} x<ny | tri≈ ¬a refl ¬c = o≤-refl |
625 | 309 x<ny→≤next {x} {y} x<ny | tri> ¬a ¬b c = o≤-refl0 (sym ( x<ny→≡next c x<ny )) |
431 | 310 |
311 omax<nomax : {x y : Ordinal} → omax x y o< next (omax x y ) | |
312 omax<nomax {x} {y} with trio< x y | |
313 omax<nomax {x} {y} | tri< a ¬b ¬c = subst (λ k → osuc y o< k ) nexto≡ (osuc<nx x<nx ) | |
314 omax<nomax {x} {y} | tri≈ ¬a refl ¬c = subst (λ k → osuc x o< k ) nexto≡ (osuc<nx x<nx ) | |
315 omax<nomax {x} {y} | tri> ¬a ¬b c = subst (λ k → osuc x o< k ) nexto≡ (osuc<nx x<nx ) | |
316 | |
317 omax<nx : {x y z : Ordinal} → x o< next z → y o< next z → omax x y o< next z | |
318 omax<nx {x} {y} {z} x<nz y<nz with trio< x y | |
319 omax<nx {x} {y} {z} x<nz y<nz | tri< a ¬b ¬c = osuc<nx y<nz | |
320 omax<nx {x} {y} {z} x<nz y<nz | tri≈ ¬a refl ¬c = osuc<nx y<nz | |
321 omax<nx {x} {y} {z} x<nz y<nz | tri> ¬a ¬b c = osuc<nx x<nz | |
322 | |
323 nn<omax : {x nx ny : Ordinal} → x o< next nx → x o< next ny → x o< next (omax nx ny) | |
324 nn<omax {x} {nx} {ny} xnx xny with trio< nx ny | |
325 nn<omax {x} {nx} {ny} xnx xny | tri< a ¬b ¬c = subst (λ k → x o< k ) nexto≡ xny | |
326 nn<omax {x} {nx} {ny} xnx xny | tri≈ ¬a refl ¬c = subst (λ k → x o< k ) nexto≡ xny | |
327 nn<omax {x} {nx} {ny} xnx xny | tri> ¬a ¬b c = subst (λ k → x o< k ) nexto≡ xnx | |
328 | |
329 record OrdinalSubset (maxordinal : Ordinal) : Set (suc n) where | |
330 field | |
331 os→ : (x : Ordinal) → x o< maxordinal → Ordinal | |
332 os← : Ordinal → Ordinal | |
333 os←limit : (x : Ordinal) → os← x o< maxordinal | |
334 os-iso← : {x : Ordinal} → os→ (os← x) (os←limit x) ≡ x | |
335 os-iso→ : {x : Ordinal} → (lt : x o< maxordinal ) → os← (os→ x lt) ≡ x | |
336 | |
337 module o≤-Reasoning {n : Level} (O : Ordinals {n} ) where | |
338 | |
339 -- open inOrdinal O | |
340 | |
341 resp-o< : _o<_ Respects₂ _≡_ | |
342 resp-o< = resp₂ _o<_ | |
343 | |
344 trans1 : {i j k : Ordinal} → i o< j → j o< osuc k → i o< k | |
345 trans1 {i} {j} {k} i<j j<ok with osuc-≡< j<ok | |
346 trans1 {i} {j} {k} i<j j<ok | case1 refl = i<j | |
347 trans1 {i} {j} {k} i<j j<ok | case2 j<k = ordtrans i<j j<k | |
348 | |
349 trans2 : {i j k : Ordinal} → i o< osuc j → j o< k → i o< k | |
350 trans2 {i} {j} {k} i<oj j<k with osuc-≡< i<oj | |
351 trans2 {i} {j} {k} i<oj j<k | case1 refl = j<k | |
352 trans2 {i} {j} {k} i<oj j<k | case2 i<j = ordtrans i<j j<k | |
353 | |
815 | 354 open import Relation.Binary.Reasoning.Base.Triple |
355 (Preorder.isPreorder OrdPreorder) | |
431 | 356 ordtrans --<-trans |
357 (resp₂ _o<_) --(resp₂ _<_) | |
358 (λ x → ordtrans x <-osuc ) --<⇒≤ | |
359 trans1 --<-transˡ | |
360 trans2 --<-transʳ | |
361 public | |
362 -- hiding (_≈⟨_⟩_) | |
363 |