[ library(ic_global) | Reference Manual | Alphabetic Index ]
lex_le(+List1, +List2)
List1 is lexicographically less or equal to List2
- List1
- List of integers or domain variables
- List2
- List of integers or domain variables
Description
Imposes a lexicographic ordering between the two lists.
I.e. either is the first element of List1 strictly smaller
than the first element of List2, or the first elements are
equal and the lexicographic order holds between the two list
tails.
Examples
L=[X, Y, Z], L :: 0..9, lex_le(L, [2, 3, 1]). % X::0..2
L=[X, Y, Z], L :: 0..9, lex_le(L, [2, 3, 1]), X=2. % Y::0..3
L=[X, Y, Z], L :: 0..9, lex_le(L, [2, 3, 1]), X#>2. % fail
L=[X, Y, Z], L :: 0..9, lex_le(L, [2, 3, 1]), X#<2. % true
L=[X, Y, Z], L :: 0..9, lex_le(L, [2, 3, 1]), Y=3. % X::0..2
L=[X, Y, Z], L :: 0..9, lex_le(L, [2, 3, 1]), Y#>3. % X::0..1
L=[X, Y, Z], L :: 0..9, lex_le(L, [2, 3, 1]), Y#<3. % X::0..2
lex_le([2, 3, 1], [3]). % true
See Also
ordered / 2, gfd : lex_le / 2, fd_global : lex_le / 2, fd_global_gac : lex_le / 2, ic_global_gac : lex_le / 2, lex_lt / 2