Section LeaderLogsLogProperties.
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}.
(* Example contiguous_log_property : log_property (fun l => contiguous_range_exact_lo l 0). *)
Proof using.
red. unfold log_properties_hold_on_leader_logs.
intros. simpl in *. intuition.
Qed.
Ltac finish := solve [eapply_prop_hyp In In; eauto].
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; [|finish].
find_eapply_lem_hyp leaderLogs_update_elections_data_RVR; eauto.
intuition; [finish|].
subst.
erewrite handleRequestVoteReply_log; eauto.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; [|finish].
find_erewrite_lem update_elections_data_appendEntries_leaderLogs; eauto.
finish.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; finish.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; [|finish].
find_erewrite_lem leaderLogs_update_elections_data_requestVote; eauto.
finish.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
match goal with
| H : nwState ?net ?h = (?gd, ?d) |- _ =>
replace gd with (fst (nwState net h)) in * by (rewrite H; reflexivity);
replace d with (snd (nwState net h)) in * by (rewrite H; reflexivity);
clear H
end.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; finish.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
match goal with
| H : nwState ?net ?h = (?gd, ?d) |- _ =>
replace gd with (fst (nwState net h)) in * by (rewrite H; reflexivity);
replace d with (snd (nwState net h)) in * by (rewrite H; reflexivity);
clear H
end.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; finish.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
match goal with
| H : nwState ?net ?h = (?gd, ?d) |- _ =>
replace gd with (fst (nwState net h)) in * by (rewrite H; reflexivity);
replace d with (snd (nwState net h)) in * by (rewrite H; reflexivity);
clear H
end.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; finish.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; [|finish].
find_erewrite_lem update_elections_data_client_request_leaderLogs; eauto.
finish.
Qed.
Proof using.
red. unfold log_properties_hold_on_leader_logs. intros.
simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto; [|finish].
find_erewrite_lem update_elections_data_timeout_leaderLogs; eauto.
finish.
Qed.

Lemma log_properties_hold_on_leader_logs_state_same_packet_subset :
refined_raft_net_invariant_state_same_packet_subset log_properties_hold_on_leader_logs.