skip to main content
article
Free Access

Practical program analysis using general purpose logic programming systems—a case study

Authors Info & Claims
Published:01 May 1996Publication History
Skip Abstract Section

Abstract

Many analysis problems can be cast in the form of evaluating minimal models of a logic program. Although such formulations are appealing due to their simplicity and declarativeness, they have not been widely used in practice because, either existing logic programming systems do not guarantee completeness, or those that do have been viewed as too inefficient for integration into a compiler. The objective of this paper is to re-examine this issue in the context of recent advances in implementation technologies of logic programming systems.We find that such declarative formulations can indeed be used in practical systems, when combined with the appropriate tool for evaluation. We use existing formulations of analysis problems --- groundness analysis of logic programs, and strictness analysis of functional programs --- in this case study, and the XSB system, a table-based logic programming system, as the evaluation tool of choice. We give experimental evidence that the resultant groundness and strictness analysis systems are practical in terms of both time and space. In terms of implementation effort, the analyzers took less than 2 man-weeks (in total), to develop, optimize and evaluate. The analyzer itself consists of about 100 lines of tabled Prolog code and the entire system, including the components to read and preprocess input programs and to collect the analysis results, consists of about 500 lines of code.

References

  1. 1 A.V. Aho, R. Sethi, and J.D. Ullman. Compilers -- Principles, Techniques, and Tools. Addison Wes{ey, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2 H. Ai't-Kaci. Warren's Abstract Machine: A Tutorial Reconstruction. MIT Press, Cambridge, Mass., 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 F. Bancilhon, D. Maier, Y. Sagiv, and J. Ullman. Magic Sets and other strange ways to implement logic programs, in A CM Symposium on Principles of Database Systems, pages 1-15. ACM Press, 1986. Google ScholarGoogle Scholar
  4. 4 C. Beeri and R. Ramakrishnan. On the power of magic. In A CM Symposium on Principles of Database Systems, pages 269-283. ACM Press, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 M. Bruynooghe. A practical framework for the abstract interpretation of logic programs. Journal of Logic Programming, 10:91-124, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6 R.E. Bryant. Symbolic boolean manipulation with ordered binary-decision diagrams. A CM Computing Surveys, 24(3):293-318, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7 W. Chen and D.S. Warren. Query evaluation under the well-founded semantics. In A CM Symposium on Principles of Database Systems. ACM Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 M. Codish and B. Demoen. Analysing logic programs using "Prop"-ositional logic programs and a Magic wand. In International Logic Programming Symposium, pages 114-129. MIT Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9 P. Codognet and G. Fil~. Computations, abstractions and constraints. In International Conference on Computer Languages, pages 155-164. IEEE Press, 1992.Google ScholarGoogle Scholar
  10. 10 M-M. Corsini, K. Musumbu, A. Rauzy, and B. Le Charher. Efficient bottom-up abstract interpretation of Prolog by means of constraint solving over symbolic finite domains. In International Symposium on Programming Language Implementation and Logic Programming, number 714 in Lecture Notes in Computer Science, pages 75-91. Springer Verlag, 1993. Google ScholarGoogle Scholar
  11. 11 P. Cousot and R. Cousot. Abstract interpretation and application to logic programs. Journal of Logic Programming, 13:103-179, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 12 P. Cousot and N. Halbwachs. Automatic discovery of linear restraints among variables of a program. In A CM Symposium on Principles of Programming Languages, pages 84-96. ACM Press, 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13 S. Debray. Static inference of modes and data dependencies in logic programs. A CM Transactions on Programming Languages and Systems, 11(3):418-450, July 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 14 S. Debray and D.S. Warren. Automatic mode inference for Prolog programs. In Proceedings of the Third Symposium on Logic Programming, pages 78-88, 1986.Google ScholarGoogle Scholar
  15. 15 J. Freire, T. Swift, and D.S. Warren. Taking I/O seriously: Rssolution rsconsidsred for disk. Technical report, Department of Computer Science, SUNY, Stony Brook, 1996.Google ScholarGoogle Scholar
  16. 16 P.H. Hartel and K.G. Langendoen. Benchmarking implementations of lazy functional languages. In Symposium on Functional Programming Languages and Computer Architecture, pages 341-349. ACM Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 17 N. Heintze. Set Based Program Analysis. PhD thesis, Carnegie Mellon University, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 18 J. Hindley. The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society, 146:29-60, 1969.Google ScholarGoogle Scholar
  19. 19 P. Hudak. A semantic model for reference counting and its abstraction. In S. Abramsky and C. Hankin, editors, Abstract Interpretation of Declarative Languages, pages 45-62. Ellis Horwood, 1987.Google ScholarGoogle Scholar
  20. 20 N.D. Jones. Automatic program specialization: A reexamination from basic principles. In Partial Evaluation and Mixed Computation, pages 225-282. North- Holland, 1988.Google ScholarGoogle Scholar
  21. 21 O. Kaser, C.R. Ramakrishnan, I.V. Ramakrishnan, and R.C. Sekar. EQUALS -- a parallel implementation of a lazy language. Journal of Functional Programming, To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22 B. Le Charller and P. Van Hentenryck. Experimental evaluation of a generic abstract interpretation algorithm for PROLOG. A CM Transactions on Programming Languages and Systems, 16(1):35-101, January 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23 K. Marriot and H. Sondergaard. Notes for a tutorial on abstract interpretation of logic programs (unpublished). In North American Conference on Logic Programming, 1989.Google ScholarGoogle Scholar
  24. 24 R. Milner. A theory of type polymorphism in programming. Journal of Computer System Sciences, 17:348- 375, 1978.Google ScholarGoogle ScholarCross RefCross Ref
  25. 25 K. Muthukumar and M. Hermenegildo. Compile-time derivation of variable dependency using abstract interpretation. Journal of Logic Programming, 13:315-347, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 26 A. Mycroft. Abstract Interpretation and Optimizing Transformations for Applicative Programs. PhD thesis, University of Edinburgh, 1981.Google ScholarGoogle Scholar
  27. 27 C.R. Ramakrishnan, I.V. Ramakrishnan, and R.C. Sekar. A symbolic constraint solving framework for analysis of logic programs. In A CM Symposium on Partial Evaluation and Semantics-based Program Manipulation, pages 12-23. ACM Press, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 28 I.V. Ramakrishnan, P. Rao, K. Sagonas, T. Swift, and D.S. Warren. Efficient tabling mechanisms for logic programs. In International Conference on Logic Programming, pages 697-711. MIT Press, 1995.Google ScholarGoogle Scholar
  29. 29 R. Ramakrishnan, P. Seshadri, D. Srivastava, and S. Sudarshan. The Coral user's manual. Technical report, Computer Sciences Department, Univerity of Wisconsin, Madison, 1993.Google ScholarGoogle Scholar
  30. 30 P. Rao, C.R. Ramakrishnan, and I.V. Ramakrishnan. A thread in time saves tabling time. Technical report, Department of Computer Science, SUNY, Stony Brook, 1996.Google ScholarGoogle Scholar
  31. 31 T. Reps. Demand interprocedural program analysis using logic databases. In R. Ramakrishnan, editor, Applications of Logic Databases. Kluwer Academic, 1994.Google ScholarGoogle Scholar
  32. 32 T. Reps. Shape analysis as a generalized path problem. In A CM Symposium on Partial Evaluation and Semantics-based Program Manipulation, pages 1-11. ACM Press, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. 33 T. Reps, M. Sagiv, and R. Wilhelm. Solving shapeanalysis problems in languages with destructive updating. In A CM Symposzum on Principles of Programming Languages. ACM Press, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 34 R. Rohmer, R. Lescoeur, and J.-M. Kersit. The Alexander method, a technique for the processing of recursive axioms in deductive databases. New Generation Computing, 4(3):273-285, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. 35 K. Sagonas, T. Swift, and D.S. Warren. XSB as an efficient deductive database engine. In ACM SIGMOD Symposium on Management of Data. ACM Press, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. 36 K. Sagonas, T. Swift, and D.S. Warren. The XSB programmer's manual, Version 1.4.2. Technical report, Department of Compufier Science, SUNY, Stony Brook, 1995.Google ScholarGoogle Scholar
  37. 37 R.C. Sekar and I.V. Ramakrishnan. Fast strictness analysis based on demand propagation. A CM Transactions on Programming Languages and Systems, 17(6), November 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. 38 H. Tamaki and T. Sato. OLDT resolution with tabulation, in International Conference on Logic Programming, pages 84-98. MiT Press, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. 39 J.D. Unman. Principles of Database and Knowledgebase Systems, Volume II. Computer Science Press, 1989.Google ScholarGoogle Scholar
  40. 40 P. Van Hentenryck, A. Cortesi, and B. Le Charlier. Evaluation of the domain Prop. Journal of Logic Programming, 23(3):237-278, 1995.Google ScholarGoogle ScholarCross RefCross Ref
  41. 41 P. Van Roy, B. Demoen, and Y. D. Willems. Improving the execution speed of compiled Prolog with modes, clause selection and determinism. In Theory and Practice of Software Development, pages 111-125, March 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Practical program analysis using general purpose logic programming systems—a case study

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 31, Issue 5
          May 1996
          300 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/249069
          Issue’s Table of Contents
          • cover image ACM Conferences
            PLDI '96: Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementation
            May 1996
            300 pages
            ISBN:0897917952
            DOI:10.1145/231379

          Copyright © 1996 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 May 1996

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader