src/Pure/facts.ML
changeset 70550 8bc7e54bead9
parent 70546 2970fdc230cc
child 70552 8d7a531a6b58
equal deleted inserted replaced
70546:2970fdc230cc 70550:8bc7e54bead9
    44   val add_dynamic: Context.generic -> binding * (Context.generic -> thm list) -> T -> string * T
    44   val add_dynamic: Context.generic -> binding * (Context.generic -> thm list) -> T -> string * T
    45   val del: string -> T -> T
    45   val del: string -> T -> T
    46   val hide: bool -> string -> T -> T
    46   val hide: bool -> string -> T -> T
    47   type thm_name = string * int
    47   type thm_name = string * int
    48   val thm_name_ord: thm_name * thm_name -> order
    48   val thm_name_ord: thm_name * thm_name -> order
    49   val single_thm_name: string -> thm_name
    49   val thm_name_flat: thm_name -> string
       
    50   val thm_name_list: string -> thm list -> (thm_name * thm) list
    50   val get_thm: Context.generic -> T -> thm_name * Position.T -> thm
    51   val get_thm: Context.generic -> T -> thm_name * Position.T -> thm
    51 end;
    52 end;
    52 
    53 
    53 structure Facts: FACTS =
    54 structure Facts: FACTS =
    54 struct
    55 struct
   303 (** get individual theorems **)
   304 (** get individual theorems **)
   304 
   305 
   305 type thm_name = string * int;
   306 type thm_name = string * int;
   306 val thm_name_ord = prod_ord string_ord int_ord;
   307 val thm_name_ord = prod_ord string_ord int_ord;
   307 
   308 
   308 fun single_thm_name name : thm_name = (name, 0);
   309 fun thm_name_flat (name, i) =
       
   310   if name = "" orelse i = 0 then name
       
   311   else name ^ "_" ^ string_of_int i;
       
   312 
       
   313 fun thm_name_list name [thm: thm] = [((name, 0), thm)]
       
   314   | thm_name_list name thms = map_index (fn (i, thm) => ((name, i + 1), thm)) thms;
   309 
   315 
   310 fun get_thm context facts ((name, i), pos) =
   316 fun get_thm context facts ((name, i), pos) =
   311   let
   317   let
   312     fun print_name () =
   318     fun print_name () =
   313       markup_extern (Context.proof_of context) facts name |-> Markup.markup;
   319       markup_extern (Context.proof_of context) facts name |-> Markup.markup;