(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(** * maxlinindepsubsets.v *)
Set Implicit Arguments.
Unset Strict Implicit.
(** - This file would be the book's chapter 1.7. It doesn't have the last place in the dependency graph (and hence in the coqdoc-generated documentation you may be reading now): the ``finite'' stuff of 1.6 isn't needed. Finiteness is usually harder to do in type theory than more general number-agnostic stuff---and this file goes to show, I guess... *)
Require Export bases.
Require Export lin_dep_facts.
Section defs.
Variable X : Setoid.
(** - ``B properly contains A'' means $A\subset B$ and $A\neq B$, so ``no member of F properly contains A'' is $\not\exists B\in F. A\subset B\wedge A\neq B$: *)
Definition maximal (F : part_set (part_set X)) (A : part_set X) :=
in_part A F /\
~ (exists B : part_set X, in_part B F /\ included A B /\ ~ A =' B in _).
Definition is_chain (F : part_set (part_set X)) :=
forall A B : part_set X,
in_part A F -> in_part B F -> included A B \/ included B A.
(** - Quoting the Maximal Principle from page 50:  Let $\cal F$ be a family of sets. If for each chain $\cal C\subset \cal F$ there exists a member of $\cal F$ that contains each member of $\cal C$, then $\cal F$ contains a maximal element.*)
(** %\tocdef{MAXIMAL\_PRINCIPLE}% *)
Axiom
MAXIMAL_PRINCIPLE :
forall F : part_set (part_set X),
(forall C : part_set (part_set X),
is_chain C ->
included C F ->
exists A : part_set X,
in_part A F /\ (forall B : part_set X, in_part B C -> included B A)) ->
exists A : part_set X, maximal F A.
End defs.

(** - %\intoc{\bf Theorem 1.12}% says every maximally linearly independent subset of any generating set is a basis *)
Lemma max_lin_indep_subsets_of_generating_sets_are_bases :
forall (F : field) (V : vectorspace F) (W : part_set V),
generates W (full V) ->
forall beta : part_set V, max_lin_indep beta W -> is_basis beta.