Prolog is a programming language built on the idea of sets of facts and rules for determining facts rather than on the idea of a sequence of executable commands. It is derived from a form of mathematical logic and an associated notion of automatic proof so the Prolog program is analogous to a set of logical sentences and the behaviour of the interpreter when attempting to determine a fact (given as a goal) is analogous to an automatic proof of a given theorem.
In practice programs are easier to understand if they are thought of as a set of callable procedures. Programs are collections of simple facts asserting that certain simple relationships hold between data values and rules which describe the circumstances in which relations can be inferred as holding. To evaluate a program a goal relationship is given to the interpreter which then examines the facts and rules to see (a) if this relationship holds, and (b) if so for which data values it is true.
There are NO stored changable data values (ie. the ``variables'' of procedural languages) and there are NO executable statements. There is no idea of obeying a sequence of commands to alter stored data values to a desired state. Rather, once given a goal Prolog searches for any values of data that will make it succeed.
© University of Hertfordshire Higher Education Corporation (1998)