First Order Logic: =1=Prenex Normal Form. Skolemization. Clausal Form
Total Page:16
File Type:pdf, Size:1020Kb
First Order Logic: Prenex normal form. Skolemization. Clausal form Valentin Goranko DTU Informatics September 2010 V Goranko Revision: CNF and DNF of propositional formulae • A literal is a propositional variable or its negation. • An elementary disjunction is a disjunction of literals. An elementary conjunction is a conjunction of literals. • A disjunctive normal form (DNF) is a disjunction of elementary conjunctions. • A conjunctive normal form (CNF) is a conjunction of elementary disjunctions. V Goranko Conjunctive and disjunctive normal forms of first-order formulae An open first-order formula is in disjunctive normal form (resp., conjunctive normal form) if it is a first-order instance of a propositional formula in DNF (resp. CNF), obtained by uniform substitution of atomic formulae for propositional variables. Examples: (:P(x) _ Q(x; y)) ^ (P(x) _:R(y)) is in CNF, as it is a first-order instance of (:p _ q) ^ (p _:r); (P(x) ^ Q(x; y) ^ R(y)) _:P(x) is in DNF, as it is a first-order instance of (:p ^ q ^ r) _:p. 8xP(x) _ Q(x; y) and :P(x) _ (Q(x; y) ^ R(y)) ^ :R(y) are not in either CNF or DNF. V Goranko Prenex normal forms A first-order formula Q1x1:::QnxnA; where Q1; :::; Qn are quantifiers and A is an open formula, is in a prenex form. The quantifier string Q1x1:::Qnxn is called the prefix, and the formula A is the matrix of the prenex form. Examples: 8x9y(x > 0 ! (y > 0 ^ x = y 2)) is in prenex form, while 9x(x = 0) ^ 9y(y < 0) and 8x(x > 0 _ 9y(y > 0 ^ x = y 2)) are not in prenex form. V Goranko Prenex conjunctive and disjunctive normal forms If A is in DNF then Q1x1:::QnxnA is in prenex disjunctive normal form (PDNF); if A is in CNF then Q1x1:::QnxnA is in prenex conjunctive normal form (PCNF). Examples: 8x9y(:x > 0 _ y > 0) is both in PDNF and in PCNF. 8x9y(:x > 0 _ (y > 0 ^ :x = y 2)) is in PDNF, but not in PCNF. 8x(x > 0 _ 9y(y > 0 ^ x = y 2)) is neither in PCNF nor in PDNF. V Goranko Transformation to prenex normal forms THEOREM: Every first-order formula is equivalent to a formula in a prenex disjunctive normal form (PDNF) and to a formula in a prenex conjunctive normal form (PCNF). Here is an algorithm: 1. Eliminate all occurrences of ! and $. 2. Import all negations inside all other logical connectives. 3. Use the equivalences: (a) 8xP ^ 8xQ ≡ 8x(P ^ Q); (b) 9xP _ 9xQ ≡ 9x(P _ Q); to pull some quantifiers outwards and, after renaming the formula whenever necessary. V Goranko Transformation to prenex normal forms cont'd 4. Use also the following equivalences, where x does not occur free in Q : (c) 8xP ^ Q ≡ Q ^ 8xP ≡ 8x(P ^ Q); (d) 8xP _ Q ≡ Q _ 8xP ≡ 8x(P _ Q); (e) 9xP _ Q ≡ Q _ 9xP ≡ 9x(P _ Q); (f ) 9xP ^ Q ≡ Q ^ 9xP ≡ 9x(P ^ Q); to pull all quantifiers in front and thus transform the formula into a prenex form. 5. Finally, transform the matrix in a DNF or CNF, just like a propositional formula. V Goranko Transformation to prenex normal forms: example A = 9z(9xQ(x; z) _ 9xP(x)) !:(:9xP(x) ^ 8x9zQ(z; x)). 1. Eliminating !: A ≡ :9z(9xQ(x; z) _ 9xP(x)) _:(:9xP(x) ^ 8x9zQ(z; x)) 2. Importing the negation: A ≡ 8z(:9xQ(x; z) ^ :9xP(x)) _ (::9xP(x) _ :8x9zQ(z; x)) ≡ 8z(8x:Q(x; z) ^ 8x:P(x)) _ (9xP(x) _ 9x8z:Q(z; x)). 3. Using the equivalences (a) and (b): A ≡ 8z8x(:Q(x; z) ^ :P(x)) _ 9x(P(x) _ 8z:Q(z; x)): 4. Renaming: A ≡ 8z8x(:Q(x; z) ^ :P(x)) _ 9y(P(y) _ 8w:Q(w; y)): 5. Using the equivalences (c)-(f) to pull the quantifiers in front: A ≡ 8z8x9y8w((:Q(x; z) ^ :P(x)) _ P(y) _:Q(w; y)): 6. The resulting formula is in a prenex DNF. For a prenex CNF we have to distribute the _ over ^: A ≡ 8z8x9y8w((:Q(x; z) _ P(y) _:Q(w; y)) ^ (:P(x) _ P(y) _ :Q(w; y))). V Goranko Skolemization I: Skolem constants Skolemization: procedure for systematic elimination of the existential quantifiers in a first-order formula in a prenex form, by introducing new constant and functional symbols, called Skolem constants and Skolem functions, in the formula. I Simple case: the result of Skolemization of the formula 9x8y8zA is the formula 8y8zA[c=x], where c is a new (Skolem) constant. .. For instance, the result of Skolemization of the formula 9x8y8z(P(x; y) ! Q(x; z)) is 8y8z(P(c; y) ! Q(c; z)). I More generally, the result of Skolemization of the formula 9x1 · · · 9xk 8y1 · · · 8ynA is 8y1 · · · 8ynA[c1=x1;:::; ck =xk ], where c1;:::; ck are new (Skolem) constants. Note that the resulting formula is not equivalent to the original one, but is equally satisfiable with it. V Goranko Skolemization II: Skolem functions I The result of Skolemization of 8y9zP (y; z) is 8yP(y; f (y)), where f is a new unary function, called Skolem function. I More generally, the result of Skolemization of 8y9x1 ···9 xk 8y1 · · · 8ynA is 8y8y1 · · · 8ynA[f1(y)=x1;:::; fk (y)=xk ], where f1;:::; fk are new Skolem functions. I The result of Skolemization of 8x9y8z9uA(x; y; z; u) is 8x8zA[f (x)=y; g(x; z)=u); where f is a new unary Skolem function and g is a new binary Skolem function. Again, the resulting formula after Skolemization is not equivalent to the original one, but is equally satisfiable with it. V Goranko Clausal form of first-order formulae A literal is an atomic formula or a negation of an atomic formula. Examples: P(x), :P(f (c; g(y))), :Q (f (x; g(c)); g(g(g(y)))). A clause is a set of literals (representing their disjunction). Example: fP(x); :P(f (c; g(y))); :Q(f (x; g(c)); g(g(g(y))))g represents P(x) _:P(f (c; g(y))) _:Q(f (x; g(c)); g(g(g(y)))) All variables in a clause are assumed to be universally quantified. A clausal form is a set of clauses (representing their conjunction). Example: f fP(x)g; f:P(f (c)); :Q(g(x; x); y)g; f:P(f (y)); P(f (c)); Q(y; f (x))g g. V Goranko Transformation of first-order formulae to clausal form Theorem: Every first-order formula A can be transformed to a clausal form fC1;:::; Ck g such that A is equally satisfiable with the universal closure (C1 ^ · · · ^ Ck ) of the conjunction of all clauses, considered as disjunctions. The algorithm: 1. Transform A to a prenex CNF. 2. Skolemize away all existential quantifiers. 3. Remove all universal quantifiers. 4. Write the matrix (which is in CNF) as a set of clauses. V Goranko.