🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #119

Re: term comparisons with variables

#119
From: Richard A. O'Keefe
Date: Tue, 28 Jul 1992 03:34
25 lines
1641 bytes
In article <270@ininx.UUCP>, jkreznar@ininx.UUCP (John E. Kreznar) writes:
> What's a good way to represent sets of (possibly non-ground) terms in a setting
> where terms are regarded as identical if they are variants of one another?

> But if variable-name correspondence between terms in the set _is_ important, as
> for example if it's a set of atoms within a clause, this device will not work.
> For example, the equivalence of the sets
> 		{p(X, a), p(Y, b)} and
> 		{p(U, b), p(V, a)}
> does not seem to be easily detectable.

A lot of Prolog coding problems are eased by using redundant representations.
For this particular problem, the thing that springs to mind is representing
each term by a _pair_ of terms, one the grounded version of the other.  So
a set of terms might be stored as a list of Ground-Original pairs, sorted
on Ground.  That would give us
	[p('$VAR'(0),a)-p(X,a), p('$VAR'(0),b)-p(Y,b)]
	[p('$VAR'(0),a)-p(V,a), p('$VAR'(0),b)-p(U,b)]
for which equivalence _is_ easily detectable.

Of course, as variables become instantiated, the Ground versions become
inappropriate, so it would be best to compute the Ground versions just
before using them.
-- 
You can lie with statistics ... but not to a statistician.
Technical Details
Message-ID: <13794@goanna.cs.rmit.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!goanna!ok
References: <1992Jul10.161816.3247@cs.kuleuven.ac.be> <270@ininx.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!goanna!ok
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.prolog
Subject: Re: term comparisons with variables
Message-ID: <13794@goanna.cs.rmit.oz.au>
Date: 28 Jul 92 03:34:40 GMT
References: <1992Jul10.161816.3247@cs.kuleuven.ac.be> <270@ininx.UUCP>
Organization: Comp Sci, RMIT, Melbourne, Australia
Lines: 25