Mercurial > hg > Members > kono > Proof > ZF-in-agda
annotate Ordinals.agda @ 333:214a087c78a5
Added tag release for changeset fcc65e37e72b
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 05 Jul 2020 16:56:40 +0900 |
parents | 0faa7120e4b5 |
children | bca043423554 |
rev | line source |
---|---|
16 | 1 open import Level |
220
95a26d1698f4
try to separate Ordinals
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
2 module Ordinals where |
3 | 3 |
14
e11e95d5ddee
separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
11
diff
changeset
|
4 open import zf |
3 | 5 |
23 | 6 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) |
75 | 7 open import Data.Empty |
14
e11e95d5ddee
separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
11
diff
changeset
|
8 open import Relation.Binary.PropositionalEquality |
213
22d435172d1a
separate logic and nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
204
diff
changeset
|
9 open import logic |
22d435172d1a
separate logic and nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
204
diff
changeset
|
10 open import nat |
220
95a26d1698f4
try to separate Ordinals
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
11 open import Data.Unit using ( ⊤ ) |
95a26d1698f4
try to separate Ordinals
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
12 open import Relation.Nullary |
95a26d1698f4
try to separate Ordinals
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
13 open import Relation.Binary |
95a26d1698f4
try to separate Ordinals
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
14 open import Relation.Binary.Core |
3 | 15 |
320 | 16 record IsOrdinals {n : Level} (ord : Set n) (o∅ : ord ) (osuc : ord → ord ) (_o<_ : ord → ord → Set n) (next : ord → ord ) : Set (suc (suc n)) where |
16 | 17 field |
221 | 18 Otrans : {x y z : ord } → x o< y → y o< z → x o< z |
19 OTri : Trichotomous {n} _≡_ _o<_ | |
20 ¬x<0 : { x : ord } → ¬ ( x o< o∅ ) | |
21 <-osuc : { x : ord } → x o< osuc x | |
22 osuc-≡< : { a x : ord } → x o< osuc a → (x ≡ a ) ∨ (x o< a) | |
329 | 23 not-limit : ( x : ord ) → Dec ( ¬ ((y : ord) → ¬ (x ≡ osuc y) )) |
321 | 24 next-limit : { y : ord } → (y o< next y ) ∧ ((x : ord) → x o< next y → osuc x o< next y ) |
324 | 25 TransFinite : { ψ : ord → Set n } |
222
59771eb07df0
TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
221
diff
changeset
|
26 → ( (x : ord) → ( (y : ord ) → y o< x → ψ y ) → ψ x ) |
59771eb07df0
TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
221
diff
changeset
|
27 → ∀ (x : ord) → ψ x |
330 | 28 TransFinite1 : { ψ : ord → Set (suc n) } |
29 → ( (x : ord) → ( (y : ord ) → y o< x → ψ y ) → ψ x ) | |
30 → ∀ (x : ord) → ψ x | |
16 | 31 |
222
59771eb07df0
TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
221
diff
changeset
|
32 |
59771eb07df0
TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
221
diff
changeset
|
33 record Ordinals {n : Level} : Set (suc (suc n)) where |
220
95a26d1698f4
try to separate Ordinals
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
34 field |
95a26d1698f4
try to separate Ordinals
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
35 ord : Set n |
221 | 36 o∅ : ord |
37 osuc : ord → ord | |
38 _o<_ : ord → ord → Set n | |
320 | 39 next : ord → ord |
40 isOrdinal : IsOrdinals ord o∅ osuc _o<_ next | |
17 | 41 |
221 | 42 module inOrdinal {n : Level} (O : Ordinals {n} ) where |
3 | 43 |
221 | 44 Ordinal : Set n |
45 Ordinal = Ordinals.ord O | |
46 | |
47 _o<_ : Ordinal → Ordinal → Set n | |
48 _o<_ = Ordinals._o<_ O | |
218 | 49 |
221 | 50 osuc : Ordinal → Ordinal |
51 osuc = Ordinals.osuc O | |
218 | 52 |
221 | 53 o∅ : Ordinal |
54 o∅ = Ordinals.o∅ O | |
43
0d9b9db14361
equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
55 |
320 | 56 next : Ordinal → Ordinal |
57 next = Ordinals.next O | |
58 | |
221 | 59 ¬x<0 = IsOrdinals.¬x<0 (Ordinals.isOrdinal O) |
60 osuc-≡< = IsOrdinals.osuc-≡< (Ordinals.isOrdinal O) | |
61 <-osuc = IsOrdinals.<-osuc (Ordinals.isOrdinal O) | |
235 | 62 TransFinite = IsOrdinals.TransFinite (Ordinals.isOrdinal O) |
330 | 63 TransFinite1 = IsOrdinals.TransFinite1 (Ordinals.isOrdinal O) |
320 | 64 next-limit = IsOrdinals.next-limit (Ordinals.isOrdinal O) |
321 | 65 |
221 | 66 o<-dom : { x y : Ordinal } → x o< y → Ordinal |
67 o<-dom {x} _ = x | |
74
819da8c08f05
ordinal atomical successor?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
73
diff
changeset
|
68 |
221 | 69 o<-cod : { x y : Ordinal } → x o< y → Ordinal |
70 o<-cod {_} {y} _ = y | |
147 | 71 |
221 | 72 o<-subst : {Z X z x : Ordinal } → Z o< X → Z ≡ z → X ≡ x → z o< x |
73 o<-subst df refl refl = df | |
94 | 74 |
221 | 75 ordtrans : {x y z : Ordinal } → x o< y → y o< z → x o< z |
76 ordtrans = IsOrdinals.Otrans (Ordinals.isOrdinal O) | |
94 | 77 |
221 | 78 trio< : Trichotomous _≡_ _o<_ |
79 trio< = IsOrdinals.OTri (Ordinals.isOrdinal O) | |
9
5ed16e2d8eb7
try to fix axiom of replacement
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
8
diff
changeset
|
80 |
221 | 81 o<¬≡ : { ox oy : Ordinal } → ox ≡ oy → ox o< oy → ⊥ |
82 o<¬≡ {ox} {oy} eq lt with trio< ox oy | |
83 o<¬≡ {ox} {oy} eq lt | tri< a ¬b ¬c = ¬b eq | |
84 o<¬≡ {ox} {oy} eq lt | tri≈ ¬a b ¬c = ¬a lt | |
85 o<¬≡ {ox} {oy} eq lt | tri> ¬a ¬b c = ¬b eq | |
23 | 86 |
221 | 87 o<> : {x y : Ordinal } → y o< x → x o< y → ⊥ |
88 o<> {ox} {oy} lt tl with trio< ox oy | |
89 o<> {ox} {oy} lt tl | tri< a ¬b ¬c = ¬c lt | |
90 o<> {ox} {oy} lt tl | tri≈ ¬a b ¬c = ¬a tl | |
91 o<> {ox} {oy} lt tl | tri> ¬a ¬b c = ¬a tl | |
23 | 92 |
221 | 93 osuc-< : { x y : Ordinal } → y o< osuc x → x o< y → ⊥ |
94 osuc-< {x} {y} y<ox x<y with osuc-≡< y<ox | |
95 osuc-< {x} {y} y<ox x<y | case1 refl = o<¬≡ refl x<y | |
96 osuc-< {x} {y} y<ox x<y | case2 y<x = o<> x<y y<x | |
180 | 97 |
221 | 98 osucc : {ox oy : Ordinal } → oy o< ox → osuc oy o< osuc ox |
99 ---- y < osuc y < x < osuc x | |
100 ---- y < osuc y = x < osuc x | |
101 ---- y < osuc y > x < osuc x -> y = x ∨ x < y → ⊥ | |
102 osucc {ox} {oy} oy<ox with trio< (osuc oy) ox | |
103 osucc {ox} {oy} oy<ox | tri< a ¬b ¬c = ordtrans a <-osuc | |
104 osucc {ox} {oy} oy<ox | tri≈ ¬a refl ¬c = <-osuc | |
105 osucc {ox} {oy} oy<ox | tri> ¬a ¬b c with osuc-≡< c | |
106 osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case1 eq = ⊥-elim (o<¬≡ (sym eq) oy<ox) | |
107 osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case2 lt = ⊥-elim (o<> lt oy<ox) | |
108 | |
109 open _∧_ | |
84 | 110 |
221 | 111 osuc2 : ( x y : Ordinal ) → ( osuc x o< osuc (osuc y )) ⇔ (x o< osuc y) |
112 proj2 (osuc2 x y) lt = osucc lt | |
113 proj1 (osuc2 x y) ox<ooy with osuc-≡< ox<ooy | |
114 proj1 (osuc2 x y) ox<ooy | case1 ox=oy = o<-subst <-osuc refl ox=oy | |
115 proj1 (osuc2 x y) ox<ooy | case2 ox<oy = ordtrans <-osuc ox<oy | |
129 | 116 |
221 | 117 _o≤_ : Ordinal → Ordinal → Set n |
326 | 118 a o≤ b = a o< osuc b -- (a ≡ b) ∨ ( a o< b ) |
221 | 119 |
129 | 120 |
221 | 121 xo<ab : {oa ob : Ordinal } → ( {ox : Ordinal } → ox o< oa → ox o< ob ) → oa o< osuc ob |
122 xo<ab {oa} {ob} a→b with trio< oa ob | |
123 xo<ab {oa} {ob} a→b | tri< a ¬b ¬c = ordtrans a <-osuc | |
124 xo<ab {oa} {ob} a→b | tri≈ ¬a refl ¬c = <-osuc | |
125 xo<ab {oa} {ob} a→b | tri> ¬a ¬b c = ⊥-elim ( o<¬≡ refl (a→b c ) ) | |
88 | 126 |
221 | 127 maxα : Ordinal → Ordinal → Ordinal |
128 maxα x y with trio< x y | |
129 maxα x y | tri< a ¬b ¬c = y | |
130 maxα x y | tri> ¬a ¬b c = x | |
131 maxα x y | tri≈ ¬a refl ¬c = x | |
84 | 132 |
308 | 133 omin : Ordinal → Ordinal → Ordinal |
134 omin x y with trio< x y | |
135 omin x y | tri< a ¬b ¬c = x | |
136 omin x y | tri> ¬a ¬b c = y | |
137 omin x y | tri≈ ¬a refl ¬c = x | |
88 | 138 |
308 | 139 min1 : {x y z : Ordinal } → z o< x → z o< y → z o< omin x y |
221 | 140 min1 {x} {y} {z} z<x z<y with trio< x y |
141 min1 {x} {y} {z} z<x z<y | tri< a ¬b ¬c = z<x | |
142 min1 {x} {y} {z} z<x z<y | tri≈ ¬a refl ¬c = z<x | |
143 min1 {x} {y} {z} z<x z<y | tri> ¬a ¬b c = z<y | |
84 | 144 |
221 | 145 -- |
146 -- max ( osuc x , osuc y ) | |
147 -- | |
148 | |
149 omax : ( x y : Ordinal ) → Ordinal | |
150 omax x y with trio< x y | |
151 omax x y | tri< a ¬b ¬c = osuc y | |
152 omax x y | tri> ¬a ¬b c = osuc x | |
153 omax x y | tri≈ ¬a refl ¬c = osuc x | |
86 | 154 |
221 | 155 omax< : ( x y : Ordinal ) → x o< y → osuc y ≡ omax x y |
156 omax< x y lt with trio< x y | |
157 omax< x y lt | tri< a ¬b ¬c = refl | |
158 omax< x y lt | tri≈ ¬a b ¬c = ⊥-elim (¬a lt ) | |
159 omax< x y lt | tri> ¬a ¬b c = ⊥-elim (¬a lt ) | |
86 | 160 |
221 | 161 omax≡ : ( x y : Ordinal ) → x ≡ y → osuc y ≡ omax x y |
162 omax≡ x y eq with trio< x y | |
163 omax≡ x y eq | tri< a ¬b ¬c = ⊥-elim (¬b eq ) | |
164 omax≡ x y eq | tri≈ ¬a refl ¬c = refl | |
165 omax≡ x y eq | tri> ¬a ¬b c = ⊥-elim (¬b eq ) | |
91 | 166 |
221 | 167 omax-x : ( x y : Ordinal ) → x o< omax x y |
168 omax-x x y with trio< x y | |
169 omax-x x y | tri< a ¬b ¬c = ordtrans a <-osuc | |
170 omax-x x y | tri> ¬a ¬b c = <-osuc | |
171 omax-x x y | tri≈ ¬a refl ¬c = <-osuc | |
16 | 172 |
221 | 173 omax-y : ( x y : Ordinal ) → y o< omax x y |
174 omax-y x y with trio< x y | |
175 omax-y x y | tri< a ¬b ¬c = <-osuc | |
176 omax-y x y | tri> ¬a ¬b c = ordtrans c <-osuc | |
177 omax-y x y | tri≈ ¬a refl ¬c = <-osuc | |
178 | |
179 omxx : ( x : Ordinal ) → omax x x ≡ osuc x | |
180 omxx x with trio< x x | |
181 omxx x | tri< a ¬b ¬c = ⊥-elim (¬b refl ) | |
182 omxx x | tri> ¬a ¬b c = ⊥-elim (¬b refl ) | |
183 omxx x | tri≈ ¬a refl ¬c = refl | |
184 | |
185 omxxx : ( x : Ordinal ) → omax x (omax x x ) ≡ osuc (osuc x) | |
186 omxxx x = trans ( cong ( λ k → omax x k ) (omxx x )) (sym ( omax< x (osuc x) <-osuc )) | |
187 | |
188 open _∧_ | |
16 | 189 |
326 | 190 o≤-refl : { i j : Ordinal } → i ≡ j → i o≤ j |
191 o≤-refl {i} {j} eq = subst (λ k → i o< osuc k ) eq <-osuc | |
221 | 192 OrdTrans : Transitive _o≤_ |
326 | 193 OrdTrans a≤b b≤c with osuc-≡< a≤b | osuc-≡< b≤c |
194 OrdTrans a≤b b≤c | case1 refl | case1 refl = <-osuc | |
195 OrdTrans a≤b b≤c | case1 refl | case2 a≤c = ordtrans a≤c <-osuc | |
196 OrdTrans a≤b b≤c | case2 a≤c | case1 refl = ordtrans a≤c <-osuc | |
197 OrdTrans a≤b b≤c | case2 a<b | case2 b<c = ordtrans (ordtrans a<b b<c) <-osuc | |
97
f2b579106770
power set using sup on Def
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
198 |
221 | 199 OrdPreorder : Preorder n n n |
200 OrdPreorder = record { Carrier = Ordinal | |
201 ; _≈_ = _≡_ | |
202 ; _∼_ = _o≤_ | |
203 ; isPreorder = record { | |
204 isEquivalence = record { refl = refl ; sym = sym ; trans = trans } | |
326 | 205 ; reflexive = o≤-refl |
221 | 206 ; trans = OrdTrans |
207 } | |
208 } | |
165 | 209 |
258 | 210 FExists : {m l : Level} → ( ψ : Ordinal → Set m ) |
221 | 211 → {p : Set l} ( P : { y : Ordinal } → ψ y → ¬ p ) |
212 → (exists : ¬ (∀ y → ¬ ( ψ y ) )) | |
213 → ¬ p | |
258 | 214 FExists {m} {l} ψ {p} P = contra-position ( λ p y ψy → P {y} ψy p ) |
221 | 215 |
309 | 216 record OrdinalSubset (maxordinal : Ordinal) : Set (suc n) where |
217 field | |
218 os→ : (x : Ordinal) → x o< maxordinal → Ordinal | |
219 os← : Ordinal → Ordinal | |
220 os←limit : (x : Ordinal) → os← x o< maxordinal | |
221 os-iso← : {x : Ordinal} → os→ (os← x) (os←limit x) ≡ x | |
222 os-iso→ : {x : Ordinal} → (lt : x o< maxordinal ) → os← (os→ x lt) ≡ x | |
223 |