Section CommonTheorems.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {cci : cronies_correct_interface}.
Context {vci : votes_correct_interface}.
Proof using.
intros.
unfold candidateEntries in *. break_exists. break_and.
repeat match goal with
| [ H : _ |- _ ] => rewrite deghost_spec in H
end.
intro.
assert (x = h).
{
match goal with
| H : wonElection _ = _ |- _ =>
eapply wonElection_one_in_common in H; [|clear H; eauto]
end.
break_exists. break_and.
eapply_prop one_vote_per_term;
try solve [eapply_prop cronies_votes; eauto].
eapply_prop cronies_votes.
repeat find_reverse_rewrite.
eapply_prop votes_received_cronies; auto.
}
subst.
concludes.
contradiction.
Qed.

Lemma wonElection_candidateEntries_rvr :
forall (net : network (params := raft_refined_multi_params)) p e,
votes_correct net ->
cronies_correct net ->
candidateEntries e (nwState net) ->
In p (nwPackets net) ->
pBody p = RequestVoteReply (eTerm e) true ->
currentTerm (snd (nwState net (pDst p))) = eTerm e ->
wonElection (dedup name_eq_dec (pSrc p :: votesReceived (snd (nwState net (pDst p))))) = true ->
type (snd (nwState net (pDst p))) <> Candidate.