DEPARTMENT OF COMPUTER SCIENCE
CMPS 401 - Programming Languages
Due: May 3, 2007
In this assignment you will use Prolog, a non-procedural logic programming language and will become familiar with the basics of logic programming and a specific environment for logic programming.
Part A: (In this part the objective is to use a Prolog system more than writing a Prolog Program) Consider the following facts and rules.
descendent(X,Y):-parent(P,X),write(P),write(' is a parent of '),write(X),nl,descendent(P,Y).
Use a prolog interpreter of your choice to show how prolog will respond to the following input:
Part B: (In this part the objective is to actually write a basic Prolog Program) Using the same database as above, write rules that express the statement that two persons X and Y are assumed to be in the same family if at least one of the following is true:
Either X is parent of Y, or, Y is parent of X, or, there exists some other person D who is parent of both X and Y, or, there exists D for who both X and Y are parents.
Run your rules to obtain the answer to the following:
The following references should adequately recap what we have talked about in class:
You may choose a Prolog compiler from the following source (or any other of your choice):
The objectives of this assignment are:
- To familiarize you with the logic programming paradigm and a non-procedural logic programming language
- To familiarize you with a Logic Programming environment and the problem solving methodology used in logic Programming
- To familiarize you with propositional logic, predicate logic, and the basics of the Prolog programming language