Re: Uniqueness in a set of variables

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Wed 03 Oct 2001 06:04:26 PM GMT
Message-ID: <3BBB532A.361CB20D@icparc.ic.ac.uk>
Warwick Harvey wrote:
> 
> It sounds like the kind of thing you're looking for is the instance/2
> predicate.  See the documentation for details, but basically it succeeds if
> and only if one term is an instance of another (i.e. they can be made the
> same by possibly binding some variables) --- assuming there are no shared
> variables involved.  So what you want to do is go through your terms and
> throw out any which are instances of others.


Yes, the prune_instances/2 predicate does exactly this:

[eclipse 12]: prune_instances([f(1,X), f(Y,1), f(1,1), g(2,Q), g(2,1)], List).

X = X
Y = Y
Q = Q
List = [f(1, X), f(Y, 1), g(2, Q)]
Yes (0.00s cpu)
[eclipse 13]: prune_instances([f(1,X), f(Y,Z), g(2,Q)], List).

X = X
Y = Y
Z = Z
Q = Q
List = [f(Y, Z), g(2, Q)]
Yes (0.00s cpu)


I don't know what exactly your application is, but maybe
library(propia) could be relevant for you.

-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
 London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
Received on Wed Oct 03 19:04:38 2001

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:10 PM GMT GMT