A paper I'm reading says the following:
Plaisted [3] showed that it is possible to write formally correct PROLOG programs using first-order predicate-calculus semantics and yet derive nonsense results such as 3 < 2.
It is referring to the fact that Prologs didn't use the occurs check back then (the 1980s).
Unfortunately, the paper it cites is behind a paywall. I'd still like to see an example such as this. Intuitively, it feels like the omission of the occurs check just expands the universe of structures to include circular ones (but this intuition must be wrong, according to the author).
I hope this example isn't
smaller(3, 2) :- X = f(X).
That would be disappointing.
Here is the example from the paper in modern syntax:
Indeed we get:
Because:
Specifically, this explains the choice of 3 and 2 in the query: Given
X = s(s(X))
the value ofs(X)
is "three-ish" (it contains three occurrences ofs
if you don't unfold the innerX
), whileX
itself is "two-ish".Enabling the occurs check gets us back to logical behavior:
So this is indeed along the lines of