DLV


The DLV 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 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.
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 .
Example Input: Datalog with Negation as Failure

smoker.
smoker.
jogger.
jogger.
healthy :- jogger, \+ smoker.

Translation to DLV: Take Clark Completion and Clausal Form

smoker <- X=john.
smoker <- X=jack.
X=john v X=jack <- smoker.
jogger <- X=jill.
jogger <- X=john.
X=jill v X=john <- jogger.
healthy v smoker <- jogger.
jogger <- healthy
<- healthy & smoker.

Example Run: Single Stable Model

?- healthy.
X = jill ;
No