Proof using ctgli rri.
term_sanity_start_update.
find_copy_apply_lem_hyp handleRequestVoteReply_type.
find_copy_apply_lem_hyp handleRequestVoteReply_log.
find_eapply_lem_hyp leaderLogs_update_elections_data_RVR; auto.
unfold ghost_data, raft_data in *. simpl in *. subst.
intuition; eauto; repeat find_rewrite; try discriminate.
find_apply_lem_hyp candidate_term_gt_log_lifted.
unfold candidate_term_gt_log in *. simpl in *; repeat break_match; simpl in *.
unfold gt in *. subst. repeat find_rewrite. eapply H3; auto.
Qed.
Ltac term_sanity_break_update :=
term_sanity_start_update;
match goal with
h : _ |- _ => eapply h
end; [| eauto];
match goal with
h : _ |- _ => solve [rewrite h; auto]
end.

Lemma leaderLogs_term_sanity_invariant :
forall net,
refined_raft_intermediate_reachable net ->
leaderLogs_term_sanity net.