equal
deleted
inserted
replaced
571 error (Pretty.string_of (Pretty.block |
571 error (Pretty.string_of (Pretty.block |
572 [Pretty.str msg, Pretty.fbrk, Syntax.pretty_term ctxt prop])); |
572 [Pretty.str msg, Pretty.fbrk, Syntax.pretty_term ctxt prop])); |
573 |
573 |
574 val elims = Induct.find_casesP ctxt prop; |
574 val elims = Induct.find_casesP ctxt prop; |
575 |
575 |
576 val cprop = Thm.cterm_of thy prop; |
576 val cprop = Thm.global_cterm_of thy prop; |
577 fun mk_elim rl = |
577 fun mk_elim rl = |
578 Thm.implies_intr cprop |
578 Thm.implies_intr cprop |
579 (Tactic.rule_by_tactic ctxt (mk_cases_tac ctxt) (Thm.assume cprop RS rl)) |
579 (Tactic.rule_by_tactic ctxt (mk_cases_tac ctxt) (Thm.assume cprop RS rl)) |
580 |> singleton (Variable.export (Variable.auto_fixes prop ctxt) ctxt); |
580 |> singleton (Variable.export (Variable.auto_fixes prop ctxt) ctxt); |
581 in |
581 in |
634 (case substs of |
634 (case substs of |
635 [s] => s |
635 [s] => s |
636 | _ => error |
636 | _ => error |
637 ("equations matching pattern " ^ Syntax.string_of_term ctxt prop ^ " is not unique")); |
637 ("equations matching pattern " ^ Syntax.string_of_term ctxt prop ^ " is not unique")); |
638 val inst = |
638 val inst = |
639 map (fn v => (Thm.cterm_of thy (Var v), Thm.cterm_of thy (Envir.subst_term subst (Var v)))) |
639 map (fn v => (Thm.global_cterm_of thy (Var v), Thm.global_cterm_of thy (Envir.subst_term subst (Var v)))) |
640 (Term.add_vars (lhs_of eq) []); |
640 (Term.add_vars (lhs_of eq) []); |
641 in |
641 in |
642 Drule.cterm_instantiate inst eq |
642 Drule.cterm_instantiate inst eq |
643 |> Conv.fconv_rule (Conv.arg_conv (Conv.arg_conv (Simplifier.full_rewrite ctxt))) |
643 |> Conv.fconv_rule (Conv.arg_conv (Conv.arg_conv (Simplifier.full_rewrite ctxt))) |
644 |> singleton (Variable.export ctxt' ctxt) |
644 |> singleton (Variable.export ctxt' ctxt) |
847 fold_rev lambda params |
847 fold_rev lambda params |
848 (Const (fp_name, (predT --> predT) --> predT) $ fp_fun))) |
848 (Const (fp_name, (predT --> predT) --> predT) $ fp_fun))) |
849 ||> is_auxiliary ? Local_Theory.restore_naming lthy; |
849 ||> is_auxiliary ? Local_Theory.restore_naming lthy; |
850 val fp_def' = |
850 val fp_def' = |
851 Simplifier.rewrite (put_simpset HOL_basic_ss lthy' addsimps [fp_def]) |
851 Simplifier.rewrite (put_simpset HOL_basic_ss lthy' addsimps [fp_def]) |
852 (Proof_Context.cterm_of lthy' (list_comb (rec_const, params))); |
852 (Thm.cterm_of lthy' (list_comb (rec_const, params))); |
853 val specs = |
853 val specs = |
854 if length cs < 2 then [] |
854 if length cs < 2 then [] |
855 else |
855 else |
856 map_index (fn (i, (name_mx, c)) => |
856 map_index (fn (i, (name_mx, c)) => |
857 let |
857 let |