equal
deleted
inserted
replaced
19 *) |
19 *) |
20 (* NOTE: Do not forget to update the Sledgehammer documentation to reflect changes here. *) |
20 (* NOTE: Do not forget to update the Sledgehammer documentation to reflect changes here. *) |
21 |
21 |
22 val check_trivialK = "check_trivial" (*=BOOL: check if goals are "trivial"*) |
22 val check_trivialK = "check_trivial" (*=BOOL: check if goals are "trivial"*) |
23 val e_selection_heuristicK = "e_selection_heuristic" (*=STRING: E clause selection heuristic*) |
23 val e_selection_heuristicK = "e_selection_heuristic" (*=STRING: E clause selection heuristic*) |
24 val force_sosK = "force_sos" (*=BOOL: use set-of-support (in Vampire)*) |
|
25 val keep_probsK = "keep_probs" (*=BOOL: keep temporary problem files created by sledgehammer*) |
24 val keep_probsK = "keep_probs" (*=BOOL: keep temporary problem files created by sledgehammer*) |
26 val keep_proofsK = "keep_proofs" (*=BOOL: keep temporary proof files created by ATPs*) |
25 val keep_proofsK = "keep_proofs" (*=BOOL: keep temporary proof files created by ATPs*) |
27 val proof_methodK = "proof_method" (*=STRING: how to reconstruct proofs (e.g. using metis)*) |
26 val proof_methodK = "proof_method" (*=STRING: how to reconstruct proofs (e.g. using metis)*) |
28 val term_orderK = "term_order" (*=STRING: term order (in E)*) |
27 val term_orderK = "term_order" (*=STRING: term order (in E)*) |
29 |
28 |
271 else |
270 else |
272 "smt") |
271 "smt") |
273 |
272 |
274 local |
273 local |
275 |
274 |
276 fun run_sh params e_selection_heuristic term_order force_sos keep pos state = |
275 fun run_sh params e_selection_heuristic term_order keep pos state = |
277 let |
276 let |
278 fun set_file_name (SOME (dir, keep_probs, keep_proofs)) = |
277 fun set_file_name (SOME (dir, keep_probs, keep_proofs)) = |
279 let |
278 let |
280 val filename = "prob_" ^ |
279 val filename = "prob_" ^ |
281 StringCvt.padLeft #"0" 5 (str0 (Position.line_of pos)) ^ "_" ^ |
280 StringCvt.padLeft #"0" 5 (str0 (Position.line_of pos)) ^ "_" ^ |
292 |> Proof.map_context |
291 |> Proof.map_context |
293 (set_file_name keep |
292 (set_file_name keep |
294 #> (Option.map (Config.put Sledgehammer_ATP_Systems.e_selection_heuristic) |
293 #> (Option.map (Config.put Sledgehammer_ATP_Systems.e_selection_heuristic) |
295 e_selection_heuristic |> the_default I) |
294 e_selection_heuristic |> the_default I) |
296 #> (Option.map (Config.put Sledgehammer_ATP_Systems.term_order) |
295 #> (Option.map (Config.put Sledgehammer_ATP_Systems.term_order) |
297 term_order |> the_default I) |
296 term_order |> the_default I)) |
298 #> (Option.map (Config.put Sledgehammer_ATP_Systems.force_sos) |
|
299 force_sos |> the_default I)) |
|
300 |
297 |
301 val ((_, (sledgehammer_outcome, msg)), cpu_time) = Mirabelle.cpu_time (fn () => |
298 val ((_, (sledgehammer_outcome, msg)), cpu_time) = Mirabelle.cpu_time (fn () => |
302 Sledgehammer.run_sledgehammer params Sledgehammer_Prover.Normal NONE 1 |
299 Sledgehammer.run_sledgehammer params Sledgehammer_Prover.Normal NONE 1 |
303 Sledgehammer_Fact.no_fact_override state') () |
300 Sledgehammer_Fact.no_fact_override state') () |
304 in |
301 in |
309 | _ => (Sledgehammer.SH_Unknown, " error: unexpected error", 0) |
306 | _ => (Sledgehammer.SH_Unknown, " error: unexpected error", 0) |
310 |
307 |
311 in |
308 in |
312 |
309 |
313 fun run_sledgehammer (params as {provers, ...}) output_dir e_selection_heuristic term_order |
310 fun run_sledgehammer (params as {provers, ...}) output_dir e_selection_heuristic term_order |
314 force_sos keep_probs keep_proofs proof_method_from_msg thy_index trivial pos st = |
311 keep_probs keep_proofs proof_method_from_msg thy_index trivial pos st = |
315 let |
312 let |
316 val thy = Proof.theory_of st |
313 val thy = Proof.theory_of st |
317 val thy_name = Context.theory_name thy |
314 val thy_name = Context.theory_name thy |
318 val triv_str = if trivial then "[T] " else "" |
315 val triv_str = if trivial then "[T] " else "" |
319 val keep = |
316 val keep = |
326 end |
323 end |
327 else |
324 else |
328 NONE |
325 NONE |
329 val prover_name = hd provers |
326 val prover_name = hd provers |
330 val (sledgehamer_outcome, msg, cpu_time) = |
327 val (sledgehamer_outcome, msg, cpu_time) = |
331 run_sh params e_selection_heuristic term_order force_sos keep pos st |
328 run_sh params e_selection_heuristic term_order keep pos st |
332 val (time_prover, change_data, proof_method_and_used_thms) = |
329 val (time_prover, change_data, proof_method_and_used_thms) = |
333 (case sledgehamer_outcome of |
330 (case sledgehamer_outcome of |
334 Sledgehammer.SH_Some {used_facts, run_time, ...} => |
331 Sledgehammer.SH_Some {used_facts, run_time, ...} => |
335 let |
332 let |
336 val num_used_facts = length used_facts |
333 val num_used_facts = length used_facts |
447 Mirabelle.get_bool_argument arguments (check_trivialK, check_trivial_default) |
444 Mirabelle.get_bool_argument arguments (check_trivialK, check_trivial_default) |
448 val keep_probs = Mirabelle.get_bool_argument arguments (keep_probsK, keep_probs_default) |
445 val keep_probs = Mirabelle.get_bool_argument arguments (keep_probsK, keep_probs_default) |
449 val keep_proofs = Mirabelle.get_bool_argument arguments (keep_proofsK, keep_proofs_default) |
446 val keep_proofs = Mirabelle.get_bool_argument arguments (keep_proofsK, keep_proofs_default) |
450 val e_selection_heuristic = AList.lookup (op =) arguments e_selection_heuristicK |
447 val e_selection_heuristic = AList.lookup (op =) arguments e_selection_heuristicK |
451 val term_order = AList.lookup (op =) arguments term_orderK |
448 val term_order = AList.lookup (op =) arguments term_orderK |
452 val force_sos = AList.lookup (op =) arguments force_sosK |
|
453 |> Option.map (curry (op <>) "false") |
|
454 val proof_method_from_msg = proof_method_from_msg arguments |
449 val proof_method_from_msg = proof_method_from_msg arguments |
455 |
450 |
456 (* Parse Sledgehammer parameters *) |
451 (* Parse Sledgehammer parameters *) |
457 val params = Sledgehammer_Commands.default_params \<^theory> arguments |
452 val params = Sledgehammer_Commands.default_params \<^theory> arguments |
458 |> (fn (params as {provers, ...}) => |
453 |> (fn (params as {provers, ...}) => |
471 else |
466 else |
472 let |
467 let |
473 val trivial = check_trivial andalso try0 pre handle Timeout.TIMEOUT _ => false |
468 val trivial = check_trivial andalso try0 pre handle Timeout.TIMEOUT _ => false |
474 val (outcome, log1, change_data1, proof_method_and_used_thms) = |
469 val (outcome, log1, change_data1, proof_method_and_used_thms) = |
475 run_sledgehammer params output_dir e_selection_heuristic term_order |
470 run_sledgehammer params output_dir e_selection_heuristic term_order |
476 force_sos keep_probs keep_proofs proof_method_from_msg theory_index trivial pos pre |
471 keep_probs keep_proofs proof_method_from_msg theory_index trivial pos pre |
477 val (log2, change_data2) = |
472 val (log2, change_data2) = |
478 (case proof_method_and_used_thms of |
473 (case proof_method_and_used_thms of |
479 SOME (proof_method, used_thms) => |
474 SOME (proof_method, used_thms) => |
480 run_proof_method trivial false name proof_method used_thms timeout pos pre |
475 run_proof_method trivial false name proof_method used_thms timeout pos pre |
481 |> apfst (prefix (proof_method ^ " (sledgehammer): ")) |
476 |> apfst (prefix (proof_method ^ " (sledgehammer): ")) |