skip to main content
research-article

Functional programs that explain their work

Authors Info & Claims
Published:09 September 2012Publication History
Skip Abstract Section

Abstract

We present techniques that enable higher-order functional computations to "explain" their work by answering questions about how parts of their output were calculated. As explanations, we consider the traditional notion of program slices, which we show can be inadequate, and propose a new notion: trace slices. We present techniques for specifying flexible and rich slicing criteria based on partial expressions, parts of which have been replaced by holes.

We characterise program slices in an algorithm-independent fashion and show that a least slice for a given criterion exists. We then present an algorithm, called unevaluation, for computing least program slices from computations reified as traces. Observing a limitation of program slices, we develop a notion of trace slice as another form of explanation and present an algorithm for computing them. The unevaluation algorithm can be applied to any subtrace of a trace slice to compute a program slice whose evaluation generates that subtrace. This close correspondence between programs, traces, and their slices can enable the programmer to understand a computation interactively, in terms of the programming language in which the computation is expressed. We present an implementation in the form of a tool, discuss some important practical implementation concerns and present some techniques for addressing them.

Skip Supplemental Material Section

Supplemental Material

References

  1. U. A. Acar. Self-Adjusting Computation. PhD thesis, Department of Computer Science, Carnegie Mellon University, May 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. U. A. Acar, A. Ahmed, J. Cheney, and R. Perera. A core calculus for provenance. In Proceedings of the First Conference on Principles of Security and Trust (POST), pages 410--429. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. J. R. Allen, K. Kennedy, C. Porterfield, and J. Warren. Conversion of control dependence to data dependence. In POPL, pages 177--189. ACM, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. D. C. Atkinson and W. G. Griswold. Implementation techniques for efficient data-flow analysis of large programs. In ICSM, pages 52--61. IEEE, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. T. Ball and S. Horwitz. Slicing programs with arbitrary control-flow. In Proceedings of the First International Workshop on Automated and Algorithmic Debugging, pages 206--222, London, UK, 1993. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Biswas. Dynamic Slicing in Higher-Order Programming Languages. PhD thesis, University of Pennsylvania, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. Bose and J. Frew. Lineage retrieval for scientific data processing: a survey. ACM Comput. Surv., 37(1):1--28, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. P. Buneman, J. Cheney, and S. Vansummeren. On the expressiveness of implicit provenance in query and update languages. ACM Transactions on Database Systems, 33(4):28, November 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Buneman, S. Khanna, and W. Tan. Why and where: A characterization of data provenance. In ICDT, number 1973 in LNCS, pages 316--330, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. Cirillo, R. Jagadeesan, C. Pitcher, and J. Riely. Tapido: Trust and authorization via provenance and integrity in distributed objects. In ESOP, volume 4960 of LNCS, pages 208--223, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. K. Claessen, C. Runciman, O. Chitil, J. Hughes, and M. Wallace. Testing and tracing lazy functional programs using Quickcheck and Hat. In In 4th Summer School in Advanced Functional Programming, number 2638 in LNCS, pages 59--99. Springer LNCS, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  12. S. B. Davidson and J. Freire. Provenance and scientific workflows: challenges and opportunities. In SIGMOD, pages 1345--1350, New York, NY, USA, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J. N. Foster, T. J. Green, and V. Tannen. Annotated XML: queries and provenance. In PODS, pages 271--280, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. T. J. Green, G. Karvounarakis, and V. Tannen. Provenance semirings. In PODS, pages 31--40, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. J. Hidders, N. Kwasnikowska, J. Sroka, J. Tyszkiewicz, and J. Van den Bussche. A formal model of dataflow repositories. In DILS, volume 4544 of LNCS, pages 105--121, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. N. M. Johnson, J. Caballero, K. Z. Chen, S. McCamant, P. Poosankam, D. Reynaud, and D. Song. Differential slicing: Identifying causal execution differences for security applications. In IEEE Symposium on Security and Privacy, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. Kishon and P. Hudak. Semantics directed program execution monitoring. J. Funct. Prog., 5(4):501--547, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. H. Nilsson. Tracing piece by piece: affordable debugging for lazy functional languages. In Proceedings of the 1999 ACM SIGPLAN international conference on Functional programming, pages 36--47, Paris, France, Sept. 1999. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. C. Ochoa, J. Silva, and G. Vidal. Dynamic slicing of lazy functional programs based on redex trails. Higher Order Symbol. Comput., 21(1-2):147--192, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. R. Perera, U. A. Acar, J. Cheney, and P. B. Levy. Functional programs that explain their work. Technical Report MPI-SWS-2012-003, Max Planck Institute for Software Systems, July 2012.Google ScholarGoogle Scholar
  21. T. Reps and T. Turnidge. Program specialization via program slicing. In O. Danvy, R. Glck, and P. Thiemann, editors, Partial Evaluation, volume 1110 of LNCS, pages 409--429. Springer-Verlag, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Y. Simmhan, B. Plale, and D. Gannon. A survey of data provenance in e-science. SIGMOD Record, 34(3):31--36, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. J. Sparud and C. Runciman. Complete and partial redex trails of functional computations. In IFL 1997, number 1467 in LNCS, pages 160--177. Springer-Verlag, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. E. Sumii and H. Bannai. VMλ: A functional calculus for scientific discovery. In Z. Hu and M. Rodríguez-Artalejo, editors, Functional and Logic Programming, volume 2441 of Lecture Notes in Computer Science, pages 290--304. Springer Berlin / Heidelberg, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. N. Swamy, B. J. Corcoran, and M. Hicks. Fable: A language for enforcing user-defined security policies. In IEEE Symposium on Security and Privacy, pages 369--383, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. F. Tip. A survey of program slicing techniques. J. Prog. Lang., 3(3), 1995.Google ScholarGoogle Scholar
  27. M. Weiser. Program slicing. In ICSE, pages 439--449, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. B. Xu, J. Qian, X. Zhang, Z. Wu, and L. Chen. A brief survey of program slicing. SIGSOFT Softw. Eng. Notes, 30:1--36, March 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Functional programs that explain their work

      Recommendations

      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

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 47, Issue 9
        ICFP '12
        September 2012
        368 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2398856
        Issue’s Table of Contents
        • cover image ACM Conferences
          ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
          September 2012
          392 pages
          ISBN:9781450310543
          DOI:10.1145/2364527

        Copyright © 2012 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 9 September 2012

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!