Proof using.
intros.
unfold handleRequestVoteReply, advanceCurrentTerm in *.
repeat break_match; try find_inversion; subst; simpl in *; intuition;
do_bool; intuition; try right; congruence.
Qed.

Lemma handleRequestVoteReply_spec' :
forall h st h' t r st',
st' = handleRequestVoteReply h st h' t r ->
log st' = log st /\
(forall v, In v (votesReceived st) -> In v (votesReceived st')) /\
(type st <> Leader /\ type st' = Leader ->
(type st = Candidate /\ wonElection (dedup name_eq_dec
(votesReceived st')) = true) /\
r = true /\
currentTerm st' = currentTerm st /\
currentTerm st = t /\
votesReceived st' = (h' :: (votesReceived st))).