This document is an edited version of a Hypercard Stack written by Mike Brayshaw as part of Joint Research Council project "The Construction and Evaluation of a Prolog Techniques Editor". It is adapted with his permission. Adapted by Paul Brna and Tamsin Treasure-Jones. It has been further edited by Angharad Shaw ( and is used with permission from Tamsin Treasure-Jones.

Introduction to Prolog

Prolog is a logic language that is particularly suited to programs that involve symbolic or non-numeric computation. For this reason it is a frequently used language in Artificial Intelligence where manipulation of symbols and inference about them is a common task.

Prolog consists of a series of rules and facts. A program is run by presenting some query and seeing if this can be proved against these known rules and facts. In this tutorial we will attempt to give you a flavour of how all this is achieved and teach you how to write a simple program for yourself.

In this tutorial we will introduce some of the central concepts of Prolog under a series of topic headings. Each discussion will be structured as follows. Firstly a concept will be described in detail, then we shall present a series of worked examples to show how the concept is applied, then finally present some simple exercises. When you have done the exercises, we'll either pass on to the next topic to give you some further hints or suggest you re-browse the current topic before moving on.


Page created by Tamsin Treasure-Jones; edited and maintained in Aberystwyth by Angharad Shaw