## 4.1  Various Constraints on Lists

The library ic_global implements a number of constraints over lists of integer variables. It is loaded using one of
```:- use_module(library(ic_global)).
:- lib(ic_global).
```
The following predicates are provided
alldifferent(+List)

A version of alldifferent/1 with strong propagation.

alldifferent(+List, ++Capacity)

Like alldifferent/1, but every value may occur Capacity times.

minlist(+List, ?Min)

Min is the minimum of the values in List. Operationally: Min gets updated to reflect the current range of the minimum of variables and values in List. Likewise, the list elements get constrained to the minimum given.

maxlist(+List, ?Max)

Max is the maximum of the values in List. Operationally: Max gets updated to reflect the current range of the maximum of variables and values in List. Likewise, the list elements get constrained to the maximum given.

lexico_le(+List1, +List2)

Imposes a lexicographic ordering between the two lists.

ordered(++Relation, +List)

Constrains List to be ordered according to Relation. Relation is one of the atoms <, =<, >, >=, = .

ordered_sum(++List, +Sum)

The list elements are ordered and their sum is Sum.

occurrences(++Value, +List, ?N)

The value Value occurs in List N times. Operationally: N gets updated to reflect the number of possible occurrences in the List. List elements may get instantiated to Value, or Value may be removed from their domain if required by N.

sorted(?List, ?Sorted)

Sorted is a sorted permutation of List.

sorted(?List, ?Sorted, ?Positions)

Sorted is a sorted permutation of List and Positions is a list whose elements indicating the position of each unsorted list element within the sorted list.

sumlist(+List, ?Sum)

The sum of the list elements is Sum. This constraint is more efficient than a general IC sum constraint if the list is long and Sum is not constrained frequently.