Definition get_op_output_keys (l : list op) : list K :=
    filterMap (fun x => match x with
                          | O k => Some k
                          | _ => None
                        end) l.

Lemma get_op_output_keys_defn : forall x l, get_op_output_keys (x :: l) = match x with | O k => k :: get_op_output_keys l | _ => get_op_output_keys l end.