Logic Programming For All Of Us


Got errata or suggestions? Email us at

Release Schedule: 2020-01-15 through 2020-03-02

Version: Mar 1, 2020

Programmer Passport Prolog


1. Exploring Prolog


Prolog is a logic programming language. It works on databases having facts and rules. The language uses these basic facts and rules to make inferences of its own. As machine learning algorithms become more popular, more developers are looking to Prolog for inspiration. It’s roots go deep into Computer Science language theory. The earliest Erlang compilers were based on Prolog, and its influences including pattern matching and syntax structure ripple deeply through Erlang, and even Elixir.

Today, Prolog is widely used in academic settings to illustrate constraint-logic-programming, a programming family that involves establishing a domain and constraints to express a program. The solutions algorithms are left to the language! Constraint-logic-programming (CLP) is instrumental for building problems with limited domains and constraints. It’s used to build schedules, plan routes, and much more.

Prolog was instrumental in the design of languages like Erlang and Elixir. Pattern matching, the syntax, and the declarative paradigm inspired Joe Armstrong and the rest of the Erlang team to build one of the most reliable languages in the world.


Originally called Programmation en Logique, Prolog was created by Alain Colmerauer at the University of Aix-Marseille, France. That’s the coast line that inspired the cover on this page! The first implementation was created in 1973, and the language has continued to grow and mature.

It was once a hot choice for artificial inteligence (AI) solutions. The University of Edinburgh continued the development of Prolog under the scientist Robert Kowalski, who was working on logic in AI systems.


Public & Private

1. Introducing Prolog

Unlike many of the language videos, this one tells a story about the relationship between Bruce Tate, the Prolog language, and Joe Armstrong, the creator of Erlang. It also shows some of the influences Prolog had on the Erlang language, and introduces some of the root concepts. In short, it sets the stage for why we're exploring Prolog as part of the Programmer Passport celebration, and why Prolog is one of the most-taught languages in world universities.

2. Prolog Sudoku

In this video, we solve our first problem in Prolog together, a Sudoku. Joe Armstrong helped me build my first solver by guiding me toward a four by four grid, and directing me to do the grouping of rows, columns, and boxes in separate clauses. That led to a design similar to the one you see in front of you.

Bonus. Bruce Tate: Joy

This is a talk about maintaining passion in a programming career. It introduces Prolog, and talks about Joe Armstrong's passion for it. If you are searching for the things that might help you get out of a career rut, this talk may be for you.

3. Working with Graphs

This video will walk you through using the built in swipl API to work with unweighted gtaphs. We use the API to answer several questions about graphs, and then implement a quick algorithm to find a path.

4. Prolog Wrap-up

In this final video of the Prolog series, we summarize the work we've done together. We show the major features from the programs we've written throughout the projects, written chapters, exercises, and other videos.

Community Resources

Cool quick trips for Prolog

Learn It

These resources will get you on the path to learning with background information, tooling and exercises.

Do It

You decide how deep to go. These resources are exercises and projects to cement your learning.

Grok It

These resources will help you put your new knowledge into context so you'll be better at your everyday job.


Longer Excursions (chapters 3 and 4)