let exists s p x = let rec loop y = p y || try Set.exists loop (Map.find y s.inv) with Not_found -> false in let (y, _) = find s x in loop y