122 |
122 |
123 fun can_tac ctxt tactic conj = can (Goal.prove ctxt [] [] conj) (K tactic) |
123 fun can_tac ctxt tactic conj = can (Goal.prove ctxt [] [] conj) (K tactic) |
124 |
124 |
125 fun SOLVE_TIMEOUT seconds name tac st = |
125 fun SOLVE_TIMEOUT seconds name tac st = |
126 let |
126 let |
127 val _ = writeln ("running " ^ name ^ " for " ^ string_of_int seconds ^ " s") |
127 val _ = Output.urgent_message ("running " ^ name ^ " for " ^ |
|
128 string_of_int seconds ^ " s") |
128 val result = |
129 val result = |
129 TimeLimit.timeLimit (Time.fromSeconds seconds) |
130 TimeLimit.timeLimit (Time.fromSeconds seconds) |
130 (fn () => SINGLE (SOLVE tac) st) () |
131 (fn () => SINGLE (SOLVE tac) st) () |
131 handle TimeLimit.TimeOut => NONE |
132 handle TimeLimit.TimeOut => NONE |
132 | ERROR _ => NONE |
133 | ERROR _ => NONE |
133 in |
134 in |
134 case result of |
135 case result of |
135 NONE => (writeln ("FAILURE: " ^ name); Seq.empty) |
136 NONE => (Output.urgent_message ("FAILURE: " ^ name); Seq.empty) |
136 | SOME st' => (writeln ("SUCCESS: " ^ name); Seq.single st') |
137 | SOME st' => (Output.urgent_message ("SUCCESS: " ^ name); Seq.single st') |
137 end |
138 end |
138 |
139 |
139 fun atp_tac ctxt timeout prover = |
140 fun atp_tac ctxt override_params timeout prover = |
140 Sledgehammer_Tactics.sledgehammer_as_oracle_tac ctxt |
141 Sledgehammer_Tactics.sledgehammer_as_oracle_tac ctxt |
141 [("debug", if debug then "true" else "false"), |
142 ([("debug", if debug then "true" else "false"), |
142 ("overlord", if overlord then "true" else "false"), |
143 ("overlord", if overlord then "true" else "false"), |
143 ("provers", prover), |
144 ("provers", prover), |
144 ("timeout", string_of_int timeout)] |
145 ("timeout", string_of_int timeout)] @ override_params) |
145 {add = [], del = [], only = true} |
146 {add = [], del = [], only = true} |
146 |
147 |
147 fun sledgehammer_tac ctxt timeout i = |
148 fun sledgehammer_tac ctxt timeout i = |
148 let |
149 let |
149 fun slice timeout prover = |
150 fun slice overload_params fraq prover = |
150 SOLVE_TIMEOUT timeout prover (atp_tac ctxt timeout prover i) |
151 SOLVE_TIMEOUT (timeout div fraq) prover |
151 in |
152 (atp_tac ctxt overload_params timeout prover i) |
152 slice (timeout div 10) ATP_Systems.satallaxN |
153 in |
153 ORELSE |
154 slice [] 7 ATP_Systems.satallaxN |
154 slice (timeout div 10) ATP_Systems.spassN |
155 ORELSE slice [] 7 ATP_Systems.spassN |
155 ORELSE |
156 ORELSE slice [] 7 z3N |
156 slice (timeout div 10) z3N |
157 ORELSE slice [] 7 ATP_Systems.vampireN |
157 ORELSE |
158 ORELSE slice [] 7 ATP_Systems.eN |
158 slice (timeout div 10) ATP_Systems.vampireN |
159 ORELSE slice [] 7 cvc3N |
159 ORELSE |
160 ORELSE slice [] 7 ATP_Systems.leo2N |
160 slice (timeout div 10) ATP_Systems.eN |
|
161 ORELSE |
|
162 slice (timeout div 10) cvc3N |
|
163 ORELSE |
|
164 slice (timeout div 10) ATP_Systems.leo2N |
|
165 end |
161 end |
166 |
162 |
167 fun auto_etc_tac ctxt timeout i = |
163 fun auto_etc_tac ctxt timeout i = |
168 SOLVE_TIMEOUT (timeout div 10) "simp" (asm_full_simp_tac (simpset_of ctxt) i) |
164 SOLVE_TIMEOUT (timeout div 10) "simp" (asm_full_simp_tac (simpset_of ctxt) i) |
169 ORELSE |
165 ORELSE SOLVE_TIMEOUT (timeout div 10) "blast" (blast_tac ctxt i) |
170 SOLVE_TIMEOUT (timeout div 10) "blast" (blast_tac ctxt i) |
166 ORELSE SOLVE_TIMEOUT (timeout div 20) "auto+spass" |
171 ORELSE |
|
172 SOLVE_TIMEOUT (timeout div 20) "auto+spass" |
|
173 (auto_tac ctxt |
167 (auto_tac ctxt |
174 THEN ALLGOALS (atp_tac ctxt (timeout div 20) ATP_Systems.spassN)) |
168 THEN ALLGOALS (atp_tac ctxt [] (timeout div 20) ATP_Systems.spassN)) |
175 ORELSE |
169 ORELSE SOLVE_TIMEOUT (timeout div 20) "fast" (fast_tac ctxt i) |
176 SOLVE_TIMEOUT (timeout div 20) "fast" (fast_tac ctxt i) |
170 ORELSE SOLVE_TIMEOUT (timeout div 20) "best" (best_tac ctxt i) |
177 ORELSE |
171 ORELSE SOLVE_TIMEOUT (timeout div 20) "force" (force_tac ctxt i) |
178 SOLVE_TIMEOUT (timeout div 20) "best" (best_tac ctxt i) |
172 ORELSE SOLVE_TIMEOUT (timeout div 20) "arith" (Arith_Data.arith_tac ctxt i) |
179 ORELSE |
173 ORELSE SOLVE_TIMEOUT timeout "fastforce" (fast_force_tac ctxt i) |
180 SOLVE_TIMEOUT (timeout div 20) "force" (force_tac ctxt i) |
|
181 ORELSE |
|
182 SOLVE_TIMEOUT (timeout div 20) "arith" (Arith_Data.arith_tac ctxt i) |
|
183 ORELSE |
|
184 SOLVE_TIMEOUT timeout "fastforce" (fast_force_tac ctxt i) |
|
185 |
174 |
186 val problem_const_prefix = Context.theory_name @{theory} ^ Long_Name.separator |
175 val problem_const_prefix = Context.theory_name @{theory} ^ Long_Name.separator |
187 |
176 |
188 (* Isabelle's standard automatic tactics ("auto", etc.) are more eager to |
177 (* Isabelle's standard automatic tactics ("auto", etc.) are more eager to |
189 unfold "definitions" of free variables than of constants (cf. PUZ107^5). *) |
178 unfold "definitions" of free variables than of constants (cf. PUZ107^5). *) |
198 fun make_conj (defs, nondefs) conjs = |
187 fun make_conj (defs, nondefs) conjs = |
199 Logic.list_implies (rev defs @ rev nondefs, |
188 Logic.list_implies (rev defs @ rev nondefs, |
200 case conjs of conj :: _ => conj | [] => @{prop False}) |
189 case conjs of conj :: _ => conj | [] => @{prop False}) |
201 |
190 |
202 fun print_szs_from_success conjs success = |
191 fun print_szs_from_success conjs success = |
203 writeln ("% SZS status " ^ |
192 Output.urgent_message ("% SZS status " ^ |
204 (if success then |
193 (if success then |
205 if null conjs then "Unsatisfiable" else "Theorem" |
194 if null conjs then "Unsatisfiable" else "Theorem" |
206 else |
195 else |
207 "% SZS status Unknown")) |
196 "% SZS status Unknown")) |
208 |
197 |
209 fun sledgehammer_tptp_file timeout file_name = |
198 fun sledgehammer_tptp_file timeout file_name = |
210 let |
199 let |
211 val (conjs, assms, ctxt) = |
200 val (conjs, assms, ctxt) = |
212 read_tptp_file @{theory} freeze_problem_consts file_name |
201 read_tptp_file @{theory} freeze_problem_consts file_name |