Third Prolog Assignment
Due Tuesday November 16th
1.
Given the following facts:
a(1,1).
a(2,1).
a(3,2).
a(4,4).
b(1,2).
b(1,3).
b(2,3).
b(3,2).
b(4,4).
a. Try to figure out ALL
the answers to each of the following queries without using the
computer
a(X,Y), b(X,Y).
a(X,Y), b(X,Y), a(Y,Y).
b. Then key in the facts and the queries and attach a
printout of your run.
2. Here’s an Agatha like problem taken from Artificial
Intelligence through Prolog by Neil Rowe.
Here’s a summary of the
current situation on the fictitious television opera Edge of Boredom:
Jason and Phoebe are married,
but Phoebe is in love with Perry. Perry doesn’t love
her because he is still married to Stacey, but Zack is also romantically
inclined toward Phoebe. He’ in competition with Lane, who also love Phoebe despite being
married to Eulalie, whom Jason is feeling romantic about.
a. Represent the basic meaning of these statement by facts
using only two different predicate names.
Notice that if X is married to Y, Y is married to X. You might
want to use some form of the word “marry” and some form of the word “love” as
your predicates.
b. A marriage is on the rocks if both its participants are
in love with other people and not with each other. Which people are in marriages on the rocks. Show the
necessary Prolog query and its result.
c.
A person is jealous when a preson they love is loved by
a third person, or a person is jealous when married to someone loved by a third
person. Which people are jealous? show the necessary
Prolog query and result.