9 signature SLEDGEHAMMER = |
9 signature SLEDGEHAMMER = |
10 sig |
10 sig |
11 type failure = ATP_Systems.failure |
11 type failure = ATP_Systems.failure |
12 type locality = Sledgehammer_Filter.locality |
12 type locality = Sledgehammer_Filter.locality |
13 type relevance_override = Sledgehammer_Filter.relevance_override |
13 type relevance_override = Sledgehammer_Filter.relevance_override |
|
14 type fol_formula = Sledgehammer_Translate.fol_formula |
14 type minimize_command = Sledgehammer_Reconstruct.minimize_command |
15 type minimize_command = Sledgehammer_Reconstruct.minimize_command |
15 type params = |
16 type params = |
16 {blocking: bool, |
17 {blocking: bool, |
17 debug: bool, |
18 debug: bool, |
18 verbose: bool, |
19 verbose: bool, |
28 expect: string} |
29 expect: string} |
29 type problem = |
30 type problem = |
30 {ctxt: Proof.context, |
31 {ctxt: Proof.context, |
31 goal: thm, |
32 goal: thm, |
32 subgoal: int, |
33 subgoal: int, |
33 axioms: ((string * locality) * thm) list} |
34 axiom_ts: term list, |
|
35 prepared_axioms: ((string * locality) * fol_formula) option list} |
34 type prover_result = |
36 type prover_result = |
35 {outcome: failure option, |
37 {outcome: failure option, |
36 message: string, |
38 message: string, |
37 pool: string Symtab.table, |
39 pool: string Symtab.table, |
38 used_thm_names: (string * locality) list, |
40 used_thm_names: (string * locality) list, |
215 {exec, required_execs, arguments, has_incomplete_mode, proof_delims, |
218 {exec, required_execs, arguments, has_incomplete_mode, proof_delims, |
216 known_failures, default_max_relevant, explicit_forall, |
219 known_failures, default_max_relevant, explicit_forall, |
217 use_conjecture_for_hypotheses} |
220 use_conjecture_for_hypotheses} |
218 ({debug, verbose, overlord, full_types, explicit_apply, |
221 ({debug, verbose, overlord, full_types, explicit_apply, |
219 max_relevant, isar_proof, isar_shrink_factor, timeout, ...} : params) |
222 max_relevant, isar_proof, isar_shrink_factor, timeout, ...} : params) |
220 minimize_command ({ctxt, goal, subgoal, axioms} : problem) = |
223 minimize_command |
|
224 ({ctxt, goal, subgoal, axiom_ts, prepared_axioms} : problem) = |
221 let |
225 let |
222 val (_, hyp_ts, concl_t) = strip_subgoal goal subgoal |
226 val (_, hyp_ts, concl_t) = strip_subgoal goal subgoal |
223 val max_relevant = the_default default_max_relevant max_relevant |
227 val max_relevant = the_default default_max_relevant max_relevant |
224 val axioms = take max_relevant axioms |
228 val axiom_ts = take max_relevant axiom_ts |
|
229 val prepared_axioms = take max_relevant prepared_axioms |
225 (* path to unique problem file *) |
230 (* path to unique problem file *) |
226 val the_dest_dir = if overlord then getenv "ISABELLE_HOME_USER" |
231 val the_dest_dir = if overlord then getenv "ISABELLE_HOME_USER" |
227 else Config.get ctxt dest_dir |
232 else Config.get ctxt dest_dir |
228 val the_problem_prefix = Config.get ctxt problem_prefix |
233 val the_problem_prefix = Config.get ctxt problem_prefix |
229 val problem_file_name = |
234 val problem_file_name = |
281 known_failures output |
286 known_failures output |
282 in (output, msecs, proof, outcome) end |
287 in (output, msecs, proof, outcome) end |
283 val readable_names = debug andalso overlord |
288 val readable_names = debug andalso overlord |
284 val (problem, pool, conjecture_offset, axiom_names) = |
289 val (problem, pool, conjecture_offset, axiom_names) = |
285 prepare_problem ctxt readable_names explicit_forall full_types |
290 prepare_problem ctxt readable_names explicit_forall full_types |
286 explicit_apply hyp_ts concl_t axioms |
291 explicit_apply hyp_ts concl_t axiom_ts |
|
292 prepared_axioms |
287 val ss = strings_for_tptp_problem use_conjecture_for_hypotheses |
293 val ss = strings_for_tptp_problem use_conjecture_for_hypotheses |
288 problem |
294 problem |
289 val _ = File.write_list probfile ss |
295 val _ = File.write_list probfile ss |
290 val conjecture_shape = |
296 val conjecture_shape = |
291 conjecture_offset + 1 upto conjecture_offset + length hyp_ts + 1 |
297 conjecture_offset + 1 upto conjecture_offset + length hyp_ts + 1 |
358 "" |
364 "" |
359 else |
365 else |
360 "\n" ^ Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i))) |
366 "\n" ^ Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i))) |
361 fun run () = |
367 fun run () = |
362 let |
368 let |
363 val problem = {ctxt = ctxt, goal = goal, subgoal = i, axioms = axioms} |
369 val problem = |
|
370 {ctxt = ctxt, goal = goal, subgoal = i, |
|
371 axiom_ts = map (prop_of o snd) axioms, |
|
372 prepared_axioms = map (prepare_axiom ctxt) axioms} |
364 val (outcome_code, message) = |
373 val (outcome_code, message) = |
365 prover_fun atp_name prover params (minimize_command atp_name) problem |
374 prover_fun atp_name prover params (minimize_command atp_name) problem |
366 |> (fn {outcome, message, ...} => |
375 |> (fn {outcome, message, ...} => |
367 (if is_some outcome then "none" else "some", message)) |
376 (if is_some outcome then "none" else "some", message)) |
368 handle ERROR message => ("unknown", "Error: " ^ message ^ "\n") |
377 handle ERROR message => ("unknown", "Error: " ^ message ^ "\n") |