Prolog Language

Logical Purity

dif/2

The predicate dif/2 is a pure predicate: It can be used in all directions and with all instantiation patterns, always meaning that its two arguments are different.

CLP(FD) constraints

CLP(FD) constraints are completely pure relations. They can be used in all directions for declarative integer arithmetic:

?- X #= 1+2.
X = 3.

?- 3 #= Y+2.
Y = 1.

Unification

Unification is a pure relation. It does not produce side effects and can be used in all directions, with either or both arguments fully or only partially instantiated.

In Prolog, unification can happen

  • explicitly, using built-in predicates like (=)/2 or unify_with_occurs_check/2
  • implicitly, when unification is used for selecting a suitable clause.

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow