Article View: comp.lang.prolog
Article #4229Re: Legitimate uses of "assert"?
From: Saumya K. Debray
Date: Wed, 28 Feb 1990 20:38
Date: Wed, 28 Feb 1990 20:38
32 lines
2132 bytes
2132 bytes
Frank Pfenning (fp@PROOF.ERGO.CS.CMU.EDU) writes:
> I am looking for papers/reports/code/information on "legitimate" uses
> of "assert" and "retract" in logic programming, that is, uses which are
> considered to be in good taste by the connoisseurs of the field.
One of the very few situations where I find the use of "assert" justifiable
is in flow analysis of Prolog programs. I have a Prolog compiler written
in Prolog, and wanted to analyze Prolog programs. A straightforward
implementation would have involved two levels of execution -- the analyzer
(symbolically) executing the input program, and it in turn being executed
by the underlying system. Because this happens during an iterative fixpoint
computation, the overhead can be quite high.
We were able to get a significant improvement (about an order of magnitude)
in speed by short-circuiting one level of interpretation -- the idea was
to construct a "specialized" analysis program on the fly (think of it as
partial-evaluation-to-the-max), assert it, then transfer control to it.
Whereas in the "old" implementation the performance bottleneck was in the
fixpoint computation, in the "new" system the bottleneck was assert.
(For details, see the paper by Debray and Warren, JLP v. 5 n. 3, Sept. 1988,
and by Warren, Hermenegildo and Debray, 5th ICLP, Seattle, 1988).
(Caveat: I won't vouch for this being considered "in good taste" by
connoisseurs, the best I can say is that it's useful and I can't think of
a reasonable workaround of comparable efficiency that doesn't use assert.)
--
Saumya Debray CS Department, University of Arizona, Tucson
internet: debray@cs.arizona.edu
uucp: uunet!arizona!debray
Technical Details
Message-ID:
<18456@megaron.cs.arizona.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!ig!arizona!debrayReferences:
<8205@pt.cs.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!ig!arizona!debray From: debray@cs.arizona.edu (Saumya K. Debray) Newsgroups: comp.lang.prolog Subject: Re: Legitimate uses of "assert"? Summary: flow analysis Message-ID: <18456@megaron.cs.arizona.edu> Date: 28 Feb 90 20:38:10 GMT References: <8205@pt.cs.cmu.edu> Organization: U of Arizona CS Dept, Tucson Lines: 32