Section SpecLemmas.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Proof using.
intros. unfold handleRequestVote, advanceCurrentTerm in *.
repeat break_match; tuple_inversion; simpl in *; intuition; try discriminate;
try solve [exfalso; do_bool; lia].
Qed.

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)).