(** * Modules *)
Module ModuleSpace.
Record mixin_of (K : Ring) (V : AbelianGroup) := Mixin {
scal : K -> V -> V ;
ax1 : forall x y u, scal x (scal y u) = scal (mult x y) u ;
ax2 : forall u, scal one u = u ;
ax3 : forall x u v, scal x (plus u v) = plus (scal x u) (scal x v) ;
ax4 : forall x y u, scal (plus x y) u = plus (scal x u) (scal y u)
}.
Section ClassDef.
Variable K : Ring.
Record class_of (V : Type) := Class {
base : AbelianGroup.class_of V ;
mixin : mixin_of K (AbelianGroup.Pack _ base V)
}.
Local Coercion base : class_of >-> AbelianGroup.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.
End ClassDef.
Module Exports.
Coercion base : class_of >-> AbelianGroup.class_of.
Coercion mixin : class_of >-> mixin_of.
Coercion sort : type >-> Sortclass.
Coercion AbelianGroup : type >-> AbelianGroup.type.
Canonical AbelianGroup.
Notation ModuleSpace := type.
End Exports.
End ModuleSpace.
Export ModuleSpace.Exports.
Section ModuleSpace1.
Context {K : Ring} {V : ModuleSpace K}.
Definition scal : K -> V -> V := ModuleSpace.scal _ _ (ModuleSpace.class K V).

Lemma scal_assoc :
forall (x y : K) (u : V),
scal x (scal y u) = scal (mult x y) u.