Proof using ogii.
intros. unfold entries_ordered in *.
remember (applied_entries (nwState net)) as l.
find_apply_lem_hyp before_func_deduplicate.
{
remember (deduplicate_log l) as l'; clear Heql'. clear Heql. clear l. rename l' into l.
induction l; simpl in *; intuition.
- repeat break_match; subst; simpl in *; break_if; try discriminate; repeat (do_bool; intuition).
+ destruct k; simpl in *; subst. right. intuition.
find_inversion. simpl in *. intuition.
+ exfalso. destruct k; subst; simpl in *.
find_apply_lem_hyp import_get_output. break_exists. congruence.
- repeat break_match; subst; simpl in *; repeat (do_bool; intuition); try break_if; try congruence.
+ right. destruct k'. simpl in *. intuition; try congruence.
destruct (key_eq_dec k (eClient, eId)); subst; intuition.
right. intuition; congruence.
+ right. destruct k'. simpl in *. intuition; try congruence.
destruct (key_eq_dec k (eClient, eId)); subst; intuition.
right. intuition; congruence.
+ right. intuition; [find_inversion; simpl in *; intuition|].
right. intuition. congruence.
+ right. intuition; [find_inversion; simpl in *; intuition|].
right. intuition. congruence.
}
{
intros. subst.
eapply output_greatest_id with (client := fst k) (id := snd k) in H.
- intros. unfold greatest_id_for_client in *.
destruct (le_lt_dec id' (snd k)); auto.
find_copy_apply_hyp_hyp.
exfalso. eapply before_func_antisymmetric; try eassumption.
unfold has_key.
intros. destruct x.
do_bool. intuition. do_bool. subst. omega.
- red. find_apply_lem_hyp in_import_in_trace_O.
break_exists_exists. intuition.
}
Qed.

(* Specifications: *)
Lemma input_before_output_import :
forall tr k,
before_func (is_input_with_key (fst k) (snd k))
(is_output_with_key (fst k) (snd k)) tr ->
before (I k) (O k) (import tr).