src/Pure/global_theory.ML
changeset 70550 8bc7e54bead9
parent 70544 16e98f89a29c
child 70552 8d7a531a6b58
equal deleted inserted replaced
70546:2970fdc230cc 70550:8bc7e54bead9
    17   val transfer_theories: theory -> thm -> thm
    17   val transfer_theories: theory -> thm -> thm
    18   val all_thms_of: theory -> bool -> (string * thm) list
    18   val all_thms_of: theory -> bool -> (string * thm) list
    19   val burrow_fact: ('a list -> 'b list) -> ('a list * 'c) list -> ('b list * 'c) list
    19   val burrow_fact: ('a list -> 'b list) -> ('a list * 'c) list -> ('b list * 'c) list
    20   val burrow_facts: ('a list -> 'b list) ->
    20   val burrow_facts: ('a list -> 'b list) ->
    21     ('c * ('a list * 'd) list) list -> ('c * ('b list * 'd) list) list
    21     ('c * ('a list * 'd) list) list -> ('c * ('b list * 'd) list) list
    22   val name_multi: string * Position.T -> 'a list -> ((string * Position.T) * 'a) list
    22   val name_multi: string * Position.T -> thm list -> ((string * Position.T) * thm) list
    23   type name_flags
    23   type name_flags
    24   val unnamed: name_flags
    24   val unnamed: name_flags
    25   val official1: name_flags
    25   val official1: name_flags
    26   val official2: name_flags
    26   val official2: name_flags
    27   val unofficial1: name_flags
    27   val unofficial1: name_flags
   132         |> (name <> "" andalso (not pre orelse not (Thm.has_name_hint thm))) ?
   132         |> (name <> "" andalso (not pre orelse not (Thm.has_name_hint thm))) ?
   133             Thm.put_name_hint name));
   133             Thm.put_name_hint name));
   134 
   134 
   135 end;
   135 end;
   136 
   136 
   137 fun name_multi (name, pos: Position.T) xs =
   137 fun name_multi (name, pos) =
   138   (case xs of
   138   Facts.thm_name_list name #> (map o apfst) (fn thm_name => (Facts.thm_name_flat thm_name, pos));
   139     [x] => [((name, pos), x)]
   139 
   140   | _ =>
   140 fun name_thms name_flags name_pos =
   141       if name = "" then map (pair ("", pos)) xs
   141   name_multi name_pos #> map (uncurry (name_thm name_flags));
   142       else map_index (fn (i, x) => ((name ^ "_" ^ string_of_int (i + 1), pos), x)) xs);
       
   143 
       
   144 fun name_thms name_flags name_pos thms =
       
   145   map (uncurry (name_thm name_flags)) (name_multi name_pos thms);
       
   146 
   142 
   147 
   143 
   148 (* apply theorems and attributes *)
   144 (* apply theorems and attributes *)
   149 
   145 
   150 fun register_proofs thms thy = (thms, Thm.register_proofs (Lazy.value thms) thy);
   146 fun register_proofs thms thy = (thms, Thm.register_proofs (Lazy.value thms) thy);