Abstract Diagnosis of Functional Programs

  • María Alpuente
  • Marco Comini
  • Santiago Escobar
  • Moreno Falaschi
  • Salvador Lucas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2664)


We present a generic scheme for the declarative debugging of functional programs modeled as term rewriting systems. We associate to our programs a semantics based on a (continuous) immediate consequence operator, \( T_\mathcal{R} \), which models the (values/normal forms) semantics of \( \mathcal{R} \) . Then, we develop an effective debugging methodology which is based on abstract interpretation: by approximating the intended specification of the semantics of \( \mathcal{R} \) we derive a finitely terminating bottom-up diagnosis method, which can be used statically. Our debugging framework does not require the user to either provide error symptoms in advance or answer questions concerning program correctness. We have made available a prototypical implementation in Haskell and have tested it on some non trivial examples.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    M. Alpuente, F. J. Correa, and M. Falaschi. Declarative Debugging of Functional Logic Programs. In B. Gramlich and S. Lucas, editors, Proceedings of the International Workshop on Reduction Strategies in Rewriting and Programming (WRS 2001), volume 57 of Electronic Notes in Theoretical Computer Science, North Holland, 2001. Elsevier Science Publishers.Google Scholar
  2. 2.
    K. R. Apt. From Logic Programming to PROLOG. Prentice-Hall, 1997.Google Scholar
  3. 3.
    K. R. Apt and E. Marchiori. Reasoning about PROLOG programs: from Modes through types to assertions. Formal Aspects of Computing, 6(6A):743–765, 1994.zbMATHCrossRefGoogle Scholar
  4. 4.
    F. Baader and T. Nipkow. Term Rewriting and All That. Cambridge University Press, 1998.Google Scholar
  5. 5.
    D. Bert and R. Echahed. Abstraction of Conditional Term Rewriting Systems. In J. W. Lloyd, editor, Proceedings of the 1995 Int’l Symposium on Logic Programming (ILPS’95), pages 162–176, Cambridge, Mass., 1995. The MIT Press.Google Scholar
  6. 6.
    F. Bueno, P. Deransart, W. Drabent, G. Ferrand, M. Hermenegildo, J. Maluszyński, and G. Puebla. On the Role of Semantic Approximations in Validation and Diagnosis of Constraint Logic Programs. In M. Kamkar, editor, Proceedings of the AADEBUG’97 (The Third International Workshop on Automated Debugging), pages 155–169, Linkoping, Sweden, 1997. University of Linkoping Press.Google Scholar
  7. 7.
    K. Claessen and J. Hughes. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP’00), 35(9):268–279, 2000.CrossRefGoogle Scholar
  8. 8.
    M. Clavel, F. Durán, S. Eker, and J. Meseguer. Building Equational Proving Tools by Reflection in Rewriting Logic. In K. Futatsugi, A. Nakagawa, and T. Tamai, editors, Cafe: An Industrial-Strength Algebraic Formal Method, pages 1–32. Elsevier, 2000.Google Scholar
  9. 9.
    M. Comini, G. Levi, M. C. Meo, and G. Vitiello. Proving properties of Logic Programs by Abstract Diagnosis. In M. Dams, editor, Proceedings of Analysis and Verification of Multiple-Agent Languages, 5th LOMAPS Workshop (LOMAPS’96), volume 1192 of Lecture Notes in Computer Science, pages 22–50, Berlin, 1996. Springer-Verlag.Google Scholar
  10. 10.
    M. Comini, G. Levi, M. C. Meo, and G. Vitiello. Abstract Diagnosis. Journal of Logic Programming, 39(1–3):43–93, 1999.zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    M. Comini, G. Levi, and G. Vitiello. Declarative Diagnosis Revisited. In J. W. Lloyd, editor, Proceedings of the 1995 Int’l Symposium on Logic Programming (ILPS’95), pages 275–287, Cambridge, Mass., 1995. The MIT Press.Google Scholar
  12. 12.
    P. Cousot. Constructive Design of a Hierarchy of Semantics of a Transition System by Abstract Interpretation. Theoretical Computer Science, 277(1–2):47–103, 2002.zbMATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    F. Durán. Termination Checker and Knuth-Bendix Completion Tools for Maude Equational Specifications. Technical report, Universidad de Málaga, July 2000.Google Scholar
  14. 14.
    M. Falaschi, G. Levi, M. Martelli, and C. Palamidessi. Declarative Modeling of the Operational Behavior of Logic Languages. Theoretical Computer Science, 69(3):289–318, 1989.zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    M. Falaschi, G. Levi, M. Martelli, and C. Palamidessi. A Model-Theoretic Reconstruction of the Operational Semantics of Logic Programs. Information and Computation, 103(1):86–113, 1993.zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    G. Ferrand. Error Diagnosis in Logic Programming, an Adaptation of E. Y. Shapiro’s Method. Journal of Logic Programming, 4(3):177–198, 1987.CrossRefzbMATHMathSciNetGoogle Scholar
  17. 17.
    J. A. Goguen and G. Malcom. Software Engineering with OBJ. Kluwer Academic Publishers, Boston, 2000.Google Scholar
  18. 18.
    J. W. Klop. Term Rewriting Systems. In S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, editors, Handbook of Logic in Computer Science, volume I, pages 1–112. Oxford University Press, 1992.Google Scholar
  19. 19.
    J. W. Lloyd. Declarative error diagnosis. New Generation Computing, 5(2):133–154, 1987.zbMATHGoogle Scholar
  20. 20.
    M. J. Maher. Equivalences of Logic Programs. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 627–658. Morgan Kaufmann, Los Altos, Ca., 1988.Google Scholar
  21. 21.
    H. Nilsson. Tracing piece by piece: affordable debugging for lazy functional languages. In Proceedings of the 1999 ACM SIGPLAN Int’l Conf. on Functional Programming, pages 36–47. ACM Press, 1999.Google Scholar
  22. 22.
    H. Nilsson and P. Fritzson. Algoritmic debugging for lazy functional languages. Journal of Functional Programming, 4(1):337–370, 1994.CrossRefGoogle Scholar
  23. 23.
    J. T. O’Donell and C. V. Hall. Debugging in Applicative Languages. Lisp and Symbolic Computation, 1(2):113–145, 1988.CrossRefGoogle Scholar
  24. 24.
    P. Padawitz. Computing in Horn Clause Theories, volume 16 of EATCS Monographs on Theoretical Computer Science. Springer-Verlag, Berlin, 1988.zbMATHGoogle Scholar
  25. 25.
    R. Plasmeijer and M. van Eekelen. Functional Programming and Parallel Graph Rewriting. Addison-Wesley, Reading, MA, 1993.zbMATHGoogle Scholar
  26. 26.
    E. Y. Shapiro. Algorithmic Program Debugging. In Proceedings of Ninth Annual ACM Symp. on Principles of Programming Languages, pages 412–531. ACM Press, 1982.Google Scholar
  27. 27.
    M.B. Smyth. Power Domains. Journal of Computer and System Sciences, 16:23–36, 1978.zbMATHCrossRefMathSciNetGoogle Scholar
  28. 28.
    J. Sparud and H. Nilsson. The architecture of a debugger for lazy functional languages. In M. Ducassé, editor, Proceedings Second International Workshop on Automated and Algorithmic Debugging, AADEBUG’95, 1995.Google Scholar
  29. 29.
    H. Tamaki and T. Sato. Unfold/Fold Transformations of Logic Programs. In S. A. Tärnlund, editor, Proceedings of Second Int’l Conf. on Logic Programming, pages 127–139, 1984.Google Scholar
  30. 30.
    I. Toyn. Exploratory Environments for Functional Programming. PhD thesis, University of York, U.K., 1987.Google Scholar
  31. 31.
    P. Wadler. Functional Programming: An angry half-dozen. ACM SIGPLAN Notices, 33(2):25–30, 1998.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • María Alpuente
    • 1
  • Marco Comini
    • 2
  • Santiago Escobar
    • 1
  • Moreno Falaschi
    • 2
  • Salvador Lucas
    • 1
  1. 1.Departamento de Sistemas Informáticos y Computación-DSICTechnical University of ValenciaValenciaSpain
  2. 2.Dipartimento di Matematica e InformaticaUniversity of UdineUdineItaly

Personalised recommendations