(** - Also we need to be able to decide whether some set generates the vectorspace.
 This, by the way, is the only time I use the sort Set - just to be able to use the
 informative or (i.e., {A}+{B}) Since I didn't introduce AC on the Set level, we should
 still be OK; also we don't have full EM, just for this one predicate. *)

Axiom
  dec_gen :
    forall S : part_set V, {generates S (full V)} + {~ generates S (full V)}.(** - To extend a linearly independent sequence (whenever possible): *)
Definition try_extend :
  forall (k : Nat) (v : seq k V),
  lin_indep (seq_set v) /\ distinct v ->
  sigT
    (fun i : Nat =>
     sigT (fun w : seq i V => lin_indep (seq_set w) /\ distinct w)).(** - To repeat this extending procedure $n$ times: *)
Fixpoint rep_ext (n : nat) (k : Nat) (v : seq k V)
 (H : lin_indep (seq_set v) /\ distinct v) {struct n} :
 sigT
   (fun i : Nat =>
    sigT (fun w : seq i V => lin_indep (seq_set w) /\ distinct w)) :=
  match n with
  | O => existT (fun i : Nat => _) k (existT (fun w : seq k V => _) v H)
  | S m =>
      match rep_ext m H with
      | existT i (existT w H') => try_extend H'
      end
  end.

Lemma subspace_preserves_findimvecsp : sigT (fun m => m <= n /\ has_dim m W).