OcxlyDev · Field Guide

The language you don't command: Prolog and the logic-programming dream

In every mainstream language you tell the computer what to do. In Prolog you tell it what is true, ask a question, and the machine works out the how. Fifty years on, the language is a niche — but the dream it embodied quietly runs your database, your type checker, and once helped a computer win a quiz show.

OcxlyDev Published 16 July 2026 ~10 min read Sources linked throughout

Here is an entire Prolog program: parent(tom, bob). parent(bob, ann). grandparent(X, Z) :- parent(X, Y), parent(Y, Z). Two facts and one rule — “X is a grandparent of Z if X is a parent of some Y who is a parent of Z.” Now ask it ?- grandparent(tom, Who). and Prolog answers Who = ann. Notice what you did not write: no loops, no search code, no instructions at all. You described a world; the language searched it. That inversion — declarative rather than imperative — is the whole idea, and it is why Prolog still matters even where Prolog itself is not used.

01Born in Marseille, theorised in Edinburgh

Prolog (programmation en logique) was created in 1972 by Alain Colmerauer and Philippe Roussel in Marseille, out of work on natural-language processing — they wanted a system that could parse French sentences and reason about them, and the tool became a language.1 The theory arrived from Edinburgh: Robert Kowalski showed that a fragment of formal logic (Horn clauses) could be read two ways at once — declaratively, as statements of truth, and procedurally, as recipes for computation. His famous equation, published in the Communications of the ACM, distilled it: Algorithm = Logic + Control.2 You supply the logic; the language supplies the control.

02How it actually works (in plain English)

Two mechanisms do all the magic. Unification is pattern-matching on steroids: Prolog makes two terms equal by finding values for their variables, in either direction — there are no “inputs” and “outputs,” only relations. The same append/3 relation that joins two lists can be run backwards to split a list into every possible pair of parts. Backtracking is the search: Prolog tries a rule; if it leads to a dead end, it undoes its choices and tries the next one, exhaustively and automatically. What you'd hand-write in another language as nested loops and a stack of partial solutions, Prolog gives you for free.3

The catch is the fine print in Kowalski's equation: when the “free” control strategy fits your problem, Prolog programs are astonishingly short — a Sudoku solver is a page3 — and when it doesn't, you end up steering the search with the infamous cut operator, and the declarative dream gets procedural fast. Prolog is at its best when the problem genuinely is search: parsing, scheduling, configuration, puzzles, rule systems, anything constraint-shaped.

Prolog's bet was that stating a problem precisely is most of solving it. On the problems where that's true, nothing else comes close to its economy.

03Boom, winter, standard

For one strange decade, Prolog was the future. In 1982 Japan's Ministry of International Trade and Industry launched the Fifth Generation Computer Systems project, a national moonshot to build massively parallel machines whose core software layer was logic programming — and Western governments, alarmed, funded competing programmes.4 The project ended in the early 1990s having produced good research but no revolution; expert systems went out of fashion, the “AI winter” set in, and Prolog's mainstream moment passed. The language itself matured quietly through it: ISO standardised Prolog in 1995 (ISO/IEC 13211-1), giving the many competing implementations a common core.5

04Where Prolog lives now

Reports of its death miss where it went. IBM Watson — the system that beat the best human Jeopardy! players in 2011 — used Prolog for its question-analysis layer: pattern-matching the parsed clue and extracting relations turned out to be exactly the search-over-rules problem Prolog was built for.6 The open-source SWI-Prolog is a genuinely modern platform — actively developed for over three decades, with HTTP servers, notebooks and a package manager7 — and Markus Triska's The Power of Prolog has become the standard free modern text.8

The bigger afterlife is by descent. Datalog, Prolog's restricted database-friendly subset, is having a renaissance in program analysis and modern databases — the Soufflé engine, for instance, compiles Datalog to parallel C++ to analyse millions of lines of code at industrial scale.9 And squint at the tools you already use: SQL asks what, not how; CSS selectors declare patterns and let the engine match; a type checker is a small logic engine deriving conclusions from premises. The Stanford Encyclopedia of Philosophy's survey of logic in AI traces exactly this diffusion — the ideas escaped the language.10

05Where OcxlyDev lands

Should you learn Prolog in 2026? Not for a job posting — there are few. Learn it for the same reason a pianist practises scales in an unfamiliar mode: an afternoon making append/3 run backwards will permanently change how you see the “declarative” parts of your daily stack, and the next time a problem smells like search-over-rules — a config validator, an access-policy engine, a scheduling puzzle — you'll recognise that writing the rules and letting an engine do the walking beats hand-rolling the loops. Install SWI-Prolog, work through the first chapters of The Power of Prolog, and ask a database a question you never told it how to answer. That feeling is the point.

About this piece. This is an editorial explainer from OcxlyDev, second in a three-part series on languages that shaped programming (Python · Prolog · Lisp). Historical claims link to primary or reputable secondary sources below; the code fragments are standard ISO Prolog.

References

  1. Colmerauer & Roussel — "The birth of Prolog", ACM History of Programming Languages II (1993)
  2. Kowalski — "Algorithm = Logic + Control", Communications of the ACM 22(7), 1979
  3. Markus Triska — The Power of Prolog (unification, backtracking, constraints; the modern free text)
  4. Wikipedia — Fifth Generation Computer Systems (Japan's 1982 logic-programming national project and its international response)
  5. ISO — ISO/IEC 13211-1:1995, Prolog Part 1: General core
  6. Association for Logic Programming — "Natural language processing with Prolog in the IBM Watson system" (Lally & Fodor, 2011)
  7. SWI-Prolog — official site (the dominant modern open-source implementation)
  8. The Power of Prolog — Introduction (what logic programming is)
  9. Soufflé — Datalog compiled to parallel C++ for industrial-scale static program analysis
  10. Stanford Encyclopedia of Philosophy — "Logical Approaches to Artificial Intelligence" (logic programming's role and diffusion)