Proof using.
intros. unfold cacheApplyEntry in *.
repeat break_match; try find_inversion; subst; auto; do_bool.
- unfold applyEntry in *.
break_let. find_inversion.
simpl in *.
match goal with
| H : context [assoc_set] |- _ =>
unfold getLastId in H; simpl in H
end.
destruct (clientId_eq_dec client (eClient e));
try now rewrite get_set_diff in *; auto.
subst. rewrite get_set_same in *.
find_inversion. repeat find_rewrite.
right. intuition. find_inversion.
omega.
- unfold applyEntry in *.
break_let. find_inversion.
simpl in *.
match goal with
| H : context [assoc_set] |- _ =>
unfold getLastId in H; simpl in H
end.
destruct (clientId_eq_dec client (eClient e));
try now rewrite get_set_diff in *; auto.
subst. rewrite get_set_same in *.
find_inversion. repeat find_rewrite.
right. intuition. congruence.
Qed.

Lemma applyEntries_app :
forall l h st os d l',
applyEntries h st (l ++ l') = (os, d) ->
exists os' os'' d',
applyEntries h st l = (os', d') /\
applyEntries h d' l' = (os'', d) /\
os = os' ++ os''.