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_checkflag is the one that controls occurs checks for unification.You can set the flag with:
For example:
So first it unifies
Xwithf(X). If we later set theoccurs_checktotrue, then if we try to unifyXagain withf(X), it fails.