Proof using taifoi si llsi lmi rri.
unfold refined_raft_net_invariant_append_entries, leaderLogs_entries_match.
intuition.
- unfold leaderLogs_entries_match_host in *. intros.
{
intros. simpl in *. repeat find_higher_order_rewrite.
find_rewrite_lem update_fun_comm. simpl in *.
find_rewrite_lem update_fun_comm.
find_rewrite_lem update_elections_data_appendEntries_leaderLogs.
find_erewrite_lem update_nop_ext'.
update_destruct_simplify; rewrite_update;
try rewrite update_elections_data_appendEntries_leaderLogs in *; eauto.
destruct (log d) using (handleAppendEntries_log_ind ltac:(eauto)); eauto.
+ subst. eapply entries_match_scratch with (plt0 := plt).
* eauto using lifted_logs_sorted_nw.
* apply sorted_uniqueIndices.
eapply leaderLogs_sorted_invariant; eauto.
* eapply_prop leaderLogs_entries_match_nw; eauto.
* use_log_matching_nw.
* use_log_matching_nw.
* match goal with
| [ H : In _ (leaderLogs _) |- _ ] =>
eapply terms_and_indices_from_one_invariant in H; [|solve[auto]]
end.
unfold terms_and_indices_from_one in *. intros.
find_apply_hyp_hyp. intuition.
+ eapply entries_match_append; eauto.
* eauto using lifted_logs_sorted_host.
* eapply leaderLogs_sorted_invariant; eauto.
* eauto using lifted_logs_sorted_nw.
* use_log_matching_nw.
* use_log_matching_nw.
* eapply findAtIndex_intro; eauto using lifted_logs_sorted_host, sorted_uniqueIndices.
}
- (* nw *)
unfold leaderLogs_entries_match_nw in *.
intros. simpl in *. repeat find_higher_order_rewrite.
find_rewrite_lem update_fun_comm. simpl in *.
find_rewrite_lem update_fun_comm.
find_rewrite_lem update_elections_data_appendEntries_leaderLogs.
find_erewrite_lem update_nop_ext'.
find_apply_hyp_hyp. break_or_hyp.
+ intuition; match goal with
| [ H : _ |- _ ] => solve [eapply H with (p0 := p0); eauto with *]
end.
+ simpl in *.
find_copy_apply_lem_hyp handleAppendEntries_doesn't_send_AE.
exfalso. eauto 10.
Qed.

(* Specifications: *)
Lemma leaderLogs_entries_match_append_entries_reply :
refined_raft_net_invariant_append_entries_reply leaderLogs_entries_match.