author | blanchet |
Mon, 31 Jan 2022 16:09:23 +0100 | |
changeset 75026 | b61949cba32a |
parent 75025 | f741d55a81e5 |
child 75031 | ae4dc5ac983f |
permissions | -rw-r--r-- |
55201 | 1 |
(* Title: HOL/Tools/Sledgehammer/sledgehammer_prover.ML |
28477
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
2 |
Author: Fabian Immler, TU Muenchen |
32996
d2e48879e65a
removed disjunctive group cancellation -- provers run independently;
wenzelm
parents:
32995
diff
changeset
|
3 |
Author: Makarius |
35969 | 4 |
Author: Jasmin Blanchette, TU Muenchen |
28477
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
5 |
|
41087
d7b5fd465198
split "Sledgehammer" module into two parts, to resolve forthcoming dependency problems
blanchet
parents:
41066
diff
changeset
|
6 |
Generic prover abstraction for Sledgehammer. |
28477
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
7 |
*) |
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
8 |
|
55201 | 9 |
signature SLEDGEHAMMER_PROVER = |
28477
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
10 |
sig |
53586
bd5fa6425993
prefixed types and some functions with "atp_" for disambiguation
blanchet
parents:
53551
diff
changeset
|
11 |
type atp_failure = ATP_Proof.atp_failure |
46340 | 12 |
type stature = ATP_Problem_Generate.stature |
46320 | 13 |
type type_enc = ATP_Problem_Generate.type_enc |
51005
ce4290c33d73
eliminated needless speed optimization -- and simplified code quite a bit
blanchet
parents:
50927
diff
changeset
|
14 |
type fact = Sledgehammer_Fact.fact |
55287 | 15 |
type proof_method = Sledgehammer_Proof_Methods.proof_method |
16 |
type play_outcome = Sledgehammer_Proof_Methods.play_outcome |
|
75026 | 17 |
type base_slice = Sledgehammer_ATP_Systems.base_slice |
75025 | 18 |
type atp_slice = Sledgehammer_ATP_Systems.atp_slice |
39493
cb2208f2c07d
move SPASS's Flotter hack to "Sledgehammer_Reconstruct"
blanchet
parents:
39492
diff
changeset
|
19 |
|
58085 | 20 |
datatype mode = Auto_Try | Try | Normal | Minimize | MaSh |
43021 | 21 |
|
73940
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
22 |
datatype induction_rules = Include | Exclude | Instantiate |
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
23 |
val induction_rules_of_string : string -> induction_rules option |
74951
0b6f795d3b78
proper filtering inf induction rules in Mirabelle
desharna
parents:
74948
diff
changeset
|
24 |
val maybe_filter_out_induction_rules : induction_rules -> fact list -> fact list |
73940
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
25 |
|
35969 | 26 |
type params = |
48321 | 27 |
{debug : bool, |
28 |
verbose : bool, |
|
29 |
overlord : bool, |
|
53800 | 30 |
spy : bool, |
48321 | 31 |
provers : string list, |
32 |
type_enc : string option, |
|
33 |
strict : bool, |
|
34 |
lam_trans : string option, |
|
35 |
uncurried_aliases : bool option, |
|
36 |
learn : bool, |
|
37 |
fact_filter : string option, |
|
73939
9231ea46e041
promoted "sledgehammer_instantiate_inducts" to proper option "induction_rules"
desharna
parents:
72798
diff
changeset
|
38 |
induction_rules : induction_rules option, |
48321 | 39 |
max_facts : int option, |
40 |
fact_thresholds : real * real, |
|
41 |
max_mono_iters : int option, |
|
42 |
max_new_mono_instances : int option, |
|
51190
2654b3965c8d
made "isar_proofs" a 3-way option, to provide a way to totally disable isar_proofs if desired
blanchet
parents:
51186
diff
changeset
|
43 |
isar_proofs : bool option, |
57783 | 44 |
compress : real option, |
57245 | 45 |
try0 : bool, |
71931
0c8a9c028304
simplified 'smt_proofs' option to be a binary option (instead of ternary), now that SMT proofs are accepted in the AFP (done with Martin Desharnais)
blanchet
parents:
63692
diff
changeset
|
46 |
smt_proofs : bool, |
57721 | 47 |
minimize : bool, |
75023 | 48 |
slices : int, |
54816
10d48c2a3e32
made timeouts in Sledgehammer not be 'option's -- simplified lots of code
blanchet
parents:
54815
diff
changeset
|
49 |
timeout : Time.time, |
10d48c2a3e32
made timeouts in Sledgehammer not be 'option's -- simplified lots of code
blanchet
parents:
54815
diff
changeset
|
50 |
preplay_timeout : Time.time, |
48321 | 51 |
expect : string} |
39493
cb2208f2c07d
move SPASS's Flotter hack to "Sledgehammer_Reconstruct"
blanchet
parents:
39492
diff
changeset
|
52 |
|
74948
15ce207f69c8
added support for initialization messages to Mirabelle
desharna
parents:
74897
diff
changeset
|
53 |
val string_of_params : params -> string |
74897
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
54 |
val set_params_provers : params -> string list -> params |
75023 | 55 |
val slice_timeout : int -> Time.time -> Time.time |
74897
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
56 |
|
40061
71cc5aac8b76
generalization of the Sledgehammer minimizer, to make it possible to handle SMT solvers as well
blanchet
parents:
40060
diff
changeset
|
57 |
type prover_problem = |
54141
f57f8e7a879f
generate a comment storing the goal nickname in "learn_prover"
blanchet
parents:
54126
diff
changeset
|
58 |
{comment : string, |
f57f8e7a879f
generate a comment storing the goal nickname in "learn_prover"
blanchet
parents:
54126
diff
changeset
|
59 |
state : Proof.state, |
48321 | 60 |
goal : thm, |
61 |
subgoal : int, |
|
62 |
subgoal_count : int, |
|
75025 | 63 |
factss : (string * fact list) list, |
75020
b087610592b4
rationalized output for forthcoming slicing model
blanchet
parents:
75017
diff
changeset
|
64 |
found_proof : string -> unit} |
39493
cb2208f2c07d
move SPASS's Flotter hack to "Sledgehammer_Reconstruct"
blanchet
parents:
39492
diff
changeset
|
65 |
|
75026 | 66 |
type prover_slice = base_slice * atp_slice option |
75025 | 67 |
|
40061
71cc5aac8b76
generalization of the Sledgehammer minimizer, to make it possible to handle SMT solvers as well
blanchet
parents:
40060
diff
changeset
|
68 |
type prover_result = |
53586
bd5fa6425993
prefixed types and some functions with "atp_" for disambiguation
blanchet
parents:
53551
diff
changeset
|
69 |
{outcome : atp_failure option, |
51009
e8ff34a1fa9a
thread through fact triple component from which used facts come, for accurate index output
blanchet
parents:
51007
diff
changeset
|
70 |
used_facts : (string * stature) list, |
e8ff34a1fa9a
thread through fact triple component from which used facts come, for accurate index output
blanchet
parents:
51007
diff
changeset
|
71 |
used_from : fact list, |
57734
18bb3e1ff6f6
rationalized preplaying by eliminating (now superfluous) laziness
blanchet
parents:
57732
diff
changeset
|
72 |
preferred_methss : proof_method * proof_method list list, |
48321 | 73 |
run_time : Time.time, |
57750 | 74 |
message : (unit -> (string * stature) list * (proof_method * play_outcome)) -> string} |
39493
cb2208f2c07d
move SPASS's Flotter hack to "Sledgehammer_Reconstruct"
blanchet
parents:
39492
diff
changeset
|
75 |
|
75025 | 76 |
type prover = params -> prover_problem -> prover_slice -> prover_result |
35867 | 77 |
|
48319
340187063d84
use async manager to manage MaSh learners to make sure they get killed cleanly
blanchet
parents:
48314
diff
changeset
|
78 |
val SledgehammerN : string |
57037 | 79 |
val str_of_mode : mode -> string |
55205 | 80 |
val overlord_file_location_of_prover : string -> string * string |
81 |
val proof_banner : mode -> string -> string |
|
43050
59284a13abc4
support "metis" and "metisFT" as provers in the architecture, so they can be used for minimizing
blanchet
parents:
43044
diff
changeset
|
82 |
val is_atp : theory -> string -> bool |
72518
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
83 |
val bunches_of_proof_methods : Proof.context -> bool -> bool -> bool -> string -> |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
84 |
proof_method list list |
75025 | 85 |
val get_facts_of_filter : string -> (string * fact list) list -> fact list |
48798 | 86 |
val is_fact_chained : (('a * stature) * 'b) -> bool |
57056 | 87 |
val filter_used_facts : bool -> (''a * stature) list -> ((''a * stature) * 'b) list -> |
48798 | 88 |
((''a * stature) * 'b) list |
55205 | 89 |
val repair_monomorph_context : int option -> int -> int option -> int -> Proof.context -> |
90 |
Proof.context |
|
55212 | 91 |
val supported_provers : Proof.context -> unit |
28477
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
92 |
end; |
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
93 |
|
55201 | 94 |
structure Sledgehammer_Prover : SLEDGEHAMMER_PROVER = |
28477
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
95 |
struct |
9339d4dcec8b
version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff
changeset
|
96 |
|
57154 | 97 |
open ATP_Proof |
43085
0a2f5b86bdd7
first step in sharing more code between ATP and Metis translation
blanchet
parents:
43063
diff
changeset
|
98 |
open ATP_Util |
38028 | 99 |
open ATP_Problem |
46320 | 100 |
open ATP_Problem_Generate |
101 |
open ATP_Proof_Reconstruct |
|
45521 | 102 |
open Metis_Tactic |
51005
ce4290c33d73
eliminated needless speed optimization -- and simplified code quite a bit
blanchet
parents:
50927
diff
changeset
|
103 |
open Sledgehammer_Fact |
55287 | 104 |
open Sledgehammer_Proof_Methods |
72400 | 105 |
open Sledgehammer_ATP_Systems |
54000
9cfff7f61d0d
added experimental configuration options to tune use of builtin symbols in SMT
blanchet
parents:
53989
diff
changeset
|
106 |
|
58085 | 107 |
(* Identifier that distinguishes Sledgehammer from other tools that could use "Async_Manager". *) |
48319
340187063d84
use async manager to manage MaSh learners to make sure they get killed cleanly
blanchet
parents:
48314
diff
changeset
|
108 |
val SledgehammerN = "Sledgehammer" |
37585 | 109 |
|
58085 | 110 |
datatype mode = Auto_Try | Try | Normal | Minimize | MaSh |
57037 | 111 |
|
112 |
fun str_of_mode Auto_Try = "Auto Try" |
|
113 |
| str_of_mode Try = "Try" |
|
114 |
| str_of_mode Normal = "Normal" |
|
58085 | 115 |
| str_of_mode Minimize = "Minimize" |
57037 | 116 |
| str_of_mode MaSh = "MaSh" |
117 |
||
73940
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
118 |
datatype induction_rules = Include | Exclude | Instantiate |
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
119 |
|
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
120 |
fun induction_rules_of_string "include" = SOME Include |
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
121 |
| induction_rules_of_string "exclude" = SOME Exclude |
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
122 |
| induction_rules_of_string "instantiate" = SOME Instantiate |
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
123 |
| induction_rules_of_string _ = NONE |
f58108b7a60c
refactored Sledgehammer option "induction_rules"
desharna
parents:
73939
diff
changeset
|
124 |
|
43050
59284a13abc4
support "metis" and "metisFT" as provers in the architecture, so they can be used for minimizing
blanchet
parents:
43044
diff
changeset
|
125 |
val is_atp = member (op =) o supported_atps |
59284a13abc4
support "metis" and "metisFT" as provers in the architecture, so they can be used for minimizing
blanchet
parents:
43044
diff
changeset
|
126 |
|
35969 | 127 |
type params = |
48321 | 128 |
{debug : bool, |
129 |
verbose : bool, |
|
130 |
overlord : bool, |
|
53800 | 131 |
spy : bool, |
48321 | 132 |
provers : string list, |
133 |
type_enc : string option, |
|
134 |
strict : bool, |
|
135 |
lam_trans : string option, |
|
136 |
uncurried_aliases : bool option, |
|
137 |
learn : bool, |
|
138 |
fact_filter : string option, |
|
73939
9231ea46e041
promoted "sledgehammer_instantiate_inducts" to proper option "induction_rules"
desharna
parents:
72798
diff
changeset
|
139 |
induction_rules : induction_rules option, |
48321 | 140 |
max_facts : int option, |
141 |
fact_thresholds : real * real, |
|
142 |
max_mono_iters : int option, |
|
143 |
max_new_mono_instances : int option, |
|
51190
2654b3965c8d
made "isar_proofs" a 3-way option, to provide a way to totally disable isar_proofs if desired
blanchet
parents:
51186
diff
changeset
|
144 |
isar_proofs : bool option, |
57783 | 145 |
compress : real option, |
57245 | 146 |
try0 : bool, |
71931
0c8a9c028304
simplified 'smt_proofs' option to be a binary option (instead of ternary), now that SMT proofs are accepted in the AFP (done with Martin Desharnais)
blanchet
parents:
63692
diff
changeset
|
147 |
smt_proofs : bool, |
57721 | 148 |
minimize : bool, |
75023 | 149 |
slices : int, |
54816
10d48c2a3e32
made timeouts in Sledgehammer not be 'option's -- simplified lots of code
blanchet
parents:
54815
diff
changeset
|
150 |
timeout : Time.time, |
10d48c2a3e32
made timeouts in Sledgehammer not be 'option's -- simplified lots of code
blanchet
parents:
54815
diff
changeset
|
151 |
preplay_timeout : Time.time, |
48321 | 152 |
expect : string} |
35867 | 153 |
|
74948
15ce207f69c8
added support for initialization messages to Mirabelle
desharna
parents:
74897
diff
changeset
|
154 |
fun string_of_params (params : params) = |
15ce207f69c8
added support for initialization messages to Mirabelle
desharna
parents:
74897
diff
changeset
|
155 |
YXML.content_of (ML_Pretty.string_of_polyml (ML_system_pretty (params, 100))) |
15ce207f69c8
added support for initialization messages to Mirabelle
desharna
parents:
74897
diff
changeset
|
156 |
|
74951
0b6f795d3b78
proper filtering inf induction rules in Mirabelle
desharna
parents:
74948
diff
changeset
|
157 |
fun maybe_filter_out_induction_rules induction_rules : fact list -> fact list = |
0b6f795d3b78
proper filtering inf induction rules in Mirabelle
desharna
parents:
74948
diff
changeset
|
158 |
induction_rules = Exclude ? |
0b6f795d3b78
proper filtering inf induction rules in Mirabelle
desharna
parents:
74948
diff
changeset
|
159 |
filter_out (fn ((_, (_, ATP_Problem_Generate.Induction)), _) => true | _ => false) |
0b6f795d3b78
proper filtering inf induction rules in Mirabelle
desharna
parents:
74948
diff
changeset
|
160 |
|
74897
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
161 |
fun set_params_provers params provers = |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
162 |
{debug = #debug params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
163 |
verbose = #verbose params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
164 |
overlord = #overlord params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
165 |
spy = #spy params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
166 |
provers = provers, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
167 |
type_enc = #type_enc params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
168 |
strict = #strict params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
169 |
lam_trans = #lam_trans params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
170 |
uncurried_aliases = #uncurried_aliases params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
171 |
learn = #learn params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
172 |
fact_filter = #fact_filter params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
173 |
induction_rules = #induction_rules params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
174 |
max_facts = #max_facts params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
175 |
fact_thresholds = #fact_thresholds params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
176 |
max_mono_iters = #max_mono_iters params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
177 |
max_new_mono_instances = #max_new_mono_instances params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
178 |
isar_proofs = #isar_proofs params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
179 |
compress = #compress params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
180 |
try0 = #try0 params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
181 |
smt_proofs = #smt_proofs params, |
75016
873b581fd690
generalized the 'slice' option towards more flexible slicing
blanchet
parents:
74951
diff
changeset
|
182 |
minimize = #minimize params, |
75023 | 183 |
slices = #slices params, |
74897
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
184 |
timeout = #timeout params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
185 |
preplay_timeout = #preplay_timeout params, |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
186 |
expect = #expect params} |
8b1ab558e3ee
reused Sledgehammer code to parse parameters of sledgehammer action in Mirabelle
desharna
parents:
74370
diff
changeset
|
187 |
|
75023 | 188 |
fun slice_timeout slices timeout = |
189 |
Time.toReal timeout * Real.fromInt (Multithreading.max_threads ()) / Real.fromInt slices |
|
190 |
|> seconds |
|
191 |
||
40061
71cc5aac8b76
generalization of the Sledgehammer minimizer, to make it possible to handle SMT solvers as well
blanchet
parents:
40060
diff
changeset
|
192 |
type prover_problem = |
54141
f57f8e7a879f
generate a comment storing the goal nickname in "learn_prover"
blanchet
parents:
54126
diff
changeset
|
193 |
{comment : string, |
f57f8e7a879f
generate a comment storing the goal nickname in "learn_prover"
blanchet
parents:
54126
diff
changeset
|
194 |
state : Proof.state, |
48321 | 195 |
goal : thm, |
196 |
subgoal : int, |
|
197 |
subgoal_count : int, |
|
75025 | 198 |
factss : (string * fact list) list, |
75020
b087610592b4
rationalized output for forthcoming slicing model
blanchet
parents:
75017
diff
changeset
|
199 |
found_proof : string -> unit} |
35867 | 200 |
|
75026 | 201 |
type prover_slice = base_slice * atp_slice option |
75025 | 202 |
|
40061
71cc5aac8b76
generalization of the Sledgehammer minimizer, to make it possible to handle SMT solvers as well
blanchet
parents:
40060
diff
changeset
|
203 |
type prover_result = |
53586
bd5fa6425993
prefixed types and some functions with "atp_" for disambiguation
blanchet
parents:
53551
diff
changeset
|
204 |
{outcome : atp_failure option, |
48321 | 205 |
used_facts : (string * stature) list, |
51009
e8ff34a1fa9a
thread through fact triple component from which used facts come, for accurate index output
blanchet
parents:
51007
diff
changeset
|
206 |
used_from : fact list, |
57734
18bb3e1ff6f6
rationalized preplaying by eliminating (now superfluous) laziness
blanchet
parents:
57732
diff
changeset
|
207 |
preferred_methss : proof_method * proof_method list list, |
48321 | 208 |
run_time : Time.time, |
57750 | 209 |
message : (unit -> (string * stature) list * (proof_method * play_outcome)) -> string} |
35867 | 210 |
|
75025 | 211 |
type prover = params -> prover_problem -> prover_slice -> prover_result |
35867 | 212 |
|
55205 | 213 |
fun overlord_file_location_of_prover prover = (getenv "ISABELLE_HOME_USER", "prob_" ^ prover) |
41313
a96ac4d180b7
optionally supply constant weights to E -- turned off by default until properly parameterized
blanchet
parents:
41259
diff
changeset
|
214 |
|
75020
b087610592b4
rationalized output for forthcoming slicing model
blanchet
parents:
75017
diff
changeset
|
215 |
fun proof_banner mode prover_name = |
55205 | 216 |
(case mode of |
75020
b087610592b4
rationalized output for forthcoming slicing model
blanchet
parents:
75017
diff
changeset
|
217 |
Auto_Try => "Auto Sledgehammer (" ^ prover_name ^ ") found a proof" |
b087610592b4
rationalized output for forthcoming slicing model
blanchet
parents:
75017
diff
changeset
|
218 |
| Try => "Sledgehammer (" ^ prover_name ^ ") found a proof" |
55205 | 219 |
| _ => "Try this") |
43033 | 220 |
|
72518
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
221 |
fun bunches_of_proof_methods ctxt try0 smt_proofs needs_full_types desperate_lam_trans = |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
222 |
let |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
223 |
val try0_methodss = |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
224 |
if try0 then |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
225 |
[[Simp_Method, Auto_Method, Blast_Method, Linarith_Method, Meson_Method, |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
226 |
Metis_Method (NONE, NONE), Fastforce_Method, Force_Method, Presburger_Method]] |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
227 |
else |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
228 |
[] |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
229 |
|
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
230 |
val metis_methods = |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
231 |
(if try0 then [] else [Metis_Method (NONE, NONE)]) @ |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
232 |
Metis_Method (SOME full_typesN, NONE) :: |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
233 |
Metis_Method (SOME really_full_type_enc, SOME desperate_lam_trans) :: |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
234 |
(if needs_full_types then |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
235 |
[Metis_Method (SOME really_full_type_enc, NONE), |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
236 |
Metis_Method (SOME full_typesN, SOME desperate_lam_trans)] |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
237 |
else |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
238 |
[Metis_Method (SOME no_typesN, SOME desperate_lam_trans)]) |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
239 |
|
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
240 |
val smt_methodss = |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
241 |
if smt_proofs then |
74370 | 242 |
[map (SMT_Method o SMT_Verit) (Verit_Proof.all_veriT_stgies (Context.Proof ctxt)), |
243 |
[SMT_Method SMT_Z3]] |
|
72518
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
244 |
else |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
245 |
[] |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
246 |
in |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
247 |
try0_methodss @ [metis_methods] @ smt_methodss |
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
desharna
parents:
72400
diff
changeset
|
248 |
end |
43033 | 249 |
|
75025 | 250 |
fun get_facts_of_filter fact_filter factss = |
251 |
(case AList.lookup (op =) factss fact_filter of |
|
252 |
SOME facts => facts |
|
253 |
| NONE => snd (hd factss)) |
|
254 |
||
48798 | 255 |
fun is_fact_chained ((_, (sc, _)), _) = sc = Chained |
256 |
||
257 |
fun filter_used_facts keep_chained used = |
|
58654
3e1cad27fc2f
special treatment of extensionality in minimizer
blanchet
parents:
58498
diff
changeset
|
258 |
filter ((member (eq_fst (op =)) used o fst) orf |
3e1cad27fc2f
special treatment of extensionality in minimizer
blanchet
parents:
58498
diff
changeset
|
259 |
(if keep_chained then is_fact_chained else K false)) |
43033 | 260 |
|
53480
247817dbb990
limit the number of instances of a single theorem
blanchet
parents:
53478
diff
changeset
|
261 |
val max_fact_instances = 10 (* FUDGE *) |
247817dbb990
limit the number of instances of a single theorem
blanchet
parents:
53478
diff
changeset
|
262 |
|
55205 | 263 |
fun repair_monomorph_context max_iters best_max_iters max_new_instances best_max_new_instances = |
52034
11b48e7a4e7e
correctly 'repair' the monomorphization context for SMT solvers from Sledgehammer
blanchet
parents:
52031
diff
changeset
|
264 |
Config.put Monomorph.max_rounds (max_iters |> the_default best_max_iters) |
11b48e7a4e7e
correctly 'repair' the monomorphization context for SMT solvers from Sledgehammer
blanchet
parents:
52031
diff
changeset
|
265 |
#> Config.put Monomorph.max_new_instances |
55205 | 266 |
(max_new_instances |> the_default best_max_new_instances) |
53480
247817dbb990
limit the number of instances of a single theorem
blanchet
parents:
53478
diff
changeset
|
267 |
#> Config.put Monomorph.max_thm_instances max_fact_instances |
52034
11b48e7a4e7e
correctly 'repair' the monomorphization context for SMT solvers from Sledgehammer
blanchet
parents:
52031
diff
changeset
|
268 |
|
55212 | 269 |
fun supported_provers ctxt = |
43050
59284a13abc4
support "metis" and "metisFT" as provers in the architecture, so they can be used for minimizing
blanchet
parents:
43044
diff
changeset
|
270 |
let |
55212 | 271 |
val thy = Proof_Context.theory_of ctxt |
272 |
val (remote_provers, local_provers) = |
|
58061 | 273 |
sort_strings (supported_atps thy) @ sort_strings (SMT_Config.available_solvers_of ctxt) |
55212 | 274 |
|> List.partition (String.isPrefix remote_prefix) |
43050
59284a13abc4
support "metis" and "metisFT" as provers in the architecture, so they can be used for minimizing
blanchet
parents:
43044
diff
changeset
|
275 |
in |
63692 | 276 |
writeln ("Supported provers: " ^ commas (local_provers @ remote_provers)) |
43050
59284a13abc4
support "metis" and "metisFT" as provers in the architecture, so they can be used for minimizing
blanchet
parents:
43044
diff
changeset
|
277 |
end |
59284a13abc4
support "metis" and "metisFT" as provers in the architecture, so they can be used for minimizing
blanchet
parents:
43044
diff
changeset
|
278 |
|
28582 | 279 |
end; |