Proof using lphogli glci rlmli rmri.
red.
split; red; intros; simpl in *; intuition;
unfold ghost_log_entries_match in *; break_and.
- repeat find_higher_order_rewrite; destruct_update; simpl in *; eauto.
+ match goal with
| [ H : msg_refined_raft_intermediate_reachable (mkNetwork _ _) |- _ ] => clear H
end.
find_apply_hyp_hyp. intuition.
* find_eapply_lem_hyp handleAppendEntries_ghost_log; eauto.
intuition; repeat find_rewrite; eauto.
* subst. simpl in *.
find_eapply_lem_hyp handleAppendEntries_ghost_log; eauto.
+ find_apply_hyp_hyp. intuition; eauto.
subst. simpl in *. unfold write_ghost_log.
simpl.
replace d with (snd (nwState {| nwPackets := ps'; nwState := st' |} (pDst p))) by
(simpl; find_higher_order_rewrite; rewrite_update; reflexivity).
replace (nwState net h) with (nwState {| nwPackets := ps'; nwState := st' |} h)by
(simpl; find_higher_order_rewrite; rewrite_update; reflexivity).
apply lifted_entries_match_invariant; auto.
- find_apply_hyp_hyp.
find_apply_hyp_hyp.
intuition.
+ eauto.
+ subst. simpl in *.
unfold write_ghost_log.
simpl.
match goal with
| [ H : context [handleAppendEntries] |- _ ] =>
eapply handleAppendEntries_ghost_log in H; eauto
end.
intuition.
* find_rewrite. eauto.
* find_rewrite. eauto.
+ subst. simpl in *.
unfold write_ghost_log.
simpl.
match goal with
| [ H : context [handleAppendEntries] |- _ ] =>
eapply handleAppendEntries_ghost_log in H; eauto
end.
intuition.
* find_rewrite. eauto.
* find_rewrite. eauto.
+ subst. simpl in *. apply entries_match_refl.
Qed.
Ltac packet_simpl :=
first [do_in_map; subst; simpl in *;
unfold add_ghost_msg in *;
do_in_map; subst; simpl in *|subst; simpl in *].
Arguments write_ghost_log / _ _ _ _ _.

Lemma ghost_log_entries_match_append_entries_reply :
msg_refined_raft_net_invariant_append_entries_reply ghost_log_entries_match.