Proof using.
intros. unfold handleTimeout, tryToBecomeLeader in *.
repeat break_match; find_inversion; subst; auto;
intuition; break_exists;
do_in_map; subst; simpl in *; congruence.
Qed.

(* Specifications: *)
Lemma doLeader_messages :
forall st h os st' ms m t n pli plt es ci,
doLeader st h = (os, st', ms) ->
In m ms ->
snd m = AppendEntries t n pli plt es ci ->
t = currentTerm st /\
log st' = log st /\
type st = Leader /\
((plt = 0) \/
((exists e, findAtIndex (log st) pli = Some e /\
eTerm e = plt))).