(* 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                                                     *)
(** * lin_dep_facts.v *)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export lin_dependence.
Require Export lin_comb_facts.
Require Export subseqs.
Require Export seq_set_facts.
Require Export distinct_facts.
(** - If $a_i\neq0$ and $\sum_ka_kv_k=0$, then $v_i=-a_i^{-1}\sum_{k\neq i}a_kv_k$ *)
intros.
assert
(a i mX v i ='
a i mX field_inverse (a i) mX (min sum (omit (mult_by_scalars a v) i)) in _).
apply Trans with (mult_by_scalars a v i); auto with algebra.
apply
Trans
with
((a i rX field_inverse (a i)) mX (min sum (omit (mult_by_scalars a v) i)));
auto with algebra.
apply Trans with (one mX (min sum (omit (mult_by_scalars a v) i)));
auto with algebra.
apply Trans with (min sum (omit (mult_by_scalars a v) i)); auto with algebra.
assert
(mult_by_scalars a v i +' sum (omit (mult_by_scalars a v) i) ='
(zero V) in _).
apply Trans with (sum (mult_by_scalars a v)); auto with algebra.
apply Sym.
apply
(seqsum_is_elt_plus_omitseq (M:=V:abelian_monoid) (mult_by_scalars a v)).
2: apply MODULE_comp; auto with algebra.
2: apply Sym.
2: apply FIELD_inverse_r; auto with algebra.
apply Sym.
apply GROUP_law_inverse.
apply Trans with (sum (mult_by_scalars a v)); auto with algebra.
apply
Trans with (mult_by_scalars a v i +' sum (omit (mult_by_scalars a v) i));
auto with algebra.
apply Sym.
apply
(seqsum_is_elt_plus_omitseq (M:=V:abelian_monoid) (mult_by_scalars a v));
auto with algebra.
set (expr := field_inverse (a i) mX (min sum (omit (mult_by_scalars a v) i)))
in *.
cut (one mX v i =' one mX expr in _).
intro.
apply Trans with (one mX expr); auto with algebra.
apply Trans with (one mX v i); auto with algebra.
apply Trans with ((field_inverse (a i) rX a i) mX v i).
apply MODULE_comp; auto with algebra.
apply Sym.
auto with algebra.
apply Trans with ((field_inverse (a i) rX a i) mX expr); auto with algebra.
apply Trans with (field_inverse (a i) mX a i mX expr); auto with algebra.
apply Trans with (field_inverse (a i) mX a i mX v i); auto with algebra.
Qed.

(** - If $y\in W\cup\{x\}$ but $y\neq x$ then $y\in W$ *)
Lemma another_small_lemma :
forall (V : Setoid) (W : part_set V) (x : V),
let Wx := union W (single x) in
forall y : Wx, ~ subtype_elt y =' x in _ -> in_part (subtype_elt y) W.