LIB = unix.cmxa str.cmxa
UTILS = util.cmx console.cmx listx.cmx pure.cmx num.cmx parser.cmx parser_andrea.cmx
-all: a.out test4.out simple.out
+all: a.out test4.out simple.out simple_test.out
run: test4.out
bash run
simple.out: $(UTILS) simple.ml
$(OCAMLC) -o simple.out $(LIB) $(UTILS) simple.ml
+simple_test.out: $(UTILS) simple.cmx simple_test.ml
+ $(OCAMLC) -o simple_test.out $(LIB) $^
+
%.cmi: %.mli
$(OCAMLC) -c $<
let freshno = List.fold_right (fun (x,_) -> max x) sigma 0 in\r
let env = Pure.env_of_sigma freshno sigma in\r
assert (Pure.diverged (Pure.mwhd (env,div,[])));\r
+ print_endline " D diverged.";\r
assert (not (Pure.diverged (Pure.mwhd (env,conv,[]))));\r
+ print_endline " C converged.";\r
()\r
;;\r
\r
| `Two -> p, delta in\r
let subst = var, mk_lams t k in\r
let p = subst_in_problem subst p in\r
+ sanity p;\r
let p = if phase = `One then {p with div = (match p.div with A(t,_) -> t | _ -> assert false)} else p in\r
sanity p; p\r
;;\r
\r
print_hline();\r
print_endline "ALL DONE. "\r
+\r
+let solve = auto';;\r
--- /dev/null
+val solve : string -> string list -> unit\r
--- /dev/null
+open Simple;;
+open Util;;
+
+let acaso l =
+ let n = Random.int (List.length l) in
+ List.nth l n
+;;
+
+let acaso2 l1 l2 =
+ let n1 = List.length l1 in
+ let n = Random.int (n1 + List.length l2) in
+ if n >= n1 then List.nth l2 (n - n1) else List.nth l1 n
+;;
+
+let gen n vars =
+ let rec take' l n =
+ if n = 0 then []
+ else match l with
+ | [] -> []
+ | [_] -> assert false
+ | x::_::xs -> x :: take' xs (n-1) in
+ let rec aux n inerts lams =
+ if n = 0 then List.hd inerts, take' (Util.sort_uniq (List.tl inerts)) 5
+ else let inerts, lams = if Random.int 2 = 0
+ then inerts, ("(" ^ acaso vars ^ ". " ^ acaso2 inerts lams ^ ")") :: lams
+ else ("(" ^ acaso inerts ^ " " ^ acaso2 inerts lams^ ")") :: inerts, lams
+ in aux (n-1) inerts lams
+ in aux (2*n) vars []
+;;
+
+
+let rec repeat f n =
+ prerr_endline "\n########################### NEW TEST ###########################";
+ f () ;
+ if n > 0 then repeat f (n-1)
+;;
+
+let main =
+ Random.self_init ();
+ let num = 100 in
+ let complex = 200 in
+ let vars = ["x"; "y"; "z"; "v" ; "w"; "a"; "b"; "c"] in
+
+ repeat (fun _ ->
+ let div, convs = gen complex vars in
+ Simple.solve div convs
+ ) num ;
+
+ prerr_endline "\n---- ALL TESTS COMPLETED ----"
+;;