Abstract Interpretation over Non-deterministic Finite Tree Automata for Set-Based Analysis of Logic Programs

  • John P. Gallagher
  • Germán Puebla
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2257)


Set-based program analysis has many potential applications, including compiler optimisations, type-checking, debugging, verification and planning. One method of set-based analysis is to solve a set of set constraints derived directly from the program text. Another approach is based on abstract interpretation (with widening) over an infinite-height domain of regular types. Up till now only deterministic types have been used in abstract interpretations, whereas solving set constraints yields non-deterministic types, which are more precise. It was pointed out by Cousot and Cousot that set constraint analysis of a particular program P could be understood as an abstract interpretation over a finite domain of regular tree grammars, constructed from P. In this paper we define such an abstract interpretation for logic programs, formulated over a domain of non-deterministic finite tree automata, and describe its implementation. Both goal-dependent and goal-independent analysis are considered. Variations on the abstract domains operations are introduced, and we discuss the associated tradeoffs of precision and complexity. The experimental results indicate that this approach is a practical way of achieving the precision of set-constraints in the abstract interpretation framework.


Logic Program Function Symbol Abstract Interpretation Abstract Domain Tree Automaton 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    A. Aiken. Set constraints: Results, applications, and future directions. In A. Borning, editor, Principles and Practice of Constraint Programming (PPCP 1994), volume 874 of Springer-Verlag Lecture Notes in Computer Science, pages 326–335. Springer Verlag, 1994.Google Scholar
  2. 2.
    A. Aiken and E. L. Wimmers. Solving systems of set constraints (extended abstract). In IEEE Symposium on Logic in Computer Science (LICS 1992), pages 329–340, 1992.Google Scholar
  3. 3.
    F. Bourdoncle. Efficient chaotic iteration strategies with widenings. In Formal Methods in Programming and their Applications, volume 735 of Springer-Verlag Lecture Notes in Computer Science, pages 123–141, 1993.CrossRefGoogle Scholar
  4. 4.
    M. Bruynooghe, H. Vandecasteele, D. A. de Waal, and M. Denecker. Detecting unsolvable queries for definite logic programs. Journal of Functional and Logic Programming, Special Issue 2, 1999.Google Scholar
  5. 5.
    F. Bueno, D. Cabeza, M. Carro, M. Hermenegildo, P. López-García, and G. Puebla. The Ciao prolog system. reference manual. Technical Report CLIP3/97. 1, School of Computer Science, Technical University of Madrid (UPM), August 1997. Available from
  6. 6.
    F. Bueno, M. G. de la Banda, and M. Hermenegildo. Effectiveness of Abstract Interpretation in Automatic Parallelization: A Case Study in Logic Programming. ACM Transactions on Programming Languages and Systems, 21(2):189–238, March 1999.CrossRefGoogle Scholar
  7. 7.
    W. Charatonik and A. Podelski. Directional type inference for logic programs. In G. Levi, editor, Proceedings of the International Symposium on Static Analysis (SAS’98), Pisa, September 14-16, 1998, volume 1503 of Springer LNCS, pages 278–294. Springer-Verlag, 1998.Google Scholar
  8. 8.
    W. Charatonik and A. Podelski. Set-based analysis of reactive infinite-state systems. In B. Steffen, editor, Proc. of TACAS’98, Tools and Algorithms for Construction and Analysis of Systems, 4th International Conference, TACAS’ 98, volume 1384 of Springer-Verlag Lecture Notes in Computer Science, 1998.CrossRefGoogle Scholar
  9. 9.
    W. Charatonik, A. Podelski, and J.-M. Talbot. Paths vs. trees in set-based program analysis. In T. Reps, editor, Proceedings of POPL’00: Principles of Programming Languages, pages 330–338. ACM, ACM Press, January 2000.Google Scholar
  10. 10.
    M. Codish. Efficient goal directed bottom-up evaluation of logic programs. Journal of Logic Programming, 38(3):355–370, 1999.zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    M. Codish and B. Demoen. Analysing logic programs using “Prop”-ositional logic programs and a magic wand. In D. Miller, editor, Proceedings of the 1993 International Symposium on Logic Programming, Vancouver. MIT Press, 1993.Google Scholar
  12. 12.
    H. Comon, M. Dauchet, R. Gilleron, F. Jacquemard, D. Lugiez, S. Tison, and M. Tommasi. Tree Automata Techniques and Applications., 1999.
  13. 13.
    P. Cousot and R. Cousot. Formal language, grammar and set-constraint-based program analysis by abstract interpretation. In Proceedings of the Seventh ACM Conference on Functional Programming Languages and Computer Architecture, pages 170–181, La Jolla, California, 25-28 June 1995. ACM Press, New York, NY.Google Scholar
  14. 14.
    D. 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
  15. 15.
    S. Debray and R. Ramakrishnan. Abstract Interpretation of Logic Programs Using Magic Transformations. Journal of Logic Programming, 18:149–176, 1994.zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    T. Frühwirth, E. Shapiro, M. 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
  17. 17.
    J. Gallagher. A bottom-up analysis toolkit. In Proceedings of the Workshop on Analysis of Logic Languages (WAILL); Eilat, Israel; (also Technical Report CSTR-95-016, Department of Computer Science, University of Bristol, July 1995), June 1995.Google Scholar
  18. 18.
    J. Gallagher, D. Boulanger, and H. Sağlam. Practical model-based static analysis for definite logic programs. In J. W. Lloyd, editor, Proc. of International Logic Programming Symposium, pages 351–365, 1995.Google Scholar
  19. 19.
    J. Gallagher and D. 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. MI T Press, 1994.Google Scholar
  20. 20.
    J. P. Gallagher and J. C. Peralta. Using regular approximations for generalisation during partial evaluation. In Proceedings of the 2000 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM’2000), Boston, Mass., (ed. J. Lawall), pages 44–51. ACM Press, January 2000.Google Scholar
  21. 21.
    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
  22. 22.
    N. Heintze and J. Jaffar. A Finite Presentation Theorem for Approximating Logic Programs. In Proceedings of the 17th Annual ACM Symposium on Principles of Programming Languages, San Francisco, pages 197–209. ACM Press, 1990.Google Scholar
  23. 23.
    M. Hermenegildo, G. Puebla, K. Marriott, and P. Stuckey. Incremental Analysis of Constraint Logic Programs. ACM Transactions on Programming Languages and Systems, 22(2):187–223, March 2000.CrossRefGoogle Scholar
  24. 24.
    M. V. Hermenegildo, F. Bueno, G. Puebla, and P. López. Program analysis, debugging, and optimization using the Ciao system preprocessor. In D. De Schreye, editor, Proceedings of ICLP 1999: International Conference on Logic Programming, Las Cruces, New Mexico, USA, pages 52–66. MIT Press, 1999.Google Scholar
  25. 25.
    G. Janssens and M. Bruynooghe. Deriving descriptions of possible values of program variables by means of abstract interpretation. Journal of Logic Programming, 13(2–3):205–258, July 1992.zbMATHCrossRefMathSciNetGoogle Scholar
  26. 26.
    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
  27. 27.
    N. D. Jones and S. S. Muchnick. A flexible approach to interprocedural data flow analysis and programs with recursive data structures. In Conference Record of the Ninth Symposium on Principles of Programming Languages, pages 66–74. ACM Press, 1982.Google Scholar
  28. 28.
    D. Kozen. Set constraints and logic programming. Information and Computation, 143(1):2–25, 1998.CrossRefMathSciNetGoogle Scholar
  29. 29.
    J. Lloyd. Foundations of Logic Programming: 2nd Edition. Springer-Verlag, 1987.Google Scholar
  30. 30.
    P. Mildner. Type Domains for Abstract Interpretation: A Critical Study. PhD thesis, Department of Computer Science, Uppsala University, 1999.Google Scholar
  31. 31.
    K. Muthukumar and M. Hermenegildo. Compile-time Derivation of Variable Dependency Using Abstract Interpretation. Journal of Logic Programming, 13(2 and 3):315–347, July 1992.zbMATHCrossRefGoogle Scholar
  32. 32.
    A. Podelski, W. Charatonik, and M. Müller. Set-based failure analysis for logic programs and concurrent constraint programs. In S. D. Swierstra, editor, Programming Languages and Systems, 8th European Symposium on Programming, ESOP’99, volume 1576 of LNCS, pages 177–192. Springer-Verlag, 1999.CrossRefGoogle Scholar
  33. 33.
    J. C. Reynolds. Automatic construction of data set definitions. In J. Morrell, editor, Information Processing 68, pages 456–461. North-Holland, 1969.Google Scholar
  34. 34.
    P. Van Hentenryck, A. Cortesi, and B. Le Charlier. Type analysis of prolog using type graphs. Journal of Logic Programming, 22(3):179–210, 1994.CrossRefGoogle Scholar
  35. 35.
    P. Van Roy and A. M. Despain. High-performance logic programming with the Aquarius Prolog compiler. IEEE Computer, 25(1):54–68, 1992.Google Scholar
  36. 36.
    J. Wunderwald. Memoing evaluation by source-to-source transformation. In M. Proietti, editor, Logic Program Synthesis and Transformation (LOPSTR’95), volume 1048 of Springer-Verlag Lecture Notes in Computer Science, pages 17–32, 1995.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • John P. Gallagher
    • 1
  • Germán Puebla
    • 2
  1. 1.Dept. of Computer ScienceUniversity of BristolBristolUK
  2. 2.Facultad de InformáticaUniversidad Politécnica de MadridMadrid

Personalised recommendations