645 val defs_ctxt = ProofContext.init_global defs_thy |> Variable.declare_term head; |
645 val defs_ctxt = ProofContext.init_global defs_thy |> Variable.declare_term head; |
646 |
646 |
647 val cert = Thm.cterm_of defs_thy; |
647 val cert = Thm.cterm_of defs_thy; |
648 |
648 |
649 val intro = Goal.prove_global defs_thy [] norm_ts statement (fn _ => |
649 val intro = Goal.prove_global defs_thy [] norm_ts statement (fn _ => |
650 MetaSimplifier.rewrite_goals_tac [pred_def] THEN |
650 rewrite_goals_tac [pred_def] THEN |
651 Tactic.compose_tac (false, body_eq RS Drule.equal_elim_rule1, 1) 1 THEN |
651 Tactic.compose_tac (false, body_eq RS Drule.equal_elim_rule1, 1) 1 THEN |
652 Tactic.compose_tac (false, |
652 Tactic.compose_tac (false, |
653 Conjunction.intr_balanced (map (Thm.assume o cert) norm_ts), 0) 1); |
653 Conjunction.intr_balanced (map (Thm.assume o cert) norm_ts), 0) 1); |
654 |
654 |
655 val conjuncts = |
655 val conjuncts = |
656 (Drule.equal_elim_rule2 OF [body_eq, |
656 (Drule.equal_elim_rule2 OF [body_eq, |
657 MetaSimplifier.rewrite_rule [pred_def] (Thm.assume (cert statement))]) |
657 Raw_Simplifier.rewrite_rule [pred_def] (Thm.assume (cert statement))]) |
658 |> Conjunction.elim_balanced (length ts); |
658 |> Conjunction.elim_balanced (length ts); |
659 val axioms = ts ~~ conjuncts |> map (fn (t, ax) => |
659 val axioms = ts ~~ conjuncts |> map (fn (t, ax) => |
660 Element.prove_witness defs_ctxt t |
660 Element.prove_witness defs_ctxt t |
661 (MetaSimplifier.rewrite_goals_tac defs THEN |
661 (rewrite_goals_tac defs THEN |
662 Tactic.compose_tac (false, ax, 0) 1)); |
662 Tactic.compose_tac (false, ax, 0) 1)); |
663 in ((statement, intro, axioms), defs_thy) end; |
663 in ((statement, intro, axioms), defs_thy) end; |
664 |
664 |
665 in |
665 in |
666 |
666 |