induction n.
intros.
destruct i as [| n].
2: inversion_clear Hi.
2: inversion_clear H.
apply Trans with (Seqtl (v ++ w)); auto with algebra.
apply Trans with (Seqtl v ++ w); auto with algebra.
intros.
destruct i as [| n0].
apply Trans with (Seqtl (v ++ w)); auto with algebra.
apply Trans with (Seqtl v ++ w); auto with algebra.
apply
Trans
with
(head (v ++ w);;
omit (Seqtl (v ++ w)) (Build_finiteT (lt_S_n _ (S (n + m)) Hi')));
auto with algebra.
apply
Trans with ((head v;; omit (Seqtl v) (Build_finiteT (lt_S_n _ _ Hi))) ++ w);
auto with algebra.
apply
Trans
with
(head v;;
omit (Seqtl (v ++ w)) (Build_finiteT (lt_S_n _ (S (n + m)) Hi')));
auto with algebra.
apply
Trans
with (head v;; omit (Seqtl v) (Build_finiteT (lt_S_n n0 (S n) Hi)) ++ w).
2: change
(head v;; omit (Seqtl v) (Build_finiteT (lt_S_n n0 (S n) Hi)) ++ w ='
(head v;; omit (Seqtl v) (Build_finiteT (lt_S_n n0 (S n) Hi))) ++ w
in seq (S (n + m)) A) in |- *.
2: apply cons_concat_special.
change
(head v;; omit (Seqtl (v ++ w)) (Build_finiteT (lt_S_n n0 (S (n + m)) Hi')) ='
head v;; omit (Seqtl v) (Build_finiteT (lt_S_n n0 (S n) Hi)) ++ w
in seq (S (n + m)) A) in |- *.
apply cons_comp; auto with algebra.
apply
Trans with (omit (Seqtl v ++ w) (Build_finiteT (lt_S_n n0 (S (n + m)) Hi'))).
change
(omit (Seqtl (v ++ w)) (Build_finiteT (lt_S_n n0 (S (n + m)) Hi')) ='
omit (Seqtl v ++ w) (Build_finiteT (lt_S_n n0 (S (n + m)) Hi'))
in seq (pred (S (n + m))) A) in |- *.
apply omit_comp; auto with algebra.
change
(omit (Seqtl v ++ w) (Build_finiteT (lt_S_n n0 (S (n + m)) Hi')) ='
omit (Seqtl v) (Build_finiteT (lt_S_n n0 (S n) Hi)) ++ w
in seq (pred (S n + m)) A) in |- *.
apply (IHn m A (Seqtl v) w).
Qed.
Hint Resolve omit_concat_first_part: algebra.
(** - The following also comes in two guises. It is again an equation between two sequences of equal but non-convertible length. The first formulation uses the external (not inherited from any setoid) equality seq_equal, the second does a cast_seq in the appropriate places *)

Lemma omit_concat_second_part' :
forall (n m : Nat) (A : Setoid) (v : seq n A) (w : seq m A)
(i : Nat) (Hi : i < m) (Hi' : n + i < n + m)
(H : n + pred m = pred (n + m)),
seq_equal (omit (v ++ w) (Build_finiteT Hi'))
(v ++ omit w (Build_finiteT Hi)).