Hi Peter,
I think you must use something like the predefined numbervars.

Example : 
?- numbervars(f(A),1,U).
—> A = '$VAR'(1)
U = 2

numbervars “counts" variables in his first argument term, beginning with the 
index given by the 2nd arg (here 1).
Meanwhile, numbervars “renames” variables as you can see in     A = '$VAR’(1) 
by calling the first variable '$VAR'(1).
The answer U=2 gives the next free index (also, 2-1=1 means : you had one 
variable).

If we try 
?- numbervars(rel(_,A,A),2,N).
we will rename the variable ‘A' by '$VAR'(3) and N=4 (this time, the index 
started at 2 and same variable gets same number).

Now, for your question : 
?- numbervars([rel(_,A,_),rel(de,B,C),rel(para,C,D)],1,N), 
memberchk(rel(_,A,_),[rel(de,B,C),rel(para,C,D)]).
—> No.

The only success case is when there are identical variables.


Hope this will help.

Alex


Le 27 août 2010 à 02:05, Pedro Fialho a écrit :

> Hi all,
> 
> Here I present a simple case which describes my problem:
> 
> | ?-  memberchk(rel(_,A,_),[rel(de,B,C),rel(para,C,D)]).
> B = A
> 
> yes
> | ?- 
> 
> I'd like this memberchk/2 call to answer "No", stated that the
> content on the list argument is unknown and as such the A \== B 
> constraint it's not available.
> 
> Is there a way to avoid unification/equality between variables?
> Or a translator from variable to atom (uppercase to lowercase)?
> 
> Any hints?
> 
> 
> Greetings,
> Peter
> 
> 
> _______________________________________________
> Users-prolog mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/users-prolog

 -------------------------------
Alexandre Saidi
Maitre de Conférences
Ecole Centrale de Lyon-Dép. MI
LIRIS-CNRS UMR 5205
Tél : 0472186530, Fax : 0472186443







_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to