Skip to main content

Explanations for Dynamic Programming

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2020)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 12007))

Included in the following conference series:

Abstract

We present an approach for explaining dynamic programming that is based on computing with a granular representation of values that are typically aggregated during program execution. We demonstrate how to derive more detailed and meaningful explanations of program behavior from such a representation than would otherwise be possible. To illustrate the practicality of this approach we also present a Haskell library for dynamic programming that allows programmers to specify programs by recurrence relationships from which implementations are derived that can run with granular representation and produce explanations. The explanations essentially answer questions of why one result was obtained instead of another. While usually the alternatives have to be provided by a user, we will show that with our approach such alternatives can be in some cases anticipated and that corresponding explanations can be generated automatically.

This work is partially supported by DARPA under the grant N66001-17-2-4030 and by the National Science Foundation under the grant CCF-1717300.

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 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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

Notes

  1. 1.

    This definition allows dominators to contain negative components, which are counter-productive to the goal of dominators. However, the definition of minimal-size dominators will never produce a dominator with a negative component, so that the general definition does not hurt.

  2. 2.

    See http://hackage.haskell.org/package/DP. The code has not been maintained in some time and doesn’t seem to work currently. Our implementation is available at https://github.com/prashant007/XDP.

  3. 3.

    Note that the Counting semiring is not monotonic. The implementation of Fibonacci numbers is still correct, since the \(\oplus \) function isn’t used to select among different alternatives.

  4. 4.

    The additional argument of type for is required to keep the types in the multi-parameter type class unambiguous. Moreover, we can’t unfortunately simply give the generic definition for indicated by the equation, since that would also lead to an ambiguous type.

References

  1. Roehm, T., Tiarks, R., Koschke, R., Maalej, W.: How do professional developers comprehend software? In: 34th International Conference on Software Engineering, pp. 255–265 (2012)

    Google Scholar 

  2. Murphy, G.C., Kersten, M., Findlater, L.: How are Java software developers using the eclipse IDE? IEEE Softw. 23(4), 76–83 (2006)

    Article  Google Scholar 

  3. Vessey, I.: Expertise in debugging computer programs: an analysis of the content of verbal protocols. IEEE Trans. Syst. Man Cybern. 16(5), 621–637 (1986)

    Article  Google Scholar 

  4. Parnin, C., Orso, A.: Are automated debugging techniques actually helping programmers? In: International Symposium on Software Testing and Analysis, pp. 199–209 (2011)

    Google Scholar 

  5. Marceau, G., Cooper, G.H., Spiro, J.P., Krishnamurthi, S., Reiss, S.P.: The design and implementation of a dataflow language for scriptable debugging. Autom. Softw. Eng. 14(1), 59–86 (2007)

    Article  Google Scholar 

  6. Khoo, Y.P., Foster, J.S., Hicks, M.: Expositor: scriptable time-travel debugging with first-class traces. In: ACM/IEEE International Conference on Software Engineering, pp. 352–361 (2013)

    Google Scholar 

  7. Golan, J.S.: Semirings and their Applications. Springer, Dordrecht (1999). https://doi.org/10.1007/978-94-015-9333-5

    Book  MATH  Google Scholar 

  8. Huang, L.: Advanced dynamic programming in semiring and hypergraph frameworks. In: Advanced Dynamic Programming in Computational Linguistics: Theory, Algorithms and Applications - Tutorial Notes, pp. 1–18 (2008)

    Google Scholar 

  9. Bellman, R.: On a routing problem. Q. Appl. Math. 16(1), 87–90 (1958)

    Article  MATH  Google Scholar 

  10. Erwig, M., Fern, A., Murali, M., Koul, A.: Explaining deep adaptive programs via reward decomposition. In: IJCAI/ECAI Workshop on Explainable Artificial Intelligence, pp. 40–44 (2018)

    Google Scholar 

  11. Juozapaitis, Z., Fern, A., Koul, A., Erwig, M., Doshi-Velez, F.: Explainable reinforcement learning via reward decomposition. In: IJCAI/ECAI Workshop on Explainable Artificial Intelligence, pp. 47–53 (2019)

    Google Scholar 

  12. Bauer, T., Erwig, M., Fern, A., Pinto, J.: Adaptation-based program generation in Java. In: ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, pp. 81–90 (2011)

    Google Scholar 

  13. Khan, O.Z., Poupart, P., Black, J.P.: Minimal sufficient explanations for factored Markov decision processes. In: 19th International Conference on Automated Planning and Scheduling, pp. 194–200 (2009)

    Google Scholar 

  14. Zeller, A.: Isolating cause-effect chains from computer programs. In: 10th ACM SIGSOFT Symposium on Foundations of Software Engineering, pp. 1–10 (2002)

    Google Scholar 

  15. Pope, B.: Declarative debugging with Buddha. In: Vene, V., Uustalu, T. (eds.) AFP 2004. LNCS, vol. 3622, pp. 273–308. Springer, Heidelberg (2005). https://doi.org/10.1007/11546382_7

    Chapter  Google Scholar 

  16. Gill, A.: Debugging Haskell by observing intermediate data structures. Electron. Notes Theoret. Comput. Sci. 41(1), 1 (2001)

    Article  Google Scholar 

  17. Ko, A.J., Myers, B.A.: Finding causes of program output with the Java Whyline. In: SIGCHI Conference on Human Factors in Computing Systems, pp. 1569–1578 (2009)

    Google Scholar 

  18. Abraham, R., Erwig, M.: GoalDebug: a spreadsheet debugger for end users. In: 29th IEEE International Conference on Software Engineering, pp. 251–260 (2007)

    Google Scholar 

  19. Ochoa, C., Silva, J., Vidal, G.: Dynamic slicing based on redex trails. In: ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, pp. 123–134 (2004)

    Google Scholar 

  20. Perera, R., Acar, U.A., Cheney, J., Levy, P.B.: Functional programs that explain their work. In: 17th ACM SIGPLAN International Conference on Functional Programming, pp. 365–376 (2012)

    Article  MATH  Google Scholar 

  21. Ricciotti, W., Stolarek, J., Perera, R., Cheney, J.: Imperative functional programs that explain their work. Proc. ACM Program. Lang. 1, 14:1–14:28 (2017)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Martin Erwig .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Erwig, M., Kumar, P., Fern, A. (2020). Explanations for Dynamic Programming. In: Komendantskaya, E., Liu, Y. (eds) Practical Aspects of Declarative Languages. PADL 2020. Lecture Notes in Computer Science(), vol 12007. Springer, Cham. https://doi.org/10.1007/978-3-030-39197-3_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-39197-3_12

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-39196-6

  • Online ISBN: 978-3-030-39197-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics