src/Pure/pure_thy.ML
changeset 33167 f02b804305d6
parent 33095 bbd52d2f8696
child 33365 4db1b31b246e
equal deleted inserted replaced
33166:55f250ef9e31 33167:f02b804305d6
    30   val add_thm: (binding * thm) * attribute list -> theory -> thm * theory
    30   val add_thm: (binding * thm) * attribute list -> theory -> thm * theory
    31   val add_thmss: ((binding * thm list) * attribute list) list -> theory -> thm list list * theory
    31   val add_thmss: ((binding * thm list) * attribute list) list -> theory -> thm list list * theory
    32   val add_thms_dynamic: binding * (Context.generic -> thm list) -> theory -> theory
    32   val add_thms_dynamic: binding * (Context.generic -> thm list) -> theory -> theory
    33   val note_thmss: string -> (Thm.binding * (thm list * attribute list) list) list
    33   val note_thmss: string -> (Thm.binding * (thm list * attribute list) list) list
    34     -> theory -> (string * thm list) list * theory
    34     -> theory -> (string * thm list) list * theory
    35   val note_thmss_grouped: string -> string -> (Thm.binding * (thm list * attribute list) list) list
       
    36     -> theory -> (string * thm list) list * theory
       
    37   val add_axioms: ((binding * term) * attribute list) list -> theory -> thm list * theory
    35   val add_axioms: ((binding * term) * attribute list) list -> theory -> thm list * theory
    38   val add_axioms_cmd: ((binding * string) * attribute list) list -> theory -> thm list * theory
    36   val add_axioms_cmd: ((binding * string) * attribute list) list -> theory -> thm list * theory
    39   val add_defs: bool -> ((binding * term) * attribute list) list ->
    37   val add_defs: bool -> ((binding * term) * attribute list) list ->
    40     theory -> thm list * theory
    38     theory -> thm list * theory
    41   val add_defs_unchecked: bool -> ((binding * term) * attribute list) list ->
    39   val add_defs_unchecked: bool -> ((binding * term) * attribute list) list ->
   190       (Facts.add_dynamic (Sign.naming_of thy) (b, f) #> snd);
   188       (Facts.add_dynamic (Sign.naming_of thy) (b, f) #> snd);
   191 
   189 
   192 
   190 
   193 (* note_thmss *)
   191 (* note_thmss *)
   194 
   192 
   195 local
   193 fun note_thmss kind = fold_map (fn ((b, more_atts), ths_atts) => fn thy =>
   196 
       
   197 fun gen_note_thmss tag = fold_map (fn ((b, more_atts), ths_atts) => fn thy =>
       
   198   let
   194   let
   199     val pos = Binding.pos_of b;
   195     val pos = Binding.pos_of b;
   200     val name = Sign.full_name thy b;
   196     val name = Sign.full_name thy b;
   201     val _ = Position.report (Markup.fact_decl name) pos;
   197     val _ = Position.report (Markup.fact_decl name) pos;
   202 
   198 
   203     fun app (x, (ths, atts)) = Library.foldl_map (Thm.theory_attributes atts) (x, ths);
   199     fun app (x, (ths, atts)) = Library.foldl_map (Thm.theory_attributes atts) (x, ths);
   204     val (thms, thy') = thy |> enter_thms
   200     val (thms, thy') = thy |> enter_thms
   205       (name_thmss true pos) (name_thms false true pos) (apsnd flat o Library.foldl_map app)
   201       (name_thmss true pos) (name_thms false true pos) (apsnd flat o Library.foldl_map app)
   206       (b, map (fn (ths, atts) => (ths, surround tag (atts @ more_atts))) ths_atts);
   202       (b, map (fn (ths, atts) => (ths, surround (Thm.kind kind) (atts @ more_atts))) ths_atts);
   207   in ((name, thms), thy') end);
   203   in ((name, thms), thy') end);
   208 
       
   209 in
       
   210 
       
   211 fun note_thmss k = gen_note_thmss (Thm.kind k);
       
   212 fun note_thmss_grouped k g = gen_note_thmss (Thm.kind k #> Thm.group g);
       
   213 
       
   214 end;
       
   215 
   204 
   216 
   205 
   217 (* store axioms as theorems *)
   206 (* store axioms as theorems *)
   218 
   207 
   219 local
   208 local