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

@@ -61,3 +61,9 @@ module Rings.RingDefinition where
-- ringHom : RingHom R S f
-- bijective : Bijection f
abs : {a b c : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A A A} {_*_ : A A A} {_<_ : Rel {_} {c} A} {pOrder : SetoidPartialOrder S _<_} (R : Ring S _+_ _*_) (order : SetoidTotalOrder pOrder) (x : A) A
abs R order x with SetoidTotalOrder.totality order (Ring.0R R) x
... | inl (inl 0<x) = x
... | inl (inr x<0) = Group.inverse (Ring.additiveGroup R) x
... | inr 0=x = Ring.0R R