1 (* Copyright (C) 2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 let configuration_file = ref "../../matita/matita.conf.xml";;
28 let core_notation_script = "../../matita/core_notation.moo";;
30 let get_from_user ~(dbd:HMysql.dbd) =
32 match read_line () with
36 let term_string = String.concat "\n" (get ()) in
37 let env, metasenv, term, ugraph =
38 List.nth (Disambiguate.Trivial.disambiguate_string dbd term_string) 0
40 term, metasenv, ugraph
43 let full = ref false;;
45 let retrieve_only = ref false;;
48 let module S = Saturation in
49 let set_ratio v = S.weight_age_ratio := v; S.weight_age_counter := v
50 and set_sel v = S.symbols_ratio := v; S.symbols_counter := v;
51 and set_conf f = configuration_file := f
54 | "lpo" -> Utils.compare_terms := Utils.lpo
55 | "kbo" -> Utils.compare_terms := Utils.kbo
56 | "nr-kbo" -> Utils.compare_terms := Utils.nonrec_kbo
57 | o -> raise (Arg.Bad ("Unknown term ordering: " ^ o))
58 and set_fullred b = S.use_fullred := b
59 and set_time_limit v = S.time_limit := float_of_int v
60 and set_width w = S.maxwidth := w
61 and set_depth d = S.maxdepth := d
62 and set_full () = full := true
63 and set_retrieve () = retrieve_only := true
66 "-full", Arg.Unit set_full, "Enable full mode";
67 "-f", Arg.Bool set_fullred,
68 "Enable/disable full-reduction strategy (default: enabled)";
70 "-r", Arg.Int set_ratio, "Weight-Age equality selection ratio (default: 4)";
72 "-s", Arg.Int set_sel,
73 "symbols-based selection ratio (relative to the weight ratio, default: 0)";
75 "-c", Arg.String set_conf, "Configuration file (for the db connection)";
77 "-o", Arg.String set_ordering,
78 "Term ordering. Possible values are:\n" ^
79 "\tkbo: Knuth-Bendix ordering\n" ^
80 "\tnr-kbo: Non-recursive variant of kbo (default)\n" ^
81 "\tlpo: Lexicographic path ordering";
83 "-l", Arg.Int set_time_limit, "Time limit in seconds (default: no limit)";
85 "-w", Arg.Int set_width,
86 Printf.sprintf "Maximal width (default: %d)" !Saturation.maxwidth;
88 "-d", Arg.Int set_depth,
89 Printf.sprintf "Maximal depth (default: %d)" !Saturation.maxdepth;
91 "-retrieve", Arg.Unit set_retrieve, "retrieve only";
92 ] (fun a -> ()) "Usage:"
94 Helm_registry.load_from !configuration_file;
95 CicNotation.load_notation core_notation_script;
96 CicNotation.load_notation "../../matita/coq.ma";
97 let dbd = HMysql.quick_connect
98 ~host:(Helm_registry.get "db.host")
99 ~user:(Helm_registry.get "db.user")
100 ~database:(Helm_registry.get "db.database")
103 let term, metasenv, ugraph = get_from_user ~dbd in
104 if !retrieve_only then
105 Saturation.retrieve_and_print dbd term metasenv ugraph
107 Saturation.main dbd !full term metasenv ugraph