A theory of logic program specialization and generalization for dealing with input data properties

  • Alberto Pettorossi
  • Maurizio Proietti
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1110)


We address the problem of specializing logic programs w.r.t. the contexts where they are used. We assume that these contexts are specified by means of computable properties of the input data. We describe a general method by which, given a program P, we can derive a specialized program P1 such that P and P1 are equivalent w.r.t. every input data satisfying a given property. Our method extends the techniques for partial evaluation of logic programs based on Lloyd and Shepherdson's approach, where a context can only be specified by means of a finite set of bindings for the variables of the input goal. In contrast to most program specialization techniques based on partial evaluation, our method may achieve superlinear speedups, and it does so by using a novel generalization technique.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    A. Bossi, N. Cocco, and S. Dulli. A method for specializing logic programs. ACM Transactions on Programming Languages and Systems, 12(2):253–302, April 1990.Google Scholar
  2. 2.
    R. M. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24(1):44–67, January 1977.Google Scholar
  3. 3.
    C. Consel and S.C. Khoo. Parameterized partial evaluation. ACM Transactions on Programming Languages and Systems, 15(3):463–493, 1993.Google Scholar
  4. 4.
    D. A. de Waal and J. P. Gallagher. Specialization of a unification algorithm. In T. Clement and K.-K. Lau, editors, Logic Program Synthesis and Transformation, Proceedings LOPSTR '91, Manchester, U.K., Workshops in Computing, pages 205–221. Springer-Verlag, 1992.Google Scholar
  5. 5.
    Y. Futamura and K. Nogi. Generalized partial computation. In D. Bjørner, A. P. Ershov, and N. D. Jones, editors, Partial Evaluation and Mixed Computation, pages 133–151. North-Holland, 1988.Google Scholar
  6. 6.
    J. P. Gallagher and D.A. de Waal. Deletion of redundant unary type predicates from logic programs. In Proceedings of LoPSTr'92, Manchester, U.K., pages 151–167. Springer-Verlag, 1993.Google Scholar
  7. 7.
    N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993.Google Scholar
  8. 8.
    M. Leuschel and B. Martens. Partial deduction of the ground representation and its application to integrity checking. In J. W. Lloyd, editor, Proceedings of the 1995 International Logic Programming Symposium (ILPS'95), pages 495–509. MIT Press, 1995.Google Scholar
  9. 9.
    J. W. Lloyd. Foundations of Logic Programming. Springer-Verlag, Berlin, 1987. Second Edition.Google Scholar
  10. 10.
    J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. Journal of Logic Programming, 11:217–242, 1991.Google Scholar
  11. 11.
    U. W. Neumerkel. Specialization of Prolog Programs with Partially Static Goals and Binarization. PhD thesis, Technical University Wien, Austria, 1992.Google Scholar
  12. 12.
    R. Paige and S. Koenig. Finite differencing of computable expressions. ACM Transactions on Programming Languages and Systems, 4(3):402–454, 1982.Google Scholar
  13. 13.
    A. Pettorossi and M. Proietti. Transformation of logic programs: Foundations and techniques. Journal of Logic Programming, 19, 20:261–320, 1994.Google Scholar
  14. 14.
    W. L. Scherlis. Program improvement by internal specialization. In Proc. 8th ACM Symposium on Principles of Programming Languages, Williamsburgh, Va, pages 41–49. ACM Press, 1981.Google Scholar
  15. 15.
    H. Tamaki and T. Sato. A generalized correctness proof of the unfold/fold logic program transformation. Technical Report 86-4, Ibaraki University, Japan, 1986.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Alberto Pettorossi
    • 1
  • Maurizio Proietti
    • 2
  1. 1.Department of Informatics, Systems, and ProductionUniversity of RomaRomaItaly
  2. 2.IASI-CNRRomaItaly

Personalised recommendations