Sei sulla pagina 1di 6

Solution 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 rst-order logic. (You may use the abbreviation 1 to mean there exists exactly one.) a. b. c. d. e. Sol: a. b. c. d. e. x: Parent(Joan, x) ^ Female(x) 1x: Parent(Joan, x) ^ Female(x) 1x: Parent(Joan, x) -> Female(x) 1x: Parent(Joan, x) ^ Parent(Kevin, x) 1x: Parent(Joan, x) -> Parent(Kevin, x) Joan has a daughter (possibly more than one, and possibly sons as well). Joan has exactly one daughter (but may have sons as well). Joan has exactly one child, a daughter. Joan and Kevin have exactly one child together. Joan has at least one child with Kevin, and no children with anyone else.

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

d. Knows(Father(y), y), Knows(x, x). Sol a. b. c. d. x/A, y/B, z/B Cannot unify x/John, y/John 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 rst-order logic: a. b. c. d. e. f. g. 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)) Emily is either a surgeon or a lawyer. Joe is an actor, but he also holds another job. All surgeons are doctors. Joe does not have a lawyer (i.e., is not a customer of any lawyer). Emily has a boss who is a lawyer. There exists a lawyer all of whose customers are doctors. Every surgeon has a lawyer.

Question 4:
Consider the following sentences:

a. b. c. d. e. Sol:

John likes all kinds of food. Apples are food. Chicken is food. Anything anyone eats and isnt killed by is food. Bill eats peanuts and is still alive. Sue eats everything Bill eats Translate these sentences into formulas in predicate logic. Prove that John likes peanuts using backward chaining. Convert the formulas of part a into clause form. Prove that John likes peanuts using resolution. Use resolution to answer the question, What food does Sue eat?\

a. (1) x: food(x) like(John, x) (2) food(Apple) (3) food(Chicken) (4) xy: 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) []

e. = 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) (2) (3) (4) (5) Easy(x) Like(Steve, x) Easy(Science) BasetketDep(x) Easy(x) BastketDep(BK301) 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

Question 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 Ellens brother. The spouse of every married person in the club is also in the club. The last meeting of the club was at Joes 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 Sallys 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) xy: 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 Sallys house. = lastmeetingAt(Sally) => = lastmeetingAt(Sally) (*) Add the fact: xy: 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)

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) xy: brother(x, y) marry(x, y) xyz: marry(x, y) marry(x, z) marry(z, y) xy: 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 -------