• No results found

Complexity of ASP

1.4 Thesis Outline

2.2.3 Complexity of ASP

When we want to analyse the complexity of ASP, we are not only interested in the answer sets themselves but also in a number of reasoning tasks. In particular, we are interested in whether a consistent answer set exists and whether a given literal is true in some or all answer sets of the program.

Definition 8

Let P be a disjunctive ASP program. We use |=band |=c to denote brave inference

and cautious inference, respectively, in ASP, i.e.

• P |=bl iff ∃M · M is an answer set of P and l ∈ M;

• P |=cl iff 6 ∃M · M is an answer set of P and l /∈ M.

Depending on the syntactic properties of our ASP program, the computational complexity of these reasoning tasks can vary considerably.

Proposition 2: from [Baral 2003, Eiter and Gottlob 1995a]

Let P be an answer set program. Answer set existence, i.e. determining wether P has a consistent answer set is:

• ΣP

• NP-complete when P is a positive disjunctive program; • NP-complete when P is a normal program;

• P-complete when P is a simple program; • P-complete when P is a definite program.

Proposition 3: from [Baral 2003, Eiter and Gottlob 1995a]

Let P be an answer set program. Let ‘l’ be a literal. Brave reasoning, i.e. determining whether P |=bl, is:

• ΣP

2-complete when P is a disjunctive program;

• ΣP

2-complete when P is a positive disjunctive program;

• NP-complete when P is a normal program; • P-complete when P is a simple program; • P-complete when P is a definite program.

Proposition 4: from [Baral 2003, Eiter and Gottlob 1995a]

Let P be an answer set program. Let ‘l’ be a literal. Cautious reasoning, i.e. determ- ining whether P |=cl, is:

• ΠP

2-complete when P is a disjunctive program;

• coNP-complete when P is a positive disjunctive program; • coNP-complete when P is a normal program;

• P-complete when P is a simple program; • P-complete when P is a definite program.

Recalling the canonical problems from Section 2.1, this means that we can use brave reasoning over a disjunctive program to simulate a QBF of the form ∃X1∀X2· p(X1, X2).

However, to simulate such a QBF we need a technique called saturation. This technique was first proposed in [Eiter and Gottlob 1995b] and plays an important role in a number of proofs in this thesis.

Proposition 5: from [Baral 2003]

Let φ ≡ ∃X1∀X2· p(X1, X2) be a QBF with p(X1, X2) an expression in DNF,

i.e. p(X1, X2)is of the form θ1∨...∨θnwith θifor 1 ≤ i ≤ n a conjunction of literals

2.2. ANSWER SET PROGRAMMING program Pφ be defined as the set of rules:

{x; x0← | x ∈ (X 1∪ X2)} (2.1) ∪ {sat ← θ0i| 1 ≤ i ≤ n} (2.2) ∪ {x ← sat | x ∈ X2} ∪ {x0← sat | x ∈ X2} (2.3) with θ0

i obtained from θi by replacing every occurrence of ¬x by x0, e.g. when

θi= (x ∧ ¬y ∧ z)we have θ0i= (x ∧ y0∧ z). The QBF φ is satisfiable if and only if

|=bsat.

We refer the reader to [Baral 2003] for the proof of Proposition 5. Because the saturation technique used in Proposition 5 plays an important role in a number of proofs in Chapter 4 and 5, we briefly explain the intuition behind saturation below and illustrate it with 2 small examples.

The intuition of the program is that an assignment is guessed in (2.1). The rules in (2.2) verify whether this assignment makes the expression p(X1, X2) true. The saturation is

applied in the rules (2.3) and makes use of the definition of an answer set as a minimal model to enforce that ‘sat’ will only be contained in an answer set when the expression

p(X1, X2) is true for every possible assignment of variables in X2. Indeed, let M be a

model of Pφ that contains literals corresponding to the variables of X1 and X2, i.e. M

defines an assignment of X1 and X2, such that the expression p(X1, X2)is true. Due to

the rules (2.2) we have sat ∈ M and, due to the rules (2.3), M must contain literals corresponding with all the possible assignments of X2.

Now suppose that there exists some other model M0 of Pφ that defines the same as-

signment of X1 as M, but another assignment for X2. In particular, assume that M0

defines an assignment of X2such that the expression p(X1, X2)is false. Then due to the

rules (2.2) this means that sat /∈ M0. However, due to the rules (2.3) we had that M

contains literals corresponding with every possible assignment of X2, i.e. we must have

M0 ⊂ M. Clearly, in this case M is not a minimal model of Pφ and thus not an answer

set. Only if we are unable to find an M0 that defines an assignment of X

2 such that the

expression p(X1, X2) is false will we be able to have an answer set M of Pφ such that

sat ∈ M and thus Pφ |=b sat.

Example 9

Consider the QBF φ ≡ ∃x1, x2∀y1, y2 · p(x1, x2, y1, y2) with p(x1, x2, y1, y2) the

take y1and y2to be false, then p(x1, x2, y1, y2)is false for every choice of assignment

for x1, x2.

We have that Pφ according to Proposition 5 is the set of rules:

x1; x01← y1; y10 ←

x2; x02← y2; y20 ←

sat ← x1, y1 y1← sat y01← sat

sat ← x2, y2 y2← sat y02← sat

Let us consider the interpretations I1 = {x1, x2, y1, y2} and I2 = {x1, x2, y10, y02}.

The first interpretation is a representation of an assignment where we take all the vari- ables to be true. Specifically, in that case we have that the formula p(x1, x2, y1, y2)

is true. The second interpretation corresponds with an identical assignment of x1

and x2, but where we take y1and y2to be false. For this assignment, as we already

discussed, we have that the formula p(x1, x2, y1, y2)is false.

It is clear that I1is a model of the topmost four rules. However, we need to extend

I1 for it to be a model of the bottommost six rules. Indeed, we need to add the

set of literals {sat, y0

1, y02} to I1 to make it a model of Pφ. As such, we find that

I10 = {x1, x2, y1, y2, sat, y10, y02}is a model of Pφ. We can verify that I2 is a model

of Pφ, without the need for adding literals. As such, we have found that I0 1 and I2

are models of Pφ, although I2 ⊂ I10. It can in fact be shown that of the models

I10 and I2only I2is an answer set of Pφ. Thus, by using saturation, we prevented I10

from being a minimal model. Example 10

Consider the QBF φ0 ≡ ∃x

1, x2∀y1, y2· p(x1, x2, y1, y2) with p(x1, x2, y1, y2) the

formula (x1∧ x2) ∨ (y1∧ y2). This is a QBF with the same variables but with a

different formula. This QBF is satisfiable. Indeed, when assigning true to x1and x2

the formula p(x1, x2, y1, y2)is true for every choice of assignment for y1 and y2.

We have that Pφ0 according to Proposition 5 is the set of rules:

x1; x01← y1; y01←

x2; x02← y2; y02←

sat ← x1, x2 y1← sat y10 ← sat

2.2. ANSWER SET PROGRAMMING We again consider the interpretations I1= {x1, x2, y1, y2}and I2= {x1, x2, y10, y20}.

As before, we need to extend I1 with {sat, y01, y20} for it to be a model of Pφ0.

We can then verify that I0

1 = {x1, x2, y1, y2, sat, y01, y02} is indeed a model of Pφ0.

This time around, however, I2 = {x1, x2, y01, y20} is not yet a model of Pφ0. In-

deed, we need to extend I2 with the set of atoms {sat, y1, y2} to obtain I20 =

{x1, x2, y01, y20, sat, y1, y2}, which is a model of Pφ0. Unlike in the previous example, we do not have I0

2⊂ I10 but instead find that I10 = I20. Furthermore, it can be shown

that I0

1 is a minimal model, i.e. an answer set of Pφ0. We thus find that sat is true

in an answer set of Pφ0, i.e. we have verified that the QBF φ0 is satisfiable.