Proof using cci.
red. unfold CandidateEntries. intros. intuition.
- unfold candidateEntries_host_invariant in *.
intros. simpl in *. eapply candidateEntries_ext; eauto.
repeat find_higher_order_rewrite.
find_rewrite_lem update_fun_comm. simpl in *.
update_destruct.
+ subst. rewrite_update.
match goal with
| |- context [handleRequestVoteReply ?h ?st ?h' ?t ?r] =>
remember (handleRequestVoteReply h st h' t r) as new_state
end.
find_copy_apply_lem_hyp handleRequestVoteReply_spec. break_and.
match goal with
| H : log _ = log _ |- _ => rewrite H in *
end.
find_apply_hyp_hyp.
eapply handleRequestVoteReply_preserves_candidate_entries; eauto.
+ rewrite_update.
eapply handleRequestVoteReply_preserves_candidate_entries; eauto.
- unfold candidateEntries_nw_invariant in *.
intros. simpl in *. eapply candidateEntries_ext; eauto.
repeat find_higher_order_rewrite.
eapply handleRequestVoteReply_preserves_candidate_entries; eauto.
Qed.

Lemma doLeader_in_entries :
forall (h : name) d h os d' ms m t li pli plt es ci e,
doLeader d h = (os, d', ms) ->
snd m = AppendEntries t li pli plt es ci ->
In m ms ->
In e es ->
In e (log d).