src/Pure/Isar/local_theory.ML
changeset 35738 98fd035c3fe3
parent 35412 b8dead547d9e
child 35798 fd1bb29f8170
equal deleted inserted replaced
35737:19eefc0655b6 35738:98fd035c3fe3
    42   val type_syntax: bool -> declaration -> local_theory -> local_theory
    42   val type_syntax: bool -> declaration -> local_theory -> local_theory
    43   val term_syntax: bool -> declaration -> local_theory -> local_theory
    43   val term_syntax: bool -> declaration -> local_theory -> local_theory
    44   val declaration: bool -> declaration -> local_theory -> local_theory
    44   val declaration: bool -> declaration -> local_theory -> local_theory
    45   val type_notation: bool -> Syntax.mode -> (typ * mixfix) list -> local_theory -> local_theory
    45   val type_notation: bool -> Syntax.mode -> (typ * mixfix) list -> local_theory -> local_theory
    46   val notation: bool -> Syntax.mode -> (term * mixfix) list -> local_theory -> local_theory
    46   val notation: bool -> Syntax.mode -> (term * mixfix) list -> local_theory -> local_theory
       
    47   val class_alias: binding -> class -> local_theory -> local_theory
       
    48   val type_alias: binding -> string -> local_theory -> local_theory
       
    49   val const_alias: binding -> string -> local_theory -> local_theory
    47   val init: serial option -> string -> operations -> Proof.context -> local_theory
    50   val init: serial option -> string -> operations -> Proof.context -> local_theory
    48   val restore: local_theory -> local_theory
    51   val restore: local_theory -> local_theory
    49   val reinit: local_theory -> local_theory
    52   val reinit: local_theory -> local_theory
    50   val exit: local_theory -> Proof.context
    53   val exit: local_theory -> Proof.context
    51   val exit_global: local_theory -> theory
    54   val exit_global: local_theory -> theory
   197 val declaration = checkpoint ooo operation2 #declaration;
   200 val declaration = checkpoint ooo operation2 #declaration;
   198 
   201 
   199 val notes = notes_kind "";
   202 val notes = notes_kind "";
   200 fun note (a, ths) = notes [(a, [(ths, [])])] #>> the_single;
   203 fun note (a, ths) = notes [(a, [(ths, [])])] #>> the_single;
   201 
   204 
       
   205 
       
   206 (* notation *)
       
   207 
   202 fun type_notation add mode raw_args lthy =
   208 fun type_notation add mode raw_args lthy =
   203   let val args = map (apfst (Morphism.typ (target_morphism lthy))) raw_args
   209   let val args = map (apfst (Morphism.typ (target_morphism lthy))) raw_args
   204   in type_syntax false (ProofContext.target_type_notation add mode args) lthy end;
   210   in type_syntax false (ProofContext.target_type_notation add mode args) lthy end;
   205 
   211 
   206 fun notation add mode raw_args lthy =
   212 fun notation add mode raw_args lthy =
   207   let val args = map (apfst (Morphism.term (target_morphism lthy))) raw_args
   213   let val args = map (apfst (Morphism.term (target_morphism lthy))) raw_args
   208   in term_syntax false (ProofContext.target_notation add mode args) lthy end;
   214   in term_syntax false (ProofContext.target_notation add mode args) lthy end;
       
   215 
       
   216 
       
   217 (* name space aliases *)
       
   218 
       
   219 fun alias syntax_declaration global_alias local_alias b name =
       
   220   syntax_declaration false (fn phi =>
       
   221     let val b' = Morphism.binding phi b
       
   222     in Context.mapping (global_alias b' name) (local_alias b' name) end)
       
   223   #> local_alias b name;
       
   224 
       
   225 val class_alias = alias type_syntax Sign.class_alias ProofContext.class_alias;
       
   226 val type_alias = alias type_syntax Sign.type_alias ProofContext.type_alias;
       
   227 val const_alias = alias term_syntax Sign.const_alias ProofContext.const_alias;
   209 
   228 
   210 
   229 
   211 (* init *)
   230 (* init *)
   212 
   231 
   213 fun init group theory_prefix operations target =
   232 fun init group theory_prefix operations target =