Section InLogInAllEntries.
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.
red. unfold in_log_in_all_entries. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
find_eapply_lem_hyp update_elections_data_appendEntries_log_allEntries; eauto.
intuition; repeat find_rewrite; eauto;
match goal with
| H : allEntries _ = _ |- _ => rewrite H in *
end; eauto.
- copy_eapply_prop_hyp In In.
break_exists_exists.
apply in_app_iff.
eauto.
- eexists.
apply in_app_iff.
left.
apply in_map_iff.
eexists; intuition; eauto.
- do_in_app. intuition.
+ eexists.
apply in_app_iff.
left.
apply in_map_iff.
eexists; intuition; eauto.
+ find_apply_lem_hyp removeAfterIndex_in.
copy_eapply_prop_hyp In In.
break_exists_exists.
apply in_app_iff.
eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
find_erewrite_lem handleAppendEntriesReply_log. eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
rewrite update_elections_data_requestVote_allEntries.
find_erewrite_lem handleRequestVote_log. eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
rewrite update_elections_data_requestVoteReply_allEntries.
find_erewrite_lem handleRequestVoteReply_log. eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
rewrite update_elections_data_timeout_allEntries.
find_erewrite_lem handleTimeout_log_same. eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
find_eapply_lem_hyp update_elections_data_client_request_log_allEntries; eauto.
intuition; try break_exists; intuition; repeat find_rewrite; eauto.
simpl in *. intuition; subst; eauto.
copy_eapply_prop_hyp In In.
break_exists_exists; eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
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.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
find_erewrite_lem doLeader_log; eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
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.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
find_erewrite_lem doGenericServer_log; eauto.
Qed.
Proof using.
red. unfold in_log_in_all_entries. intros. simpl in *.
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.
subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
Qed.

Lemma in_log_in_all_entries_state_same_packet_subset :
refined_raft_net_invariant_state_same_packet_subset in_log_in_all_entries.