(* 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 :  seq\_equality\_facts.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export seq_equality.
Require Export concat_facts.
Require Export omit.
Require Export Classical_Prop.
(** - Some useful lemmas concerning seq_equal *)
intros.
red in H.
apply NNPP; intro.
assert (n < m \/ m < n).
apply nat_total_order; auto with algebra.
inversion_clear H1.
generalize (H n); clear H; intro.
inversion_clear H.
inversion_clear H1.
apply (lt_irrefl n); auto with algebra.
inversion_clear H1.
apply (lt_not_le n m); auto with algebra.
generalize (H m); clear H; intro.
inversion_clear H.
inversion_clear H1.
inversion_clear H.
apply (lt_irrefl m); auto with algebra.
inversion_clear H1.
apply (le_not_lt n m); auto with algebra.
Qed.
Hint Resolve seq_equal_length_equal: algebra.
intros.
red in H.
destruct i.
rename index into i.
destruct j.
rename index into j.
simpl in H0.
case (H i); clear H; intros.
inversion_clear H.
inversion_clear H1.
apply Trans with (v (Build_finiteT x)); auto with algebra.
apply Trans with (w (Build_finiteT x0)); auto with algebra.
inversion_clear H.
apply False_ind.
apply (le_not_lt n i); auto with algebra.
Qed.
Hint Resolve seq_equal_equal_elements: algebra.
intros.
red in H.
case (H 0); clear H; intros.
inversion_clear H; inversion_clear H0.
apply Trans with (v (Build_finiteT x)); auto with algebra.
apply Trans with (w (Build_finiteT x0)); auto with algebra.
inversion_clear H; inversion_clear H0.
Qed.
Hint Resolve seq_equal_head: algebra.

Lemma seq_equal_seqtl :
forall (A : Setoid) (n m : Nat) (v : seq n A) (w : seq m A),
seq_equal v w -> seq_equal (Seqtl v) (Seqtl w).