Inference in first-order logic I CIS 391 – Introduction to Artificial Intelligence AIMA Chapter 9.1-9.2 (through p. 278) Chapter 9.5 (through p. 300)

Slides:



Advertisements
Similar presentations
Inference in first-order logic
Advertisements

Inference in first-order logic
First-Order Logic.
Inference Rules Universal Instantiation Existential Generalization
ITCS 3153 Artificial Intelligence Lecture 15 First-Order Logic Chapter 9 Lecture 15 First-Order Logic Chapter 9.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
1 Resolution in First Order Logic CS 171/271 (Chapter 9, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Inference in FOL All rules of inference for propositional logic apply to first-order logic We just need to reduce FOL sentences to PL sentences by instantiating.
First-Order Logic Inference
1 FOL CS 331/531 Dr M M Awais Unification “It is an algorithm for determining the substitutions needed to make two predicate calculus expressions match”
1 FOL Resolution based Inferencing Resolution based rules studied earlier can lead to inferences, rules such as modus ponen, unit resolution etc… Other.
CSCE 580 Artificial Intelligence Ch.9: Inference in First-Order Logic
1 FOL CS 331 Dr M M Awais Inferencing Finding solution to queries Propositionalization –(For reference only, may leave slides 2 to 7) Unification –Forward.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
1 CS 4700: Foundations of Artificial Intelligence Carla P. Gomes Module: FOL Inference (Reading R&N: Chapter 8)
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Fall 2004.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2005.
Inference in First-Order Logic Inference Rules with Quantifiers The three new inference rules are as follows: Universal Elimination: For any sentence ,
1 Inference in First-Order Logic. 2 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining.
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
CHAPTER 9 Oliver Schulte Inference in First-Order Logic.
Inference in First-Order Logic CS 271: Fall 2007 Instructor: Padhraic Smyth.
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 26, 2012.
Logic review A summary of chapters 7, 8, 9 of Artificial Intelligence: A modern approach by Russel and Norving.
1 CS 2710, ISSP 2160 Chapter 9 Inference in First-Order Logic.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
1 Inference in first-order logic Chapter 9. 2 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Inference in first- order logic. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining.
Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 16 of 42 Friday, 29 September.
Inference in First-Order Logic 부산대학교 전자전기컴퓨터공학과 인공지능연구실 김민호
1 Knowledge Representation & Reasoning First Order Logic chapter 6 Dr Souham Meshoul CAP492.
Computing & Information Sciences Kansas State University Lecture 14 of 42 CIS 530 / 730 Artificial Intelligence Lecture 14 of 42 William H. Hsu Department.
1 Inference in First-Order Logic CS 271: Fall 2009.
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.
5/18/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 13, 5/18/2005 University of Washington, Department of Electrical Engineering Spring.
1 First Order Logic (Syntax, Semantics and Inference)
An Introduction to Artificial Intelligence – CE Chapter 9 - Inference in first-order logic Ramin Halavati In which we define.
1 First Order Logic CS 171/271 (Chapters 8 and 9) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1/19 Inference in first-order logic Chapter 9- Part2 Modified by Vali Derhami.
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
Inference in first-order logic
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
Inference in First-Order Logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
1 Chaining in First Order Logic CS 171/271 (Chapter 9, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logical Agents.
Inference in first-order logic
School of Computer Science & Engineering
Inference in First-Order Logic
Chapter 9 Inference in First-Order Logic
Knowledge Representation & Reasoning
Introduction to Artificial Intelligence
Inference in First-Order Logic
Inference in first-order logic part 1
Artificial intelli-gence 1:Inference in first-order logic
Artificial Intelligence
Introduction to Artificial Intelligence
Artificial intelligence: Inference in first-order logic
Artificial Intelligence Inference in First Order Logic
Inference in first-order logic
Inference in first-order logic part 1
Inference in First Order Logic (1)
First-Order Logic Inference
First-Order Logic Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

Inference in first-order logic I CIS 391 – Introduction to Artificial Intelligence AIMA Chapter (through p. 278) Chapter 9.5 (through p. 300)

CIS Intro to AI 2 Outline  Reducing first-order inference to propositional inference  Unification  Generalized Modus Ponens

CIS Intro to AI 3 Universal instantiation (UI)  Every instantiation of a universally quantified sentence is entailed by it:  v α Subst({v/g}, α) for any variable v and ground term g  E.g.,  x King(x)  Greedy(x)  Evil(x) yields any or all of: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) King(Father(John))  Greedy(Father(John))  Evil(Father(John)) …

CIS Intro to AI 4 Existential instantiation (EI)  For any sentence α, variable v, and constant symbol k that does not appear elsewhere in the knowledge base:  v α Subst({v/k}, α)  E.g.,  x Crown(x)  OnHead(x,John) yields: Crown(C1)  OnHead(C1,John) provided C1 is a new constant symbol, called a Skolem constant

CIS Intro to AI 5 Existential Instantiation continued  UI can be applied several times to add new sentences the new KB is logically equivalent to the old  EI can be applied once to replace the existential sentence the new KB is not equivalent to the old but it is satisfiable iff the old KB was satisfiable

CIS Intro to AI 6 Reduction to propositional inference Suppose the KB contains just the following:  x King(x)  Greedy(x)  Evil(x) King(John) Greedy(John) Brother(Richard,John) Instantiating the universal sentence in all possible ways, we have: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) King(John) Greedy(John) Brother(Richard,John)  The new KB is propositionalized: proposition symbols are King(John), Greedy(John), Evil(John), King(Richard), etc.

CIS Intro to AI 7 Reduction contd.  Claim: Every FOL KB can be propositionalized so as to preserve entailment (A ground sentence is entailed by new KB iff entailed by original KB)  Proof argument: (see text)  Problem: with function symbols, there are infinitely many ground terms, e.g., Father(Father(Father(John)))

CIS Intro to AI 8 Reduction contd. Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositionalized KB Idea: For n = 0 to ∞ do create a propositional KB by instantiating with depth-n terms see if α is entailed by this KB Problem: works if α is entailed, loops if α is not entailed Theorem: Turing (1936), Church (1936) Entailment for FOL is semidecidable (algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every nonentailed sentence.)

CIS Intro to AI 9 Practical Problems with propositionalization 1.Propositionalization seems to generate lots of irrelevant sentences. E.g., from:  x King(x)  Greedy(x)  Evil(x) King(John)  y Greedy(y) Brother(Richard,John) it seems obvious that Evil(John), but propositionalization produces lots of facts such as Greedy(Richard) that are irrelevant 2.With p k-ary predicates and n constants, there are p·n k instantiations.  With function symbols, it gets much, much worse!

CIS Intro to AI 10 Unification  We can get the inference Evil(John) immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works  Unify(α,β) = θ if αθ = βθ 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)

CIS Intro to AI 11 Unification  We can get the inference Evil(John) immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works  Unify(α,β) = θ if αθ = βθ 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)

CIS Intro to AI 12 Unification  We can get the inference Evil(John) immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works  Unify(α,β) = θ if αθ = βθ 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)

CIS Intro to AI 13 Unification  We can get the inference Evil(John) immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works  Unify(α,β) = θ if αθ = βθ 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)

CIS Intro to AI 14 Unification  We can get the inference Evil(John) immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works  Unify(α,β) = θ if αθ = βθ 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

CIS Intro to AI 15 Unification  We can get the inference Evil(John) immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works  Unify(α,β) = θ if αθ = βθ 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  Standardizing apart eliminates overlap of variables, e.g., Knows(z 17,OJ)

CIS Intro to AI 16 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 }

CIS Intro to AI 17 The unification algorithm

CIS Intro to AI 18 The unification algorithm

CIS Intro to AI 19 Generalized Modus Ponens (GMP) p 1 ', p 2 ', …, p n ', ( p 1  p 2  …  p n  q) qθ p 1 ' is King(John) p 1 is King(x) p 2 ' is Greedy(y) p 2 is Greedy(x) θ is {x/John,y/John} q is Evil(x) q θ is Evil(John)  GMP used with KB of definite clauses (exactly one positive literal)  All variables assumed universally quantified where p i 'θ = p i θ for all i

CIS Intro to AI 20 Soundness of GMP Need to show that p 1 ', …, p n ', (p 1  …  p n  q) ╞ qθ provided that p i' θ = p i θ for all i Lemma: For any definite clause p, we have p ╞ pθ by UI 1.(p 1  …  p n  q) ╞ (p 1  …  p n  q)θ = (p 1 θ  …  p n θ  qθ) 2.p 1 ', …, p n ' ╞ p 1 '  …  p n ' ╞ p 1 'θ  …  p n 'θ 3.From 1 and 2, qθ follows by ordinary Modus Ponens

CIS Intro to AI 21 Resolution: brief summary  Full first-order version: l 1  ···  l k, m 1  ···  m n ( l 1  ···  l i-1  l i+1  ···  l k  m 1  ···  m j-1  m j+1  ···  m n )θ where Unify ( l i,  m j ) = θ. The two clauses are assumed to be standardized apart so that they share no variables.  For example,  Rich(x)  Unhappy(x) Rich(Ken) Unhappy(Ken) with θ = {x/Ken}  Apply resolution steps to CNF(KB   α); complete for FOL

CIS Intro to AI 22 Conversion to CNF for FOL  Everyone who loves all animals is loved by someone:  x [  y Animal(y)  Loves(x,y)]  [  y Loves(y,x)] 1.Eliminate biconditionals and implications  x [  y  Animal(y)  Loves(x,y)]  [  y Loves(y,x)] 2.Move  inwards:  x p ≡  x  p,   x p ≡  x  p  x [  y  (  Animal(y)  Loves(x,y))]  [  y Loves(y,x)]  x [  y  Animal(y)   Loves(x,y)]  [  y Loves(y,x)]  x [  y Animal(y)   Loves(x,y)]  [  y Loves(y,x)]

CIS Intro to AI 23 Conversion to CNF contd. 3.Standardize variables: each quantifier should use a different one  x [  y Animal(y)   Loves(x,y)]  [  z Loves(z,x)] 4.Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables:  x [Animal(F(x))   Loves(x,F(x))]  Loves(G(x),x) 5.Drop universal quantifiers: [Animal(F(x))   Loves(x,F(x))]  Loves(G(x),x) 6.Distribute  over  : [Animal(F(x))  Loves(G(x),x)]  [  Loves(x,F(x))  Loves(G(x),x)]

CIS Intro to AI 24 Example knowledge base  The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American.  Prove that Col. West is a criminal

CIS Intro to AI 25 Example knowledge base contd.... it is a crime for an American to sell weapons to hostile nations: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Nono … has some missiles, i.e.,  x Owns(Nono,x)  Missile(x): Owns(Nono,M 1 ) and Missile(M 1 ) … all of its missiles were sold to it by Colonel West Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missiles are weapons: Missile(x)  Weapon(x) An enemy of America counts as "hostile“: Enemy(x,America)  Hostile(x) West, who is American … American(West) The country Nono, an enemy of America … Enemy(Nono,America)

CIS Intro to AI 26 Resolution proof: definite clauses 

CIS Intro to AI 27 Example proof : Did Curiosity kill the cat?  Jack owns a dog. Every dog owner is an animal lover. No animal lover kills an animal. Either Jack or Curiosity killed the cat, who is named Tuna. Did Curiosity kill the cat?  The axioms can be represented as follows: A.(  x) Dog(x) ^ Owns(Jack,x) B.(  x) ((  y) Dog(y) ^ Owns(x, y)) => AnimalLover(x) C.(  x) AnimalLover(x) => (  y) Animal(y) => ~Kills(x,y) D.Kills(Jack,Tuna)  Kills(Curiosity,Tuna) E.Cat(Tuna) F.(  x) Cat(x) => Animal(x) (This and next 2 slides adapted from CMSC421 – Fall 2006, Univ. of Maryland)

CIS Intro to AI 28 Example: Did Curiosity kill the cat? 1.Dog(spike) 2.Owns(Jack,spike) 3.~Dog(y) v ~Owns(x, y) v AnimalLover(x) 4.~AnimalLover(x1) v ~Animal(y1) v ~Kills(x1,y1) 5. Kills(Jack,Tuna) v Kills(Curiosity,Tuna) 6. Cat(Tuna) 7. ~Cat(x2) v Animal(x2)

CIS Intro to AI 29 1.Dog(spike) 2.Owns(Jack,spike) 3.~Dog(y) v ~Owns(x, y) v AnimalLover(x) 4.~AnimalLover(x1) v ~Animal(y1) v ~Kills(x1,y1) 5. Kills(Jack,Tuna) v Kills(Curiosity,Tuna) 6. Cat(Tuna) 7. ~Cat(x2) v Animal(x2) 8.~Kills(Curiosity,Tuna) negated goal 9.Kills(Jack,Tuna) 5,8 10.~AnimalLover(Jack) V ~Animal(Tuna) 9,4 x1/Jack,y1/Tuna 11.~Dog(y) v ~Owns(Jack,y) V ~Animal(Tuna) 10,3 x/Jack 12.~Owns(Jack,spike) v ~Animal(Tuna) 11,1 13.~Animal(Tuna) 12,2 14.~Cat(Tuna) 13,7 x2/Tuna 15.False 14,6 Example: Did Curiosity kill the cat?