The Complexity of Datalog on Linear Orders
We study the program complexity of datalog on both finite and infinite linear orders. Our main result states that on all linear orders with at least two elements, the nonemptiness problem for datalog is EXPTIME-complete. While containment of the nonemptiness problem in EXPTIME is known for finite linear orders and actually for arbitrary finite structures, it is not obvious for infinite linear orders. It sharply contrasts the situation on other infinite structures; for example, the datalog nonemptiness problem on an infinite successor structure is undecidable. We extend our upper bound results to infinite linear orders with constants. As an application, we show that the datalog nonemptiness problem on Allen’s interval algebra is EXPTIME-complete.
💡 Research Summary
The paper investigates the program‑complexity of Datalog when evaluated over linear orders, covering both finite and infinite domains. The central question is whether the non‑emptiness problem—determining whether a given Datalog program derives at least one fact in its least model—remains tractable on infinite linear orders, where other infinite structures (e.g., the natural numbers with the successor relation) already render the problem undecidable. The authors answer affirmatively: on any linear order containing at least two elements, the non‑emptiness problem is EXPTIME‑complete.
The authors begin by recalling that for arbitrary finite structures the non‑emptiness problem belongs to EXPTIME, a result that follows from the boundedness of Datalog derivations and the ability to simulate the evaluation with a deterministic exponential‑time Turing machine. However, this containment does not automatically extend to infinite structures because the usual finiteness arguments (e.g., the existence of a finite Herbrand base) break down. To overcome this obstacle, the paper introduces a novel abstraction based on interval types. In a linear order, any pair of elements (a, b) with a < b defines an interval, and the authors show that, up to logical equivalence relevant for Datalog derivations, there are only finitely many such interval types regardless of whether the underlying order is finite or infinite. The types capture whether the interval is empty, contains finitely many points, or is unbounded, together with the relative positions of any constants that may be present.
Using interval types, each Datalog rule is transformed into a finite set of type‑transition rules. For instance, a binary rule R(x, y) :- S(x, z), T(z, y) becomes a transition that, given the type of the interval (x, z) and the type of (z, y), determines the possible type of (x, y). Consequently, the whole program can be represented as a finite transition system whose states are tuples of interval types and whose edges correspond to rule applications. The evaluation of the program then reduces to a reachability problem in this finite graph. Because the number of interval types is bounded by a polynomial in the size of the program, the state space grows at most exponentially, and a deterministic Turing machine can explore it in exponential time. This yields the EXPTIME upper bound for both finite and infinite linear orders, and the construction easily accommodates additional constant symbols by extending the type vocabulary.
For the lower bound, the authors give a polynomial‑time reduction from a known EXPTIME‑hard problem, such as the acceptance problem for alternating Turing machines with polynomial time bounds or the succinct circuit value problem. The reduction encodes the computation of the source problem into a Datalog program over a linear order by representing configurations as intervals and using Datalog rules to simulate transition steps. The program derives a distinguished goal fact if and only if the original machine accepts, establishing EXPTIME‑hardness of the Datalog non‑emptiness problem on linear orders.
The paper further shows that the same techniques apply when the linear order is enriched with a finite set of constants. Constants merely refine interval types (e.g., an interval may start or end at a constant), but they do not increase the number of distinct types beyond a constant factor, so the EXPTIME bound persists.
As a concrete application, the authors consider Allen’s interval algebra, a qualitative temporal reasoning framework consisting of 13 basic relations between time intervals. By representing each interval as a pair of points in a linear order and translating Allen’s relations into Datalog rules, they embed the algebra into the same setting. The previously proved EXPTIME‑completeness for linear orders immediately yields that the Datalog non‑emptiness problem for Allen’s algebra is also EXPTIME‑complete.
In summary, the paper makes three major contributions: (1) it establishes that Datalog non‑emptiness on any linear order with at least two elements is EXPTIME‑complete, closing a gap between finite and infinite domains; (2) it introduces a robust abstraction—interval types and finite type‑transition systems—that may be useful for analyzing Datalog on other infinite structures; and (3) it applies the result to a well‑known temporal reasoning formalism, showing that even in expressive qualitative algebras the Datalog non‑emptiness problem remains within EXPTIME. This work deepens our understanding of the computational limits of Datalog in ordered domains and provides a solid theoretical foundation for designing efficient Datalog‑based reasoning engines in temporal and spatial applications.
Comments & Academic Discussion
Loading comments...
Leave a Comment