End Ring1.
(** ** Rings with absolute value *)
Module AbsRing.
Record mixin_of (K : Ring) := Mixin {
abs : K -> R ;
ax1 : abs zero = 0 ;
ax2 : abs (opp one) = 1 ;
ax3 : forall x y : K, abs (plus x y) <= abs x + abs y ;
ax4 : forall x y : K, abs (mult x y) <= abs x * abs y ;
ax5 : forall x : K, abs x = 0 -> x = zero
}.
Section ClassDef.
Record class_of (K : Type) := Class {
base : Ring.class_of K ;
mixin : mixin_of (Ring.Pack _ base K)
}.
Local Coercion base : class_of >-> Ring.class_of.
Structure type := Pack { sort; _ : class_of sort ; _ : Type }.
Local Coercion sort : type >-> Sortclass.
Variable cT : type.
Definition class := let: Pack _ c _ := cT return class_of cT in c.
Let xT := let: Pack T _ _ := cT in T.
Notation xclass := (class : class_of xT).
Definition AbelianGroup := AbelianGroup.Pack cT xclass xT.
Definition Ring := Ring.Pack cT xclass xT.
End ClassDef.
Module Exports.
Coercion base : class_of >-> Ring.class_of.
Coercion mixin : class_of >-> mixin_of.
Coercion sort : type >-> Sortclass.
Coercion AbelianGroup : type >-> AbelianGroup.type.
Canonical AbelianGroup.
Coercion Ring : type >-> Ring.type.
Canonical Ring.
Notation AbsRing := type.
End Exports.
End AbsRing.
Export AbsRing.Exports.
(** Usual properties *)
Section AbsRing1.
Context {K : AbsRing}.
Definition abs : K -> R := AbsRing.abs _ (AbsRing.class K).

(* Specifications: *)
Lemma abs_zero :
abs zero = 0.
Lemma abs_opp_one :
abs (opp one) = 1.
Lemma abs_triangle :
forall x y : K,
abs (plus x y) <= abs x + abs y.
Lemma abs_mult :
forall x y : K,
abs (mult x y) <= abs x * abs y.
Lemma abs_eq_zero :
forall x : K,
abs x = 0 -> x = zero.
Lemma abs_opp :
forall x, abs (opp x) = abs x.
Lemma abs_minus :
forall x y : K, abs (minus x y) = abs (minus y x).
Lemma abs_one :
abs one = 1.
Lemma abs_ge_0 :
forall x, 0 <= abs x.
Lemma abs_pow_n :
forall (x : K) n,
abs (pow_n x n) <= (abs x)^n.