What is the difference between A \= B and not(A==B) in Prolog?
I found this http://www.learnprolognow.org/lpnpage.php?pagetype=html&pageid=lpn-htmlse5
and this wiki page
http://en.wikibooks.org/wiki/Prolog/Built-in_predicates
but it didn’t help me since there is no clarification to the difference, nor short meaning for \=.
Thanks.
A \= Bis equivalent tonot (A = B)So lets compare
=/2and==/2first; from the swi-prolog manual:Notice that
=/2tries to unify the terms and if it succeeds it’s true while==/2just performs a check:while
and also:
now,
not/1will invert the result and be true if=/2or==/2was false.for
==/2there is nothing complicated; if the terms were equivalent now it will return false otherwise true.for
=/2you should remember that all unifications will be temporary:(
_G399indicates thatXis non-instantiated)