Not should be placed after Prolog Instantiation, so that it compares the instantiated values.
Negation Operator
% negation of X
\+X not Functor
not(G).Not Equals
% equivalent
X \= Y.
not(X = Y).Not should be placed after Prolog Instantiation, so that it compares the instantiated values.
% negation of X
\+X not Functornot(G).% equivalent
X \= Y.
not(X = Y).