On the Complexity of Single-Rule Datalog Queries

  • Georg Gottlob
  • Christos Papadimitriou
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1705)

Abstract

Datalog is a well-known database query language based on the logic programming paradigm. A general datalog program consists of a number of rules and facts. Programs containing a unique rule and possibly some facts are called single rule programs (sirups). We study both the combined and the program complexity of sirups, ie., the complexity of evaluating sirups over variable and fixed databases, respectively. Moreover, we study the descriptive complexity of sirups, i.e., their expressive power. In all cases it turns out that even very restricted classes of sirups have the same complexity and essentially the same expressive power as general datalog programs. We show that the evaluation of single clause programs is EXPTIME complete (combined complexity), and, if restricted to linear recursive rules, PSPACE complete. Moreover, sirups with one recursive rule and one additional fact capture PTIME on ordered structures, if a certain data representation is assumed and certain predefined relations are provided. Our results are obtained by a uniform product construction which maps a datalog program into a single rule by essentially maintaining its semantics. We also prove that the datalog clause implication problem, i.e., deciding whether a datalog clause implies another one, is EXPTIME complete.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    S. Aanderaa. On the Decision Problem for Formulas in which all Disjunctions are binary. Proc. of the 2nd Scandinavian Logic Symposium, pp. 1–18, North Holland Publishing Company, 1971.Google Scholar
  2. 2.
    S. Abiteboul. Boundedness is undecidable for datalog programs with a single recursive rule. Information Processing Letters, 32(6):281–289, 1989.MATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    S. Abiteboul, R. Hull, and V. Vianu. Foundations of Databases. Addison-Wesley, 1995.Google Scholar
  4. 4.
    F. Afrati and C. H. Papadimitriou. The parallel complexity of simple logic programs. Journal of the Association for Computing Machinery, 40(4):891–916, 1993.MATHMathSciNetGoogle Scholar
  5. 5.
    E. Börger Reduktionstypen in Krom-und Hornformeln. Ph.D. Dissertation, Minister, Germany, 1971.Google Scholar
  6. 6.
    E. Börger, E. Grädel, and Y. Gurevich. The Classical Decision Problem. Springer, Berlin Heidelberg, 1997.MATHGoogle Scholar
  7. 7.
    S. Ceri, G. Gottlob, and L. Tanca. Logic Programming and Databases. Surveys in Computer Science. Springer Verlag, 1990.Google Scholar
  8. 8.
    A. K. Chandra, H. Lewis, and J. Makowsky. Embedded implicational dependencies and their inference problem. In ACM Symposium on Theory of Computing (STOC), pages 342–354, 1981.Google Scholar
  9. 9.
    A. Chandra and P. Merlin. Optimal implementation of conjunctive queries in relational databases. In Proc. Ninth ACM Symposium on the Theory of Computing, pages 77–90, 1977.Google Scholar
  10. 10.
    E. Dantsin, T. Eiter, G. Gottlob, and A. Voronkov. Complexity and expressive power of logic programming. In Proceedings Twelfth Annual IEEE Conference on Computational Complexity, pages 82–101, Ulm, Germany, June 1997. Full version available from the authors.Google Scholar
  11. 11.
    P. Devienne, P. Lebègue, and J.-C. Routier. Halting problem of one binary Horn clause is undecidable. In P. Enjalbert, A. Finkel, and K. Wagner, editors, Proceedings Tenth Symposium on Theoretical Aspects of Computing (STACS-93), number 665 in LNCS, pages 48–57, Würzburg, February 1993. Springer.Google Scholar
  12. 12.
    H.-D. Ebbinghaus and J. Flum. Finite Model Theory. Perspectives in Mathematical Logic. Springer, 1995.Google Scholar
  13. 13.
    M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. In Proc. 5th International Conference and Symposium on Logic Programming, pages 1070–1080. The MIT Press, 1988.Google Scholar
  14. 14.
    G. Gottlob. Subsumption and implication. Information Processing Letters, 24(2):109–111, 1987.MATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    E. Grädel. The Expressive Power of Second-Order Horn Logic. In Proceedings STACS-91, LNCS 480, pages 466–477, 1991.CrossRefGoogle Scholar
  16. 16.
    E. Grädel. Capturing Complexity Classes with Fragments of Second Order Logic. Theoretical Computer Science, 101:35–57, 1992.MATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    Y. Gurevich. Logic and the Challenge of Computer Science. In E. Börger, editor, Trends in Theoretical Computer Science, chapter 1. Computer Science Press, 1988.Google Scholar
  18. 18.
    P. Hanschke and J. Würtz. Satisfiability of the smallest binary program. Information Processing Utters, 45(5):237–241, 1993.MATHCrossRefGoogle Scholar
  19. 19.
    G. G. Hillebrand, P. C. Kanellakis, H. G. Mairson, and M. Y. Vardi. Undecidable boundedness problems for datalog programs. Journal of Logic Programming, 25(2):163–190, 1995.MATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    N. Immerman. Relational queries computable in polynomial time. Information and Control, 68:86–104, 1986.MATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    N. Immerman. Descriptive Complexity Theory. Springer, 1998 (to appear).Google Scholar
  22. 22.
    P. Kanellakis. Logic programming and parallel complexity. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pp. 547–586. Morgan Kaufmann, 1988.Google Scholar
  23. 23.
    J. U. Kietz, S. Dzeroski. Inductive Logic Programming and Learnability. SIGART Bulletin 5(1), pp. 22–32,1994.CrossRefGoogle Scholar
  24. 24.
    H. Lewis. Krom Formulas with One Dyadic Predicate Letter. Journal of Symbolic Logic, 46(2):341–362, 1976.Google Scholar
  25. 25.
    J. Marcinkowski. The 3 frenchmen method proves undecidability of the uniform boundedness for single recursive rule ternary DATALOG programs. In ACM Symposium on Theory of Computing (STOC), volume 1046 of Lecture Notes in Computer Science, pages 427–438. Springer Verlag, 1996.Google Scholar
  26. 26.
    J. Marcinkowski. DATALOG SIRUPs uniform boundedness is undecidable. In Proc. IEEE Conference on Logic in Computer Science (LICS), pages 13–24. IEEE Computer Society Press, 1996.Google Scholar
  27. 27.
    J. Marcinkowski and L. Pacholski. Undecidability of the Horn-clause implication problem. In Proc. IEEE International Conference of Foundations of Computer Science (FOCS), pages 354–362. IEEE Computer Society Press, 1992.Google Scholar
  28. 28.
    L. J. Stockmeyer. The Polynomial-Time Hierarchy. Theoretical Computer Science, 3:1–22, 1977.MATHCrossRefMathSciNetGoogle Scholar
  29. 29.
    J. D. Ullman and A. van Gelder. Parallel complexity of logical query programs. Algorithmica, 3:5–42, 1988.MATHCrossRefMathSciNetGoogle Scholar
  30. 30.
    J. Ullman. Database and Knowledge-Base Systems, volume I. Computer Science Press, 1988.Google Scholar
  31. 31.
    J. Ullman. Database and Knowledge-Base Systems, volume II. Computer Science Press, 1989.Google Scholar
  32. 32.
    M. Vardi. Complexity of Relational Query Languages. In Proceedings 14th STOC, pages 137–146, San Francisco, 1982.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Georg Gottlob
    • 1
  • Christos Papadimitriou
    • 1
  1. 1.Computer Science Division, Dept of Electrical Engineering and Computer ScienceUniversity of California, BerkeleyBerkeley

Personalised recommendations