SWI Prolog - CLP(R) not propagating fully

74 views Asked by At

This gives me a result:

?- {5/(X) = (5/2)}.
X = 2.0 ;

This shows me a constraint, but doesn't let me use X in any material way:

?- {5/(3-X) = (5/2)}.
{-2.5+5/(3-X)=0.0}.

?- {5/(3-X) = (5/2)}, Z is X.
ERROR: Arguments are not sufficiently instantiated

Of course, if I explicitly give the solution, the constraint goes away and it evaluates as true.

?- {5/(3-X) = (5/2)}, X = 1.
X = 1.

Why, and how can I make it work?

1

There are 1 answers

2
brebs On

See section A10.3 at https://www.swi-prolog.org/man/clpqr.html

However, clpBNR seems better:

?- pack_install(clpBNR).
?- use_module(library(clpBNR)).

?- {5/(3-X) =:= 5/2}, Z = X.
X = Z, Z = 1.