Order Invariance on Decomposable Structures

Order Invariance on Decomposable Structures

Michael Elberfeld    Marlin Frickenschmidt    Martin Grohe
rwth Aachen University
Aachen, Germany
July 22, 2019

Order-invariant formulas access an ordering on a structure’s universe, but the model relation is independent of the used ordering. They are frequently used for logic-based approaches in computer science. Order-invariant formulas capture unordered problems of complexity classes and they model the independence of the answer to a database query from low-level aspects of databases. We study the expressive power of order-invariant monadic second-order (mso) and first-order (fo) logic on restricted classes of structures that admit certain forms of tree decompositions (not necessarily of bounded width).

While order-invariant mso is more expressive than mso and, even, cmso (mso with modulo-counting predicates) in general, we show that order-invariant mso and cmso are equally expressive on graphs of bounded tree width and on planar graphs. This extends an earlier result for trees due to Courcelle. Moreover, we show that all properties definable in order-invariant fo are also definable in mso on these classes. These results are applications of a theorem that shows how to lift up definability results for order-invariant logics from the bags of a graph’s tree decomposition to the graph itself.

Keywords: finite model theory, first-order logic, monadic second-order logic, order-invariant logic, modulo-counting logic, bounded tree width, planarity


label=– \setenumeratefont=

1 Introduction

A formula is order-invariant if it has access to an additional total ordering on the universe of a given structure, but its answer is invariant with respect to the given order. The concept of order invariance is used to formalize the observation that logical structures are often encoded in a form that implicitly depends on a linear order of the elements of the structure; think of the adjacency-matrix representation of a graph. Yet the properties of structures we are interested in should not depend on the encoding and hence the implicit linear order, but just on the abstract structure. Thus, we use formulas that access orderings, but define unordered properties. This approach can be prominently found in database theory where formulas from first-order (fo) and monadic second-order (mso) logic are used to model query languages for relational databases and (hierarchical) xml documents, respectively. Being order-invariant means in this setting that the formula evaluation process is always independent of low-level aspects of databases like, for example, the encoding of elements as indices. Another example approach can be found in descriptive complexity theory where formulas whose evaluation is invariant with respect to specific encodings of the input structure capture unordered problems decidable by certain complexity classes. The famous open problem of whether there is a logic that captures all unordered properties decidable in polynomial time falls into this category.

Gurevich [17] proved that order-invariant fo (<-inv-fo) is more expressive than fo (also see [24] for details). The same holds for order-invariant mso (<-inv-mso) and mso with modulo-counting predicates (cmso); Ganzow and Rubin showed that <-inv-mso is able to express more properties than cmso on general finite structures [15]. Since it is not possible to decide, for a given fo-formula, whether it is order-invariant or not, this opens up the question of whether we can find alternative logics that are equivalent to the order-invariant logics <-inv-fo and <-inv-mso. While on general logical structures no logics that are equivalent to <-inv-fo or <-inv-mso are known, this changes if we consider classes of structures that are well-behaved. Benedikt and Segoufin [1] showed that <-inv-fo and fo have the same expressive power on the class of all strings and the class of all trees (we write on to indicate that the properties definable in <-inv-fo equal the properties definable in fo when considering structures from a class ). Considering <-inv-mso, Courcelle [7] showed that it has the same expressive power as cmso on the class of trees (that means, on trees). Recently it was shown that and hold on classes of graphs of bounded tree depth [12]. More general results that apply to graphs of bounded tree width or planar graphs have not been obtained so far. This is due to the fact that, whenever we want to move from an order-invariant logic to another logic on a class of structures, we need to understand both (1) the expressive power of the order-invariant logic when restricted to these structures, and (2) the ability of the other logic to handle the structures in terms of, for example, definable decompositions.


Our results address both of these issues to better understand the expressive power of order-invariant logics on decomposable structures.

Addressing issue (1), we prove two general results, which show how to lift-up definability results for order-invariant logics from the bags of tree decompositions up to the whole decomposed structure. We show that, whenever we are able to use mso-formulas to define a tree decomposition whose adhesion is bounded (that means, bags have only bounded size intersections) and we can define total orderings on the vertices of each bag individually, then (Theorem 3.1) and (Theorem 3.2). Lifting theorems of this kind can be seen to be implicitly used earlier [1, 5, 6], but so far they only applied to the case where the defined tree decomposition has a bounded width. In this case, the whole structure can be easily transformed into an equivalent tree. Our theorems also handle the case where bags have an unbounded width: they merely assume the additional definability of a total ordering on bags, possibly using arbitrary parameters (which may be sets in the case of mso-definability). This is a much weaker assumption than having bounded width, and it covers larger graph classes. The proofs of the lifting theorems use type-composition methods to show how one can define the logical types of structures from the logical types of substructures. The main challenge lies in trading the power of the used types (in our case these are certain order-invariant types based on orderings that are compatible with the given decomposition) with the ability to prove the needed type-composition methods. The latter need to work with bags of unbounded size and, thus, are more general than the type-composition methods that are commonly used for the case of bounded size bags.

Addressing issue (2), we study two types of classes of graphs where it is possible to meet the assumptions of the lifting theorems and, thus, show that and hold on these classes. The first two results (formally stated as Theorems 5.6 and 5.7) apply to classes of graphs of bounded tree width. For the proof, we show that one can define tree decompositions of bounded adhesion in mso, where the bags admit mso-definable total orderings. Let us remark that in proving these results we do not rely on the mso-definability of width-bounded tree decompositions, a result announced by Lapoire [18], but only proved recently (and independently of our work) by Bojańczyk and Pilipczuk [3] [4]. Benedikt and Segoufin [1] had shown earlier how to prove these results using the mso-definability of width-bounded tree decompositions. Our second application of the lifting theorem is concerned with classes of graphs that, for some , do not contain as a minor. This includes the class of planar graphs and all classes of graphs embedabble in a fixed surface [22, 23]. Using an mso-definable tree decomposition into 3-connected components due to Courcelle [8] along with proving that there are mso-definable total orderings for the 3-connected bags of the decomposition, we are able to apply the lifting theorems to prove that (Theorem 5.10) and (Theorem 5.11) hold on every class of graphs that exclude as a minor for some .

Organization of the paper.

The paper starts with a preliminary section (Section 2) containing definitions related to graphs and logic. In Section 3, we formally state and prove the lifting theorems. Section 4 shows how to mso-define tree decompositions along clique separators and reviews the known mso-definable tree decomposition into 3-connected components. Section 5 picks up the decomposed graphs and shows how to define total orderings for bags. This is combined with the lifting theorems to prove the results about bounded tree width graphs and -minor-free graphs stated above.

2 Background

In the present section, we introduce the necessary background related to logical structures and graphs (Section 2.1), monadic second-order logic and its variants (Section 2.2), logical games and types (Section 2.3), and transductions (Section 2.4).

2.1 Structures and Graphs

A vocabulary is a finite set of relational symbols where an arity is assigned to each . A structure over a vocabulary consists of a finite set , its universe, and a relation for every . We sometimes write by , in particular if is a symbol like .

An expansion of a -structure is a -structure for some vocabulary such that and for all . If is a -structure and , then the induced substructure is the -structure with universe and relations for all . Furthermore, we let .

Graphs  are structures over the vocabulary with . When working with graphs, we also write for the graph’s universe (its set of vertices) and call its set of edges. The graphs we are working with are undirected. That means, for every two vertices and , we have if, and only if, and . The Gaifman graph of a structure has vertices and for every pair of distinct elements and that are part of a common tuple in , we insert the edge into ; thus, is always undirected.

A tree decomposition of a structure is a tree together with a labeling function satisfying the following two conditions. (Connectedness condition) For every element , the induced subtree is nonempty and connected. (Cover condition) For every tuple of a relation in , there is a with . It will be convenient to assume that the trees underlying our tree decompositions are directed. That means, all edges are directed away from a root. The set of neighbors of a node in a directed tree consists of its children (if is not a leaf) and its parent (if is not the root). The set of children of a node in a directed tree is denoted by . We omit from and if it is clear from the context. The sets for every are the bags of the tree decomposition. The width of the tree decomposition is and its adhesion is . The tree width, , of a structure is the minimum width of a tree decomposition for it. Structures and their Gaifman graphs have the same tree decompositions. In particular . The torso of a node in a tree decomposition for a structure with Gaifman graph is together with edges between all pairs for .

2.2 Monadic Second-Order Logic and its Variants

Monadic second-order logic (mso-logic) is defined by taking all second-order formulas without second-order quantifiers of arity 2 and higher. More specifically, to define its syntax, we use element variables for and set variables for . Formulas of mso-logic (mso-formulas) over a vocabulary are inductively defined as usual (see, for example, [19]). Such formulas are also called -formulas to indicate the vocabulary along with the logic. The set of free variables of an mso-formula , denoted by , contains the variables of that are not used as part of a quantification. By renaming a formula’s variables, we can always assume for some ; we write to indicate that the free variables of are exactly to and to . Given an mso-formula , indicates that together with the assignment , for , and , for , to ’s free variables satisfies . A formula without free variables is also called a sentence.

Monadic second-order logic with modulo-counting (cmso-logic) extends mso-logic with the ability to access (built-in) modulo-counting atoms for every where is a relation symbol. Given a structure over a vocabulary that contains , we have exactly if divides (that means, ). Atoms where  is a set variable are used in the same way.

Let be a vocabulary and a binary relation symbol not contained in . An mso-sentence of vocabulary is order-invariant if for all -structures and all linear orders of we have if, and only if, . We can now form a new logic, order-invariant monadic second-order logic (<-inv-mso-logic), where the sentences of vocabulary are the order-invariant sentences of vocabulary , and a -structure satisfies an order-invariant sentence if satisfies in the usual sense for some (and hence for all) linear orders of . There is a slight ambiguity in the definition of order-invariant sentences in which binary relation symbol we are referring to as our special “order symbol” (there may be several binary relation symbols in ). But we always assume that is clear from the context. Alternatively, we could view as a “built-in” relation symbol that is fixed once and for all and is not part of any vocabulary. However, this would be inconvenient because we sometimes need to treat just as an ordinary relation symbol and the sentences of <-inv-mso-logic of vocabulary just as ordinary mso-sentences of vocabulary .

First-order logic (fo-logic) and order-invariant first-order logic (<-inv-fo-logic) are defined by taking all sentences of mso-logic and <-inv-mso-logic, respectively, that do not contain set variables.

2.3 Games and Types

The quantifier rank of an mso-formula , denoted by , is the maximum number of nested quantifiers in . For structures and , we write if and satisfy the same mso-sentences of quantifier rank at most . We write if and satisfy the same order-invariant mso-sentences of quantifier rank at most . For every , we write if and satisfy the same cmso-sentences of quantifier rank at most and only numbers are used in the modulo-counting atoms.

It will sometimes be convenient to use versions of mso and cmso without element variables (see, for example, [25]). In particular, in the context of Ehrenfeucht-Fraïssé games. We will freely do so. We assume that the reader is familiar with the characterizations of mso-equivalence and cmso-equivalence by Ehrenfeucht-Fraïssé games (see, for example, [11, 15]). Corresponding to the versions of the logics without element variables, we use a version of the games where the players only select sets and never elements, and a position induces a partial isomorphism if the mapping between the singleton sets of the position is a partial isomorphism. (The rules of the game require the Duplicator to answer to a singleton set with a singleton set and to preserve the subset relation.) Then a position of the game on structures is a sequence of pairs of subsets and . The position is a -move winning position for one of the players if this player has a winning strategy for the -move game starting in this position.

We also use the concept of types. Let be a vocabulary and . Then for all -structures and sets , the mso-type of of quantifier rank is

Moreover, the class of all types over with respect to rank and free set variables is

and we let . For , we say that a cmso-formula has rank at most if it has quantifier rank at most and only contains modulo-counting atoms with . Based on this notion of rank, we define the cmso-type , and sets and .

Note that if, and only if, is a -move winning position for the Duplicator in the mso-game on . Furthermore, for we have if, and only if, . Similar remarks apply to cmso-types.

For a vocabulary and a binary relation symbol , we say that a subset is order-invariant if for all -structures and all linear orders of we have if, and only if, . If is inclusion-wise minimal order-invariant, then we call it an order-invariant type. Note that every is contained in exactly one order-invariant type, which we denote by . We set , the set of all order-invariant types. For a -structure , we call the set for some and, hence, for all linear orders of the order-invariant mso-type of of quantifier rank . It may seem more natural to define the order-invariant type of a structure as the set of all order-invariant sentences it satisfies. The following proposition says that this would lead to an equivalent notion, but our version is easier to work with, because it makes the connection between types of ordered structures and order-invariant types more explicit.

Lemma 2.1.

For all -structure , the following statements are equivalent.

  1. .

  2. .

  3. There is a sequence of -structures and linear orders with , , and for all .

If , we say that sequences , , and as in statement 3 of Lemma 2.1 witness .

Proof of Lemma 2.1.

We prove each of the implications from the chain (1)(3)(2)(1).

For proving (1)(3), suppose . Let for some linear order of and for some linear order of . Let be the class of all ordered -structures such that there is a sequence of -structures and linear orders such that and and for all , and let the class of types for . An easy induction on the length of the witnessing sequence shows that . Moreover, is order-invariant, and thus . Similarly, we define and prove that . Thus , and this implies (3).

To prove (3)(2), just note that all structures in a witnessing sequence satisfy the same order-invariant formulas.

Finally, to prove (2)(1), suppose that . Let for some linear order of . Then . Let with . Then is an order-invariant mso-sentence of quantifier rank . As , we have , and thus satisfies as a sentence of <-inv-mso. Hence satisfies as a sentence of <-inv-mso, and thus for some linear order of . Thus there is a such that , which implies . Hence . ∎

2.4 Transductions

Transductions define new structures out of a given structure. We use -copying mso-transductions as defined in [10], but based on the below terminology. They are able to (1) enlarge the universe of a given structure by establishing copies of each element, (2) define relations over the new universe from the given structure, and (3) not only define a single structure, but a set of new structures parameterized by adding monadic relations to the given structure.

An mso-transduction of width with parameters for some is defined via a finite collection of mso-formulas over where the relation symbols are monadic and not part of . consists of a group of mso-formulas ,…, for defining the universe of a new structure and for each with some arity a group of formulas for . Given a -structure and , they define the universe of a -structure via

and for each relation symbol the relation

Finally, by ranging over all possible parameters, defines the set

for a given structure where is a formula that is also part of the transduction, which singles out the valid combinations of the given structure and parameters. Moreover, for a -structure , we set . For an element , we call its level.

mso-transductions preserve mso-definability (formally stated by Fact 2.2) and they can be composed to form new transductions (formally stated by Fact 2.3). For a formal proof of Fact 2.3, which implies Fact 2.2, see [10]. The facts also hold if we replace all occurrences of mso by cmso.

Fact 2.2 (mso is closed under mso-transductions).

Let be an mso-definable property of -structures and an mso-transduction. Then the property of -structures is mso-definable.

Fact 2.3 (mso-transductions are closed under composition).

Let be an -transduction and be an for some vocabularies . Then there is an -transduction with for every -structure .

3 Lifting Definability

An ordered tree decomposition of a structure is a tree decomposition of together with a linear order for each bag. We represent ordered tree decompositions by logical structures in the following way. An ordered tree extension (otx for short) of a -structure is a structure that extends by a tree decomposition of and a linear order of for each . The adhesion of is the adhesion of the tree decomposition . Formally, we view as a structure over the vocabulary , where and are unary, and are binary, and is ternary. Of course we assume that none of these symbols appears in . In the -structure , these symbols are interpreted as follows:

An -transduction defines an otx (of adhesion at most ) of a -structure if every is isomorphic to an otx of (of adhesion at most ) and is nonempty. We say that defines otxs (of adhesion at most ) on a class of -structures if defines an otx (of adhesion at most ) of every . Moreover, admits mso-definable ordered tree decompositions (of bounded adhesion) if there is such a transduction that defines otxs (of adhesion at most for some constant ) on . We make similar definitions for the logic cmso.

We prove the following theorems, which show how to use the tree decompositions and the bag orderings to define properties of order-invariant formulas without using order invariance.

Theorem 3.1 (Lifting theorem for <-inv-mso).

Let be a class of structures that admits cmso-definable ordered tree decompositions of bounded adhesion. Then on .

Theorem 3.2 (Lifting theorem for <-inv-fo).

Let be a class of structures that admits mso-definable ordered tree decompositions of bounded adhesion. Then on .

Theorem 3.1 is proved in three steps: First, in Section 3.1, we modify the given ordered tree extension, such that its tree decomposition follows a certain normal form that allows to partition its nodes into two different classes (called a-nodes and b-nodes). The partition of the nodes along with a global partial order that is based on the local orderings in the bags is then encoded as part of the structure, turning every otx into an expanded otx. Second, in Section 3.2, we prove type-composition lemmas for both the a-nodes and the b-nodes. They show how one can define the type of an expanded otx with respect to total orderings that respect the already existing partial order from the types of substructures that arise by adding such compatible orderings to them. Third, Section 3.3 shows how these type-composition lemmas can be used in the context of order-invariance. Finally, Section 3.4 applies the type compositions to prove Theorem 3.1. The proof of Theorem 3.2 proceeds in a similar way. The modifications that we need to apply to the proof of Theorem 3.1 in order to prove Theorem 3.2 are mentioned along the way.

3.1 Segmented Ordered Tree Extensions

Recall that we view the tree in a tree decomposition as directed. A tree decomposition of a structure is segmented if the set can be partitioned into a set of adhesion nodes and a set of bag nodes (a-nodes and b-nodes, for short) satisfying the following conditions.

  1. For all edges , either and or and .

  2. For all a-nodes and all distinct neighbors , we have .

  3. For all b-nodes and all distinct neighbors we have .

  4. All leaves of are b-nodes.

We can transform an arbitrary tree decomposition into a segmented tree decomposition as follows. In the construction, we view as an undirected tree. We will have . Thus we can direct the edges of away from the root of , which will remain the root of . We first contract all edges with , resulting in a decomposition where for all . Then, for all edges , we introduce a new node , where , and edges from to and . Then we identify all nodes and such that . We let be the resulting tree. The nodes from the original tree are the b-nodes, and the nodes are the a-nodes. We define on by for and for all . The resulting tree decomposition is segmented. This transformation is definable by an mso-transduction. Thus we may assume that the tree decompositions in ordered tree extensions are segmented, because there is an -transduction that transforms every otx into an otx where the tree decomposition is segmented.

For the rest of this section, we fix a vocabulary that does not contain the order symbol and a . In the rest of this section, we only consider otxs of -structures. We assume that the adhesion of these otxs is at most and their tree decomposition is segmented.

It will be convenient to introduce some additional notation. As before, whenever we denote an otx by , we denote the underlying structure by and the tree decomposition by . We denote the descendant order in the tree of an otx by . For every node , we let be the subtree of rooted in , that is, . We let , called the cone of , be the union of all bags for . If is the parent of we let ; this is the separator at . For the root we let . In all these notations we may omit the index if is clear from the context. Note that for all a-nodes of and all we have .

We expand an otx to a structure over the vocabulary , where are unary and are binary relation symbols that do not appear in . We let and be the sets of a-nodes and b-nodes of the tree , respectively, and

We let be the partial order on defined as follows. We first define the restriction of to . For all b-nodes , we let be the linear order on defined by if the set is lexicographically smaller than or equal to the set with respect to the linear order on , for all children . This is indeed a linear order because is a linear order of and for all distinct . Then we let the restriction of to be the reflexive transitive closure of the “descendant order” on and all the relations for b-nodes . To define the restriction of to , for every we let be the topmost (that is, -minimal) node such that . Then we let if, and only if, or and . To complete the definition of , we let for all and .

Finally, we define the relations by letting be the set of all pairs , where and is the th element of with respect to the partial order , which is a linear order when restricted to . Recall that we have by our general assumption that the adhesion of all otxs is at most . This completes the definition of . It is easy to see that there is an -transduction that defines in .

We call an expanded otx (otxx for short) of . More generally, we call a -structure an expanded otx if there is a -structure such that is an otxx of . Let be an expanded otx. For every , we let

We call a -structure a sub-otxx if there is an otxx and a node with . The only difference between an otxx and a sub-otxx is that in an otxx the set is empty for the root whereas in a sub-otxx it may be nonempty.

Lemma 3.3.

There are mso-sentences otxxs and sub-otxx of vocabulary defining the classes of all otxx and sub-otxx (satisfying our general assumptions: the tree decomposition is segmented and has adhesion at most ).


Straightforward. ∎

We will later modify an otxx by replacing a sub-otxx , for some , by another sub-otxx . Let be the root node of the tree . The replacement is possible if the induced substructures and are isomorphic. If they are, there is a unique isomorphism, because and are linearly ordered by the restrictions of , . Now replacing by in just means deleting all elements in except those in , adding a disjoint copy of , and identifying the elements in and according to the unique isomorphism. Note that the substructures and are isomorphic if the sub-otxxs and satisfy the same first-order sentences of quantifier rank , where denote the maximum arity of a relation symbol in the vocabulary . To express isomorphism, we use the relations and the fact that the root of an otxx can be defined by a formula of quantifier rank . Thus in particular, if for some , we can replace by .

Finally, we say that a linear order on an otxx or sub-otxx is compatible if it extends the partial order . If is a compatible linear order, then denotes the -expansion of by this order, and denotes the induced substructure where is restricted to the sub-otxx . We can extend the replacement operation to such ordered expansions of otxxs; in the same way we replace a sub-otxx by , we can replace a by for some compatible linear order of .

3.2 Ordered Type Compositions

As all structures we are working with in this subsection are otxxs and sub-otxx, we denote them by rather than . Apart from that, we use the same notation as before. In particular, if is an otxx then by we denote the tree of its tree decomposition, and for a node , by we denote the sub-otxx rooted in , and we let .

Throughout this subsection, we fix a such that and and is at least the quantifier rank of the formulas otxx and sub-otxx of Lemma 3.3. This means that if is an otxx (or sub-otxx) and an arbitrary -structure with , then is an otxx (a sub-otxx) as well. Furthermore, if are the root nodes of , , respectively, then the induced substructures and are isomorphic. Finally, if are otxxs and are linear orders of , respectively, such that then is compatible if, and only if, is compatible.

We let . Furthermore, we assume that .

Let be an otxx, a compatible linear order of , and (usually for a node ). For all , let be the set of all such that . We call the type partition of . (Note that some of the may be empty. We always allow partitions to have empty parts.) The following lemma extends classical type-composition theorems [21, 14] to our situation, where substructures are combined through b-nodes.

Lemma 3.4 (Ordered type composition at b-nodes).

For every there is an -formula such that for every otxx , every b-node , and every compatible linear order of , if is the type partition of , then


For , let , and suppose that . Then and , and we may assume that for all . Let . The core of the proof is the following claim.


Let be otxxs and compatible linear orders of , respectively. Let and . Let and be the type partitions of and , respectively. If


then .

The claim implies that only depends on the type of