equal
deleted
inserted
replaced
1547 val introN = "intro"; |
1547 val introN = "intro"; |
1548 val axiomsN = "axioms"; |
1548 val axiomsN = "axioms"; |
1549 |
1549 |
1550 fun atomize_spec thy ts = |
1550 fun atomize_spec thy ts = |
1551 let |
1551 let |
1552 val t = foldr1 Logic.mk_conjunction ts; |
1552 val t = Logic.mk_conjunction_list ts; |
1553 val body = ObjectLogic.atomize_term thy t; |
1553 val body = ObjectLogic.atomize_term thy t; |
1554 val bodyT = Term.fastype_of body; |
1554 val bodyT = Term.fastype_of body; |
1555 in |
1555 in |
1556 if bodyT = propT then (t, propT, Thm.reflexive (Thm.cterm_of thy t)) |
1556 if bodyT = propT then (t, propT, Thm.reflexive (Thm.cterm_of thy t)) |
1557 else (body, bodyT, ObjectLogic.atomize_cterm thy (Thm.cterm_of thy t)) |
1557 else (body, bodyT, ObjectLogic.atomize_cterm thy (Thm.cterm_of thy t)) |
1601 Tactic.compose_tac (false, Drule.conj_intr_list (map (Thm.assume o cert) norm_ts), 0) 1)); |
1601 Tactic.compose_tac (false, Drule.conj_intr_list (map (Thm.assume o cert) norm_ts), 0) 1)); |
1602 |
1602 |
1603 val conjuncts = |
1603 val conjuncts = |
1604 (Drule.equal_elim_rule1 OF [Thm.symmetric body_eq, |
1604 (Drule.equal_elim_rule1 OF [Thm.symmetric body_eq, |
1605 Tactic.rewrite_rule [pred_def] (Thm.assume (cert statement))]) |
1605 Tactic.rewrite_rule [pred_def] (Thm.assume (cert statement))]) |
1606 |> Drule.conj_elim_precise (length ts); |
1606 |> Drule.conj_elim_precise [length ts] |> hd; |
1607 val axioms = ts ~~ conjuncts |> map (fn (t, ax) => |
1607 val axioms = ts ~~ conjuncts |> map (fn (t, ax) => |
1608 prove_protected defs_thy t |
1608 prove_protected defs_thy t |
1609 (Tactic.rewrite_goals_tac defs THEN |
1609 (Tactic.rewrite_goals_tac defs THEN |
1610 Tactic.compose_tac (false, ax, 0) 1)); |
1610 Tactic.compose_tac (false, ax, 0) 1)); |
1611 in (defs_thy, (statement, intro, axioms)) end; |
1611 in (defs_thy, (statement, intro, axioms)) end; |
2108 fun prep_result propps thmss = |
2108 fun prep_result propps thmss = |
2109 ListPair.map (fn ((_, props), thms) => (props ~~ thms)) (propps, thmss); |
2109 ListPair.map (fn ((_, props), thms) => (props ~~ thms)) (propps, thmss); |
2110 |
2110 |
2111 val refine_protected = |
2111 val refine_protected = |
2112 Proof.refine (Method.Basic (K (Method.RAW_METHOD |
2112 Proof.refine (Method.Basic (K (Method.RAW_METHOD |
2113 (K (ALLGOALS (CONJUNCTS2 ~1 (ALLGOALS (Tactic.rtac Drule.protectI)))))))) |
2113 (K (ALLGOALS |
|
2114 (PRECISE_CONJUNCTS ~1 (ALLGOALS |
|
2115 (PRECISE_CONJUNCTS ~1 (ALLGOALS (Tactic.rtac Drule.protectI)))))))))) |
2114 #> Seq.hd; |
2116 #> Seq.hd; |
2115 |
2117 |
2116 fun goal_name thy kind target propss = |
2118 fun goal_name thy kind target propss = |
2117 kind ^ Proof.goal_names (Option.map (extern thy) target) "" |
2119 kind ^ Proof.goal_names (Option.map (extern thy) target) "" |
2118 (propss |> map (fn ((name, _), _) => extern thy name)); |
2120 (propss |> map (fn ((name, _), _) => extern thy name)); |
2121 |
2123 |
2122 fun interpretation (prfx, atts) expr insts thy = |
2124 fun interpretation (prfx, atts) expr insts thy = |
2123 let |
2125 let |
2124 val (propss, activate) = prep_global_registration (prfx, atts) expr insts thy; |
2126 val (propss, activate) = prep_global_registration (prfx, atts) expr insts thy; |
2125 val kind = goal_name thy "interpretation" NONE propss; |
2127 val kind = goal_name thy "interpretation" NONE propss; |
2126 val after_qed = activate o (prep_result propss); |
2128 val after_qed = activate o prep_result propss; |
2127 in |
2129 in |
2128 ProofContext.init thy |
2130 ProofContext.init thy |
2129 |> Proof.theorem_i kind NONE after_qed NONE ("", []) (prep_propp propss) |
2131 |> Proof.theorem_i kind NONE after_qed NONE ("", []) (prep_propp propss) |
2130 |> refine_protected |
2132 |> refine_protected |
2131 end; |
2133 end; |