src/Pure/Isar/attrib.ML
changeset 47249 c0481c3c2a6c
parent 47005 421760a1efe7
child 47815 43f677b3ae91
equal deleted inserted replaced
47248:afacccb4e2c7 47249:c0481c3c2a6c
    23     (('c * 'a list) * ('d * 'a list) list) list ->
    23     (('c * 'a list) * ('d * 'a list) list) list ->
    24     (('c * 'att list) * ('d * 'att list) list) list
    24     (('c * 'att list) * ('d * 'att list) list) list
    25   val map_facts_refs: ('a list -> 'att list) -> ('b -> 'fact) ->
    25   val map_facts_refs: ('a list -> 'att list) -> ('b -> 'fact) ->
    26     (('c * 'a list) * ('b * 'a list) list) list ->
    26     (('c * 'a list) * ('b * 'a list) list) list ->
    27     (('c * 'att list) * ('fact * 'att list) list) list
    27     (('c * 'att list) * ('fact * 'att list) list) list
       
    28   val global_notes: string -> (binding * (thm list * src list) list) list ->
       
    29     theory -> (string * thm list) list * theory
       
    30   val local_notes: string -> (binding * (thm list * src list) list) list ->
       
    31     Proof.context -> (string * thm list) list * Proof.context
       
    32   val generic_notes: string -> (binding * (thm list * src list) list) list ->
       
    33     Context.generic -> (string * thm list) list * Context.generic
    28   val eval_thms: Proof.context -> (Facts.ref * src list) list -> thm list
    34   val eval_thms: Proof.context -> (Facts.ref * src list) list -> thm list
    29   val setup: Binding.binding -> attribute context_parser -> string -> theory -> theory
    35   val setup: Binding.binding -> attribute context_parser -> string -> theory -> theory
    30   val attribute_setup: bstring * Position.T -> Symbol_Pos.text * Position.T -> string ->
    36   val attribute_setup: bstring * Position.T -> Symbol_Pos.text * Position.T -> string ->
    31     theory -> theory
    37     theory -> theory
    32   val add_del: attribute -> attribute -> attribute context_parser
    38   val add_del: attribute -> attribute -> attribute context_parser
   135 fun map_facts f = map (apfst (apsnd f) o apsnd (map (apsnd f)));
   141 fun map_facts f = map (apfst (apsnd f) o apsnd (map (apsnd f)));
   136 fun map_facts_refs f g = map_facts f #> map (apsnd (map (apfst g)));
   142 fun map_facts_refs f g = map_facts f #> map (apsnd (map (apfst g)));
   137 
   143 
   138 
   144 
   139 (* fact expressions *)
   145 (* fact expressions *)
       
   146 
       
   147 fun global_notes kind facts thy = thy |>
       
   148   Global_Theory.note_thmss kind (map_facts (map (attribute_i thy)) facts);
       
   149 
       
   150 fun local_notes kind facts ctxt = ctxt |>
       
   151   Proof_Context.note_thmss kind (map_facts (map (attribute_i (Proof_Context.theory_of ctxt))) facts);
       
   152 
       
   153 fun generic_notes kind facts context = context |>
       
   154   Context.mapping_result (global_notes kind facts) (local_notes kind facts);
   140 
   155 
   141 fun eval_thms ctxt srcs = ctxt
   156 fun eval_thms ctxt srcs = ctxt
   142   |> Proof_Context.note_thmss ""
   157   |> Proof_Context.note_thmss ""
   143     (map_facts_refs (map (attribute (Proof_Context.theory_of ctxt))) (Proof_Context.get_fact ctxt)
   158     (map_facts_refs (map (attribute (Proof_Context.theory_of ctxt))) (Proof_Context.get_fact ctxt)
   144       [((Binding.empty, []), srcs)])
   159       [((Binding.empty, []), srcs)])