5 Central manager component for ATP threads. |
5 Central manager component for ATP threads. |
6 *) |
6 *) |
7 |
7 |
8 signature ATP_MANAGER = |
8 signature ATP_MANAGER = |
9 sig |
9 sig |
|
10 type problem = |
|
11 {with_full_types: bool, |
|
12 subgoal: int, |
|
13 goal: Proof.context * (thm list * thm), |
|
14 axiom_clauses: (thm * (string * int)) list option, |
|
15 filtered_clauses: (thm * (string * int)) list option} |
|
16 val problem_of_goal: bool -> int -> Proof.context * (thm list * thm) -> problem |
|
17 type prover_result = |
|
18 {success: bool, |
|
19 message: string, |
|
20 theorem_names: string list, |
|
21 runtime: int, |
|
22 proof: string, |
|
23 internal_thm_names: string Vector.vector, |
|
24 filtered_clauses: (thm * (string * int)) list} |
|
25 type prover = int -> problem -> prover_result |
|
26 |
10 val atps: string Unsynchronized.ref |
27 val atps: string Unsynchronized.ref |
11 val get_atps: unit -> string list |
28 val get_atps: unit -> string list |
12 val timeout: int Unsynchronized.ref |
29 val timeout: int Unsynchronized.ref |
13 val full_types: bool Unsynchronized.ref |
30 val full_types: bool Unsynchronized.ref |
14 val kill: unit -> unit |
31 val kill: unit -> unit |
15 val info: unit -> unit |
32 val info: unit -> unit |
16 val messages: int option -> unit |
33 val messages: int option -> unit |
17 val add_prover: string * ATP_Wrapper.prover -> theory -> theory |
34 val add_prover: string * prover -> theory -> theory |
18 val get_prover: theory -> string -> ATP_Wrapper.prover option |
35 val get_prover: theory -> string -> prover option |
19 val print_provers: theory -> unit |
36 val print_provers: theory -> unit |
20 val sledgehammer: string list -> Proof.state -> unit |
37 val sledgehammer: string list -> Proof.state -> unit |
21 end; |
38 end; |
22 |
39 |
23 structure ATP_Manager : ATP_MANAGER = |
40 structure ATP_Manager : ATP_MANAGER = |
24 struct |
41 struct |
|
42 |
|
43 (** problems, results, and provers **) |
|
44 |
|
45 type problem = |
|
46 {with_full_types: bool, |
|
47 subgoal: int, |
|
48 goal: Proof.context * (thm list * thm), |
|
49 axiom_clauses: (thm * (string * int)) list option, |
|
50 filtered_clauses: (thm * (string * int)) list option}; |
|
51 |
|
52 fun problem_of_goal with_full_types subgoal goal : problem = |
|
53 {with_full_types = with_full_types, |
|
54 subgoal = subgoal, |
|
55 goal = goal, |
|
56 axiom_clauses = NONE, |
|
57 filtered_clauses = NONE}; |
|
58 |
|
59 type prover_result = |
|
60 {success: bool, |
|
61 message: string, |
|
62 theorem_names: string list, (*relevant theorems*) |
|
63 runtime: int, (*user time of the ATP, in milliseconds*) |
|
64 proof: string, |
|
65 internal_thm_names: string Vector.vector, |
|
66 filtered_clauses: (thm * (string * int)) list}; |
|
67 |
|
68 type prover = int -> problem -> prover_result; |
|
69 |
25 |
70 |
26 (** preferences **) |
71 (** preferences **) |
27 |
72 |
28 val message_store_limit = 20; |
73 val message_store_limit = 20; |
29 val message_display_limit = 5; |
74 val message_display_limit = 5; |
259 Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i)); |
304 Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i)); |
260 |
305 |
261 val _ = Toplevel.thread true (fn () => |
306 val _ = Toplevel.thread true (fn () => |
262 let |
307 let |
263 val _ = register birth_time death_time (Thread.self (), desc); |
308 val _ = register birth_time death_time (Thread.self (), desc); |
264 val problem = ATP_Wrapper.problem_of_goal (! full_types) i (ctxt, (facts, goal)); |
309 val problem = problem_of_goal (! full_types) i (ctxt, (facts, goal)); |
265 val message = #message (prover (! timeout) problem) |
310 val message = #message (prover (! timeout) problem) |
266 handle Sledgehammer_HOL_Clause.TRIVIAL => (* FIXME !? *) |
311 handle Sledgehammer_HOL_Clause.TRIVIAL => (* FIXME !? *) |
267 "Empty clause: Try this command: " ^ Markup.markup Markup.sendback "apply metis" |
312 "Empty clause: Try this command: " ^ Markup.markup Markup.sendback "apply metis" |
268 | ERROR msg => ("Error: " ^ msg); |
313 | ERROR msg => ("Error: " ^ msg); |
269 val _ = unregister message (Thread.self ()); |
314 val _ = unregister message (Thread.self ()); |