Section prelim.
Variable F : field.
Variable V : vectorspace F.
intros.
unfold generates in H.
apply NNPP; intro.
red in H; apply H.
intro.
simpl in |- *; split; auto; intros _.
apply NNPP; intro.
red in H0; apply H0.
exists x.
simpl in |- *; auto.
Qed.
(** - Once we know that some subset of $V$ has an element, we must be able to get it if we want to prove theorem 1.11 - hence this axiom. It is a kind of choice principle, hence the name I gave it. I know AC+EM+impredicativity = inconsistency, but type isn't impredicative so we should be OK *)
Axiom
AC' :
forall S : part_set V,
(exists v : V, in_part v S) -> sigT (fun v : V => in_part v S).
intros.
cut (exists v : V, in_part v (compl S)); try intro.
generalize (AC' H0).
intro.
destruct X.
exists x.
simpl in i.
auto.
simpl in |- *.
auto.
Qed.
(** - 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)).
intros.
generalize (dec_gen (seq_set v)).
intro.
inversion_clear H0.
exists k.
exists v.
auto.
exists (S k).
generalize dependent (ACcomplement (not_generates_then_leaves_over H1)).
intro.
destruct X.
exists (x;; v).
inversion_clear H; split.
elim (lin_dep_vs_span_lemma H0 (x:=x)).
intros.
apply lin_indep_comp with (union (seq_set v) (single x)); auto with algebra.
red in |- *; intro p; generalize dependent (H p).
auto.
generalize dependent set_included_in_its_span.
unfold included in |- *.
intros; intro; red in n; apply n.
apply in_part_comp_r with (span (seq_set v):part_set V); auto with algebra.
apply distinct_cons.
auto.
intros.
intro.
red in n.
apply n.
apply in_part_comp_r with (span (seq_set v):part_set V); auto with algebra.
apply set_included_in_its_span.
exists i.
auto.
Defined.
(** - It has the desired properties: *)

Lemma extend_prop :
forall (k : Nat) (v : seq k V) (H : lin_indep (seq_set v) /\ distinct v),
match try_extend H with
| existT i _ =>
(i =' k in _ <-> span (seq_set v) =' full V in part_set V) /\
(i =' S k in _ <-> ~ span (seq_set v) =' full V in part_set V)
end.