Skip to main content

Certifying Standard and Stratified Datalog Inference Engines in SSReflect

  • Conference paper
Interactive Theorem Proving (ITP 2017)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10499))

Included in the following conference series:

Abstract

We propose a SSReflect library for logic programming in the Datalog setting. As part of this work, we give a first mechanization of standard Datalog and of its extension with stratified negation. The library contains a formalization of the model theoretical and fixpoint semantics of the languages, implemented through bottom-up and, respectively, through stratified evaluation procedures. We provide corresponding soundness, termination, completeness and model minimality proofs. To this end, we rely on the Coq proof assistant and SSReflect. In this context, we also construct a preliminary framework for dealing with stratified programs. We consider this to be a necessary first step towards the certification of security-aware data-centric applications.

This work was supported by the Datacert project (ANR-15-CE39-0009) of the French ANR.

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.

    Arithmetic predicates and skolem functions destroy this guarantee.

  2. 2.

    http://math-comp.github.io/math-comp/.

  3. 3.

    Term sequences \(t_{1},\ldots ,t_{n}\) are abbreviated as \(\vec {t}\) and \(|\vec {t} |= n\) denotes their length.

  4. 4.

    We call language constructs that are variable-free, ground and, otherwise, open.

  5. 5.

    The set of program constants is also called its active domain, denoted adom(P).

  6. 6.

    Also called clause instantiation.

  7. 7.

    \(\sqcup \) denotes the pairwise disjoint set union.

  8. 8.

    A program can have multiple stratifications.

  9. 9.

    As proven by Apt et al. [3], \(M_n\) is independent from the choice of stratification.

  10. 10.

    By abuse of notation, we use the same \(\omega \) for the different numbers of \(T_P\) iterations needed to reach a fixpoint, when evaluating each program slice.

  11. 11.

    Since Datalog does not have function symbols and interpretations are ground, we can restrict substitution codomains to the set of program constants, w.l.o.g.

  12. 12.

    Groundings can be coerced to substitutions and substitutions can be lifted to groundings, by padding with a default element def.

  13. 13.

    We establish corresponding reflexivity, antisymmetry and transitivity properties.

  14. 14.

    We use the boolean quantifier, as the ordinal type of variables is finite.

  15. 15.

    gr_atom_def lifts substitutions to groundings, by padding with the def constant.

  16. 16.

    Thanks to using the bigcup operator from the SSReflect bigop library.

  17. 17.

    We state this as the fwd_chainP reflection lemma.

  18. 18.

    “Positive” interpretations are sets of ground atoms with a true flag.

  19. 19.

    This corresponds to the set of all “positive” ground atoms.

  20. 20.

    This is the top element of interp cf. Sect. 3.1.

  21. 21.

    The dashed encodep arrow marks the partiality of the cancellation lemma.

  22. 22.

    i.e, \(\mathrm {str}_\le \) stratifies \(\mathrm {p}_{\mathrm {str}_\le }\) and \(\mathrm {str}_>\) stratifies \(\mathrm {p}_{\mathrm {str}_>}\).

  23. 23.

    http://www.cs.nott.ac.uk/types06/slides/NathanWhitehead.pdf.

References

  1. Barceló, P., Pichler, R. (eds.): Datalog in Academia and Industry. LNCS, vol. 7494. Springer, Heidelberg (2012)

    MATH  Google Scholar 

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

    MATH  Google Scholar 

  3. Apt, K.R., Blair, H.A., Walker, A.: Foundations of Deductive Databases and Logic Programming. Morgan Kaufmann Publishers Inc., San Francisco (1988)

    Google Scholar 

  4. Aref, M., ten Cate, B., Green, T.J., Kimelfeld, B., Olteanu, D., Pasalic, E., Veldhuizen, T.L., Washburn, G.: Design and implementation of the LogicBlox system. In: SIGMOD ACM Proceedings of ICMD, pp. 1371–1382 (2015)

    Google Scholar 

  5. Bagan, G., Bonifati, A., Ciucanu, R., Fletcher, G.H.L., Lemay, A., Advokaat, N.: gMark: schema-driven generation of graphs and queries. IEEE TKDE 29, 856–869 (2017)

    Google Scholar 

  6. Calì, A., Gottlob, G., Lukasiewicz, T.: Datalog\({\pm }\): a unified approach to ontologies and integrity constraints. In: Fagin, R. (ed.) ACM Proceedings of ICDT, vol. 361, pp. 14–30 (2009)

    Google Scholar 

  7. Ceri, S., Gottlob, G., Tanca, L.: Logic Programming and Databases. Springer, Heidelberg (1990)

    Book  Google Scholar 

  8. Chin, B., von Dincklage, D., Ercegovac, V., Hawkins, P., Miller, M.S., Och, F.J., Olston, C., Pereira, F.: Yedalog: exploring knowledge at scale. In: Ball, T., Bodk, R., Krishnamurthi, S., Lerner, B.S., Morrisett, G. (eds.) LIPIcs Proceedings of SNAPL, vol. 32, pp. 63–78 (2015)

    Google Scholar 

  9. Datomic. http://www.datomic.com/

  10. DeTreville, J.: Binder, a logic-based security language. In: IEEE Proceedings of the Symposium on Security and Privacy, Washington, DC, USA, pp. 105–115. IEEE Computer Society (2002)

    Google Scholar 

  11. Doczkal, C., Smolka, G.: Completeness and decidability results for CTL in Coq. In: Klein, G., Gamboa, R. (eds.) ITP 2014. LNCS, vol. 8558, pp. 226–241. Springer, Cham (2014). doi:10.1007/978-3-319-08970-6_15

    Chapter  Google Scholar 

  12. Exeura. http://www.exeura.com/

  13. Gonthier, G.: Point-free, set-free concrete linear algebra. In: van Eekelen, M., Geuvers, H., Schmaltz, J., Wiedijk, F. (eds.) ITP 2011. LNCS, vol. 6898, pp. 103–118. Springer, Heidelberg (2011). doi:10.1007/978-3-642-22863-6_10

    Chapter  Google Scholar 

  14. Gonthier, G., et al.: A machine-checked proof of the odd order theorem. In: Blazy, S., Paulin-Mohring, C., Pichardie, D. (eds.) ITP 2013. LNCS, vol. 7998, pp. 163–179. Springer, Heidelberg (2013). doi:10.1007/978-3-642-39634-2_14

    Chapter  Google Scholar 

  15. Gonthier, G., Mahboubi, A., Tassi, E.: A small scale reflection extension for the Coq system (2016). https://hal.inria.fr/inria-00258384

  16. Gottlob, G., Koch, C., Baumgartner, R., Herzog, M., Flesca, S.: The lixto data extraction project: back and forth between theory and practice. In: ACM SIGMOD-SIGACT-SIGART Proceedings of PODS, pp. 1–12. ACM, New York (2004)

    Google Scholar 

  17. Grumbach, S., Wang, F.: Netlog, a rule-based language for distributed programming. In: Carro, M., Peña, R. (eds.) PADL 2010. LNCS, vol. 5937, pp. 88–103. Springer, Heidelberg (2010). doi:10.1007/978-3-642-11503-5_9

    Chapter  Google Scholar 

  18. Hellerstein, J.M.: The declarative imperative: experiences and conjectures in distributed logic. ACM SIGMOD Rec. J. 39(1), 5–19 (2010)

    Article  Google Scholar 

  19. Huang, S.S., Green, T.J., Loo, B.T.: Datalog and emerging applications: an interactive tutorial. In: ACM SIGMOD Proceedings of ICMD, pp. 1213–1216 (2011)

    Google Scholar 

  20. Kriener, J., King, A., Blazy, S.: Proofs you can believe in: proving equivalences between prolog semantics in Coq. In: ACM Proceedings of PPDP, pp. 37–48 (2013)

    Google Scholar 

  21. Libkin, L.: The finite model theory toolbox of a database theoretician. In: ACM SIGMOD-SIGACT-SIGART Proceedings of PODS, pp. 65–76 (2009)

    Google Scholar 

  22. Lloyd, J.W.: Foundations of Logic Programming. Springer, Heidelberg (1987)

    Book  Google Scholar 

  23. LogicBlox. http://www.logicblox.com/

  24. Loo, B.T., Condie, T., Hellerstein, J.M., Maniatis, P., Roscoe, T., Stoica, I.: Implementing declarative overlays. In: ACM Proceedings of SOSP, pp. 75–90 (2005)

    Google Scholar 

  25. Lu, L., Cleary, J.G.: An operational semantics of starlog. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 294–310. Springer, Heidelberg (1999). doi:10.1007/10704567_18

    Chapter  Google Scholar 

  26. Luteberget, B., Johansen, C., Feyling, C., Steffen, M.: Rule-based incremental verification tools applied to railway designs and regulations. In: Fitzgerald, J., Heitmeyer, C., Gnesi, S., Philippou, A. (eds.) FM 2016. LNCS, vol. 9995, pp. 772–778. Springer, Cham (2016). doi:10.1007/978-3-319-48989-6_49

    Chapter  Google Scholar 

  27. The Coq Development Team: The Coq Proof Assistant. Reference Manual (2016). https://coq.inria.fr/refman/. Version 8.6

  28. Ramakrishnan, R., Ullman, J.D.: A survey of research on deductive database systems. J. Log. Program. 23(2), 125–149 (1993)

    Article  Google Scholar 

  29. Semmle. https://semmle.com/

  30. Seo, J., Park, J., Shin, J., Lam, M.S.: Distributed socialite: a datalog-based language for large-scale graph analysis. Proc. VLDB Endow. 6, 1906–1917 (2013)

    Article  Google Scholar 

  31. Tarski, A.: A lattice-theoretical fixpoint theorem and its applications. Pac. J. Math. 5(2), 285–309 (1955)

    Article  MathSciNet  Google Scholar 

  32. Van Emden, M.H., Kowalski, R.A.: The semantics of predicate logic as a programming language. J. ACM 23(4), 733–742 (1976)

    Article  MathSciNet  Google Scholar 

  33. Vardi, M.Y.: The complexity of relational query languages. In: ACM Proceedings of STOC, pp. 137–146 (1982)

    Google Scholar 

  34. Whaley, J., Avots, D., Carbin, M., Lam, M.S.: Using datalog with binary decision diagrams for program analysis. In: Yi, K. (ed.) APLAS 2005. LNCS, vol. 3780, pp. 97–118. Springer, Heidelberg (2005). doi:10.1007/11575467_8

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Stefania Dumbrava .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this paper

Cite this paper

Benzaken, V., Contejean, É., Dumbrava, S. (2017). Certifying Standard and Stratified Datalog Inference Engines in SSReflect. In: Ayala-Rincón, M., Muñoz, C.A. (eds) Interactive Theorem Proving. ITP 2017. Lecture Notes in Computer Science(), vol 10499. Springer, Cham. https://doi.org/10.1007/978-3-319-66107-0_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-66107-0_12

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-66106-3

  • Online ISBN: 978-3-319-66107-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics