Proof using lmi smsi misi si.
red. unfold state_machine_log in *. simpl in *. intros.
find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
unfold doGenericServer in *. break_let.
find_inversion. simpl in *.
find_copy_apply_lem_hyp applyEntries_execute_log'. repeat find_rewrite.
find_copy_apply_lem_hyp applyEntries_lastApplied_commitIndex_log.
break_and. repeat find_rewrite.
simpl in *. repeat find_higher_order_rewrite.
break_if; do_bool.
- rewrite filter_and by
(intros;
match goal with
| |- context [?x <? ?y] =>
destruct (x <? y) eqn:?; auto
end; do_bool;
find_eapply_lem_hyp findGtIndex_necessary; omega).
get_invariant_pre logs_sorted_invariant; unfold logs_sorted in *; intuition.
match goal with
| |- context [commitIndex ?st] =>
rewrite removeAfterIndex_app
with (i := commitIndex st)
(i' := lastApplied st); intuition eauto
end.
rewrite rev_app_distr.
unfold deduplicate_log.
rewrite deduplicate_log'_app.
unfold execute_log.
rewrite execute_log'_app. break_let.
simpl in *.
erewrite snd_execute_log'.
f_equal. f_equal.
apply deduplicate_log'_a_equiv.
apply client_cache_keys_correct_invariant; auto.
- match goal with
| |- context [filter ?f ?l] =>
assert (filter f l = filter (fun _ => false) l) by
(apply filter_fun_ext_eq;
intros; do_bool; right;
apply leb_correct_conv;
eapply le_lt_trans; eauto;
eapply findGtIndex_necessary; eauto)
end.
repeat find_rewrite.
rewrite filter_false. reflexivity.
Qed.

Lemma state_machine_append_entries :
raft_net_invariant_append_entries' state_machine_log.