Section SquareBlockMatrixRing.
Context {R : ringType} {p : nat} {p_ : 'I_p -> nat}.
Notation sp := (\sum_i p_ i)%N.
Implicit Type (s : 'I_sp).
End SquareBlockMatrixRing.

Lemma mul_mxdiag_mxblock {R : ringType} {p q : nat}
{p_ : 'I_p -> nat} {q_ : 'I_q -> nat}
(D_ : forall j, 'M[R]_(p_ j)) (B_ : forall i j, 'M[R]_(p_ i, q_ j)):
\mxdiag_j D_ j *m \mxblock_(i, j) B_ i j = \mxblock_(i, j) (D_ i *m B_ i j).