Skip to main content

Meta-circular Abstract Interpretation in Prolog

  • Chapter
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2566))

Abstract

We give an introduction to the meta-circular approach to the abstract interpretation of logic programs. This approach is particularly useful for prototyping and for introductory classes on abstract interpretation. Using interpreters, students can immediately write, adapt, and experiment with interpreters and working dataflow analysers. We use a simple meta-circular interpreter, based on a “non-ground T P” semantics, as a generic analysis engine. Instantiating the engine is a matter of providing an appropriate domain of approximations, together with definitions of “abstract” unification and disjunction. Small changes of the interpreter let us vary both what can be “observed” by an analyser, and how fixed point computation is done. Amongst the dataflow analyses used to exemplify this approach are a parity analysis, groundness dependency analysis, call patterns, depth-k analysis, and a “pattern” analysis to establish most specific generalisations of calls and success sets.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. S. Abramsky and C. Hankin. Abstract Interpretation of Declarative Languages. Ellis Horwood, 1987.

    Google Scholar 

  2. F. Baader and J. Siekmann. Unification theory. In D. Gabbay, C. Hogger, and J. Robinson, editors, Handbook of Logic in Artificial Intelligence and Logic Programming, volume 2, pages 41–126. Oxford University Press, 1994.

    Google Scholar 

  3. R. Bagnara. China: A data-flow analyzer for CLP languages. Survey at URL http://www.cs.unipr.it/China/, 19 February 2001.

  4. F. Bancilhon, D. Maier, Y. Sagiv, and J. Ullman. Magic sets and other strange ways to implement logic programs. In Proc. Fifth ACM SIGMOD/SIGACT Symp. Principles of Database Systems, pages 1–15. ACMPress, 1986.

    Google Scholar 

  5. R. Barbuti, R. Giacobazzi, and G. Levi. A general framework for semantics-based abstract interpretation. ACM Transactions on Programming Languages, 15(1):133–181, 1993.

    Article  Google Scholar 

  6. A. Bossi, M. Gabbrielli, G. Levi, and M. Martelli. The s-semantics approach: Theory and applications. Journal of Logic Programming, 19&20:149–197, 1994.

    Article  MathSciNet  Google Scholar 

  7. D. Boulanger, M. Bruynooghe, and M. Denecker. Abstracting s-semantics using a model-theoretic approach. In M. Hermenegildo and J. Penjam, editors, Programming Language Implementation and Logic Programming: Proc. Sixth Int. Symp., volume 844 of Lecture Notes in Computer Science, pages 432–446. Springer-Verlag, 1994.

    Google Scholar 

  8. M. Bruynooghe. A practical framework for the abstract interpretation of logic programs. Journal of Logic Programming, 10(2):91–124, 1991.

    Article  MathSciNet  MATH  Google Scholar 

  9. M. Bruynooghe, B. Demoen, D. Boulanger, M. Denecker, and A. Mulkers. A freeness and sharing analysis of logic programs based on a pre-interpretation. In R. Cousot and D. A. Schmidt, editors, Static Analysis: Proc. Third Int. Symp., volume 1145 of Lecture Notes in Computer Science, pages 128–142. Springer-Verlag, 1996.

    Google Scholar 

  10. M. Bruynooghe, G. Janssens, A. Callebaut, and B. Demoen. Abstract interpretation: Towards the global optimisation of Prolog programs. In Proc. 1987 Symp. Logic Programming, pages 192–204. IEEE Comp. Soc., 1987.

    Google Scholar 

  11. M. Codish. Efficient goal directed bottom-up evaluation of logic programs. Journal of Logic Programming, 38(3):355–370, 1999.

    Article  MATH  MathSciNet  Google Scholar 

  12. M. Codish, D. Dams, and E. Yardeni. Bottom-up abstract interpretation of logic programs. Theoretical Computer Science, 124(1):93–125, 1994.

    Article  MATH  MathSciNet  Google Scholar 

  13. M. Codish and B. Demoen. Deriving polymorphic type dependencies for logic programs using multiple incarnations of Prop. In P. Van Hentenryck, editor, Static Analysis: Proc. First Int. Symp., volume 864 of Lecture Notes in Computer Science, pages 281–296. Springer-Verlag, 1994.

    Google Scholar 

  14. M. Codish and B. Demoen. Analysing logic programs using “Prop”-ositional logic programs and a magic wand. Journal of Logic Programming, 25(3):249–274, 1995.

    Article  MATH  MathSciNet  Google Scholar 

  15. M. Codish, B. Demoen, and K. Sagonas. Semantics-based program analysis for logic-based languages using XSB. Springer Int. Journal of Software Tools for Technology Transfer, 2(1):29–45, 1998.

    Article  MATH  Google Scholar 

  16. M. Codish and V. Lagoon. Type dependencies for logic programs using ACI unification. Theoretical Computer Science, 238:131–159, 2000.

    Article  MATH  MathSciNet  Google Scholar 

  17. M. Codish, V. Lagoon, and F. Bueno. An algebraic approach to sharing analysis of logic programs. Journal of Logic Programming, 41(2):110–149, 2000.

    MathSciNet  Google Scholar 

  18. M. Codish, K. Marriott, and C. Taboch. Improving program analyses by structure untupling. Journal of Logic Programming, 43(3):251–263, 2000.

    Article  MATH  MathSciNet  Google Scholar 

  19. M. Codish and H. Søndergaard. Meta-circular abstract interpretation in Prolog. http://www.cs.bgu.ac.il/~mcodish/Tutorial/, 11 June 2001.

  20. M. Codish, H. Søndergaard, and P. J. Stuckey. Sharing and groundness dependencies in logic programs. ACM Transactions on Programming Languages and Systems, 21(5):948–976, 1999.

    Article  Google Scholar 

  21. M.-M. Corsini, K. Musumbu, A. Rauzy, and B. Le Charlier. Efficient bottomup abstract interpretation of Prolog by means of constraint solving over symbolic finite domains. In M. Bruynooghe and J. Penjam, editors, Programming Language Implementation and Logic Programming, volume 714 of Lecture Notes in Computer Science, pages 75–91. Springer-Verlag, 1993.

    Google Scholar 

  22. P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proc. Fourth ACM Symp. Principles of Programming Languages, pages 238–252. ACM Press, 1977.

    Google Scholar 

  23. P. Cousot and R. Cousot. Systematic design of program analysis frameworks. In Proc. Sixth ACM Symp. Principles of Programming Languages, pages 269–282. ACM Press, 1979.

    Google Scholar 

  24. S. Dawson, R. Ramakrishnan, and D. S. Warren. Practical program analysis using general purpose logic programming systems: A case study. In Proc. ACM SIGPLAN 96 Conf. Programming Language Design and Implementation, pages 117–126. ACM Press, 1996.

    Google Scholar 

  25. S. K. Debray and D. S. Warren. Automatic mode inference for Prolog programs. In Proc. 1986 Symp. Logic Programming, pages 78–88. IEEE Comp. Soc., 1986.

    Google Scholar 

  26. M. Falaschi, G. Levi, M. Gabbrielli, and C. Palamidessi. A new declarative semantics for logic languages. In R. Kowalski and K. Bowen, editors, Logic Programming: Proc. Fifth Int. Conf. Symp., pages 993–1005. MIT Press, 1988.

    Google Scholar 

  27. M. Falaschi, G. Levi, M. Martelli, and C. Palamidessi. Declarative modeling of the operational behavior of logic languages. Theoretical Computer Science, 69(3):289–318, 1989.

    Article  MATH  MathSciNet  Google Scholar 

  28. M. Falaschi, G. Levi, M. Martelli, and C. Palamidessi. A model-theoretic reconstruction of the operational semantics of logic programs. Information and Computation, 103:86–113, 1993.

    Article  MATH  MathSciNet  Google Scholar 

  29. C. Fecht. Abstrakte Interpretation logischer Programme: Theorie, Implementierung, Generierung. PhD thesis, Universität des Saarlandes, Saarbrücken, Germany, 1997.

    Google Scholar 

  30. J. Gallagher, D. Boulanger, and H. Sağlam. Practical model-based static analysis for definite logic programs. In J. Lloyd, editor, Logic Programming: Proc. 1995 Int. Symp., pages 351–365. MIT Press, 1995.

    Google Scholar 

  31. J. Gallagher and D. de Waal. Deletion of redundant unary type predicates from logic programs. In K.-K. Lau and T. Clement, editors, Logic Program Synthesis and Transformation: Proc. LOPSTR 92, Workshops in Computing, pages 151–167. Springer-Verlag, 1993.

    Google Scholar 

  32. J. Gallagher and D. de Waal. Fast and precise regular approximations of logic programs. In P. Van Hentenryck, editor, Logic Programming: Proc. Eleventh Int. Conf., pages 599–613. MIT Press, 1994.

    Google Scholar 

  33. S. Genaim and M. Codish. The Def-inite approach to dependency analysis. In D. Sands, editor, Proc. Tenth European Symp. Programming, volume 2028 of Lecture Notes in Computer Science, pages 417–431. Springer-Verlag, 2001.

    Google Scholar 

  34. M. Hermenegildo, R. Warren, and S. K. Debray. Global flow analysis as a practical compilation tool. Journal of Logic Programming, 13(4):349–366, 1992.

    Article  Google Scholar 

  35. J. Howe and A. King. Implementing groundness analysis with definite Boolean functions. In G. Smolka, editor, Programming Languages and Systems, volume 1782 of Lecture Notes in Computer Science, pages 200–214. Springer-Verlag, 2000.

    Chapter  Google Scholar 

  36. N. D. Jones. Concerning the abstract interpretation of Prolog. Draft paper, DIKU, Copenhagen, 1985. Cited in Mellish [49].

    Google Scholar 

  37. N. D. Jones and A. Mycroft. Dataflow analysis of applicative programs using minimal function graphs. In Proc. Thirteenth ACM Symp. Principles of Programming Languages, pages 296–306. ACMPress, 1986.

    Google Scholar 

  38. N. D. Jones and H. Søndergaard. A semantics-based framework for the abstract interpretation of Prolog. In S. Abramsky and C. Hankin, editors, Abstract Interpretation of Declarative Languages, chapter 6, pages 123–142. Ellis Horwood, 1987.

    Google Scholar 

  39. A. Kelly, K. Marriott, H. Søndergaard, and P. Stuckey. A practical object-oriented analysis engine for constraint logic programs. Software-Practice and Experience, 28(2):199–224, 1998.

    Article  Google Scholar 

  40. B. Le Charlier and P. Van Hentenryck. Experimental evaluation of a generic abstract interpretation algorithm for Prolog. ACM Transactions on Programming Languages and Systems, 16(1):35–101, 1994.

    Article  Google Scholar 

  41. G. Levi and D. Ramundo. A formalization of metaprogramming for real. In D. S. Warren, editor, Logic Programming: Proc. Tenth Int. Conf., pages 354–373. MIT Press, 1993.

    Google Scholar 

  42. J. W. Lloyd. Foundations of Logic Programming. Springer-Verlag, Berlin, second edition, 1987.

    MATH  Google Scholar 

  43. M. J. Maher and R. Ramakrishnan. Déjà vu in fixpoints of logic programs. In E. Lusk and R. Overbeek, editors, Logic Programming: Proc. North American Conf. 1989, pages 963–980. MIT Press, 1989.

    Google Scholar 

  44. K. Marriott and H. Søndergaard. Bottom-up abstract interpretation of logic programs. In R. A. Kowalski and K. A. Bowen, editors, Logic Programming: Proc. Fifth Int. Conf. Symp., pages 733–748. MIT Press, 1988.

    Google Scholar 

  45. K. Marriott and H. Søndergaard. Semantics-based dataflow analysis of logic programs. In G. X. Ritter, editor, Information Processing 89, pages 601–606. North-Holland, 1989.

    Google Scholar 

  46. K. Marriott and H. Søndergaard. Bottom-up dataflow analysis of normal logic programs. Journal of Logic Programming, 13(2 & 3):181–204, 1992.

    Article  MATH  MathSciNet  Google Scholar 

  47. B. Martens and D. De Schreye. Why untyped nonground metaprogramming is not (much of) a problem. Journal of Logic Programming, 22(1):47–99, 1995.

    Article  MATH  MathSciNet  Google Scholar 

  48. C. S. Mellish. Some global optimizations for a Prolog compiler. Journal of Logic Programming, 2(1):43–66, 1985.

    Article  MATH  Google Scholar 

  49. C. S. Mellish. Abstract interpretation of Prolog programs. In E. Shapiro, editor, Proc. Third Int. Conf. Logic Programming, volume 240 of Lecture Notes in Computer Science, pages 463–474. Springer-Verlag, 1986.

    Google Scholar 

  50. K. Muthukumar and M. Hermenegildo. Compile-time derivation of variable dependency using abstract interpretation. Journal of Logic Programming, 13(2&3):315–347, 1992.

    Article  MATH  Google Scholar 

  51. A. Mycroft. Abstract Interpretation and Optimising Transformations for Applicative Programs. PhD thesis, University of Edinburgh, Scotland, 1981.

    Google Scholar 

  52. R. Ramakrishnan and J. Ullman. A survey of deductive database systems. Journal of Logic Programming, 23(2):125–149, 1995.

    Article  MathSciNet  Google Scholar 

  53. J. Reynolds. Transformational systems and the algebraic structure of atomic formulas. In B. Meltzer and D. Michie, editors, Machine Intelligence, volume 5, pages 135–152. 1970.

    Google Scholar 

  54. K. Sagonas, T. Swift, and D. S. Warren. XSB as an efficient deductive database engine. In Proc. ACM SIGMOD Int. Conf. Management of Data, pages 442–453. ACMPress, 1994.

    Google Scholar 

  55. T. Sato and H. Tamaki. Enumeration of success patterns in logic programs. Theoretical Computer Science, 34:227–240, 1984.

    Article  MATH  MathSciNet  Google Scholar 

  56. H. Søndergaard. An application of abstract interpretation of logic programs: Occur check reduction. In B. Robinet and R. Wilhelm, editors, Proc. ESOP 86, volume 213 of Lecture Notes in Computer Science, pages 327–338. Springer-Verlag, 1986.

    Google Scholar 

  57. L. Sterling and E. Shapiro. The Art of Prolog. MIT Press, second edition, 1994.

    Google Scholar 

  58. J. Ullman. Principles of Database and Knowledge-Base Systems. Computer Science Press, 1988.

    Google Scholar 

  59. M. van Emden and R. Kowalski. The semantics of logic as a programming language. Journal of the ACM, 23:733–742, 1976.

    Article  MATH  Google Scholar 

  60. W. Winsborough. Automatic, Transparent Parallelization of Logic Programs at Compile Time. PhD thesis, University of Wisconsin-Madison, Wisconsin, 1988.

    Google Scholar 

  61. J. Wunderwald. Memoing evaluation by source-to-source transformation. In M. Proietti, editor, Logic Program Synthesis and Transformation, volume 1048 of Lecture Notes in Computer Science, pages 17–32. Springer-Verlag, 1995.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2002 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Codish, M., Søndergaard, H. (2002). Meta-circular Abstract Interpretation in Prolog. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds) The Essence of Computation. Lecture Notes in Computer Science, vol 2566. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-36377-7_6

Download citation

  • DOI: https://doi.org/10.1007/3-540-36377-7_6

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-00326-7

  • Online ISBN: 978-3-540-36377-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics