home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / prolog / 1457 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  1.6 KB

  1. Path: sparky!uunet!munnari.oz.au!goanna!ok
  2. From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
  3. Newsgroups: comp.lang.prolog
  4. Subject: Re: term comparisons with variables
  5. Message-ID: <13794@goanna.cs.rmit.oz.au>
  6. Date: 28 Jul 92 03:34:40 GMT
  7. References: <1992Jul10.161816.3247@cs.kuleuven.ac.be> <270@ininx.UUCP>
  8. Organization: Comp Sci, RMIT, Melbourne, Australia
  9. Lines: 25
  10.  
  11. In article <270@ininx.UUCP>, jkreznar@ininx.UUCP (John E. Kreznar) writes:
  12. > What's a good way to represent sets of (possibly non-ground) terms in a setting
  13. > where terms are regarded as identical if they are variants of one another?
  14.  
  15. > But if variable-name correspondence between terms in the set _is_ important, as
  16. > for example if it's a set of atoms within a clause, this device will not work.
  17. > For example, the equivalence of the sets
  18. >         {p(X, a), p(Y, b)} and
  19. >         {p(U, b), p(V, a)}
  20. > does not seem to be easily detectable.
  21.  
  22. A lot of Prolog coding problems are eased by using redundant representations.
  23. For this particular problem, the thing that springs to mind is representing
  24. each term by a _pair_ of terms, one the grounded version of the other.  So
  25. a set of terms might be stored as a list of Ground-Original pairs, sorted
  26. on Ground.  That would give us
  27.     [p('$VAR'(0),a)-p(X,a), p('$VAR'(0),b)-p(Y,b)]
  28.     [p('$VAR'(0),a)-p(V,a), p('$VAR'(0),b)-p(U,b)]
  29. for which equivalence _is_ easily detectable.
  30.  
  31. Of course, as variables become instantiated, the Ground versions become
  32. inappropriate, so it would be best to compute the Ground versions just
  33. before using them.
  34. -- 
  35. You can lie with statistics ... but not to a statistician.
  36.