Section RequestVoteReplyMoreUpToDate.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {rri : raft_refinement_interface}.
Context {rvmimti : requestVote_maxIndex_maxTerm_interface}.
Context {rvrtsi : requestVoteReply_term_sanity_interface}.
Context {vfmutdi : votedFor_moreUpToDate_interface}.
Proof using.
red. unfold requestVoteReply_moreUpToDate. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
assert (In p0 (nwPackets net)) by
(find_apply_hyp_hyp; repeat find_rewrite; intuition; [in_crush|];
exfalso; subst; simpl in *; subst;
unfold handleAppendEntries in *;
repeat break_match; find_inversion).
repeat find_rewrite.
destruct_update; simpl in *; eauto;
try rewrite votesWithLog_same_append_entries; eauto;
find_apply_lem_hyp handleAppendEntries_log_term_type;
intuition; repeat find_rewrite; try congruence;
eauto.
Qed.
Proof using.
red. unfold requestVoteReply_moreUpToDate. intros. simpl in *.
assert (In p0 (nwPackets net)) by
(repeat find_rewrite;
find_apply_lem_hyp handleAppendEntriesReply_packets;
subst; simpl in *; find_apply_hyp_hyp; intuition; in_crush).
repeat find_rewrite.
find_copy_apply_lem_hyp handleAppendEntriesReply_votesReceived.
find_copy_apply_lem_hyp handleAppendEntriesReply_log_term_type.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto;
intuition; try congruence; repeat find_rewrite; eauto.
Qed.

Lemma requestVoteReply_moreUpToDate_request_vote :
refined_raft_net_invariant_request_vote requestVoteReply_moreUpToDate.