A \= B
is equivalent to not (A = B)
So lets compare =/2
and ==/2
first; from the swi-prolog manual:
?Term1 = ?Term2
Unify Term1 with Term2. True if the unification succeeds
@Term1 == @Term2
True if Term1 is equivalent to Term2.
Notice that =/2
tries to unify the terms and if it succeeds it's true while ==/2
just performs a check:
?- X = 1.
X = 1.
(implicit true.)
while
?- X == 1.
false.
and also:
?- X = Y.
X = Y.
?- X == Y.
false.
now, not/1
will invert the result and be true if =/2
or ==/2
was false.
for==/2
there is nothing complicated; if the terms were equivalent now it will return false otherwise true.
for =/2
you should remember that all unifications will be temporary:
?- \+ (\+ X = 1), print(X).
_G399
true.
(_G399
indicates that X
is non-instantiated)