Section StructuralLinear.
Canonical diag_mx_additive n := Additive (@diag_mx_is_linear n).
Canonical diag_mx_linear n := Linear (@diag_mx_is_linear n).
(* Matrix multiplication using bigops. *)
Fact mulmx_key : unit. Proof. by []. Qed.
Definition mulmx {m n p} (A : 'M_(m, n)) (B : 'M_(n, p)) : 'M[R]_(m, p) :=
\matrix[mulmx_key]_(i, k) \sum_j (A i j * B j k).
Local Notation "A *m B" := (mulmx A B) : ring_scope.

Lemma mulmx_sumr m n p (A : 'M_(m, n)) I r P (B_ : I -> 'M_(n, p)) :
A *m (\sum_(i <- r | P i) B_ i) = \sum_(i <- r | P i) A *m B_ i.