simple induction n; intros.
inversion_clear j; inversion_clear in_range_prf.
red in H0.
elim i.
intro x; case x; intros.
cut (~ Seqtl v j =' v (Build_finiteT in_range_prf) in _).
case j.
intros.
cut
(~
v (Build_finiteT (lt_n_S _ _ in_range_prf0)) ='
v (Build_finiteT in_range_prf) in _).
intros.
cut
(~
Build_finiteT (lt_n_S index (S n0) in_range_prf0) ='
Build_finiteT in_range_prf in fin _).
intro.
red in H2; red in |- *.
auto with algebra.
simpl in |- *.
auto.
auto with algebra.
case j.
intros x0 l.
cut
(~ v (Build_finiteT (lt_n_S _ _ l)) =' v (Build_finiteT in_range_prf) in _).
unfold not in |- *; auto with algebra.
cut
(~ Build_finiteT (lt_n_S x0 (S n0) l) =' Build_finiteT in_range_prf in fin _).
intro.
apply H0; auto with algebra.
red in |- *.
simpl in |- *.
intro.
inversion H1.
red in |- *; intro.
cut
((head v;; omit (Seqtl v) (Build_finiteT (lt_S_n _ _ in_range_prf))) j ='
v (Build_finiteT in_range_prf) in _).
case j.
intro x0.
case x0.
intro l.
intro.
cut (head v =' v (Build_finiteT in_range_prf) in _).
intro.
unfold head in H3.
red in H0.
apply H0 with (Build_finiteT (lt_O_Sn (S n0))) (Build_finiteT in_range_prf);
auto with algebra.
simpl in |- *.
auto.
apply
Trans
with
((head v;; omit (Seqtl v) (Build_finiteT (lt_S_n n1 (S n0) in_range_prf)))
(Build_finiteT l)); auto with algebra.
intros n2 l H2.
cut
(omit (Seqtl v) (Build_finiteT (lt_S_n n1 (S n0) in_range_prf))
(Build_finiteT (lt_S_n _ _ l)) =' v (Build_finiteT in_range_prf) in _).
intro.
cut
(omit (Seqtl v) (Build_finiteT (lt_S_n n1 (S n0) in_range_prf))
(Build_finiteT (lt_S_n _ _ l)) ='
Seqtl v (Build_finiteT (lt_S_n _ _ in_range_prf)) in _).
intro.
red in H.
cut (distinct (Seqtl v)).
intro.
apply
H
with
(Seqtl v)
(Build_finiteT (lt_S_n n1 (S n0) in_range_prf))
(Build_finiteT (lt_S_n n2 n0 l)); auto with algebra.
apply Seqtl_preserves_distinct; auto with algebra.
apply Trans with (v (Build_finiteT in_range_prf)); auto with algebra.
apply
Trans
with
((head v;; omit (Seqtl v) (Build_finiteT (lt_S_n n1 (S n0) in_range_prf)))
(Build_finiteT l)); auto with algebra.
apply Trans with (omit v (Build_finiteT in_range_prf) j); auto with algebra.
Qed.

Lemma Map_embed_preserves_distinct :
forall (A : Setoid) (n : Nat) (B : part_set A) (v : seq n B),
distinct v -> distinct (Map_embed v).