Section VotesReceivedMoreUpToDate.
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 {rvrmutdi : requestVoteReply_moreUpToDate_interface}.
Proof using.
red. unfold votesReceived_moreUpToDate. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto;
try rewrite votesWithLog_same_append_entries; eauto;
find_copy_apply_lem_hyp handleAppendEntries_votesReceived;
find_apply_lem_hyp handleAppendEntries_log_term_type;
intuition; repeat find_rewrite; try congruence;
eauto;
rewrite votesWithLog_same_append_entries;
eauto.
Qed.
Proof using.
red. unfold votesReceived_moreUpToDate. intros. simpl in *.
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.
Proof using.
red. unfold votesReceived_moreUpToDate. intros. simpl in *.
find_copy_apply_lem_hyp handleRequestVote_votesReceived.
find_copy_apply_lem_hyp handleRequestVote_log_term_type.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto;
intuition; try congruence; repeat find_rewrite; eauto;
copy_eapply_prop_hyp In In; eauto;
try rewrite <- plus_n_O in *;
break_exists_exists; intuition;
eauto using update_elections_data_request_vote_votesWithLog_old.
Qed.
Proof using rvrmutdi.
red. unfold votesReceived_moreUpToDate. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
- erewrite handleRequestVoteReply_log; eauto.
find_copy_eapply_lem_hyp handleRequestVoteReply_log_term_type; eauto.
intuition.
repeat find_rewrite.
find_apply_lem_hyp handleRequestVoteReply_votesReceived.
rewrite update_elections_data_request_vote_reply_votesWithLog.
intuition; eauto.
repeat find_rewrite. subst.
find_eapply_lem_hyp requestVoteReply_moreUpToDate_invariant; eauto.
- erewrite handleRequestVoteReply_log; eauto.
find_copy_eapply_lem_hyp handleRequestVoteReply_log_term_type; eauto.
intuition.
repeat find_rewrite.
find_apply_lem_hyp handleRequestVoteReply_votesReceived.
intuition; eauto.
repeat find_rewrite. subst.
find_eapply_lem_hyp requestVoteReply_moreUpToDate_invariant; eauto.
- rewrite update_elections_data_request_vote_reply_votesWithLog.
eauto.
Qed.
Proof using.
red. unfold votesReceived_moreUpToDate. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
- find_eapply_lem_hyp update_elections_data_timeout_votesWithLog_votesReceived; eauto.
intuition; try congruence.
repeat find_rewrite. simpl in *. intuition. subst.
exists (log d). intuition. auto using moreUpToDate_refl.
- find_eapply_lem_hyp update_elections_data_timeout_votesWithLog_votesReceived; eauto.
intuition; try congruence.
repeat find_rewrite. simpl in *. intuition.
- eapply_prop_hyp Candidate Candidate; eauto.
break_exists_exists. intuition.
apply update_elections_data_timeout_votesWithLog_old.
try rewrite <- plus_n_O in *. auto.
Qed.

Lemma votesReceived_moreUpToDate_client_request :
refined_raft_net_invariant_client_request votesReceived_moreUpToDate.