Skip to main content

Using Global Analysis, Partial Specifications, and an Extensible Assertion Language for Program Validation and Debugging

  • Chapter
The Logic Programming Paradigm

Part of the book series: Artificial Intelligence ((AI))

Summary

We present a framework for the application of abstract interpretation as an aid during program development, rather than in the more traditional application of program optimization. Program validation and detection of errors is first performed statically by comparing (partial) specifications written in terms of assertions against information obtained from static analysis of the program. The results of this process are expressed in the user assertion language. Assertions (or parts of assertions) which cannot be verified statically are translated into run-time tests. The framework allows the use of assertions to be optional. It also allows using very general properties in assertions, beyond the predefined set understandable by the static analyzer and including properties defined by means of user programs. We also report briefly on an implementation of the framework. The resulting tool generates and checks assertions for Prolog, CLP(R), and CHIP/CLP(fd) programs, and integrates compile-time and run-time checking in a uniform way. The tool allows using properties such as types, modes, non-failure, determinacy, and computational cost, and can treat modules separately, performing incremental analysis. In practice, this modularity allows detecting statically bugs in user programs even if they do not contain any assertions.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. Aggoun, F. Benhamou, F. Bueno, M. Carro, P. Deransart, W. Drabent, G. Ferrand, F. Goualard, M. Hermenegildo, C. Lai, J. Lloyd, J. Maluszynski, G. Puebla, and A. Tessier. CP Debugging Tools: Clarification of Functionalities and Selection of the Tools. Technical Report D.WP1.1.M1.1–2, DISCIPL Project, June 1997.

    Google Scholar 

  2. K. Apt, editor.From Logic Programming to Prolog. Prentice-Hall, Hemel Hempstead, Hertfordshire, England, 1997.

    Google Scholar 

  3. K. R. Apt and E. Marchiori. Reasoning about Prolog programs: from modes through types to assertions. Formal Aspects of Computing, 6(6):743–765, 1994.

    Article  MATH  Google Scholar 

  4. K. R. Apt and D. Pedreschi. Reasoning about termination of pure PROLOG programs. Information and Computation, 1(106): 109–157, 1993.

    Article  MathSciNet  Google Scholar 

  5. F. Bourdoncle. Abstract debugging of higher-order imperative languages. In Programming Languages Design and Implementation’93, pages 46–55, 1993.

    Google Scholar 

  6. J. Boye, W. Drabent, and J. Maluszyński. Declarative diagnosis of constraint programs: an assertion-based approach. In Proc. of the 3rd. Int’l Workshop on Automated Debugging-AADEBUG’97, pages 123–141, Linkoping, Sweden, May 1997. U. of Linkoping Press.

    Google Scholar 

  7. F. Bueno. The CIAO Multiparadigm Compiler: A User’s Manual. Technical Report CLIP8/95.0, Facultad de Informática, UPM, June 1995.

    Google Scholar 

  8. F. Bueno, D. Cabeza, M. Hermenegildo, and G. Puebla. Global Analysis of Standard Prolog Programs. In European Symposium on Programming, number 1058 in LNCS, pages 108–124, Sweden, April 1996. Springer-Verlag

    Google Scholar 

  9. F. Bueno, M. García de la Banda, and M. Hermenegildo. Effectiveness of Abstract Interpretation in Automatic Parallelization: A Case Study in Logic Programming. ACM Transactions on Programming Languages and Systems, 1998. In Press.

    Google Scholar 

  10. F. Bueno, P. Deransart, W. Drabent, G. Ferrand, M. Hermenegildo, J. Maluszynski, and G. Puebla. On the Role of Semantic Approximations in Validation and Diagnosis of Constraint Logic Programs. In Proc. of the 3rd. Int’l Workshop on Automated Debugging-AADEBUG’97, pages 155–170, Linkoping, Sweden, May 1997. U. of Linkoping Press.

    Google Scholar 

  11. L. Byrd. Understanding the Control Flow of Prolog Programs. In S.-A. Tärnlund, editor, Workshop on Logic Programming, Debrecen, 1980

    Google Scholar 

  12. 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 

  13. M. Comini, G. Levi, M. C. Meo, and G. Vitiello. Proving properties of logic programs by abstract diagnosis. In M. Dams, editor, Analysis and Verification of Multiple-Agent Languages, 5th LOMAPS Workshop, number 1192 in Lecture Notes in Computer Science, pages 22–50. Springer-Verlag, 1996

    Google Scholar 

  14. M. Comini, G. Levi, and G. Vitiello. Abstract debugging of logic programs. In L. Fribourg and F. Turini, editors, Proc. Logic Program Synthesis and Transformation and Metaprogramming in Logic 1994, volume 883 of Lecture Notes in Computer Science, pages 440–450, Berlin, 1994. Springer-Verlag.

    Google Scholar 

  15. P. Cousot and R. Cousot. Abstract Interpretation: a Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In Fourth ACM Symposium on Principles of Programming Languages, pages 238–252, 1977

    Google Scholar 

  16. P.W. Dart and J. Zobel. A regular type language for logic programs. In F. Pfenning, editor, Types in Logic Programming, pages 157–187. MIT Press, 1992

    Google Scholar 

  17. P. Deransart. Proof methods of declarative properties of definite programs. Theoretical Computer Science, 118:99–166, 1993.

    Article  MathSciNet  MATH  Google Scholar 

  18. W. Drabent, S. Nadjm-Tehrani, and J. Maluszyński. The Use of Assertions in Algorithmic Debugging. In Proceedings of the Intl. Conf. on Fifth Generation Computer Systems, pages 573–581, 1988

    Google Scholar 

  19. W. Drabent, S. Nadjm-Tehrani, and J. Maluszynski. Algorithmic debugging with assertions. In H. Abramson and M.H.Rogers, editors, Meta-programming in Logic Programming, pages 501–522. MIT Press, 1989

    Google Scholar 

  20. M. Ducassé. OPIUM – an advanced debugging system. In M. J. Comyn, G.; Fuchs, N.E.; Ratcliffe, editors, Proceedings of the Second International Logic Programming Summer School on Logic Programming in Action (LPSS’92), volume 636 of Lecture Notes in Computer Science (subseries LNA1), pages 303–312. Springer Verlag, 1992

    Google Scholar 

  21. M. Ducassé. A pragmatic survey of automated debugging. In Peter A. Fritzson, editor, Automated and Algorithmic Debugging, volume 749 of Lecture Notes in Computer Science, pages 1–15. Springer Verlag, May 1993.

    Google Scholar 

  22. M. Ducassé and J. Noyé. Logic programming environments: Dynamic program analysis and debugging. Journal of Logic Programming, 19,20:351–384, 1994

    Article  MathSciNet  Google Scholar 

  23. G. Ferrand. Error diagnosis in logic programming. J. Logic Programming, 4:177–198, 1987.

    Article  MathSciNet  MATH  Google Scholar 

  24. J.P. Gallagher and D.A. de Waal. Fast and precise regular approximations of logic programs. In Pascal Van Hentenryck, editor, Proceedings of the Eleventh International Conference on Logic Programming, pages 599–613. The MIT Press, 1994.

    Google Scholar 

  25. M. García de la Banda, M. Hermenegildo, M. Bruynooghe, V. Dumortier, G. Janssens, and W. Simoens. Global Analysis of Constraint Logic Programs. ACM Transactions on Programming Languages and Systems, 18(5):564–615

    Google Scholar 

  26. M. Hermenegildo, F. Bueno, D. Cabeza, M. García de la Banda, P. López, and G. Puebla. The CIAO Multi-Dialect Compiler and System: An Experimentation Workbench for Future (C)LP Systems. In Parallelism and Implementation Technology for Logic and Constraint Logic Programming. Nova Science, Com- mack, NY, USA, 1998.

    Google Scholar 

  27. M. Hermenegildo and The CLIP Group. pl2texi: An Automatic Documentation Generator for (C)LP — Reference Manual. The CIAO System Documentation Series - TR CLIP5/97.1, Facultad de Informática, UPM, August.

    Google Scholar 

  28. M. Hermenegildo and The CLIP Group. Programming with Global Analysis. In Proceedings of ILPS’97, pages 49–52, Cambridge, MA, October 1997. MIT Press, (abstract of invited talk).

    Google Scholar 

  29. M. Hermenegildo, R. Warren, and S. K. Debray. Global Flow Analysis as a Practical Compilation Tool. Journal of Logic Programming, 13(4):349–367, August 1992.

    Article  Google Scholar 

  30. P. Hill and J. Lloyd. The Goedel Programming Language. MIT Press, Cambridge MA, 1994.

    MATH  Google Scholar 

  31. A. Kelly, A. Macdonald, K. Marriott, P. Stuckey, and R. Yap. Effectiveness of optimizing compilation for CLP(R). In Proceedings of Joint International Conference and Symposium on Logic Programming, pages 37–51. MIT Press, 1996.

    Google Scholar 

  32. K. Marriott and P. Stuckey. The 3 R’s of Optimizing Constraint Logic Programs: Refinement, Removal, and Reordering. In 19th. Annual ACM Conf. on Principles of Programming Languages. ACM, 1992.

    Google Scholar 

  33. K. Muthukumar and M. Hermenegildo. Combined Determination of Sharing and Freeness of Program Variables Through Abstract Interpretation. In 1991 International Conference on Logic Programming, pages 49–63. MIT Press, June 1991.

    Google Scholar 

  34. K. Muthukumar and M. Hermenegildo. Compile-time Derivation of Variable Dependency Using Abstract Interpretation. Journal of Logic Programming, 13(2/3):315–347, July 1992. Originally published as Technical Report FIM 59.1/IA/90, Computer Science Dept, Universidad Politecnica de Madrid, Spain, August 1990.

    Google Scholar 

  35. L. Naish. A three-valued declarative debugging scheme. In 8th Workshop on Logic Programming Environments, July 1997. ICLP Post-Conference Workshop.

    Google Scholar 

  36. G. Puebla, F. Bueno, and M. Hermenegildo. An Assertion Language for Debugging of Constraint Logic Programs. In Proceedings of the ILPS’97 Workshop on Tools and Environments for (Constraint) Logic Programming, October 1997.

    Google Scholar 

  37. G. Puebla, F. Bueno, and M. Hermenegildo. A Framework for Assertion-based Debugging in Constraint Logic Programming. In Proceedings of the JICSLP’98 Workshop on Types for CLP, Manchester, UK, June 1998.

    Google Scholar 

  38. G. Puebla and M. Hermenegildo. Implementation of Multiple Specialization in Logic Programs. In Proc. ACM SIGPLAN Symposium on Partial Evaluation and Semantics Based Program Manipulation, pages 77–87. ACM Press, June 1995.

    Google Scholar 

  39. G. Puebla and M. Hermenegildo. Abstract Multiple Specialization and its Application to Program Parallelization. Journal of Logic Programming. Special Issue on Synthesis, Transformation and Analysis of Logic Programs, 1999. To appear.

    Google Scholar 

  40. D. De Schreye and M. Denecker. Assesment of some issues in CL-theory and program development, this volume, pp. 195–208.

    Google Scholar 

  41. E. Shapiro. Algorithmic Program Debugging. ACM Distiguished Dissertation. MIT Press, 1982.

    Google Scholar 

  42. Z. Somogyi, F. Henderson, and T. Conway. The execution algorithm of Mercury: an efficient purely declarative logic programming language. JLP, 29(1–3), October 1996.

    Article  Google Scholar 

  43. P. Van Roy and A.M. Despain. High-Performace Logic Programming with the Aquarius Prolog Compiler. IEEE Computer Magazine, pages 54–68, January 1992.

    Google Scholar 

  44. E. Vetillard. Utilisation de Declarations en Programmation Logique avec Constraintes. PhD thesis, U. of Aix-Marseilles II, 1994.

    Google Scholar 

  45. R. Warren, M. Hermenegildo, and S. K. Debray. On the Practicality of Global Flow Analysis of Logic Programs. In Fifth International Conference and Symposium on Logic Programming, pages 684–699. MIT Press, August 1988.

    Google Scholar 

  46. E. Yardeni and E. Shapiro. A Type System for Logic Programs. Concurrent Prolog: Collected Papers, pages 211–244, 1987.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Hermenegildo, M., Puebla, G., Bueno, F. (1999). Using Global Analysis, Partial Specifications, and an Extensible Assertion Language for Program Validation and Debugging. In: Apt, K.R., Marek, V.W., Truszczynski, M., Warren, D.S. (eds) The Logic Programming Paradigm. Artificial Intelligence. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-60085-2_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-60085-2_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-64249-4

  • Online ISBN: 978-3-642-60085-2

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics