Proof using.
intros.
apply in_middle_reduce with (y := I k'); intuition (auto with *; congruence).
Qed.

Lemma IRO_O_preserved :
forall xs ys zs k' ir,
(~ In k' (get_IR_output_keys ir)) ->
(forall k, In (IRO k) (IRI k' :: IRO k' :: ir) ->
In (O k) (xs ++ I k' :: ys ++ O k' :: zs)) ->
forall k, In (IRO k) ir ->
In (O k) (xs ++ ys ++ zs).