27 val default_max_relevant: Proof.context -> string -> int |
27 val default_max_relevant: Proof.context -> string -> int |
28 |
28 |
29 (*filter*) |
29 (*filter*) |
30 val smt2_filter: Proof.context -> thm -> ('a * (int option * thm)) list -> int -> Time.time -> |
30 val smt2_filter: Proof.context -> thm -> ('a * (int option * thm)) list -> int -> Time.time -> |
31 {outcome: SMT2_Failure.failure option, rewrite_rules: thm list, conjecture_id: int, |
31 {outcome: SMT2_Failure.failure option, rewrite_rules: thm list, conjecture_id: int, |
32 helper_ids: (int * thm) list, fact_ids: (int * ('a * thm)) list, |
32 prem_ids: int list, helper_ids: (int * thm) list, fact_ids: (int * ('a * thm)) list, |
33 z3_proof: Z3_New_Proof.z3_step list} |
33 z3_proof: Z3_New_Proof.z3_step list} |
34 |
34 |
35 (*tactic*) |
35 (*tactic*) |
36 val smt2_tac: Proof.context -> thm list -> int -> tactic |
36 val smt2_tac: Proof.context -> thm list -> int -> tactic |
37 val smt2_tac': Proof.context -> thm list -> int -> tactic |
37 val smt2_tac': Proof.context -> thm list -> int -> tactic |
258 val wfacts = map snd xwfacts |
258 val wfacts = map snd xwfacts |
259 val wthms = wconjecture :: wprems @ wfacts |
259 val wthms = wconjecture :: wprems @ wfacts |
260 val iwthms = map_index I wthms |
260 val iwthms = map_index I wthms |
261 |
261 |
262 val conjecture_i = 0 |
262 val conjecture_i = 0 |
263 val facts_i = 1 + length wprems |
263 val prems_i = 1 |
|
264 val facts_i = prems_i + length wprems |
264 in |
265 in |
265 wthms |
266 wthms |
266 |> apply_solver ctxt |
267 |> apply_solver ctxt |
267 |> (fn (((iidths0, z3_proof), _), {rewrite_rules, ...}) => |
268 |> (fn (((iidths0, z3_proof), _), {rewrite_rules, ...}) => |
268 let val iidths = if can_filter ctxt then iidths0 else map (apsnd (apfst (K no_id))) iwthms |
269 let |
|
270 val iidths = if can_filter ctxt then iidths0 else map (apsnd (apfst (K no_id))) iwthms |
|
271 fun id_of_index i = the_default no_id (Option.map fst (AList.lookup (op =) iidths i)) |
269 in |
272 in |
270 {outcome = NONE, |
273 {outcome = NONE, |
271 rewrite_rules = rewrite_rules, |
274 rewrite_rules = rewrite_rules, |
272 conjecture_id = |
275 conjecture_id = id_of_index conjecture_i, |
273 the_default no_id (Option.map fst (AList.lookup (op =) iidths conjecture_i)), |
276 prem_ids = map id_of_index (prems_i upto facts_i - 1), |
274 helper_ids = map_filter (try (fn (~1, idth) => idth)) iidths, |
277 helper_ids = map_filter (try (fn (~1, idth) => idth)) iidths, |
275 fact_ids = map_filter (fn (i, (id, _)) => |
278 fact_ids = map_filter (fn (i, (id, _)) => |
276 try (apsnd (apsnd snd o nth xwfacts)) (id, i - facts_i)) iidths, |
279 try (apsnd (apsnd snd o nth xwfacts)) (id, i - facts_i)) iidths, |
277 z3_proof = z3_proof} |
280 z3_proof = z3_proof} |
278 end) |
281 end) |
279 end |
282 end |
280 handle SMT2_Failure.SMT fail => {outcome = SOME fail, rewrite_rules = [], conjecture_id = no_id, |
283 handle SMT2_Failure.SMT fail => {outcome = SOME fail, rewrite_rules = [], conjecture_id = no_id, |
281 helper_ids = [], fact_ids = [], z3_proof = []} |
284 prem_ids = [], helper_ids = [], fact_ids = [], z3_proof = []} |
282 |
285 |
283 |
286 |
284 (* SMT tactic *) |
287 (* SMT tactic *) |
285 |
288 |
286 local |
289 local |