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