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.
This work has been partially supported by the “Progetto Finalizzato Sistemi Informatici e Calcolo Parallelo” of the CNR and MPI 40% (Italy).
Preview
Unable to display preview. Download preview PDF.
8. References
Burstall, R.M. and Darlington, J.: "A Transformation System for Developing Recursive Programs", JACM, Vol. 24, No. 1, January 1977, pp. 44–67.
CIP Language Group: "The Munich Project CIP" Lecture Notes in Computer Science, 1984.
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.
Debray, S.K. and Warren, D.S.: "Functional Computations in Logic Programs", ACM TOPLAS, 11 (3), 1989, pp. 451–481.
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.
Hogger, C.J.: "Derivation of Logic Programs", JACM, No. 28, 2, 1981, pp. 372–392.
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.
Lloyd, J.W.: "Foundations of Logic Programming", Springer-Verlag, Berlin, Heidelberg, New York, Tokyo, 2nd edition, 1987.
Paige, R. and Koenig, S.: "Finite Differencing of Computable Expressions" ACM TOPLAS 4 (3) July 1982, pp. 402–454.
Pettorossi, A.: "Transformation of Programs and Use of Tupling Strategy", Proc. Informatica 77, Bled, Yugoslavia, 1977, pp. 3 103, 1–6.
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.
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.
Tamaki, H. and Sato, T.: "Unfold/Fold Transformation of Logic Programs", Proc. 2nd International Conference on Logic Programming, Uppsala, Sweden, 1984.
Wadler, P. L.: "Deforestation: Transforming Programs to Eliminate Trees", Proc. ESOP 88, Nancy, France, 1988, Lecture Notes in Computer Science 300, pp. 344–358.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1991 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Proietti, M., Pettorossi, A. (1991). Unfolding — definition — folding, in this order, for avoiding unnecessary variables in logic programs. In: Maluszyński, J., Wirsing, M. (eds) Programming Language Implementation and Logic Programming. PLILP 1991. Lecture Notes in Computer Science, vol 528. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-54444-5_111
Download citation
DOI: https://doi.org/10.1007/3-540-54444-5_111
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-54444-9
Online ISBN: 978-3-540-38362-8
eBook Packages: Springer Book Archive