Proof using.
intros.
eapply in_middle_reduce.
- auto with *.
- intro. find_inversion.  eauto using get_IR_input_keys_complete.
Qed.

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