The primary virtue of logic programming
is its declarative semantics.
A logic program can be read as a theory stating
relations between entities in a particular domain.
For a programmer, such an interpretation allows to
separate the concerns for the logical structure of an algorithm
from issues of control.
The famous phrase
[M] algorithm = logic + control
of [Ko79] states this principle succinctly.
The idea of using predicate logic as a programming language
arose from research in automated theorem-proving
in the early 70s
and resulted in the language Prolog.
The first implementation was by Roussel/Colmerauer.
Soon afterwards, efficient implementations became available
which demonstrated the fruitfulness of this idea,
at least for the kind of problems to be found
in academic settings.
By now Prolog is a widely accepted programming tool
which is applied in areas like
databases,
problem solving,
natural language processing,
compiler design
and, not the least important, expert systems.
According to [Bu83] Prolog has often been used to prototype
small- to medium-scale expert systems in a business environment.
As another indication of the potential
of the paradigm, it may be mentioned that the Japanese
Fifth Generation Computers project is based on logic
programming.
The logical language used in logic programming
is called Horn clause logic,
which is a subset of predicate logic
that enables an efficient computational interpretation.
C.f. [DoGa84].
\nop{
Polynomial time/pebblings.
}
In this section, which is necessarily of an introductory nature,
we will explore the notion of a logic program
and its mathematical, logical foundations enabling a declarative
reading of a program.
Complementary to the declarative interpretation
we will define a procedural interpretation
that allows logic programs to be used for computing.\ftn{
Readers not interested in the mathematical foundations of logic
programming are advised to jump to section \ref{dig/prolog}.
}
We will then describe the language Prolog,
including the so-called impure or extra-logical
facilities that are in practice considered necessary
for using Prolog in actual programming tasks.
We will defer a discussion of the merits of Prolog
from a software engineering perspective to section [softw].