QBF as an Alternative to Courcelle’s Theorem
We propose reductions to quantified Boolean formulas (QBF) as a new approach to showing fixed-parameter linear algorithms for problems parameterized by treewidth. We demonstrate the feasibility of this approach by giving new algorithms for several well-known problems from artificial intelligence that are in general complete for the second level of the polynomial hierarchy. By reduction from QBF we show that all resulting algorithms are essentially optimal in their dependence on the treewidth. Most of the problems that we consider were already known to be fixed-parameter linear by using Courcelle’s Theorem or dynamic programming, but we argue that our approach has clear advantages over these techniques: on the one hand, in contrast to Courcelle’s Theorem, we get concrete and tight guarantees for the runtime dependence on the treewidth. On the other hand, we avoid tedious dynamic programming and, after showing some normalization results for CNF-formulas, our upper bounds often boil down to a few lines.
Courcelle’s seminal theorem  states that every graph property definable in monadic second order logic can be decided in linear time on graphs of constant treewidth. Here treewidth is the famous width measure used to measure intuitively how similar a graph is to a tree. While the statement of Courcelle’s Theorem might sound abstract to the unsuspecting reader, the consequences are tremendous. Since a huge number of computational problems can be encoded in monadic second order logic, this gives automatic linear time algorithms for a wealth of problems in such diverse fields as combinatorial algorithms, artificial intelligence and databases; out of the plethora of such papers let us only cite [20, 10] that treat problems that will reappear in this paper. This makes Courcelle’s Theorem one of the cornerstones of the field of parameterized algorithms.
Unfortunately, its strength comes with a price: while the runtime dependence on the size of the problem instance is linear, the dependence on the treewidth is unclear when using this approach. Moreover, despite recent progress (see e.g. the survey ) Courcelle’s Theorem is largely considered impractical due to the gigantic constants involved in the construction. Since generally these constants are unavoidable , showing linear time algorithms with Courcelle’s Theorem can hardly be considered as a satisfying solution.
As a consequence, linear time algorithms conceived with the help of Courcelle’s Theorem are sometimes followed up with more concrete algorithms with more explicit runtime guarantees often by dynamic programming or applications of a datalog approach [12, 20, 22]. Unfortunately, these hand-written algorithms tend to be very technical, in particular for decision problems outside of . Furthermore, even this meticulous analysis usually gives algorithms with a dependance on treewidth that is a tower of exponentials.
The purpose of this paper is two-fold. On the one hand we propose reductions to QBF combined with the use of a known QBF-algorithm by Chen  as a simple approach to constructing linear-time algorithms for problems beyond parameterized by treewidth. In particular, we use the proposed method in order to construct (alternative) algorithms for a variety of problems stemming from artificial intelligence: abduction, circumscription, abstract argumentation and the computation of minimal unsatisfiable sets in unsatisfiable formulas. The advantage of this approach over Courcelle’s Theorem or tedious dynamic programming is that the algorithms we provide are almost straightforward to produce, while giving bounds on the treewidth that asymptotically match those of careful dynamic programming. On the other hand, we show that our algorithms are asymptotically best possible, giving matching complexity lower bounds.
Our algorithmic approach might at first sight seem surprising: since QBF with a fixed number of alternations is complete for the different levels of the polynomial hierarchy, there are trivially reductions from all problems in that hierarchy to the corresponding QBF problem. So what is new about this approach? The crucial observation here is that in general reductions to QBF guaranteed by completeness do not maintain the treewidth of the problem. Moreover, while Chen’s algorithm runs in linear time, there is no reason for the reduction to QBF to run in linear time which would result in an algorithm with overall non-linear runtime.
The runtime bounds that we give are mostly of the form where is the treewidth and the size of the input. Furthermore, starting from recent lower bounds for QBF , we also show that these runtime bounds are essentially tight as there are no algorithms with runtime for the considered problems. Our lower bounds are based on the Exponential Time Hypothesis (ETH) which posits that there is no algorithm for 3SAT with runtime where is the number of variables in the input. ETH is by now widely accepted as a standard assumption in the fields of exact and parameterized algorithms for showing tight lower bounds, see e.g., the survey . We remark that our bounds confirm the observation already made in  that problems complete for the second level of the polynomial hierarchy parameterized by treewidth tend to have runtime double-exponential in the treewidth.
As a consequence, the main contribution of this paper is to show that reductions to QBF can be used as a simple technique to show algorithms with essentially optimal runtime for a wide range of problems.
We show upper bounds of the form for instances of treewidth and size for abstract argumentation, abduction, circumscription and the computation of minimal unsatisfiable sets in unsatisfiable formulas. For the former three problems it was already known that there are linear time algorithms for bounded treewidth instances: for abstract argumentation, this was shown in  with Courcelle’s theorem and a tighter upper bound of the form was given by dynamic programming in . For abduction, there was a linear time algorithm in  for all abduction problems we consider and a algorithm based on a datalog encoding for some of the problems. The upper bound that we give for so-called necessity is new. For circumscription, a linear time algorithm was known  but we are the first to give concrete runtime bounds. Finally, we are the first to give upper bounds for minimal unsatisfiable subsets for CNF-formulas of bounded treewidth.
We complement our upper bounds with ETH-based lower bounds for all problems mentioned above, all of which are the first such bounds for these problems.
Finally, we apply our approach to abduction with -preferences but giving a linear time algorithm with triple exponential dependence on the treewidth, refining upper bounds based on Courcelle’s theorem  by giving an explicit treewidth dependence.
In this section, we only introduce notation that we will use in all parts of the paper. The background for the problems on which we demonstrate our approach will be given in the individual sections in which these problems are treated.
Throughout this paper, all graphs will be undirected and simple unless explicitly stated otherwise. A tree decomposition of a graph consists of a tree and a subset for every node of with the following properties:
every vertex is contained in at least one set ,
for every edge , there is a set that contains both and , and
for every , the set induces a subtree of .
The last condition is often called the connectivity condition. The sets are called bags. The width of a tree decomposition is . The treewidth of is the minimum width of a tree decomposition of . We will sometimes tacitly use the fact that any tree decomposition can always be assumed to be of size linear in by standard simplifications. Computing the treewidth of a graph is -hard , but for every fixed there is a linear time algorithm that decides if a given graph has treewidth at most and if so computes a tree decomposition witnessing this .
A tree decomposition is called nice if every node of is of one of the following types:
leaf node: is a leaf of .
introduce node: has a single child node and for a vertex .
forget node: has a single child node and for a vertex .
join node: has exactly two children and with .
Nice tree decompositions were introduced in  where it was also shown that given a tree decomposition of a graph , one can in linear time compute a nice tree decomposition of with the same width.
2.2 CNF formulas
A literal is a propositional variable or the negation of a propositional variable. A clause is a disjunction of literals and a CNF-formula is a conjunction of clauses. For technical reasons we assume that there is an injective mapping from the variables in a CNF formula to for an arbitrary but fixed constant where is the number of variables in and that we can evaluate this mapping in constant time. This assumption allows us to easily create lists, in linear time in , which store data assigned to the variables that we can then look up in constant time. Note that formulas in the DIMACS format , the standard encoding for CNF formulas, generally have this assumed property. Alternatively, we could use perfect hashing to assign the variables to integers, but this would make some of the algorithms randomized.
Let and be two CNF formulas. We say that is a projection of if and only if and is a model of if and only if can be extended to a model of .
To every CNF formula we assign a graph called primal graph whose vertex set is the set of variables of . Two vertices are connected by an edge if and only if they appear together in a clause of (see Figure (a)a). The primal treewidth of a CNF formula is the treewidth of its primal graph. We will also be concerned with the following generalization of primal treewidth: the incidence graph of a CNF formula has as vertices the variables and the clauses of the formula. Two vertices are connected by an edge if and only if one vertex is a variable and the other is a clause such that the variable appears in the clause (see Figure (b)b). The incidence treewidth of a formula is then the treewidth of its incidence graph.
It is well-know that the primal treewidth of a CNF-formula can be arbitrarily higher than the incidence treewidth (for example consider a single clause of size ). The other way round, formulas of primal treewidth can easily be seen to be of incidence treewidth at most .
2.3 From primal to incidence treewidth
While in general primal and incidence treewidth are two different parameters, in this section we argue that when dealing with CNF formulas we don’t need to distinguish between the two: first, since incidence treewidth is more general, the lower bounds for primal treewidth transfer automatically to it; second, while the same cannot generally be said for algorithmic results, it is easy to see that the primal treewidth is bounded by the product of the incidence treewidth the arity (clause size), so it suffices to show that we can transform any CNF formula to an equivalent one having bounded arity while roughly maintaining its incidence treewidth. Proposition 2.1 suggests a linear time transformation achieving this. In the following we can then interchangably work with incidence treewidth or primal treewidth, whichever is more convenient in the respective situation.
There is an algorithm that, given a CNF formula of incidence treewidth , computes in time a 3CNF formula of incidence treewidth with such that is a projection of .
(Sketch) We use the classic reduction from SAT to 3SAT that cuts big clauses into smaller clauses by introducing new variables. During this reduction we have to take care that the runtime is in fact linear and that we can bound the treewidth appropriately. For the complete proof see Appendix A.
It is well-known that if the clauses in a formula of incidence treewidth have at most size , then the primal treewidth of is at most , see e.g.  so the following result follows directly.
There is an algorithm that, given a CNF-formula of incidence treewidth , computes in time a 3CNF-formula of primal treewidth such that is a projection of .
We will in several places in this paper consider Boolean combinations of functions expressed by CNF formulas of bounded treewidth. The following technical lemma states that we can under certain conditions construct CNF formulas of bounded treewidth for the these Boolean combinations.
There is an algorithm that, given a 3CNF-formula and a tree decomposition of its incidence graph of width , computes in time a CNF-formula and a tree decomposition of the incidence graph of such that is a projection of , for all we have and the width of is .
There is an algorithm that, given two 3CNF-formulas and two tree decompositions for of the incidence graphs of of width such that for every bag either or , computes in time a tree decomposition of the incidence graph of such that , for all we have and the width of is .
a) Because every clause has at most literals, we assume w.l.o.g. that every bag that contains a clause contains also all variables of .
In a first step, we add for every clause a variable and substitute by clauses with at most -variables encoding the constraint introducing some new variables. The result is a CNF-formula in which every assignment to can be extended uniquely to a satisfying assignment and in the variable is true if and only if is satisfied by . Note that, since every clause has at most variables, the clauses for can be constructed in constant time. Moreover, we can construct a tree decomposition of width for from that of by adding all new clauses for and to every bag containing .
In a next step, we introduce a variable for every and a constraint defining where are the children of and the variables are omitted in case they do not appear. The resulting CNF formula is such that every assignment to can be uniquely extended to a satisfying assignment of and is true in if and only if all clauses that appear in the subtree of rooted in are satisfied by . Since every constraint has at most variables, we can construct the 3CNF-formula simulating it in time , e.g. by Tseitin transformation. We again bound the treewidth as before.
The only thing that remains is to add a clause where is the root of . This completes the proof of a).
b) We simply set . It is readily checked that this satisfies all conditions. ∎
There is an algorithm that, given a 3CNF formula with a tree decomposition of width of the incidence graph of and sequences of variables , such that for every there is a bag with , computes in time a formula that is a projection of and a tree decomposition of of width . The same is true for instead of .
For the case , is simply . satisfies all properties even without projection and with the same tree decomposition.
Our main tool in this paper will be QBF, the quantified version of CNF. In particular, we will be concerned with the version of QBF which only has two quantifier blocks which is often called -QBF. Let us recall some standard definitions. A -QBF is a formula of the form where and are disjoint vectors of variables and is a CNF-formula called the matrix. We assume the usual semantics for -QBF. Moreover, we sometimes consider Boolean combinations of QBF-formulas which we assume to be turned into prenex form again with the help of the usual transformations.
It is well-known that deciding if a given -QBF is true is complete for the second level of the polynomial hierarchy, and thus generally considered intractable. Treewidth has been used as an approach for finding tractable fragments of -QBF and more generally bounded alternation QBF. Let us define the primal (resp. insidence) treewidth of a -QBF to be the primal (resp. incidence) treewidth of the underlying CNF formula. Chen  showed the following result.
 There is an algorithm that given a -QBF of primal treewidth decides in time if is true.
We note that the result of  is in fact more general than what we state here. In particular, the paper gives a more general algorithm for -QBF with running time , where the height of the tower of exponentials is . For readability we will restrict ourselves to the case that is general enough for our needs. We also remark that Chen does not state that his algorithm in fact works in linear time. We sketch in Appendix B why there is indeed a linear runtime bound.
There is an algorithm that given a -QBF of incidence treewidth decides in time if is true.
We remark that general QBF of bounded treewidth without any restriction on the quantifier prefix is -complete , and finding tractable fragments by taking into account the structure of the prefix and notions similar to treewidth is quite an active area of research, see e.g. [15, 14].
To show tightness of our upper bounds, we use the following theorem from .
There is no algorithm that, given a -QBF with variables and primal treewidth , decides if is true in time , unless ETH is false.
4 Abstract Argumentation
Abstract argumentation is an area of artificial intelligence which tries to assess the acceptability of arguments within a set of possible arguments based only the relation between them, i.e., which arguments defeat which. Since its creation in , abstract argumentation has developed into a major and very active subfield. In this section, we consider the most studied setting introduced in .
An argumentation framework is a pair where is a finite set and . The elements of are called arguments. The elements of are called the attacks between the arguments and we say for that attacks if and only if . A set is called conflict-free if and only if there are no such that . We say that a vertex is defended by if for every that attacks , i.e. , there is an argument that attacks . The set is called admissible if and only if it is conflict-free and all elements of are defended by . An admissible set is called preferred if and only if it is subset-maximal in the set of all admissible sets.
There are two main notions of acceptance: A set of arguments is accepted credulously if and only if there is a preferred admissible set such that . The set is accepted skeptically if and only if for all preferred admissible sets we have . Both notions of acceptance have been studied extensively in particular with the following complexity results: it is hard to decide, given an argumentation framework and a set , if is credulously accepted. For skeptical acceptance, the analogous decision problem is -complete . Credulous acceptance is easier to decide, because when is contained in any admissible set then it is also contained in a preferred admissible set : a simple greedy algorithm that adds arguments to that are not in any conflicts constructs such an .
Concerning treewidth, after some results using Courcelle’s Theorem , it was shown in  by dynamic programming that credulous acceptance can be decided in time while skeptical acceptance can be decided in time for argument frameworks of size n and treewidth . Here an argument framework is seen as a directed graph and the treewidth is that of the underlying undirected graph. We reprove these results in our setting. To this end, we first encode conflict free sets in CNF. Given an argumentation framework , construct a CNF formula that has an indicator variable for every as
It is easy to see that the satisfying assignments of encode the conflict-free sets for . To encode the admissible sets, we add an additional variable for every and define:
The clauses for each are equivalent to , i.e., is true in a model if and only if is attacked by the encoded set. Thus by setting
we get a CNF formula whose models restricted to the variables are exactly the admissible sets. We remark that in  the authors give a similar SAT-encoding for argumentation problems with slightly different semantics.
If has treewidth , then has incidence treewidth .
We start from a tree decomposition of width of and construct a tree decomposition of . First note that is also a tree decomposition of the primal graph of up to renaming each to . For every there is thus a bag that contains both and . We connect a new leaf to containing where is a clause node for the clause to construct a tree decomposition of the primal graph of .
Now we add to all bags containing , so that for every clause we have a bag containing both variables, and we add new leaves for the corresponding clause nodes as before. Then we add for every clause the node to every bag containing . This covers all edges incident to in the incidence graph of and since for every we only have one such edge, this only increases the width of the decomposition by a constant factor. We obtain a tree decomposition of width for the incidence graph of .
The additional edges for are treated similarly to above and we get a tree decomposition of width of of as desired. ∎
There is an algorithm that, given an argumentation framework of treewidth and a set , decides in time if is credulously accepted.
We also give a short reproof of the second result of .
There is an algorithm that, given an argumentation framework of treewidth and a set , decides in time if is skeptically accepted.
Note that the preferred admissible sets of are exactly the subset maximal assignments to the that can be extended to a satisfying assignment of . Let , then we can express the fact that an assignment is a preferred admissible set by
where the sets , and are defined analogously to . Then does not appear in all preferred admissible sets if and only if
After negation we get
We now show that Theorem 4.3 is essentially tight.
There is no algorithm that, given an argumentation framework of size and treewidth and a set , decides if is in every preferred admissible set of in time , unless ETH is false.
One can show that is in every preferred admissible set of if and only if is true. Moreover, from a tree decomposition of the primal graph of we get a tree decomposition of as follows: we add every to every bag that contains and we add to all bags. This increases the treewidth from to and thus we get the claim with Theorem 3.3. ∎
In this section, we consider (propositional) abduction, a form of non-monotone reasoning that aims to find explanations for observations that are consistent with an underlying theory. A propositional abduction problem (short PAP) consists of a tuple where is a propositional formula called the theory in variables , the set is called the set of manifestations and the set of hypotheses. We assume that is always in CNF. In abduction, one identifies a set with the formula . Similarly, given a set , we define . A set is a solution of the PAP, if , i.e., all models of are models of .
There are three main problems on PAPs that have been previously studied:
Solvability: Given a PAP , does it have a solution?
Relevance: Given a PAP and , is contained in at least one solution?
Necessity: Given a PAP and , is contained in all solutions?
The first two problems are -complete while necessity is -complete . In , it is shown with Courcelle’s Theorem that if the theory of an instance is of bounded treewidth, then all three above problems can be solved in linear time. Moreover,  gives an algorithm based on a Datalog-encoding that solves the solvability and relevance problems in time on instances of treewidth . Our first result gives a simple reproof of the latter results and gives a similar runtime for necessity.
There is a linear time algorithm that, given a PAP such that the incidence treewidth of is and , decides in time the solvability, relevance and necessity problems.
We first consider solvability. We identify the subsets with assignments to in the obvious way. Then, for a given choice , we have that is consistent if and only if
is true where has a variable for every variable . Moreover, if and only if
where similarly to has a variable for every variable . To get a -formula, we observe that the PAP has no solution if and only if
is true, where denotes the restriction of to the variables of . Now applying Lemmata 2.3 and 2.4 in combination with de Morgan laws to express yields a -QBF of incidence treewidth and the result follows with Corollary 3.2.
For relevance, we simply add the hypothesis to and test for solvability.
For necessity, observe that is in all solutions if and only if
which can easily be brought into -QBF slightly extending the construction for the solvability case. ∎
Using the -hardness reduction from , it is not hard to show that the above runtime bounds are tight.
There is no algorithm that, given a PAP whose theory has primal treewidth , decides decides solvability of in time , unless ETH is false. The same is true for relevance and necessity of a variable .
Let be a -QBF with and . Define a PAP as follows
where and are fresh variables. It is shown in  that is true if and only if has a solution. We show that can be rewritten into CNF-formula with the help of Lemma 2.3. The only non-obvious part is the rewriting of . We solve this part by first negating into and observing that the second conjunct is just a clause, adding it to only increases the treewidth by . Finally, we negate the resulting formula to get a CNF-formula for with the desired properties. The rest of the construction of is straightforward. The claim then follows with Theorem 3.3.
The result is a PAP with theory of treewidth and variables and the result for solvability follows with Theorem 3.3. As to the result for relevance and necessity, we point the reader to the proof of Theorem 4.3 in . There for a PAP a new PAP with three additional variables and additional clauses is constructed such that solvability of reduces to the necessity (resp. relevance) of a variable in . Since adding a fixed number of variables and clauses only increases the primal treewidth at most by a constant, the claim follows. ∎
5.1 Adding -Preferences
In abduction there are often preferences for the solution that one wants to consider for a given PAP. One particular interesting case is -preference where one tries to find (subset-)minimal solutions, i.e. solutions such that no strict subset is a solution. This is a very natural concept as it corresponds to finding minimal explanations for the observed manifestations. We consider two variations of the problems considered above, -relevance and -necessity. Surprisingly, complexity-wise, both remain in the second level of the polynomial hierarchy . Below we give a linear-time algorithm for these problems.
There is a linear time algorithm that, given a PAP such that the incidence treewidth of is and , decides in time the -relevance and -necessity problems.
(sketch) We have seen how to express the property of a set being a solution as a formula in the proof of Theorem 5. Then expressing that is a minimal model can written by
This directly yields QBFs for encoding the -necessity and -relevance problems as before which can again be turned into treewidth . The only difference is that we now have three quantifier alternations leading to a triple-exponential dependence on when applying the algorithm from  ∎
We remark that  already gives a linear time algorithm for -relevance and -necessity based on Courcelle’s algorithm and thus without any guarantees for the dependence on the runtime. Note that somewhat disturbingly the dependence on the treewidth in Theorem 5.3 is triple-exponential. We remark that the lower bounds we could get with the techniques from the other sections are only double-exponential. Certainly, having a double-exponential dependency as in our other upper bounds would be preferable and thus we leave this as an open question.
In this section, we consider the problem of circumscription. To this end, consider a CNF-formula encoding a propositional function called the theory. Let the variable set of be partitioned into three variable sets . Then a model of is called -minimal if and only if there is no model such that and . In words, is minimal on for the models that coincide with it on . Note that and can take arbitrary values on . We denote the -minimal models of by . Given a CNF-formula , we say that entails , in symbols , if all assignments in are models of . The problem of circumscription is, given and as before, to decide if .
Circumscription has been studied extensively and is used in many fields, see e.g. [30, 33]. We remark that circumscription can also be seen as a form of closed world reasoning which is equivalent to reasoning under the so-called extended closed world assumption, see e.g.  for more context. On general instances circumscription is -complete  and for bounded treewidth instances, i.e. if the treewidth of is bounded, there is a linear time algorithm shown by Courcelle’s Theorem . There is also a linear time algorithm for the corresponding counting problem based on datalog . We here give a version of the result from  more concrete runtime bounds.
There is an algorithm that, given an instance and of incidence treewidth , decides if in time .
Note that we have if and only if for every assignment to , we have that is not a model of , or is a model of or there is a model of such that and . This can be written as a -formula as follows:
We first compute a tree decomposition of of width in time . We can use Lemma 2.3, Lemma 2.4 and Proposition 2.1 to compute in time a CNF-formula such that the matrix of is a projection of and has incidence treewidth . Applying Corollary 3.2, yields the result. ∎
There is no algorithm that, given an instance and of size and treewidth , decides if in time , unless ETH is false.
Let be a QBF with and . We define the theory as follows:
where and are fresh variables. Set and and the rest of the variables. In , it is shown that if and only if is true. Now using Lemma 2.3 we turn into a 2-QBF with the same properties. Note that has treewidth and variables and thus the claim follows directly with Theorem 3.3.∎
7 Minimal Unsatisfiable Subsets
Faced with unsatisfiable CNF-formula, it is in many practical settings highly interesting to find the sources of unsatisfiability. One standard way of describing them is by so-called minimal unsatisfiable subsets. A minimal unsatisfiable set (short MUS) is an unsatisfiable set of clauses of a CNF-formula such that every proper subset of is satisfiable. The computation of MUS has attracted a lot of attention, see e.g. [25, 21, 36] and the references therein.
In this section, we study the following question: given a CNF-formula and a clause , is contained in a MUS of ? Clauses for which this is the case can in a certain sense be considered as not problematic for the satisfiability of . As for the other problems studied in this paper, it turns out that the above problem is complete for the second level of the polynomial hierarchy, more specifically for . Treewidth restrictions seem to not have been considered before, but we show that our approach gives a linear time algorithm in a simple way.
There is an algorithm that, given a CNF-formula incidence treewidth and a clause of , decides is in a MUS of in time .
Note that is in a MUS of if and only if there is an unsatisfiable clause set such that and is satisfiable. We will encode this in -QBF. In a first step, similarly to the proof of Lemma 2.3, we add a new variable for every clause of and substitute by clauses expressing . Call the resulting formula . It is easy to see that the incidence treewidth of is at most double that of . Moreover, for every assignment to , there is exactly one extension to a satisfying assignment of . Moreover, in a clause variable is true if and only if satisfies the clause . Let be a set of clauses, then is unsatisfiable if and only if for every assignment to , is not contained in the set of satisfied clauses. Interpreting sets by assignments as before, we can write this as a formula by
Let now range over the sets of clauses not containing . Then we have by the considerations above that appears in a MUS if and only if
Negating and rewriting the matrix of the resulting QBF with Lemma 2.3, we get in linear time a -QBF of treewidth that is true if and only if does not appear in a MUS of . Using Theorem 3.2 completes the proof. ∎
There is no algorithm that, given a CNF-formula with variables and primal treewidth and a clause of , decides if is in a MUS of in time , unless ETH is false.
Given a -QBF of incidence treewidth where are the clauses of , we construct the CNF-formula
In  it is shown that is true if and only if the clause appears in a MUS of . Note that has primal treewidth : in a tree decomposition of the primal graph of , we can simply add the variable into all bags to get a tree decomposition of the primal graph of . Since clearly , any algorithm to check if is in a MUS of in time contradicts ETH with Theorem 3.3. ∎
In this paper, we took an alternate approach in the design of optimal algorithms mainly for the second level of the polynomial hierarchy parameterized by treewidth: we used reductions to 2-QBF.We stress that, apart from some technical transformations on CNF-formulas which we reused throughout the paper, our algorithms are straightforward and all complexity proofs very simple. We consider this as a strength of what we propose and not as a lack of depth, since our initial goal was to provide a black-box technique for designing optimal linear-time algorithms with an asymptotically optimal guarantee on the treewidth. We further supplement the vast majority of our algorithms by tight lower-bounds, using ETH reductions again from 2-QBF.
We concentrated on areas of artificial intelligence, investigating a collection of well-studied and diverse problems that are complete for and . However we conjecture that we could apply our approach to several problems with similar complexity status. Natural candidates are problems complete for classes in the polynomial hierarchy, starting from the second level, see e.g.  for an overview (mere -complete problems can often be tackled by other successful techiques).
Of course, our approach is no silver bullet that magically makes all other techniques obsolete. On the one hand, for problems whose formulation is more complex than what we consider here, Courcelle’s Theorem might offer a richer language to model problems than QBF. This is similar in spirit to some problems being easier to model in declarative languages like ASP than in CNF. On the other hand, handwritten algorithms probably offer better constants than what we get by our approach. For example, the constants in  are more concrete and smaller than what we give in Section 4. However, one could argue that for double-exponential dependencies, the exact constants probably do not matter too much simply because already for small parameter values the algorithms become infeasible111To give the reader an impression: and already .. Despite these issues, in our opinion, QBF encodings offer a great trade-off between expressivity and tightness for the runtime bounds and we consider it as a valuable alternative.
Most of the research in this paper was performed during a stay of the first and third authors at CRIL that was financed by the project PEPS INS2I 2017 CODA. The second author is thankful for many valuable discussions with members of CRIL, in particular Jean-Marie Lagniez, Emmanuel Lonca and Pierre Marquis, on the topic of this article.
Moreover, the authors would like to thank the anonymous reviewers whose numerous helpful remarks allowed to improve the presentation of the paper.
-  Ofer Arieli and Martin W. A. Caminada. A general qbf-based formalization of abstract argumentation theory. In Bart Verheij, Stefan Szeider, and Stefan Woltran, editors, Computational Models of Argument, COMMA 2012, pages 105–116, 2012.
-  Stefan Arnborg and Andrzej Proskurowski. Linear time algorithms for NP-hard problems restricted to partial k-trees. Discrete Applied Mathematics, 23(1):11–24, 1989.
-  Albert Atserias and Sergi Oliva. Bounded-width QBF is PSPACE-complete. J. Comput. Syst. Sci., 80(7):1415–1429, 2014.
-  Hans L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput., 25(6):1305–1317, 1996.
-  Marco Cadoli and Maurizio Lenzerini. The complexity of propositional closed world reasoning and circumscription. J. Comput. Syst. Sci., 48(2):255–310, 1994.
-  Hubie Chen. Quantified constraint satisfaction and bounded treewidth. In Ramon López de Mántaras and Lorenza Saitta, editors, Proceedings of the 16th Eureopean Conference on Artificial Intelligence, ECAI 2004, pages 161–165, 2004.
-  Bruno Courcelle. The monadic second-order logic of graphs. i. recognizable sets of finite graphs. Inf. Comput., 85(1):12–75, 1990.
-  DIMACS. Satisfiability: Suggested Format. DIMACS Challenge. DIMACS, 1993.
-  Phan Minh Dung. On the acceptability of arguments and its fundamental role in nonmonotonic reasoning, logic programming and n-person games. Artif. Intell., 77(2):321–358, 1995.
-  Paul E. Dunne. Computational properties of argument systems satisfying graph-theoretic constraints. Artif. Intell., 171(10-15):701–729, 2007.
-  Paul E. Dunne and Trevor J. M. Bench-Capon. Coherence in finite argument systems. Artif. Intell., 141(1/2):187–203, 2002.
-  Wolfgang Dvorák, Reinhard Pichler, and Stefan Woltran. Towards fixed-parameter tractable algorithms for abstract argumentation. Artif. Intell., 186:1–37, 2012.
-  Uwe Egly and Stefan Woltran. Reasoning in argumentation frameworks using quantified boolean formulas. In Paul E. Dunne and Trevor J. M. Bench-Capon, editors, Computational Models of Argument, COMMA 2006, pages 133–144, 2006.
-  Eduard Eiben, Robert Ganian, and Sebastian Ordyniak. Using decomposition-parameters for QBF: mind the prefix! In Dale Schuurmans and Michael P. Wellman, editors, Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, pages 964–970, 2016.
-  Eduard Eiben, Robert Ganian, and Sebastian Ordyniak. Small resolution proofs for QBF using dependency treewidth. CoRR, abs/1711.02120, 2017.
-  Thomas Eiter and Georg Gottlob. Propositional circumscription and extended closed-world reasoning are -complete. Theor. Comput. Sci., 114(2):231–245, 1993.
-  Thomas Eiter and Georg Gottlob. The complexity of logic-based abduction. J. ACM, 42(1):3–42, 1995.
-  Eldar Fischer, Johann A. Makowsky, and Elena V. Ravve. Counting truth assignments of formulas of bounded tree-width or clique-width. Discrete Applied Mathematics, 156(4):511–529, 2008.
-  Markus Frick and Martin Grohe. The complexity of first-order and monadic second-order logic revisited. Ann. Pure Appl. Logic, 130(1-3):3–31, 2004.
-  Georg Gottlob, Reinhard Pichler, and Fang Wei. Bounded treewidth as a key to tractability of knowledge representation and reasoning. Artif. Intell., 174(1):105–132, 2010.
-  Alexey Ignatiev, Alessandro Previti, Mark H. Liffiton, and Joao Marques-Silva. Smallest MUS extraction with minimal hitting set dualization. In Principles and Practice of Constraint Programming, CP 2015, volume 9255, pages 173–182, 2015.
-  Michael Jakl, Reinhard Pichler, Stefan Rümmele, and Stefan Woltran. Fast counting with bounded treewidth. In Logic for Programming, Artificial Intelligence, and Reasoning, LPAR 2008, volume 5330, pages 436–450, 2008.
-  Mikolás Janota and João P. Marques Silva. On deciding MUS membership with QBF. In Principles and Practice of Constraint Programming, CP 2011, volume 6876 of Lecture Notes in Computer Science, pages 414–428. Springer, 2011.
-  Ton Kloks. Treewidth, Computations and Approximations, volume 842 of Lecture Notes in Computer Science. Springer, 1994.
-  Jean-Marie Lagniez and Armin Biere. Factoring out assumptions to speed up MUS extraction. In Matti Järvisalo and Allen Van Gelder, editors, Theory and Applications of Satisfiability Testing, SAT 2013, volume 7962 of Lecture Notes in Computer Science, pages 276–292. Springer, 2013.
-  Jean-Marie Lagniez, Emmanuel Lonca, and Jean-Guy Mailly. Coquiaas: A constraint-based quick abstract argumentation solver. In 27th IEEE International Conference on Tools with Artificial Intelligence, ICTAI 2015, pages 928–935, 2015.
-  Michael Lampis and Valia Mitsou. Treewidth with a quantifier alternation revisited. 2017.
-  Alexander Langer, Felix Reidl, Peter Rossmanith, and Somnath Sikdar. Practical algorithms for MSO model-checking on tree-decomposable graphs. Computer Science Review, 13-14:39–74, 2014.
-  Paolo Liberatore. Redundancy in logic I: CNF propositional formulae. Artif. Intell., 163(2):203–232, 2005.
-  Vladimir Lifschitz. Handbook of logic in artificial intelligence and logic programming (vol. 3). chapter Circumscription, pages 297–352. Oxford University Press, Inc., New York, NY, USA, 1994.
-  Daniel Lokshtanov, Dániel Marx, and Saket Saurabh. Lower bounds based on the exponential time hypothesis. Bulletin of the EATCS, 105:41–72, 2011.
-  Dániel Marx and Valia Mitsou. Double-exponential and triple-exponential bounds for choosability problems parameterized by treewidth. In 43rd International Colloquium on Automata, Languages, and Programming, ICALP 2016, pages 28:1–28:15, 2016.
-  John McCarthy. Applications of circumscription to formalizing common-sense knowledge. Artif. Intell., 28(1):89–116, 1986.
-  Marko Samer and Stefan Szeider. Algorithms for propositional model counting. J. Discrete Algorithms, 8(1):50–64, 2010.
-  Marcus Schaefer and Christopher Umans. Completeness in the polynomial-time hierarchy: A compendium. SIGACT news, 33(3):32–49, 2002.
-  João P. Marques Silva and Inês Lynce. On improving MUS extraction algorithms. In Theory and Applications of Satisfiability Testing, SAT 2011, pages 159–173, 2011.
Appendix A Proof of Proposition 2.1
In this section we prove that given a CNF formula with bounded incidence treewidth and unbounded arity we can compute in linear time a 3CNF formula which has essentially the same treewidth (give or take a constant).
There is an algorithm that, given a CNF formula of incidence treewidth , computes in time a 3CNF formula of incidence treewidth with such that is a projection of .
We use the classic reduction from SAT to 3SAT that cuts big clauses into smaller clauses by introducing new variables. During this reduction we have to take care that the runtime is in fact linear and that we can bound the treewidth appropriately.
In a first step, we compute a tree decomposition of width for the incidence graph of in time with the algorithm from [BodlaenderDDFLP13].
We store in the following format: for every clause we have a doubly linked list storing pointers to all variables in and their polarity, i.e., if they appear positively or negatively. Moreover, for every variable we have a doubly linked list storing pointers to the clauses that appears in. So far, this is essentially an adjacency list representation of the incidence graph of . As additional information, we add for every entry in that points to a variable also a pointer to the cell in that points to . Symmetrically, we add in the cell pointing to in a pointer to the cell in pointing towards . The purpose of this data structure is that it allows us efficient deletions: if we are in a cell in that points towards , we can delete the edge from the adjacency list in constant time without having to search for the right entry in . Similarly, if we have the entry in representing the edge , we can delete this edge in constant time. Note that this data structure can be computed easily in linear time in a single pass over .
We now construct the formula along a postfix DFS order on (that can easily be computed in linear time). For each clause node appearing in a bag, we store a variable that will be put in the next clause we print out for . will always be a variable that does not appear outside the subtree below in and might be empty.
We now describe the construction in the different types of nodes in :
if introduces a new variable, we copy the values from its child and do nothing else.
if introduces a new clause , we initialize as empty and copy all other values from the child node.
if is forget node for a variable , we first copy all as before. Then, for every clause in such that contains , we do the following: if is empty, we set to with the polarity as in . If contains a literal , we write out a clause where is the variable with the same polarity as in and is a fresh variable we have not used before. Then we set to . Finally, in any case, we delete the edge in our data structure.
if is a forget node for a clause , we again first copy all . Then define the set that consists of and all literals whose variables are in that appear in . We arbitrarily split into a 3CNF by adding some more fresh variables and print it out. Afterwards, we delete all edges containing in our data structure.
if is a join node with two children and , we compute the as follows: if and are empty, we set empty as well. If exactly one of the and contains a literal, we set to that literal. If contains and contains , we print out a clause for a fresh variable and set to .
This completes the algorithm. The clauses we have printed out in the various steps form the formula . We have to check that the algorithm indeed runs in linear time in and that has the desired properties.
Obviously, is in 3CNF, because all clauses we print out only contain at most variables.
We next argue that the treewidth of is . To this end, we construct a tree decomposition . For every bag the corresponding bag contains all variables in and all variables in the . Moreover, for every for which the algorithm prints out a clause , we put and the variables of into . Since in every bag we print out at most clauses and all of them have size at most , the resulting has size . By construction, the bags cover all edges in the incidence graph of . Finally, the connectivity condition is easy to verify. It follows that the treewidth of is .
We next claim that the construction of from and can be done in time with the help of our data structure. To see this, first observe when a variable is forgotten in a bag , it contains only at most neighbors in our data structure and those all lie in . This is because for all neighbors that have been forgotten before, the corresponding edges have been deleted in the adjacency lists. The same is true when forgetting clauses. Thus, we can find the clauses that a variable is in in time . Since we can delete edges in constant time, it is easy to see that every bag can be treated in time polynomial in . Since can be assumed to be of size linear in , the desired runtime bound follows.
Finally, it is easy to see that is a projection of . This follows exactly as in the usual reduction from SAT to 3SAT. The only slight difference is that instead of cutting of pieces of the formula from the left to the right side, we decompose clauses potentially in a treelike fashion which results in clauses that contain only fresh variables. However, this does changes neither the correctness of the reduction not the argument. ∎
Appendix B Bounded Treewidth -QBF in Linear Time
We sketch a proof for linear runtime in Theorem 3.1 and refer the reader to  for the technical details. In fact, since this will not be much more work, we treat the case of -QBF, the generalization of -QBF to quantifier blocks.
To give the runtime bound, define recursively by and . We now state the linear time version of the main result in .
There is an algorithm that given a -QBF of primal treewidth decides in time if is true.
We remark that Theorem B.1 was already observed in [PanV06] but, since that paper gives no justification of that claim, we decided to give some more details.
The crucial data structure in  are choice constraints which consist of a variable scope and a rooted tree with unbounded fanout in which all leaves are at depth and for every leaf a relation .
Chen then defines choice quantified formulas which consist of a variable prefix and a conjunction of choice constraints in the variables of the prefix. We omit the semantics of choice quantified formulas here since they are not important for our sketch and refer the reader to  for details. We remark however that any given QBF where all clauses have at most variables can be turned in time into a choice quantified formula such that is true if and only if is.
We define a notion of equivalence for nodes in choice constraints: leaves are equivalent if and only if they have the same relation. Equivalence of two nodes of depth is defined recursively: let be the children of and be children of . Then and are equivalent if and only if for every there is an equivalent and for every there is an equivalent 222We remark that the notion of equivalence in  is slightly different. We chose to modify the definition since our notion gives slightly smaller size bounds for normalized choice constraints and have the same properties concerining truth of the resulting formulas.. A choice constraint is in normal form if and only if no node has any equivalent children.
Chen shows that one can normalize a choice constraint by deleting iteratively for all equivalent pairs of nodes one of them and its subtree. Crucially, applying this operation for a constraint in a choice quantified formula yields an equivalent formula.
There are non-equivalent normal choice constraints with scope of size whose leaves are at depth and all of these constrains have size .
Choice constraints of depth are just relations of arity over , so there are of those. Moreover, each of those relations can be decribed in size , e.g. by a value table.
For , by definition of equivalence, the root can have as children any subset of normal choice constraints of depth and the same scope. Since there are by induction of those, the first claim follows by definition of . The description size is at most ∎
Note that we can check the equivalence of two children in time polynomial in the size of a given choice constraint and thus normalization can also be done in time .
Chen also introduces a polynomial time computable join operation on choice constraints with the property that substituting two choice constraints by their join in a choice quantified formula one gets a new formula that is equivalent to the old. A naive solution to solve choice quantified formulas would thus be to simply join all its choice constraints and then check the single resulting constraint. The problem with this is that it would grow the variables scope of the resulting constraint (the variables of a join are the unions those of the joined constraints) such that the size bound in Observation B.2 would become meaningless and the runtime bound would explode.
The solution to this is working along a tree decomposition: in every forget node, one joins all choice constraints having the forgotten variable in their scope. Note that these choice constraints and thus also the resulting join only have at most the variables of the current bag in the scope, so by normalizing after every join, the resulting choice constraint will have size at most . Now the variable to forget only appears in a single choice constraint and Chen shows how to forget it in that case in an operation that may grow the choice constraint but by applying normalization during this forget operation one maintains the size bound of Observation B.2. Applying this on all forget nodes iteratively, one gets a trivial choice constraint formula that can be decided in constant time.
Let us explain why this algorithm runs within the claimed time bounds: by similar preprocessing than that in Proposition 2.1, we can make sure that for every node that is forgotten, we can look up all constraints it appears in time linear in the number of those constraints, so at most . Now we compute at most pairwise joins followed by normalization which run each in time . Thus the overall time for joining and normalizing is . Observing that the forgetting can also be done in polynomial time and thus in leads to an overall cost per forgotten variables of . Now noting that the computation of the tree decomposition and a traversal to find the order in which the variables are forgotten can be done in time where is the number of variables, completes the proof.