Backtrack _ -> `Unseparable "backtrack"
;;
+let no_bombs_pacmans p =
+ not (List.exists (eta_subterm `Bottom) (p.ps@p.conv))
+ && not (List.exists (eta_subterm `Pacman) p.ps)
+ && Util.option_map (eta_subterm `Pacman) p.div <> Some true
+;;
+
let check p =
- (* TODO check if there are duplicates in p.ps
- before it was: ps = sort_uniq ~compare:eta_compare (ps :> nf list) *)
- (* FIXME what about initial fragments? *)
if (let rec f = function
| [] -> false
| hd::tl -> List.exists (eta_eq hd) tl || f tl in
- f p.ps)
+ f p.ps) (* FIXME what about initial fragments of numbers? *)
then `CompleteUnseparable "ps contains duplicates"
(* check if div occurs somewhere in ps@conv *)
else if (match p.div with
| None -> true
| Some div -> not (List.exists (eta_subterm div) (p.ps@p.conv))
- ) && false (* TODO no bombs && pacmans *)
+ ) && no_bombs_pacmans p
then `CompleteSeparable "no bombs, pacmans and div"
- else if false (* TODO bombs or div fuori da lambda in ps@conv *)
- then `CompleteUnseparable "bombs or div fuori da lambda in ps@conv"
+ (* il check seguente e' spostato nel parser e lancia un ParsingError *)
+ (* else if false (* TODO bombs or div fuori da lambda in ps@conv *)
+ then `CompleteUnseparable "bombs or div fuori da lambda in ps@conv" *)
else if p.div = None
then `CompleteSeparable "no div"
else `Uncomplete