[ library(ic) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

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

Reflect into Bool the truth of Var having the domain Domain.

Var
  Variable
Domain
  Domain specification
Bool
  Reified truth value

## Description

Provides a reified form of the ::/2 domain assignment predicate. This reified ::/3 is defined only to work for one variable and only integer variables (unlike ::/2), hence only the Domain formats suitable for integers may be supplied to this reified ::/3.

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 an integer 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. Instatiating Bool to 0 will cause Domain to be excluded from the domain of the variable where such an exclusion is representable. If such an integer domain is unrepresentable (eg. -1.0Inf .. -5, 5..1.0Inf), then a delayed goal will be setup to exclude values when the bounds become sufficiently narrow.

Note that calling the reified form of :: will result in the Variable becoming constrained to be integral, even if Bool is uninstantiated.

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

## Examples

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

    X = X{[1 .. 10, 12 .. 30]}
    Yes (0.00s cpu)

    [eclipse 3]: ::(X, [1..10, 12..30],0).
    X = X{-1.0Inf .. 1.0Inf}
    Delayed goals:
            exclude_range(X{-1.0Inf .. 1.0Inf}, 1, 10)
            exclude_range(X{-1.0Inf .. 1.0Inf}, 12, 30)
    Yes (0.00s cpu)

    [eclipse 4]: ::(X, [1..10, 12..30],B).
    X = X{-1.0Inf .. 1.0Inf}
    B = B{[0, 1]}
    Delayed goals:
            ic : ::(X{-1.0Inf .. 1.0Inf}, [1 .. 10, 12 .. 30], B{[0, 1]})
    Yes (0.00s cpu)

    [eclipse 5]: ic:( B =:= (X :: [1..10,12..30])).
    B = B{[0, 1]}
    X = X{-1.0Inf .. 1.0Inf}
    Delayed goals:
            ic : ::(X{-1.0Inf .. 1.0Inf}, [1 .. 10, 12 .. 30], B{[0, 1]})
    Yes (0.00s cpu)

## See Also

integers / 1, reals / 1, ic_hybrid_sets : :: / 2, suspend : :: / 2, fd : :: / 2, eplex : :: / 2, ic_sets : :: / 2, fd_sets : :: / 2, :: / 2