Proof using.
intros. unfold doLeader, advanceCommitIndex in *.
break_match; try solve [find_inversion; simpl in *; intuition].
break_if; try solve [find_inversion; simpl in *; intuition].
find_inversion. simpl. do_in_map. subst.
simpl in *. find_inversion.
eauto using findGtIndex_in.
Qed.

Theorem handleAppendEntries_log_term_type :
forall h st t n pli plt es ci st' ps,
handleAppendEntries h st t n pli plt es ci = (st', ps) ->
(log st' = log st /\ currentTerm st' = currentTerm st /\ type st' = type st) \/
type st' = Follower.