Triangle inequality on the rationals (#20)

This commit is contained in:
Patrick Stevens
2019-01-18 13:00:15 +00:00
committed by GitHub
parent 20b31da82d
commit 9cccd51cbf
6 changed files with 356 additions and 22 deletions

View File

@@ -1,32 +1,39 @@
{-# OPTIONS --safe --warning=error #-}
open import Fields
open import Rings
open import Fields.Fields
open import Functions
open import Orders
open import LogicalFormulae
open import Rationals
open import Naturals
open import Numbers.Rationals
open import Numbers.RationalsLemmas
open import Numbers.Naturals
open import Setoids.Setoids
open import Setoids.Orders
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_)
module Reals where
record Subset {m n : _} (A : Set m) (B : Set n) : Set (m n) where
field
inj : A B
injInj : Injection inj
--record RealField {n : _} {A : Set n} {R : Ring A} {F : Field R} : Set _ where
-- field
-- orderedField : OrderedField F
-- open OrderedField orderedField
-- open TotalOrder ord
-- open Ring R
-- field
-- complete : {c : _} {C : Set c} → (S : Subset C A) → (upperBound : A) → ({s : C} → (Subset.inj S s) < upperBound) → Sg A (λ lub → ({s : C} → (Subset.inj S s) < lub) && ({s : C} → (Subset.inj S s) < upperBound → (Subset.inj S s) < lub))
record Real : Set where
module Numbers.Reals where
record : Set where
field
f :
converges : {ε : } Sg (λ x {y : } x <N y (f x) +Q (f y) <Q ε)
converges : {ε : } Sg (λ x {y : } x <N y (absQ ((f x) -Q (f y))) <Q ε)
_+R_ :
.f (record { f = a ; converges = conA } +R record { f = b ; converges = conB }) n = (a n) +Q (b n)
.converges (record { f = a ; converges = conA } +R record { f = b ; converges = conB }) {e} = {!absQ (a x +Q b x)!}
negateR :
.f (negateR record { f = f ; converges = converges }) n = negateQ (f n)
.converges (negateR record { f = f ; converges = converges }) {e} with converges {e}
... | n , pr = n , λ {y} x<y SetoidPartialOrder.wellDefined PartialOrder {absQ ((f n) -Q (f y))} {absQ ((negateQ (f n)) -Q (negateQ (f y)))} {e} {e} {!!} {!reflQ e!} (pr {y} x<y)
_-R_ :
a -R b = a +R (negateR b)
_*R_ :
.f (record { f = a ; converges = conA } *R record { f = b ; converges = conB }) n = (a n) *Q (b n)
.converges (record { f = a ; converges = conA } *R record { f = b ; converges = conB}) {e} = {!!}
realsSetoid : Setoid
(realsSetoid Setoid. record { f = a ; converges = convA }) record { f = b ; converges = convB } = {!!}
Setoid.eq realsSetoid = {!!}