Proof using.
unfold raft_net_invariant_timeout. unfold logs_sorted. intuition.
- unfold logs_sorted_host in *. simpl in *. intros.
find_apply_lem_hyp handleTimeout_log.
find_higher_order_rewrite. break_match; repeat find_rewrite; eauto.
- eapply logs_sorted_nw_no_append_entries; eauto. intros.
eauto using handleTimeout_not_is_append_entries.
- eapply packets_gt_prevIndex_no_append_entries; eauto. intros.
eauto using handleTimeout_not_is_append_entries.
- eapply packets_ge_prevTerm_no_append_entries; eauto. intros.
eauto using handleTimeout_not_is_append_entries.
Qed.
Ltac find_eapply_hyp_goal :=
match goal with
| H : _ |- _ =>
eapply H
end.

Theorem sorted_append :
forall l l',
sorted l ->
sorted l' ->
(forall e e', In e l -> In e' l' -> eIndex e > eIndex e') ->
(forall e e', In e l -> In e' l' -> eTerm e >= eTerm e') ->
sorted (l ++ l').