Artificial Intelligence with Prolog
What is intelligence? Various explanations and definitions
have been put forward by different researchers.
Intelligence has been defined, among many other proposals,
as the ability to acquire and apply knowledge, and as the capacity
for logical reasoning and self-awareness. It has been related to
understanding, solving, planning, and several other concepts and
tasks. It has been categorized into different kinds of
intelligence, such as emotional intelligence, social
intelligence and so on.
The word stems from the Latin verb intellego "I understand,
realize, perceive, see, notice" (among other meanings),
from lego "I gather, collect, take, read" (among other meanings).
Since no generally accepted definition of intelligence is
available, it is even harder to define what artificial
intelligence is. Broadly speaking, we can distinguish
two different categories of artificial intelligence (AI):
So far, we have seen a lot of progress in weak AI. For
example, machines have been built that
play chess, Go,
and many other games even better than the most able humans. Many
of us are routinely using partially self-driving trains and
subways, and we currently witness the first attempts at
- strong AI: This means a mechanism whose intellectual
ability is indistinguishable from that of a human.
- weak AI: This means a mechanism that automates a
subset of human abilities.
In contrast, strong AI has remained out of reach.
In fact, it has
and further argued,
that strong AI is inherently impossible to implement.
Broadly speaking, we distinguish two possible approaches
towards implementing AI:
Both approaches have been widely known among researchers, and have
also been used in practice, for many decades. Prolog is frequently
associated with symbolic approaches. Well-known
applications of this kind are planning tasks such
as Wumpus World, Escape
from Zurg, Connect 4,
scheduling tasks such as timetabling
and sports tournaments, and also other
combinatorial tasks such as N queens
and Sudoku. Prolog can of course also
implement statistical approaches. For example, check
and AILog 2
for probabilistic logic programming and reasoning with
- symbolic approaches:
- statistical approaches:
- neural nets
- machine learning (ML)
- data mining
The approaches have different advantages and drawbacks: A symbolic
approach is typically amenable to formal verification. The
rules are explicitly available, and you can check whether they are
complete, and whether they express what you intend.
Using inductive logic programming (ILP), you can even let a
program learn rules based on positive and negative
examples. See for example
system. However, not all tasks are amenable to symbolic
approaches, because the rules may be too hard to express.
For example, it is hard to express rules that determine whether a
musical piece is borderline atonal, or whether a photo
contains a painting of a flower.
On the other hand, statistical approaches have the ability to
acquire rules implicitly, based on
so-called training-, test-
and validation sets. This is convenient, because you
do not have to think about the rules yourself, and the machine may
derive rules that are too hard for you to encode. Unfortunately,
this also comes with significant drawbacks: You can no longer
reason about the rules explicitly, and the obtained mechanism may
produce colossal outliers that are hard to remedy. For example, it
may misclassify the picture of a penguin as a car if you change a
Prolog and AI
Prolog has very strong historic ties with AI. In 1982, Japan
started a very ambitious government project called the Fifth
Generation Computer System (FGCS) with the goal to create
a massively parallel computer, using concurrent
logic programming as the software foundation of the
When I visited Japan, I asked a retired Japanese scientist who had
worked on the project why the project had failed. He said: "What
do you mean, 'failed'? All my colleagues who have worked on
the project went on to become professors!" Another
researcher told me that the project achieved what was actually
intended: a way to input Japanese characters into computers.
In my view, a major achievement of the scientists who had worked
on this project was that they managed to convince the government
to fund an interesting and very ambitious project with
By the end of the FGCS project, commodity hardware had become so
powerful that custom-built machines as those constructed by the
project were hardly needed anymore.
Now, several decades later, is it not time
to try again? Is it not time to convince our
governments and funding agencies that we want to benefit from the
power of Prolog to build applications, and do interesting
Here are a few ideas:
- Write a chatbot that answers questions to the administration.
- Write an application that guides students through solving
tasks, so that it can be used in computer-aided education. See RITS for an example.
- Find a way to formalize legislation, so that
questions about laws can be automatically answered. For an
example, check out a Prolog formulation of
with Regulations as instances
of smart contracts.
More about Prolog