Section VotedForTermSanity.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {rri : raft_refinement_interface}.
Context {rvtsi : requestVote_term_sanity_interface}.
Proof using.
red. unfold votedFor_term_sanity in *. simpl in *.
intros. subst. repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
- find_copy_eapply_lem_hyp handleAppendEntries_term_votedFor; eauto.
intuition; repeat find_rewrite; eauto.
- find_copy_apply_lem_hyp handleAppendEntries_currentTerm_leaderId.
intuition; eauto;
eapply_prop_hyp RaftState.votedFor RaftState.votedFor; eauto;
try rewrite <- plus_n_O in *; lia.
Qed.

Lemma votedFor_term_sanity_append_entries_reply :
refined_raft_net_invariant_append_entries_reply votedFor_term_sanity.