A Prolog Haiku:
        and backtracking predicates.
        Throughout the seasons.

About Prolog

Prolog is a programming language that is rooted in classical logic. It supports search and unification as built-in features. Prolog allows us to elegantly solve many tasks with short and general programs.

Prolog has a pure monotonic core. The following documents are centered around this important aspect of Prolog, allowing declarative debugging and many other approaches that are impossible or only rudimentarily developed in other programming languages.

A Prolog program consists of predicates. Each Prolog predicate defines a relation between its arguments. A relation is a generalization of a function. Prolog predicates are often more versatile than functions in other programming languages, and are typically usable in multiple directions.

Prolog has several facets that distinguish it from many other programming languages. In addition, the language has undergone significant developments in the last few decades. The increasing availability of more declarative features allows us to present the language in a more uniform way that is easier to understand and at the same time yields more general programs with less effort than was the case with early Prolog versions.

The goal of this material is to bridge the gap between the great traditional Prolog textbooks of the past and the language as it currently is, several decades after these books were written. You will see that many limitations of the past are no longer relevant, while several new constructs are now of great importance even though they are not yet covered in any available Prolog book. If you are new to Prolog, read the chapters in order for a self-contained exposition of many important language features. If you already have some experience with Prolog and would like to learn more about more recent aspects, I recommend you start with the chapter on integer arithmetic and proceed with the chapters it links to.

You can use PceProlog to configure Emacs for Prolog programming.

About you

You are currently learning or teaching Prolog and find the existing literature somewhat unsatisfying. Is Prolog still the same language it was decades ago? Are the existing books still applicable? If not, what does modern Prolog code look like?

You can sense that Prolog is a powerful language, yet you are currently unable to use it to its fullest potential. In fact, it sometimes seems too limited to you to solve real problems. On the other hand, you know that Prolog is the most widely used logic programming language. How can this be?

Parts of the presented material seem new and unusual to you, and even contradict what others tell you about Prolog. In such cases, it is only natural to ask how legitimate the material is. Can you rely on what the author is saying?

About me

In 2005, I contributed library(simplex) to SWI-Prolog and worked on library(assoc). Together with a colleague, I won the online version of the Prolog Programming Contest in 2006 and 2007. Since 2007, I am contributing the CLP(FD) solver that ships with SWI-Prolog. Also since 2007, I have been maintaining the comp.lang.prolog Frequently Asked Questions.

In 2008, I received a Master's degree from the Vienna University of Technology after solving a combinatorial optimization task called the Social Golfer Problem.

In 2014, I received a doctoral degree from the Vienna University of Technology in the area of Prolog and constraints. You can read my thesis. Also since 2014, my CLP(B) solver ships with SWI-Prolog. More recently, I have worked on library(ssl). My last major contribution to SWI-Prolog is library(crypto).

Since 2016, I am developing my constraint libraries with Scryer Prolog and SICStus Prolog as the primary target systems. See CLP(ℤ), and the SICStus port of CLP(B) for more information. As of April 2020, Scryer Prolog ships with these libraries as built-in features. Other libraries I contributed to Scryer Prolog include library(crypto) and library(format). As of November 2020, library(format) also ships with Tau Prolog and Trealla Prolog.

I am author and co-author of several scientific publications about combinatorial optimization, Prolog and constraints. I am mentioned as one of the contributors to the Prolog teaching environment GUPU and have contributed to the Prolog ISO standard (N226).

I learned almost everything I know about Prolog from Ulrich Neumerkel, Stefan Kral, Richard O'Keefe, Bart Demoen, Tom Schrijvers, Leon Sterling, Ehud Shapiro, Jan Wielemaker and Mats Carlsson.

What does this all mean? All considered, you still have to draw your own conclusions. Good luck!

More about Prolog

Main page