The Complexity of Reasoning for Fragments of Autoepistemic

Nadia Creignou Laboratoire d’Informatique Fondamentale, CNRS, Aix-Marseille Universite´ 163, avenue de Luminy, 13288 Marseille, France [email protected] Arne Meier, Michael Thomas, Heribert Vollmer Institut fur¨ Theoretische Informatik, Gottfried Wilhelm Leibniz Universitat¨ Appelstr. 4, 30167 Hannover, Germany {meier,thomas,vollmer}@thi.uni-hannover.de

Abstract duced. Stable expansions are defined as the fixed points of an operator deriving the logical consequences of the agent’s Autoepistemic logic extends propositional logic by the knowledge and . A given knowledge base may admit L. A formula ϕ that is preceded by an L is no or several such stable expansions. Hence, the following said to be “believed”. The logic was introduced by Moore questions naturally arise. Given a knowledge base Σ, does 1985 for modeling an ideally rational agent’s behavior and Σ admits a stable expansion at all? And given a knowledge reasoning about his own beliefs. In this paper we analyze base Σ and a formula ϕ, is ϕ contained in at least one (resp. all Boolean fragments of autoepistemic logic with respect all) stable expansion of Σ. to the computational complexity of the three most common While all these problems are undecidable for first-order decision problems expansion existence, brave reasoning and autoepistemic logic, they are situated at the second level of cautious reasoning. As a second contribution we classify the polynomial hierarchy in the propositional case [12]; and the computational complexity of counting the number of thus harder to solve than the classical satisfiability or impli- stable expansions of a given knowledge base. To the best of cation problem unless the polynomial hierarchy collapses our knowledge this is the first paper analyzing the counting below its second level. This increase in complexity raises problem for autoepistemic logic. the question for the sources of the hardness on the one hand, and for tractable restrictions on the other hand. In this paper, we study the computational complexity of 1. Introduction the three decision problems mentioned above for fragments of autoepistemic logic, given by restricting the propositional part, i.e., by restricting the set of allowed Boolean connec- Non-monotonic are among the most important tives. We bound the complexity of all three reasoning tasks calculi in the area of knowledge representation and reasoning. for all finite sets of allowed Boolean functions. This ap- Autoepistemic logic, introduced 1985 by Moore [20], is proach has first been taken by Lewis, who showed that the one of the most prominent non-monotonic logic. It was satisfiability problem for (pure) propositional logic is NP- originally created to overcome difficulties present in the complete if the negation of the implication (x 6→ y) can non-monotonic modal logics proposed by McDermott and be composed from the set of available Boolean connectives, Doyle [18], but was also shown to embed several other non- and is polynomial-time solvable in all other cases. Since monotonic formalisms such as Reiter’s default logic [25] or then, this approach has been applied to a wide range of prob- McCarthy’s circumscription [17]. lems including equivalence and implication problems [26, 5], Autoepistemic logic extends classical logic with a unary satisfiability and model checking in modal and temporal log- modal operator L expressing the beliefs of an ideally ratio- ics [2, 4, 3, 19], default logic [6], and circumscription [28]. nal agent. The sentence Lϕ means that the agent can derive ϕ based on its knowledge. To formally capture the set of Our goal is to exhibit fragments of lower complexity beliefs of an agent, the notion of stable expansions was intro- which might lead to better algorithms for cases in which the set of Boolean connectives can be restricted. Furthermore ∗Supported in part by DFG grant VO 630/6-1. we aim to understand the sources of hardness and to provide

1

Dagstuhl Seminar Proceedings 10061 Circuits, Logic, and Games http://drops.dagstuhl.de/opus/volltexte/2010/2523 an understanding which connectives take the role of (x 6→ y) that exhibits an odd number of accepting paths iff x ∈ L in the context of autoepistemic logic. for all x [8]. It is known that L ⊆ ⊕L ⊆ P. Regarding Though at first sight, an infinite number of sets B of hardness proofs of decision problems, we consider logspace allowed propositional connectives has to be examined, we many-one reductions, defined as follows: a language A is prove, making use of results from universal algebra, that logspace many-one reducible to some language B (written log essentially only seven cases can occur: (1) B can express A ≤m B) if there exists a logspace-computable function f all Boolean connectives, (2) B can express all monotone such that x ∈ A ⇐⇒ f(x) ∈ B. Boolean connectives, (3) B can express all linear connec- In the context of counting problems, denote by FP the tives, (4) B is equivalent to {∨}, (5) B is equivalent to {∧}, set of all functions computable in polynomial time, and for (6) B is equivalent to {¬}, (7) B is empty. We first show, an arbitrary complexity class C, define #·C as the class the extending Gottlob’s results, that the above problems are functions f for which there exists a set A ∈ C (the witness complete for a class from the second level of the polynomial set for f) such that there exists a polynomial p such that for hierarchy for the cases (1) and (2). In case (4) the complexity all (x, y) ∈ A, |y| ≤ p(x) , and drops to completeness for a class from the first level of the hierarchy, whereas for (3) the problem becomes solvable in f(x) = {y | (x, y) ∈ A} , polynomial time while being hard for ⊕L. Finally, for the cases (5) to (7) it even drops down to solvability in logspace. see [13]. In particular, we make use of the classes #P := #·P #·coNP Besides the decision variant, another natural question and . To obtain hardness results for counting parsimonious reductions is concerned with the number of stable expansions. This problems, we will employ defined f refers to the so called counting problem for stable expan- as follows: A counting function parsimoniously reduces h g ∈ FP sions. Recently, counting problems have gained quite a lot to function if there is a function such that for x f(x) = hg(x) of attention in non-monotonic logics. For circumscription, all , . Note the analogy to the simple m the counting problem (that is, determining the number of -reductions for decision problems defined above. minimal models of a propositional formula) has been studied We moreover assume familiarity with propositional logic. in [11, 10]. For propositional abduction, a different non- As we are going to consider problems parameterized by monotonic logic, some complexity results for the counting the set of Boolean connectives, we require some algebraic problem (that is, computing the number of so called “solu- tools to classify the complexity of the infinitely many aris- clone B tions” of a propositional abduction problem) were presented ing problems. A is a set of Boolean functions that i.e. B in [14, 9]. Algorithms based on bounded treewidth have is closed under superposition, , contains all projec- been proposed in [15] for the counting problems in abduc- tions and is closed under arbitrary compositions(see [23, B tion and circumscription. Here, we consider the complexity Chapter 1] or [7]). For a set of Boolean functions, we [B] B of the problem to count the number of stable expansions denote by the smallest clone containing and call B base [B] for a given knowledge base. To the best of our knowledge, a for . Post classified the lattice of all clones this problem is addressed here for the first time. We show and found a finite base for each clone [24]. A list of all that it is #·coNP-complete in cases (1) and (2) from the Boolean clones together with a basis for each of them can e.g. above, drops to #P-completeness for the case (4), and is be found, , in [7]. In order to introduce the clones rel- n polynomial-time computable in cases (3) and (5) to (7). evant to this paper, say that an -ary Boolean functions f monotone a ≤ b , a ≤ b , . . . , a ≤ b The rest of this paper is organized is follows. Sections 2 is if 1 1 2 2 n n im- f(a , . . . , a ) ≤ f(b , . . . , b ) f linear and 3 contain preliminaries and the formal definition of au- plies 1 n 1 n , and that is f ≡ x ⊕ · · · ⊕ x ⊕ c c ∈ {0, 1} toepistemic logic. In Section 4 we classify the complexity of if 1 n for a constant and vari- x , . . . , x the decision problems mentioned above for all finite sets of ables 1 n. The clones relevant to this paper together allowed Boolean functions. Section 5 contains the classifica- with their bases are listed in Table 1. tion of the problem to count the number of stable expansion. Finally, Section 6 concludes with a discussion of the results. 3. Autoepistemic Logic

2. Preliminaries Autoepistemic logic extends propositional logic by a modal operator L stating that its argument is “believed”. Syntactically, the set of autoepistemic formulae L is de- We use standard notions of complexity theory. For deci- ae fined defined via sion problem, the arising complexity degrees encompass the p p classes L, P, NP, coNP, Σ2 and Π2 . For more background ϕ ::= p | f(ϕ, . . . , ϕ) | Lϕ, information, the reader is referred to [22]. We furthermore require the class ⊕L defined as the class of languages L such where f is a Boolean function and p is a proposition. The that there exists a nondeterministic logspace Turing machine consequence relation |= of the underlying propositional logic

2 Name Definition Base BF All Boolean functions {∧, ¬} M {f : f is monotone} {∨, ∧, 0, 1} L {f : f is linear} {⊕, 1} Wn V {f : f ≡ c0 ∨ i=1 cixi where the cis are constant} {∨, 0, 1} Vn E {f : f ≡ c0 ∧ i=1 cixi where the cis are constant} {∧, 0, 1} N {f : f depends on at most one variable} {¬, 0, 1} I {f : f is a projection or a constant} {id, 0, 1}

Table 1. A list of Boolean clones with definitions and bases.

L is extended to Lae by simply treating Lϕ as an atomic for- Definition 3.2. For a set Σ ⊆ Lae, a set Λ ⊆ SF (Σ) ∪ mula. An (autoepistemic) B-formula is an autoepistemic ¬SFL(Σ) is Σ-full if for each Lϕ ∈ SFL(Σ), formula using only functions from a finite set B of Boolean functions as connectives. The set of all autoepistemic B- 1. Σ ∪ Λ |= ϕ iff Lϕ ∈ Λ, formulae will be denoted by Lae(B). 2. Σ ∪ Λ 6|= ϕ iff ¬Lϕ ∈ Λ. Let B be any finite set of Boolean functions. For Σ ⊆ Lae(B), we write Th(Σ) for the deductive closure of Σ, i.e., Lemma 3.3 ([21]). Let Σ ⊆ Lae. Th(Σ) := {ϕ | Σ |= ϕ}. For ϕ ∈ L (B), let SF(ϕ) be ae L the set of its subformulae and let SFL(ϕ) := {Lψ | Lψ ∈ 1. Let Λ be a Σ-full set, then for every Lϕ ∈ SF (Σ) SF(ϕ)} be the set of its L-prefixed subformulae. The above either Lϕ ∈ Λ or ¬Lϕ ∈ Λ. notions are canonically extended to sets of formulae. 2. There is a one-to-one correspondence of Σ-full sets and The key notion in autoepistemic logic are stable sets of stable expansions of Σ. beliefs grounded on the given premises. These sets, called stable expansions, are defined as the fixed points of the To make this one-to-one correspondence more precise, consequences of knowledge and belief. say that a formula is quasi-atomic if it is atomic or else begins with an L. Further denote by SFq(ϕ) the set of all Definition 3.1. Let Σ ⊆ Lae(B). A set ∆ ⊆ Lae is a stable expansion of Σ if it satisfies the condition maximal quasi-atomic subformulae of ϕ (in the sense that a quasi-atomic subformula is maximal if it is not a subformula ∆ = Th(Σ ∪ L(∆) ∪ ¬L(∆))¯ , of another quasi-atomic subformula of ϕ). Write SE(Λ) for the stable expansion corresponding to Λ and say that Λ is its where L(∆) := {Lϕ | ϕ ∈ ∆} and ¬L(∆)¯ := {¬Lϕ | kernel. ϕ 6∈ ∆}. The three main decision problems in the context of Definition 3.4. Let Σ ⊆ Lae and let ϕ ∈ Lae. We define autoepistemic logic are deciding whether a given set of the consequence relation |=L recursively as premises has a stable expansion, and deciding whether a Σ |= ϕ ⇐⇒ Σ ∪ SB(ϕ) |= ϕ, given formula in contained in at least one (resp. all) stable L expansion. As we are to study the complexity of these prob- q where SB(ϕ) := {Lχ ∈ SF (ϕ) | Σ |=L χ} ∪ {¬Lχ | lems for finite restricted sets B of Boolean functions, we q Lχ ∈ SF (ϕ), Σ 6|=L χ}. formally define the expansion existence problem as The point in defining the consequence relation |= is Problem: EXP(B) L that, once a Σ-full set has been determined, it describes Input: A set Σ ⊆ L (B) ae membership in the stable expansion corresponding to Λ. Output: Does Σ have a stable expansion? Lemma 3.5 ([21]). Let Σ ⊆ L , let Λ be a Σ-full set and and the brave (resp. cautious) reasoning problems as ae ϕ ∈ Lae. It holds that Σ ∪ Λ |=L ϕ iff ϕ ∈ SE(Λ). Problem: MEMb(B) (resp. MEMc(B)) Input: A set Σ ⊆ Lae(B), a formula ϕ ∈ Lae(B) 4. Complexity Results Output: Is ϕ contained in some (resp. any) stable ex- pansion of Σ? The complexity of the before defined decision problems A central tool for the study of the computational complex- for autoepistemic logic has already been investigated by ity of the above problems is the following finite characteriza- Niemela¨ [21] and Gottlob [12]. Niemela¨ [21] proved that tion of stable expansions given by Niemela¨ [21]. in order to show that a set Σ has a stable expansion, we

3 L L may guess a Λ ⊆ SF (Σ) ∪ ¬SF (Σ) nondetermin- BF istically and check that it is Σ-full (see Definition 3.2 and Lemma 3.3). Thus the problem of deciding whether Σ has a stable expansion is nondeterministically Turing-reducible M L to the propositional implication problem. Thus he proved p p that the extension existence problem is in Σ2 . According V E N Σ2 -complete to Definition 3.4 and Lemma 3.5 the problem of deciding NP-complete whether there exists a stable expansion Σ containing a given in P, ⊕L-hard formula φ can be solved with a polynomial number of calls I in L to an NP-oracle by a nondeterministic Turing reduction as follows. Guess a subset Λ; check that Λ is Σ-full and check Figure 1. The relevant clones and their in- that φ ∈ SE(Λ). Therefore, the brave reasoning problem is clusion structure. The shading indicates the p p in Σ2 , whereas the cautious reasoning problem is in Π2 . Cor- complexity of EXP(B). responding hardness results were obtained by Gottlob [12]. More precisely he obtained completeness results for the spe- cial case B = {∧, ∨, ¬}. We investigate here the complexity of these problems for ately from the list of clones given in [7]). These are the seven every B. Observe that the upper bounds, i.e., membership clones I, N, V, E, L, M, and BF (see Fig. 1). All other cases p p will have the same complexity of these, by the explanations in Σ2 (resp. Π2 ) still hold for any B. In order to classify the complexity for the infinitely many cases of B we will above. make use of Post’s lattice as follows: Suppose that B ⊆ Before we start proving our classification, we note one B0 for some finite sets B,B0 of Boolean functions. Then further observation: every function in B can be expressed as a composition of For every set Σ ⊆ L , L is a stable expan- 0 Lemma 4.2. ae ae functions from B ; in other words: for every f ∈ B there sion of Σ iff Σ ∪ SFL(Σ) is inconsistent. 0 is a propositional formula φf over connectives B defining f, and every Lae(B)-formula can be transformed into an . Suppose that Lae is a stable expansion of Σ and let Λ 0 equivalent Lae(B )-formula. If moreover in the formulae φf denote its kernel. Then Σ ∪ Λ |=L 0 by virtue of Lemma 3.5. L every free variable appears only once (in this case we say that As Σ ∪ Λ |=L 0 iff Σ ∪ Λ |= 0, we obtain Λ = SF (Σ) q φf is a small formula for f; and in the proofs below we will (notice that {Lχ | Lχ ∈ SF (0)} = ∅, cf. Definition 3.4). see that we can always construct such small formulae), then In conclusion, Σ∪SFL(Σ) must be inconsistent. Conversely L the transformation of a Lae(B)-formula ψ into an equivalent suppose that Σ∪SF (Σ) is inconsistent. Then so is Th(Σ∪ 0 0 Lae(B )-formula ψ is efficient in the sense that the length of L(Lae)). Consequently, any stable expansion must contain ψ0 can be bounded by a polynomial in the length of ψ. Thus, all autoepistemic formulae. the upper bound for the complexity of EXP(B0) yields an upper bound for the complexity of EXP(B), and a lower 4.1. Expansion Existence bound for the complexity of EXP(B) yields a lower bound for the complexity of EXP(B0). If [B] = [B0] then EXP(B) Theorem 4.3. Let B be a finite set of Boolean functions. EXP(B0) and are of the same complexity (w.r.t. logspace p reductions). Thus, the complexity of EXP(B) is determined • If [B ∪ {0, 1}] is BF or M then EXP(B) is Σ2 - by the clone [B]. This already brings some structure into the complete. 0 infinitely many problems EXP(B ). We next note that we • If [B ∪ {0, 1}] is V then EXP(B) is NP-complete. may w.l.o.g. assume the availability of the Boolean constants. • If [B ∪ {0, 1}] is L then EXP(B) is ⊕L-hard and con- Lemma 4.1. Let P be any of the problems EXP, MEMc, log tained in P. or MEMb. Then P(B) ≡m P(B ∪ {0, 1}) for all finite sets B of Boolean functions. • If [B ∪ {0, 1}] is E or N or I then EXP(B) is in L (solvable in logspace). Proof. For the nontrivial direction, let Σ ∈ Lae. We map 0 Σ to Σ := Σ[1/t, 0/Lf] ∪ {t}, where t and f are fresh The proof of this theorem requires several propositions. propositions. Then the stable expansions of Σ0 and Σ are in one-to-one correspondence, as any expansion of Σ0 includes Proposition 4.4. Let B be a finite set of Boolean functions p t and ¬Lf. such that M ⊆ [B]. Then EXP(B) is Σ2 -complete. As a consequence of Lemma 4.1, it suffices to consider Proof. Let B be a finite set of Boolean functions as required. p the clones of the form [B ∪ {0, 1}] (as can be seen immedi- We have to prove Σ2 -hardness.

4 Let ϕ := ∃x1 · · · ∃xn∀y1 · · · ∀ymψ be a quantified defined by small formulae, i.e., there exist formulae φ∧ ≡ Boolean formula in disjunctive normal form. In [12], Got- x ∧ y and φ∨ ≡ x ∨ y such that x and y occur exactly once tlob shows that ϕ is satisfied iff the set Σ := {Lψ, Lx1 ↔ these formulae, see [27]. x1, . . . , Lxn ↔ xn} has a stable expansion. The idea of our proof is to modify the given reduction to only use mono- We cannot transfer the above result to EXP(B) for [B] = p V, because we may not assume ψ to be in conjunctive normal tone connectives, thus showing that EXP(B) is Σ2 -hard for every finite set B ⊆ M. More precisely, we define form. But, using a similar idea, we can show that the problem is NP-complete. 0 0 0 0 0 ψ := ψ[¬x1/x1,..., ¬xn/xn, ¬y1/y1,..., ¬ym/ym] Proposition 4.5. Let B be a finite set of Boolean functions and let such that [B ∪ {0, 1}] = V. Then EXP(B) is NP-complete. 0 0 0 0 Σ := {Lψ } ∪ {xi ∨ Lxi, Lxi ∨ xi | 1 ≤ i ≤ n} ∪ Proof. We first show that EXP(B) is efficiently verifiable, 0 {yj ∨ yj | 1 ≤ j ≤ m}. thus proving membership in NP. Given a set Σ ⊆ Lae and 0 a candidate Λ for a Σ-full set, substitute Lϕ by the Boolean Clearly Σ ⊆ Lae({∧, ∨}). Moreover, for every 1 ≤ i ≤ value assigned to by Λ and call the resulting set Σ0. Note n, we have that any stable expansion of Σ contains either 0 0 0 that Σ is still equivalent to a set of disjunctions. Therefore Lxi or Lxi but not both: assume that Λ is a Σ -full set 0 0 0 0 0 the conditions Σ |= ϕ if Lϕ ∈ Λ and Σ 6|= ϕ if ¬Lϕ ∈ Λ such that Lxi ∈ Λ and Lxi ∈ Λ. Then Σ ∪ Λ 6|= xi, xi, 0 0 can be verified in polynomial time, for IMP(B) ∈ P [5]. although Lxi, Lxi ∈ Λ; a to Λ being Σ -full. 0 To show NP-hardness, we reduce 3SAT to EXP(B) as Otherwise, if Λ were a Σ -full set such that Lxi ∈/ Λ and V 0 0 0 0 follows. Let ϕ := 1≤i≤n ci with clauses ci = `i1∨`i2∨`i3, Lx ∈/ Λ, then Σ ∪ Λ |= xi, x , although Lxi, Lx ∈/ Λ. i i i 1 ≤ i ≤ n be given and let x1, . . . , xm enumerate the In conclusion, any Σ0-full set and equivalently any stable 0 propositions occurring in ϕ. From ϕ we construct the set expansion contains either Lxi or Lxi but not both. Similarly, all stable expansions of Σ0 include at least one of y or y0 0 0 0 j j Σ := {Lci | 1 ≤ i ≤ n}∪{xi∨Lxi, Lxi∨xi | 1 ≤ i ≤ m}, (or both). 0 0 0 0 We show that Σ has a stable expansion iff ϕ is valid. where ci = ci[¬x1/x1,..., ¬xm/xm] for 1 ≤ i ≤ n. Anal- First suppose that Σ0 has a stable expansion ∆. Let Λ denote ogously to Proposition 4.4, we obtain that for any stable 0 L 0 0 its kernel. As Σ ∪ SF (Σ ) is consistent, we obtain that expansion ∆ of Σ either xi ∈ ∆ or xi ∈ ∆, but not both. ∆ 6= Lae from Lemma 4.2. By the argument above, either First, suppose that ∆ is a stable expansion of Σ. It is easily 0 0 L Lxi ∈ ∆ or Lxi ∈ ∆, but not both. Moreover, Lψ ∈ ∆, observed that Σ ∪ SF (Σ) is consistent, therefore ∆ 6= Lae. 0 0 0 whence ψ must be derivable from Σ ∪ Λ. Note that this Let Λ be the kernel of ∆. As ∆ 6= Lae and Lci ∈ Σ for all 0 0 implies that ψ is satisfied by all assignments setting either 1 ≤ i ≤ n, Definition 3.2 implies that Σ ∪ Λ |=L ci and 0 yi or yi to 1, in particular by all assignments that assign a hence Σ ∪ Λ |= ci for all 1 ≤ i ≤ n. From this it follows 0 complementary value to yi and yi for every i. Define a that ϕ is satisfied by the assignment σ setting σ(xi) = 1 iff assignment σ : {xi | 1 ≤ i ≤ n} → {0, 1} from Λ such Lxi ∈ ∆. that σ(xi) := 1 if Lxi ∈ Λ, and σ(xi) := 0 otherwise. It Conversely, suppose that ϕ is satisfied by the assign- 0 follows that σ |= ∀y1 · · · ∀ymψ, thus ϕ is valid. ment σ. Define the set Λ := {Lxi, ¬Lxi | σ(xi) = 0 0 Now suppose that ϕ is valid. Then there exists an assign- 1} ∪ {Lxi, ¬Lxi | σ(xi) = 0} ∪ {Lci | 1 ≤ i ≤ n}. 0 ment σ : {xi | 1 ≤ i ≤ n} → {0, 1} such that any exten- As σ |= ci for any 1 ≤ i ≤ n, we obtain that Σ ∪ Λ |= ci. 0 sion of σ to y1, . . . , ym satisfies ψ. Let Λ = {Lxi, ¬Lxi | Concluding, Λ is a Σ-full set. 0 0 σ(xi) = 1} ∪ {¬Lxi, Lxi | σ(xi) = 0} ∪ {Lψ }. We claim 0 0 Next, we turn to the case [B ∪ {0, 1}] = L. Say that an that Λ is a Σ -full set. If Lxi ∈ Λ, then ¬Lxi ∈ Λ; hence 0 0 L-prefixed formula is L-atomic if it is of the form Lϕ for {Lxi ∨ xi, ¬Lxi} implies xi. Conversely, if Σ ∪ Λ |= xi 0 0 some atomic formula ϕ. then ¬Lxi has to be in Λ, because xi occurs in Lψ and the 0 clause Lx ∨ xi only. From this, we obtain Lxi ∈ Λ. There- L i Lemma 4.6. Let Σ ⊆ Lae({⊕, 1}). If SF (Σ) contains fore, Σ ∪ Λ |= xi iff Lxi ∈ Λ. Similarly, one proves that only L-atomic formulae, then one can decide in polynomial 0 Σ ∪ Λ 6|= xi iff ¬Lxi ∈ Λ. The same holds for xi for each i. time whether Σ has a stable expansion. 0 Due to the construction of Λ, the fact that the clause yi ∨ yi 0 enforces yi to be assigned a value equal to or bigger than the Proof. The idea is to use Gaussian elimination twice. Let Σ 0 one assigned to ¬yi, the definition of ψ and its monotonic- be as required and suppose that Σ consists of m formulas. ity, we also have Σ0 ∪ Λ |= ψ0. Hence, following Definition Then the set Σ can be seen as a system of linear equations and 0 0 T 3.2, Λ is a Σ -full set and Σ has a stable expansion. thus written as Ax = By + C, where x = (x1, . . . , xn) , T Finally, note that in any finite set of Boolean functions y = (Lx1, . . . , Lxn) , A and B are Boolean matrices hav- B such that M ⊆ [B], conjunction and disjunction can be ing m rows, and C is a Boolean vector.

5 By applying Gaussian elimination to A we obtain an Conversely, suppose that λ is a solution of the sys- 0 0 0 0 equivalent system A x = B y + C with an upper triangular tem T [xs+1/Lxs+1, . . . , xn/Lxn]. In particular, λ sat- 0 0 0  matrix A . Let r denote the number of free variables in A x isfies λ(Lxi) = εi + gi λ(Lxs+1), . . . , λ(Lxn) + ci | and suppose w.l.o.g. that these are x1, . . . , xr. By subse- s + 1 ≤ i ≤ n}. Set Λ := {¬Lx1,..., ¬Lxs} ∪ {¬Lxi | quently eliminating the variables xr+1, . . . , xn, we arrive at s + 1 ≤ i ≤ n, λ(xi) = 0} ∪ {Lxi | s + 1 ≤ i ≤ 0 a system T equivalent to Σ of the form: n, λ(xi) = 1}. Then T ∪ Λ is equivalent to {Lxi = 0  εi + gi λ(Lxs+1), . . . , λ(Lxn) + ci | s < i ≤ n} ∪ {0 = 0  {xi =fi(x1, . . . , xr)+gi(Lx1, . . . , Lxn)+ci | r

To prove the claim, let Λ = {¬Lx1,..., ¬Lxs} ∪ Λϕ := (Λ \{Lϕ, ¬Lϕ}) ∪ {Lyϕ | Lϕ ∈ Λ} ∪ {¬Lxi | i ∈ I} ∪ {Lxj | j ∈ J} be a Σ-full set. Ob- {¬Ly | ¬Lϕ ∈ Λ}. 0 ϕ serve that Σ ∪ Λ is consistent and that either T ∪ Λ |= xi or 0 T ∪ Λ |= ¬xi. Denote by λ the truth assignment induced by That is, Σϕ differs from Σ in that we substituted one non-L- L Λ on SF (Σ). Then, for every i > s, Lxi ∈ Λ iff λ(Lxi) = atomic subformula. 0 0  1 iff T ∪Λ |= xi iff εi +gi λ(Lxs+1), . . . , λ(Lxn) +ci = Observe that Σ ∪ Λ |= ϕ iff Σϕ ∪ Λϕ |= yϕ. Therefore, 0 1; and ¬Lxi ∈ Λ iff λ(Lxi) = 0 iff T ∪ Λ |= ¬xi iff since Lϕ ∈ Λ iff Lyϕ ∈ Λϕ and ¬Lϕ ∈ Λ iff ¬Lyϕ ∈ Λϕ, 0  εi + gi λ(Lxs+1), . . . , λ(Lxn) + ci = 0. This means that it holds that Λ is Σ-full iff Λϕ is Σϕ-full. 0  for every i, we have εi +gi λ(Lxs+1), . . . , λ(Lxn) +ci = Now notice that any Σ containing non-L-atomic subfor- λ(Lxi). Therefore λ is a solution of the system {Lxi = mulae contains a “minimal” non-L-atomic subformula Lϕ εi + gi(0,..., 0, Lxs+1, . . . , Lxn) + ci | s < i ≤ n}, and in the sense that ϕ is does not contain L-prefixed subformu- 0 0 hence of the system T [xs+1/Lxs+1, . . . , xn/Lxn]. lae. Repeating the above argument eventually yields Σ , for

6 which the existence of stable expansions can be tested in Proof. The corollary follows immediately from the proof polynomial time by Lemma 4.6. of Theorem 4.3. Indeed, in each hardness proof (see Propo- To establish ⊕L-hardness, we give a reduction from sitions 4.4, 4.5 and 4.7) we have shown that the set of B- IMP(B) for [B ∪ {0, 1}] = L, i.e., the problem to decide premises constructed in that proof, Σ or Σ0, does not admit 0 whether Γ |= ψ for a given set Γ of B-formulae and a given Lae as a stable expansion. Therefore, Σ or Σ has a sta- B-formula ψ. Since IMP(B) is ⊕L-complete in this case, ble expansion iff it has a consistent stable expansion. This our lemma follows. proves all the hardness results. As for the upper bounds, We map (Γ, ψ) to Σ := Γ0 ∪ {Lq}, where q is a fresh Propositions 4.4 and 4.5 are easily seen to extend to the proposition and existence of a consistent stable expansion. For the tractable cases [B] ⊆ E and [B] ⊆ N, one can decide the existence of Γ0 := {ϕ ⊕ q | ϕ ∈ Γ ∪ {¬ψ}, ϕ(1,..., 1) = 0} ∪ a consistent stable expansion in logarithmic space. This fol- {ϕ | ϕ ∈ Γ ∪ {¬ψ}, ϕ(1,..., 1) = 1}. lows from the proof of Proposition 4.8. Finally, for [B] ⊆ L, observe that the proof Proposition 4.7 actually allows to com- Observe that Γ0 is satisfied by the assignment setting all pute full sets corresponding to consistent stable expansions variables to 1. We claim that Γ |= ψ iff Σ has a stable in polynomial time. expansion. First suppose that Γ |= ψ. Then Γ ∪ {¬ψ} and con- 4.2. Brave and Cautious Reasoning sequently Γ0[q/0] are unsatisfiable. As Γ0[q/1] |= q[q/1], we obtain that Γ0 |= q. Consequently, {Lq} is a Σ-full set Theorem 4.10. Let B be a finite set of Boolean functions. and Σ has the (consistent) stable expansion SE({Lq}). For p the converse, suppose that Γ 6|= ψ. Then Γ ∪ {¬ψ} and • If [B ∪ {0, 1}] is BF or M then MEMb(B) is Σ2 - 0 0 p Γ [q/0] are satisfiable. From this we obtain that Γ 6|= q. complete, whereas MEMc(B) is Π2 -complete. So there exists an assignment σ such that σ(Γ0) = 1 and • If [B ∪ {0, 1}] is V then MEM (B) is NP-complete, σ(q) = 0. For Λ = {Lq}, we now have Σ ∪ Λ = Σ 6|= q, as b whereas MEM (B) is coNP-complete. witnessed by an appropriate extension of σ. Thus, {Lq} is c not Σ-full. On the other hand, for Λ = {¬Lq}, we obtain • If [B ∪{0, 1}] is L then MEMb(B) and MEMc(B) are Σ ∪ Λ ≡ Γ ∪ {Lq, ¬Lq} |= q. Hence, Λ = {¬Lq} is not Σ- ⊕L-hard and in P. full either; concluding that Σ has no stable expansions. • If [B ∪ {0, 1}] is E or N or I then MEMb(B) and Proposition 4.8. Let B be a finite set of Boolean functions MEMc(B) are in L. such that [B] ⊆ N or [B] ⊆ E. Then EXP(B) is solvable in L. It moreover holds that, for every set Σ ⊆ Lae(B), there To prove Theorem 4.10, we require two lemmas that pro- is at most one consistent stable expansion. vide upper bounds on the complexity of MEMb(B) and MEMc(B) via reduction to the expansion existence prob- Proof. Let B be a finite set of Boolean functions such that lem. [B] ⊆ N and let Σ ⊆ Lae(B) be given. For Σ to have a consistent stable expansion, ϕ has to be in Σ for all Lϕ ∈ Σ, Lemma 4.11. Let B be a finite set of Boolean functions log while ϕ must not to be in Σ for all ¬Lϕ ∈ Σ or L¬ϕ ∈ Σ. such that [B] = L. Then MEMb(B) ≤m EXP(B). As Σ ≡ V Σ, the result for [B] ⊆ E follows from the Proof. Let B be a finite set of Boolean functions such that above. [B] = L. Given Σ ⊆ Lae(B) and ϕ ∈ Lae(B), map the pair (Σ, ϕ) to Σ0 := Σ ∪ {Lϕ ⊕ p ⊕ 1, Lp}, where p is a The proof of Theorem 4.3 now immediately follows from fresh proposition. We claim that ϕ is contained in a stable Propositions 4.4–4.8. Note that by Lemma 4.1 and the discus- expansion of Σ iff Σ0 ∈ EXP(B). sion following that lemma, this covers all cases and, hence, ϕ Theorem 4.3 gives a complete classification. First suppose that is contained in a stable expansion ∆ of Σ and let Λ denote its kernel. We claim that Λ0 := From this theorem and its proof one can easily settle the Λ ∪ {Lϕ, Lp} is Σ0-full: complexity of the existence of a consistent stable expansion as well as the complexity of the brave and cautious reasoning. 0 0 • Σ ∪ Λ |= ϕ, because Σ ∪ Λ |=L ϕ;

Corollary 4.9. For all finite sets B of Boolean functions, • Σ0 ∪ Λ0 |= p, because Σ ∪ {Lϕ, Lϕ ⊕ p ⊕ 1} |= p; the complexity of the problem to decide whether a set of autoepistemic B-formulae has a consistent stable expansion • for all Lψ ∈ Λ, we have Σ0 ∪Λ0 ≡ Σ∪Λ∪{Lϕ, Lϕ⊕ is the same as for the problem to decide the existence of a p ⊕ 1, Lp} |=L ψ; whereas for all ¬Lψ ∈ Λ, we still 0 0 stable expansion. have Σ ∪ Λ ≡ Σ ∪ Λ ∪ {Lϕ, Lϕ ⊕ p ⊕ 1, Lp} 6|=L ψ.

7 Hence, Σ0 has a stable expansion. set T ⊆ SFq(ϕ), verify that Σ∪Λ∪{Lχ | χ ∈ T }∪{¬Lχ | Conversely, suppose that ϕ is not bravely entailed. Hence χ ∈ SFq(ϕ) \ T } |= ϕ, and recursively check that Σ does not have Lae as a stable expansion and ¬Lϕ ∈ ∆ for all stable expansions ∆ of Σ. Observe that Σ0 ∪ • Σ ∪ Λ |=L χ for all χ ∈ T , L 0 L SF (Σ ) = Σ ∪ SF (Σ) ∪ {Lϕ ⊕ p ⊕ 1, Lp} ∪ {Lϕ, Lp} • Σ ∪ Λ 6|= χ χ ∈ SFq(ϕ) \ T 0 L for all . is consistent, therefore Lae is not a stable expansion of Σ . Hence, assume that ∆0 is a consistent stable expansion of Σ0. This recursion terminates after at most |ϕ| steps as 0 0 0 q Then either Lp ∈ ∆ or ¬Lp ∈ ∆ . In the former case, ∆ |SF (ϕ)| ≤ SF(ϕ) ≤ |ϕ| and Σ∪Λ |=L χ iff Σ∪Λ |= χ for would also have to contain Lϕ, while ϕ can not be derived. all for all propositional formulae χ. The above hence consti- A contradiction to ∆0 being a stable expansion of Σ0. In tutes a polynomial-time Turing reduction to the implication the latter case, we have that Th(Σ0 ∪ L(∆0) ∪ ¬L(∆¯0)) ⊇ problem for propositional B-formulae. As implication test- 0 0 ¯0 0 {¬Lp, Lp}. Thus Th(Σ ∪L(∆ )∪¬L(∆ )) = Lae ) ∆ — ing for B-formulae is in P, we obtain that Σ ∪ Λ |=L ϕ is 0 a contradiction to ∆ being a stable expansion. We conclude polynomial-time decidable; thence MEMb(B) ∈ NP and 0 that Σ does not posses any stable expansions. MEMc(B) ∈ coNP. For [B] ⊆ N and [B] ⊆ E, the proof of Proposition 4.8 Lemma 4.12. Let B be a finite set of Boolean functions shows that, given Σ ⊆ Lae(B), computation of a Σ-full log ∗ such that [B] = L. Then MEMc(B) ≤m EXP (B), where set Λ can be performed in L, while deciding Σ ∪ Λ |=L ϕ ∗ EXP (B) denotes the problem of deciding the existence of reduces to testing whether Σ ∪ Λ |= ψ for the (unique) a consistent stable expansion. atomic subformula ψ ∈ SF(ϕ). Finally, for [B ∪ {0, 1}] = L, the claim follows from Proof. The proof is similar to the proof of Lemma 4.11. Let Lemmas 4.11 and 4.12, Proposition 4.7 and Corollary 4.9. B be a finite set of Boolean functions such that [B] = L. Given Σ ⊆ Lae(B) and ϕ ∈ Lae(B), map the pair (Σ, ϕ) to Σ0 := Σ ∪ {Lϕ ⊕ p, Lp}, where p is a fresh proposition. We claim that ϕ is contained in any stable expansion of Σ iff 5. Counting Complexity Σ0 6∈ EXP∗(B). First suppose that there exists a stable expansion ∆ of Σ Besides deciding existence of stable expansions or entail- that does not contain ϕ. Let Λ denote its kernel. Then, for ment of formulae, another natural question is concerned with the same arguments as above, Λ0 := Λ ∪ {¬Lϕ, Lp} is a the total number of stable expansions of a given autoepis- Σ0-full set. Conversely, suppose that ϕ is contained in all temic theory. We define the counting problem for stable stable expansions ∆ of Σ. Let ∆0 denote a consistent stable extensions as expansion of Σ0. If Lp ∈ ∆0, then ∆0 would also have to contain ¬Lϕ, while ϕ can be derived. A contradiction to Problem: #EXP(B) ∆0 being a stable expansion of Σ0. Otherwise, if ¬Lp ∈ ∆0, Input: A set Σ ⊆ Lae(B) then Σ0 ∪ L(∆0) ∪ ¬L(∆¯0) is inconsistent—contradictory Output: The number of stable expansions of Σ. to ∆0 being a consistent stable expansion. We conclude that The complexity of this problem is classified by the following Σ0 does not posses any consistent stable expansion. theorem.

Proof of Theorem 4.10. According to Lemma 4.1 one can Theorem 5.1. Let B be a finite set of Boolean functions. suppose w.l.o.g. that B contains the two constants 0 and 1. Since 1 belongs to all stable expansion, a set Σ of B- • If [B ∪ {0, 1}] is BF or M then #EXP(B) is #·coNP- premises has a stable expansion iff 1 belongs to some stable complete. expansion of Σ. Since 0 does not belong to any consistent stable expansion, a set Σ of B-premises has no consistent • If [B ∪ {0, 1}] is V then #EXP(B) is #P-complete. stable expansion iff 0 belongs to any stable expansion of Σ. • If [B ∪{0, 1}] ⊆ L or [B ∪{0, 1}] ⊆ E then #EXP(B) Therefore, the lower bounds follow from Theorem 4.3 and is in FP. Corollary 4.9. p p As for the upper bounds, membership in Σ2 and Π2 in Proof. We first prove the lower bounds. It is easily observed the general case follows from the discussion preceding The- that the reduction given in the proof of Lemma 4.1 is par- orem 4.3. simonious. For the claimed lower bounds it hence suffices For [B] ⊆ V, the proof of Proposition 4.5 shows that, to prove the #·coNP-hardness of #EXP(B) for [B] = M given Σ ⊆ Lae(B), we can compute a Σ-full set Λ in NP and the #·coNP-hardness of #EXP(B) for [B] = V. For resp. coNP. By Lemma 3.5, it remains to check whether the former, notice that the reduction given in Proposition 4.5 Σ ∪ Λ |=L ϕ. To this end, we nondeterministically guess a is also a parsimonious reduction from #3SAT, which is

8 #P-complete-complete via parsimonious reductions [29]. become tractable (either contained in L or contained in P For the latter, notice that the proof of Proposition 4.4 estab- and ⊕L-hard). We obtained a non-trivial polynomial-time lishes a parsimonious reduction from the problem #Π1SAT, upper bound for the case of not-unary affine functions. Note which is #·coNP-complete via parsimonious reductions however that the exact complexity of the problems in this [11]. case remains open. This clone has also remained unclassified We are thus left to prove the upper bounds. Let B be a fi- in a number of previous related works on different modal nite set of Boolean functions such that [B] = BF. In the para- and non-monotonic logics [2, 28]. graph starting Section 4, it has been argued that the problem As for the problem of counting the number of stable of deciding EXP(B) nondeterministically Turing-reduces to expansions, its computational complexity is trichotomic: the propositional implication problem (see also [21]): given #·coNP-complete, #P-complete, or contained in FP. We + L Σ ⊆ Lae(B), guess a subset Λ ⊆ SF (Σ) and verify that think it is important to note that for our classification of Λ := Λ+ ∪ {¬Lϕ | ϕ ∈ SFL(Σ), Lϕ∈ / Λ+} is a Σ-full set counting problems the conceptually simple parsimonious using the conditions given in Definition 3.2. It is thus clear reductions are sufficient, while for related classifications in that #EXP is contained in #·PNP, as a Turing machine the literature less restrictive (and more complicated) reduc- implementing the above algorithm can be build in a way tions such as subtractive or complementive reductions had such that there is a bijection between its computation paths to be used (see, e.g.,[11, 10, 1] and some of the results of and the possible sets Λ+. The first claim now follows from [14]). Parsimonious reductions are not only the conceptually #·PNP = #·coNP [13]. simplest ones since they are direct analogues of the usual Next, let B be such that [B] = V. Then there exists a many-one reductions among languages. They also form the nondeterministic Turing machine M such that the number strongest (strictest) type of reduction with a number of good of accepting path of M on input Σ ⊆ Lae(B) corresponds properties, e. g. all relevant counting classes are closed under to the number of stable expansions of Σ (cf. the proof of parsimonious reductions (and not under the other mentioned Proposition 4.5). Hence, #EXP(B) ∈ #P. types of reductions). Thus, one of the contributions of our Next, suppose that [B] ⊆ L and let Σ denote the paper is a natural counting problem complete in the class given autoepistemic theory. Let T 0 denote the system #·coNP under the simplest type of reductions. of linear equations obtained from Σ in the proofs of Future work, besides closing the gap for the clone L, Lemma 4.6. Then the number of consistent stable expan- should compare the classification obtained here to related sions of Σ is equal to the number of solutions of the system classifications for non-monotonic logics such as default logic 0 T [xs+1/Lxs+1, . . . , xn/Lxn], which can be computed in [6] or circumscription [28]. It will be interesting to study if polynomial time by Gaussian elimination. Moreover, Lae is the embeddings between the three logics mentioned in the a stable expansion of Σ iff Σ∪SFL(Σ) is inconsistent, which introduction obey the border between the clones. is polynomial-time decidable. Hence, #EXP(B) ∈ FP. Finally, the case [B] ⊆ E follows from the fact that for References 0 any Σ ⊆ Lae(B) an equivalent representation Σ ∈ Lae(I) can be computed efficiently. [1] M. Bauland, E. Bohler,¨ N. Creignou, S. Reith, H. Schnoor, and H. Vollmer. The complexity of problems for quantified 6. Conclusion constraints. Theory of Computing Systems, 2009. Electroni- cally available at http://dx.doi.org/10.1007/s00224-009-9194- 6. In this paper we followed the approach of Lewis to build [2] M. Bauland, E. Hemaspaandra, H. Schnoor, and I. Schnoor. formulae from a given finite set B of allowed Boolean func- Generalized modal satisfiability. In 23nd Symposium on tions [16] and studied the complexity of the expansion ex- Theoretical Aspects of Computer Science, pages 500–511, istence, the brave (resp. cautious) reasoning problem, and 2006. the counting problem for stable expansions involving B- [3] M. Bauland, M. Mundhenk, T. Schneider, H. Schnoor, formulae. I. Schnoor, and H. Vollmer. The tractability of model check- We showed that for all sets of allowed Boolean functions, ing for LTL: the good, the bad, and the ugly fragments. Elec- the computational complexity of the expansion existence tronic Notes in Theoretical Computer Science, 231:277–292, and reasoning problems is divided into four presumably 2009. [4] M. Bauland, T. Schneider, H. Schnoor, I. Schnoor, and different levels (see Figure 1): all three problems remain H. Vollmer. The complexity of generalized satisfiability for complete for classes of the second level of the polynomial linear temporal logic. Logical Methods in Computer Science, hierarchy as long as the connectives ∧ and ∨ can be ex- 5(1), 2008. pressed; if, otherwise, only disjunctions can be expressed the [5] O. Beyersdorff, A. Meier, M. Thomas, and H. Vollmer. The complexity drops to completeness for the first level of the complexity of propositional implication. Information Pro- polynomial hierarchy; in all remaining cases, the problems cessing Letters, 109(18):1071–1077, 2009.

9 [6] O. Beyersdorff, A. Meier, M. Thomas, and H. Vollmer. The [25] R. Reiter. A logic for default reasoning. Artificial Intelligence, complexity of reasoning for fragments of default logic. In 13:81–132, 1980. Proceedings 12th Theory and Applications of Satisfiability [26] S. Reith. On the complexity of some equivalence problems Testing (SAT), volume 5584 of Lecture Notes in Computer for propositional calculi. In Proc. 28th International Sym- Science, pages 51–64. Springer, 2009. posium on Mathematical Foundations of Computer Science, [7] E. Bohler,¨ N. Creignou, S. Reith, and H. Vollmer. Playing pages 632–641, 2003. with Boolean blocks, part I: Post’s lattice with applications [27] H. Schnoor. The complexity of the Boolean formula value to complexity theory. SIGACT News, 34(4):38–52, 2003. problem. Technical report, Theoretical Computer Science, [8] G. Buntrock, C. Damm, U. Hertrampf, and C. Meinel. Struc- Leibniz University of Hannover, 2005. ture and importance of logspace MOD-classes. Mathematical [28] M. Thomas. The complexity of circumscriptive inference Systems Theory, 25:223–237, 1992. in Post’s lattice. In Proc. 10th International Conference on [9] N. Creignou, J. Schmidt, and M. Thomas. Complexity of Logic Programming and Nonmonotonic Reasoning, volume propositional abduction for restricted sets of Boolean func- 5753 of Lecture Notes in Computer Science, pages 290–302. tions. In Proc. 12th International Conference on the Princi- Springer, 2009. ples of Knowledge Representation and Reasoning, 2010. To [29] L. G. Valiant. The complexity of enumeration and reliability appear. problems. SIAM Journal of Computing, 8(3):411–421, 1979. [10] A. Durand and M. Hermann. On the counting complexity of propositional circumscription. Information Processing Letters, 106:164–170, 2008. [11] A. Durand, M. Hermann, and P. G. Kolaitis. Subtractive reductions and complete problems for counting complexity classes. Theoretical Computer Science, 340(3):496–513, 2005. [12] G. Gottlob. Complexity results for nonmonotonic logics. Journal of Logic Computation, 2(3):397–425, 1992. [13] L. Hemaspaandra and H. Vollmer. The satanic notations: counting classes beyond #P and other definitional adventures. Complexity Theory Column 8, ACM-SIGACT News, 26(1):2– 13, 1995. [14] M. Hermann and R. Pichler. Counting complexity of propo- sitional abduction. In Proceedings of the 20th International Joint Conference on Artificial Intelligence, pages 417–422, 2007. [15] M. Jakl, R. Pichler, S. Rummele,¨ and S. Woltran. Fast count- ing with bounded treewidth. In 15th International Conference on Logic for Programming, Artificial Intelligence, and Rea- soning, number 5330 in Lecture Notes in Computer Science, pages 436–450. Springer-Verlag, 2008. [16] H. Lewis. Satisfiability problems for propositional calculi. Mathematical Systems Theory, 13:45–53, 1979. [17] J. McCarthy. Circumscription – A form of non-monotonic reasoning. Artificial Intelligence, 13:27–39, 1980. [18] D. McDermott and J. Doyle. Non-monotonic logic I. Artifi- cial Intelligence, 13:41–72, 1980. [19] A. Meier, M. Mundhenk, M. Thomas, and H. Vollmer. The complexity of satisfiability for fragments of CTL and CTL?. Electr. Notes Theor. Comput. Sci., 223:201–213, 2008. [20] R. C. Moore. Semantical considerations on modal logic. Artificial Intelligence, 25:75–94, 1985. [21] I. Niemela. Towards automatic autoepistemic reasoning. In Proceedings European Workshop on Logics in AI, volume 478 of Lecture Notes in Computer Science, pages 428–443. Springer, 1991. [22] C. H. Papadimitriou. Computational Complexity. Addison- Wesley, Reading, MA, 1994. [23] N. Pippenger. Theories of Computability. Cambridge Uni- versity Press, Cambridge, 1997. [24] E. Post. The two-valued iterative systems of . Annals of Mathematical Studies, 5:1–122, 1941.

10