Proof using.
unfold update_elections_data_timeout, handleTimeout, tryToBecomeLeader in *.
intros.
repeat break_match; simpl in *; intuition; repeat tuple_inversion; intuition;
simpl in *; repeat find_inversion; intuition; try congruence.
Qed.

(* Specifications: *)
Lemma update_elections_data_timeout_votedFor :
forall h cid st out st' m,
handleTimeout h (snd st) = (out, st', m) ->
votedFor st' = Some cid ->
(votedFor (snd st) = Some cid /\
currentTerm st' = currentTerm (snd st) /\
type st' = type (snd st) /\
votesWithLog (update_elections_data_timeout h st) = votesWithLog (fst st)) \/
(cid = h /\
currentTerm st' = S (currentTerm (snd st)) /\
votesWithLog (update_elections_data_timeout h st) =
(currentTerm st', cid, (log st')) :: votesWithLog (fst st)).