In Prolog - Programming for Artificial Intelligence, Bratko says the following on page 58.
"Matching in Prolog corresponds to what is called unification in logic. However, we avoid the word unification because matching, for for efficiency reasons in most Prolog systems, is implemented in a way that does not exactly correspond to unification. Proper unification requires the so-called occurs check: does a given variable occur in a given term? The occurs check would make matching inefficient."
My questions is if unification in miniKanren suffers this efficiency penalty or how is this problem solved?
In Prolog, the occurs check is optional. In SWI Prolog, you can turn it globally on, off, or configure Prolog to raise an
error
when the occurs check succeeds (which is very useful for debugging programs that are intended to run with the occurs check turned off)On the other hand, in miniKanren, the occurs check is non-optional.