Re: Curry Crash Course

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Sat, 26 Jan 2013 17:04:01 +0100

On 01/25/2013 03:47 AM, Sergio Antoy wrote:
> Michael's proposal is very reasonable and accommodating. I
> favor it, though I am a bit wary of select. I am not familiar
> with indeterminism. The semantics, as I understand it, is
> like choose followed by a cut a la Prolog. Why should we
> provide this cut for choose and not for other or all the
> functions of a program?

I think one reason is the interaction of lazy evaluation
and search. If one offers a cut (or commit as in earlier
versions of Curry) for arbitrary operations, i.e.,
commit to some rule of the operation, it could be the
case that the commit depends on the evaluation state
of the arguments, e.g., if an operation is evaluated
call-by-value, you might commit to other branches
than with a lazy strategy. One might argue that
this is the risk of a cut, but I can imagine that
it might be difficult to reason about the effects
of a commit since it is difficult to reason about
the order of lazy evaluation.

On the other hand, these problems do not occur for
the select operation that I proposed since one
selects a complete *value* rather than a partially
evaluated expression.

> I think that it boils down to the intuition of
> non-determinism. My intuition is that any result of a
> non-determinism computation carries the same information of
> any other. Hence, when you get one result theere is no point
> in getting any other. E.g., if you print the elements of a
> finite set, you can print them in different orders, but one
> order does not tell you anything more than any other order.
>
> Hence, a computation should give you only one result (if you
> want all of them use the set function). But giving you only
> one result before the computation is finished conflicts with
> the overall approach of current interpreter and destroys
> completeness.

I agree. Thus, I think the main use of an indeterministic
"select" will be in cases where one is sure that only
one results exists or all other results are identical
so that it is useless to search for further results.
This is also the intuition of "green cuts" in Prolog.
Of course, this is an undecidable property so that
it is put into the hands of the programmer.

Best regards,

Michael


_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Sat Jan 26 2013 - 17:04:45 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 18 2019 - 07:15:08 CET