Advertisement

Unfolding — definition — folding, in this order, for avoiding unnecessary variables in logic programs

  • Maurizio Proietti
  • Alberto Pettorossi
Sessvon: Optimization Techniques
Part of the Lecture Notes in Computer Science book series (LNCS, volume 528)

Abstract

We take a syntactically based approach to the automatic improvement of performances of logic programs by using the unfold/fold transformation technique. A cause of program inefficiency is often the presence of variables which are unnecessary, in the sense that they force computations of redundant values or multiple visits of data structures.

We propose a strategy which automatically transforms initial program versions into new efficient versions by avoiding unnecessary variables. Our strategy is an extension of the one which was introduced in an earlier paper [Proietti-Pettorossi 90]. It is based on the syntactical characterization of the unnecessary variables and the introduction of a composite transformation rule made out of unfolding-definition-folding steps, in this order. The strategy consists in the repeated application of this composite rule to each clause with unnecessary variables. It avoids the search for eureka definitions which is often required by other techniques proposed in the literature. We define a class of programs for which our transformation strategy is successful and we propose a variant of that strategy which uses the so-called Generalization Rule. This variant is always terminating, but, in general, not all unnecessary variables are eliminated.

Keywords

Logic Program Transformation Technique Predicate Symbol Elimination Procedure Relevant Portion 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

8. References

  1. [Burstall-Darlington 77]
    Burstall, R.M. and Darlington, J.: "A Transformation System for Developing Recursive Programs", JACM, Vol. 24, No. 1, January 1977, pp. 44–67.Google Scholar
  2. [CIP 84]
    CIP Language Group: "The Munich Project CIP" Lecture Notes in Computer Science, 1984.Google Scholar
  3. [Debray 88]
    Debray, S.K.: "Unfold/Fold Transformations and Loop Optimization of Logic Programs", Proc. SIGPLAN 88, Conference on Programming Language Design and Implementation, Altanta, Georgia, 1988.Google Scholar
  4. [Debray-Warren 89]
    Debray, S.K. and Warren, D.S.: "Functional Computations in Logic Programs", ACM TOPLAS, 11 (3), 1989, pp. 451–481.Google Scholar
  5. [Feather 86]
    Feather, M.S.: "A Survey and Classification of Some Program Transformation Techniques", Proc. TC2 IFIP Working Conference on Program Specification and Transformation, Bad Tölz, Germany, 1986.Google Scholar
  6. [Hogger 81]
    Hogger, C.J.: "Derivation of Logic Programs", JACM, No. 28, 2, 1981, pp. 372–392.Google Scholar
  7. [Kawamura-Kanamori 88]
    Kawamura, T. and Kanamori, T.: "Preservation of Stronger Equivalence in Unfold/Fold Logic Program Transformation", Proc. Int. Conf. on Fifth Generation Computer Systems, Tokyo, 1988, pp. 413–422.Google Scholar
  8. [Lloyd 87]
    Lloyd, J.W.: "Foundations of Logic Programming", Springer-Verlag, Berlin, Heidelberg, New York, Tokyo, 2nd edition, 1987.Google Scholar
  9. [Paige-Koenig 82]
    Paige, R. and Koenig, S.: "Finite Differencing of Computable Expressions" ACM TOPLAS 4 (3) July 1982, pp. 402–454.Google Scholar
  10. [Pettorossi 77]
    Pettorossi, A.: "Transformation of Programs and Use of Tupling Strategy", Proc. Informatica 77, Bled, Yugoslavia, 1977, pp. 3 103, 1–6.Google Scholar
  11. [Pettorossi-Proietti 87]
    Pettorossi, A. and Proietti, M.: "Importing and Exporting Information in Program Development", Proc. IFIP TC2 Workshop on Partial Evaluation and Mixed Computation, Gammel Avernaes, Denmark, North Holland 1987, pp. 405–425.Google Scholar
  12. [Proietti-Pettorossi 90]
    Proietti, M. and Pettorossi, A.: "Synthesis of Eureka Predicates for Developing Logic Programs", Proc. ESOP 90, Copenhagen, 1990, Lecture Notes in Computer Science No. 432, pp. 306–325.Google Scholar
  13. [Tamaki-Sato 84]
    Tamaki, H. and Sato, T.: "Unfold/Fold Transformation of Logic Programs", Proc. 2nd International Conference on Logic Programming, Uppsala, Sweden, 1984.Google Scholar
  14. [Wadler 88]
    Wadler, P. L.: "Deforestation: Transforming Programs to Eliminate Trees", Proc. ESOP 88, Nancy, France, 1988, Lecture Notes in Computer Science 300, pp. 344–358.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Maurizio Proietti
    • 1
  • Alberto Pettorossi
    • 2
  1. 1.IASI-CNRRomaItaly
  2. 2.Electronics DepartmentUniversity of Rome IIRomeItaly

Personalised recommendations