### 2.3.5 Questions

• Why are there three colons in the statement `[X Y Z] ::: 1#7`?

If you want to restrict the domain of a single FD variable then you write `X :: 1#7` with two colons. But if you want to restrict the domains of all variables of some list like `[X Y Z]`, then you need to write three colons.

• Is the name `solution` in the example program `Equations` arbitrary?

Yes, you may choose whatever Oz-atom instead. You could also use a list rather than a record to represent a solution.

• What is the difference between the statements `X+Y=:3*Z` and `X+Y=3*Z`?

Be careful, this is very different! The first statement `X+Y=:3*Z` creates a (concurrent) propagator for equation . The second statement `X+Y=3*Z` blocks until the exact values of the variables are known, then evaluates terms `X+Y` and `3*Z` and finally unifies these two results.

• Why does the Explorer come up with a yellow diamond in the following program instead of searching for a solution?

`declare Zproc {Equations Sol}   X Y  in    Sol = solution(x:X y:Y z:Z)   [X Y Z] ::: 1#7   X + Y =: 3*Z   X - Y =: Z   {FD.distribute naive [X Y Z]}end  {Explorer.one Equations}`

The problem is that the search predicate contains the free global variable `Z`. Search blocks in an unstable state since the value of `Z` is not yet determined (but may eventually become determined, e. g. as an effect of another, concurrent computation).

• Why does the Explorer come up with a yellow square in the following program instead of searching for the solutions?

`declare proc {Equations Sol}   X Y Zin    Sol = solution(x:X y:Y z:Z)   {FD.distribute naive [X Y Z]}   [X Y Z] ::: 1#7   X + Y =: 3*Z   X - Y =: Zend  {Explorer.one Equations}`

The problem is that the distributor `{FD.distribute naive [X Y Z]}` blocks the execution of all subsequent statements. The distributor waits until the variables `X, Y, Z` have to denote integers in a finite domain. This will never happen since the execution of the statement `[X Y Z] ::: 1#7` is blocked by the distributor itself. So we have a deadlock.

The yellow diamond displayed by the Explorer means that the search process is blocked forever.

You can resolve the problem running the distributor in its own thread, i.e. by replacing `{FD.distribute naive [X Y Z]}` by `thread {FD.distribute naive [X Y Z]} end`.

• I found the following call of the explorer in some document. What's wrong with this?

`{Explorer one(Equations)}`

This is the old syntax of DFKI Oz 2.0 which is no longer valid in Mozart. There the syntax for calling the Explorer is slightly different. You have to use the more consistent notation `{Explorer.one Equations}` instead.

Denys Duchier, Claire Gardent and Joachim Niehren
Version 1.2.4 (20020829)