Solution Question 1: Assuming predicates Parent p, q and Femalep and constants Joan and Kevin, with the obvious meanings, express each of the following sentences in first-order logic.. J
Trang 1Solution
Question 1:
Assuming predicates Parent (p, q) and Female(p) and constants Joan and Kevin, with the obvious
meanings, express each of the following sentences in first-order logic (You may use the abbreviation
∃1 to mean “there exists exactly one.”)
a Joan has a daughter (possibly more than one, and possibly sons as well)
b Joan has exactly one daughter (but may have sons as well)
c Joan has exactly one child, a daughter
d Joan and Kevin have exactly one child together
e Joan has at least one child with Kevin, and no children with anyone else
Sol:
a ∃x: Parent(Joan, x) ^ Female(x)
b ∃1x: Parent(Joan, x) ^ Female(x)
c ∃1x: Parent(Joan, x) -> Female(x)
d ∃1x: Parent(Joan, x) ^ Parent(Kevin, x)
e ∃1x: Parent(Joan, x) -> Parent(Kevin, x)
Question 2:
For each pair of atomic sentences, give the most general unifier if it exists:
a P(A, B, B), P(x, y, z)
b Q(y, G(A, B)), Q(G(x, x), y)
c Older(Father(y), y), Older(Father(x), John)
Trang 2d Knows(Father(y), y), Knows(x, x)
Sol
a x/A, y/B, z/B
b Cannot unify
c x/John, y/John
d Cannot unify
Question 3:
Consider a vocabulary with the following symbols:
Occupation(p, o): Predicate Person p has occupation o
Customer (p1,p2): Predicate Person p1 is a customer of person p2
Boss(p1,p2): Predicate Person p1 is a boss of person p2
Doctor , Surgeon, Lawyer , Actor : Constants denoting occupations
Emily, Joe: Constants denoting people
Use these symbols to write the following assertions in first-order logic:
a Emily is either a surgeon or a lawyer
b Joe is an actor, but he also holds another job
c All surgeons are doctors
d Joe does not have a lawyer (i.e., is not a customer of any lawyer)
e Emily has a boss who is a lawyer
f There exists a lawyer all of whose customers are doctors
g Every surgeon has a lawyer
Sol:
a (Occupation(Emily, Surgeon) ˅ Occupation(Emily, Lawyer)) ˄ (¬ Occupation(Emily, Surgeon) ˅
¬Occupation(Emily, Lawyer))
b Occupation(John, Doctor) ˄ ∃o Diff(o, Doctor) ˄ Occupation(John, o)
c x Occupation(x, Surgeon) => Occupation(x, Doctor)
d ¬(∃x Customer(Joe, x) ˄ Occupation(x, Lawyer)
or x Customer (Joe, x) => ¬ Occupation(x, Lawyer)
e ∃x Boss(x, Emily) ˄ Occupation(x, Lawyer)
f ∃x Occupation(x, Lawyer) ˄ ( y Customer(y, x) =>Occupation(y, Doctor))
g x Occupation(x, Surgeon) => ∃y Customer(x, y) ˄ Occupation(y, Lawyer))
Question 4:
Consider the following sentences:
Trang 3• John likes all kinds of food
• Apples are food
• Chicken is food
• Anything anyone eats and isn’t killed by is food
• Bill eats peanuts and is still alive
• Sue eats everything Bill eats
a Translate these sentences into formulas in predicate logic
b Prove that John likes peanuts using backward chaining
c Convert the formulas of part a into clause form
d Prove that John likes peanuts using resolution
e Use resolution to answer the question, “What food does Sue eat?”\ Sol:
a (1) ∀x: food(x) ⇒ like(John, x)
(2) food(Apple)
(3) food(Chicken)
(4) ∀x∀y: eat(x, y) ∧ ¬killedby(x, y) ⇒ food(y)
(5) eat(Bill, Peanut) ∧ ¬killedby(Bill, Peanut)
(6) ∀x : eat(Bill, x) ⇒ eat(Sue, x)
b like(John, Peanut)
(1, substitution) > food(Peanut)
(4, substitution) > eat(x, Peanut) ∧ ¬killedby(x, Peanut)
(5, substitution) > eat(Bill, Peanut) ∧ ¬killedby(Bill, Peanut)
c (1) ¬food(x) ∨ like(John, x)
(2) food(Apple)
(3) food(Chicken)
(4) ¬eat(x, y) ∨ killedby(x, y) ∨ food(y)
(5a) eat(Bill, Peanut)
(5b) ¬killedby(Bill, Peanut)
(6) ¬eat(Bill, x) ∨ eat(Sue, x)
d α = like(John, Peanut)
¬α = ¬like(John, Peanut) (*)
Resolution:
(*) {x/Peanut} (1) ¬food(Peanut)
¬food(Peanut) {y/Peanut} (4) ¬eat(x, Peanut) ∨ killedby(x, Peanut)
¬eat(x, Peanut) ∨ killedby(x, Peanut) {x/Bill} (5a) killedby(Bill, Peanut) killedby(Bill, Peanut) (5b) []
Trang 4e α = food(z) ∧ eat(Sue, z)
¬α = ¬food(z) ∨ ¬eat(Sue, z) (**)
Resolution:
(**) {x/z} (6) ¬food(z) ∨ ¬eat(Bill, z)
¬food(z) ∨ ¬eat(Bill, z) {z/Peanut} (5a) ¬food(Peanut)
¬food(Peanut) {y/Peanut} (4) ¬eat(x, Peanut) ∨ killedby(x, Peanut)
¬eat(x, Peanut) ∨ killedby(x, Peanut) {x/Bill} (5a) killedby(Bill, Peanut)
killedby(Bill, Peanut) (5b) []
Cause we unified argument z with Peanut in the resolution process above, we can conclude that Sue eats peanuts
Question 5:
Assume the following facts:
• Steve only likes easy courses
• Science courses are hard
• All the courses in the basket weaving department are easy
• BK301 is a basket weaving course
Use resolution to answer the question “What course would Steve like?”
Sol:
(1) Easy(x) -> Like(Steve, x)
(2) ¬Easy(Science)
(3) BasetketDep(x) -> Easy(x)
(4) BastketDep(BK301)
(5) Question: Like(Steve, x)
Normalization:
(1) ¬Easy(x) Like(Steve, x)
(2) ¬Easy(Science)
(3) ¬BasetketDep(x) Easy(x)
(4) BastketDep(BK301)
(5) ¬Like(Steve, x)
Resolution:
(6) (3), (4) : Easy(BK301)
(7) (6), (1): Like(Steve, BK301)
(8) (7), (5): x/BK301 => So, Steve like BK301 course
Trang 5Question 6 (Extra):
Consider the following facts:
• The members of the Elm St Bridge Club are Joe, Sally, Bill, and Ellen
• Joe is married to Sally
• Bill is Ellen’s brother
• The spouse of every married person in the club is also in the club
• The last meeting of the club was at Joe’s house
a Represent these facts in predicate logic
b From the facts given above, most people would be able to decide on the truth of the following additional statements:
o The last meeting of the club was at Sally’s house
o Ellen is not married
Can you construct resolution proofs to demonstrate the truth of each of these statements given the five facts listed above? Do so if possible Otherwise, add the facts you need and then construct the proofs Sol:
a (1) member(Joe)
(2) member(Sally)
(3) member(Bill)
(4) member(Ellen)
(5) marry(Joe, Sally)
(6) brother(Bill, Ellen)
(7) ∀x∀y: member(x) ∧ marry(x, y) ⇒ member (y)
Convert to clause form: ¬member(x) ∨ ¬marry(x, y) ∨ member (y)
(8) lastmeetingAt(Joe)
b We need to add some facts to construct resolution proofs to demonstrate the truth of each of two statements given
• The last meeting of the club was at Sally’s house
α = lastmeetingAt(Sally)
=> ¬α = ¬lastmeetingAt(Sally) (*)
Add the fact: ∀x∀y: lastmeetingAt (x) ∧ marry(x, y) ⇒ lastmeetingAt (y)
Convert to clause form: (9) ¬lastmeetingAt (x) ∨ ¬marry(x, y) ∨ lastmeetingAt(y)
Resolution:
(*) {y/Sally} (9) ¬lastmeetingAt (x) ∨ ¬marry(x, Sally)
Trang 6¬lastmeetingAt (x) ∨ ¬marry(x, Sally) {x/Joe} (8) ¬marry(Joe, Sally)
¬marry(Joe, Sally) (5) []
• Ellen is not married
α = ∀x: ¬marry(x, Ellen)
=> ¬α = ∃x: marry(x, Ellen)
Convert ¬α into clause form: marry(A, Ellen) (**)
Add the facts:
∀x: ¬marry(x, x)
∀x∀y: brother(x, y) ⇒ ¬marry(x, y)
∀x∀y∀z: marry(x, y) ⇒ ¬marry(x, z) ∧ ¬marry(z, y)
∀x∀y: marry(x, y) ∧ member(y) ⇒
marry(Joe, y) ∨ marry(Sally, y) ∨ marry(Bill, y) ∨ marry(Ellen, y) Convert new facts into clause form:
(10) ¬marry(x, x)
(11) ¬brother(x, y) ∨ ¬marry(x, y)
-THE END -