Monadic second order finite satisfiability and unbounded tree-width Tomer Kotek, Helmut Veith, Florian Zuleger
arXiv:1505.06622v1 [cs.LO] 25 May 2015
TU Vienna
Abstract. The finite satisfiability problem of monadic second order logic is decidable only on classes of structures of bounded tree-width by the classic result of Seese [21]. We prove the following problem is decidable: Input: (i) A monadic second order logic sentence α, and (ii) a sentence β in the two-variable fragment of first order logic extended with counting quantifiers. The vocabularies of α and β may intersect. Output: Is there a finite structure which satisfies α ∧ β such that the restriction of the structure to the vocabulary of α has bounded tree-width? (The tree-width of the desired structure is not bounded.) As a consequence, we prove the decidability of the satisfiability problem by a finite structure of bounded tree-width of a logic extending monadic second order logic with linear cardinality constraints of the form |X1 | + · · · + |Xr | < |Y1 | + · · · + |Ys |, where the Xi and Yj are monadic second order variables. We prove the decidability of a similar extension of WS1S.
Monadic second order logic (MSO) is among the most expressive logics with good algorithmic properties. It has found countless applications in computer science in diverse areas ranging from verification and automata theory [11,15,22] to combinatorics [13,14], and parameterized complexity theory [7,6]. The power of MSO is most visible over graphs of bounded tree-width, and with second order quantifiers ranging over sets of edges1 : (1) Courcelle’s famous theorem shows that MSO model checking is decidable over graphs of bounded treewidth in linear time [5,1]. (2) Finite satisfiability by graphs of bounded tree-width is decidable [5] (with non-elementary complexity) – thus contrasting Trakhtenbrot’s undecidability result of first order logic. (3) Seese proved [21] that for each class K of graphs with unbounded tree-width, finite satisfiability of MSO by graphs in K is undecidable. Together, (2) and (3) give a fairly clear picture of the decidability of finite satisfiability of MSO. It appeared that (3) gives a natural limit for decidability of MSO on graph classes. For instance, finite satisfiability on planar graphs is undecidable because their tree-width is unbounded. While Courcelle and Seese circumvent Trakhtenbrot’s undecidability result by restricting the classes of graphs (or relational structures), several other research communities have studied syntactic restrictions of first order logic. Modal logic [23], many temporal logics [18], [20, Chapter 24], the guarded fragment [8], many 1
The logic we denote by MSO is denoted MS2 by Courcelle and Engelfriet [6].
description logics [2], and the two-variable fragment [9] are restricted first order logics with decidable finite satisfiability, and hundreds of papers on these topics have explored the border between decidability and undecidability. While many of the earlier papers exploited variations of the tree model property to show decidability, recent research has also focused on logics such as the two-variable fragment with counting C 2 [10,19], where finite satisfiability is decidable despite the absence of the tree model property. In a recent breakthrough result, Charatonik and Witkowski [4] have extended this result to structures with built-in trees. Note that this logic is not a fragment of first order logic, but more naturally understood as a very weak second order logic which can express one specific second order property – the property of being a tree. Our main result is a powerful generalization of the seminal result on decidability of the satisfiability problem of MSO over bounded tree-width and the recent Theorem by [4]: We show decidability of finite satisfiability of conjunctions α ∧ β where α is in MSO and β is in C 2 by a finite structure M whose restriction to the vocabulary of α has bounded tree-width. (Theorem 14 in Section 4) Let us put this result into perspective: – The MSO decidability problem is a trivial consequence by setting β to true; Charatonik and Witkowski’s result follows by choosing α to be an MSO formula which axiomatizes a d-ary tree, which is a standard construction [6]. – The decidability of model checking α ∧ β over a finite structure is a much simpler problem than ours: We just have to model check α and β one after the other. In contrast, satisfiability is not obvious because α and β an share relational variables. When we run two finite satisfiability algorithms for the two formulas independently, we may receive two models who disagree on the shared vocabulary. Thus, the problem we consider is similar in spirit to (but technically very different from ) Nelson-Oppen [17] combinations of theories. – Our result trivially generalizes to Boolean combinations of sentences in the two logics. Proof Technique. We show how to reduce our satisfiability problem for α ∧ β to the finite satisfiability of a C 2 -sentence with a built-in tree, which is decidable by [4]. The first technical challenge is to replace the MSO-sentence α with an equisatisfiable C 2 -sentence α0 . To do so, we introduce a new encoding of structures of bounded tree-width into trees, and apply tools including the Feferman-Vaught theorem for MSO and translation schemes. The second technical challenge is to eliminate shared binary relation symbols between α0 and β. Our Separation Theorem overcomes this challenge by an elegant construction based on local types of universe elements and a coloring argument for directed graphs. Monadic Second Order Logic with Cardinalities. Our results imply new decidability results for monadic second order logic with cardinality constraints, i.e., expressions of the form |X1 | + . . . |Xr | < |Y1 | + . . . |Yt | where the Xi and Yi are monadic second order variables. Klaedtke and Rueß [12] showed that the decision problem for weak monadic second order logic with one successor (WS1S) is undecidable; they describe a decidable fragment where the second order quantifiers
have no alternation and appear after the first order quantifiers in the prefix. Our results imply decidability of a different fragment of WS1S with cardinalities: Our ¯ where the cardinality constraints in ψ involve fragment consists of formulas ∃Xψ ¯ cf. Theorem 15 in Section 5. only the monadic second order variables from X, Note that in contrast to [12], our fragment is a strict superset of WS1S. For WS2S, we are not aware of results about decidable fragments with cardinalities. Our paper is a first step in this direction. We describe a strict superset of MSO whose satisfiability problem over finite graphs of bounded tree-width is decidable, and which is syntactically similar to the WS1S extension above. Expressive Power over Graphs. Our main result extends the existing body of results on finite satisfiability by structures of bounded tree-width to a sig•• nificantly richer set of structures. The structures we • •• consider are extensions of structures of bounded tree• 2 width which are axiomatizable in C . For instance, we can have interconnected lists, or a tree whose leaves have edges pointing to any of the nodes of a ••• cyclic list, see Fig. 1. These structures occur very nat(a) (b) urally as shapes of dynamic data structures in proFig. 1. gramming – where cycles and trees are containers for data, and additional edges express relational information between the data. The analysis of data structures served as a motivation for us to investigate the logics in the current paper [3]. Note that while the structures we consider contain grids of unbounded sizes as subgraphs, the logic cannot axiomatize them.
1
Background
This section introduces basic definitions and results in model theory and graph theory. We follow [16] and [6]. The two-variable fragment with counting C 2 is the extension of the twovariable fragment of first order logic with first order counting quantifiers ∃≤n , ∃≥n , ∃=n , for every n ∈ N. Monadic Second order logic MSO is the extension of first order logic with set quantifiers which can range over elements of the universe or subsets of relations2 . Throughout the paper all structures consist of unary and binary relations only. Structures are finite unless explicitly stated otherwise (in the discussion of WS1S decidability). Let Σ be a vocabulary (signature). The arity of a relation symbol C ∈ Σ is denoted by arity(C). The set of unary (binary) relation symbols in Σ are un(Σ) (bin(Σ)). We write MSO(Σ) for the set of MSOformulas on the vocabulary Σ. The quantifier rank of a formula ϕ ∈ MSO, i.e. the maximal depth of nested quantifiers in ϕ is denoted qr(ϕ). We denote by A1 t A2 the disjoint union of two Σ-structures A1 and A2 . Given vocabularies 2
On relational structures, MSO is also known as Guarded Second Order logic GSO. The results of this paper extend to CMSO, the extension of MSO with modular counting quantifiers.
Σ1 ⊆ Σ2 , a Σ2 -structure A2 is an expansion of a Σ1 -structure A1 if A1 and A2 agree on the symbols in Σ1 ; in this case A1 is the reduct of A2 to Σ2 , i.e. A1 is the Σ2 -reduct of A2 . We denote the reduct of A2 to Σ1 by A2 |Σ1 . A Σ-structure A0 is a substructure of a Σ-structure A1 if A0 ⊆ A1 and for every R ∈ Σ, R0A = R1A ∩ A0 . We say A0 is the substructure of A1 generated by A0 . A translation scheme for Σ2 over Σ1 is a tuple t = hφ, ψC : C ∈ Σ2 i of MSO(Σ1 )-formulas such that φ has exactly one free first order variable and each ψC has arity(C) free first order variables. The formulas φ and ψC , C ∈ Σ2 , do not have any free second order variables. 3 The quantifier rank of t is the maximum of the quantifier ranks of φ and the ψC . t is quantifier-free if qr(t) = 0. The induced transduction t? is a partial function from Σ1 -structures to Σ2 structures which assigns a Σ2 -structure t? (A) to a Σ1 -structure A as follows. The ? universe of tn (A) is At = {a ∈ A : A |= φ(a)}. The interpretation of C ∈ Σ2 in At o ?
is C t
(A)
= a ¯ ∈ At arity(C) : A |= ψC (¯ a) . Due to the convention that structures
do not have an empty universe, t? (A) is defined iff A |= ∃xφ(x). Lemma 1 (Fundamental property of translation schemes) Let t be a translation scheme for Σ2 over Σ1 . There is a computable function t] from MSO(Σ2 )sentences to MSO(Σ1 )-sentences satisfying: Given a Σ1 -structure A such that t? (A) is defined and a MSO(Σ2 )-sentence θ, A |= t] (θ) if and only if t? (A) |= θ. If the quantifier rank of t is q and θ is a MSO(Σ2 )-sentence of quantifier rank r, then t] has quantifier rank at most r + q. t] is called the induced translation. Let Σ3 be a vocabulary disjoint from Σ2 and Σ1 . We denote by trep(Σ3 ) the translation scheme for Σ2 ∪ Σ3 over Σ1 ∪ Σ3 which is obtained from t by setting ψC (x, y) = C(x, y) or ψC (x) = C(x) for every C ∈ Σ3 . We say trep(Σ3 ) is the Σ3 -replicating extension of t. We omit the arguments of rep when they are clear from the context. Theorem 2 (Hintikka sentences) Let Σ be a vocabulary. For every q ∈ N there is a finite set HΣ,q of MSO(Σ) of quantifier rank q such that: 1. every ∈ HΣ,q has a model; 2. the conjunction of any two distinct sentences 1 , 2 ∈ HΣ,q is not satisfiable; 3. every MSO(Σ)-sentence α of quantifier rank at most q is equivalent to exactly one finite disjunction of sentences HΣ,q ; 4. every finite Σ-structure A satisfies exactly one sentence hinΣ,q (A) of HΣ,q . We may omit Σ or q from the subscript when they are clear from the context. For a class of Σ-structures K an n-ary operation Op over Σ-structures is called smooth over K, if for all A1 , . . . , An ∈ K, hinΣ,q (Op(A1 , . . . , An ) depends only on hinΣ,q (Ai ): i ∈ [n] and this dependence is computable4 . We omit “over K” when K consists of all Σ-structures. 3
4
All translation schemes in this paper are scalar (i.e. non-vectorized). In the notation of [6], a translation scheme is a parameterless non-copying MSO-definition scheme with precondition formula ∃x(x ≈ x). Smooth operations here are called effectively smooth in [16].
Theorem 3 (Smoothness) 1. The disjoint union is smooth. 2. For every quantifier-free translation scheme t, the operation t? is smooth. 3. Let Σ be a vocabulary with one binary relation symbol s, an unary relation symbol root and possibly other unary relation symbols. Let Kroot be the class of → Σ structures A in which |rootA | = 1. The following binary operation A1 ◦ A2 → on Kroot is smooth. A1 ◦ A2 is the disjoint union of A1 and A2 , with an → additional edge from rootA1 to rootA2 , and setting rootA1 ◦ A2 = rootA1 . Graphs are structures of the vocabulary5 ΣG = hsi consisting of a single binary relation symbol s. Graphs are simple and undirected unless explicitly stated otherwise. Tree-width tw(G) is a graph parameter indicating how close a simple undirected graph G is to being a tree, cf. [6]. It is well-known that a graph has tree-width at most k iff it is a partial k-tree. A partial k-tree is a subgraph of a k-tree. k-trees are built inductively from the k-clique by repeated addition of vertices, each of which is connected with k edges to a k-clique. The Gaifman graph Gaif(A) of a Σ-structure A is the graph whose vertex set is the universe of A and whose edge set is the union of the symmetric closures of C A for every C ∈ bin(Σ). Note the unary relations of A play no role in Gaif(A). The treewidth tw(A) of a Σ-structure A is the tree-width of its Gaifman graph. In this paper, tree-width is a parameter of finite structures only. Fix k ∈ N for the rest of the paper. k will denote the tree-width bound we consider.
2
Oriented k-trees
The class of graphs of bounded tree-width is well-known to be the image of a translation scheme on the class of trees [1]. Tree-width is also commonly defined with respect to another encoding of graphs as trees, namely tree decompositions. We too rely heavily in our proofs on an encoding of graphs of bounded tree-width into trees. However, both of the above approaches are not adequate for our purposes, since our proof technique requires C 2 formulas to axiomatize structures based on tree encodings, and C 2 is much weaker than MSO and its variants. We introduce a new tree encoding of structures of bounded tree-width. An oriented k-tree encoding T is a binary tree whose vertices are labeled by certain unary relations. All structures of bounded tree-width can be obtained by applying transductions to oriented k-tree encodings with additional vertex labelings: Oriented k-tree encoding Reduced oriented k-tree
interpret
−→
structurize
−→
reduce
Oriented k-tree −→ Structure of tw ≤ k
Two key properties of our encoding: (I) Using that the number of edges in a ktree is at most k · (number of vertices), our oriented k-trees have partial functions R1 , . . . , Rk rather than an edge relation. (II) The elements of the universe of a 5
Since we explicitly allowed quantification over subsets of relations for MSO, we do not view graphs and structures as incidence structures, in contrast to [6, Sections 1.8.1 and 1.9.1].
structure appear as elements in the reduced oriented k-tree, in the oriented ktree, and in the oriented k-tree encoding. Oriented k-tree encodings and oriented k-trees have additional auxiliary vertices which are eliminated by reduce. Let σ be the vocabulary containing the binary relation symbol s, and the unary relation symbols root, D1 , . . . , Dk , Dblank . Let ω be the vocabulary which consists of the binary relation symbols R1 , . . . , Rk . Let µ = σ ∪ ω. An oriented k-tree encoding is a σ-structure T with universe T such that (i) (T, sT ) is a directed tree (i.e., an acyclic directed graph in which all vertices have in-degree 1 except exactly one.), (ii) every vertex in (T, sT ) has T out-degree at most 2, (iii) D1T , . . . , DkT , Dblank T form a partition of T , (iv) root denotes the unary relation containing only the unique vertex with in-degree 0 in (T, sT ), and (v) all T the children of vertices in T \Dblank belong to T Dblank . Fig. 2(a) shows an oriented 3-tree encoding. The edges represent s. The small black circles represent Dblank , the larger red circles (a) (b) (c) represent D1 , the squares represent D2 , and Fig. 2. the diamonds represent D3 . An oriented k-tree A is an expansion of an oriented k-tree encoding T to µ. For every j ∈ [k], RjA contains all pairs (v, u) ∈ (A\Dj ) × DjT such that there is a directed path P from u to v in (T, sT ) which does not intersect with DjT except on u, i.e. DjT ∩ (P \{u}) = ∅. Observe that the relation RjA is a partial function. Fig. 2(b) shows the oriented 3-tree obtained from (a). The new edges represent R1 , R2 , and R3 : dashed edges represent R1 , solid edges represent R2 , and the single thick edge (from a square to a diamond) represents R3 . A reduced oriented k-tree is the ω-reduct of the substructure of an oriented k-tree A0 generated by D1A0 ∪ · · · ∪ DkA0 . Fig. 2(c) shows the reduced oriented 3-tree obtained from (b) The vertices of (c) are not labeled by any unary relation. Lemma 4 (1) For every reduced oriented k-tree A, Gaif(A) is a partial (k − 1)-tree. (2) For every (k − 1)-tree G there is a reduced oriented k-tree A such that G = Gaif(A). (See proofs in Appendix 6.3.) There are translation schemes interpret (shorthand i)) for σ over µ and reduce (shorthand(r) for ω over µ which takes an oriented k-tree encoding to its oriented k-tree respectively an oriented k-tree to its reduce oriented k-tree. Lemma 5 (1) For every oriented k-tree A, i? (A|σ ) = A. (2) For every reduced oriented k-tree A obtained from an oriented k-tree A0 , r? (A0 ) = A. i and r are spelled out in Appendices 6.4 and 6.5. Structures M with tw(M) < k can be encoded inside reduced oriented k-trees by unary relations on the sources of Rj edges, using that Rj are partial functions.
Lemma 6 For every ρ consisting of binary relation symbols only, there is a set Ξρ of unary relation symbols and a translation scheme structurizeρ (shorthand sρ ) for ρ over Ξρ ∪ ω such that: (1) If M is a ρ structure whose Gaifman graph is a partial (k −1)-tree, then there is an expansion A of a reduced oriented k-tree to Ξρ ∪ω for which s?ρ (A) = M. (2) If A is a (Ξρ ∪ω)-structure and A|ω is a reduced oriented k-tree, then Gaifs?ρ (A) is a partial (k − 1)-tree. We denote σρ = σ ∪ Ξρ and µρ = σρ ∪ ω ∪ ρ. (See proof in Appendix 6.6.) Lemma 7 Let q ∈ N and let ρ ⊇ σ be a vocabulary extending σ with unary relation symbols only. Let C : ∈ Hρ,q be new unary relation symbols. Let hin(ρ, q) hin extend ρ with {C : ∈ Hρ,q }. There is a computable C 2 (hin(ρ, q))-sentence Θρ,q such that if T0 is a ρ-structure whose σ-reduct is an oriented k-tree encoding: hin (i) There is an expansion T1 of T0 to hin(ρ, q) with T1 |= Θρ,q . hin (ii) For every expansion T1 of T0 to hin(ρ, q) with T1 |= Θρ,q and γ ∈ MSO(ρ) with qr(γ) = W q, i?ρ (T0 ) |= γ iff T1 |= γhin , where γhin is the C 2 -sentence ∀x(root(x) → ∈Hρ,q : |=γ C (x)). hin so that for every T0 there is a unique expansion T1 such that We will define Θρ,q hin T1 |= Θρ,q . For every a ∈ T1 , we will have a ∈ CT1 iff the subtree Ta of T0 whose → root is a, satisfies i?ρ (Ta ) |= . Using the smoothness of ◦ , whether an element of T1 belongs to CT1 depends only on its children. This can be axiomatized in C 2 .
3 3.1
Separation Theorem Basic Definitions and Results
We begin with some notation and definitions in the spirit of the literature on decidability of C 2 , cf. e.g. [19,4]. Let ρ be a vocabulary. A 1-type π is a maximal consistent set of atomic ρ-formulas or negations of atomic ρ-formulas with free variable x, i.e., exactly one of A(x) and ¬A(x) belongs to π for every unary relation symbol A ∈ ρ, and exactly one of r(x, x) and ¬r(x, x) V belongs to π for every binary relation symbol r ∈ ρ. We denote by ϕπ (x) = ι∈π ι the formula that characterizes the 1-type π. We denote by Π(ρ) the set of 1-types over ρ. A 2-type λ is a maximal consistent set of atomic ρ-formulas or negations of atomic ρ-formulas with free variables x and y, i.e., for every z1 , z2 ∈ {x, y}, exactly one of A(z1 ) and ¬A(z1 ) belongs to π and exactly one of A(z2 ) and ¬A(z2 ) belongs to π for every unary relation symbol A ∈ ρ, and exactly one of r(z1 , z2 ) and ¬r(z1 , z2 ) belongs to π for every binary relation symbol r ∈ ρ. Note that the equality relation ≈ is not part of a 2-type. We write λ−1 for the 2-type obtained from λ by replacing all occurrences of x resp. y with y resp. x. We write λx for the 1-type obtained from λ by restricting λ to formulas with free variable x. We write λy for the 1-type obtained from λ by restricting λ to formulas with free
V variable y and replacing y with x. We denote by ϕλ (x, y) = ι∈λ ι the formula that characterizes the 2-type λ. We denote by Λ(ρ) the set of 2-types over ρ. Let M be a structure with universe M and let u, v ∈ M be some elements of the universe. We denote by tpM (u) the unique 1-type π such that M |= ϕπ (u). We denote by tpM (u, v) the unique 2-type λ such that M |= ϕλ (u, v). C 2 -sentences have a Scott-like normal form, cf. [9,19]. Every C 2 -sentence can be transformed into an equi-satisfiable C 2 -sentence by applying Skolemization. Lemma 8 For every C 2 -sentence ϕ there is a C 2 -sentence ϕ0 of the form V ∀x∀y χ ∧ i∈[l] ∀x∃=1 y (fi (x, y) ∧ x 6≈ y) ,
(1)
over an expanded vocabulary containing in particular the binary relation symbols f1 , . . . , fl such that ϕ and ϕ0 are equi-satisfiable. Moreover, ϕ0 is computable. For the rest of the section we fix a vocabulary ρ and a C 2 -sentence ϕ. We assume ϕ is in the form given in Eq. (1) for some binary relation symbols fi : i ∈ [l] and quantifier-free C 2 -formula χ. We call a 2-type λ a message-type, if fi (x, y) ∈ λ for some i ∈ [l]. Otherwise, we call λ quiet. We call λ silent, if λ and λ−1 are quiet. We call a message-type λ invertible, if λ−1 is also a message-type. Otherwise, we call λ non-invertible. A star-type δ ⊆ Λ(ρ) is a set of message-types such that there is a 1-type denoted δx with δx = λx for all λ ∈ δ and |{λ ∈ δ|fi ∈ λ}| = 1 for all i ∈ [l]. We call δ chromatic, if all induced 1-types in δ are different, i.e., δx 6= λy for 0 0 0 all V λ ∈ δ and λy 6= λy for all λ, λ ∈ δ with λ 6= λ . We denote by ϕδ (x) = (x, y) the formula that characterizes star-type δ for all ρ-structures M λ∈δ ∃y ϕλ V with M |= i∈[l] ∀x ∃=1 y fi (x, y) ∧ x 6≈ y. We denote by ∆(ρ) the set of star-types over ρ. We denote by Π(δ) = δx ∪ {λy | V λ ∈ δ} the set of 1-types of star-type δ. Let M be a ρ-structure with M |= i∈[l] ∀x ∃=1 y fi (x, y) ∧ x 6≈ y. Let M be the universe of M and let u, v ∈ M . We denote by stpM (u) the unique star-type δ such that M |= ϕδ (u). We define the set of silent 2-types realized by M by Silent(M) = {λ | there are u, v ∈ M with λ = tpM (u, v) silent}. Lemma 9 Let M1 , M2 be two ρ-structures over the same universe M with Mj |= V =1 ∀x ∃ y fi (x, y) ∧ x 6≈ y for j ∈ {1, 2}. If stpM1 (u) = stpM2 (u) for all i∈[l] u ∈ M and Silent(M1 ) = Silent(M2 ), then: M1 |= ϕ iff M2 |= ϕ. (See proof in Appendix 6.8.) Let M be a ρ-structure with universe M . We define: Emessage = {(u, v) ∈ M 2 | tpM (u, v) is a message-type}, and Enon−inv = {(u, v) ∈ M 2 | tpM (u, v) is a non-invertible message-type}. The 2 message-graph is D(M) = (M, Emessage ∪ Enon−inv ), where R2 denotes the composition of a relation R with itself. We call M chromatic, if tpM (u) 6= tpM (v) 2 for all (u, v) ∈ Emessage ∪ Enon−inv . Note that the message-graph is a directed graph (without self-loops) with out-degree deg + (v) ≤ l + l2 for all v ∈ M . Note that for a chromatic structure M the star-types realized in M are chromatic. The following lemmas are proved in Appendices 6.9 and 6.10.
Lemma 10 Let G = (V, E) be a directed graph with out-degree deg + (v) ≤ k for all v ∈ V . Then, the underlying undirected graph has a proper 2k + 1-coloring. Lemma 11 There is a vocabulary ρcolors that expands ρ such that every ρ-structure can be expanded to a chromatic ρcolors -structure. 3.2
Separation Theorem
Theorem 1. Let µ ⊆ ρ. There is a vocabulary τ that expands ρ such that for every sentence ϕ ∈ C 2 (ρ) there are sentences ψ1 ∈ C 2 (τ \ω) and ψ2 ∈ C 2 (un(τ ) ∪ ω) such that: (1) Let M be a ρ-structure such that M |= ϕ and M|µ is an oriented k-tree. Then M can be expanded to a τ -structure N with N |= ψ1 and N |= ψ2 . (2) Let N be a τ -structure with N |= ψ1 , N |= ψ2 and N |µ is an oriented k-tree. Then there is a ρ-structure M with M |= ϕ and M|un(ρ)∪ω = N |un(ρ)∪ω . The proof is organized as follows: we start with an informal presentation of the proof idea, then we define the vocabulary τ and introduce the two formulas ψ1 and ψ2 . Finally we state two lemmas for the if and only if directions. The proof has the following underlying idea: We maintain counterparts ω ˆ = ˆ1, . . . , R ˆ k } to the relations symbols in ω; the R ˆ j are fresh binary relation sym{R bols. ψ1 will be based on the sentence obtained from ϕ by replacing the symbols of ω with their counterparts in ω ˆ . ψ2 will requirements about the oriented k-tree using only unary relational symbols and the symbols of ω. Consider the direction ˆ N for all j, a model M (2)⇒(1). Given a model N of ψ1 and ψ2 in which RjN = R j of ϕ can be obtained by taking the appropriate reduct of N . However, there is no ˆ N , since neither ψ1 nor way to axiomatize using ψ1 and ψ2 that indeed RjN = R j ψ2 can refer both to ω and ω ˆ . However, we will use ψ1 and ψ2 to ensure that N ˆ N by a sequence of edge swap can be transformed into a model such that RjN = R j operations; the transfomation will be such that the truth-values of ψ1 and ψ2 will remain unchanged under the swap operations. After performing the swap operations, we will obtain a model whose reduct satisfies ϕ. To guarantee that such swap operations are possible, we introduce unary relation symbols encoding startypes and axiomatize constraints on the star-types. These constraints ensure that ˆ N are sufficiently consistent to allow the transformation. the relations RjN and R j We set ρˆ = (ρ \ ω) ∪ ω ˆ . Let ρcolors be the vocabulary from Lemma 11. Let Υ = {δ ∈ ∆(ˆ ρcolors ) | δ is chromatic} be the set of chromatic star-types over ρˆcolors . We set τ = ω ∪ ρˆcolors ∪ {Pδ | δ ∈ Υ }, where Pδ are fresh unary symbols. We set ψ1 = ζ0 ∧ ∀x (ζ1 ∧ ζ2 ∧ ζ3 ), where ˆ j \Rj ] is obtained from ϕ by replacing every occurrence of a – ζ0 (x) = ϕ[R ˆj . relation symbol Rj with R ˆ j and their domain: ζ1 is – ∀x ζ1 (x) expresses the functionality of the relations R ≤1 ˆ ˆ j (x, y) → ¬Dblank (x) ∧ the disjunction over j ∈ [k] of (∃ y Rj (x, y)) ∧ ∀y (R Dj (y)) – ζ2 (x) expresses that x belongs to exactly one chromatic star-type relation Pδ : ζ2 is the conjunction of (1) the disjunction over δ ∈ Υ of Pδ (x) and (2) the disjunction over (δ1 , δ2 ∈ Υ with δ1 6= δ2 ) of (¬Pδ1 (x) ∨ ¬Pδ2 (x)) .
– ζ3 (x) expresses that if Pδ (x) holds, then x has the chromatic star-type δ: ζ3 is the conjunction over δ ∈ Υ of Pδ (x) → ϕδ (x). Clearly, ψ1 does not contain any symbol from ω. Next we set ψ2 = ∀x ζ4 ∧ ∀x∀y (ζ5 ∧ ζ6 ) ∧ ∀x ζ7 , where: ˆ j (x, y) ∈ λ – ζ4 (x) expresses that if x receives a message of type λ inside ω ˆ (i.e., R −1 for some j ∈ [k] and λ ∈ δ, where δ is the star-type of x), then there is exactly one Rj -child y that sends this message (i.e., λ ∈ δ 0 for star-type δ 0 of ˆ j (x, y) ∈ λ) of ζ4,a → ζ4,b , y): ζ4 is the conjunction over (δ ∈ Υ, λ−1 ∈ δ, R where ζ4,a = Pδ (x) ∧ Rj (y, x) and ζ4,b is the disjunction over (δ 0 ∈ Υ, λ ∈ δ 0 ) of Pδ0 (y). – ζ5 (x, y) expresses that if Rj (x, y) holds and the chromatic star-type δ of x contains an invertible message-type λ where the message of type λ is sent ˆ j (x, y) ∈ λ for some j ∈ [k]), then y accepts the required within ω ˆ (i.e., R message-type (i.e., λ−1 ∈ δ 0 for star-type δ 0 of y): ζ5 = ζ5,a → ζ5,b , where ζ5,a is ˆ j (x, y) ∈ λ) of Pδ (x) ∧ Rj (x, y) the conjunction over (δ ∈ Υ, invertible λ ∈ δ, R and ζ5,b is the disjunction over (δ 0 ∈ Υ, λ−1 ∈ δ) of Pδ0 (y). – ζ6 (x, y) expresses the if Rj (x, y) holds and the chromatic star-type δ of x contains a non-invertible message-type λ, where the message of type λ is sent within ω ˆ , then y only sends messages to nodes with 1-types different from δx (i.e., δx 6∈ Π(δ 0 ) for star-type δ 0 of y) and has the right 1-type to receive the message (i.e., δx0 = λy ): ζ6 = ζ6,a → ζ6,b , where ζ6,a is the conjunction over ˆ j (x, y) ∈ λ) of Pδ (x) ∧ Rj (x, y) and ζ6,b is the (δ ∈ Υ, non-invertible λ ∈ δ, R disjunction over (δ 0 ∈ Υ, δx 6∈ Π(δ 0 ), δx0 = λy ) of Pδ0 (y). ˆ j and Rj agree on their domain: ζ7 is – ∀xζ7 (x) expresses that the relations R ˆ the disjunction over (δ ∈ Υ, λ ∈ δ, Rj (x, y) ∈ λ) of Pδ (x) ↔ ∃y Rj (x, y). Clearly, ψ2 only contains binary relational symbols from ω. The direction (1)⇒(2) of Theorem 1 is proved by setting the Pδ according to the star-types of the eleˆ N = RM for all j: ments of M and R j j Lemma 12 The direction (1)⇒(2) of Theorem 1 holds. (See Appendix 6.11.) Now we turn to the other direction. Let N be a τ -structure with N |= ψ1 , N |= ψ2 and N |µ is an oriented k-tree. We denote M = N |ρˆcolors ∪ω . We note that all star-types realized by M|ρˆcolors are chromatic because N satisfies ∀x ζ2 and ∀x ζ3 . Let M be the universe of M. We note that the following statement holds because N satisfies ∀x ζ1 and ∀x ζ7 , and because N |µ is an oriented k-tree: both ˆ M and RM are partial functions and for all u ∈ M , there is a v ∈ M relations R j j M ˆ (u, v) iff there is a w ∈ M with RM (u, w). This allows us to make the with R j j following definition: We call an element u ∈ M bad, if there are v, w ∈ M with ˆ M (u, v), RM (u, w) and v 6= w. Otherwise, we call u good. We denote the set of R j j bad elements of M by bad (M). We point out that if bad (M) = ∅, then M|µ is an oriented k-tree and M|ρ |= ϕ. The direction (2) to (1) follows from: Lemma 13 There is a sequence of (ˆ ρcolors ∪ ω)-models M = M0 , . . . , Mp , all with the same universe M , which satisfy: (See the proof in Appendix 6.12.)
1. stpMi |ρˆcolors (u) = stpM|ρˆcolors (u) for all 0 ≤ i ≤ p, u ∈ M (we note that this implies tpMi (u) = tpM (u) for all 0 ≤ i ≤ p, u ∈ M ), 2. Silent(Mi |ρˆcolors ) = Silent(M|ρˆcolors ) for all 0 ≤ i ≤ p, ˆ j \Rj ] for all 0 ≤ i ≤ p, 3. Mi |ρˆcolors |= ϕ[R Mi M 4. Rj = Rj and sMi = sM for all 0 ≤ i ≤ p, 5. Mi |µ is an oriented k-tree for all 0 ≤ i ≤ p, 6. bad (Mi ) ( bad (Mi−1 ) for all 0 < i ≤ p, and bad (Mp ) = ∅.
4
Main Theorem
Theorem 14 (Main Theorem) Let τ0 and τ1 be distinct vocabularies. Let α ∈ MSO(τ0 ) and β ∈ C 2 (τ0 ∪ τ1 ). Let s ∈ / τ0 ∪ τ1 . There exist a vocabulary τ2 ⊇ {s} distinct from τ0 ∪ τ1 and a sentence δ = δk ∈ C 2 (τ0 ∪ τ1 ∪ τ2 ) such that the following are equivalent: (i) Exists a (τ0 ∪ τ1 )-structure M such that M |= α ∧ β and tw(M|τ0 ) ≤ k. (ii) Exists a (τ0 ∪ τ1 ∪ τ2 )-structure N such that N |= δ and sN is a binary tree. (See Appendix 6.1 for a detailed proof.) The finite satisfiability problem of α ∧ β is decidable since the finite satisfiability problem of C 2 -sentences by structures N in which sN is a binary tree is decidable [4]. The proof of Theorem 14 consists mostly of the application of a sequence of lemmas on (i), yielding statements equivalent to (i). Starting from (i) we apply Lemmas 6 and 5(2), thereby moving from structures to oriented k-trees. α and β are translated to α0 ∈ MSO and β 0 ∈ C 2 resp. by applying first s]ρ then r] . Theorem 1 is then used to remove the dependence of α0 and β 0 on the same binary relation symbols; after the application of Theorem 1, the resulting MSOsentence α00 and C 2 -sentence β 00 only share unary symbols. Lemma 5(1) moves from oriented k-trees to their encodings, by applying i] to α00 . Lemma 7 replaces the MSO-sentence i] (α00 ) by an equivalent C 2 -sentence. Now (i) holds iff there is N such that N |= ϑ and N |σ is an oriented k-tree encoding, where ϑ ∈ C 2 . It is not hard to axiomatize in C 2 oriented k-tree encodings in structures N in which s is a binary tree. Hence, (i) holds iff there is N such that N |= enc ∧ ϑ and sN .
5
MSO with Cardinality Constraints
MSOcard denotes of MSO with atomic formulas called cardinality Pr the extension Pt constraints i=1 |Xi | < i=1 |Yi |, where the Xi and Yi are MSO variables, and |X| denotes the cardinality of X. Let WS1S (WS1Scard ) be the weak monadic second order theory (with cardinality constraints) of the structure hN, +1,