HOME

TheInfoList



OR:

The DLV (DataLog with Disjunction, where the
logical disjunction In logic, disjunction is a logical connective typically notated as \lor and read aloud as "or". For instance, the English language sentence "it is raining or it is snowing" can be represented in logic using the disjunctive formula R \lor ...
symbol V is used) system is a disjunctive
logic programming Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic pro ...
system, implementing the stable model semantics under the answer set programming paradigm. It extends the
Datalog Datalog is a declarative logic programming language. While it is syntactically a subset of Prolog, Datalog generally uses a bottom-up rather than top-down evaluation model. This difference yields significantly different behavior and properties ...
language to allow the use of OR in the heads of 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.


Programming example

The following is a program in Datalog extended with
negation as failure Negation as failure (NAF, for short) is a non-monotonic inference rule in logic programming, used to derive \mathrm~p (i.e. that ~p is assumed not to hold) from failure to derive ~p. Note that \mathrm ~p can be different from the statement \neg p ...
: smoker(john). smoker(jack). jogger(jill). jogger(john). healthy(X) :- jogger(X), \+ smoker(X). This is the translation of the above program into 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).
The following query has a single stable model:
?- healthy(X).
X = jill ;
No


References


External links


DLV user manual


Query languages Logic programming languages {{compu-lang-stub