(* 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                                                     *)
(** %\subsection*{ support :  omit\_facts.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
From Algebra Require Field_facts.
Export Sets Categories Parts Sgroup_cat Monoid_cat Group_cat Abelian_group_cat Ring_cat.
Export Field_facts.
From Algebra Require Ring_facts.
Export Ring_facts.
From Algebra Require Export Field_cat.
Require Export seq_equality_facts.
Require Export sums.
Require Export mult_by_scalars.
destruct n.
simpl in |- *.
red in |- *; auto with algebra.
destruct n.
intros; (apply Trans with (empty_seq M); auto with algebra).
auto with algebra.
Qed.
Hint Resolve omit_head_is_seqtl: algebra.
simple induction n.
intros A v m.
case m.
intros.
apply Trans with (head v;; empty_seq A); auto with algebra.
intros.
inversion H.
inversion H1.
intros.
apply Trans with (head v;; omit (Seqtl v) (Build_finiteT (lt_S_n _ _ HS)));
auto with algebra.
change
(head v;; omit (Seqtl v) (Build_finiteT (lt_S_n m (S (S n0)) HS)) ='
head v;; omit (Seqtl v) (Build_finiteT H0) in seq (S (S n0)) A)
in |- *.
apply cons_comp; auto with algebra.
Qed.
Hint Resolve omit_tlelt: algebra.
(** - The above also holds for seqs of length (S n), but since the types become non-convertible then, we have to do a cast_seq or use seq_equal. *)
destruct n.
intros; inversion_clear Heq.
intros.
apply Trans with (head v;; omit (Seqtl v) (Build_finiteT H));
auto with algebra.
Qed.
Hint Resolve omit_tlelt': algebra.
intros.
apply
seq_equal_trans
with
(pred (S n))
(cast_seq (head v;; omit (Seqtl v) (Build_finiteT H)) Heq);
auto with algebra.
apply Map_eq_seq_equal; auto with algebra.
Qed.
Hint Resolve omit_tlelt'': algebra.

Lemma omit_concat_first_part :
forall (n m : Nat) (A : Setoid) (v : seq (S n) A)
(w : seq m A) (i : Nat) (Hi : i < S n) (Hi' : i < S n + m),
omit (v ++ w) (Build_finiteT Hi') =' omit v (Build_finiteT Hi) ++ w in _.