226 val th3 = th2 |> Conv.fconv_rule Object_Logic.atomize |
226 val th3 = th2 |> Conv.fconv_rule Object_Logic.atomize |
227 |> extensionalize_theorem |
227 |> extensionalize_theorem |
228 |> Meson.make_nnf ctxt |
228 |> Meson.make_nnf ctxt |
229 in (th3, ctxt) end |
229 in (th3, ctxt) end |
230 |
230 |
|
231 fun to_definitional_cnf_with_quantifiers thy th = |
|
232 let |
|
233 val eqth = cnf.make_cnfx_thm thy (HOLogic.dest_Trueprop (prop_of th)) |
|
234 val eqth = eqth RS @{thm eq_reflection} |
|
235 val eqth = eqth RS @{thm TruepropI} |
|
236 in Thm.equal_elim eqth th end |
|
237 |
231 (* Convert a theorem to CNF, with Skolem functions as additional premises. *) |
238 (* Convert a theorem to CNF, with Skolem functions as additional premises. *) |
232 fun cnf_axiom thy th = |
239 fun cnf_axiom thy th = |
233 let |
240 let |
234 val ctxt0 = Variable.global_thm_context th |
241 val ctxt0 = Variable.global_thm_context th |
235 val (nnfth, ctxt) = to_nnf th ctxt0 |
242 val (nnf_th, ctxt) = to_nnf th ctxt0 |
236 val sko_ths = map (skolem_theorem_of_def thy) |
243 val def_th = to_definitional_cnf_with_quantifiers thy nnf_th |
237 (assume_skolem_funs nnfth) |
244 val sko_ths = map (skolem_theorem_of_def thy) (assume_skolem_funs def_th) |
238 val (cnfs, ctxt) = Meson.make_cnf sko_ths nnfth ctxt |
245 val (cnf_ths, ctxt) = Meson.make_cnf sko_ths def_th ctxt |
239 in |
246 in |
240 cnfs |> map introduce_combinators_in_theorem |
247 cnf_ths |> map introduce_combinators_in_theorem |
241 |> Variable.export ctxt ctxt0 |
248 |> Variable.export ctxt ctxt0 |
242 |> Meson.finish_cnf |
249 |> Meson.finish_cnf |
243 |> map Thm.close_derivation |
250 |> map Thm.close_derivation |
244 end |
251 end |
245 handle THM _ => [] |
252 handle THM _ => [] |
246 |
253 |
247 end; |
254 end; |