Proof using rlmli.
start_update; simpl in *.
- match goal with
| H : context [handleAppendEntries] |- _ =>
eapply update_elections_data_appendEntries_log_allEntries with (h' := n) in H
end ; intuition; repeat find_rewrite; simpl in *; intuition; subst; eauto;
try (find_rewrite_lem map_app; find_rewrite_lem map_map; simpl in *; find_rewrite_lem map_id;
do_in_app; intuition; eauto).
+ enough (In e' (log (snd (nwState net (pDst p))))) by
(eapply uniqueIndices_elim_eq; eauto; apply sorted_uniqueIndices; eapply entries_sorted_invariant; eauto).
eapply entries_match_nw_host_invariant; eauto.
+ eapply uniqueIndices_elim_eq; eauto; apply sorted_uniqueIndices; eapply entries_sorted_nw_invariant; eauto.
+ do_in_app. intuition.
* eapply uniqueIndices_elim_eq; eauto; apply sorted_uniqueIndices;
eapply entries_sorted_nw_invariant; eauto.
* find_apply_lem_hyp removeAfterIndex_in.
enough (In e' (log (snd (nwState net (pDst p))))) by
(eapply uniqueIndices_elim_eq; eauto; apply sorted_uniqueIndices; eapply entries_sorted_invariant; eauto).
eapply entries_match_nw_host_invariant; eauto.
+ do_in_app; intuition; eauto using removeAfterIndex_in.
- match goal with
| H : context [handleAppendEntries] |- _ =>
eapply update_elections_data_appendEntries_log_allEntries with (h' := n) in H
end ; intuition; repeat find_rewrite; simpl in *; intuition; subst; eauto;
try (find_rewrite_lem map_app; find_rewrite_lem map_map; simpl in *; find_rewrite_lem map_id;
do_in_app; intuition; eauto).
+ enough (In e' (log (snd (nwState net h)))) by
(eapply uniqueIndices_elim_eq; eauto; apply sorted_uniqueIndices; eapply entries_sorted_invariant; eauto).
eapply entries_match_nw_host_invariant; eauto.
+ enough (In e' (log (snd (nwState net h)))) by
(eapply uniqueIndices_elim_eq; eauto; apply sorted_uniqueIndices; eapply entries_sorted_invariant; eauto).
eapply entries_match_nw_host_invariant; eauto.
+ enough (In e' (log (snd (nwState net h)))) by
(eapply uniqueIndices_elim_eq; eauto; apply sorted_uniqueIndices; eapply entries_sorted_invariant; eauto).
eapply entries_match_nw_host_invariant; eauto.
- find_apply_lem_hyp handleAppendEntries_log.
intuition; repeat find_rewrite; simpl in *; eauto.
do_in_app. intuition; eauto using removeAfterIndex_in.
- find_apply_hyp_hyp.
intuition;
[|exfalso; do_in_map; subst; simpl in *;
find_eapply_lem_hyp handleAppendEntries_not_append_entries; eauto;
intuition; repeat find_rewrite; find_false; repeat eexists; eauto].
assert (In p0 (xs ++ p :: ys)) by in_crush.
match goal with
| H : context [handleAppendEntries] |- _ =>
eapply update_elections_data_appendEntries_log_allEntries with (h' := n) in H
end.
intuition; repeat find_rewrite; simpl in *; subst; intuition; eauto.
+ find_rewrite_lem map_app.
find_rewrite_lem map_map.
simpl in *.
find_rewrite_lem map_id.
apply in_app_or in H11.
intuition; eauto.
eauto using packets_entries_eq.
+ find_rewrite_lem map_app.
find_rewrite_lem map_map.
simpl in *.
find_rewrite_lem map_id.
apply in_app_or in H11.
intuition; eauto.
eauto using packets_entries_eq.
+ find_rewrite_lem map_app.
find_rewrite_lem map_map.
simpl in *.
find_rewrite_lem map_id.
apply in_app_or in H11.
intuition; eauto.
eauto using packets_entries_eq.
- find_apply_hyp_hyp.
intuition;
[|exfalso; do_in_map; subst; simpl in *;
eapply handleAppendEntries_not_append_entries; eauto;
intuition; repeat find_rewrite; repeat eexists; eauto].
eauto.
Qed.

(* Specifications: *)
Lemma allEntries_log_matching_append_entries_reply :
refined_raft_net_invariant_append_entries_reply allEntries_log_matching_inductive.