JMU CS 430 Spring 2021

Programming Languages

Module 15 Project


In this PA, you will practice writing Prolog by encoding various family relationships using Prolog predicates.

Project starter files:

There are three Prolog files:

You can test your code by loading the Prolog files into swipl (e.g., using the command [facts]. to load and running queries or test predicates directly. You can also use the provided shell script, which runs swipl and runs each test predicate separately, automating the process of parsing the output and counting failed tests for you.


You must write the following predicates:

Hint: Run the individual tests as you write your predicates. Later predicates will be easier to write if you use earlier ones; it will be much easier to debug your code as you go along than waiting until the end. If a test fails, try each of its parts until you isolate the problem. If you are having trouble, you might find it helpful to draw the family tree given in

You should not hard-code any of these predicates (e.g., by enumerating all correct conclusions as new facts). In other words, your implementations should continue to work if a different family tree is provided.


Your program must contain implementations as described above. You must name your Prolog script file You must put your name in a comment at the top of the file. As usual, decompose your rules if necessary to make them more readable, use good names, indent properly, and so on. You will partly be graded on the readability of your code but mostly on whether it works.

Submit ONLY to the appropriate assignment on Canvas by the deadline.

This PA was originally designed by Dr. Chris Fox; much of the wording on this page was originally his.