End ZpolyScale.
(* Integral spans. *)

Lemma int_Smith_normal_form m n (M : 'M[int]_(m, n)) :
{L : 'M[int]_m & L \in unitmx &
{R : 'M[int]_n & R \in unitmx &
{d : seq int | sorted dvdz d &
M = L *m (\matrix_(i, j) (d`_i *+ (i == j :> nat))) *m R}}}.