10.11.5 Projection and Redundancy Elimination

Once a derivation succeeds, the Prolog system presents the bindings for the variables in the query. In a CLP system, the set of answer constraints is presented in analogy. A complication in the CLP context are variables and associated constraints that were not mentioned in the query. A motivating example is the familiar mortgage relation:

% library('clpqr/examples/mg')
     T = 1,
     B + MP = P * (1 + I)
     T > 1,
     P1 = P * (1 + I) - MP,
     T1 = T - 1
  mg(P1, T1, I, B, MP).

A sample query yields:

clp(r) ?- [library('clpqr/examples/mg')].
clp(r) ?- mg(P,12,0.01,B,Mp).


Without projection of the answer constraints onto the query variables we would observe the following interaction:

clp(r) ?- mg(P,12,0.01,B,Mp).

{Mp= -(_A)+1.01*P},

The variables _A_K are not part of the query, they originate from the mortgage program proper. Although the latter answer is equivalent to the former in terms of linear algebra, most users would prefer the former.

Send feedback on this subject.