A confluent relational calculus for higher-order programming with constraints
Constraints in Computational Logics
We present the -calculus, a relational calculus parametrized with a logical constraint system. The -calculus provides for higherorder relational programming with rst-order constraints, and subsumes higher-order functional programming as a special case. It captures important aspects of the concurrent constraint programming language Oz. We prove the uniform con uence of the -calculus. Uniform con uence implies that all maximal derivations issuing from a given expression have equal length. But
... con uence of a nonfunctional calculus modelling computation with partial information is interesting on its own right. Recently, two other minimalistic relational calculi have been proposed: thecalculus 8] and the -calculus 13] The -calculus models purely functional computation in a relational setting. It is uniformly con uent and embeds the eager -calculus. The -calculus is a extension of the -calculus being a minimalistic foundation for relational, concurrent, and object-oriented programming. In particular, it provides for lazy functional programming with sharing 5] integrating concurrent state 1, 6]. The -calculus provides for logical variables but not for rst-order uni cation, which would amount to the integration of a tree constraint system. This choice makes the -calculus technically simpler than the -calculus. However, in relational calculi providing for encapsulated search 11] or type inference 7], rstorder uni cation or other forms of constraint solving are needed. For these purposes, extensions of the -calculus are appropriate. We continue with some technical remarks on uniform con uence. In 8], uniform con uence of the eager -calculus and the -calculus are proved. The proof for the eager -calculus is trivial, whereas the proof for the -calculus requires a deep analysis of parallel composition. We point out that proofs of uniform con uence are based on local considerations excluding termination. This is possible, since uniform con uence implies Huet's notion of strong con uence 4]. A central contribution of this paper is the proof of the uniform con uence of the -calculus. This proof is hard. It is based on a method developed for the -calculus 8]. Additionally, it needs a novel method for the decomposition of equivalence relations. This new complexity comes with the freedom of constraint handling. The con uence of the -calculus depends essentially on the concept of names. Names are rst-class citizens. This means that variables may denote names and that names can be passed as parameters. Names can be tested for equality and disequality in rst-order logic. An equation a = b between names is unsatis able if and only if a and b are distinct. The -calculus ensures that all abstractions are equipped with a unique name. On creation of a new abstraction a new name is created, relying on a mechanism independently proposed in 14, 10, 9] . Without the above invariant, con uence of the -calculus would fail. For instance, consider the following expression E being a composition of two abstractions with the same name a: a: x =>^a: y =? : E reduces to non-joinable expressions when composed with an application az : E^? E^az ! E^> : The paper is organized as follows: First, we de ne constraint systems and present the -calculus. Then, we give a typical example for programming in thecalculus. After that, we investigate uniform con uence and its consequences for general calculi. Finally, we formulate our decomposition method and prove the uniform con uence of the -calculus.