Section AllEntriesLeaderLogsTerm.
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 {aerlli : append_entries_leaderLogs_interface}.
Proof using aerlli.
red. unfold allEntries_leaderLogs_term. intros. simpl in *. subst.
repeat find_higher_order_rewrite.
destruct_update; simpl in *;
[|find_apply_hyp_hyp; intuition;
right; break_exists_exists; intuition;
find_higher_order_rewrite;
destruct_update; simpl in *; eauto;
rewrite update_elections_data_appendEntries_leaderLogs; eauto].
find_apply_lem_hyp update_elections_data_appendEntries_allEntries_term.
intuition;
[find_apply_hyp_hyp; intuition;
right; break_exists_exists; intuition;
find_higher_order_rewrite;
destruct_update; simpl in *; eauto;
rewrite update_elections_data_appendEntries_leaderLogs; eauto|].
subst.
match goal with
| H : context [pBody] |- _ =>
eapply append_entries_leaderLogs_invariant in H; eauto
end.
break_exists. break_and. subst. do_in_app.
case H7; intros; try find_apply_hyp_hyp; auto.
right.
find_eapply_lem_hyp Prefix_In; eauto.
repeat eexists; eauto.
find_higher_order_rewrite;
destruct_update; simpl in *; eauto;
rewrite update_elections_data_appendEntries_leaderLogs; subst; eauto.
Qed.

(* rest of cases are easy *)
Lemma allEntries_leaderLogs_term_init :
refined_raft_net_invariant_init allEntries_leaderLogs_term.