Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

instantiated error

Status
Not open for further replies.

synhedionn

Programmer
Oct 22, 2008
9
FR
Hi,
Why
X < 10 , X > 0 , integer(X), integer(Y),Y < 10 , Y > 0 , X mod Y = 0 , X / Y = 2 .

does give
ERROR: </2: Arguments are not sufficiently instantiated ?
 
because you don't give any value to X for integer(X).
 
OK, but
1) if I want it to solve X as an integer unknown to solve, how can I give value to X ?!
2) imagine I want to initiate X with 3, so :
X < 10 , X > 0 , integer(X), X = 3,Y < 10 , Y > 0 , X mod Y = 0 , X / Y = 2 .

but :
ERROR: </2: Arguments are not sufficiently instantiated ?

So where is the problem?
 
You can't do that in classical Prolog, use library(clpfd).
 
thanks.
In fact it was already loaded, but still same error:
?- use_module(library(clpfd)). X < 10 , X > 0 , integer(X), X = 3,Y < 10 , Y > 0 , X mod Y = 0 , X / Y = 2 .
ERROR: </2: Arguments are not sufficiently instantiated
 
you don't use clpfd when you write X < 0 .
You must write
X #< 10 , X #> 0 , Y #< 10 , Y #> 0 , X mod Y #= 0 , X / Y #= 2, label([X, Y]).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top