1.4 Thesis Outline
2.2.2 Semantics
Thus far we discussed how the language of ASP is constructed. We now attach a meaning to an ASP program. Intuitively, we want the semantics of ASP to correspond with the con- clusions that can be derived from the knowledge that is expressed using an ASP program.
We start by defining the Herbrand base BP of a disjunctive program P , which is the set of atoms appearing in P . The set of literals relevant for a disjunctive ASP program is defined as LitP = (BP ∪ ¬BP). An interpretation I of a disjunctive program P is any set of literals I ⊆ LitP. A consistent interpretation is an interpretation I that does not contain both ‘a’ and ‘¬a’ for some a ∈ I.
Definition 2
A consistent interpretation I is a model of a positive disjunctive rule r if head(r)∩I 6= ∅or body(r) 6⊆ I, i.e. the body is false or the head is true.
In particular, a consistent interpretation I is a model of a constraint rule r if body(r) 6⊆ I. If for an interpretation I and a constraint rule r we have that body(r) ⊆ I, then we say that the interpretation I violates the constraint rule r. Notice that for a fact rule we require that head(r) ∩ I 6= ∅, i.e. at least one of the literals in the head must be true. Indeed, otherwise I would not be a model of r. The body of the rule can thus be seen as the preconditions under which the head of the rule, the conclusions, are true.
Definition 3
An interpretation I of a positive disjunctive program P is a model of P either if I is consistent and for every rule r ∈ P we have that I is a model of r, or if I = LitP. It follows from this definition that LitP is always a model of P , and that all other models of P (if any) are consistent interpretations, which we will further on also refer to as consistent models.
Definition 4
We say that an interpretation I is an answer set of the positive disjunctive program
P if I is a minimal model of P w.r.t. set inclusion, i.e. there does not exist another
model I0 of P such that I0 ⊂ I.
Example 6
Consider the program P6 with the rules
red; green; blue ← ball ball ←
2.2. ANSWER SET PROGRAMMING It is easy to see that this is a positive disjunctive program. We can verify that this program has two minimal models, namely M1 = {ball, red} and M2{ball, green}.
Both M1 and M2 are answer sets of P6.
Thus far we only considered positive disjunctive programs, i.e. programs without negation- as-failure. For programs with negation-as-failure, the minimal models need not necessarily correspond with our intuition.
Example 7
Consider the program P7with the rules
sunny ←
bbq ← sunny, not rain
Intuitively, this program encodes that it is sunny, and that when it is sunny and there is no indication that it rains we will hold a barbecue. This program has two minimal models. The minimal models {sunny, rain} and {sunny, bbq} both contain knowledge that was not explicitly present. Indeed, the first minimal model assumes that rain is true, whereas the second minimal model assumes that there is no evidence to support that rain is true.
Intuitively, ‘not l’ is understood as “it cannot be proven that l is true”. Given this intuition, we only want the second minimal model from P7in Example 7. To this end, the
semantics of an ASP program with negation-as-failure are based on the idea of a stable model [Gelfond and Lifschitz 1988].
Definition 5
The reduct PI of a disjunctive program P w.r.t. the interpretation I is defined as the set of rules:
PI = {l0; ...; lk ← lk+1, ..., lm | ({lm+1, ..., ln} ∩ I = ∅) and (l0; ...; lk ← lk+1, ..., lm, not lm+1, ..., not ln) ∈ P }.
Intuitively, we guess some interpretation I and use this guess to remove negation-as- failure from the original program. We discard those rules r where body−(r) ∩ I 6= ∅,
i.e. those rules that are trivially satisfied by I (since the body can intuitively not be satisfied by I), and we remove the naf-literals of the form ‘not l’ from the remaining rules.
Definition 6
An interpretation I is said to be an answer set of the disjunctive program P when I is an answer set of the positive disjunctive program PI (hence the notion of stable model).
Whenever a disjunctive program P has consistent answer sets, i.e. answer sets that are consistent interpretations, we say that P is a consistent program.2 When P has the answer
set LitP, then this is the unique [Baral 2003] inconsistent answer set and we say that P is an inconsistent program.
Example 8
Consider the normal program P8with the rules:
apple ← green ← not blue blue ← not green ← blue We have that BP = {apple, blue, green}. Three consistent interpretations of P are {apple, blue, green}, {apple, green} and {apple, blue}. The first and last interpreta- tion violate the constraint rule. Furthermore, the first interpretation is not minimal w.r.t. the other two interpretations. Only the second interpretation is a model of P . In particular, for I = {apple, green} we have that PI is the program with the set of rules
apple ← green ← ← blue
for which it is immediately clear that {apple, green} = I is the minimal model and thus the answer set of PI, i.e. I is an answer set of P . Furthermore, we say that P is a consistent program since it has consistent answer sets.
Answer sets of simple programs can also be defined in a more procedural way. Definition 7
The immediate consequence operator TP is defined for a simple program P w.r.t. an interpretation I as:
TP(I) = {l0| (l0← l1, ..., lm) ∈ P and l1, ..., lm⊆ I} .
2.2. ANSWER SET PROGRAMMING It is easy to see that this operator is monotonic and the operator is defined over a complete lattice. Due to [Tarski 1955] we then know that the least fixpoint of TP w.r.t. set inclusion can be computed by repeatedly applying TP starting from the empty interpretation ∅. We denote this least fixpoint by P?.
Proposition 1: from [Baral 2003]
Let P be a simple program without constraint rules. When the interpretation P? is consistent, P? is the unique and consistent answer set of P .
When we also want to take programs with constraint rules under consideration, we can use the observation that, in general, a program P can be written as P = P0∪ C with C
the set of constraint rules in P . When we allow constraint rules, an interpretation is a (consistent) answer set of P = P0∪ C iff I is a (consistent) answer set of P and I is a
model of C, i.e. I does not violate any constraints in C.