src/Pure/pure_thy.ML
changeset 26319 f512d78e6687
parent 26308 73d68876ba46
child 26320 5fe18f9493ef
equal deleted inserted replaced
26318:967323f93c67 26319:f512d78e6687
    48   val single_thm: string -> thm list -> thm
    48   val single_thm: string -> thm list -> thm
    49   val name_of_thmref: thmref -> string
    49   val name_of_thmref: thmref -> string
    50   val map_name_of_thmref: (string -> string) -> thmref -> thmref
    50   val map_name_of_thmref: (string -> string) -> thmref -> thmref
    51   val select_thm: thmref -> thm list -> thm list
    51   val select_thm: thmref -> thm list -> thm list
    52   val selections: string * thm list -> (thmref * thm) list
    52   val selections: string * thm list -> (thmref * thm) list
       
    53   val check_lookup: bool ref
    53   val theorems_of: theory -> thm list NameSpace.table
    54   val theorems_of: theory -> thm list NameSpace.table
    54   val all_facts_of: theory -> Facts.T
    55   val all_facts_of: theory -> Facts.T
    55   val thms_of: theory -> (string * thm) list
    56   val thms_of: theory -> (string * thm) list
    56   val all_thms_of: theory -> (string * thm) list
    57   val all_thms_of: theory -> (string * thm) list
    57   val hide_thms: bool -> string list -> theory -> theory
    58   val hide_thms: bool -> string list -> theory -> theory
   248       (NameSelection (name, [Single i]), thm));
   249       (NameSelection (name, [Single i]), thm));
   249 
   250 
   250 
   251 
   251 (* lookup/get thms *)
   252 (* lookup/get thms *)
   252 
   253 
       
   254 val check_lookup = ref false;
       
   255 
   253 local
   256 local
   254 
   257 
   255 fun lookup_thms thy xname =
   258 fun lookup_thms thy xname =
   256   let
   259   let
   257     val (space, thms) = #theorems (get_theorems thy);
   260     val (space, thms) = #theorems (get_theorems thy);
   278       (case (new_res, old_res) of
   281       (case (new_res, old_res) of
   279         (NONE, NONE) => true
   282         (NONE, NONE) => true
   280       | (SOME (name1, ths1), SOME (name2, ths2)) => name1 = name2 andalso Thm.eq_thms (ths1, ths2)
   283       | (SOME (name1, ths1), SOME (name2, ths2)) => name1 = name2 andalso Thm.eq_thms (ths1, ths2)
   281       | _ => false);
   284       | _ => false);
   282     val _ =
   285     val _ =
   283       if is_same then ()
   286       if is_same orelse not (! check_lookup) then ()
   284       else legacy_feature ("Fact lookup differs from old-style thm database:\n" ^
   287       else legacy_feature ("Fact lookup differs from old-style thm database:\n" ^
   285         show_result new_res ^ " vs " ^ show_result old_res ^
   288         show_result new_res ^ " vs " ^ show_result old_res ^
   286         Position.str_of (Position.thread_data ()));
   289         Position.str_of (Position.thread_data ()));
   287   in Option.map #2 old_res |> the_thms name |> select_thm thmref |> map (Thm.transfer theory) end;
   290   in Option.map #2 old_res |> the_thms name |> select_thm thmref |> map (Thm.transfer theory) end;
   288 
   291