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.
- 1 A.V. Aho, R. Sethi, and J.D. Ullman. Compilers -- Principles, Techniques, and Tools. Addison Wes{ey, 1988. Google ScholarDigital Library
- 2 H. Ai't-Kaci. Warren's Abstract Machine: A Tutorial Reconstruction. MIT Press, Cambridge, Mass., 1991. Google ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 5 M. Bruynooghe. A practical framework for the abstract interpretation of logic programs. Journal of Logic Programming, 10:91-124, 1991. Google ScholarDigital Library
- 6 R.E. Bryant. Symbolic boolean manipulation with ordered binary-decision diagrams. A CM Computing Surveys, 24(3):293-318, 1992. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 9 P. Codognet and G. Fil~. Computations, abstractions and constraints. In International Conference on Computer Languages, pages 155-164. IEEE Press, 1992.Google Scholar
- 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 Scholar
- 11 P. Cousot and R. Cousot. Abstract interpretation and application to logic programs. Journal of Logic Programming, 13:103-179, 1992. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- 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 ScholarDigital Library
- 17 N. Heintze. Set Based Program Analysis. PhD thesis, Carnegie Mellon University, 1992. Google ScholarDigital Library
- 18 J. Hindley. The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society, 146:29-60, 1969.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 24 R. Milner. A theory of type polymorphism in programming. Journal of Computer System Sciences, 17:348- 375, 1978.Google ScholarCross Ref
- 25 K. Muthukumar and M. Hermenegildo. Compile-time derivation of variable dependency using abstract interpretation. Journal of Logic Programming, 13:315-347, 1992. Google ScholarDigital Library
- 26 A. Mycroft. Abstract Interpretation and Optimizing Transformations for Applicative Programs. PhD thesis, University of Edinburgh, 1981.Google Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 31 T. Reps. Demand interprocedural program analysis using logic databases. In R. Ramakrishnan, editor, Applications of Logic Databases. Kluwer Academic, 1994.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 38 H. Tamaki and T. Sato. OLDT resolution with tabulation, in International Conference on Logic Programming, pages 84-98. MiT Press, 1986. Google ScholarDigital Library
- 39 J.D. Unman. Principles of Database and Knowledgebase Systems, Volume II. Computer Science Press, 1989.Google Scholar
- 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 ScholarCross Ref
- 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 ScholarDigital Library
Index Terms
- Practical program analysis using general purpose logic programming systems—a case study
Recommendations
Practical program analysis using general purpose logic programming systems—a case study
PLDI '96: Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementationMany 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 ...
Comments