Datalog with Negation and Monotonicity

Authors Bas Ketsman , Christoph Koch

Thumbnail PDF


  • Filesize: 0.62 MB
  • 18 pages

Document Identifiers

Author Details

Bas Ketsman
  • École Polytechnique Fédérale de Lausanne (EPFL), Switzerland
Christoph Koch
  • École Polytechnique Fédérale de Lausanne (EPFL), Switzerland

Cite AsGet BibTex

Bas Ketsman and Christoph Koch. Datalog with Negation and Monotonicity. In 23rd International Conference on Database Theory (ICDT 2020). Leibniz International Proceedings in Informatics (LIPIcs), Volume 155, pp. 19:1-19:18, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2020)


Positive Datalog has several nice properties that are lost when the language is extended with negation. One example is that fixpoints of positive Datalog programs are robust w.r.t. the order in which facts are inserted, which facilitates efficient evaluation of such programs in distributed environments. A natural question to ask, given a (stratified) Datalog program with negation, is whether an equivalent positive Datalog program exists. In this context, it is known that positive Datalog can express only a strict subset of the monotone queries, yet the exact relationship between the positive and monotone fragments of semi-positive and stratified Datalog was previously left open. In this paper, we complete the picture by showing that monotone queries expressible in semi-positive Datalog exist which are not expressible in positive Datalog. To provide additional insight into this gap, we also characterize a large class of semi-positive Datalog programs for which the dichotomy `monotone if and only if rewritable to positive Datalog' holds. Finally, we give best-effort techniques to reduce the amount of negation that is exhibited by a program, even if the program is not monotone.

Subject Classification

ACM Subject Classification
  • Information systems → Relational database query languages
  • Theory of computation → Constraint and logic programming
  • Datalog
  • Monotonicity


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Serge Abiteboul, Meghyn Bienvenu, Alban Galland, and Émilien Antoine. A rule-based language for web data management. In Proceedings of the 30th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS 2011), pages 293-304, 2011. URL:
  2. Serge Abiteboul, Richard Hull, and Victor Vianu. Foundations of Databases. Addison-Wesley, 1995. URL:
  3. Foto N. Afrati, Stavros S. Cosmadakis, and Mihalis Yannakakis. On Datalog vs. Polynomial Time. Journal of Computer and System Sciences, 51(2):177-196, 1995. URL:
  4. Miklós Ajtai and Yuri Gurevich. Monotone versus positive. Journal of the ACM, 34(4):1004-1015, 1987. URL:
  5. Miklós Ajtai and Yuri Gurevich. Datalog vs First-Order Logic. J. Comput. Syst. Sci., 49(3):562-588, 1994. URL:
  6. Tom J. Ameloot, Jan Van den Bussche, William R. Marczak, Peter Alvaro, and Joseph M. Hellerstein. Putting logic-based distributed systems on stable grounds. Theory and Practice of Logic Programming, 16(4):378-417, 2016. URL:
  7. Tom J. Ameloot, Bas Ketsman, Frank Neven, and Daniel Zinn. Weaker Forms of Monotonicity for Declarative Networking: A More Fine-Grained Answer to the CALM-Conjecture. ACM Transactions on Database Systems, 40(4):21:1-21:45, 2016. URL:
  8. Tom J. Ameloot, Bas Ketsman, Frank Neven, and Daniel Zinn. Datalog Queries Distributing over Components. ACM Transactions on Computational Logic, 18(1):5:1-5:35, 2017. URL:
  9. Surajit Chaudhuri and Moshe Y. Vardi. On the Equivalence of Recursive and Nonrecursive Datalog Programs. In Proceedings of the 11th ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS 1992), pages 55-66, 1992. Google Scholar
  10. Anuj Dawar and Stephan Kreutzer. On Datalog vs. LFP. In Automata, Languages and Programming, 35th International Colloquium, (ICALP 2008), pages 160-171, 2008. URL:
  11. Thomas Eiter and Michael Fink. Uniform Equivalence of Logic Programs under the Stable Model Semantics. In Logic Programming, 19th International Conference (ICLP 2003), pages 224-238, 2003. URL:
  12. Tomás Feder and Moshe Y. Vardi. Homomorphism Closed vs. Existential Positive. In 18th IEEE Symposium on Logic in Computer Science (LICS 2003), pages 311-320, 2003. URL:
  13. Gaetano Geck, Bas Ketsman, Frank Neven, and Thomas Schwentick. Parallel-Correctness and Containment for Conjunctive Queries with Union and Negation. In 19th International Conference on Database Theory (ICDT 2016), pages 9:1-9:17, 2016. URL:
  14. Jim N. Gray. Notes on data base operating systems. Lecture Notes in Computer Science, 60:393-481, 1978. Google Scholar
  15. Rachid Guerraoui and Jingjing Wang. How Fast can a Distributed Transaction Commit? In Proceedings of the 36th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, (PODS'17), pages 107-122, 2017. URL:
  16. Joseph M. Hellerstein. The declarative imperative: experiences and conjectures in distributed logic. SIGMOD Record, 39(1):5-19, 2010. URL:
  17. Bas Ketsman, Aws Albarghouthi, and Paraschos Koutris. Distribution Policies for Datalog. In 21st International Conference on Database Theory (ICDT 2018), pages 17:1-17:22, 2018. URL:
  18. Phokion G. Kolaitis and Moshe Y. Vardi. On the Expressive Power of Datalog: Tools and a Case Study. J. Comput. Syst. Sci., 51(1):110-134, 1995. URL:
  19. Boon Thau Loo, Tyson Condie, Minos N. Garofalakis, David E. Gay, Joseph M. Hellerstein, Petros Maniatis, Raghu Ramakrishnan, Timothy Roscoe, and Ion Stoica. Declarative networking: language, execution and optimization. In Proceedings of the ACM SIGMOD International Conference on Management of Data (SIGMOD 2006), pages 97-108, 2006. URL:
  20. Marie-Laure Mugnier, Geneviève Simonet, and Michaël Thomazo. On the complexity of entailment in existential conjunctive first-order logic with atomic negation. Information and Computation, 215:8-31, 2012. URL:
  21. Aleksandr A. Razborov. Lower bounds on the monotone complexity of some Boolean functions. Doklady Akademii Nauk SSSR, 281:798-801, 1985. Google Scholar
  22. Benjamin Rossman. Homomorphism preservation theorems. Journal of the ACM, 55(3):15:1-15:53, 2008. URL:
  23. Sebastian Rudolph and Michaël Thomazo. Expressivity of Datalog Variants - Completing the Picture. In Proceedings of the 25th International Joint Conference on Artificial Intelligence (IJCAI 2016), pages 1230-1236, 2016. URL:
  24. Yehoshua Sagiv. Optimizing Datalog Programs. In Proceedings of the Sixth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS 1987), pages 349-362, 1987. URL:
  25. Alexei P. Stolboushkin. Finitely Monotone Properties. In Proceedings, 10th Annual IEEE Symposium on Logic in Computer Science, pages 324-330, 1995. URL:
  26. Jeffrey D. Ullman. Information integration using logical views. Theoretical Computer Science, 239(2):189-210, 2000. URL:
  27. Ouri Wolfson and Abraham Silberschatz. Distributed Processing of Logic Programs. In Proceedings of the 1988 ACM SIGMOD International Conference on Management of Data (SIGMOD 1988), pages 329-336, 1988. URL:
  28. Daniel Zinn, Todd J. Green, and Bertram Ludäscher. Win-Move is Coordination-Free (Sometimes). CoRR, abs/1312.2919, 2013. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail