let useful_instances s visited =
let env = {
hid_cubes = Hashtbl.create (3 * (List.length visited));
cur_id = s.tag
} in
match check env s visited with
| None -> assert false
| Some db ->
(* eprintf "\n> mon id %d \n" s.tag; *)
(* List.iter (eprintf "\n>%d ") db; eprintf "@."; *)
let db = List.filter (fun id -> not (id = s.tag)) db in
(* List.iter (eprintf "\n>>%d ") db; eprintf "@."; *)
(* Hashtbl.iter (fun id (n, sigma) -> *)
(* eprintf "id:%d == %d[%a]@." id n.tag *)
(* Variable.print_subst sigma) env.hid_cubes; *)
List.map (Hashtbl.find env.hid_cubes) db