248 (*Conjunctive normal form, adding clauses from th in front of ths (for foldr). |
248 (*Conjunctive normal form, adding clauses from th in front of ths (for foldr). |
249 Strips universal quantifiers and breaks up conjunctions. |
249 Strips universal quantifiers and breaks up conjunctions. |
250 Eliminates existential quantifiers using skoths: Skolemization theorems.*) |
250 Eliminates existential quantifiers using skoths: Skolemization theorems.*) |
251 fun cnf skoths (th,ths) = |
251 fun cnf skoths (th,ths) = |
252 let fun cnf_aux (th,ths) = |
252 let fun cnf_aux (th,ths) = |
253 if not (HOLogic.is_Trueprop (prop_of th)) then ths (*meta-level: ignore*) |
253 if not (can HOLogic.dest_Trueprop (prop_of th)) then ths (*meta-level: ignore*) |
254 else if not (has_conns ["All","Ex","op &"] (prop_of th)) |
254 else if not (has_conns ["All","Ex","op &"] (prop_of th)) |
255 then th::ths (*no work to do, terminate*) |
255 then th::ths (*no work to do, terminate*) |
256 else case head_of (HOLogic.dest_Trueprop (concl_of th)) of |
256 else case head_of (HOLogic.dest_Trueprop (concl_of th)) of |
257 Const ("op &", _) => (*conjunction*) |
257 Const ("op &", _) => (*conjunction*) |
258 cnf_aux (th RS conjunct1, cnf_aux (th RS conjunct2, ths)) |
258 cnf_aux (th RS conjunct1, cnf_aux (th RS conjunct2, ths)) |