Background: Almost everyone is aware of, if not exactly fond of, the British royal family. For this portion of the homework, you are to represent a branch of the royal family (see the family tree image, on the next page, for the portion of interest) in Prolog and write several rules that ‘reason’ about the family relationships.
Create a Prolog database in a file named royals.pl that allows the user to ask query the royal family tree. In particular, here’s what we want your database to include:
Facts about the royals. You’ll need:
– married(W,M) – States the fact that woman W married man M. Repeat as many times as necessary
for all of the married pairs of royals.
– childOf2(C,W,M) – States that C is the child of woman W and man M.
For this assignment, we’ll use the facts given in the family tree fragment shown below. Identify the people by their first names. If you find a duplicate, give the younger person’s name a digit suffix. E.g., frank and frank2.
The following rules that Prolog can use to determine various family relationships. Implement these in terms of each other and the facts above; do not add any additional facts:
– equal(X,X). – That’s it, exactly. Type it as you see it. You’ll probably find it useful as part of another rule later on.
– childOf1(C,W) – Determines if C is a child of woman W.
– childOf1(C,M) – Determines if C is a child of man M.
– sibling(X,Y) – For this assignment, siblings are considered to be people who share the same two parents.
– auntOrUncleByBlood(C,O) – Your mother’s sister is an example of an aunt by blood. As the name suggests, uncles by blood count here, too.
 

2 comments on “The British royal family

Leave a Reply

Your email address will not be published. Required fields are marked *