End Sums.
(** ** Noncommutative rings *)
Module Ring.
Record mixin_of (K : AbelianGroup) := Mixin {
mult : K -> K -> K ;
one : K ;
ax1 : forall x y z, mult x (mult y z) = mult (mult x y) z ;
ax2 : forall x, mult x one = x ;
ax3 : forall x, mult one x = x ;
ax4 : forall x y z, mult (plus x y) z = plus (mult x z) (mult y z) ;
ax5 : forall x y z, mult x (plus y z) = plus (mult x y) (mult x z)
}.
Section ClassDef.
Record class_of (K : Type) := Class {
base : AbelianGroup.class_of K ;
mixin : mixin_of (AbelianGroup.Pack _ base K)
}.
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 Ring := type.
End Exports.
End Ring.
Export Ring.Exports.
(** Arithmetic operations *)
Section Ring1.
Context {K : Ring}.
Definition mult : K -> K -> K := Ring.mult _ (Ring.class K).
Definition one : K := Ring.one _ (Ring.class K).

Lemma sum_n_m_mult_r :
forall (a : K) (u : nat -> K) (n m : nat),
sum_n_m (fun k => mult (u k) a) n m = mult (sum_n_m u n m) a.