Section condensing.
(** - Easy to see but not easy to prove: if $x=\sum_{i=1}^n a_ib_i$ then in fact $x=\sum_{i=1}^{n'} a_ib'_i$ where all $b'_i$ are distinct vectors.*)
intros.
red in H.
inversion_clear H.
generalize x0 H0; clear H0 x0.
intro n; induction  n as [| n Hrecn].
intros.
inversion_clear H0.
inversion_clear H.
exists 0.
exists x0.
exists x1.
split.
auto.
red in |- *.
intros.
apply False_ind; auto with algebra.
intros.
inversion_clear H0.
inversion_clear H.
assert (distinct x1 \/ ~ distinct x1).
apply classic.
case H.
intro.
exists (S n).
exists x0; exists x1; split; auto.
intro.
unfold distinct in H1.
assert
(exists i : fin (S n),
(exists j : fin (S n), ~ i =' j in _ /\ x1 i =' x1 j in _)).
apply NNPP.
red in |- *.
red in H1.
intros; apply H1.
intros.
red in |- *; red in H2.
intro; apply H2.
exists i; exists j; auto.
inversion_clear H2; inversion_clear H3.
inversion_clear H2.
apply Hrecn.
exists (omit (modify_seq x0 x2 (x0 x2 +' x0 x3)) x3).
exists (omit x1 x3).
apply
Trans
with
(sum
(mult_by_scalars (omit (modify_seq x0 x2 (x0 x2 +' x0 x3)) x3)
(omit (Map_embed x1) x3))).
apply
Trans
with
(sum
(omit
(mult_by_scalars (modify_seq x0 x2 (x0 x2 +' x0 x3)) (Map_embed x1))
x3)); auto with algebra.
apply
Trans
with
(sum (mult_by_scalars (modify_seq x0 x2 (x0 x2 +' x0 x3)) (Map_embed x1)) +'
(min mult_by_scalars (modify_seq x0 x2 (x0 x2 +' x0 x3))
(Map_embed x1) x3)); auto with algebra.
apply
Trans
with
(sum (mult_by_scalars (modify_seq x0 x2 (x0 x2 +' x0 x3)) (Map_embed x1)) +'
(min x0 x3 mX Map_embed x1 x3)).
apply
Trans
with
(sum
(modify_seq (mult_by_scalars x0 (Map_embed x1)) x2
((x0 x2 +' x0 x3) mX Map_embed x1 x2)) +'
(min x0 x3 mX Map_embed x1 x3)); auto with algebra.
apply
Trans
with
(sum (mult_by_scalars x0 (Map_embed x1)) +'
(min mult_by_scalars x0 (Map_embed x1) x2) +'
(x0 x2 +' x0 x3) mX Map_embed x1 x2 +' (min x0 x3 mX Map_embed x1 x3));
auto with algebra.
apply
Trans
with
(sum (mult_by_scalars x0 (Map_embed x1)) +'
((min mult_by_scalars x0 (Map_embed x1) x2) +'
(x0 x2 +' x0 x3) mX Map_embed x1 x2 +' (min x0 x3 mX Map_embed x1 x3))).
2: apply
Trans
with
(sum (mult_by_scalars x0 (Map_embed x1)) +'
((min mult_by_scalars x0 (Map_embed x1) x2) +'
(x0 x2 +' x0 x3) mX Map_embed x1 x2) +'
(min x0 x3 mX Map_embed x1 x3)); auto with algebra.
apply Trans with (sum (mult_by_scalars x0 (Map_embed x1))); auto with algebra.
apply Trans with (sum (mult_by_scalars x0 (Map_embed x1)) +' (zero V));
auto with algebra.
apply SGROUP_comp; auto with algebra.
unfold mult_by_scalars in |- *.
simpl in |- *.
apply GROUP_reg_right with (x0 x3 mX subtype_elt (x1 x3)).
apply Trans with (x0 x3 mX subtype_elt (x1 x3)); auto with algebra.
apply
Trans
with
((min x0 x2 mX subtype_elt (x1 x2)) +'
(x0 x2 +' x0 x3) mX subtype_elt (x1 x2) +'
((min x0 x3 mX subtype_elt (x1 x3)) +' x0 x3 mX subtype_elt (x1 x3)));
auto with algebra.
apply
Trans
with
((min x0 x2 mX subtype_elt (x1 x2)) +'
(x0 x2 +' x0 x3) mX subtype_elt (x1 x2) +' (zero V));
auto with algebra.
apply
Trans
with
((min x0 x2 mX subtype_elt (x1 x2)) +'
(x0 x2 +' x0 x3) mX subtype_elt (x1 x2)); auto with algebra.
(* mind the change x3->x2 *)
apply Trans with (x0 x3 mX subtype_elt (x1 x2)); auto with algebra.
apply
Trans
with
((min x0 x2) mX subtype_elt (x1 x2) +'
(x0 x2 +' x0 x3) mX subtype_elt (x1 x2)); auto with algebra.
apply Trans with (((min x0 x2) +' (x0 x2 +' x0 x3)) mX subtype_elt (x1 x2));
auto with algebra.
apply MODULE_comp; auto with algebra.
apply Trans with ((min x0 x2) +' x0 x2 +' x0 x3); auto with algebra.
apply Trans with ((zero F) +' x0 x3); auto with algebra.
apply SGROUP_comp; auto with algebra.
apply GROUP_comp; auto with algebra.
unfold mult_by_scalars in |- *.
apply Trans with (modify_seq x0 x2 (x0 x2 +' x0 x3) x3 mX Map_embed x1 x3);
auto with algebra.
apply MODULE_comp; auto with algebra.
apply Sym.
apply modify_seq_modifies_one_elt; auto with algebra.
unfold mult_by_scalars in |- *.
apply sum_comp.
apply toMap.
apply pointwise_comp; auto with algebra.
change (omit (Map_embed x1) x3 =' Map_embed (omit x1 x3) in _) in |- *.
apply omit_Map_embed.
Qed.
(** - Similarly easy to see, not easy to prove: if $B=\{b_0...b_{n-1}\}$, then any linear combination $x=\sum_{i=0}^{p-1} a_i b_{k_i}$ can be written as $x=\sum_{i=01}^{n-1} a_ib_i$*)

Lemma lin_comb_condensed :
forall (F : field) (V : vectorspace F) (B : part_set V)
(n : Nat) (b : seq n V),
B =' seq_set b in _ ->
forall x : V,
is_lin_comb x B -> exists a : seq n F, x =' sum (mult_by_scalars a b) in _.