Section StateMachineSafety'.
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 {lci : leader_completeness_interface}.
Context {aelli : all_entries_leader_logs_interface}.
Context {lmi : log_matching_interface}.
Context {uii : unique_indices_interface}.
Context {aerlli : append_entries_leaderLogs_interface}.
Context {llsi : leaderLogs_sorted_interface}.
Context {lsi : sorted_interface}.
Context {llci : leaderLogs_contiguous_interface}.
Context {lllmi : leaderLogs_entries_match_interface}.
Context {llli : logs_leaderLogs_interface}.
Context {ollpti : one_leaderLog_per_term_interface}.
Context {rlmli : refined_log_matching_lemmas_interface}.
Proof using lmi rri.
intros.
eapply lift_prop; eauto using log_matching_invariant.
Qed.
Proof using lsi rri.
intros.
eapply lift_prop; eauto using logs_sorted_invariant.
Qed.
Proof using lmi rri.
intros.
find_apply_lem_hyp lift_log_matching.
unfold log_matching, log_matching_hosts in *. intuition.
unfold deghost in *. simpl in *.
repeat break_match; eauto.
Qed.
Proof using uii rri.
intros. eapply lift_prop; eauto using UniqueIndices_invariant.
Qed.
Proof using uii rri.
intros.
find_apply_lem_hyp lift_UniqueIndices.
unfold UniqueIndices, uniqueIndices_host_invariant in *.
intuition.
unfold deghost in *. simpl in *. break_match; eauto.
Qed.

Theorem lift_logs_sorted :
forall net h,
refined_raft_intermediate_reachable net ->
sorted (log (snd (nwState net h))).