Abstract
This paper investigates the optimization by fold/unfold of declarative programs that integrate the best features from both functional and logic programming. Transformation sequences are guided by a mixed strategy which, in three low-level transformation phases, successfully combines two well-known heuristics -composition and tupling-, thus avoiding the construction of intermediate data structures and redundant sub-computations. In particular, whereas composition is able to produce a single function definition for some nested (composed) functions, the tupling method merges non-nested functions calls into a new function definition called eureka. We solve the non trivial problem of discovering the set of calls to be tupled in an incremental way, i.e. by chaining different eureka definitions where only non-nested calls sharing common variables are taken into account. Moreover, by appropriately combining both strategies, together with a simplification pre-process based on a kind of normalization, we automatically optimize a wide range of programs (with nested and/or non-nested function calls) at a very low cost.
This work was partially supported by CICYT under grant TIC 2001-2705-C03-03.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Alpuente, M., Falaschi, M., Moreno, G., Vidal, G.: An Automatic Composition Algorithm for Functional Logic Programs. In: Jeffery, K., Hlaváč, V., Wiedermann, J. (eds.) SOFSEM 2000. LNCS, vol. 1963, pp. 289–297. Springer, Heidelberg (2000)
Alpuente, M., Falaschi, M., Moreno, G., Vidal, G.: Rules+Strategies for Transforming Lazy Functional Logic Programs. Theoretical Computer Science 311, 479–525 (2004)
Antoy, S., Echahed, R., Hanus, M.: A Needed Narrowing Strategy. In: Proc. 21st ACM Symp. on POPL, Portland, pp. 268–279. ACM Press, New York (1994)
Bird, R.S.: Tabulation techniques for recursive programs. ACM Computing Surveys 12(4), 403–418 (1980)
Burstall, R.M., Darlington, J.: A Transformation System for Developing Recursive Programs. Journal of the ACM 24(1), 44–67 (1977)
Chin, W.: Towards an Automated Tupling Strategy. In: Proc. of Partial Evaluation and Semantics-Based Program Manipulation 1993, pp. 119–132. ACM Press, New York (1993)
González, S., Moreno, G.: Incremental Tupling with Simplification Pre-Process. Technical Report DIAB-04-05-1, UCLM (2004)
Moreno, G.: Automatic Optimization of Multi-Paradigm Declarative Programs. In: Garijo, F.J., Riquelme, J.-C., Toro, M. (eds.) IBERAMIA 2002. LNCS (LNAI), vol. 2527, pp. 131–140. Springer, Heidelberg (2002)
Pettorossi, A., Proietti, M.: Rules and Strategies for Transforming Functional and Logic Programs. ACM Computing Surveys 28(2), 360–414 (1996)
Tamaki, H., Sato, T.: Unfold/Fold Transformations of Logic Programs. In: Proc. of 2nd Int’l Conf. on Logic Programming, Uppsala, Sweden, pp. 127–139 (1984)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
González, S., Moreno, G. (2004). Improved Tupling for Optimizing Multi-paradigm Declarative Programs. In: Lemaître, C., Reyes, C.A., González, J.A. (eds) Advances in Artificial Intelligence – IBERAMIA 2004. IBERAMIA 2004. Lecture Notes in Computer Science(), vol 3315. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-30498-2_42
Download citation
DOI: https://doi.org/10.1007/978-3-540-30498-2_42
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-23806-5
Online ISBN: 978-3-540-30498-2
eBook Packages: Springer Book Archive