Model-Checking on Ordered Structures
Kord Eickmeyer, Jan van den Heuvel, Ken-ichi Kawarabayashi, Stephan, Kreutzer, Patrice Ossona de Mendez, Micha{\l} Pilipczuk, Daniel A. Quiroz,, Roman Rabinovich, Sebastian Siebertz

TL;DR
This paper investigates the complexity of model-checking for first- and monadic second-order logic on ordered structures, revealing intractability in general but tractability under certain order-invariant conditions on specific graph classes.
Contribution
It extends understanding of model-checking complexity by analyzing order-invariant logic on classes of structures, showing tractability results where ordering does not affect truth.
Findings
Order-invariant MSO model-checking is tractable on certain graph classes.
First-order successor-invariant formulas are tractable on graphs with bounded expansion.
Model-checking is tractable on coloured posets of bounded width.
Abstract
We study the model-checking problem for first- and monadic second-order logic on finite relational structures. The problem of verifying whether a formula of these logics is true on a given structure is considered intractable in general, but it does become tractable on interesting classes of structures, such as on classes whose Gaifman graphs have bounded treewidth. In this paper we continue this line of research and study model-checking for first- and monadic second-order logic in the presence of an ordering on the input structure. We do so in two settings: the general ordered case, where the input structures are equipped with a fixed order or successor relation, and the order invariant case, where the formulas may resort to an ordering, but their truth must be independent of the particular choice of order. In the first setting we show very strong intractability results for most…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
\hypersetup
ocgcolorlinks=true,colorlinks=true,linkcolor=blue, citecolor=brown
Model-Checking on Ordered Structures††thanks: This paper
subsumes the results of [33, 20, 18, 17, 38].
S. Kreutzer and R. Rabinovich are supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (ERC Consolidator Grant DISTRUCT, grant agreement No. 648527). P. Ossona de Mendez is supported by grant ERCCZ LL-1201 and CE-ITI, and by the European Associated Laboratory “Structures in Combinatorics” (LEA STRUCO) P202/12/G061. M. Pilipczuk and S. Siebertz are supported by the National Science Centre of Poland via POLONEZ grant agreement UMO-2015/19/P/ST6/03998, which has received funding from the European Union’s Horizon 2020 research and innovation programme (Marie Skłodowska-Curie grant agreement No. 665778). D.A. Quiroz is supported by CONICYT, PIA/Concurso Apoyo a Centros Científicos y Tecnológicos de Excelencia con Financiamiento Basal AFB170001.
Kord Eickmeyer
Technische Universität Darmstadt, Germany,
Jan van den Heuvel
London School of Economics and Political Science, United Kingdom
Ken-ichi Kawarabayashi
National Institute of Informatics, Yapan
Stephan Kreutzer
Technische Universität Berlin, Germany
Patrice Ossona de Mendez
Centre d’Analyse et de Mathématiques Sociales (CNRS, UMR 8557), Paris, France
and
Charles University Prague, Czech Republic
Michał Pilipczuk
University of Warsaw, Poland
Daniel A. Quiroz
Universidad de Chile, Chile
Roman Rabinovich
Technische Universität Berlin, Germany
Sebastian Siebertz
Humboldt-Universität zu Berlin, Germany
Abstract
We study the model-checking problem for first- and monadic second-order logic on finite relational structures. The problem of verifying whether a formula of these logics is true on a given structure is considered intractable in general, but it does become tractable on interesting classes of structures, such as on classes whose Gaifman graphs have bounded treewidth. In this paper we continue this line of research and study model-checking for first- and monadic second-order logic in the presence of an ordering on the input structure. We do so in two settings: the general ordered case, where the input structures are equipped with a fixed order or successor relation, and the order invariant case, where the formulas may resort to an ordering, but their truth must be independent of the particular choice of order. In the first setting we show very strong intractability results for most interesting classes of structures. In contrast, in the order invariant case we obtain tractability results for order-invariant monadic second-order formulas on the same classes of graphs as in the unordered case. For first-order logic, we obtain tractability of successor-invariant formulas on classes whose Gaifman graphs have bounded expansion. Furthermore, we show that model-checking for order-invariant first-order formulas is tractable on coloured posets of bounded width.
{textblock}
5(12.75,14.15)
1 Introduction
Pinpointing the exact complexity of the model-checking problem for first-order and monadic second-order logic has been the object of a large body of research. The model-checking problem for a logic , denoted , is the problem of deciding for a given finite structure and a formula whether is a model of ; in symbols . We will denote restricted to a class of input structures as .
Vardi [59] proposed to distinguish the complexity of the model-checking problem into data, formula, and combined complexity, depending on whether we treat the structure (the data) as input while considering as fixed, the formula as input while considering as fixed, or considering both and as part of the input. As shown by Vardi, for any fixed formula of size the model-checking problem is solvable in polynomial time , i.e. the data complexity of is in Ptime. On the other hand, the formula complexity and combined complexity of first-order logic is Pspace-complete already on a fixed 2-element structure [5]. Evaluating a fixed formula of monadic second-order logic belongs to the polynomial time hierarchy. (And for each level and there exists an -formula whose model-checking problem is complete for that level [57].) Again, the formula complexity and combined complexity of monadic second-order logic is PSpace-complete.
A more fine-grained analysis of model-checking complexity can be achieved through the lens of parameterised complexity. In this framework, the model-checking problem for a logic is said to be fixed-parameter tractable if it can be solved in time , for some function (usually required to be computable) and a constant independent of and . The complexity class FPT of all fixed-parameter tractable problems is the parameterised analogue to Ptime as a model of efficient solvability. Hence, parameterised complexity lies somewhere between data and combined complexity, in that the formula is not taken to be fixed and yet has a different influence on the complexity than the structure. Already the model-checking problem for first-order logic is complete for the parameterised complexity class , which is conjectured and widely believed to strictly contain the class FPT. Thus it is widely believed that model-checking for first-order logic (and thus also for monadic second-order logic) is not fixed-parameter tractable.
Perhaps the most famous result on the parameterised complexity of model-checking is Courcelle’s theorem [7], which states that every algorithmic property on graphs definable in monadic second-order logic (with quantification over edge sets) can be evaluated in linear time on any class of graphs of bounded treewidth. An equivalent statement is that is fixed-parameter tractable via a linear-time algorithm for any class of bounded treewidth. This result was followed by a similar result for monadic second-order logic with only quantification over vertex sets on graph classes of bounded clique-width [9]. It was shown in [39, 40] that Courcelle’s theorem cannot be extended in full generality much beyond bounded treewidth.
For first-order logic, Seese [55] proved that first-order model-checking is fixed-parameter tractable on any class of graphs of bounded degree. This result was the starting point of a long series of papers establishing tractability results for first-order model-checking on sparse classes of graphs; see e.g. [24, 22, 11, 15, 31], and see [29] for a survey. This line of research culminated in the theorem of Grohe et al. [31] stating that for any nowhere dense class of graphs we have . Moreover, for classes of graphs that are closed under taking subgraphs, this yields a precise characterisation of tractability for first-order model-checking [15].
So far, most of the work on algorithmic meta-theorems has focused on unordered structures. Many of the results mentioned above rely on locality theorems for first-order logic, such as Gaifman’s locality theorem [25], and the applied techniques do not readily extend to ordered structures. In this paper we study the complexity of first-order model-checking on structures where an ordering is available to be used in formulas. We do so in two different settings. The first is that the input structures are equipped with a fixed order or with a fixed successor relation. (A successor relation is a directed Hamiltonian path on the universe of the structure.) We show that first-order logic on ordered structures as well as on structures with a successor relation is essentially intractable on nearly all interesting classes.
The other case we consider is an order-invariant or a successor-invariant logic. In order-invariant logics, we are allowed to use an order relation in the formulas, but whether the formula is true in a given structure must not depend on the particular choice of order.
It is easily seen that the expressive power of order-invariant is greater than that of plain , as, e.g. with an order we can formalise in that a structure has an even number of elements, a property not definable without an order. In fact, the expressive power of order-invariant is even greater than the expressive power of the extension of with counting quantifiers [28]. Over restricted classes of structures, order-invariant and have the same expressive power (see e.g. [8]). This holds true for successor-invariant as well, as an order is definable from a successor relation via .
For monadic second-order logic we are able to show that order-invariant is tractable on essentially the same classes of graphs as plain , i.e. we can increase the expressive power without restricting the tractable cases. To be precise, we show that the model-checking problem for order-invariant on classes of graphs of bounded clique-width is fixed-parameter tractable. Furthermore, combining the result of Courcelle [7] and results that one can add the edges of a successor relation to a graph of bounded treewidth without increasing its treewidth too much, we get that model-checking for order-invariant (with quantification over edge sets) on classes of graphs of bounded treewidth is fixed-parameter tractable.
Also successor- and order-invariant first-order logic have both been studied intensively in the literature, see e.g. [50, 47, 1, 53, 52, 19]. However, the difference between the expressive powers of order-invariant, successor-invariant, and plain on various classes of structures remains largely unexplored. An unpublished result of Gurevich states that the expressive power of order-invariant is stronger than that of plain (see e.g. Theorem 5.3 of [41] for a presentation of the result). Rossman [53] proved the stronger result that that successor-invariant is more expressive than plain . The construction of [53] creates dense instances though, and no separation between successor-invariant and plain is known on sparse classes, say on classes of bounded expansion. On the other hand, collapse results in this context are known only for very restricted settings. It is known that order-invariant collapses to plain on trees [1, 46] and on graphs of bounded treedepth [16]. Moreover, order-invariant is a subset of on graphs of bounded degree and on graphs of bounded treewidth [1], and, more generally, on decomposable graphs in the sense of [19].
We show that, up to a narrow gap, the model-checking results for plain carry over to successor-invariant . In particular, we show that model-checking successor-invariant is fixed-parameter tractable on any class of graphs of bounded expansion. Classes of bounded expansion generalise classes with excluded topological minors, and form a natural meta-class one step below nowhere dense classes of graphs. More precisely, we show that if is a class of structures of bounded expansion, then model-checking for successor-invariant first-order formulas on can be solved in time , where is the size of the universe of the given structure, is some function, and is the inverse Ackermann function. Note that model-checking for plain can be done in linear time on classes of bounded expansion [15], thus the running time of our algorithm is very close to the best known results for plain .
The natural way of proving tractability for successor-invariant on a specific class of graphs is to show that any given graph can be augmented by a new set of coloured edges which form a successor relation on such that falls within a class of graphs on which plain is tractable. In this way, model-checking for successor-invariant on the class is reduced to the model-checking problem for on . The main problem is how to construct the set of augmentation edges . For classes of bounded expansion, to construct such an edge set, we rely on a characterisation of bounded expansion classes by generalised colouring numbers. The definition of these graph parameters is roughly based on measuring reachability properties in a linear vertex ordering of the input graph. Any such ordering yields a very weak form of decomposition of a graph in terms of an elimination tree. The main technical contribution of this paper is that we find a way to control these elimination trees so that we can use them to define, in a first step, a set of new edges with the following properties: a) forms a spanning tree of the input graph , b) has maximum degree at most , and c) after adding all the edges of to the graph, the increase in the colouring numbers is bounded. In a second step, from the bounded degree spanning tree we will construct a successor relation as desired.
This construction, besides its use in this paper, yields a new insight into the elimination trees generated by colouring numbers. We believe it may prove useful in future research as well.
As mentioned before, the tractability of model-checking for on sparse graphs is well understood, while only few results are available for classes of dense graphs. We review some known results for model-checking on dense graph classes in Section 6 and show that a result by Gajarský et al. [26] carries over to order-invariant .
Organisation of the paper.
In Section 2 we fix the terminology and notation used throughout the paper. In Section 3 we study the case of ordered structures, i.e. structures equipped with a fixed order or successor relation. Order-invariant is considered in Section 4. We recall the notions from the theory of sparse graphs, in particular the generalised colouring numbers, and prove tractability of successor-invariant on bounded expansion classes in Section 5. Finally, in Section 6 we consider order-invariant on posets of bounded width and other dense classes of structures.
Acknowledgements.
We thank Christoph Dittmann and Viktor Engelmann for many hours of fruitful discussions.
2 Preliminaries
General notation.
By we denote the set of nonnegative integers. For a set , by we denote the set of unordered pairs of elements of , that is, -element subsets of . By we denote the inverse Ackermann function, i.e. the inverse of the function with
[TABLE]
Relational structures.
We consider finite structures over finite signatures that contain only relation symbols and constant symbols. Hence a signature is a finite set of relation symbols and constant symbols , where each relation symbol is assigned an arity (arities are part of the signature). A -structure \mathbb{A}=\bigl{(}V(\mathbb{A}),R_{1}(\mathbb{A}),\ldots,R_{k}(\mathbb{A}),c_{1}(\mathbb{A}),\ldots,c_{s}(\mathbb{A})\bigr{)} consists of a set , the universe of , for each a relation , and for each a constant . If is a -structure and is a relation symbol not in with associated arity and is an -ary relation over , we write for the -structure obtained by extending with the relation . The order of a -structure is , and its size is , which corresponds to the size of a representation of in an appropriate model of computation. We call a structure of signature , where is a binary relation symbol, a digraph, and if is symmetric and irreflexive, we call a graph. Let be a set. A successor relation on is a binary relation such that is a directed path of length . We write for a finite sequence and usually leave it to the context to determine the length of a sequence. The Gaifman-graph of a -structure is the graph with vertex set and edge set \{(u,v)\,:\,\text{u\neq vR\in\tau\bar{a}\in R(\mathbb{A})u,v\in\bar{a}}\}.
First-order logic.
We assume familiarity with first-order logic and monadic second-order logic . We write and for the set of all and formulas over signature , respectively. If is a formula of or , we write for the length (of an encoding) of . If is a sentence of or and a -structure, we write if is true in . If has free variables and is a tuple of the same length as , we write if is true in , where the free variables are interpreted by the elements of in the obvious way. We write for the relation . We call a formula over signature order-invariant if for every -structure and all linear orders over we have . Analogously, we call a formula over signature (where is a binary relation symbol) successor-invariant if for every -structure and all successor relations over we have . We write and for the set of all order-invariant and formulas, respectively, and and for the set of all successor invariant and formulas, respectively. We write and for the set of all and formulas, respectively, over a signature which contains at least the binary relation symbol , and similarly for and . For any order-invariant formula and any -structure , we denote if for some (equivalently, every) order relation on the universe of it holds that . Similarly, For a successor-invariant formula and any -structure , we denote if for some (equivalently, every) successor relation on the universe of it holds that .
Throughout the paper we study the complexity of order- and successor-invariant logics on restricted classes of structures. As usual in this type of research we focus on classes of graphs. More general structures can be reduced to this case using their Gaifman-graphs. In our analysis we will use the framework of parameterised complexity, see, e.g. [10, 13, 23]. A parameterised problem is a subset of where is a fixed finite alphabet. For an instance , is called the parameter.
Let be a class of graphs and be one of first-order or monadic second-order logic. The order-invariant model-checking problem of the logic on the class of graphs is defined as the problem
Input:
, order-invariant
Parameter:
Problem:
?
Analogously, we define the successor-invariant model-checking problem for on , where instead the formula is required to be successor-invariant.
Finally, we define the ordered model-checking problem for on as
Input:
, a linear order of and
Parameter:
Problem:
?
Likewise, we define the model-checking problem with successor for on , which gets as input a graph , a successor relation on , and a formula .
The order- and successor-invariant model-checking problems are fixed-parameter tractable, or in the complexity class FPT, if there are algorithms that correctly decide on input whether for some linear order or for some successor relation , respectively, in time , for some function in the case where is order invariant or successor invariant, respectively. We have a similar definition of FTP for and . The model-checking problem for first-order logic is complete for the parameterised complexity class , which is conjectured and widely believed to strictly contain the class FPT. Thus it is widely believed that model-checking for first-order logic (and thus also for monadic second-order logic) is not fixed-parameter tractable.
3 Model-Checking on Ordered Structures
In this section we investigate the tractability of model-checking on classes of ordered structures and on classes of structures with a successor relation. Of course, it is easy to come up with classes of ordered structures on which model-checking is fixed-parameter tractable, e.g. by taking the class of all cliques with a linear order on the vertex set. Thus we seek restrictions as weak as possible while still allowing us to show that model-checking is AW-hard.
3.1 Coloured Sets
We start by observing that on the class of ordered coloured sets (and, a forteriori, on the class of coloured sets with a successor relation), model-checking is tractable even for monadic second-order logic. This is Büchi-Elgot-Trakhtenbrot’s Theorem (cf. [23]), since coloured ordered sets are just strings. Thus model-checking for is fixed-parameter tractable on structures whose signature contains only unary relation symbols, apart from the order relation.
3.2 Vertex-Ordered Graphs
The simplest case not covered by the preceding paragraph is that of ordered graphs, i.e. -structures where both and are binary relation symbols. We show that model-checking for first-order logic is AW-hard even for very simple graphs.
Theorem 1**.**
*Let be a class of graphs. If contains all partial matchings, then is AW-hard. If contains all star forests, then is AW-hard. *
Here, a partial matching is a disjoint union of edges and isolated vertices (i.e. a graph of maximum degree 1), while a star forest is a disjoint union of stars (complete bipartite graphs with ). Note that on both these graph classes, the model-checking problem for plain is fixed-parameter tractable.
Proof.
For the first part we show how to construct in polynomial time for every graph a -structure such that can be -interpreted in . For this, let be the vertex set of ordered in an arbitrary way, and assume that has degree in . To each vertex in we associate an interval of length in , and separate the intervals by gaps of length . Thus with
[TABLE]
we associate with the interval . The edge set consists of the edges for , together with the edges if is an edge of , is the -th neighbour of in the ordering, and is the -th neighbour of . Notice that the edges are the only edges between consecutive elements, so they can be used to determine the intervals used in this construction.
For the second part we construct a structure consisting of a disjoint union of stars and a successor relation that can be used to recover the original graph using an interpretation. Again, we assume the vertex set of to be . A vertex is encoded by a path . The vertices of these paths are placed at the beginning of the successor relation in an arbitrary order. An edge is encoded by three vertices such that is a direct successor of and is a direct successor of . All these vertices are placed at the end of the successor relation. For every edge , assume that is smaller than in the successor relation. We connect, in , to and to . Again, may be recovered from using an interpretation.
As a corollary of the previous theorem we get that and are AW-hard for the class of planar graphs and the class of graphs of treewidth (forests). However, for to be AW-hard it is essential that the graphs in the class have unbounded degree. Indeed, on graph classes of bounded degree, successor-invariant model-checking is tractable.
Theorem 2**.**
*For every let be the class of graphs of maximum degree at most . Then for all , is fixed-parameter tractable. In fact, we can allow any (fixed) number of successor relations on top of and still have tractable first-order model-checking. *
Proof.
By a result of Seese [55] the model-checking problem for on graphs of bounded degree and also on all structures with Gaifman-graph of bounded degree is fixed-parameter tractable. Adding a successor relation increases the degree of the Gaifman-graph of a structure by at most two.
4 Order-Invariant MSO
In this section we consider order-invariant logics. The most expressive logic studied in the context of algorithmic meta-theorems is monadic second-order logic, the extension of first-order logic by quantification over sets of elements. With respect to graphs, there are two variants of usually considered, one, called , where we can quantify over sets of vertices, and the other, called , where we can additionally quantify over sets of edges. It was shown by Courcelle [7] that is fixed-parameter tractable on every class of graphs of bounded treewidth. Later, Courcelle et al. [9] showed that is fixed-parameter tractable on every class of graphs of bounded clique-width, a concept more general than bounded treewidth. In this section, we show that for both logics we can allow order-invariance without increase in complexity.
We first consider the case of . As shown in Theorem 5.1.1. of [51], for every graph of treewidth there is a successor relation on such that the graph obtained from by adding the edges in has treewidth at most . From the proof one can easily derive an algorithm that takes as input a a graph and a tree decomposition of of width and outputs a successor relation as desired in polynomial time. We can use the algorithm of Bodlaender [2] to compute an optimal tree decomposition in time first, and then compute the desired successor relation. We also refer to [43] and [6] for proofs that for every graph of treewidth there is a successor relation on such that the graph obtained from by adding the edges in has treewidth at most . In combination with Courcelle’s theorem, this implies the following result.
Theorem 3**.**
*For any class of bounded treewidth, is fixed-parameter tractable. *
In fact, is fixed-parameter tractable with parameter , where is the treewidth of a graph . We prove next that also for and clique-width we can allow order-invariance without loss of tractability.
Theorem 4**.**
*For any class of graphs of bounded clique-width, is fixed-parameter tractable. *
We first review the definition of clique-width. For the rest of this section we fix a relational signature in which every relation symbol has arity at most .
Definition 1** (-clique-expression of width ).**
Let be fixed. A -clique-expression of width is a pair , where is a directed rooted tree in which all edges are directed away from the root and
[TABLE]
such that for all we have: if , then is a leaf of ; if , then has exactly two successors; and in all other cases has exactly one successor.
Definition 2**.**
Let be a -clique-expression of width . With every we associate a -structure in which vertices are coloured by colours as follows.
- •
If is a leaf, then consists of one element coloured by .
- •
If and has successors , then is the disjoint union .
- •
If and is the successor of , then is the structure obtained from by adding to the relation all pairs such that has colour and has colour .
- •
If and is the successor of , then is the structure obtained from by changing the colour of all vertices which have colour in to colour in .
The -structure generated by is the structure , where is the root of , from which we remove all colours . Finally, the clique-width of a -structure is the minimal width of a clique-expression generating .
Combining results from [34] and [48] yields the following well-known result.
Theorem 5**.**
*There is a computable function and an algorithm which, given a graph of clique-width at most as input, computes a clique-expression of width at most in time . *
Combining this theorem with results of Courcelle et al. [9] yields the following (also well-known) result.
Theorem 6**.**
*For any class of graphs of bounded clique-width, is fixed-parameter tractable. *
In fact, the result applies to any -structure of bounded clique-width, provided that a clique-expression generating the structure (whose width is bounded by a computable function of the clique-width of the structure) is given or computable in polynomial time.
The next lemma is the main technical ingredient for the proof of Theorem 4 above.
Lemma 1**.**
*There is an algorithm which, on input a graph of clique-width at most , computes a linear order on and a clique-expression of width at most generating the structure . *
Proof.
Let and be given. Using Theorem 5 we first compute an -clique-expression of width at most generating . Let be the root of . For every node we fix an ordering of its successors. Let be the partial order on induced by this ordering.
Let be a node and let be the first node on the path from to with , if it exists. Let be the successors of with . We call a left node if , and a right node otherwise. If there is no node labelled strictly above , then we call a left node as well.
For every let be the subtree of with root , and let be the restriction of to the subtree . We recursively define a transformation on the subtrees of defined as follows. Intuitively, we produce a new clique-expression over the signature using colours . Essentially, the new clique-expression will generate the same graph as , but so that if is a node in and generates the graph , then contains a node generating an ordered version of so that if has colour , then, in , has colour if is a left node and if is a right node. Hence, whenever in we take the disjoint union of and and , then we can define the ordering on by adding all edges from nodes in to , i.e. all edges from vertices coloured to for all pairs .
Formally, the transformation is defined as follows.
- •
If is a leaf, then , where consists only of and if is a left node, and if is a right node.
- •
Suppose and let be the successor of . Then , where is a tree defined as follows. Let and let be the root of . Then is obtained from by adding a new root , a new vertex , and new edges and . We define , , and for .
- •
Suppose and let be the successor of . Then , where is a tree defined as follows. Let and let be the root of . Then is obtained from by adding a path of length and making a successor of . We define , , , , and for .
- •
Finally, suppose and let be the successors of such that . Then , where is a tree defined as follows. For , let and let be the root of . consists of the union of and , and the additional vertices , , , , and . We add the edges for , the edges for , , and the edges for , and finally the edges , , and for . For every node we define , . Furthermore, we define and for . Finally, if is a left node, then we define for , and if is a right node, then we define for .
Now, it is easily seen that generates an -structure where is the graph generated by and is a linear order on . The width of is twice the width of , and hence at most .
We are now ready to prove Theorem 4.
Proof (Proof of Theorem 4).
Let be a class of graphs of clique-width at most . On input and , we apply Lemma 1 to obtain a clique-expression of width generating an ordered copy of in time , for some computable function . We can now apply Theorem 6 to decide whether in time , where is a computable function and a polynomial. As is order-invariant, if , then for any linear order on . Hence, if we can return “yes” and otherwise reject the input. This concludes the proof.
It is worth pointing out the following feature of the model-checking algorithms established in Theorems 3 and 4. Instead of designing new model-checking algorithms, we reduce the verification of order-invariant on classes of small treewidth or clique-width to the standard model-checking algorithms for on classes of (slightly larger) treewidth and clique-width, respectively. The advantage of this approach is that we can reuse existing results on on such classes of graphs. For instance, in [37] the authors report on a practical implementation of Courcelle’s theorem, i.e. on the implementation of a model-checker for on graph classes of bounded treewidth, and obtain astonishing performance results in practical tests. Our technique allows us to reuse this implementation so that with minimal effort it is possible to implement our algorithm on top of the work in [37].
Furthermore, in [22] it is shown that on graph classes of bounded treewidth, the set of all satisfying assignments of a given formula with free variables in a graph can be computed in time linear in the size of the output and the size of . Again we can use the same algorithm to obtain the same result for order-invariant .
5 Successor-invariant FO on classes of bounded expansion
Classes of bounded expansion are classes of uniformly sparse graphs that have very good structural and algorithmic properties. Most notably, these classes admit efficient first-order model-checking, as shown by Dvořák et al. [15]. In this section we are going to lift this result to successor-invariant formulas. Let us give the required definitions first.
Shallow minors and bounded expansion.
A graph is a minor of , written , if there are pairwise disjoint connected subgraphs of , called branch sets, such that whenever , then there are and with . We call the family a minor model of in . A graph is a depth- minor of , denoted , if there is a minor model of in such that each subgraph has radius at most . For a graph and , we write for the maximum edge density of a graph .
Definition 3**.**
A class of graphs has bounded expansion if there is a function such that for all and all .
Let be a finite and purely relational signature and let be a class of -structures. We say that has bounded expansion if the class of the Gaifman graphs of the structures from has bounded expansion.
Generalised colouring numbers.
We will mainly rely on an alternative characterisation of bounded expansion classes via generalised colouring numbers. Let us fix a graph . By we denote the set of all linear orderings of . For , we write if is smaller than in , and if or .
For , we say that a vertex is strongly -reachable from a vertex with respect to if and there is a path of length at most that starts in , ends in , and all whose internal vertices are larger than in . By we denote the set of vertices that are strongly -reachable from with respect to . Note that for any vertex .
We define the -colouring number of with respect to as
[TABLE]
and the -colouring number of (sometimes called strong -colouring number) as
[TABLE]
For and ordering , the -admissibility of a vertex with respect to is defined as the maximum size of a family of paths that satisfies the following two properties:
- •
each path has length at most , starts in , and is either the trivial length-zero path or ends in a vertex and all its internal vertices are larger than in ;
- •
the paths in are pairwise vertex-disjoint, apart from sharing the start vertex .
The -admissibility of with respect to is defined similarly to the -colouring number:
[TABLE]
and the -admissibility of is given by
[TABLE]
The -colouring numbers were introduced by Kierstead and Yang [36], while -admissibility was first studied by Dvořák [14]. It was shown that those parameters are related as follows.
Lemma 2** (Dvořák [14]).**
For any graph , and vertex ordering , we have
[TABLE]
(Note that in Dvořák’s work, the reachability sets do not include the starting vertex, hence the above inequality is stated slightly differently in [14].)
As proved by Zhu [60], the generalised colouring numbers are tightly related to densities of low-depth minors, and hence they can be used to characterise classes of bounded expansion.
Theorem 7** (Zhu [60]).**
*A class of graphs has bounded expansion if and only if there is a function such that for all and all . *
We need to be a bit more precise and use the following lemma.
Lemma 3** (Grohe et al. [30]).**
*For any graph and we have . *
As shown by Dvořák [14], on classes of bounded expansion one can compute in linear fixed-parameter time, parameterised by . More precisely, we have the following.
Theorem 8** (Dvořák [14]).**
*Let be a class of bounded expansion. Then there is an algorithm that, given a graph and , computes a vertex ordering with in time , for some computable function . *
We remark that Dvořák states the result in [14] as the existence of a linear-time algorithm for each fixed value of . However, an inspection of the proof reveals that it is actually a single fixed-parameter algorithm that can take as input. To the best of our knowledge, a similar result for computing is not known, but by Lemma 2 we can use admissibility to obtain an approximation of the -colouring number of a given graph from a class of bounded expansion.
Bounded expansion classes are very robust under local changes, e.g. under taking lexicographic products, as defined below.
Definition 4**.**
Let and be graphs. The lexicographic product of and is the graph with vertex set and edge set
[TABLE]
The following lemma shows that taking lexicographic products preserves the edge density of shallow minors. This was first proved in [44]; the following improved bounds are given in [32].
Lemma 4** (**Har-Peled and Quanrud
[32]).
*For any graph and we have . *
Bounded expansion classes are also stable under taking shallow minors, as expressed in the following lemma.
Lemma 5** (see Nešetřil and Ossona de Mendez [45, Proposition 4.1]).**
*If and are graphs and such that is a depth- minor of and is a depth- minor of , then is a depth--minor of . *
The following lemma is folklore, we provide a proof for completeness.
Lemma 6**.**
*For any graph and we have . *
Proof.
Set and let be a linear order of for which . Next let , say with a minor model . We will show that .
For each let be the -minimal vertex in . We define a linear order on by setting if . Observe that since each branch set has radius at most and and are minimum in their respective branch sets, if , there exists a vertex in which is strongly -reachable from . Hence, is -degenerate and can have at most edges.
We are going to prove the following theorem.
Theorem 9**.**
*Let be a finite and purely relational signature and let be a class of -structures of bounded expansion. Then there exists an algorithm that, given a finite -structure and a successor-invariant formula , verifies whether in time , where is a function and is the size of the universe of . *
In the language of parameterised complexity, Theorem 9 essentially states that the model-checking problem for successor-invariant first-order formulas is fixed-parameter tractable on classes of finite structures whose underlying Gaifman graph belongs to a fixed class of bounded expansion. There is a minor caveat, though. The formal definition of fixed-parameter tractability, see e.g. [23], requires the function to be computable, which is not asserted by Theorem 9. In order to have this property, it suffices to assume that the class is effectively of bounded expansion. In the characterisation of Theorem 7, this means that there exist a computable function such that for each . See [31] for a similar discussion regarding model-checking first-order logic on (effectively) nowhere dense classes of graphs.
In principle, our approach follows that of the earlier results on successor-invariant model-checking. As is successor-invariant, to verify whether , we may compute an arbitrary successor relation on , and verify whether . Of course, we will try to compute a successor relation so that adding it to preserves the structural properties as much as possible, so that model-checking on can be done efficiently.
Our construction of such a structure preserving successor relation is based on the above described characterisation of bounded expansion classes by the generalised colouring numbers. As a first step, we show how to define a set of new edges with the following properties:
- •
forms a tree on the vertex set of the input graph ,
- •
has maximum degree at most , and
- •
after adding all the edges of to , the colouring numbers are still bounded.
In a second step, we construct from the bounded degree spanning tree a successor relation on , again ensuring that the relevant parameters remain bounded.
5.1 Constructing a low-degree spanning tree
In this section we prove the following theorem.
Theorem 10**.**
There exists an algorithm that, given a graph , , and ordering of , computes a set of unordered pairs such that the graph is a tree of maximum degree at most and
[TABLE]
*where is the graph . The running time of the algorithm is , where and . *
The main step towards this goal is the corresponding statement for connected graphs, as expressed in the following lemma.
Lemma 7**.**
There exists an algorithm that, given a connected graph , , and ordering of , computes a set of unordered pairs such that the graph is a tree of maximum degree at most and
[TABLE]
*The running time of the algorithm is , where and . *
We first show that Theorem 10 follows easily from Lemma 7.
Proof (Proof of Theorem 10, assuming
Lemma 7).
Let be a (possibly disconnected) graph, and let be its connected components. For , let be the ordering obtained by restricting to . Obviously .
Apply the algorithm of Lemma 7 to and , obtaining a set of unordered pairs such that is a tree of maximum degree at most and
[TABLE]
For , select a vertex of with degree at most in ; since is a tree, such a vertex exists. Define
[TABLE]
Obviously we have that is a tree. Observe that it has maximum degree at most . This is because each vertex had degree at most in its corresponding tree , and hence its degree can grow to at most after adding edges and . By Lemma 7, the construction of each takes time , where . It follows that the construction of takes time .
It remains to argue that . Take any vertex of , say , and let be a set of paths of length at most that start in , are pairwise vertex-disjoint (apart from ), and end in vertices smaller than in , while internally traversing only vertices larger than in . Observe that at most two of the paths from can use any of the edges from the set , since any such path has to use either or . The remaining paths are entirely contained in , and hence their number is bounded by . The theorem follows.
In the remainder of this section we focus on Lemma 7.
Proof (Proof of Lemma 7).
We begin our proof by showing how to compute the set . This will be a two step process, starting with an elimination tree. For a connected graph and an ordering of , we define the (rooted) elimination tree of imposed by (cf. [3, 54]) as follows. If , then the rooted elimination tree is just the tree on the single vertex . Otherwise, the root of is the vertex that is the smallest with respect to the ordering in . For each connected component of we construct a rooted elimination tree , where denotes the restriction of to the vertex set of . These rooted elimination trees are attached below as subtrees by making their roots into children of . Thus, the vertex set of the elimination tree is always equal to the vertex set of . See Figure 2 for an illustration. The solid black lines are the edges of ; the dashed blue lines are the edges of . The ordering is given by the numbers written in the vertices.
Let be the rooted elimination tree of imposed by . For a vertex , by we denote the subgraph of induced by all descendants of in , including . The following properties follow easily from the construction of a rooted elimination tree.
Claim 1**.**
The following assertions hold.
For each , the subgraph is connected. 2. 2.
Whenever a vertex is an ancestor of a vertex in , we have . 3. 3.
For each with , is an ancestor of in . 4. 4.
For each and each child of in , has at least one neighbour in .
Proof.
Assertions (1) and (2) follow immediately from the construction of . For assertion (3), suppose that and are not bound by the ancestor-descendant relation in , and let be their lowest common ancestor in . Then and would be in different connected components of , hence could not be an edge; a contradiction. It follows that and are bound by the ancestor-descendant relation, implying that is an ancestor of , due to and assertion (2). Finally, for assertion (4), recall that by assertion (1) we have that is connected, whereas by construction is one of the connected components of . Hence, in there is no edge between and any of the other connected components of . If there was no edge between and as well, then there would be no edge between and , contradicting the connectivity of .
We now define a set of edges as follows. For every vertex of and every child of in , select an arbitrary neighbour of in ; such a neighbour exists by Claim 1 (4). Then let be the set of all edges , for ranging over the children of in . Define
[TABLE]
Let be the graph spanned by all the edges in , that is, . In Figure 2, the edges of are represented by the dotted red lines.
Claim 2**.**
*The graph is a tree. *
Proof.
Observe that for each , the number of edges in is equal to the number of children of in . Since every vertex of has exactly one parent in , apart from the root of , we infer that
[TABLE]
Therefore, since is the edge set of , to prove that is a tree it suffices to prove that is connected. To this end, we prove by a bottom-up induction on that for each , the subgraph U_{u}=\bigl{(}V(G_{u}),B\cap\binom{V(G_{u})}{2}\bigr{)} is connected. Note that for the root of this claim is equivalent to being connected.
Take any , and suppose by induction that for each child of in , the subgraph is connected. Observe that can be constructed by taking the vertex and, for each child of in , adding the connected subgraph and connecting to via the edge . Thus, constructed in this manner is also connected, as claimed.
Next, we verify that can be computed within the claimed running time. Note that we do not need to compute , as we use it only in the analysis. We remark that this is the only place in the algorithm where the running time is not linear.
Claim 3**.**
*The tree can be computed in time . *
Proof.
We use the classic Union & Find data structure on the set . Recall that in this data structure, at each moment we maintain a partition of into a number of equivalence classes, each with a prescribed representative, where initially each vertex is in its own class. The operations are a) for a given , find the representative of the class to which belongs, and b) merge two equivalence classes into one. Tarjan [58] gave an implementation of this data structure where both operations run in amortised time , where is the total number of operations performed.
Having initialised the data structure, we process the vertex ordering from the smallest end, starting with an empty prefix. For an already processed prefix of , the maintained classes within will represent the partition of into connected components, while every vertex outside will still be in its own equivalence class. Let us consider one step, when we process a vertex , thus moving from a prefix to the prefix . Iterate through all the neighbours of , and for each neighbour of such that , verify whether the equivalence classes of and are different. If this is the case, merge these classes and add the edge to . A straightforward induction shows that the claimed invariant holds. Moreover, when processing we add exactly the edges of to , hence at the end we obtain the set and the tree .
For the running time analysis, observe that in total we perform operations on the data structure, thus the running time is . We remark that we assume that the ordering is given as a bijection between and numbers , thus for two vertices we can check in constant time whether .
By Lemma 2 we have that is a spanning tree of . However its maximum degree may be too large. The idea is to use to construct a new tree with maximum degree at most (on the same vertex set ). The way we constructed will enable us to argue that adding the edges of to the graph does not change the generalised colouring numbers too much.
Give the same root as the elimination tree . From now on we treat as a rooted tree, which imposes parent-child and ancestor-descendant relations in as well. Note that the parent-child and ancestor-descendant relations in and in may be completely different. For instance, consider vertices and in the example from Figure 2: is a child of in , and an ancestor of in .
For every , let be an enumeration of the children of in , such that if . Let , and define
[TABLE]
See Figure 3 for an illustration.
Claim 4**.**
*The graph is a tree with maximum degree at most . *
Proof.
Observe that for each we have that is equal to the number of children of in . Every vertex of apart from the root of has exactly one parent in , hence
[TABLE]
Therefore, to prove that is a tree, it suffices to argue that it is connected. This, however, follows immediately from the fact that is connected, since for each edge in there is a path in that connects the same pair of vertices.
Finally, it is easy to see that each vertex is incident to at most edges of : at most one leading to a child of in , and at most belonging to , where is the parent of in .
Observe that once the tree is constructed, it is straightforward to construct in time . Thus, it remains to check that adding to does not change the generalised colouring numbers too much.
Take any vertex and examine its children in . We partition them as follows. Let be the set of those children of in that are its ancestors in , and let be the set of those children of in that are its descendants in . By the construction of and by Claim 1.3, each child of in is either its ancestor or descendant in . By Claim 1.2, this is equivalent to saying that , respectively , comprise the children of in that are smaller, respectively larger, than in . Note that by the construction of , the vertices of lie in pairwise different subtrees rooted at the children of in , thus is the lowest common ancestor in of every pair of vertices from . On the other hand, all vertices of are ancestors of in , thus every pair of them is bound by the ancestor-descendant relation in .
Claim 5**.**
*The graph union satisfies . *
Proof.
Write . Let be the set of edges from that were not already present in . If an edge belongs also to for some , then we know that cannot be an endpoint of . This is because edges joining a vertex with its children in were already present in . We say that the vertex is the origin of an edge , and denote it by . Observe that is adjacent to both endpoints of in by construction. Also observe that if the endpoints of belong to , then they are both ancestors of in , and thus are both smaller than in . Otherwise, if the endpoints of belong to , then they are not bound by the ancestor-descendant relation in and is their lowest common ancestor in .
To give an upper bound on , let us fix a vertex and a family of paths in such that
- •
each path in has length at most , starts in , ends in a vertex smaller than in , and all its internal vertices are larger than in ;
- •
the paths in are pairwise vertex-disjoint, apart from the starting vertex .
For each path , we define a walk in as follows. For every edge from traversed on , replace the usage of this edge on by the following detour of length : . Observe that is a walk in the graph , it starts in , ends in the same vertex as , and has length at most . Next, we define to be the first vertex on (that is, the closest to on ) that does not belong to . Since the endpoint of that is not does not belong to , such a vertex exists. Finally, let be the prefix of from to the first visit of on (from the side of ). Observe that the predecessor of on belongs to and is a neighbour of in , hence has to be a strict ancestor of in . We find that is a walk of length at most in , it starts in , ends in , and all its internal vertices belong to , so in particular they are not smaller than in . This means that certifies that .
Since \bigl{|}\mathrm{SReach}_{2r}[G,L,u]\bigr{|}\leqslant\mathrm{col}_{2r}(G,L), in order to prove the bound on , it suffices to prove the following claim: For each vertex that is a strict ancestor of in , there can be at most two paths for which . To this end, we fix a vertex that is a strict ancestor of in and proceed by a case distinction on how a path with may behave.
Suppose first that is the endpoint of other than , equivalently the endpoint of other than . (For example, , , and , in figures 2 and 3.) However, the paths of are pairwise vertex-disjoint, apart from the starting vertex , hence there can be at most one path from for which is an endpoint. Thus, this case contributes at most one path for which .
Next suppose that is an internal vertex of the walk ; in particular, it is not the endpoint of other than . (For example, , , and , in figures 2 and 3.) Since the only vertex traversed by that is smaller than in is this other endpoint of , and is smaller than in due to being its strict ancestor in , it follows that each visit of on is due to having for some edge traversed on . Select to be such an edge corresponding to the first visit of on . Let , where lies closer to on than . (That is, in our figures, and .) Since was chosen as the first vertex on that does not belong to , we have .
Since , either or . Note that the second possibility cannot happen, because then would be a descendant of in , hence would belong to , due to ; a contradiction. We infer that .
Recall that, by construction, contains at most one vertex from each subtree of rooted at a child of . Since is a strict ancestor of in , we infer that has to be the unique vertex of that belongs to . In the construction of , however, we added only at most two edges of incident to this unique vertex: at most one to its predecessor on the enumeration of the children of , and at most one to its successor. Since paths from are pairwise vertex-disjoint in , apart from the starting vertex , only at most one path from can use these two edges. We can have for this path only. Thus, this case contributes at most one path for which , completing the proof of the claim.
We conclude the proof by summarising the algorithm: first construct the tree , and then construct the tree . As argued, these steps take time and , respectively. By claims 4 and 5, satisfies the required properties.
5.2 Constructing a successor relation
The preceding section provides us with a spanning tree of maximum degree at most . We now show how this can be used to obtain a successor relation from this spanning tree.
We give two constructions: One which constructs an actual successor relation, at the cost of possibly adding further edges. The added edges may increase the admissibility, but in a way that preserves bounded expansion. We also give a second construction that does not add additional edges and hence preserves also other structural properties. Such a construction may thus be potentially used for model-checking on other graph classes. This construction shows how a successor relation may be first-order interpreted in a graph with bounded-degree spanning tree, without adding any edges.
Adding a successor relation.
Theorem 11**.**
There exists an algorithm that, given a graph , , the edge set of a tree of maximum degree at most , and an ordering of , computes a set of ordered pairs such that is a successor relation on and
[TABLE]
*for an appropriately defined function where . The running time of the algorithm is , where and . *
As observed e.g. in [35, 56], the cube of every connected graph contains a Hamiltonian path. (The cube of a graph is the graph on the same vertex set as and in which two vertices are connected if their distance in is at most .) Furthermore, such a Hamiltonian path can be computed in linear time in the size of the original graph [42]. The set of edges whose existence is stated in Theorem 11 will simply be the Hamiltonian path computed in the cube of the spanning tree that we constructed above. It remains to prove the claimed bound on the -admissibility of the new graph.
Proof (Proof of Theorem 11).
Observe that we can find , where is as described above, as a depth- minor of . This is a simple consequence of the fact that has maximum degree . Now we have
[TABLE]
Finally, by Lemma 3 we have , which gives us \mathrm{adm}_{r}(G+S)\leqslant g\bigl{(}r,\mathrm{col}_{40r+1}(G+F)\bigr{)}, for an appropriately defined function . We have by Lemma 2, which leads to the stated result.
Interpreting a successor relation.
We show how in a graph with a spanning tree of degree , a successor relation can be interpreted after suitably colouring vertices and edges, but without adding further edges. We first notice that existence of such a spanning tree guarantees the existence of a -walk, i.e. a walk through the graph that visits each vertex at least once and at most three times. The following lemma allows us to interpret a successor relation from a -walk in first-order logic, for arbitrary . For a natural number , let be the set .
Lemma 8**.**
Let be a finite relational signature, a finite -structure, and a -walk through the Gaifman graph of , where . Then there is a finite relational signature and a first-order formula , both depending only on , and a -expansion of which can be computed from and in polynomial time, such that
- •
the Gaifman-graphs of and are the same;
- •
* defines a successor relation on .*
Proof.
We define a function which counts how many times we have visited a vertex on the walk before, by
[TABLE]
Furthermore, let count how many times we visit a vertex:
[TABLE]
To simplify notation, if we write for .
We encode the -walk by binary relations with , in such a way that if and only if there is some such that
- •
and , and
- •
and .
That is, after visiting for the -th time, the walk proceeds to , visiting it for the -th time. Note that if , we can immediately define a successor relation by
[TABLE]
If , we show how to interpret a -walk in first-order logic, given a -walk encoded by as above. By daisy-chaining these interpretations we end up with a -walk (i.e. a Hamiltonian path). Plugging in the interpretation of this Hamiltonian path into defined above gives the formulas .
In order to get from a -walk to a -walk, we look at all vertices that are visited times, and “jump” over these vertices, either when they are visited for the -th or for the -th time. Jumping over a vertex can be done in first-order logic, but we must be careful to choose the vertices for jumping in such a way that we never jump over an unbounded number of vertices in a row, as this is not possible in first-order logic. We encode the information on whether to jump when visiting for the -th or the -th time in a new unary predicate .
To be precise, let \varphi_{\text{k-times}}(x) be a formula which states that is visited times:
[TABLE]
For those which are visited -times, we agree to jump over them when they are visited for the -th time if , and when they are visited for the -th time otherwise. Thus, if , and , we want to remove the -th step. However, it may be the case that is also visited times and needs to be jumped over. We define first-order formulas which carry out a bounded number of such jumps as follows.
- •
For , the formula holds if we jump over when visiting it for the -th time:
[TABLE]
- •
For and , the formula holds if, when applying at most consecutive jumps on entering for the -th time, we end up in node which is visited for the -th time in the (original) walk. Specifically:
[TABLE]
Here, is true if the indices and are the same:
[TABLE]
- •
We will show below how to choose the predicate so that we never need to take more than two consecutive jumps. Thus, we can interpret a -walk using, for , the formulas
[TABLE]
For we set
[TABLE]
Next, for we set
[TABLE]
and finally we define
[TABLE]
To define the predicate , let be the set of indices for which and . We obtain a perfect matching on by matching and if and only if (cf. Figure 4 (a)). We define a subset with the intended meaning that if , we jump over the -th step of . The set will satisfy the following two conditions:
- •
every vertex with is jumped over exactly once, i.e.
[TABLE]
- •
we never jump more than twice in a row, i.e. if , then .
We partition the set into intervals of size , setting
[TABLE]
with the last set being a singleton if is odd. Then the matching defines a multigraph without loops on , and the degree of is at most 2. We direct the edges of , viewed as edges in the multigraph , in such a way that every has at most one incoming edge. The edges incident with correspond to the elements of , and we put into if and only if the edge corresponding to is directed towards (cf. Figure 4 (b)). For every k=1,\ldots,\bigl{\lfloor}\frac{1}{2}(n-1)\bigr{\rfloor} at most one of and is in , and therefore satisfies the above requirements.
The definition of is now straightforward:
[TABLE]
In summary, we end up with
[TABLE]
and it is clear that our construction can be carried out in polynomial time.
5.3 Proof of Theorem 9
Let us finally derive the main theorem, Theorem 9. We first need to draw upon the literature on model-checking first-order logic on classes of bounded expansion. The following statement encapsulates the model-checking results of Dvořák et al. [15] and of Grohe and Kreutzer [29]. We also refer to the new expositions given in [27, 49].
Theorem 12**.**
*Let be a finite and purely relational signature. Then for every formula there exists a nonnegative integer , computable from , such that the following holds. Given a -structure , it can be verified whether in time f\bigl{(}|\varphi|,\mathrm{adm}_{r(\varphi)}(G(\mathbb{A}))\bigr{)}\cdot n, where is the size of the universe of and is a computable function. *
Observe that if is drawn from a fixed class of bounded expansion , then is a parameter depending only on , hence we recover fixed-parameter tractability of model-checking for on any class of bounded expansion, parameterised by the length of the formula. Theorem 12 is stronger than this latter statement in that it says that the input structure does not need to be drawn from a fixed class of bounded expansion, where the colouring number is bounded in terms of the radius for all values of , but it suffices to have a bound on the colouring numbers up to some radius , which depends only on the formula . We need this strengthening in our algorithm for the following reason. When adding a low-degree spanning tree to the Gaifman graph, we are not able to control all the colouring numbers at once, but only for some particular value of the radius. Theorem 12 ensures that this is sufficient for the model-checking problem to remain tractable.
We now sketch how Theorem 12 may be derived from the works of Dvořák et al. [15] and of Grohe and Kreutzer [29]. We prefer to work with the algorithm of Grohe and Kreutzer [29], because we find it conceptually simpler. For a given quantifier rank and an nonnegative integer , the algorithm computes the set of all types realised by -tuples in the input structure : for a given -tuple of elements , its type is the set of all formulas with free variables and quantifier rank at most for which holds. Note that for this corresponds to the set of sentences of quantifier rank at most that hold in the structure, from which the answer to the model-checking problem can be directly read; whereas for we consider quantifier-free formulas with free variables. Essentially, is computed explicitly, and then one inductively computes based on . The above description is, however, a bit too simplified, as each step of the inductive computation introduces new relations to the structure, but does not change its Gaifman graph. We will explain this later.
When implementing the above strategy, the assumption that the structure is drawn from a class of bounded expansion is used via treedepth- colourings, a colouring notion functionally equivalent to the generalised colouring numbers. More precisely, a treedepth- colouring of a graph is a colouring , where is a set of colours, such that for any subset of colours, , the vertices with colours from induce a subgraph of treedepth at most . The treedepth- chromatic number of a graph , denoted , is the smallest number of colours needed for a treedepth- colouring of . As proved by Zhu [60], the treedepth- chromatic numbers are bounded in terms of -colouring numbers as follows.
Theorem 13** (Zhu [60]).**
For any graph and we have
[TABLE]
Moreover, an appropriate treedepth- colouring can be constructed in polynomial time from an ordering , certifying an upper bound on .
The computation of both and from is done by rewriting every possible type as a purely existential formula. Each rewriting step, however, enriches the signature by unary relations corresponding to colours of some treedepth- colouring , as well as binary relations representing edges of appropriate treedepth decompositions certifying that is correct. However, the binary relations are added in a way that the Gaifman graph of the structure remains intact. For us it is important that in all the steps, the parameter used for the definition of depends only on and in a computable manner. Thus, by Theorem 13, to ensure that uses a bounded number of colours, we only need to ensure the boundedness of for some computable function . By taking to be the quantifier rank of the input formula, the statement of Theorem 12 follows.
We can now combine all the ingredients and show how our main result follows from Theorem 11.
Proof (Proof of Theorem 9).
Given a successor-invariant formula , we first compute the integer whose existence and computability is stated in Theorem 12. Given the structure , we now use the algorithm of Theorem 8 to compute an order of the vertex set of the Gaifman graph of , which satisfies for some constant . Such constant exists by the assumption that is from a class of bounded expansion. We use the algorithm of Theorem 10 to compute a set of unordered pairs such that the graph is a tree of maximum degree at most and
[TABLE]
By Lemma 2 we find . This means that for . Now, using the algorithm of Theorem 11 we compute a successor relation such that
[TABLE]
where is the function from Theorem 11. Finally, we apply the algorithm of Theorem 12 to decide whether in time f\bigl{(}|\varphi|,\mathrm{adm}_{r}(G(\mathbb{A})+S)\bigr{)}\cdot n. Since is drawn from a fixed class of bounded expansion , is a parameter depending only on . This finishes the proof of the theorem.
6 Dense Graphs
While model-checking for first-order logic has been studied rather thoroughly for sparse graph classes, few results are known for dense graphs.
- •
On classes of graphs with bounded clique-width (or, equivalently, bounded rank-width; cf. [48]), model-checking even for monadic second-order logic has been shown to be fixed-parameter tractable by Courcelle et al. [9].
- •
More recently, model-checking on coloured posets of bounded width has been shown to be in fixed-parameter tractable for existential by Bova et al. [4] and for all of by Gajarský et al. [26].
Both of these results extend to order-invariant , and therefore also to successor-invariant . For bounded clique-width, this has already been shown in Section 4 . For posets of bounded width we give a proof here. We first review the necessary definitions.
Definition 5**.**
A partially ordered set (poset) is a set with a reflexive, transitive and antisymmetric binary relation . A chain is a totally ordered subset, i.e. for all one of and holds. An antichain is a set such that if for , then . The width of is the maximal size of an antichain .
A coloured poset is a poset together with a function mapping to some set of colours.
By we denote the length of a suitable encoding of .
We will need Dilworth’s Theorem, which relates the width of a poset to the minimum number of chains needed to cover the poset.
Theorem 14** (Dilworth’s Theorem).**
*Let be a poset. Then the width of is equal to the minimum number of disjoint chains needed to cover , i.e. such that . *
A proof can be found e.g. in [12, Sec. 2.5]. Moreover, by a result of Felsner et al. [21], both the width and a set of chains covering can be computed from in time .
With this, we are ready to prove the following.
Theorem 15**.**
*There is an algorithm which, on input a coloured poset with colouring and an order-invariant first-order formula , checks whether in time where is the width of . *
Proof.
Using the algorithm of [21], we compute a chain cover of . To obtain a linear order on , we just need to arrange the chains in a suitable order, which can be done by colouring the vertices with colours via
[TABLE]
Then
[TABLE]
defines a linear order on with colouring . After substituting for in , we may apply the algorithm of Gajarský et al. [26] to check whether .
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Michael Benedikt and Luc Segoufin. Towards a characterization of order-invariant queries over tame graphs. J. Symbolic Logic , 74:168–186, 2009.
- 2[2] Hans L Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM Journal on computing , 25(6):1305–1317, 1996.
- 3[3] Hans L. Bodlaender, Jitender S. Deogun, Klaus Jansen, Ton Kloks, Dieter Kratsch, Haiko Müller, and Zsolt Tuza. Rankings of graphs. SIAM J. Discrete Math. , 11:168–181, 1998.
- 4[4] Simone Bova, Robert Ganian, and Stefan Szeider. Model checking existential logic on partially ordered sets. ACM Trans. Comput. Log. , 17:10:1–10:35, 2015.
- 5[5] Ashok K. Chandra and Philip M. Merlin. Optimal implementation of conjunctive queries in relational data bases. In 9th Annual ACM Symposium on Theory of Computing (STOC 1977) , pages 77–90. ACM, 1977.
- 6[6] Yijia Chen and Jörg Flum. On the ordered conjecture. In 27th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS 2012) , pages 225–234. IEEE Computer Soc., 2012.
- 7[7] Bruno Courcelle. Graph rewriting: an algebraic and logic approach. In Jan van Leeuwen, editor, Handbook of Theoretical Computer Science, Vol. B , pages 194–242. Elsevier, 1990.
- 8[8] Bruno Courcelle. The monadic second-order logic of graphs. X. Linear orderings. Theor. Comput. Sci. , 160:87–143, 1996.
