Definition subvs_vectMixin :=  VectMixin subvs_vect_iso.
Canonical subvs_vectType := VectType K subvs_of subvs_vectMixin.
End SubVector.
Prenex Implicits vsval vsproj vsvalK.
Arguments subvs_inj {K vT U} [x1 x2].
Arguments vsprojK {K vT U} [x] Ux.
Section MatrixVectType.
Variables (R : ringType) (m n : nat).
(* The apparently useless => /= in line 1 of the proof performs some evar     *)
(* expansions that the Ltac interpretation of exists is incapable of doing.   *)
Fact matrix_vect_iso : Vector.axiom (m * n) 'M[R]_(m, n).
Definition matrix_vectMixin := VectMixin matrix_vect_iso.
Canonical matrix_vectType := VectType R 'M[R]_(m, n) matrix_vectMixin.
End MatrixVectType.
(* A ring is a one-dimension vector space *)
Section RegularVectType.
Variable R : ringType.
Fact regular_vect_iso : Vector.axiom 1 R^o.
Definition regular_vectMixin := VectMixin regular_vect_iso.
Canonical regular_vectType := VectType R R^o regular_vectMixin.
End RegularVectType.
(* External direct product of two vectTypes. *)
Section ProdVector.
Variables (R : ringType) (vT1 vT2 : vectType R).
Fact pair_vect_iso : Vector.axiom (Vector.dim vT1 + Vector.dim vT2) (vT1 * vT2).
Definition pair_vectMixin := VectMixin pair_vect_iso.
Canonical pair_vectType := VectType R (vT1 * vT2) pair_vectMixin.
End ProdVector.
(* Function from a finType into a ring form a vectype. *)
Section FunVectType.
Variable (I : finType) (R : ringType) (vT : vectType R).
(* Type unification with exist is again a problem in this proof. *)
Fact ffun_vect_iso : Vector.axiom (#|I| * Vector.dim vT) {ffun I -> vT}.
Definition ffun_vectMixin := VectMixin ffun_vect_iso.
Canonical ffun_vectType := VectType R {ffun I -> vT} ffun_vectMixin.
End FunVectType.
Canonical exp_vectType (K : fieldType) (vT : vectType K) n :=
[vectType K of vT ^ n].
(* Solving a tuple of linear equations. *)
Section Solver.
Variable (K : fieldType) (vT : vectType K).
Variables (n : nat) (lhs : n.-tuple 'End(vT)) (rhs : n.-tuple vT).
Let lhsf u := finfun ((tnth lhs)^~ u).
Definition vsolve_eq U := finfun (tnth rhs) \in (linfun lhsf @: U)%VS.

(* Specifications: *)
Lemma vsolve_eqP (U : {vspace vT}) :
reflect (exists2 u, u \in U & forall i, tnth lhs i u = tnth rhs i)
(vsolve_eq U).