Proof using.
intros. unfold handleRequestVote, advanceCurrentTerm in *.
repeat break_match; tuple_inversion; simpl in *; intuition; try discriminate;
try solve [exfalso; do_bool; omega].
Qed.

(* Specifications: *)
Lemma handleRequestVote_cases :
forall h h' t lli llt st st' m,
handleRequestVote h st t h' lli llt = (st', m) ->
st' = st \/
st' = advanceCurrentTerm st t \/
(st' = {[ advanceCurrentTerm st t with votedFor := Some h']} /\
(votedFor st = None /\ currentTerm st = t \/ currentTerm st < t)).