# Module ordered

This module provides ordered elements. The module realizes a base class for the classes represented by the module integer and the module rational from the package groebner. The predicates (=:=)/2 and (=\=)/2 check equality of integers and rational numbers. The predicates (<)/2, (=<)/2, (>)/2 and (>=)/2 allow comparison of integers and rational numbers. The predicates override the usual built-in predicates.

Examples:
`?- -9/5 > -2.Yes?- X is [0,1,2], 3 < len(X).No`

The predicates perform a polymorphic dispatch to the method gen_eq/2 respective gen_ls/2 on the class of the first argument. If a method is not found comparison aborts. If a method is found, the class of the second argument is checked. Derived from (<)/2 we also provide constructors min/2, max/2, abs/2 and sign/2 to determine corresponding values.

Further there are the constructors integer/1, floor/1 and ceiling/1 that will find and return an integer near the given integer or rational number. The constructor integer/1 rounds toward zero, the constructor floor/1 rounds towards negative infinity and the constructor ceiling/1 rounds towards positive infinity.

The following ordered elements predicates are defined:

E =:= F:
The predicate succeeds when evaluating E and F by using polymorphism gives the same constant result.
E =\= F:
The predicate succeeds when evaluating E and F by using polymorphism don’t give the same constant result.
E < F:
The predicate succeeds when evaluating E by using polymorphism is less than evaluating F by using polymorphism.
E =< F:
The predicate succeeds when evaluating E by using polymorphism is less or equal than evaluating F by using polymorphism.
E > F:
The predicate succeeds when evaluating E by using polymorphism is greater than evaluating F by using polymorphism.
E >= F:
The predicate succeeds when evaluating E by using polymorphism is greater or equal than evaluating F by using polymorphism.
min(X, Y, Z):
The predicate succeeds in Z with the minimum of X and Y.
max(X, Y, Z):
The predicate succeeds in Z with the maximum of X and Y.
abs(X, Y):
The predicate succeeds in Z with the absolute of X.
sign(X, Y):
The predicate succeeds in Z with the sign of X.
integer(P, Q):
The predicate succeeds in Q with the integer of P.
floor(P, Q):
The predicate succeeds in Q with the floor of P.
ceiling(P, Q):
The predicate succeeds in Q with the ceiling of P.
float(P, Q):
The predicate succeeds in Q with the float of P.