?- 3 = 3.
Yes.
?- 3 = 4.
No.
?- hello = hello.
Yes.
?- hello = 3.
No.
?- foo(a,2) = foo(a,2).
Yes.
?- foo(a,2) = foo(b,2).
No.
?- foo(a,2) = foo(a,2,c).
No.
?- foo(3,4) = 7.
No.
?- +(3,4) = 7.
No.
?- 3 + 4 = 7.
No.
Note in particular the last two examples (which are equivalent):
there is no automatic arithmetic evaluation. The term +(3,4) is simply
a data structure with two arguments, and therefore of course different from
any number.
X = 7 is true with X instantiated to 7
X = Y is true with X aliased to Y (or vice versa)
foo(X) = foo(7) is true with X instantiated to 7
foo(X,Y) = foo(3,4) is true with X instantiated to 3 and Y to 4
foo(X,4) = foo(3,Y) is true with X instantiated to 3 and Y to 4
foo(X) = foo(Y) is true with X aliased to Y (or vice versa)
foo(X,X) = foo(3,4) is false because there is no possible value for X
foo(X,4) = foo(3,X) is false because there is no possible value for X