equal
deleted
inserted
replaced
18 val .*K = "PARAMETER" (*DESCRIPTION*) |
18 val .*K = "PARAMETER" (*DESCRIPTION*) |
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*) |
|
24 val keep_probsK = "keep_probs" (*=BOOL: keep temporary problem files created by sledgehammer*) |
23 val keep_probsK = "keep_probs" (*=BOOL: keep temporary problem files created by sledgehammer*) |
25 val keep_proofsK = "keep_proofs" (*=BOOL: keep temporary proof files created by ATPs*) |
24 val keep_proofsK = "keep_proofs" (*=BOOL: keep temporary proof files created by ATPs*) |
26 val proof_methodK = "proof_method" (*=STRING: how to reconstruct proofs (e.g. using metis)*) |
25 val proof_methodK = "proof_method" (*=STRING: how to reconstruct proofs (e.g. using metis)*) |
27 val term_orderK = "term_order" (*=STRING: term order (in E)*) |
26 val term_orderK = "term_order" (*=STRING: term order (in E)*) |
28 |
27 |
270 else |
269 else |
271 "smt") |
270 "smt") |
272 |
271 |
273 local |
272 local |
274 |
273 |
275 fun run_sh params e_selection_heuristic term_order keep pos state = |
274 fun run_sh params term_order keep pos state = |
276 let |
275 let |
277 fun set_file_name (SOME (dir, keep_probs, keep_proofs)) = |
276 fun set_file_name (SOME (dir, keep_probs, keep_proofs)) = |
278 let |
277 let |
279 val filename = "prob_" ^ |
278 val filename = "prob_" ^ |
280 StringCvt.padLeft #"0" 5 (str0 (Position.line_of pos)) ^ "_" ^ |
279 StringCvt.padLeft #"0" 5 (str0 (Position.line_of pos)) ^ "_" ^ |
288 | set_file_name NONE = I |
287 | set_file_name NONE = I |
289 val state' = |
288 val state' = |
290 state |
289 state |
291 |> Proof.map_context |
290 |> Proof.map_context |
292 (set_file_name keep |
291 (set_file_name keep |
293 #> (Option.map (Config.put Sledgehammer_ATP_Systems.e_selection_heuristic) |
|
294 e_selection_heuristic |> the_default I) |
|
295 #> (Option.map (Config.put Sledgehammer_ATP_Systems.term_order) |
292 #> (Option.map (Config.put Sledgehammer_ATP_Systems.term_order) |
296 term_order |> the_default I)) |
293 term_order |> the_default I)) |
297 |
294 |
298 val ((_, (sledgehammer_outcome, msg)), cpu_time) = Mirabelle.cpu_time (fn () => |
295 val ((_, (sledgehammer_outcome, msg)), cpu_time) = Mirabelle.cpu_time (fn () => |
299 Sledgehammer.run_sledgehammer params Sledgehammer_Prover.Normal NONE 1 |
296 Sledgehammer.run_sledgehammer params Sledgehammer_Prover.Normal NONE 1 |
305 ERROR msg => (Sledgehammer.SH_Unknown, " error: " ^ msg, 0) |
302 ERROR msg => (Sledgehammer.SH_Unknown, " error: " ^ msg, 0) |
306 | _ => (Sledgehammer.SH_Unknown, " error: unexpected error", 0) |
303 | _ => (Sledgehammer.SH_Unknown, " error: unexpected error", 0) |
307 |
304 |
308 in |
305 in |
309 |
306 |
310 fun run_sledgehammer (params as {provers, ...}) output_dir e_selection_heuristic term_order |
307 fun run_sledgehammer (params as {provers, ...}) output_dir term_order |
311 keep_probs keep_proofs proof_method_from_msg thy_index trivial pos st = |
308 keep_probs keep_proofs proof_method_from_msg thy_index trivial pos st = |
312 let |
309 let |
313 val thy = Proof.theory_of st |
310 val thy = Proof.theory_of st |
314 val thy_name = Context.theory_name thy |
311 val thy_name = Context.theory_name thy |
315 val triv_str = if trivial then "[T] " else "" |
312 val triv_str = if trivial then "[T] " else "" |
322 |> (fn dir => SOME (dir, keep_probs, keep_proofs)) |
319 |> (fn dir => SOME (dir, keep_probs, keep_proofs)) |
323 end |
320 end |
324 else |
321 else |
325 NONE |
322 NONE |
326 val prover_name = hd provers |
323 val prover_name = hd provers |
327 val (sledgehamer_outcome, msg, cpu_time) = |
324 val (sledgehamer_outcome, msg, cpu_time) = run_sh params term_order keep pos st |
328 run_sh params e_selection_heuristic term_order keep pos st |
|
329 val (time_prover, change_data, proof_method_and_used_thms) = |
325 val (time_prover, change_data, proof_method_and_used_thms) = |
330 (case sledgehamer_outcome of |
326 (case sledgehamer_outcome of |
331 Sledgehammer.SH_Some {used_facts, run_time, ...} => |
327 Sledgehammer.SH_Some {used_facts, run_time, ...} => |
332 let |
328 let |
333 val num_used_facts = length used_facts |
329 val num_used_facts = length used_facts |
442 (* Parse Mirabelle-specific parameters *) |
438 (* Parse Mirabelle-specific parameters *) |
443 val check_trivial = |
439 val check_trivial = |
444 Mirabelle.get_bool_argument arguments (check_trivialK, check_trivial_default) |
440 Mirabelle.get_bool_argument arguments (check_trivialK, check_trivial_default) |
445 val keep_probs = Mirabelle.get_bool_argument arguments (keep_probsK, keep_probs_default) |
441 val keep_probs = Mirabelle.get_bool_argument arguments (keep_probsK, keep_probs_default) |
446 val keep_proofs = Mirabelle.get_bool_argument arguments (keep_proofsK, keep_proofs_default) |
442 val keep_proofs = Mirabelle.get_bool_argument arguments (keep_proofsK, keep_proofs_default) |
447 val e_selection_heuristic = AList.lookup (op =) arguments e_selection_heuristicK |
|
448 val term_order = AList.lookup (op =) arguments term_orderK |
443 val term_order = AList.lookup (op =) arguments term_orderK |
449 val proof_method_from_msg = proof_method_from_msg arguments |
444 val proof_method_from_msg = proof_method_from_msg arguments |
450 |
445 |
451 (* Parse Sledgehammer parameters *) |
446 (* Parse Sledgehammer parameters *) |
452 val params = Sledgehammer_Commands.default_params \<^theory> arguments |
447 val params = Sledgehammer_Commands.default_params \<^theory> arguments |
465 "" |
460 "" |
466 else |
461 else |
467 let |
462 let |
468 val trivial = check_trivial andalso try0 pre handle Timeout.TIMEOUT _ => false |
463 val trivial = check_trivial andalso try0 pre handle Timeout.TIMEOUT _ => false |
469 val (outcome, log1, change_data1, proof_method_and_used_thms) = |
464 val (outcome, log1, change_data1, proof_method_and_used_thms) = |
470 run_sledgehammer params output_dir e_selection_heuristic term_order |
465 run_sledgehammer params output_dir term_order keep_probs keep_proofs |
471 keep_probs keep_proofs proof_method_from_msg theory_index trivial pos pre |
466 proof_method_from_msg theory_index trivial pos pre |
472 val (log2, change_data2) = |
467 val (log2, change_data2) = |
473 (case proof_method_and_used_thms of |
468 (case proof_method_and_used_thms of |
474 SOME (proof_method, used_thms) => |
469 SOME (proof_method, used_thms) => |
475 run_proof_method trivial false name proof_method used_thms timeout pos pre |
470 run_proof_method trivial false name proof_method used_thms timeout pos pre |
476 |> apfst (prefix (proof_method ^ " (sledgehammer): ")) |
471 |> apfst (prefix (proof_method ^ " (sledgehammer): ")) |