Skip to main content

Detection and optimization of functional computations in Prolog

  • Session 5a: Program Analysis
  • Conference paper
  • First Online:
Third International Conference on Logic Programming (ICLP 1986)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 225))

Included in the following conference series:

Abstract

While the ability to simulate nondeterminism and return multiple outputs for a single input is a powerful and attractive feature of Prolog, it is expensive both in time and space. Since Prolog programs are very often functional, i.e. do not produce more than one distinct output for a single input, this overhead is especially undesirable. This paper describes how a program may be analyzed statically to determine which literals and predicates are functional, and how the program may then be optimized using this information. Our notion of “functionality” subsumes the notion of “determinacy” that has been considered by various researchers. Our algorithms are less reliant on features such as cut, and thus extend more easily to parallel execution strategies than others that have been proposed.

This work was supported in part by the National Science Foundation under grant number DCR-8407688.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

7. References

  1. M. Bruynooghe, “Adding Redundancy to Obtain More Reliable and More Readable Prolog Programs”, in Proc. 1st. Int. Logic Programming Conference, Marseille, France, 1982.

    Google Scholar 

  2. M. Bruynooghe and L. M. Pereira, “Deduction revision by intelligent backtracking”, in Implementations of Prolog, J. A. Campbell, (ed.), Ellis Horwood Ltd., Chichester, 1984.

    Google Scholar 

  3. J. Chang and A. M. Despain, “Semi-Intelligent Backtracking of Prolog Based on Static Data Dependency Analysis”, in Proc. 1985 Symposium on Logic Programming, Boston, July 1985, 10–21.

    Google Scholar 

  4. K. L. Clark, “Negation as Failure”, in Logic and Data Bases, H. Gallaire and J. Minker, (eds.), Plenum Press, New York, 1978.

    Google Scholar 

  5. S. K. Debray, “Detection and Optimization of Functional Computations in Prolog”, Technical Report #85/020, Dept. of Computer Science, SUNY at Stony Brook, Stony Brook, NY, Aug. 1985.

    Google Scholar 

  6. S. K. Debray, “Automatic Mode Inference for Prolog Programs”, Technical Report #85/019, Department of Computer Science, SUNY at Stony Brook, Stony Brook, NY, June 1985.

    Google Scholar 

  7. S. Haridi and A. Ciepielewski, “An Or-Parallel Token Machine”, TRITA-CS-8303, Dept. of Telecommunication Systems — Computer Systems, Royal Institute of Technology, Stockholm, May 1983.

    Google Scholar 

  8. C. S. Mellish, “The Automatic Generation of Mode Declarations for Prolog Programs”, DAI Research Paper 163, Dept. of Artificial Intelligence, University of Edinburgh, Aug. 1981.

    Google Scholar 

  9. C. S. Mellish, “Some Global Optimizations for a Prolog Compiler”, J. Logic Programming, 2, 1 (Apr. 1985), 43–66.

    Google Scholar 

  10. A. O. Mendelzon, “Functional Dependencies in Logic Programs”, in Proc. 11th. ACM Int. Conf. on Very Large Data Bases, Stockholm, Sweden, Aug. 1985.

    Google Scholar 

  11. R. A. O'Keefe, “On the Treatment of Cuts in Prolog Source-Level Tools”, in Proc. 1985 Symposium on Logic Programming, Boston, July 1985, 73–77.

    Google Scholar 

  12. H. Sawamura and T. Takeshima, “Recursive Unsolvability of Determinacy, Solvable Cases of Determinacy and Their Applications to Prolog Optimization”, in Proc. 1985 Symposium on Logic Programming, Boston, July 1985, 200–207.

    Google Scholar 

  13. R. Venken, “A Prolog Meta-Interpreter for Partial Evaluation and its Application to Source-to-Source Transformation and Query Optimization”, in Proc. ECAI 84,.

    Google Scholar 

  14. D. H. D. Warren, “Implementing Prolog — Compiling Predicate Logic Programs”, Research Reports 39 and 40, Dept. of Artificial Intelligence, University of Edinburgh, 1977.

    Google Scholar 

  15. D. H. D. Warren, “An Abstract Prolog Instruction Set”, Technical Note 309, SRI International, Menlo Park, CA, Oct. 1983.

    Google Scholar 

  16. D. S. Warren, M. Ahamad, S. K. Debray and L. V. Kale, “Executing Distributed Prolog Programs on a Broadcast Network”, Proc. 1984 Int. Symp. on Logic Programming, Atlantic City, New Jersey, Feb. 1984.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Ehud Shapiro

Rights and permissions

Reprints and permissions

Copyright information

© 1986 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Debray, S.K., Warren, D.S. (1986). Detection and optimization of functional computations in Prolog. In: Shapiro, E. (eds) Third International Conference on Logic Programming. ICLP 1986. Lecture Notes in Computer Science, vol 225. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-16492-8_97

Download citation

  • DOI: https://doi.org/10.1007/3-540-16492-8_97

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-16492-0

  • Online ISBN: 978-3-540-39831-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics