Noeud: Comparison of Terms, Noeud « Next »: Control, Noeud « Previous »: Arithmetic, Noeud « Up »: Built-In Predicates
These built-in predicates are meta-logical. They treat uninstantiated variables as objects with values which may be compared, and they never instantiate those variables. They should not be used when what you really want is arithmetic comparison (voir Arithmetic) or unification.
The predicates make reference to a standard total ordering of terms, which is as follows:
./2
.
These are the basic predicates for comparison of arbitrary terms:
Term1 ==
Term2
%>dyalog -s "?-X==Y. "
fails (answers no
) because X and Y are distinct
uninstantiated variables. However, the query
%>dyalog -s "?-X=Y,X==Y. " Answer : Y = X
succeeds because the first goal unifies the two variables
(voir Miscellaneous).
Term1 \==
Term2
Term1 @<
Term2
Term1 @>
Term2
Term1 @=<
Term2
Term1 @>=
Term2