Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Free access

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

Published: 01 May 1996 Publication History

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]
A.V. Aho, R. Sethi, and J.D. Ullman. Compilers -- Principles, Techniques, and Tools. Addison Wes{ey, 1988.
[2]
H. Ai't-Kaci. Warren's Abstract Machine: A Tutorial Reconstruction. MIT Press, Cambridge, Mass., 1991.
[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.
[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.
[5]
M. Bruynooghe. A practical framework for the abstract interpretation of logic programs. Journal of Logic Programming, 10:91-124, 1991.
[6]
R.E. Bryant. Symbolic boolean manipulation with ordered binary-decision diagrams. A CM Computing Surveys, 24(3):293-318, 1992.
[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.
[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.
[9]
P. Codognet and G. Fil~. Computations, abstractions and constraints. In International Conference on Computer Languages, pages 155-164. IEEE Press, 1992.
[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.
[11]
P. Cousot and R. Cousot. Abstract interpretation and application to logic programs. Journal of Logic Programming, 13:103-179, 1992.
[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.
[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.
[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.
[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.
[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.
[17]
N. Heintze. Set Based Program Analysis. PhD thesis, Carnegie Mellon University, 1992.
[18]
J. Hindley. The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society, 146:29-60, 1969.
[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.
[20]
N.D. Jones. Automatic program specialization: A reexamination from basic principles. In Partial Evaluation and Mixed Computation, pages 225-282. North- Holland, 1988.
[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.
[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.
[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.
[24]
R. Milner. A theory of type polymorphism in programming. Journal of Computer System Sciences, 17:348- 375, 1978.
[25]
K. Muthukumar and M. Hermenegildo. Compile-time derivation of variable dependency using abstract interpretation. Journal of Logic Programming, 13:315-347, 1992.
[26]
A. Mycroft. Abstract Interpretation and Optimizing Transformations for Applicative Programs. PhD thesis, University of Edinburgh, 1981.
[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.
[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.
[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.
[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.
[31]
T. Reps. Demand interprocedural program analysis using logic databases. In R. Ramakrishnan, editor, Applications of Logic Databases. Kluwer Academic, 1994.
[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.
[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.
[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.
[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.
[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.
[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.
[38]
H. Tamaki and T. Sato. OLDT resolution with tabulation, in International Conference on Logic Programming, pages 84-98. MiT Press, 1986.
[39]
J.D. Unman. Principles of Database and Knowledgebase Systems, Volume II. Computer Science Press, 1989.
[40]
P. Van Hentenryck, A. Cortesi, and B. Le Charlier. Evaluation of the domain Prop. Journal of Logic Programming, 23(3):237-278, 1995.
[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.

Cited By

View all
  • (2023)Applying declarative analysis to industrial automotive software product line modelsEmpirical Software Engineering10.1007/s10664-023-10290-228:2Online publication date: 4-Feb-2023
  • (2023)Declarative static analysis for multilingual programs using CodeQLSoftware: Practice and Experience10.1002/spe.319953:7(1472-1495)Online publication date: 9-Mar-2023
  • (2018)Datalog-based scalable semantic diffing of concurrent programsProceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering10.1145/3238147.3238211(656-666)Online publication date: 3-Sep-2018
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
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: 01 May 1996
Published in SIGPLAN Volume 31, Issue 5

Check for updates

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)133
  • Downloads (Last 6 weeks)15
Reflects downloads up to 07 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Applying declarative analysis to industrial automotive software product line modelsEmpirical Software Engineering10.1007/s10664-023-10290-228:2Online publication date: 4-Feb-2023
  • (2023)Declarative static analysis for multilingual programs using CodeQLSoftware: Practice and Experience10.1002/spe.319953:7(1472-1495)Online publication date: 9-Mar-2023
  • (2018)Datalog-based scalable semantic diffing of concurrent programsProceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering10.1145/3238147.3238211(656-666)Online publication date: 3-Sep-2018
  • (2016)Description and evaluation of a generic design to integrate CLP and tabled executionProceedings of the 18th International Symposium on Principles and Practice of Declarative Programming10.1145/2967973.2968596(10-23)Online publication date: 5-Sep-2016
  • (2016)A Lock-Free Hash Trie Design for Concurrent Tabled Logic ProgramsInternational Journal of Parallel Programming10.1007/s10766-014-0346-144:3(386-406)Online publication date: 1-Jun-2016
  • (2015)Planning as tabled logic programmingTheory and Practice of Logic Programming10.1017/S147106841500021615:4-5(543-558)Online publication date: 3-Sep-2015
  • (2009)Program transformations using temporal logic side conditionsACM Transactions on Programming Languages and Systems10.1145/1516507.151650931:4(1-48)Online publication date: 26-May-2009
  • (2008)Linear tabling strategies and optimizationsTheory and Practice of Logic Programming10.1017/S147106840700316X8:1(81-109)Online publication date: 1-Jan-2008
  • (2007)Interactive, scalable, declarative program analysisProceedings of the 9th ACM SIGPLAN international conference on Principles and practice of declarative programming10.1145/1273920.1273923(13-24)Online publication date: 14-Jul-2007
  • (2006)A local algorithm for incremental evaluation of tabled logic programsProceedings of the 22nd international conference on Logic Programming10.1007/11799573_7(56-71)Online publication date: 17-Aug-2006
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media