Proof using.
intros. unfold handleAppendEntriesReply, advanceCurrentTerm in *.
repeat break_match; find_inversion; auto.
Qed.

Lemma handleAppendEntriesReply_type_term :
forall h st h' t es r st' ms,
handleAppendEntriesReply h st h' t es r = (st', ms) ->
(type st' = type st /\ currentTerm st' = currentTerm st) \/
(type st' = Follower /\ currentTerm st' >= currentTerm st).