Academia.eduAcademia.edu

On the Correctness of the Replacement Operation for CLP Modules

In this paper we study the replacement transformation for Constraint Logic Programming modules. We define new applicabihty conditions which guarantee the correctness of the operation also wrt module's composition: under this conditions, the original and the transformed modules have the same observable properties also when they are composed with other modules. Furthermore, the applicability y conditions are uot bound to a specific notion of observable. Here we consider three distinct such notions: two of them are operational and are based on the computed constraints; the third one is the algebraic one based on the least model. We show that our transformation method can be applied in any of these distinct contexts, thus providing a parametric approach.

The Replacement Operation Sandro CWI and this paper the replacement Programming modules. we study Logic plicabihty conditions operation also the wrt original and observable same with other di Piss* tions are uot erational and third one is the show that our the such based on algebraic one they notion ation can program. y the can least last Here Here model. Centraf any are primitive a logicaf elements inference employed in [19], circuit lems [30]. many Its a parametric ap- is now grams and simple and incremental maintain Compile computation such and as financial due adoption of step used naodutes reduces splitting the that complexity been for O’Keefe different [25], be a combinmodules operator methods which for ible struc- tion: straint a program compiled @. side the of into applied Logic to CLP another hand [18]. have there are systems, Programs ones the [29] focus and primarily technique above kind which and [29] and later in replacing of a program a very con- In fact in the field Sato consists body It is therefore the program. was introduced Tamaki in the bath of a CLP flex- of optimiza- to manipulate 1], syntacticrdly of atoms conjunction. Logic side by in [22, other for solving analysis transformation used operation, constraint program. “declarative” Programming and statements) these both be profitably the a conjunction This paper has been prepared during both author’s stay at CWI Center for Mathematics and Computer Science - Amsterdam. Permanent address of authors: Sandro Etalle, D. I.S.1, Universit& di Geneva of the on the [24] static lit- branches. transformation for Dro- th; exclusively the the 1, 10], is a program replacement and design can focus on On applicfor main compile-time unfold/fold [22, two imperative initially CLP efficient para~igm, into based to encompass and CLP which into [23]. as the declarative it (in optimizations to enough as the verify optimization developed and techniques the constraint Replacement be of large of the such applied on the established of the intro- languages. where can be divided investigated were then the can forward a well logic of R. of optimization we find time which prob- y to design, [7] shows, composition C&cer;ing subject local techniques problems flexibility is by now Indeed, fact constructs is an important design the complex whole were to modules, studv be partially also analysis search to CLP’S by successfully combinatorial methodology smaller been programs. applications, is specified already to solve and modular large several may constraints allows the This software-engineering is a power- which is partially of CLP by programs. short) in fields [14] concise enhanced turing for has into de- receiving survey program by a simple modules. one hand (CLP the the been proposals approach logic development the on this paradigm CLP diverse success nature further and rule. synthesis declarative by Programming original separate to the ations low-level programming constructs to specific- that has recent module together manipulation Logic as the different helps We in On declarative rather modularity and, also program’s the Introduction Constraint modules a constraint of several it in several to the are combined erature ful some “reasons, years we adhere moreover, as changes attention few we consider ation proach. 1 onlv these for integrating and are op- be applied providing the duced condi- constraints; on the affect a considerable phases, software, For in composed of them computed thus for ap- of the of observable. two method contexts, are validation adaptable condi- have applicability notions: based this modules the the transformation distinct under when to a specific new correctness transformed also distinct are the composition: Furthermore, bound three We define of the velop transformation guarantee properties modules. we consider of these which module’s Geneva and Universit& and Constraint tions, di Gabbrielli Abstract In Modules Etalle Universitii Maurizio CWI for CLP clause general by operation ● Viale Benedetto XV 3, 16132 Geneva, Maurizio Gabbrlelli, Dipartimento Corso Italia 40, 56125 Piss, search of the first Fellowship Program supported by the author has The EC/HCM di Italy been Italy. partially research network sandro@disi Informatica, gabbri~di of supported the .unige. Universit .unlpi . it.. second EUROFOCS by author under and it. & di Piss The rethe ERCIM has n. many [3] and other (see tion satisfy should is correctness: program should or declarative) area, 27] has been tions sufficient wrt several [22], none applied devoted to different of these to modules. [26] the original to the the semantics, transformation since a survey as an Opera- and the to some In the trans(opera- logic pro- [29, 20, 13, 28, 4, 5, 22, 1, 9, of applicability definition guarantee In fact, wrt semantics. of research such for languages). a transformation be equivalent reference a lot transformations, folding techniques for logic a primary requirement gramming 168 to mimic fattening transformation Clearly, tional ERBCHBGCT930496 Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the titte of the publication and its date appear, and notice is given that copying is by permission of the Association of Computing Machinery.To copy othetwise, or to republish, requires a fee and/or specific permission. PEPM ’95 La JoHa. CA USA @ 1995 ACM 0-89791 -720-0/95/0006 ...$3.50 is able formed been grant it thinning, correctness Unfortunately, systems they condi- of replacement apart can all refer from be correctly to semantics which are not ness results stand alone units. When .iust we want them want any other to each M’ When in our On even replacement Programs. 27] do On exploit recursion, for other the 28, full which, other of which which property that for generic the do not as we will at this paper and ensure study for relatively us that equivalent the two optimizations CLP based modules. simple We applicability transformed to the original following (i) we operation natural Our the The which is compositionally approach is based requirements: remainder Section 2 we introduce on replacement 4 we give in order to relate sufficient itional approaches: the replacing the and to guarantee equivalences the part replacement The we call from ending and to guarantee viduate not the not introduce fatal the Indeed, part alone in which any comparing our In 3 we operation. conditions pro- of observable, Section when and 5 shows how considering of modules. to based Section equivalent notion results Next technique applicabihty weakened the programs. the composition properties the operation Referring to the we can compute time replaced steps, cing those one in text condition m steps with m < n. situation which (which fits can The We recent survey means constraint given This well program) c for the other Section 6 con- contained in some enough to allow be seen as an example clearly advantages are that no loops of this apprc~ach to the to we consider, depending different we by and We Jaffar Maher introduce fi will conjunction will connective use instances observable “,” %5 formula uf congruence pro- and the the necessary the [16] for a tuple B will atoms. to ❑ will We # from notation we’ll often find the the to existential variables ii variables. instead convenient which of ambigu- of used and a (finite, no a set be also of terms denote When denote to denote constraints, over a computational and rule which determines D denotes (i.e. ~ H by head) D. A of use the closure remain of un- + O to the and computa- the least be obtained. 169 D-model of a program prim- predicates of constraints. on the If O is a domain a D-solution variables c ❑ B1, ..., is an atom using V is a structure Formally, O is called of built predefine of variables then application H (the formula interpretation a mapping CO holds, the order are essentially domain the is denoted straint, op- c is a first itive valuation from are introduced. can logic Lassez provide while also and @ except constraint A re- of non-fatal of terminology quantified. which property and now is a sequence of atoms. Analogously noted by c ❑ BI, . . . . B-. We recall on which the denote of i conjunction. notation twofold. 10f course, material. denote the with of constraint sequel. arise, this replacement [16] by Jaffar empty) The of th~e predicates. guarantees [15] respectively, in in order the replacing conjunction is independent the clause that is going to be transformed. paper ~ and possibly us to introduce original variables ity con- be familiar notations that n to programs on the semantics distinct c for Moreover, When This The is undoubtedly speed. results background repla- in the natural is performed execution definition grams. certainly this answer the transformation program’s in the the the is flexible cursion loop) (in compute in which to increase sufficient indi- CLP is assumed the main is at least as efi- semantics also reader and use in the an “answer” conjunction we can a desirable operational Preliminaries: The of the loop: fatiil each is not is correct. (a) When the replacing conjunction cient as the replaced one. The be CLP example. result. to for papers. 1.1 loops. the computation the equivalence replacement situations introduce (fataJ) if it prevents replaced that two does must a loop successfully. replacing (b) can modified as follows. compositionally correctness as it Moreover. corollaries. on of the when parts, Results as easy constraints and logic) by related of compos- main conditions cludes are the answer its be simply optimization the details to obtain all is organized and and preserving is also useful preliminaries the trans- whale we desire. a simple obtain application modules. can to then equivalence. Here, the these used replaced the preservation we state the guarantee us available (i) modules In Section (i) in paper through CLP an This obtained some we provide (operational previous of this requirement specified in then In part from are on the can results of modularity cases formally of the the mentioned “degree” wrt components on contains define on the We of the program. 1 least instantiate allows programs. completely oDtimize (the which approach together subsection grams, not tion the replacing conjunction must be equivalent to the replaced one (in a sense w,bich enforces compositional This is alrea,dy the point where we deequivalence). so far eration us to equivalence re- some conditions program one. on provide The (ii) meaning is not the con- properties. our the combine non-modular placement desired said, to the on answer Depending naturally conditions equivalent a program match complicated. In of the as we proper- notion structure). relative trans- are based computed we can prop- the observable is a logical applicability the original the are discouragingly one along such (the to, the semantic as they algebraic independently allows 4, 5, three of equivalence obtain successively Logic third we refer notion form but relevant compositionally shortly replacement, the the Secondly, allow [29, while and here computations preservation the which, approaches conditions on wrt to maintain operational, are the model above Constraint potentiality of applicabdity 22] the straints), of the operation. 20, of is parametric we want consider of them some modular drawbacks optimizing hand, non We two result method program given we say provided diffusion ties: congruen$. the from [13, feature the to so far a wider to introduce that, our of the formation. be equivalent or restricting them we need is satisfied suffer of see, is an important the price when M’ is the con- M’ o Q will equivalent erties behavior: guarantee conditions some words Firstly, as M into same whatever other condition prevented hand, the correctare seen a module have which transformations opinion, one this applicability replacement In provide if programs equi relent compositionally are the to M @ Q and Q, Furthermore, setting, M’ y conditions module other. M and and we use them. applicability @, they cmly we transform M semantically in which further wrt are adequate we don’t text compositional which in B~ where of D), of c). c is a con- B1, . . ., 1?” (the a goal (or query) that there exists P which c (cI9 A CLP is the natural body) is de([15]) CLP counterpart Here of the least and in the Herbrand following, A = H as a shorthand for: - false, if H and A have al =tl H=p(tl, A... model given the different Aa~ logic be programs. A, H, relation tn,if = for atoms we write symbols, A=p(al,. operational olution by More model simply precisely, B~ in t~ B:–l, ... such there no u~) and SLD res- that c1 : (co A (B, 3 c1. gram P is a sequence obtained from following a derivation denoted by G, GO ~ GO ~ cessful derivation is a goal is called the answer any A,ti For constraint following of variance two c by we and we will ~ are equal denote the the result of c1 ❑ al relative In if we consider exchange~ates this section may cl: E [1, 2], for average particular duce we’ll show recursion employ in y of CJ such (Xs, systems plicability tools of [29]. the to (semantic) the of on, it is much allows unfold/fold: the properties for more is a simple to provide rivation step all to than an we assume the just Len) which typical atom In that body to reordering the sum( I (Curr, on clauses of simplify the ap- Definition 2.1 in a program (Unfolding) P, and {H] Let list to List > 0 A Av*Len the are work- s ❑ sum len( Notice steps one, list the , Rates, List exchange Rates) Sum’) Sum) + ❑ + Sum’ Value), , . length of list List O ). [H ITsI , Len) + Len ❑ = Len’+1 Len’). is a source of inefficiency unfolding and replacement operations. which ([26]). First, defined by the following we are going in the bod- sum(Xs, Rates, len(Xs, Len) needs that The use is often the list can be fixed to scan via transformation referred a new predicate to as surden clause Rates, exchange-ates the use we introduce C2 : sumden(Xs, transa de- be the tupling defin- C. of average This strategy Sum, (Rates) Len) , + ❑ Sum) , . 2CLP(R) [17] is the CLP language obtained by considering the constraint domain R of s.rithmetlc over the real numbers. The signature for $2 contains the constant symbols O and 1, the binary function symbols + and *, and the binary predicate symbols +, <, ~ for constraints which are interpreted on the real numbers as usual. are variable + that of clause, c ❑ H, ~ definition xs twice. by bodies notation, . . . . H. by currency I Tsl *Value Rates, len(Ts, opera- usual of the atoms in the history a program the values is multiplied to its (( Curr, is the len([], solely the e of the Amount) Len) Len folding be obtained c1 : A + server with the folding of a program + c1 •~l, to predic- o) . len(List, to let disjoint. clause information Sum) value Sum = Amount refer in the , sum(Ts, is basic to all the consists in applying the order modulo Sum([l member replacement we need Len corresponding In example. example in also atoms imported) SmrI) , sum each in over we cannot cur- natural . Rates, we feasible mimicking between comes (Rates), Rates, this transformation to the this context. information. of the ~ len(Xs, used enough program of redundant the ways. is given ies and on rates it open (or external is the ex- simplicity, e average sum(Xs, be intro- Indeed, the former depend is, This operation and essentially systems possible definition these optimizations unfolding. the Naturally, clauses [29]. general for of (that elimination ition of formation in folding In order For of replacement conditions performed). there since advantage transformation previously tion One in are to is typically of the transformations applicability while the most us predicates. one give can example. allows which aa the we will mimic is that ing such conditions replacement of strategy of the form in a modular exchange up-to-date Av) its ratios, to some Av) exchangerates, m equivalence of optimizations replacement the a term exchange ExchangeRate be used of curren- contains (pairs) Despite can exchange~ates as multisets. a worked definition a transformation unfold/fold the how the kind through where most is the sum(List, what the fol- average applicable terms as an refer the rate replacement Consider the predicate fluctuating (List, Av c itself. we show via cl ❑ are r’e- in different The the that typically always Example achieved H in Cn ❑ ~n} of the list containing that are which be given to currency. program average and element ExchangeRate), where An = clause in P. average) Amount). a list rencies access each by calling return Indeed, ate, c be found is a typical last may Sum is the 2 cl~} AVERAGE computing Values reason rate whose bodies a D-solution fij the unfolding ..., . . . . H~ + an program (currency, will assume ~_va~(G) i, j may suc- (viewing this form A general- Cll N Clz iff, for exists ~,0 that + for the change Note e cJ1 : Al ci~ be clauses. (Computing in a list. (Currency, c [1, i]. be relation values which GJ is GO. 2.2 CLP(J?)2 rates is, pro- that case, on clauses clauses We write of simplicity, In Example of P will and is considered the U of c, there sake ❑). + let Then {cl{, c1 ❑ ~1, {HI unfolding cies, that O for derivation C2 •l fiz. of a clause of length this = A~ T and the class ICI. is a finite Consider D-solution that by (c form Finally, as multisets). length cl by c A c, A (H that [1, n], ❑ B,, K. Hi) situation c❑ g in G; ( reju tation) the notion Ciz : A2 + its such z’ E of replacing to as the apart GO in the of the computation. izes to C LP and + in P, for j t$ : GO, G1, ..., = P in For In this the . . . . G, such step clauses ferred by the selec- H G) a goal GO, GI, GO a derivation element the i for c A C, A (H lowing A c) is D-satisfiable, in one derivation In the by with the A e c1 ❑ B1,..., P standardized in of length of goals GJ–l denote H) = A derivation selected common of D-satisfiable. unifiability. of the form a clause in for G : co ❑ 1%, . . . . a goal in a goal exists D ~ for if B, is the atom variables from D-solvability step P results ..7 Bn and with is obtained substituting program rule (i.e. CLP a derivation B, Bi+l,. tion of set is in P consists . . ..tn). The the H,) a ❑Ifin} 170 suml.en reports gether with exchange to weighted length rates. traverse form the the of Notice the list that Xs Len) module in the AV1 which of Xs itself the surden, twice AVERAGE by unfolding len(Xs, sum the in Xs, to- programs and the list of the by as it is now, We start as well. values both:sum(Xs, body of c2. contains the This needs to quite trans- by Linguistic clausal oriented Sum) and hiding, can operations yield the erators [2]. two clauses: smden([], Rates, O, exchange~ates c4: sum-len( [( Curr, Len Amount) = Len)+i exchange O) - (Rates;) Here, a set We lRest], Rates, Sum, Sum = Amount* A xates •l . Len) sum(Rest, Rates, len(Rest, Len’). open ❑ Value+Sum’ Definition Rates), cleaning by up the the 3.1 srmden([], c5: snm~en([(Curr,Amount) Rates, O, exchangerates predicate O) A sud.en by is Rates,Smtr, Len) of smden list only Sum’, Value), because of now recursive is once. of average this Finally, enjoy of these the cleaning-up last the used by the average(Xs, order be first resulting the it needs to let Len) seen as the one rules to also traverse the clause To clauses) replace ,Surrr),len(Xs ,Len) the After symbols the adjoining program interface obtained Sum, c6, c5, C3 and needs to scan the module where the transformations, we find list * Here will be Len = Sum O and AVS, consisting once. of average correctness The discussed 3.2 (and proved) in which provided wise the defined we denote in We now provide engineering techniques programs. the Following (Module @fvf2 So, when again approach based on to for the modular to paper programs usual software development of R. programming a rneta-iinguistic the incremental original definitions for added follow [6] takes Pred(E) to the and into set of Let Ml use account predicate E. expression Composition) We : (Pi, T1) define Urrz) of O’Keefe we consider composition qzlnm Pred(Pz) holds. Other- ❑ is undefined. composing &fl andlkfz, werequire symbols to beopenin both more sophisticated compositions mentioned, lation, background the the exported Section Programs aformrd & are Further which by in the Pred(P1)m that Ml predicate CLP some So, modules. IM2 : (P2, rr2) be modules. of El Modular contains relations. of the clauses 4. 3 modules. Len). a definition only more) E which operator appear and database partin the form of eztemrional part. basic parts. modules union r. which Symmetric- can be incrementally new CLP are two predicates (or unspecified the of further be exported a deductive module which and is A Av Rates, an with definition M may of two describing composing by a simple we simply to the in intentional another M specified modules. instance, the refer compose other composition by hand, given predicates For predicates database the definition from Zcontains which (unit one Ml @lklz = (Pl UP2, T] So, we have sym- specified a module to be (further) partially of open modules. theextensional definition inthebodyofcl. -Len>O sum-1.en(Xs, r. isapair(P,rr) of predicate composing On be irnportingit is specified facts improvements, Sum, Av) isin open predicates, the modules. could other can is that are allowed other Definition c6: we follow symbol r is a set andthey definitions The This operation, ,sum(Xs,Rates Rates, and for by ally, some ❑ Len’), Rates). ancl in exchange-rates(Rates) bysum-len(Xs, the ACLPmodule idea predicates to Z when that, op- P together with open predicates. predicate as aninterface adjoining extensional Notice whose program underlying specified - Sum = Amount*Value+Sum’ Rates, member((Curr, simple, program specifying atom (Module) modules, open ❑ - lRest], = Len)+l Len the other (Rates~l. sumJen(Rest, presentation symbols information composition •1 The clauses: c3: and are object- Sum’), constraints?’, following of the ofsimple is a CLP offered bols. Now, we can replace exchange~ates(Rates), sum(Rest, Rates, Sum’), len(Rest, Len’ )bysumflen(Rest, Rates, Sum’, Len’) inthebodyofc4. Intheresulting module AVz, after tokeepthe P is a CLP in x, behave defined those operations as encapsulation a module atoman than mechanisms bymeans r of predicate where Value), such in order call thetypical bereahzed say that richer rneta-linguistic - (Rates;), member((Curr, indeed paradigm, Rates, following mechanisms Moreover, powerful, [6] and c3: logic). inheritance and from the ment of the interfaces one defined to simulate hiding information above As previously (like hiding) by suitably (essentially the common modules. can encapsu- reobtained modifying the by introducing treat- renamings andoverridlng). [25], here is mechan- 4 Operational correctness of Replacement ism. Viewing tions to on the modularity programs definition structuring CLP theory in has terms several of a simple programs (this which is not of traeta-linguistic aclvantages. and does thecase powerful not require ifonetries In fact operait methodology to extend toextend As previously leads simply for program the plicabfity CLP clause In this some used cussed to present a clause in a more readable rectness natural form. 171 by of the section based another the necessary consists in the body Clearly, in order to of a some ensure apthe operation. we first define answer conditions formalization operations of atoms conjunction. are on the applicability in thereplacement a conjunction conditions correctness 3Since all the semantic properties we refer to are invariant under ~, we can always replace any clausec~ in aprogram P by aclause cl’, provided that cl’ R c1 (typically, we can rename the variables in cl). This operation is often referred to as a “clean up” since it is mainly discussed, in replacing of introduction. the an operational constraints. for replacement requirements Then notion Then we in (i) show of cor- we provide and that, form (ii) of dis- whenever a these conditions are opemtionallg how these the Later, conditions sidering gical satisfied, correct. can correctness in replacement Section remodified based on operation 5, we will (weakened) different show when con- operational The is also and idea guishes lo- ular context have to take a tuple notions. To define first formally provide etace. This have of operational allows us to identify behavior a congruence we extend the correctness operatioraal of module’s operational it is actually First, notion those inany relation, equivalence we modules (this @operator). first m to derivations. b~hand~’: in the Let P, c❑ e ~ 4.1 same goal. Let P’ be two b’ ❑ 8’ programs, be two derivations ❑ ~). ~ = Var-(c also c ❑ ~ ~ : We ment ~ starting say ~) computation that can may also not iff q(i5) b❑ ~ t predicate & q(fi) This ends allows in a goal with Definition 4.2 modules be CLP We say Ml and for every defined, exists we have definition body. of the opera- same Let Ml set of open Example and cl: predic- that for congruent, that each refutation Ml that it @ N @ N =0, and refutation in Mz iff Ml in and Ml In @ N @ N modules to replacing To query’s give the operation, the applicability we start conjunction this end, Here used Definition to following the wrt variable (Query’s disjoint c1 ❑ 61 of variables. the replaced we say with and we say that we have any longer. for wrt each f, apart wrt where c; ❑ 6, rr-derivation there exists one ~ such i, j q(i) that E [1, 2], i # j b, ❑ ~i q is any + and to the there set the definition exists 3 and 5The variable notation of based m, this a ‘D-solution_ the multisets condition name on on Bt9 clauses of and that for for b‘ such that 0 E‘0’ used are in the can correctness. This is counter-example. module consisting of the succeed with actually empty equivalent However, computed to each other if we replace r with congruent introduced to a loop the previous and p and module. q do not In succeed are (ii) two methods we mentioned complex program’s Recall (i.e. in our that the guaranteeing methods that formalize in the int reduction. but optimization. definition. its length for These int reduced. opinion It if f number is is also based no the The first the most on the is a derivation, fol- then of resolution steps 1~[ in it). queries Definition 4.5 (Not ule, and cz ❑ ~z c1 •l CI renamed apart Then Slower) we say Let be two M = queries (P, rr) be a mod- and E be a tuple of that C2 ❑ C2 is O-not-slower c1 ❑ ~1 than under & in M b, ❑ B3, renamed & q(i) bJ ❑ B3, + (dummy) g as a shorthand: means 0‘ not con- the replacement total the of variables). most for denotes iff predicate indeed, according any D-solution and equal, derivation and $‘ @ of coincide on b to each wrt T-derivation 2, there rena~ed apart bl ❑ 111 N dicate q(i) .$1 : exists wrt Z such- that e c1 ❑ a derivation b2 ❑ B2, 61 Z I$z I s where ~1 ❑ 61, (z : cz ❑ 6z. ~ renamed bz ❑ Bz, 1<1I and that any (dummy) q is g(i) + pre- ❑ symbole. the vice-versa. is needed for apart El use r are we propose is the useful symbo15. 4We but the replacing of c1 we obtain loops lowing Let that b, ❑ B,, ~ c, ❑ G~ ~ a derivation original, may ❑ variables. iff q and they is by no means fact requirement E if all be two set body “fatal” i. C2 IJ ~z Then both so they Now of equivalence) this as there cl~:q +q. re- we want definition following case any which the in the when clause the classical However, r. (i): a set of variable operational = (P, K) be a module, be a tuple in apart in ~ are 4.3 equivalent the and < is renamed clauses be provide this q in the there ❑ for requirement one. correctness, In fact, (P, 0) be Let each mod- -r. (under are operationally conditions with to we equivalence. a derivation q operation- is into initial be done affecting operational context) clauses. answer, vice-versa, a transformation maps 4.4 the on the modified thus require- in the transformed total can any d❑ D and this partial (in we our r. Mz, Mz in that the that be performed by the following following i.e. program. a loop by when of c R 6 be shown to guarantee which depends shown is a derivation Congruence) have such we say order i junction ones. one. M N correct placement and the an empty operationally module (totally) the give a refutation that are Accordingly, In (dummy) that Mz congruent to that (Operational a similar ally us Recall M2 iff, g is any introduce congruence. ates. where ❑ concept tional that b’ ❑ ~’, - symbo14. can to obtain in the transformed the c ❑ ~, ~, A + c1 : equivalence It be performed be enough be computations clause operation, can that be influenced in the introduction, be the is sufficient of the of equival- implies to be predicates definition likely end in eventually definitions. M. in correctness ule that alone more mentioned will Var(A, the predicates we also that is the set of open d ❑ D in the by but could open are of external definition distin- in a mod- derivations becomes more we consider requirement under Definition stronger which is that to refutations, partial the larger having c ❑ ~ replace refer those that As we informally is just and approaches, whose the Indeed, adjoining which @-context, wrtthe the definition, atoms, Notice derivations congru- above account of open ence. definition concept thesame why the the into we consider, congruence the all the previous we cannot modified. Operational behind it from avoid to clashes. 172 6 Again, the condition avoid variable name on clauses clashes. used in the derivation is needed We are now ready to state our first result on total Previous correct- Theorem 4.6 a clause ult proposition conditions ness. (Correctness in the module I) M Let : (P, r) M’ c ❑ & by d •l D in cl. of replacing A+d~D,~]. A + c ❑ ~, & be c1 : and : (P’, mimic, to defined in [29]. So P’ = P\{cl} u {cl’ ● d ❑ D is than 2.2 folding above c IZ ~ under Var(A, ~) in Notice that whole viously no to we are if the Notice c ❑ ~ c ❑ ~ actually in also M never the than the replaced ation operations then in Theorem satisfied in the an answer requires for more can the one, fits are well intended AV2 holds. second that not-slower than under our order example to that Clearly, the to where the also a clause in say that long as this Let us operation now first replacement that allowed go also is not back to the theorem, the us to transform- 2.2 This introduce the conditions step. of Theorem and the b ❑ b under Var(H) the module obtained in in the then body true now Var(H) of c1 such that in M’. say } in AV1. method this and Snm~ ) , in In ThereAVERAGE we propose by the symbol of cl. D this we need for en- replacement, depends case the on the no loop following can formal on q P be a program, Let that of the now state of {Cl’ rejers p the head P if in to g and (p, relation our P iff in in q the is in the q) and p there is body. We reflexive and ❑ to. refers second result on (total) correctness. do D, X}. ❑ II) Let cl : : (P, T), and c ❑d replacing A + : d❑ ~ by A + c &, ~ M’ : (P’, x) in cl. So P’ = If to d ❑ ~ under is O-equivalent no predicate was Var(A, l?) in M the Len) one definition der of in that For this 2.2 Pred(A,) not-slower if M’ atoms @ r for than c 1. As before, { Xs, the plies we can 3) and (Rates) in M Sum) , Sum, Len) Len) is that holds sr.nden does Therefore, from Theorem that is the transformation 5 Correctness in un- correctness AVZ, we have AVQ. This im- Rates, ❑ sum~en(Xs, c1 in AV2. depend it Len) , sum(Xs, to Av} not 4.10 the AV1 %0 also (Rates) {List, in that len(Xs, Sum, Since @-equivzdent under Sum) , Rates, implies equivalence replace- 4.8 we have Rates, } in AV1. Cl exchsnge~ates len(Xs, second of Proposition Len replacement the by c 1 the constraint , sum(Xs, Sum, previous c1 now us denote to sum_len(Xs, Rates, that Consider let because is ~-equivalent that : (P’, r) is Al, . . ., An all (Part of the the first case depends on Pred(A) D ❑ exchengerates the it constituted that in we performed clause t Moreover, unfolding some ❑ H is operationally Sum, Len (Dependency) closure Example as consider the satisfied. in M. by For We result Rates, H easiest head p depends Moreover, cl : Rates, M WO M’. then proposition. 4.8 Let, the in c 13 ~ ● b ❑ B be the unique clause which defines Pred(H) in the module M : (P, T) and assume Pred(H) @ r. Then true ❑ H is operationally equivalent to proposition , sum(Rest, are int reduced p U ● atoms. and therefore We show 4.6 were of which that Theorem 4.10 (Correctness of the module M be a clause t rans- setting, operation recursion optimization un- opera- overall modular to open the crucial use the following the appl!ied st, Rat es, Sum’, Len’) the Because constraint 4.6 are satisfied no predicate P with We can performances unfolding of Example sumlen(Re c1 the of AV1. and in we performed. x one ment is correct maybe at all. 4.9 transitive Proposition 4.7 [10] Let M : (P, m) be a module, c1 be a of unfolding the atom clause in P and let P’ be the result H in c! in P. If Pred(H) @ m then Ill =CJ M’, where ❑ M’ : (P’, 7r). So unfolding by (Rates) in relations. we need also the following. formation correctness be not-slower to increase means as the above has correctness the we have loops that Definition comput- this in a context we used state as of dependency. g be be in in c4, and be introduced P\{c~} Since to transformation AVERAGE denoting of Theorem symbol notion of programs. tion, that no fatal predicate in d ❑ D in M, of the conjunction applicability replacement latter. as efficient requirement replacing From conditions is to require in satisfied 2) Amouut,Rest,Rates, xo suring say b A d O ~, { Curr, the The is ob- always are iterations c ❑ C. for the the unfold/fold it follows the clause fore the b A c ❑ 6, ~ we we that allow Len’) under when This b A c ❑ ~ with of d ❑ O is at least Therefore, that one. A + clause above answer th~ definition namely d ❑ fi, a new that substitute d ❑ D is (operationally) that @-context, of c ❑ C. the if computing the corresponding that if in are also we always with with of the they we assume then replacing conditions case, Theorem clause restriction: that the first above of the replace fact ing the replacement, constraint want any in the the c1 ❑ exchange~ates •1 M ZO M’, (Part Proposition, len(Rest, we perform also 4.6 C4 ❑ sumJen(Rest ,Rates ,Sum> ,Len} ) is 0-equivalent to and 0-not-slower than M then shows Theorem extent, operation appear to c Cl ~ and O-not-slower a large Example : the d ❑ D is O-equivalent in m) be the res- If ● given on clause follows c 1 in AV2. AVERAGE %0 AV3, ❑ is correct. wrt other congruences i c [1, m], In some b ❑ B under cases of properties ❑ straints. 173 be interested rather Indeed constraint CLP one can of modules without in the semantics negatiok. literature, [l 21. we “One in preserving than (all) their together find is two the with other so-called other kind answer con- the answer semantics C-semantics for which was adapted in defined [1] by an the program. The model most semantics model (on and programs [8, for program’s transformation) more CLP and counterpart is the structure It [15]. operationally this it is not declarat- these two both semantics. the orems 4.6 and the 4.10. In thus order the are that we can these than the easily are more optimizations the in semantics weaker new induce one, than the on the (and one Let : h13Band# same ❑ c goal. P, P’ < b’ e Let be two ❑ B’ programs, two be We Note 5.3 of the here. the than general each 6’ of =, O of b, there exists agree conjunction It is also b❑ B D ~ solution O and 3_~ that on the ~’O’ worth variables is also noticing that since we can This is due to the have to considered them as sets is sufficient. be we consider and the ~’ : p(x) starting say We can have that fact in [’ ~ ( and the set of most is also proven iff then two For instance, ~ : this p(z) “one still here + the C- and the they have just We 5.2 say and every defined, Moreover, defined, such for general and every N that we say Ml least same of open Ml that each Ml %C in @ N Moreover, ~’. evaluating about the logical ~ such when talk q(y). as fol- M-congruent, MI and Mz and o M we have domain the are is stronger than the three modules kind than the to prove C-congruence, M-congruence. of relations where that To clarify let we assume the operational which the us consider the set of open in turn difference the have that they atoms the order of P, or computed language the same (a) is infin- C semantics model. above. The and for P. by of the C-semantics of (b) (b) is defined fact in is that, are not example the D is the usual Ml by the for equivalent programs the most Ma (seen they do contains that the the but Ms have is the the set does answers. same have under V“ not if we we have set that, of natural the same set least of constants D “ un- of most though if num- consequences even iff imply Indeed, above, have case inter- programs this of logical this D“, by this P + ~. Now, of our CLP on the not infinite D # consequences and set is meaningful universe two as programs) same talking general our struc- corresponding to ❑ numbers. As before, correct (resp. we say that a transformation M-correct) congruent ones. the more iff it the we are going but also For example, possibly duplicated is modules operations modules, but maps Of course, module. of that that structure the Notice hand. of P “under general in Ml additive but ination same domain it D-model, least the sense other ~ such we have little are the formulae of D determines programs and C-correct the of formulae we need makes of P (which same der the it logical therefore natural context of atomic7 models, D“, CLP consequences models, have consider ulting is stronger among “set we consider, congruence following set and same M-) same ❑ difficult the they on It is not definiin P is defined program Herbrand constraint, logical since ture D-model. the the M2, M such that &f, @ M and M, that Ml @ M and Mz @ M have that answers. vice-versa. module least in the the we mean bers, Mz, ZM are have consequences P ~ +). On the about pretations predicates. since D for the are M2. VX=b. = b. that Mz original it the underlying is shown = a. goals case Ml This -X @ N and JWZ @ N are in MI @ N there Mz the answers the statements other. +X refutation refutation and explanations logic programs as the counterpart p(x) [ # y ❑ q(y), Let set C-congruent, are module a more for the of natural side” M-congruence M-congruence) have Mz we have exists Iff that we refer set Ml consequences counterpart p(X) that Ml iff, for (C- and modules that, same programs the Definition the the CLP the lows. be CLP with some general logic ~6’. g(y). define the is while and that considering is the z = familiar logical [21] pure -X=a for in of & the while only to both of a pure of atomic p(X) iff, element definition as multisets, z = yo now the to Mz, if the structure is Ml as Now, conjunction represent Finally, [8] C-semantics (b) CLP not ~ ~ [’, that each modules hand M-congruent) contains reader set that O’ of b’ such of the s does derivations + & and an element the the ite, <, ( ~ f’, a solution three On the other is M-congruent (a) It c ❑ & ~ : 3–5 b’ ❑ B’ holds + to Ms. C-semantics The to each Notice For indifferently previ- [I] f’ is more also domain Ms of these we first derivations ❑ 6). fi = Var(c also f therefore whose then no one to another. C-congruent tion modules. congruences that to The- following. 5.1 ❑p(Y). = Y+i . by adapt used operational conditions formally induced conditions since weaker allowing to define Definition in the show congruences applicability applicability ones, the Moreover, which resulting need We contexts congruences ous we consider +x p(o) congruent to is the CLP. Section : p(x) . . to check C-congruent Herbrand the standard is easy numbers, In M3 p(x) p(o) . least D) of the least considered Mz : p(x) of a CLP one, algebraic Ml : then C-semantics constraints not able the relevant 11] The answer and it is commonly for definition. general is the semantics logic operational second, semantics ive pure (specifically using characterizes This for to CLP the not less weaker “faithful” a typical operationally the the in body will operation atomic also a formula of C- C- (resp. congruence to be allowed correct atoms (totally) into the be the res- which is the clause is elim(see later). simple to be empty. 7Here we can consider where c is a constraint. 174 of the form P(X) t c 5.1 Correctness wrt C-congruence the fact that some replacement operations which are correct wrt C congruence may not be so wrt the operational one. In this Subsection we provide the applicability conditions for the replacement operation in the case we refer to the C-congruence. More precisely, we are going to reformulate appropriately Theorems 4.6 and 4.10. This provides a generahzation of the result on the correctness of the replacement operation given in [1]. First, we restate to the new context. Definition C2 ❑ ~2 5.4 the Definitions Let M queries be two = 4.3 and 4.5 to adapt them c1 ❑ ~1 (P, n) be a module, and ii be a tuple A typical example of a replacement operation which always satisfies the hypothesis of Theorem 5.5, but which is possibly not operationally correct, and therefore does not satisfy the hypothesis of Theorems 4.6 and 4.10, is the elimination of duplicate atoms in the body of a clause. Indeed, consider a program M consisting the following clause of variables. cl: ❑ C2 to c1 ❑ cl C-equivalent is under Y) +q(x, and If we eliminate one of loose the answer { X=a reason the operation is is C-correct, in fact the Then Z in M p (X, Y) (which iff for each rr-derivation ists a x-derivation 3-z b, ❑ ~, we say that (j + ~-j <i : : C, ❑ C3 ❑ ~~ $ bj ❑ Bj (i # j, than C2 !3 @2 is C-not-slower 6, b, ❑ B, ~ there b~ ❑ B3 such that E [1, 2]). i, j c1 D cl under bl ❑ B1 D + 5.2 Z in M exists < [$1 I and D 1= El-i bl ❑ BI + 3-Z b;! ❑ BZ. In this definitions all the derivations are supposed renamed apart wrt 2. to be ❑ & : : ~z ❑ 62 & Cl & o dl ~ b2 ❑ B2 such that Theorem 5.5 (C-correctness) Let c1 : A + c ❑ ~, S be a clause of the module M : (P, T), and M’ : (P’, m) be the resA+--dD~,~}. c ❑ C?by d ❑ ~ in cl. So P’ = P\{cl} U {cl’ : c-equivalent to c u ~ under Var(A, j) in M and — either d ~ ~ is C-not Var(A, 1?) in M, — or no predicate sc are { X=a} and { Y=b}) are not lost. wrt M-congruence In this subsection we give the M-counterpart of the results stated in the previous one. We formulate the applicability conditions for the replacement operation for the case in which we want to preserve the M-congruence. First, we need to adapt to the new context the concepts of equivalent and of not-slower query. 5.6 ❑ &2 be we say that C2 c1 !3 Cl Let M queries two r9, of b,, there exists a derivation ❑ C2 fi2 is M-not-glower than iff for each r-derivation & : solution 01 of bl, there exists b: •! B2 amj B1191 + Again, supposed a solution c1 and each solution bj ❑ B] CJ E ~le~ and a solution 0$ of b] such that D + iOI = ii5&. Moreover, we say that ❑ c1 &l ❑ & B,O, + Z in M bl ❑ jl a derivation & 02 of b2 such that (i # j) BJ 19j and under 61 B282 and 581 = Ztiz. all the considered derivations to be renamed apart wrt ii. and Then Z in M under b, ❑ B, c, ❑ 6, ~ ifi for each ~-derivation of variables. to C2 ❑ 62 M-equivalent is c1 ❑ ~1 = (P, T) be a module, and 3 be a tuple and for each C2 ❑ : I.$zl < (?2 ~ [(l 1, D & here considered are ❑ If ● d ❑ D is then M the atoms in the body of c 1 then we A Y=b} to the query p(X, Y). For this not operationally correct. However it most “general” answers to the query Correctness Definition It is easy to see that the concepts of C-equivalence and of C-not-slower are weaker than their operational counterparts given in Definitions 4.3 and 4.5. Intuitively, the difference in terms of derivations lies in the fact that for the former we want a one-to-one correspondence between all the partial derivations ending with open atom:s, while the latter requires this one-to-one correspondence to hold only for the “most general” ones. Now when we refer to the C-congruence we can weaken the hypothesis of Theorems 4.6 and 4.10 by reby their placing the concepts of equivalent and not-slower C-counterparts. Namely, we have the following. ult of replacing Y). Moreover, [&[ for each ~-derivation a ~-derivation q(x, ex- there if Y), q(a, W). q(W, b) . we say that C2 p(x, M’ slower in ~ depends than c ❑ (? under on Pred(A) The M-equivalence is the weakest of the three congruence we have introduced. This is due to the fact that it checks only the “ground” derivations. Theorem 5.5 can be immediately restated for the case of the M-congruence as follows. Theorem 5.7 (M-correctness) Let cl : A ~ c ❑ ~, E be a ciause of the module M : (P, m), and M’ : (P’, r) be the res- in M, ❑ A+d This result generalizes Proposition 4.6 in [1]. In fact, it is easy to check that when the hypothesis of that proposition are satisfied then the replacing and the replaced conjunction are always C-equivalent to each other and that the replacing conjunction is always not-slower than the replaced one (under an appropriate set of variables). The applicabfity conditions in the previous Theorem are weaker than the ones in Theorems 4.6 and 4.10. This reflects c ❑ & by d ❑ D in cl. So P’ = P\{c/} ult of replacing OD, ● E}. If d ❑ ~ is M-equivalent and — either Var(A, — or then M %N no M’. U {cl’ : If c ❑ ~ under d ? D is M-not E) in M, predicate slower in b depends Var(A, than fi) in M c❑ ~ under on Pred(A) in M, ❑ The non-modular case does not considers modules, so their replacement operation in general does not transform a program into a congruent one. Finally, we have proved correctness wrt the operational congruence which, we believe, is the naturaJ notion to be considered for practicaJ applications and which was not taken into account in [22, 1]. From the definitions it is clear that the smaller is the set of open predicates, the weaker become the applicability conditions needed to ensure correctness of replacement, for all the three congruences considered. In particular, if we assume that the set of open predicates is empty we obtain (much) weaker conditions adequate for a non-modular setting in which programs are viewed as stand-alone units (or, equivalently, only compositions of predicate disjoint modules are allowed). Therefore, the non-modular case can be naturally regarded as a particular instance of the general one: the correctness results in this specific case can be obtained by just setting m = 0 in Theorems 4.6, 4.10, 5.5, and 5.7. 6 References Transforming Constraint [1] N. Bensaou and I. Guessarian. In F. Turini, editor, Proc. Fourth Logic Programs. Workshop on Logic Program Synthesis and Transformation, 1994. Conclusions M. Gabbrielli, G. Levi, and M. C. [2] A. Bossi, M. Bugliesi, Meo. Differential logic programming. In Proc, Twentieth Annual ACM Symp. on Principles of Programming Languages, pages 359-37o. ACM Press, 1993. We have investigated optimizations of CLP modules based on the replacement transformation. Our results extend previous ones in the field of transformations for logic programs in that we have defined applicability conditions for replacement which guarantee that the original and the transformed module are semantically equivalent under any @-context. These conditions have been instantiated to consider three different semantic notions. To the best of our knowledge, the only other papers which consider transformations for modular logic programs are [22, 10]. However, our notion of module composition is more general than the one considered in [22], since the latter assumes that each predicate is defiued within a single module and does not allow mutual recursion among modules. On the other hand, [10] considers only fold/unfold systems which, as previously mentioned, are quite different from those based on replacement. Also when restricting to the non-modular setting our results generalizes previous ones in the field. More specifically, paper [29] (which int reduced we extend those in the origina! replacement) by considering CLP equipped with three different semantics (the method in [29] is devised for pure logic programs and the least Herbrand model semantics) and by providing a different applicability condition to avoid loops (the one relative to condition (b) above). We also believe that our setting is more suitable for practical applications, as it does not rely on bottom-up concepts as [29] does. In the literature we find only two other papers which investigated replacement for CLP: one by Maher ([22]) which refers (when restricted to programs without negation) to the ([1]) M-congruence, and one by Bensaou and Guessarian which considers the C-semantics. We extend the part of the results of Maher relative to definite programs8 by rdlowing the replacement to introduce recursion in the predicate’s definition and by weakening the requirements of the applicability conditions: each time that the requirements of [22] are satisfied also the hypothesis of of Theorem 5.7 are satisfied. On the other hand, Theorem 5.5 provides ns with a generalization of Proposition 4.6 in [1]: each time that the ap placability conditions given in that paper are satisfied we can also apply the replacement. The converse is not trne, even in the non-modular case. For instance the replacements performed in Example 2.2 are not feasible using the tools of [1]. As previously said, the paper by Bensaou and Guessarian 8Although the clauses, Maher which [22] are considers beyond the also negated scope of this atoms in the body [3] A. Bossi and N. Cocco. Basic Transformation Operations which preserve Computed Answer Substitutions Journal of Logic Programming, of Logic Programs. 16(l&2):47-87, 1993. On Safe Folding. [4] A. Bossi, N. Cocco, and S. EtaUe. In M. Bruynooghe and M. Wirsing, editors, Programming Language Implementation and Logic Pr-ogram’92, volume 631 of Lecture ming - Proceedings PULP Notes in Computer Science, pages 172–186. SpringerVerlag, 1992. replace[5] A. Bossi, N. Cocco, and S. Etalle. Simultaneous ment in normal programs. Technical Report CS-R9357, CWI, Centre for Mathematics and Computer Science, Amsterdam, The Netherlands, August 1993. To appear in Journal of Logic and Computation, 1995. Available via ftp (or xmcsaic) at ftp.cwi.nl, in /pub/etaJle. [6] A. Bossi, M. Compositional ical Computer Gabbrielli, G. Levi, and M. C. Meo. A Semantics for Logic Programs. TheoretScience, 122(1-2):3–47, 1994. [7] M. Bugliesi, E. Lamma, and P. Mello. Modularity logic programming. Journal of Logic Programming, 20:443–502, 1994. in 19- logic as a computational formal[8] K. L. Clark. Predicate ism. Res. Report DOC 79/59, Imperial College, Dept. of Computing, London, 1979. A transformation system [9] J. Cook and J.P. Gallagher. for definite programs based on termination analisys. In F. Turini, editor, Proc. Fourth Workshop on Logic Program Synthesis and Transformation. Springer-Verlag, 1994. Modular Transformations [10] S. Etalle and M. Gabbrielli. of CLP Programs. In L. Sterling, editor, Proc. Twelfth Int’1 Conf. on Logic Programming, 1995. Extended version available as C WI Technical Report, 1995. G. Levi, M. Martelli, and C. Palam[11] M. Falaschi, idessi. Declarative modelling of the operational behavior of logic languages. Theorettca/ Computer Science, 69(3):289-318, 1989. of paper. 176 [12] M. Gabbrielli and G. Levi. Modeling Answer Constraints in Constraint Logic Programs. In K. Furukawa, editor, Proc. Eighth Int’! Conf. on Logic Programming, pages 238– 252. The MIT Press, Cambridge, Mass., 1991. Unfold/fold trans[13] P.A. Gardner and J.C. Shepherdson. formations of logic programs. In J-L Lassez and Computational Logic: Essays in G. Plotkin, editors, Honor of Alan Robinson. M1[T Press, 1991. Spiro Michaylov, and Peter J. Stuckey. [14] Nevin Heintze, CLP(7Z.) and some electrical engineering problems. In Jean-Louis Lassez, editor, ICLP’87: Proceedings ~th International Conference on Logic Programming, pages 675-703, Melbourne, Victoria, Australia, May 1987. MIT Press. Also in Journal of Automated Reasoning vol. 9, pages 231–260, October 1992. R. A. O’Keefe. Towards an Algebra for Const rutting Logic Programs. In Proc. IEEE Symp. on Logic Programming, pages 152-160, 1985. [26] A. Pettorossi and M. Proietti. Transformation of logic programs: Foundations and techniques. Journal of Logic Programming, 19,20:261-320, 1994. [27] M. Proietti and A. Pettorossi. Totaf correctness of a goal replacement rule based of the unfold/fold proof method. Conference on In M. Alpuente, editor, Proc. 1994 Joint Declarative Programing GULP-PRODE’94, 1994. [28] T. Sate. Equivalence-preserving first-order unfold/fold transformation system. Theoretical Computer Science, 105(1):57-84, 1992. [29] H. Tamaki and T. Sate. of Logic Programs. Second Int’1 Conf. 139, 1984. Logic Program[15] J. Jaffar and J.-L. Lassez. Constraint In Proc. Fourteenth Annual ACM Syrnp. on ming. Principles of Programming Languages, pages 111-119. ACM, 1987. gic Programming. Peter J. Stuckey, and Ro[17] Joxan Jaffar, Spiro Michayov, land H. C. Yap. The CLP(7?) language and system. TOPLAS: ACM Transactions on Programming Languages and Systems, 14(3):339–395, July 1992. Kim Marriott, and Spiro Michaylov. [18] Niels J@gensen, Some global compile-time optimizations for CLP(R-). In Vljay Saraswat and Kazunori Ueda, editors, lLPS’91: Proceedings of the International Logic Programming Symposium, pages 420-434, San Diego, October 1991. MIT press. and R. Yap. Constraint Logic [19] C. Lassez, K. McAloon, Programming and Option Trading. IEEE Ezpert, 2(3), 1987. of a. logic program transforma[20] M. J. Maher. Correctness tion system. IBM Research Report RC13496, T.J. Watson Research Center, 1987. Equivalences of logic programs. In ed[21] M. J. Maher. itor J. Minker, editor, Foundation of Deductive Databases and Logic Programmirag, pages 627–658. Morgan Kaufmann, 1988. A transformation system for deductive [22] M. J. Maher. databases with perfect model semantics. Theoretical Computer Science, 110:377–403, 1993. and Harald S@ndergaard. Analysis of con[23] Kim Marriott straint logic programs. In Saumya Debray and Manuel Hermenegildo, editors, NA CLP’90: Proceedings North pages American Conference on Logic Programming, 531–547, Austin, 1990. MIT Press. and Peter J. Stuckey. The 3 r’s of optimiz[24] Kim Marriott Refinement, removal and ing constraint logic programs: ACM SIGPLA N reordering. In POPL ‘9.9: Proceedings Symposium on Principles of Programming Languages, Charleston, January 1993. 177 Unfold/Fold Transformations In Sten-~ke Tarnlund, on Logic Programming, [30] Pascal JJan Hentenryck. J. Maher. Constraint logic [16] Joxan Jaffar and Michael of Logic Programprogramming: A survey. Journal ming, 19/20:503–581, 1994. View publication stats [25] MIT editor, Proc. pages 127– Constraint Satisfaction Press, Cambridge, MA, in Lo1989.