The simultaneous linear equations: are expressed in CLP(R) as: and a typical implementation's response would be:
The first rule expresses that for a 0 period loan the balance owing at the end is simply the original principal.
The second rule expresses that for a loan of at least one time period we can calculate the new owing amount P1 by multiplying the principal by 1 plus the interest rate and subtracting the repayment.
The system responds with the answer What is the relationship between the principal, repayment and balance on a 10 year loan at 10% interest?
[1] This implementation has since been ported to many popular Prolog systems, including Ciao,[2] SWI-Prolog[3] and XSB.