Proof using.
intros; induction l; simpl in *; intuition eauto using app_nil_r.
break_exists. break_if; [exists nil; eauto|].
do_bool.
match goal with
| l : list entry, e : entry |- _ =>
solve [exists (e :: l); simpl in *; f_equal; auto]
end.
Qed.

(* Specifications: *)
Lemma entries_match_scratch :
forall es ys plt,
sorted es ->
uniqueIndices ys ->
(forall e1 e2,
eIndex e1 = eIndex e2 ->
eTerm e1 = eTerm e2 ->
In e1 es ->
In e2 ys ->
(forall e3,
eIndex e3 <= eIndex e1 ->
In e3 es ->
In e3 ys) /\
(0 <> 0 ->
exists e4,
eIndex e4 = 0 /\
eTerm e4 = plt /\
In e4 ys)) ->
(forall i, 0 < i <= maxIndex es -> exists e, eIndex e = i /\ In e es) ->
(forall e,
In e es ->
0 < eIndex e) ->
(forall y, In y ys -> 0 < eIndex y) ->
entries_match es ys.