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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 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.
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.
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.
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
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)
Murphy, G.C., Kersten, M., Findlater, L.: How are Java software developers using the eclipse IDE? IEEE Softw. 23(4), 76–83 (2006)
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)
Parnin, C., Orso, A.: Are automated debugging techniques actually helping programmers? In: International Symposium on Software Testing and Analysis, pp. 199–209 (2011)
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)
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)
Golan, J.S.: Semirings and their Applications. Springer, Dordrecht (1999). https://doi.org/10.1007/978-94-015-9333-5
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)
Bellman, R.: On a routing problem. Q. Appl. Math. 16(1), 87–90 (1958)
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)
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)
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)
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)
Zeller, A.: Isolating cause-effect chains from computer programs. In: 10th ACM SIGSOFT Symposium on Foundations of Software Engineering, pp. 1–10 (2002)
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
Gill, A.: Debugging Haskell by observing intermediate data structures. Electron. Notes Theoret. Comput. Sci. 41(1), 1 (2001)
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)
Abraham, R., Erwig, M.: GoalDebug: a spreadsheet debugger for end users. In: 29th IEEE International Conference on Software Engineering, pp. 251–260 (2007)
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)
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)
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)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
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)