Section BlockMatrixRing.
Context {R : ringType} {p q : nat} {p_ : 'I_p -> nat} {q_ : 'I_q -> nat}.
Notation sp := (\sum_i p_ i)%N.
Notation sq := (\sum_i q_ i)%N.
End BlockMatrixRing.

Lemma mul_mxblock {R : ringType} {p q r : nat}
{p_ : 'I_p -> nat} {q_ : 'I_q -> nat} {r_ : 'I_r -> nat}
(A_ : forall i j, 'M[R]_(p_ i, q_ j)) (B_ : forall j k, 'M_(q_ j, r_ k)) :
\mxblock_(i, j) A_ i j *m \mxblock_(j, k) B_ j k =
\mxblock_(i, k) \sum_j (A_ i j *m B_ j k).