Proof using.
induction l; simpl in *; repeat break_match; subst; intuition eauto using f_equal.
repeat break_match; eauto using f_equal; solve [exfalso; eauto].
Qed.
Definition good_move (x y : IR) : Prop :=
(forall k k', ~ (x = IRO k /\ y = IRI k')) /\
(forall k, ~ (x = IRI k /\ y = IRO k)) /\
(forall k, ~ (x = IRI k /\ y = IRU k)).
Inductive IR_equivalent : list IR -> list IR -> Prop :=
| IR_equiv_nil : IR_equivalent [] []
| IR_equiv_cons : forall x xs ys,
IR_equivalent xs ys ->
IR_equivalent (x :: xs) (x :: ys)
| IR_equiv_move : forall x y xs ys,
IR_equivalent xs ys ->
good_move x y ->
IR_equivalent (x :: y :: xs) (y :: x :: ys)
| IR_equiv_trans : forall l1 l2 l3,
IR_equivalent l1 l2 ->
IR_equivalent l2 l3 ->
IR_equivalent l1 l3.
Hint Constructors IR_equivalent.

Lemma IR_equivalent_refl :
forall l,
IR_equivalent l l.