Re: [eclipse-clp-users] user defined constraints using propia

From: Marco Gavanelli <marco.gavanelli_at_...17...>
Date: Thu, 01 Apr 2010 11:06:39 +0200
Oliver Shycle wrote:
> Hi all,
> After studying the Constraint Library Manual I thought that using propia
> enables me to turn every prolog goal into a constraint. Using such a
> constraint works in general. However it unfortunately doesn't work in
> combination with constraint expression connectives like "=>" or "neg".
> The use of "neg (my_constraint(X) infers most)" where X is a variable to be
> labeled later gives me the following error:
> instantiation fault in infers(my_constraint(_518{1 .. 6}), most, _5589{[0,
> 1]})
> Why do I get this error?
> And what is the third variable "_5589{[0, 1]" of the infers predicate that
> is shown in this error message?

Dear Olivier,

as Thorsten suggested, you can read Section 3.2.3 in the Constraint 
Library Manual; there you can find a section on "User-defined reified 

Then, you can consider this example:

% Original predicate. Becomes a constraint when invoked with "infers most"
my_constr(X):- X#>10.
my_constr(X):- X#<10.

% Reified version of the predicate
my_reif_constr(X,1):- X#>10.
my_reif_constr(X,1):- X#<10.
my_reif_constr(X,0):- X#=10.

% Reified version is now a constraint
     my_reif_constr(X,B) infers most.


[eclipse 13]: X::0..20, neg(reif_constr(X)).

X = 10
Yes (0.00s cpu)


Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
Tel/Fax  +39-0532-97-4833
Received on Thu Apr 01 2010 - 09:29:38 CEST

This archive was generated by hypermail 2.3.0 : Sun Aug 25 2019 - 03:15:37 CEST