On space efficiency of algorithms working on structural decompositions of graphs

Dynamic programming on path and tree decompositions of graphs is a technique that is ubiquitous in the field of parameterized and exponential-time algorithms. However, one of its drawbacks is that the space usage is exponential in the decomposition's width. Following the work of Allender et al. [Theory of Computing, '14], we investigate whether this space complexity explosion is unavoidable. Using the idea of reparameterization of Cai and Juedes [J. Comput. Syst. Sci., '03], we prove that the question is closely related to a conjecture that the Longest Common Subsequence problem parameterized by the number of input strings does not admit an algorithm that simultaneously uses XP time and FPT space. Moreover, we complete the complexity landscape sketched for pathwidth and treewidth by Allender et al. by considering the parameter tree-depth. We prove that computations on tree-depth decompositions correspond to a model of non-deterministic machines that work in polynomial time and logarithmic space, with access to an auxiliary stack of maximum height equal to the decomposition's depth. Together with the results of Allender et al., this describes a hierarchy of complexity classes for polynomial-time non-deterministic machines with different restrictions on the access to working space, which mirrors the classic relations between treewidth, pathwidth, and tree-depth.


Introduction
Treewidth is a graph parameter that measures how much a graph resembles a tree. Intuitively, a graph has treewidth s if it can be decomposed into parts (called bags) of size at most s + 1 so that this decomposition, called a tree decomposition, has the shape of a tree. While initially introduced by Robertson and Seymour in their Graph Minors project [47], treewidth has found numerous applications in the field of algorithms. This is mostly due to the fact that many problems that are intractable on general graphs, become efficiently solvable on graphs of small treewidth using the principle of dynamic programming. Theorems of Courcelle [17] and of Arnborg et al. [5] explain that every decision or optimization problem expressible in Monadic Second Order logic can be solved in time f (s)·n on graphs of treewidth s and size n, for some function f . While f can be non-elementary, for many classic problems, like Vertex Cover, 3Coloring, or Dominating Set, the natural dynamic programming approach yields an algorithm with running time O(c s · n) for some typically small constant c. This is important from the point of view of applications, because dynamic programming procedures working on tree decompositions often serve as critical subroutines in more complex algorithms, such as subexponential algorithms derived using the technique of bidimensionality [19], or approximation schemes that use Baker's approach [7]. Algorithms working on tree decompositions are usually analyzed in the paradigm of parameterized complexity, where the width of the decomposition is the considered parameter. Nowadays, the study of problems parameterized by structural measures of the input, such as treewidth, is a classic topic of study in this field. We refer to textbooks [18,20,26] for a broad introduction, and to a recent survey of Langer et al. [35] for more specific results.
A certain limitation of dynamic programming on a tree decomposition is that it uses space exponential in its width. In practical applications this is often a prohibitive factor, because the machine is likely to simply run out of space much before the elapsed time exceeds tolerable limits. Therefore, recently there is much focus on reducing the space complexity of exponential-time algorithms to polynomial, even at the cost of slightly worsening the time complexity [6,9,27,28,39,42]. Here, the usage of algebraic tools proved to be an extremely useful approach. Unfortunately, algorithms working on tree decompositions of graphs remain a family where virtually no progress has been achieved in this matter. Therefore, a natural question arises: Can we reduce the space complexity of algorithms working on tree decompositions while keeping (or moderately worsening) their time complexity? The first explicit statement of this question known to us is due to Lokshtanov et al. [38], who sketched how using a simple tradeoff one can obtain polynomial space complexity while increasing the time complexity to 2 O(s 2 ) + O(n 2 ). Later, the same question was asked by Langer et al. [35].
Following early completeness results of Monien and Sudborough [41] on bandwidth-constrained problems and of Gottlob et al. [31] on conjunctive queries of bounded treewidth, Allender et al. [4] recently initiated the systematic study of satisfaction complexity in small, but non-constant path-and treewidth. Essentially, they observe that CSP-like problems-say, 3Coloring for concreteness 1 -when limited to instances of small treewidth or pathwidth, are complete for certain complexity classes under logspace reductions. More precisely, when the input graph is equipped with a path decomposition of width at most s(n) ≥ log n, for some fixed constructible function s of the input size, then 3Coloring (denoted in this case as pw-3Coloring space ] is that the algorithm can use an auxiliary push-down of unlimited size, to which read/write access is only from the top. We remark that Allender et al. focus on a different characterization by semi-unbounded fan-in (SAC) circuits; this characterization will not be relevant to our work, and hence we omit it. While they state their results only for s(n) = log k n, the proof works in the more general setting given below. Thus, the feasibility of various space-time tradeoffs for algorithms working on tree/path decompositions is equivalent to inclusions of corresponding complexity classes. For instance (assuming for conciseness s(n c ) = O(s(n)) for each constant c, e.g., s(n) = log k n for some k), pw-3Coloring[s] is solvable in: Similar statements can be inferred for treewidth. In contrast, the best known determinization results come from a brute-force approach or from Savitch's theorem 3 [50], yielding respectively (for constructible t(n) ≥ n and s(n) ≥ log t(n)): In this manner, Allender et al. conclude that, intuitively speaking, achieving better time-space tradeoffs for algorithms working on path and tree decompositions of small width would require developing a general technique of improving upon the tradeoff of Savitch. As Lipton [36] phrased it, "one of the biggest embarrassments of complexity theory is the fact that Savitch's theorem has not been improved [. . .]. Nor has anyone proved that it is tight".
Allender et al. argue that such an improvement would contradict certain rescaled variants of known conjectures about the containment of time-and space-constrained classes, in particular the assumption that NL SC; more precisely that the rescaled hierarchies built on top of these two classes are somehow orthogonal-we refer to [4] for details. We consider the study of Allender et al. not as a definite answer in the topic, but rather as an invitation to a further investigation of links between the introduced conjectures and more well-established complexity assumptions.
Our Contribution. In the Longest Common Subsequence problem (LCS), we are given an alphabet Σ and k strings s 1 , s 2 , . . . , s k over Σ, and the task is to compute the longest sequence of symbols of Σ that appears as a subsequence in each s i . The applicability of the LCS problem in, e.g., computational biology, motivated many to search for faster or more space-efficient algorithms, as the classical dynamic programming solution, running in time and space O(n k ) (where n is the length of each string and k the number of strings) is often far from practical. From the point of view of parameterized complexity, LCS parameterized by k is W[t]-hard for every level t [12], remains W[1]-hard even for a fixed-sized alphabet [45], and is W [1]-complete when parameterized jointly by k and , the target length of the subsequence [32]. In a recent breakthrough, Abboud et al. [1] proved that the existence of an algorithm with running time O(n k−ε ), for any ε > 0, would contradict the Strong Exponential Time Hypothesis. As far as the space complexity is concerned, only modest progress has been achieved: The best known result is an algorithm of Barsky et al. [8], which improves the space complexity to O(n k−1 ). This motivates us to formulate the following conjecture.

Conjecture 1.
There is no algorithm for LCS that works in time n f (k) and space f (k)poly(n) for a computable function f , where k is the number of input strings and n the total input length.
Quite surprisingly, we show that Conjecture 1 is closely related to the question about time-space tradeoffs for algorithms working on path decompositions of bounded width.
Theorem 2. The following statements hold: • Conjecture 1 implies the following: There is no algorithm for pw-3Coloring working in time 2 O(s) poly(n) and space 2 o eff (s) poly(n) (for all values of width s).
• Conjecture 1 is implied by the following: There is an unbounded, computable function g, for which pw-3Coloring cannot be solved in time 2 s·g(s) poly(n) and space 2 o eff (s) poly(n) (for all values of width s).
Thus, Conjecture 1 is sandwiched between a weaker statement that it is impossible to achieve subexponential space complexity while keeping single exponential time complexity, and a stronger statement that this holds even if we allow the time complexity exponent to increase by some (arbitrarily slowly growing) computable function of the width.
To prove Theorem 2, we use the results of Elberfeld et al. [25] who showed a completeness result for LCS. Viewed from this perspective, Conjecture 1 is equivalent to a statement in parameterized complexity about the impossibility of determinization results improving upon Savitch's theorem (we defer the definitions and discussion to Section 3). Using the ideas of Cai and Juedes [13] that connected subexponential complexity to fixed-parameter tractability, we consider a reparameterized version of pw-3Coloring. This allows us to compare questions concerning time-space tradeoffs for pw-3Coloring and determinization of N[ t In the second part of this work, we complement the findings of Allender et al. [4] by considering the graph parameter tree-depth. For a graph G, its tree-depth is equal to the minimum height of a rooted forest T whose ancestor-descendant closure contains G as a subgraph; the forest T is then called a tree-depth decomposition of G. Tree-depth of a graph is lower bounded by its pathwidth and upper bounded by its treewidth times lg n. Our motivation for considering this parameter is two-fold. First, recent advances have uncovered a wide range of topics where tree-depth appears naturally. For instance, tree-depth plays an important role in the theory of sparse graphs developed by Nešetřil and Ossona de Mendez [43], is the key factor in classification of homomorphism problems that can be solved in logspace [15], and corresponds to classes of graphs where the expressive power of First-Order logic and Monadic Second-Order logic coincides [22]. It was also rediscovered several times in different contexts and under different names: minimum elimination tree height [46], ordered chromatic number [33], vertex ranking [11], or the maximum number of introduce nodes on a root-to-leaf path in a tree decomposition of a graph [28].
Second, algorithms working on tree-depth decompositions of small height model generic exponentialtime Divide&Conquer algorithms. In this approach, after finding a small, usually balanced separator S in the graph, the algorithm tries all possible ways a solution can interact with S, and solves connected components of G − S recursively. A run of such an algorithm naturally gives rise to a tree-depth decomposition of the graph, where S is placed on top of the decomposition, and decompositions of the components of G − S are attached below it as subtrees. The maximum total number of separator vertices handled at any moment in the recursion corresponds to the height of the decomposition. Thus, many classic Divide&Conquer algorithms, including the ones derived for planar graphs using the Lipton-Tarjan separator theorem [37], can be reinterpreted as first building a tree-depth decomposition of the graph using a separator theorem, and then running the algorithm on this decomposition.
Most importantly for us, when implemented using recursion, the algorithms working on treedepth decompositions run in polynomial space. For instance, such an algorithm for 3Coloring on a tree-depth decomposition of depth s runs in time 3 s · poly(n) and space O(s + log n) (see Lemma 26), which places td-3Coloring ]. This is immediate for CSP-like problems like 3Coloring, but recently Fürer and Yu [28] showed that algebraic transforms can be used to reduce the space usage to polynomial in n also for other problems, like counting perfect matchings or dominating sets. In Section 5, we describe how this approach gives an 3 s · poly(n)-time poly(n)-space algorithm for Dominating Set in more detail, and then improve the space usage to O(s · log n) using Fourier transforms and the Chinese remainder theorem. This means that the reduction of space complexity that is conjectured to be impossible for treewidth and pathwidth, actually is possible for tree-depth. Therefore, we believe that it is useful to study the model of computations standing behind low tree-depth decompositions, in order to understand how it differs from the models for treewidth and pathwidth.
Consequently, mirroring Theorem 1, we prove that computations on tree-depth decompositions exactly correspond to the class NAuxSA[poly time , log space , s height ]: problems which can decided by a non-deterministic Turing Machine that uses polynomial time and logarithmic working space, but also has access to an auxiliary stack of maximum height s. The stack can be freely read by the machine, just like the input tape, but the write access to it is only via push and pop operations. Thus, computations on tree-depth and path decompositions differ by the access restrictions to O(s) space used by the machine. While for pathwidth this space can be accessed freely, for tree-depth all of the space apart from an O(log n) working buffer has to be organized in a stack.
The proof of Theorem 3 largely follows the approach of Akatov and Gottlob [3], who proved a different completeness result for the class NAuxSA[poly time , log space , log 2 height ], which they call DC 1 . The main idea is to regularize the run of the machine so that the push-pop tree has the rigid shape of a full binary tree. Then we can use this concrete structure to "wrap around" gadgets encoding an accepting run of a regularized NAuxSA machine. However, the motivation in the work of Akatov and Gottlob was answering conjunctive queries in a hypergraph by exploiting a kind of balanced decomposition, and hence the problem proven to be complete for DC 1 is a quite general and expressive problem originating in database motivations; see [2,3] for details. In our setting, in order to get a reduction to 3Coloring, we need to work more to encode an accepting run. In particular, to encode each part of the computation where no push or pop is performed, instead of producing a single atom in a conjunctive query, we use computation gadgets that originate in Cook's proof of the NP-completeness of SAT. The assumption that the computation has a polynomial number of steps is essential here for bounding the tree-depth of each such gadget. This way, Theorem 3 presents a more natural complete problem for DC 1 .
Another difference is that Theorem 3 works for any well-behaved function s(n) ≥ log 2 n, as opposed to the bound s(n) = log 2 n inherent to the problem considered by Akatov and Gottlob. For this, the crucial new idea is to increase the working space of the machine to s(n)/ log n in order to be able to perform regularization -a move that looks dangerous at first glance, but turns out not to increase the expressive power of the computation model. This proves the following interesting by-product of our work. Theorem 5 for s(n) = log 2 n also follows from the work of Akatov and Gottlob [3]. Observe that now the justification for the assumption s(n) ≥ log 2 n becomes apparent: for, say, s(n) = log n, the theorem would state that L = NL, a highly unexpected outcome.
We find Theorem 5 interesting, because a naive simulation of the whole configuration space for NAuxSA would require space exponential in s. It appears, however, that the exponential blow-up of the space complexity can be avoided. We do not see any significantly simpler way to prove this result other than going through the td-3Coloring[s] problem, and hence it seems that the tree-depth view gives a valuable insight into the computation model of NAuxSA.
The classic relations between treewidth, pathwidth and tree-depth are, through completeness results, mirrored in a hierarchy between NAuxPDA, N, and NAuxSA classes, as detailed in the concluding section. In particular, this answers a question of Akatov and Gottlob [2,3]  Finally, using Theorem 3 we also give an alternative view on NAuxSA computations using alternating Turing machines in Theorem 27, answering another question of Akatov and Gottlob. From this point of view, Theorem 5 is immediate.
Outline. In Section 2 we give preliminaries, in Section 3 we prove Theorem 2 and related results, and in Section 4 we prove Theorem 3 and derive corollaries from it (Theorems 4 and 5). Section 5 describes the algorithm for Dominating Set in graphs of low tree-depth. We finish by concluding remarks in Section 6. The discussion of how standard NP-hardness reductions preserve parameters linearly is deferred to Appendix A.

Reductions and complexity classes
For two languages P, Q, we write P ≤ L Q when P is logspace reducible to Q. Most of the complexity classes we consider are closed under logspace reductions.
Because we handle various measures of complexity and compare a wide array of classes that bound two measures simultaneously, we introduce the following notation. A complexity class is first described by the machine model: D, N, A denote deterministic, non-deterministic, and alternating (see [49]) Turing machines, respectively. Then, in square brackets, bounds on complexity measures are described (up to constant factors) as a list of functions with the name of the measure it bounds underneath. All functions except the symbol f (which we reserve for classes in parameterized complexity) are functions of the input size n. For example, for t, s : N → N, D[ s space ] denotes the class of languages recognizable by deterministic Turing machines using at most O(s(n)) space, usually known as DSpace(s(n)); similarly N[ t time , s space ] is often denoted NTiSp(t(n), s(n)). We write lg for the logarithm with base 2, log(n) when the base is irrelevant and poly(n) for n O(1) . As customary for the O-notation, a complexity class stated with a bound that is a family of functions (instead of a single function) is defined as the sum of classes over all functions in the family. An auxiliary push-down or stack is denoted as AuxPDA or AuxSA, respectively: the difference is that a push-down can only be read at the top, while a stack can be read just as a tape (both can be written to only by pushing and popping symbols at the top), see e.g. [51]. The measure named height is the maximum height of the push-down or stack.
We say a function s : N → N is constructible if there is a Turing machine which given a number n in unary outputs s(n) in unary using logarithmic space; in particular, this implies s(n) ≤ poly(n). A function s is nice if it is constructible and s(n) lg n is non-decreasing; note that this implies that s(n) itself is also non-decreasing. For simplicity, we will assume all functions s : N → N describing complexity bounds to be nice.
Note that logspace reductions can blow-up instance sizes polynomially, hence the closure of N[poly s(n) such that s(poly(n)) ≤ O(s(n)) (that is, if for every c > 0 there is a d > 0 such that s(n c ) ≤ ds(n)). This includes lg k (n) for any k ≥ 1 and lg n lg lg n, for example; however, one can construct artificial examples that are polylogarithmically bounded but fail to have this property.

Structural parameters
We recall the definitions of treewidth, pathwidth and tree-depth. For conciseness, we will refer to the certifying structures defined below as decompositions for all three parameters.
Definition 6 (treewidth). A tree decomposition of an undirected graph G is a tree T together with a collection of sets of vertices of G (called bags) X t indexed by nodes t ∈ T , such that: • every vertex of G is in at least one bag; • for every edge uv of G, there is a bag containing both u and v; and The width of a tree decomposition is defined as max t∈T |X t |−1. The treewidth of G is the minimum width over all possible tree decompositions of G.
Definition 7 (pathwidth). A path decomposition of an undirected graph G is a tree decomposition (T , (X t ) t∈T ) in which T is a path. The pathwidth of G is the minimum width over all possible path decompositions of G.
Definition 8 (tree-depth). A tree-depth decomposition of an undirected graph G is a rooted forest T (a disjoint union of rooted trees) together with a bijective mapping µ from the vertices of G to the nodes of T , such that for every edge uv of G, µ(u) is an ancestor of µ(v) or µ(v) is an ancestor of µ(u) in T . The depth of a rooted forest is the largest number of nodes on a path between a root and a leaf. The tree-depth of G is the minimum depth over all possible tree-depth decompositions of G.
For technical reasons, we assume that in all given tree and path decompositions, |T | ≤ 2|V (G)| 2 ; standard methods allow to prune any decomposition to this size in logspace, see [34,Lemma 13.1.2].
For a graph problem, such as 3Coloring, a structural parameter π ∈ {td, pw, tw}, and a nice function s : N → N, we define π-3Coloring[s] to be the decision problem where given an instance G of 3Coloring and a π-decomposition of G, we ask whether the decomposition has width at most s(|V (G)|) and G is a yes-instance of 3Coloring. The assumption that a decomposition is given on input is to factor away the complexity of finding it, which is a problem not directly relevant to our work. Note that the validity and width/depth of a decomposition given in any natural encoding can easily be checked in logarithmic space.
Observe also that for any c > 0, π-3Coloring[s(n)] is equivalent to π-3Coloring[s(n c )] under logspace reductions. Namely, a reduction from π-3Coloring[s(n)] to π-3Coloring[s(n c )] is trivial, while the reverse reduction follows easily by padding: adding isolated vertices up to size n c that do not change the answer nor the value of π. Since we assume s to be nice, we have lg n c , hence c · s(n) ≤ s(n c ) for any c ≥ 1. This implies that π-3Coloring[c · s(n)] is equivalent to π-3Coloring[s(n)].
A hierarchy between these classes immediately follows from well-known inequalities between the parameters td, pw, tw, shown in the next lemma and corollary. Every tree-depth decomposition can be turned into a path decomposition by taking bags to be the vertex sets of all the root-to-leaf paths, and ordering them as in a left-to-right scan of the tree. Every path decomposition is trivially a tree decomposition. Every tree decomposition allows to find small separators, which can be used to recursively build a tree-depth decomposition, yielding the last inequality-details can be found e.g. in [44, Corollary 2.5], we show how to execute them effectively below for completeness.

Lemma 9.
There is a constant c ∈ N such that for any graph G, td(G) ≥ pw(G) ≥ tw(G) ≥ td(G)/(c · log |V (G)|). Furthermore, each inequality is certified by an algorithm that transforms the respective graph decompositions in logspace. Proof of Lemma 9. The algorithms for the first two inequalities are trivial. For the third inequality, a straightforward implementation would be problematic because of recursion and the need to remember a subset of vertices. We now show how to circumvent these issues.
Let (T , (X t ) t∈T ) be a given tree decomposition of a graph G of width k. Elberfeld et al. [23,Theorem 14] showed that there is a constant c ∈ N and a logspace algorithm that given a tree T , outputs a width-3 tree decomposition (S, (Y s ) s∈S ) of T such that S is a full binary tree of depth c·log |V (T )| (their implementation in fact uses a circuit model even more restrictive than logspace). Let Z s = t∈Ys X t ; then it is easy to check that (S, (Z s ) s∈S ) is a tree decomposition of G of width at most 4k+ 3, also computable in logspace. Note that S is rooted, so we can consider the ancestor relation on it.
Since S has logarithmic depth, we can construct the following tree-depth decomposition of G. For s ∈ V (S), let Z s be the set of those vertices of Z s , for which s is the top-most node of S to whose bag s belongs. Observe that { Z s : s ∈ V (S)} is a partition of V (G). Let S be the tree obtained by replacing every node s of S by a path P s of | Z s | nodes, respecting the ancestor relation (so that the last vertex of P s becomes the parent of the first vertex of P s for every child s of s). Consider any mapping µ : V (G) → V (S ) which bijectively assigns vertices in each Z s to nodes of P s in an arbitrary order. We claim that (S, µ) defines a tree-depth decomposition. To see this, consider any edge uv of G. The vertices u, v must be contained in some common bag X t and hence in some bag Z s , s ∈ V (S). Let Z s(u) , Z s(v) be the topmost bags containing u, v respectively, then u ∈ Z s(u) , v ∈ Z s(v) . Both s(u) and s(v) must be ancestors of s in S, and hence they are themselves related by the ancestor relation. Since the ancestor relation was preserved by the construction, µ(u) is related to µ(v). This shows correctness.
Membership in Z s , as well as | Z s | can be calculated on the fly in logspace, hence it is straightforward to perform the whole construction in logspace. The depth of S is at most 3k · c · log |T |. Since we assumed that in all given decompositions |T | ≤ 2|V (G)| 2 , the depth is O(k · log |V (G)|).

Equivalence of problems
We say that a reduction between two graph problems preserves structural parameters (linearly) if for each parameter π ∈ {tw, pw, td} there is an integer c ∈ N such that for any instance with graph G, the graph H produced by the reduction satisfies π(H) ≤ c·π(G), and moreover a decomposition of G of width/depth at most s can be transformed in logspace into a decomposition of H of width/depth at most c · s. Many known NP-hardness reductions can be shown to have this property, in particular those that replace each vertex or edge with a gadget of bounded size (see the descriptions of 'local replacement' and 'component design' methods in the classical work of Garey and Johnson [29]). For example, 3Coloring and variants of SAT are equivalent in all our theorems, while Vertex Cover or Dominating Set (defined in [29]) are at least as hard. The proofs are deferred to the appendix.
Definition 11. Let φ be a CNF formula. The primal (Gaifman) graph of φ is the graph with a vertex for each variable of φ and an edge between every pair of variables that appear together in some clause. The incidence graph of φ is the bipartite graph with a vertex for each clause and each variable of φ and an edge between each clause and every variable contained in that clause.
Lemma 12 (♠). The following problems are equivalent under logspace reductions that preserve structural parameters: 3Coloring, CNF-SAT (using a decomposition of the primal graph), k-SAT (using a decomposition of either the primal or incidence graph) for each k ≥ 3.
Furthermore, the following problems admit logspace reductions that preserve structural parameters from the above problems: Vertex Cover, Independent Set, Dominating Set.
We will often consider problems like π-3-SAT or π-CNF-SAT, for π ∈ {tw, pw, td}, in which case we always mean the width/depth of a given decomposition of the primal graph of the formula.

Cook's theorem with bounded space
In our reductions we will need to describe Turing machine computations using CNF formulas, just as in Cook's theorem on the NP-completeness of CNF-SAT. It has already been observed by Monien and Sudborough [41] that Cook's reduction applied to machines with bounded space yields formulas of bounded width. The only difference is that in this setting a machine's worktape space bound can be significantly shorter than the input word-the read-only tape on which the input is placed must be treated differently. One standard solution would be to modify the machine to make it oblivious, i.e., simulate tape operations so that head movements are independent of the input; the reduction can then encode appropriate input symbols exactly where they would be read. We employ a different approach by encoding the reading process directly into the formula, providing the input to each computation step with a copy of the following simple random access gadget. This has the advantage of making our reductions slightly more explicit and adaptable.
Lemma 13 (Random access gadget). For every n ∈ N, there is a 3-CNF formula including named variables: x 0 , . . . , x n−1 ('input'), y 0 , . . . , y lg n −1 ('index'), and z ('output'), such that: every assignment of the named variables can be extended to a satisfying assignment if and only if it satisfies z = xȳ. Hereȳ is the number encoded in binary by the index variables (we require z = 0 ifȳ ≥ n). The formula has O(n) variables in total, tree-depth O(log n) (of the primal graph), and can be constructed using O(log n) space, given n.
Proof. Construct a full binary tree of variables, of depth lg n . Let the root be z and name the leaves x 0 , x 1 , . . . , x 2 lg n −1 . Add clauses of size 1 requiring x i = 0 for i ≥ n. Introduce new variables y 0 , . . . , y lg n −1 . For each internal variable v at level j of the tree, with children v 0 , v 1 , enforce that v = v 0 if y j is false and v = v 1 otherwise (using four clauses of size 3 on the variables {v, v 0 , v 1 , y j }). This enforces that any assignment to the input and index variables can be extended to a satisfying assignment in exactly one way, in which furthermore z = xȳ. A tree-depth decomposition of logarithmic depth is obtained from the full binary tree simply by mapping the index variables to a path of length lg n attached above the root of the tree.
The following lemma shows more precisely (for our needs) how a Turing machine computation can be encoded in a formula (a computation gadget) -the crucial part of Cook's theorem. In reductions involving stack machines it will also describe fragments of computation without any push/pop operation. The contents of the stack will be considered as a separate read-only input tape, which we treat differently because, while smaller in size, the content is not given to the reduction.
Note that Lemmas 14 and 12, applied for h = 0, immediately give the first part of Theorem 1: for Lemma 14 (Computation gadget). Let M be a non-deterministic Turing machine over alphabet Σ with two read-only input tapes and one work tape. Given an input word α over Σ of length n and integers s, t, h such that lg n + lg h ≤ O(s), one can using O(log(n + s + t + h)) space output a CNF formula such that: These variables respectively describe two configurations u, v of M (up to s symbols of the working tape, heads' positions encoded in binary, and the state), and a wordw over Σ of length h.
• Any assignment to the named variables can be extended to a satisfying assignment iff the computation of M on inputs α andw can lead (by some sequence of non-deterministic choices) from the configuration u to the configuration v, using at most t steps and s space.
• The formula's primal graph has pathwidth O(s + h) and tree-depth O(s · log(n + s + t + h) + h). Moreover, appropriate decompositions can be output within the same space bound.
Proof. For simplicity of presentation, we assume input tapes use the binary alphabet. A larger alphabet can be reduced by encoding each symbol using a block of lg |Σ| bits, and applying straightforward modifications to the machine M . As in Cook's original proof, we create t blocks of s ∈ Θ(s) variables each, describing the configuration at each step. The first and last blocks contain variables (u i ) 1≤i≤s and (v i ) 1≤i≤s , respectively, to encode configurations u and v. Additionally, variables (w i ) 1≤i≤h are created.
We may assume that machine M always keeps track of the indices on which the heads of the input tapes are placed. These indices are encoded in binary in pre-defined buffers on the working tape (index buffers), and each time the head on an input tape is moved, the machine updates the index. To encode reading access to the input tapes in the formula, for each step and each input tape, we create a copy of the random access gadget of Lemma 13. For the first input tape, the gadget has its input variables fixed with the bits of the word α (given to the reduction). For the second input tape, the gadget has its input variables identified with w 1 , . . . , w h . The index variables are identified with the variables of the block that encode the contents of respective index buffers. The machine behavior is then encoded with clauses binding variables of two consecutive blocks, including the output bit z of each random-access gadget, exactly as in Cook's proof: the clauses verify the correctness of the transition. In doing this, we allow at each step a transition that does not change the configuration in any way. Transitions that would move the working tape's head outside the first s symbols are not allowed. This construction makes the formula satisfiable exactly with assignments in which the t-th block describes a configuration reachable in at most t steps and s space (from the configuration described by u variables).
It remains to bound the pathwidth and the tree-depth of the constructed formula's primal graph. To construct a path decomposition, create t − 1 bags A 1 , A 2 , . . . , A t−1 , where each A i contains a pair of consecutive configuration blocks i and i + 1 (that is, variables describing the configuration just before and after a single computation step) and all the variables (w i ) 1≤i≤h . Consider one of the two random-access gadgets created for step i, and let B 1 , . . . , B b be the bags of the provided path decomposition of this gadget Similarly, let B 1 , . . . , B b be the bags of the provided path decomposition of the second gadget (|B j | ≤ O(s)). Then the final decomposition is obtained by adding bags From the construction it follows that each bag contains at most O(s + h + s) = O(s + h) variables and each clause binds a set of variables contained in one of the bags. For the tree-depth bound, consider the above decomposition with the variables w 1 , . . . , w h removed. Its width is O(s) and hence using Lemma 9, we can obtain a tree-depth decomposition of the formula's primal graph of depth O(s · log(n + s + t + h)) if we removed the w variables. The variables can then be reintroduced by placing them atop all others in the decomposition, in any order, which increases the tree-depth by at most h.

Connections with tradeoffs for LCS
There is no algorithm for pw-3Coloring working in There is no algorithm for pw-3Coloring working in time n f (s/ lg n) and space f (s/ lg n)poly(n) for a computable f There is no algorithm for pw-3Coloring working in time 2 O(s) poly(n) and space 2 o eff (s) poly(n) There is no algorithm for pw-3Coloring working in time 2 O(s) poly(n) and space poly(s, log n) r e s c a l i n g  In this section we relate Conjecture 1 to statements of varying strength concerning complexity class containments, or time-space tradeoffs for pathwidth-constrained problems. The results are summarized in Figure 1. Here, we consider algorithms that work uniformly for all values of pathwidth, with complexity depending on both the input size n and the pathwidth s of a given decomposition.
We use the notion of pl-reduction between parameterized problems: it is an algorithm that transforms an instance of one problem with parameter k into an equivalent instance of another problem with parameter k ≤ f (k), working in space f (k) + O(log n), for some computable function f . Following Elberfeld et al. [25] we define 4 N[f poly, f log ] as the class of parameterized problems that can be solved in non-deterministic time f (k)poly(n) and space f (k) log(n) for some computable function f , where k is the parameter. Similarly, D[n f , f poly] is the class of parameterized problems that can be solved in deterministic time n f (k) and space f (k)poly(n) for some computable function f . Further classes D[t, s] will be defined analogously for different expressions t, s. All those mentioned in the article are closed under pl-reductions. The reason we do not use the better known fpt-reductions is that N[f poly, f log ] is not expected to be closed under such reductions; its closure under fpt-reductions has been called WNL by Guillemot [32], but Elberfeld et al. [25] argue that a different parameterized class should have this name. We use the notation o eff (h(n)) as an effective variant of o(h(n)); formally, for f, h : [14,Lemmas 3.2,3.4] showed how computable bounds f and their inverses can be assumed to be computable in appropriately bounded space (logarithmic in f (n)) without loss of generality. We use this implicitly when computing tradeoffs in this section, and refer to [14] for further details.

Completeness results and statements equivalent to Conjecture 1
Conjecture 1 refers to the following parameterized problem.

LCS
Parameter: k Input: A finite alphabet Σ, k strings s 1 , s 2 , . . . , s k over Σ, and an integer . Question: Is there a common subsequence of s 1 , s 2 , . . . , s k of length at least ?
We would like to stress that in this variant, the alphabet Σ is not of fixed size, but is given on the input and can be arbitrarily large. Under standard fpt-reductions, LCS is known to be W[t]-hard for every level t [12]. Moreover, there is some fixed alphabet size for which the problem remains W[1]-hard [45], and the problem is also W[1]-complete when parameterized jointly by k and [32]. This makes it very hard from the parameterized perspective. From the point of view of pl-reductions, Elberfeld et al. [25], drawing on the work of Guillemot [32], pinpointed the exact complexity of LCS. Similarly as described in the introduction, the best known determinization results (a brute-force approach and Savitch's theorem) imply only that To relate parameterized tractability bounds to subexponential bounds, we use the following tool from Cai and Juedes [13]. For a parameterized problem Π, its reparametrization (or extended version) Π log n is defined as the same problem parameterized by s/ lg n, where s was the old parameter. In particular, pw-3Coloring log n is the following parameterized problem: pw-3Coloring log n Parameter: k Input: A graph G with a path decomposition of width k · lg n Question: Is G 3-colorable?
Similarly as in Theorem 1, pathwidth-constrained problems turn out to be complete for nondeterministic computation with simultaneous time and space bounds. Proof. To show containment, we give a non-deterministic algorithm solving pw-3Coloring in time poly(n) ans space O(s + log n), where s is the pathwidth of the graph decomposition given on the input. The algorithm proceeds on consecutive bags of the pathwidth decomposition by guessing the color of every vertex when it is introduced for the first time and comparing it with previously guessed colors of adjacent vertices in the bag. At any moment, only the colors of all vertices in the current bag and the position in the decomposition need to be remembered, hence O(s + log n) space suffices. Correctness follows from the fact that every color is guessed exactly once and every edge is checked, because every pair of adjacent vertices is contained in some bag. Since k = s lg n is the parameter of the rescaled problem, the same algorithm works in time poly(n) and space O(k log n + log n), and hence in time f (k)poly(n) and space To show hardness, consider any non-deterministic Turing machine M solving a problem with input size n and parameter k in time t(n, k) = f (k)poly(n) and space s(n, k) = O(f (k) log n), for some computable function f . Given an instance α of this problem with size n and parameter k, the reduction of Lemma 14, with h = 0, t = t(n, k), s = s(n, k), will output a CNF-SAT instance ϕ, using O(log(n + s + t))) = O(log f (k) + log n) space. We can easily add clauses on the named variables to enforce the correct shape of the initial configuration and that the final configuration is accepting. Hence, the formula can be modified so that ϕ is satisfiable if and only if M accepts α. The lemma further provides a path decomposition of ϕ's primal graph of width O(s) = O(f (k) log n); it is easy to verify that the additional clauses do not spoil this bound. Using Lemma 12 we can then reduce this instance to an instance of pw-3Coloring with a path decomposition of width O(f (k) log n), that is, to pw-3Coloring log n with parameter k = O(f (k)).
Conjecture 1 is thus equivalent to the statement that pw-3Coloring log n is not in D[n f , f poly], in other words, that pw-3Coloring cannot be solved deterministically in time n f (s/ lg n) and space f (s/ lg n)poly(n) for any computable function f , where s is the width of the input path decomposition. To contrast pathwidth with tree-depth, one may easily observe (see Lemma 26) that an instance of 3Coloring with a tree-depth decomposition of depth s can be solved deterministically using O(s + log n) space. This places td-3Coloring log n in D[n f , f log ], a class usually known as XL.

Statements weaker than Conjecture 1
Similarly as in the work of Cai and Juedes [13], we show that the parameterized complexity of the reparameterized problem pw-3Coloring log n is related to subexponential bounds in the complexity of pw-3Coloring. Recall that we always assume that instances of pw-3Coloring come with appropriate path decompositions of the graph. The assumption implies that pw-3Coloring log n can be solved in time 2 O(k·lg n) = n O(k) and space 2 k·lg n/g(k·lg n) for some unbounded and non-decreasing computable function g(·). If k ≤ g(k · lg n), then the bound on space is bounded by n. Otherwise, if k > g(k lg n) ≥ g(lg n), then n ≤ 2 g −1 (k) . In this case the bound on space is bounded by a computable function of k, namely 2 k·g −1 (k) . Hence in each case, the same algorithm solves pw-3Coloring log n in time n O(k) and space n + 2 k·g −1 (k) . By Theorem 17,  An even weaker statement is equivalent to NL ⊆ SC by the following padding argument. Proof. If there was such an algorithm, then it would solve pw-3Coloring[log n] in polynomial time and polylogarithmic space. However, from Theorem 1 it follows that pw-3Coloring[log n] is complete for NL, so this would imply that NL ⊆ SC.
For the other direction, suppose NL ⊆ SC. Then, pw-3Coloring on instances with path decompositions of width at most lg n can be solved in polynomial time and space O(log c n) for some constant c. Thus, an instance of size n and a path decomposition of width s can be padded to size n = max(n, 2 s ) (by adding isolated vertices -neither the answer nor the width changes) and solved by this algorithm in time poly(n ) and space O(log c n ). This solves pw-3Coloring in time at most max(poly(n), poly(2 s )) ≤ 2 O(s) poly(n) and space max(log c n, s c ) ≤ poly(s, log(n)).

Statements stronger than Conjecture 1
Contrary to the results of Cai and Juedes [13], in our context we are unable to prove the converse of Lemma 18. However, we can get arbitrarily close to it, in a sense. Proof. The assumption is equivalent to N[f poly, f log ] ⊆ D[n f , f poly], which in turn implies that pw-3Coloring can be solved in time n f (s/ lg n) and space f (s/ lg n) · poly(n) for some computable, increasing function f . Let g(s) be an arbitrarily slowly growing, unbounded, computable function. Without loss of generality assume that g is non-decreasing and g(s) ≤ s. Let n = 2 s/f −1 (g(s)) .
Consider an instance of pw-3Coloring of size n with a path decomposition of width s. If s ≤ lg n, then the assumed algorithm runs in time n f (s/ lg n) ≤ n f (1) = poly(n) and space f (1) · poly(n) = poly(n). If lg n < s ≤ f −1 (g(s)) · lg n, then f (s/ lg n) ≤ g(s) and hence the assumed algorithm runs in time n f (s/ lg n) ≤ n g(s) = 2 lg n·g(s) ≤ 2 s·g(s) and space f (s/ lg n)·poly(n) ≤ g(s)·poly(n) = poly(n) (the last equality follows from g(s) ≤ s and s ≤ n). Finally, if s > f −1 (g(s))·lg n, then n > n, hence we can pad the instance (by adding isolated vertices -neither the answer nor the width changes) to size n . Applying the assumed algorithm to the padded instance solves the problem in time For a somewhat less natural, stronger variant of Conjecture 1, we can show a similar, but exact correspondence (note the quasi-polynomial factor on both sides). The proof is very similar. Proof. Suppose first there is an algorithm for pw-3Coloring working in time 2 s 2 /g(s) n O(log n) and space 2 s/g(s) poly(n), for some unbounded, non-decreasing, computable function g. Consider an instance of pw-3Coloring log n of size n, parameter k, and hence equipped with a path decomposition of the graph of width k · lg n. If k 2 < g(lg n), then the algorithm solves the instance in time at most 2 k 2 lg 2 n g(k lg n) n O(log n) ≤ 2 O(log 2 n) and space 2 k lg n g(k lg n) ≤ poly(n). Otherwise, if g(lg n) ≤ k 2 , then n is bounded by a computable function of k, namely 2 g −1 (k 2 ) . Hence the algorithm solves the instance in time and space bounded by a computable function f of k. Therefore in any case, the same algorithm solves pw-3Coloring log n in time f (k) + 2 O(log 2 n) and space f (k) + poly(n), For the converse, suppose now that N[f poly, f log ] ⊆ D[n f +log , f poly]. Then, there is an algorithm for pw-3Coloring working in time n f (s/ lg n)+O(log n) and space f (s/ lg n)poly(n) on instances of size n and with path decompositions of width s, for some computable, increasing function f . Given such an instance of pw-3Coloring, let n = 2 s/f −1 (lg n) . If n < n, then s lg n < f −1 (lg n), hence f (s/ lg n) < f (f −1 (lg n)) ≤ lg n and the assumed algorithm works in time n O(log n) and space poly(n). Otherwise, if n ≥ n, then we can pad the instance to size n (by adding isolated vertices -neither the answer nor the width changes). Then, since lg n = s/f −1 (lg n) ≤ s/f −1 (lg s) = o eff (s), the padded instance is solved in time 2 lg n ·(lg n+O(lg n )) = 2 O(lg 2 n ) = 2 o eff (s 2 ) and space lg n · poly(n ) = 2 O(lg n ) = 2 o eff (s) .

A summary
Theorem 2 follows from Lemmas 18 and 20. We summarize the relationships around Conjecture 1 in Figure 1. The weakest statement there is NL ⊆ SC, a widely explored hypothesis in complexity theory. Since Directed (s, t)-Reachability (asking given a directed graph and two nodes s, t, whether is t reachable from s) is an NL-complete problem, this is also equivalent to the question of whether this problem can be decided in polynomial time and polylogarithmic space simultaneously. However, even this weakest statement is not known to be implied by better known conjectures such as the Exponential Time Hypothesis. It seems that the simultaneous requirement on bounding two complexity measures-time and space-has a nature that is independent of the usual time complexity considerations. Hence, new complexity assumptions may be needed to explore this paradigm, and we hope that Conjecture 1 may serve as a transparent and robust example of such.
In a certain restricted computation model (allowing operations on graph nodes only, not on individual bits), unconditional tight lower bounds have been proved by Edmonds et al. [21]: it is impossible to decide Directed (s, t)-Reachability in time 2 o(log 2 n) and space O(n 1−ε ) (for any ε > 0), even if randomization is allowed. Essentially all known techniques for solving Directed (s, t)-Reachability are known to be implementable in this model [40] (including Depth-and Breadth-First Search, as well as the well-known theorems of Savitch, of Immerman and Szelepcsényi, and Reingold's breakthrough), therefore this strongly suggests that no algorithm running in time 2 o eff (log 2 n) and space n o eff (1) is possible, that is, By Theorem 1, this is equivalent to saying that pw-3Coloring[log] cannot be solved in these time and space bounds. The strongest statement on Figure 1 is a rescaling of this, that is, it ] by a trivial padding argument, but the reverse implication is also probable in the sense that any proof of the latter would likely scale to prove the former. However, it is still possible that an algorithm working in polynomial space refutes the stronger statement even though NL ⊆ D

Characterization via NTMs with a small auxilliary stack
In this section we prove a completeness theorem for small tree-depth computations, i.e., Theorem 3. Let s : N → N be a nice function. Before we proceed, we discuss more precisely the model of machines used to define the class NAuxSA[poly time , log space , s height ]. The machine has three tapes: a read-only input tape, a working tape of length O(log n), and a stack tape of length s(n). Each tape contains symbols from some fixed, finite alphabet Σ. Initially both the working tape and the stack tape are empty, i.e., filled with blank symbols. On each of the tapes there is a head, and the transitions of the machine depend on its state and the triple of symbols under the heads. The access restraints to each of the tapes are as follows: The input tape is a read-only tape. The working tape can be both read and written on by the machine. The stack tape can be read but not freely written on; instead, the transitions of the machine may contain instructions of the form push σ or pop, where σ is some non-blank symbol of Σ. In case of push σ, the first blank symbol of the tape is replaced by σ. In case of pop, the last non-blank symbol of the tape is replaced by a blank. Since s is nice, s(n) ≤ poly(n), In particular, this implies that these two classes are equal. We start by showing containment, exemplifying how the resources are used. Proof. The input consists of a graph G and a mapping of its vertices into a rooted forest T ; we assume any natural encoding for which validity of the decomposition can be checked in logarithmic space. We now give a non-deterministic algorithm showing that td-3Coloring[s] belongs to NAuxSA[poly time , log space , s height ]. The algorithm considers the trees of T one by one, and for each tree T of T it explores T by a depth-first search beginning from the root. Since the trees are rooted and for each vertex we store its parent and the list of its children, it suffices to maintain only the identifier of the current vertex during the search. When entering a node, the algorithm non-deterministically guesses its color (encoded using a constant number of bits) and pushes it onto the stack. When the depth-first search withdraws from a vertex to its parent, the algorithm pops its color from the stack. Thus, the stack always contains the list of guessed colors of vertices on the path from the current vertex to the root of its tree. To verify the correctness of the coloring, after guessing the color of some vertex u, we check that all its ancestors in T that are adjacent to it have different colors; this information can be retrieved from the stack. In this way, the color of each vertex is guessed exactly once, and for each edge of the tree we verify that its endpoints have different colors when considering the endpoint that is lower in T . Therefore, the machine accepts if and only if the graph has a proper 3-coloring.
Clearly when s(n) ≥ log 2 n, NAuxSA . The next step is to show how the stack operations of the latter class' machines can be regularized. This idea originates in the approach of Akatov and Gottlob [3]. Following their ideas, we define a regular stack machine in the following way. For any valid sequence S of push and pop operations that starts and ends with an empty stack, define the corresponding push-pop tree τ (S) to be the ordered tree (a tree with an order imposed on the children of each node) in which a depth-first search would result in the sequence S; specifically, • τ (ε) is a single root node, • τ (push S pop) is a new root node with τ (S) attached as the only child subtree, • τ (S 1 S 2 ) is obtained from τ (S 1 ) and τ (S 2 ) by identifying their roots, and putting all the children of the root of τ (S 1 ) before all children of the root of τ (S 2 ).
We say that a language is in reg-NAuxSA (c) If the machine accepts an input α, then there is a run on α where the corresponding push-pop tree (where each operation of pushing/popping a block is considered atomic) is the full binary tree of depth exactly c lg n , for some fixed integer c. In particular, at the moment of accepting the stack is empty.
Obviously, the block pushes and pops described in restriction ((a)) can be simulated by a standard machine in O(b) steps, so their introduction does not give additional expressive power to the computation model. Restriction ((b)) is a technical adjustment that will be used to streamline future constructions. Intuitively, restriction ((a)) is easy to achieve, because the machine has enough working space to simulate the top s(n)/ lg(n) symbols from the stack on the working tape, and group pushes and pops into blocks of size b. The most important restriction is ((c)): the push-pop tree has a fixed shape of a full binary tree. This property will be essential when reducing an arbitrary problem from NAuxSA[poly time , s/ log space , s height ] to td-3Coloring[s], because the push-pop tree will form a "skeleton" of the graph output from the reduction. In order to achieve this property, we use the following technical result of Akatov and Gottlob [3,2], which was also used independently by Elberfeld et al. [24]. The traversal ordering of the nodes of an ordered tree is the linear ordering which places a parent before its children and, for two children a, b of a node, a occurring before b, places all descendants of a before all descendants of b. In other words, the traversal ordering is the ordering in which the nodes are visited in a depth-first search started at the root.

Lemma 23 (Lemma 3.3 of [2]
; Theorem 3.14 of [24]). Given an ordered tree T with n nodes and depth at most lg n, one can in logarithmic space compute an embedding (an injection that preserves the ancestor relation and traversal ordering) into a full binary tree of depth 4 lg n.
We are now ready to prove that every problem from NAuxSA[poly time , s/ log space , s height ] can be recognized by a regularized machine, in a similar way as was the case in [3]. First, to achieve restriction ((a)), we designate the first b = s(n)/ lg(n) of the working tape as a buffer for simulating the top of the stack. Whenever during the run M has p symbols on the stack, then after modification the top-most p mod b symbols are stored in the buffer, while the remaining symbols are stored in p/b blocks on the stack. The operations on the stack are simulated in the buffer. Whenever the size of the buffer reaches full size b, the modified machine invokes the block push operation and clears the buffer. Whenever M wants to pop a symbol but the buffer is empty, the modified machine copies the top b symbols from the stack to the buffer, invokes the block pop operation, and then simulates the pop of M in the buffer. It is straightforward to simulate the read access to the stack tape with a polynomial-time overhead in the running time.
To achieve restriction ((b)), whenever the machine would like to push or pop, we split this transition into three. In the first transition, the machine only verifies the symbols under the heads, and enters a state "ready to push/pop" where it additionally remembers the target state and additional operations (moving the heads) to be performed after the stack operation. Then, in the second transition, it performs only the push or pop; note that this transition does not depend on the symbols under the heads, and the heads also do not move. Finally, in the third transition the machine performs the remembered head movements and reaches the target state.
Finally, we concentrate on restriction ((c)). Let us add a dummy symbol to the alphabet. Suppose that on some input α of length n the machine M (after the modifications above) has an accepting run. By a simple modification, we may assume that M always empties the stack before accepting. Since the maximum stack height is still O(s(n)) and stack operations are done in blocks of b = s(n)/ lg n operations at a time, the corresponding push-pop tree T (where blocks operations are considered as atomic) has depth at most c 1 lg n and size at most n c 2 for some integers c 1 , c 2 . By Lemma 23, there exists an integer c for which T can be always embedded into a tree T 0 that is a full binary tree of depth exactly c lg n . We now modify M so that it has also an accepting run whose push-pop tree is T 0 .
We modify machine M in the following manner. First, M will keep track of the current position of the computation in the push-pop tree T 0 , encoded as binary string of length at most c lg n . We add the possibility for M to guess non-deterministically, at any moment of the computation, to push a block of b dummy symbols without changing the machine's configuration, apart from updating the current position in T 0 (if the computation is in a leaf of T 0 , then this transition is not allowed). Similarly, M can, at any moment, pop the top-most block of the stack provided it consists only of dummy symbols, update the position in T 0 , without changing the configuration otherwise. The read access to the stack tape is simulated by ignoring the dummy symbols, i.e., the head always continues browsing the tape until a non-dummy symbol is found. Since the dummy symbols are effectively ignored by the computation, it is easy to see that the modified machine accepts if and only if the original one accepts.
Take now an accepting run of M on α and consider an embedding η of its push-pop tree T into T 0 . Construct a run of modified M on α by adding non-deterministic pushes and pops of blocks of dummy symbols for all nodes of T 0 that are not in the image of η. Thus, the push-pop tree of the modified run is exactly T 0 .
Knowing that computations for NAuxSA can be conveniently regularized, we can describe the existence of such a computation by a CNF formula "wrapped around" the rigid shape of the full binary tree that encodes the push-pop tree of the run. This was also the idea of Akatov and Gottlob [3], but our reduction needs to introduce many more elements, in particular copies of the gadget of Lemma 14, due to a less expressive target language. Proof. Let M be an appropriate machine recognizing L; by the assumption, M satisfies restrictions ((a)), ((b)), and ((c)). Consider an input word α; let n = |α|. Let T be the push-pop tree of M on input α. By definition T is the full binary tree of depth exactly c lg n for some fixed integer c that depends on L only. We assume that the machine works in time at most t(n) and uses work tape of size at most s(n)/ log n.
Before we proceed to the formal description, let us elaborate on the intuition; see Figure 2 for a visualization. An Euler tour of the nodes and edges of T corresponds to subsequent phases of M 's execution on α. We think of the computation as starting at the root node, moving down an edge whenever a push is made and moving up an edge whenever a pop is made. Since T is fixed, the idea is to construct a gadget for each node of T and to wire the gadgets so that they encode the full computation of M . Each node gadget will contain three copies of the computation gadget of Lemma 14. These copies respectively encode the parts of the computation before going into the first subtree, between withdrawing from them first subtree and proceeding to the second subtree, and after withdrawing from the second subtree. Each part of the computation depends on symbols pushed onto the stack on the path to the root, but is independent of the guesses in different branches. This, together with the bound of Lemma 14 on the tree-depth of the computation gadget, will give rise to a natural tree-depth decomposition of depth O(s(n)) of the obtained graph.
We proceed to the formal description; the reader is advised to look at log n ) variables describing the initial and final configurations: init, final. We enforce them to be the initial and accepting configurations, respectively. For init this only requires introduction of a number of clauses of size 1 that precisely describe the initial configuration. For final, we only need to verify that the final state is accepting. Since the description of the state uses a constant number of variables, this can be easily done by imposing a constant number of CNF clauses on them.
We now wire these groups of variables in order to simulate the machine's execution. First, for each edge e of T , we connect before-push(e) with after-push(e) and before-pop(e) with after-pop(e) by clauses that enforce that valid push/pop transitions are being used at these points. By restriction ((b)), during these transitions only the machine's state can change. Hence, we can enforce that in blocks before-push(e) and after-push(e) all the information apart from the machine's state is exactly the same, and the same holds also for before-pop(e) and after-pop(e); this can be easily done using clauses of size 2. Then, we need to verify that the performed transition was indeed available. Since the availability of a push/pop transition depends solely on the machine's state (restriction ((b))), we can verify that the original and target state can be connected by a push/pop transition using a constant-size family of CNF clauses on the variables describing these states. Finally, we need to make sure that the values memorized in block stack(e) are indeed the ones that the machine intended to push onto the stack. Therefore, in the connection between before-push(e) and after-push(e) we also verify, again using clauses of size 2, that values stored in stack(e) are exactly the same as values on the b first positions of the working tape. Observe that no such check is needed between before-pop(e) and after-pop(e).
Then, we connect (in a manner described later) pairs of configurations that correspond to the beginning and end of a computation without stack operations. That is, for the root note q with children l, r we connect: init with before-push(ql), after-pop(ql) with before-push(qr) ...  and after-pop(qr) with final. For every internal, non-root node q with parent p and children l, r, we connect: after-push(pq) with before-push(ql), after-pop(ql) with before-push(qr) and after-pop(qr) with before-pop(pq). For every leaf node q with parent p we connect after-push(pq) with before-pop(pq). Each connection between two blocks is made by creating a new copy of the computation gadget of Lemma 14, where: • t from the statement of Lemma 14 is simply t(n).
• s from the statement of Lemma 14 is s(n) lg n . • h is equal to the stack height at the corresponding moment. That is, this height is exactly b times the number of edges on the path from the root to the current node q of the push-pop tree T (note that h ≤ b · c lg n ≤ 4c · s(n)).
• The input word is α.
Variables u 1 , . . . , u s and v 1 , . . . , v s of the gadget are identified with the two variable blocks we connect. Variables w 1 , . . . , w h of the gadget are identified with consecutive variables from stack(e) for all edges e on the path from root to the current node q. Note that in this manner, each computation gadget has the input string α encoded within, so that the computation simulated by the gadget has read access to α. This concludes the construction of the formula. By Lemma 14 and restriction ((c)), it is clear that the formula has a satisfying assignment iff there is an accepting run of M . It remains to construct a tree-depth decomposition of the formula's primal graph G that has depth O(s(n)).
Let R be the subset of variables consisting of all the variables contained in the named blocks (i.e. init, stack(e), before-push(e), etc.). First, we create a mapping η that maps variables of R to the nodes of T . We begin by mapping the variables of init and final blocks to the root of T . For every non-root node q of T with parent p, we map the variables of stack(pq) to q. Additionally, if q has a parent p or children l, r, we map the variables of after-push(pq), before-push(ql), after-pop(ql), before-push(qr), after-pop(qr) and before-pop(pq) to q. To this point, η maps O( s(n) log n ) variables to each node of T . Create a tree-depth decomposition of G[R] as follows: start with T , end replace each node q of T with a path consisting of variables η −1 (q), ordered arbitrarily. These paths are organized in a tree in the same way as the original nodes: the last vertex of a path corresponding to a node q becomes the parent of the first node of each path corresponding to a child of q. Observe that whenever two variables of R appear in the same clause, then the nodes to which their blocks are mapped by η are either equal, or they are in the ancestor-descendant relation. Therefore, it is easy to see that indeed we have constructed a valid tree-depth decomposition of G[R]. Since T has depth O(log n) and the pre-image of each node of T under η has size O( s(n) log n ), the depth of the decomposition is O(s(n)).
It remains to consider the variables and clauses created in computation gadgets for each node q. By Lemma 14, every such gadget has a tree-depth decomposition of depth O( s(n) log n ·log n+h) = O(s(n)), where h is the current stack depth. Observe that, among the variables of R, the clauses of each gadget connect only variables from blocks mapped to q by η, and variables from the stack blocks corresponding to the edges on the path from q to the root of T . Hence, we can take the tree-depth decomposition of the gadget of depth O(s(n)), remove from it all the variables contained in R, and attach the resulting decomposition as a new subtree below the deepest vertex of η −1 (q). By performing this operation for each computation gadget, we obtain a tree-depth decomposition of the whole prime graph G that has depth O(s(n) + s(n)) = O(s(n)). It is straightforward to verify, using Lemma 14, that all the described constructions can be performed in logspace. Therefore Therefore, all containments must be equalities, which concludes the proof of Theorems 3 and 4. Note that for an unbounded (or polynomial) stack, Theorem 4 implies that space is unbounded too; in other words, NL (that is, non-deterministic logspace) machines augmented with an unbounded auxiliary stack have the same power as NP, an observation already made by Vinay and Chandru [51].
By Theorem 3, to prove a determinization result for NAuxSA[poly, log, s(poly)] we only need such a result for td-3Coloring[s]. Proof. Let G be the input instance of td-3Coloring[s], and let (T , µ) be the given tree-depth decomposition of G. By abuse of notation, we identify the vertices of G with their images under µ. For every u ∈ V (G), let tail(u) be the set of vertices on the path from u to the root of its tree in T , excluding u, and let tree[u] be the set of vertices contained in the subtree of T rooted at u, including u. For every u ∈ V (G) and every proper coloring φ of G[tail(u)] into 3 colors, let f (u, φ) be the Boolean value denoting whether φ can be extended to a proper 3-coloring of G[tree[u] ∪ tail(u)]. Then clearly f (u, φ) is true if and only if it is possible to extend φ to φ by assigning u one of the three colors in such a manner that φ remains a proper 3-coloring of G[tail(u) ∪ {u}], and f (v, φ ) is true for every child v of u. Whether G has a proper 3-coloring is equivalent to the conjunction of values f (r, ∅) over the roots r of trees in T .
We give a recursive procedure for computing values f (u, φ); the whole problem then reduces to computing f (r, ∅) for every root r of a tree in T . This recursive procedure simply browses through all three possible extensions φ of φ to a proper 3-coloring of G[tail(u) ∪ {u}], and calls itself recursively to compute f (v, φ ) for all children v of u; in particular, no memoization of computed values is done. Note that the recursion tree stops in the leaves of T . The correctness of the algorithm follows directly from the discussion of the previous paragraph. As far as the space usage is concerned, at each point the algorithm maintains identifier of the current vertex u, of logarithmic length, and a stack of O(s) calls to the procedure computing f (·, ·). The data stored for each call requires constant space; note that there is no need to memorize the identifier of the vertex, because it can be recomputed when returning from a subcall. Hence, the space complexity of the algorithm is O(s + log n). To analyze the running time, observe that for each pair (u, φ), where φ is a proper 3-coloring of G[tail(u)], throughout the whole algorithm there will be at most one call to f (u, φ); this is because whenever recursing, we are considering an extension of the current coloring. Thus, the whole recursion tree will have at most n · 3 s nodes. Since the computations at each node are done in polynomial time, it follows that the running time of the algorithm is 3 s · poly(n).

Characterization via alternating machines
An alternating Turing machine (ATM) is a Turing machine with a partition of states into existential or universal states. For an ATM and an input word, an accepting tree is a finite tree T labeled with machine configurations, such that: the root is labeled with the initial configuration, every node with a configuration in an existential state in T has one child labeled with a next configuration (one reachable in one step according to the machine's transition rules), every node with a configuration in a universal state in T has all possible next configurations as children, and all leaves are accepting configurations. An ATM accepts an input word in time t, space s, and treesize z, if there is an accepting tree with root-to-leaf distances at most t, configurations using at most s space, and at most z tree nodes.
Similarly as ATMs proved to be a useful computational model, giving a new, unified view on various complexity issues, the notion of treesize introduced by Ruzzo [49] allowed to see various classes under a common light and simplify a few containment proofs. In particular, Ruzzo showed that NAuxPDA[poly Proof. For one containment (⊆) we show that td-3Coloring[s], which is hard for the former class by Theorem 3, is contained in the latter. Indeed, a straightforward algorithm traverses a given tree-depth decomposition of the input graph top-down by existentially guessing a color of each encountered vertex, checking its compatibility with previous guesses, and universally guessing which subtree to proceed into. The bounds on time and treesize of an alternating Turing machine executing this algorithm follow directly from the bounds on the depth (s) and size (polynomial) of the decomposition's tree.
For the other containment, we simulate an alternating Turing machine with a NAuxSA machine. This is done exactly as in Ruzzo's simulation with NAuxPDA machines (Theorem 1 in [49]), except that all the configurations on the current path are remembered on the stack by only writing the difference (log of changes) from the previous configuration: the constant-size description consists of the new state, the direction of movement for each head and the symbol written on the worktape. Observe that in this manner, the machine can within logarithmic working space retrieve all the information needed to verify availability of a transition: • The current simulated state is on the top of the stack; • The current head positions can be recalculating by browsing through the stack and applying consecutive moves; • The symbol under the worktape head can be recalculated by finding on the stack the latest symbol written on its current position.
Consequently, deterministic steps of the machine can be simulated by verifying the applicability of the transition, and pushing onto the stack the constant-size log of changes leading to the new configuration. Similarly, existential guesses are simulated with the machine's own non-determinism. Universal guesses are simulated by choosing one possibility and then backtracking (popping the stack) to choose the next possibility, as described by Ruzzo. Such backtracking corresponds exactly to traversing an accepting tree of the ATM, hence the running time is polynomial. At most s(poly(n)) steps are described on the stack at any time, each requiring a constant number of symbols due to keeping only the log of changes.

Dominating Set on graphs of small treedepth
In this section we show how to solve Dominating Set, or even count the number of dominating sets of any cardinality, in time 3 s · poly(n) and space O(s · log n), given a tree-depth decomposition of depth s. Recall that for a graph G, a set S ⊆ V (G) is a dominating set if every vertex of G either is in S, or is adjacent to some vertex of S. We first describe an algorithm working in space poly(n).

Lemma 28.
There exists an algorithm that, given a graph G on n vertices and its tree-depth decomposition of depth s, runs in time 3 s · poly(n) and space poly(n), and outputs a sequence (q i ) 0≤i≤n , where q i is the number of dominating sets of G of cardinality i.
Proof. We will work in the ring of polynomials Z[x], where x is a formal variable. The algorithm will compute polynomial P (x) = n i=0 q i x i , whose coefficients constitute the output. Let (T , µ) be the given tree-depth decomposition of G; recall that T is a rooted forest of depth at most s. By abuse of notation, we identify the vertices of G with their images under µ. Let us introduce some notation relating to T .
Note that if there are two adjacent vertices v, v ∈ tail(u) with φ(v) = T and φ(v ) = F, then no set X can satisfy the requirements above and hence f (u, φ) = 0. Similarly for g and ψ.
We remark that values f and g are exactly what one would obtain by applying the Möbius transform to the standard definition of states for dynamic programming for Dominating Set (that is, we count sets that dominate any subset of φ −1 ({A, T}) in the tail, instead of exactly specifying which vertices are to be dominated). This transform translates subset convolutions used in the standard dynamic programming to pointwise products, which is the crucial idea behind the proof. Since the algorithm is not complicated, we prefer to present it directly after applying the transform.
We now give recursive equations on the values of f (·, ·) and g(·, ·). First, observe that for each v ∈ chld(u) we have tail(v) = tail [u]. Then, it is easy to verify that the following equation holds for each u ∈ V (G) with chld(u) = ∅ and each ψ : tail[u] → Σ: Indeed, every set X ⊆ tree(u) that contributes to some coefficient of g(u, ψ) can be partitioned , and hence when computing the product the formal variable x correctly keeps track of the cardinality. When chld(u) = ∅, then tree(u) = ∅ and we can compute g(u, ψ) directly from the definition: if there is no edge between ψ −1 (T) and ψ −1 (F), 0 otherwise.
We now proceed to setting up the equation for f (·, ·). Take any u ∈ V (G) and φ : tail(u) → Σ. Then, it is easy to verify that the following equation holds: The term x · g(u, φ[u → T]) counts the contribution from sets X that contain u. The term g(u, φ[u → A]) counts the contribution from all sets X that do not contain u, regardless of whether they dominate u or not, whereas by subtracting the term g(u, φ[u → F]) we remove the contribution from sets that do not contain or dominate u. Observe that if u has a neighbor in φ −1 (T), i.e., it is already dominated by φ −1 (T), then the subtracted term g(u, φ[u → F]) will be a zero polynomial. This corresponds to the fact that in this case we do not need to care about domination of u by X. Similarly, if u has a neighbor in φ −1 (F), then g(u, φ[u → T]) will be a zero polynomial. This corresponds to the fact that in this case it is not allowed to take u to X. Finally, observe that where roots is the set of roots of the trees in forest T . We now give the algorithm that computes P . The algorithm uses two mutually recursive functions that compute the values of f (·, ·) and g(·, ·), respectively. The polynomial P is computed using equation (4) by a sequence of calls to the procedure computing f (·, ·). The procedure computing f (·, ·) applies equation (3) and calls g(·, ·) recursively. Similarly, the procedure computing g(·, ·) applies equation (1) and calls f (·, ·) recursively, or uses the base case (2). In particular, no memoization of computed values is performed.
The correctness of the algorithm follows from equations (1)- (4). Note that at each moment, the space used by the algorithm is composed of a stack of at most 2s + 1 recursive calls to f (·, ·), g(·, ·), and the main procedure computing P , and for each of these calls we can store just the partial result of computation being one polynomial from Z[x] (in case of equations (1) and (4), this will be the product calculated for a prefix). These polynomials have degrees bounded by n and their coefficients have values between 0 and 2 n , hence the total space usage of the algorithm is O(sn 2 ). Finally, to estimate the running time observe that for every pair (u, φ), where u ∈ V (G) and φ : tail(u) → Σ, throughout the whole computation there will be at most one call to computing f (u, φ). This is because when recursing, the new function φ is always an extension of the previous one. Similarly, for every pair (u, ψ), where u ∈ V (G) and ψ : tail[u] → Σ, throughout the whole computation there will be at most one call to computing g(u, ψ). The total number of such pairs (u, φ) and (u, ψ) is at most 2n·3 s , which implies that the whole recursion tree has at most this many nodes. Since the work done at each node is polynomial in n, we conclude that the algorithm runs in time 3 s · poly(n).
We now show how to improve the space usage of the above algorithm to O(s · log n). Given a graph G on n vertices and its tree-depth decomposition of depth s, consider again the polynomial P (x) = n i=0 q i x i over a single variable x, with integer coefficients q i equal to the number of dominating sets of G of cardinality exactly i (in particular, 0 ≤ q i ≤ 2 n ). We use the fact that given a prime number p ≤ 2n+2 and some element a of the Galois field F p , the value of (P (a) mod p) can be computed in time O(3 s · poly(n)) and space O(s · log n). Indeed, one can recursively compute all O(3 s · n) values of (f (·, ·)(a) mod p) and (g(·, ·)(a) mod p), as described in the proof of Lemma 28. On each of the O(s) recursion levels, we need to maintain only one number in F p (describing a partial sum or product), and each value can be added or multiplied (to the partial sum or product that requires it) in time O(poly(n)) and space O(log n).
With such a procedure in hand, the following theorem describes how to recover the exact coefficients of P (x) using interpolation. This is done using the Chinese remainder theorem, and applying a number-theoretic transform, that is, the discrete Fourier transform specialized to the field of integers mod p, for prime p. Effectively, this technique boils down to evaluating the polynomial in many points and computing a weighted sum of the results. We need the following simple corollary of the prime number theorem. In fact, it can be proved for n 0 = 21 using explicit bounds given by [48,Theorem 4] and hand computation for small enough n.

Fact 29.
There is an n 0 ∈ N such that for all n ≥ n 0 , the product of primes strictly between n and 2n is larger than 2 n . Theorem 30. Let P (x) = n i=0 q i x i be a polynomial over one variable x, of degree at most n and with integer coefficients satisfying 0 ≤ q i ≤ 2 n , for i = 0, . . . , n. Suppose that given a prime number p ≤ 2n + 2 and a ∈ F p , the value of (P (a) mod p) can be computed in T time and S space. Then given k ∈ {0, . . . , n}, the value q k can be computed in O(T · poly(n)) time and O(S + log n) space.
Proof. We first show how to compute q k mod p, given k and a prime p with n + 1 < p < 2n + 2. Let α be a primitive element of the field F p , that is, a generator of the multiplicative group F * p (in other words, F * p = {α 0 , α 1 , . . . , α p−2 }). Such an element can be found in polynomial time by trying all elements of F * p and testing whether α 1 , . . . , α p−2 = 1. Compute in F p the value This takes O(T · n) time and O(S + log n) space. We claim q k = q k mod p. To show this, first notice that for a ∈ F p \ {0}, we have Hence, if a = 1 then p−2 i=0 a i = 0 (mod p), while for a = 1, we have p−2 i=0 a i = p − 1 = −1 (mod p). Thus, for any k ∈ Z we have the following: Here, [·] denotes Iverson's notation: the value is 0 or 1 depending whether the predicate in the brackets is false or true, respectively. Since n < p − 1, for integers j, k ∈ {0, . . . , n} we have j − k ≡ 0 mod (p − 1) if and only if j = k. Therefore, as claimed, we conclude that Therefore, for every integer p strictly between n + 1 and 2(n + 1), we can check whether it is prime (by brute-force) and compute q k mod p in O(T · n) time and O(S + log n) space. From Fact 29 and the Chinese remainder theorem, it follows that q k is non-zero if and only if (q k mod p) turns out to be non-zero for at least one p (we assume n + 1 ≥ n 0 , as otherwise q k can be computed by brute-force). Moreover, given a list of pairs (p, q k mod p) for the primes p between n + 1 and 2(n + 1), the exact value of q k can be recovered with a logspace (and hence polynomial time) algorithm by Chiu et al. [16,Theorem 3.3], which is an effective version of the Chinese remainder theorem. Note that we do not need to simultaneously store all values q k mod p for different p: we use the compositionality of logspace algorithms instead, that is, values output by our algorithm are recomputed on the fly as needed by the remaindering algorithm, multiplying the running times and adding the space bounds of the two algorithms. Corollary 31. There exists an algorithm that, given a graph G on n vertices and its tree-depth decomposition of depth s, runs in time 3 s · poly(n) and space O(s · log n), and outputs a sequence (q i ) 0≤i≤n , where q i is the number of dominating sets of G of cardinality i.

Conclusions
In what follows we assume for conciseness that s(n) is a nice function satisfying s(n c ) = O(s(n)) for each constant c (this includes s(n) = lg k n for k ≥ 1, in particular).
The hierarchy of graph parameters of Corollary 10 together with Theorems 1, 3, and 27 implies the following hierarchy of complexity classes between NL and NP. This yields the following hierarchy: ], using an approach very similar to that of Lemma 26 as follows. The algorithm traverses the treedepth decomposition in the prefix order, nondeterministically guessing a maximum-size independent set X on the fly, and storing the following information: on the stack we store the intersection of X with the path from the current vertex to a root of the decomposition, whereas in the working memory we store the number of vertices from X found so far. By Theorem 5, this means that Independent Set on a graph given with tree-depth decomposition of depth s can be solved deterministically in space O(s + log n).
As far as Dominating Set is concerned, in Section 5 we demonstrated how using the algebraic approach of Lokshtanov and Nederlof [39], and of Fürer and Yu [28], one can obtain an algorithm for Dominating Set with running time 3 s · poly(n) and space complexity O(s · log n). Thus, it is unclear to us whether the problem Dominating Set on graphs with treedepth decompositions of width s(n) belongs to NAuxSA[poly time , log space , s height ]. Observe that if this would be the case, then by Theorem 5 it should be solvable in space O(s + log n); however, already achieving space complexity O(s · log n) was highly nontrivial.
For tree-depth, let (T , µ) define a tree-depth decomposition of H of depth w h . Create sets M t for nodes t of T and place each vertex v of G in M t where t is the lowest common ancestor of Observe that by definition of a deconstruction, if v ∈ B h and v ∈ B h for some h, h ∈ V (H), then there is a path connecting h and h in H containing only vertices h such that v ∈ B h ; hence there is an h ∈ V (H) such that µ(h ) is a common ancestor of µ(h) and µ(h ) in T and v ∈ B h . Therefore, if h 0 is the lowest common ancestor of {µ(h) | v ∈ B h } in T , then also v ∈ B h 0 , and hence every vertex v is put into a set M t such that v ∈ B µ −1 (t) . That is, M t ⊆ B µ −1 (t) , which implies |M t | ≤ w for all t ∈ V (T ).
Let us then modify T by replacing every node t ∈ V (T ) by a path of |M t | nodes, and define a bijection µ between vertices of G and nodes of this tree that maps vertices in M t to nodes of the path that replaced t (in any order). Let T be the modified decomposition. Clearly T has depth at most w ·w h . To check that T with µ defines a valid tree-depth decomposition, consider any edge uv of G. By definition of a deconstruction there are adjacent or equal vertices h, h in H such that u ∈ B h and v ∈ B h . Since µ(h) is an ancestor of µ(h ) or vice versa, u was assigned to a set M t such that t is an ancestor of µ(h) and v was assigned to a set M t such that t is an ancestor of µ(h ), it must be that t is an ancestor of t or vice versa. Hence µ (u) ∈ M t is an ancestor of µ (v) ∈ M t or vice versa.
Many reductions between NP-complete graph problems introduce components of bounded size replacing every edge of the original graph, or more generally, attach small components to cliques of the original graph. We need the following lemma to show that such reductions also preserve structural parameters. For a graph G and a vertex set S ⊆ V (G), the subgraph of G induced by S, denoted G[S], is the graph with vertex set S and edge set E(G) ∩ (S × S). We write G − S for G[V (G) \ S].
Lemma 34. Let π ∈ {td, pw, tw}. Let G be an induced subgraph of G such that for each connected component C of G − V (G) we have that C has at most c vertices and the neighborhood of C in V (G) is a clique in G, for some constant c. Then π(G ) ≤ π(G) + c.
Furthermore, given G, G and any π-decomposition of G, one can compute a π-decomposition of G of width/depth larger by at most c in logspace.
Proof. For td, in any tree-depth decomposition, the vertices of a clique in G must be mapped to nodes fully ordered by the ancestor relation. We may thus simply take each connected component C of G − V (G), examine the placement of the clique N (C) ⊆ V (G) in the given tree-depth decomposition of G, and attach the vertices of C as a path of length |C| below the lowest node the clique N (C) maps to. In this manner we create a tree-depth decomposition of G of depth larger than the input tree-depth decomposition of G by at most c.
For tw and pw, we use the fact that each clique in G must be fully contained in some bag of a decomposition (e.g., [10, Lemma 1]). Hence, for each connected component C of G − V (G), we find a bag that contains all the vertices of the clique N (C) ⊆ V (G), and create a copy of this bag into which all the vertices of C are added. It is straightforward to arrange the new bags in the decomposition. In this manner we construct a decomposition of G of width larger than the original decomposition of G by at most c.
For all three parameters, it is trivial to implement the described procedure in logspace.
We are now ready to show how standard reductions for some example NP-complete problems prove them to be equivalent to 3Coloring, or at least as hard, in our setting.
Lemma 12 (restated). The following problems are equivalent under logspace reductions that preserve structural parameters: 3Coloring, CNF-SAT (using a decomposition of the primal graph), k-SAT (using a decomposition of either the primal or incidence graph) for each k ≥ 3.
Furthermore, the following problems admit logspace reductions that preserve structural parameters from the above problems: Vertex Cover, Independent Set, Dominating Set.
Proof. All the following reductions are standard, and hence we keep the description concise. Also, it will be straightforward to verify that they can be implemented in logspace. The only non-trivial check will be to verify, using Lemmas 34 and 33, that the structural parameters are preserved.
CNF-SAT (primal graph) ≤ L k-SAT (primal graph) (for any k ≥ 3): Replace every clause (l 1 ∨l 2 ∨· · ·∨l ) of length with clauses (l 1 ∨l 2 ∨x 2 ), (¬x 2 ∨l 3 ∨x 3 ), (¬x 3 ∨l 4 ∨ x 4 ) . . . (¬x −2 ∨ l −1 ∨ l ) using new variables x 2 , . . . , x −2 . Let G be the primal graph of the original formula, G be the primal graph of the new formula, and let G = G ∪ G , i.e., a graph on the vertex set V (G ) where the edge set is the union of the edge sets of G and G . By the construction it follows that G [V (G)] = G and that each connected component of G − V (G) has size at most c − 3, where c is the maximum clause size in the original formula. Moreover, the neighborhood of such a connected component is a clique in G. Since each clause induces a clique in the primal graph, it follows that c ≤ π(G) + 1 for each π ∈ {td, pw, tw}. Hence, from Lemma 34 we have that π(G ) ≤ max(π(G), 2π(G) − 2), and an appropriate decomposition can be constructed from a decomposition of G in logspace. Since G is a subgraph of G, it is also a decomposition of G .
k-SAT (primal graph) (for any fixed k ∈ N) ≤ L k-SAT (incidence graph): Use the same formula, bounds follow immediately from Lemma 34 (the connected components are single vertices).
k-SAT (incidence graph) (for any fixed k ∈ N) ≤ L k-SAT (primal graph): The primal graph has a natural width-k deconstruction into the incidence graph of the formula. For every variable of the formula we create a bag containing only it. For every clause of the formula we create a bag containing all the variables contained in this clause. It is easy to verify that this is a deconstruction.
3-SAT (incidence graph) ≤ L 3Coloring: The reduction of Garey, Johnson, Stockmeyer [30] creates a pair of adjacent vertices for every variable of the formula (a variable gadget), and a 6-vertex subgraph for every clause (clause gadget). For each clause, three edges are added to connect it to gadgets for variables occurring in this clause. Then a single triangle is created, whose one vertex is connected to all the vertices of all the variable gadgets. The graph created can easily be seen to have a width-11 deconstruction into the formula's incidence graph. Namely, a variable's (clause's) bag contains the 2 (6) corresponding vertices, and all bags contain the last triangle.
3Coloring ≤ L 3-SAT (primal graph): Create three variables x, y, z and four clauses (x ∨ y ∨ z), (¬x ∨ ¬y), (¬y ∨ ¬z), (¬z ∨ ¬x) for each vertex of the input graph G, describing that exactly one of the variables corresponding to this vertex is true. Then, for each edge of G add three clauses of size 2, describing that the true variable corresponding to one endpoint has a different label than for the other endpoint. It is easy to see that the formula's primal graph has a width-6 deconstruction into the original graph. Namely, for each original vertex of G create a bag that contains the corresponding 3 variables x, y, z.

3-SAT (incidence graph) ≤ L Independent Set:
Create two adjacent vertices x, ¬x for every variable x (variable gadget), and a triangle for every clause (clause gadget). In every clause gadget label the vertices of the triangle by the literals occurring in the clause, and connect these vertices to corresponding literals in clause gadgets. Then