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.
Proof using.
intros. unfold output_before_input in *.
induction tr; simpl in *; intuition.
- unfold key_in_output_trace.
unfold is_output_with_key in *. repeat break_match; try congruence.
subst. do 2 eexists. intuition; eauto.
- unfold key_in_output_trace in *.
break_exists_exists. simpl; intuition.
Qed.

Lemma in_applied_entries_entries_ordered :
forall net,
in_applied_entries client id net ->
~ in_applied_entries client' id' net ->
entries_ordered client id client' id' net.