55 |
55 |
56 type prover_result = |
56 type prover_result = |
57 {outcome : atp_failure option, |
57 {outcome : atp_failure option, |
58 used_facts : (string * stature) list, |
58 used_facts : (string * stature) list, |
59 used_from : fact list, |
59 used_from : fact list, |
|
60 preferred_methss : proof_method * proof_method list list, |
60 run_time : Time.time, |
61 run_time : Time.time, |
61 preplay : (proof_method * play_outcome) Lazy.lazy, |
|
62 message : proof_method * play_outcome -> string, |
62 message : proof_method * play_outcome -> string, |
63 message_tail : string} |
63 message_tail : string} |
64 |
64 |
65 type prover = |
65 type prover = |
66 params -> ((string * string list) list -> string -> minimize_command) -> prover_problem -> |
66 params -> ((string * string list) list -> string -> minimize_command) -> prover_problem -> |
69 val SledgehammerN : string |
69 val SledgehammerN : string |
70 val str_of_mode : mode -> string |
70 val str_of_mode : mode -> string |
71 val overlord_file_location_of_prover : string -> string * string |
71 val overlord_file_location_of_prover : string -> string * string |
72 val proof_banner : mode -> string -> string |
72 val proof_banner : mode -> string -> string |
73 val is_atp : theory -> string -> bool |
73 val is_atp : theory -> string -> bool |
74 val bunch_of_proof_methods : bool -> bool -> string -> proof_method list |
74 val bunches_of_proof_methods : bool -> bool -> string -> proof_method list list |
75 val is_fact_chained : (('a * stature) * 'b) -> bool |
75 val is_fact_chained : (('a * stature) * 'b) -> bool |
76 val filter_used_facts : bool -> (''a * stature) list -> ((''a * stature) * 'b) list -> |
76 val filter_used_facts : bool -> (''a * stature) list -> ((''a * stature) * 'b) list -> |
77 ((''a * stature) * 'b) list |
77 ((''a * stature) * 'b) list |
78 val play_one_line_proof : mode -> Time.time -> ((string * 'a) * thm) list -> Proof.state -> int -> |
|
79 proof_method -> proof_method list -> proof_method * play_outcome |
|
80 val repair_monomorph_context : int option -> int -> int option -> int -> Proof.context -> |
78 val repair_monomorph_context : int option -> int -> int option -> int -> Proof.context -> |
81 Proof.context |
79 Proof.context |
82 |
80 |
83 val supported_provers : Proof.context -> unit |
81 val supported_provers : Proof.context -> unit |
84 val kill_provers : unit -> unit |
82 val kill_provers : unit -> unit |
153 |
149 |
154 type prover_result = |
150 type prover_result = |
155 {outcome : atp_failure option, |
151 {outcome : atp_failure option, |
156 used_facts : (string * stature) list, |
152 used_facts : (string * stature) list, |
157 used_from : fact list, |
153 used_from : fact list, |
|
154 preferred_methss : proof_method * proof_method list list, |
158 run_time : Time.time, |
155 run_time : Time.time, |
159 preplay : (proof_method * play_outcome) Lazy.lazy, |
|
160 message : proof_method * play_outcome -> string, |
156 message : proof_method * play_outcome -> string, |
161 message_tail : string} |
157 message_tail : string} |
162 |
158 |
163 type prover = |
159 type prover = |
164 params -> ((string * string list) list -> string -> minimize_command) |
160 params -> ((string * string list) list -> string -> minimize_command) |
170 (case mode of |
166 (case mode of |
171 Auto_Try => "Auto Sledgehammer (" ^ quote name ^ ") found a proof" |
167 Auto_Try => "Auto Sledgehammer (" ^ quote name ^ ") found a proof" |
172 | Try => "Sledgehammer (" ^ quote name ^ ") found a proof" |
168 | Try => "Sledgehammer (" ^ quote name ^ ") found a proof" |
173 | _ => "Try this") |
169 | _ => "Try this") |
174 |
170 |
175 fun bunch_of_proof_methods smt_proofs needs_full_types desperate_lam_trans = |
171 fun bunches_of_proof_methods smt_proofs needs_full_types desperate_lam_trans = |
176 [Simp_Method, Auto_Method, Fastforce_Method, Blast_Method, Meson_Method, |
172 [[Simp_Method, Auto_Method, Blast_Method, Linarith_Method], |
177 Metis_Method (if needs_full_types then SOME full_typesN else NONE, NONE), |
173 [Fastforce_Method, Meson_Method, |
178 Force_Method, Linarith_Method, Presburger_Method] @ |
174 Metis_Method (if needs_full_types then SOME full_typesN else NONE, NONE), |
179 (if needs_full_types then |
175 Force_Method, Presburger_Method], |
180 [Metis_Method (SOME really_full_type_enc, NONE), |
176 (if needs_full_types then |
181 Metis_Method (SOME full_typesN, SOME desperate_lam_trans), |
177 [Metis_Method (NONE, NONE), |
182 Metis_Method (SOME really_full_type_enc, SOME desperate_lam_trans)] |
178 Metis_Method (SOME really_full_type_enc, NONE), |
183 else |
179 Metis_Method (SOME full_typesN, SOME desperate_lam_trans), |
184 [Metis_Method (SOME full_typesN, NONE), |
180 Metis_Method (SOME really_full_type_enc, SOME desperate_lam_trans)] |
185 Metis_Method (SOME no_typesN, SOME desperate_lam_trans), |
181 else |
186 Metis_Method (SOME really_full_type_enc, SOME desperate_lam_trans)]) @ |
182 [Metis_Method (SOME full_typesN, NONE), |
187 (if smt_proofs then [SMT2_Method] else []) |
183 Metis_Method (SOME no_typesN, SOME desperate_lam_trans), |
188 |
184 Metis_Method (SOME really_full_type_enc, SOME desperate_lam_trans)])] @ |
189 fun preplay_methods timeout facts meths state i = |
185 (if smt_proofs then [[SMT2_Method]] else []) |
190 let |
|
191 val {context = ctxt, facts = chained, goal} = Proof.goal state |
|
192 val (_, hyp_ts, concl_t) = strip_subgoal goal i ctxt |
|
193 val step = |
|
194 Prove ([], [], ("", 0), Logic.list_implies (map prop_of chained @ hyp_ts, concl_t), [], |
|
195 ([], facts), meths, "") |
|
196 in |
|
197 preplay_isar_step ctxt timeout [] step |
|
198 end |
|
199 |
186 |
200 fun is_fact_chained ((_, (sc, _)), _) = sc = Chained |
187 fun is_fact_chained ((_, (sc, _)), _) = sc = Chained |
201 |
188 |
202 fun filter_used_facts keep_chained used = |
189 fun filter_used_facts keep_chained used = |
203 filter ((member (op =) used o fst) orf (if keep_chained then is_fact_chained else K false)) |
190 filter ((member (op =) used o fst) orf (if keep_chained then is_fact_chained else K false)) |
204 |
|
205 fun play_one_line_proof mode timeout used_facts state i preferred (meths as meth :: _) = |
|
206 let |
|
207 fun dont_know () = |
|
208 (if member (op =) meths preferred then preferred else meth, Play_Timed_Out Time.zeroTime) |
|
209 in |
|
210 if timeout = Time.zeroTime then |
|
211 dont_know () |
|
212 else |
|
213 let |
|
214 val _ = if mode = Minimize then Output.urgent_message "Preplaying proof..." else () |
|
215 val gfs = used_facts |> map (fst o fst) |> sort string_ord |
|
216 in |
|
217 (case preplay_methods timeout gfs meths state i of |
|
218 res :: _ => res |
|
219 | [] => dont_know ()) |
|
220 end |
|
221 end |
|
222 |
191 |
223 val max_fact_instances = 10 (* FUDGE *) |
192 val max_fact_instances = 10 (* FUDGE *) |
224 |
193 |
225 fun repair_monomorph_context max_iters best_max_iters max_new_instances best_max_new_instances = |
194 fun repair_monomorph_context max_iters best_max_iters max_new_instances best_max_new_instances = |
226 Config.put Monomorph.max_rounds (max_iters |> the_default best_max_iters) |
195 Config.put Monomorph.max_rounds (max_iters |> the_default best_max_iters) |