Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!pipex!sunic!trane.uninett.no!eunet.no!nuug!EU.net!uunet!allegra!ulysses!alice!pereira
From: pereira@alta.research.att.com (Fernando Pereira)
Subject: Re: Occur-check considered harmful?
In-Reply-To: fjh@munta.cs.mu.OZ.AU's message of Sun, 11 Sep 1994 20:10:16 GMT
Message-ID: <PEREIRA.94Sep11211814@alta.research.att.com>
Sender: netnews@ulysses.homer.att.com (Shankar Ishwar)
Reply-To: pereira@research.att.com
Organization: AT&T Bell Laboratories
References: <PERM.94Sep8192108@groucho.csd.uu.se> <9425506.6106@mulga.cs.mu.OZ.AU>
Date: Mon, 12 Sep 1994 01:18:14 GMT
Lines: 34

In article <9425506.6106@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
> perm@csd.uu.se (Per Mildner) writes:
> >Assuming occur-check was free, what would people think about a prolog
> >implementation that enforces unification with occur-check?

> If the occur-check was free, I think logic programmers would definitely
> want implementations to enforce it.
The situation is a bit more shaded than that. There are perfectly
legitimate reasons for doing (constraint) logic programming with
equality and inequality constraints over rational terms. But then
there are many other applications in which the appropriate constraint
theory is the standard Herbrand one. While it is true that for much
Prolog programming the lack of an occurs check (when the intended
constraint theory is the Herbrand one) is not a major problem, just a
danger to be aware of, in applications involving partial execution,
eg. various grammar compilation and execution schemes I have worked
on, the lack of occurs check can engender nasty and subtle bugs.

In an ideal logic programming system, it whould be possible to
parameterize programs by the constraint theory to be used in solving
the implicit equations arising from procedure calls. It should also be
possible to use several theories through explicit constraints in a
program, and to coerce terms from a theory to another is reasonable
(eg. Herbrand terms to rational terms).




--
Fernando Pereira
2D-447, AT&T Bell Laboratories
600 Mountain Ave, PO Box 636
Murray Hill, NJ 07974-0636
pereira@research.att.com
