Proof using cti.
intros.
destruct (serverType_eq_dec (type (snd (A:=electionsData) (B:=raft_data) (nwState net h))) Leader).
+ (* Leader case *)
unfold handleTimeout, tryToBecomeLeader in *. simpl in *.
find_rewrite. find_inversion.
eapply candidateEntries_same; eauto;
intros;
repeat (rewrite update_fun_comm; simpl in * );
update_destruct; subst; rewrite_update;
auto using update_elections_data_timeout_leader_cronies_same.
+ (* non-Leader case *)
unfold candidateEntries in *.
break_exists. break_and.
exists x.
rewrite update_fun_comm; simpl.
rewrite update_fun_comm; simpl.
rewrite update_fun_comm; simpl.
rewrite update_fun_comm; simpl.
rewrite update_fun_comm with (f := type); simpl.
update_destruct; subst; rewrite_update; auto.
split.
* match goal with
| [ H : handleTimeout _ _ = _ |- _ ] =>
pose proof H;
apply update_elections_data_timeout_cronies with (t := eTerm e) in H
end.
intuition; find_rewrite; auto.
find_apply_lem_hyp wonElection_exists_voter.
break_exists.
find_apply_lem_hyp in_dedup_was_in.
find_copy_apply_lem_hyp cronies_term_invariant; auto.
find_copy_apply_lem_hyp handleTimeout_not_leader_inc_term; auto.
simpl in *.
omega.
* intros.
find_apply_lem_hyp wonElection_exists_voter.
break_exists.
find_apply_lem_hyp in_dedup_was_in.
find_copy_apply_lem_hyp cronies_term_invariant; auto.
find_copy_apply_lem_hyp handleTimeout_not_leader_inc_term; auto.
simpl in *.
omega.
Qed.

Lemma candidate_entries_timeout :
refined_raft_net_invariant_timeout CandidateEntries.