src/Pure/Isar/local_theory.ML
changeset 21433 89104dca628e
parent 21292 11143b6ad87f
child 21498 6382c3a1e7cf
equal deleted inserted replaced
21432:625797c592b2 21433:89104dca628e
    19   val target: (Proof.context -> Proof.context) -> local_theory -> local_theory
    19   val target: (Proof.context -> Proof.context) -> local_theory -> local_theory
    20   val assert: local_theory -> local_theory
    20   val assert: local_theory -> local_theory
    21   val pretty: local_theory -> Pretty.T list
    21   val pretty: local_theory -> Pretty.T list
    22   val consts: (string * typ -> bool) ->
    22   val consts: (string * typ -> bool) ->
    23     ((bstring * typ) * mixfix) list -> local_theory -> (term * thm) list * local_theory
    23     ((bstring * typ) * mixfix) list -> local_theory -> (term * thm) list * local_theory
    24   val axioms: ((bstring * Attrib.src list) * term list) list -> local_theory ->
    24   val axioms: string -> ((bstring * Attrib.src list) * term list) list -> local_theory ->
    25     (bstring * thm list) list * local_theory
    25     (bstring * thm list) list * local_theory
    26   val defs: ((bstring * mixfix) * ((bstring * Attrib.src list) * term)) list ->
    26   val defs: string -> ((bstring * mixfix) * ((bstring * Attrib.src list) * term)) list ->
    27     local_theory -> (term * (bstring * thm)) list * local_theory
    27     local_theory -> (term * (bstring * thm)) list * local_theory
    28   val notes: ((bstring * Attrib.src list) * (thm list * Attrib.src list) list) list ->
    28   val notes: string -> ((bstring * Attrib.src list) * (thm list * Attrib.src list) list) list ->
    29     local_theory -> (bstring * thm list) list * local_theory
    29     local_theory -> (bstring * thm list) list * local_theory
    30   val term_syntax: (Context.generic -> Context.generic) -> local_theory -> local_theory
    30   val term_syntax: (Context.generic -> Context.generic) -> local_theory -> local_theory
    31   val declaration: (Context.generic -> Context.generic) -> local_theory -> local_theory
    31   val declaration: (Context.generic -> Context.generic) -> local_theory -> local_theory
    32   val def: (bstring * mixfix) * ((bstring * Attrib.src list) * term) ->
    32   val def: string -> (bstring * mixfix) * ((bstring * Attrib.src list) * term) ->
    33     local_theory -> (term * (bstring * thm)) * local_theory
    33     local_theory -> (term * (bstring * thm)) * local_theory
    34   val note: (bstring * Attrib.src list) * thm list ->
    34   val note: string -> (bstring * Attrib.src list) * thm list ->
    35     local_theory -> (bstring * thm list) * Proof.context
    35     local_theory -> (bstring * thm list) * Proof.context
    36   val notation: Syntax.mode -> (term * mixfix) list -> local_theory -> local_theory
    36   val notation: Syntax.mode -> (term * mixfix) list -> local_theory -> local_theory
    37   val abbrevs: Syntax.mode -> ((bstring * mixfix) * term) list -> local_theory ->
    37   val abbrevs: Syntax.mode -> ((bstring * mixfix) * term) list -> local_theory ->
    38     (term * term) list * local_theory
    38     (term * term) list * local_theory
    39   val init: string option -> operations -> Proof.context -> local_theory
    39   val init: string option -> operations -> Proof.context -> local_theory
    51 
    51 
    52 type operations =
    52 type operations =
    53  {pretty: local_theory -> Pretty.T list,
    53  {pretty: local_theory -> Pretty.T list,
    54   consts: (string * typ -> bool) -> ((bstring * typ) * mixfix) list -> local_theory ->
    54   consts: (string * typ -> bool) -> ((bstring * typ) * mixfix) list -> local_theory ->
    55     (term * thm) list * local_theory,
    55     (term * thm) list * local_theory,
    56   axioms: ((bstring * Attrib.src list) * term list) list -> local_theory ->
    56   axioms: string -> ((bstring * Attrib.src list) * term list) list -> local_theory ->
    57     (bstring * thm list) list * local_theory,
    57     (bstring * thm list) list * local_theory,
    58   defs: ((bstring * mixfix) * ((bstring * Attrib.src list) * term)) list -> local_theory ->
    58   defs: string -> ((bstring * mixfix) * ((bstring * Attrib.src list) * term)) list ->
    59     (term * (bstring * thm)) list * local_theory,
    59     local_theory -> (term * (bstring * thm)) list * local_theory,
    60   notes: ((bstring * Attrib.src list) * (thm list * Attrib.src list) list) list -> local_theory ->
    60   notes: string ->
    61     (bstring * thm list) list * local_theory,
    61     ((bstring * Attrib.src list) * (thm list * Attrib.src list) list) list ->
       
    62     local_theory -> (bstring * thm list) list * local_theory,
    62   term_syntax: (Context.generic -> Context.generic) -> local_theory -> local_theory,
    63   term_syntax: (Context.generic -> Context.generic) -> local_theory -> local_theory,
    63   declaration: (Context.generic -> Context.generic) -> local_theory -> local_theory,
    64   declaration: (Context.generic -> Context.generic) -> local_theory -> local_theory,
    64   reinit: local_theory -> theory -> local_theory,
    65   reinit: local_theory -> theory -> local_theory,
    65   exit: local_theory -> Proof.context};
    66   exit: local_theory -> Proof.context};
    66 
    67 
   141 fun operation1 f x = operation (fn ops => f ops x);
   142 fun operation1 f x = operation (fn ops => f ops x);
   142 fun operation2 f x y = operation (fn ops => f ops x y);
   143 fun operation2 f x y = operation (fn ops => f ops x y);
   143 
   144 
   144 val pretty = operation #pretty;
   145 val pretty = operation #pretty;
   145 val consts = operation2 #consts;
   146 val consts = operation2 #consts;
   146 val axioms = operation1 #axioms;
   147 val axioms = operation2 #axioms;
   147 val defs = operation1 #defs;
   148 val defs = operation2 #defs;
   148 val notes = operation1 #notes;
   149 val notes = operation2 #notes;
   149 val term_syntax = operation1 #term_syntax;
   150 val term_syntax = operation1 #term_syntax;
   150 val declaration = operation1 #declaration;
   151 val declaration = operation1 #declaration;
   151 
   152 
   152 
   153 
   153 (* derived operations *)
   154 (* derived operations *)
   154 
   155 
   155 fun def arg lthy = lthy |> defs [arg] |>> hd;
   156 fun def kind arg lthy = lthy |> defs kind [arg] |>> hd;
   156 
   157 
   157 fun note (a, ths) lthy = lthy |> notes [(a, [(ths, [])])] |>> hd;
   158 fun note kind (a, ths) lthy = lthy |> notes kind [(a, [(ths, [])])] |>> hd;
   158 
   159 
   159 fun notation mode args = term_syntax
   160 fun notation mode args = term_syntax
   160   (Context.mapping (Sign.add_notation mode args) (ProofContext.add_notation mode args));
   161   (Context.mapping (Sign.add_notation mode args) (ProofContext.add_notation mode args));
   161 
   162 
   162 fun abbrevs mode args = term_syntax
   163 fun abbrevs mode args = term_syntax