Abstract
We propose some techniques for mechanizing a class of rule-based transformations of logic programs. Analogous techniques can be applied also in the case of functional programs for which the program transformation methodology was first introduced [4].
We consider the following abstract Transformation Problem: given a program P and a property Φ, we are required to find a program, say TransfP, equivalent to P such that Φ holds for TransfP. The property Φ characterizes the desired ‘shape’ of the program to be derived (for instance, linear recursive, tail recursive, without intermediate variables, etc.).
We propose some restrictions on the property Φ which make it possible to perform the desired transformation in an incremental way, in the sense that, if a clause which does not satisfy Φ is transformed into clauses which do satisfy Φ, then these resulting clauses need not be considered again during the transformation process.
The core of our technique is a procedure, called Incremental Transformation, which is a generalization of the procedure for eliminating unnecessary variables introduced in [13]. The generalization basically consists in the fact that we have parametrized our transformation procedure w.r.t. the property Φ which the transformed program is required to satisfy.
The proposed procedure is nondeterministic and it generates a possibly infinite tree of programs which are all derivable from the given program P. We study the use of best-first search strategies for traversing this tree of programs. We finally provide a sufficient condition for solving a given transformation problem by using a best-first strategy, in case our Incremental Transformation procedure can find a solution by using any other strategy.
This work has been partially supported by the ‘Progetto Finalizzato Sistemi Informatici e Calcolo Parallelo’ of the CNR and MURST 40%, Italy under grant n. 89.00026.69.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
A. Bossi, N. Cocco, and S. Etalle. Transforming normal programs by replacement. In A. Pettorossi, editor, Proceedings of the Third International Workshop on Meiaprogramming in Logic (Meta ′92), Uppsala (Sweden), pages 204–220. Uppsala University, June 1992.
M. Bruynooghe, D. D. Schreye, and B. Krekels. Compiling control. Journal of Logic Programming, 6: 135–162, 1989.
A. Bundy. The Computer Modelling of Mathematical Reasoning. Academic Press, 1983.
R. M. Burst all and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24 (1): 44–67, January 1977.
M. S. Feather. A system for assisting program transformation. TOPLAS, 4 (1): 1–20, January 1982.
P. A. Gardner and J. C. Shepherdson. Unfold/fold transformations of logic programs. In J.-L. Lassez and G. Plotkin, editors, Computational Logic, Essays in Honor of Alan Robinson, pages 565-583. MIT Press, 1990.
H. J. Komorowski. Partial evaluation as a means for inferencing data structures in an applicative language: A theory and implementation in the case of Prolog. In Proceedings of the Ninth ACM Symposium on Principles of Programming Languages, Albuquerque, New Mexico (USA), pages 255 - 267, 1982.
J. W. Lloyd. Foundations of Logic Programming. Springer-Verlag, Berlin, Second Edition, 1987.
J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. Journal of Logic Programming, 11: 217 - 242, 1991.
D. Miller and G. Nadathur. A logic programming approach to manipulating formulas and programs. In Proceedings of the 1987 IEEE Symposium on Logic Programming, San Francisco, CA (USA), pages 379-388. IEEE Press, 1987.
N. J. Nilsson. Principles of Artificial Intelligence. Springer-Verlag, 1982.
M. Proietti and A. Pettorossi. Semantics preserving transformation rules for Prolog. In Proceedings of the ACM Symposium on Partial Evaluation and Semantics Based Program Manipulation, PEPM '91, New Haven, CT (U.S.A.), pages 274-284. SIGPLAN NOTICES, 26, 9 ( 1991 ), 1991.
M. Proietti and A. Pettorossi. Unfolding-definition-folding, in this order, for avoiding unnecessary variables in logic programs. In N. Jones, editor, LNCS n. 528, Proceedings PLILP 91, Passau (Germany), pages 347-358. Springer-Verlag, 1991.
T. Sato. An equivalence preserving first order unfold/fold transformation system. In LNCS n. ^63, Proceedings ALP 90, Nancy (France), pages 175-188. Springer-Verlag, 1990.
H. Seki. Unfold/fold transformation of stratified programs. Theoretical Computer Science, 86: 107 - 139, 1991.
H. Tamaki and T. Sato. Unfold/fold transformation of logic programs. In S.-A. Tarlund, editor, Proceedings of the Second International Conference on Logic Programming, Uppsala (Sweden), pages 243-251. Uppsala University, 1984.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1993 Springer-Verlag London
About this chapter
Cite this chapter
Proietti, M., Pettorossi, A. (1993). Best-first Strategies for Incremental Transformations of Logic Programs. In: Lau, KK., Clement, T.P. (eds) Logic Program Synthesis and Transformation. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3560-9_7
Download citation
DOI: https://doi.org/10.1007/978-1-4471-3560-9_7
Publisher Name: Springer, London
Print ISBN: 978-3-540-19806-2
Online ISBN: 978-1-4471-3560-9
eBook Packages: Springer Book Archive