From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

The DLV (DataLog with Disjunction, where the logical disjunction symbol V is used) system is a disjunctive logic programming system, implementing the stable model semantics under the Answer set programming paradigm. It extends the datalog language to allow the use of OR in rules.

Briefly, disjunctive Datalog is a variant of Datalog where disjunctions may appear in the rule heads; advanced versions also allow for negation in the bodies, which can be handled according to a semantics for negation in disjunctive logic programming.

A disjunctive Datalog rule is a clause of the form:

A disjunctive Datalog constraint is a clause of the form:

One of the most popular nonmonotonic logics is Reiter’s [1980] default logic. This logic was developed as a knowledge representation formalism and was originally not conceived as a database query language. However, a suitable setting was defined in which default logic can be used as a query language for relational databases (Default Query Language, DQL).

From a practical point of view, in the context of deductive databases disjunctive Datalog seems to be the more suitable extension of DATALOG~ than DQL. Due to its plain syntax, DATALOGv,~ is amenable to automatic program analysis and optimization.

These results are not only of theoretical interest; problems relevant in practice such as computing the optimal tour value in the Traveling Salesman Problem and eigenvector computations can be handled in disjunctive Datalog, but not Datalog with negation (unless the Polynomial Hierarchy collapses).[1]

Example Input: Datalog with Negation as Failure



healthy(X) :- jogger(X), \+ smoker(X).

Translation to DLV: Take Clark Completion and Clausal Form

smoker(X) <- X=john.
smoker(X) <- X=jack.
X=john v X=jack <- smoker(X).

jogger(X) <- X=jill.
jogger(X) <- X=john.
X=jill v X=john <- jogger(X).

healthy(X) v smoker(X) <- jogger(X).
jogger(X) <- healthy(X)
<- healthy(X) & smoker(X).

Example Run: Single Stable Model

?- healthy(X).
X = jill ;


  1. ^ Eiter, T., Gottlob, G. and Mannila, H. (2001): Disjunctive Datalog, ACM Transactions on Database Systems 22(3), July 2001 [1]

External links[edit]