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.
Proof using.
start.
find_rewrite_lem update_elections_data_appendEntries_leaderLogs. eauto.
Qed.
Proof using.
start. (* and finish *)
Qed.
Proof using.
start.
find_rewrite_lem update_elections_data_requestVote_leaderLogs. eauto.
Qed.
Proof using lmi rri.
start.
match goal with
| [ _ : context [ update_elections_data_requestVoteReply ?d ?s ?t ?v ?st ] |- _ ] =>
pose proof update_elections_data_requestVoteReply_leaderLogs
d s t v st
end. intuition; repeat find_rewrite; eauto.
simpl in *; break_or_hyp; eauto.
find_inversion.
eauto using logs_contiguous.
Qed.
Proof using.
start. replace gd with (fst (nwState net h0)) in *; eauto.
find_rewrite; reflexivity.
Qed.
Proof using.
start. replace gd with (fst (nwState net h0)) in *; eauto.
find_rewrite; reflexivity.
Qed.

Lemma leaderLogs_contiguous_state_same_packet_subset :
refined_raft_net_invariant_state_same_packet_subset leaderLogs_contiguous.