Although Prolog is a computer programming language, it is very different from conventional programming languages. Conventional programming languages conform to the model of specifying computation in terms of an algorithm together with a data structure. Prolog, however, is a declarative language, and moreover, it is a logic programming language.
Most programming languages describe computation in terms of instructions, i.e. in terms of how to perform a task. The result of running the program is that the task is completed. But a declarative language does not specify how to perform a task, they describe what happens instead. The difference is roughly as follows: with a conventional language, the programmer writes the equivalent of "go and compute one plus two". If the execution is successful, the machine comes back shouting "three" (and has no recollection of what made it say that). In a declarative language, the programmer says "I want the result of adding one and two", and the machine comes back saying "one and two is three".
Logic programming languages are a particular type of declarative language. In these languages, computation is specified by a logic together with a control mechanism. The logic is a set of statements (effectively premises) in a formal language with properties similar to a formal logic. These statements make up the program. Computation is a matter of proving a statement given the program. This is carried out by checking if the statement follows from the premises. The concept of control stands for the method of trying the premises in the program to prove the statement.
The procedure of writing and running a Prolog programme usually follows the following steps:
This section briefly explains how the things I have asked you to do so far are relevant to the course.
<a.von.klopp@bangor.ac.uk>