1ApplicationsComputational Logic Lecture 11Michael Genesereth Spring 20052PlanFirst Lecture:Pattern MatchingUnificationSecond Lecture:Relational Clausal FormResolution PrincipleResolution Theorem ProvingThird Lecture:True or False QuestionsFill in the Blank QuestionsResidueFourth Lecture:Strategies to enhance efficiency23Determining Logical EntailmentTo determine whether a set Δ of sentences logically entails aclosed sentence ϕ, rewrite Δ∪{¬ϕ} in clausal form and try toderive the empty clause.4ExampleShow that (p(x) ⇒ q(x)) and p(a) logically entail ∃z.q(z).1. {¬p(x), q(x)} Premise2. {p(a)} Premise3. {¬q(z)} Goal4. {¬p(z)} 1, 35. {} 2, 435Alternate MethodBasic Method: To determine whether a set Δ of sentenceslogically entails a closed sentence ϕ, rewrite Δ∪{¬ϕ} inclausal form and try to derive the empty clause.Alternate Method: To determine whether a set Δ of sentenceslogically entails a closed sentence ϕ , rewrite Δ∪{ϕ ⇒ goal}in clausal form and try to derive goal.Intuition: The sentence (ϕ ⇒ goal) is equivalent to thesentence (¬ϕ ∨ goal).6ExampleShow that (p(x) ⇒ q(x)) and p(a) logically entail ∃z.q(z).1. {¬p(x), q(x)} p(x) ⇒ q(x)2. {p(a)} p(a)3. {¬q(z), goal} ∃z. q(z) ⇒ goal4. {¬p(z), goal} 1, 35. {goal} 2, 447Answer Extraction MethodAlternate Method for Determining Logical Entailment: Todetermine whether a set Δ of sentences logically entails aclosed sentence ϕ , rewrite Δ∪{ϕ ⇒ goal} in clausal form andtry to derive goal.Method for Answer Extraction: To get values for freevariables ν1,…,νn in ϕ for which Δ logically entails ϕ, rewriteΔ∪{ϕ ⇒ goal(ν1,…,νn)} in clausal form and try to derivegoal(ν1,…,νn).Intuition: The sentence (q(z) ⇒ goal(z)) says that, whenever, zsatisfies q, it satisfies the “goal”.8ExampleGiven (p(x) ⇒ q(x)) and p(a), find a term τ such that q(τ) istrue.1. {¬p(x), q(x)} p(x) ⇒ q(x)2. {p(a)} p(a)3. {¬q(z), goal(z)} q(z) ⇒ goal(z)4. {¬p(z), goal(z)} 1, 35. {goal(a)} 2, 459ExampleGiven (p(x) ⇒ q(x)) and p(a) and p(b), find a term τ such thatq(τ) is true.1. {¬p(x), q(x)} p(x) ⇒ q(x)2. {p(a)} p(a)3. {p(b)} p(b)4. {¬q(z), goal(z)} q(z) ⇒ goal(z)5. {¬p(z), goal(z)} 1,36. {goal(a)} 2, 57. {goal(b)} 3,510ExampleGiven (p(x) ⇒ q(x)) and (p(a) ∨ p(b)), find a term τ such thatq(τ) is true.1. {¬p(x), q(x)} p(x) ⇒ q(x)2. {p(a), p(b)} p(a) ∨ p(b)3. {¬q(z), goal(z)} q(z) ⇒ goal(z)4. {¬p(z), goal(z)} 1,35. {p(b), goal(a)} 2, 46. {goal(a), goal(b)} 4, 5611KinshipArt is the parent of Bob and Bud.Bob is the parent of Cal and Coe.A grandparent is a parent of a parent.p(art,bob)p(art,bud)p(bob, cal)p(bob, coe)p(x, y) ∧ p(y, z) ⇒ g(x, z)12Is Art the Grandparent of Coe?1. {p(art, bob)} p(art, bob)2. {p(art, bud)} p(art, bud)3. {p(bob, cal)} p(bob, cal)4. {p(bob, coe)} p(bob, coe)5. {¬p(x, y), ¬p(y, z), g(x, z)} p(x, y) ∧ p(y, z) ⇒ g(x,z)6. {¬g(art, coe), goal} g(art, coe) ⇒ goal7. {¬p(art, y), ¬p(y, coe), goal} 5,68. {¬p(bob, coe), goal} 1, 79. {goal} 4, 8713Who is the Grandparent of Coe?1. {p(art, bob)} p(art,bob)2. {p(art, bud)} p(art,bud)3. {p(bob, cal )} p(bob, cal)4. {p(bob, coe)} p(bob, coe)5. {¬p(x, y), ¬p(y, z), g(x, z)} p(x, y) ∧ p(y, z) ⇒ g(x, z)6. {¬g(x, coe), goal(x)} g(x, coe) ⇒ goal(x)7. {¬p(x, y), ¬p(y,coe), goal(x)} 5,68. {¬p(bob, coe), goal(art)} 1,79. {goal(art)} 4,814Who Are the Grandchildren of Art?1. {p(art,bob)} p(art,bob)2. {p(art,bud)} p(art,bud)3. {p(bob, cal)} p(bob, cal)4. {p(bob, coe)} p(bob, coe)5. {¬p(x, y), ¬p(y, z), g(x, z)} p(x, y) ∧ p(y, z) ⇒ g(x, z)6. {¬g(art, z), goal(z)} g(art, z) ⇒ goal(z)7. {¬p(art, y), ¬p(y, z), goal(z)} 5,68. {¬p(bob, z), goal(z)} 1,79. {¬p(bud, z), goal(z)} 2, 710. {goal(cal )} 3,811. {goal(coe)} 4, 8815People and their Grandchildren?1. {p(art,bob)} p(art, bob)2. {p(art,bud)} p(art, bud)3. {p(bob, cal)} p(bob, cal)4. {p(bob, coe)} p(bob, coe)5. {¬p(x, y), ¬p(y, z), g(x, z)} p(x, y) ∧ p(y, z) ⇒ g(x, z)6. {¬g(x,z), goal(x, z)} g(x, z) ⇒ goal(x, z)7. {¬p(x, y), ¬p(y, z), goal(x, z)} 5,68. {¬p(bob, z), goal(art, z)} 1, 79. {¬p(bud, z), goal(art, z)} 2, 710. {goal(art, cal )} 3,811. {goal(art, coe)} 4,816Map Coloring ProblemColor the map with the 4 colors red, green, blue, and purpleColor the map with the 4 colors red, green, blue, and purplesuch that no two regions have the same color.such that no two regions have the same color.134526917Acceptable Neighborsn(red, green) n(blue,red)n(red, blue) n(blue, green)n(red, purple) n(blue, purple)n(green, red) n( purple, red)n(green, blue) n( purple, blue)n(green, purple) n( purple, green)18Question134526n(x1, x2) ∧ n(x1, x3) ∧ n(x1, x5) ∧ n(x1, x6)∧ n(x2, x3) ∧ n(x2, x4) ∧ n(x2, x5) ∧ n(x2, x6)∧ n(x3, x4) ∧ n(x3, x6) ∧ n(x5, x6)⇒ goal(x1, x2, x3, x4, x5, x6)1019ResidueProblem: Given the database shown below, find conditionsunder which s(a) is true expressed in terms of m, n, and o.p(x) ∧ q(x) ⇒ s(x)m(x) ⇒ p(x)n(x) ⇒ q(x)o(x) ⇒ r(x)Residue:m(a) ∧ n(a)In other words:m(a) ∧ n(a) ⇒ s(a)20MethodTo obtain the residue for ϕ given Δ in terms of ρ1,...,ρn,rewrite Δ∪{¬ϕ} in clausal form and try to derive a clause withconstants restricted to ρ1,...,ρn. The residue is the negation ofany clause so derived.1121Example€ 1. {¬p(x),¬q(x),s(x)} p(x)∧ q(x) ⇒ s(x)2. {¬m(x), p(x)} m(x) ⇒ p(x)3. {¬n(x),q(x)} n(x) ⇒ q(x)4. {¬o(x),r(x)} o(x) ⇒ r(x)5. {¬s(a)} ¬s(a)6. {¬p(a),¬q(a)} 1,57. {¬m(a),¬q(a)} 2,68.* {¬m(a),¬n(a)} 3, 722Multiple Residues1. {¬p(x), ¬q(x), s(x)} p(x) ∧ q(x) ⇒ s(x)2. {¬r(x), s(x)} r(x) ⇒ s(x)3. {¬m(x), p(x)} m(x) ⇒ p(x)4. {¬n(x), q(x)} n(x) ⇒ q(x)5. {¬o(x), r(x)} o(x) ⇒ r(x)6. {¬s(x)} ¬s(x)7. {¬p(x), ¬q(x)} 1, 68. {¬m(x), ¬q(x)} 3, 79. * {¬m(x), ¬n(x)} 4, 810.* {¬r(x)} 2, 61223Databasespart bobart budamy bobamy budbob calbob coebea calbea coemaleartbobbudcalfemaleamybeacoe24Databases as Ground Atomic Sentencesp(art,bob)p(art,bud)p(amy, bob)p(amy, bud)p(bob, cal)p(bob, coe)p(bea,cal)p(bea,coe)art bobart budamy bobamy budbob calbob coebea calbea coe1325Database ViewsFather: p(x,y) ∧ male(x) ⇒ f(x,y)Mother: p(x,y) ∧ female(x) ⇒ m(x,y)Grandfather: f(x,y) ∧ p(y,z) ⇒ gf(x,z)Grandmother: m(x,y) ∧ p(y,z) ⇒ gm(x,z)26Database Query PlanningQuery: gf(u,v)Tables: male, female, p.Reformulated Query: p(u,y) ∧ male(u) ∧ p(y,v)1. {¬p(x, y), ¬male(x), f (x, y)} p(x, y) ∧ male(x) ⇒ f
View Full Document