module HyperReal where open import Data.Nat open import Data.Nat.Properties open import Data.Empty open import Relation.Nullary using (¬_; Dec; yes; no) open import Level renaming ( suc to succ ; zero to Zero ; _⊔_ to _L⊔_ ) open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import Relation.Binary.Definitions open import Relation.Binary.Structures open import nat open import logic open import bijection HyperNat : Set HyperNat = ℕ → ℕ open _∧_ open Bijection n1 : ℕ → ℕ n1 n = proj1 (fun→ nxn n) n2 : ℕ → ℕ n2 n = proj2 (fun→ nxn n) _n*_ : (i j : HyperNat ) → HyperNat i n* j = λ k → i k * j k _n+_ : (i j : HyperNat ) → HyperNat i n+ j = λ k → i k + j k hzero : HyperNat hzero _ = 0 h : (n : ℕ) → HyperNat h n _ = n record _n=_ (i j : HyperNat ) : Set where field =-map : Bijection ℕ ℕ =-m : ℕ is-n= : (k : ℕ ) → k > =-m → i k ≡ j (fun→ =-map k) open _n=_ record _n≤_ (i j : HyperNat ) : Set where field ≤-map : Bijection ℕ ℕ ≤-m : ℕ is-n≤ : (k : ℕ ) → k > ≤-m → i k ≤ j (fun→ ≤-map k) open _n≤_ record _n<_ (i j : HyperNat ) : Set where field <-map : Bijection ℕ ℕ <-m : ℕ is-n< : (k : ℕ ) → k > <-m → i k < j (fun→ <-map k) open _n<_ _n<=s≤_ : (i j : HyperNat ) → (i n< j) ⇔ (( i n+ h 1 ) n≤ j ) _n<=s≤_ = {!!} ¬hn<0 : {x : HyperNat } → ¬ ( x n< h 0 ) ¬hn<0 {x} x<0 = ⊥-elim ( nat-≤> (is-n< x<0 (suc (<-m x<0)) a ¬a ¬b c = {!!} trans1 : {i j k : HyperNat} → i n≤ j → j n≤ k → i n≤ k trans1 = {!!} record n-finite (i : HyperNat ) : Set where field val : ℕ is-val : i n= h val n-infinite : (i : HyperNat ) → Set n-infinite i = (j : ℕ ) → h j n≤ i n-linear : HyperNat n-linear i = i n-linear-is-infnite : n-infinite n-linear n-linear-is-infnite i = record { ≤-map = bid ℕ ; ≤-m = i ; is-n≤ = λ k lt → ¬a ¬b c with <-cmpn y (h 0) ... | tri< a ¬b₁ ¬c = ⊥-elim ( ¬hn<0 a) ... | tri≈ ¬a₁ b ¬c = nzy b ... | tri> ¬a₁ ¬b₁ c₁ = hn2 c c₁ xy0 HZzero : HyperZ → Set HZzero z = hZ 0 0 z= z HZzero? : ( i : HyperZ ) → Dec (HZzero i) HZzero? = {!!} data HyperR : Set where hr : HyperZ → (k : HyperNat ) → ((i : ℕ) → 0 < k i) → HyperR HZnzero* : {x y : HyperZ } → ¬ ( HZzero x ) → ¬ ( HZzero y ) → ¬ ( HZzero (x z* y) ) HZnzero* {x} {y} nzx nzy nzx*y = {!!} HRzero : HyperR → Set HRzero (hr i j nz ) = HZzero i R0 : HyperR R0 = hr (hZ 0 0) (h 1) {!!} record Rational : Set where field rp rm k : ℕ 0