SEM242 - Prolog and Logic Programming
This course is supported by World-Wide Web documents. These notes originated from
the School of Computer Science in the
University of Birmingham, United Kingdom. More
precisely, they were written by Peter
Hancox mainly in the early hours of the morning at home in the edge of
Worcestershire in the English midlands.
These notes are publically accessible and we know they are used by students learning
at other universities. If you are a tutor and want to use these notes for group teaching,
please ask for a copy rather than using our World-Wide Web server.
These notes will be greatly improved if you report the errors that are bound to creep
into teaching material like this. I'd welcome comments about difficulties in using these
notes and (of course) any encouraging comments you want to make. Messages should be
addressed to firstname.lastname@example.org. The reward for helpful messages is to get your name
in the acknowledgements!
The set of documents includes:
This is all for now!
Introduction for Software Engineers
Modules consisting of learning material
- Module 1 - Some unification, some data types and some
This Module has the primary objective of introducing the reader to Prolog's powerful
matching features (often called "unification"). In the process, the reader will learn
about some of Prolog's data types and some of Prolog's built-in predicates.
- Module 2 - The structured object data type and storing
and retrieving facts
This Module introduces another data type, the structured object. Using this, it is
possible to write simple and useful Prolog programs.
- Module 3 - Representing information, search strategies
and simple rules
The previous Module introduced the structured object and showed how they could be used to
store information in a similar way to a database. Queries with more than one goal were
used to retrieve information held in more than one object. This Module shows how rules
can be written that encapsulate general knowledge within programs.
- Module 4 - Backtracking and recursion
The previous Module used a simple network to show how to write rules to traverse this
network. This Module introduces a small change to the network to introduce non-determinism.
This allows Prolog's search mechanism to be revealed in greater detail, which in turn
allows a closer examination of the technique of recursion.
- Module 5 - Lists and list processing
This Module introduces the list, the most influential data type in artificial
intelligence programming. It starts with an introduction to lists in Prolog and how
lists are typically processed. The major section looks at list processing operations,
splitting them into three groups, classified by the nature of their terminating condition.
Some of the examples given in this section work but are not the most efficient
method of implementation in practical Prolog, so some examples based on the use of
accumulators are given.
- Module 6 - Output and program design
This Module gives an example of output in Prolog. This example is part of a program that
is later used to demonstrate program design in Prolog.
These Pages are maintained by
Dr Peter Hancox
Last updated October 1998