Abstract
Reversible debugging is becoming increasingly popular for locating the source of errors. This technique proposes a more natural approach to debugging, where one can explore a computation from the observable misbehaviour backwards to the source of the error. In this work, we propose a reversible debugging scheme for logic programs. For this purpose, we define an appropriate instrumented semantics (a so-called Landauer embedding) that makes SLD resolution reversible. An implementation of a reversible debugger for Prolog, rever, has been developed and is publicly available.
This paper is dedicated to Manuel Hermenegildo on his 60th birthday, for his many contributions to logic programming as well as his energetic leadership within the community. I wish him many springs more to come.
This work has been partially supported by grant PID2019-104735RB-C41 funded by MCIN/AEI/ 10.13039/501100011033, by the Generalitat Valenciana under grant Prometeo/2019/098 (DeepTrust), and by the COST Action IC1405 on Reversible Computation - extending horizons of computing.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
In this paper, we only consider Prolog’s computation rule, so that the selected atom in a query is always the leftmost one.
- 2.
We consider Prolog notation in examples (so variables start with an uppercase letter). Clauses are labelled with a unique identifier of the form \(\ell _i\).
- 3.
Here, \((A,H,m)\!:\!\mathcal{H}\) denotes a list with head element (A, H, m) and tail \(\mathcal{H}\).
- 4.
For clarity, we only show the bindings for the variables in the initial query. Moreover, the steps are labelled with the applied rule.
- 5.
For simplicity, we assume that the same renamed clauses are considered in both derivations.
- 6.
The subscripts of some configurations: call, exit, fail, redo, and answer, can be ignored for now. They will become useful in the next section.
- 7.
As is common, |S| denotes the cardinality of the set or sequence S.
References
Apt, K.R.: From Logic Programming to Prolog. Prentice Hall, London (1997)
Byrd, L.: Understanding the control flow of prolog programs. In: Tarnlund, S.A. (ed.) Proceedings of the 1980 Logic Programming Workshop, pp. 127–138 (1980)
Clocksin, W.F., Mellish, C.S.: Programming in PROLOG, 4th edn. Springer, Cham (1994)
Ducassé, M.: Opium: an extendable trace analyzer for prolog. J. Log. Program. 39(1–3), 177–223 (1999). https://doi.org/10.1016/S0743-1066(98)10036-5
Landauer, R.: Irreversibility and heat generation in the computing process. IBM J. Res. Develop. 5, 183–191 (1961)
Lanese, I., Palacios, A., Vidal, G.: Causal-consistent replay debugging for message passing programs. In: Pérez, J.A., Yoshida, N. (eds.) FORTE 2019. LNCS, vol. 11535, pp. 167–184. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-21759-4_10
Lloyd, J.W.: Foundations of Logic Programming, 2nd Edition. Springer, Cham (1987). https://doi.org/10.1007/978-3-642-83189-8
Mesnard, F., Payet, É., Vidal, G.: Concolic testing in logic programming. Theory Pract. Log. Program. 15(4–5), 711–725 (2015). https://doi.org/10.1017/S1471068415000332
O’Callahan, R., Jones, C., Froyd, N., Huey, K., Noll, A., Partush, N.: Engineering record and replay for deployability: Extended technical report. CoRR abs/1705.05937 (2017). http://arxiv.org/abs/1705.05937
Ströder, T., Emmes, F., Schneider-Kamp, P., Giesl, J., Fuhs, C.: A linear operational semantics for termination and complexity analysis of ISO Prolog. In: Vidal, G. (ed.) LOPSTR 2011. LNCS, vol. 7225, pp. 237–252. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-32211-2_16
Stulova, N., Morales, J.F., Hermenegildo, M.V.: Assertion-based debugging of higher-order (C)LP programs. In: Chitil, O., King, A., Danvy, O. (eds.) Proceedings of the 16th International Symposium on Principles and Practice of Declarative Programming (PPDP 2014), pp. 225–235. ACM (2014). https://doi.org/10.1145/2643135.2643148
Undo Software: Increasing software development productivity with reversible debugging (2014). https://undo.io/media/uploads/files/Undo_ReversibleDebugging_Whitepaper.pdf
Vidal, G.: Reversible computations in logic programming. In: Lanese, I., Rawski, M. (eds.) RC 2020. LNCS, vol. 12227, pp. 246–254. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-52482-1_15
Acknowledgements
The author gratefully acknowledges the editors, John Gallagher, Roberto Giacobazzi and Pedro López-García, for the opportunity to contribute to this volume, dedicated to Manuel Hermenegildo on the occasion of his 60th birthday.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 Springer Nature Switzerland AG
About this chapter
Cite this chapter
Vidal, G. (2023). Reversible Debugging in Logic Programming. In: Lopez-Garcia, P., Gallagher, J.P., Giacobazzi, R. (eds) Analysis, Verification and Transformation for Declarative Programming and Intelligent Systems. Lecture Notes in Computer Science, vol 13160. Springer, Cham. https://doi.org/10.1007/978-3-031-31476-6_15
Download citation
DOI: https://doi.org/10.1007/978-3-031-31476-6_15
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-31475-9
Online ISBN: 978-3-031-31476-6
eBook Packages: Computer ScienceComputer Science (R0)