Tractable Fragments of Datalog with Metric Temporal Operators

Przemyslaw Andrzej Walega, Bernardo Cuenca Grau, Mark Kaminski, Egor V. Kostylev

Abstract

Reasoning over temporal data is essential for modern applications like sensor monitoring and financial analysis. While DatalogMTL provides a robust framework for this, its PSPACE-complete complexity often renders it impractical for large-scale datasets. This paper explores the computational boundaries of DatalogMTL, identifying specific "tractable fragments" that reduce data complexity to classes like NL and TC$^0$. By strategically restricting rule structures and temporal operators, the authors demonstrate that efficient, parallelizable temporal reasoning is achievable without sacrificing the core expressive power of the language.

Introduction

In the era of "Big Data," the ability to query information that evolves over time is critical. DatalogMTL (Metric Temporal Logic) serves this need by combining the rule-based logic of Datalog with metric temporal operators. For instance, one might define a rule to trigger a cooling alert if a machine's temperature exceeds a threshold at any point within a specific past interval. However, the full expressivity of DatalogMTL comes at a high cost: reasoning is PSPACE-complete. This complexity makes it difficult to scale to massive datasets or real-time streaming environments. The research focuses on finding the "sweet spot"—subsets of the language that are expressive enough for practical use but computationally efficient.

Methodology

The authors evaluate the data complexity of various DatalogMTL fragments, focusing on how the problem scales with input data size. They introduce two primary structural restrictions:

  1. Core Fragments: Rules where the body (condition) consists of only a single atom.
  2. Linear Fragments: Rules where the body may contain multiple conditions, but only one can be recursive (an IDB atom).

Furthermore, they examine the impact of specific temporal operators, such as $\diamond$ (diamond: "at some point in the past interval"), $\boxminus$ (box: "always during the past interval"), and $S$ (since). To establish these bounds, the authors employ a "ruler" technique to discretize the continuous rational timeline and map logic problems onto structures like directed edge-weighted multigraphs and non-deterministic finite automata (NFAs).

The Complexity Landscape

The study reveals a nuanced relationship between language features and computational cost:

  • The "Since" Operator: Including the "Since" ($S$) operator, even in core fragments, maintains PSPACE-hardness due to its ability to simulate complex state changes.
  • The Past Diamond ($\diamond$): Restricting the language to the past diamond operator in the core fragment reduces complexity to TC$^0$. This is significant because TC$^0$ problems are highly parallelizable, making them suitable for modern hardware.
  • Linearity vs. Core: Moving from core to linear rules with the $\diamond$ operator increases complexity to NL-complete, matching the complexity of standard linear Datalog used in SQL recursion.
  • Operator Asymmetry: The "Always in the Past" ($\boxminus$) operator is inherently more difficult than the diamond operator. While $\diamond$ allows for TC$^0$ or NL complexity, $\boxminus$ is P-hard, indicating that "always" constraints necessitate more sequential processing.

Key Results

The research provides a comprehensive map of the complexity landscape for DatalogMTL fragments. These findings prove that tractability can be achieved by carefully selecting operators and rule structures.

Complexity landscape of DatalogMTL fragments showing the hierarchy from TC0 to PSPACE.

As shown in the diagram, the fragments range from the highly efficient DatalogMTL$^\diamond_{core}$** (TC$^0$-complete) to the more demanding DatalogMTL$^S_{core}$** (PSPACE-complete).

Conclusion and Future Work

This work establishes a theoretical foundation for efficient temporal reasoning. Future research directions include extending the analysis to "future-facing" operators, investigating combined complexity (where both rules and data grow), and developing practical query engines to test these fragments on real-world streaming data.

Summary updated

BibTeX
@inproceedings{walega2020tractable,
  author = {Przemyslaw Andrzej Walega and Bernardo Cuenca Grau and Mark Kaminski and Egor V. Kostylev},
  title = {{Tractable Fragments of Datalog with Metric Temporal Operators}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.24963/ijcai.2020/266},
}
Figure