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).

Lemma abs_triangle :
forall x y : K,
abs (plus x y) <= abs x + abs y.