These predicates use a standard total order when comparing terms. The standard total order is:

variables`@<`

database references`@<`

numbers`@<`

atoms`@<`

compound terms

(Interpret `@<`

as "comes before".)

Within these categories, ordering is as follows.

- Variables are put in a standard order. (Roughly, the oldest
variable is put first; the order is not related to the names of variables.
Users should not rely on the order of variables. They should be
considered implementation dependent. The ordering of variables within
a sorted list, as produced by
`setof/3`

or`sort/2`

, shall remain constant.) - Database references are put in a standard order (the order is based roughly on the time of creation of the reference).
- Numbers are put in numeric order. Where a number may be represented by an integer or a floating-point number, as in 2 and 2.0, the integer is considered to be infinitesimally smaller than its floating-point counterpart.
- Atoms are put in alphabetical order according to the character set in use.
- Compound terms are ordered first by arity, then by the name of the principal functor, then by the arguments (in left-to-right order).
- Lists are compared as ordinary compound terms with functor
`./2`

For example, here is a list of terms in the standard order:

[ X, '$ref'(123456,12), -9, 1, 1.0, fie, foe, fum, [1], X = Y, fie(0,2), fie(1,1) ]

The predicates for comparison of terms are described below.

`T1``==`

`T2``T1`and`T2`are literally identical (in particular, variables in equivalent positions in the two terms must be identical).`T1``\==`

`T2``T1`and`T2`are*not*literally identical.`T1``@<`

`T2``T1`is before term`T2`in the standard order.`T1``@>`

`T2``T1`is after term`T2``T1``@=<`

`T2``T1`is not after term`T2``T1``@>=`

`T2``T1`is not before term`T2``compare(`

`Op, T1, T2``)`

- the result of comparing terms
`T1`and`T2`is`Op`, where the possible values for`Op`are:`=`

- if
`T1`is identical to`T2`, `<`

- if
`T1`is before`T2`in the standard order, `>`

- if
`T1`is after`T2`in the standard order.