Proof using.
intros.
unfold handleAppendEntries, advanceCurrentTerm in *.
repeat break_match; try find_inversion; subst; simpl in *; intuition;
do_bool; intuition; try solve [break_exists; congruence];
in_crush; eauto using removeAfterIndex_in.
Qed.

Lemma handleAppendEntries_term_same_or_type_follower :
forall h t n pli plt es ci d m st,
handleAppendEntries h st t n pli plt es ci = (d, m) ->
(currentTerm d = currentTerm st /\ type d = type st) \/ type d = Follower.