Proof using.
induction l; intros; simpl in *; intuition.
- find_inversion. auto.
- repeat break_let. find_inversion.
repeat break_match; simpl in *.
+ break_let.
rewrite snd_execute_log'_nil.
find_apply_hyp_hyp. do_bool.
find_apply_lem_hyp clientCache_to_ks_assoc_getLastId.
break_exists.
find_copy_eapply_lem_hyp cacheApplyEntry_stateMachine_apply;
[|eauto|idtac|]; eauto. subst.
find_eapply_lem_hyp cacheApplyEntry_cache_apply; eauto.
erewrite clientCache_to_ks_assoc_set.
rewrite Heqp1. eauto.
+ do_bool.
find_apply_hyp_hyp.
find_apply_lem_hyp clientCache_to_ks_assoc_getLastId.
break_exists.
break_exists.
find_copy_eapply_lem_hyp cacheApplyEntry_stateMachine_no_apply; eauto.
find_eapply_lem_hyp cacheApplyEntry_cache_no_apply; eauto.
repeat find_rewrite. auto.
+ break_let.
rewrite snd_execute_log'_nil.
find_apply_hyp_hyp. do_bool.
find_apply_lem_hyp clientCache_to_ks_assoc_getLastId_none.
break_exists.
find_copy_eapply_lem_hyp cacheApplyEntry_stateMachine_apply_none; eauto.
subst.
find_eapply_lem_hyp cacheApplyEntry_cache_apply_none; eauto.
erewrite clientCache_to_ks_assoc_set.
rewrite Heqp1. eauto.
Qed.

(* Specifications: *)
Lemma applyEntries_lastApplied_commitIndex_log :
forall l h st os st',
applyEntries h st l = (os, st') ->
lastApplied st' = lastApplied st /\
commitIndex st' = commitIndex st /\
log st' = log st.