Proof using.
red. unfold CandidateEntries.
intros.
intuition; simpl in *.
- unfold candidateEntries_host_invariant in *.
intros.
eapply candidateEntries_ext; eauto.
repeat find_higher_order_rewrite.
update_destruct; subst; rewrite_update.
+ simpl in *.
find_copy_apply_lem_hyp doGenericServer_spec. break_and.
find_rewrite.
repeat match goal with
| [ H : nwState ?net ?h = (_, ?d), H' : context [ log ?d ] |- _ ] =>
replace (log d) with (log (snd (nwState net h))) in H' by (repeat find_rewrite; auto)
end.
eauto using doGenericServer_preserves_candidateEntries.
+ eauto using doGenericServer_preserves_candidateEntries.
- unfold candidateEntries_nw_invariant in *.
intros. simpl in *.
eapply candidateEntries_ext; eauto.
find_apply_hyp_hyp.
intuition.
+ eauto using doGenericServer_preserves_candidateEntries.
+ do_in_map.
find_copy_apply_lem_hyp doGenericServer_spec. break_and.
subst. simpl in *.
find_apply_hyp_hyp.
exfalso.
find_rewrite. eauto 20.
Qed.

Lemma candidate_entries_state_same_packet_subset :
refined_raft_net_invariant_state_same_packet_subset CandidateEntries.