2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
12 (* $Id: orderings.ml 9869 2009-06-11 22:52:38Z denes $ *)
14 module OT = struct type t = string let compare = Pervasives.compare end
15 module HC = Map.Make(OT)
17 type leaf = int * string
19 let cache = ref HC.empty
25 cache := HC.add s (!num,s) !cache;
33 let problem_file = ref "no-file-given";;
34 let tptppath = ref "/";;
35 let seconds = ref 300;;
38 print_endline ("% SZS status Timeout for " ^
39 Filename.basename !problem_file)
44 Sys.signal 24 (Sys.Signal_handle (fun _ -> fail_msg (); exit 1)) in
46 Sys.signal Sys.sigalrm
47 (Sys.Signal_handle (fun _ -> fail_msg (); exit 1)) in
49 "--tptppath", Arg.String (fun p -> tptppath := p),
50 ("[path] TPTP lib root, default " ^ !tptppath);
51 "--timeout", Arg.Int (fun p -> seconds := p),
52 ("[seconds] timeout, default " ^ string_of_int !seconds);
53 ] (fun x -> problem_file := x) "
54 Matitaprover is the first order automatic prover that equips the
55 Matita interactive theorem prover (http://matita.cs.unibo.it).
57 Developed by A.Asperti, M.Denes and E.Tassi, released under GPL-2.1
59 If --tptppath is given, instead of the problem file you can just give the
60 problem name with the .p suffix (e.g. BOO001-1.p)
62 If --tptppath is not given, included files (i.e. axiom sets) are searched
63 in the current directory only.
65 usage: matitaprover [options] problemfile";
66 let hypotheses, goals = Tptp_cnf.parse ~tptppath:!tptppath !problem_file in
67 let goal = match goals with [x] -> x | _ -> assert false in
68 let module B : Terms.Blob
69 with type t = leaf and type input = Ast.term = struct
72 let compare (a,_) (b,_) = Pervasives.compare a b
76 let rec embed m = function
77 | Ast.Variable name ->
78 (try m, List.assoc name m
80 let t = Terms.Var ~-(List.length m) in
82 | Ast.Constant name -> m, Terms.Leaf (hash name)
83 | Ast.Function (name,args) ->
86 (fun x _ m -> embed m x) m args
88 m, Terms.Node (Terms.Leaf (hash name):: args)
91 let vars, ty = embed [] ty in
92 let _, bo = embed vars bo in
93 let bo = Terms.Node (bo :: List.map snd (List.rev vars)) in
96 let embed t = snd(embed [] t);;
100 let module P = Paramod.Paramod(B) in
101 let module Pp = Pp.Pp(B) in
102 let bag = Terms.M.empty, 0 in
103 let bag, g_passives = P.mk_goal bag goal in
105 HExtlib.list_mapi_acc (fun x _ b -> P.mk_passive b x) bag hypotheses
107 prerr_endline "Order";
109 (fun _ (w,x) -> prerr_endline (" " ^ x ^ " is " ^ string_of_int w)) !cache;
110 prerr_endline "Facts";
111 List.iter (fun x -> prerr_endline (" " ^ Pp.pp_unit_clause x)) passives;
112 prerr_endline "Goal";
113 prerr_endline (" " ^ Pp.pp_unit_clause g_passives);
114 let _ = Unix.alarm !seconds in
115 match P.paramod ~max_steps:max_int bag ~g_passives:[g_passives] ~passives with
118 print_endline ("% SZS status Unsatisfiable for " ^
119 Filename.basename !problem_file);
120 print_endline ("% SZS output start CNFRefutation for " ^
121 Filename.basename !problem_file);
124 print_endline (Pp.pp_unit_clause ~margin:max_int
125 (fst(Terms.M.find x bag)))) l;
126 print_endline ("% SZS output end CNFRefutation for " ^
127 Filename.basename !problem_file);