Resolution.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Artificial Intelligence 8. The Resolution Method
Resolution Proof System for First Order Logic
First-Order Logic.
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
SLD-resolution Introduction Most general unifiers SLD-resolution
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
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.
Standard Logical Equivalences
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.
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.
Predicate Calculus Russell and Norvig: Chapter 8,9.
RESOLUTION: A COMPLETE INFERENCE PROCEDURE. I Then we certainly want to be able to conclude S(A); S(A) is true if S(A) or R(A) is true, and one of those.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
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.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
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.
Logic in Computer Science Transparency No Chapter 3 Propositional Logic 3.6. Propositional Resolution.
Inference and Resolution for Problem Solving
Chapter 3 Propositional Logic
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.
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
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.
For Wednesday Read chapter 10 Prolog Handout 4. Exam 1 Monday Take home due at the exam.
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.
Marriage Problem Your the sovereign in a small kingdom. One of your jobs is to marry off the people in kingdom. There are three rules that apply.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
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.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
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 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.
第 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.
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
Resolution Preliminaries Computational LogicLecture 9 By Prof. Michael Genesereth, Computer Science, Stanford Univ Spring 2005 Modified by Charles Ling.
1 Hojjat Ghaderi, University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Knowledge Representation III ● Required Readings: 9.1, 9.2,
1 Introduction to Artificial Intelligence LECTURE 9: Resolution in FOL Theorem Proving in First Order Logic Unification Resolution.
Propositional Logic. Assignment Write any five rules each from two games which you like by using propositional logic notations.
Introduction to Logic for Artificial Intelligence Lecture 2
Horn Clauses and Unification
Horn Clauses and Unification
Prolog IV Logic, condensed.
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
RESOLUTION.
Resolution Proof System for First Order Logic
Resolution Preliminaries
Presentation transcript:

Resolution

An example John is a lawyer. Lawyers are rich. Rich people have big houses. Big houses are a lot of work. We would like to conclude that John’s house is a lot of work. Natural languages are ambiguous so we can have different axiomatizations.

Axiomatization 1 lawyer(john) x lawyer(x)  rich(x) x rich(x)  y house(x,y) x,y rich(x)  house(x,y)  big(y) x,y ( house(x,y)  big(y)  work(y) ) 3 and 4, say that rich people do have at least one house and all their houses are big. Conclusion we want to show: house(john, jhouse)  work(john, jhouse) Or, do we want to conclude that John has at least one house that needs a lot of work? I.e. y house(john,y)  work(y)

Axiomatization 2 lawyer(john) x lawyer(x)  rich(x) x rich(x)  y house(x,y)  big(y) x,y ( house(x,y)  big(y)  work(y) ) Now, 3 says that rich people have at least one house which is big. Conclusion we want to show: house(john, jhouse)  work(john, jhouse) Well, this is not anymore a conclusion we can or want to derive! So, now we want to conclude that John has at least one house that needs a lot of work? I.e. y house(john,y)  work(y)

Let’s fix axiomatization 1… lawyer(john) x lawyer(x)  rich(x) x rich(x)  y house(x,y) x,y rich(x)  house(x,y)  big(y) x,y ( house(x,y)  big(y)  work(y) ) Conclusion we want to show: John has at least one house that needs a lot of work. I.e. y house(john,y)  work(y) Think about sentence 3. It says that every rich person x, has a house; which house? The one that belongs to him, I.e. let’s name it: houseof(x). Now, 3 can be rewritten as x rich(x)  house(x, houseof(x)) This is called skolemization.

Universal quantifiers Since universal quantifiers appear so often, it is common simply to omit them, using the convention that any variable not associated with a quantifier is implicitly universally quantified. So, the premises become: lawyer(john) lawyer(x)  rich(x) rich(x)  house(x, houseof(x)) rich(x)  house(x,y)  big(y) house(x,y)  big(y)  work(y)

Clausal Form A literal is either an atomic sentence or a negation of an atomic sentence. A clausal sentence is either a literal or a disjunction of literals. A clause is a set of literals. {p(a)} {Øp(a)} {p(a), q(b)} The empty clause {} is unsatisfiable. Before applying resolution we want to convert the sentences into clausal form.

Inseado Implications Out: Negations In: j1 Þ j2 ® Øj1 Ú j2 j1 Û j2 ® (Øj1 Ú j2 ) Ù (j1 Ú Øj2 ) Negations In: ØØj ® j Ø(j1 Ù j2 ) ® Øj1 Ú Øj2 Ø(j1 Ú j2 ) ® Øj1 Ù Øj2 Ø"n.j ® $n.Øj Ø$n.j ® "n.Øj

Inseado (continued) Standardize variables (I.e. renaming) "x.p(x) Ú "x.q(x) ® "x.p(x) Ú "y.q(y) The scope of quantifiers determines the scope of variables. So, in order to avoid name conflicts we rename the variables. Existentials Out $x.p(x) ® p(a) "xy.(p(x) Ù $z.q(x, y, z)) ® "xy.(p(x) Ù q(x, y, f (x, y))) This is called skolemization. Recall example with lawyers. When the existentially quantified variable is not in the scope of any universally quantified variable, we just replace it with an object constant (name doesn’t matter). See first case.

Inseado (concluded) Alls Out "x.( p(x) Ù q(x, y, f (x, y))) ® p(x) Ù q(x, y, f (x, y)) Distribution j1 Ú (j2 Ù j3) ® (j1 Ú j2) Ù (j1 Ú j3) (j1 Ù j2) Ú j3 ® (j1 Ú j3) Ù (j2 Ú j3) Operators out j1 Ù... Ùjn ® j1 ... jn j1 Ú... Újn ® {j1,..., jn}

Example x (rich(x)  y house(x,y)) I x (rich(x)  y house(x,y)) N x (rich(x)  y house(x,y)) S x (rich(x)  y house(x,y)) E x (rich(x)  house(x,houseof(x)) A rich(x)  house(x,houseof(x)) D rich(x)  house(x,houseof(x)) O {rich(x), house(x,houseof(x))} x,y (rich(x)  house(x,y)  big(y)) I x,y ((rich(x)  house(x,y))  big(y)) N x,y (rich(x)  house(x,y)  big(y)) S x,y (rich(x)  house(x,y)  big(y)) E x,y (rich(x)  house(x,y)  big(y)) A rich(x)  house(x,y)  big(y) D rich(x)  house(x,y)  big(y) O {rich(x), house(x,y), big(y)} {lawyer(john)} x (lawyer(x)  rich(x)) x (rich(x)  y house(x,y)) x,y (rich(x)  house(x,y)  big(y)) x,y ( house(x,y)  big(y)  work(y) ) I x (lawyer(x)  rich(x)) N x (lawyer(x)  rich(x)) S x (lawyer(x)  rich(x)) E x (lawyer(x)  rich(x)) A lawyer(x)  rich(x) D lawyer(x)  rich(x) O {lawyer(x), rich(x)}

Example (continued) x,y ( house(x,y)  big(y)  work(y) ) I x,y ((house(x,y)  big(y))  work(y) ) N x,y (house(x,y)  big(y)  work(y) ) S x,y (house(x,y)  big(y)  work(y) ) E x,y (house(x,y)  big(y)  work(y) ) A house(x,y)  big(y)  work(y) D house(x,y)  big(y)  work(y) O {house(x,y), big(y), work(y)} Negated conclusion: y (house(john,y)  work(y)) I y (house(john,y)  work(y)) N y (house(john,y)  work(y)) S y (house(john,y)  work(y)) E y (house(john,y)  work(y)) A house(john,y)  work(y) D house(john,y)  work(y) O {house(john,y), work(y)}

Example (concluded) Here are all the clauses we got through INSEADO from the premises and the negated conclusion. {lawyer(john)} {lawyer(x1), rich(x1)} {rich(x2), house(x2,houseof(x2))} {rich(x3), house(x3,y1), big(y1)} {house(x4,y2), big(y2), work(y2)} {house(john,y3), work(y3)} Note: We rename the variables, in order to not have variable name clashes between clauses.

Resolution Propositional resolution was: Example. {j1,..., j,..., jm} {y1,..., Øj,...,yn} {j1,..., jm,y1,..., yn} Similarly, relational resolution is: {y1,..., Øy,..., yn} {j1,..., jm,y1,..., yn}s where s = mgu(j,y) mgu(j,y): Most General Unifier Example. { p(a, y),r(y)} {Øp(x,b)} {r(y)} {x¬a, y¬b} {r(b)} We are unifying (or making the same) p(a, y) with p(x,b). So, what we should do? Make x¬a and y¬b. The set {x¬a, y¬b}, which is a mapping from variables to constants is called a unifier.

Unification Unification is the process of determining whether two expressions can be made identical by the appropriate substitutions for their variables. A substitution is a finite mapping of variables to terms. We write substitutions as sets of replacement rules, e.g.: {x¬ a,y¬ f (b),z ¬v} In each rule, the variable to which the arrow is pointing to is to be replaced by the term from which the arrow is pointing. In this case, x is to be replaced by a, y is to be replaced by f(b), and z is to be replaced by v. The variables being replaced constitute the domain of the substitution, and the terms replacing them constitute the range. In the example above: domain is {x, y, z}, and range is {a, b, v}. The variables in the domain are called bound. The terms in the range are called variable bindings.

A substitution is pure when all replacement terms in the range are free of the variables in the domain of the substitution. Otherwise, the substitution is impure. The substitution shown above is pure whereas the one shown below is impure. {x¬ a,y¬ f (b),z ¬ x} The result of applying a substitution s to an expression j is the expression js obtained from the original expression by replacing every occurrence of every variable in the domain of the substitution by the term with which it is associated. Examples: q(x, y) {x¬ a, y¬ f (b), z¬ v} = q(a, f (b)) q(x, x) {x¬ a, y¬ f (b), z¬ v} = q(a,a) q(x,w) {x¬ a, y¬ f (b), z¬ v} = q(a,w) q(z,v) {x¬ a, y¬ f (b), z¬ v} = q(v,v)

If no bound variable of a pure substitution  occurs in another pure substitution , then we can compose  with , obtaining so a new substitution  which is also pure. We do the composition by applying  at the bindings of , and then adding remaining bindings from . E.g. {w¬g(x,y)} {x¬a, y¬b, z¬c} = {w¬g(a,b), x¬a, y¬b, z¬c} A set of expressions {1, …, n} is unifiable if and only if there is a substitution  that makes the expressions identical; I.e. 1 = …= n  is said to be a unifer for the set. E.g. {x¬a, y¬b, z¬c} unifies the expressions p(a,y,z) and p(x,b,z): p(a,y,z) {x¬a, y¬b, z¬c} = p(a,b,c) = P(x,b,z) {x¬a, y¬b, z¬c} The above is not the only unifier. We can say for z, z¬w or z¬c. Well, the z¬w is more “general” than z¬c, because w is variable, which can bounded later to any other variable or constant, while c as constant can’t be bounded to anything at all.

Formally: We say that a substitution  is more general than a unifier  if there exists a substitution  such that  = . A most general unifier (mgu)  has the property that any other unifier  can be obtained from  by some substitution:  = . The mgu is unique up to variable renaming. Example. p(x,y) and p(a,v) are unifiable because they have a unifier, e.g. {x¬a,y¬b,v¬b} The results of applying this substitution to the two expressions are: p(x, y) {x ¬ a, y¬ b,v¬ b} = p(a,b) p(a,v) {x¬ a,y ¬b,v¬ b} = p(a,b) We could have substituted c or d or f(c) or f(w) for y and v. In fact, we can unify the expressions without changing v at all by simply replacing y by v. So, the substitution {x¬a,y¬v} is more general than {x¬a,y¬f(c),v¬f(c)} since there is a substitution {v¬f(c)} that, when applied to the former, gives the latter: {x¬ a,y¬ v} {v¬ f (c)}= {x ¬a, y¬ f (c),v¬ f (c)}

Recursive procedure for the mgu of two expressions(starting with a relation or function) Mgu (x,y) { if (x==y) return {}; if (Variable(x)) return MguVar(x,y); if (Variable(y)) return MguVar(y,x); if (Constant(x) || Constant(y)) exit(“Non unifiable”); if (Length(x) != Length(y)) exit(“Non unifiable”);; i = 0; g = {}; while (TRUE) { if (i==Length(x)) return g; s = Mgu (Part(x,i), Part(y,i)); g = Compose(g,s); x = Substitute(x,g); y = Substitute(y,g); i = i + 1; } MguVar (x,y) { if (x occurs in y) exit(“Non unifiable”); return {xy}; Well, this is for the computer…In doing examples by hand, we can easily find the mgu by looking. Variable(x) returns TRUE is x is variable. Length(x) for x e.g. x=F(A,G(y)) returns the number of arguments, I.e. 2. Part(i) returns the i-th part. E.g. Part(F(A,G(y)), 0) = F Part(F(A,G(y)), 1) = A Part(F(A,G(y)), 2) = G(y) Compose(g,s) is self-explanatory. Substitute(x,g) is self-explanatory.

Unification example E1: p(x, g(y,y), x) with E2: p(g(a,z), v, v) p==p -- part 0 Now try to unify x with g(a,z) -- part 1 xg(a,z) Now apply this substitution to both E1 and E2 E1: p(g(a,z), g(y,y), g(a,z)) E2: p(g(a,z), v, v) Now try to unify g(y,y) with v -- part 2 vg(y,y) E1: p(g(a,z), g(y,y), g(a,z)) E2: p(g(a,z), g(y,y), g(y,y)) Now try to unify g(a,z) with g(y,y) -- part 3 Recursively, we find ya and za. Finally, {xg(a,a), ya, za, vg(a,a)} E1: p(g(a,a), g(a,a), g(a,a)) E2: p(g(a,a), g(a,a), g(a,a))

Example. {p(a,b)}  {p(x,y), q(x,y)}  {q(z,w), r(z)}  {r(v)}  {q(a,b)} 1,2 {q(v,w)} 3,4 {} 5,6 When the {} conclusion is derived we have a contradiction. It is useful in proving things by refutation, I.e. assuming that what we want to prove is not true… There are other possible conclusions that can be derived from the same premises. In the following graph there are the possible conclusions. {p(a,b)} {p(x,y), q(x,y)} {q(z,w), r(z)} {r(v)} {q(a,b)} {p(z,w), r(z)} {q(v,w)} {r(a)} {} {p(v,w)}

{p(a,b)}  {p(x,y), q(x,y)}  {q(z,w), r(z)}  {r(v)}  {q(a,b)} 1,2 {p(z,w), r(z)} 2,3 {q(v,w)} 3,4 {r(a)} 3,5 {r(a)} 1,6 {p(v,w)} 4,6 {p(v,w)} 2,7 {} 1,10 We keep two pointers (the slow and the fast); On each step we compare the sentences under the pointers. If we can resolve, we add the new derived sentence at the end of the list. At the start of the inference we initialize slow and fast at the top of the list. As long as the two pointers point to different positions, we leave the slow where it is and advance the fast. When they meet, we move the fast at the top of the list and we move the slow one position down the list.

Lawyer’s example {lawyer(john)} {lawyer(x1), rich(x1)} {rich(x2), house(x2,houseof(x2))} {rich(x3), house(x3,y1), big(y1)} {house(x4,y2), big(y2), work(y2)} {house(john,y3), work(y3)} {rich(john)} 1,2 mgu = {x1john} {lawyer(x2), house(x2,houseof(x2))} 2,3 mgu = {x1x2} {lawyer(x2), house(x3,y1), big(y1)} 2,4 {rich(x3), big(houseof(x3))} 3,4 {rich(x2), big(houseof(x2)), work(houseof(x2))} 3,5 {…} 4,5 {…} 3,6 {…} 5,6 … you can continue with the two finger method…but it’s too long.

Lawyer’s example in short… {lawyer(john)} {lawyer(x1), rich(x1)} {rich(x2), house(x2,houseof(x2))} {rich(x3), house(x3,y1), big(y1)} {house(x4,y2), big(y2), work(y2)} {house(john,y3), work(y3)} {rich(john)} 1,2 {rich(john), work(houseof(john))} 3,6 {work(houseof(john))} 7,8 {house(john,houseof(john))} 3,7 {house(john,y1), big(y1)} 4,7 {big(houseof(john))} 10,11 {house(x4, houseof(john)), work(houseof(john))} 5,12 {work(houseof(john))} 10,13 {} 9,14

Curiosity and the cat Everyone who loves all animals is loved by someone. Anyone who kills an animal is loved by no one. Jack loves all animals. Either Jack or Curiosity killed the cat, who is named Tuna. Did Curiosity kill the cat? x [y animal(y)  loves(x,y)]  [y loves(y,x)] x [y animal(y)  kills(x,y)]  [z loves(z,x)] y animal(y)  loves(jack,y) kills(jack,tuna)  kills(curiosity,tuna) x cat(x)  animal(x) kills(curiosity,tuna) negated goal

Curiosity – Inseado (1) x [y (animal(y)  loves(x,y))]  [y loves(y,x)] I x [y (animal(y)  loves(x,y))]  [y loves(y,x)] N x [y (animal(y)  loves(x,y))]  [y loves(y,x)] x [y (animal(y)  loves(x,y))]  [y loves(y,x)] S x [y (animal(y)  loves(x,y))]  [z loves(z,x)] E x [animal(f(x))  loves(x,f(x))]  [loves(g(x),x)] A [animal(f(x))  loves(x,f(x))]  [loves(g(x),x)] D [animal(f(x))  loves(g(x),x) ]  [loves(x,f(x))  loves(g(x),x)] O {animal(f(x)), loves(g(x),x)} {loves(x,f(x)), loves(g(x),x)}

Curiosity – Inseado (2) x [y animal(y)  kills(x,y)]  [z loves(z,x)] I x [y animal(y)  kills(x,y)]  [z loves(z,x)] N x [y animal(y)  kills(x,y)]  [z loves(z,x)] S x [y animal(y)  kills(x,y)]  [z loves(z,x)] E x [y animal(y)  kills(x,y)]  [z loves(z,x)] A animal(y)  kills(x,y)  loves(z,x) D animal(y)  kills(x,y)  loves(z,x) O {animal(y), kills(x,y), loves(z,x)}

Curiosity – Inseado (3-5) y animal(y)  loves(jack,y) INSE y animal(y)  loves(jack,y) AD animal(y)  loves(jack,y) O {animal(y), loves(jack,y)} kills(jack,tuna)  kills(curiosity,tuna) INSEADO {kills(jack,tuna), kills(curiosity,tuna)} x cat(x)  animal(x) INSE x cat(x)  animal(x) AD cat(x)  animal(x) O {cat(x), animal(x)}

Clausal Curiosity {animal(f(x1)), loves(g(x1),x1)} {loves(x2,f(x2)), loves(g(x2),x2)} {animal(y1), kills(x3,y1), loves(z,x3)} {animal(y2), loves(jack,y2)} {kills(jack,tuna), kills(curiosity,tuna)} {cat(x4), animal(x4)} kills(curiosity,tuna) Note: We rename the variables, in order to not have variable name clashes between clauses.