Canonical matrix_countRingType (R : countRingType) n :=
[countRingType of 'M[R]_n.+1].
Canonical matrix_finLmodType (R : finRingType) m n :=
[finLmodType R of 'M[R]_(m, n)].
Canonical matrix_finRingType (R : finRingType) n' :=
Eval hnf in [finRingType of 'M[R]_n'.+1].
Canonical matrix_finLalgType (R : finRingType) n' :=
[finLalgType R of 'M[R]_n'.+1].
(* Parametricity over the algebra structure. *)
Section MapRingMatrix.
Variables (aR rR : ringType) (f : {rmorphism aR -> rR}).
Local Notation "A ^f" := (map_mx f A) : ring_scope.
Section FixedSize.
Variables m n p : nat.
Implicit Type A : 'M[aR]_(m, n).

(* Specifications: *)
Lemma map_mxZ a A : (a *: A)^f = f a *: A^f.
Lemma map_delta_mx i j : (delta_mx i j)^f = delta_mx i j :> 'M_(m, n).
Lemma cofactor_map_mx (A : 'M_n) i j : cofactor A^f i j = f (cofactor A i j).
Lemma map_lin_mx m1 n1 m2 n2 (g : 'M_(m1, n1) -> 'M_(m2, n2)) gf :
(forall A, (g A)^f = gf A^f) -> (lin_mx g)^f = lin_mx gf.