**Next:**Semantics of Programming Languages

**Up:**Michaelmas Term 2007: Part

**Previous:**Logic and Proof

**Contents**

##

Prolog

*Lecturer: Dr A.C. Rice*

*No. of lectures:* 6

*Prerequisite courses: Foundations of Computer Science, Algorithms I and Logic & Proof*

**Aims**

The aim of this course is to introduce programming in the Prolog language. Prolog encourages a different programming style to Java or ML and particular focus is placed on programming real problems which are suited to this style. Practical experimentation with the language is strongly encouraged.

**Lectures**

**Introduction to Prolog.**The structure of a Prolog program and how to use the Prolog interpreter is described. Unification is revisited and we look at some simple programs.**Arithmetic and lists.**Prolog's support for evaluating arithmetic expressions and lists is covered. The space complexity of program evaluation is discussed with reference to last-call optimisation.**Backtracking, cut, and negation.**The`cut`operator is introduced for controlling backtracking. We consider*negation as failure*and its uses.**Search and cut.**Prolog's search method for solving problems is discussed. Graph searching exploiting Prolog's built in search mechanisms is examined.**Difference structures.**Difference lists are introduced and applied to example programs.**Constraint Logic Programming.**Constraint Logic Programming (CLP) is introduced. We examine how CLP addresses particular limitations of Prolog programs.

**Objectives**

At the end of the course students should

- be able to write programs in Prolog using techniques such as accumulators and difference structures.
- know how to model the backtracking behaviour of program execution.
- appreciate the unique perspective Prolog gives to problem solving and algorithm design.
- understand how larger programs can be created using the basic programming techniques used in this course.

**Recommended reading**

* Bratko, I. (2001). *PROLOG programming for artificial intelligence*. Addison-Wesley (3rd ed).

**Next:**Semantics of Programming Languages

**Up:**Michaelmas Term 2007: Part

**Previous:**Logic and Proof

**Contents**