542 |
542 |
543 |
543 |
544 (*--------------------------------------------------------------------------- |
544 (*--------------------------------------------------------------------------- |
545 * Trace information for the rewriter |
545 * Trace information for the rewriter |
546 *---------------------------------------------------------------------------*) |
546 *---------------------------------------------------------------------------*) |
547 val term_ref = ref[] : term list ref |
547 val term_ref = ref [] : term list ref |
548 val ss_ref = ref [] : simpset list ref; |
548 val ss_ref = ref [] : simpset list ref; |
549 val thm_ref = ref [] : thm list ref; |
549 val thm_ref = ref [] : thm list ref; |
550 val tracing = ref false; |
550 val tracing = ref false; |
551 |
551 |
552 fun say s = if !tracing then writeln s else (); |
552 fun say s = if !tracing then writeln s else (); |
553 |
553 |
554 fun print_thms s L = |
554 fun print_thms s L = |
555 say (cat_lines (s :: map Display.string_of_thm_without_context L)); |
555 say (cat_lines (s :: map Display.string_of_thm_without_context L)); |
556 |
556 |
557 fun print_cterms s L = |
557 fun print_cterm s ct = |
558 say (cat_lines (s :: map Display.string_of_cterm L)); |
558 say (cat_lines [s, Syntax.string_of_term_global (Thm.theory_of_cterm ct) (Thm.term_of ct)]); |
559 |
559 |
560 |
560 |
561 (*--------------------------------------------------------------------------- |
561 (*--------------------------------------------------------------------------- |
562 * General abstraction handlers, should probably go in USyntax. |
562 * General abstraction handlers, should probably go in USyntax. |
563 *---------------------------------------------------------------------------*) |
563 *---------------------------------------------------------------------------*) |
681 val dummy = thm_ref := (thm :: !thm_ref) |
681 val dummy = thm_ref := (thm :: !thm_ref) |
682 val dummy = ss_ref := (ss :: !ss_ref) |
682 val dummy = ss_ref := (ss :: !ss_ref) |
683 (* Unquantified eliminate *) |
683 (* Unquantified eliminate *) |
684 fun uq_eliminate (thm,imp,thy) = |
684 fun uq_eliminate (thm,imp,thy) = |
685 let val tych = cterm_of thy |
685 let val tych = cterm_of thy |
686 val dummy = print_cterms "To eliminate:" [tych imp] |
686 val dummy = print_cterm "To eliminate:" (tych imp) |
687 val ants = map tych (Logic.strip_imp_prems imp) |
687 val ants = map tych (Logic.strip_imp_prems imp) |
688 val eq = Logic.strip_imp_concl imp |
688 val eq = Logic.strip_imp_concl imp |
689 val lhs = tych(get_lhs eq) |
689 val lhs = tych(get_lhs eq) |
690 val ss' = Simplifier.add_prems (map ASSUME ants) ss |
690 val ss' = Simplifier.add_prems (map ASSUME ants) ss |
691 val lhs_eq_lhs1 = MetaSimplifier.rewrite_cterm (false,true,false) (prover used) ss' lhs |
691 val lhs_eq_lhs1 = MetaSimplifier.rewrite_cterm (false,true,false) (prover used) ss' lhs |
779 val rcontext = rev cntxt |
779 val rcontext = rev cntxt |
780 val cncl = HOLogic.dest_Trueprop o Thm.prop_of |
780 val cncl = HOLogic.dest_Trueprop o Thm.prop_of |
781 val antl = case rcontext of [] => [] |
781 val antl = case rcontext of [] => [] |
782 | _ => [S.list_mk_conj(map cncl rcontext)] |
782 | _ => [S.list_mk_conj(map cncl rcontext)] |
783 val TC = genl(S.list_mk_imp(antl, A)) |
783 val TC = genl(S.list_mk_imp(antl, A)) |
784 val dummy = print_cterms "func:" [cterm_of thy func] |
784 val dummy = print_cterm "func:" (cterm_of thy func) |
785 val dummy = print_cterms "TC:" |
785 val dummy = print_cterm "TC:" (cterm_of thy (HOLogic.mk_Trueprop TC)) |
786 [cterm_of thy (HOLogic.mk_Trueprop TC)] |
|
787 val dummy = tc_list := (TC :: !tc_list) |
786 val dummy = tc_list := (TC :: !tc_list) |
788 val nestedp = isSome (S.find_term is_func TC) |
787 val nestedp = isSome (S.find_term is_func TC) |
789 val dummy = if nestedp then say "nested" else say "not_nested" |
788 val dummy = if nestedp then say "nested" else say "not_nested" |
790 val dummy = term_ref := ([func,TC]@(!term_ref)) |
789 val dummy = term_ref := ([func,TC]@(!term_ref)) |
791 val th' = if nestedp then raise RULES_ERR "solver" "nested function" |
790 val th' = if nestedp then raise RULES_ERR "solver" "nested function" |