List.hd divs) div in
{p with div=option_map cast_to_i_var div; ps=List.map cast_to_i_n_var ps; conv=List.map cast_to_i_n_var conv}
+let cast_to_ps =
+ function
+ #i_num_var as y -> (y : i_num_var)
+ | `Bottom | `Pacman -> raise (Backtrack "foo")
+ | t ->
+ prerr_endline (print (t :> nf));
+ assert false (* algorithm failed *)
+
let subst_in_problem x inst ({freshno; div; conv; ps; sigma} as p) =
let len_ps = List.length ps in
(*(let l = Array.to_list (Array.init (freshno + 1) string_of_var) in
match u with
| `N i -> acc_new_ps,i
| _ ->
- let ps = List.map (fun t -> cast_to_i_num_var (subst false false x inst (t:> nf))) (acc_ps@acc_new_ps) in
+ let ps = List.map (fun t -> cast_to_ps (subst false false x inst (t:> nf))) (acc_ps@acc_new_ps) in
let super_simplified_ps = super_simplify_ps ps ps in
(*prerr_endline ("CERCO u:" ^ print (fst u :> nf));
List.iter (fun x -> prerr_endline ("IN: " ^ print (fst x :> nf))) ps;