CS538: Spring 2008

Assignment#3: Prolog

Handin procedure

Grading criteria

The first and foremost criteria for grading is correctness. Your programs should execute without errors and produce the correct output with our test suite. Points are awarded for each test input successfully handled by your code.

You can use any algorithms or Prolog predicates to produce the correct output, you are not restricted to following the exact path set by the questions.

No extra points for the most elegant programs but you are encouraged to write in a declarative style, making best use of Prolog's natural abstractions: declarative logic, backtracking, pattern matching and so on. These will invariably reward you with compact, natural-looking code which is easy to read and understand. Tell Prolog what you want, and not how to do it. See the lecture notes and look online for Prolog programs to get a flavor of Prolog programming.

I may penalize programs that are excessively kludgy and hard to read or understand. Don't try to write C++ or Java in Prolog. In particular, the excessive use of the extra-logical predicates and operators (the cut !, fail, assert, retract and their cousins) is frowned upon and will be penalized. Note that this does not apply when the cut operator (!) is required or is natural for controlling backtracking, as with the subsets predicate in Q.4.

Partial credit will be given for programs that seem to be on the right track.

Prolog Tips

First of all, check out the 538 Prolog page for information on YAP Prolog and how to use it in the CS Department. This page also has information on downloading YAP and online help and the debugger.

Assignment Notes, Hints, FAQ

Q.1

Q.2

Q.3

Q.4