src/Pure/Isar/new_locale.ML
changeset 28833 f356687a7659
parent 28818 249e394e5b8e
child 28851 368aca388dd9
equal deleted inserted replaced
28832:cf7237498e7a 28833:f356687a7659
    24   (* Specification *)
    24   (* Specification *)
    25   val params_of: theory -> string -> (Name.binding * typ option * mixfix) list
    25   val params_of: theory -> string -> (Name.binding * typ option * mixfix) list
    26   val declarations_of: theory -> string -> declaration list * declaration list;
    26   val declarations_of: theory -> string -> declaration list * declaration list;
    27 
    27 
    28   (* Storing results *)
    28   (* Storing results *)
    29 (*
    29   val add_thmss: string -> string -> (Attrib.binding * (thm list * Attrib.src list) list) list ->
    30 val add_thmss: string -> string -> (Attrib.binding * (thm list * Attrib.src list) list) list ->
       
    31     Proof.context -> Proof.context
    30     Proof.context -> Proof.context
    32 *)
       
    33   val add_type_syntax: string -> declaration -> Proof.context -> Proof.context
    31   val add_type_syntax: string -> declaration -> Proof.context -> Proof.context
    34   val add_term_syntax: string -> declaration -> Proof.context -> Proof.context
    32   val add_term_syntax: string -> declaration -> Proof.context -> Proof.context
    35   val add_declaration: string -> declaration -> Proof.context -> Proof.context
    33   val add_declaration: string -> declaration -> Proof.context -> Proof.context
    36 
    34 
    37   (* Activate locales *)
    35   (* Activate locales *)
   274 end;
   272 end;
   275 
   273 
   276 
   274 
   277 (*** Storing results ***)
   275 (*** Storing results ***)
   278 
   276 
       
   277 (* Theorems *)
       
   278 
       
   279 fun add_thmss loc kind args ctxt =
       
   280   let
       
   281     val (([Notes args'], _), ctxt') = Element.activate_i [Notes (kind, args)] ctxt;
       
   282     val ctxt'' = ctxt' |> ProofContext.theory
       
   283       (change_locale loc
       
   284         (fn (parameters, spec, decls, notes, dependencies) =>
       
   285           (parameters, spec, decls, (args', stamp ()) :: notes, dependencies)))
       
   286       (* FIXME registrations *)
       
   287   in ctxt'' end;
       
   288 
       
   289 
   279 (* Declarations *)
   290 (* Declarations *)
   280 
   291 
   281 local
   292 local
   282 
   293 
   283 fun decl_attrib decl phi = Thm.declaration_attribute (K (decl phi));
   294 fun decl_attrib decl phi = Thm.declaration_attribute (K (decl phi));
   284 
   295 
   285 fun add_decls add loc decl =
   296 fun add_decls add loc decl =
   286   ProofContext.theory (change_locale loc
   297   ProofContext.theory (change_locale loc
   287     (fn (parameters, spec, decls, notes, dependencies) =>
   298     (fn (parameters, spec, decls, notes, dependencies) =>
   288       (parameters, spec, add (decl, stamp ()) decls, notes, dependencies)))
   299       (parameters, spec, add (decl, stamp ()) decls, notes, dependencies))) #>
   289 (*
       
   290   #>
       
   291   add_thmss loc Thm.internalK
   300   add_thmss loc Thm.internalK
   292     [((Name.no_binding, [Attrib.internal (decl_attrib decl)]), [([Drule.dummy_thm], [])])];
   301     [((Name.no_binding, [Attrib.internal (decl_attrib decl)]), [([Drule.dummy_thm], [])])];
   293 *)
       
   294 
   302 
   295 in
   303 in
   296 
   304 
   297 val add_type_syntax = add_decls (apfst o cons);
   305 val add_type_syntax = add_decls (apfst o cons);
   298 val add_term_syntax = add_decls (apsnd o cons);
   306 val add_term_syntax = add_decls (apsnd o cons);