Prolog Docs
Links to important parts of the Prolog documentation.
Header
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
- Learn Prolog Now!
- The examples in the clpfd documentation are great for logic programming.
Documentation
-
-
logic including “if and only if”
-
clpb library for working with boolean variables
- operations on booleans
- satisfiability-type operations
- all clpb functions