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).

Lemma cofactor_map_mx (A : 'M_n) i j : cofactor A^f i j = f (cofactor A i j).