Language

Prolog

First appeared
1972
Paradigm
Logic programming, declarative
Toolchain
SWI-Prolog 9.2.9
Container image
debian:trixie-20261027-slim + swi-prolog-core 9.2.9

Prolog (PROgrammation en LOGique) was created in Marseille in 1972 for working with natural language, and it became the other great language of early artificial intelligence, beside Lisp. Japan’s Fifth Generation Computer project of the 1980s was built around logic programming. Today it’s used in rule engines, type checkers, and parts of IBM’s Watson.

A Prolog program is a set of facts and rules. You don’t tell it what to do next; you ask a question, and it searches for values that make the question true, backing up to try another choice whenever a goal fails. There are no loops and no assignment: a variable gets one value per attempt, and repetition is recursion or helpers such as maplist and findall. The implementations use SWI-Prolog’s built-ins and the libraries that ship with it, which have lists, strings, and sorting, but no statistics. Add-on packs aren’t installed.

Quirks

Concepts in Prolog

Run the examples locally

You need Docker and Python 3. The harness builds the pinned container and runs every Prolog example:

git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language prolog