ident(X,f(X)). ?- ident(X,X), write(1), ident(x,x), write(2), fail; write(3).