Toward the partial evaluation of CLP languages

In this paper we present a schema for constructing partial evaluators for Constraint Logic Programming (CLP) languages. Our method is based on applying meaningpreserving program transformations to program-query pairs. The three fundamental transformations are specialization, unfolding, and fact orization, which we rigorously define for CLP languages, and which we show preserve breadth-first equivalence. The factorization transformation generalizes three previously stndied techniques: constraint lifting, reparameterization, and auxiliary call creation. We also show that if some restrictions are placed on these transformations they preserve depth-first equivalence as well. A partial evaluator which employs these transformations is presented. It is guaranteed to terminate and generates a residual program containing none of the clauses of the original program. To illustrate the fundamental ideas, we present a detailed example of transforming a CLP(BOO1) program defining a boolean adder circuit into a bit-shifting program when the query is to add a bit-string to itself.