Proof using.
unfold refined_raft_net_invariant_append_entries_reply. intros.
unfold cronies_correct in *; intuition.
- unfold votes_received_cronies, handleAppendEntriesReply, advanceCurrentTerm in *.
intros. simpl in *.
repeat break_match; repeat find_inversion; subst; simpl in *; eauto;
repeat find_higher_order_rewrite; repeat (break_if; simpl in *); intuition; try congruence.
- unfold cronies_votes in *. intros.
simpl in *. repeat find_higher_order_rewrite.
repeat break_match; subst; simpl in *; eauto.
- unfold votes_nw in *. intros. simpl in *.
assert (In p0 (xs ++ ys)) by eauto using handleAppendEntriesReply_rvr.
assert (In p0 (nwPackets net)) by (repeat find_rewrite; in_crush).
repeat find_apply_hyp_hyp.
repeat find_higher_order_rewrite.
repeat break_match; subst; repeat find_rewrite; simpl in *; intuition.
- unfold votes_received_leaders in *. intros. simpl in *.
repeat find_higher_order_rewrite. repeat break_if; eauto.
subst. simpl in *. unfold handleAppendEntriesReply, advanceCurrentTerm in *.
repeat break_match; find_inversion; subst; simpl in *;
try discriminate; eauto.
Qed.

Lemma handleRequestVote_true_votedFor :
forall h st t src lli llt d t',
handleRequestVote h st t src lli llt = (d, RequestVoteReply t' true) ->
currentTerm d = t' /\ votedFor d = Some src.