Proof using.
intros.
apply applied_entries_log_lastApplied_same.
- intros. update_destruct; subst; rewrite_update; auto.
eapply doLeader_same_log; eauto.
- intros. update_destruct; subst; rewrite_update; auto.
unfold doLeader in *. repeat break_match; find_inversion; auto.
Qed.

(* Specifications: *)
Lemma applyEntries_spec :
forall es h st os st',
applyEntries h st es = (os, st') ->
exists d cc,
st' = {[ {[ st with stateMachine := d ]} with clientCache := cc ]}.