210 likes | 495 Views
Resolution and Refutation Proofs. Introduction to Artificial Intelligence CS440/ECE448 Lecture 13 Homework due March 2. Last lecture. Substitutions and unification Generalized Modus Ponens Resolution definition This lecture Refutation proofs True-or-false questions
E N D
Resolution and Refutation Proofs Introduction to Artificial Intelligence CS440/ECE448 Lecture 13 Homework due March 2
Last lecture • Substitutions and unification • Generalized Modus Ponens • Resolution definition This lecture • Refutation proofs • True-or-false questions • Fill-in-the-blanks questions • Resolution properties Reading • Chapter 9
Generalized Modus Ponens (GMP) p1’, p2’,…, pn’, (p1p2… pn q) wherepi’ = pi q for all i For example, let p1’ = Faster (Bob, Pat) p2’ = Faster (Pat, Steve) Faster (x, y) Faster (y, z) Faster (x, z) Unify p1’ and p2’ with the premise = { x/Bob, y/Pat, z/Steve } Apply substitution to the conclusion q = Faster(Bob, Steve) pi and q atomic sentences Universally quantified variables
Forward Chaining Example • White: Facts added in turn • Yellow: The result of implication of rules. • Buffalo(x) Pig(y) Faster(x, y) • Pig(y) Slug(z) Faster(y, z) • Faster(x, y) Faster(y, z) Faster(x, z) • Buffalo(Bob) [ Unifies with 1-a ] • Pig(Pat) [ Unifies with 1-b, GMP Fires ] [ Unifies with 2-a ] • Faster(Bob,Pat) [ Unifies with 3-a, 3-b ] • Slug(Steve) [ Unifies with 2-b, GMP Fires ] • Faster(Pat, Steve) [ Unifies with 3-b and with 6,GMP Fires ] • Faster (Bob, Steve) • …
Pig(y) Slug(z) Faster (y, z) Slimy(a) Creeps(a) Slug(a) Pig(Pat) Slimy(Steve) Creeps(Steve) Backward Chaining Example
Refutation Proofs • Given • a knowledge base KB (collection of true sentences), • a proposition P, we wish to prove that P is true. • Proof by contradiction (refutation): • Assume that P is FALSE (i.e., that P is TRUE). • Show that a contradiction arises. • A complete approach to refutation can be obtained using a single inference rule: resolution.
Resolution Inference Rule • Idea: If is true or is true and is false or is true then or must be true • Basic resolution rule from propositional logic: • Can be expressed in terms of implications , • Note that Resolution rule is a generalization of Modus Ponens , is equivalent to TRUE , TRUE
Generalized Resolution Generalized resolution rule for first order logic (with variables) If pj can be unified with qk, then we can apply the resolution rule: p1 … pj … pm q1 … qk … qn Subst(, (p1 … pj-1 pj+1 … pm q1 … qk-1 qk+1 … qn)) where = Unify (pj, qk) • Example: KB: Rich(x) Unhappy(x) Rich(Me) Substitution: = { x/Me } Conclusion: Unhappy(Me)
Canonical Form • For generalized Modus Ponens, entire knowledge base is represented as Horn Sentences. • For resolution, entire database will be represented using Conjunctive Normal Form (CNF) • Any first order logic sentence can be converted to a Canonical CNF form. • Note: Can also do resolution with implicative form, but let’s stick to CNF.
Converting any FOL to CNF • Literal = (possibly negated) atomic sentence, e.g., Rich(Me) • Clause = disjunction of literals, e.g., Rich(Me) Unhappy(Me) • The KB is a conjunction of clauses • Any FOL sentence can be converted to CNF as follows: • Replace P QbyP Q • Move inwards to literals, e.g., x P becomes x P • Standardize variables, e.g., (x P) (x Q) becomes (x P) (y Q) • Move quantifiers left in order, e.g., x P y Q becomes x y P Q • Eliminate by Skolemization (next slide) • Drop universal quantifiers • Distribute over , e.g., (P Q) R becomes (P R) (Q R) • Flatten nested conjunctions & disjunctions, e.g. (P Q) R P Q R
Skolemization (Thoralf Skolem 1920) • The process of removing existential quantifiers by elimination. • Simple case: No universal quantifiers. Existential Elimination Rule • For example: x Rich(x) becomes Rich(G1) where G1 is a new ``Skolem constant'‘. • More tricky when is inside .
Skolemization – continued • More tricky when is inside E.g., ``Everyone has a heart'' x Person(x) y Heart(y) Has(x,y) • Incorrect: x Person(x) Heart(H1) Has(x,H1) This means everyone has the same heart calledH1. • Problem is that for each person, we need another “heart” – i.e., consider the “heart” to be a function of the person. • Correct: Person(x) Heart(H(x)) Has(x,H(x)) where H is a new symbol (``Skolem function'') • Skolem function arguments: all enclosing universally quantified variables.
Resolution proof p1 … pj … pm q1 … qk … qn Subst(, (p1 … pj-1 pj+1 … pm q1 … qk-1 qk+1 … qn)) • To prove : • Negate . • Convert to CNF. • Add to CNF KB. • Infer contradiction using the resolution rule (a contradiction is detected when resolution derives the empty clause). • E.g., to prove Rich(Me),add Rich(Me) to the CNF KB, then: PhD(x) HighlyQualified(x) PhD(x) EarlySalary(x) HighlyQualified(x) Rich(x) EarlySalary(x) Rich(x)
Resolution Proof Rich(Me) PhD(x) HighlyQualified(x) PhD(x) EarlySalary(x) HighlyQualified(x) Rich(x) EarlySalary(x) Rich(x)
Resolution Proof Rich(Me) PhD(x) HighlyQualified(x) PhD(x) EarlySalary(x) HighlyQualified(x) Rich(x) EarlySalary(x) Rich(x)
Resolution Proof Rich(Me) PhD(x) HighlyQualified(x) PhD(x) EarlySalary(x) HighlyQualified(x) Rich(x) EarlySalary(x) Rich(x)
Resolution Proof Rich(Me) PhD(x) HighlyQualified(x) PhD(x) EarlySalary(x) HighlyQualified(x) Rich(x) EarlySalary(x) Rich(x)
All birds fly. No bird swims Pete is a bird Does Pete Fly? The Knowledge base 1. Bird(x) Flies(x) 2. Bird(y)Swims(y) Bird(Pete) The query Flies ( Pete) Applying Resolution 5. Swims(Pete) 2,3 Bird(Pete) 1,4 { } 3,6 True-or-False Question
Fill-in-the-blanks Question • Given a database KB and a sentence with free variables v1, …, vn what are the bindings that make true? • Prove that given KB, v1, …, vn • i.e., add to the database, derive a contradiction and find what is the subsitution leading to it. • Green’s trick: add {, Ans (v1 ,…, vn)} instead.
Decidability How hard is it to determine if KB entails ? • Propositional logic (zeroth order) is decidable: • Can determine whether or not KB entails in finite time. • Second order logic is undecidable: • Cannot determine whether KB entails in finite time. • First order logic is semi-decidable: • If KB entails or , then a proof will be found in finite time. • But, if KB neither entails or , then proof process may never terminate.
Resolution properties • Resolution is sound. • Resolution refutation is complete. (See Section 9.5 for proof.) • Resolution (and any proof procedure) is at best semi-decidable. • Note: checking consistency of a database is also semidecidable.