PLOGHELP EQUAL Chris Mellish, August 1982
Jonathan Laventhol, June 1983
Revised by Kathryn Seifert October 1986
Operators which perform the "equals" operation, and related operations
?- X = Y.
?- X \= Y.
?- X =:= Y.
?- X =\= Y.
?- X == Y.
?- X \== Y.
Keywords: equality, unify, unification, identity, evaluation,
arithmetic expressions
-- INTRODUCTION -------------------------------------------------------
There are three predicates which begin with the equals sign "=", and
have roughly the sense of the word equals. (There is also =.. which is
described in PLOGHELP * UNIV) Notice that all these predicates can be
written in prefix form as well:
?- =(X, Y).
We normally use the infix form, and by default, all of these operators
have precedence 40 and fix "xfx". See PLOGHELP * OP and * OPERATORS.
Also note that there are negated forms as well.
-- DESCRIPTION OF THE DIFFERENT OPERATIONS ----------------------------
?- X = Y.
X and Y are equal (can be matched).
?- X \= Y.
X and Y are cannot be matched.
?- X =:= Y.
Arithmetic expressions X and Y evaluate to the same number. X
and Y can be simple integers or real numbers, or they can be
constructed from the special functors recognised by 'is' (see
PLOGHELP * IS).
?- X =\= Y.
Arithmetic expression do not evaluate to the same number.
?- X == Y.
X and Y are identical. Uninstantiated variables in corresponding
positions must already be "sharing" for this to be true.
?- X \== Y.
X and Y are not identical.
-- RELATED DOCUMENTATION ----------------------------------------------
PLOGHELP * IS
Evaluating POP-11 and arithmetic expressions which return one result
PLOGHELP * SYMBOLS
Summary and index of HELP files for symbols used in Prolog
PLOGHELP * OPERATORS
Operator declarations made when the Prolog system is loaded
PLOGHELP * OP
How to declare operators