Proof using.
unfold handleRequestVote.
intros.
repeat break_match; repeat find_inversion;
auto using handleRV_advanceCurrentTerm_preserves_candidateEntries.
- eapply candidateEntries_same; eauto;
intros;
repeat (rewrite update_fun_comm; simpl in * );
update_destruct; subst; rewrite_update;
auto using update_elections_data_requestVote_cronies_same.
- do_bool. intuition. congruence.
- unfold candidateEntries in *. break_exists. break_and. exists x.
simpl.
split.
+ rewrite update_fun_comm with (f := fst). simpl.
rewrite update_fun_comm with (f := cronies). simpl.
rewrite update_elections_data_requestVote_cronies_same.
update_destruct; subst; rewrite_update; auto.
+ rewrite update_fun_comm with (f := snd). simpl.
rewrite update_fun_comm with (f := currentTerm). simpl.
rewrite update_fun_comm with (f := type). simpl.
update_destruct; subst; rewrite_update; auto.
match goal with
| [ |- context [advanceCurrentTerm ?st ?t] ] =>
pose proof advanceCurrentTerm_same_or_type_follower st t
end.
intuition; try congruence.
repeat find_rewrite. auto.
Qed.

Lemma handleRequestVote_only_sends_RVR :
forall d h h' t lli llt d' m,
handleRequestVote h d t h' lli llt = (d', m) ->
is_request_vote_reply m.