Section SquareBlockMatrixZmod.
Context {V : zmodType} {p : nat} {p_ : 'I_p -> nat}.
Notation sp := (\sum_i p_ i)%N.
Implicit Type (s : 'I_sp).
Definition mxdiag (B_ : forall i, 'M[V]_(p_ i)) : 'M[V]_(\sum_i p_ i) :=
\mxblock_(j, k) if j == k then conform_mx 0 (B_ j) else 0.
Local Notation "\mxdiag_ i E" := (mxdiag (fun i => E)) : ring_scope.
End SquareBlockMatrixZmod.
Notation "\mxdiag_ ( i < n ) E" := (mxdiag (fun i : 'I_n => E))
(only parsing) : ring_scope.
Notation "\mxdiag_ i E" := (\mxdiag_(i < _) E) : ring_scope.

Lemma mxdiag_recl {V : zmodType} {m : nat} {p_ : 'I_m.+1 -> nat}
(B_ : forall i, 'M[V]_(p_ i)) :
\mxdiag_i B_ i = castmx (mxsize_recl, mxsize_recl)
(block_mx (B_ 0) 0 0 (\mxdiag_i B_ (lift ord0 i))).