Solutions to Homework Assignment #5
Last modified: "December 9, 1996 20:14:12 by matt"
From Russell and Norvig Artificial Intelligence, a Modern Approach:
7.2
- Takes(x,c): student x takes course c
- Fails(x,c): student x fails course c
- Score(x,c): the score obtained by student x in course c
- H: a specific history course; B: a specific biology course
- Dislikes(x,y): a person x dislikes person y
- Shaves(x,y): person x shaves person y
- Student(x), Person(x), Man(x), Woman(x), Barber(x), Vegetarian(x), Smart(x), Professor(x), Politician(x): predicates satisfied by members of the corresponding categories.
- Fools(x,y,t): person x fools person y at time t.
- Not all students take both history and biology.
~forall x student(x) --> (takes(x,H) and takes(x,B))
- Only one student failed history.
exists x student(x) and fails(x,H) and forall ystudent(y) and fails(x,H) --> x=y
- Only one student failed both History and Biology.
exists x student(x) and fails(x,H) and fails(x,B) and forall y student(y) and fails(x,H) and fails(x,B) --> x=y
- The best score in history was better than the best score in biology.
exists x forall y score(x,H0 > score(y,B)
- Every person who dislikes all vegetarians is smart.
forall x person(x) and (forall y vegetarian(y) --> dislikes(x,y)) --> smart(x)
- No person likes a smart vegetarian.
forall x,y person(x) and smart(y) and vegetarian(y) --> ~likes(x,y)
- There is a woman who likes all men who are not vegetarians.
exists x woman(x) and forall y man(y) and ~vegetarians(y) --> likes(x,y)
- There is a barber who shaves all men in town who do not shave themselves.
exists x barber(x) and forall y man(y) and ~shaves(y,y) --> shaves(x,y)
- No person likes a professor unless the professor is smart.
forall x,y person(x) and professor(y) and ~smart(y) --> ~likes(x,y)
- Politicians can fool some of the people all of the time, and they can fool all of the people some of the time, but they can't fool all of the people all of the time.
forall x politican(x) --> (exists y forall t person(y) and fools(x,y,t)) and (exists t forall y person(y) --> fools(x,y,t)) and ~(forall t forall y person(y) --> fools(x,y,t))
7.6
You must use <--> to form definitions. If you use only
simple implication, -->, you are only imposing constraints.
- grandchild(c,a) <--> exists b child(c,b) and child(b,a)
- greatGrandParent(a,d) <--> exists b,c child(d,c) and child(c,b) and child(b,a)
- brother(x,y) <--> male(x) and sibling(x,y)
- sister(x,y) <--> female(x) and sibling(x,y)
- daughter(d,p) <--> female(d) and child(d,p)
- son(s,p) <--> male(s) and child(s,p)
- auntOrUncle(a,c) <--> exits p child(c,p) and sibling(a,p)
- aunt(a,c) <--> female(a) and auntOrUncle(a,c)
- uncle(u,c) <--> male(a) and auntOrUncle(a,c)
- brotherInLaw(b,x) <--> exists m spouse(x,m) and brother(b,m)
- sisterInLaw(b,x) <--> exists m spouse(x,m) and sister(b,m)
- firstCousin(c,k) <--> exists p auntOrUncle(p,c) and parent(p,k)