Proof using.
unfold doLeader.
intros.
repeat break_match; repeat find_inversion; simpl in *; intuition.
do_in_map.
unfold replicaMessage in *.
simpl in *.
repeat break_match; repeat find_inversion; subst; simpl in *;
repeat find_inversion; auto.
Qed.

(* Specifications: *)
Lemma doLeader_message_term :
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'.