Abstract
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.
Work partially supported by CICYT TIC2001-2705-C03-01, Acciones Integradas HI2000-0161, HA2001-0059, HU2001-0019, and Generalitat Valenciana GV01-424.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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.
K. R. Apt. From Logic Programming to PROLOG. Prentice-Hall, 1997.
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.
F. Baader and T. Nipkow. Term Rewriting and All That. Cambridge University Press, 1998.
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.
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.
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.
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.
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.
M. Comini, G. Levi, M. C. Meo, and G. Vitiello. Abstract Diagnosis. Journal of Logic Programming, 39(1–3):43–93, 1999.
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.
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.
F. Durán. Termination Checker and Knuth-Bendix Completion Tools for Maude Equational Specifications. Technical report, Universidad de Málaga, July 2000.
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.
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.
G. Ferrand. Error Diagnosis in Logic Programming, an Adaptation of E. Y. Shapiro’s Method. Journal of Logic Programming, 4(3):177–198, 1987.
J. A. Goguen and G. Malcom. Software Engineering with OBJ. Kluwer Academic Publishers, Boston, 2000.
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.
J. W. Lloyd. Declarative error diagnosis. New Generation Computing, 5(2):133–154, 1987.
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.
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.
H. Nilsson and P. Fritzson. Algoritmic debugging for lazy functional languages. Journal of Functional Programming, 4(1):337–370, 1994.
J. T. O’Donell and C. V. Hall. Debugging in Applicative Languages. Lisp and Symbolic Computation, 1(2):113–145, 1988.
P. Padawitz. Computing in Horn Clause Theories, volume 16 of EATCS Monographs on Theoretical Computer Science. Springer-Verlag, Berlin, 1988.
R. Plasmeijer and M. van Eekelen. Functional Programming and Parallel Graph Rewriting. Addison-Wesley, Reading, MA, 1993.
E. Y. Shapiro. Algorithmic Program Debugging. In Proceedings of Ninth Annual ACM Symp. on Principles of Programming Languages, pages 412–531. ACM Press, 1982.
M.B. Smyth. Power Domains. Journal of Computer and System Sciences, 16:23–36, 1978.
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.
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.
I. Toyn. Exploratory Environments for Functional Programming. PhD thesis, University of York, U.K., 1987.
P. Wadler. Functional Programming: An angry half-dozen. ACM SIGPLAN Notices, 33(2):25–30, 1998.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2003 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Alpuente, M., Comini, M., Escobar, S., Falaschi, M., Lucas, S. (2003). Abstract Diagnosis of Functional Programs. In: Leuschel, M. (eds) Logic Based Program Synthesis and Transformation. LOPSTR 2002. Lecture Notes in Computer Science, vol 2664. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45013-0_1
Download citation
DOI: https://doi.org/10.1007/3-540-45013-0_1
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-40438-5
Online ISBN: 978-3-540-45013-9
eBook Packages: Springer Book Archive