Proof using lmi lacimi si smci.
intros.
match goal with
| [ H : context [ step_failure _ _ _ ] |- _ ] => invcs H
end.
- unfold RaftNetHandler in *. repeat break_let. repeat find_inversion.
find_apply_lem_hyp in_output_trace_singleton_inv.
find_apply_lem_hyp in_output_list_app_or.
intuition.
+ exfalso. eapply doLeader_key_in_output_list; eauto.
+ find_copy_eapply_lem_hyp RIR_handleMessage; eauto.
find_copy_eapply_lem_hyp RIR_doLeader; simpl; rewrite_update; eauto.
intermediate_networks.
find_copy_apply_lem_hyp doLeader_appliedEntries.
eapply doGenericServer_output_correct; eauto.
- unfold RaftInputHandler in *. repeat break_let. repeat find_inversion.
find_apply_lem_hyp in_output_trace_inp_inv.
find_apply_lem_hyp in_output_trace_singleton_inv.
find_apply_lem_hyp in_output_list_app_or.
intuition.
+ exfalso. eapply handleInput_in_output_list; eauto.
+ find_apply_lem_hyp in_output_list_app_or.
intuition.
* exfalso. eapply doLeader_key_in_output_list; eauto.
* find_copy_eapply_lem_hyp RIR_handleInput; eauto.
find_copy_eapply_lem_hyp RIR_doLeader; simpl; rewrite_update; eauto.
intermediate_networks.
find_copy_apply_lem_hyp doLeader_appliedEntries.
eapply doGenericServer_output_correct; eauto.
- exfalso. eauto using in_output_trace_not_nil.
- exfalso. eauto using in_output_trace_not_nil.
- exfalso. eauto using in_output_trace_not_nil.
- exfalso. eauto using in_output_trace_not_nil.
Qed.
Program Instance TR : TraceRelation step_failure :=
{
init := step_failure_init;
T := in_output_trace client id out ;
T_dec := in_output_trace_dec ;
R := fun s => let (_, net) := s in
output_correct client id out (applied_entries (nwState net))
}.
Next Obligation.
repeat break_let. subst.
find_eapply_lem_hyp applied_entries_monotonic';
eauto using step_failure_star_raft_intermediate_reachable.
unfold output_correct in *.
break_exists.
repeat find_rewrite.
match goal with
| [ |- context [ deduplicate_log (?l ++ ?l') ] ] =>
pose proof deduplicate_log_app l l'; break_exists; find_rewrite
end.
repeat eexists; intuition eauto; repeat find_rewrite; auto.
rewrite app_ass. simpl. repeat f_equal.
Defined.
Next Obligation.
unfold in_output_trace in *. intuition.
break_exists; intuition.
Defined.
Next Obligation.
find_apply_lem_hyp in_output_changed; auto.
eauto using in_output_trace_step_output_correct, step_failure_star_raft_intermediate_reachable.
Defined.

(* Specifications: *)
Theorem output_correct :
forall  failed net tr,
step_failure_star step_failure_init (failed, net) tr ->
in_output_trace client id out tr ->
output_correct client id out (applied_entries (nwState net)).