equal
deleted
inserted
replaced
14 val hide_fact: bool -> string -> theory -> theory |
14 val hide_fact: bool -> string -> theory -> theory |
15 val get_thms: theory -> xstring -> thm list |
15 val get_thms: theory -> xstring -> thm list |
16 val get_thm: theory -> xstring -> thm |
16 val get_thm: theory -> xstring -> thm |
17 val transfer_theories: theory -> thm -> thm |
17 val transfer_theories: theory -> thm -> thm |
18 val all_thms_of: theory -> bool -> (string * thm) list |
18 val all_thms_of: theory -> bool -> (string * thm) list |
19 val map_facts: ('a -> 'b) -> ('c * ('a list * 'd) list) list -> ('c * ('b list * 'd) list) list |
|
20 val burrow_fact: ('a list -> 'b list) -> ('a list * 'c) list -> ('b list * 'c) list |
19 val burrow_fact: ('a list -> 'b list) -> ('a list * 'c) list -> ('b list * 'c) list |
21 val burrow_facts: ('a list -> 'b list) -> |
20 val burrow_facts: ('a list -> 'b list) -> |
22 ('c * ('a list * 'd) list) list -> ('c * ('b list * 'd) list) list |
21 ('c * ('a list * 'd) list) list -> ('c * ('b list * 'd) list) list |
23 val name_multi: string * Position.T -> 'a list -> ((string * Position.T) * 'a) list |
22 val name_multi: string * Position.T -> 'a list -> ((string * Position.T) * 'a) list |
24 type name_flags |
23 type name_flags |
61 val extend = I; |
60 val extend = I; |
62 val merge = Facts.merge; |
61 val merge = Facts.merge; |
63 ); |
62 ); |
64 |
63 |
65 val facts_of = Data.get; |
64 val facts_of = Data.get; |
|
65 fun map_facts f = Data.map f; |
66 |
66 |
67 fun check_fact thy = Facts.check (Context.Theory thy) (facts_of thy); |
67 fun check_fact thy = Facts.check (Context.Theory thy) (facts_of thy); |
68 val intern_fact = Facts.intern o facts_of; |
68 val intern_fact = Facts.intern o facts_of; |
69 val defined_fact = Facts.defined o facts_of; |
69 val defined_fact = Facts.defined o facts_of; |
70 |
70 |
71 fun alias_fact binding name thy = |
71 fun alias_fact binding name thy = |
72 Data.map (Facts.alias (Sign.naming_of thy) binding name) thy; |
72 map_facts (Facts.alias (Sign.naming_of thy) binding name) thy; |
73 |
73 |
74 fun hide_fact fully name = Data.map (Facts.hide fully name); |
74 fun hide_fact fully name = map_facts (Facts.hide fully name); |
75 |
75 |
76 |
76 |
77 (* retrieve theorems *) |
77 (* retrieve theorems *) |
78 |
78 |
79 fun get_thms thy xname = |
79 fun get_thms thy xname = |
104 |
104 |
105 (** store theorems **) |
105 (** store theorems **) |
106 |
106 |
107 (* fact specifications *) |
107 (* fact specifications *) |
108 |
108 |
109 fun map_facts f = map (apsnd (map (apfst (map f)))); |
|
110 fun burrow_fact f = split_list #>> burrow f #> op ~~; |
109 fun burrow_fact f = split_list #>> burrow f #> op ~~; |
111 fun burrow_facts f = split_list ##> burrow (burrow_fact f) #> op ~~; |
110 fun burrow_facts f = split_list ##> burrow (burrow_fact f) #> op ~~; |
112 |
111 |
113 |
112 |
114 (* name theorems *) |
113 (* name theorems *) |
174 | TERM (msg, _) => err msg |
173 | TERM (msg, _) => err msg |
175 | ERROR msg => err msg |
174 | ERROR msg => err msg |
176 end); |
175 end); |
177 val arg = (b, Lazy.map_finished (tap check) fact); |
176 val arg = (b, Lazy.map_finished (tap check) fact); |
178 in |
177 in |
179 thy |> Data.map (Facts.add_static (Context.Theory thy) {strict = true, index = false} arg #> #2) |
178 thy |> map_facts (Facts.add_static (Context.Theory thy) {strict = true, index = false} arg #> #2) |
180 end; |
179 end; |
181 |
180 |
182 fun check_thms_lazy (thms: thm list lazy) = |
181 fun check_thms_lazy (thms: thm list lazy) = |
183 if Proofterm.proofs_enabled () orelse Options.default_bool "strict_facts" |
182 if Proofterm.proofs_enabled () orelse Options.default_bool "strict_facts" |
184 then Lazy.force_value thms else thms; |
183 then Lazy.force_value thms else thms; |
229 |
228 |
230 |
229 |
231 (* dynamic theorems *) |
230 (* dynamic theorems *) |
232 |
231 |
233 fun add_thms_dynamic' context arg thy = |
232 fun add_thms_dynamic' context arg thy = |
234 let val (name, facts') = Facts.add_dynamic context arg (Data.get thy) |
233 let val (name, facts') = Facts.add_dynamic context arg (facts_of thy) |
235 in (name, Data.put facts' thy) end; |
234 in (name, map_facts (K facts') thy) end; |
236 |
235 |
237 fun add_thms_dynamic arg thy = |
236 fun add_thms_dynamic arg thy = |
238 add_thms_dynamic' (Context.Theory thy) arg thy |> snd; |
237 add_thms_dynamic' (Context.Theory thy) arg thy |> snd; |
239 |
238 |
240 |
239 |