A Flexible Framework for Programming with Non-deterministic Functions ?

The use of non-deterministic functions is a distinctive feature of modern functional logic languages. The semantics commonly adopted is call- time choice, a notion that at the operational level is related to the sharing mechanism of lazy evaluation in functional languages. However, there are situ- ations where run-time choice, closer to ordinary rewriting, is more appropriate. In this paper we propose a unied formal framework where both semantics can co-exist for the same progam. This is done through a careful but neat combina- tion of ordinary rewriting {to cope with run-time choice{ with local bindings via a let-construct devised to express call-time choice. The result is a exible framework into which existing call-time choice based languages can be embed- ded by means of a simple program transformation introducing lets in function denitions. We prove the adequacy of the embedding, as well as other relevant properties of the framework.