These predicates cause two expressions to be evaluated and their values to be compared.
Each arithmetic comparison predicate corresponds to an operation which depends on the types of the values which are obtained by evaluating the argument(s) of the predicate.
=:=/2
(arithmetic equal),
=\=/2
(arithmetic not equal),
</2
(arithmetic less than),
=<
(arithmetic less than or equal),
>/2
(arithmetic greater than),
>=/2
(arithmetic greater than or equal)
The following requirements are true for all P where P = {
=:=
,
=\=
,
<
,
=<
,
>
,
>=
}.
'P'(E1, E2)
is true iff evaluating
E1
and
E2
as expressions and performing the corresponding arithmetic operation
on their values is
true
.
Templates and modes for the predicate are as follows:
'=:='(@evaluable, @evaluable) '=\='(@evaluable, @evaluable) '<'(@evaluable, @evaluable) '=<'(@evaluable, @evaluable) '>'(@evaluable, @evaluable) '>='(@evaluable, @evaluable)
Let's start with some simple tests verifying success of failure of single goals.
Goal | Theory | success(String goal,String theory) |
---|---|---|
'=\='(0, 1). | null | true |
'<'(0, 1). | null | true |
'=<'(0, 1). | null | true |
'=:='(1.0, 1). | null | true |
'>='(1.0, 1). | null | true |
'=<'(1.0, 1). | null | true |
'=:='(3 * 2, 7 - 1). | null | true |
'>='(3 * 2, 7 - 1). | null | true |
'=<'(3 * 2, 7 - 1). | null | true |
Goal | Theory | success(String goal,String theory) |
---|---|---|
'=:='(0, 1). | null | false |
'>'(0, 1). | null | false |
'>='(0, 1). | null | false |
'=\='(1.0, 1). | null | false |
'<'(1.0, 1). | null | false |
'>'(1.0, 1). | null | false |
'=\='(3 * 2, 7 - 1). | null | false |
'<'(3 * 2, 7 - 1). | null | false |
'>'(3 * 2, 7 - 1). | null | false |
Test With Exception
Goal | Theory | success(String goal) | Type Of Error |
---|---|---|---|
'=:='(X, 5). | null | true | |
'=\='(X, 5). | null | true | |
'<'(X, 5). | null | true | |
'>'(X, 5). | null | true | |
'>='(X, 5). | null | true | |
'=<'(X, 5). | null | true |