src/Pure/theory.ML
changeset 48638 22d65e375c01
parent 47005 421760a1efe7
child 48927 ef462b5558eb
equal deleted inserted replaced
48637:547b075669ae 48638:22d65e375c01
   136 
   136 
   137 fun at_begin f = map_wrappers (apfst (cons (f, stamp ())));
   137 fun at_begin f = map_wrappers (apfst (cons (f, stamp ())));
   138 fun at_end f = map_wrappers (apsnd (cons (f, stamp ())));
   138 fun at_end f = map_wrappers (apsnd (cons (f, stamp ())));
   139 
   139 
   140 fun begin_theory name imports =
   140 fun begin_theory name imports =
   141   let
   141   if name = Context.PureN then
   142     val thy = Context.begin_thy Context.pretty_global name imports;
   142     (case imports of [thy] => thy | _ => error "Bad bootstrapping of theory Pure")
   143     val wrappers = begin_wrappers thy;
   143   else
   144   in
   144     let
   145     thy
   145       val thy = Context.begin_thy Context.pretty_global name imports;
   146     |> Sign.local_path
   146       val wrappers = begin_wrappers thy;
   147     |> Sign.map_naming (Name_Space.set_theory_name name)
   147     in
   148     |> apply_wrappers wrappers
   148       thy
   149     |> tap (Syntax.force_syntax o Sign.syn_of)
   149       |> Sign.local_path
   150   end;
   150       |> Sign.map_naming (Name_Space.set_theory_name name)
       
   151       |> apply_wrappers wrappers
       
   152       |> tap (Syntax.force_syntax o Sign.syn_of)
       
   153     end;
   151 
   154 
   152 fun end_theory thy =
   155 fun end_theory thy =
   153   thy |> apply_wrappers (end_wrappers thy) |> Context.finish_thy;
   156   thy |> apply_wrappers (end_wrappers thy) |> Context.finish_thy;
   154 
   157 
   155 
   158