intros.
unfold try_extend in |- *.
set (dgv := dec_gen (seq_set v)) in *.
case dgv.
intro.
split; try split; auto with algebra.
intros.
simpl in H0.
apply False_ind.
clear g dgv H v; induction k; intuition; inversion_clear H0.
intro.
set (Acv := ACcomplement (not_generates_then_leaves_over n)) in *.
case Acv.
intros.
split; try split.
intro; apply False_ind.
simpl in H0.
clear n0 x Acv n dgv H v.
induction k; intuition; inversion_clear H0.
intros; apply False_ind; intuition.
2: intros _.
2: apply Map_eq_seq_equal; auto with algebra.
generalize dependent (seq_equal_length_equal H0).
intro p; simpl in p.
clear b H2 H1 H0 n0 x Acv n v.
induction k; intuition; inversion_clear p.
Qed.
(** - 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.

(* Specifications: *)
Lemma preserve_lin_indep :
forall (n k : Nat) (v : seq k V) (H : lin_indep (seq_set v) /\ distinct v),
match rep_ext n H with
| existT i (existT w H') => lin_indep (seq_set w) /\ distinct w
end.