Skip to main content Accessibility help
×
Home

Efficient local unfolding with ancestor stacks*

  • GERMÁN PUEBLA (a1), ELVIRA ALBERT (a2) and MANUEL HERMENEGILDO (a3) (a4)

Abstract

The most successful unfolding rules used nowadays in the partial evaluation of logic programs are based on well quasi orders (wqo) applied over (covering) ancestors, i.e., a subsequence of the atoms selected during a derivation. Ancestor (sub)sequences are used to increase the specialization power of unfolding while still guaranteeing termination and also to reduce the number of atoms for which the wqo has to be checked. Unfortunately, maintaining the structure of the ancestor relation during unfolding introduces significant overhead. We propose an efficient, practical local unfolding rule based on the notion of covering ancestors which can be used in combination with a wqo and allows a stack-based implementation without losing any opportunities for specialization. Using our technique, certain nonleftmost unfoldings are allowed as long as local unfolding is performed, i.e., we cover depth-first strategies. To deal with practical programs, we propose assertion-based techniques which allow our approach to treat programs that include (Prolog) built-ins and external predicates in a very extensible manner, for the case of leftmost unfolding. Finally, we report on our implementation of these techniques embedded in a practical partial evaluator, which shows that our techniques, in addition to dealing with practical programs, are also significantly more efficient in time and somewhat more efficient in memory than traditional tree-based implementations.

Copyright

References

Hide All
Aho, A. V., Sethi, R. and Ullman, J. D. 1986. Compilers – Principles, Techniques and Tools. Addison-Wesley.
Albert, E., Hanus, M. and Vidal, G. 2002. A practical partial evaluation scheme for multi-paradigm declarative languages. Journal of Functional and Logic Programming 2002, 134.
Albert, E., Puebla, G. and Gallagher, J. 2006. Non-leftmost unfolding in partial evaluation of logic programs with impure predicates. In Fiftheenth International Symposium on Logic-based Program Synthesis and Transformation (LOPSTR'05). Hill, Patricia M., Ed. Lecture Notes in Computer Science, vol. 3901. Springer-Verlag, 115132.
Bruynooghe, M. 1991. A practical framework for the abstract interpretation of logic programs. Journal of Logic Programming 10, 91124.
Bruynooghe, M., Schreye, D. D. and Martens, B. 1992. A general criterion for avoiding infinite unfolding during partial deduction. New Generation Computing 1, 11, 4779.
Bueno, F., Cabeza, D., Carro, M., Hermenegildo, M., López-García, P. and Puebla, G. (Eds.) 2004. The Ciao System. Reference Manual. Vol. 1.10. Technical report, School of Computer Science (UPM). URL: http://www.ciaohome.org.
Bueno, F., Cabeza, D., Carro, M., Hermenegildo, M., López-García, P. and Puebla, G. (Eds.) 2009. The Ciao System. Reference Manual. Vol. 1.13. Technical report URL: http://www.ciaohome.org.
Christensen, N. H. and Glück, R. 2004. Offline partial evaluation can be as accurate as online partial evaluation. ACM Transactions on Programming Languages and Systems 26, 1, 191220.
Craig, S.-J., Gallagher, J. P., Leuschel, M. and Henriksen, K. S. 2005. Fully automatic binding-time analysis for prolog. In LOPSTR. Lecture Notes in Computer Science, vol. 3573. Springer, 5368.
De Schreye, D., Glück, R., Jørgensen, J., Leuschel, M., Martens, B. and Sørensen, M. H. 1999. Conjunctive partial deduction: Foundations, control, algorithms and experiments. Journal of Logic Programming 41, 2 & 3 (November), 231277.
Etalle, S., Gabbrielli, M. and Marchiori, E. 1997. A transformation system for CLP with dynamic scheduling and CCP. In Proc. of the ACM Sigplan PEPM'97. ACM Press, New York, 137150.
Gallagher, J. 1993. Tutorial on specialisation of logic programs. In Proc. of PEPM'93, the ACM Sigplan Symposium on Partial Evaluation and Semantics-Based Program Manipulation. ACM Press, 8898.
Hermenegildo, M., Puebla, G., Bueno, F. and López-García, P. 2005. Integrated program debugging, verification, and optimization using abstract interpretation (and the ciao system preprocessor). Science of Computer Programming 58, 1–2 (October), 115140.
Jones, N., Gomard, C. and Sestoft, P. 1993. Partial Evaluation and Automatic Program Generation. Prentice Hall, New York.
Kruskal, J. 1960. Well-quasi-ordering, the tree theorem, and vazsonyi's conjecture. Transactions of the American Mathematical Society 95, 210225.
Le Charlier, B., Rossi, S. and Van Hentenryck, P. 2002. Sequence based abstract interpretation of prolog. Theory and Practice of Logic Programming 2, 1, 2584.
Leuschel, M. 1994. Partial evaluation of the “real thing”. In Proc. of LOPSTR'94 and META'94. Fribourg, Laurent and Turini, Franco, Eds. Lecture Notes in Computer Science, vol. 883. Springer-Verlag, 122137.
Leuschel, M. 1996–2002a. The ecce partial deduction system and the dppd library of benchmarks. Obtainable via URL: http://www.ecs.soton.ac.uk/~mal.
Leuschel, M. 1998. On the power of homeomorphic embedding for online termination. In Proceedings of SAS'98, Levi, G., Ed. Lecture Notes in Computer Science, vol. 1503. Springer-Verlag, Pisa, Italy, 230245.
Leuschel, M. 2002b. Homeomorphic embedding for online termination of symbolic methods. In The Essence of Computation – Essays Dedicated to Neil Jones, Mogensen, T. Æ., Schmidt, D. and Sudborough, I. H., Eds. Lecture Notes in Computer Science, vol. 2566. Springer-Verlag, 379403.
Leuschel, M. and Bruynooghe, M. 2002. Logic program specialisation through partial deduction: Control issues. Theory and Practice of Logic Programming 2, 4 & 5 (July & September), 461515.
Leuschel, M., Craig, S., Bruynooghe, M. and Vanhoof, W. 2004. Specialising interpreters using offline partial deduction. In Program Development in Computational Logic. Bruynooghe, Maurice and Lau, Kung-Kiu, Eds. Lecture Notes in Computer Science, vol. 3049. Springer, 340375.
Leuschel, M., Jørgensen, J., Vanhoof, W. and Bruynooghe, M. 2004. Offline specialisation in prolog using a hand-written compiler generator. TPLP 4, 1–2, 139191.
Lloyd, J. 1987. Foundations of Logic Programming. Springer, 2nd, extended ed.
Lloyd, J. W. and Shepherdson, J. C. 1991. Partial evaluation in logic programming. The Journal of Logic Programming 11, 217242.
Martens, B. and De Schreye, D. 1996. Automatic finite unfolding using well-founded measures. The Journal of Logic Programming 28, 2 (August), 89146.
Puebla, G., Bueno, F. and Hermenegildo, M. 2000. An assertion language for constraint logic programs. In Analysis and Visualization Tools for Constraint Programming. Deransart, Pierre, Hermenegildo, Manuel V. and Maluszynski, Jan, Eds. Lecture Notes in Computer Science, vol. 1870. Springer, 2361.
Sahlin, D. 1993. Mixtus: An automatic partial evaluator for full prolog. New Generation Computing 12, 1, 751.
Sørensen, M. and Glück, R. 1995. An algorithm of generalization in positive supercompilation. In Proc. of ILPS'95. The MIT Press, 465479.
Venken, R. and Demoen, B. 1988. A partial evaluation system for prolog: Some practical considerations. New Generation Computing 6, 279290.

Keywords

Related content

Powered by UNSILO

Efficient local unfolding with ancestor stacks*

  • GERMÁN PUEBLA (a1), ELVIRA ALBERT (a2) and MANUEL HERMENEGILDO (a3) (a4)

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed.