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.
Proof using.
unfold votes_correct, cronies_correct.
intros. break_and.
match goal with
| [ H : context [ votes_nw ], H' : context [ pBody ] |- _ ] =>
eapply H in H'
end.
unfold candidateEntries in *. break_exists. break_and.
match goal with
| H : wonElection _ = _ |- _ =>
eapply wonElection_one_in_common in H; [|clear H; eauto]
end.
break_exists.
break_and.
simpl in *.
intuition.
- subst.
apply_prop_hyp cronies_votes In.
assert (x = pDst p) by (eapply_prop one_vote_per_term; eauto).
subst. concludes. contradiction.
- apply_prop_hyp votes_received_cronies In. concludes.
apply_prop_hyp cronies_votes In.
apply_prop_hyp cronies_votes In.
unfold raft_data in *. unfold raft_refined_base_params, raft_refined_multi_params in *.
simpl in *.
repeat find_reverse_rewrite.
assert (x = pDst p) by (eapply_prop one_vote_per_term; eauto).
subst.
repeat concludes. contradiction.
Qed.
Proof using.
unfold candidateEntries.
intuition.
break_exists_exists.
intuition;
repeat find_higher_order_rewrite; auto.
Qed.

Lemma candidateEntries_same :
forall (st st' : name -> _) e,
candidateEntries e st ->
(forall h, cronies (fst (st' h)) = cronies (fst (st h))) ->
(forall h, currentTerm (snd (st' h)) = currentTerm (snd (st h))) ->
(forall h, type (snd (st' h)) = type (snd (st h))) ->
candidateEntries e st'.