Prolog Docs

Links to important parts of the Prolog documentation.

The start of your file should at least contain:

:- use_module(library(clpfd)).
:- use_module(library(clpb)).

I also add the debug flag when writing my code:

:- debug.

Operators

The FD library operators use the pound sign #. You should prefer them over the “vanilla” operators.

#= #\=
#> #>= #< #=<
min(A,B). max(A,B).
A mod B.  A rem B.  A // B.  A div B.
abs(A).

Logical operations that work on booleans:

#\/       or (union)
#/\       and (intersection)
#\ A      not
A #\ B    exclusive or
#<==>     if and only if (equivalence)

Learning Prolog

Documentation

Last modified February 22, 2024: Prolog reference and fact sheet. (08586b3)