BIROn - Birkbeck Institutional Research Online
Chen, Hubie and Muller, M. (2015) The fine classification of conjunctive
queries and parameterized logarithmic space.
In:
UNSPECIFIED
(ed.)
PODS ’13 Proceedings of the 32nd ACM SIGMOD-SIGACT-SIGAI
symposium on Principles of database systems.
New York, U.S.: ACM
Publications, pp. 309-320. ISBN 9781450320665.
Downloaded from:
Usage Guidelines:
Please refer to usage guidelines at
or alternatively
arXiv:1306.5424v2 [cs.CC] 25 Jun 2013
The Fine Classification of Conjunctive Queries
and
Parameterized Logarithmic Space Complexity
Hubie Chen
∗Departamento LSI, Facultad de Inform´atica
Universidad del Pa´ıs Vasco, San Sebasti´an, Spain
and
IKERBASQUE, Basque Foundation for Science, Bilbao, Spain
Moritz M¨uller
†Kurt G¨odel Research Center, Universit¨at Wien, Vienna, Austria
Abstract
We perform a fundamental investigation of the complexity of conjunctive query evaluation from the perspective of parameterized complexity. We classify sets of boolean conjunctive queries according to the complexity of this problem. Previous work showed that a set of conjunctive queries is fixed-parameter tractable precisely when the set is equivalent to a set of queries having bounded treewidth. We present a fine classification of query sets up to parameterized logarithmic space reduction. We show that, in the bounded treewidth regime, there are three complexity de-grees and that the properties that determine the degree of a query set are bounded pathwidth and bounded tree depth. We also engage in a study of the two higher degrees via logarithmic space machine characterizations and complete problems. Our work yields a significantly richer perspective on the complexity of conjunctive queries and, at the same time, suggests new avenues of research in parameterized complexity.
1
Introduction
Conjunctive queries are the most basic and most heavily studied database queries, and can be formalized logically as formulas consisting of a sequence of existentially quanti-fied variables, followed by a conjunction of atomic formulas. Ever since the landmark
∗E-mail address:[email protected]
1977 article of Chandra and Merlin [4], complexity-theoretic aspects of conjunctive queries have been a research subject of persistent and enduring interest which continues to the present day (as a sampling, we point to the works [1, 22, 27, 18, 19, 20, 9, 28, 25]; see the discussions and references therein for more information). The problem of evaluating a conjunctive query on a relational database is equivalent to a number of well-known problems, including conjunctive query containment, the homomorphism problem on relational structures, and the constraint satisfaction problem [4, 22]. That this evaluation problem appears in many equivalent guises attests to the fundamental and primal nature of this problem, and it has correspondingly been approached and studied from a wide variety of perspectives and motivations. The resulting literature has not only been fruitful in terms of continually providing insights into and notions for understanding conjunctive queries themselves, but has also meaningfully fed back into a richer understanding of computational complexity theory at large, and of com-mon complexity classes in particular. This is witnessed by the observation that various flavors of conjunctive query evaluation are used as prototypical complete problems for complexity classes such as NP and W[1] (refer, for example, to the books by Creignou, Khanna, and Sudan [8] and by Flum and Grohe [17], respectively). Another example of this phenomenon is the work showing LOGCFL-completeness of evaluating acyclic conjunctive queries (as well as of many related problems) due to Gottlob, Leone, and Scarcello [18].
As has been eloquently articulated in the literature [27], the employment of classi-cal complexity notions such as polynomial-time tractability to grade the complexity of conjunctive query evaluation is not totally satisfactory. For in the context of databases, the typical scenario is the evaluation of a relatively short query on a relatively large database; this suggests a notion of time complexity wherein a non-polynomial depen-dence on the query may be tolerated, so long as the dependepen-dence on the database is poly-nomial. Computational complexity theory has developed and studied precisely such a relaxation of polynomial-time tractability, called fixed-parameter tractability, in which arbitrary dependence in a parameter is permitted; in our query evaluation setting, the query size is normally taken as the parameter. The class of such tractable problems is denoted by FPT. Fixed-parameter tractability is the base tractability notion of
param-eterized complexity theory, a comprehensive theory for studying problems where each
instance has an associated parameter. As a parameterized problem, conjunctive query evaluation is complete for the parameterized complexity class W[1] [27, 17]; the prop-erty of W[1]-hardness plays, in the parameterized setting, a role similar to that played by NP-hardness in the classical setting.
use an equivalent formulation of this problem. It is known that each boolean conjunc-tive queryφcan be bijectively represented as a relational structureAin such a way that, for any relational structureB, it holds thatφis true onBif and only if there exists a homomorphism fromAtoB[4]. Hence, the following family of problems is equiv-alent to the family of problems EVAL(Φ). LetAbe a set of structures, and denote by HOM(A)the problem of deciding, given a structureA∈ Aand a second structureB, whether or not there is a homomorphism fromAtoB. Usep-HOM(A)to denote the parameterized version of this problem, where the size ofAis taken as the parameter.
Under the assumption that the structures inAhave bounded arity, Grohe [20] pre-sented a classification of the tractable problems of this form: if the cores ofAhave bounded treewidth, then the problemp-HOM(A)is fixed-parameter tractable; other-wise, the problemp-HOM(A)is W[1]-hard. The core of a structure can be intuitively thought of as a smallest equivalent structure. Grohe’s classification thus shows that, in the studied setting, the condition of bounded treewidth is the only property guaran-teeing tractability (assuming FPT6=W[1]). Recall that treewidth is a graph measure which, intuitively speaking, measures the similitude of a graph to a tree, with a lower measure indicating a higher degree of similarity. The assumption of bounded arity pro-vides robustness in that translating between two reasonable representations of struc-tures can be done efficiently; this is in contrast to the case of unbounded arity, where the choice of representation can dramatically affect complexity [5].
The present article was motivated by the following fundamental research question:
What algorithmic/complexity behaviors of conjunctive queries are possible, within the regime of fixed-parameter tractability? That is, we endeavored to obtain a finer
per-spective on the parameterized complexity of conjunctive queries, and in particular, on the possible sources of tractability thereof, by presenting a classification result akin to Grohe’s, but for queries that are fixed-parameter tractable. As is usual in computa-tional complexity, we make use of a weak notion of reduction in order to be able to make fine distinctions within the tractable zone. Logarithmic space computation is a common machine-based mode of computation that is often used to make distinctions within polynomial time; correspondingly, we adopt parameterized logarithmic space
computation, which is obtained by relaxing logarithmic space computation much in
the way that fixed-parameter tractability is obtained by relaxing polynomial time, as the base complexity class and as the reduction notion used in our investigation.
We present a classification theorem that comprehensively describes, for each set
Aof structures having bounded arity and bounded treewidth, the complexity of the problemp-HOM(A), up to parameterized logarithmic space reducibility (Section 3). LetT denote the set of all graphs that are trees,P denote the set of all graphs that are paths, and, for a set of structuresA, let A∗ denote the set of structures obtain-able by taking a structureA ∈ Aand adding each element ofAas a relation. Our theorem shows that precisely three degrees of behavior are possible: such a problem
problemp-HOM(A)based on the hardness ofp-HOM(M∗)whereMconsists of cer-tain graph minors derived fromA(Lemma 3.6). The proof of our classification theorem utilizes this reduction in conjunction with excluded minor characterizations of graphs of bounded pathwidth and of bounded tree depth. We remark that, in combination with the excluded grid theorem from graph minor theory, the discussed reduction can be employed to readily derive Grohe’s classification from the hardness of the colored grid
homomorphism problem; this hardness result was presented by Grohe, Schwentick, and
Segoufin [21]. A fascinating aspect of our classification theorem, which is shared with that of Grohe, is that natural graph-theoretic conditions–in our case, those of bounded pathwidth and bounded tree depth–arise naturally as the relevant properties that are needed to present our classification. This theorem also widens the interface among conjunctive queries, graph minor theory, and parameterized complexity that is present in the discussed work [21, 20].
Given that the problemsp-HOM(P∗)andp-HOM(T∗)are the only problems (up to equivalence) above parameterized logarithmic space that emerge from our classifi-cation, we then seek a richer understanding of these problems. In particular, we en-gage in a study of the complexity classes that these problems define: we study the class of problems that reduce to p-HOM(P∗), and likewise forp-HOM(T∗) (Sec-tions 4 and 5). Following a time-honored tradition in complexity theory, we present machine-based definitions of these classes, which classes we call PATH and TREE, respectively. The machine definition of PATH comes from recent work of Elberfeld, Stockhusen, and Tantau [12] and is based on nondeterministic Turing machines satis-fying two simultaneous restrictions: first, that only parameterized logarithmic space is consumed; second, that the number of nondeterministic bits used is bounded, namely, by the product of the logarithm of the input size and a constant depending on the pa-rameter. The machine characterization of TREE is similar, but it is based on alternating Turing machines where, in addition to the nondeterministic bits permitted previously, a parameter-dependent number of conondeterministic bits may also be used. In addi-tion to proving that the problemsp-HOM(P∗)andp-HOM(T∗)are complete for the machine-defined classes, we also prove that for any set of structuresAhaving bounded pathwidth, the parameterized embedding problemp-EMB(A)is in PATH, and prove an analogous result for structures of bounded treewidth and the class TREE.
In the final section of the paper, we present a fine classification for the problem of counting homomorphisms which is analogous to our classification for the homomor-phism problem (Section 6).
2
Preliminaries
Forn∈Nwe define[n] :={1, . . . , n}ifn >0and[0] :=∅. We write{0,1}≤nfor
the set of binary stringsx∈ {0,1}∗of length
|x| ≤n; we have{0,1}≤0=
{λ}where
λis the empty string.
2.1
Structures, homomorphisms and cores
Structures
A vocabulary τis a finite set of relation symbols, where eachR∈τhas an associated
arityar(R) ∈ N. Aτ-structure Aconsists of a nonempty finite setA, its universe, together with an interpretationRA
⊆Aar(R)
of everyR ∈τ. Let us emphasize that, in this article, we consider only finite structures. A substructure (weak substructure) ofAis a structure induced by a nonempty subsetX ofA, i.e. the structurehXiA
with universeXthat interprets everyR∈τby (respectively, a subset of)Xar(R)
∩RA
. A
restriction of a structure is obtained by forgetting the interpretations of some symbols,
and an expansion of a structure is obtained by adding interpretations of some symbols. We view directed graphs as{E}-structuresG:= (G, EG)for binaryE;Gis a graph if EG
is irreflexive and symmetric. Note that a weak substructure of a graph is a subgraph. The graph underlying a directed graphGwithout loops (i.e. with irreflexive
EG
) is obtained by replacingEG
with its symmetric closure. We shall be concerned with the following classes of structures.
– Fork ≥ 2, the structure −→Pk has universe[k] and edge relation {(i, i+ 1) |
i ∈ [k−1]}. The class−→P of directed paths consists of the structures that are isomorphic to a structure of this form.
LetPkbe the graph underlying−→Pk. The classPof paths consists of the struc-tures that are isomorphic to a structure of this form.
– Fork≥2, the structure−→Ck has universe[k]and edge relation{(i, i+ 1)|i∈
[k−1]} ∪ {(k,1)}. The class−→C of directed cycles consists of the structures that are isomorphic to a structure of this form.
LetCk be the graph underlying−→Ck. The classCof cycles consists of the struc-tures that are isomorphic to a structure of this form.
– Fork≥0,the structure−→Bkhas universe{0,1}≤kand binary relationsS−→Bk
i =
{(x, xi)|x∈ {0,1}≤k−1}fori∈ {0,1}. The class−→B consists of the structures
that are isomorphic to a structure of this form.
LetTkbe the graph underlying the directed graph({0,1}≤k, S−→Bk
0 ∪S
−→
Bk
1 ).
LetBk be the structure with universe{0,1}≤k and binary relationsSBk
0 ,S
Bk
1
defined to be the symmetric closures of the relationsS
−→
Bk
0 ,S
−→
Bk
1 , respectively.
The classBconsists of the structures that are isomorphic to a structure of this form.
A class of structuresAhas bounded arity if there exists ar∈Nsuch that any relation symbol interpreted in any structureA∈ Ahas arity at mostr.
Homomorphisms
LetA,Bbe structures. A homomorphism fromAtoBis a functionh:A→Bsuch that for allR ∈ τ and for all¯a = (a1, . . . , aar(R)) ∈ R
A
it holds thath(¯a) ∈ RB
where we writeh(¯a) = (h(a1), . . . , h(aar(R))). A partial homomorphism fromAto Bis the empty set or a homomorphism from a substructure ofAtoB; equivalently, this is a partial functionhfromAtoB that is a homomorphism fromhdom(h)iA
to Bif the domaindom(h)ofhis not empty. As has become usual in our context, by an
embedding we mean an injective homomorphism.
A structureAis a core if all homomorphisms fromAtoAare embeddings. Every structureAmaps homomorphically to a weak substructure of itself which is a core. This weak substructure is unique up to isomorphism and called the core ofA(cf. [13]). For a set of structuresAwe letcore(A)denote the set of cores of structures inA. It is not hard to see that two structuresA,Bare homomorphically equivalent (that is, there are homomorphisms in both directions) if and only if they have the same core.
WhenAis a structure, we useA∗to denote its expansion that interprets for every
a∈Aa fresh unary relation symbolCabyC
A∗
a ={a}. For a class of structuresAwe
let
A∗:=
{A∗|A∈ A}.
Example 2.1. The following facts are straightforward to verify. Trees with at least two
vertices and cycles of even length have a single edge as core, and so do cycles of even length. Cycles of odd length are cores, and so are directed paths. Structures of the form A∗are cores.
2.2
Notions of width
We rely on Bodlaender’s survey [3] as a general reference for the notions of treewidth and pathwidth. Tree depth was introduced in [26].
A tree-decomposition of a graphG= (G, EG)is a pair of a treeTand a family of
bagsXt⊆Gfort∈T such thatG=St∈TXt, E
G
⊆S
t∈TXt2andXt∩Xt′ ⊆Xt′′
whenevert′′lies on the simple path fromttot′; it is called a path-decomposition ifT
is a path; its width ismaxt∈T|Xt| −1.
The treewidthtw(G)ofGis the minimum width of a tree-decomposition ofG. The pathwidthpw(G)ofGis the minimum width of a path-decomposition ofG.
By a rooted treeTwe mean an expansion (T, ET
,rootT)of a tree (T, ET
)by a unary relation symbol root interpreted by a singleton containing the root. The tree
depthtd(G)ofGis the minimumh∈Nsuch that every connected component ofGis a subgraph of the closure of some rooted tree of heighth. Here, the closure of a rooted tree is obtained by adding an edge fromttot′whenevertlies on the simple path from
the root tot′.
The tree depthtd(A)of an arbitrary structureAis the tree depth of its Gaifman
different and occur together in some tuple in some relation inA. The notionspw(A) andtw(A)are similarly defined.
A classAof structures has bounded tree depth if there isw∈Nsuch thattd(A)≤
wfor allA∈ A. Having bounded pathwidth or treewidth is similarly explained. It is not hard to see that bounded pathwidth is implied by bounded tree depth, and, trivially, bounded treewidth is implied by bounded pathwidth. The converse statements fail:
Example 2.2. The classPhas unbounded tree depth and bounded pathwidth (cf. [26, Lemma 2.2]). The class B has unbounded pathwidth and bounded treewidth (see. e.g. [3, Theorem 67]).
Such classes are characterized as those excluding certain minors as follows. The first two statements are well-known from Robertson and Seymour’s graph minor series (cf. [3, Theorems 12,13]) and the third is from [2, Theorem 4.8].
Theorem 2.3. LetCbe a class of graphs.
1. (Excluded Grid Theorem)Chas bounded treewidth if and only ifCexcludes some grid as a minor.
2. (Excluded Tree Theorem) C has bounded pathwidth if and only ifC excludes some tree as a minor.
3. (Excluded Path Theorem)C has bounded tree depth if and only ifC excludes some path as a minor.
A class of graphsCexcludes a graphMas a minor ifMis not a minor of any graph inC. Recall,Mis a minor of a graphGif there exists a minor mapµfromMtoG, that is, a family(µ(m))m∈M of pairwise disjoint, non-empty, connected subsets ofG
such that for all(m, m′)
∈EM
there arev∈µ(m)andv′
∈µ(m′)with(v, v′)
∈EG
. It is easy to verify thattd,pw,tware monotone with respect to the minor pre-order, that is, e.g. td(G) ≥ td(M)for every minorMofG. Example 2.2 thus gives the (easy) directions from left to right in the above theorem.
2.3
Parameterized complexity
Turing machines
We identify (classical) problems with setsQ⊆ {0,1}∗of finite binary strings. We use
Turing machines with a (read-only) input tape and several worktapes as our basic model of computation. We will consider nondeterministic and alternating Turing machines with binary nondeterminism and co-nondeterminism. For concreteness, let us agree that a nondeterministic machine has a special (existential) guess state; a configuration with the guess state has two successor configurations obtained by changing the guess state to one out of two further distinguished statess0, s1. An alternating machine may additionally have a universal guess state that follows a similar convention. For a functionf :{0,1}∗
→Nwe say thatAusesf (co-)nondeterministic bits if for every
inputx∈ {0,1}∗every run ofAonxcontains at mostf(x)many configurations with
Fixed-parameter (in)tractability
A parameterized problem(Q, κ)is a pair of a classical problemQ ⊆ {0,1}∗and a
logarithmic space computable parameterizationκ:{0,1}∗
→Nassociating with any instancex∈ {0,1}∗its parameterκ(x)
∈N.1 A Turing machine is fpt-time bounded
(with respect toκ) if on inputx ∈ {0,1}∗ it runs in timef(κ(x))
· |x|O(1) where f :N→Nis a computable function. The class FPT (para-NP) contains the parameter-ized problems(Q, κ)such thatQis decided (accepted) by an fpt-time bounded deter-ministic (nondeterdeter-ministic) Turing machine. An fpt-reduction from(Q, κ)to(Q′, κ′)
is a reductionR : {0,1}∗
→ {0,1}∗ fromQtoQ′ that is computable by a fpt-time
bounded (with respect toκ) Turing machine and such thatκ′
◦R ≤ f ◦κfor some computablef.
We are concerned with homomorphism and embedding problems associated with classes of structuresA.
p-HOM(A)
Instance: A pair of structures(A,B)whereA∈ A.
Parameter: |A|.
Problem: Is there a homomorphism fromAintoB?
p-EMB(A)
Instance: A pair of structures(A,B)whereA∈ A.
Parameter: |A|.
Problem: Is there an embedding fromAintoB?
These problem definitions exemplify how we present parameterized problems. More formally, the parameterization indicated is the function that maps a string encoding a pair of structures(A,B)to|A|, and any other string to, say, 0. Here,|A| := |τ|+
|A|+P
R∈τ|RA| ·ar(R)is the size ofA; note that the length of a reasonable binary
encoding ofAisO(|A| ·log|A|)(cf. [14]).
The theory of parameterized intractability is centered around the W-hierarchy, which consists of the classes W[1]⊆W[2]⊆ · · · ⊆W[P].The class W[P] contains the pa-rameterized problems(Q, κ)that are accepted by nondeterministic Turing machines that are fpt-time bounded with respect toκand usef(κ(x))·log|x|many nondeter-ministic bits. We refer to the monographs [17, 11] for more information about the W-hierarchy. It is well-known that, whenAis a decidable class of structures, the prob-lemsp-HOM(A)andp-EMB(A)are contained in W[1]; whenAis the e.g. class of cliques, these problems are W[1]-hard and hence W[1]-complete under fpt-reductions.
Parameterized logarithmic space
A Turing machine is parameterized logarithmic space bounded (with respect toκ), in
short, pl-space bounded (with respect toκ) if on inputx ∈ {0,1}∗ it runs in space
O(f(κ(x)) + logn), where f : N → Nis some computable function. The class para-L (para-NL) contains the parameterized problems(Q, κ)such thatQis decided
(accepted) by a (non)deterministic Turing machine that is pl-space bounded with re-spect toκ. Obviously,
para-L⊆para-NL⊆FPT⊆W[P]⊆para-NP.
Remark 2.4. Allowing in the above definition spacef(κ(x))·log|x|gives strictly larger classes known as (the stronlgy uniform versions of) XL and XNL. These classes are likely to be incomparable with FPT: they do not contain FPT unless P=NL and contain problems that are even AW[SAT]-hard under fpt-reductions. We shall not be concerned with these classes here and refer the interested reader to [6, 12] for proofs of the mentioned facts and further information. [15] gives some general account of the para- and X-operators.
Letκbe a parameterization. A functionF : {0,1}∗
→ {0,1}∗is implicitly
pl-computable (with respect toκ) if the parameterized problem
BITGRAPH(F)
Instance: A triple(x, i, b)wherex∈ {0,1}∗,i
≥1, andb∈ {0,1}.
Parameter: κ(x).
Problem: DoesF(x)have length|F(x)| ≥iandith bit equal tob?
is in para-L. The following is straightforwardly verified as in the classical setting of logarithmic space computability.
Lemma 2.5. Letκ, κ′ be parameterizations and letF, F′ : {0,1}∗ → {0,1}∗ be
implicitly pl-computable with respect toκandκ′respectively. ThenF′◦Fis implicitly
pl-computable with respect toκ.
Let (Q, κ),(Q′, κ′)be parameterized problems. A pl-reduction from (Q, κ) to
(Q′, κ′) is a reductionR :
{0,1}∗
→ {0,1}∗ from Qto Q′ that is implicitly
pl-computable2 with respect toκand such that there exists a computable functionf :
N → Nsuch that κ′
◦ R ≤ f ◦ κ. We write (Q, κ) ≤pl (Q′, κ′) to indicate that
such a reduction exists. We write(Q, κ)≡pl (Q′, κ′)if both(Q, κ)≤pl (Q′, κ′)and
(Q′, κ′)
≤pl(Q, κ).
3
Classification
Theorem 3.1 (Classification Theorem). LetAbe a decidable class of structures of bounded arity such thatcore(A)has bounded treewidth.
1. Ifcore(A)has unbounded pathwidth, then
p-HOM(A)≡plp-HOM(T∗).
2. Ifcore(A)has bounded pathwidth and unbounded tree depth, then p-HOM(A)≡plp-HOM(P∗).
3. Ifcore(A)has bounded tree depth, then
p-HOM(A)∈para-L.
Remark 3.2. IfAis assumed to be only computably enumerable instead of decidable, then the theorem stays true understanding all mentioned problems in a suitable way as promise problems. If no computability assumption is placed onA, then the theorem stays true in the non-uniform setting of parameterized complexity theory (cf. [11]).
We break the proof into several lemmas.
To prove statement (3) of Theorem 3.1 we show that a structure of tree depthwcan be characterized, in a sense made precise, by an existential first-order sentence of
quan-tifier rankw+1, and that model-checking such sentences can be done in parameterized logarithmic space. A proof can be found in Section 3.2.
Lemma 3.3. AssumeAis a decidable class of structures of bounded arity such that
core(A)has bounded tree depth. Thenp-HOM(A)∈para-L.
To prove statements (1) and (2) of Theorem 3.1 we need to deal with homomor-phism problems for classesAthat are not necessarily decidable. Slightly abusing no-tation, we sayp-HOM(A)≤plp-HOM(A′)for arbitrary classes of structuresA,A′if
there is a implicitly pl-computable partial functionFthat is defined on those instances
(A,B)ofp-HOM(A)withA ∈ Aand maps them to equivalent instances(A′,B′)
ofp-HOM(A′)withA′ ∈ A′such that|A′|is effectively bounded in|A|. By saying
that a partial functionFis implicitly pl-computable with respect to a parameterization
κwe mean that there are a computablef : N → Nand a Turing machine that on those instances(x, i, b)of BITGRAPH(F)such thatF is defined onx, runs in space
O(f(κ(x)) + log|x|)and answers(x, b, i) ∈? BITGRAPH(F); on other instances the machine may do whatever it wants.
The following lemma takes care of the reductions from left to right in statements (1) and (2) of Theorem 3.1.
Lemma 3.4. LetAbe a class of structures and R ⊆ T be a computably enumer-able class of trees. Assume there isw ∈Nsuch that every structure inAhas a tree decomposition of width at mostwwhose tree is contained inR. Then,
p-HOM(A)≤plp-HOM(R∗).
Proof. Let (A,B) with A ∈ A be an instance of p-HOM(A). Enumerating R, test successively for T ∈ R whether there exists a width≤ w tree-decomposition
defined.
B′ :=
f |fis a partial homomorphism fromAtoBand|dom(f)| ≤w ;
EB′
:=
(f, g)∈B′×B′| fandgare compatible ;
CB′
t :=
f ∈B′|dom(f) =Xt , for everyt∈T .
Suppose thathis a homomorphism fromAtoB. Then the mappingh′ : T
→ B′
defined byh′(t) =h ↾X
tis straightforwardly verified to be a homomorphism from
T∗toB′.
Conversely, leth′ be a homomorphism fromT∗ toB′. Then,h′(t) is a partial homomorphism fromAtoBwith domainXt. SinceTis connected the values ofh′
are pairwise compatible. Henceh:=S
t∈Th′(t)is a function from
S
t∈TXt=Ato
B. To seehis a homomorphism, consider a tuple(a1, . . . , ar)∈RAfor somer-ary
relationR in the vocabulary ofA. Then {a1, . . . , ar}is contained in some bag Xt
since it is a clique in the Gaifman graph ofA(cf. [3, Lemma 4]). Buth′(t)maps this
tuple to a tuple inRB
, so the mappinghdoes as well.
For later use we make the following remark concerning the above proof.
Remark 3.5. The previous proof associates with a homomorphismhfromAtoBthe homomorphismh′ fromT∗ toB′ that mapst toh ↾ X
t. This associationh 7→ h′
is injective because everya ∈ A appears in some bagXt. It is also surjective: a
homomorphismh′ fromT∗ toB′, is associated withh := S
t∈Th′(t); the previous
proof argued thathis a homomorphism fromA toB. Hence, there is a bijection between the set of homomorphisms fromAtoBand the set of homomorphisms from T∗toB′.
At the heart of the proof of Theorem 3.1 is the following sequence of reductions, proved in the following subsection. The appropriately informed reader will recognize elements from Grohe’s proof [20] as well as from Marx [24, Lemma 5.2].
Lemma 3.6 (Reduction Lemma). LetAbe a computably enumerable class of struc-tures of bounded arity, letGbe the class of Gaifman graphs ofcore(A), and letMbe the class of minors of graphs inG. Then
p-HOM(M∗) ≤pl p-HOM(G∗)
≤pl p-HOM(core(A)∗)
≤pl p-HOM(core(A))
≤pl p-HOM(A).
With the Reduction Lemma, we can give the proof of the Classification Theorem.
Proof of Theorem 3.1. The reduction from left to right in statements (1) and (2)
3.1
Proof of the Reduction Lemma
As a consequence of the assumption thatAis computably enumerable, each of the sets
M∗,
G∗, core(
A)∗, andcore(
A)are computably enumerable. The statement of the theorem claims the existence of four reductions. The last one fromp-HOM(core(A))
top-HOM(A)is easy to see. We construct the first three in sequence.
Lemma 3.7. LetGbe a class of graphs which is computable enumerable, and letM be the class of minors of graphs inG. Then
p-HOM(M∗)≤plp-HOM(G∗).
Proof. Let (M∗,B)withM∗ ∈ M∗ be an instance of the problemp-HOM(M∗). EnumeratingG, test successively forG ∈ G whether M is a minor ofG. Since M ∈ Mthis test eventually succeeds, and then compute a minor mapµfromMto G. The time needed is effectively bounded in the parameter|M∗|. The reduction then produces the instance(G∗,B′)ofp-HOM(G∗), whereB′is defined as follows. LetI
denote the setS
m∈Mµ(m).
B′ := (M ×B) ˙∪{⊥};
EB′
:=
((m1, b1),(m2, b2))|[m1=m2⇒b1=b2]and
[(m1, m2)∈EM
⇒(b1, b2)∈EB
]
∪
(⊥, b′)|b′∈B′} ∪ {(b′,⊥)|b′∈B′ ;
CB′
v := {(m, b)|b∈C
B
m}, ifm∈M andv∈µ(m);
CB′
v := {⊥}, ifv /∈I.
Suppose thathis a homomorphism fromM∗toB. Leth′ :G
→B′ be the map
that sends, for eachm ∈ M, the elements inµ(m)to(m, h(m))and that sends all elementsv /∈Ito⊥. Thenh′is a homomorphism fromG∗toB′.
Suppose thatgis a homomorphism fromG∗toB′. We show thatgis of the form
h′for a homomorphismhfromM∗toB. First, by definition of theCB′
v , it holds that
g(v) =⊥for allv /∈I. Next, letv, wbe elements of a setµ(m), withm∈M. The definition of theCB′
v ensures thatg(v)andg(w)have the form (m,·). Sinceµ(m)
is connected, the definition ofEB′
ensures thatg(v) = g(w). Finally, suppose that
(m1, m2)∈EM
, let(m1, b1)be the image ofµ(m1)underg, and let(m2, b2)be the image ofµ(m2)underg. We claim that(b1, b2)∈ EB
. But there existv1 ∈ µ(m1)
andv2∈µ(m2)such that(v1, v2)∈EG
. We then have(g(v1), g(v2))∈EB′ and the definition ofEB′
ensures that(b1, b2)∈EB
.
Lemma 3.8. LetAbe a computably enumerable class of structures of bounded arity, and letGbe the class of Gaifman graphs ofA. Then
p-HOM(G∗)≤plp-HOM(A∗).
graph isG; in particular,A=Gand we writeG= (A, EG). The reduction outputs
(A∗,B′)whereB′is the structure defined as follows.
B′ := A×B, CB′
a := {a} ×C
B
a,
RB′
:= n((a1, b1), . . .(aar(R), bar(R)))∈(A×B) ar(R)
|
¯
a∈RA
and for alli, j∈[ar(R)] : ifai=6 aj, then(bi, bj)∈E
Bo
,
forR∈τ whereτdenotes the vocabulary ofA. We have to show
(G∗,B)∈p-HOM(G∗)⇐⇒(A∗,B′)∈p-HOM(A∗).
To see this, assume first thath is a homomorphism from G∗ to B. We claim thath′(a) := (a, h(a))defines a homomorphism fromA∗ toB′. Ifa′
∈ CA∗
a , then
a′ = aandh(a′)
∈ CB
a sincehis a homomorphism; by definition then h′(a′) =
(a, h(a)) ∈ CB′
a . Henceh′ preserves the symbolsCa. To show it preservesR ∈ τ,
let(a1, . . . , aar(R))∈ R
A
. We have to show((a1, h(a1)), . . . ,(aar(R), h(aar(R)))) ∈
RB′
, or equivalently, for alli, j∈[ar(R)]withai6=ajthat(h(ai), h(aj))∈E
B
. But ifai6=aj, then(ai, aj)∈E
G
by definition of the Gaifman graph and(h(ai), h(aj))∈
EB
follows fromhbeing a homomorphism.
Conversely, assume that h′ is a homomorphism from A∗ toB′. By definition
ofCB′
a is follows thath′(a) = (a, h(a))for some functionh : A → B such that
h(a)∈ CB
a . We claim thathis a homomorphism fromG∗ toB. It suffices to show
(h(a), h(a′)) ∈ EB
whenever(a, a′) ∈ EG
. But if (a, a′) ∈ EG
, then a 6= a′
and there existR ∈ σand(a1, . . . , aar(R)) ∈ R
A
andi, j ∈ [ar(R)]such thata =
ai and a′ = aj. Then ((a1, h(a1)), . . . ,(aar(R), h(aar(R)))) ∈ R
B′
because h′ is
a homomorphism. Since ai 6= aj the definition ofEB
′
implies (h(ai), h(aj)) =
(h(a), h(a′))
∈EB
as desired.
Recall that the direct productA×Bof twoτ-structuresAandBhas universe
A×Band interprets a relation symbolR∈τby{((a1, b1), . . . ,(aar(R), bar(R)))|¯a∈
RA
,¯b∈RB
}.
Lemma 3.9. LetAbe a class of structures. Then
p-HOM(core(A)∗)≤plp-HOM(core(A)).
Proof. Let(D∗,B)withD ∈core(A)be an instance ofp-HOM(core(A)∗). LetB ∗
be the restriction ofBto the vocabulary ofD. The reduction produces the instance
(D,B′)of the problemp-HOM(core(A))), where B′:=
(d, b)∈D×B|b∈CB
d
D×B∗
.
Suppose thathis a homomorphism fromD∗toB. Then, the mappingh′ :D
→B′
defined byh′(d) = (d, h(d))is straightforwardly verified to be a homomorphism from
Suppose thatgis a homomorphism fromDtoB′. Writeπ1andπ2for the projec-tions that map a pair to its first and second component respectively. The composition
(π1◦g)is a homomorphism fromDto itself; sinceDis a core,(π1◦g)is bijective. Hence, there exists a naturalm ≥1such that(π1◦g)mis the identity onD. Define
has g◦(π1◦g)m−1. Clearly,his a homomorphism fromDtoB′, so π2◦his a
homomorphism fromDtoB∗. We claim thatπ2◦his also a homomorphism fromD∗
toB. Observe thatπ1◦his the identity onD. In other words, for everyd∈Dthere isbd ∈Bsuch thath(d) = (d, bd). By definition ofB′ we getbd∈CdB, establishing
the claim.
Observe that the maph′constructed in the above proof is an embedding. Hence we
have the following corollary that we note explicitly for later use.
Corollary 3.10. LetAbe a class of structures. Then
p-HOM(core(A)∗)≤plp-EMB(core(A)).
3.2
Bounded tree depth and para-L
Letτ be a vocabulary. First-order τ-formulas are built from atomsRx, x¯ = xby Boolean combinations and existential and universal quantification. Here,x¯is a tuple of variables of length matching the arity ofR. We writeϕ(¯x)for a (first-order)τ -for-mulaϕto indicate that the free variables inϕare among the components ofx¯. The
quantifier rankqr(ϕ)of a formulaϕis defined as follows:
qr(ϕ) = 0 for atomsϕ;
qr(¬ϕ) =qr(ϕ);
qr(ϕ∧ψ) =qr(ϕ∨ψ) = max{qr(ϕ),qr(ψ)};
qr(∃xϕ) =qr(∀xϕ) = 1 +qr(ϕ).
The following is standard, but we could not find a reference, so include the simple proof for completeness.
Lemma 3.11. The parameterized problem
p-MC(FO)
Instance: A structureA, a first-order sentenceϕ.
Parameter: |ϕ|.
Problem: A|=ϕ?
can be decided in spaceO(|ϕ| ·log|ϕ|+ (qr(ϕ) +ar(ϕ))·log|A|), whereqr(ϕ)is the quantifier rank ofϕandar(ϕ)is the maximal arity over all relation symbols inϕ
Proof. We give an algorithm expecting inputs(A, ϕ, α)whereϕis a formula andα
is an assignment forϕinA, that is, a map from a superset of the free variables ofϕ
Ifϕis an atomRy¯the algorithm writes the tupleα(¯y)∈Aar(R)
on the worktape and checks whether it is contained inRA
by scanning the input; it then erases the tuple and returns the bit corresponding to the answer obtained.
Ifϕ= (ψ∧χ), the algorithm recurses onψ(with the same assignment); upon com-pleting the recursion it erases all space used in it, stores a bit for the answer obtained, and then recurses onχ; upon completion it erases the space used in it and returns the minimum of the bit obtained and the stored bit. The casesϕ= (ψ∨χ)andϕ=¬ψ
are similar.
Ifϕ(¯x) = ∃yψ(¯x, y)the algorithm loops throughb ∈ Aand recurses onψwith assignmentαextended by mappingytob; it maintains a bit which is intially 0 and updates it after each loop to the maximum of the bit obtained in the loop; after each loop it erases the space used in in it. Upon completing the loop it returns this bit, and restricts the assignment back to its old domain withouty. The caseϕ(¯x) =∀yψ(¯x, y)
is similar.
When started on a sentenceϕand the empty assignment, all assignmentsα oc-curing in the recursion have cardinality≤qr(ϕ), so can be stored in spaceO(qr(ϕ)· (log|ϕ|+ log|A|)). Each recursive step adds spaceO(log|ϕ|)to remember the (posi-tion of) the current subformula plus one bit plusO(log|A|)for the loop onb∈Ain the quantifier case and plusO(ar(ϕ)·log|A|)in the atomic case. From these considerations it is routine to verify the claimed upper bound on space.
The canonical conjunction of a structure A is a quantifier-free conjunction in the variablesxa fora ∈ A; namely, for every relation symbol R ofA and every
(a1, . . . , aar(R)) ∈R
A
it contains the conjunctRxa1· · ·xaar(R). It is easy to see that
the canonical conjunction ofAis satisfiable in a structureBif and only if there is an homomorphism fromAtoB.
Proof of Lemma 3.3. Choosew∈Nsuch thattd(core(A))≤wfor allA∈ A. Given a structureAwe compute a sentenceϕAof quantifier rank at mostw+ 1such that for
all structuresB, the sentenceϕAis true inBif and only if there is a homomorphism
fromAtoB. This is enough by Lemma 3.11.
GivenAwe checkA∈ Arunning some decision procedure forA. IfA∈ A/ we letϕA :=∃x¬x=x. IfA∈ A, compute the coreA0ofAand compute for every
connected componentCof the Gaifman graph ofA0some rooted treeTwith vertices
T =Cand height at mostwsuch that every edge of the Gaifman graph ofhCiA0
is in the closure ofT.
Consider a componentC and letTbe the rooted tree computed forC. Forc ∈
C = T we compute the following first-order formulaϕc. We use variablesxc for
c∈C=T. Ifcis a leaf ofT, letϕcbe the canonical conjunction ofhPciA0wherePc
is the path inTleading from the rootrofTtoc. For an inner vertexcdefine
ϕc:=Vd∃xdϕd,
wheredranges over the successors ofc. The following claims are straightforwardly verified by induction along the recursive definition of theϕcs.
1. the quantifier rank ofϕcequals the height of the subtree ofTrooted atc;
2. the free variables ofϕcare{xd|d∈Pc};
3. ϕcis satisfiable inBif and only if so is the canonical conjunction ofhC(c)i
A0
whereC(c)containsPcand the vertices in the subtree rooted atc.
Lettingrrange over the roots of the treesTchosen for the connected components
CofA0, we set
ϕA:=Vr∃xrϕr.
By Claim 2 this is a sentence and by Claim 1 it has quantifier rank at mostw+ 1. It is true inBif and only if every∃xrϕris true inB, and by Claim 3 this holds if and
only if the canonical conjunction ofhC(r)iA0
is satisfiable inBfor every connected componentC. NotingC(r) =C, this means that everyhCiA0
maps homomorphically toB, and this means thatA0maps homomorphically toB. Recalling thatA0is the core ofA, we see that this is equivalent toAmapping homomorphically toB.
Define a{∧,∃}-sentence to be a first-order sentence built from atoms, conjunction, and existential quantification. The previous proof revealed that, given a structureA withtd(core(A)) ≤ w, there exists a {∧,∃}-sentenceφof quantifier rank at most
w+ 1that corresponds toAin that, for all structuresB, the sentenceφis true onBif and only if there is a homomorphism fromAtoB. We show that the existence of such a sentence in fact characterizes tree depth, in the following precise sense.
Theorem 3.12. Letw≥0, and letAbe a structure. It holds thattd(core(A))≤wif and only if there exists a{∧,∃}-sentenceφthat corresponds toAwithqr(φ)≤w+ 1. Proof. The forward direction follows from the previous proof. For the backward
di-rection, letφbe a sentence of the described type. We may assume that no variable is quantified twice inφand that no equality of variables appears inφ, by renaming vari-ables and replacing equalities of the formv=vwith the empty conjunction. Letφpbe
the prenex sentence where all variables that are existentially quantified inφare existen-tially quantified inφp, and the quantifier-free part ofφpis the conjunction of all atoms
appearing inφ. LetCbe a structure whose canonical conjunction is the quantifier-free part ofφp. Clearly,φpand the originalφare logically equivalent; it follows thatCand
Aare homomorphically equivalent [4]. It thus suffices to show thattd(C)≤w. View the sentenceφas a directed graph, and define an acyclic directed graphDon the variables ofφwhere the directed edge(v, v′)is present if and only if the node for
∃vis the first node with quantification occurring above the node for∃v′. Letαbe an arbitrary atom fromφp(equivalently, fromφ). Sinceφis a sentence, if one traversesφ
starting from the root and moving toα, one will pass a node∃vfor each variablevofα. Letv1, . . . , vk be the variables ofαin the order encountered by such a traversal. The
edges(v1, v2),(v2, v3), . . . ,(vk−1, vk)are in the transitive closure ofD, and hence in
the closure of the graph underlyingD (where a node is a root in the graph iff it is parentless inD). Sinceqr(φ)≤w+ 1, each directed path inDhas length less than or equal tow, and so the graph underlyingDwitnesses thattd(C)≤w.
Theorem 3.13. Assume A is a decidable class of structures of bounded arity and bounded tree depth. Thenp-EMB(A)∈para-L.
The proof of this result uses color coding methods, more precisely, it relies on the following lemma (see [17, p.349]).
Lemma 3.14. For every sufficiently largen, it holds that for allk ∈Nand for every k-element subsetX of[n], there exists a primep < k2lognandq < psuch that the functionhp,q: [n]→ {0, . . . , k2−1}given by
hp,q(m) := (q·mmodp)modk2
is injective onX.
For later use we give the main step in the proof of Theorem 3.13 as a separate lemma. Call a structure connected if its Gaifman graph is connected.
Lemma 3.15. For every decidable class of connected structuresAwe have p-EMB(A)≤plp-HOM(A∗).
Proof. Map an instance(A,B)to(A∗,B
∗)whereB∗ is defined as follows. We
as-sume thatB= [|B|]andA= [|A|]. LetFbe the set
g◦hp,q|g:{0, . . . ,|A|2−1} →Aandq < p <|A|2log|B| .
Here,hp,q: [|B|]→ {0, . . . ,|A|2−1}is the function from Lemma 3.14 (forn:=|B|
andk:=|A|). Forf ∈F, letBfbe the expansion ofBthat interprets everyCa, a∈
A,byf−1(a)
⊆Band defineB∗as the disjoint union of the structuresBf. We verify
(A,B)∈p-EMB(A)⇐⇒(A∗,B∗)∈p-HOM(A∗).
Note that the setsCB ∗
a , a∈A, are pairwise disjoint, so every homomorphism fromA∗
toB∗is an embedding. And becauseA∗is connected, it is an embedding into (the copy of) someBf, so it corresponds to an embedding fromAintoB. Conversely, assumee
is an embedding ofAintoB. By Lemma 3.14 there arep, qwithq < p <|A|2log|B|
such thathp,qis injective on the image ofe. Then there existsg:{0, . . . ,|A|2−1} →
Asuch thatg◦hp,q ◦eis the identity onA. Thenf := g◦hp,q ∈ F andeis an
embedding ofA∗intoBfand hence intoB∗. This lemma together with Corollary 3.10 implies:
Corollary 3.16. LetAbe a decidable class of connected cores. Then p-HOM(A∗)≡plp-EMB(A).
Proof of Theorem 3.13. LetAaccord the assumption.
Notep-EMB(A′)≤plp-HOM((A′)∗)by the previous lemma andp-HOM((A′)∗)∈
para-L by Lemma 3.3. We are thus left to prove the claim.
AssumeAhas tree depth at mostdand letEbe a binary relation symbol not oc-curing in the vocabulary of anyA ∈ A. Fix a computable function that maps every A∈ Ato a family of height≤drooted trees(TC)CwithTC = (C, ETC,rootTC)
whereCranges over the connected components of the Gaifman graphG(A)ofA, and such thathCiG(A)
is a subgraph of the closure ofTC. DefineA′ to be the expansion
ofAinterpretingEbyS
CE
TC
∪E′whereE′is defined as follows. It contains edges
between the root ofTC
0 and the roots of the otherTC whereC0 is the
lexicograph-ically minimal component (according to the encoding ofA). ThenA′ is connected and has tree depth at mostd+ 1. Clearly,A′ := {A′ | A ∈ A}is decidable. The map(A,B)7→(A′,B′), whereB′is the expansion ofBinterpretingE byB2, is a
pl-reduction fromp-EMB(A)top-EMB(A′).
4
The class PATH
We present the complexity class PATH to capture the complexity ofp-HOM(P∗). This class was discovered very recently by Elberfeld et al. [12] with a different angle of motivation; they refer to this class as para-NL[flog]. Among other results, they show that the following problem is complete for this class: check if a digraph contains a path from a distinguished vertexsto another distinguished vertextof length at mostk; here,kis the parameter. We usep-st-PATHto denote the corresponding problem for undirected graphs.
p-st-PATH
Instance: A graphG,s, t∈Gandk∈N.
Parameter: k.
Problem: Is there a path inGfromstotof length at mostk?
Definition 4.1. The class PATH contains a parameterized problem(Q, κ)if there are a computable functionf :N→Nand a nondeterministic Turing machine that acceptsQ, is pl-space bounded with respect toκ, and usesf(κ(x))·log|x|many nondeterministic bits.
The following is straightforward to verify.
Proposition 4.2. The complexity class PATH is closed under pl-reductions.
Recall that, using the notation in [15], one has
FPT=para-P⊆W[P]⊆para-NP.
It follows immediately from the definitions that
para-L⊆PATH⊆para-NL.
Theorem 4.3. p-HOM(P∗)is complete for PATH under pl-reductions.
Thatp-HOM(P∗)is contained in PATH can be seen by the guess-and-check para-digm. We find it informative to present such algorithms in a computational model tailored specifically for this kind of nondeterminism.
Definition 4.4. A jump machine is a Turing machine with an input tape and a special jump state. When the machine enters the jump state the head on the input tape is set
nondeterministically on one of the cells carrying an input bit; we say that the machine
jumps to the cell. When this occurs, no other head moves or writes and the state is
changed to the starting state. Acceptance is defined as usual, that is, such a machine accepts an input if there exists a sequence of nondeterministic jump choices under which the machine accepts. An injective jump machine is defined similarly to a jump machine, but never jumps to a cell that has already been jumped to.
For a functionj : {0,1}∗
→ N, we say that a jump machine (an injective jump machine) usesj many (injective) jumps if for every inputxand every run on x, it enters the jump state at mostj(x)many times.
The idea is that a jump corresponds to a guess of a number in[n]wherenis the length of the input. Observe that one can compute in logarithmic space the number
m∈[n]of the cell it jumps to by moving the head to the left and stepwise increasing a counter.
Lemma 4.5. Let(Q, κ)be a parameterized problem. The following are equivalent.
1. (Q, κ)∈PATH.
2. There exists a computablef :N→Nand a jump machineAusing(f◦κ)many jumps that acceptsQand is pl-space bounded with respect toκ.
3. There exists a computablef : N →Nand an injective jump machineAusing
(f◦κ)many injective jumps that acceptsQand is pl-space bounded with respect toκ.
Proof. (1) implies (2): assume (1) and chooseAandfaccording Definition 4.1. Given an inputxwe simulateAby a jump machineBthat makes use of an extra worktape. WhenAenters its guess stateBmoves its head on the extra worktape right and con-tinues the simulation ofAin statesbwhereb∈ {0,1}is the bit scanned by this head.
In case the head scans a blank cell,Bstores the numberjof the cell its input head is scanning and then performs a jump, say to cellm∈[|x|]. It computes the binary code ofmof length⌈log(|x|+ 1)⌉. It overwrites the content of the extra worktape by this code and sets its head on the first bitbof the code, moves the input head back to cell
jand continues the simulation ofAin statesb. ThenBmakes at mostf(κ(x))many
jumps.
(2) implies (3): letAandfaccord (2). To get a machine according to (3) we intend to simply simulateAon an injective jump machine. This works providedAdoes not have accepting runs with two jumps to the same cell. To ensure this condition we replaceAby the following machineA′. Intutively, ifAjumpsktimes thenA′ jumps
simulation of theith jump ofAis done by jumping to the(m2i, m2i+1)th cell. Details
follow.
The machineA′ onxfirst computesk := f(κ(x)): noteκ(x)can be computed
in spaceO(log|x|)by our convention on parameterizations; thenkcan be computed fromκ(x)running some machine computingf onκ(x)– this needs additional space which is effectively bounded in the parameterκ(x).
ThenA′checks that2k·⌈√n⌉ ≤nwheren:=|x|. If this check fails,A′simulates
some fixed decision procedure forQ(note that (2) implies thatQis decidable). Ob-serve that in this casek≥Ω(√n), so the decision procedure runs in space effectively bounded inkand hence in the parameter. Otherwise2k· ⌈√n⌉ ≤nandA′simulates
Aas follows. Throughout the simulation it maintains a counter for jumps that initially is set to 0. It will be clear that this counter always stores a number≤2k.
WhenAjumps, A′ jumps twice and computes the two numbersa, bof the cells it jumped to. It interpretsa, bas encoding pairs(ia, ma),(ib, mb) ∈ [2k]×[⌈√n⌉].
More precisely,ia := ⌈a/⌈√n⌉⌉ is the leasti such thati· ⌈√n⌉ ≥ aandma :=
1 +a−(ia −1)· ⌈√n⌉; similarly for(ib, mb). If (ia, ma) or(ib, mb) is not in
[2k]×[⌈√n⌉], thenA′halts and rejects.
Forithe value of the jump counter,A′checks thati+ 1 =iaand thati+ 2 =ib.
Then it computesm:=ma· ⌈√n⌉+mband checks thatm∈[n]. ThenA′increases
the jump counter by two, moves the input head to cellm, changes to the starting state and resumes the simulation ofA.
(3) implies (1): choose a machineAand a functionf according (3) and define a machineBas follows. Onxit first computesk :=f(κ(x))(within allowed space as seen above) andn:=|x|. Ifk ≥lognit runs some fixed machineQdecidingQand answers accordingly. Sincek ≥ lognthis needs space effectively bounded inkand thus in the parameter. If otherwisek <logn, thenBsimulatesAas follows. During the simulation it maintains a setXcontaining at mostknatural numbers all smallerk2
– intuitively, this set contains fingerprints of the jumps sofar. Initially,X=∅. To begin,Bguesses a pair(p, q)withq < p < k2lognand stores it. Note that
this requires onlyO(logk+ log logn)≤O(log logn)nondeterministic bits and space. ThenBstarts simulatingA. WhenAjumps,Bguesses⌈log(n+1)⌉many bits encoding a numberm∈ [n]. It computesf := hp,q(m)and checks thatf /∈ X. Then it adds
f toX, moves the input head to themth input bit, changes to the starting state and continues the simulation ofA.
Obviously, ifAjumps at mostℓtimes, thenBuses at mostO(log logn+ℓlogn)
nondeterministic bits. To see thatBruns in allowed space, observe that the “finger-print”f can be computed in spaceO(logn): firstb := qmmodpcan trivially be computed in space polynomial inlogpand this is space(log logn)O(1)
≤O(logn); second,f =b modk2can trivially be computed in space polynomial in(logk+logb)
and the space usage her is(log logn)O(1).
We show thatBacceptsxif and only ifx∈Q. IfBacceptsxthen either because
Qacceptsx(and then triviallyx∈Q) or becauseAreaches an accepting state when it jumps to cells numberedm1, . . . , mℓ; note that the fingerprints of these cell numbers
hp,qis injective on{m1, . . . , mℓ}. ThenBaccepts when first guessing some such pair
(p, q)and then strings encodingm1, . . . , mℓ.
Theorem 4.6. LetAbe a decidable class of structures of bounded arity and of bounded pathwidth. Thenp-EMB(A)∈PATH.
Proof. Choose a constantw∈ Nbounding the pathwidth ofA. We use a machineA
with injective jumps to solvep-EMB(A). The result will then follow from Lemma 4.5. Given an instance(A,B)ofp-EMB(A)the machine first computes a width≤w path-decomposition(Pk,(Xi)i∈[k])ofAsuch thatXi(Xi+1orXi+1 (Xifor all
i∈[k−1]; we further assume that noXi is empty. This is done in space effectively
bounded in the parameter|A|and, in particular,kis effectively bounded in|A|. It then computes inductively for each i ∈ [k] a maphi from Xi into B that is
a partial homomorphism fromAintoB. To start, the machineAjumps|X1|times to guess elementsb1, . . . b|X1| ∈ B. It checks that the functionh1 : X1 → B that
maps the ith element ofX1 tobi defines a partial homomorphism from Ainto B.
Having computedhi the machine computeshi+1 as follows. If Xi+1 ( Xi, then
hi+1 := hi ↾ Xi+1 is the restriction of hi toXi+1. OtherwiseXi+1 ) Xi, say
Xi+1 =Xi∪ {a1, . . . , ad}; thenAjumpsdtimes to guessb1, . . . bd ∈Band checks
thathi+1 := (hi↾Xi)∪ {(aj, bj)|j ∈[d]}is a partial homomorphism fromAinto
B. In the end, if no check fails,Ahalts accepting.
This procedure can be implemented in pl-space: the space to store the path de-composition is bounded in the parameter, and storing one hi needs space roughly
w·(log|A|+ log|B|).
It is routine to check thatAmakes exactly|A|many jumps, and that it accepts only ifS
ihi is a homomorphism fromAtoB. Since the machine has injective jumps it
accepts in fact only if this homomorphism is an embedding. Conversely, it is obvious that the machine accepts if an embedding fromAintoBexists.
Proof of Theorem 4.3. To seep-HOM(P∗) ∈PATH, just consider the machineA de-scribed in the proof of Theorem 4.6 as a machine with jumps instead of as a machine with injective jumps.
To see thatp-HOM(P∗)is hard for PATH under pl-reductions, let(Q, κ)∈PATH and choose a Turing machineAwith jumps according Lemma 4.5 (2) that acceptsQ. We can assume that there are computablef, g:N→Nsuch thatAonx∈ {0,1}∗runs
in spaceO(g(κ(x)) + log|x|)and makes on every run exactlyf(κ(x))many jumps. Fixx ∈ {0,1}∗and set k := κ(x)andn := |x|. LetAdet be the deterministic
Turing machine defined asAbut with the jump state interpreted as a rejecting halting state. Observe thatAdet(andA) has at mostm := 2g(k)
·nc configurations where
c ∈ Nis a suitable constant. Letc1, . . . , cm be a list (possibly with repetitions) of
all configurations ofAdetonxwhose state is the starting state. Assume thatc1 is the starting configuration ofAdet. Fori, j∈[m], sayireachesjif the computation ofAdet
started onci (withxon the input tape) reaches in at mostmsteps a configurationc
with the jump state, andcjis obtained fromcby changing the jump state to the starting
Consider the structureBxgiven by
Bx := [f(k) + 1]×[m],
EBx
:= the symmetric closure of
{((i, j),(i+ 1, j′))|i∈[f(k)], jreachesj′}, CBx
1 := {(1,1)}, CBx
i := {i} ×[m]for2≤i≤f(k),
CBx
f(k)+1 := {(f(k) + 1, j)|jis accepting}.
It is clear that there exists a homomorphism fromP∗
f(k)+1 to Bx if and only if A
accepts x, that is, the mapx 7→ (P∗
f(κ(x))+1,Bx) is a reduction from (Q, κ) to
p-HOM(P∗). The new parameter|P∗
f(κ(x))+1|depends only onκ(x). The reduction is
implicitly pl-computable: first observe that the numbersf(k)andmcan be computed fromxin pl-space. A counter for numbers up tomneeds only spaceO(g(k) + logn). Hence one can tell whether or notireachesjin pl-space simply by simulatingAdetfor at mostmmany steps. Similarly, this space is sufficient to tell whether or not a given
j∈[m]is accepting.
The following result gives information about fundamental problems: the problems
p-EMB(−→P),p-EMB(C), andp-EMB(−→C)are the parameterized problems of determin-ing if an input graph contains a simple directedk-path, a simple undirectedk-cycle, and a simple directedk-cycle, respectively; these problems are denoted respectively by
p-DIRPATH,p-CYCLE, andp-DIRCYCLEby Flum and Grohe [16].
Theorem 4.7. The following parameterized problems are complete for PATH under pl-reductions:
p-st-PATH,
p-HOM(−→P), p-EMB(−→P)
p-HOM(C), p-EMB(C)
p-HOM(−→C), p-EMB(−→C)
Proof. By Theorem 4.6 all embedding problems are contained in PATH. For the
ho-momorphism problems andp-st-PATH the same argument works (see the proof of Theorem 4.3). We are thus left to prove hardness.
Recall Example 2.1. Corollary 3.10 implies thatp-HOM(−→P∗) ≤pl p-EMB(−→P)
and also thatp-HOM(−→C∗) ≤pl p-EMB(−→C).Since we trivially havep-HOM(A) ≤pl
p-HOM(A∗) for all classes A, we conclude that p-HOM(−→P) ≤pl p-EMB(−→P) and
also that p-HOM(−→C) ≤pl p-EMB(−→C). For C we similarly getp-HOM(Codd) ≤pl
p-EMB(Codd)whereCodd is the class of odd length cycles. By −→Codd we denote the
class of odd length directed cycles.
It thus suffices to show that the problems
are PATH-hard. By Theorem 4.3, we know thatp-HOM(P∗)is hard for PATH. We give the sequence of reductions
p-HOM(P∗)≤plp-HOM(−→P)≤plp-st-PATH≤plp-HOM(−→Codd)
and then show the hardness ofp-HOM(Codd).
p-HOM(P∗) ≤pl p-HOM(−→P). Let(P∗k,B)be an instance ofp-HOM(P∗). The
reduction produces the instance(−→Pk,B′)whereB′is the directed graph with vertices
B′:= [k]
×Band edges
EB′
:={((i, b),(i+ 1, b′))|i∈[k−1], b∈CB
i , b′∈C
B
i+1}.
p-HOM(−→P) ≤pl p-st-PATH. Let (−→Pk,G)be an instance of p-HOM(−→P). The
reduction produces the instance(G′, s, t, k+ 2)whereG′has verticesG′ :=
{s, t} ∪
([k]×G)and as edges the symmetric closure of
((i, u),(i+ 1, v))|i∈[k−1],(u, v)∈EG
∪ {s} ×([1]×G)
∪ {t} ×([k]×G)
.
p-st-PATH≤pl p-HOM(−→Codd). Let(G, s, t, k)be an instance of the former
prob-lem; by the previous reduction, we may assume that it is a yes instance if and only if there is ans-tpath of length exactlyk. We can assume thatkis odd (otherwise we take a new neighbor of the givensas our news). Define the graphG′with vertices([k]×G)
and edges as follows. Wheni∈[k−1]and(u, v)∈EG, there is an edge from(i, u)
to(i+ 1, v); also, there is an edge from(k, t)to(1, s). Then(G, s, t, k)7→(−→Ck,G′) is a reduction as desired.
Finally, we show the hardness ofp-HOM(Codd). By appeal to Lemma 3.9, it suffices
to demonstrate a reductionp-st-PATH≤plp-HOM(Codd∗ ). Given an instance(G, s, t, k)
of the former problem of the above form, we defineG′as in the previous reduction. The produced instance is(C∗
k,G′′), whereG′′is the expansion of the symmetric closure
ofG′withCG′′
i ={i} ×G.
5
The class TREE
We give a machine characterization of the class of parameterized problems that are pl-reducible top-HOM(T∗).
Definition 5.1. The class TREE contains a parameterized problem(Q, κ)if there are a computable functionf :N→Nand an alternating Turing machine that acceptsQ, is pl-space bounded with respect toκ, and usesf(κ(x))·log|x|nondeterministic bits andf(κ(x))co-nondeterministic bits.
The following proposition is straightforward to verify.