author | blanchet |
Tue, 14 Aug 2012 13:20:59 +0200 | |
changeset 48798 | 9152e66f98da |
parent 48796 | 0f94b8b69e79 |
child 48799 | 5c9356f8c968 |
permissions | -rw-r--r-- |
38988 | 1 |
(* Title: HOL/Tools/Sledgehammer/sledgehammer_minimize.ML |
31037
ac8669134e7a
added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff
changeset
|
2 |
Author: Philipp Meyer, TU Muenchen |
36370
a4f601daa175
centralized ATP-specific error handling in "atp_wrapper.ML"
blanchet
parents:
36369
diff
changeset
|
3 |
Author: Jasmin Blanchette, TU Muenchen |
31037
ac8669134e7a
added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff
changeset
|
4 |
|
40977 | 5 |
Minimization of fact list for Metis using external provers. |
31037
ac8669134e7a
added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff
changeset
|
6 |
*) |
ac8669134e7a
added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff
changeset
|
7 |
|
38988 | 8 |
signature SLEDGEHAMMER_MINIMIZE = |
32525 | 9 |
sig |
46340 | 10 |
type stature = ATP_Problem_Generate.stature |
46320 | 11 |
type play = ATP_Proof_Reconstruct.play |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
12 |
type mode = Sledgehammer_Provers.mode |
41087
d7b5fd465198
split "Sledgehammer" module into two parts, to resolve forthcoming dependency problems
blanchet
parents:
40983
diff
changeset
|
13 |
type params = Sledgehammer_Provers.params |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
14 |
type prover = Sledgehammer_Provers.prover |
35867 | 15 |
|
42646
4781fcd53572
replaced some Unsynchronized.refs with Config.Ts
blanchet
parents:
42579
diff
changeset
|
16 |
val binary_min_facts : int Config.T |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
17 |
val auto_minimize_min_facts : int Config.T |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
18 |
val auto_minimize_max_time : real Config.T |
40061
71cc5aac8b76
generalization of the Sledgehammer minimizer, to make it possible to handle SMT solvers as well
blanchet
parents:
40060
diff
changeset
|
19 |
val minimize_facts : |
48399
4bacc8983b3d
learn from SMT proofs when they can be minimized by Metis
blanchet
parents:
48396
diff
changeset
|
20 |
(string -> thm list -> unit) -> string -> params -> bool -> int -> int |
4bacc8983b3d
learn from SMT proofs when they can be minimized by Metis
blanchet
parents:
48396
diff
changeset
|
21 |
-> Proof.state -> ((string * stature) * thm list) list |
46340 | 22 |
-> ((string * stature) * thm list) list option |
43261
a4aeb26a6362
make sure that the message tail (timing + TPTP important message) is preserved upon automatic minimization
blanchet
parents:
43259
diff
changeset
|
23 |
* ((unit -> play) * (play -> string) * string) |
48321 | 24 |
val get_minimizing_prover : |
48399
4bacc8983b3d
learn from SMT proofs when they can be minimized by Metis
blanchet
parents:
48396
diff
changeset
|
25 |
Proof.context -> mode -> (string -> thm list -> unit) -> string -> prover |
38996 | 26 |
val run_minimize : |
48399
4bacc8983b3d
learn from SMT proofs when they can be minimized by Metis
blanchet
parents:
48396
diff
changeset
|
27 |
params -> (string -> thm list -> unit) -> int |
4bacc8983b3d
learn from SMT proofs when they can be minimized by Metis
blanchet
parents:
48396
diff
changeset
|
28 |
-> (Facts.ref * Attrib.src list) list -> Proof.state -> unit |
35866
513074557e06
move the Sledgehammer Isar commands together into one file;
blanchet
parents:
35865
diff
changeset
|
29 |
end; |
32525 | 30 |
|
38988 | 31 |
structure Sledgehammer_Minimize : SLEDGEHAMMER_MINIMIZE = |
31037
ac8669134e7a
added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff
changeset
|
32 |
struct |
ac8669134e7a
added Philipp Meyer's implementation of AtpMinimal
immler@in.tum.de
parents:
diff
changeset
|
33 |
|
43085
0a2f5b86bdd7
first step in sharing more code between ATP and Metis translation
blanchet
parents:
43064
diff
changeset
|
34 |
open ATP_Util |
39496
a52a4e4399c1
got caught once again by SML's pattern maching (ctor vs. var)
blanchet
parents:
39491
diff
changeset
|
35 |
open ATP_Proof |
46320 | 36 |
open ATP_Problem_Generate |
37 |
open ATP_Proof_Reconstruct |
|
36142
f5e15e9aae10
make Sledgehammer "minimize" output less confusing + round up (not down) time limits to nearest second
blanchet
parents:
36063
diff
changeset
|
38 |
open Sledgehammer_Util |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
39 |
open Sledgehammer_Fact |
41087
d7b5fd465198
split "Sledgehammer" module into two parts, to resolve forthcoming dependency problems
blanchet
parents:
40983
diff
changeset
|
40 |
open Sledgehammer_Provers |
35866
513074557e06
move the Sledgehammer Isar commands together into one file;
blanchet
parents:
35865
diff
changeset
|
41 |
|
36370
a4f601daa175
centralized ATP-specific error handling in "atp_wrapper.ML"
blanchet
parents:
36369
diff
changeset
|
42 |
(* wrapper for calling external prover *) |
31236 | 43 |
|
40061
71cc5aac8b76
generalization of the Sledgehammer minimizer, to make it possible to handle SMT solvers as well
blanchet
parents:
40060
diff
changeset
|
44 |
fun n_facts names = |
38698
d19c3a7ce38b
clean handling of whether a fact is chained or not;
blanchet
parents:
38696
diff
changeset
|
45 |
let val n = length names in |
40061
71cc5aac8b76
generalization of the Sledgehammer minimizer, to make it possible to handle SMT solvers as well
blanchet
parents:
40060
diff
changeset
|
46 |
string_of_int n ^ " fact" ^ plural_s n ^ |
38092
81a003f7de0d
speed up the minimizer by using the time taken for the first iteration as a timeout for the following iterations, and fix a subtle bug in "string_for_failure"
blanchet
parents:
38084
diff
changeset
|
47 |
(if n > 0 then |
48085
ff5e900d7b1a
avoid dumping definitions several times in LEO-II proofs
blanchet
parents:
47531
diff
changeset
|
48 |
": " ^ (names |> map fst |> sort string_ord |> space_implode " ") |
38092
81a003f7de0d
speed up the minimizer by using the time taken for the first iteration as a timeout for the following iterations, and fix a subtle bug in "string_for_failure"
blanchet
parents:
38084
diff
changeset
|
49 |
else |
81a003f7de0d
speed up the minimizer by using the time taken for the first iteration as a timeout for the following iterations, and fix a subtle bug in "string_for_failure"
blanchet
parents:
38084
diff
changeset
|
50 |
"") |
81a003f7de0d
speed up the minimizer by using the time taken for the first iteration as a timeout for the following iterations, and fix a subtle bug in "string_for_failure"
blanchet
parents:
38084
diff
changeset
|
51 |
end |
81a003f7de0d
speed up the minimizer by using the time taken for the first iteration as a timeout for the following iterations, and fix a subtle bug in "string_for_failure"
blanchet
parents:
38084
diff
changeset
|
52 |
|
41091
0afdf5cde874
implicitly call the minimizer for SMT solvers that don't return an unsat core
blanchet
parents:
41090
diff
changeset
|
53 |
fun print silent f = if silent then () else Output.urgent_message (f ()) |
0afdf5cde874
implicitly call the minimizer for SMT solvers that don't return an unsat core
blanchet
parents:
41090
diff
changeset
|
54 |
|
42724
4d6bcf846759
added "max_mono_instances" option to Sledgehammer and renamed old "monomorphize_limit" option
blanchet
parents:
42646
diff
changeset
|
55 |
fun test_facts ({debug, verbose, overlord, provers, max_mono_iters, |
46301 | 56 |
max_new_mono_instances, type_enc, strict, lam_trans, |
46409
d4754183ccce
made option available to users (mostly for experiments)
blanchet
parents:
46388
diff
changeset
|
57 |
uncurried_aliases, isar_proof, isar_shrink_factor, |
d4754183ccce
made option available to users (mostly for experiments)
blanchet
parents:
46388
diff
changeset
|
58 |
preplay_timeout, ...} : params) |
43064
b6e61d22fa61
made "explicit_apply" smarter -- no need to force explicit applications in minimizer on all constants, better do it more fine granularly
blanchet
parents:
43058
diff
changeset
|
59 |
silent (prover : prover) timeout i n state facts = |
31236 | 60 |
let |
41277
1369c27c6966
reduce the minimizer slack and add verbose information
blanchet
parents:
41267
diff
changeset
|
61 |
val _ = |
1369c27c6966
reduce the minimizer slack and add verbose information
blanchet
parents:
41267
diff
changeset
|
62 |
print silent (fn () => |
1369c27c6966
reduce the minimizer slack and add verbose information
blanchet
parents:
41267
diff
changeset
|
63 |
"Testing " ^ n_facts (map fst facts) ^ |
1369c27c6966
reduce the minimizer slack and add verbose information
blanchet
parents:
41267
diff
changeset
|
64 |
(if verbose then " (timeout: " ^ string_from_time timeout ^ ")" |
43085
0a2f5b86bdd7
first step in sharing more code between ATP and Metis translation
blanchet
parents:
43064
diff
changeset
|
65 |
else "") ^ "...") |
41742
11e862c68b40
automatically minimize Z3-as-an-ATP proofs (cf. CVC3 and Yices)
blanchet
parents:
41741
diff
changeset
|
66 |
val {goal, ...} = Proof.goal state |
44463
c471a2b48fa1
make sure that all facts are passed to ATP from minimizer
blanchet
parents:
43630
diff
changeset
|
67 |
val facts = |
c471a2b48fa1
make sure that all facts are passed to ATP from minimizer
blanchet
parents:
43630
diff
changeset
|
68 |
facts |> maps (fn (n, ths) => ths |> map (Untranslated_Fact o pair n)) |
38100
e458a0dd3dc1
use "explicit_apply" in the minimizer whenever it might make a difference to prevent freak failures;
blanchet
parents:
38094
diff
changeset
|
69 |
val params = |
42060
889d767ce5f4
make Minimizer honor "verbose" and "debug" options better
blanchet
parents:
41824
diff
changeset
|
70 |
{debug = debug, verbose = verbose, overlord = overlord, blocking = true, |
46301 | 71 |
provers = provers, type_enc = type_enc, strict = strict, |
46409
d4754183ccce
made option available to users (mostly for experiments)
blanchet
parents:
46388
diff
changeset
|
72 |
lam_trans = lam_trans, uncurried_aliases = uncurried_aliases, |
48321 | 73 |
learn = false, fact_filter = NONE, max_facts = SOME (length facts), |
48314
ee33ba3c0e05
added option to control which fact filter is used
blanchet
parents:
48293
diff
changeset
|
74 |
fact_thresholds = (1.01, 1.01), max_mono_iters = max_mono_iters, |
42740
31334a7b109d
renamed "max_mono_instances" to "max_new_mono_instances" and changed its semantics accordingly
blanchet
parents:
42724
diff
changeset
|
75 |
max_new_mono_instances = max_new_mono_instances, isar_proof = isar_proof, |
45706 | 76 |
isar_shrink_factor = isar_shrink_factor, slice = false, |
45707
6bf7eec9b153
added "minimize" option for more control over automatic minimization
blanchet
parents:
45706
diff
changeset
|
77 |
minimize = SOME false, timeout = timeout, |
6bf7eec9b153
added "minimize" option for more control over automatic minimization
blanchet
parents:
45706
diff
changeset
|
78 |
preplay_timeout = preplay_timeout, expect = ""} |
40065 | 79 |
val problem = |
80 |
{state = state, goal = goal, subgoal = i, subgoal_count = n, |
|
47531
7fe7c7419489
get rid of minor optimization that caused strange problems and was hard to debug (and apparently saved less than 100 ms on a 30 s run)
blanchet
parents:
46409
diff
changeset
|
81 |
facts = facts} |
45370
bab52dafa63a
use "Time.time" rather than milliseconds internally
blanchet
parents:
45369
diff
changeset
|
82 |
val result as {outcome, used_facts, run_time, ...} = |
45520 | 83 |
prover params (K (K (K ""))) problem |
36223
217ca1273786
make Sledgehammer's minimizer also minimize Isar proofs
blanchet
parents:
36143
diff
changeset
|
84 |
in |
43259
30c141dc22d6
killed "explicit_apply" option in Sledgehammer -- the "smart" default is about as lightweight as "false" and just as complete as "true"
blanchet
parents:
43166
diff
changeset
|
85 |
print silent |
30c141dc22d6
killed "explicit_apply" option in Sledgehammer -- the "smart" default is about as lightweight as "false" and just as complete as "true"
blanchet
parents:
43166
diff
changeset
|
86 |
(fn () => |
30c141dc22d6
killed "explicit_apply" option in Sledgehammer -- the "smart" default is about as lightweight as "false" and just as complete as "true"
blanchet
parents:
43166
diff
changeset
|
87 |
case outcome of |
30c141dc22d6
killed "explicit_apply" option in Sledgehammer -- the "smart" default is about as lightweight as "false" and just as complete as "true"
blanchet
parents:
43166
diff
changeset
|
88 |
SOME failure => string_for_failure failure |
30c141dc22d6
killed "explicit_apply" option in Sledgehammer -- the "smart" default is about as lightweight as "false" and just as complete as "true"
blanchet
parents:
43166
diff
changeset
|
89 |
| NONE => |
30c141dc22d6
killed "explicit_apply" option in Sledgehammer -- the "smart" default is about as lightweight as "false" and just as complete as "true"
blanchet
parents:
43166
diff
changeset
|
90 |
"Found proof" ^ |
30c141dc22d6
killed "explicit_apply" option in Sledgehammer -- the "smart" default is about as lightweight as "false" and just as complete as "true"
blanchet
parents:
43166
diff
changeset
|
91 |
(if length used_facts = length facts then "" |
45370
bab52dafa63a
use "Time.time" rather than milliseconds internally
blanchet
parents:
45369
diff
changeset
|
92 |
else " with " ^ n_facts used_facts) ^ |
bab52dafa63a
use "Time.time" rather than milliseconds internally
blanchet
parents:
45369
diff
changeset
|
93 |
" (" ^ string_from_time run_time ^ ")."); |
38092
81a003f7de0d
speed up the minimizer by using the time taken for the first iteration as a timeout for the following iterations, and fix a subtle bug in "string_for_failure"
blanchet
parents:
38084
diff
changeset
|
94 |
result |
36223
217ca1273786
make Sledgehammer's minimizer also minimize Isar proofs
blanchet
parents:
36143
diff
changeset
|
95 |
end |
31236 | 96 |
|
40204
da97d75e20e6
standardize on "fact" terminology (vs. "axiom" or "theorem") in Sledgehammer -- but keep "Axiom" in the lower-level "ATP_Problem" module
blanchet
parents:
40200
diff
changeset
|
97 |
(* minimalization of facts *) |
31236 | 98 |
|
45372 | 99 |
(* Give the external prover some slack. The ATP gets further slack because the |
100 |
Sledgehammer preprocessing time is included in the estimate below but isn't |
|
101 |
part of the timeout. *) |
|
102 |
val slack_msecs = 200 |
|
103 |
||
104 |
fun new_timeout timeout run_time = |
|
105 |
Int.min (Time.toMilliseconds timeout, |
|
106 |
Time.toMilliseconds run_time + slack_msecs) |
|
107 |
|> Time.fromMilliseconds |
|
108 |
||
45367 | 109 |
(* The linear algorithm usually outperforms the binary algorithm when over 60% |
110 |
of the facts are actually needed. The binary algorithm is much more |
|
111 |
appropriate for provers that cannot return the list of used facts and hence |
|
112 |
returns all facts as used. Since we cannot know in advance how many facts are |
|
113 |
actually needed, we heuristically set the threshold to 10 facts. *) |
|
42646
4781fcd53572
replaced some Unsynchronized.refs with Config.Ts
blanchet
parents:
42579
diff
changeset
|
114 |
val binary_min_facts = |
4781fcd53572
replaced some Unsynchronized.refs with Config.Ts
blanchet
parents:
42579
diff
changeset
|
115 |
Attrib.setup_config_int @{binding sledgehammer_minimize_binary_min_facts} |
45368 | 116 |
(K 20) |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
117 |
val auto_minimize_min_facts = |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
118 |
Attrib.setup_config_int @{binding sledgehammer_auto_minimize_min_facts} |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
119 |
(fn generic => Config.get_generic generic binary_min_facts) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
120 |
val auto_minimize_max_time = |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
121 |
Attrib.setup_config_real @{binding sledgehammer_auto_minimize_max_time} |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
122 |
(K 5.0) |
40977 | 123 |
|
45368 | 124 |
fun linear_minimize test timeout result xs = |
125 |
let |
|
126 |
fun min _ [] p = p |
|
127 |
| min timeout (x :: xs) (seen, result) = |
|
128 |
case test timeout (xs @ seen) of |
|
45372 | 129 |
result as {outcome = NONE, used_facts, run_time, ...} |
130 |
: prover_result => |
|
48798 | 131 |
min (new_timeout timeout run_time) |
132 |
(filter_used_facts true used_facts xs) |
|
133 |
(filter_used_facts false used_facts seen, result) |
|
45368 | 134 |
| _ => min timeout xs (x :: seen, result) |
48798 | 135 |
in min timeout (rev xs) ([], result) end |
38015 | 136 |
|
45368 | 137 |
fun binary_minimize test timeout result xs = |
40977 | 138 |
let |
45372 | 139 |
fun min depth (result as {run_time, ...} : prover_result) sup |
140 |
(xs as _ :: _ :: _) = |
|
41743 | 141 |
let |
45367 | 142 |
val (l0, r0) = chop (length xs div 2) xs |
41743 | 143 |
(* |
45366
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
144 |
val _ = warning (replicate_string depth " " ^ "{ " ^ |
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
145 |
"sup: " ^ n_facts (map fst sup)) |
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
146 |
val _ = warning (replicate_string depth " " ^ " " ^ |
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
147 |
"xs: " ^ n_facts (map fst xs)) |
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
148 |
val _ = warning (replicate_string depth " " ^ " " ^ |
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
149 |
"l0: " ^ n_facts (map fst l0)) |
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
150 |
val _ = warning (replicate_string depth " " ^ " " ^ |
4339763edd55
speed up binary minimizer in practice by preferring the first half of the used facts (which are likelier to be relevant) to the second half
blanchet
parents:
44463
diff
changeset
|
151 |
"r0: " ^ n_facts (map fst r0)) |
41743 | 152 |
*) |
45367 | 153 |
val depth = depth + 1 |
45372 | 154 |
val timeout = new_timeout timeout run_time |
41743 | 155 |
in |
45368 | 156 |
case test timeout (sup @ l0) of |
45372 | 157 |
result as {outcome = NONE, used_facts, ...} => |
48798 | 158 |
min depth result (filter_used_facts true used_facts sup) |
159 |
(filter_used_facts true used_facts l0) |
|
45367 | 160 |
| _ => |
45368 | 161 |
case test timeout (sup @ r0) of |
45367 | 162 |
result as {outcome = NONE, used_facts, ...} => |
48798 | 163 |
min depth result (filter_used_facts true used_facts sup) |
164 |
(filter_used_facts true used_facts r0) |
|
45367 | 165 |
| _ => |
166 |
let |
|
167 |
val (sup_r0, (l, result)) = min depth result (sup @ r0) l0 |
|
168 |
val (sup, r0) = |
|
48798 | 169 |
(sup, r0) |
170 |
|> pairself (filter_used_facts true (map fst sup_r0)) |
|
45367 | 171 |
val (sup_l, (r, result)) = min depth result (sup @ l) r0 |
48798 | 172 |
val sup = sup |> filter_used_facts true (map fst sup_l) |
45367 | 173 |
in (sup, (l @ r, result)) end |
40977 | 174 |
end |
41743 | 175 |
(* |
176 |
|> tap (fn _ => warning (replicate_string depth " " ^ "}")) |
|
177 |
*) |
|
45367 | 178 |
| min _ result sup xs = (sup, (xs, result)) |
179 |
in |
|
180 |
case snd (min 0 result [] xs) of |
|
45372 | 181 |
([x], result as {run_time, ...}) => |
182 |
(case test (new_timeout timeout run_time) [] of |
|
45367 | 183 |
result as {outcome = NONE, ...} => ([], result) |
184 |
| _ => ([x], result)) |
|
185 |
| p => p |
|
186 |
end |
|
40977 | 187 |
|
48321 | 188 |
fun minimize_facts do_learn prover_name (params as {learn, timeout, ...}) silent |
189 |
i n state facts = |
|
31236 | 190 |
let |
40941
a3e6f8634a11
replace "smt" prover with specific SMT solvers, e.g. "z3" -- whatever the SMT module gives us
blanchet
parents:
40553
diff
changeset
|
191 |
val ctxt = Proof.context_of state |
45574 | 192 |
val prover = |
193 |
get_prover ctxt (if silent then Auto_Minimize else Minimize) prover_name |
|
45368 | 194 |
fun test timeout = test_facts params silent prover timeout i n state |
48796
0f94b8b69e79
consider removing chained facts last, so that they're more likely to be kept
blanchet
parents:
48399
diff
changeset
|
195 |
val (chained, non_chained) = List.partition is_fact_chained facts |
48798 | 196 |
(* Pull chained facts to the front, so that they are less likely to be |
197 |
kicked out by the minimization algorithms (cf. "rev" in |
|
198 |
"linear_minimize"). *) |
|
48796
0f94b8b69e79
consider removing chained facts last, so that they're more likely to be kept
blanchet
parents:
48399
diff
changeset
|
199 |
val facts = non_chained @ chained |
31236 | 200 |
in |
48796
0f94b8b69e79
consider removing chained facts last, so that they're more likely to be kept
blanchet
parents:
48399
diff
changeset
|
201 |
(print silent (fn () => "Sledgehammer minimizer: " ^ |
0f94b8b69e79
consider removing chained facts last, so that they're more likely to be kept
blanchet
parents:
48399
diff
changeset
|
202 |
quote prover_name ^ "."); |
0f94b8b69e79
consider removing chained facts last, so that they're more likely to be kept
blanchet
parents:
48399
diff
changeset
|
203 |
case test timeout facts of |
45371 | 204 |
result as {outcome = NONE, used_facts, run_time, ...} => |
38015 | 205 |
let |
48798 | 206 |
val facts = filter_used_facts true used_facts facts |
45372 | 207 |
val min = |
42646
4781fcd53572
replaced some Unsynchronized.refs with Config.Ts
blanchet
parents:
42579
diff
changeset
|
208 |
if length facts >= Config.get ctxt binary_min_facts then |
45368 | 209 |
binary_minimize |
40977 | 210 |
else |
45368 | 211 |
linear_minimize |
212 |
val (min_facts, {preplay, message, message_tail, ...}) = |
|
45371 | 213 |
min test (new_timeout timeout run_time) result facts |
48321 | 214 |
in |
215 |
print silent (fn () => cat_lines |
|
216 |
["Minimized to " ^ n_facts (map fst min_facts)] ^ |
|
48796
0f94b8b69e79
consider removing chained facts last, so that they're more likely to be kept
blanchet
parents:
48399
diff
changeset
|
217 |
(case min_facts |> filter is_fact_chained |> length of |
48321 | 218 |
0 => "" |
219 |
| n => "\n(including " ^ string_of_int n ^ " chained)") ^ "."); |
|
48399
4bacc8983b3d
learn from SMT proofs when they can be minimized by Metis
blanchet
parents:
48396
diff
changeset
|
220 |
(if learn then do_learn prover_name (maps snd min_facts) else ()); |
48321 | 221 |
(SOME min_facts, (preplay, message, message_tail)) |
222 |
end |
|
43052
8d6a4978cc65
automatically minimize with Metis when this can be done within a few seconds
blanchet
parents:
43051
diff
changeset
|
223 |
| {outcome = SOME TimedOut, preplay, ...} => |
8d6a4978cc65
automatically minimize with Metis when this can be done within a few seconds
blanchet
parents:
43051
diff
changeset
|
224 |
(NONE, |
8d6a4978cc65
automatically minimize with Metis when this can be done within a few seconds
blanchet
parents:
43051
diff
changeset
|
225 |
(preplay, |
8d6a4978cc65
automatically minimize with Metis when this can be done within a few seconds
blanchet
parents:
43051
diff
changeset
|
226 |
fn _ => "Timeout: You can increase the time limit using the \ |
8d6a4978cc65
automatically minimize with Metis when this can be done within a few seconds
blanchet
parents:
43051
diff
changeset
|
227 |
\\"timeout\" option (e.g., \"timeout = " ^ |
45371 | 228 |
string_of_int (10 + Time.toMilliseconds timeout div 1000) ^ |
229 |
"\").", |
|
43261
a4aeb26a6362
make sure that the message tail (timing + TPTP important message) is preserved upon automatic minimization
blanchet
parents:
43259
diff
changeset
|
230 |
"")) |
43052
8d6a4978cc65
automatically minimize with Metis when this can be done within a few seconds
blanchet
parents:
43051
diff
changeset
|
231 |
| {preplay, message, ...} => |
43261
a4aeb26a6362
make sure that the message tail (timing + TPTP important message) is preserved upon automatic minimization
blanchet
parents:
43259
diff
changeset
|
232 |
(NONE, (preplay, prefix "Prover error: " o message, ""))) |
43166 | 233 |
handle ERROR msg => |
45519
cd6e78cb6ee8
make metis reconstruction handling more flexible
blanchet
parents:
45514
diff
changeset
|
234 |
(NONE, (K (Failed_to_Play plain_metis), fn _ => "Error: " ^ msg, "")) |
31236 | 235 |
end |
236 |
||
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
237 |
fun adjust_reconstructor_params override_params |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
238 |
({debug, verbose, overlord, blocking, provers, type_enc, strict, |
48321 | 239 |
lam_trans, uncurried_aliases, learn, fact_filter, max_facts, |
240 |
fact_thresholds, max_mono_iters, max_new_mono_instances, isar_proof, |
|
241 |
isar_shrink_factor, slice, minimize, timeout, preplay_timeout, expect} |
|
242 |
: params) = |
|
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
243 |
let |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
244 |
fun lookup_override name default_value = |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
245 |
case AList.lookup (op =) override_params name of |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
246 |
SOME [s] => SOME s |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
247 |
| _ => default_value |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
248 |
(* Only those options that reconstructors are interested in are considered |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
249 |
here. *) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
250 |
val type_enc = lookup_override "type_enc" type_enc |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
251 |
val lam_trans = lookup_override "lam_trans" lam_trans |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
252 |
in |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
253 |
{debug = debug, verbose = verbose, overlord = overlord, blocking = blocking, |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
254 |
provers = provers, type_enc = type_enc, strict = strict, |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
255 |
lam_trans = lam_trans, uncurried_aliases = uncurried_aliases, |
48321 | 256 |
learn = learn, fact_filter = fact_filter, max_facts = max_facts, |
48314
ee33ba3c0e05
added option to control which fact filter is used
blanchet
parents:
48293
diff
changeset
|
257 |
fact_thresholds = fact_thresholds, max_mono_iters = max_mono_iters, |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
258 |
max_new_mono_instances = max_new_mono_instances, isar_proof = isar_proof, |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
259 |
isar_shrink_factor = isar_shrink_factor, slice = slice, |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
260 |
minimize = minimize, timeout = timeout, preplay_timeout = preplay_timeout, |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
261 |
expect = expect} |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
262 |
end |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
263 |
|
48384
83dc102041e6
learn on explicit "min" command but do the learning in a thread, since it may take a couple of seconds
blanchet
parents:
48321
diff
changeset
|
264 |
fun maybe_minimize ctxt mode do_learn name |
48394
82fc8c956cdc
fixed various issues with MaSh's file handling + tune output + generate local facts again + handle nameless facts gracefully
blanchet
parents:
48392
diff
changeset
|
265 |
(params as {verbose, isar_proof, minimize, ...}) |
48384
83dc102041e6
learn on explicit "min" command but do the learning in a thread, since it may take a couple of seconds
blanchet
parents:
48321
diff
changeset
|
266 |
({state, subgoal, subgoal_count, facts, ...} : prover_problem) |
83dc102041e6
learn on explicit "min" command but do the learning in a thread, since it may take a couple of seconds
blanchet
parents:
48321
diff
changeset
|
267 |
(result as {outcome, used_facts, run_time, preplay, message, |
83dc102041e6
learn on explicit "min" command but do the learning in a thread, since it may take a couple of seconds
blanchet
parents:
48321
diff
changeset
|
268 |
message_tail} : prover_result) = |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
269 |
if is_some outcome orelse null used_facts then |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
270 |
result |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
271 |
else |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
272 |
let |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
273 |
val num_facts = length used_facts |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
274 |
val ((perhaps_minimize, (minimize_name, params)), preplay) = |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
275 |
if mode = Normal then |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
276 |
if num_facts >= Config.get ctxt auto_minimize_min_facts then |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
277 |
((true, (name, params)), preplay) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
278 |
else |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
279 |
let |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
280 |
fun can_min_fast_enough time = |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
281 |
0.001 |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
282 |
* Real.fromInt ((num_facts + 1) * Time.toMilliseconds time) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
283 |
<= Config.get ctxt auto_minimize_max_time |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
284 |
fun prover_fast_enough () = can_min_fast_enough run_time |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
285 |
in |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
286 |
if isar_proof then |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
287 |
((prover_fast_enough (), (name, params)), preplay) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
288 |
else |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
289 |
let val preplay = preplay () in |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
290 |
(case preplay of |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
291 |
Played (reconstr, timeout) => |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
292 |
if can_min_fast_enough timeout then |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
293 |
(true, extract_reconstructor params reconstr |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
294 |
||> (fn override_params => |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
295 |
adjust_reconstructor_params |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
296 |
override_params params)) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
297 |
else |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
298 |
(prover_fast_enough (), (name, params)) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
299 |
| _ => (prover_fast_enough (), (name, params)), |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
300 |
K preplay) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
301 |
end |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
302 |
end |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
303 |
else |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
304 |
((false, (name, params)), preplay) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
305 |
val minimize = minimize |> the_default perhaps_minimize |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
306 |
val (used_facts, (preplay, message, _)) = |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
307 |
if minimize then |
48392
ca998fa08cd9
added "learn_from_atp" command to MaSh, for patient users
blanchet
parents:
48384
diff
changeset
|
308 |
minimize_facts do_learn minimize_name params |
ca998fa08cd9
added "learn_from_atp" command to MaSh, for patient users
blanchet
parents:
48384
diff
changeset
|
309 |
(mode <> Normal orelse not verbose) subgoal |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
310 |
subgoal_count state |
48798 | 311 |
(filter_used_facts true used_facts |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
312 |
(map (apsnd single o untranslated_fact) facts)) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
313 |
|>> Option.map (map fst) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
314 |
else |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
315 |
(SOME used_facts, (preplay, message, "")) |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
316 |
in |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
317 |
case used_facts of |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
318 |
SOME used_facts => |
48394
82fc8c956cdc
fixed various issues with MaSh's file handling + tune output + generate local facts again + handle nameless facts gracefully
blanchet
parents:
48392
diff
changeset
|
319 |
{outcome = NONE, used_facts = used_facts, run_time = run_time, |
82fc8c956cdc
fixed various issues with MaSh's file handling + tune output + generate local facts again + handle nameless facts gracefully
blanchet
parents:
48392
diff
changeset
|
320 |
preplay = preplay, message = message, message_tail = message_tail} |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
321 |
| NONE => result |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
322 |
end |
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
323 |
|
48321 | 324 |
fun get_minimizing_prover ctxt mode do_learn name params minimize_command |
325 |
problem = |
|
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
326 |
get_prover ctxt mode name params minimize_command problem |
48384
83dc102041e6
learn on explicit "min" command but do the learning in a thread, since it may take a couple of seconds
blanchet
parents:
48321
diff
changeset
|
327 |
|> maybe_minimize ctxt mode do_learn name params problem |
48250
1065c307fafe
further ML structure split to permit finer-grained loading/reordering (problem to solve: MaSh needs most of Sledgehammer)
blanchet
parents:
48085
diff
changeset
|
328 |
|
48321 | 329 |
fun run_minimize (params as {provers, ...}) do_learn i refs state = |
38045 | 330 |
let |
331 |
val ctxt = Proof.context_of state |
|
38696
4c6b65d6a135
quote facts whose names collide with a keyword or command name (cf. "subclass" in "Jinja/J/TypeSafe.thy")
blanchet
parents:
38617
diff
changeset
|
332 |
val reserved = reserved_isar_keyword_table () |
48292 | 333 |
val chained_ths = #facts (Proof.goal state) |
48396 | 334 |
val css = clasimpset_rule_table_of ctxt |
40204
da97d75e20e6
standardize on "fact" terminology (vs. "axiom" or "theorem") in Sledgehammer -- but keep "Axiom" in the lower-level "ATP_Problem" module
blanchet
parents:
40200
diff
changeset
|
335 |
val facts = |
46388 | 336 |
refs |> maps (map (apsnd single) |
48396 | 337 |
o fact_from_ref ctxt reserved chained_ths css) |
38045 | 338 |
in |
339 |
case subgoal_count state of |
|
40132
7ee65dbffa31
renamed Output.priority to Output.urgent_message to emphasize its special role more clearly;
wenzelm
parents:
40114
diff
changeset
|
340 |
0 => Output.urgent_message "No subgoal!" |
41265
a393d6d8e198
let each prover minimizes its own stuff (rather than taking the first prover of the list to minimize every prover's stuff)
blanchet
parents:
41259
diff
changeset
|
341 |
| n => case provers of |
a393d6d8e198
let each prover minimizes its own stuff (rather than taking the first prover of the list to minimize every prover's stuff)
blanchet
parents:
41259
diff
changeset
|
342 |
[] => error "No prover is set." |
a393d6d8e198
let each prover minimizes its own stuff (rather than taking the first prover of the list to minimize every prover's stuff)
blanchet
parents:
41259
diff
changeset
|
343 |
| prover :: _ => |
a393d6d8e198
let each prover minimizes its own stuff (rather than taking the first prover of the list to minimize every prover's stuff)
blanchet
parents:
41259
diff
changeset
|
344 |
(kill_provers (); |
48321 | 345 |
minimize_facts do_learn prover params false i n state facts |
43261
a4aeb26a6362
make sure that the message tail (timing + TPTP important message) is preserved upon automatic minimization
blanchet
parents:
43259
diff
changeset
|
346 |
|> (fn (_, (preplay, message, message_tail)) => |
a4aeb26a6362
make sure that the message tail (timing + TPTP important message) is preserved upon automatic minimization
blanchet
parents:
43259
diff
changeset
|
347 |
message (preplay ()) ^ message_tail |
a4aeb26a6362
make sure that the message tail (timing + TPTP important message) is preserved upon automatic minimization
blanchet
parents:
43259
diff
changeset
|
348 |
|> Output.urgent_message)) |
38045 | 349 |
end |
350 |
||
35866
513074557e06
move the Sledgehammer Isar commands together into one file;
blanchet
parents:
35865
diff
changeset
|
351 |
end; |