Skip to main content
Log in

Evaluating Datalog via Tree Automata and Cycluits

  • Published:
Theory of Computing Systems Aims and scope Submit manuscript

Abstract

We investigate parameterizations of both database instances and queries that make query evaluation fixed-parameter tractable in combined complexity. We show that clique-frontier-guarded Datalog with stratified negation (CFG-Datalog) enjoys bilinear-time evaluation on structures of bounded treewidth for programs of bounded rule size. Such programs capture in particular conjunctive queries with simplicial decompositions of bounded width, guarded negation fragment queries of bounded CQ-rank, or two-way regular path queries. Our result is shown by translating to alternating two-way automata, whose semantics is defined via cyclic provenance circuits (cycluits) that can be tractably evaluated.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2

Similar content being viewed by others

References

  1. Abiteboul, S., Hull, R., Vianu, V.: Foundations of databases. Addison-Wesley, Reading (1995)

    MATH  Google Scholar 

  2. Alon, N., Yuster, R., Zwick, U.: Finding and counting given length cycles. Algorithmica 17(3) (1997)

  3. Amarilli, A.: Leveraging the structure of uncertain data. Ph.D. thesis, Télécom ParisTech (2016)

  4. Amarilli, A., Bourhis, P., Monet, M., Senellart, P.: Combined Tractability of Query Evaluation via Tree Automata and Cycluits. In: ICDT (2017)

  5. Amarilli, A., Bourhis, P., Monet, M., Senellart, P.: Combined tractability of query evaluation via tree automata and cycluits (extended version). arXiv:1612.04203. Extended version of [4] (2017)

  6. Amarilli, A., Bourhis, P., Senellart, P.: Provenance Circuits for Trees and Treelike Instances. In: ICALP (2015)

  7. Amarilli, A., Monet, M., Senellart, P.: Conjunctive Queries on Probabilistic Graphs: Combined Complexity. In: PODS (2017)

  8. Bȧrȧny, V., ten Cate, B., Otto, M.: Queries with guarded negation. PVLDB 5(11) (2012)

  9. Bȧrȧny, V., Ten Cate, B., Segoufin, L.: Guarded negation. J ACM 62(3) (2015)

  10. Barceló, P.: Querying graph databases. In: PODS (2013)

  11. Barceló, P., Romero, M., Vardi, M.Y.: Does query evaluation tractability help query containment?. In: PODS (2014)

  12. Benedikt, M., Bourhis, P., Gottlob, G., Senellart, P.: Monadic datalog and limited access containment. Unpublished (2016)

  13. Benedikt, M., Bourhis, P., Senellart, P.: Monadic datalog containment. In: ICALP (2012)

  14. Benedikt, M., Bourhis, P., Vanden Boom, M.: A step up in expressiveness of decidable fixpoint logics. In: LICS (2016)

  15. Benedikt, M., ten Cate, B., Vanden Boom, M.: Effective interpolation and preservation in guarded logics. In: LICS (2014)

  16. Benedikt, M., Gottlob, G.: The impact of virtual views on containment. PVLDB 3(1-2) (2010)

  17. Berry, A., Pogorelcnik, R., Simonet, G.: An introduction to clique minimal separator decomposition. Algorithms 3(2) (2010)

  18. Berwanger, D., Grȧdel, E.: Games and model checking for guarded logics. In: LPAR (2001)

  19. Birget, J. C.: State-complexity of finite-state devices, state compressibility and incompressibility. Mathematical Systems Theory 26(3) (1993)

  20. Bodlaender, H.L.: A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput 25(6) (1996)

  21. Bodlaender, H. L., Koster, A.M.C.A.: Treewidth computations I. Upper bounds. Inf. Comput 208(3) (2010)

  22. Cachat, T.: Two-way tree automata solving pushdown games. In: Automata Logics, and Infinite Games, Chap. 17. Springer (2002)

  23. Calvanese, D., De Giacomo, G., Lenzeniri, M., Vardi, M.Y.: Containment of conjunctive regular path queries with inverse. In: KR (2000)

  24. Chandra, A. K., Vardi, M. Y.: The implication problem for functional and inclusion dependencies is undecidable. SIAM Journal on Computing 14(3) (1985)

  25. Comon, H., Dauchet, M., Gilleron, R., Löding, C., Jacquemard, F., Lugiez, D., Tison, S., Tommasi, M.: Tree automata: Techniques and applications (2007)

  26. Cosmadakis, S., Gaifman, H., Kanellakis, P., Vardi, M.: Decidable Optimization Problems for Database Logic Programs. In: STOC (1988)

  27. Courcelle, B.: The monadic second-order logic of graphs. I. Recognizable sets of finite graphs. Inf. Comput 85(1) (1990)

  28. Deutch, D., Milo, T., Roy, S., Tannen, V.: Circuits for Datalog Provenance. In: ICDT (2014)

  29. Diestel, R.: Simplicial decompositions of graphs: A survey of applications. Discrete Math 75(1) (1989)

  30. Fagin, R.: Degrees of acyclicity for hypergraphs and relational database schemes. J ACM 30(3) (1983)

  31. Flum, J., Frick, M., Grohe, M.: Query evaluation via tree-decompositions j.ACM 49(6) (2002)

  32. Flum, J., Grohe, M.: Parameterized complexity theory. Springer, Berlin (2006)

    MATH  Google Scholar 

  33. Gavril, F.: The intersection graphs of subtrees in trees are exactly the chordal graphs. J Combinatorial Theory 16(1) (1974)

  34. Gottlob, G., Grȧdel, E., Veith, H.: Datalog LITE: A deductive query language with linear time model checking. ACM Trans. Comput. Log 3(1) (2002)

  35. Gottlob, G., Greco, G., Scarcello, F.: Treewidth and hypertree width. In: Tractability: Practical Approaches to Hard Problems, Chap. 1. Cambridge University Press (2014)

  36. Gottlob, G., Leone, N., Scarcello, F.: Hypertree decompositions and tractable queries. JCSS 64(3) (2002)

  37. Gottlob, G., Leone, N., Scarcello, F.: Robbers, marshals, and guards: game theoretic and logical characterizations of hypertree width. JCSS 66(4) (2003)

  38. Gottlob, G., Pichler, R., Wei, F.: Monadic Datalog over finite structures of bounded treewidth. TOCL 12(1) (2010)

  39. Grȧdel, E.: Guarded fixed point logics and the monadic theory of countable trees. Theor. Comput. Sci. 288(1) (2002)

  40. Green, T. J., Karvounarakis, G., Tannen, V.: Provenance semirings. In: PODS (2007)

  41. Grohe, M., Marx, D.: Constraint solving via fractional edge covers. TALG 11(1) (2014)

  42. Imielinski, T., Lipski Jr., W.: Incomplete information in relational databases. J ACM 31(4) (1984)

  43. Leimer, H.G.: Optimal decomposition by clique separators. Discrete Math 113(1-3) (1993)

  44. Leinders, D., Marx, M., Tyszkiewicz, J., Den Bussche, J.V.: The semijoin algebra and the guarded fragment. Journal of Logic Language and Information 14(3) (2005)

  45. Malik, S.: Analysis of cyclic combinational circuits. In: ICCAD (1993)

  46. Maniu, S., Cheng, R., Senellart, P.: An indexing framework for queries on probabilistic graphs. ACM Transactions on Database Systems 42(2) (2017)

  47. Mendelzon, A. O., Wood, P.T.: Finding regular simple paths in graph databases. In: VLDB (1989)

  48. Meyer, A. R.: Weak Monadic Second Order Theory of Succesor is Not Elementary-Recursive. In: Logic Colloquium (1975)

  49. Mitchell, J. C.: The implication problem for functional and inclusion dependencies. Information and Control 56(3) (1983)

  50. Monet, M.: Probabilistic evaluation of expressive queries on bounded-treewidth instances. In: SIGMOD/PODS Phd Symposium (2016)

  51. Riedel, M. D., Bruck, J., title=Cyclic Boolean circuits. Discrete Applied Mathematics 160(13-14) (2012)

  52. Robertson, N., Seymour, P. D.: Graph minors. III. Planar tree-width. J. Comb. theory, Ser B 36(1) (1984)

  53. Robertson, N., Seymour, P. D.: Graph minors. II. Algorithmic aspects of tree-width. J Algorithms 7(3) (1986)

  54. Tarjan, R.E.: Depth-first search and linear graph algorithms. SIAM Journal on Computing (1972)

  55. Tarjan, R.E.: Decomposition by clique separators. Discrete Math 55(2) (1985)

  56. Tarjan, R. E., Yannakakis, M.: Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs. SIAM Journal on Computing 13(3) (1984)

  57. Tarski, A.: A lattice-theoretical fixpoint theorem and its applications. Pac. J. Math. 5 (1955)

  58. Thompson, K.: Programming Techniques: Regular Expression Search Algorithm. Communications of the ACM (1968)

  59. Vardi, M.Y.: The complexity of relational query languages. In: STOC (1982)

  60. Vardi, M.Y.: On the complexity of bounded-variable queries. In: PODS (1995)

  61. Yannakakis, M.: Algorithms for acyclic database schemes. In: VLDB (1981)

Download references

Acknowledgments

This work was partly funded by the Télécom ParisTech Research Chair on Big Data and Market Insights.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Mikaël Monet.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

This article is part of the Topical Collection on Special Issue on Database Theory (ICDT 2017)

Appendix: A Proof of Theorem 9

Appendix: A Proof of Theorem 9

Theorem 9 1

There is an arity-two signatureσfor which there is no algorithm\(\mathscr{A}\)withexponential running time and polynomial output size for thefollowing task: given a conjunctive query Q of treewidth≤ 2,produce an alternating two-way tree automatonAQon\({\Gamma }^{5}_{\sigma }\)-treesthat tests Q onσ-instancesof treewidth ≤ 5.

To prove this theorem, we need some notions and lemmas from [12], an extended version of [13]. Since [12] is currently unpublished, relevant results are reproduced as Appendix F of [5], in particular Lemma 68, Theorem 69, and their proofs.

Proof of Theorem 9

Let σ be \(\mathscr{S}^{\text {Bin}}{~}_{\mathsf {Ch1},\mathsf {Ch2},\mathsf {Child},\mathsf {Child^?}}\) as in Theorem 69 of [5]. We pose c = 3, kI = 2 × 3 − 1 = 5. Assume by way of contradiction that there exists an algorithm \(\mathscr{A}\) satisfying the prescribed properties. We will describe an algorithm to solve any instance of the containment problem of Theorem 69 of [5] in singly exponential time. As Theorem 69 of [5] states that it is 2EXPTIME-hard, this yields a contradiction by the time hierarchy theorem.

Let P and Q be an instance of the containment problem of Theorem 69 of [5], where P is a monadic Datalog program of var-size ≤ 3, and Q is a CQ of treewidth ≤ 2. We will show how to solve the containment problem, that is, decide whether there exists some instance I satisfying P ∧¬Q.

Using Lemma 68 of [5], compute in singly exponential time the \({\Gamma }_{\sigma }^{k_{\text {I}}}\)-bNTA AP. Using the putative algorithm \(\mathscr{A}\) on Q, compute in singly exponential time an alternating two-way automaton AQ of polynomial size. As AP describes a family \(\mathscr{I}\) of canonical instances for P, there is an instance satisfying P ∧¬Q iff there is an instance in \(\mathscr{I}\) satisfying P ∧¬Q. Now, as \(\mathscr{I}\) is described as the decodings of the language of AP, all instances in \(\mathscr{I}\) have treewidth ≤ kI. Furthermore, the instances in \(\mathscr{I}\) satisfy P by definition of \(\mathscr{I}\). Hence, there is an instance satisfying P ∧¬Q iff there is an encoding E in the language of AP whose decoding satisfies ¬Q. Now, as AQ tests Q on instances of treewidth kI, this is the case iff there is an encoding E in the language of AP which is not accepted by AQ. Hence, our problem is equivalent to the problem of deciding whether there is a tree accepted by AP but not by AQ.

We now use Theorem A.1 of [26] to compute in EXPTIME in AQ a bNTA \(A^{\prime }_{Q}\) recognizing the complement of the language of AQ. Remember that AQ was computed in EXPTIME and is of polynomial size, so the entire process so far is EXPTIME. Now we know that we can solve the containment problem by testing whether AP and \(A^{\prime }_{Q}\) have non-trivial intersection, which can be done in PTIME by computing the product automaton and testing emptiness [25]. This solves the containment problem in EXPTIME. As we explained initially, we have reached a contradiction, because it is 2EXPTIME-hard. □

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Amarilli, A., Bourhis, P., Monet, M. et al. Evaluating Datalog via Tree Automata and Cycluits. Theory Comput Syst 63, 1620–1678 (2019). https://doi.org/10.1007/s00224-018-9901-2

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00224-018-9901-2

Keywords

Navigation