Definition get_IR_output_keys (l : list IR) : list K :=
    filterMap (fun x => match x with
                          | IRO k => Some k
                          | IRU k => Some k
                          | _ => None
                        end) l.

(* Specifications: *)
Lemma get_IR_output_keys_defn : forall x l, get_IR_output_keys (x :: l) = match x with | IRO k => k :: get_IR_output_keys l | IRU k => k :: get_IR_output_keys l | _ => get_IR_output_keys l end.
Lemma good_trace_IRI_in : forall ir, good_trace ir -> forall k, In (IRI k) ir -> In (IRO k) ir \/ In (IRU k) ir.
Lemma before_head_op : forall l h ir, (forall k1 k2, In (I k2) l -> before (O k1) (I k2) l -> before (IRO k1) (IRI k2) (IRI h :: ir)) -> forall x, In (I h) l -> before x (I h) l -> exists k, x = I k.
Lemma good_move_II : forall k k', good_move (IRI k) (IRI k').
Lemma good_move_OO : forall k k', good_move (IRO k) (IRO k').