An introduction to logic programming through prolog
Science of Computer Programming
If you need to teach Logic Programming to an audience of people who are not very familiar with logic, and, nevertheless, you want to put an appropriate emphasis on the declarative reading of the programs and provide a rigorous logical approach, this is probably a good course book for you to use. The book begins by introducing a subset of first-order logic: syntax, relations, truth tables and logical variables. Every concept is carefully and at length explained using examples taken from logic
... gramming, and the reader is step-by-step brought to think about logic programs in a purely declarative way. The first operational concepts are introduced only in Chapter 5, and these operational concepts are inference rules and refutation. Unification and the SLD resolution principle are handled only in Chapters 6 and 7. This introductory part provides a very "declarative" and perhaps uncommon approach to the teaching of Logic Programming. Personally, I have found this part didactically sound and very convincing. In what could be considered the second part of the book, the issue of PROLOG as a programming language is tackled. Here the approach is the standard one we are used to. In this section, it is explained how some prominent programming problems (among them: search, parsing and hardware simulation) can be solved using PROLOG. Some attention is dedicated to the problem of nontermination and to the choice of the search technique. In this part, the reader becomes aware of the most important features of the Logic Programming paradigm. To this end, one full chapter is dedicated to the unfold/fold transformations, which, in my personal view, is useful in that it allows to understand the strength of symbolic manipulation techniques. From Chapter 14 onwards, the book concentrates on the operational aspects of PRO-LOG. It does so by describing the key implementation aspects of Pico-PROLOG, a dialect of PROLOG for which the author wrote an interpreter in about 2000 lines of PASCAL code. The carefully commented source code is reported at the end of the book. Despite the fact that from this point on the discussion becomes unavoidably more technical, the author manages to keep the book very readable and enjoyable, focusing on the key aspects, and leaving the technical details to the source code.