[mercury-users] Confused about "undefined behaviour" of promise_only_solution

Kral Stefan skral at mips.complang.tuwien.ac.at
Fri Nov 26 03:34:23 AEDT 2004


Hi All.

I'd like to commit to one particular solution of a 
non-deterministic predicate. I really do not care 
which one (first, last, or anything in between).

Having read through parts of the "Net Talk"-page 
"N-Solutions in Mercury and Declarativity", 
I think I can get what I want by using promise_only_solution.

Then again, I am puzzled by section 6 of the mercury reference 
manual, which explains the meaning of the predicate and states 
"If the assumption [that there are no solutions X1, X2 for 
which X1 \= X2 holds] is not satisfied, then the behaviour 
is undefined."

So far, so good -- I think I'm all confused...

1) "Undefined" sounds very hard, in fact a bit repulsive, just 
   like the possible effects of turning of checks of array indices.
   The way I see it is that "If the assumption is not satisfied, 
   then promise_only_solution returns an arbitrarily chosen solution 
   of 'Pred(X)'."   Is my interpretation correct?

2) In my app the predicate of interest has many syntactically 
   different, but semantically equivalent solutions.
   Is is okay to use promise_only_solution within this case?

Thank you in advance.

Best Regards,
Stefan.

-- 
Stefan Kral            http://www.complang.tuwien.ac.at/skral/

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list