src/Pure/Isar/locale.ML
changeset 47246 2bbab021c0e6
parent 47005 421760a1efe7
child 47249 c0481c3c2a6c
equal deleted inserted replaced
47245:ff1770df59b8 47246:2bbab021c0e6
    47   val specification_of: theory -> string -> term option * term list
    47   val specification_of: theory -> string -> term option * term list
    48 
    48 
    49   (* Storing results *)
    49   (* Storing results *)
    50   val add_thmss: string -> string -> (Attrib.binding * (thm list * Attrib.src list) list) list ->
    50   val add_thmss: string -> string -> (Attrib.binding * (thm list * Attrib.src list) list) list ->
    51     Proof.context -> Proof.context
    51     Proof.context -> Proof.context
    52   val add_declaration: string -> declaration -> Proof.context -> Proof.context
    52   val add_declaration: string -> bool -> declaration -> Proof.context -> Proof.context
    53   val add_syntax_declaration: string -> declaration -> Proof.context -> Proof.context
       
    54 
    53 
    55   (* Activation *)
    54   (* Activation *)
    56   val activate_declarations: string * morphism -> Proof.context -> Proof.context
    55   val activate_declarations: string * morphism -> Proof.context -> Proof.context
    57   val activate_facts: morphism option -> string * morphism -> Context.generic -> Context.generic
    56   val activate_facts: morphism option -> string * morphism -> Context.generic -> Context.generic
    58   val init: string -> theory -> Proof.context
    57   val init: string -> theory -> Proof.context
   551             (registrations_of (Context.Theory thy) loc) thy));
   550             (registrations_of (Context.Theory thy) loc) thy));
   552 
   551 
   553 
   552 
   554 (* Declarations *)
   553 (* Declarations *)
   555 
   554 
   556 fun add_declaration loc decl =
   555 local
       
   556 
       
   557 fun add_decl loc decl =
   557   add_thmss loc ""
   558   add_thmss loc ""
   558     [((Binding.conceal Binding.empty,
   559     [((Binding.conceal Binding.empty,
   559         [Attrib.internal (fn phi => Thm.declaration_attribute (K (decl phi)))]),
   560         [Attrib.internal (fn phi => Thm.declaration_attribute (K (decl phi)))]),
   560       [([Drule.dummy_thm], [])])];
   561       [([Drule.dummy_thm], [])])];
   561 
   562 
   562 fun add_syntax_declaration loc decl =
   563 in
   563   Proof_Context.background_theory ((change_locale loc o apfst o apfst) (cons (decl, serial ())))
   564 
   564   #> add_declaration loc decl;
   565 fun add_declaration loc syntax decl =
       
   566   syntax ?
       
   567     Proof_Context.background_theory ((change_locale loc o apfst o apfst) (cons (decl, serial ())))
       
   568   #> add_decl loc decl;
       
   569 
       
   570 end;
   565 
   571 
   566 
   572 
   567 (*** Reasoning about locales ***)
   573 (*** Reasoning about locales ***)
   568 
   574 
   569 (* Storage for witnesses, intro and unfold rules *)
   575 (* Storage for witnesses, intro and unfold rules *)