Article View: comp.lang.prolog
Article #61Re: term comparisons with variables
From: John E. Kreznar
Date: Mon, 03 Aug 1992 10:08
Date: Mon, 03 Aug 1992 10:08
58 lines
2783 bytes
2783 bytes
In article <13794@goanna.cs.rmit.oz.au>, ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
> 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.
Not only must the _equivalence_ between
{p(X, a), p(Y, b)} and
{p(U, b), p(V, a)}
be easily detectable, but the important _difference_ between
{p(X, a), p(Y, b)} and
{p(X, a), p(X, b)}
must also be preserved and be easily detectable. If I understand what you're
proposing, the ground versions of these last two sets are the same, even though
the variables in one are shared.
If numbervars is run on these last two as _sets_, the results are
[p('$VAR'(0), a),p('$VAR'(1), b)] and
[p('$VAR'(0), a),p('$VAR'(0), b)]
which correctly preserves the distinction between the variables in the first
case and their identification with one another in the second. However, the
inadequacy of this idea is revealed by applying it to my original pair of sets,
yielding
[p('$VAR'(0), a), p('$VAR'(1), b)] and
[p('$VAR'(0), b), p('$VAR'(1), a)],
which obscures the equivalence of the two sets.
I still have the question: What's a good way to represent sets of equivalence
classes of terms, where two terms are equivalent if they are variants.
--
Relations among people to be by mutual consent, or not at all.
---John E. Kreznar, jkreznar@ininx.com, uunet!ininx!jkreznar
Technical Details
Message-ID:
<271@ininx.UUCP>Path:
arc1-ca.pugleaf.net!sparky!uunet!ininx!jkreznarReferences:
<1992Jul10.161816.3247@cs.kuleuven.ac.be> <270@ininx.UUCP> <13794@goanna.cs.rmit.oz.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ininx!jkreznar From: jkreznar@ininx.UUCP (John E. Kreznar) Newsgroups: comp.lang.prolog Subject: Re: term comparisons with variables Message-ID: <271@ininx.UUCP> Date: 3 Aug 92 10:08:47 GMT References: <1992Jul10.161816.3247@cs.kuleuven.ac.be> <270@ininx.UUCP> <13794@goanna.cs.rmit.oz.au> Organization: Independence Industries, Los Angeles Lines: 58