[ library(gfd) | Reference Manual | Alphabetic Index ]

::(?Var, ++Domain, ?Bool)

Reflect into Bool the truth of Var having the domain Domain.
Var
(Domain) variable (array notation accepted)
Domain
Domain specification
Bool
Reified truth value (array notation accepted)

Description

Provides a reified form of the ::/2 domain assignment predicate. This reified ::/3 is defined only to work for one variable (unlike ::/2).

For a single variable, V, the Bool will be instantiated to 0 if the current domain of V does not intersect with Domain. It will be instantiated to 1 iff the domain of V is wholly contained within Domain. Finally the Boolean will remain a domain variable in the range 0..1, if neither of the above two conditions hold.

Instantiating Bool to 1, will cause the constraint to behave exactly like ::/2. Instantiating Bool to 0 will cause Domain to be excluded from the domain of the variable.

Note that calling the reified form of :: will result in the Variable becoming a domain variable, even if Bool is uninstantiated.

Further note that, like other reified predicates, :: can be used infix in a GFD expression, e.g. B #= (X :: [1..10]) is equivalent to ::(X, [1..10], B).

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Examples

[eclipse 2]: ::(X, [1..10, 12..30], 1).

X = X{[1 .. 10, 12 .. 30]}


[eclipse 2]: ::(X, [1..10, 12..30], 0).

X = X{[-1000000 .. 0, 11, 31 .. 1000000]}

[eclipse 2]: ::(X, [1..10, 12..30], B).

X = X{[-1000000 .. 1000000]}
B = B{[0, 1]}

[eclipse 2]: gfd:( B #= (X :: [1..10, 12..30])).

B = B{[0, 1]}
X = X{[-1000000 .. 1000000]}

See Also

suspend : :: / 3, ic : :: / 3, fd : :: / 3, :: / 2