DatalogZ


DatalogZ is an extension of Datalog with integer arithmetic and comparisons. The decision problem of whether or not a given ground atom is entailed by a DatalogZ program is RE-complete, which can be shown by a reduction to diophantine equations.

Syntax

The syntax of DatalogZ extends that of Datalog with numeric terms, which are integer constants, integer variables, or terms built up from these with addition, subtraction, and multiplication. Furthermore, DatalogZ allows, which are atoms of the form t < s or t <= s for numeric terms t, s.

Semantics

The semantics of DatalogZ are based on the model-theoretic (Herbrand) semantics of Datalog.

Limit DatalogZ

The undecidability of entailment of DatalogZ motivates the definition of limit DatalogZ. Limit DatalogZ restricts predicates to a single numeric position, which is marked maximal or minimal. The semantics are based on the model-theoretic semantics of Datalog. The semantics require that Herbrand interpretations be to qualify as models, in the following sense: Given a ground atom of a limit predicate where the last position is a max position, if is in a Herbrand interpretation, then the ground atoms for must also be in for to be limit-closed.

Example

Given a constant w, a binary relation edge that represents the edges of a graph, and a binary relation sp with the last position of sp minimal, the following limit DatalogZ program computes the relation sp, which represents the length of the shortest path from w to any other node in the graph:

sp :-.
sp :- sp, edge.