PROVIDER - logic programming and rule inference in one engine

Prolog

Prolog arrived in Marseille in 1972 and expresses problems as facts and rules that an engine resolves through unification and backtracking; SWI-Prolog keeps it practical for constraint solving and rule checking, while the general ecosystem and talent pool stay small.

Programming Languages & Frameworks France 2026.11.19
3.7pts

Detailed Notes

Pros 5 items

Implemented in 1972 by Alain Colmerauer and Philippe Roussel at the University of Aix-Marseille, built on Horn clauses and unification
Declarative style: you state facts and rules, and the engine resolves queries through unification and backtracking, so 1 query enumerates every solution
The core is standardized as ISO/IEC 13211-1:1995, with further parts covering modules and constraints
SWI-Prolog, dating from 1987, bundles CLP(FD) and CLP(R) constraint libraries plus an HTTP server
Still deployed across 4 scenario families: expert systems, NLP, compliance rule checking and formal verification

Cons 4 items

General engineering support is thin, so web, concurrency and persistence come from SWI-Prolog packs assembled by hand
Backtracking search degrades badly on combinatorial problems without pruning, indexing and constraint modelling
Industrial jobs are rare, so teams without Prolog experience face a steep maintenance cost
Debugging means reading a search tree, which is far from imperative habits

Service Overview

Prolog was implemented in 1972 by Alain Colmerauer and Philippe Roussel at the University of Aix-Marseille, resting on Kowalski's resolution formulation of Horn clauses. Programs no longer describe how to compute: they state what is true, and a query asks the engine to find substitutions that make it hold.

In the languages and frameworks category it represents the declarative style. SWI-Prolog is the most active open-source implementation, originating at the University of Amsterdam in 1987, and adds constraint libraries, an HTTP server, unit testing and a graphical debugger.

Key Strengths

  • Declarative modelling: business rules become clauses, so a requirement change touches a local definition instead of a control flow
  • Search built in: backtracking and pattern matching replace hand-written traversal over combinations
  • Constraint solving: CLP(FD) and CLP(R) express scheduling, configuration and allocation problems directly
  • Metaprogramming: clauses can be inspected and constructed at runtime, which suits rule engines and code generation
  • Connected to classical AI: expert systems, definite clause grammars and knowledge-graph reasoning all have established idioms

Product Ecosystem

Main implementations

SWI-Prolog (open source, widest ecosystem), SICStus Prolog (commercial, industrial), GNU Prolog (lean and compiled), ECLiPSe (constraint focused) and Tau Prolog (runs in the browser).

Libraries and extensions

SWI-Prolog packs provide CLP(FD), DCG support, HTTP, SQL and Pengines for remote queries.

Related paradigms

Datalog is a decidable subset of Prolog used in policy engines and static analysis; answer set programming shares the same lineage.

Limitations

  • Weak general backend support: sessions, authentication and migrations must be built or delegated elsewhere
  • Search performance depends on modelling; without pruning and indexing, a few rules can trigger exponential backtracking
  • Debugging is demanding: tracing the search tree and variable bindings requires training, and handovers get expensive
  • Few jobs: hiring is almost nonexistent in most markets, so maintenance needs internal training

Use Cases

  • Business rule validation and compliance checks (★★★★): rules stay readable and can change incrementally
  • Constraint and scheduling problems (★★★★): CLP(FD) models beat hand-written search
  • Grammar analysis and NLP prototypes (★★★★): DCGs put grammars directly in code
  • High-concurrency web services (★★): prefer Go or Java

Pricing

Item Price Notes
SWI-Prolog $0 Open source under a BSD-2 style licence, usable commercially
GNU Prolog and ECLiPSe $0 Open-source implementations
SICStus Prolog Per seat subscription Commercial build with industrial support and certification tooling

Most teams can take SWI-Prolog from prototype to production; paid implementations matter when commercial support or certification is required.

FAQ

  • Does Prolog fit business systems? It fits rule-driven modules such as risk policy, pricing and permission checks, not the whole application. The backend routes in languages and frameworks are a safer base.
  • How is it different from Datalog? Datalog forbids function symbols so evaluation is decidable and terminating; Prolog is more general and can loop forever. Policy engines lean on Datalog, richer reasoning leans on Prolog.
  • How do you avoid backtracking blow-ups? Replace generate-and-test with constraints, add indexing on key predicates, reorder clauses and prune explicitly with cuts or once/1.

Code Examples

Facts, rules and a query

% facts
plan(vps_basic, 59).
plan(vps_standard, 99).
plan(dedicated, 599).

region(vps_basic, hk).
region(vps_standard, us).
region(dedicated, de).

% rule: under 100 and available in Hong Kong or the US
affordable_asia_us(X) :-
    plan(X, P), P < 100,
    region(X, R), (R = hk ; R = us).

% ?- affordable_asia_us(X).
% X = vps_basic ;
% X = vps_standard.

Typing a semicolon at the prompt asks the engine for the next solution.

Finite domain constraints

:- use_module(library(clpfd)).

schedule(Tasks) :-
    Tasks = [A, B, C],
    Tasks ins 0..24,
    A #< B, B #< C,
    C - A #>= 8,
    sum(Tasks, #=, 24),
    label(Tasks).

ins declares domains and label/1 starts the search, while propagation does most of the work.

Community & Resources

Visit Prolog Website → https://www.swi-prolog.org/
Visit Website ↗