CPSC 433 Artificial Intelligence Unification & Resolution Examples Andrew Kuipers Please include [CPSC433] in the subject line.

Slides:



Advertisements
Similar presentations
Artificial Intelligence 8. The Resolution Method
Advertisements

Resolution Proof System for First Order Logic
Biointelligence Lab School of Computer Sci. & Eng.
Set Based Search Modeling Examples II
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 06 : First Order Logic Resolution Prove.
Standard Logical Equivalences
Resolution.
Artificial Intelligence University Politehnica of Bucharest Adina Magda Florea
First Order Logic Resolution
Resolution in Propositional and First-Order Logic.
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
CPSC 433 Artificial Intelligence And-Tree Search Modeling Example – Model Elimination CPSC 433 T01 & T02 Andrew Kuipers.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Logic seminar 5 The resolution principle Slobodan Petrović.
AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07
Inference and Resolution for Problem Solving
CSE (c) S. Tanimoto, 2007 Unification 1 Unification Predicate calculus rules are sometimes so general that we need to create specializations of.
CPSC 433 Artificial Intelligence CPSC 433 : Artificial Intelligence Tutorials T01 & T02 Andrew “M” Kuipers note: please include.
Logic Programming Part 2: Semantics James Cheney CS 411.
The Semantic Web – WEEK 8: An automatic Proof technique.. The “Layer Cake” Model – [From Rector & Horrocks Semantic Web cuurse] You are here!
Björn Pelzer (AGKI)E-KRHyper1/11 E-KRHyper A Hyper Tableau Theorem Prover with Equality Björn Pelzer
Advanced Topics in FOL Chapter 18 Language, Proof and Logic.
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.
Knowledge Representation IV Inference for First-Order Logic CSE 473.
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.
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,
CPSC 433 Artificial Intelligence Search Modeling Practice Problems M. Reza Zakerinasab Please include [CPSC433] in the subject line.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Resolution Strategies One common strategy for applying resolution is called level saturation. Here you try to resolve every pair of clauses from the original.
The AI War LISP and Prolog Basic Concepts of Logic Programming
Logic Programming and Prolog Goal: use formalism of first-order logic Output described by logical formula (theorem) Input described by set of formulae.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Procedural Semantics Soundness of SLD-Resolution.
1 Section 9.1 Automatic Reasoning Recall that a wff W is valid iff ¬ W is unsatisfiable. Resolution is an inference rule used to prove unsatisfiability.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
CSE (c) S. Tanimoto, 2008 Predicate Calculus II 1 Predicate Calculus 2 Outline: Unification: definitions, algorithm Formal interpretations and satisfiability.
1 Hojjat Ghaderi, University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Knowledge Representation IV ● Answer Extraction ● Factoring.
CPSC 433 Artificial Intelligence Set Based Search Modeling Examples Andrew Kuipers Please include [CPSC433] in the subject line.
1 Hojjat Ghaderi, University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Knowledge Representation III ● Required Readings: 9.1, 9.2,
CSE (c) S. Tanimoto, 2001 Logic Programming
ece 627 intelligent web: ontology and beyond
CSE 341, S. Tanimoto Logic Programming -
The Hebrew University of Jerusalem
The function of knowledge representation scheme is
Horn Clauses and Unification
Biointelligence Lab School of Computer Sci. & Eng.
Soundness of SLD-Resolution
Horn Clauses and Unification
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2004 Unification
CSE S. Tanimoto Unification
Horn Clauses and Unification
CPSC 433 : Artificial Intelligence Tutorials T01 & T02
CSE (c) S. Tanimoto, 2002 Unification
CSE (c) S. Tanimoto, 2004 Logic Programming
CSE (c) S. Tanimoto, 2002 Logic Programming
Horn Clauses and Unification
Warm Up 12/3/2018 Solve by substitution.
Chapter 4: Prolog (Substitution, Unification and Resolution)
Resolution in predicate Logic
Resolution Proof System for First Order Logic
Soundness of SLD-Resolution
Resolution Preliminaries
Presentation transcript:

CPSC 433 Artificial Intelligence Unification & Resolution Examples Andrew Kuipers Please include [CPSC433] in the subject line of any s regarding this course.

CPSC 433 Artificial Intelligence Unification – A Quick Review Unification is needed to compute mgu (most general unifier) Yet another set-based search problem: States: set of term equations u  v, with  indicating failure Transitions: Extension Rules to generate new term equations Goal condition: all equations in the state have form x  t and Occurcheck and Substitute are not applicable

CPSC 433 Artificial Intelligence Unification – A Quick Review Delete:E  {t  t} E Decompose:E  {f(t 1,…,t n )  f(s 1,…,s n )} E  {t 1  s 1,…,t n  s n } Orient:E  {t  x} (if t not a var) E  {x  t}

CPSC 433 Artificial Intelligence Unification – A Quick Review Substitute:E  {x  t, t'  s'} E  {x  t, t'[x  t]  s'[x  t]} Occurcheck:E  {x  t}  Clash:E  {f(t 1,…,t n )  g(s 1,…,s n )}  if x not in t s[x  t] : replace all x’s in s with t if x in t if f  g

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) )

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { f(g(x, y), c) ≈ f(g(f(d, x), z), c) }

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { f(g(x, y), c) ≈ f(g(f(d, x), z), c) } 1.Decompose E  {f(t 1,…,t n )  f(s 1,…,s n )} E  {t 1  s 1,…,t n  s n } E = { g(x, y) ≈ g(f(d,x),z), c ≈ c }

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { g(x, y) ≈ g(f(d,x),z), c ≈ c }

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { g(x, y) ≈ g(f(d,x),z), c ≈ c } 2. Delete E  {t  t} E E = { g(x, y) ≈ g(f(d,x),z) }

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { g(x, y) ≈ g(f(d,x),z) }

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { g(x, y) ≈ g(f(d,x),z) } 3. Decompose E  {f(t 1,…,t n )  f(s 1,…,s n )} E  {t 1  s 1,…,t n  s n } E = { x ≈ f(d, x), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { x ≈ f(d, x), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 1: mgu( f(g(x,y),c), f(g(f(d,x),z),c) ) E = { x ≈ f(d, x), y ≈ z } 4. OccurcheckE  {x  t} if x in t  E = , f(g(x,y), c) and f(g(f(d,x),z),c) not unifiable

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) )

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { h(c,d,g(x,y)) ≈ h(z,d,g(g(a,y),z)) }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { h(c,d,g(x,y)) ≈ h(z,d,g(g(a,y),z)) } 1. Decompose E  {f(t 1,…,t n )  f(s 1,…,s n )} E  {t 1  s 1,…,t n  s n } E = { c ≈ z, d ≈ d, g(x, y) ≈ g(g(a, y), z) }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, d ≈ d, g(x, y) ≈ g(g(a, y), z) }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, d ≈ d, g(x, y) ≈ g(g(a, y), z) } 2. Delete E  {t  t} E E = { c ≈ z, g(x, y) ≈ g(g(a, y), z) }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, g(x, y) ≈ g(g(a, y), z) }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, g(x, y) ≈ g(g(a, y), z) } 3. Decompose E  {f(t 1,…,t n )  f(s 1,…,s n )} E  {t 1  s 1,…,t n  s n } E = { c ≈ z, x ≈ g(a, y), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, x ≈ g(a, y), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, x ≈ g(a, y), y ≈ z } 4. Substitute E  {x  t, t'  s'} E  {x  t, t'[x  t]  s'[x  t]} E = { c ≈ z, x ≈ g(a, z), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, x ≈ g(a, z), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { c ≈ z, x ≈ g(a, z), y ≈ z } 5. Orient E  {t  x} E  {x  t} E = { z ≈ c, x ≈ g(a, z), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { z ≈ c, x ≈ g(a, z), y ≈ z }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { z ≈ c, x ≈ g(a, z), y ≈ z } 6. Substitute E  {x  t, t'  s'} E  {x  t, t'[x  t]  s'[x  t]} E = { z ≈ c, x ≈ g(a, c), y ≈ c }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { z ≈ c, x ≈ g(a, c), y ≈ c }

CPSC 433 Artificial Intelligence Unification Example 2: mgu( h(c,d,g(x,y)), h(z,d,g(g(a,y),z)) ) E = { z ≈ c, x ≈ g(a, c), y ≈ c } No more applicable extensions!

CPSC 433 Artificial Intelligence Resolution – A Quick Review Used to prove a consequence from a set of logical formulae States: Sets of clauses L 1 (t 11,…,t 1,n1 )  …  L m (t m1,…,t m,nm ) - L i is a predicate symbol or its negation, - t ij terms out of function symbols and variables (x,y…) - variables in different clauses are disjunct Initially: The consequence we want to prove is negated and added to the set of clauses representing the initial state Goal: Derive the empty clause (  ), ie: reductio ad absurdum

CPSC 433 Artificial Intelligence Resolution – A Quick Review Transitions: New clauses generated by Resolution or Factorization Resolution:C  P, D   P’  (C  D) Factorization: C  P  P'  (C  P) Note: clauses are commutative: p  q  q  p, p  q  r same as r  p  q where  = mgu(P,P’)

CPSC 433 Artificial Intelligence Resolution Example 3: 1.¬P(x)  P(f(x)) 2.¬Q(a, y)  ¬R(y, x)  P(x) 3.R(b, g(a, z)) 4.Q(a, b) Goal: P(f(g(a, c)))

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b)

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c)))

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c)))

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) ¬Q(a, y)  ¬R(y, x)  P(x), Q(a, b) ¬R(b, x)  P(x) σ = { y ≈ b }

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) ¬Q(a, y)  ¬R(y, x)  P(x), Q(a, b) ¬R(b, x)  P(x) σ = { y ≈ b }

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x)

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) ¬R(b, x)  P(x), R(b, g(a, z)) P(g(a, z)) σ = { x ≈ g(a,z) }

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) 7. P(g(a, z)) ¬R(b, x)  P(x), R(b, g(a, z)) P(g(a, z)) σ = { x ≈ g(a,z) }

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) Resolve (7) and (1) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) 7. P(g(a, z))

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) Resolve (7) and (1) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) 7. P(g(a, z)) P(g(a, z)), ¬P(x)  P(f(x)) P(f(g(a,z))) σ = { x ≈ g(a,z) }

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) Resolve (7) and (1) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) 7. P(g(a, z)) 8. P(f(g(a, z))) P(g(a, z)), ¬P(x)  P(f(x)) P(f(g(a,z))) σ = { x ≈ g(a,z) }

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) Resolve (7) and (1) Resolve (8) and (5) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) 7. P(g(a, z)) 8. P(f(g(a, z)))

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) Resolve (7) and (1) Resolve (8) and (5) 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) 7. P(g(a, z)) 8. P(f(g(a, z))) P(f(g(a, z))), ¬P(f(g(a, c))) □ σ = { z ≈ c }

CPSC 433 Artificial Intelligence Resolution Example 3: Negate goal, add to folmulas Resolve (4) and (2) Resolve (6) and (3) Resolve (7) and (1) Resolve (8) and (5) Search complete, goal proved 1. ¬P(x)  P(f(x)) 2. ¬Q(a, y)  ¬R(y, x)  P(x) 3. R(b, g(a, z)) 4. Q(a, b) 5. ¬P(f(g(a, c))) 6. ¬R(b, x)  P(x) 7. P(g(a, z)) 8. P(f(g(a, z))) 9. □