Towards Banishing the Cut from Prolog

Saumya K. Debray, David S. Warren

Research output: Contribution to journalArticle

7 Scopus citations

Abstract

There has been a great deal of interest in logic programming languages in recent years. This is due, in great part, to the advantages offered by these languages: declarative readings of programs and separation of program logic from control. However, logic programs can often be dismayingly inefficient. The usual solution to this problem has been to return some control to the user in the form of impure language features like cut. Unfortunately, this often results in the loss of precisely those features that made logic programming attractive in the first place. We argue that it is not necessary to resort to such impure features for efficiency. This point is illustrated by considering how most of the common uses of cut can be eliminated from Prolog source programs, relying on static analysis to generate them at compile time. Three common situations where the cut is used are considered. Static analysis techniques are given to detect such situations, and applicable program transformations are described. We also suggest two language constructs, firstof and oneof, for situations involving “don't-care” non-determinism. These constructs have better declarative readings than the cut, and extend better to parallel evaluation strategies. Together, these proposals result in a system where users need rely much less on cuts for efficiency, thereby promoting a purer programming style without sacrificing efficiency.

Original languageEnglish (US)
Pages (from-to)335-349
Number of pages15
JournalIEEE Transactions on Software Engineering
Volume16
Issue number3
DOIs
StatePublished - Mar 1990

    Fingerprint

Keywords

  • Optimization
  • Prolog
  • program transformation

ASJC Scopus subject areas

  • Software

Cite this