Proof using.
red. unfold append_entries_request_reply_correspondence. intros.
simpl in *.
find_apply_hyp_hyp.
find_apply_hyp_hyp.
unfold exists_equivalent_network_with_aer in *.
break_exists_name net''.
break_exists_name pli.
break_exists_name plt.
break_exists_name ci.
break_exists_name n.
intuition.
(exists (mkNetwork (nwPackets net' ++ [{|
pSrc := pDst p;
pDst := pSrc p;
pBody := AppendEntries t n pli plt es ci |}]) (nwState net'))).
repeat eexists; intuition; eauto.
repeat find_rewrite.
break_exists_exists; intuition; repeat find_rewrite; eauto.
eapply subset_reachable with (net := net''); eauto.
- simpl in *. repeat find_rewrite.
apply functional_extensionality. eauto.
- simpl.
intros. repeat find_rewrite. do_in_app. intuition.
Qed.

(* Specifications: *)
Lemma handleAppendEntries_reply_spec:
forall h st (d : raft_data)
(t : term) (n : name) (pli : logIndex) (plt : term)
(es : list entry) (ci : logIndex) (t0 : term)
(es0 : list entry) t' es',
handleAppendEntries h st t n pli plt es ci =
(d, AppendEntriesReply t' es' true) ->
t' = t /\ es' = es.