Skip to main content

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13160))

  • 159 Accesses

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.

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

    In this paper, we only consider Prolog’s computation rule, so that the selected atom in a query is always the leftmost one.

  2. 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. 3.

    Here, \((A,H,m)\!:\!\mathcal{H}\) denotes a list with head element (AHm) and tail \(\mathcal{H}\).

  4. 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. 5.

    For simplicity, we assume that the same renamed clauses are considered in both derivations.

  6. 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. 7.

    As is common, |S| denotes the cardinality of the set or sequence S.

References

  1. Apt, K.R.: From Logic Programming to Prolog. Prentice Hall, London (1997)

    Google Scholar 

  2. 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)

    Google Scholar 

  3. Clocksin, W.F., Mellish, C.S.: Programming in PROLOG, 4th edn. Springer, Cham (1994)

    Book  MATH  Google Scholar 

  4. 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

    Article  MATH  Google Scholar 

  5. Landauer, R.: Irreversibility and heat generation in the computing process. IBM J. Res. Develop. 5, 183–191 (1961)

    Article  MathSciNet  MATH  Google Scholar 

  6. 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

    Chapter  Google Scholar 

  7. Lloyd, J.W.: Foundations of Logic Programming, 2nd Edition. Springer, Cham (1987). https://doi.org/10.1007/978-3-642-83189-8

  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

    Article  MathSciNet  MATH  Google Scholar 

  9. 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

  10. 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

    Chapter  MATH  Google Scholar 

  11. 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

  12. Undo Software: Increasing software development productivity with reversible debugging (2014). https://undo.io/media/uploads/files/Undo_ReversibleDebugging_Whitepaper.pdf

  13. 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

    Chapter  MATH  Google Scholar 

Download references

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

Authors

Corresponding author

Correspondence to Germán Vidal .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics