Proof using.
intros; induction tr; simpl in *; intuition.
- repeat break_match; subst; simpl in *; intuition; try congruence.
break_if; repeat (do_bool; intuition); try congruence.
destruct k; subst; simpl in *; intuition.
- repeat break_match; subst; simpl in *; intuition; try congruence.
+ destruct k.
match goal with
| |- context [ I (?x, ?y) = I (?x', ?y') ] =>
destruct (op_eq_dec (I (x, y)) (I (x', y')))
end; subst; intuition.
right.
intuition; try congruence.
apply before_remove_if; intuition.
+ break_if; try congruence.
apply before_app_if; [apply before_remove_all_if|]; auto.
* intuition. find_apply_lem_hyp in_dedup_was_in.
find_apply_lem_hyp In_filterMap. break_exists.
break_match; intuition; congruence.
* intuition.
match goal with
| H : _ -> False |- False => apply H
end.
find_apply_lem_hyp in_dedup_was_in.
find_apply_lem_hyp In_filterMap.
break_exists. intuition. break_match; try congruence.
find_inversion.
unfold key_in_output_list. simpl.
eexists; eauto.
Qed.

Lemma I_before_O :
forall failed net tr k,
step_failure_star step_failure_init (failed, net) tr ->
In (O k) (import tr) ->
before (I k) (O k) (import tr).