Proof using.
intros.
eapply cacheAppliedEntry_clientCache_preserved in H; eauto.
break_exists. intuition. repeat find_rewrite. find_inversion. auto.
Qed.

Lemma applyEntries_output_correct :
forall l c i o h st os st' es,
applyEntries h st l = (os, st') ->
in_output_list c i o os ->
(stateMachine st = snd (execute_log (deduplicate_log es))) ->
(forall c i o,
getLastId st c = Some (i, o) ->
output_correct c i o es) ->
(forall c i o e',
getLastId st c = Some (i, o) ->
In e' es -> eClient e' = c -> eId e' <= i) ->
(forall e',
In e' es ->
exists i o,
getLastId st (eClient e') = Some (i, o) /\ eId e' <= i) ->
output_correct c i o (es ++ l).