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 defined: T -> string -> bool |
31 val defined: T -> string -> bool |
32 val is_dynamic: T -> string -> bool |
32 val is_dynamic: T -> string -> bool |
33 val lookup: Context.generic -> T -> string -> (bool * thm list) option |
33 val lookup: Context.generic -> T -> string -> {dynamic: bool, thms: thm list} option |
34 val retrieve: Context.generic -> T -> xstring * Position.T -> |
34 val retrieve: Context.generic -> T -> xstring * Position.T -> |
35 {name: string, static: bool, thms: thm list} |
35 {name: string, dynamic: bool, thms: thm list} |
36 val fold_static: (string * thm list -> 'a -> 'a) -> T -> 'a -> 'a |
36 val fold_static: (string * thm list -> 'a -> 'a) -> T -> 'a -> 'a |
37 val dest_static: bool -> T list -> T -> (string * thm list) list |
37 val dest_static: bool -> T list -> T -> (string * thm list) list |
38 val dest_all: Context.generic -> bool -> T list -> T -> (string * thm list) list |
38 val dest_all: Context.generic -> bool -> T list -> T -> (string * thm list) list |
39 val props: T -> thm list |
39 val props: T -> thm list |
40 val could_unify: T -> term -> thm list |
40 val could_unify: T -> term -> thm list |
176 | _ => false); |
176 | _ => false); |
177 |
177 |
178 fun lookup context facts name = |
178 fun lookup context facts name = |
179 (case Name_Space.lookup (facts_of facts) name of |
179 (case Name_Space.lookup (facts_of facts) name of |
180 NONE => NONE |
180 NONE => NONE |
181 | SOME (Static ths) => SOME (true, ths) |
181 | SOME (Static ths) => SOME {dynamic = false, thms = ths} |
182 | SOME (Dynamic f) => SOME (false, f context)); |
182 | SOME (Dynamic f) => SOME {dynamic = true, thms = f context}); |
183 |
183 |
184 fun retrieve context facts (xname, pos) = |
184 fun retrieve context facts (xname, pos) = |
185 let |
185 let |
186 val name = check context facts (xname, pos); |
186 val name = check context facts (xname, pos); |
187 val (static, thms) = |
187 val {dynamic, thms} = |
188 (case lookup context facts name of |
188 (case lookup context facts name of |
189 SOME (static, thms) => |
189 SOME res => |
190 (if static then () |
190 (if #dynamic res |
191 else Context_Position.report_generic context pos (Markup.dynamic_fact name); |
191 then Context_Position.report_generic context pos (Markup.dynamic_fact name) |
192 (static, thms)) |
192 else (); |
|
193 res) |
193 | NONE => error ("Unknown fact " ^ quote name ^ Position.here pos)); |
194 | NONE => error ("Unknown fact " ^ quote name ^ Position.here pos)); |
194 in |
195 in |
195 {name = name, |
196 {name = name, |
196 static = static, |
197 dynamic = dynamic, |
197 thms = map (Thm.transfer (Context.theory_of context)) thms} |
198 thms = map (Thm.transfer (Context.theory_of context)) thms} |
198 end; |
199 end; |
199 |
200 |
200 |
201 |
201 (* content *) |
202 (* content *) |