<!-- Markdown version of https://ocxly.com/prolog-field-guide.html · auto-generated, may lag the live page -->

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

In most languages you tell the computer what to do. In Prolog you state what is true, ask a question, and the system works out how. Fifty years on it is a niche language, but the idea it embodied runs your database, your type checker, and once helped a computer win a quiz show.

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. Ask it `?- grandparent(tom, Who).` and Prolog answers `Who = ann`. Notice what you did not write: no loops, no search code, no step-by-step instructions. You described a world, and 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](#ref-1) The theory came from Edinburgh, where 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 equation, published in the *Communications of the ACM*, summed it up: **Algorithm = Logic + Control**.[2](#ref-2) You supply the logic; the language supplies the control.

## 02How it actually works (in plain English)

Two mechanisms do most of the work. **Unification** is pattern-matching taken further: Prolog makes two terms equal by finding values for their variables, in either direction, so there are no fixed 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, and if it reaches a dead end it undoes its choices and tries the next one, exhaustively and automatically. What you would hand-write elsewhere as nested loops and a stack of partial solutions, Prolog provides for free.[3](#ref-3)

The catch is the second half of Kowalski's equation. When the built-in control strategy fits your problem, Prolog programs are very short (a Sudoku solver is about a page[3](#ref-3)); when it does not, you end up steering the search with the *cut* operator, and the declarative style becomes procedural quickly. Prolog is at its best when the problem really 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 holds, little else matches its economy.

## 03Boom, winter, standard

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

## 04Where Prolog lives now

The 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 was exactly the search-over-rules problem Prolog was built for.[6](#ref-6) The open-source **SWI-Prolog** is a genuinely modern platform, actively developed for over three decades, with HTTP servers, notebooks, and a package manager,[7](#ref-7) and Markus Triska's *The Power of Prolog* has become the standard free modern text.[8](#ref-8)

The larger afterlife is by descent. **Datalog**, Prolog's restricted database-friendly subset, is having a revival in program analysis and modern databases; the Soufflé engine, for example, compiles Datalog to parallel C++ to analyse millions of lines of code at industrial scale.[9](#ref-9) And the tools you already use rhyme with it: 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 this diffusion; the ideas escaped the language.[10](#ref-10)

## 05Where OcxlyDev lands

Should you learn Prolog in 2026? Not for a job posting; there are few. Learn it the way a pianist practises scales in an unfamiliar mode: an afternoon making `append/3` run backwards will change how you see the declarative parts of your daily stack, and the next time a problem looks like search-over-rules, a config validator, an access-policy engine, a scheduling puzzle, you will 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.

### References

1. [Colmerauer & Roussel — "The birth of Prolog", ACM History of Programming Languages II (1993)](https://dl.acm.org/doi/10.1145/155360.155362)
2. [Kowalski — "Algorithm = Logic + Control", *Communications of the ACM* 22(7), 1979](https://dl.acm.org/doi/10.1145/359131.359136)
3. [Markus Triska — *The Power of Prolog* (unification, backtracking, constraints; the modern free text)](https://www.metalevel.at/prolog)
4. [Wikipedia — Fifth Generation Computer Systems (Japan's 1982 logic-programming national project and its international response)](https://en.wikipedia.org/wiki/Fifth_Generation_Computer_Systems)
5. [ISO — ISO/IEC 13211-1:1995, Prolog Part 1: General core](https://www.iso.org/standard/21413.html)
6. [Association for Logic Programming — "Natural language processing with Prolog in the IBM Watson system" (Lally & Fodor, 2011)](https://logicprogramming.org/2011/03/natural-language-processing-with-prolog-in-the-ibm-watson-system/)
7. [SWI-Prolog — official site (the dominant modern open-source implementation)](https://www.swi-prolog.org/)
8. [*The Power of Prolog* — Introduction (what logic programming is)](https://www.metalevel.at/prolog/introduction)
9. [Soufflé — Datalog compiled to parallel C++ for industrial-scale static program analysis](https://souffle-lang.github.io/)
10. [Stanford Encyclopedia of Philosophy — "Logical Approaches to Artificial Intelligence" (logic programming's role and diffusion)](https://plato.stanford.edu/entries/logic-ai/)

---
*Source: [ocxly.com/prolog-field-guide.html](https://ocxly.com/prolog-field-guide.html) — OCXLY, free 100% client-side privacy-first tools. A detailed, cited field guide to Prolog: facts, rules and queries; unification and backtracking explained plainly; the Fifth Generation project and the AI winter; IBM Watson's Prolog layer; and Datalog's modern renaissance.*
