Proof using.
intros. do_in_app. intuition.
match goal with
| H : sorted (?l ++ ?l'), _ : In _ ?l, _ : In _ ?l' |- _ =>
eapply sorted_app_in_in in H
end; eauto.  omega.
Qed.

(* Lemma sorted_app_in3_in4_prefix : forall l1 l2 l3 l4 e e', sorted (l1 ++ l3) -> sorted (l2 ++ l4) -> Prefix l4 l3 -> In e l3 -> In e' (l2 ++ l4) -> eIndex e' = eIndex e -> In e' l4. *)
Lemma sorted_term_index_le :
forall l e e',
sorted l ->
In e l ->
In e' l ->
eTerm e' < eTerm e ->
eIndex e' <= eIndex e.