src/Pure/Isar/named_target.ML
changeset 78798 200daaab2578
parent 78795 f7e972d567f3
equal deleted inserted replaced
78797:fc598652fb8a 78798:200daaab2578
    14   val init: Bundle.name list -> string -> theory -> local_theory
    14   val init: Bundle.name list -> string -> theory -> local_theory
    15   val theory_init: theory -> local_theory
    15   val theory_init: theory -> local_theory
    16   val theory_map: (local_theory -> local_theory) -> theory -> theory
    16   val theory_map: (local_theory -> local_theory) -> theory -> theory
    17   val theory_map_result: (morphism -> 'a -> 'b) -> (local_theory -> 'a * local_theory) ->
    17   val theory_map_result: (morphism -> 'a -> 'b) -> (local_theory -> 'a * local_theory) ->
    18     theory -> 'b * theory
    18     theory -> 'b * theory
    19   val global_setup: (local_theory -> local_theory) -> unit
    19   val setup: (local_theory -> local_theory) -> unit
    20   val global_setup_result: (morphism -> 'a -> 'b) -> (local_theory -> 'a * local_theory) -> 'b
    20   val setup_result: (morphism -> 'a -> 'b) -> (local_theory -> 'a * local_theory) -> 'b
    21   val global_setup_result0: (local_theory -> 'a * local_theory) -> 'a
    21   val setup_result0: (local_theory -> 'a * local_theory) -> 'a
    22   val revoke_reinitializability: local_theory -> local_theory
    22   val revoke_reinitializability: local_theory -> local_theory
    23   val exit_global_reinitialize: local_theory -> (theory -> local_theory) * theory
    23   val exit_global_reinitialize: local_theory -> (theory -> local_theory) * theory
    24 end;
    24 end;
    25 
    25 
    26 structure Named_Target: NAMED_TARGET =
    26 structure Named_Target: NAMED_TARGET =
   142 val theory_init = init [] "";
   142 val theory_init = init [] "";
   143 
   143 
   144 fun theory_map g = theory_init #> g #> Local_Theory.exit_global;
   144 fun theory_map g = theory_init #> g #> Local_Theory.exit_global;
   145 fun theory_map_result f g = theory_init #> g #> Local_Theory.exit_result_global f;
   145 fun theory_map_result f g = theory_init #> g #> Local_Theory.exit_result_global f;
   146 
   146 
   147 val global_setup = Theory.setup o theory_map;
   147 fun setup g = Context.>> (Context.mapping (theory_map g) g);
   148 fun global_setup_result f g = Theory.setup_result (theory_map_result f g);
   148 fun setup_result f g =
   149 fun global_setup_result0 g = global_setup_result (K I) g;
   149   Context.>>> (Context.mapping_result (theory_map_result f g) (g #>> f Morphism.identity));
       
   150 fun setup_result0 g = setup_result (K I) g;
   150 
   151 
   151 val revoke_reinitializability = (Data.map o Option.map o apsnd) (K false);
   152 val revoke_reinitializability = (Data.map o Option.map o apsnd) (K false);
   152 
   153 
   153 fun exit_global_reinitialize lthy =
   154 fun exit_global_reinitialize lthy =
   154   if is_reinitializable lthy
   155   if is_reinitializable lthy