Section SortedProof.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {tsi : term_sanity_interface}.
Proof using.
unfold raft_net_invariant_init, logs_sorted,
logs_sorted_host, logs_sorted_nw, packets_gt_prevIndex, packets_ge_prevTerm in *.
intuition; simpl in *; intuition.
Qed.
Proof using.
intros. find_apply_lem_hyp handleClientRequest_log. intuition.
Qed.
Proof using.
unfold logs_sorted_nw in *. intros.
simpl in *. find_apply_hyp_hyp. intuition eauto.
Qed.
Proof using.
unfold packets_gt_prevIndex in *. intros.
simpl in *. find_apply_hyp_hyp. intuition eauto.
Qed.
Proof using.
unfold packets_ge_prevTerm in *. intros.
simpl in *. find_apply_hyp_hyp. intuition eauto.
Qed.

Lemma handleClientRequest_logs_sorted :
forall h client id c out st l net,
handleClientRequest h (nwState net h) client id c = (out, st, l) ->
raft_intermediate_reachable net ->
logs_sorted_host net ->
sorted (log st).