src/Pure/Isar/new_locale.ML
changeset 29018 17538bdef546
parent 28994 49f602ae24e5
child 29019 8e7d6f959bd7
equal deleted inserted replaced
28994:49f602ae24e5 29018:17538bdef546
    35   val add_dependency: string -> (string * Morphism.morphism) -> theory -> theory
    35   val add_dependency: string -> (string * Morphism.morphism) -> theory -> theory
    36 
    36 
    37   (* Activation *)
    37   (* Activation *)
    38   val activate_declarations: theory -> string * Morphism.morphism ->
    38   val activate_declarations: theory -> string * Morphism.morphism ->
    39     Proof.context -> Proof.context
    39     Proof.context -> Proof.context
    40   val activate_global_facts: string * Morphism.morphism ->
    40   val activate_global_facts: string * Morphism.morphism -> theory -> theory
    41     theory -> theory
    41   val activate_local_facts: string * Morphism.morphism -> Proof.context -> Proof.context
    42   val activate_local_facts: theory -> string * Morphism.morphism ->
       
    43     Proof.context -> Proof.context
       
    44 (*  val activate: string -> theory -> (Element.context_i -> 'a -> 'a) -> 'a -> 'a *)
    42 (*  val activate: string -> theory -> (Element.context_i -> 'a -> 'a) -> 'a -> 'a *)
    45   val init: string -> theory -> Proof.context
    43   val init: string -> theory -> Proof.context
    46 
    44 
    47   (* Reasoning about locales *)
    45   (* Reasoning about locales *)
    48   val witness_attrib: attribute
    46   val witness_attrib: attribute
   358   
   356   
   359 fun activate_global_facts dep thy =
   357 fun activate_global_facts dep thy =
   360   roundup thy (activate_notes init_global_elem) dep (get_global_idents thy, thy) |>
   358   roundup thy (activate_notes init_global_elem) dep (get_global_idents thy, thy) |>
   361   uncurry put_global_idents;
   359   uncurry put_global_idents;
   362 
   360 
   363 fun activate_local_facts thy dep ctxt =
   361 fun activate_local_facts dep ctxt =
   364   roundup thy (activate_notes init_local_elem) dep (get_local_idents ctxt, ctxt) |>
   362   roundup (ProofContext.theory_of ctxt) (activate_notes init_local_elem) dep
       
   363     (get_local_idents ctxt, ctxt) |>
   365   uncurry put_local_idents;
   364   uncurry put_local_idents;
   366 
   365 
   367 fun init name thy = activate_all name thy init_local_elem (empty, ProofContext.init thy) |>
   366 fun init name thy = activate_all name thy init_local_elem (empty, ProofContext.init thy) |>
   368   uncurry put_local_idents;
   367   uncurry put_local_idents;
   369 
   368 
   452       Method.ctxt_args (fn ctxt => Method.METHOD (intro_locales_tac true ctxt ORELSE'
   451       Method.ctxt_args (fn ctxt => Method.METHOD (intro_locales_tac true ctxt ORELSE'
   453         Locale.intro_locales_tac true ctxt)),
   452         Locale.intro_locales_tac true ctxt)),
   454       "back-chain all introduction rules of locales")]));
   453       "back-chain all introduction rules of locales")]));
   455 
   454 
   456 
   455 
   457 (*** Registrations: interpretations in theories and proof contexts ***)
   456 (*** Registrations: interpretations in theories ***)
   458 
   457 
       
   458 (* FIXME only global variant needed *)
   459 structure RegistrationsData = GenericDataFun
   459 structure RegistrationsData = GenericDataFun
   460 (
   460 (
   461   type T = ((string * Morphism.morphism) * stamp) list;
   461   type T = ((string * Morphism.morphism) * stamp) list;
   462     (* registrations, in reverse order of declaration *)
   462     (* registrations, in reverse order of declaration *)
   463   val empty = [];
   463   val empty = [];
   468 
   468 
   469 val get_global_registrations = map fst o RegistrationsData.get o Context.Theory;
   469 val get_global_registrations = map fst o RegistrationsData.get o Context.Theory;
   470 fun add_global_registration reg =
   470 fun add_global_registration reg =
   471   (Context.theory_map o RegistrationsData.map) (cons (reg, stamp ()));
   471   (Context.theory_map o RegistrationsData.map) (cons (reg, stamp ()));
   472 
   472 
   473 
   473 end;
   474 end;
   474 
   475