Hacker News new | ask | show | jobs
by fspeech 2671 days ago
Prolog is a general programming language with built-in backchaining semantics. It in general does not know how to solve constraints. Indeed if your clauses have loops Prolog will just run in circles until it is out of stack space. The following common rules for equivalence are good examples of valid logic statements that do not work with Prolog's naive execution strategy:

% Symmetry

f(A, B) :- f(B, A).

% Transitivity

f(A, C) :- f(A, B), f(B, C).

Indeed in general finding the symmetric/transitive closure of relations is a very hard problem. Constraint/SAT solvers use heuristics to solve problems like the above and can accept much more declarative specifications than Prolog.