63 case filter (fn s => String.isSubstring s proof) strs of |
63 case filter (fn s => String.isSubstring s proof) strs of |
64 [] => if is_proof_well_formed proof then NONE |
64 [] => if is_proof_well_formed proof then NONE |
65 else SOME "Ill-formed ATP output" |
65 else SOME "Ill-formed ATP output" |
66 | (failure :: _) => SOME failure |
66 | (failure :: _) => SOME failure |
67 |
67 |
68 fun generic_prover get_facts prepare write cmd args failure_strs produce_answer |
68 fun generic_prover overlord get_facts prepare write cmd args failure_strs |
69 name ({full_types, ...} : params) |
69 produce_answer name ({full_types, ...} : params) |
70 ({subgoal, goal, relevance_override, axiom_clauses, filtered_clauses} |
70 ({subgoal, goal, relevance_override, axiom_clauses, filtered_clauses} |
71 : problem) = |
71 : problem) = |
72 let |
72 let |
73 (* get clauses and prepare them for writing *) |
73 (* get clauses and prepare them for writing *) |
74 val (ctxt, (chain_ths, th)) = goal; |
74 val (ctxt, (chain_ths, th)) = goal; |
85 | SOME axcls => axcls); |
85 | SOME axcls => axcls); |
86 val (internal_thm_names, clauses) = |
86 val (internal_thm_names, clauses) = |
87 prepare goal_cls chain_ths the_axiom_clauses the_filtered_clauses thy; |
87 prepare goal_cls chain_ths the_axiom_clauses the_filtered_clauses thy; |
88 |
88 |
89 (* path to unique problem file *) |
89 (* path to unique problem file *) |
90 val destdir' = Config.get ctxt destdir; |
90 val destdir' = if overlord then getenv "ISABELLE_HOME_USER" |
|
91 else Config.get ctxt destdir; |
91 val problem_prefix' = Config.get ctxt problem_prefix; |
92 val problem_prefix' = Config.get ctxt problem_prefix; |
92 fun prob_pathname nr = |
93 fun prob_pathname nr = |
93 let val probfile = |
94 let |
94 Path.basic (problem_prefix' ^ serial_string () ^ "_" ^ string_of_int nr) |
95 val probfile = |
|
96 Path.basic (problem_prefix' ^ |
|
97 (if overlord then "_" ^ name else serial_string ()) |
|
98 ^ "_" ^ string_of_int nr) |
95 in |
99 in |
96 if destdir' = "" then File.tmp_path probfile |
100 if destdir' = "" then File.tmp_path probfile |
97 else if File.exists (Path.explode destdir') |
101 else if File.exists (Path.explode destdir') |
98 then Path.append (Path.explode destdir') probfile |
102 then Path.append (Path.explode destdir') probfile |
99 else error ("No such directory: " ^ destdir') |
103 else error ("No such directory: " ^ destdir') |
157 (* generic TPTP-based provers *) |
161 (* generic TPTP-based provers *) |
158 |
162 |
159 fun generic_tptp_prover |
163 fun generic_tptp_prover |
160 (name, {command, arguments, failure_strs, max_new_clauses, |
164 (name, {command, arguments, failure_strs, max_new_clauses, |
161 prefers_theory_const, supports_isar_proofs}) |
165 prefers_theory_const, supports_isar_proofs}) |
162 (params as {respect_no_atp, relevance_threshold, convergence, |
166 (params as {overlord, respect_no_atp, relevance_threshold, convergence, |
163 theory_const, higher_order, follow_defs, isar_proof, |
167 theory_const, higher_order, follow_defs, isar_proof, |
164 modulus, sorts, ...}) |
168 modulus, sorts, ...}) |
165 timeout = |
169 timeout = |
166 generic_prover |
170 generic_prover overlord |
167 (get_relevant_facts respect_no_atp relevance_threshold convergence |
171 (get_relevant_facts respect_no_atp relevance_threshold convergence |
168 higher_order follow_defs max_new_clauses |
172 higher_order follow_defs max_new_clauses |
169 (the_default prefers_theory_const theory_const)) |
173 (the_default prefers_theory_const theory_const)) |
170 (prepare_clauses higher_order false) write_tptp_file command |
174 (prepare_clauses higher_order false) write_tptp_file command |
171 (arguments timeout) failure_strs |
175 (arguments timeout) failure_strs |
217 (* SPASS *) |
221 (* SPASS *) |
218 |
222 |
219 fun generic_dfg_prover |
223 fun generic_dfg_prover |
220 (name, ({command, arguments, failure_strs, max_new_clauses, |
224 (name, ({command, arguments, failure_strs, max_new_clauses, |
221 prefers_theory_const, ...} : prover_config)) |
225 prefers_theory_const, ...} : prover_config)) |
222 (params as {respect_no_atp, relevance_threshold, convergence, |
226 (params as {overlord, respect_no_atp, relevance_threshold, convergence, |
223 theory_const, higher_order, follow_defs, ...}) |
227 theory_const, higher_order, follow_defs, ...}) |
224 timeout = |
228 timeout = |
225 generic_prover |
229 generic_prover overlord |
226 (get_relevant_facts respect_no_atp relevance_threshold convergence |
230 (get_relevant_facts respect_no_atp relevance_threshold convergence |
227 higher_order follow_defs max_new_clauses |
231 higher_order follow_defs max_new_clauses |
228 (the_default prefers_theory_const theory_const)) |
232 (the_default prefers_theory_const theory_const)) |
229 (prepare_clauses higher_order true) write_dfg_file command |
233 (prepare_clauses higher_order true) write_dfg_file command |
230 (arguments timeout) failure_strs (metis_lemma_list true) name params; |
234 (arguments timeout) failure_strs (metis_lemma_list true) name params; |