Proof using.
induction l; intros; simpl in *; intuition.
- destruct l'; simpl in *; intuition; subst; intuition.
find_apply_hyp_hyp. intuition.
- do_in_app. intuition. right. eapply IHl; eauto.
intuition.
Qed.

Lemma contiguous_app_prefix_contiguous :
forall l1 l2 l2' i,
Prefix l2 l2' ->
sorted (l1 ++ l2) ->
contiguous_range_exact_lo (l1 ++ l2) i ->
(l2 <> [] \/ i = maxIndex l2') ->
contiguous_range_exact_lo l1 (maxIndex l2').