[mercury-users] single-solution context

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 12 16:41:53 AEST 1998


On 11-Oct-1998, Martin Stein <ms40 at inf.tu-dresden.de> wrote:
> 
> It seems to me that it's not possible to use a predicate declared as cc_multi
> or cc_nondet outside a single-solution context. In the reference manual there
> is nothing said about how to "get rid" of such a context. Or did I miss
> something?

This was discussed a bit on this list in October 1997.
Basically there are three ways:

	- you can push the cc'ness up (all the way to `main', if necessary);

	- a cc goal can occur inside a non-cc goal if the non-cc goal
	  has no output variables;

	- if a cc goal will only ever have at most one solution, then
	  you can use `promise_only_solution' (source code for which is
	  included in the mail referenced below).  
	  If the goal may have solutions that are different but are
	  nevertheless equivalent, then you can use types with
	  user-defined equality axioms.

For more details, see the following URL from our mailing list archives:

<http://www.cs.mu.oz.au/mercury/mailing-lists/mercury-users/mercury-users.9710/0032.html>

That's the first message in the thread, and it includes code for
`promise_only_solution' (called `promise_one_solution' then, but
I now think `promise_only_solution' is a better name).
There were quite a few followups which you can find by following
the links on that page.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the users mailing list