Derivation of Efficient Logic Programs by Specialization and Reduction of Nondeterminism
 Alberto Pettorossi,
 Maurizio Proietti,
 Sophie Renault
 … show all 3 hide
Rent the article at a discount
Rent now* Final gross prices may vary according to local VAT.
Get AccessAbstract
Program specialization is a program transformation methodology which improves program efficiency by exploiting the information about the input data which are available at compile time. We show that current techniques for program specialization based on partial evaluation do not perform well on nondeterministic logic programs. We then consider a set of transformation rules which extend the ones used for partial evaluation, and we propose a strategy for guiding the application of these extended rules so to derive very efficient specialized programs. The efficiency improvements which sometimes are exponential, are due to the reduction of nondeterminism and to the fact that the computations which are performed by the initial programs in different branches of the computation trees, are performed by the specialized programs within single branches. In order to reduce nondeterminism we also make use of mode information for guiding the unfolding process. To exemplify our technique, we show that we can automatically derive very efficient matching programs and parsers for regular languages. The derivations we have performed could not have been done by previously known partial evaluation techniques.
 Apt, K.R. Introduction to logic programming. In Handbook of Theoretical Computer Science, J. van Leeuwen (Ed.), Elsevier, 1990, pp. 493–576.
 Apt, K.R. From Logic Programming to Prolog. Prentice Hall, 1997.
 Bird, R.S., Gibbons, J., and Jones, G. Formal derivation of a pattern matching algorithm. Science of Computer Programming, 12 (1989) 93–104. CrossRef
 Bossi, A., Cocco, N., and Dulli, S. A method for specializing logic programs. ACM Transactions on Programming Languages and Systems, 12(2) (1990) 253–302. CrossRef
 Bossi, A., Cocco, N., and Etalle, S. Transforming leftterminating programs. In Proceedings of the Ninth International Workshop on Logicbased Program Synthesis, LOPSTR’99, A. Bossi (Ed.), Venezia, Italy, September 22–24, 1999, Lecture Notes in Computer Science 1817, Springer, 2000, 156–175.
 Burstall, R.M. and Darlington, J. A transformation system for developing recursive programs. Journal of the ACM, 24(1) (1977) 44–67. CrossRef
 Danvy, O., Glück, R., and Thiemann, P. (Eds). Partial Evaluation. International Seminar, Dagstuhl Castle, Germany, vol. 1110 of Lecture Notes in Computer Science. SpringerVerlag, 1996.
 De Schreye, D., Glück, R., Jørgensen, J., Leuschel, M., Martens, B., and Sørensen, M.H. Conjunctive partial deduction: Foundations, control, algorithms, and experiments. Journal of Logic Programming, 41(2–3) (1999) 231–277. CrossRef
 Debray, S.K. and Warren, D.S. Automatic mode inference for logic programs. Journal of Logic Programming, 5 (1988) 207–229. CrossRef
 Deville, Y. Logic Programming: Systematic Program Development. AddisonWesley, 1990.
 Fujita, H. An algorithm for partial evaluation with constraints. Technical Memorandum TM0367, ICOT, Tokyo, Japan, 1987.
 Futamura, Y., Nogi, K., and Takano, A. Essence of generalized partial computation. Theoretical Computer Science, 90 (1991) 61–79. CrossRef
 Gallagher, J.P. Tutorial on specialisation of logic programs. In Proceedings of ACM SIGPLAN Symposium on Partial Evaluation and Semantics Based Program Manipulation, PEPM ‘93, Copenhagen, Denmark, ACM Press, 1993, pp. 88–98.
 Gergatsoulis, M. and Katzouraki, M. Unfold/fold transformations for definite clause programs. In Proceedings Sixth International Symposium on Programming Language Implementation and Logic Programming (PLILP ‘94), M. Hermenegildo and J. Penjam (Eds.), Lecture Notes in Computer Science 844, SpringerVerlag, 1994, pp. 340–354.
 Glück, R. and Klimov, A.V. Occam’s razor in metacomputation: The notion of a perfect process tree. In 3rd International Workshop on Static Analysis, Padova, Italy, September 1993, P. Cousot, M. Falaschi, G. Filé, and A. Rauzy (Eds.), Lecture Notes in Computer Science 724, SpringerVerlag, 1993, pp. 112–123.
 Glück, R. and Sørensen, M.H. A roadmap to metacomputation by supercompilation. In Partial Evaluation, O. Danvy, R. Glück, and P. Thiemann (Eds.), Lecture Notes in Computer Science 1110, Springer, 1996, pp. 137–160.
 Gordon, M.J., Milner, A.J., and Wadsworth, C.P. Edinburgh LCF. Lecture Notes in Computer Science 78. SpringerVerlag, 1979.
 Henderson, F., Somogyi, Z., and Conway, T. Determinism analysis in the Mercury compiler. In Proceedings of the Australian Computer Science Conference, Melbourne, Australia, 1996, pp. 337–346.
 Hermenegildo, M.V., Bueno, F., Puebla, G., and López, P. Program analysis, debugging, and optimization using the CIAO system preprocessor. In Proceedings of the 1999 International Conference on Logic Programming, D. De Schreye (Ed.), Las Cruces, NM, USA, MIT Press, 1999, pp. 52–66.
 Jaffar, J., Maher, M., Marriott, K., and Stuckey, P. The semantics of constraint logic programming. Journal of Logic Programming, 37 (1998) 1–46. CrossRef
 Jones, N.D., Gomard, C.K., and Sestoft, P. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993.
 Knuth, D.E., Morris, J.H., and Pratt, V.R. Fast pattern matching in strings. SIAM Journal on Computing, 6(2) (1977) 323–350. CrossRef
 Leuschel, M. On the power of homeomorphic embedding for online termination. In Proceedings of the Fifth Static Analysis Symposium, SAS ‘98, G. Levi (Ed.) Pisa, Italy, Lecture Notes in Computer Science 1503, SpringerVerlag, 1998, pp. 230–245.
 Leuschel, M. The ECCE partial deduction system and the DPPD library of benchmarks, Release 3, Nov. 2000. Accessible via http://www.ecs.soton.ac.uk/mal.
 Leuschel, M., Martens, B., and De Schreye, D. Controlling generalization and polyvariance in partial deduction of normal logic programs. ACM Transactions on Programming Languages and Systems, 20(1) (1998) 208–258. CrossRef
 Leuschel, M., Martens, B., and de Schreye, D. Some achievements and prospects in partial deduction. ACM Computing Surveys, 30 (Electronic Section) (3es) (1998) 4.
 Liu, Y.A. Efficiency by incrementalization: An introduction. HigherOrder and Symbolic Computation, 13(4) (2000) 289–313. CrossRef
 Lloyd, J.W. Foundations of Logic Programming, 2nd edition. SpringerVerlag, Berlin, 1987.
 Lloyd, J.W. and Shepherdson, J.C. Partial evaluation in logic programming. Journal of Logic Programming, 11 (1991) 217–242. CrossRef
 Martens, B., De Schreye, D., and HorvÁth, T. Sound and complete partial deduction with unfolding based on wellfounded measures. Theoretical Computer Science, 122 (1994) 97–117. CrossRef
 Mellish, C.S. Some global optimizations for a Prolog compiler. Journal of Logic Programming, 2(1) (1985) 43–66. CrossRef
 Mellish, C.S. Abstract interpretation of Prolog programs. In Abstract Interpretation of Declaratice Languages, In S. Abramsky and C. Hankin (Eds.), Chapter 8, Ellis Horwood, 1987, pp. 181–198.
 Paige, R. and Koenig, S. Finite differencing of computable expressions. ACM Transactions on Programming Languages and Systems, 4(3) (1982) 402–454. CrossRef
 Pettorossi, A. Transformation of programs and use of tupling strategy. In Proceedings Informatica 77, Bled, Yugoslavia, 1977, pp. 1–6.
 Pettorossi, A., Proietti, M., and Renault, S. Reducing nondeterminism while specializing logic programs. In Proc. 24th ACM Symposium on Principles of Programming Languages, Paris, France, ACM Press, 1997, pp. 414–427.
 Prestwich, S. Online partial deduction of large programs. In ACM Sigplan Symposium on Partial Evaluation and SemanticsBased Program Manipulation, PEPM ‘93, Copenhagen, Denmark, ACM Press, 1993, pp. 111–118.
 Proietti, M. and Pettorossi, A. The loop absorption and the generalization strategies for the development of logic programs and partial deduction. Journal of Logic Programming, 16(1–2) (1993) 123–161. CrossRef
 Proietti, M. and Pettorossi, A. Unfoldingdefinitionfolding, in this order, for avoiding unnecessary variables in logic programs. Theoretical Computer Science, 142(1) (1995) 89–124. CrossRef
 Renault, S. A system for transforming logic programs. R 97–04, Department of Computer Science, University of Rome Tor Vergata, Rome, Italy, 1997.
 Roychoudhury, A., Narayan Kumar, K., Ramakrishnan, C.R., and Ramakrishnan, I.V. A parameterized unfold/fold transformation framework for definite logic programs. In Proceedings of Principles and Practice of Declarative Programming (PPDP), Lecture Notes in Computer Science 1702, pp. 396–413. SpringerVerlag, 1999.
 Sahlin, D. Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing, 12 (1993) 7–51.
 Sato, T. An equivalence preserving first order unfold/fold transformation system. Theoretical Computer Science, 105 (1992) 57–84. CrossRef
 Sawamura, H. and Takeshima, T. Recursive unsolvability of determinacy, solvable cases of determinacy and their application to Prolog optimization. In Proceedings of the International Symposium on Logic Programming, Boston, IEEE Computer Society Press, 1985, pp. 200–207.
 Smith, D.A. Partial evaluation of pattern matching in constraint logic programming languages. In Proceedings ACM Symposium on Partial Evaluation and Semantics Based Program Manipulation, PEPM ‘91, New Haven, CT, USA, SIGPLAN Notices, 26(9), ACM Press, 1991, pp. 62–71.
 Somogyi, Z., Henderson, F., and Conway, T. The execution algorithm of Mercury: an efficient purely declarative logic programming language. Journal of Logic Programming, 29(1–3) (1996) 17–64. CrossRef
 Tamaki, H. and Sato, T. Unfold/fold transformation of logic programs. In Proceedings of the Second International Conference on Logic Programming, S.Å. Tärnlund (Ed.), Uppsala, Sweden, Uppsala University, 1984, pp. 127–138.
 Turchin, V.F. The concept of a supercompiler. ACM TOPLAS, 8(3) (1986) 292–325. CrossRef
 Wadler, P.L. Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science, 73 (1990) 231–248. CrossRef
 Warren, D.H.D. Implementing Prolog — Compiling predicate logic programs. Research Report 39 & 40, Department of Artificial Intelligence, University of Edinburgh, 1977.
 Title
 Derivation of Efficient Logic Programs by Specialization and Reduction of Nondeterminism
 Journal

HigherOrder and Symbolic Computation
Volume 18, Issue 12 , pp 121210
 Cover Date
 20050601
 DOI
 10.1007/s1099000570083
 Print ISSN
 13883690
 Online ISSN
 15730557
 Publisher
 Kluwer Academic Publishers
 Additional Links
 Topics
 Keywords

 automatic program derivation
 program transformation
 program specialization
 logic programming
 transformation rules and strategies
 Industry Sectors
 Authors

 Alberto Pettorossi ^{(1)}
 Maurizio Proietti ^{(2)}
 Sophie Renault ^{(3)}
 Author Affiliations

 1. DISP, University of Roma Tor Vergata, Via del Politecnico 1, I00133, Roma, Italy
 2. IASICNR, Viale Manzoni 30, I00185, Roma, Italy
 3. European Patent Office, Patentlaan 2, P.O. Box 5818, NL, 2280 HV, Rijswijk, The Netherlands