[eclipse-clp-users] Implying Initial Domains for Certain Arguments of Predicates

From: Gökhan Solak <solakg_at_...399...>
Date: Fri, 2 Oct 2015 16:48:32 +0300
Hello,

First of all, I would like to inform that I'm a novice in Prolog.

What I want to do is to imply predefined domains for the variables which
takes part in arguments of certain predicates.

For example, for the custom predicate *age( A, X)*, which means in my
model *"age
of the object A is X"*, it follows that X is an integer. Moreover if A is a
human, domain of X is [1,130] (broadly speaking).

In predicate logic with constraints, I think this can be defined by the
following clauses:
age(A, X) -> integer(X).
age(A, X) and human(A) -> X € [1,130].

I translated this into Prolog program as:
integer(X) :- age( _, X).
X :: 1..130 :- age( _A, X), human( _A).

age/2 and human/1 are defined in the same file. lib(ic) is imported.

When I compile the module I get a warning and an error as follows:

WARNING: Hiding imported predicate ::/2 from module ic_constraints in
module cilp_bk (use local/1)

*** trying to redefine a built-in predicate: integer / 1

I can understand that redefining predicates may not be safe. But I can't
think of another way to define this concept with my Prolog knowledge. Is
there a way I can do it?

Thanks in advance,
Gökhan Solak
Received on Fri Oct 02 2015 - 13:49:09 CEST

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:20 CET