Re: Intended meaning

From: Wolfgang Lux <wlux_at_uni-muenster.de>
Date: Wed, 31 Oct 2007 16:41:59 +0100

Michael Hanus wrote:

> Sergio Antoy wrote:
>> [...]
>> Is there a clear reason why x should NOT be shared across the
>> arguments of (?), but must be in any other situation?
>
> Intuitively, sharing must be kept as long as the different
> subexpressions belong to one expression. Thus, x is shared
> in (1+x ? zero x) as long as you don't evaluate the (?).
> However, if you evaluate (?), the complete expression
> is reduced to the left OR right expression so that
> the connection between both have been dropped.

I think there is some sort of confusion here between sharing
and non-deterministic search. Of course the variable in
1+x ? zero x is shared between both arguments of (?). However,
a variable *must* not be shared between different branches of
a non-deterministic choice -- unless one can prove that the
variable is bound to the same value in all branches (which is
trivially the case when the variable is bound to a head normal
form). Thus at the time when (?) is evaluated it creates two
different search branches with independent instances x1 and
x2 of the variable x. In the first branch one reduces
   1+x1 ? zero x1 ~~> 1+x1 ~~> suspension
and in the second one reduces
   1+x2 ? zero x2 ~~> zero x2 ~~> {x2=0} success

So it do think that (?) is treated differently than other
operations.

Regards
Wolfgang
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Wed Oct 31 2007 - 17:07:17 CET

This archive was generated by hypermail 2.3.0 : Mon Sep 16 2019 - 07:15:06 CEST