annotate ordinal.agda @ 224:afc864169325

recover ε-induction
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 10 Aug 2019 12:31:25 +0900
parents 59771eb07df0
children e06b76e5b682
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34
c9ad0d97ce41 fix oridinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
1 {-# OPTIONS --allow-unsolved-metas #-}
16
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
2 open import Level
29
fce60b99dc55 posturate OD is isomorphic to Ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
3 module ordinal where
3
e7990ff544bf reocrd ZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
14
e11e95d5ddee separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
5 open import zf
3
e7990ff544bf reocrd ZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
23
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 22
diff changeset
7 open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ )
75
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
8 open import Data.Empty
14
e11e95d5ddee separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
9 open import Relation.Binary.PropositionalEquality
213
22d435172d1a separate logic and nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 204
diff changeset
10 open import logic
22d435172d1a separate logic and nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 204
diff changeset
11 open import nat
3
e7990ff544bf reocrd ZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
13 data OrdinalD {n : Level} : (lv : Nat) → Set n where
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
14 Φ : (lv : Nat) → OrdinalD lv
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
15 OSuc : (lv : Nat) → OrdinalD {n} lv → OrdinalD lv
3
e7990ff544bf reocrd ZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
17 record Ordinal {n : Level} : Set n where
202
ed88384b5102 ε-induction like loop again
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
18 constructor ordinal
16
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
19 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
20 lv : Nat
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
21 ord : OrdinalD {n} lv
16
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
22
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
23 data _d<_ {n : Level} : {lx ly : Nat} → OrdinalD {n} lx → OrdinalD {n} ly → Set n where
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
24 Φ< : {lx : Nat} → {x : OrdinalD {n} lx} → Φ lx d< OSuc lx x
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
25 s< : {lx : Nat} → {x y : OrdinalD {n} lx} → x d< y → OSuc lx x d< OSuc lx y
17
6a668c6086a5 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
26
6a668c6086a5 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
27 open Ordinal
6a668c6086a5 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
28
27
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
29 _o<_ : {n : Level} ( x y : Ordinal ) → Set n
17
6a668c6086a5 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
30 _o<_ x y = (lv x < lv y ) ∨ ( ord x d< ord y )
3
e7990ff544bf reocrd ZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
75
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
32 s<refl : {n : Level } {lx : Nat } { x : OrdinalD {n} lx } → x d< OSuc lx x
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
33 s<refl {n} {lv} {Φ lv} = Φ<
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
34 s<refl {n} {lv} {OSuc lv x} = s< s<refl
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
35
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
36 trio<> : {n : Level} → {lx : Nat} {x : OrdinalD {n} lx } { y : OrdinalD lx } → y d< x → x d< y → ⊥
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
37 trio<> {n} {lx} {.(OSuc lx _)} {.(OSuc lx _)} (s< s) (s< t) = trio<> s t
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
38 trio<> {n} {lx} {.(OSuc lx _)} {.(Φ lx)} Φ< ()
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
39
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
40 d<→lv : {n : Level} {x y : Ordinal {n}} → ord x d< ord y → lv x ≡ lv y
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
41 d<→lv Φ< = refl
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
42 d<→lv (s< lt) = refl
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
43
43
0d9b9db14361 equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
44 o<-subst : {n : Level } {Z X z x : Ordinal {n}} → Z o< X → Z ≡ z → X ≡ x → z o< x
0d9b9db14361 equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
45 o<-subst df refl refl = df
0d9b9db14361 equalitu and internal parametorisity
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
46
14
e11e95d5ddee separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
47 open import Data.Nat.Properties
30
3b0fdb95618e problem on Ordinal ( OSuc ℵ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
48 open import Data.Unit using ( ⊤ )
6
d9b704508281 isEquiv and isZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
49 open import Relation.Nullary
d9b704508281 isEquiv and isZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
50
d9b704508281 isEquiv and isZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
51 open import Relation.Binary
d9b704508281 isEquiv and isZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
52 open import Relation.Binary.Core
d9b704508281 isEquiv and isZF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
53
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
54 o∅ : {n : Level} → Ordinal {n}
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
55 o∅ = record { lv = Zero ; ord = Φ Zero }
21
6d9fdd1dfa79 add transfinite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
56
39
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
57 open import Relation.Binary.HeterogeneousEquality using (_≅_;refl)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
58
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
59 ordinal-cong : {n : Level} {x y : Ordinal {n}} →
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
60 lv x ≡ lv y → ord x ≅ ord y → x ≡ y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
61 ordinal-cong refl refl = refl
21
6d9fdd1dfa79 add transfinite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
62
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
63 ≡→¬d< : {n : Level} → {lv : Nat} → {x : OrdinalD {n} lv } → x d< x → ⊥
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
64 ≡→¬d< {n} {lx} {OSuc lx y} (s< t) = ≡→¬d< t
14
e11e95d5ddee separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
65
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
66 trio<≡ : {n : Level} → {lx : Nat} {x : OrdinalD {n} lx } { y : OrdinalD lx } → x ≡ y → x d< y → ⊥
17
6a668c6086a5 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
67 trio<≡ refl = ≡→¬d<
14
e11e95d5ddee separete constructible set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
68
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
69 trio>≡ : {n : Level} → {lx : Nat} {x : OrdinalD {n} lx } { y : OrdinalD lx } → x ≡ y → y d< x → ⊥
17
6a668c6086a5 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
70 trio>≡ refl = ≡→¬d<
9
5ed16e2d8eb7 try to fix axiom of replacement
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
71
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
72 triOrdd : {n : Level} → {lx : Nat} → Trichotomous _≡_ ( _d<_ {n} {lx} {lx} )
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
73 triOrdd {_} {lv} (Φ lv) (Φ lv) = tri≈ ≡→¬d< refl ≡→¬d<
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
74 triOrdd {_} {lv} (Φ lv) (OSuc lv y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< )
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
75 triOrdd {_} {lv} (OSuc lv x) (Φ lv) = tri> (λ lt → trio<> lt Φ<) (λ ()) Φ<
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
76 triOrdd {_} {lv} (OSuc lv x) (OSuc lv y) with triOrdd x y
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
77 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) )
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
78 triOrdd {_} {lv} (OSuc lv x) (OSuc lv x) | tri≈ ¬a refl ¬c = tri≈ ≡→¬d< refl ≡→¬d<
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
79 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)
9
5ed16e2d8eb7 try to fix axiom of replacement
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
80
74
819da8c08f05 ordinal atomical successor?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 73
diff changeset
81 osuc : {n : Level} ( x : Ordinal {n} ) → Ordinal {n}
75
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
82 osuc record { lv = lx ; ord = ox } = record { lv = lx ; ord = OSuc lx ox }
74
819da8c08f05 ordinal atomical successor?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 73
diff changeset
83
819da8c08f05 ordinal atomical successor?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 73
diff changeset
84 <-osuc : {n : Level} { x : Ordinal {n} } → x o< osuc x
75
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
85 <-osuc {n} {record { lv = lx ; ord = Φ .lx }} = case2 Φ<
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
86 <-osuc {n} {record { lv = lx ; ord = OSuc .lx ox }} = case2 ( s< s<refl )
74
819da8c08f05 ordinal atomical successor?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 73
diff changeset
87
203
8edd2a13a7f3 fixing transfinte induction...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
88 o<¬≡ : {n : Level } { ox oy : Ordinal {suc n}} → ox ≡ oy → ox o< oy → ⊥
111
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 97
diff changeset
89 o<¬≡ {_} {ox} {ox} refl (case1 lt) = =→¬< lt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 97
diff changeset
90 o<¬≡ {_} {ox} {ox} refl (case2 (s< lt)) = trio<≡ refl lt
94
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
91
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
92 ¬x<0 : {n : Level} → { x : Ordinal {suc n} } → ¬ ( x o< o∅ {suc n} )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
93 ¬x<0 {n} {x} (case1 ())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
94 ¬x<0 {n} {x} (case2 ())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
95
81
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
96 o<> : {n : Level} → {x y : Ordinal {n} } → y o< x → x o< y → ⊥
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
97 o<> {n} {x} {y} (case1 x₁) (case1 x₂) = nat-<> x₁ x₂
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
98 o<> {n} {x} {y} (case1 x₁) (case2 x₂) = nat-≡< (sym (d<→lv x₂)) x₁
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
99 o<> {n} {x} {y} (case2 x₁) (case1 x₂) = nat-≡< (sym (d<→lv x₁)) x₂
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
100 o<> {n} {record { lv = lv₁ ; ord = .(OSuc lv₁ _) }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) (case2 ())
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
101 o<> {n} {record { lv = lv₁ ; ord = .(OSuc lv₁ _) }} {record { lv = .lv₁ ; ord = .(OSuc lv₁ _) }} (case2 (s< y<x)) (case2 (s< x<y)) =
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
102 o<> (case2 y<x) (case2 x<y)
16
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
103
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
104 orddtrans : {n : Level} {lx : Nat} {x y z : OrdinalD {n} lx } → x d< y → y d< z → x d< z
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
105 orddtrans {_} {lx} {.(Φ lx)} {.(OSuc lx _)} {.(OSuc lx _)} Φ< (s< y<z) = Φ<
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
106 orddtrans {_} {lx} {.(OSuc lx _)} {.(OSuc lx _)} {.(OSuc lx _)} (s< x<y) (s< y<z) = s< ( orddtrans x<y y<z )
9
5ed16e2d8eb7 try to fix axiom of replacement
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
107
75
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
108 osuc-≡< : {n : Level} { a x : Ordinal {n} } → x o< osuc a → (x ≡ a ) ∨ (x o< a)
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
109 osuc-≡< {n} {a} {x} (case1 lt) = case2 (case1 lt)
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
110 osuc-≡< {n} {record { lv = lv₁ ; ord = Φ .lv₁ }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) = case1 refl
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
111 osuc-≡< {n} {record { lv = lv₁ ; ord = OSuc .lv₁ ord₁ }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) = case2 (case2 Φ<)
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
112 osuc-≡< {n} {record { lv = lv₁ ; ord = Φ .lv₁ }} {record { lv = .lv₁ ; ord = .(OSuc lv₁ _) }} (case2 (s< ()))
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
113 osuc-≡< {n} {record { lv = la ; ord = OSuc la oa }} {record { lv = la ; ord = (OSuc la ox) }} (case2 (s< lt)) with
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
114 osuc-≡< {n} {record { lv = la ; ord = oa }} {record { lv = la ; ord = ox }} (case2 lt )
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
115 ... | case1 refl = case1 refl
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
116 ... | case2 (case2 x) = case2 (case2( s< x) )
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
117 ... | case2 (case1 x) = ⊥-elim (¬a≤a x) where
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
118
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
119 osuc-< : {n : Level} { x y : Ordinal {n} } → y o< osuc x → x o< y → ⊥
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
120 osuc-< {n} {x} {y} y<ox x<y with osuc-≡< y<ox
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
121 osuc-< {n} {x} {x} y<ox (case1 x₁) | case1 refl = ⊥-elim (¬a≤a x₁)
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
122 osuc-< {n} {x} {x} (case1 x₂) (case2 x₁) | case1 refl = ⊥-elim (¬a≤a x₂)
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
123 osuc-< {n} {x} {x} (case2 x₂) (case2 x₁) | case1 refl = ≡→¬d< x₁
81
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
124 osuc-< {n} {x} {y} y<ox (case1 x₂) | case2 (case1 x₁) = nat-<> x₂ x₁
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
125 osuc-< {n} {x} {y} y<ox (case1 x₂) | case2 (case2 x₁) = nat-≡< (sym (d<→lv x₁)) x₂
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
126 osuc-< {n} {x} {y} y<ox (case2 x<y) | case2 y<x = o<> (case2 x<y) y<x
75
714470702a8b Union done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
127
23
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 22
diff changeset
128
27
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
129 ordtrans : {n : Level} {x y z : Ordinal {n} } → x o< y → y o< z → x o< z
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
130 ordtrans {n} {x} {y} {z} (case1 x₁) (case1 x₂) = case1 ( <-trans x₁ x₂ )
81
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
131 ordtrans {n} {x} {y} {z} (case1 x₁) (case2 x₂) with d<→lv x₂
27
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
132 ... | refl = case1 x₁
81
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
133 ordtrans {n} {x} {y} {z} (case2 x₁) (case1 x₂) with d<→lv x₁
27
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
134 ... | refl = case1 x₂
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
135 ordtrans {n} {x} {y} {z} (case2 x₁) (case2 x₂) with d<→lv x₁ | d<→lv x₂
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
136 ... | refl | refl = case2 ( orddtrans x₁ x₂ )
bade0a35fdd9 OD, HOD, TC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
137
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
138 trio< : {n : Level } → Trichotomous {suc n} _≡_ _o<_
23
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 22
diff changeset
139 trio< a b with <-cmp (lv a) (lv b)
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
140 trio< a b | tri< a₁ ¬b ¬c = tri< (case1 a₁) (λ refl → ¬b (cong ( λ x → lv x ) refl ) ) lemma1 where
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
141 lemma1 : ¬ (Suc (lv b) ≤ lv a) ∨ (ord b d< ord a)
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
142 lemma1 (case1 x) = ¬c x
81
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
143 lemma1 (case2 x) = ⊥-elim (nat-≡< (sym ( d<→lv x )) a₁ )
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
144 trio< a b | tri> ¬a ¬b c = tri> lemma1 (λ refl → ¬b (cong ( λ x → lv x ) refl ) ) (case1 c) where
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
145 lemma1 : ¬ (Suc (lv a) ≤ lv b) ∨ (ord a d< ord b)
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
146 lemma1 (case1 x) = ¬a x
81
96c932d0145d simpler ordinal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 75
diff changeset
147 lemma1 (case2 x) = ⊥-elim (nat-≡< (sym ( d<→lv x )) c )
23
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 22
diff changeset
148 trio< a b | tri≈ ¬a refl ¬c with triOrdd ( ord a ) ( ord b )
24
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
149 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
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
150 lemma1 : (record { lv = _ ; ord = x }) ≡ b → x ≡ ord b
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
151 lemma1 refl = refl
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
152 lemma2 : ¬ (Suc (lv b) ≤ lv b) ∨ (ord b d< x)
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
153 lemma2 (case1 x) = ¬a x
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
154 lemma2 (case2 x) = trio<> x a
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
155 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
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
156 lemma1 : (record { lv = _ ; ord = x }) ≡ b → x ≡ ord b
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
157 lemma1 refl = refl
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
158 lemma2 : ¬ (Suc (lv b) ≤ lv b) ∨ (x d< ord b)
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
159 lemma2 (case1 x) = ¬a x
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
160 lemma2 (case2 x) = trio<> x c
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
161 trio< record { lv = .(lv b) ; ord = x } b | tri≈ ¬a refl ¬c | tri≈ ¬a₁ refl ¬c₁ = tri≈ lemma1 refl lemma1 where
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
162 lemma1 : ¬ (Suc (lv b) ≤ lv b) ∨ (ord b d< ord b)
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
163 lemma1 (case1 x) = ¬a x
3186bbee99dd separte level
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
164 lemma1 (case2 x) = ≡→¬d< x
23
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 22
diff changeset
165
86
08be6351927e internal error
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
166
91
b4742cf4ef97 infinity axiom done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
167 open _∧_
b4742cf4ef97 infinity axiom done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
168
203
8edd2a13a7f3 fixing transfinte induction...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
169 TransFinite : {n m : Level} → { ψ : Ordinal {suc n} → Set m }
8edd2a13a7f3 fixing transfinte induction...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
170 → ( ∀ (lx : Nat ) → ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x ) → ψ ( record { lv = lx ; ord = Φ lx } ) )
222
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
171 → ( ∀ (lx : Nat ) → (x : OrdinalD lx ) → ( (y : Ordinal {suc n} ) → y o< ordinal lx (OSuc lx x) → ψ y ) → ψ ( record { lv = lx ; ord = OSuc lx x } ) )
22
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
172 → ∀ (x : Ordinal) → ψ x
204
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
173 TransFinite {n} {m} {ψ} caseΦ caseOSuc x = proj1 (TransFinite1 (lv x) (ord x) ) where
222
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
174 TransFinite1 : (lx : Nat) (ox : OrdinalD lx ) → ψ (ordinal lx ox) ∧ ( ( (x : Ordinal {suc n} ) → x o< ordinal lx ox → ψ x ) )
204
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
175 TransFinite1 Zero (Φ 0) = record { proj1 = caseΦ Zero lemma ; proj2 = lemma1 } where
203
8edd2a13a7f3 fixing transfinte induction...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
176 lemma : (x : Ordinal) → x o< ordinal Zero (Φ Zero) → ψ x
8edd2a13a7f3 fixing transfinte induction...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
177 lemma x (case1 ())
8edd2a13a7f3 fixing transfinte induction...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
178 lemma x (case2 ())
204
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
179 lemma1 : (x : Ordinal) → x o< ordinal Zero (Φ Zero) → ψ x
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
180 lemma1 x (case1 ())
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
181 lemma1 x (case2 ())
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
182 TransFinite1 (Suc lx) (Φ (Suc lx)) = record { proj1 = caseΦ (Suc lx) (λ x → lemma (lv x) (ord x)) ; proj2 = (λ x → lemma (lv x) (ord x)) } where
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
183 lemma0 : (ly : Nat) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal lx (Φ lx) → ψ (ordinal ly oy)
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
184 lemma0 ly oy lt = proj2 ( TransFinite1 lx (Φ lx) ) (ordinal ly oy) lt
d4802eb159ff Transfinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
185 lemma : (ly : Nat) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal (Suc lx) (Φ (Suc lx)) → ψ (ordinal ly oy)
213
22d435172d1a separate logic and nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 204
diff changeset
186 lemma lx1 ox1 (case1 lt) with <-∨ lt
22d435172d1a separate logic and nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 204
diff changeset
187 lemma lx (Φ lx) (case1 lt) | case1 refl = proj1 ( TransFinite1 lx (Φ lx) )
222
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
188 lemma lx (Φ lx) (case1 lt) | case2 lt1 = lemma0 lx (Φ lx) (case1 lt1)
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
189 lemma lx (OSuc lx ox1) (case1 lt) | case1 refl = caseOSuc lx ox1 lemma2 where
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
190 lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx) ∨ (ord y d< OSuc lx ox1) → ψ y
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
191 lemma2 y lt1 with osuc-≡< lt1
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
192 lemma2 y lt1 | case1 refl = lemma lx ox1 (case1 a<sa)
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
193 lemma2 y lt1 | case2 t = proj2 (TransFinite1 lx ox1) y t
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
194 lemma lx1 (OSuc lx1 ox1) (case1 lt) | case2 lt1 = caseOSuc lx1 ox1 lemma2 where
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
195 lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx1) ∨ (ord y d< OSuc lx1 ox1) → ψ y
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
196 lemma2 y lt2 with osuc-≡< lt2
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
197 lemma2 y lt2 | case1 refl = lemma lx1 ox1 (ordtrans lt2 (case1 lt))
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
198 lemma2 y lt2 | case2 (case1 lt3) = proj2 (TransFinite1 lx (Φ lx)) y (case1 (<-trans lt3 lt1 ))
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
199 lemma2 y lt2 | case2 (case2 lt3) with d<→lv lt3
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
200 ... | refl = proj2 (TransFinite1 lx (Φ lx)) y (case1 lt1)
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
201 TransFinite1 lx (OSuc lx ox) = record { proj1 = caseOSuc lx ox lemma ; proj2 = lemma } where
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
202 lemma : (y : Ordinal) → y o< ordinal lx (OSuc lx ox) → ψ y
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
203 lemma y lt with osuc-≡< lt
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
204 lemma y lt | case1 refl = proj1 ( TransFinite1 lx ox )
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
205 lemma y lt | case2 lt1 = proj2 ( TransFinite1 lx ox ) y lt1
97
f2b579106770 power set using sup on Def
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
206
184
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
207 -- we cannot prove this in intutionistic logic
142
c30bc9f5bd0d Power Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 129
diff changeset
208 -- (¬ (∀ y → ¬ ( ψ y ))) → (ψ y → p ) → p
166
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
209 -- postulate
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
210 -- TransFiniteExists : {n m l : Level} → ( ψ : Ordinal {n} → Set m )
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
211 -- → (exists : ¬ (∀ y → ¬ ( ψ y ) ))
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
212 -- → {p : Set l} ( P : { y : Ordinal {n} } → ψ y → p )
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
213 -- → p
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
214 --
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
215 -- Instead we prove
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
216 --
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
217 TransFiniteExists : {n m l : Level} → ( ψ : Ordinal {n} → Set m )
165
d16b8bf29f4f minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 158
diff changeset
218 → {p : Set l} ( P : { y : Ordinal {n} } → ψ y → ¬ p )
d16b8bf29f4f minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 158
diff changeset
219 → (exists : ¬ (∀ y → ¬ ( ψ y ) ))
d16b8bf29f4f minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 158
diff changeset
220 → ¬ p
166
ea0e7927637a use double negation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 165
diff changeset
221 TransFiniteExists {n} {m} {l} ψ {p} P = contra-position ( λ p y ψy → P {y} ψy p )
165
d16b8bf29f4f minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 158
diff changeset
222
224
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
223 open import Ordinals
222
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
224
224
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
225 C-Ordinal : {n : Level} → Ordinals {suc n}
222
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
226 C-Ordinal {n} = record {
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
227 ord = Ordinal {suc n}
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
228 ; o∅ = o∅
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
229 ; osuc = osuc
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
230 ; _o<_ = _o<_
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
231 ; isOrdinal = record {
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
232 Otrans = ordtrans
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
233 ; OTri = trio<
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
234 ; ¬x<0 = ¬x<0
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
235 ; <-osuc = <-osuc
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
236 ; osuc-≡< = osuc-≡<
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
237 ; TransFinite = TransFinite1
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
238 }
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
239 } where
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
240 ord1 : Set (suc n)
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
241 ord1 = Ordinal {suc n}
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
242 TransFinite1 : { ψ : ord1 → Set (suc (suc n)) }
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
243 → ( (x : ord1) → ( (y : ord1 ) → y o< x → ψ y ) → ψ x )
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
244 → ∀ (x : ord1) → ψ x
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
245 TransFinite1 {ψ} lt x = TransFinite {n} {suc (suc n)} {ψ} caseΦ caseOSuc x where
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
246 caseΦ : (lx : Nat) → ((x₁ : Ordinal) → x₁ o< ordinal lx (Φ lx) → ψ x₁) →
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
247 ψ (record { lv = lx ; ord = Φ lx })
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
248 caseΦ lx prev = lt (ordinal lx (Φ lx) ) prev
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
249 caseOSuc : (lx : Nat) (x₁ : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x₁) → ψ y) →
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
250 ψ (record { lv = lx ; ord = OSuc lx x₁ })
59771eb07df0 TransFinite induction fixed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
251 caseOSuc lx ox prev = lt (ordinal lx (OSuc lx ox)) prev
224
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
252
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
253 module C-Ordinal-with-choice {n : Level} where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
254
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
255 import OD
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
256 -- open inOrdinal C-Ordinal
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
257 open OD (C-Ordinal {n})
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
258 open OD.OD
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
259
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
260 --
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
261 -- another form of regularity
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
262 --
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
263 ε-induction : {m : Level} { ψ : OD → Set m}
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
264 → ( {x : OD } → ({ y : OD } → x ∋ y → ψ y ) → ψ x )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
265 → (x : OD ) → ψ x
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
266 ε-induction {m} {ψ} ind x = subst (λ k → ψ k ) oiso (ε-induction-ord (lv (osuc (od→ord x))) (ord (osuc (od→ord x))) <-osuc) where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
267 ε-induction-ord : (lx : Nat) ( ox : OrdinalD {suc n} lx ) {ly : Nat} {oy : OrdinalD {suc n} ly }
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
268 → (ly < lx) ∨ (oy d< ox ) → ψ (ord→od (record { lv = ly ; ord = oy } ) )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
269 ε-induction-ord lx (OSuc lx ox) {ly} {oy} y<x =
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
270 ind {ord→od (record { lv = ly ; ord = oy })} ( λ {y} lt → subst (λ k → ψ k ) oiso (ε-induction-ord lx ox (lemma y lt ))) where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
271 lemma : (z : OD) → ord→od record { lv = ly ; ord = oy } ∋ z → od→ord z o< record { lv = lx ; ord = ox }
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
272 lemma z lt with osuc-≡< y<x
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
273 lemma z lt | case1 refl = o<-subst (c<→o< lt) refl diso
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
274 lemma z lt | case2 lt1 = ordtrans (o<-subst (c<→o< lt) refl diso) lt1
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
275 ε-induction-ord (Suc lx) (Φ (Suc lx)) {ly} {oy} (case1 y<sox ) =
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
276 ind {ord→od (record { lv = ly ; ord = oy })} ( λ {y} lt → lemma y lt ) where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
277 --
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
278 -- if lv of z if less than x Ok
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
279 -- else lv z = lv x. We can create OSuc of z which is larger than z and less than x in lemma
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
280 --
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
281 -- lx Suc lx (1) lz(a) <lx by case1
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
282 -- ly(1) ly(2) (2) lz(b) <lx by case1
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
283 -- lz(a) lz(b) lz(c) lz(c) <lx by case2 ( ly==lz==lx)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
284 --
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
285 lemma0 : { lx ly : Nat } → ly < Suc lx → lx < ly → ⊥
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
286 lemma0 {Suc lx} {Suc ly} (s≤s lt1) (s≤s lt2) = lemma0 lt1 lt2
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
287 lemma1 : {ly : Nat} {oy : OrdinalD {suc n} ly} → lv (od→ord (ord→od (record { lv = ly ; ord = oy }))) ≡ ly
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
288 lemma1 {ly} {oy} = let open ≡-Reasoning in begin
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
289 lv (od→ord (ord→od (record { lv = ly ; ord = oy })))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
290 ≡⟨ cong ( λ k → lv k ) diso ⟩
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
291 lv (record { lv = ly ; ord = oy })
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
292 ≡⟨⟩
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
293 ly
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
294
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
295 lemma : (z : OD) → ord→od record { lv = ly ; ord = oy } ∋ z → ψ z
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
296 lemma z lt with c<→o< {z} {ord→od (record { lv = ly ; ord = oy })} lt
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
297 lemma z lt | case1 lz<ly with <-cmp lx ly
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
298 lemma z lt | case1 lz<ly | tri< a ¬b ¬c = ⊥-elim ( lemma0 y<sox a) -- can't happen
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
299 lemma z lt | case1 lz<ly | tri≈ ¬a refl ¬c = -- ly(1)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
300 subst (λ k → ψ k ) oiso (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (subst (λ k → lv (od→ord z) < k ) lemma1 lz<ly ) ))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
301 lemma z lt | case1 lz<ly | tri> ¬a ¬b c = -- lz(a)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
302 subst (λ k → ψ k ) oiso (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (<-trans lz<ly (subst (λ k → k < lx ) (sym lemma1) c))))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
303 lemma z lt | case2 lz=ly with <-cmp lx ly
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
304 lemma z lt | case2 lz=ly | tri< a ¬b ¬c = ⊥-elim ( lemma0 y<sox a) -- can't happen
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
305 lemma z lt | case2 lz=ly | tri> ¬a ¬b c with d<→lv lz=ly -- lz(b)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
306 ... | eq = subst (λ k → ψ k ) oiso
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
307 (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (subst (λ k → k < lx ) (trans (sym lemma1)(sym eq) ) c )))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
308 lemma z lt | case2 lz=ly | tri≈ ¬a lx=ly ¬c with d<→lv lz=ly -- lz(c)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
309 ... | eq = subst (λ k → ψ k ) oiso ( ε-induction-ord lx (dz oz=lx) {lv (od→ord z)} {ord (od→ord z)} (case2 (dz<dz oz=lx) )) where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
310 oz=lx : lv (od→ord z) ≡ lx
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
311 oz=lx = let open ≡-Reasoning in begin
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
312 lv (od→ord z)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
313 ≡⟨ eq ⟩
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
314 lv (od→ord (ord→od (ordinal ly oy)))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
315 ≡⟨ cong ( λ k → lv k ) diso ⟩
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
316 lv (ordinal ly oy)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
317 ≡⟨ sym lx=ly ⟩
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
318 lx
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
319
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
320 dz : lv (od→ord z) ≡ lx → OrdinalD lx
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
321 dz refl = OSuc lx (ord (od→ord z))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
322 dz<dz : (z=x : lv (od→ord z) ≡ lx ) → ord (od→ord z) d< dz z=x
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
323 dz<dz refl = s<refl
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
324
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
325 ---
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
326 --- With assuption of OD is ordered, p ∨ ( ¬ p ) <=> axiom of choice
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
327 ---
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
328 record choiced ( X : OD) : Set (suc (suc n)) where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
329 field
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
330 a-choice : OD
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
331 is-in : X ∋ a-choice
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
332
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
333 choice-func' : (X : OD ) → (p∨¬p : { n : Level } → ( p : Set (suc n) ) → p ∨ ( ¬ p )) → ¬ ( X == od∅ ) → choiced X
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
334 choice-func' X p∨¬p not = have_to_find where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
335 ψ : ( ox : Ordinal {suc n}) → Set (suc (suc n))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
336 ψ ox = (( x : Ordinal {suc n}) → x o< ox → ( ¬ def X x )) ∨ choiced X
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
337 lemma-ord : ( ox : Ordinal {suc n} ) → ψ ox
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
338 lemma-ord ox = TransFinite {n} {suc (suc n)} {ψ} caseΦ caseOSuc1 ox where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
339 ∋-p' : (A x : OD ) → Dec ( A ∋ x )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
340 ∋-p' A x with p∨¬p ( A ∋ x )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
341 ∋-p' A x | case1 t = yes t
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
342 ∋-p' A x | case2 t = no t
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
343 ∀-imply-or : {n : Level} {A : Ordinal {suc n} → Set (suc n) } {B : Set (suc (suc n)) }
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
344 → ((x : Ordinal {suc n}) → A x ∨ B) → ((x : Ordinal {suc n}) → A x) ∨ B
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
345 ∀-imply-or {n} {A} {B} ∀AB with p∨¬p ((x : Ordinal {suc n}) → A x)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
346 ∀-imply-or {n} {A} {B} ∀AB | case1 t = case1 t
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
347 ∀-imply-or {n} {A} {B} ∀AB | case2 x = case2 (lemma x) where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
348 lemma : ¬ ((x : Ordinal {suc n}) → A x) → B
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
349 lemma not with p∨¬p B
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
350 lemma not | case1 b = b
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
351 lemma not | case2 ¬b = ⊥-elim (not (λ x → dont-orb (∀AB x) ¬b ))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
352 caseΦ : (lx : Nat) → ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x) → ψ (ordinal lx (Φ lx) )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
353 caseΦ lx prev with ∋-p' X ( ord→od (ordinal lx (Φ lx) ))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
354 caseΦ lx prev | yes p = case2 ( record { a-choice = ord→od (ordinal lx (Φ lx)) ; is-in = p } )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
355 caseΦ lx prev | no ¬p = lemma where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
356 lemma1 : (x : Ordinal) → (((Suc (lv x) ≤ lx) ∨ (ord x d< Φ lx) → def X x → ⊥) ∨ choiced X)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
357 lemma1 x with trio< x (ordinal lx (Φ lx))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
358 lemma1 x | tri< a ¬b ¬c with prev (osuc x) (lemma2 a) where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
359 lemma2 : x o< (ordinal lx (Φ lx)) → osuc x o< ordinal lx (Φ lx)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
360 lemma2 (case1 lt) = case1 lt
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
361 lemma1 x | tri< a ¬b ¬c | case2 found = case2 found
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
362 lemma1 x | tri< a ¬b ¬c | case1 not_found = case1 ( λ lt df → not_found x <-osuc df )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
363 lemma1 x | tri≈ ¬a refl ¬c = case1 ( λ lt → ⊥-elim (o<¬≡ refl lt ))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
364 lemma1 x | tri> ¬a ¬b c = case1 ( λ lt → ⊥-elim (o<> lt c ))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
365 lemma : ((x : Ordinal) → (Suc (lv x) ≤ lx) ∨ (ord x d< Φ lx) → def X x → ⊥) ∨ choiced X
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
366 lemma = ∀-imply-or lemma1
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
367 caseOSuc : (lx : Nat) (x : OrdinalD lx) → ψ ( ordinal lx x ) → ψ ( ordinal lx (OSuc lx x) )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
368 caseOSuc lx x prev with ∋-p' X (ord→od record { lv = lx ; ord = x } )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
369 caseOSuc lx x prev | yes p = case2 (record { a-choice = ord→od record { lv = lx ; ord = x } ; is-in = p })
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
370 caseOSuc lx x (case1 not_found) | no ¬p = case1 lemma where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
371 lemma : (y : Ordinal) → (Suc (lv y) ≤ lx) ∨ (ord y d< OSuc lx x) → def X y → ⊥
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
372 lemma y lt with trio< y (ordinal lx x )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
373 lemma y lt | tri< a ¬b ¬c = not_found y a
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
374 lemma y lt | tri≈ ¬a refl ¬c = subst (λ k → def X k → ⊥ ) diso ¬p
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
375 lemma y lt | tri> ¬a ¬b c with osuc-≡< lt
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
376 lemma y lt | tri> ¬a ¬b c | case1 refl = ⊥-elim ( ¬b refl )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
377 lemma y lt | tri> ¬a ¬b c | case2 lt1 = ⊥-elim (o<> c lt1 )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
378 caseOSuc lx x (case2 found) | no ¬p = case2 found
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
379 caseOSuc1 : (lx : Nat) (x : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x) → ψ y) →
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
380 ψ (record { lv = lx ; ord = OSuc lx x })
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
381 caseOSuc1 lx x lt = caseOSuc lx x (lt ( ordinal lx x ) (case2 s<refl))
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
382 have_to_find : choiced X
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
383 have_to_find with lemma-ord (od→ord X )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
384 have_to_find | t = dont-or t ¬¬X∋x where
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
385 ¬¬X∋x : ¬ ((x : Ordinal) → (Suc (lv x) ≤ lv (od→ord X)) ∨ (ord x d< ord (od→ord X)) → def X x → ⊥)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
386 ¬¬X∋x nn = not record {
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
387 eq→ = λ {x} lt → ⊥-elim (nn x (def→o< lt) lt)
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
388 ; eq← = λ {x} lt → ⊥-elim ( ¬x<0 lt )
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
389 }
afc864169325 recover ε-induction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 222
diff changeset
390