src/HOL/Eisbach/method_closure.ML
changeset 72450 24bd1316eaae
parent 72436 d62d84634b06
child 74561 8e6c973003c8
equal deleted inserted replaced
72449:e1ee4a9902bd 72450:24bd1316eaae
   176 
   176 
   177 fun gen_method add_fixes name vars uses declares methods source lthy =
   177 fun gen_method add_fixes name vars uses declares methods source lthy =
   178   let
   178   let
   179     val (uses_internal, lthy1) = lthy
   179     val (uses_internal, lthy1) = lthy
   180       |> Proof_Context.concealed
   180       |> Proof_Context.concealed
   181       |> Local_Theory.begin_target
   181       |> Local_Theory.begin_nested
   182       |-> Proof_Context.private_scope
   182       |-> Proof_Context.private_scope
   183       |> Local_Theory.map_background_naming (Name_Space.add_path (Binding.name_of name))
   183       |> Local_Theory.map_background_naming (Name_Space.add_path (Binding.name_of name))
   184       |> Config.put Method.old_section_parser true
   184       |> Config.put Method.old_section_parser true
   185       |> fold setup_local_method methods
   185       |> fold setup_local_method methods
   186       |> fold_map (fn b => Named_Theorems.declare b "") uses;
   186       |> fold_map (fn b => Named_Theorems.declare b "") uses;
   219 
   219 
   220     val text' = (Method.map_source o map) (Token.transform morphism) text;
   220     val text' = (Method.map_source o map) (Token.transform morphism) text;
   221     val term_args' = map (Morphism.term morphism) term_args;
   221     val term_args' = map (Morphism.term morphism) term_args;
   222   in
   222   in
   223     lthy3
   223     lthy3
   224     |> Local_Theory.close_target
   224     |> Local_Theory.end_nested
   225     |> Proof_Context.restore_naming lthy
   225     |> Proof_Context.restore_naming lthy
   226     |> put_closure name
   226     |> put_closure name
   227         {vars = term_args', named_thms = named_thms, methods = method_args, body = text'}
   227         {vars = term_args', named_thms = named_thms, methods = method_args, body = text'}
   228     |> Method.local_setup name
   228     |> Method.local_setup name
   229         (Args.context :|-- (fn ctxt =>
   229         (Args.context :|-- (fn ctxt =>