<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
the	O
occurs	B-Application
check	I-Application
is	O
a	O
part	O
of	O
algorithms	O
for	O
syntactic	O
unification	B-Algorithm
.	O
</s>
<s>
It	O
causes	O
unification	B-Algorithm
of	O
a	O
variable	O
V	O
and	O
a	O
structure	O
S	O
to	O
fail	O
if	O
S	O
contains	O
V	O
.	O
</s>
<s>
In	O
theorem	B-Application
proving	I-Application
,	O
unification	B-Algorithm
without	O
the	O
occurs	B-Application
check	I-Application
can	O
lead	O
to	O
unsound	O
inference	O
.	O
</s>
<s>
:	O
the	O
negation	O
of	O
that	O
formula	O
has	O
the	O
conjunctive	B-Application
normal	I-Application
form	I-Application
,	O
with	O
and	O
denoting	O
the	O
Skolem	B-Application
function	I-Application
for	O
the	O
first	O
and	O
second	O
existential	O
quantifier	O
,	O
respectively	O
;	O
the	O
literals	O
and	O
are	O
unifiable	O
without	O
occurs	B-Application
check	I-Application
,	O
producing	O
the	O
refuting	O
empty	O
clause	O
.	O
</s>
<s>
Prolog	B-Language
implementations	O
usually	O
omit	O
the	O
occurs	B-Application
check	I-Application
for	O
reasons	O
of	O
efficiency	O
,	O
which	O
can	O
lead	O
to	O
circular	O
data	O
structures	O
and	O
looping	O
.	O
</s>
<s>
Modern	O
implementations	O
,	O
based	O
on	O
Colmerauer	O
's	O
Prolog	B-Language
II	I-Language
,	O
</s>
<s>
use	O
rational	O
tree	O
unification	B-Algorithm
to	O
avoid	O
looping	O
.	O
</s>
<s>
See	O
image	O
for	O
an	O
example	O
run	O
of	O
the	O
unification	B-Algorithm
algorithm	O
given	O
in	O
Unification	B-Algorithm
(	O
computer	B-General_Concept
science	I-General_Concept
)	O
#A	O
unification	B-Algorithm
algorithm	O
,	O
trying	O
to	O
solve	O
the	O
goal	O
,	O
however	O
without	O
the	O
occurs	B-Application
check	I-Application
rule	O
(	O
named	O
"	O
check	O
"	O
there	O
)	O
;	O
applying	O
rule	O
"	O
eliminate	O
"	O
instead	O
leads	O
to	O
a	O
cyclic	O
graph	O
(	O
i.e.	O
</s>
<s>
ISO	O
Prolog	B-Language
implementations	O
have	O
the	O
built-in	O
predicate	O
unify_with_occurs_check/2	O
for	O
sound	O
unification	B-Algorithm
but	O
are	O
free	O
to	O
use	O
unsound	O
or	O
even	O
looping	O
algorithms	O
when	O
unification	B-Algorithm
is	O
invoked	O
otherwise	O
,	O
provided	O
the	O
algorithm	O
works	O
correctly	O
for	O
all	O
cases	O
that	O
are	O
"	O
not	O
subject	O
to	O
occurs-check	O
"	O
(	O
NSTO	O
)	O
.	O
</s>
<s>
Implementations	O
offering	O
sound	O
unification	B-Algorithm
for	O
all	O
unifications	B-Algorithm
are	O
Qu-Prolog	O
and	O
Strawberry	O
Prolog	B-Language
and	O
(	O
optionally	O
,	O
via	O
a	O
runtime	O
flag	O
)	O
:	O
XSB	B-Language
,	O
SWI-Prolog	B-Application
,	O
,	O
and	O
.	O
</s>
<s>
of	O
optimizations	O
can	O
render	O
sound	O
unification	B-Algorithm
feasible	O
for	O
common	O
cases	O
.	O
</s>
