Proof using cti.
unfold refined_raft_net_invariant_timeout, prevLog_candidateEntriesTerm.
simpl. intros.
find_apply_hyp_hyp. break_or_hyp.
- eapply candidateEntriesTerm_ext; eauto.
eapply handleClientRequest_preserves_candidateEntriesTerm; eauto.
- find_apply_lem_hyp in_map_iff. break_exists. break_and.
subst. simpl in *.
exfalso. eapply handleTimeout_not_is_append_entries; eauto.
find_rewrite. eauto 10.
Qed.

(* Specifications: *)
Lemma handleAppendEntries_preserves_candidateEntriesTerm :
forall net h t n pli plt es ci d m t',
handleAppendEntries h (snd (nwState net h)) t n pli plt es ci = (d, m) ->
refined_raft_intermediate_reachable net ->
candidateEntriesTerm t' (nwState net) ->
candidateEntriesTerm t' (update name_eq_dec (nwState net) h
(update_elections_data_appendEntries
h
(nwState net h) t n pli plt es ci, d)).