1 / 30

Resolution

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)

spike
Download Presentation

Resolution

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Resolution

  2. 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.

  3. 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)

  4. 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)

  5. 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.

  6. 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)

  7. 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.

  8. Inseado • Implications Out: j1 Þ j2 ® Øj1 Ú j2 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

  9. 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.

  10. 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}

  11. 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) ) x (lawyer(x)  rich(x)) 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)}

  12. 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)}

  13. 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.

  14. Resolution 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¬aand y¬b. The set {x¬a, y¬b}, which is a mapping from variables to constants is called a unifier. Propositional resolution was: {j1,..., j,..., jm} {y1,..., Øj,...,yn} {j1,..., jm,y1,..., yn} Similarly, relational resolution is: {j1,..., j,..., jm} {y1,..., Øy,..., yn} {j1,..., jm,y1,..., yn}s where s = mgu(j,y) mgu(j,y): Most General Unifier

  15. 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, xis to be replaced by a, • yis to be replaced by f(b), and • zis 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.

  16. 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 sto an expression jis 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)

  17. 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.

  18. 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 • cor dor f(c) or f(w) for y and v. • In fact, we can unify the expressions without changing vat all by simply replacing yby 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)}

  19. Recursive procedure for the mgu of two expressions(starting with a relation or function) Mgu (x,y) { if (x==y) return {}; if (Variable(x)) returnMguVar(x,y); if (Variable(y)) returnMguVar(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.

  20. 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) 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), 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))

  21. {r(v)} {p(a,b)} {p(x,y), q(x,y)} {q(z,w), r(z)} {q(a,b)} {q(v,w)} {p(z,w), r(z)} {p(v,w)} {} {p(v,w)} {r(a)} {r(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.

  22. {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 thefast. • When they meet, we move the fast at the top of the list and we move the slow one position down the list.

  23. 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.

  24. 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

  25. 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

  26. 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)}

  27. 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)}

  28. 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)}

  29. 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.

More Related