Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Prolog database by typing the facts listed below in a .pro file. Consul

ID: 3939322 • Letter: C

Question

Create a Prolog database by typing the facts listed below in a .pro file. Consult the file in Amzi Prolog. While in Amzi Prolog, type in the queries given below. You are to turn in the first response from Prolog. It is not necessary to show the responses after the ‘;’ is hit.

Facts:

Mickey is a toy.

Snoopy is a toy.

Jane plays with Snoopy.

Jane plays with Mickey.

Jane likes every toy she plays with.

Ann likes everything that Jane likes.

Queries:

Does Ann like Snoopy?

What does Jane like?

Who likes what?

Thanks a lot for your help!!!

Explanation / Answer

Prolog database related to the .pro file :

toy: (toy name)

toy: mickey

toy: snoopy

person : (toy name)

jane: mickey

jane: snoopy

person: (favourite toy)

jane: mickey

jane: snoopy

ann: mickey

ann: snoopy

From the above database we can solve the queries:

1) Yes. Ann likes snoopy because jane likes snoopy and ann likes everything that jane likes.

2) Jane likes to play with mickey and snoopy because jane likes every toy she plays with.

3) Both of them like mickey and snoopy. Because jane likes every toy she plays with and ann likes everything what jane likes.