[m-dev.] Delayed goals and if-then-else goals

Ralph Becket rafe at cs.mu.OZ.AU
Tue Jan 6 18:14:47 AEDT 2004


Happy New Year!

I came away from reading the HAL Herbrand types paper with the
impression that adding support for delayed goals on Herbrand variables
makes a fairly insignificant impact on performance and that, therefore,
when adding Herbrand types to Mercury we might as well make them support
delay as well.

It occurs to me now that delayed goals can cause all manner of problems
in the conditions of if-then-else goals (and negated contexts in
general.)

Consider the following goal, where X and Y are unbound variables
belonging to a Herbrand type and /= is implemented by posting a
constraint (i.e. a delayed goal) in the case that either of X or Y is
not bound.

	( if X /= Y then false else X = Y )

The denotational semantics of this is

	( X /= Y, false ; not (X /= Y), X = Y )

However, the operational semantics in Mercury are different in this
case: the condition is only tested once, hence the if-then-else as a
whole will fail rather than succeed unifying X and Y as per the
denotational reading.

The goal (not (X /= Y)) also looks like a source of trouble: how should
constraints posted in a negated context be handled?

Given that delay has been around for decades, I assume there are
solutions to these problems so I'd be very grateful if someone could
someone point me towards a decent paper on the matter.

Cheers,
-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list