equal
deleted
inserted
replaced
268 |
268 |
269 (*Skolemize a named theorem, with Skolem functions as additional premises.*) |
269 (*Skolemize a named theorem, with Skolem functions as additional premises.*) |
270 (*also works for HOL*) |
270 (*also works for HOL*) |
271 fun skolem_thm th = |
271 fun skolem_thm th = |
272 let val nnfth = to_nnf th |
272 let val nnfth = to_nnf th |
273 in Meson.make_cnf (skolem_of_nnf nnfth) nnfth |
273 in rm_redundant_cls (Meson.make_cnf (skolem_of_nnf nnfth) nnfth) |
274 end |
274 end |
275 handle THM _ => []; |
275 handle THM _ => []; |
276 |
276 |
277 (*Declare Skolem functions for a theorem, supplied in nnf and with its name. |
277 (*Declare Skolem functions for a theorem, supplied in nnf and with its name. |
278 It returns a modified theory, unless skolemization fails.*) |
278 It returns a modified theory, unless skolemization fails.*) |
280 let val cname = (case name of "" => gensym "sko" | s => Sign.base_name s) |
280 let val cname = (case name of "" => gensym "sko" | s => Sign.base_name s) |
281 in Option.map |
281 in Option.map |
282 (fn nnfth => |
282 (fn nnfth => |
283 let val (thy',defs) = declare_skofuns cname nnfth thy |
283 let val (thy',defs) = declare_skofuns cname nnfth thy |
284 val skoths = map skolem_of_def defs |
284 val skoths = map skolem_of_def defs |
285 in (thy', Meson.make_cnf skoths nnfth) end) |
285 in (thy', rm_redundant_cls (Meson.make_cnf skoths nnfth)) end) |
286 (SOME (to_nnf th) handle THM _ => NONE) |
286 (SOME (to_nnf th) handle THM _ => NONE) |
287 end; |
287 end; |
288 |
288 |
289 (*Populate the clause cache using the supplied theorem. Return the clausal form |
289 (*Populate the clause cache using the supplied theorem. Return the clausal form |
290 and modified theory.*) |
290 and modified theory.*) |
344 val tag_intro = preserve_name (fn th => th RS tagI); |
344 val tag_intro = preserve_name (fn th => th RS tagI); |
345 val tag_elim = preserve_name (fn th => tagD RS th); |
345 val tag_elim = preserve_name (fn th => tagD RS th); |
346 |
346 |
347 fun rules_of_claset cs = |
347 fun rules_of_claset cs = |
348 let val {safeIs,safeEs,hazIs,hazEs,...} = rep_cs cs |
348 let val {safeIs,safeEs,hazIs,hazEs,...} = rep_cs cs |
349 val intros = [subset_refl] @ safeIs @ hazIs |
349 val intros = safeIs @ hazIs |
350 (*subset_refl is a special case: obviously useful in resolution, but |
|
351 harmful if added as a default intro rule.*) |
|
352 val elims = map Classical.classical_rule (safeEs @ hazEs) |
350 val elims = map Classical.classical_rule (safeEs @ hazEs) |
353 in |
351 in |
354 Output.debug ("rules_of_claset intros: " ^ Int.toString(length intros) ^ |
352 Output.debug ("rules_of_claset intros: " ^ Int.toString(length intros) ^ |
355 " elims: " ^ Int.toString(length elims)); |
353 " elims: " ^ Int.toString(length elims)); |
356 if tagging_enabled |
354 if tagging_enabled |