src/Pure/Isar/attrib.ML
changeset 45390 e29521ef9059
parent 45375 7fe19930dfc9
child 45491 3c9aff74fb58
equal deleted inserted replaced
45389:bc0d50f8ae19 45390:e29521ef9059
    14   val intern_src: theory -> src -> src
    14   val intern_src: theory -> src -> src
    15   val pretty_attribs: Proof.context -> src list -> Pretty.T list
    15   val pretty_attribs: Proof.context -> src list -> Pretty.T list
    16   val defined: theory -> string -> bool
    16   val defined: theory -> string -> bool
    17   val attribute: theory -> src -> attribute
    17   val attribute: theory -> src -> attribute
    18   val attribute_i: theory -> src -> attribute
    18   val attribute_i: theory -> src -> attribute
    19   val map_specs: ('a -> 'att) ->
    19   val map_specs: ('a list -> 'att list) ->
    20     (('c * 'a list) * 'b) list -> (('c * 'att list) * 'b) list
    20     (('c * 'a list) * 'b) list -> (('c * 'att list) * 'b) list
    21   val map_facts: ('a -> 'att) ->
    21   val map_facts: ('a list -> 'att list) ->
    22     (('c * 'a list) * ('d * 'a list) list) list ->
    22     (('c * 'a list) * ('d * 'a list) list) list ->
    23     (('c * 'att list) * ('d * 'att list) list) list
    23     (('c * 'att list) * ('d * 'att list) list) list
    24   val map_facts_refs: ('a -> 'att) -> ('b -> 'fact) ->
    24   val map_facts_refs: ('a list -> 'att list) -> ('b -> 'fact) ->
    25     (('c * 'a list) * ('b * 'a list) list) list ->
    25     (('c * 'a list) * ('b * 'a list) list) list ->
    26     (('c * 'att list) * ('fact * 'att list) list) list
    26     (('c * 'att list) * ('fact * 'att list) list) list
    27   val eval_thms: Proof.context -> (Facts.ref * src list) list -> thm list
    27   val eval_thms: Proof.context -> (Facts.ref * src list) list -> thm list
    28   val crude_closure: Proof.context -> src -> src
    28   val crude_closure: Proof.context -> src -> src
    29   val setup: Binding.binding -> attribute context_parser -> string -> theory -> theory
    29   val setup: Binding.binding -> attribute context_parser -> string -> theory -> theory
   125 fun attribute thy = attribute_i thy o intern_src thy;
   125 fun attribute thy = attribute_i thy o intern_src thy;
   126 
   126 
   127 
   127 
   128 (* attributed declarations *)
   128 (* attributed declarations *)
   129 
   129 
   130 fun map_specs f = map (apfst (apsnd (map f)));
   130 fun map_specs f = map (apfst (apsnd f));
   131 
   131 
   132 fun map_facts f = map (apfst (apsnd (map f)) o apsnd (map (apsnd (map f))));
   132 fun map_facts f = map (apfst (apsnd f) o apsnd (map (apsnd f)));
   133 fun map_facts_refs f g = map_facts f #> map (apsnd (map (apfst g)));
   133 fun map_facts_refs f g = map_facts f #> map (apsnd (map (apfst g)));
   134 
   134 
   135 
   135 
   136 (* fact expressions *)
   136 (* fact expressions *)
   137 
   137 
   138 fun eval_thms ctxt srcs = ctxt
   138 fun eval_thms ctxt srcs = ctxt
   139   |> Proof_Context.note_thmss ""
   139   |> Proof_Context.note_thmss ""
   140     (map_facts_refs (attribute (Proof_Context.theory_of ctxt)) (Proof_Context.get_fact ctxt)
   140     (map_facts_refs (map (attribute (Proof_Context.theory_of ctxt))) (Proof_Context.get_fact ctxt)
   141       [((Binding.empty, []), srcs)])
   141       [((Binding.empty, []), srcs)])
   142   |> fst |> maps snd;
   142   |> fst |> maps snd;
   143 
   143 
   144 
   144 
   145 (* crude_closure *)
   145 (* crude_closure *)