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.

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.