CSCI 301 Program 1, Spring 2018

Problem Specifications

You are going to be using Prolog to encode the Simpsons family tree.

The relationships that you will be encoding can be found: simpsons_graph.pdf.

You can find a sample Prolog file here to get you started.

I also want you to encode the relationships for father and mother as described in class.


Using Prolog

Prolog should now be available on all of the G1 lab machines. In order to invoke Prolog go to Start>Swi-Prolog and click the red owl. This will bring up the Prolog interpreter. To load the sample file first download it to your account. You can view the file in the built in editor by going to File> Edit. You can consult the file by going to File>Consult. Once you consult the file you can issue queries about the relationships encoded (not many) with a Query: male(homer_simpson).

Queries

In Prolog there are two types of queries: In the event of a query with one or more variables, multiple possible answers may exist. If you hit enter (or return) you tell the system that you are satisfied with the first answer. If you hit the ; (semi-colon) you are asking the system for any additional values for the query (try both with your own code to verify that it is working correctly).

If you attempt to find multiple solutions to a query, eventually the system will return with "no" (a value of false) letting you know that there are no more results in the knowledge base.

Programming Guidelines

Hints:

When you get started on this program, start by focusing on the immediate family outlined in class.
%Comments start like this
Remember to end every statement with a period (".").
Remember that, variables in Prolog start with capitol letters. Everything else is lower case.
Remember that facts and rules that start with the same identifier must be together (all male(). facts, for instance).

Testing

Thorough testing of the program is the student's responsibility. I should be able to run queries like the following:
%Should be true
male(bart_simpson).

%Should infer all children correctly.
parent(homer, X).

%Should infer all father, child relationships.
father(X, Y).
    

What you should turn in:

By email you should turn in a program lastname_firstname.pl (where lastname is your last name and firstname is your first name) with the following predicates fully specified:
  1. Facts for male.
  2. Facts for female.
  3. Facts for parent.
  4. A rule for being married (lets make the simplifying assumption that having a child with someone makes you married).
  5. A rule for father
  6. A rule for mother
  7. A rule for son.
  8. A rule for daughter.
  9. A rule for a sibling.
  10. A rule for a brother.
  11. A rule for a sister.
  12. A rule for an aunt.
  13. A rule for an uncle
  14. Your program should load correctly, and should not crash when I run queries.
Remember, all work should be your own.