Section LeaderLogsContiguous.
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 {lmi : log_matching_interface}.
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.
intros.
unfold handleRequestVoteReply, advanceCurrentTerm in *.
repeat break_match; try find_inversion; subst; simpl in *; intuition;
do_bool; intuition.
Qed.
Proof using.
intros.
unfold update_elections_data_requestVoteReply in *.
repeat break_match; intuition.
simpl in *.
match goal with
| |- context [handleRequestVoteReply ?h ?s ?h' ?t ?r] =>
pose proof handleRequestVoteReply_spec
h s h' t r (handleRequestVoteReply h s h' t r)
end. intuition; repeat find_rewrite; intuition.
congruence.
Qed.
Proof using lmi rri.
intros.
eapply lift_prop; eauto using log_matching_invariant.
Qed.
Proof using lmi rri.
intros.
find_apply_lem_hyp lift_log_matching.
unfold log_matching, log_matching_hosts in *.
intuition.
split.
- intros.
match goal with
| H : forall _ _, _ <= _ <= _ -> _ |- _ =>
specialize (H h i);
conclude H ltac:(simpl; repeat break_match; simpl in *; repeat find_rewrite; simpl in *;lia)
end.
break_exists_exists; intuition.
simpl in *.
repeat break_match; simpl in *; repeat find_rewrite; simpl in *; auto.
- intros.
cut (eIndex e > 0); intros; try lia.
cut (In e (log (nwState (deghost net) h))); intros; eauto.
simpl in *. repeat break_match. simpl in *. repeat find_rewrite. simpl in *. auto.
Qed.
Ltac start :=
red; unfold leaderLogs_contiguous; intros;
subst; simpl in *; find_higher_order_rewrite;
update_destruct; subst; rewrite_update; eauto; simpl in *.
Proof using.
split; simpl in *; intuition.
Qed.
Proof using.
start.
find_rewrite_lem update_elections_data_client_request_leaderLogs. eauto.
Qed.
Proof using.
start.
find_rewrite_lem update_elections_data_timeout_leaderLogs. eauto.
Qed.

Lemma leaderLogs_contiguous_append_entries :
refined_raft_net_invariant_append_entries leaderLogs_contiguous.