End AbsRing1.
(** * Uniform spaces defined using balls *)
Module UniformSpace.
Record mixin_of (M : Type) := Mixin {
ball : M -> R -> M -> Prop ;
ax1 : forall x (e : posreal), ball x e x ;
ax2 : forall x y e, ball x e y -> ball y e x ;
ax3 : forall x y z e1 e2, ball x e1 y -> ball y e2 z -> ball x (e1 + e2) z
}.
Notation class_of := mixin_of (only parsing).
Section ClassDef.
Structure type := Pack { sort; _ : class_of sort ; _ : Type }.
Local Coercion sort : type >-> Sortclass.
Definition class (cT : type) := let: Pack _ c _ := cT return class_of cT in c.
End ClassDef.
Module Exports.
Coercion sort : type >-> Sortclass.
Notation UniformSpace := type.
End Exports.
End UniformSpace.
Export UniformSpace.Exports.
Section UniformSpace1.
Context {M : UniformSpace}.
Definition ball := UniformSpace.ball _ (UniformSpace.class M).

Lemma ball_triangle :
forall (x y z : M) (e1 e2 : R),
ball x e1 y -> ball y e2 z -> ball x (e1 + e2) z.