Regular approximation of computation paths in logic and functional languages

  • John Gallagher
  • Laura Lafave
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1110)


The aim of this work is to compute descriptions of successful computation paths in logic or functional program executions. Computation paths are represented as terms, built from special constructor symbols, each constructor symbol corresponding to a specific clause or equation in a program. Such terms, called trace-terms, are abstractions of computation trees, which capture information about the control flow of the program. A method of approximating trace-terms is described, based on well-established methods for computing regular approximations of terms. The special function symbols are first introduced into programs as extra arguments in predicates or functions. Then a regular approximation of the program is computed, describing the terms occurring in some set of program executions. The approximation of the extra arguments (the trace-terms) can then be examined to see what computation paths were followed during the computation. This information can then be used to control both off-line or on-line specialisation systems.

A key aspect of the analysis is the use of suitable widening operations during the regular approximation, in order to preserve information on determinacy and branching structure of the computation. This method is applicable to both logic and functional languages, and appears to offer appropriate control information in both formalisms.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [BJ92]
    M. Bruynooghe and G. Janssens. Deriving descriptions of possible values of program variables by means of abstract interpretation. Journal of Logic Programming, 13(2&3):205–258, 1992.Google Scholar
  2. [dWG94]
    D.A. de Waal and J. Gallagher. The applicability of logic program analysis and transformation to theorem proving. In Proceedings of the 12th International Conference on Automated Deduction (CADE-12), Nancy, 1994.Google Scholar
  3. [FSVY91]
    T. Frühwirth, E. Shapiro, M.Y. Vardi, and E. Yardeni. Logic programs as types for logic programs. In Proceedings of the IEEE Symposium on Logic in Computer Science, Amsterdam, July 1991.Google Scholar
  4. [Gal86]
    J. Gallagher. Transforming logic programs by specialising interpreters. In Proceedings of the 7th European Conference on Artificial Intelligence (ECAI-86), Brighton, pages 109–122, 1986.Google Scholar
  5. [GB91]
    J. Gallagher and M. Bruynooghe. The derivation of an algorithm for program specialisation. New Generation Computing, 9(1991):305–333, 1991.Google Scholar
  6. [GdW94]
    J. Gallagher and D.A. de Waal. Fast and precise regular approximation of logic programs. In P. Van Hentenryck, editor, Proceedings of the International Conference on Logic Programming (ICLP'94), Santa Margherita Ligure, Italy, MIT Press, 1994.Google Scholar
  7. [GK93]
    Robert Glück and Andrei V. Klimov. Occam's razor in metacomputation: the notion of a perfect process tree. In G. Filè P.Cousot, M.Falaschi and A. Rauzy, editors, Static Analysis. Proceedings, pages 112–123, Springer-Verlag, 1993.Google Scholar
  8. [GS94]
    Robert Glück and Morten Heine Sørensen. Partial deduction and driving are equivalent. In M. Hermenegildo and J. Penjam, editors, Programming Language Implementation and Logic Programming, pages 165–181, Springer-Verlag, 1994.Google Scholar
  9. [HCCap]
    P. Van Hentenryck, A. Cortesi, and B. Le Charlier. Type analysis of prolog using type graphs. Journal of Logic Programming, (to appear).Google Scholar
  10. [Hei92]
    N. Heintze. Practical aspects of set based analysis. In K. Apt, editor, Proceedings of the Joint International Symposium and Conference on Logic Programming, pages 765–769, MIT Press, 1992.Google Scholar
  11. [JM86]
    N. Jones and A. Mycroft. Dataflow analysis of applicative programs using minimal function graphs. In Proceedings of Principle of Programming Languages (POPL'86), ACM Press, 1986.Google Scholar
  12. [Jon87]
    N. Jones. Flow analysis of lazy higher order functional programs. In S. Abramsky and C. Hankin, editors, Abstract Interpretation of Declarative Languages, Ellis-Horwood, 1987.Google Scholar
  13. [Leu95]
    M. Leuschel. Ecological partial deduction: preserving characteristic trees without constraints. In M. Proietti, editor, Proceedings of the 5th International Workshop on Logic Program Synthesis and Transformation, Springer-Verlag (to appear), 1995.Google Scholar
  14. [Llo95]
    J.W. Lloyd. The Programming Language Escher. Technical Report CSTR-95-013, Dept. of Computer Science, University of Bristol, 1995.Google Scholar
  15. [LM96]
    M. Leuschel and B. Martens. Global control for partial deduction through characteristic atoms and global trees. In O. Danvy, R. Glück, and P. Thiemann, editors, Proc. of the Dagstuhl Seminar on Partial Evaluation, Springer-Verlag, 1996.Google Scholar
  16. [MG95]
    B. Martens and J. Gallagher. Ensuring global termination of partial deduction while allowing flexible polyvariance. In L. Sterling, editor, Proc. International Conference on Logic Progrmaming, (ICLP'95), Tokyo, MIT Press, 1995.Google Scholar
  17. [SG95a]
    H. Saglam and J. Gallagher. Approximating Constraint Logic Programs Using Polymorphic Types and Regular Descriptions. Technical Report CSTR-95-17, University of Bristol, Department of Computer Science, 1995.Google Scholar
  18. [SG95b]
    Morten Heine Sørensen and Robert Glück. An algorithm of generalization in positive supercompilation. In J. W. Lloyd, editor, International Logic Programming Symposium, page to appear, MIT Press, 1995.Google Scholar
  19. [SGJ94]
    Morten Heine Sørensen, Robert Glück, and Neil D. Jones. Towards unifying partial evaluation, deforestation, supercompilation, and GPC. In ESOP, Springer-Verlag, 1994.Google Scholar
  20. [Sha87]
    E.Y. Shapiro. Or-parallel prolog in flat concurrent prolog. In E.Y. Shapiro, editor, Concurrent Prolog: Collected Papers (Volume 2), MIT Press, 1987.Google Scholar
  21. [TS86]
    H. Tamaki and T. Sato. OLDT resolution with tabulation. In E.Y. Shapiro, editor, Proc. 3rd ICLP, London, Springer-Verlag, 1986.Google Scholar
  22. [Tur88]
    V. Turchin. The algorithm of generalization in the supercompiler. In D. Bjørner, A.P. Ershov, and N.D. Jones, editors, Proc. of the IFIP TC2 Workshop, Partial Evaluation and Mixed Computation, pages 531–549, North-Holland, 1988.Google Scholar
  23. [Tur93]
    V. Turchin. Program transformation with metasystem transitions. Journal of Functional Programming, 3(3):283–313, 1993.Google Scholar
  24. [Tur96]
    V. Turchin. Metacomputation: MST plus SCP. In O. Danvy, R. Glück, and P. Thiemann, editors, Proc. of the Dagstuhl Seminar on Partial Evaluation, Springer-Verlag, 1996.Google Scholar
  25. [YS90]
    E. Yardeni and E.Y. Shapiro. A type system for logic programs. Journal of Logic Programming, 10(2):125–154, 1990.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • John Gallagher
    • 1
  • Laura Lafave
    • 1
  1. 1.Department of Computer ScienceUniversity of BristolBristolUK

Personalised recommendations