src/Pure/global_theory.ML
changeset 70594 64b5514c33b1
parent 70577 ed651a58afe4
child 70894 15adbeb1fabd
equal deleted inserted replaced
70593:1d239ebba0e3 70594:64b5514c33b1
    13   val alias_fact: binding -> string -> theory -> theory
    13   val alias_fact: binding -> string -> theory -> theory
    14   val hide_fact: bool -> string -> theory -> theory
    14   val hide_fact: bool -> string -> theory -> theory
    15   val dest_thms: bool -> theory list -> theory -> (Thm_Name.T * thm) list
    15   val dest_thms: bool -> theory list -> theory -> (Thm_Name.T * thm) list
    16   val dest_thm_names: theory -> (serial * Thm_Name.T) list
    16   val dest_thm_names: theory -> (serial * Thm_Name.T) list
    17   val lookup_thm_id: theory -> Proofterm.thm_id -> Thm_Name.T option
    17   val lookup_thm_id: theory -> Proofterm.thm_id -> Thm_Name.T option
    18   val lookup_thm: theory -> thm -> Thm_Name.T option
    18   val lookup_thm: theory -> thm -> (Proofterm.thm_id * Thm_Name.T) option
    19   val get_thms: theory -> xstring -> thm list
    19   val get_thms: theory -> xstring -> thm list
    20   val get_thm: theory -> xstring -> thm
    20   val get_thm: theory -> xstring -> thm
    21   val transfer_theories: theory -> thm -> thm
    21   val transfer_theories: theory -> thm -> thm
    22   val all_thms_of: theory -> bool -> (string * thm) list
    22   val all_thms_of: theory -> bool -> (string * thm) list
    23   val get_thm_name: theory -> Thm_Name.T * Position.T -> thm
    23   val get_thm_name: theory -> Thm_Name.T * Position.T -> thm
   124         NONE => NONE
   124         NONE => NONE
   125       | SOME lazy_tab => Inttab.lookup (Lazy.force lazy_tab) (#serial thm_id));
   125       | SOME lazy_tab => Inttab.lookup (Lazy.force lazy_tab) (#serial thm_id));
   126   in lookup end;
   126   in lookup end;
   127 
   127 
   128 fun lookup_thm thy =
   128 fun lookup_thm thy =
   129   let val lookup = lookup_thm_id thy
   129   let val lookup = lookup_thm_id thy in
   130   in fn thm => (case Thm.derivation_id thm of NONE => NONE | SOME thm_id => lookup thm_id) end;
   130     fn thm =>
       
   131       (case Thm.derivation_id thm of
       
   132         NONE => NONE
       
   133       | SOME thm_id =>
       
   134           (case lookup thm_id of
       
   135             NONE => NONE
       
   136           | SOME thm_name => SOME (thm_id, thm_name)))
       
   137   end;
   131 
   138 
   132 val _ =
   139 val _ =
   133   Theory.setup (Theory.at_end (fn thy =>
   140   Theory.setup (Theory.at_end (fn thy =>
   134     if is_some (thm_names_of thy) then NONE
   141     if is_some (thm_names_of thy) then NONE
   135     else
   142     else