Written Homework #3 Solutions

1. One last CSP Problem:

   Around the water cooler this morning, Green and four other workers at Circuit City compared what they had for dinner last night. For example, in the course of the conversation, it was discovered that one of them ate lasagne. Knowing that no two made the same entrée, can you determine each person's full name (first + last), occupation (one is a janitor), and meal. Here are some other clues to help you solve this:-

  • The five workers are Mike, Black, the manager, Suzie, and one of them who ate chicken.
  • Dave isn't the accountant.
  • Patty, who isn't Black, loves her job in sales.
  • Strong ate spaghetti that HE made from his old family recipe.
  • One of the women is the owner; another ate fish.
  • Walters ate a hamburger.
  • Polly's last name is Brown


For non-Americans, the first names are Mike and Dave (male) and Suzie, Patty, and Polly (female). The last names are Black, Brown, Green, Strong, and Walters.

[13] Define this problem formally as a CSP problem.

You can do this a few ways; either assigning a number to each of the 5 sets of first/last/job/dinner, or simply using one of the value sets (say, the first names) as the DOMAINS for the other variables. So, taking the second way:

Initial Domain for all variables = {Mike, Suzie, Dave, Patty, Polly}

Variables:
[LastNames] Black, Strong, Walters, Brown, Green
[Jobs] Manager, Janitor, Accountant, Sales, Owner
[Dinner] Lasagne, Chicken, Spaghetti, Fish, Hamburger

Constraints:
Black != {Mike, Suzie}
Manager != {Mike, Suzie}
Chicken != {Mike, Suzie}
Black != Manager != Chicken
Accountant != {Dave}
Black != {Patty}
Sales ={Patty}
Strong = Spaghetti
Strong = {Mike, Dave}
Owner = {Suzie, Patty, Polly}
Fish = {Suzie, Patty, Polly}
Owner != Fish
Walters = Hamburger
Brown = Polly
Alldiff(Lastnames), Alldiff(Jobs), Alldiff(Dinner)

[13] solve it. Use the MRV heuristic and forward checking. Some of the constraints can be encoded directly in the initial domains. Show your steps.

Mike Strong Accountant Spaghetti
Suzie Walters Owner Hamburger
Dave Black Janitor Lasagne
Patty Green Sales Chicken
Polly Brown Manager Fish


2 . [6] Consider a vocabulary with exactly four propositions A, B, C, and D. How many models are there for the following sentences?

Simply count the rows in the truth table that come out to be true; but also remember to account for the "free variables" that do not appear in the sentence, and so can take on either T or F values (like D).

(A ^ B) v (B ^ C) has 6 models
A v B has 12 models
A <=> B <=> C has 4 models


3 . [10] Assume the following:

If the unicorn is mythical ( Y) , then it is immortal (I), but if it is not mythical (~Y), then it is a mortal (~I) mammal (A). If the unicorn is either immortal (I) or a mammal (A), then it is horned (H). The unicorn is magical (G) if it is horned (H).

Y -> I
~Y -> ~I ^ A
I v A -> H
H -> G

Can you (mechanically) prove the following? (use resolution by hand)

The unicorn is magical (G)?

4 . [5] First Order Logic: Consider a knowledgebase containing just two sentences: P(a) and P(b). Does this knowledgebase entail FORALL x P(x)?

No. We don't know how big the domain is--- consider a domain with 3 elements. Then there is an interpretation where a and b map to the first two elements, and which has a model where P holds only for those first two elements.

Basically this question is just to test that you understand that the domain/universe of discourse is not the same as what is in the knowledgebase, i.e. just because P holds for everything you know doesn't mean that it will hold for elements you don't know anything about.

5 . [32 (4 each)] Represent the following sentences in First Order Logic. Use a consistent vocabulary!!

NOTE: Here the idea is also to encode a reasonable answer, that might be used to reason about something. Thus "forall x, pushhardenough(x) -> fallsover(x)" is only worth one point: it is not wrong, but it does not really capture the central intention, that there exists a force above which something will fall when pushed.

Some students took French in Spring 2001.


Every student who takes French passes it..


Only one student took Greek in Spring 2001.


The best score in Greek is always higher than the best score in French.

If you push anything hard enough, it will fall over.


The coat in the closet belongs to Sarah.


One of the coats in the closet belongs to Sarah.


Anyone with two or more spouses is a bigamist.


6 . [5] What axioms would be needed to infer the fact Female(Laura) given the facts Male(Jim) and Spouse(Jim, Laura) ?

7.[6] Define the concept of "uncle" (i.e. what are the properties that "x" must have in order than Uncle(x) is true?)

8. [10] Attempt to unify the following pairs of expressions. Either show their most general unifiers or explain why they will not unify. CAPS indicate CONSTANTS, small letters are variables.

  • p(x, y) and p(TABLE, BLOCK1)
  • p(x, y) and p(TABLE, z)
  • p(x, x) and p(TABLE, BLOCK1)
  • ancestor(x, y) and ancestor(BILL, father(BILL))
  • ancestor(x, father(x)) and ancestor(DAVID, GEORGE)

a.{x/TABLE,y/BLOCK1}
b.{x/TABLE,y/z}
c. cannot unify
d.{x/BILL,y/Father(BILL)}
e.cannot unify: cannot assume father(DAVID) is GEORGE