Standard Logical Equivalences

Slides:



Advertisements
Similar presentations
Artificial Intelligence 8. The Resolution Method
Advertisements

First-Order Logic (FOL) aka. predicate calculus
Some Prolog Prolog is a logic programming language
Logic Inference CMSC 471 Chapter 7.5, 9 Chuck Dyer, and Lise Getoor
Resolution Proof System for First Order Logic
First-Order Logic.
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 06 : First Order Logic Resolution Prove.
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: – Constant symbols (i.e., the "individuals"
Resolution.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Automated Reasoning Systems For first order Predicate Logic.
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Logic Use mathematical deduction to derive new knowledge.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Inference and Resolution for Problem Solving
Knoweldge Representation & Reasoning
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Fall 2004.
Artificial Intelligence
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2005.
The Semantic Web – WEEK 8: An automatic Proof technique.. The “Layer Cake” Model – [From Rector & Horrocks Semantic Web cuurse] You are here!
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
UIUC CS 497: Section EA Lecture #3 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
1 Chapter 8 Inference and Resolution for Problem Solving.
First Order Predicate Logic
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
1CS3754 Class Notes 14B, John Shieh, Figure 2.5: Further steps in the unification of (parents X (father X) (mother bill)) and (parents bill.
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
1 Inference in First Order Logic CS 171/271 (Chapter 9) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Reasoning using First-Order Logic
The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07
第 1 6 章 谓词演算中的归结. 2 Outline Unification Predicate-Calculus Resolution Completeness and Soundness Converting Arbitrary wffs to Clause Form Using Resolution.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
First-Order Logic Reading: C. 8 and C. 9 Pente specifications handed back at end of class.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Answer Extraction To use resolution to answer questions, for example a query of the form  X C(X), we must keep track of the substitutions made during.
1 Introduction to Artificial Intelligence LECTURE 9: Resolution in FOL Theorem Proving in First Order Logic Unification Resolution.
CS621: Artificial Intelligence
Introduction to Logic for Artificial Intelligence Lecture 2
First-Order Logic (FOL) aka. predicate calculus
Horn Clauses and Unification
Logic Use mathematical deduction to derive new knowledge.
Horn Clauses and Unification
Prolog IV Logic, condensed.
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
RESOLUTION.
Presentation transcript:

Standard Logical Equivalences

Resolution Procedure (aka Resolution Refutation Procedure) Resolution procedure is a complete inference procedure for FOL Resolution procedure uses a single rule of inference: the Resolution Rule (RR), which is a generalization of the same rule used in PL Resolution Rule for PL: From sentence P1 v P2 v ... v Pn and sentence ~P1 v Q2 v ... v Qm derive resolvent sentence: P2 v ... v Pn v Q2 v ... v Qm Examples From P and ~P v Q, derive Q (Modus Ponens) From (~P v Q) and (~Q v R), derive ~P v R From P and ~P, derive False From (P v Q) and (~P v ~Q), derive True

Resolution Procedure… Resolution Rule for FOL: Given sentence P1 v ... v Pn and sentence Q1 v ... v Qm where each Pi and Qi is a literal, i.e., a positive or negated predicate symbol with its terms, if Pj and ~Qk unify with substitution list Theta, then derive the resolvent sentence: subst(Theta, P1 v ... v Pj-1 v Pj+1 v ... v Pn v Q1 v ... Qk-1 v Qk+1 v ... v Qm) Example From clause P(x, f(a)) v P(x, f(y)) v Q(y) and clause ~P(z, f(a)) v ~Q(z), derive resolvent clause P(z, f(y)) v Q(y) v ~Q(z) using Theta = {x/z} To introduce substitutions different logical expressions have to be look identical Unification

Unification Unification is a "pattern matching" procedure that takes two atomic sentences, called literals, as input, and returns "failure" if they do not match and a substitution list, Theta, if they do match. Theta is called the most general unifier (mgu)

The unification algorithm

The unification algorithm

Unification… Examples Literal 1 Literal 2 Literal 3 parents(x, father(x), mother(Bill)) parents(x, father(x), mother(Jane)) parents(Bill, father(Bill), y) parents(Bill, father(y), z) parents(Bill, father(y), mother(y)) {x/Bill, y/mother(Bill)} {x/Bill, y/Bill, z/mother(Bill)} Failure

Unification p q  Knows(John,x) Knows(John,Jane) Knows(John,x) Knows(y,OJ) Knows(John,x) Knows(y,Mother(y)) Knows(John,x) Knows(x,OJ)

Unification p q  Knows(John,x) Knows(John,Jane) {x/Jane} Knows(John,x) Knows(y,OJ) Knows(John,x) Knows(y,Mother(y)) Knows(John,x) Knows(x,OJ)

Unification p q  Knows(John,x) Knows(John,Jane) {x/Jane} Knows(John,x) Knows(y,OJ) {x/OJ,y/John} Knows(John,x) Knows(y,Mother(y)) Knows(John,x) Knows(x,OJ)

Unification p q  Knows(John,x) Knows(John,Jane) {x/Jane} Knows(John,x) Knows(y,OJ) {x/OJ,y/John} Knows(John,x) Knows(y,Mother(y)) {y/John,x/Mother(John)}} Knows(John,x) Knows(x,OJ)

Unification p q  Knows(John,x) Knows(John,Jane) {x/Jane} Knows(John,x) Knows(y,OJ) {x/OJ,y/John} Knows(John,x) Knows(y,Mother(y)) {y/John,x/Mother(John)}} Knows(John,x) Knows(x,OJ) {fail}

Unification To unify Knows(John,x) and Knows(y,z),  = {y/John, x/z } or  = {y/John, x/John, z/John} The first unifier is more general than the second. There is a single most general unifier (MGU) that is unique up to renaming of variables. MGU = { y/John, x/z }

Unification… Unify is a linear time algorithm that returns the most general unifier (mgu) i.e., a shortest length substitution list that makes the two literals match. A variable can never be replaced by a term containing that variable. For example, x/f(x) is illegal. This "occurs check" should be done in the previous pseudo-code.

Models and Entailment If there is an interpretation for a sentence such that the sentence is true in a particular world, that world is called a model A sentence  is entailed by a knowledge base KB if the models of the knowledge base KB are also models of the sentence  KB |=  This means that every interpretation I that satisfies KB, satisfies 

Resolution Procedure… Proof by contradiction method Given a set of axioms KB and goal sentence Q, we want to show that KB |= Q. This means that every interpretation I that satisfies KB, satisfies Q. But we know that any interpretation I satisfies either Q or ~Q, but not both. Therefore if in fact KB |= Q, an interpretation that satisfies KB, satisfies Q and does not satisfy ~Q. Hence KB union {~Q} is unsatisfiable, i.e., that it's false under all interpretations. In other words, (KB |- Q) <=> (KB ^ ~Q |- False)

Resolution Algorithm procedure resolution-refutation(KB, Q) ;; KB is a set of consistent, true FOL sentences ;; Q is a goal sentence that we want to derive ;; return success if KB |- Q, and failure otherwise KB = union(KB, ~Q) while false not in KB do pick 2 sentences, S1 and S2, in KB that contain literals that unify (if none, return "failure“) resolvent = resolution-rule(S1, S2) KB = union(KB, resolvent) return "success"

Resolution example (using PL sentences) From “Heads I win, tails you lose” prove that “I win” First, define the axioms in KB: "Heads I win, tails you lose." (Heads => IWin) or, equivalently, (~Heads v IWin) (Tails => YouLose) or, equivalently, (~Tails v YouLose) Add some general knowledge axioms about coins, winning, and losing: (Heads v Tails) (YouLose => IWin) or, equivalently, (~YouLose v IWin) (IWin => YouLose) or, equivalently, (~IWin v YouLose) Goal: IWin

Resolution example (using PL sentences)… Resolvent ~IWin ~Heads Tails YouLose IWin ~Heads v IWin Heads v Tails ~Tails v YouLose ~YouLose v Iwin False

Problems yet to be addressed Resolution rule of inference is only applicable with sentences that are in the form P1 v P2 v ... v Pn where each Pi is a negated or nonnegated predicate contains functions, constants, and universally quantified variables so can we convert every FOL sentence into this form? Resolution strategy How to pick which pair of sentences to resolve? How to pick which pair of literals, one from each sentence, to unify?

Converting FOL sentences to clause form Every FOL sentence can be converted to a logically equivalent sentence that is in a "normal form" called clause form Steps to convert a sentence to clause form: Eliminate all <=> connectives by replacing each instance of the form (P <=> Q) by expression ((P => Q) ^ (Q => P)) Eliminate all => connectives by replacing each instance of the form (P => Q) by (~P v Q) Reduce the scope of each negation symbol to a single predicate by applying equivalences such as converting ~~P to P ~(P v Q) to ~P ^ ~Q ~(P ^ Q) to ~P v ~Q ~(Ax)P to (Ex)~P ~(Ex)P to (Ax)~P

Converting FOL sentences to clause form… Standardize variables: rename all variables so that each quantifier has its own unique variable name. For example, convert (Ax)P(x) to (Ay)P(y) if there is another place where variable x is already used. Eliminate existential quantification by introducing Skolem functions. For example, convert (Ex)P(x) to P(c) where c is a brand new constant symbol that is not used in any other sentence. c is called a Skolem constant. More generally, if the existential quantifier is within the scope of a universal quantified variable, then introduce a Skolem function that depends on the universally quantified variable. For example, (Ax)(Ey)P(x,y) is converted to (Ax)P(x, f(x)). f is called a Skolem function, and must be a brand new function name that does not occur in any other sentence in the entire KB. Example: (Ax)(Ey)loves(x,y) is converted to (Ax)loves(x,f(x)) where in this case f(x) specifies the person that x loves. (If we knew that everyone loved their mother, then f could stand for the mother-of function.)

Converting FOL sentences to clause form… Remove universal quantification symbols by first moving them all to the left end and making the scope of each the entire sentence, and then just dropping the "prefix" part. E.g., convert (Ax)P(x) to P(x) Distribute "and" over "or" to get a conjunction of disjunctions called conjunctive normal form. convert (P ^ Q) v R to (P v R) ^ (Q v R) convert (P v Q) v R to (P v Q v R) Split each conjunct into a separate clause, which is just a disjunction ("or") of negated and nonnegated predicates, called literals Standardize variables apart again so that each clause contains variable names that do not occur in any other clause

Converting FOL sentences to clause form… Examples: Convert the sentence (Ax)(P(x) => ((Ay)(P(y) => P(f(x,y))) ^ ~(Ay)(Q(x,y) => P(y)))) Eliminate <=> Nothing to do here. Eliminate => (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ ~(Ay)(~Q(x,y) v P(y)))) Reduce scope of negation (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ (Ey)(Q(x,y) ^ ~P(y))))

Converting FOL sentences to clause form… Standardize variables (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ (Ez)(Q(x,z) ^ ~P(z)))) Eliminate existential quantification (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ (Q(x,g(x)) ^ ~P(g(x))))) Drop universal quantification symbols (~P(x) v ((~P(y) v P(f(x,y))) ^ (Q(x,g(x)) ^ ~P(g(x))))) Convert to conjunction of disjunctions (~P(x) v ~P(y) v P(f(x,y))) ^ (~P(x) v Q(x,g(x))) ^ (~P(x) v ~P(g(x)))

Converting FOL sentences to clause form… Create separate clauses ~P(x) v ~P(y) v P(f(x,y)) ~P(x) v Q(x,g(x)) ~P(x) v ~P(g(x)) Standardize variables ~P(z) v Q(z,g(z)) ~P(w) v ~P(g(w))

Example: Hoofers Club Problem Statement: Tony, Shi-Kuo and Ellen belong to the Hoofers Club. Every member of the Hoofers Club is either a skier or a mountain climber or both. No mountain climber likes rain, and all skiers like snow. Ellen dislikes whatever Tony likes and likes whatever Tony dislikes. Tony likes rain and snow. Query: Is there a member of the Hoofers Club who is a mountain climber but not a skier?

Example: Hoofers Club… Translation into FOL Sentences Let S(x) mean x is a skier, M(x) mean x is a mountain climber, and L(x,y) mean x likes y, where the domain of the first variable is Hoofers Club members, and the domain of the second variable is snow and rain. We can now translate the above English sentences into the following FOL wffs: (Ax) S(x) v M(x) ~(Ex) M(x) ^ L(x, Rain) (Ax) S(x) => L(x, Snow) (Ay) L(Ellen, y) <=> ~L(Tony, y) L(Tony, Rain) L(Tony, Snow) Query: (Ex) M(x) ^ ~S(x) Negation of the Query: ~(Ex) M(x) ^ ~S(x)

Example: Hoofers Club… Conversion to Clause Form S(x1) v M(x1) ~M(x2) v ~L(x2, Rain) ~S(x3) v L(x3, Snow) ~L(Tony, x4) v ~L(Ellen, x4) L(Tony, x5) v L(Ellen, x5) L(Tony, Rain) L(Tony, Snow) Negation of the Query: ~M(x7) v S(x7)

Example: Hoofers Club… Resolution Refutation Proof Clause 1 Clause 2 Resolvent MGU (i.e., Theta) 8 9 10 11 1 3 4 7 9. S(x1) 10. L(x1, Snow) 11. ~L(Tony, Snow) 12. False {x7/x1} {x3/x1} {x4/Snow, x1/Ellen} {}

Example: Hoofers Club… Answer Extraction Clause 1 Clause 2 Resolvent MGU (i.e., Theta) ~M(x7) v S(x7) v (M(x7) ^ ~S(x7)) 9 10 11 1 3 4 7 9. S(x1) v (M(x1) ^ ~S(x1)) 10. L(x1, Snow) v (M(x1) ^ ~S(x1)) 11. ~L(Tony, Snow) v (M(Ellen) ^ ~S(Ellen)) 12. M(Ellen) ^ ~S(Ellen) {x7/x1} {x3/x1} {x4/Snow, x1/Ellen} {} Answer to the query: Ellen!