20 open ATP_Problem_Generate |
20 open ATP_Problem_Generate |
21 open ATP_Proof_Reconstruct |
21 open ATP_Proof_Reconstruct |
22 open Sledgehammer_Util |
22 open Sledgehammer_Util |
23 open Sledgehammer_Fact |
23 open Sledgehammer_Fact |
24 open Sledgehammer_Prover |
24 open Sledgehammer_Prover |
|
25 open Sledgehammer_Prover_SMT |
25 open Sledgehammer_Prover_Minimize |
26 open Sledgehammer_Prover_Minimize |
26 open Sledgehammer_MaSh |
27 open Sledgehammer_MaSh |
27 open Sledgehammer |
28 open Sledgehammer |
28 |
29 |
29 (* val cvc3N = "cvc3" *) |
30 (* val cvc3N = "cvc3" *) |
192 val empty = default_default_params |> map (apsnd single) |
193 val empty = default_default_params |> map (apsnd single) |
193 val extend = I |
194 val extend = I |
194 fun merge data : T = AList.merge (op =) (K true) data |
195 fun merge data : T = AList.merge (op =) (K true) data |
195 ) |
196 ) |
196 |
197 |
|
198 fun is_prover_supported ctxt = |
|
199 let val thy = Proof_Context.theory_of ctxt in |
|
200 is_proof_method orf is_atp thy orf is_smt_prover ctxt |
|
201 end |
|
202 |
|
203 fun is_prover_installed ctxt = |
|
204 is_proof_method orf is_smt_prover ctxt orf is_atp_installed (Proof_Context.theory_of ctxt) |
|
205 |
|
206 fun remotify_prover_if_supported_and_not_already_remote ctxt name = |
|
207 if String.isPrefix remote_prefix name then |
|
208 SOME name |
|
209 else |
|
210 let val remote_name = remote_prefix ^ name in |
|
211 if is_prover_supported ctxt remote_name then SOME remote_name else NONE |
|
212 end |
|
213 |
|
214 fun remotify_prover_if_not_installed ctxt name = |
|
215 if is_prover_supported ctxt name andalso is_prover_installed ctxt name then |
|
216 SOME name |
|
217 else |
|
218 remotify_prover_if_supported_and_not_already_remote ctxt name |
|
219 |
197 (* The first ATP of the list is used by Auto Sledgehammer. Because of the low |
220 (* The first ATP of the list is used by Auto Sledgehammer. Because of the low |
198 timeout, it makes sense to put E first. *) |
221 timeout, it makes sense to put E first. *) |
199 fun default_provers_param_value mode thy = |
222 fun default_provers_param_value mode ctxt = |
200 [eN, spassN, z3N, e_sineN, vampireN, yicesN] |
223 [eN, spassN, z3N, e_sineN, vampireN, yicesN] |
201 |> map_filter (remotify_atp_if_not_installed thy) |
224 |> map_filter (remotify_prover_if_not_installed ctxt) |
202 (* In "try" mode, leave at least one thread to another slow tool (e.g. Nitpick) *) |
225 (* In "try" mode, leave at least one thread to another slow tool (e.g. Nitpick) *) |
203 |> take (Multithreading.max_threads_value () - (if mode = Try then 1 else 0)) |
226 |> take (Multithreading.max_threads_value () - (if mode = Try then 1 else 0)) |
204 |> implode_param |
227 |> implode_param |
205 |
228 |
206 fun set_default_raw_param param thy = |
229 fun set_default_raw_param param thy = |
207 let val ctxt = Proof_Context.init_global thy in |
230 let val ctxt = Proof_Context.init_global thy in |
208 thy |> Data.map (AList.update (op =) (normalize_raw_param ctxt param)) |
231 thy |> Data.map (AList.update (op =) (normalize_raw_param ctxt param)) |
209 end |
232 end |
210 |
233 |
211 fun default_raw_params mode thy = |
234 fun default_raw_params mode thy = |
212 Data.get thy |
235 let val ctxt = Proof_Context.init_global thy in |
213 |> fold (AList.default (op =)) |
236 Data.get thy |
214 [("provers", [(case !provers of "" => default_provers_param_value mode thy | s => s)]), |
237 |> fold (AList.default (op =)) |
215 ("timeout", |
238 [("provers", [(case !provers of "" => default_provers_param_value mode ctxt | s => s)]), |
216 let val timeout = Options.default_int @{option sledgehammer_timeout} in |
239 ("timeout", |
217 [if timeout <= 0 then "none" else string_of_int timeout] |
240 let val timeout = Options.default_int @{option sledgehammer_timeout} in |
218 end)] |
241 [if timeout <= 0 then "none" else string_of_int timeout] |
|
242 end)] |
|
243 end |
219 |
244 |
220 fun extract_params mode default_params override_params = |
245 fun extract_params mode default_params override_params = |
221 let |
246 let |
222 val raw_params = rev override_params @ rev default_params |
247 val raw_params = rev override_params @ rev default_params |
223 val lookup = Option.map implode_param o AList.lookup (op =) raw_params |
248 val lookup = Option.map implode_param o AList.lookup (op =) raw_params |