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