Ltac find_eapply_hyp_goal :=
    match goal with
      | H : _ |- _ =>
        eapply H
    end.

Lemma doLeader_messages : forall h st os st' ms m t n pli plt entries c, doLeader st h = (os, st', ms) -> sorted (log st) -> In m ms -> snd m = AppendEntries t n pli plt entries c -> subseq entries (log st) /\ (forall e, In e entries -> eIndex e > pli) /\ (forall e, In e entries -> eTerm e >= plt).