479 |
479 |
480 (* init *) |
480 (* init *) |
481 |
481 |
482 fun generic_note_thmss kind facts context = |
482 fun generic_note_thmss kind facts context = |
483 let |
483 let |
484 val facts' = Attrib.map_facts (Attrib.attribute_i (Context.theory_of context)) facts; |
484 val facts' = |
|
485 Attrib.map_facts (map (Attrib.attribute_i (Context.theory_of context))) facts; |
485 in |
486 in |
486 context |> Context.mapping_result |
487 context |> Context.mapping_result |
487 (Global_Theory.note_thmss kind facts') |
488 (Global_Theory.note_thmss kind facts') |
488 (Proof_Context.note_thmss kind facts') |
489 (Proof_Context.note_thmss kind facts') |
489 end; |
490 end; |
490 |
491 |
491 fun init (Fixes fixes) = Context.map_proof (Proof_Context.add_fixes fixes #> #2) |
492 fun init (Fixes fixes) = Context.map_proof (Proof_Context.add_fixes fixes #> #2) |
492 | init (Constrains _) = I |
493 | init (Constrains _) = I |
493 | init (Assumes asms) = Context.map_proof (fn ctxt => |
494 | init (Assumes asms) = Context.map_proof (fn ctxt => |
494 let |
495 let |
495 val asms' = Attrib.map_specs (Attrib.attribute_i (Proof_Context.theory_of ctxt)) asms; |
496 val asms' = |
|
497 Attrib.map_specs (map (Attrib.attribute_i (Proof_Context.theory_of ctxt))) asms; |
496 val (_, ctxt') = ctxt |
498 val (_, ctxt') = ctxt |
497 |> fold Variable.auto_fixes (maps (map #1 o #2) asms') |
499 |> fold Variable.auto_fixes (maps (map #1 o #2) asms') |
498 |> Proof_Context.add_assms_i Assumption.assume_export asms'; |
500 |> Proof_Context.add_assms_i Assumption.assume_export asms'; |
499 in ctxt' end) |
501 in ctxt' end) |
500 | init (Defines defs) = Context.map_proof (fn ctxt => |
502 | init (Defines defs) = Context.map_proof (fn ctxt => |
501 let |
503 let |
502 val defs' = Attrib.map_specs (Attrib.attribute_i (Proof_Context.theory_of ctxt)) defs; |
504 val defs' = |
|
505 Attrib.map_specs (map (Attrib.attribute_i (Proof_Context.theory_of ctxt))) defs; |
503 val asms = defs' |> map (fn ((name, atts), (t, ps)) => |
506 val asms = defs' |> map (fn ((name, atts), (t, ps)) => |
504 let val ((c, _), t') = Local_Defs.cert_def ctxt t (* FIXME adapt ps? *) |
507 let val ((c, _), t') = Local_Defs.cert_def ctxt t (* FIXME adapt ps? *) |
505 in (t', ((Thm.def_binding_optional (Binding.name c) name, atts), [(t', ps)])) end); |
508 in (t', ((Thm.def_binding_optional (Binding.name c) name, atts), [(t', ps)])) end); |
506 val (_, ctxt') = ctxt |
509 val (_, ctxt') = ctxt |
507 |> fold Variable.auto_fixes (map #1 asms) |
510 |> fold Variable.auto_fixes (map #1 asms) |