331 proof_text isar_proof |
331 proof_text isar_proof |
332 (pool, debug, isar_shrink_factor, ctxt, conjecture_shape) |
332 (pool, debug, isar_shrink_factor, ctxt, conjecture_shape) |
333 (full_types, minimize_command, proof, axiom_names, goal, subgoal) |
333 (full_types, minimize_command, proof, axiom_names, goal, subgoal) |
334 |>> (fn message => |
334 |>> (fn message => |
335 message ^ (if verbose then |
335 message ^ (if verbose then |
336 "\nATP CPU time: " ^ string_of_int msecs ^ " ms." |
336 "\nCPU time: " ^ string_of_int msecs ^ " ms." |
337 else |
337 else |
338 "")) |
338 "")) |
339 | SOME failure => (string_for_failure failure, []) |
339 | SOME failure => (string_for_failure failure, []) |
340 in |
340 in |
341 {outcome = outcome, message = message, pool = pool, |
341 {outcome = outcome, message = message, pool = pool, |
344 conjecture_shape = conjecture_shape} |
344 conjecture_shape = conjecture_shape} |
345 end |
345 end |
346 |
346 |
347 fun get_prover_fun thy name = prover_fun name (get_prover thy name) |
347 fun get_prover_fun thy name = prover_fun name (get_prover thy name) |
348 |
348 |
349 fun start_prover_thread (params as {blocking, timeout, expect, ...}) |
349 fun run_prover ctxt (params as {blocking, timeout, expect, ...}) i n |
350 i n relevance_override minimize_command axioms state |
350 relevance_override minimize_command |
351 (prover, atp_name) = |
351 (problem as {goal, ...}) (prover, atp_name) = |
352 let |
352 let |
353 val birth_time = Time.now () |
353 val birth_time = Time.now () |
354 val death_time = Time.+ (birth_time, timeout) |
354 val death_time = Time.+ (birth_time, timeout) |
355 val {context = ctxt, facts, goal} = Proof.goal state |
|
356 val desc = |
355 val desc = |
357 "ATP " ^ quote atp_name ^ " for subgoal " ^ string_of_int i ^ ":" ^ |
356 "ATP " ^ quote atp_name ^ " for subgoal " ^ string_of_int i ^ ":" ^ |
358 (if blocking then |
357 (if blocking then |
359 "" |
358 "" |
360 else |
359 else |
361 "\n" ^ Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i))) |
360 "\n" ^ Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i))) |
362 fun run () = |
361 fun run () = |
363 let |
362 let |
364 val problem = |
|
365 {ctxt = ctxt, goal = goal, subgoal = i, |
|
366 axioms = map (prepare_axiom ctxt) axioms} |
|
367 val (outcome_code, message) = |
363 val (outcome_code, message) = |
368 prover_fun atp_name prover params (minimize_command atp_name) problem |
364 prover_fun atp_name prover params (minimize_command atp_name) problem |
369 |> (fn {outcome, message, ...} => |
365 |> (fn {outcome, message, ...} => |
370 (if is_some outcome then "none" else "some", message)) |
366 (if is_some outcome then "none" else "some", message)) |
371 handle ERROR message => ("unknown", "Error: " ^ message ^ "\n") |
367 handle ERROR message => ("unknown", "Error: " ^ message ^ "\n") |
409 provers 0 |
405 provers 0 |
410 val axioms = |
406 val axioms = |
411 relevant_facts ctxt full_types relevance_thresholds |
407 relevant_facts ctxt full_types relevance_thresholds |
412 max_max_relevant relevance_override chained_ths |
408 max_max_relevant relevance_override chained_ths |
413 hyp_ts concl_t |
409 hyp_ts concl_t |
|
410 val problem = |
|
411 {ctxt = ctxt, goal = goal, subgoal = i, |
|
412 axioms = map (prepare_axiom ctxt) axioms} |
414 val num_axioms = length axioms |
413 val num_axioms = length axioms |
415 val _ = if verbose then |
414 val _ = if verbose then |
416 priority ("Selected " ^ string_of_int num_axioms ^ |
415 priority ("Selected " ^ string_of_int num_axioms ^ |
417 " fact" ^ plural_s num_axioms ^ ".") |
416 " fact" ^ plural_s num_axioms ^ ".") |
418 else |
417 else |
419 () |
418 () |
420 val _ = |
419 val _ = |
421 (if blocking then Par_List.map else map) |
420 (if blocking then Par_List.map else map) |
422 (start_prover_thread params i n relevance_override |
421 (run_prover ctxt params i n relevance_override |
423 minimize_command axioms state) provers |
422 minimize_command problem) provers |
424 in |
423 in |
425 if verbose andalso blocking then |
424 if verbose andalso blocking then |
426 priority ("Total time: " ^ |
425 priority ("Total time: " ^ |
427 signed_string_of_int (Time.toMilliseconds |
426 signed_string_of_int (Time.toMilliseconds |
428 (Timer.checkRealTimer timer)) ^ " ms.") |
427 (Timer.checkRealTimer timer)) ^ " ms.") |