bstract
MaurizioGabbrielli~Elena MarchioriĨ n this paper we study unfold/fold transformations for constraint logic programs (CLP) with dynamic scheduling and for concurrent constraint programming (CCP). We define suitable applicability conditions for these transformations which guarantee that the original and the transformed program have the same results of successful derivations and the same deadlock free queries.The possible applications of these results are twofold. On one hand we can use the unfold/fold system to optimize CLP and CCP programs while preserving their intended meaning and in particular without the risk of introducing deadlocks. On the other hand, unfold/fold transformations can be used for proving deadlock freeness of a class of queries in a given program: to this aim it is sufficient to apply our transformations and to specialize the resulting program with respect to the given queries in such a way that the obtained program is trivially deadlock free. As shown by several interesting examples, this yields a methodology for proving deadlock freeness which is simple and powerful at the same time. Permission to mske digital/hsrd copy of psrt or all this work for personal or clsssroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage, the copyright notice, the title of the publication and its date appear, and notice ia given that copying is by permission of ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. PEPM '97 Amsterdam, ND @ 1997 ACM 0-89791 -917-319710006.,,$3,50 In nearly all the practical CLP systems [19] the flexibility of CLP comrrutation is further enhanced bv zdlowine " a dynamic selection rule which allows the computation to dynamically delay (or suspend) the selection of an atom until its argumente are sufficiently instantiated.This dynamic scheduling is obtained by adding the so-called delay declarations next to program clauses.
Delay declarations, advocated by van Emden and de Lucena [34] and introduced explicitly in logic programmingby Naiah in [27], allow one to improve the efficiency of programs, to prevent run-time errors and to enforce termination. In many CLP systems they are used also to postpone the evaluation of constraints which are "too hard" for the solver. For example, in CLP(!R) [18] non-linear arithmetic constraints are delayed until they become linear.More generally, delay declarations provide the programmer with a better control over the computation and, similarly to guards in concurrent logic languages, allow one to express some degree of synchronization, usually called coroutining, among the different processes (i.e. stoma) in a program. In this sense, even though the underlying computational model uses a different kind of non-determinism, CLP with dynamic scheduling can be considered as an intermediate language between the purely sequential CLP and the concurrent language CCP. The increased expreasiveness of t...