18 val auto_minimize_max_time : real Config.T |
18 val auto_minimize_max_time : real Config.T |
19 val minimize_facts : |
19 val minimize_facts : |
20 (string -> thm list -> unit) -> string -> params -> bool -> int -> int |
20 (string -> thm list -> unit) -> string -> params -> bool -> int -> int |
21 -> Proof.state -> ((string * stature) * thm list) list |
21 -> Proof.state -> ((string * stature) * thm list) list |
22 -> ((string * stature) * thm list) list option |
22 -> ((string * stature) * thm list) list option |
23 * ((unit -> play) * (play -> string) * string) |
23 * (play Lazy.lazy * (play -> string) * string) |
24 val get_minimizing_isar_prover : |
24 val get_minimizing_isar_prover : |
25 Proof.context -> mode -> (string -> thm list -> unit) -> string -> prover |
25 Proof.context -> mode -> (string -> thm list -> unit) -> string -> prover |
26 val run_minimize : |
26 val run_minimize : |
27 params -> (string -> thm list -> unit) -> int |
27 params -> (string -> thm list -> unit) -> int |
28 -> (Facts.ref * Attrib.src list) list -> Proof.state -> unit |
28 -> (Facts.ref * Attrib.src list) list -> Proof.state -> unit |
234 (timeout |> the_default (seconds 60.0)) div 1000) ^ |
234 (timeout |> the_default (seconds 60.0)) div 1000) ^ |
235 "\").", "")) |
235 "\").", "")) |
236 | {preplay, message, ...} => |
236 | {preplay, message, ...} => |
237 (NONE, (preplay, prefix "Prover error: " o message, ""))) |
237 (NONE, (preplay, prefix "Prover error: " o message, ""))) |
238 handle ERROR msg => |
238 handle ERROR msg => |
239 (NONE, (K (Failed_to_Play plain_metis), fn _ => "Error: " ^ msg, "")) |
239 (NONE, (Lazy.value (Failed_to_Play plain_metis), |
|
240 fn _ => "Error: " ^ msg, "")) |
240 end |
241 end |
241 |
242 |
242 fun adjust_reconstructor_params override_params |
243 fun adjust_reconstructor_params override_params |
243 ({debug, verbose, overlord, blocking, provers, type_enc, strict, |
244 ({debug, verbose, overlord, blocking, provers, type_enc, strict, |
244 lam_trans, uncurried_aliases, learn, fact_filter, max_facts, |
245 lam_trans, uncurried_aliases, learn, fact_filter, max_facts, |
288 fun prover_fast_enough () = can_min_fast_enough run_time |
289 fun prover_fast_enough () = can_min_fast_enough run_time |
289 in |
290 in |
290 if isar_proofs then |
291 if isar_proofs then |
291 ((prover_fast_enough (), (name, params)), preplay) |
292 ((prover_fast_enough (), (name, params)), preplay) |
292 else |
293 else |
293 let val preplay = preplay () in |
294 (case Lazy.force preplay of |
294 (case preplay of |
295 Played (reconstr, timeout) => |
295 Played (reconstr, timeout) => |
296 if can_min_fast_enough timeout then |
296 if can_min_fast_enough timeout then |
297 (true, extract_reconstructor params reconstr |
297 (true, extract_reconstructor params reconstr |
298 ||> (fn override_params => |
298 ||> (fn override_params => |
299 adjust_reconstructor_params |
299 adjust_reconstructor_params |
300 override_params params)) |
300 override_params params)) |
301 else |
301 else |
302 (prover_fast_enough (), (name, params)) |
302 (prover_fast_enough (), (name, params)) |
303 | _ => (prover_fast_enough (), (name, params)), |
303 | _ => (prover_fast_enough (), (name, params)), |
304 preplay) |
304 K preplay) |
|
305 end |
|
306 end |
305 end |
307 else |
306 else |
308 ((false, (name, params)), preplay) |
307 ((false, (name, params)), preplay) |
309 val minimize = minimize |> the_default perhaps_minimize |
308 val minimize = minimize |> the_default perhaps_minimize |
310 val (used_facts, (preplay, message, _)) = |
309 val (used_facts, (preplay, message, _)) = |
350 [] => error "No prover is set." |
349 [] => error "No prover is set." |
351 | prover :: _ => |
350 | prover :: _ => |
352 (kill_provers (); |
351 (kill_provers (); |
353 minimize_facts do_learn prover params false i n state facts |
352 minimize_facts do_learn prover params false i n state facts |
354 |> (fn (_, (preplay, message, message_tail)) => |
353 |> (fn (_, (preplay, message, message_tail)) => |
355 message (preplay ()) ^ message_tail |
354 message (Lazy.force preplay) ^ message_tail |
356 |> Output.urgent_message)) |
355 |> Output.urgent_message)) |
357 end |
356 end |
358 |
357 |
359 end; |
358 end; |