- Prolog is available on esus at /usr/bin/pl
- Prolog source files should have a suffix of .pl
- You can load a Prolog source file into the Prolog
environment by typing consult('whatever.pl').
- You can break a list apart using [a|b] where
a denotes the first item in the list and b denotes
the rest of the list.
- To test for inequality, use \=
- You can trace one query by typing trace.
- You can exit the Prolog environment by typing halt.
Look at the file examples.pl.
- Construct a Prolog genealogy database
that covers 3 generations of your family.
You may use the following facts in your database:
male(x), female(x), and
parent(x, y) where x is the parent of y.
- Define mother(X,Y).
- Define father(X,Y).
- Define grandmother(X,Y).
- Define grandfather(X,Y).
- Define allgrandparents(X,Y). This predicate should
find and print all grandparents of Y.
- Define sibling(X,Y). Make sure that a person is
not his or her own sibling!
- Define allsiblings(X,Y). This predicate should find
and print all siblings of Y.
- Define aunt(X,Y).
- Define uncle(X,Y).
- Define a function that counts the number of top level
elements in a Prolog list.