Related Paradigms
A subset of Prolog without function symbols — always terminates, used for database queries and program analysis (Soufflé, Datomic, LogicBlox, CodeQL-like engines).
40.1 Datalog
A subset of Prolog without function symbols — always terminates, used for database queries and program analysis (Soufflé, Datomic, LogicBlox, CodeQL-like engines). Prolog with tabling can run Datalog directly.
40.2 Answer Set Programming (ASP)
Stable-model semantics for combinatorial search (clingo/Potassco):
s(CASP) brings goal-directed ASP to SWI/Ciao.
color(red;green;blue).
1 { assign(N, C) : color(C) } 1 :- node(N).
:- edge(X, Y), assign(X, C), assign(Y, C).40.3 Probabilistic logic programming
ProbLog, cplint (SWI pack, PITA), LPAD:
0.6::rain.
0.9::wet :- rain.
query(wet).40.4 Other logic languages
Mercury — strongly typed, moded, compiled logic/functional language.
λProlog (Teyjus, ELPI) — higher-order logic programming.
Curry — functional logic programming.
miniKanren — embedded logic programming (Scheme, Clojure core.logic).
Logtalk — object-oriented extension running on top of most Prologs.
Erlang was originally implemented in Prolog and inherits syntax from it.
🧪 Part III Exercises
Rewrite list_without/3 and max_of/3 purely (no cuts) using dif/2, if_/3, or CLP(FD).
Solve the zebra puzzle with CLP(FD).
Write a CLP(FD) timetable: 5 courses, 3 rooms, 4 time slots, no teacher conflicts.
Implement a leq/2 solver in CHR and test cycle detection.
Use tabling to compute reachability in a graph with cycles and shortest paths via answer subsumption.
Write a meta-interpreter that returns proof trees and prints a "how" explanation.
Solve the missionaries & cannibals puzzle with BFS, then with iterative deepening.
Build a small expert system for diagnosing car problems with "why" questions.
Implement a tokenizer + DCG parser + interpreter for a tiny language with variables, if, and while.
Use concurrent_maplist/3 to speed up a CPU-heavy computation and measure with time/1.