let iosh_defId_find iosh defId =
  (* int -> IOS.t -> int option -> int option*)
  let get_vid vid ios io =
    match io with
      Some(i) -> Some(i)
    | None ->
        let there = IOS.exists
            (function None -> false
              | Some(i') -> defId = i') ios in
        if there then Some(vid) else None
  in
  IH.fold get_vid iosh None