According to Wikipedia:
Implementations offering sound unification for all unifications are Qu-Prolog and Strawberry Prolog and (optionally, via a runtime flag): XSB, SWI-Prolog and Tau Prolog.
However, when I do apropos(occur)
it only finds unify_with_occurs_check/2
. The man page doesn't mention "occur" either. How can the occurs check be enabled for all unifications in SWI-Prolog?
In the section on Environment Control, it lists the flags of the system. The
occurs_check
flag is the one that controls occurs checks for unification.You can set the flag with:
For example:
So first it unifies
X
withf(X)
. If we later set theoccurs_check
totrue
, then if we try to unifyX
again withf(X)
, it fails.