Section LeadersHaveLeaderLogsStrong.
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}.
Proof using.
intros.
unfold handleRequestVoteReply, advanceCurrentTerm in *.
repeat break_match; try find_inversion; subst; simpl in *; intuition.
Qed.
Ltac start :=
red; unfold leaders_have_leaderLogs_strong; intros;
subst; simpl in *; find_higher_order_rewrite;
update_destruct; subst; rewrite_update; eauto; simpl in *.
Proof using.
intros. unfold handleAppendEntries, advanceCurrentTerm in *.
repeat break_match; find_inversion; auto.
Qed.
Proof using.
intros. unfold handleAppendEntriesReply, advanceCurrentTerm in *.
repeat break_match; find_inversion; auto.
Qed.
Proof using.
intros. unfold handleRequestVote, advanceCurrentTerm in *.
repeat break_match; find_inversion; auto.
Qed.
Proof using.
intros. unfold handleClientRequest in *.
repeat break_match; find_inversion; intuition eauto.
simpl in *. right. eexists; simpl in *; intuition eauto.
reflexivity.
Qed.
Proof using.
intros. unfold handleTimeout, tryToBecomeLeader in *.
repeat break_match; find_inversion; auto.
Qed.
Proof using.
unfold doGenericServer.
intros.
repeat break_match; repeat find_inversion;
use_applyEntries_spec; subst; simpl in *;
auto.
Qed.
Proof using.
intros. unfold doLeader in *.
repeat break_match; find_inversion; auto.
Qed.
Proof using.
unfold update_elections_data_client_request in *.
intros. repeat break_match; repeat find_inversion; auto.
Qed.
Proof using.
unfold update_elections_data_timeout.
intros.
repeat break_match; simpl in *; auto.
Qed.
Proof using.
intros.
unfold update_elections_data_appendEntries.
repeat break_match; subst; simpl in *; auto.
Qed.
Proof using.
unfold update_elections_data_requestVote.
intros.
repeat break_match; auto.
Qed.
Proof using.
start.
find_copy_apply_lem_hyp handleAppendEntries_type.
rewrite update_elections_data_appendEntries_leaderLogs.
intuition; try congruence; subst;
repeat find_rewrite; eauto.
Qed.
Proof using.
start.
find_apply_lem_hyp handleAppendEntriesReply_type. intuition; try congruence.
repeat find_rewrite. eauto.
Qed.
Proof using.
start.
find_apply_lem_hyp handleRequestVote_type. intuition; try congruence.
rewrite update_elections_data_requestVote_leaderLogs.
repeat find_rewrite. eauto.
Qed.
Proof using.
start.
unfold update_elections_data_requestVoteReply.
break_match; unfold raft_data in *;
try solve [repeat find_rewrite; congruence].
simpl in *.
match goal with
| |- context [ handleRequestVoteReply ?h ?st ?s ?t ?v ] =>
pose proof handleRequestVoteReply_spec h st s t v (handleRequestVoteReply h st s t v)
end. intuition; break_if; intuition; simpl in *; repeat find_rewrite; eauto; try congruence.
eexists. exists []. intuition eauto. simpl in *. intuition.
Qed.

Lemma leaders_have_leaderLogs_strong_clientRequest :
refined_raft_net_invariant_client_request leaders_have_leaderLogs_strong.