(* 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                                                     *)
(** * bases_finite_dim.v *)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export bases_from_generating_sets.
Require Export replacement_corollaries.
(** %\tocdef{is\_{\em[in]}finite\_dimensional}% *)
Definition is_finite_dimensional (F : field) (V : vectorspace F) :=
exists beta : basis V, (exists n : Nat, has_n_elements n beta).
Definition is_infinite_dimensional (F : field) (V : vectorspace F) :=
forall (beta : basis V) (n : Nat), ~ has_n_elements n beta.
(** %\tocdef{has\_dim}% *)
Definition has_dim (F : field) (n : Nat) (V : vectorspace F) :=
exists beta : basis V, has_n_elements n beta.
intros.
inversion_clear H.
rename x into beta.
inversion_clear H0.
inversion_clear H.
rename x into n.
exists n.
red in |- *.
exists beta; auto.
red in |- *.
exists x0; auto.
Qed.
intros.
inversion_clear H.
inversion_clear H0.
assert (has_n_elements m x).
apply all_finite_bases_equally_big with x0; auto with algebra.
generalize has_n_elements_inj; intro p.
apply (p _ _ _ H1 _ _ H0); auto with algebra.
Qed.

Lemma has_dim_easy :
forall (F : field) (V : vectorspace F) (b : part_set V),
is_basis b -> forall n : nat, has_n_elements n b -> has_dim n V.