These predicates test the ordering of two terms as defined by the specification.
A goal executing any of these built-in predicates simply succeeds or fails; there is no side effect, unification, or error.
@=</2
(term less than or equal),
==/2
(term identical),
\==/2
(term not identical),
@</2
(term less than),
@>/2
(term greater than),
@>=/2
(term greater than or equal)
These predicates also test the identity and term-precedence of their
arguments. As an example,
'@=<'(X, Y)
is true iff
X
preceds
Y
as defined by the specification, or
X
and
Y
are identical terms.
Templates and modes for the predicate are as follows:
'@=<'(@term, @term) '=='(@term, @term) '\\=='(@term, @term) '@<'(@term, @term) '@>'(@term, @term) '@>='(@term, @term)
Let's start with some simple tests verifying success of failure of single goals.
Goal | Theory | success(String goal,String theory) |
---|---|---|
'@=<'(1.0, 1). | null | true |
'@<'(1.0, 1). | null | true |
'@=<'(aardvark, zebra). | null | true |
'@=<'(short, short). | null | true |
'@=<'(short, shorter). | null | true |
'@>'(foo(b), foo(a)). | null | true |
'@<'(foo(a, X), foo(b, Y)). | null | true |
'@<'(foo(X, a), foo(Y, b)). | null | true |
'@=<'(X, X). | null | true |
'=='(X, X). | null | true |
'@=<'(X, Y). | null | true |
'\=='(_, _). | null | true |
'@=<'(_, _). | null | true |
'@=<'(foo(X, a), foo(Y, b)). | null | true |
Goal | Theory | success(String goal,String theory) |
---|---|---|
'\=='(1, 1). | null | false |
'@>='(short, shorter). | null | false |
'@<'(foo(a, b), north(a)). | null | false |
'=='(X, Y). | null | false |
'=='(_, _). | null | false |