Proof using.
unfold raft_net_invariant_append_entries. intros. unfold logs_sorted. intuition.
- unfold logs_sorted_host. simpl in *. intros.
repeat find_higher_order_rewrite.
break_match; repeat find_rewrite; eauto;
[|unfold logs_sorted in *; intuition eauto].
subst.
eauto using handleAppendEntries_logs_sorted.
- unfold logs_sorted in *. intuition.
simpl in *.
eapply logs_sorted_nw_not_append_entries; eauto.
+ intros. find_apply_hyp_hyp. intuition eauto.
+ simpl. eauto using handleAppendEntries_not_append_entries.
- unfold logs_sorted in *. intuition.
simpl in *.
eapply packets_gt_prevIndex_not_append_entries; eauto.
+ intros. find_apply_hyp_hyp. intuition eauto.
+ simpl. eauto using handleAppendEntries_not_append_entries.
- unfold logs_sorted in *. intuition.
simpl in *.
eapply packets_ge_prevTerm_not_append_entries; eauto.
+ intros. find_apply_hyp_hyp. intuition eauto.
+ simpl. eauto using handleAppendEntries_not_append_entries.
Qed.

Lemma handleAppendEntriesReply_log :
forall h st from t es s st' ps,
handleAppendEntriesReply h st from t es s = (st', ps) ->
log st' = log st.