Ltac use_entries_match :=
    match goal with
      | [ _ : eIndex ?e1 = eIndex ?e2,
              H : context [entries_match]
                              |- _ ] =>
        first [ solve [eapply H with (e:=e2)(e':=e1); eauto; congruence] |
                solve [eapply H with (e:=e1)(e':=e2); eauto; congruence]]
    end.

Lemma contiguous_sorted_subset_prefix : forall l1 l2 i, contiguous_range_exact_lo l1 i -> contiguous_range_exact_lo l2 i -> sorted l1 -> sorted l2 -> (forall e, In e l1 -> In e l2) -> Prefix (rev l1) (rev l2).