Create a predicate unify/2 that unifies its two arguments with occurs check.

?- unify(X,X).
true .

?- unify(X,Y).
X = Y .

?- unify(X,food(X)).
false.

?- unify(food(X),food(X)).
true .

?- unify(food(spicy(X)),food(X)).
false.