
impose_domain(?Var, ?DomVar)

   Restrict (if required) the domain of Var t othe domain of DomVar.

Arguments
   Var                 Variable or number
   DomVar              Variable or number

Type
   library(ic_kernel)

Description

   Primitive for restricting the domain of Var to the domain of DomVar.
   Any values in the domain of Var, which are not also in the domain of
   DomVar, are removed.  DomVar remains unaffected.  
   The domain update on Var may fail (when the update empties the domain),
   succeed (possibly updating the variable's domain), or instantiate the
   variable (in the case where the domain gets restricted to a singleton
   value).  Note that if DomVar's type is integer, the integrality will
   be imposed on Var as well as the domain values.

   Note that this predicate is intended for use only in implementing
   constraint propagators, and should not be called from ordinary user code.
   The waking behaviour is the same as discussed for impose_min/2 and
   impose_max/2.  Apart from this, the effect is similar to unifying
   Var with a copy of DomVar.
   


Examples
       ?- X::1..9, Y::5..7, impose_domain(X, Y).
    X = X{5 .. 7}
    Y = Y{5 .. 7}
    Yes (0.00s cpu)

    ?- X::1..9, impose_domain(X, 7).
    X = 7
    Yes (0.00s cpu)

    ?- X::1..9, Y::4.1..7.5, impose_domain(X, Y).
    X = X{5 .. 7}
    Y = Y{4.1 .. 7.5}
    Yes (0.00s cpu)

    ?- X::1.0..9.0, Y::5..7, impose_domain(X, Y).
    X = X{5 .. 7}
    Y = Y{5 .. 7}
    Yes (0.00s cpu)

    ?- X::1..3, Y::5..7, impose_domain(X, Y).
    No (0.00s cpu)

    ?- Y::1..5, impose_domain(3, Y).
    Y = Y{1 .. 5}
    Yes (0.00s cpu)

    ?- Y::1..5, impose_domain(6, Y).
    No (0.00s cpu)

    ?- Y::1..5, impose_domain(X, Y).
    Y = Y{1 .. 5}
    X = X{1 .. 5}
    Yes (0.00s cpu)


See Also
   impose_min / 2, impose_max / 2, impose_bounds / 3, exclude / 2, exclude_range / 3
