wenzelm@32327
|
1 |
(* Title: HOL/Tools/ATP_Manager/atp_wrapper.ML
|
wenzelm@28592
|
2 |
Author: Fabian Immler, TU Muenchen
|
blanchet@36371
|
3 |
Author: Jasmin Blanchette, TU Muenchen
|
wenzelm@28592
|
4 |
|
wenzelm@28592
|
5 |
Wrapper functions for external ATPs.
|
wenzelm@28592
|
6 |
*)
|
wenzelm@28592
|
7 |
|
wenzelm@28592
|
8 |
signature ATP_WRAPPER =
|
wenzelm@28592
|
9 |
sig
|
blanchet@35867
|
10 |
type prover = ATP_Manager.prover
|
boehmes@32864
|
11 |
|
blanchet@35867
|
12 |
(* hooks for problem files *)
|
blanchet@35867
|
13 |
val destdir : string Config.T
|
blanchet@35867
|
14 |
val problem_prefix : string Config.T
|
blanchet@35867
|
15 |
val measure_runtime : bool Config.T
|
boehmes@32864
|
16 |
|
blanchet@35867
|
17 |
val refresh_systems_on_tptp : unit -> unit
|
blanchet@36371
|
18 |
val default_atps_param_value : unit -> string
|
blanchet@35867
|
19 |
val setup : theory -> theory
|
wenzelm@28592
|
20 |
end;
|
wenzelm@28592
|
21 |
|
blanchet@35865
|
22 |
structure ATP_Wrapper : ATP_WRAPPER =
|
wenzelm@28592
|
23 |
struct
|
wenzelm@28596
|
24 |
|
blanchet@36187
|
25 |
open Sledgehammer_Util
|
blanchet@35967
|
26 |
open Sledgehammer_Fact_Preprocessor
|
blanchet@35865
|
27 |
open Sledgehammer_HOL_Clause
|
blanchet@35865
|
28 |
open Sledgehammer_Fact_Filter
|
blanchet@35865
|
29 |
open Sledgehammer_Proof_Reconstruct
|
blanchet@35867
|
30 |
open ATP_Manager
|
blanchet@35826
|
31 |
|
wenzelm@28596
|
32 |
(** generic ATP wrapper **)
|
wenzelm@28596
|
33 |
|
wenzelm@32944
|
34 |
(* external problem files *)
|
wenzelm@28596
|
35 |
|
wenzelm@36001
|
36 |
val (destdir, destdir_setup) = Attrib.config_string "atp_destdir" (K "");
|
boehmes@32864
|
37 |
(*Empty string means create files in Isabelle's temporary files directory.*)
|
boehmes@32864
|
38 |
|
boehmes@32864
|
39 |
val (problem_prefix, problem_prefix_setup) =
|
wenzelm@36001
|
40 |
Attrib.config_string "atp_problem_prefix" (K "prob");
|
boehmes@32864
|
41 |
|
boehmes@33239
|
42 |
val (measure_runtime, measure_runtime_setup) =
|
wenzelm@36001
|
43 |
Attrib.config_bool "atp_measure_runtime" (K false);
|
boehmes@33239
|
44 |
|
boehmes@32864
|
45 |
|
blanchet@35867
|
46 |
(* prover configuration *)
|
boehmes@32864
|
47 |
|
wenzelm@32941
|
48 |
type prover_config =
|
blanchet@36370
|
49 |
{home: string,
|
blanchet@36370
|
50 |
executable: string,
|
blanchet@36370
|
51 |
arguments: Time.time -> string,
|
blanchet@36370
|
52 |
proof_delims: (string * string) list,
|
blanchet@36370
|
53 |
known_failures: (failure * string) list,
|
blanchet@36370
|
54 |
max_new_clauses: int,
|
blanchet@36370
|
55 |
prefers_theory_relevant: bool};
|
boehmes@32864
|
56 |
|
wenzelm@28596
|
57 |
|
wenzelm@28596
|
58 |
(* basic template *)
|
wenzelm@28596
|
59 |
|
blanchet@36370
|
60 |
val remotify = prefix "remote_"
|
blanchet@36370
|
61 |
|
boehmes@32458
|
62 |
fun with_path cleanup after f path =
|
boehmes@32458
|
63 |
Exn.capture f path
|
boehmes@32458
|
64 |
|> tap (fn _ => cleanup path)
|
boehmes@32458
|
65 |
|> Exn.release
|
blanchet@36369
|
66 |
|> tap (after path)
|
boehmes@32458
|
67 |
|
blanchet@36369
|
68 |
(* Splits by the first possible of a list of delimiters. *)
|
blanchet@36369
|
69 |
fun extract_proof delims output =
|
blanchet@36369
|
70 |
case pairself (find_first (fn s => String.isSubstring s output))
|
blanchet@36369
|
71 |
(ListPair.unzip delims) of
|
blanchet@36369
|
72 |
(SOME begin_delim, SOME end_delim) =>
|
blanchet@36369
|
73 |
output |> first_field begin_delim |> the |> snd
|
blanchet@36369
|
74 |
|> first_field end_delim |> the |> fst
|
blanchet@36369
|
75 |
| _ => ""
|
blanchet@36369
|
76 |
|
blanchet@36370
|
77 |
fun extract_proof_and_outcome res_code proof_delims known_failures output =
|
blanchet@36370
|
78 |
case map_filter (fn (failure, pattern) =>
|
blanchet@36370
|
79 |
if String.isSubstring pattern output then SOME failure
|
blanchet@36370
|
80 |
else NONE) known_failures of
|
blanchet@36369
|
81 |
[] => (case extract_proof proof_delims output of
|
blanchet@36370
|
82 |
"" => ("", SOME UnknownError)
|
blanchet@36370
|
83 |
| proof => if res_code = 0 then (proof, NONE)
|
blanchet@36370
|
84 |
else ("", SOME UnknownError))
|
blanchet@36370
|
85 |
| (failure :: _) => ("", SOME failure)
|
blanchet@36370
|
86 |
|
blanchet@36370
|
87 |
fun string_for_failure Unprovable = "The ATP problem is unprovable."
|
blanchet@36370
|
88 |
| string_for_failure TimedOut = "Timed out."
|
blanchet@36370
|
89 |
| string_for_failure OutOfResources = "The ATP ran out of resources."
|
blanchet@36370
|
90 |
| string_for_failure OldSpass =
|
blanchet@36370
|
91 |
"Warning: Sledgehammer requires a more recent version of SPASS with \
|
blanchet@36370
|
92 |
\support for the TPTP syntax. To install it, download and untar the \
|
blanchet@36370
|
93 |
\package \"http://isabelle.in.tum.de/~blanchet/spass-3.7.tgz\" and add the \
|
blanchet@36370
|
94 |
\\"spass-3.7\" directory's full path to \"" ^
|
blanchet@36370
|
95 |
Path.implode (Path.expand (Path.appends
|
blanchet@36370
|
96 |
(Path.variable "ISABELLE_HOME_USER" ::
|
blanchet@36370
|
97 |
map Path.basic ["etc", "components"]))) ^
|
blanchet@36370
|
98 |
"\" on a line of its own."
|
blanchet@36370
|
99 |
| string_for_failure MalformedOutput = "Error: The ATP output is malformed."
|
blanchet@36370
|
100 |
| string_for_failure UnknownError = "Error: An unknown ATP error occurred."
|
blanchet@35865
|
101 |
|
blanchet@36289
|
102 |
fun generic_prover overlord get_facts prepare write_file home executable args
|
blanchet@36369
|
103 |
proof_delims known_failures name
|
blanchet@36287
|
104 |
({debug, full_types, explicit_apply, isar_proof, modulus, sorts, ...}
|
blanchet@36287
|
105 |
: params) minimize_command
|
blanchet@35967
|
106 |
({subgoal, goal, relevance_override, axiom_clauses, filtered_clauses}
|
blanchet@35967
|
107 |
: problem) =
|
wenzelm@28596
|
108 |
let
|
immler@31750
|
109 |
(* get clauses and prepare them for writing *)
|
wenzelm@32942
|
110 |
val (ctxt, (chain_ths, th)) = goal;
|
wenzelm@32942
|
111 |
val thy = ProofContext.theory_of ctxt;
|
blanchet@35865
|
112 |
val chain_ths = map (Thm.put_name_hint chained_hint) chain_ths;
|
blanchet@35967
|
113 |
val goal_cls = #1 (neg_conjecture_clauses ctxt th subgoal);
|
immler@31752
|
114 |
val the_filtered_clauses =
|
wenzelm@32942
|
115 |
(case filtered_clauses of
|
blanchet@35967
|
116 |
NONE => get_facts relevance_override goal goal_cls
|
wenzelm@32942
|
117 |
| SOME fcls => fcls);
|
immler@31409
|
118 |
val the_axiom_clauses =
|
wenzelm@32942
|
119 |
(case axiom_clauses of
|
wenzelm@32942
|
120 |
NONE => the_filtered_clauses
|
wenzelm@32942
|
121 |
| SOME axcls => axcls);
|
blanchet@35967
|
122 |
val (internal_thm_names, clauses) =
|
wenzelm@32942
|
123 |
prepare goal_cls chain_ths the_axiom_clauses the_filtered_clauses thy;
|
immler@31750
|
124 |
|
boehmes@32864
|
125 |
(* path to unique problem file *)
|
blanchet@36141
|
126 |
val destdir' = if overlord then getenv "ISABELLE_HOME_USER"
|
blanchet@36141
|
127 |
else Config.get ctxt destdir;
|
wenzelm@32942
|
128 |
val problem_prefix' = Config.get ctxt problem_prefix;
|
boehmes@32864
|
129 |
fun prob_pathname nr =
|
blanchet@36141
|
130 |
let
|
blanchet@36141
|
131 |
val probfile =
|
blanchet@36141
|
132 |
Path.basic (problem_prefix' ^
|
blanchet@36141
|
133 |
(if overlord then "_" ^ name else serial_string ())
|
blanchet@36141
|
134 |
^ "_" ^ string_of_int nr)
|
wenzelm@32942
|
135 |
in
|
wenzelm@32942
|
136 |
if destdir' = "" then File.tmp_path probfile
|
wenzelm@35570
|
137 |
else if File.exists (Path.explode destdir')
|
blanchet@36281
|
138 |
then Path.append (Path.explode destdir') probfile
|
blanchet@36169
|
139 |
else error ("No such directory: " ^ destdir' ^ ".")
|
wenzelm@32942
|
140 |
end;
|
boehmes@32864
|
141 |
|
blanchet@36289
|
142 |
val command = Path.explode (home ^ "/" ^ executable)
|
immler@31750
|
143 |
(* write out problem file and call prover *)
|
blanchet@36289
|
144 |
fun command_line probfile =
|
blanchet@36284
|
145 |
(if Config.get ctxt measure_runtime then
|
blanchet@36289
|
146 |
"TIMEFORMAT='%3U'; { time " ^
|
blanchet@36289
|
147 |
space_implode " " [File.shell_path command, args,
|
blanchet@36289
|
148 |
File.shell_path probfile] ^ " ; } 2>&1"
|
blanchet@36284
|
149 |
else
|
blanchet@36289
|
150 |
space_implode " " ["exec", File.shell_path command, args,
|
blanchet@36289
|
151 |
File.shell_path probfile, "2>&1"]) ^
|
blanchet@36284
|
152 |
(if overlord then
|
blanchet@36286
|
153 |
" | sed 's/,/, /g' \
|
blanchet@36286
|
154 |
\| sed 's/\\([^!=]\\)\\([=|]\\)\\([^=]\\)/\\1 \\2 \\3/g' \
|
blanchet@36286
|
155 |
\| sed 's/! =/ !=/g' \
|
blanchet@36286
|
156 |
\| sed 's/ / /g' | sed 's/| |/||/g' \
|
blanchet@36286
|
157 |
\| sed 's/ = = =/===/g' \
|
blanchet@36286
|
158 |
\| sed 's/= = /== /g'"
|
blanchet@36284
|
159 |
else
|
blanchet@36284
|
160 |
"")
|
boehmes@32510
|
161 |
fun split_time s =
|
boehmes@32510
|
162 |
let
|
wenzelm@32942
|
163 |
val split = String.tokens (fn c => str c = "\n");
|
blanchet@36369
|
164 |
val (output, t) = s |> split |> split_last |> apfst cat_lines;
|
wenzelm@32942
|
165 |
fun as_num f = f >> (fst o read_int);
|
wenzelm@32942
|
166 |
val num = as_num (Scan.many1 Symbol.is_ascii_digit);
|
wenzelm@32942
|
167 |
val digit = Scan.one Symbol.is_ascii_digit;
|
wenzelm@32942
|
168 |
val num3 = as_num (digit ::: digit ::: (digit >> single));
|
wenzelm@32942
|
169 |
val time = num --| Scan.$$ "." -- num3 >> (fn (a, b) => a * 1000 + b);
|
wenzelm@32942
|
170 |
val as_time = the_default 0 o Scan.read Symbol.stopper time o explode;
|
blanchet@36369
|
171 |
in (output, as_time t) end;
|
boehmes@33239
|
172 |
fun split_time' s =
|
boehmes@33239
|
173 |
if Config.get ctxt measure_runtime then split_time s else (s, 0)
|
boehmes@32458
|
174 |
fun run_on probfile =
|
blanchet@36289
|
175 |
if File.exists command then
|
blanchet@36235
|
176 |
write_file full_types explicit_apply probfile clauses
|
blanchet@36289
|
177 |
|> pair (apfst split_time' (bash_output (command_line probfile)))
|
blanchet@36289
|
178 |
else error ("Bad executable: " ^ Path.implode command ^ ".");
|
wenzelm@28592
|
179 |
|
blanchet@36167
|
180 |
(* If the problem file has not been exported, remove it; otherwise, export
|
blanchet@36167
|
181 |
the proof file too. *)
|
wenzelm@32942
|
182 |
fun cleanup probfile = if destdir' = "" then try File.rm probfile else NONE;
|
blanchet@36369
|
183 |
fun export probfile (((output, _), _), _) =
|
blanchet@36187
|
184 |
if destdir' = "" then
|
blanchet@36187
|
185 |
()
|
blanchet@36187
|
186 |
else
|
blanchet@36187
|
187 |
File.write (Path.explode (Path.implode probfile ^ "_proof"))
|
blanchet@36282
|
188 |
((if overlord then
|
blanchet@36289
|
189 |
"% " ^ command_line probfile ^ "\n% " ^ timestamp () ^
|
blanchet@36289
|
190 |
"\n"
|
blanchet@36282
|
191 |
else
|
blanchet@36369
|
192 |
"") ^ output)
|
wenzelm@32261
|
193 |
|
blanchet@36370
|
194 |
val (((output, atp_run_time_in_msecs), res_code), _) =
|
wenzelm@35570
|
195 |
with_path cleanup export run_on (prob_pathname subgoal);
|
boehmes@32458
|
196 |
|
blanchet@36167
|
197 |
(* Check for success and print out some information on failure. *)
|
blanchet@36370
|
198 |
val (proof, outcome) =
|
blanchet@36370
|
199 |
extract_proof_and_outcome res_code proof_delims known_failures output
|
blanchet@35967
|
200 |
val (message, relevant_thm_names) =
|
blanchet@36370
|
201 |
case outcome of
|
blanchet@36370
|
202 |
NONE => proof_text isar_proof debug modulus sorts ctxt
|
blanchet@36370
|
203 |
(minimize_command, proof, internal_thm_names, th,
|
blanchet@36370
|
204 |
subgoal)
|
blanchet@36370
|
205 |
| SOME failure => (string_for_failure failure ^ "\n", [])
|
boehmes@32864
|
206 |
in
|
blanchet@36370
|
207 |
{outcome = outcome, message = message,
|
blanchet@35967
|
208 |
relevant_thm_names = relevant_thm_names,
|
blanchet@36369
|
209 |
atp_run_time_in_msecs = atp_run_time_in_msecs, output = output,
|
blanchet@36369
|
210 |
proof = proof, internal_thm_names = internal_thm_names,
|
blanchet@35967
|
211 |
filtered_clauses = the_filtered_clauses}
|
wenzelm@32942
|
212 |
end;
|
wenzelm@28596
|
213 |
|
wenzelm@28596
|
214 |
|
wenzelm@28596
|
215 |
(* generic TPTP-based provers *)
|
wenzelm@28596
|
216 |
|
blanchet@35865
|
217 |
fun generic_tptp_prover
|
blanchet@36369
|
218 |
(name, {home, executable, arguments, proof_delims, known_failures,
|
blanchet@36369
|
219 |
max_new_clauses, prefers_theory_relevant})
|
blanchet@36264
|
220 |
(params as {debug, overlord, respect_no_atp, relevance_threshold,
|
blanchet@36264
|
221 |
convergence, theory_relevant, higher_order, follow_defs,
|
blanchet@36287
|
222 |
isar_proof, ...})
|
blanchet@36281
|
223 |
minimize_command timeout =
|
blanchet@36141
|
224 |
generic_prover overlord
|
blanchet@36058
|
225 |
(get_relevant_facts respect_no_atp relevance_threshold convergence
|
blanchet@36058
|
226 |
higher_order follow_defs max_new_clauses
|
blanchet@36220
|
227 |
(the_default prefers_theory_relevant theory_relevant))
|
blanchet@36222
|
228 |
(prepare_clauses higher_order false)
|
blanchet@36289
|
229 |
(write_tptp_file (debug andalso overlord andalso not isar_proof)) home
|
blanchet@36369
|
230 |
executable (arguments timeout) proof_delims known_failures name params
|
blanchet@36369
|
231 |
minimize_command
|
wenzelm@28592
|
232 |
|
blanchet@35967
|
233 |
fun tptp_prover name p = (name, generic_tptp_prover (name, p));
|
wenzelm@28592
|
234 |
|
wenzelm@32941
|
235 |
|
boehmes@32864
|
236 |
(** common provers **)
|
wenzelm@28596
|
237 |
|
blanchet@36140
|
238 |
fun generous_to_secs time = (Time.toMilliseconds time + 999) div 1000
|
blanchet@36140
|
239 |
|
wenzelm@28596
|
240 |
(* Vampire *)
|
wenzelm@28596
|
241 |
|
blanchet@36289
|
242 |
(* Vampire requires an explicit time limit. *)
|
wenzelm@28596
|
243 |
|
blanchet@35967
|
244 |
val vampire_config : prover_config =
|
blanchet@36289
|
245 |
{home = getenv "VAMPIRE_HOME",
|
blanchet@36289
|
246 |
executable = "vampire",
|
blanchet@35967
|
247 |
arguments = (fn timeout => "--output_syntax tptp --mode casc -t " ^
|
blanchet@36140
|
248 |
string_of_int (generous_to_secs timeout)),
|
blanchet@36369
|
249 |
proof_delims = [("=========== Refutation ==========",
|
blanchet@36369
|
250 |
"======= End of refutation =======")],
|
blanchet@36265
|
251 |
known_failures =
|
blanchet@36370
|
252 |
[(Unprovable, "Satisfiability detected"),
|
blanchet@36370
|
253 |
(OutOfResources, "CANNOT PROVE"),
|
blanchet@36370
|
254 |
(OutOfResources, "Refutation not found")],
|
blanchet@35967
|
255 |
max_new_clauses = 60,
|
blanchet@36289
|
256 |
prefers_theory_relevant = false}
|
blanchet@35967
|
257 |
val vampire = tptp_prover "vampire" vampire_config
|
wenzelm@28596
|
258 |
|
wenzelm@28596
|
259 |
|
wenzelm@28596
|
260 |
(* E prover *)
|
wenzelm@28596
|
261 |
|
blanchet@36369
|
262 |
val tstp_proof_delims =
|
blanchet@36369
|
263 |
("# SZS output start CNFRefutation.", "# SZS output end CNFRefutation")
|
blanchet@36369
|
264 |
|
blanchet@35967
|
265 |
val e_config : prover_config =
|
blanchet@36289
|
266 |
{home = getenv "E_HOME",
|
blanchet@36289
|
267 |
executable = "eproof",
|
blanchet@35967
|
268 |
arguments = (fn timeout => "--tstp-in --tstp-out -l5 -xAutoDev \
|
blanchet@35967
|
269 |
\-tAutoDev --silent --cpu-limit=" ^
|
blanchet@36140
|
270 |
string_of_int (generous_to_secs timeout)),
|
blanchet@36369
|
271 |
proof_delims = [tstp_proof_delims],
|
blanchet@36265
|
272 |
known_failures =
|
blanchet@36370
|
273 |
[(Unprovable, "SZS status: Satisfiable"),
|
blanchet@36370
|
274 |
(Unprovable, "SZS status Satisfiable"),
|
blanchet@36370
|
275 |
(TimedOut, "Failure: Resource limit exceeded (time)"),
|
blanchet@36370
|
276 |
(TimedOut, "time limit exceeded"),
|
blanchet@36370
|
277 |
(OutOfResources,
|
blanchet@36370
|
278 |
"# Cannot determine problem status within resource limit"),
|
blanchet@36370
|
279 |
(OutOfResources, "SZS status: ResourceOut"),
|
blanchet@36370
|
280 |
(OutOfResources, "SZS status ResourceOut")],
|
blanchet@35967
|
281 |
max_new_clauses = 100,
|
blanchet@36289
|
282 |
prefers_theory_relevant = false}
|
blanchet@35967
|
283 |
val e = tptp_prover "e" e_config
|
wenzelm@28596
|
284 |
|
wenzelm@28596
|
285 |
|
wenzelm@28596
|
286 |
(* SPASS *)
|
wenzelm@28596
|
287 |
|
blanchet@35865
|
288 |
fun generic_dfg_prover
|
blanchet@36369
|
289 |
(name, {home, executable, arguments, proof_delims, known_failures,
|
blanchet@36369
|
290 |
max_new_clauses, prefers_theory_relevant})
|
blanchet@36141
|
291 |
(params as {overlord, respect_no_atp, relevance_threshold, convergence,
|
blanchet@36220
|
292 |
theory_relevant, higher_order, follow_defs, ...})
|
blanchet@36281
|
293 |
minimize_command timeout =
|
blanchet@36141
|
294 |
generic_prover overlord
|
blanchet@36058
|
295 |
(get_relevant_facts respect_no_atp relevance_threshold convergence
|
blanchet@36058
|
296 |
higher_order follow_defs max_new_clauses
|
blanchet@36220
|
297 |
(the_default prefers_theory_relevant theory_relevant))
|
blanchet@36289
|
298 |
(prepare_clauses higher_order true) write_dfg_file home executable
|
blanchet@36369
|
299 |
(arguments timeout) proof_delims known_failures name params
|
blanchet@36369
|
300 |
minimize_command
|
boehmes@32869
|
301 |
|
blanchet@36264
|
302 |
fun dfg_prover name p = (name, generic_dfg_prover (name, p))
|
boehmes@32869
|
303 |
|
blanchet@36219
|
304 |
(* The "-VarWeight=3" option helps the higher-order problems, probably by
|
blanchet@36219
|
305 |
counteracting the presence of "hAPP". *)
|
blanchet@36059
|
306 |
val spass_config : prover_config =
|
blanchet@36289
|
307 |
{home = getenv "SPASS_HOME",
|
blanchet@36289
|
308 |
executable = "SPASS",
|
blanchet@36289
|
309 |
arguments = (fn timeout => "-Auto -SOS=1 -PGiven=0 -PProblem=0 -Splits=0" ^
|
blanchet@36289
|
310 |
" -FullRed=0 -DocProof -VarWeight=3 -TimeLimit=" ^
|
blanchet@36289
|
311 |
string_of_int (generous_to_secs timeout)),
|
blanchet@36369
|
312 |
proof_delims = [("Here is a proof", "Formulae used in the proof")],
|
blanchet@36289
|
313 |
known_failures =
|
blanchet@36370
|
314 |
[(Unprovable, "SPASS beiseite: Completion found"),
|
blanchet@36370
|
315 |
(TimedOut, "SPASS beiseite: Ran out of time"),
|
blanchet@36370
|
316 |
(OutOfResources, "SPASS beiseite: Maximal number of loops exceeded")],
|
blanchet@36289
|
317 |
max_new_clauses = 40,
|
blanchet@36289
|
318 |
prefers_theory_relevant = true}
|
blanchet@36264
|
319 |
val spass = dfg_prover "spass" spass_config
|
blanchet@35967
|
320 |
|
blanchet@36264
|
321 |
(* SPASS 3.7 supports both the DFG and the TPTP syntax, whereas SPASS 3.0
|
blanchet@36264
|
322 |
supports only the DFG syntax. As soon as all Isabelle repository/snapshot
|
blanchet@36264
|
323 |
users have upgraded to 3.7, we can kill "spass" (and all DFG support in
|
blanchet@36264
|
324 |
Sledgehammer) and rename "spass_tptp" "spass". *)
|
blanchet@36264
|
325 |
|
blanchet@36265
|
326 |
(* FIXME: Change the error message below to point to the Isabelle download
|
blanchet@36265
|
327 |
page once the package is there (around the Isabelle2010 release). *)
|
blanchet@36265
|
328 |
|
blanchet@36264
|
329 |
val spass_tptp_config =
|
blanchet@36289
|
330 |
{home = #home spass_config,
|
blanchet@36289
|
331 |
executable = #executable spass_config,
|
blanchet@36264
|
332 |
arguments = prefix "-TPTP " o #arguments spass_config,
|
blanchet@36369
|
333 |
proof_delims = #proof_delims spass_config,
|
blanchet@36265
|
334 |
known_failures =
|
blanchet@36265
|
335 |
#known_failures spass_config @
|
blanchet@36370
|
336 |
[(OldSpass, "unrecognized option `-TPTP'"),
|
blanchet@36370
|
337 |
(OldSpass, "Unrecognized option TPTP")],
|
blanchet@36264
|
338 |
max_new_clauses = #max_new_clauses spass_config,
|
blanchet@36289
|
339 |
prefers_theory_relevant = #prefers_theory_relevant spass_config}
|
blanchet@36264
|
340 |
val spass_tptp = tptp_prover "spass_tptp" spass_tptp_config
|
wenzelm@28596
|
341 |
|
wenzelm@28596
|
342 |
(* remote prover invocation via SystemOnTPTP *)
|
wenzelm@28596
|
343 |
|
wenzelm@32942
|
344 |
val systems = Synchronized.var "atp_wrapper_systems" ([]: string list);
|
immler@31828
|
345 |
|
immler@31828
|
346 |
fun get_systems () =
|
blanchet@36370
|
347 |
case bash_output "\"$ISABELLE_ATP_MANAGER/SystemOnTPTP\" -w" of
|
blanchet@36370
|
348 |
(answer, 0) => split_lines answer
|
blanchet@36370
|
349 |
| (answer, _) =>
|
blanchet@36370
|
350 |
error ("Failed to get available systems at SystemOnTPTP:\n" ^ answer)
|
immler@31828
|
351 |
|
blanchet@35867
|
352 |
fun refresh_systems_on_tptp () =
|
blanchet@35867
|
353 |
Synchronized.change systems (fn _ => get_systems ());
|
immler@31828
|
354 |
|
immler@31828
|
355 |
fun get_system prefix = Synchronized.change_result systems (fn systems =>
|
boehmes@32864
|
356 |
(if null systems then get_systems () else systems)
|
wenzelm@32942
|
357 |
|> `(find_first (String.isPrefix prefix)));
|
immler@31828
|
358 |
|
wenzelm@32948
|
359 |
fun the_system prefix =
|
boehmes@32864
|
360 |
(case get_system prefix of
|
blanchet@36370
|
361 |
NONE => error ("System " ^ quote prefix ^
|
blanchet@36370
|
362 |
" not available at SystemOnTPTP.")
|
wenzelm@32942
|
363 |
| SOME sys => sys);
|
wenzelm@28596
|
364 |
|
blanchet@36265
|
365 |
val remote_known_failures =
|
blanchet@36370
|
366 |
[(TimedOut, "says Timeout"),
|
blanchet@36370
|
367 |
(MalformedOutput, "Remote-script could not extract proof")]
|
blanchet@35865
|
368 |
|
blanchet@36059
|
369 |
fun remote_prover_config prover_prefix args
|
blanchet@36369
|
370 |
({proof_delims, known_failures, max_new_clauses,
|
blanchet@36369
|
371 |
prefers_theory_relevant, ...} : prover_config) : prover_config =
|
blanchet@36289
|
372 |
{home = getenv "ISABELLE_ATP_MANAGER",
|
blanchet@36289
|
373 |
executable = "SystemOnTPTP",
|
blanchet@35967
|
374 |
arguments = (fn timeout =>
|
blanchet@36140
|
375 |
args ^ " -t " ^ string_of_int (generous_to_secs timeout) ^ " -s " ^
|
blanchet@35967
|
376 |
the_system prover_prefix),
|
blanchet@36369
|
377 |
proof_delims = insert (op =) tstp_proof_delims proof_delims,
|
blanchet@36265
|
378 |
known_failures = remote_known_failures @ known_failures,
|
blanchet@35967
|
379 |
max_new_clauses = max_new_clauses,
|
blanchet@36289
|
380 |
prefers_theory_relevant = prefers_theory_relevant}
|
boehmes@32864
|
381 |
|
blanchet@35967
|
382 |
val remote_vampire =
|
blanchet@36289
|
383 |
tptp_prover (remotify (fst vampire))
|
blanchet@36059
|
384 |
(remote_prover_config "Vampire---9" "" vampire_config)
|
boehmes@32864
|
385 |
|
blanchet@35967
|
386 |
val remote_e =
|
blanchet@36289
|
387 |
tptp_prover (remotify (fst e))
|
blanchet@36289
|
388 |
(remote_prover_config "EP---" "" e_config)
|
boehmes@32864
|
389 |
|
blanchet@35967
|
390 |
val remote_spass =
|
blanchet@36289
|
391 |
tptp_prover (remotify (fst spass))
|
blanchet@36289
|
392 |
(remote_prover_config "SPASS---" "-x" spass_config)
|
wenzelm@28592
|
393 |
|
blanchet@36371
|
394 |
fun maybe_remote (name, _) ({home, ...} : prover_config) =
|
blanchet@36371
|
395 |
name |> home = "" ? remotify
|
blanchet@36371
|
396 |
|
blanchet@36371
|
397 |
fun default_atps_param_value () =
|
blanchet@36371
|
398 |
space_implode " " [maybe_remote e e_config, maybe_remote spass spass_config,
|
blanchet@36371
|
399 |
remotify (fst vampire)]
|
blanchet@36371
|
400 |
|
blanchet@36289
|
401 |
val provers =
|
blanchet@36289
|
402 |
[spass, spass_tptp, vampire, e, remote_vampire, remote_spass, remote_e]
|
blanchet@35867
|
403 |
val prover_setup = fold add_prover provers
|
blanchet@35867
|
404 |
|
blanchet@35867
|
405 |
val setup =
|
blanchet@35867
|
406 |
destdir_setup
|
blanchet@35867
|
407 |
#> problem_prefix_setup
|
blanchet@35867
|
408 |
#> measure_runtime_setup
|
blanchet@36371
|
409 |
#> prover_setup
|
blanchet@35867
|
410 |
|
wenzelm@28592
|
411 |
end;
|