simpl in |- *.
red in |- *.
intros.
split; intros.
simpl in |- *.
simpl in H.
inversion_clear H.
destruct x0.
case (classic (index < n)).
intro.
left.
exists (Build_finiteT H).
apply Trans with ((v ++ w) (Build_finiteT in_range_prf)); auto with algebra.
right.
assert (exists i : Nat, index = i + n).
clear H0 x w v A.
induction  m as [| m Hrecm].
assert (n + 0 = n); auto with arith.
rewrite H0 in in_range_prf.
absurd (index < n); auto.
assert (index < n + m \/ index = n + m).
apply le_lt_or_eq; auto with algebra.
assert (n + S m = S (n + m)); auto with arith.
rewrite H0 in in_range_prf.
auto with arith.
inversion_clear H0.
apply Hrecm; auto with algebra.
exists m.
apply trans_eq with (n + m); auto with arith.
inversion_clear H1.
assert (x0 < m).
apply plus_lt_reg_l with n.
replace (n + x0) with index.
auto.
transitivity (x0 + n); auto with arith.
exists (Build_finiteT H1).
generalize concat_second_part; intro p.
assert (irp' : n + x0 < n + m).
replace (n + x0) with (x0 + n); auto with arith.
rewrite <- H2; auto.
apply Trans with ((v ++ w) (Build_finiteT irp')); auto with algebra.
apply Trans with ((v ++ w) (Build_finiteT in_range_prf)); auto with algebra.
apply Ap_comp; auto with algebra.
simpl in |- *.
transitivity (x0 + n); auto with arith.
simpl in |- *.
simpl in H.
inversion_clear H.
inversion_clear H0.
destruct x0.
exists (Build_finiteT (lt_plus_trans _ _ m in_range_prf)).
apply Trans with (v (Build_finiteT in_range_prf)); auto with algebra.
inversion_clear H0.
destruct x0.
assert (n + index < n + m).
auto with arith.
exists (Build_finiteT H0).
apply Trans with (w (Build_finiteT in_range_prf)); auto with algebra.
Qed.

Lemma seq_set_head_or_tail :
forall (v : seq (S n) A) (a : A),
in_part a (seq_set v) -> ~ a =' head v in _ -> in_part a (seq_set (Seqtl v)).