71 {state, goal, subgoal, subgoal_count, factss as (_, facts) :: _} name = |
71 {state, goal, subgoal, subgoal_count, factss as (_, facts) :: _} name = |
72 let |
72 let |
73 val ctxt = Proof.context_of state |
73 val ctxt = Proof.context_of state |
74 |
74 |
75 val hard_timeout = time_mult 3.0 (timeout |> the_default one_day) |
75 val hard_timeout = time_mult 3.0 (timeout |> the_default one_day) |
76 val _ = spying spy (fn () => (state, subgoal, name, "launched")); |
76 val _ = spying spy (fn () => (state, subgoal, name, "Launched")); |
77 val birth_time = Time.now () |
77 val birth_time = Time.now () |
78 val death_time = Time.+ (birth_time, hard_timeout) |
78 val death_time = Time.+ (birth_time, hard_timeout) |
79 val max_facts = max_facts |> the_default (default_max_facts_of_prover ctxt slice name) |
79 val max_facts = max_facts |> the_default (default_max_facts_of_prover ctxt slice name) |
80 val num_facts = length facts |> not only ? Integer.min max_facts |
80 val num_facts = length facts |> not only ? Integer.min max_facts |
81 |
81 |
98 |> commas |
98 |> commas |
99 |> enclose ("Fact" ^ plural_s (length facts) ^ " in " ^ quote name ^ |
99 |> enclose ("Fact" ^ plural_s (length facts) ^ " in " ^ quote name ^ |
100 " proof (of " ^ string_of_int (length facts) ^ "): ") "." |
100 " proof (of " ^ string_of_int (length facts) ^ "): ") "." |
101 |> Output.urgent_message |
101 |> Output.urgent_message |
102 |
102 |
103 fun spying_str_of_res ({outcome = NONE, used_facts, ...} : prover_result) = |
103 fun spying_str_of_res ({outcome = NONE, used_facts, used_from, ...} : prover_result) = |
104 let val num_used_facts = length used_facts in |
104 let |
|
105 val num_used_facts = length used_facts |
|
106 val indices = |
|
107 tag_list 1 used_from |
|
108 |> map (fn (j, fact) => fact |> apsnd (K j)) |
|
109 |> filter_used_facts false used_facts |
|
110 |> map (prefix "@" o string_of_int o snd) |
|
111 in |
105 "success: Found proof with " ^ string_of_int num_used_facts ^ " fact" ^ |
112 "success: Found proof with " ^ string_of_int num_used_facts ^ " fact" ^ |
106 plural_s num_used_facts |
113 plural_s num_used_facts ^ |
|
114 (if num_used_facts = 0 then "" else " (" ^ commas indices ^ ")") |
107 end |
115 end |
108 | spying_str_of_res {outcome = SOME failure, ...} = |
116 | spying_str_of_res {outcome = SOME failure, ...} = |
109 "failure: " ^ string_of_atp_failure failure |
117 "Failure: " ^ string_of_atp_failure failure |
110 |
118 |
111 fun really_go () = |
119 fun really_go () = |
112 problem |
120 problem |
113 |> get_minimizing_prover ctxt mode learn name params minimize_command |
121 |> get_minimizing_prover ctxt mode learn name params minimize_command |
114 |> verbose |
122 |> verbose |
224 val _ = case find_first (not o is_prover_supported ctxt) provers of |
232 val _ = case find_first (not o is_prover_supported ctxt) provers of |
225 SOME name => error ("No such prover: " ^ name ^ ".") |
233 SOME name => error ("No such prover: " ^ name ^ ".") |
226 | NONE => () |
234 | NONE => () |
227 val _ = print "Sledgehammering..." |
235 val _ = print "Sledgehammering..." |
228 val _ = |
236 val _ = |
229 spying spy (fn () => (state, i, "***", "starting " ^ @{make_string} mode ^ " mode")) |
237 spying spy (fn () => (state, i, "***", "Starting " ^ @{make_string} mode ^ " mode")) |
230 val (smts, (ueq_atps, full_atps)) = |
238 val (smts, (ueq_atps, full_atps)) = |
231 provers |> List.partition (is_smt_prover ctxt) |
239 provers |> List.partition (is_smt_prover ctxt) |
232 ||> List.partition (is_unit_equational_atp ctxt) |
240 ||> List.partition (is_unit_equational_atp ctxt) |
233 |
241 |
234 val spying_str_of_factss = |
242 val spying_str_of_factss = |
248 in |
256 in |
249 all_facts |
257 all_facts |
250 |> (case is_appropriate_prop of |
258 |> (case is_appropriate_prop of |
251 SOME is_app => filter (is_app o prop_of o snd) |
259 SOME is_app => filter (is_app o prop_of o snd) |
252 | NONE => I) |
260 | NONE => I) |
253 |> relevant_facts ctxt params (hd provers) max_max_facts fact_override |
261 |> relevant_facts ctxt params (hd provers) max_max_facts fact_override hyp_ts concl_t |
254 hyp_ts concl_t |
|
255 |> tap (fn factss => |
262 |> tap (fn factss => |
256 if verbose then |
263 if verbose then |
257 label ^ plural_s (length provers) ^ ": " ^ |
264 label ^ plural_s (length provers) ^ ": " ^ |
258 string_of_factss factss |
265 string_of_factss factss |
259 |> print |
266 |> print |
260 else |
267 else |
261 ()) |
268 ()) |
262 |> spy ? tap (fn factss => |
269 |> spy ? tap (fn factss => spying spy (fn () => |
263 spying spy (fn () => |
270 (state, i, label ^ "s", "Selected facts: " ^ spying_str_of_factss factss))) |
264 (state, i, label ^ "s", "selected facts: " ^ spying_str_of_factss factss))) |
|
265 end |
271 end |
266 |
272 |
267 fun launch_provers state label is_appropriate_prop provers = |
273 fun launch_provers state label is_appropriate_prop provers = |
268 let |
274 let |
269 val factss = get_factss label is_appropriate_prop provers |
275 val factss = get_factss label is_appropriate_prop provers |