Discussion #18 Resolution with Propositional Calculus; Prenex Normal Form Discussion #18 1/13 Topics • • • • • Motivation for resolution Resolution Why resolution works Examples Prenex normal form Discussion #18 2/13 Programming a Computer to do Proofs Too much work to program all the possibilities we have considered. We need a better way. 1. Better = more uniform not so many cases (even though it may sometimes be longer). 2. Better = fewer rules of inference. 3. Better = a heuristic guide to lead us to the conclusion. 4. Better = easier to convert to an algorithm. Discussion #18 3/13 Resolution Resolution answers these “demands:” Uniform: Only disjunctions of literals in every rule Fewer Rules: Only one inference rule Heuristic Guide: Reduce the number of literals with the goal of reaching False Algorithmic: 1. 2. 3. 4. 5. Negate the conclusion and add it as a premise. Convert the premises to CNF (conjunction of disjunction of literals). Write each premise (which is a disjunction of literals) as a line of the proof. Repeatedly apply resolution (the one inference rule) & simplify as needed. Success iff F is reached. Discussion #18 4/13 Resolution Rule literals PA P B AB clauses: A and B will always be disjunctions of literals or just a literal or possibly missing. This says: In two disjunctive clauses, if we have complementary literals, we can discard them and “OR” the remaining clauses. Discussion #18 5/13 Resolution is Valid P T T T T F F F F A T T F F T T F F Discussion #18 B T F T F T F T F (P A) T T T T T T F F T F T F T T F F (P F F F F T T T T B) T F T F T T T T AB T T T T T T T F T T T T T T T F 6/13 Resolution Subsumes “the big 3” Inference Rules Modus ponens Modus tollens Hypothetical syllogism P PQ Q P QP Q PQ QR PR PF P Q QF P F Q P Q F P Q Q R P R We now have one rule to rule them all! Discussion #18 7/13 Example #1 If P Q, Q R, P then R. 1. Negate the conclusion (R becomes another premise). 2. Convert to CNF: (P Q) (Q R) P R 3. Write the premises as the first lines of the proof. 4. Do resolution. 1. 2. 3. 4. 5. 6. 7. P Q Q R P R P R R premise premise premise premise resolution 1,2 resolution 3,5 resolution 4,6 } Sometimes called the support. empty = F Discussion #18 8/13 Example #2 If P (Q R), R Q then P. 1. Negate conclusion: P P 2. Convert to CNF: (P Q) (P R) R Q P 1. 2. 3. 4. 5. 6. 7. P Q P R R Q P R F premise (not used could discard) premise premise premise (not used could discard) premise resolution 2,5 resolution 3,6 Also, resolution 1,5 yields Q, which need not be added to the derivation already there. Do we always need to use all the premises? If not, we can discard them from the statement to be proved. Discussion #18 9/13 Example #3 If P Q, Q P, P Q then P Q. 1. Negate conclusion: (P Q) (P Q) 2. CNF: (P Q) (Q P) (P Q) (P Q) 1. 2. 3. 4. 5. 6. 7. 8. PQ Q P P Q P Q P Q Q F Discussion #18 premise premise premise premise resolution 1,2 (idemp. P P P) resolution 3,5 resolution 4,5 resolution 6,7 10/13 Example #4 If (P Q) (P R), P then Q R. 1. Negate conclusion: (Q R) (Q R) 2. CNF: ((P Q) (P R)) P (Q R) (P Q R) P Q R 1. 2. 3. 4. 5. 6. 7. Discussion #18 P Q R P Q R QR R premise premise premise premise resolution 1,2 resolution 3,5 resolution 4,6 11/13 Prenex Normal Form • Prenex Normal Form preparation to do resolution in predicate calculus – All quantifiers in front – More formally: No quantifier in the scope of any logical connector (, , , , ) • Algorithm to obtain prenex normal form: 1. 2. 3. 4. Remove and Move in Rectify (standardize all variables apart) Move quantifiers to the front Discussion #18 12/13 Prenex Normal Form – Example y(xP(x) xQ(x, y)) y(xP(x) xQ(x, y)) y(xP(x) xQ(x, y)) y(xP(x) xQ(x, y)) y(xP(x) xQ(x, y)) y(xP(x) zQ(z, y)) yx(P(x) zQ(z, y)) yxz(P(x) Q(z, y)) Discussion #18 implication xA xA (de Morgan’s) de Morgan’s, double neg. xA xA (de Morgan’s) rectification xAB x(AB) (x not free in B) AzB z(AB) (z not free in A) 13/13