Proof using.
unfold not_empty.
intros. break_match; congruence.
Qed.

Lemma handleAppendEntries_success_allEntries :
forall h st t n pli plt es ci st' t',
handleAppendEntries h st t n pli plt es ci = (st', AppendEntriesReply t' es true) ->
es <> nil ->
(forall e e' e'',
In e es ->
In e' (log st) ->
eIndex e = eIndex e' ->
eTerm e = eTerm e' ->
In e'' es ->
eIndex e'' <= eIndex e ->
In e'' (log st)) ->
sorted (log st) ->
exists e, In e (log st') /\ In e es /\
eIndex e = maxIndex es /\
eTerm e = maxTerm es.