Proof using misi smsi lmi.
intros. unfold key_in_output_list in *.
match goal with | H : exists _, _ |- _ => destruct H as [o] end.
unfold doGenericServer in *. break_let. simpl in *.
find_inversion. simpl in *.
pose proof Heqp as Happ.
find_eapply_lem_hyp applyEntries_In; eauto.
use_applyEntries_spec; subst_max; simpl in *.
eexists; intuition eauto.
find_apply_lem_hyp In_rev.
find_apply_lem_hyp filter_In.
intuition. repeat (do_bool; intuition).
break_if; simpl in *; do_bool; [|try omega].
match goal with
| |- context [update _ ?st ?h ?st'] =>
pose proof applied_entries_update st h st'
end. forwards; [simpl in *; intuition|]. concludes.
intuition.
- simpl in *. unfold raft_data in *. simpl in *.
find_rewrite.
match goal with | H : applied_entries _ = applied_entries _ |- _ => clear H end.
break_exists. intuition.
unfold applied_entries in *.
find_rewrite.
match goal with
| |- In _ (rev ?l') => apply in_rev with (l := l')
end.
apply removeAfterIndex_le_In; intuition.
find_copy_apply_lem_hyp log_matching_invariant.
find_copy_apply_lem_hyp max_index_sanity_invariant.
find_apply_lem_hyp state_machine_safety_invariant.
unfold state_machine_safety, log_matching, log_matching_hosts, maxIndex_sanity in *.
intuition.
match goal with
| [ e : entry, H : forall _ _, _ <= _ <= _ -> _, Hm : maxIndex_lastApplied _
|- In _ (log (_ _ ?h)) ] =>
specialize (H h (eIndex e)); specialize (Hm h); forward H; intuition
end. break_exists. intuition.
find_apply_lem_hyp findGtIndex_necessary. intuition.
match goal with
| _ : In ?e1 (log _), _ : In ?e2 (log _) |- _ =>
cut (e1 = e2); [intros; subst; auto|]
end. eapply_prop state_machine_safety_host; unfold commit_recorded; intuition eauto.
omega.
- simpl in *. unfold raft_data in *. simpl in *.
find_rewrite.
match goal with
| |- In _ (rev ?l') => apply in_rev with (l := l')
end.
find_apply_lem_hyp findGtIndex_necessary.
intuition.
eauto using removeAfterIndex_le_In.
Qed.

(* Specifications: *)
Lemma output_implies_in_applied_entries :
forall failed net failed' net' o,
raft_intermediate_reachable net ->
@step_failure _ _ failure_params (failed, net) (failed', net') o ->
key_in_output_trace client id o ->
in_applied_entries client id net'.