Barber Paradox - in Prolog

In Prolog

In Prolog, one aspect of the Barber paradox can be expressed by a self-referencing clause:

shaves(barber, X) :- male(X), not shaves(X,X).
male(barber).

where negation as failure is assumed. If we apply the stratification test known from Datalog, the predicate shaves is exposed as unstratifiable since it is defined recursively over its negation.

Read more about this topic:  Barber Paradox