skip to main content
article
Open Access

Global analysis of constraint logic programs

Published:01 September 1996Publication History
Skip Abstract Section

Abstract

This article presents and illustrates a practical approach to the dataflow analysis of constraint logic programming languages using abstract interpretation. It is first argued that, from the framework point of view, it suffices to propose relatively simple extensions of traditional analysis methods which have already been proved useful and practical and for which efficient fixpoint algorithms exist. This is shown by proposing a simple extension of Bruynooghe's traditional framework which allows it to analyze constraint logic programs. Then, and using this generalized framework, two abstract domains and their required abstract functions are presented: the first abstract domain approximates definiteness information and the second one freeness. Finally, an approach for combining those domains is proposed. The two domains and their combination have been implemented and used in the analysis of CLP(R) and Prolog-III applications. Results form this implementation showing its performance and accuracy are also presented.

Skip Supplemental Material Section

Supplemental Material

References

  1. Armstrong, T., Marriott, K., Schachte, P., and S ndergaard, H. 1994. Boolean functions for dependency analysis: Algebraic properties and e cient representation. In Proceedings of the Static Analysis Symposium, B. Le Charlier, Ed. Lecture Notes in Computer Science, vol. 864. Springer-Verlag, Namur, Belgium, 266{280.Google ScholarGoogle Scholar
  2. Bruynooghe, M. 1991. A practical framework for the abstract interpretation of logic programs. J. Logic Program. 10, 2 (Feb.), 91{124. Google ScholarGoogle Scholar
  3. Bruynooghe, M. and Boulanger, D. 1994. Abstract interpretation for (constraint) logic programming. In Constraint Programming, B. Mayoh, E. Tyugu, and J. Penjam, Eds. Nato ASI Series, vol. F/131. Springer-Verlag, Berlin, 228{258.Google ScholarGoogle Scholar
  4. Bruynooghe, M. and Janssens, G. 1992. Propagation: A new operation in a framework for abstract interpretation of logic programs. In Proceedings of the 3rd International Workshop on Metaprogramming in Logic, A. Pettorossi, Ed. Lecture Notes in Computer Science, vol. 649. Springer-Verlag, Uppsala, Sweden, 294{307. Google ScholarGoogle Scholar
  5. Bueno, F., de la Banda, M. G., and Hermenegildo, M. 1994. E ectiveness of global analysis in strict independence-based automatic program parallelization. In Proceedings of the 1994 International Symposium on Logic Programming. MIT Press, Cambridge, Mass., 320{336. Google ScholarGoogle Scholar
  6. Codish, M., Mulkers, A., Bruynooghe, M., Garc a de la Banda, M., and Hermenegildo, M. 1995. Improving abstract interpretations by combining domains. ACM Trans. Program. Lang. Syst. 17, 1 (Jan.), 28{44. Google ScholarGoogle Scholar
  7. Codognet, P. and Fil e, G. 1992. Computations, abstractions and constraints in logic programs. In Proceedings of the 4th International Conference on Computer Languages, J. Cordy, Ed. IEEE Computer Society Press, Los Alamitos, Calif., 155{164.Google ScholarGoogle Scholar
  8. Colmerauer, A. 1990. An introduction to PROLOGIII. Commun. ACM 30, 7 (July), 69{96. Google ScholarGoogle Scholar
  9. Cousot, P. and Cousot, R. 1977. Abstract interpretation: A uni ed lattice model for static analysis of programs by construction or approximation of xpoints. In Proceedings of the 4th ACM Symposium on Principles of Programming Languages. ACM, New York, 238{252. Google ScholarGoogle Scholar
  10. Cousot, P. and Cousot, R. 1979. Systematic design of program analysis frameworks. In Proceedings of the 6th ACM Symposium on Principles of Programming Languages. ACM, New York, 269{282. Google ScholarGoogle Scholar
  11. Cousot, P. and Cousot, R. 1992a. Abstract interpretation and application to logic programs. J. Logic Program. 13, 2 { 3 (July), 103{179. Google ScholarGoogle Scholar
  12. Cousot, P. and Cousot, R. 1992b. Comparing the galois connection with widening/narrowing approaches to abstract interpretation. In Proceedings of the 4th International Symposium on Programming Language Implementation and Logic Programming, M. Bruynooghe and M. Wirs-ing, Eds. Lecture Notes in Computer Science, vol. 631. Springer-Verlag, Leuven, Belgium, 269{ 295. Google ScholarGoogle Scholar
  13. Dart, P. 1988. Dependency analysis and query interfaces for deductive databases. Ph.D. thesis, Univ. of Melbourne, Australia.Google ScholarGoogle Scholar
  14. Debray, S. K. 1989. Static inference of modes and data dependencies in logic programs. ACM Trans. Program. Lang. Syst. 11, 3, 418{450. Google ScholarGoogle Scholar
  15. Debray, S. K. 1992a. E cient data ow analysis of logic programs. J. ACM 39, 4 (Oct.), 949{984. Google ScholarGoogle Scholar
  16. Debray, S. K., Ed. 1992b. Special issue: Abstract interpretation. J. Logic Program. 13, 2 { 3 (July).Google ScholarGoogle Scholar
  17. Debray, S. K. 1995. On the complexity of data ow analysis of logic programs. ACM Trans. Program. Lang. Syst. 17, 2 (Mar.), 331{365. Google ScholarGoogle Scholar
  18. Dumortier, V. 1994. Freeness and related analyses of constraint logic programs using abstract interpretation. Ph.D. thesis, Dept. of Computer Science, Katholieke Univ. Leuven, Leuven, Belgium.Google ScholarGoogle Scholar
  19. Dumortier, V. and Janssens, G. 1994. Towards a practical full mode inference system for CLP(H,N). In Proceedings of the 11th International Conference on Logic Programming, P. Van Hentenryck, Ed. MIT Press, Cambridge, Mass., 569{583. Google ScholarGoogle Scholar
  20. Dumortier, V., Janssens, G., Bruynooghe, M., and Codish, M. 1993. Freeness analysis in the presence of numerical constraints. In Proceedings of the 10th International Conference on Logic Programming, D. S. Warren, Ed. MIT Press, Cambridge, Mass., 100{115. Google ScholarGoogle Scholar
  21. Englebert, V., Le Charlier, B., Roland, D., and Van Hentenryck, P. 1992. Generic abstract interpretation algorithms for Prolog: Two optimization techniques and their experimental evaluation. In Proceedings of the 4th International Symposium on Programming Language Implementation and Logic Programming (PLILP 92), M. Bruynooghe and M. Wirsing, Eds. Lecture Notes in Computer Science, vol. 631. Springer-Verlag, Leuven, Belgium, 311{325. Also in Software Practice and Experience, 23(4):419{460, 1993. Google ScholarGoogle Scholar
  22. Garc a de la Banda, M. 1994. Independence, global analysis, and parallelism in dynamically scheduled constraint logic programming. Ph.D. thesis, Univ. Polit ecnica de Madrid, Spain.Google ScholarGoogle Scholar
  23. Garc a de la Banda, M. and Hermenegildo, M. 1993. A practical approach to the global analysis of CLP programs. In Proceedings of the 1993 International Logic Programming Symposium, D. Miller, Ed. MIT Press, Cambridge, Mass., 437{455. Google ScholarGoogle Scholar
  24. Garc a de la Banda, M., Hermenegildo, M., and Marriott, K. 1993. Independence in constraint logic programs. In Proceedings of the 1993 International Logic Programming Symposium, D. Miller, Ed. MIT Press, Cambridge, Mass., 130{146. Google ScholarGoogle Scholar
  25. Garc a de la Banda, M., Marriott, K., and Stuckey, P. 1995. E cient analysis of logic programs with dynamic scheduling. In Logic Programming, Proceedings of the 1995 International Symposium (ILPS'95), J. LLoyd, Ed. MIT Press, Cambridge, Mass., 417{431.Google ScholarGoogle Scholar
  26. Giacobazzi, R., Debray, S., and Levi, G. 1993. Generalized semantics and abstract interpretation for constraint logic programs. Draft, Univ. of Pisa. Apr. Preliminary version in Proceedings of the International Conference on Fifth Generation Computer Systems 1992.Google ScholarGoogle Scholar
  27. Hanus, M. 1993. Analysis of nonlinear constraints in CLP(R). In Proceedings of the 10th International Conference on Logic Programming, D. S. Warren, Ed. MIT Press, Cambridge, Mass., 83{99. Google ScholarGoogle Scholar
  28. Hanus, M. 1995. Analysis of residuation in logic programs. J. Logic Program. 24, 3 (Sept.), 161{199.Google ScholarGoogle Scholar
  29. Hermenegildo, M. and Greene, K. J. 1990. &-Prolog and its performance: Exploiting independent And-parallellism. In Proceedings of the 7th International Conference on Logic Programming, D. H. D. Warren and P. Szeredi, Eds. MIT Press, Cambridge, Mass., 253{268. Google ScholarGoogle Scholar
  30. Hermenegildo, M., Marriott, K., Puebla, G., and Stuckey, P. 1995. Incremental analysis of logic programs. In Proceedings of the 12th International Conference on Logic Programming, L. Sterling, Ed. MIT Press, Cambridge, Mass., 797{811.Google ScholarGoogle Scholar
  31. Jacobs, D. and Langen, A. 1992. Static analysis of logic programs for independent And-parallelism. J. Logic Program. 13, 2 { 3 (July), 291{314. Google ScholarGoogle Scholar
  32. Jaffar, J. and Lassez, J.-L. 1987. Constraint logic programming. In Proceedings of the 14th ACM Symposium on the Principles of Programming Languages. ACM, New York, 111{119. Google ScholarGoogle Scholar
  33. Jaffar, J. and Maher, M. 1994. Constraint logic programming: A survey. J. Logic Program. 19 { 20, 503{581.Google ScholarGoogle Scholar
  34. Jaffar, J., Michaylov, S., Stuckey, P., and Yap, R. 1992. An abstract machine for CLP(R). In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, New York, 128{139. Google ScholarGoogle Scholar
  35. Janssens, G. and Bruynooghe, M. 1992. Deriving descriptions of possible values of program variables by means of abstract interpretation. J. Logic Program. 13, 2 { 3 (July), 205{258. Google ScholarGoogle Scholar
  36. Janssens, G., Bruynooghe, M., and Dumortier, V. 1995. A blueprint for an abstract machine for abstract interpretation of (constraint) logic programs. In Logic Programming, Proceedings of the 1995 International Symposium (ILPS'95), J. LLoyd, Ed. MIT Press, Cambridge, Mass., 336{350.Google ScholarGoogle Scholar
  37. J rgensen, N., Marriott, K., and Michaylov, S. 1991. Some global compile-time optimizations for CLP(R). In Proceedings of the 1991 International Symposium on Logic Programming, V. Saraswat and K. Ueda, Eds. MIT Press, Cambridge, Mass., 420{434.Google ScholarGoogle Scholar
  38. Lassez, J.-L. and McAloon, K. 1992. A canonical form for generalised linear constraints. J. Symb. Comput. 13, 1 (Jan.), 1{24. Google ScholarGoogle Scholar
  39. Le Charlier, B. and Van Hentenryck, P. 1994. Experimental evaluation of a generic abstract interpretation algorithm for Prolog. ACM Trans. Program. Lang. Syst. 16, 1 (Jan.), 35{101. Google ScholarGoogle Scholar
  40. Le Charlier, B., Musumbu, K., and Van Hentenryck, P. 1991. A generic abstract interpretation algorithm and its complexity analysis (extended abstract). In Proceedings of the 8th International Conference on Logic Programming, K. Furukawa, Ed. MIT Press, Cambridge, Mass., 64{78.Google ScholarGoogle Scholar
  41. Le Charlier, B., Rossi, S., and Van Hentenryck, P. 1994. An abstract interpretation framework for almost full prolog. In Proceedings of the 1994 International Logic Programming Symposium, M. Bruynooghe, Ed. MIT Press, Cambridge, Mass. Google ScholarGoogle Scholar
  42. Lloyd, J. W. 1987. Foundations of Logic Programming, 2nd ed. Symbolic Computation | Arti cial Intelligence. Springer-Verlag, Berlin. Google ScholarGoogle Scholar
  43. Macdonald, A. D., Stuckey, P. J., and Yap, R. H. C. 1993. Redundancy of variables in CLP(R). In Proceedings of the 1993 International Logic Programming Symposium, D. Miller, Ed. MIT Press, Cambridge, Mass., 75{93. Google ScholarGoogle Scholar
  44. Marriott, K. 1993. Frameworks for abstract interpretation. Acta Inf. 30, 103{129. Google ScholarGoogle Scholar
  45. Marriott, K. and S ndergaard, H. 1989. Semantics-based data ow analysis of logic programs. In Information Processing 89, G. Ritter, Ed. Elsevier Science Publishers B.V., North-Holland, Amsterdam, 601{606.Google ScholarGoogle Scholar
  46. Marriott, K. and S ndergaard, H. 1990. Analysis of constraint logic programs. In Proceedings of the 1990 North American Conference on Logic Programming, S. Debray and M. Hermene-gildo, Eds. MIT Press, Cambridge, Mass., 531{547. Google ScholarGoogle Scholar
  47. Marriott, K. and Stuckey, P. 1993. The 3 R's of optimizing constraint logic programs: Re- nement, removal and reordering. In Proceedings of the 20th ACM Symposium on Principles of Programming Languages. ACM, New York, 334{344. Google ScholarGoogle Scholar
  48. Marriott, K. and Stuckey, P. 1994. Approximating interaction between linear arithmetic constraints. In Proceedings of the 1994 International Symposium on Logic Programming, M. Bruynooghe, Ed. MIT Press, Cambridge, Mass., 571{585. Google ScholarGoogle Scholar
  49. Marriott, K., Garc a de la Banda, M., and Hermenegildo, M. 1994. Analyzing logic programs with dynamic scheduling. In Proceedings of the 20th Annual ACM Conference on Principles of Programming Languages. ACM, New York, 240{253. Google ScholarGoogle Scholar
  50. Marriott, K., S ndergaard, H., Stuckey, P., and Yap, R. 1994. Optimizing compilation for CLP(R). In Proceedings of the 17th Annual Computer Science Conference.Google ScholarGoogle Scholar
  51. Martelli, A. and Montanari, U. 1982. An e cient uni cation algorithm. ACM Trans. Program. Lang. Syst. 4, 3, 258{282. Google ScholarGoogle Scholar
  52. Mellish, C. 1986. Abstract interpretation of Prolog programs. In Proceedings of the 3rd International Conference on Logic Programming, E. Shapiro, Ed. Lecture Notes in Computer Science, vol. 225. Springer-Verlag, Berlin, 463{475. Google ScholarGoogle Scholar
  53. Mulkers, A. 1993. Live Data Structures in Logic Programs, Derivation by Means of Abstract Interpretation. Lecture Notes in Computer Science, vol. 675. Springer-Verlag, Berlin. Google ScholarGoogle Scholar
  54. Mulkers, A., Simoens, W., Janssens, G., and Bruynooghe, M. 1994. On the practicality of abstract equation systems. Tech. Rep. CW198, Dept. of Computer Science, Katholieke Univ. Leuven, Leuven, Belgium. Nov.Google ScholarGoogle Scholar
  55. Mulkers, A., Simoens, W., Janssens, G., and Bruynooghe, M. 1995. On the practicality of abstract equation systems. In Proceedings of the 12th International Conference on Logic Programming, L. Sterling, Ed. MIT Press, Cambridge, Mass., 781{795.Google ScholarGoogle Scholar
  56. Mulkers, A., Winsborough, W., and Bruynooghe, M. 1990. Analysis of shared data structures for compile-time garbage collection in logic programs. In Proceedings of the 7th International Conference on Logic Programming, D. H. D. Warren and P. Szeredi, Eds. MIT Press, Cambridge, Mass., 747{762. Google ScholarGoogle Scholar
  57. Mulkers, A., Winsborough, W., and Bruynooghe, M. 1994. Live-structure data ow analysis for Prolog. ACM Trans. Program. Lang. Syst. 16, 2 (Mar.), 205{258. Google ScholarGoogle Scholar
  58. Muthukumar, K. and Hermenegildo, M. 1989. Determination of variable dependence information at compile-time through abstract interpretation. In Proceedings of the 1989 North American Conference on Logic Programming, E. Lusk and R. Overbeek, Eds. MIT Press, Cambridge, Mass., 166{189.Google ScholarGoogle Scholar
  59. Muthukumar, K. and Hermenegildo, M. 1990. Deriving a xpoint computation algorithm for top-down abstract interpretation of logic programs. Tech. Rep. ACT-DC-153-90, Microelectronics and Computer Technology Corporation (MCC), Austin, Tex. Apr.Google ScholarGoogle Scholar
  60. Muthukumar, K. and Hermenegildo, M. 1992. Compile-time derivation of variable dependency using abstract interpretation. J. Logic Program. 13, 2 { 3 (July), 315{347. Google ScholarGoogle Scholar
  61. Nielson, F. 1988. Strictness analysis and denotational abstract interpretation. Inf. Comput. 76, 1, 29{92. Google ScholarGoogle Scholar
  62. Plaisted, D. A. 1984. The occur-check problem in Prolog. New Gen. Comput. 2, 4, 309{322. Also in Proceedings of the 1984 International Symposium on Logic Programming.Google ScholarGoogle Scholar
  63. Ramachandran, V. and Van Hentenryck, P. 1995. LSign reordered. In International Static Analysis Symposium (SAS'95). Lecture Notes in Computer Science, vol. 983. Springer-Verlag, Berlin, 330{347. Google ScholarGoogle Scholar
  64. Sterling, L. and Shapiro, E. 1994. The Art of Prolog: Advanced Programming Techniques, 2nd ed. Logic Programming Series. MIT Press, Cambridge, Mass. Google ScholarGoogle Scholar
  65. Van Hentenryck, P. 1989. Constraint Satisfaction in Logic Programming. MIT Press, Cambridge, Mass. Google ScholarGoogle Scholar
  66. Van Hentenryck, P. and Ramachandran, V. 1994. Backtracking without trailing in CLP(RLin ).In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, New York, 349{360. Google ScholarGoogle Scholar
  67. Van Roy, P. and Despain, A. M. 1992. High-performance logic programming with the Aquarius Prolog compiler. IEEE Comput. 25, 1 (Jan.), 54{68. Google ScholarGoogle Scholar
  68. Warren, R., Hermenegildo, M., and Debray, S. 1988. On the practicality of global ow analysis of logic programs. In Proceedings of the 5th International Conference and Symposium on Logic Programming, R. Kowalski and K.A.Bowen, Eds. MIT Press, Cambridge, Mass., 684{699.Google ScholarGoogle Scholar

Index Terms

  1. Global analysis of constraint logic programs

              Recommendations

              Reviews

              Gunther W. Schmidt

              The aim of this paper is to relate the expressive power of constraint logic programming, using abstract interpretation, to the efficiency of more classical logic programming techniques. The background and notation of constraint logic programming are presented in an easily readable form with examples. The Galois connection of abstraction and concretization is presented, together with concepts of insertion and approximation. The authors then show that the standard abstract interpretation framework for logic programs is—under certain generalizations—useful for the analysis of constraint logic programs as well. In a rather technical way, they deal with inference on definiteness as well as on freeness information. Finally, they combine the information gathered both ways. The paper ends with a broad presentation of experimental results on standard benchmarks, including eight large tables.

              Access critical reviews of Computing literature here

              Become a reviewer for Computing Reviews.

              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