open Lambda4;;
-let solve_many = List.iter solve;;
+open Util;;
+
+let assert_separable x =
+ match solve x with
+ | _, `Separable _ -> ()
+ | _, `Unseparable s ->
+ failwith ("assert_separable: unseparable because: " ^ s ^ ".")
+;;
+
+let assert_unseparable x =
+ match solve x with
+ | _, `Unseparable _ -> ()
+ | _, `Separable _ ->
+ failwith ("assert_unseparable: separable.")
+;;
+
+let solve_many = List.iter assert_separable;;
+
+(* TODO *)
+(* div under a lambda in conv *)
+(* assert_unseparable (problem_of (Some"`y y") ["x (_. y y)"] []);; *)
(* p-series problems *)
-let f x = problem_of None [] x in
-solve_many (List.map f [
+let f x = assert_separable (problem_of None [] x) in
+List.iter f [
(* 2 *) [ "x y"; "x z" ; "x (y z)"];
(* 4 *) [ "x y"; "x (a. a x)" ; "y (y z)" ];
(* 5 *) ["a (x. x a) b"; "b (x. x b) a"];
"(((((((z v) (y a)) (b a)) w) b) (a (((((y a) (((z v) (y a)) (b a))) ((b a) (b a))) (x a)) ((((y a) (((z v) (y a)) (b a))) z) (((z v) (y a)) (c y)))))) ((((y a) (((z v) (y a)) (b a))) ((((y a) (((z v) (y a)) (b a))) ((b a) (b a))) (x a))) x))"];
(* 37 *) (* issue with eta-equality of terms in ps *)
["x (a y) z"; "x (a z. y z) w"; "a c"];
-
-]);;
+];;
(* q-series problems *)
o1; o2; o3; o4; o5; o6
]);;
-should_fail(fun () -> problem_of None ["BOT"] []);;
-should_fail(fun () -> problem_of (Some"x y") ["x BOMB"] []);;
-should_fail(fun () -> problem_of (Some"x y z") ["x BOMB z"; "x y y"] []);;
+assert_unseparable(problem_of None ["BOT"] []);;
+assert_unseparable(problem_of (Some"x y") ["x BOMB"] []);;
+assert_unseparable(problem_of (Some"x y z") ["x BOMB z"; "x y y"] []);;
solve_many [
problem_of