Proof using.
intros. unfold handleAppendEntries, advanceCurrentTerm in *.
repeat break_match; find_inversion; simpl in *; auto; congruence.
Qed.

(* Specifications: *)
Theorem handleAppendEntriesReply_term_votedFor :
forall h st n t es r st' ps h',
handleAppendEntriesReply h st n t es r = (st', ps) ->
votedFor st' = Some h' ->
currentTerm st' = currentTerm st /\ votedFor st' = votedFor st.