Section AllEntriesLeaderSublog.
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 {cei : candidate_entries_interface}.
Context {lsi : leader_sublog_interface}.
Context {olpti : one_leader_per_term_interface}.
Context {aecei : allEntries_candidate_entries_interface}.
Context {vci : votes_correct_interface}.
Context {cci : cronies_correct_interface}.
Proof using lsi rri.
intros.
pose proof (lift_prop _ leader_sublog_invariant_invariant _ ltac:(eauto)) as Hinv.
unfold leader_sublog_invariant, leader_sublog_nw_invariant in *.
destruct Hinv as [Hhost Hnw].
find_apply_lem_hyp ghost_packet.
eapply_prop_hyp In In; eauto; try find_rewrite_lem deghost_spec; try rewrite deghost_spec; eauto.
Qed.
Proof using olpti rri.
intros.
eapply (lift_prop _ one_leader_per_term_invariant _ ltac:(eauto));
simpl in *; repeat break_match; repeat (find_rewrite; simpl in *);
auto; simpl in *; repeat find_rewrite; simpl in *; auto.
Qed.
Proof using.
intros.
apply in_map_iff.
eexists; intuition; eauto; reflexivity.
Qed.
Hint Resolve map_snd : core.
Proof using olpti rri.
red. unfold allEntries_leader_sublog. intros. simpl in *.
subst. repeat find_higher_order_rewrite.
find_copy_apply_lem_hyp handleClientRequest_type. intuition.
destruct_update; simpl in *; eauto;
do_in_map; subst;
destruct x; simpl in *.
- find_apply_lem_hyp update_elections_data_client_request_log_allEntries.
intuition; repeat find_rewrite; eauto.
break_exists. intuition. repeat find_rewrite. simpl in *.
intuition; repeat find_rewrite; eauto; solve_by_inversion.
- find_apply_lem_hyp update_elections_data_client_request_log_allEntries.
intuition; repeat find_rewrite; eauto.
break_exists. intuition. repeat find_rewrite. simpl in *.
intuition; repeat find_rewrite; eauto; solve_by_inversion.
- find_apply_lem_hyp update_elections_data_client_request_log_allEntries.
intuition; repeat find_rewrite; eauto.
break_exists. intuition. repeat find_rewrite. simpl in *.
intuition; repeat find_rewrite; eauto.
tuple_inversion.
repeat find_rewrite.
find_false.
eapply lifted_one_leader_per_term; eauto.
Qed.
Proof using.
intros.
unfold update_elections_data_appendEntries in *.
unfold handleAppendEntries, advanceCurrentTerm in *.
repeat break_match; repeat find_inversion; subst; simpl in *; auto;
congruence.
Qed.

Lemma allEntries_leader_sublog_append_entries :
refined_raft_net_invariant_append_entries allEntries_leader_sublog.