[mercury-users] Constraints and conditionals in Mercury

Richard A. O'Keefe ok at cs.otago.ac.nz
Fri Apr 11 13:28:19 AEST 2008

I should clarify that the concern was specifically with if-then-else
tests where the solver variables are entirely local to the test and
do not appear in the call, so would not be visible in the type or
mode of the predicate itself.  It seems possible from Ralph Beckett's
reply (saying that "inst 'any' in the condition is noticed) that
Mercury might *not* notice this.

Here's an example.

knights_tour/1 has one argument, an integer.  It is known to be ground.
There is a conditional

	if knights_tour(N) then ... else ...

The implementation of knights_tour/1 uses constraints *internally* to
determine whether there exists at least one knight's tour on an NxN
board or not.  Suppose that knights_tour(N) leaves some constraints
pending when it exits, and that for some value of N those constraints
are not satisfiable.  (Perhaps the programmer got it wrong.)

What happens?
If it's not yet satisfactory, what _will_ happen?

mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au

More information about the users mailing list