src/Pure/Isar/local_theory.ML
changeset 47273 ea089b484157
parent 47271 b0b78ce6903a
child 47281 d6c76b1823fb
equal deleted inserted replaced
47272:ca31cfa509b1 47273:ea089b484157
     9 
     9 
    10 signature LOCAL_THEORY =
    10 signature LOCAL_THEORY =
    11 sig
    11 sig
    12   type operations
    12   type operations
    13   val assert: local_theory -> local_theory
    13   val assert: local_theory -> local_theory
       
    14   val restore: local_theory -> local_theory
    14   val level: Proof.context -> int
    15   val level: Proof.context -> int
    15   val assert_bottom: bool -> local_theory -> local_theory
    16   val assert_bottom: bool -> local_theory -> local_theory
    16   val open_target: Name_Space.naming -> operations -> local_theory -> local_theory
    17   val open_target: Name_Space.naming -> operations -> local_theory -> local_theory
    17   val close_target: local_theory -> local_theory
    18   val close_target: local_theory -> local_theory
    18   val map_contexts: (int -> Proof.context -> Proof.context) -> local_theory -> local_theory
    19   val map_contexts: (int -> Proof.context -> Proof.context) -> local_theory -> local_theory
    31   val background_theory: (theory -> theory) -> local_theory -> local_theory
    32   val background_theory: (theory -> theory) -> local_theory -> local_theory
    32   val target_of: local_theory -> Proof.context
    33   val target_of: local_theory -> Proof.context
    33   val target: (Proof.context -> Proof.context) -> local_theory -> local_theory
    34   val target: (Proof.context -> Proof.context) -> local_theory -> local_theory
    34   val target_morphism: local_theory -> morphism
    35   val target_morphism: local_theory -> morphism
    35   val propagate_ml_env: generic_theory -> generic_theory
    36   val propagate_ml_env: generic_theory -> generic_theory
    36   val restore: local_theory -> local_theory
       
    37   val operations_of: local_theory -> operations
    37   val operations_of: local_theory -> operations
    38   val define: (binding * mixfix) * (Attrib.binding * term) -> local_theory ->
    38   val define: (binding * mixfix) * (Attrib.binding * term) -> local_theory ->
    39     (term * (string * thm)) * local_theory
    39     (term * (string * thm)) * local_theory
    40   val define_internal: (binding * mixfix) * (Attrib.binding * term) -> local_theory ->
    40   val define_internal: (binding * mixfix) * (Attrib.binding * term) -> local_theory ->
    41     (term * (string * thm)) * local_theory
    41     (term * (string * thm)) * local_theory
   105 
   105 
   106 fun map_first_lthy f = assert #>
   106 fun map_first_lthy f = assert #>
   107   Data.map (fn {naming, operations, target} :: parents =>
   107   Data.map (fn {naming, operations, target} :: parents =>
   108     make_lthy (f (naming, operations, target)) :: parents);
   108     make_lthy (f (naming, operations, target)) :: parents);
   109 
   109 
       
   110 fun restore lthy = #target (get_first_lthy lthy) |> Data.put (Data.get lthy);
       
   111 
   110 
   112 
   111 (* nested structure *)
   113 (* nested structure *)
   112 
   114 
   113 val level = length o Data.get;
   115 val level = length o Data.get;
   114 
   116 
   211         |> map_contexts (K (Context.proof_map inherit))
   213         |> map_contexts (K (Context.proof_map inherit))
   212         |> Context.Proof
   214         |> Context.Proof
   213       end
   215       end
   214   | propagate_ml_env context = context;
   216   | propagate_ml_env context = context;
   215 
   217 
   216 fun restore lthy = target_of lthy |> Data.put (Data.get lthy);
       
   217 
       
   218 
   218 
   219 
   219 
   220 (** operations **)
   220 (** operations **)
   221 
   221 
   222 val operations_of = #operations o get_first_lthy;
   222 val operations_of = #operations o get_first_lthy;