]> matita.cs.unibo.it Git - fireball-separation.git/blob - ocaml/problems.ml
Important: added special variable "Z" for zero.
[fireball-separation.git] / ocaml / problems.ml
1 open Lambda4;;
2 open Util;;
3
4 (* Syntax for problem files in problem/ folder:
5
6 - dollar ($) on newline
7   begin new problem
8   $! means that the problem is expected to be separable,
9   $? means that it is expected to be unseparable
10
11 - (#) on new line
12   comment line
13
14 - (D) (C) (N) stand respectively for divergent, convergent, numeric
15
16 - lines starting with spaces inherit the type from the last line
17
18 *)
19
20 let assert_separable x =
21  match solve x with
22  | `Separable _ -> ()
23  | `Unseparable s ->
24    failwith ("assert_separable: unseparable because: " ^ s ^ ".")
25 ;;
26
27 let assert_unseparable x =
28  match solve x with
29  | `Unseparable _ -> ()
30  | `Separable _ ->
31    failwith ("assert_unseparable: separable.")
32 ;;
33
34 let assert_depends x =
35  let c = String.sub (Lambda4.label_of_problem x) 0 1 in
36  if c = "!" then assert_separable x
37   else if c = "?" then assert_unseparable x
38    else (solve x; ())
39 ;;
40
41 (* TODO *)
42 (* div under a lambda in conv *)
43
44 if Array.length Sys.argv = 1
45  then failwith "no command line args. Please use e.g. ./a.out problems/*"
46 else Array.iteri (fun i filename -> if i > 0 then
47  List.iter (assert_depends ++ problem_of) (Parser.from_file filename)
48  ) Sys.argv
49 ;;