Noeud: Comparison of Terms, Noeud « Next »: , Noeud « Previous »: Arithmetic, Noeud « Up »: Built-In Predicates



Comparison of Terms

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:

These are the basic predicates for comparison of arbitrary terms:

Term1 == Term2
Tests if the terms currently instantiating Term1 and Term2 are literally identical (in particular, variables in equivalent positions in the two terms must be identical). For example, the query
          %>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
Tests if the terms currently instantiating Term1 and Term2 are not literally identical.
Term1 @< Term2
Term Term1 is before term Term2 in the standard order.
Term1 @> Term2
Term Term1 is after term Term2 in the standard order.
Term1 @=< Term2
Term Term1 is not after term Term2 in the standard order.
Term1 @>= Term2
Term Term1 is not before term Term2 in the standard order.