Proof using.
intros.
unfold advanceCurrentTerm. break_if; simpl in *; auto.
Qed.

Theorem handleAppendEntries_log :
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 <= t /\ es <> [] /\ pli = 0 /\ log st' = es) \/
(currentTerm st <= t /\ es <> [] /\ pli <> 0 /\ exists e,
In e (log st) /\
eIndex e = pli /\
eTerm e = plt) /\
log st' = es ++ (removeAfterIndex (log st) pli).