Proof using.
intros.
unfold cacheApplyEntry in *.
repeat break_match; try find_inversion; simpl in *; repeat find_rewrite; eauto.
- do_bool.
unfold applyEntry in *.
repeat break_match; find_inversion.
unfold getLastId in *. simpl in *.
destruct (clientId_eq_dec (eClient e) c); subst.
+ rewrite get_set_same. find_rewrite.
find_inversion. eauto.
+ rewrite get_set_diff in *; auto.
repeat find_rewrite. eauto.
- unfold applyEntry in *.
repeat break_match; find_inversion.
unfold getLastId in *. simpl in *.
destruct (clientId_eq_dec (eClient e) c); subst.
+ repeat find_rewrite.  congruence.
+ rewrite get_set_diff in *; auto.
repeat find_rewrite. eauto.
Qed.

(* Specifications: *)
Lemma cacheAppliedEntry_clientCache_nondecreasing :
forall st e l st' c i o i' o',
cacheApplyEntry st e = (l, st') ->
getLastId st c = Some (i, o) ->
getLastId st' c = Some (i', o') ->
i <= i'.