prerr_endline ("INSTANTIATING CRITICAL TO EAT " ^ string_of_var y); y
| [], [] ->
| [], y::_ ->
prerr_endline ("INSTANTIATING CRITICAL TO EAT " ^ string_of_var y); y
| [], [] ->
- let heads = List.sort compare (filter_map (fun t -> match t with `Var _ -> None | x -> hd_of x) ((match p.div with Some t -> [(t :> i_n_var)] | _ -> []) @ p.ps)) in
+ let heads =
+ List.sort compare (filter_map (
+ fun t -> match t with `Var _ -> None | x -> if arity_of_hd x < 0 then None else hd_of x
+ ) ((match p.div with Some t -> [(t :> i_n_var)] | _ -> []) @ p.ps)) in