equal
deleted
inserted
replaced
16 val make_proof: rule -> int list -> cterm * cterm list -> proof |
16 val make_proof: rule -> int list -> cterm * cterm list -> proof |
17 val prove: Proof.context -> thm list option -> proof Inttab.table -> int -> |
17 val prove: Proof.context -> thm list option -> proof Inttab.table -> int -> |
18 thm |
18 thm |
19 |
19 |
20 (*setup*) |
20 (*setup*) |
|
21 val trace_assms: bool Config.T |
21 val setup: theory -> theory |
22 val setup: theory -> theory |
22 end |
23 end |
23 |
24 |
24 structure Z3_Proof_Rules: Z3_PROOF_RULES = |
25 structure Z3_Proof_Rules: Z3_PROOF_RULES = |
25 struct |
26 struct |
472 |
473 |
473 datatype assms = Some of thm list | Many of thm Net.net |
474 datatype assms = Some of thm list | Many of thm Net.net |
474 |
475 |
475 val true_false = @{lemma "True == ~ False" by simp} |
476 val true_false = @{lemma "True == ~ False" by simp} |
476 |
477 |
|
478 val (trace_assms, trace_assms_setup) = |
|
479 Attrib.config_bool "z3_trace_assms" false |
|
480 |
477 local |
481 local |
478 val TT_eq = @{lemma "(P = (~False)) == P" by simp} |
482 val TT_eq = @{lemma "(P = (~False)) == P" by simp} |
479 val remove_trigger = @{lemma "trigger t p == p" |
483 val remove_trigger = @{lemma "trigger t p == p" |
480 by (rule eq_reflection, rule trigger_def)} |
484 by (rule eq_reflection, rule trigger_def)} |
481 val remove_iff = @{lemma "p iff q == p = q" |
485 val remove_iff = @{lemma "p iff q == p = q" |
489 val TT_eq_conv = Conv.rewr_conv TT_eq |
493 val TT_eq_conv = Conv.rewr_conv TT_eq |
490 val norm_conv = More_Conv.bottom_conv (K (Conv.try_conv TT_eq_conv)) |
494 val norm_conv = More_Conv.bottom_conv (K (Conv.try_conv TT_eq_conv)) |
491 |
495 |
492 val threshold = 10 |
496 val threshold = 10 |
493 |
497 |
|
498 fun trace ctxt thm = |
|
499 if Config.get ctxt trace_assms |
|
500 then tracing (Display.string_of_thm ctxt thm) |
|
501 else () |
|
502 |
494 val lookup = (fn Some thms => first_of thms | Many net => net_instance net) |
503 val lookup = (fn Some thms => first_of thms | Many net => net_instance net) |
495 fun lookup_assm ctxt assms ct = |
504 fun lookup_assm ctxt assms ct = |
496 (case lookup assms ct of |
505 (case lookup assms ct of |
497 SOME thm => thm |
506 SOME thm => (trace ctxt thm; thm) |
498 | _ => z3_exn ("not asserted: " ^ |
507 | _ => z3_exn ("not asserted: " ^ |
499 quote (Syntax.string_of_term ctxt (Thm.term_of ct)))) |
508 quote (Syntax.string_of_term ctxt (Thm.term_of ct)))) |
500 in |
509 in |
501 fun prepare_assms ctxt assms = |
510 fun prepare_assms ctxt assms = |
502 let |
511 let |
1390 fun result (hyps, (thm, _)) = |
1399 fun result (hyps, (thm, _)) = |
1391 fold SMT_Normalize.discharge_definition hyps (thm_of thm) |
1400 fold SMT_Normalize.discharge_definition hyps (thm_of thm) |
1392 |
1401 |
1393 in (fn ptab => fn idx => result (fst (lookup idx ptab))) end |
1402 in (fn ptab => fn idx => result (fst (lookup idx ptab))) end |
1394 |
1403 |
1395 val setup = Z3_Rewrite_Rules.setup |
1404 val setup = trace_assms_setup #> Z3_Rewrite_Rules.setup |
1396 |
1405 |
1397 end |
1406 end |