]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/paramodulation/saturate_main.ml
fixed a bug (status not reset properly between calls), tried some other
[helm.git] / helm / ocaml / paramodulation / saturate_main.ml
1 let configuration_file = ref "../../matita/matita.conf.xml";;
2
3 let core_notation_script = "../../matita/core_notation.moo";;
4
5 let get_from_user ~(dbd:HMysql.dbd) =
6   let rec get () =
7     match read_line () with
8     | "" -> []
9     | t -> t::(get ())
10   in
11   let term_string = String.concat "\n" (get ()) in
12   let env, metasenv, term, ugraph =
13     List.nth (Disambiguate.Trivial.disambiguate_string dbd term_string) 0
14   in
15   term, metasenv, ugraph
16 ;;
17
18 let full = ref false;;
19
20 let _ =
21   let module S = Saturation in
22   let set_ratio v = S.weight_age_ratio := v; S.weight_age_counter := v
23   and set_sel v = S.symbols_ratio := v; S.symbols_counter := v;
24   and set_conf f = configuration_file := f
25   and set_ordering o =
26     match o with
27     | "lpo" -> Utils.compare_terms := Utils.lpo
28     | "kbo" -> Utils.compare_terms := Utils.kbo
29     | "nr-kbo" -> Utils.compare_terms := Utils.nonrec_kbo
30     | o -> raise (Arg.Bad ("Unknown term ordering: " ^ o))
31   and set_fullred b = S.use_fullred := b
32   and set_time_limit v = S.time_limit := float_of_int v
33   and set_width w = S.maxwidth := w
34   and set_depth d = S.maxdepth := d
35   and set_full () = full := true
36   in
37   Arg.parse [
38     "-full", Arg.Unit set_full, "Enable full mode";
39     "-f", Arg.Bool set_fullred,
40     "Enable/disable full-reduction strategy (default: enabled)";
41     
42     "-r", Arg.Int set_ratio, "Weight-Age equality selection ratio (default: 4)";
43
44     "-s", Arg.Int set_sel,
45     "symbols-based selection ratio (relative to the weight ratio, default: 0)";
46
47     "-c", Arg.String set_conf, "Configuration file (for the db connection)";
48
49     "-o", Arg.String set_ordering,
50     "Term ordering. Possible values are:\n" ^
51       "\tkbo: Knuth-Bendix ordering\n" ^
52       "\tnr-kbo: Non-recursive variant of kbo (default)\n" ^
53       "\tlpo: Lexicographic path ordering";
54
55     "-l", Arg.Int set_time_limit, "Time limit in seconds (default: no limit)";
56     
57     "-w", Arg.Int set_width,
58     Printf.sprintf "Maximal width (default: %d)" !Saturation.maxwidth;
59     
60     "-d", Arg.Int set_depth,
61     Printf.sprintf "Maximal depth (default: %d)" !Saturation.maxdepth;
62   ] (fun a -> ()) "Usage:"
63 in
64 Helm_registry.load_from !configuration_file;
65 CicNotation.load_notation core_notation_script;
66 CicNotation.load_notation "../../matita/coq.ma";
67 let dbd = HMysql.quick_connect
68   ~host:(Helm_registry.get "db.host")
69   ~user:(Helm_registry.get "db.user")
70   ~database:(Helm_registry.get "db.database")
71   ()
72 in
73 let term, metasenv, ugraph = get_from_user ~dbd in
74 Saturation.main dbd !full term metasenv ugraph;;