Proof using.
intros.
find_apply_lem_hyp handleAppendEntries_log.
intuition; subst; try find_rewrite; auto.
break_exists. intuition eauto.
Qed.

(* Specifications: *)
Lemma haveNewEntries_true :
forall st es,
haveNewEntries st es = true ->
(es <> nil /\
(findAtIndex (log st) (maxIndex es) = None \/
exists e,
findAtIndex (log st) (maxIndex es) = Some e /\
eTerm e <> maxTerm es)).