src/Pure/facts.ML
changeset 57942 e5bec882fdd0
parent 57887 44354c99d754
child 59058 a78612c67ec0
equal deleted inserted replaced
57941:57200bdc2aa7 57942:e5bec882fdd0
    27   val check: Context.generic -> T -> xstring * Position.T -> string
    27   val check: Context.generic -> T -> xstring * Position.T -> string
    28   val intern: T -> xstring -> string
    28   val intern: T -> xstring -> string
    29   val extern: Proof.context -> T -> string -> xstring
    29   val extern: Proof.context -> T -> string -> xstring
    30   val markup_extern: Proof.context -> T -> string -> Markup.T * xstring
    30   val markup_extern: Proof.context -> T -> string -> Markup.T * xstring
    31   val lookup: Context.generic -> T -> string -> (bool * thm list) option
    31   val lookup: Context.generic -> T -> string -> (bool * thm list) option
    32   val retrieve: Context.generic -> T -> xstring * Position.T -> string * thm list
    32   val retrieve: Context.generic -> T -> xstring * Position.T ->
       
    33     {name: string, static: bool, thms: thm list}
    33   val defined: T -> string -> bool
    34   val defined: T -> string -> bool
    34   val fold_static: (string * thm list -> 'a -> 'a) -> T -> 'a -> 'a
    35   val fold_static: (string * thm list -> 'a -> 'a) -> T -> 'a -> 'a
    35   val dest_static: bool -> T list -> T -> (string * thm list) list
    36   val dest_static: bool -> T list -> T -> (string * thm list) list
    36   val props: T -> thm list
    37   val props: T -> thm list
    37   val could_unify: T -> term -> thm list
    38   val could_unify: T -> term -> thm list
   174   | SOME (_, Dynamic f) => SOME (false, f context));
   175   | SOME (_, Dynamic f) => SOME (false, f context));
   175 
   176 
   176 fun retrieve context facts (xname, pos) =
   177 fun retrieve context facts (xname, pos) =
   177   let
   178   let
   178     val name = check context facts (xname, pos);
   179     val name = check context facts (xname, pos);
   179     val thms =
   180     val (static, thms) =
   180       (case lookup context facts name of
   181       (case lookup context facts name of
   181         SOME (static, thms) =>
   182         SOME (static, thms) =>
   182           (if static then ()
   183           (if static then ()
   183            else Context_Position.report_generic context pos (Markup.dynamic_fact name);
   184            else Context_Position.report_generic context pos (Markup.dynamic_fact name);
   184            thms)
   185            (static, thms))
   185       | NONE => error ("Unknown fact " ^ quote name ^ Position.here pos));
   186       | NONE => error ("Unknown fact " ^ quote name ^ Position.here pos));
   186   in (name, map (Thm.transfer (Context.theory_of context)) thms) end;
   187   in
       
   188    {name = name,
       
   189     static = static,
       
   190     thms = map (Thm.transfer (Context.theory_of context)) thms}
       
   191   end;
   187 
   192 
   188 
   193 
   189 (* static content *)
   194 (* static content *)
   190 
   195 
   191 fun fold_static f =
   196 fun fold_static f =