Spokes.wiki Search About
Defined Term paradigm updated Thu Aug 06 2026 00:00:00 GMT+0000 (Coordinated Universal Time)

Logic programming

A paradigm in which a program is a set of facts and rules in a subset of first-order logic, and running it means posing a query the system tries to prove. The machinery underneath is unification (matching a goal against clause heads, binding variables both directions) plus backtracking over alternatives — SLD resolution in prolog, the paradigm’s canonical language.

The difference from everything else in this spoke is what a program is. In c, go, rust and the rest, a program is a sequence of state changes, however disguised. Even clojure‘s immutability keeps evaluation going one direction: expressions produce values. A logic program describes relations, and the same clause can run backwards — the relation between a list and its reverse answers “what is the reverse of this” and “what reverses to this” with no additional code.

The paradigm’s own complaint about itself

prolog‘s recorded criticisms are unusually candid for the corpus and they are all one criticism: the declarative reading is not the whole truth. Clause order matters, depth-first search can diverge, performance depends on where the choice points are, and the cut exists so a programmer can prune the search — which trades away the bidirectionality that made the paradigm attractive. Writing effective Prolog means holding both readings at once, the logical one and the operational one.

That is why the-power-of-prolog is a position rather than a tutorial: its argument is that the declarative reading should be defended, using dif/2, declarative arithmetic and constraints instead of cuts. The paradigm has an internal dispute about its own centre, which nothing else in the founding corpus does.

What it does to this spoke’s axes

programming-language sorts languages by memory, concurrency, runtime and governance. Logic programming does not answer those questions differently so much as make them secondary — the interesting axis here is the evaluation strategy, and that axis was invisible while the corpus held only imperative and functional languages. It is the first evidence that the four axes were a portrait of the sources, not a theory.

The axis generalized (added 2026-08-06). This page argued that evaluation strategy, not memory or concurrency, is what separates a logic language from the rest. haskell‘s laziness makes that a corpus-wide axis rather than a Prolog exception, and it now has its own page: evaluation-strategy.

prolog · the-power-of-prolog · programming-language · spark · evaluation-strategy · synthesis