Explanations for Dynamic Programming

  • Martin ErwigEmail author
  • Prashant Kumar
  • Alan Fern
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 12007)


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.


  1. 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. 2.
    Murphy, G.C., Kersten, M., Findlater, L.: How are Java software developers using the eclipse IDE? IEEE Softw. 23(4), 76–83 (2006)CrossRefGoogle Scholar
  3. 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)CrossRefGoogle Scholar
  4. 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. 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)CrossRefGoogle Scholar
  6. 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. 7.
    Golan, J.S.: Semirings and their Applications. Springer, Dordrecht (1999). Scholar
  8. 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. 9.
    Bellman, R.: On a routing problem. Q. Appl. Math. 16(1), 87–90 (1958)zbMATHCrossRefGoogle Scholar
  10. 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. 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. 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. 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. 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. 15.
    Pope, B.: Declarative debugging with Buddha. In: Vene, V., Uustalu, T. (eds.) AFP 2004. LNCS, vol. 3622, pp. 273–308. Springer, Heidelberg (2005). Scholar
  16. 16.
    Gill, A.: Debugging Haskell by observing intermediate data structures. Electron. Notes Theoret. Comput. Sci. 41(1), 1 (2001)CrossRefGoogle Scholar
  17. 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. 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. 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. 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)zbMATHCrossRefGoogle Scholar
  21. 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)CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.Oregon State UniversityCorvallisUSA

Personalised recommendations