Logic, Programming and Prolog: 2nd Edition
The main objective of both editions of this textbook is to provide a uniform account of both the foundations of logic programming and simple programming techniques in the programming language Prolog. The discussion of the foundations also facilitates a systematic survey of variants of the logic programming scheme, like constraint logic programming, deductive databases or concurrent logic programming. This book is not primarily intended to be a theoretical handbook on logic programming. Nor is it intended to be a book on advanced Prolog programming or on constraint logic programming. For each of these topics there are more suitable books around. Because of the diversity of the field there is of course a risk that nothing substantial is said about anything. We have tried to compensate for this risk by limiting our attention to (what we think are) the most important areas of logic programming and by providing the interested reader with pointers containing suggestions for further reading. As a consequence of this:
- the theoretical presentation is limited to well-established results and many of the most elaborate theorems are stated only with hints or pointers to their proofs;
- most of the program examples are small programs whose prime aim is to illustrate the principal use of logic programming and to inspire the reader to apply similar techniques when writing ‘real’ logic programs.
The first part deals with the logical aspects of logic programming and tries to provide a logical understanding of the programming language Prolog. Logic programs consist of logical formulas and computation is the process of deduction or proof construction. This makes logic programming fundamentally different from most other programming languages, largely a consequence of the fact that logic is considerably much older than electronic computers and not restricted to the view of computation associated with the Von Neumann machine. The main difference between logic programming and conventional programming languages is the declarative nature of logic. A program written in, for instance, Fortran can, in general, not be understood without taking operational considerations into account. That is, a Fortran program cannot be understood without knowing how it is going to be executed. In contrast to that, logic has no inherent concept of execution and logic formulas can be understood without any notion of evaluation or execution in mind. One of the most important aims of this book is to emphasize this distinction between logic programs and programs written in traditional programming languages.