4.8.1.2 Unification

The following predicates are related to unification. Unless mentioned otherwise, unification is performed without occurs-check (see ref-sem-occ).

To unify two terms, simply use:

     ?- X = Y.
Please note:

To unify two terms with occurs-check, use:

     ?- unify_with_occurs_check(X,Y).

To check whether two terms do not unify, use the following, which is equivalent to \+ (X=Y):

     ?- X \= Y.

To check whether two terms are either strictly identical or do not unify, use the following. This construct is useful in the context of when/2:

     ?- ?=(X,Y).

To constrain two terms to not unify, use the following. It blocks until ?=(X,Y) holds:

     ?- dif(X,Y).

Send feedback on this subject.