home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / prolog / 2281 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.7 KB  |  57 lines

  1. Newsgroups: comp.lang.prolog
  2. Path: sparky!uunet!brunix!brunix!mj
  3. From: mj@cs.brown.edu (Mark Johnson)
  4. Subject: Re: Occurs check
  5. Message-ID: <1992Dec21.153147.26177@cs.brown.edu>
  6. Sender: news@cs.brown.edu
  7. Organization: Brown University Department of Computer Science
  8. References: <TORKEL.92Dec18231028@lludd.sics.se> <24454@alice.att.com> <TORKEL.92Dec20104928@bast.sics.se>
  9. Date: Mon, 21 Dec 1992 15:31:47 GMT
  10. Lines: 45
  11.  
  12. >  In a more perspicuous description of Prolog-style Horn clause programming,
  13. >I think it's a good idea to separate the constraint system from the
  14. >resolution mechanism. Thus Prolog (in the simplified version here considered),
  15. >whatever the constraint system used, delivers answers to a question A(x)
  16. >of the form C(x,y), where C(x,y) is a conjunction of constraints, and
  17. >it always holds that
  18. >
  19. >    (1)                     C(x,y) -> A(x)
  20. >
  21. >is a logical consequence of the program, read as a set of Horn clauses. Of
  22. >course (1) does not imply that there is an x such that A(x); for this to
  23. >follow, the constraint theory must be used.
  24.  
  25. This is a nice way of viewing things, but I don't know any Prolog that
  26. gives you all of the constraints C.  Consider the following program:
  27.  
  28.     p(a) :- q(X,X).
  29.  
  30.     q(Y, f(Y)).
  31.  
  32. One the query p(X), Sicstus returns the following:
  33.  
  34. | ?- p(X).
  35.  
  36. X = a ? ;
  37.  
  38. no
  39. | ?- q(X,X).
  40.  
  41. X = f(f(f(f(f(f(f(f(f(f(f(f(f(f ...
  42.  
  43. That is, sicstus only returns constraints related to variables appearing
  44. the goal.  But the constraints that only have cyclic solutions may be
  45. associated with other variables.
  46.  
  47. On a related issue, are there systems that permit user-specified
  48. constraints, perhaps by means of some kind of escape system built
  49. into the unifier?
  50.  
  51. Mark
  52.  
  53.  
  54. Mark Johnson
  55. Cognitive Science, Box 1978
  56. Brown University
  57.