this repo has no description
1%-----------------------------------------------------------------------------%
2% Requires that the array 'x' is lexicographically less than or equal to
3% array 'y'. Compares them from first to last element, regardless of indices
4%-----------------------------------------------------------------------------%
5
6predicate fzn_lex_lesseq_bool_reif(array[int] of var bool: x,
7 array[int] of var bool: y,
8 var bool: c) =
9 let { int: lx = min(index_set(x)),
10 int: ux = max(index_set(x)),
11 int: ly = min(index_set(y)),
12 int: uy = max(index_set(y)),
13 int: size = max(ux - lx, uy - ly),
14 array[0..size] of var bool: b }
15 % b[i] is true if the lexicographical order holds from position i on.
16 in
17 (c <-> b[0])
18 /\
19 forall(i in 0..size) (
20 b[i] = ( x[lx + i] <= y[ly + i]
21 /\
22 if i = size then true
23 else x[lx + i] < y[ly + i] \/ b[i+1] endif
24 )
25 );
26
27%-----------------------------------------------------------------------------%