[ library(cardinal) | Reference Manual | Alphabetic Index ]
# minimum(?SetVariable, ?Min)

Minimum of a set of integers
*SetVariable*
- A Set (variable or ground) of integers.
*Min*
- An integer or an FD variable.

## Description

Min is the minimum (i.e. the lowest element) of SetVariable.
If Min is given (as an integer or FD variable) then SetVariable is
constrained to have such minimum.
If Min is a free variable, then it is unified with the set's minimum as
an FD variable or an integer (if it is already known).

minimum/2 can thus be used either to declare (or constrain) a minimum
function or to retrieve it.

### Fail Conditions

Fails if Min can not be the minimum of SetVariable.
### Resatisfiable

No.
## Examples

?- S`::[]..[1,2], minimum(S,M).
?- set(S,[],[1,2],[minimum:1], minimum(S,M).
M = 1
?- S`::[]+[1,2], minimum(S,2).
S = [2]
?- set(S,[],[1,2],[minimum:2], minimum(S,M).
S = [2]
M = 2

## See Also

maximum / 2, set / 4, sets / 4, cardinality / 2