Section inner.
Variable client : clientId.
Variable id : nat.
Variable client' : clientId.
Variable id' : nat.
Proof using.
intros. find_eapply_lem_hyp before_func_app_necessary; eauto.
intuition.
break_exists. unfold in_input_trace in *.
break_exists. do_in_app. intuition;
[find_apply_hyp_hyp; simpl in *; break_if; repeat (do_bool; intuition)|].
invcs H0; intuition.
- break_if; congruence.
- find_inversion; try congruence.
repeat (do_bool; intuition).
break_if; try congruence.
- find_inversion.
Qed.

Lemma output_before_input_key_in_output_trace :
forall tr,
output_before_input client id client' id' tr ->
key_in_output_trace client id tr.