annotate src/HyperReal.agda @ 22:942f4e528a79 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 09 Jul 2021 11:11:10 +0900
parents 5e4b38745a39
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 module HyperReal where
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 open import Data.Nat
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 open import Data.Nat.Properties
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import Data.Empty
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import Relation.Nullary using (¬_; Dec; yes; no)
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
7 open import Level renaming ( suc to succ ; zero to Zero ; _⊔_ to _L⊔_ )
0
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 open import Relation.Binary.PropositionalEquality hiding ( [_] )
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import Relation.Binary.Definitions
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
10 open import Relation.Binary.Structures
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
11 open import nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
12 open import logic
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
13 open import bijection
0
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
15 HyperNat : Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
16 HyperNat = ℕ → ℕ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
17
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
18 open _∧_
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
19 open Bijection
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
21 n1 : ℕ → ℕ
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
22 n1 n = proj1 (fun→ nxn n)
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
23
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
24 n2 : ℕ → ℕ
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
25 n2 n = proj2 (fun→ nxn n)
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
26
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
27 _n*_ : (i j : HyperNat ) → HyperNat
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
28 i n* j = λ k → i k * j k
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
29
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
30 _n+_ : (i j : HyperNat ) → HyperNat
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
31 i n+ j = λ k → i k + j k
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
32
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
33 hzero : HyperNat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
34 hzero _ = 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
35
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
36 h : (n : ℕ) → HyperNat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
37 h n _ = n
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
38
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
39 record _n=_ (i j : HyperNat ) : Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
40 field
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
41 =-map : Bijection ℕ ℕ
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
42 =-m : ℕ
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
43 is-n= : (k : ℕ ) → k > =-m → i k ≡ j (fun→ =-map k)
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
44
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
45 open _n=_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
46
3
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
47 record _n≤_ (i j : HyperNat ) : Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
48 field
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
49 ≤-map : Bijection ℕ ℕ
3
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
50 ≤-m : ℕ
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
51 is-n≤ : (k : ℕ ) → k > ≤-m → i k ≤ j (fun→ ≤-map k)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
52
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
53 open _n≤_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
54
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
55 record _n<_ (i j : HyperNat ) : Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
56 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
57 <-map : Bijection ℕ ℕ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
58 <-m : ℕ
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
59 is-n< : (k : ℕ ) → k > <-m → i k < j (fun→ <-map k)
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
60
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
61 open _n<_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
62
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
63 _n<=s≤_ : (i j : HyperNat ) → (i n< j) ⇔ (( i n+ h 1 ) n≤ j )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
64 _n<=s≤_ = {!!}
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
65
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
66 ¬hn<0 : {x : HyperNat } → ¬ ( x n< h 0 )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
67 ¬hn<0 {x} x<0 = ⊥-elim ( nat-≤> (is-n< x<0 (suc (<-m x<0)) a<sa) 0<s )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
68
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
69 postulate
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
70 <-cmpn : Trichotomous {Level.zero} _n=_ _n<_
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
71
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
72 n=IsEquivalence : IsEquivalence _n=_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
73 n=IsEquivalence = record { refl = record {=-map = bid ℕ ; =-m = 0 ; is-n= = λ _ _ → refl}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
74 ; sym = λ xy → record {=-map = bi-sym ℕ ℕ (=-map xy) ; =-m = =-m xy ; is-n= = λ k lt → {!!} } -- (is-n= xy k lt) }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
75 ; trans = λ xy yz → record {=-map = bi-trans ℕ ℕ ℕ (=-map xy) (=-map yz) ; =-m = {!!} ; is-n= = λ k lt → {!!} } }
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
76
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
77 HNTotalOrder : IsTotalPreorder _n=_ _n≤_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
78 HNTotalOrder = record {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
79 isPreorder = record {
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
80 isEquivalence = n=IsEquivalence
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
81 ; reflexive = λ eq → record { ≤-map = =-map eq ; ≤-m = =-m eq ; is-n≤ = {!!} }
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
82 ; trans = trans1 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
83 ; total = total
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
84 } where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
85 open import Data.Sum.Base using (_⊎_)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
86 open _⊎_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
87 total : (x y : HyperNat ) → (x n≤ y) ⊎ (y n≤ x)
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
88 total x y with <-cmpn x y
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
89 ... | tri< a ¬b ¬c = inj₁ {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
90 ... | tri≈ ¬a b ¬c = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
91 ... | tri> ¬a ¬b c = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
92 trans1 : {i j k : HyperNat} → i n≤ j → j n≤ k → i n≤ k
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
93 trans1 = {!!}
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
94
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
95 record n-finite (i : HyperNat ) : Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
96 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
97 val : ℕ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
98 is-val : i n= h val
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
99
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
100 n-infinite : (i : HyperNat ) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
101 n-infinite i = (j : ℕ ) → h j n≤ i
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
102
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
103 n-linear : HyperNat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
104 n-linear i = i
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
105
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
106 n-linear-is-infnite : n-infinite n-linear
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
107 n-linear-is-infnite i = record { ≤-map = bid ℕ ; ≤-m = i ; is-n≤ = λ k lt → <to≤ lt }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
108
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
109 ¬-infinite-n-finite : (i : HyperNat ) → n-finite i → ¬ n-infinite i
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
110 ¬-infinite-n-finite = {!!}
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
111
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
112 data HyperZ : Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
113 hz : HyperNat → HyperNat → HyperZ
0
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
115 hZ : ℕ → ℕ → HyperZ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
116 hZ x y = hz (λ _ → x) (λ _ → y )
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
117
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
118 _z+_ : (i j : HyperZ ) → HyperZ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
119 hz i i₁ z+ hz j j₁ = hz ( i n+ j ) (i₁ n+ j₁ )
0
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 16
diff changeset
121 _z*_ : (i j : HyperZ ) → HyperZ
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
122 hz i i₁ z* hz j j₁ = hz (λ k → i k * j k + i₁ k * j₁ k ) (λ k → i k * j₁ k - i₁ k * j k )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
123
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
124 -- x0 - y0 ≡ x1 - y1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
125 -- x0 + y1 ≡ x1 + y0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
126 --
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
127 _z=_ : (i j : HyperZ ) → Set
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
128 _z=_ (hz x0 y0) (hz x1 y1) = (x0 n+ y1) n= (x1 n+ y0)
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
129
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
130 _z≤_ : (i j : HyperZ ) → Set
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
131 _z≤_ (hz x0 y0) (hz x1 y1) = (x0 n+ y1) n≤ (x1 n+ y0)
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
132
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
133 _z<_ : (i j : HyperZ ) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
134 _z<_ (hz x0 y0) (hz x1 y1) = (x0 n+ y1) n< (x1 n+ y0)
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
135
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
136 <-cmpz : Trichotomous {Level.zero} _z=_ _z<_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
137 <-cmpz (hz x0 y0) (hz x1 y1) = <-cmpn (x0 n+ y1) (x1 n+ y0)
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
138
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
139 -z : (i : HyperZ ) → HyperZ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
140 -z (hz x y) = hz y x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
141
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
142 z-z=0 : (i : HyperZ ) → (i z+ (-z i)) z= hZ 0 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
143 z-z=0 = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
144
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
145 z+infinite : (i : HyperZ ) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
146 z+infinite i = (j : ℕ ) → hZ j 0 z≤ i
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
147
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
148 z-infinite : (i : HyperZ ) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
149 z-infinite i = (j : ℕ ) → i z≤ hZ 0 j
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
150
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
151 import Axiom.Extensionality.Propositional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
152 postulate f-extensionality : { n m : Level} → Axiom.Extensionality.Propositional.Extensionality n m
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
153
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
154 --- x*y ...... 0 0 0 0 ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
155 --- x ...... 0 0 1 0 1 ....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
156 --- y ...... 0 1 0 1 0 ....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
157
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
158 HNnzero* : {x y : HyperNat } → ¬ ( x n= h 0 ) → ¬ ( y n= h 0 ) → ¬ ( (x n* y) n= h 0 )
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
159 HNnzero* {x} {y} nzx nzy xy0 = hn1 where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
160 hn2 : ( h 0 n< x ) → ( h 0 n< y ) → ¬ ( (x n* y) n= h 0 )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
161 hn2 0<x 0<y xy0 = ⊥-elim ( nat-≡< (sym (is-n= xy0 (suc mxy) {!!} )) {!!} ) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
162 mxy : ℕ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
163 mxy = <-m 0<x ⊔ <-m 0<y ⊔ =-m xy0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
164 hn1 : ⊥
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
165 hn1 with <-cmpn x (h 0)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
166 ... | tri≈ ¬a b ¬c = nzx b
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
167 ... | tri< a ¬b ¬c = ⊥-elim ( ¬hn<0 a)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
168 hn1 | tri> ¬a ¬b c with <-cmpn y (h 0)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
169 ... | tri< a ¬b₁ ¬c = ⊥-elim ( ¬hn<0 a)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
170 ... | tri≈ ¬a₁ b ¬c = nzy b
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
171 ... | tri> ¬a₁ ¬b₁ c₁ = hn2 c c₁ xy0
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
172
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
173 HZzero : HyperZ → Set
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
174 HZzero z = hZ 0 0 z= z
0
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
176 HZzero? : ( i : HyperZ ) → Dec (HZzero i)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
177 HZzero? = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
178
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
179 data HyperR : Set where
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
180 hr : HyperZ → (k : HyperNat ) → ((i : ℕ) → 0 < k i) → HyperR
0
8c492c69514c HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
181
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
182 HZnzero* : {x y : HyperZ } → ¬ ( HZzero x ) → ¬ ( HZzero y ) → ¬ ( HZzero (x z* y) )
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
183 HZnzero* {x} {y} nzx nzy nzx*y = {!!}
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
184
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
185 HRzero : HyperR → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
186 HRzero (hr i j nz ) = HZzero i
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
187
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
188 R0 : HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
189 R0 = hr (hZ 0 0) (h 1) {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
190
22
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
191 R1 : HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
192 R1 = hr (hZ 1 0) (h 1) {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
193
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
194 record Rational : Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
195 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
196 rp rm k : ℕ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
197 0<k : 0 < k
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
198
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
199 hR : ℕ → ℕ → (k : HyperNat ) → ((i : ℕ) → 0 < k i) → HyperR
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
200 hR x y k ne = hr (hZ x y) k ne
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
201
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
202 rH : (r : Rational ) → HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
203 rH r = hr (hZ (Rational.rp r) (Rational.rm r)) (h (Rational.k r)) {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
204
22
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
205 nH : (r : ℕ ) → HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
206 nH r = hr (hZ r 0) (h 1) {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
207
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
208 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
209 -- z0 / y0 = z1 / y1 ← z0 * y1 = z1 * y0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
210 --
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
211 _h=_ : (i j : HyperR ) → Set
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
212 hr z0 k0 ne0 h= hr z1 k1 ne1 = (z0 z* (hz k1 (h 0))) z= (z1 z* (hz k0 (h 0)))
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
213
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
214 _h≤_ : (i j : HyperR ) → Set
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
215 hr z0 k0 ne0 h≤ hr z1 k1 ne1 = (z0 z* (hz k1 (h 0))) z≤ (z1 z* (hz k0 (h 0)))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
216
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
217 _h<_ : (i j : HyperR ) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
218 hr z0 k0 ne0 h< hr z1 k1 ne1 = (z0 z* (hz k1 (h 0))) z< (z1 z* (hz k0 (h 0)))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
219
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
220 <-cmph : Trichotomous {Level.zero} _h=_ _h<_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
221 <-cmph (hr z0 k0 ne0 ) ( hr z1 k1 ne1 ) = <-cmpz (z0 z* (hz k1 (h 0))) (z1 z* (hz k0 (h 0)))
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
222
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
223 _h*_ : (i j : HyperR) → HyperR
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
224 hr x k nz h* hr y k₁ nz₁ = hr ( x z* y ) ( k n* k₁ ) {!!}
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
225
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
226 _h+_ : (i j : HyperR) → HyperR
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
227 hr x k nz h+ hr y k₁ nz₁ = hr ( (x z* (hz k hzero)) z+ (y z* (hz k₁ hzero)) ) (k n* k₁) {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
228
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
229 -h : (i : HyperR) → HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
230 -h (hr x k nz) = hr (-z x) k nz
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
231
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
232 inifinitesimal-R : (inf : HyperR) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
233 inifinitesimal-R inf = ( r : Rational ) → R0 h< rH r → ( -h (rH r) h< inf ) ∧ ( inf h< rH r)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
234
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
235 1/x : HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
236 1/x = hr (hZ 1 0) n-linear {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
237
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
238 1/x-is-inifinitesimal : inifinitesimal-R 1/x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
239 1/x-is-inifinitesimal r 0<r = ⟪ {!!} , {!!} ⟫
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
240
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
241 HyperReal : Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
242 HyperReal = ℕ → HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
243
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
244 HR→HRl : HyperR → HyperReal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
245 HR→HRl (hr (hz x y) k ne) k1 = hr (hz (λ k2 → (x k1)) (λ k2 → (x k1))) k ne
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
246
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
247 HRl→HR : HyperReal → HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
248 HRl→HR r = hr (hz (λ k → {!!}) (λ k → {!!}) ) factor {!!} where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
249 factor : HyperNat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
250 factor n = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 17
diff changeset
251 fne : (n : ℕ) → ¬ (factor n= h 0)
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
252 fne = {!!}
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
253
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
254 _≈_ : (x y : HyperR ) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
255 x ≈ y = inifinitesimal-R (x h+ ( -h y ))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
256
21
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
257 is-inifinitesimal : {x : HyperR } → inifinitesimal-R x → x ≈ R0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
258 is-inifinitesimal {x} inf = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
259
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
260 record Standard : Set where
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
261 field
21
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
262 standard : HyperR → HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
263 is-standard : {x : HyperR } → x ≈ standard x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
264 standard-unique : {x y : HyperR } → x ≈ y → standard x ≡ standard y
22
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
265 st-inifinitesimal : {x : HyperR } → inifinitesimal-R x → standard x ≡ R0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
266 st-ℕ : {x : HyperR } → { i : ℕ } → x ≈ nH i → standard x ≡ nH i
21
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
267
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
268 postulate
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
269 ST : Standard
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
270
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
271 open Standard
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
272
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
273 st : HyperR → HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
274 st x = standard ST x
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
275
22
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
276 open import Algebra.Structures
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
277 open import Algebra.Bundles
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
278
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
279 HRing : CommutativeRing Level.zero Level.zero
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
280 HRing = record {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
281 Carrier = HyperR
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
282 ; _≈_ = _h=_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
283 ; _+_ = _h+_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
284 ; _*_ = _h*_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
285 ; -_ = -h
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
286 ; 0# = R0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
287 ; 1# = R1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
288 ; isCommutativeRing = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
289 }
20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
290
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
291
22
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
292 transfer : ( p : Rational ∨ HyperR → Set )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
293 → ((x : Rational ) → p (case1 x) )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
294 → ((x : HyperR ) → p (case2 x))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
295 transfer = {!!}