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

(* Specifications: *)
Lemma mult_assoc :
forall x y z : K,
mult x (mult y z) = mult (mult x y) z.
Lemma mult_one_r :
forall x : K,
mult x one = x.
Lemma mult_one_l :
forall x : K,
mult one x = x.
Lemma mult_distr_r :
forall x y z : K,
mult (plus x y) z = plus (mult x z) (mult y z).
Lemma mult_distr_l :
forall x y z : K,
mult x (plus y z) = plus (mult x y) (mult x z).
Lemma mult_zero_r :
forall x : K,
mult x zero = zero.
Lemma mult_zero_l :
forall x : K,
mult zero x = zero.
Lemma opp_mult_r :
forall x y : K,
opp (mult x y) = mult x (opp y).
Lemma opp_mult_l :
forall x y : K,
opp (mult x y) = mult (opp x) y.
Lemma opp_mult_m1 :
forall x : K,
opp x = mult (opp one) x.
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.
Lemma sum_n_m_mult_l :
forall (a : K) (u : nat -> K) (n m : nat),
sum_n_m (fun k => mult a (u k)) n m = mult a (sum_n_m u n m).
Lemma sum_n_mult_r :
forall (a : K) (u : nat -> K) (n : nat),
sum_n (fun k => mult (u k) a) n = mult (sum_n u n) a.
Lemma sum_n_mult_l :
forall (a : K) (u : nat -> K) (n : nat),
sum_n (fun k => mult a (u k)) n = mult a (sum_n u n).