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

Lemma extend_prop2 :
forall (k : Nat) (v : seq k V) (H : lin_indep (seq_set v) /\ distinct v),
match try_extend H with
| existT i (existT w H') =>
(i =' k in _ <-> seq_equal v w) /\
(i =' S k in _ -> seq_equal v (Seqtl w))
end.