Skip to main content

A Counterexample-Guided Debugger for Non-recursive Datalog

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2020)

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

Included in the following conference series:

Abstract

The Datalog language is used in many potential applications including database queries, program analysis, bidirectional transformations, and so forth. In practice, such a Datalog program is expected to be well-written to meet requirements such as the round-tripping properties in bidirectional programming. Although verifying and debugging Datalog programs play an essential role to guarantee the expected properties of these programs, very few approaches have been proposed. The existing approaches require much users’ effort in finding out unintended behaviors or unexpected computations of the Datalog program that neither counterexamples nor bug explanations are provided. In this paper, we propose an efficient approach to interactively debugging Datalog programs so that the user’s burden is reduced. Specifically, we provide a syntax for users to specify properties of non-recursive Datalog programs, present a counterexample generator that verifies specified properties and generates counterexamples to show unexpected behaviors of user-written programs, and design a debugging engine combined with a dialog-based user interface to assist users in locating bugs in the programs with the generated counterexamples. We have implemented a prototype of our approach and demonstrated its feasibility and efficiency.

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.

    It is not necessary to filter duplicates here. The duplicates will be eliminated in all the other checks and algorithms.

References

  1. Z3: Theorem prover (2018). https://z3prover.github.io

  2. Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison-Wesley, Boston (1995)

    MATH  Google Scholar 

  3. Amaral, C., Florido, M., Santos Costa, V.: PrologCheck – property-based testing in prolog. In: Codish, M., Sumii, E. (eds.) FLOPS 2014. LNCS, vol. 8475, pp. 1–17. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-07151-0_1

    Chapter  Google Scholar 

  4. Bravenboer, M., Smaragdakis, Y.: Strictly declarative specification of sophisticated points-to analyses. In: OOPSLA, pp. 243–262 (2009)

    Google Scholar 

  5. Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F.: A theoretical framework for the declarative debugging of Datalog programs. In: Semantics in Data and Knowledge Bases, pp. 143–159 (2008)

    Google Scholar 

  6. Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F.: A new proposal for debugging Datalog programs. In: WFLP 2007 (2007)

    Google Scholar 

  7. Caballero, R., Riesco, A., Silva, J.: A survey of algorithmic debugging. ACM Comput. Surv. 50(4), 60:1–60:35 (2017)

    Article  Google Scholar 

  8. Calì, A., Gottlob, G., Lukasiewicz, T.: Datalog\(\pm \): a unified approach to ontologies and integrity constraints. In: ICDT, pp. 14–30 (2009)

    Google Scholar 

  9. Ceri, S., Gottlob, G., Tanca, L.: What you always wanted to know about Datalog (and never dared to ask). TKDE 1(1), 146–166 (1989)

    Google Scholar 

  10. Czarnecki, K., Foster, J.N., Hu, Z., Lämmel, R., Schürr, A., Terwilliger, J.F.: Bidirectional transformations: a cross-discipline perspective. In: Theory and Practice of Model Transformations, pp. 260–283 (2009)

    Google Scholar 

  11. Grebenshchikov, S., Lopes, N.P., Popeea, C., Rybalchenko, A.: Synthesizing software verifiers from proof rules. In: PLDI, pp. 405–416 (2012)

    Google Scholar 

  12. Green, T.J., Karvounarakis, G., Ives, Z.G., Tannen, V.: Update exchange with mappings and provenance. In: VLDB, pp. 675–686 (2007)

    Google Scholar 

  13. Herschel, M., Hernández, M.A.: Explaining missing answers to SPJUA queries. PVLDB 3(1), 185–196 (2010)

    Google Scholar 

  14. Köhler, S., Ludäscher, B., Smaragdakis, Y.: Declarative Datalog debugging for mere mortals. In: Datalog in Academia and Industry, pp. 111–122 (2012)

    Google Scholar 

  15. Köhler, S., Ludäscher, B., Zinn, D.: First-order provenance games. In: In Search of Elegance in the Theory and Practice of Computation, pp. 382–399 (2013)

    Google Scholar 

  16. Lee, S., Köhler, S., Ludäscher, B., Glavic, B.: A SQL-middleware unifying why and why-not provenance for first-order queries. In: ICDE, pp. 485–496 (2017)

    Google Scholar 

  17. Sáenz-Pérez, F., Caballero, R., García-Ruiz, Y.: A deductive database with Datalog and SQL query languages. In: Yang, H. (ed.) APLAS 2011. LNCS, vol. 7078, pp. 66–73. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-25318-8_8

    Chapter  Google Scholar 

  18. Shapiro, E.Y.: Algorithmic program diagnosis. In: POPL, pp. 299–308 (1982)

    Google Scholar 

  19. Shmueli, O.: Equivalence of Datalog queries is undecidable. J. Logic Program. 15(3), 231–241 (1993)

    Article  MathSciNet  Google Scholar 

  20. Torlak, E., Bodík, R.: A lightweight symbolic virtual machine for solver-aided host languages. In: PLDI, pp. 530–541 (2014)

    Google Scholar 

  21. Tran, V.D., Kato, H., Hu, Z.: Programmable view update strategies on relations. PVLDB 13(5), 726–739 (2020)

    Google Scholar 

Download references

Acknowledgments

We would like to thank Meng Wang and the anonymous reviewers for their insightful comments on this paper. This work is partially supported by the Japan Society for the Promotion of Science (JSPS) Grant-in-Aid for Scientific Research (S) No. 17H06099.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Van-Dang Tran .

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

Tran, VD., Kato, H., Hu, Z. (2020). A Counterexample-Guided Debugger for Non-recursive Datalog. In: Oliveira, B.C.d.S. (eds) Programming Languages and Systems. APLAS 2020. Lecture Notes in Computer Science(), vol 12470. Springer, Cham. https://doi.org/10.1007/978-3-030-64437-6_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-64437-6_17

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-64436-9

  • Online ISBN: 978-3-030-64437-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics