Reputation: 21
I want to write the following constraint in Prolog, is it possible?
C1(x, y) : isSU(x) ∧ isSU(y)
note that isSU is a user defined predicate which reads a configuration file, and checks whether its input parameter (here x or y) has a certain condition or not. Actually my problem is that, I don't know how to define a user defined predicate in Prolog. The other thing is that I don't know how to use universal and existential quantifiers in a rule in Prolog.
Thanks for your answer. Ali Davoudian
Upvotes: 1
Views: 484
Reputation: 5575
In SWI-Prolog your constraint would be written that way:
c1(X, Y) :- isSU(X), isSU(Y).
And about the rest I would recommend reading a book. Here is good list of free books about Prolog programming: https://stackoverflow.com/tags/prolog/info
Upvotes: 1