Manuscript Offprint
arXiv:2610.39108Deciding two-variable logic with global and local Presburger quantification
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
We look at a two-variable logic over finite graphs that allows Presburger quantifiers: linear arithmetic inequalities between the number of elements that satisfy subformulas. The prior literature shows that closing two-variable logic under Presburger quantification leads to undecidability, while closing under local quantification – the counts are always over neighbors of a given node – preserves decidability. Here we show decidability of satisfiability for an intermediate logic that allows both local counts and global counts, but where the linear constraints do not mix the two. The proof requires a significant extension of the prior machinery developed for two-variable logic with counting.
As a corollary we obtain decidability of satisfiability for an important family of Graph Neural Networks (GNNs). GNNs are a popular graph learning formalism. For example, in a variation of GNNs considered in the past literature, local aggregation is used in each layer to create modified values at each vertex of a graph, and then global aggregation is used in a final layer to obtain a single numerical value for the graph as a whole. Our logic is motivated by the fact that mixing of local counting and global aggregation in GNNs has been shown to lead to undecidability. Our results here show that if global and local aggregation are separated, one regains decidability. Decidability of other static analysis problems, like equivalence of GNNs, follows from the decidability of satisfiability.
2012 ACM Subject Classification Theory of computation → Logic and verification
Keywords and phrases Presburger quantifiers, Spectrum, Guarded logics
Digital Object Identifier 10.4230/LIPics...
© Michael Benedikt, Chia-Hsuan Lu, Alex Perry, and Tony Tan; licensed under Creative Commons License CC-BY 4.0
Leibniz International Proceedings in Informatics
Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany
XX:2 Deciding two-variable logic with global and local Presburger quantification
1 Introduction
First-order logic is well known to have an undecidable satisfiability problem over finite structures, even when we restrict to vocabularies with unary relations and a single binary relation [7]: we refer to this as a graph signature below. This contrasts with the following two decidability results. Presburger arithmetic, which uses only additive arithmetic over the integers, is decidable: there is a procedure taking a sentence using +, < and constant symbols, and determining whether it holds in the integers. Two-variable logic (FO²) is decidable over finite graphs: there is a procedure taking a sentence in a graph signature in which every formula has at most two variables, determining whether there is some finite structure for the signature where it holds. Various attempts have been made to combine these paradigms. For example, BAPA [15] is a decidable two-sorted logic extending logic over an uninterpreted unary signature with Presburger arithmetic. Two-variable logic with counting (C²) [12, 18, 20] is another fragment of first-order logic, decidable over finite structures. It extends FO² with fixed counting quantification – e.g. “there are at least five such that ”. Guarded two-variable Presburger logic [3, 16], GP², is a language incomparable in expressiveness with C², allowing linear arithmetic comparison between unbounded counts, but only counts of the number of neighbors of a given node satisfying a subformula. Thus one can express, for example, a property of a node in a colored graph like “ has twice as many green neighbors as it has red neighbors”. It is easy to define a more general Presburger quantifier (P²) allowing formulas in a free variable via linear inequalities between the counts of subformulas . But this language has an undecidable satisfiability problem [2].
Our main contribution is a decidable logic over finite graphs (without self-loops, the default below) intermediate between GP² and P², allowing both “local Presburger quantification” – arithmetic inequalities over the number of neighbors of a given node satisfying a subformula – as well as “global Presburger quantification” – arithmetic inequalities over the number of nodes in the entire graph satisfying a formula. This logic GandLP² is the first extension of BAPA and GP² known to be decidable over finite structures. While we do not have tight complexity bounds for our full logic, we consider a variant over directed graphs where aggregation is restricted to one direction, namely “outgoing neighbors”; for this logic, we show satisfiability is NEXP-complete.
As a consequence of our main result, we provide a new decidability result for graph neural networks (GNNs), the dominant formalism for graph learning. We consider a model originating from [1]: aggregate-combine GNNs with truncated ReLU activations and global readout. GNNs can be used to define Boolean queries on nodes in graphs, just as a logical formula with one free variable would. They are formed in layers which alternate applying a traditional neural network on fixed-size vectors with summation to aggregate an unbounded number of vectors into one. “Truncated” refers to the fact that the neural networks do not use the standard piecewise linear ReLU function as building blocks, but rather an analog that is constant going out to infinity in each direction. “Global readout” refers to the fact that there are two kinds of aggregation, one over neighbors of a given node, and another over all nodes: analogous to the two quantifications in our logic. Several prior works [17, 26, 25, 6] studied satisfiability for variations of these models. [6, 17] showed that satisfiability with only local aggregation was decidable, while [6] showed that aggregations that mix global and local in the same layer lead to undecidability. [8] showed decidability for “quantized GNNs”, where every operator works on a finite domain. The case where we have local aggregation and also global readout, but not in the same layer, was left open – even though global readout is generally used only standalone at the final layer. Decidability of these GNNs with unmixed
XX:3
global readout easily follows from the main result on GandLP².
To prove our main result, we require new machinery for analyzing models of GP², building on and substantially extending the infrastructure developed in prior work on logics over uninterpreted finite graphs with arithmetic [3, 18, 22, 21, 24]. One idea from prior work is to describe the structures satisfying a formula using linear inequalities over variables representing various cardinalities of a structure. [4] presented an obstacle to extending this method to mix local and global counting. The 1-type spectrum is the collection of tuples of numbers associated with a GP² sentence – for each finite structure, it includes the vectors of sizes for each Boolean combination of unary atoms. [4] shows that this may not be semilinear. We work around this by not describing a structure directly, but rather an associated decomposed structure, in which the behavior of elements is decomposed into different vector components.
Logic with Presburger quantifiers. Let be a vocabulary consisting of unary and binary predicates.
► Definition 2 (Structure). A structure for a vocabulary with unary and binary symbols in this work will consist of a nonempty finite domain, along with an assignment of each unary relation to a finite set of elements (sometimes called nodes or vertices), and an assignment of each binary relation to a set of pairs of elements, without self-loops: that is, without a pair being assigned.
We review logics with Presburger quantifiers, originating with [3].
► Definition 3 (Local and global Presburger quantifiers). A local Presburger quantifier is of the form: , where ; each ; each is a formula with free variables from , is an atom or , and is one of , , , , , or \mathcal{P}(x)x\mathcal{P}(x) := \sum_{t \in [k]} \lambda_t \cdot #_y [\varphi_t(y)] \oplus \delta\lambda_t, \oplus\delta\varphi_t(x)x$ the only free variable.
The semantics of these quantifiers is given inductively, assuming a semantics for , and . The semantic function takes as arguments a structure and valuation for the free variables. Free variable convention for Global Presburger quantifiers Although the truth value of is independent of the assignment to , we still treat it as a formula with
XX:4 Deciding two-variable logic with global and local Presburger quantification
one free variable : the semantics will either assign true to every element of the domain or to none.
For the local quantifier, given a structure and an element in , we say that holds in , denoted by , if the following (in)equality holds in :
The semantics for the global quantifier is defined in a similar manner. Each is interpreted as the number of elements in that satisfy .
Note that the semantics of all logics considered here is over finite structures, since finiteness guarantees that the linear inequalities in Presburger quantifiers are applied to ordinary integers. Since this will be our default, we say that a sentence is satisfiable if there is a finite structure where it holds, and similarly for formulas with free variables.
► Definition 4 (GandLP). The syntax of global and local two-variable Presburger logic (GandLP) over vocabulary is built up starting with arbitrary relational atoms over the vocabulary, with closure under the usual connectives and the following rules for quantifiers.
If is a formula, then so are and .
If is a formula, then so are and , where is an atom involving both variables and .
(Pure local Presburger formula) If are formulas and are atoms involving both and , then is a formula.
(Pure global Presburger formula) If is a set of formulas, then is also a formula.
The inductive definition of free variables of a formula and the semantic function are straightforward, keeping in mind our convention about global Presburger quantifiers having an implicit free variable.
Note that the standard existential quantification can easily be expressed using Presburger quantifiers, and thus extends , the guarded two-variable first-order logic with counting. It also extends the guarded fragment of two-variable logic with Presburger quantifiers () [3, 4, 16], the fragment of obtained by excluding pure global Presburger formulas. For example, is a sentence of that holds in a directed graph when there is an element that has 3 times as many outgoing edges as incoming edges. also allows us to express cardinality constraints on the structure as a whole. For example, is a formula that holds of a node in a structure when the size of the predicate is at least twice the size of the predicate . In fact, up to equisatisfiability, and cardinality constraints on the structure are essentially all can express: see Lemma 16.
Our main result can now be stated:
► Theorem 5 (GandLP decidability). Satisfiability of is decidable.
The modal variant of . We define the natural modal variant of : Local Presburger quantifiers that aggregate only over out-neighbors , where now must be an atom . Similarly, we restrict the use of universal and existential quantifiers to the modal case: If is a formula, then so are and , for some binary relation .
This “modal” restriction simplifies decidability considerably.
XX:5
► Theorem 6. Satisfiability of the modal variant of the logic is NEXP-complete.
In fact, we get decidability even allowing mixing of global and local counting within Presburger quantifiers. Note that the outgoing-only result is quite similar to results of [17, 28], and the technique we use is a variation of one introduced for another logic in [13, 10].
GNN analysis. We now apply the results to the analysis of graph neural networks (GNNs).
► Definition 7 (Truncated ReLU). Truncated ReLU (TrReLU) is the function from to that is the identity on , for , and zero otherwise. We extend this function to vectors by applying it pointwise.
► Definition 8 (Colored graph). Following prior work (e.g. [6]), we consider a GNN model that takes as input -color graphs for some non-negative integer . These are standard directed (finite) graphs without self-loops, extended with unary predicates (colors) representing the colors. Formally, it is a graph , where each . We do not require the sets to be pairwise disjoint. Note that this restricts structures over to the case with only one binary relation , thus our logics also apply to colored graphs.
► Definition 9 (Syntax of GNNs). A graph neural network (GNN) is a tuple
, where is the number of layers; each , called the dimension of the layer, requiring , the number of colors, each , the coefficient matrices of the layer; and , the bias vector of the layer. We also require for each .
► Definition 10 (Feature of a GNN, computation of GNNs). For a GNN and a graph , the computation of on is a sequence of functions defined inductively on . For , is called the -feature vector of w.r.t. , and denotes the entry of . For brevity we sometimes omit when it is either clear from context or irrelevant. We also shorten “feature vector” to “feature” at times.
For , is the encoding of the colors of the vertex , with a one at an index exactly when holds. This is also called the initial feature vector of . Formally, for , if , then ; otherwise, . For , where
► Definition 11 (Pure layers and non-mixing GNNs, outgoing-only). We say that the layer of a GNN is pure global if both and are zero. It is pure local if is zero. A layer is pure if it is either pure global or pure local. Intuitively, this means that the features in a layer depend either only on global aggregation or only on local neighborhood aggregation, but never on both. A graph neural network is non-mixing if all of its layers are pure. It is outgoing-only if the coefficients of matrices corresponding to are all zero.
► Definition 12 (Boolean semantics of GNNs). For a GNN , a graph , and a node in , we say that accepts the tuple , if .
XX:6 Deciding two-variable logic with global and local Presburger quantification
With the Boolean semantics, we can define several verification problems for GNNs. The most basic one is the satisfiability problem.
► Definition 13 (Satisfiability of a GNN). For a GNN , we say that is satisfiable, if there exist a graph and a node in , such that accepts .
► Corollary 14. Satisfiability for non-mixing GNNs with TrReLU activations is decidable.
The derivation of Corollary 14 is analogous to Theorem 4.12 in [6], which translates GNNs into equiexpressive logical formulas. Observe that, when the input GNN is non-mixing, the construction in [6] produces a formula. Hence, the satisfiability problem for non-mixing GNNs reduces to the corresponding satisfiability problem for , which is decidable by Theorem 5.
3 High-level proof outline
We now give an overview of the proof of Theorem 5.
We now give a normal form for the logic. We begin by defining atomic global cardinality constraints, which are the simplest form of global Presburger quantifiers.
► Definition 15 (Global Cardinality Constraint). An atomic global cardinality constraint (GCC) over is a formula of the form
where and are unary predicates in . A GCC over is built from atomic GCCs using logical connectives. We say that a -structure satisfies the atomic GCC if the inequality holds. The semantics of general GCCs is straightforward.
Every sentence can be effectively converted into a conjunction of a sentence in normal form and a GCC. The proof is standard, so we defer it to the appendix.
Convention: for brevity, we often write where is a 1-type and is quantifier-free, to indicate that for every loopless finite structure, every element satisfying satisfies . It is straightforward to check this effectively.
► Lemma 16 (Normal form). Every sentence can be effectively converted to a sentence of the form over an extended vocabulary where is a sentence in normal form:
with is quantifier-free and asserts that holds for each binary relation , each a binary atom, each quantifier-free, each a unary atom, each is a “lower bound Presburger quantifier”, of the form
with each a binary atom, while is a GCC defined in Def. 15, such that has a model of size if and only if has a model of size .
In what follows we fix a sentence in the normal form as above, and let be the formula obtained from by discarding the outer quantifier , i.e., .
XX:7
► Definition 17 (1-type, 2-type,dual 2-type). A 1-type (resp. 2-type) is a maximal consistent subset of and , respectively.
The null 2-type is the 2-type in which every atom appears negatively. For a given 2-type , let denote the dual of , where the variables and are swapped.
For a structure , the 1-type of an element is the unique 1-type that satisfies in . Similarly, the 2-type of a pair of elements, where , is the unique 2-type that satisfies in . Note that if the 2-type of is , then the 2-type of is . Further, if the 2-type of is the null 2-type, so is the 2-type of .
An element with 1-type is also called a -element. An element is an -neighbor of if the 2-type of is . It is called a -neighbor of if it is a -element and an -neighbor of .
Both 1- and 2-types can be identified with the conjunction of their constituent formulas. When viewed as formulas, we write types as and . By default, a 1-type will be a formula with as free variable; we write to denote the same 1-type but substituting with in .
► Definition 18 (Asymmetric types, Conformant types). A 1-type is conformant (w.r.t. ) if .
An asymmetric 2-type is a 2-type which is distinct from its dual 2-type.
A 2-type is conformant with 1-types and (w.r.t. ), if it is asymmetric, and for every ,
Note that while the null 2-type is conformant with any choice of 1-types and , it does not affect the satisfaction of local Presburger quantifiers, which merely count elements adjacent via some binary relation.
Thus, throughout the remainder of this paper, by default we will use the term “2-types” to mean “non-null 2-types”, and explicitly highlight whenever null 2-types are allowed.
We let OneTps be the set of conformant 1-types, and TwoTps be the set of asymmetric 2-types conformant with and . Both sets can be constructed effectively from and . Since we fix , we will omit the superscript and write OneTps and TwoTps.
► Definition 19 (Asymmetric structure, Asymmetric satisfiability). An asymmetric structure is one where every pair of distinct elements realizes an asymmetric 2-type as in Definition 18 or a null 2-type. The asymmetric satisfiability problem asks whether a sentence in is satisfiable in an asymmetric (finite) structure.
► Proposition 20. For any vocabulary , there is an expansion to so that every structure can be expanded to an asymmetric structure. In particular, the satisfiability problem for reduces to the asymmetric satisfiability problem.
Proof. Suppose is a structure over witnessing . Let be a fresh binary predicate not in . Let be the expansion of to the vocabulary in which the predicate is interpreted as follows: for every two distinct elements such that satisfies some relation symbol, we pick arbitrarily a pair and set to be in and the reverse to be not in . Then, the structure is asymmetric as required.
XX:8 Deciding two-variable logic with global and local Presburger quantification
By Proposition 20, it suffices to show that asymmetric satisfiability is decidable, and this is what we will do.
Our goal is to characterize a structure using a vector of integers. We start with characterizing a single element in a structure.
► Definition 21 (Behavior). A behavior beh is a vector of non-negative integers indexed by a 2-type and a 1-type. We write beh(η, π) to denote the entry for 2-type η and 1-type π. We say that a beh is the behavior of an element v, if for each 2-type η and target 1-type π, beh(η, π) is the number of (π, η)-neighbors of v.
Observe that whether an element satisfies the GP² formula φᵥ(x) depends only on its 1-type and its behavior. More precisely, let and be structures, and let be an element in and be an element in . If and have the same 1-type and the same behavior, then if and only if . This motivates the following notion of a conformant behavior, which formalizes when a behavior is compatible with .
► Definition 22 (Conformant behavior and ). We say that a behavior beh is conformant with and (or equivalently, with and ) if there exists a structure and an element in with behavior beh and 1-type such that
-
;
-
for every element in , has a conformant 1-type, and for every pair of elements in with , has conformant 2-type or null 2-type.
We denote this set as , the set of behaviors conformant with and .
Recall the definition of hybrid linear set, a strengthening of semilinearity from Definition 1. The following result is easily shown (see Appendix D):
► Proposition 23. For any 1-type , , the set of conformant behaviors is hybrid linear, and a hybrid linear representation can be effectively generated from and .
Accordingly, we define the following bases for conformant behaviors, which can also be computed effectively.
► Definition 24 (Basis for conformant behaviors, , , and ). For every 1-type , we construct vectors of non-negative integers and a set of vectors of non-negative integers , where every is not the zero vector, such that . We let be the set .
Note that forms a union of linear sets sharing the same finite set of period vectors. This follows from the fact that is defined by a quantifier-free Presburger formula without disjunction – it is a conjunction of linear (in)equalities in the Presburger quantifiers.
Fixing all these vectors 's and 's, we define the notion of local behavior vector, which records its base index and the multiplicities of its periods.
► Definition 25 (Local behavior vector (LBV), realizing lbv, valid, homogeneously valid). Let be a 1-type. A local behavior vector (LBV) lbv of a 1-type is a vector of non-negative integers with entries. We denote its entries by for and .
We say that lbv is valid if there is exactly one such that , and for , . This unique index is called the base index of lbv. We say that lbv is homogeneously valid if for every .
XX:9
The behavior generated by is: .
Given a structure , an element realizes if its behavior is . In this case, we say that is an LBV of .
► Remark 26 (Non-unique representations). Although we have used the term “basis” for the representation of our hybrid linear set in Definition 24, we emphasize that this does not give a unique representation, as one would have from a basis for a vector space: The LBV realized by a vertex is not necessarily unique. Indeed, it is possible for two distinct valid LBVs to generate the same behavior. We can say that an element realizes some valid LBV of 1-type whenever its behavior is in the set .
Having discussed local behavior vectors, which capture local neighborhoods, we introduce the notion of global behavior vector (GBV). While an LBV represents a behavior of a given element, a GBV will give a global description of a structure. Intuitively, a GBV records the multiplicities of behaviors in a structure. It will do this not in terms of the number of occurrences of each conformant behavior – since there are infinitely many – but in terms of the base and period components given by the hybrid linear representation.
More precisely, for each 1-type, a GBV counts the occurrences of the base and period components of the conformant behaviors. In doing so, however, it loses the information about the connectivity of the structure and which period components belong to the same element.
► Definition 27 (Global behavior vector (GBV), slice). A global behavior vector (GBV) is a vector with entries. We denote its entries by for , , and .
The slice of on 1-type , denoted by , is a vector with entries where for , and , .
We illustrate the different notions of behavior in Figure 1.
We now define the notion of realization between structures and GBVs. Intuitively, a GBV is realized by a structure if is the sum of LBVs of all vertices in .
► Definition 28 (Structure realizing a GBV, realization witness). Let be a structure. We say that realizes a GBV if there exists a mapping witness from the vertices of to valid LBVs such that 1. for every element , realizes witness() (Def. 25) and 2. for every , the slice of on is precisely the sum of witness() over all elements of 1-type in .
The mapping witness is called a witness of the realization.
We can show that a structure satisfies if and only if it realizes some GBV. Indeed, if does not satisfy , then there exists an element of with 1-type that does not satisfy , and hence, its behavior is not in . Thus, such a mapping does not exist, and realizes no GBV. Conversely, if satisfies , then every element of satisfies , and in particular, its behavior is in , where is the 1-type of . Thus, the mapping witness that maps every element to its LBV is the witness for realizing some GBV.
Note that since there may exist multiple LBVs that generate the same behavior, a structure may realize multiple GBVs. Our goal is to reduce the satisfiability of to the existence of a realizable GBV for a given hybrid linear set, which in turn is reduced to the satisfiability of Presburger formulas.
Overapproximation of GBVs realized by models of formulas; D-structures. It is easy to see that a GCC, which constrains cardinalities of elements in a structure, implies
XX:10 Deciding two-variable logic with global and local Presburger quantification

Figure 1 Illustration of behavior, local behavior vector, and global behavior vector.
a linear constraint over a GBV, with variables corresponding to the numbers . We can combine this with some other sanity conditions to derive an overapproximation Presburger formula for GBVs realized by models of . This is formally defined in Section 4.1. An example of a sanity condition is a matching constraint saying that the sum of the entries corresponding to a given 2-type is the same as the sum of entries for the dual of the 2-type as defined in Def. 17.
However, not all GBVs in the overapproximation are realizable. This brings us to the main and most involved part of our proof: deciding whether there is a realizable GBV in a given hybrid linear set.
Let us fix a representation and , and let be the solution set of the corresponding overapproximation. We will show that necessary and sufficient conditions for in to be realizable by a structure can be encoded as a Presburger formula.
First, we show that every satisfying the overapproximation is realizable by what we call a decomposed structure (-structure). Intuitively, a D-structure is a relaxation of a structure where we allow phantom elements and multiple 2-types between two elements. For technical convenience, we define D-structures in terms of directed multigraphs.
► Definition 29 (D-structure, phantom vertex). A D-structure is a nonempty directed, node-and edge-labelled multigraph , where 1. is the set of concrete vertices and is the set of phantom vertices, where we require and to be disjoint. 2. is the multiset of directed edges, 3. labels vertices in by 1-types, and 4. is a mapping that assigns a 2-type to each edge .
► Definition 30 (implicit -edge, explicit -edge, -edge). We refer to an edge from to as an explicit -edge if . We will also refer to it as an implicit -edge from to . An -edge from to is either an explicit -edge from to , or an implicit -edge from to .
The behavior of a vertex , denoted by , is the vector whose -entry is the number of distinct -edges from to vertices with .
A -structure is phantomless if it contains no phantom vertices, i.e., .
A -structure is asymmetric if all two-types associated with edges between distinct nodes are asymmetric.
A -structure is a kind of pre-model in which there are two obstacles to being a proper model. First, there can be multi-edges connecting two vertices: multiple directed edges,
XX:11
possibly in different directions and possibly assigned to different 2-types, which a model does not allow. Second, the behavior that we ultimately want for a node in a real structure might be split between a concrete node and one or more phantoms. Phantoms represent partial behaviors that may not be conformant, but can be merged with a concrete vertex while maintaining conformance. In certain situations – and under further restrictions – a subset of the phantoms can be pumped to make a D-structure larger, which is useful for enabling swapping, which in turn will allow the removal of multi-edges. Lastly, we emphasize that D-structures allow self-loops: edges or multi-edges where the source and target are the same. Note that a phantomless D-structure without multi-edges and self-loops corresponds to a structure where the 2-type of a non-edge is the null 2-type.
► Definition 31 (Realization of a GBV in a D-structure). We extend the notion of a structure realizing a GBV to D-structures. This requires a realization witness map as in Def. 28, but mapping the concrete vertices to valid LBVs and the phantom vertices to homogeneously valid LBVs, where these notions are defined in Definition 25.
The intention is that when we merge a concrete vertex with 1-type with a non-adjacent phantom vertex with the same 1-type , its behavior will stay in the hybrid linear set .
We observe that the following operations on D-structures preserve GBVs, and also preserve asymmetry of a structure. They will be used to transform D-structures to structures.
► Lemma 32. For a D-structure , each of the following operations preserves the realized GBVs. 1. (Merge) Merge a phantom vertex into a concrete or phantom vertex , where . We will typically apply this where we want to preserve the property that there are no self-loops. In such a case, we must further require that and are not adjacent. 2. (Swap) Let be an -edge from to , and an -edge from to with and . Suppose that and are distinct. Remove the edges and . Add an edge from to and an edge from to . Assign the 2-types so that .
Conditions for realizability of a linear set of GBVs. We now introduce the conditions under which a D-structure whose GBV is in can be transformed into another structure whose (possibly different) GBV is also in . Then we show how to encode these conditions in a Presburger formula.
From and we can deduce which 1-types have a bounded number of vertices for every structure realizing a GBV in . These are called king 1-types. The rest are called peasant 1-types. We will be interested in the scenario where a D-structure realizing a gbv in can be decomposed into two disjoint D-structures – the kernel and the village – with realizing some GBV in and realizing some GBV in . The kernel has a bounded number of vertices and a bounded number of edges. Both bounds can be computed effectively from and .
In the decomposition, we can impose additional conditions on the kernel such as:
K1. Only phantom vertices may have peasant 1-types. We call concrete vertices with king 1-types kings, non-king concrete vertices nobles, and phantom vertices phantom nobles.
K2. Multi-edges cannot involve kings. Kings cannot have self-loops.
A village which is compatible with a given kernel will have the following properties:
V1. All phantom vertices have king 1-types, while concrete vertices in the village have peasant 1-types. We call the phantom vertices shadows and the concrete vertices peasants.
V2. There are no edges between shadows. Multi-edges cannot involve shadows. There are no self-loops in the village.
XX:12 Deciding two-variable logic with global and local Presburger quantification
V3. There is a 1-type preserving bijection between village shadows and kings in the kernel.
V4. For a phantom noble in the kernel, there is a peasant in the village with the same 1-type.
V5. For every multi-edge in the kernel, there is a pair of peasants in the village with 1-types matching the endpoints of the edge in the kernel and the same 2-type as the edge.
V6. For every self-loop with 2-type in the vertex with 1-type in the kernel, there is a pair of peasants in the village with and an edge with between them.
See Figure 2 for an illustration.

Figure 2 Illustration of (a) a kernel and (b) a compatible village. Concrete vertices are drawn with solid outlines (vertices 1-7 and 12-15), and phantom vertices are drawn with dashed outlines (8-11). Vertices of king 1-types are shown in red (1-3 and 9-11), while vertices of peasant 1-types are shown in blue (4-8 and 12-15). The gray arrows indicate the bijection between kings and shadows in the condition shadow-king correspondence.
To obtain a structure from a kernel and village compatible with , we have a pumping theorem (see Theorem 54). We create enough copies of villages so that we can:
-
Merge the shadows in the villages with the kings in the kernel according to the bijection defined in V3. Note that, by conditions K2 and V2, no multi-edges involving kings are created by this merging process.
-
Merge each phantom noble in the kernel with an appropriate peasant in the village. Condition V4 guarantees that such a peasant exists. After these first two steps, every vertex satisfies the local conditions, and no phantom vertices remain. It remains to eliminate the multi-edges.
-
Eliminate the multi-edges arising from the peasants in the villages. Sufficient pumping guarantees that we can always find suitable swap partners.
-
Eliminate the remaining multi-edges arising from the phantom nobles in the kernel. Condition V5 guarantees that, after enough pumping of the villages, suitable swap partners are available.
-
Eliminate the remaining self-loop arising from the nobles and phantom nobles in the kernel. Condition V6 guarantees that, after enough pumping of the villages, suitable swap partners are available.
See Figure 3 for an illustration.
For a fixed kernel , we construct a Presburger formula describing a decomposition into a village for the kernel, or just “village formula” below. Informally, the village formula will be a linear system whose solutions represent a village compatible with the kernel such that the union realizes a GBV in . Our main theorem then breaks down into two further components: 1. A satisfiability-to-solvability theorem (Theorem 70): Existence of a structure realizing a GBV in implies existence of a kernel and solvability of the corresponding constraints. 2. A solvability-to-village-existence theorem (Theorem 65): Given a kernel , the solvability of the corresponding constraints implies existence of a village compatible with . Note that, by the pumping theorem, this implies the existence of a structure realizing a GBV in .
XX:13

Figure 3 Illustration of the pumping argument. The construction starts with one kernel and three disjoint copies of a village. The green edges all have the same 2-type and connect vertices of the same 1-types. Similarly, the magenta edges all have the same 2-type and connect vertices of the same 1-types. The vertices marked with × have the same 1-type. In Steps 1 and 2, we merge the corresponding shadows in the three village copies with the kings in the kernel. We also merge each phantom noble in the kernel with a peasant of the same 1-type in one of the village copies. Condition V4 guarantees the existence of such a peasant. In Steps 3 and 4, we apply the swapping operation to the green and magenta edges to eliminate the resulting multi-edges. Since the green (respectively, magenta) edges originate from corresponding edges in different copies of the same village, they all have the same 2-type. Condition V5 guarantees that a suitable edge is always available for each swapping operation.
Combined with the pumping theorem, which allows us to obtain a model from a kernel and compatible village, we complete the proof. The details are in Section 4.
4 Proof of Theorem 5
We now flesh out the outline, referring to the notation from Table 1.
| OneTps | set of 1-types conformant with (Def. 18) |
|---|---|
| TwoTps | set of non-null 2-types conformant with and 1-types and (Def. 18) |
| set of behaviors of 1-type (Def. 24) | |
| homogeneous set of behaviors of 1-type (Def. 24) | |
| base vector for the behaviors of 1-type (Def. 24) | |
| period vector for the behaviors of 1-type (Def. 24) | |
| number of base vectors for the behaviors of 1-type (Def. 24) | |
| number of period vectors for the behaviors of 1-type (Def. 24) | |
| evaluation of the local behavior vector (Def. 25) |
Table 1 Summary of notation.
We need some terminology to describe components of GBVs.
► Definition 33 (GBV incorporating 1- and 2-types, basely or periodically). Let gbv be a GBV.
XX:14 Deciding two-variable logic with global and local Presburger quantification
-
gbv incorporates a 1-type basely if gbv(, base, ) > 0 for some .
-
gbv incorporates a 1-type periodically if gbv(, period, ) > 0 for some .
-
gbv incorporates a 1-type if gbv incorporates either basely or periodically.
-
gbv incorporates a 2-type between and if either
-
there exists such that gbv(, base, ) > 0 and , or
-
there exists such that gbv(, period, ) > 0 and .
Intuitively, a GBV records which 1-types and 2-types must appear in a realization, and whether the corresponding 1-types are witnessed by concrete or phantom vertices.
We record the following simple consequences of the definitions:
► Lemma 34. Let gbv be a GBV and be a -structure that realizes gbv.
-
If gbv incorporates a 1-type basely, then there exists a concrete vertex in realizing .
-
If gbv incorporates a 1-type periodically but not basely, then there exists a phantom vertex in realizing .
-
If gbv incorporates a 2-type between and , then there exist nodes and and an -edge from to in (as in Definition 30) with and .
Proof. We start with the first item. Note that by Definition 31, the witness map assigns each phantom vertex a homogeneously valid LBV: one where the coefficients corresponding to base vectors are all zero. In particular this is true for vertices with 1-type . We also know from Definition 31 that the slice of gbv on is the sum of the LBVs associated (via the witness map) to vertices with 1-type . If there are only phantom vertices with 1-type , this means that for each component of the slice of gbv on , given by some index , that component of the slice is the sum of the witness-defined LBVs of phantom vertices, and for a base component this would be zero by homogeneous validity. But this would mean that each base component of the slice of gbv on is zero, contradicting the fact that is incorporated basely.
For the second part, suppose that gbv incorporates a 1-type periodically but not basely. We first show that there is no concrete vertex in with 1-type . Suppose, for contradiction, that is such a vertex. Then witness() is a valid LBV, which implies that there exists some such that witness()(base, ) > 0. Thus, gbv(, base, ) witness()(base, ) > 0, contradicting the assumption that gbv does not incorporate basely. We next show that there exists a phantom vertex in with 1-type . Again, suppose for contradiction that there is no such vertex. Since there is also no concrete vertex with 1-type , there is no vertex with 1-type in . It follows that gbv(, period, ) = 0 for every . This contradicts the assumption that gbv incorporates periodically.
For the third part, suppose gbv incorporates a 2-type between and . The definition requires one of two options, and the proofs are similar in both cases. Let us only consider the first option: there is a base component present that includes an edge to : there exists such that gbv(, base, ) > 0 and . Fix such an . For , the witness map must assign some vertex a LBV in which the base component is non-zero: otherwise gbv could not have a total for the base component above zero. Since this base component has a non-zero entry for and and realizes the LBV, there must be a as required, completing the argument in this case.
We need a few more quantities associated with a GBV.
► Definition 35 (Size and base size of a GBV). Let gbv be a GBV. The size of gbv, denoted by , the base size of gbv, denoted by , and the -base size of gbv for 1-type ,
XX:15
denoted by , are defined by
Intuitively, the size of a GBV gbv counts the total number of components, while the base size counts only base components. In particular, the number of concrete vertices in a D-structure realizing gbv is the base size of gbv.
▶ Lemma 36. Let gbv be a GBV, and let be a D-structure realizing gbv. Then the number of concrete vertices in is exactly , and the number of concrete vertices with 1-type in is exactly .
Proof. Let witness be a witness of realizing gbv. Recall that witness maps every concrete vertex of with 1-type to a valid LBV lbv of . And validity means that there exists exactly one such that , and for every with .
For every , let be the set of concrete vertices of such that has 1-type and witness. Clearly, the sets partition the set of concrete vertices of with 1-type . Let denote this set.
Observe that . Moreover, by the definition of a realization witness, . Hence,
Similarly, the total number of concrete vertices is exactly
Since the entries of every GBV are non-negative integers, the size is additive: . The same property also holds for the base size.
4.1 Overapproximation of GBVs for a GandLP sentence
We now move to the next part of the proof outline, obtaining an overapproximation Presburger formula which will be denoted by . Here, is a tuple of variables used to encode a GBV; we index its coordinates in the same way as the entries of a GBV.
XX:16 Deciding two-variable logic with global and local Presburger quantification
► Definition 37 (OverApprox , MATCH, STRUCT, LIFTGCC). We define OverApprox , where
and LIFTGCC(r) is obtained from gcc by replacing every term with ,
where OneTps is the set of conformant 1-types that contain .
The constraint STRUCT(r) requires that if a 1-type is incorporated periodically, then must also be incorporated basely. This property always holds in a structure, since structures contain no phantom vertices. The formula LIFTGCC(r) encodes the GCCs. It is routine to show that OverApprox is an overapproximation of the set of GBVs realized by models of .
► Lemma 38. Let be structure. If is a model of , then for every GBV gbv realized by , gbv is a solution to OverApprox .
Proof. Let be a model of . In particular, holds in for every element in , and hence its behavior is in with the 1-type of and therefore its LBV is valid.
Let witness be the witness that maps each element to its LBV and let gbv be the GBV whose slice on each 1-type is the sum of the LBV associated by the witness map of -elements. We verify that GBV satisfies each condition in OverApprox.
Observe that is the number of -edges (Definition 30) from to such that and . Note that if is an -edge from to , then it is also an -edge from to , it follows that and are the same. Hence, holds.
We comment that for this part, we just use that gbv is a global behavior vector of a structure, regardless of whether the structure satisfies any formula.
For every 1-type , suppose that for some . By the definition of the realization witness for a GBV in Definition 28, the value is the sum of the -entries of the witness of vertices in satisfying 1-type , which implies that there exists a vertex with . Since is a valid LBV (Def. 25), there exists , such that . By the definition of realization witness of GBV, this implies that .
Suppose that satisfies the atomic GCC . By the semantics of GCCs, it holds that . For every element in satisfying 1-type , since is a valid LBV, we have .
Therefore . The case for a general GCC can be
XX:17
proven inductively. It follows that the corresponding lifted GCC constraint for atomic GCC holds. The result for a general GCC then follows by induction on its structure.
Although is only an overapproximation, the only “excess” GBVs satisfied in it are those that are not realizable in any structure: whenever a structure realizes a GBV satisfying , is a model of the sentence :
► Lemma 39. Let be a structure. If realizes some GBV , then is a model of .
Proof. Recall that is a sentence in normal form, and is the formula obtained from by removing the outermost quantifier . By the definition of conformant behaviors, the behavior realized by an element of is conformant (w.r.t ) if and only if .
Let witness be a witness to the realization of by . By definition, is a valid LBV for every in . Hence, the behavior realized by , namely , is conformant. It follows that for every in , and therefore .
It remains to show that . We use the same correspondence as in the argument for LIFTGCC() in Lemma 38. For every unary predicate , the validity of ensures that each element of contributes exactly once to the base component corresponding to its 1-type. Consequently, , where is the set of conformant 1-types containing . Thus, for every atomic GCC of the form , its interpretation in satisfies . Hence, an atomic GCC holds in if and only if its corresponding lifted constraint holds for . By induction on the Boolean structure of , we conclude that .
Finally, we note that if we allow -structures rather than structures, there is no overapproximation: We begin with the following building block for the matching constraint involving a pair of 1-types and a 2-type.
► Lemma 40 (Rewiring lemma). Let be 1-types and be an asymmetric 2-type as in Definition 18. Let be a -structure, be the set of concrete and phantom vertices of with 1-type , and be the set of concrete and phantom vertices of with 1-type . Suppose that for every , ; and for every , . Let and be functions satisfying the “local match equation” .
Then there exists a -structure with the same sets of concrete and phantom vertices as , obtained by adding edges of 2-type between vertices in and , such that:
-
For every vertex , .
-
For every vertex , , while all other entries of coincide with the corresponding entries of .
-
For every vertex , , while all other entries of coincide with the corresponding entries of .
-
For every vertex such that , .
Furthermore, if is asymmetric, the new structure is asymmetric as well.
XX:18 Deciding two-variable logic with global and local Presburger quantification
Intuitively, the functions and specify the intended behavior entries of the vertices in and , respectively: specifies the intended -entry for each , while specifies the intended -entry for each . We show that, whenever these functions satisfy the “local match equation”, the D-structure can be extended so that every vertex in realizes its intended behavior entry.
One application of Lemma 40 is the following lemma concerning MATCH.
► Lemma 41 (Assembling a D-structure from a MATCH solution). For every gbv satisfying MATCH, there exists a D-structure realizing gbv. In particular, this holds for any gbv satisfying .
The proof is also deferred to Appendix E.
The gap between and the set of GBVs realizing models of is that may contain GBVs that are not realized by any structure. Thus, by Lemma 39, we can reduce the finite satisfiability problem of to the realizability problem of .
Note that is an existential Presburger formula. Hence, its solution set is semilinear. We discuss the property of the solution set of in the next section.
4.2 King and peasant 1-types, and concretifying bases
We next investigate the properties of a linear subset of , identifying which 1-types have bounded occurrences. We have our overapproximation , and we choose one linear set within it. This is specified by a GBV along with a finite set of GBVs – that is, . We write for : the number of “outer periods”, as opposed to the basis vectors we had for local behaviors. And we write for the linear set, the set of GBVs in the form .
To characterize which GBVs in are realized by structures, we introduce the notion of king and peasant 1-types w.r.t. and . Here we refer to the definition of a GBV incorporating a one type basely from Definition 33.
► Definition 42 (King 1-type, peasant 1-type w.r.t. and ).
■ A 1-type is called a king 1-type w.r.t. and if is incorporated basely by and is not incorporated basely by any .
■ A 1-type is called a peasant 1-type w.r.t. and if is incorporated basely by some .
We denote the set of king 1-types w.r.t. and by and the set of peasant 1-types w.r.t. and by .
The following notion, concretifying, addresses the requirement that the existence of a phantom vertex with 1-type implies the existence of a concrete vertex with the same 1-type. This is crucial when we want to transform a D-structure to a structure. Recall that in a D-structure that realizes a GBV, the witnessed-assigned LBV of a phantom vertex must be homogeneously valid so that it can be merged to a concrete vertex with the same 1-type.
► Definition 43 (Concretifying and ). We say that and are concretifying if the following condition holds.
XX:19
(No unsupported phantoms in ) For every 1-type , for every , if is incorporated periodically in , then is also incorporated basely in or in some .
We can then prove that every basis of a linear subset of the solution set of is concretifying.
The following lemma follows from the fact that .
▶ Lemma 44. Let be a GBV and let be a finite set of GBVs such that . Then and are concretifying.
Proof. We verify that b and satisfy the condition of concretifying.
(No unsupported phantoms in ) For each , we have . Hence satisfies , from which the required condition follows.
▶ Lemma 45. Suppose that and are concretifying. For every and , and are concretifying.
Proof. Let . We verify that and satisfy each condition.
(No unsupported phantoms in ) The property follows immediately from the observation that if incorporates basely, then also incorporates basely.
Recall that, for every GBV , the base vector appears only once. Therefore, if a 1-type is incorporated basely only in and not basely in any period vector in , then every structure realizing contains only a bounded number of vertices of 1-type . We therefore call these king 1-types (Def. 42): as we promised in Section 3, such types are controlled entirely by the bounded base part , so their cardinality is bounded. Moreover, this bound can be lifted to the edges between king 1-types. Since there are no multi-edges between vertices of a structure, the number of such edges is also bounded. As a consequence, we can also upper bound the number of period GBVs whose induced behavior incorporates such an edge.
▶ Lemma 46 (Bounding entries for king types). For every , if incorporates a 2-type between king 1-types and , then for every with , there is no structure realizing .
Proof. We argue by contradiction. Suppose that is a structure realizing with , and incorporates a 2-type between king 1-types and .
Since and are king 1-types, they are incorporated basely only in . Hence, by Lemma 36, contains at most vertices of 1-type or .
On the other hand, implies that contains more than edges with 2-type from vertices with 1-type to vertices with 1-type . However, since is a structure, it contains no multi-edges. Therefore, there can be at most edges from vertices with 1-types to vertices with 1-types , a contradiction.
The lemma tells us that if we are interested in structures, we can impose the following restriction on the family of GBVs, strongly concretifying b and .
XX:20 Deciding two-variable logic with global and local Presburger quantification
► Definition 47 (Strongly concretifying b and ). We say that b and are strongly concretifying if they are concretifying and satisfy:
- (No edges incorporated between king 1-types in ) For every , every pair of king 1-types and , and every 2-type , does not incorporate the 2-type between and , in the sense of Definition 33.
A linear set is strongly concretifying if and are strongly concretifying.
Unlike with concretifying, we cannot prove that every linear subset of the solution set of is strongly concretifying. Instead, we show that the realizable GBVs in this solution set can be covered by finitely many strongly concretifying linear sets, the representations of which are computable from .
The key idea is as follows. Suppose that some period vector does not satisfy the required condition. Then, by Lemma 46, there exists a threshold such that no GBV containing sufficiently many copies of can be realized by a structure. Consequently, it suffices to consider only finitely many copies of . By explicitly enumerating all possible numbers of copies below the threshold, we can replace the original linear set with finitely many linear sets, each of which satisfies the required condition.
► Lemma 48. Suppose that and are concretifying but not strongly concretifying. Then, for every realizable GBV , there exist and such that
-
and are strongly concretifying;
-
, where is the maximum of for ;
-
.
Proof. Let . Choose an index such that violates the condition no edges between king 1-types in period vectors. Since is realizable, Lemma 46 implies that .
We absorb all copies of into the base vector by defining , . Then , and , where is the maximum of for . Moreover, by Lemma 45, the and are still concretifying.
Note that the cardinality is strictly less than the cardinality of . We may therefore repeat the same argument. Each iteration removes one period vector from while preserving the containment of and the concretifying property by Lemma 45. Hence, after at most iterations, we obtain and such that no period vector in violates the strongly concretifying condition. Therefore, and are strongly concretifying.
It remains to bound the size of . The sequence with , , and satisfies the recurrence . Consequently, .
► Lemma 49. Suppose that and are concretifying but not strongly concretifying. Then we can construct linear sets of GBVs , such that
-
for every , and are strongly concretifying and ;
-
every realizable GBV in belongs to one of these linear sets.
Proof. By Lemma 48, every realizable GBV in belongs to a linear set , where and are strongly concretifying, is bounded by the bound given in Lemma 48, and .
We construct the finite family of representations of linear sets of GBVs using the following procedure. We enumerate all satisfying this size bound, together with all subsets
XX:21
. For each pair of and , we test whether and are strongly concretifying and retain those that satisfy the condition. Since the strongly concretifying property is effectively decidable, this procedure constructs a finite family of linear sets effectively.
It is clear that every linear set is contained in by construction. Moreover, by Lemma 48, every realizable GBV in belongs to one of these linear sets.
► Lemma 50. Given a sentence in normal form, we can construct a finite family of linear sets of GBVs , such that
-
for every , and are strongly concretifying and is contained in
-
every GBV realized by a model of belongs to one of these linear sets.
Proof. Since is an existential Presburger formula, its solution set is semilinear, and a semilinear representation can be computed effectively. By Lemma 44, every linear set in this representation is concretifying.
We then apply Lemma 49 to each concretifying linear set. For each such linear set, the lemma produces a finite family of strongly concretifying linear sets whose union contains every realizable GBV in the original linear set. Applying this transformation to every linear set in the semilinear representation yields the desired finite family.
Since every step of the construction is effective, the resulting family can be computed effectively.
4.3 Kernels, villages, and village systems
We continue to fix a representation for one of the linear components of our overapproximating semilinear set, consisting of GBV and a finite set of GBVs . Note that this determines a set of king and peasant 1-types (Definition 42), which we are thus also fixing.
We can assume that and are strongly concretifying by Lemma 50. We aim to determine the condition under which there exists a structure realizing some GBV in .
Recall the intuition from Section 3. We want to show that there exists a structure realizing some GBV if and only if it can be decomposed into two parts: a bounded-size kernel and an unbounded-size village. Although the size of the village is unbounded, we will further show that the existence of a village can be characterized by a bounded-size existential Presburger formula, which can be constructed from and effectively.
We now formalize the intuitions behind kernel and village, which were illustrated in Figure 2.
► Definition 51 (Kernel, king, noble, and phantom noble). We say that a -structure is a kernel of and if it is asymmetric and realizes a GBV in and satisfies the following conditions.
K1. contains no phantom vertices realizing 1-types in KingOneTps().
We call the concrete vertices of realizing 1-types in KingOneTps() kings. The remaining concrete vertices realizing 1-types in PeasantOneTps() are called nobles, while the phantom vertices realizing 1-types in PeasantOneTps() are called phantom nobles.
K2. Referring to the definitions in K1 above, no multi-edge of involves a king. No edge of connects a king and a phantom noble. A king of has no self-loop.
XX:22 Deciding two-variable logic with global and local Presburger quantification
► Definition 52 (Village, shadow, and peasant). We say that a -structure is a village of and if it is asymmetric, it realizes a GBV in , and satisfies the following conditions.
V1. Every phantom vertex of realizes a 1-type in KingOneTps(). Every concrete vertex of realizes a 1-type in PeasantOneTps().
We call the phantom vertices of shadows, and the concrete vertices of peasants.
V2. No multi-edge of involves a shadow. No edge of connects two shadows. There is no self-loop in .
► Definition 53 (Compatibility between kernel and village). Let be a kernel of and and let be a village of and . We say that and are compatible if:
V3. (Shadow–king correspondence) There exists a bijection from shadows of to kings of that preserves 1-types. Equivalently, for every 1-type, the number of shadows of that satisfy it in the village is the same as the number of kings that satisfy it in the kernel.
V4. (Absorption of phantom nobles in ) For every phantom noble of realizing the 1-type , contains a peasant realizing .
V5. (Absorption of multi-edges in ) For every vertex and in , if there exists distinct -edge and -edge from to , then contains an -edge from to which satisfies , , and .
V6. (Absorption of self-loops in ) For every self-loop for in , contains an edge , such that letting be the source vertex of and be the destination of , we have: , , and .
We now formally state the pumping theorem mentioned in the proof sketch:
► Theorem 54 (Pumping). Let be a kernel of and , and let be a village of and . If and are compatible, then there exists an asymmetric structure realizing a GBV in .
Proof. Let be the number of kings in . The construction consists of several steps. We begin with the disjoint union of and copies of . We then perform the following operations
-
(Eliminating shadows.) For each copy of and each shadow in that copy, merge into the king of , where is the bijection from the shadows of to the kings of that preserves 1-types, given by (V3). Note that there cannot be an edge from a shadow to . Moreover, for each king in , for every copy of the village, there is exactly one shadow from that copy merged into . Since there are no edges between shadows in different copies, the merge procedure cannot create a self-loop, as required for a structure.
-
(Eliminating phantom nobles.) For each phantom noble in of 1-type , merge it into a peasant of 1-type in one of the copies of .
We do not have edges between phantom nobles and peasants. With sufficiently many copies (as many as there are phantom nobles), we can ensure that we do not merge two phantom nobles to the same peasant. Thus again there is no self-loop created in this process.
-
(Eliminating multi-edges in the villages.) For each multi-edge in a copy of , repeatedly apply the swapping operation to the corresponding pair of vertices across the other copies. Since there are sufficiently many copies, every multi-edge can be eliminated.
-
(Eliminating multi-edges in the kernel.) For each multi-edge in , apply the swapping operation using a suitable pair of peasants from one of the copies of with the corresponding 1-types.
XX:23
= (Eliminating self-loops in the kernel.) For each self-loop in , apply the swapping operation, using a suitable pair of peasants from one of the copies of with the corresponding 1-types.
Let us check that these operations are possible and achieve the required goals. Because and are compatible, the absorption of phantom nobles in (V4), absorption of multi-edges in (V5) and absorption of self-loops in (V6) conditions ensure that the required peasants in always exist. Moreover, since the numbers of phantom nobles and multi-edges in are finite, by taking sufficiently many copies of , every phantom noble and every multi-edge in can be eliminated. Consequently, the resulting D-structure is phantom-free and without multi-edges, and hence is a structure.
Since realizes a GBV in and realizes a GBV in , the disjoint union of and sufficiently many copies of also realizes a GBV in . By Lemma 32, each of the above operations preserves the GBV realized by the D-structure. Therefore, the resulting structure also realizes a GBV in .
As outlined in Section 3, our next goal is to construct an existential Presburger formula, called the village system, and then show a three-way equivalence: existence of a village for a given kernel, solvability of the village system, and existence of a structure realizing an appropriate GBV.
We first establish a basic property of kernels of and .
► Lemma 55. Let be a -structure realizing a GBV . For every king 1-type , contains exactly concrete vertices of 1-type .
Moreover, let witness be a realization witness of for . Then, for every king 1-type , for every , there are exactly vertices of 1-type such that .
Proof. By the definition of a king 1-type, for every , we have . By Lemma 36, the number of vertices of 1-type in is
For the second claim, since witness is a realization witness for , we have
Since is a king 1-type, for every , . Hence . Moreover, since is valid LBV for every vertex , each entry is either 0 or 1. Therefore, is precisely the number of vertices of 1-type satisfying . Consequently, there are exactly such vertices.
► Definition 56 (Base Behavior of an LBV). Given LBV of 1-type , its base behavior is .
We note a consequence of the lemma, which we will use throughout the subsequent arguments.
► Corollary 57. For every -structure realizing a GBV , the multiset of 1-types and the corresponding base behaviors of its concrete vertices with king 1-types is the same. In particular, this multiset is determined solely by and , independently of the choice of -structure and realization witness.
XX:24 Deciding two-variable logic with global and local Presburger quantification
► Definition 58 (, and ). Based on this observation, for convenience, we can define be the number of concrete vertices with king 1-types in some (equivalently, in any, by Corollary 57) -structure realizing a . We fix an enumeration of these 1-types and their corresponding base behaviors of witness().
To obtain a Presburger description of a village , we describe its shadows and peasants separately.
To describe shadows, recall that if a village and a kernel are compatible, the number of shadows is fixed and their 1-types depend only on the kernel . Thus, we can enumerate the shadows and their 1-types and encode their LBVs by variables.
Recall that the number of possible LBVs is unbounded. However, for a village to be compatible with a fixed kernel the number of shadows and the 1-types of shadows are fixed. Thus, the number of possible behaviors of vertices in the village toward the shadows is bounded. This motivates the notion of king-reaching LBV in Definition 60.
► Definition 59 (King-reaching). A behavior is king-reaching with respect to and if there exist a 2-type and a king 1-type such that .
► Definition 60 (King-restricted LBV, well-behaved). Let be a peasant 1-type in PeasantOneTps(). A king-restricted LBV () of with respect to and is a pair , where is a valid LBV and each is an ordinary (non-null) 2-type or the null 2-type.
We use the same notation to indicate the behavior generated by as in Definition 25. For and , we write for . For , we write -2-type() for .
We say that is well-behaved if it satisfies the following conditions.
-
(King-reaching Periods) For every , if , then the behavior is king-reaching,
-
(Cardinality linking) For every 2-type and every king 1-type , equals the number of indices satisfying -2-type() = and .
Informally, is the king-restricted behavior of a peasant if the peasant has behavior and is connected to a shadow of 1-type by an edge of 2-type -2-type() for every , or they are not connected to such a shadow at all in case 2-type -2-type() is the null 2-type.
Intuitively, a peasant in a village is king-reaching if it is connected to a shadow by an edge. For example, in Figure 2 vertices 12 and 13 are king-reaching, while vertices 14 and 15 are not. Suppose are the 1-types of the shadows.
► Lemma 61. Let be a peasant 1-type. We can compute, from , and the bases, a bound on the number of well-behaved of with respect to and .
Proof. Let be a well-behaved of with respect to and . Each can take only finitely many values, since the set of 2-types, supplemented with the null 2-type, is fixed.
We next bound the size of . Recall that well-behavedness implies that is valid (Definition 25), and thus there exists exactly one such that and the rest are set to 0. Thus, there are only finitely many options for the base component of . It remains to bound the entries of . By (King-reaching Periods), if the behavior is not king-reaching, we have . Thus we only need to compute a bound in the king-reaching case. Suppose that the behavior is king-reaching and
XX:25
for some 2-type and king 1-type . By the definition of behavior generated by , . By (Cardinality linking), we have that is the number of indices satisfying and which is bounded by .
► Definition 62 (). Let denote the set of well-behaved KRLBVs of w.r.t. and .
The idea is that whenever we have a village satisfying a GBV compatible with a fixed kernel, we will have a D-structure where each concrete element satisfies a well-behaved KRLBV, and hence the number of KRLBVs of peasants is bounded. This will allow us to describe the D-structure by specifying the quantity of each KRLBV. From such a D-structure we can create a village for the kernel.
We are now ready to introduce the village system, which captures the conditions for the existence of a village with a specified list of shadows and their 1-types.
► Definition 63 (Village system, Weak village system, Homogeneous village system). The village system with respect to and is an existential Presburger formula defined as follows.
= (Variables) The variables of are:
for ;
for and ;
for every peasant 1-type (relative to and , which are fixed throughout Section 4.3), and every .
Intuitively,
encodes the number of occurrences of the GBV period of the village;
encodes the intended of the shadow in the village, which is homogeneously valid (in the sense of Definition 25)
encodes the number of peasants with 1-type and KRLBV in the village.
Thus represents the intended GBV of the village, and for ,
represents the intended behavior of the shadow in the village.
consists of three types of constraints. The first type ensures that the behavior vector bases and periods of the vertices in the intended village agree with those specified by the intended GBV.
= (Counting shadows constraint) For every king 1-type and , contains the constraints ,
where , for a king 1-type denotes the set of indices such that .
The constraint guarantees that the number of behavior vector periods contributed by shadows is exactly the same as the number required by the intended GBV.
= (Counting peasant bases constraint) For each peasant 1-type and , contains the constraint
.
The constraint guarantees that the number of the behavior-vector base components contributed by peasants is exactly the same as the number required by the intended GBV.
XX:26 Deciding two-variable logic with global and local Presburger quantification
(Counting peasant periods constraint) For every peasant 1-type and , if is king-reaching, then contains the constraints
The constraint guarantees that the number of behavior vector periods contributed by peasants is exactly the same as the number required by the intended GBV.
The second type of constraint is the (Shadow-peasant matching constraint): For , every 2-type , and every peasant 1-type , contains the constraint
This constraint guarantees that the number of edges incident to the shadow equals the total number of edges incident to that shadow as specified by the KRLBVs.
The last type of constraint enforces an additional structural property of a village. Recall from property (V1) of Definition 52 that a village contains no phantom vertices of peasant 1-type. If a structure realizes a GBV in which a peasant 1-type is incorporated periodically but not basely, then by Lemma 34, it contains a phantom vertex with 1-type , which implies that the structure cannot be a village. Since and are concretifying, if the peasant 1-type is incorporated periodically in , then is incorporated basely in some . Therefore, the following condition implies that every peasant 1-type of and is incorporated basely by the intended GBV .
(Absorption of phantom vertices with peasant 1-type constraint) For every , .
We also define the homogeneous village system, denoted by , to be the system obtained by removing the constant terms from the first four constraints.
The weak village system, denoted by , is obtained by removing the Absorption of phantom vertices with peasant 1-type constraint.
To capture the compatibility between kernel and village, we need additional conditions.
► Definition 64 (Kernel-friendly solution of the village system). We say that a solution of the village system is -friendly if it satisfies the following conditions.
(Absorption of phantom nobles in constraint) For every phantom noble in realizing the 1-type , there exists such that and is incorporated basely by , where is the element in .
(Absorption of multi-edges in constraint) For vertices and in , if there exists edges and from to , then there exists such that and incorporates or between and .
(Absorption of self-loops in constraint) For every self-loop on vertex in , there exists such that and incorporates between and .
4.4 From a solution to a village
► Theorem 65 (Solvability-to-village-existence). Let be a GBV, and a finite set of GBVs such that and are strongly concretifying and . Let be a kernel of and . If the homogeneous village system has a -friendly solution, then there exists a village compatible with .
XX:27
We start with a result implying the existence of a village, without any compatibility condition with regard to a kernel.
► Lemma 66. If the homogeneous village system has a solution, then there exists a village of and with shadows with for .
Proof. Suppose that the homogeneous village system has a solution . Let .
► Definition 67 ( prototype-vertices. prototype-vertices). We start with an empty -structure , and add the following vertices.
-
() Add fresh phantom vertices as the shadows, and set the 1-type of to .
-
((, ) prototype-vertices) For every peasant 1-type and every king-restricted LBV , add fresh concrete vertices with 1-type . We call these the prototype-vertices.
-
((, ) prototype-vertices) Recall the behavior period vectors from Table 1. For every peasant 1-type and every , if the behavior is not king-reaching, then add fresh phantom vertices with 1-type . We call these the prototype-vertices.
The intuition is that the vertices will serve as shadows in the village, while the remainder of the construction will ensure that prototype-vertices satisfy and that prototype-vertices has behavior . We add edges to with the following procedure:
-
(Edges between and prototype-vertices) For every , for every prototype-vertex , if -type() is not the null type, then add an edge from to with 2-type .
-
(Edges within prototype-vertices and prototype-vertices) For every pair of peasant 1-types and every asymmetric 2-type , let be the set of vertices with 1-type and be the set of vertices with 1-type . Let and be functions defined as
We will show that the conditions of the rewiring lemma, Lemma 40, are satisfied. Recall that for every ,
Since is well-behaved (Definition 60) the (King-reaching Periods) condition guarantees that if is not king-reaching. For , the Counting
XX:28 Deciding two-variable logic with global and local Presburger quantification
peasant bases constraint in VillSys implies:
For , if is king-reaching, the Counting peasant periods constraint in , implies
Combining the above, the sum of the -entries of the intended behaviors of all prototype-vertices and prototype-vertices is , which is
Symmetrically, we have .
Since each satisfies the MATCH condition, also satisfies the MATCH condition, which implies that . Finally we have .
Thus, by Lemma 40, we can add edges of 2-type between the and so that:
(*) for every prototype-vertex , , and for every prototype-vertices , .
Symmetrically, the corresponding equalities hold for the and prototype-vertices.
We argue that satisfies certain properties of a village. In the subsequent steps, we will further transform into a village. Note that is asymmetric as required for a village (Definition 52).
We first argue that realizes . We define the realization witness witness on the three kinds of vertices, and show that holds for every in .
For every , we let and set all base entries to 0. Note that this implies that .
Clearly, is homogeneously valid.
In the construction of , the only edges incident to are those introduced according to the 's of the prototype-vertices. More precisely, for every 2-type and every 1-type , the number of such edges can be counted as follows:
where is equal to 1 if -type( ) = , and is equal to 0 otherwise.
On the other hand, by the Shadow-peasant matching constraint in VillSys , we have
XX:29
By the definition of witness(), the left-hand side is precisely . Since this holds for every 2-type and every 1-type , we conclude that .
= ((π, krlbv) prototype-vertex) For every prototype-vertex , we define witness() be the LBV corresponding to krlbv.
For every king 1-type and every 2-type , the (Cardinality linking) condition for a well-behaved KRLBV ensures that . For every peasant 1-type and every 2-type , because the edges of 2-type were added according to the procedure described in Lemma 40, we have . Hence, .
= ((π, i) prototype-vertex) For every prototype-vertex , define witness() by witness()(period, ) = 1, with all other entries set to 0. By construction, there are no edges in from to any shadow. Consequently, for every king 1-type and every 2-type , , since is not king-reaching. For every peasant 1-type and every 2-type , since the edges of 2-type are added according to the procedure described in Lemma 40, we have . Hence, .
It remains to show that for every , the slice of gbv on is precisely the sum of the witnessed-assigned LBVs of the elements with 1-type . This follows straightforwardly from the Counting shadows constraint, Counting peasant bases constraint, and Counting peasant periods constraint in .
= (Partial V1) By construction, we see that every concrete vertex of realizes a 1-type in PeasantOneTps(). There are still some phantom vertices of realizing a 1-type in PeasantOneTps(). We will remove them in further steps.
= (Partial V2) By construction, there is no multi-edge of involving a shadow, and no edge of connects two shadows. There are still some self-loops for vertices with peasant 1-types. We will remove them in further steps.
We next transform the D-structure into the desired village in two steps. First, we obtain by merging each prototype-vertex into a prototype-vertex of the same 1-type.
To see that such a prototype-vertex always exists, let be a peasant 1-type and let be a prototype-vertex. By definition of peasant 1-type (Definition 42), there exists some and such that . By the Absorption of phantom vertices with peasant 1-type constraint in , we have . By the Counting peasant bases constraint in , . The left hand side is positive, and at least one of the vectors being summed on the right is nonzero. Thus there exists such that . Therefore our construction contains a prototype-vertex which can be merged.
▷ Claim 68 ( properties). has the following properties. 1. It realizes gbv and is (still) asymmetric. 2. It realizes (V1) from the definition of a village (Definition 52). 3. It realizes part of the property (V2) of a village (“Partial V2”): There are no multi-edges incident to a shadow.
Note that we do not claim the other part of (V2): some vertices of peasant 1-type may still have self-loops.
Proof. (of Claim 68) For the first item note that the merge operation preserves the GBV
XX:30 Deciding two-variable logic with global and local Presburger quantification
realized by the D-structure, by Lemma 32. The merge operation also does not introduce new two types between distinct elements, so clearly preserves asymmetry.
For the second item, note that every phantom vertex of peasant 1-type is merged with some concrete vertex, every concrete vertex of realizes a 1-type in PeasantOneTps(), while every phantom vertex of realizes a 1-type in KingOneTps(). This implies (V1).
For the last claim. By construction, there are no edges between shadows and prototype-vertices. Therefore, the merge step introduces no multi-edges incident to a shadow.
Finally, we obtain from by eliminating all self-loops. Let be the maximum number of self-loops incident to any vertex of .
We take the disjoint union of 2 copies of , and then merge the copies of each shadow into a single vertex.
We eliminate the self-loops by performing suitable edge swaps between different copies. More precisely, for each vertex , we resolve its self-loops by swapping the corresponding edges between distinct copies of .
We argue that is the desired village.
Since realizes , the disjoint union of 2 copies of satisfy some . Since the merge and swap operations preserve the GBV realized by the D-structure by Lemma 32, this will imply that realizes some GBV in .
By Claim 68, satisfies (V1). The construction of from preserves (V1).
Claim 68 established (V2) except for the requirements on self-loops for . By construction, we removed self-loops by swapping. Hence (V2) holds for .
Note that swapping does not introduce new 2-types, so does not impact asymmetry. The swapping may introduce multi-edges, but this is allowed within a village according to Definition 52. This completes the proof of Lemma 66,
We now refine the lemma above to take into account a kernel.
► Lemma 69. Let be a kernel of and . If the village system has a -friendly solution, then there exists a village of and , with and are compatible.
Proof. Let be the village constructed in Lemma 66 from the -friendly solution. We now show that and are compatible according to Definition 53.
V3. (Shadow-king correspondence) By the construction in Lemma 66, in has 1-type , which is also the 1-type of in . Thus, the property holds.
V4. (Absorption of phantom nobles in ) By the definition of -friendly (Definition 64), in particular by the Absorption of phantom vertices with peasant 1-type constraint, for every phantom vertex in with 1-type , there exists such that and is incorporated basely by .
Since realizes , where , we have . Therefore, is also incorporated basely by . By Lemma 34, contains a vertex with 1-type . Note that, by (K1), every phantom vertex in has peasant 1-type, which implies that is a peasant 1-type. Thus, is a peasant in , and the desired property holds.
V5. (Absorption of multi-edges in ) By the definition of -friendly, for vertices and in , if there exist edges and from to , then there exists such that and incorporates some between and .
XX:31
Again, since realizes , where , we have . Therefore, is also incorporated between and by . By Lemma 34, contains an edge from a vertex of 1-type to a vertex of 1-type such that . Thus, the desired property holds.
V6. (Absorption of self-loops in ) By the definition of -friendly, for every self-loop on a vertex in , there exists such that and incorporates between and , where .
Again, since realizes , where , we have . Therefore, is also incorporated between and by . By Lemma 34, contains an edge from a vertex of 1-type to a vertex of 1-type such that . Thus, the desired property holds.
We are now ready to prove Theorem 65. Since the corresponding village system has a -friendly solution, Lemma 69 implies that there exists a village of and that is compatible with .
4.5 Satisfiability-to-solvability theorem: From a structure satisfying the constraints to a solution of the system
Recall from the proof outline that our final algorithm will first guess one of the linear sets within the overapproximation. It will then guess a small kernel and look for a -friendly solution to the village system. To show one direction of the correctness, we need to argue that if there is a structure realizing a GBV in the linear set, then we can “decompose” the structure to obtain a small kernel and a village, along with a -friendly solution to the village system. This is the last component of the proof.
► Theorem 70 (Satisfiability-to-solvability theorem). Let be a GBV, and let be a finite set of GBVs, with and strongly concretifying. For every asymmetric structure realizing a GBV in , there exist 1. of size bounded by , where is a computable function; 2. a subset , where and are strongly concretifying; 3. and a kernel of and which realizes the GBV such that the homogeneous village system has a -friendly solution.
Note that a kernel realizing a GBV must have size bounded by the size of and the basis for local behaviors, since the two of these together describe the total number of edges in a D-structure.
Proof. Recall that a solution to the village system in Definition 63 has coefficients for variables , , and . The are indexed by , the by and , and the by a peasant 1-type and . We first show how to get the bindings of the , which will be denoted .
We fix a structure realizing a GBV in the linear set generated by base vector and period vectors (Definition 1).
► Definition 71 (). We let for be such that: .
Let witness be a realization witness for realizing . Following Corollary 57, we can set to be the concrete vertices of realizing king 1-types such that for
XX:32 Deciding two-variable logic with global and local Presburger quantification
, has 1-type and base behavior . Note that, since is a structure, all its vertices are concrete.
We prove the theorem by transforming so that it has a substructure that is the desired kernel. We will proceed in several steps. Each step will preserve asymmetry, so the asymmetry requirement of a kernel will be satisfied.
Step 1: decomposing the initial structure. We first transform into a D-structure by the following splitting procedure. Let and . We define and recursively.
Suppose that there exists a concrete vertex of with peasant 1-type such that for some for which is not king-reaching. We introduce a new phantom vertex of 1-type . For every 2-type and every 1-type , we select many -edges from to vertices of 1-type and rewire them from to .
More precisely, for each selected -edge from to a vertex (as in Definition 30), we proceed as follows. If is explicit, we remove it and add an explicit -edge from to . Otherwise, if is implicit, we remove it and add an explicit -edge from to .
We define the corresponding realization witness by setting , while leaving all other entries of unchanged, and by setting , with all other entries of equal to 0. For every other vertex , we set .
The following properties are invariant under the splitting procedure:
- For every vertex of , .
Indeed, let be the vertex split at iteration, let and be the corresponding 1-type and index, and let be the newly added phantom vertex. By construction, we transfer edges from to precisely prescribed by . Hence,
Moreover, . For every other vertex , the redirection of edges does not change its behavior, and . Therefore, .
- The D-structure realizes gbv with witness .
Using the same notation as above, we have
All other witness entries are unchanged. Thus, for every 1-type, the sum of the witnesses over all vertices of that 1-type remains unchanged. Consequently, is a realization witness for the same gbv.
At each iteration, the sum of the entries over concrete vertices and indices for which is not king-reaching decreases by one. Hence, the procedure eventually terminates. Let be the resulting D-structure and let be the corresponding realization witness.
By construction, contains the following three kinds of vertices:
► Definition 72 (, split-vertices, split-vertices).
-
() These are the concrete vertices realizing king 1-types.
-
((, krlbv) split-vertices) For every concrete vertex in of peasant 1-type , we define a KRLBV krlbv associated to . Recall from Definition 62 that a KRLBV consists of a local behavior vector and a sequence of 2-types (possibly the null 2-type). The LBV will be , and the sequence of 2-types or null 2-types will be those associated with
XX:33
the edges from to the vertices in . Since the splitting procedure has terminated, for every concrete vertex with peasant 1-type, , whenever is not king-reaching.
We call a split-vertex.
■ (( ) split-vertices) These are the phantom vertices introduced by the splitting procedure. For every such vertex with 1-type , there exists , such that , with all other entries of equal to 0. We call a split-vertex.
is illustrated in Figure 4.

Figure 4 Illustration of obtained in Step 1 in the proof of Theorem 70. Concrete vertices are drawn with solid outlines, while phantom vertices are drawn with dashed outlines. Vertices of king 1-types are shown in red, and vertices of peasant 1-types are shown in blue. For simplicity, we assume that there is only one 2-type. After the splitting procedure, concrete vertices of peasant 1-types are grouped according to their KRLBVs. Consequently, all vertices in the same group are adjacent to the same set of vertices of king 1-types and to the same number of vertices of each peasant 1-type. For example, the split-vertices are adjacent to , , and one vertex of 1-type . Similarly, phantom vertices of peasant 1-types are grouped according to the period behaviors they realize. For example, each split-vertex is adjacent to exactly one vertex of 1-type . Note that the splitting procedure guarantees that the resulting D-structure contains no multi-edges and no edges between vertices of king 1-types and phantom vertices.
▷ Claim 73. Each krlbv associated to a split-vertex above is well-behaved, according to Definition 60.
Proof. Recall that well-behavedness requires two properties, according to Definition 60. Just after the definition of -split vertex we have established the contraposition of the property King-reaching periods.
Let us consider the other property, Cardinality linking: for every 2-type and every king 1-type , equals the number of indices satisfying and .
Fix king 1-type and a 2-type . Our construction guarantees that for every split vertex , the number of -edges from to vertices with king 1-type is
XX:34 Deciding two-variable logic with global and local Presburger quantification
. But the number of -edges to vertices with 1-type is exactly the number of indices satisfying and .
We next define and , which form the initial weak assignment.
▶ Definition 74 (, , initial weak assignment). For every and for , let . For every peasant 1-type , let denote the number of vertices of . By the weak initial assignment we mean the assignment to the variables of the village system: , where are as in Definition 71.
We argue that the weak initial assignment forms a solution of the weak village system .
▷ Claim 75. The weak initial assignment is a solution to the weak village system .
Proof. We start with the Counting shadows constraint. For every king 1-type and ,
On the other hand, by the definition of realization (Definition 31), the -entry of GBV is the some of witness of -entries of vertices with 1-type , that is
Thus we have
This completes the proof.
We now prove the Counting peasant bases constraint. For every peasant 1-type and , we count the number of occurrences of the behavior base ,
On the other hand, by the definition of witness, is the sum of -entries of vertices with 1-type , that is
Hence we conclude as required
We now prove the Counting peasant periods constraint. For every peasant 1-type and , if is king-reaching, we count the number of occurrences of the behavior period ,
XX:35
Reasoning as in the previous constraint,
Hence:
Finally, we prove the Shadow-peasant matching constraint. For every , every 2-type , and every peasant 1-type , we compare two ways of counting the number of edges with 2-type from to vertices with peasant 1-type .
On the one hand, this number is determined by the behavior of .
On the other hand, recall that the construction guarantees that there are no edges between split-vertices and . We can count the same edges by summing the contribution of split-vertices. Recall that is 1 if -2-type in , otherwise, it is 0. Then the total number of such edges is . Thus
We conclude this step by recording the following properties of .
▷ Claim 76 (H properties).
contains no multi-edges. There are no edges between the vertices and any split-vertex in .
realizes gbv with witness witness .
Proof.
Since is a structure, it contains no multi-edges. The splitting procedure does not introduce any multi-edges, and hence contains no multi-edges.
For every split-vertex , we have . Since is not king-reaching, is not adjacent to any vertex of king 1-type.
By the invariant of the construction, realizes gbv with witness witness .
For , by definition of realization witness, we have
XX:36 Deciding two-variable logic with global and local Presburger quantification
Recall that we choose the enumeration of , see comments after Corollary 57. Therefore we have
By Definition 74, we have . Therefore
△
Step 2: shrinking the assignment until it is a solution to the village system. In Claim 75, we showed that the initial weak assignment, consisting of , , and , is a solution to the weak village system, which is a non-homogeneous integer linear system. By well-known bounds on minimal solutions in linear systems (see Lemma 94 in Appendix A), there exists another solution whose values are bounded by an exponential function of the coefficients of the system, and hence by an exponential function of the entries in and and the entries in the representation of the semilinear for every 1-type .
That is, we can define:
► Definition 77 (a'_i b'_i, c'_{krlbv}^{\pi}). We let , , and c'_{krlbv}^{\pi} \leq c_{krlbv}^{\pi} be the bounded solution given by Lemma 94.
► Definition 78 . We define , , and
Consider the assignment to the village system variables, corresponding to above. Note that since this is difference between two solutions to the weak village system, it is a solution to the homogeneous weak village system. We now show:
▷ Claim 79. This assignment also satisfies the last constraint from Definition 63, the Absorption of phantom vertices with peasant 1-type constraint: for every outerperiods, .
Proof. We distinguish two cases.
Suppose that for some . We have . It is possible that and is not strongly concretifying. If this is the case, by Lemma 48, there exists and such that and are strongly concretifying, , and , where depends on , as obtained in Lemma 48. We then return to Step 1 with . Since the cardinality of is strictly less than the cardinality of , this process terminates after at most iterations, and after that we must be in the other case. We abuse notation by continuing to call the resulting GBV , and to call the resulting set of GBVs .
Note that is bounded by an exponential function (given by Lemma 94 in Appendix A). Thus, there is a triple-exponential blow-up in the size of . Since we perform this iteration times, this step can yield non-elementary blow-up.
XX:37
= Otherwise, for every outerperiods. Since every for every outerperiods, it follows that is a solution of the Absorption of phantom vertices with peasant 1-type constraint. Therefore, is a solution to the homogeneous village system .
So far, we have shown that \{x_i \leftarrow a'_i, y_{i,j} \leftarrow b'_{i,j}, z_{krlbv}^{\pi} \leftarrow c'_{krlbv}^{\pi}\} is a solution to the weak village system , and \{x_i \leftarrow a''_i, y_{i,j} \leftarrow b''_{i,j}, z_{krlbv}^{\pi} \leftarrow c''_{krlbv}^{\pi}\} is a solution to the homogeneous village system .
We define the target linear representation and show that its size if bounded.
► Definition 80 (, , and target linear representation). Let and . We refer the pair and as the target linear representation.
▷ Claim 81. The size of is bounded by a computable function.
Proof. We bound the size of as follows. The coefficients in these constraints come from the entries of and , as well as from the entries in the representation of the semilinear set for each 1-type . The value is bounded exponentially in the maximum absolute value of these coefficients, by the bound on linear systems given in Lemma 94 in Appendix A. Recall that we iteratively construct a system of linear equations admitting a solution in which a'_i'' > 0 for every . Each iteration causes a triple-exponential blow-up in the coefficients of the system. Thus, although the construction is non-elementary, it is effective, and hence the size of is bounded by a computable function.
We conclude this step by showing that the following target assignment is a solution of the homogeneous village system of the target linear representation and .
► Definition 82 (Target assignment). In the remainder of the proof, we refer to \{x_i \leftarrow a''_i, y_{i,j} \leftarrow b''_{i,j}, z_{krlbv}^{\pi} \leftarrow c''_{krlbv}^{\pi}\} as the target assignment.
▷ Claim 83. The target assignment is a solution to the homogeneous village system .
Proof. Since and induce the same set of king 1-types and peasant 1-types. The homogeneous village systems and coincide. Therefore \{x_i \leftarrow a'_i'', y_{i,j} \leftarrow b'_{i,j}, z_{krlbv}^{\pi} \leftarrow c'_{krlbv}^{\prime\prime\pi}\} is a solution to the homogeneous village system .
▷ Claim 84. \{x_i \leftarrow 0, y_{i,j} \leftarrow b'_{i,j}, z_{krlbv}^{\pi} \leftarrow c'_{krlbv}^{\pi}\} is a solution to the weak village system .
Proof. Note that in the weak village system , the variables occur only through expressions of the form . This implies that \{x_i \leftarrow 0, y_{i,j} \leftarrow b'_{i,j}, z_{krlbv}^{\pi} \leftarrow c'_{krlbv}^{\pi}\} is a solution to the weak village system .
Step 3: finding a kernel for the target assignment. The remainder of the proof of Theorem 70 will involve showing that there exists a bounded-size kernel for the target linear representation given by and as well as showing that the target assignment \{x_i \leftarrow a''_i, y_{i,j} \leftarrow b''_{i,j}, z_{krlbv}^{\pi} \leftarrow c''_{krlbv}^{\prime\prime\pi}\} is kernel-friendly.
We obtain the desired kernel by transforming the D-structure constructed in Step 1, guided by the small solution obtained in Step 2. The transformation proceeds in three phases.
XX:38 Deciding two-variable logic with global and local Presburger quantification
Step 3A: modifying and decomposing to obtain a bounded kernel. First, we obtain by partitioning the vertices of peasant 1-type and splitting the vertices of king 1-type, as follows.
► Definition 85 (, Kernel and village vertices, Kernel part, Village part).
We first partition the vertices of peasant 1-type. For every peasant 1-type and every well-behaved KRLBV krlbv, we choose many split-vertices and designate them as kernel-vertices. The remaining split-vertices are designated as village-vertices. Similarly, for every such that is non-king-reaching, we choose many split-vertices and designate them as kernel-vertices. The remaining split-vertices are designated as village-vertices. We leave the realization witnesses of all vertices of peasant 1-type unchanged; that is, for every such vertex .
We next split each vertex of king 1-type into a king and a shadow. For every , we add a phantom vertex to and assign it 1-type . We redirect every edge between and a village-vertex so that it is instead incident to , while keeping its other endpoint unchanged. We then rename as .
We define the realization witnesses of and as follows. For every and , we let and . For the shadow , we let and .
We call the , kernel-vertices, and kernel-vertices the kernel part of , and , village-vertices, and village-vertices the village part of .
We need to generalize the notion of a D-structure realizing a GBV (Definition 31) to restrict the behaviors to a subset.
► Definition 86 (Subset of a D-structure realizing a GBV). Let be a D-structure and be a subset of the vertices in . We say that of realizes a GBV gbv if there exists a mapping witness mapping concrete vertices of to valid LBVs and phantom vertices to homogeneously valid LBVs such that 1. for every element , realizes witness() (Def. 25) and 2. for every , the slice of gbv on is precisely the sum of witness() over all elements of 1-type in . The mapping witness is again called a witness of the realization.
We argue for some properties of .
▷ Claim 87 ( properties). The following properties hold for .
- also contains no multi-edges or self-loops. There are no edges between any two vertices and . There are no edges between and any , village-vertex, or village-vertex; There are no edges between and any , kernel-vertex, or kernel-vertex.
However, there may still be edges between the kernel part and the village part.
-
witness satisfies the condition of a realization witness; that is, for every vertex of , .
-
For , . where are defined in Definition 78.
-
For , . where are as in Definition 77.
-
The kernel part of realizes the GBV , in the sense of Definition 86, with as a witness.
XX:39
- The village part of realizes the GBV , with witness as a witness.
Proof. (of Claim 87)
-
Since contains neither multi-edges nor self-loops, and the splitting procedure introduces neither, also contains no multi-edges or self-loops. The remaining properties are also straightforward from our construction.
-
Let be a vertex of peasant 1-type. Our construction does not change the behavior of , and hence . Moreover, we keep its realization witness unchanged, so . Since is a realization witness of , we have . Combining these equalities yields .
-
For , note that the are connected with many village-vertices, we have
where is 1 if , otherwise, it is 0. By the constraint in , which is satisfied by the target assignment, we have:
- Recall that the edges of the in are redirected from in , which implies that
By Claim 76, it holds that
Thus, we have
where the final equality follows from Definition 78, .
- Recall that, by Definition 28, the kernel part of realizes with witness witness if, for every 1-type , the sum of witness over all vertices in the kernel part of 1-type is exactly . We verify this by computing the sum and comparing it with entrywise, considering each case separately. For every 1-type , let denote the set of vertices of 1-type in the kernel part of .
XX:40 Deciding two-variable logic with global and local Presburger quantification
= (King 1-type , base components) Let be a king 1-type. We first consider the base components. We have
= (King 1-type , period components) We next consider the period components. By the definition of witness, we have
Since \{x_i \leftarrow 0, y_{i,j} \leftarrow b'_{i,j}, z_{krlbv}^{\pi} \leftarrow c'_{krlbv}^{\pi}\} is a solution to the weak village system , the constraint counting shadows yields
Therefore, .
= (Peasant 1-type , base components) Let be a peasant 1-type. Recall that, for every kernel-vertex (Definition 85), whenever is not king-reaching. Moreover, for every kernel-vertex , , while all other entries of are 0.
Recall that the assignment \{x_i \leftarrow 0, y_{i,j} \leftarrow b'_{i,j}, z_{krlbv}^{\pi} \leftarrow c'_{krlbv}^{\pi}\} is a solution to the weak village system . We use the constraints of this system to compute the contribution of vertices in the kernel part.
We first consider the base components. By the definition of the kernel-vertices,
Since the above assignment is a solution to , the constraint counting peasant bases yields
Therefore, .
= (Peasant 1-type , period components) We next consider the period components. Let and suppose first that is king-reaching. In this case, the kernel-vertices make no contribution, and hence
XX:41
Since the above assignment satisfies the constraint counting peasant periods, we obtain
Therefore, .
Finally, suppose that is not king-reaching. In this case, the kernel-vertices make no contribution. By construction, there are exactly many kernel-vertices, each contributing 1 to this entry. Hence,
- Recall that, by Definition 28, realizes a GBV gbv with witness witness_{\mathcal{H}'} if, for every 1-type , the sum of witness_{\mathcal{H}'}(v)\mathcal{H}'\mathfrak{b}'(\pi,-)$.
Because the kernel part and the village part form a partition of the vertices of , the GBV realized by with witness witness_{\mathcal{H}'} is the sum of the GBVs realized by its kernel and village parts with the same witness.
Since realizes gbv with realization witness witness_{\mathcal{H}'}, and its kernel part realizes with the same witness (according to Definition 86), it follows that the village part of realizes .
△
Step 3B: removing edges crossing from the kernel part to the village part. After Step 3a, there may still be some edges between the kernel part and the village part in . This is undesirable, as our goal is to split the model into two D-structures, one of which serves as the desired kernel. Note that these edges do not involve any or .
In the next stage, we will obtain another D-structure from by eliminating all these undesired edges. This will be achieved by repeatedly applying the swap operation defined in Lemma 32. This process may introduce new multi-edges and self-loops for vertices with peasant 1-type. However, this is acceptable, as multi-edges and self-loops involving such vertices are permitted in kernels (Definition 51).
▶ Definition 88 ( ). We start by setting to and witness to witness . Suppose we have an edge from to where is in the kernel part with 1-type and is in the village part with 1-type and . Let be the set of vertices with 1-type in the kernel part and be the set of vertices with 1-type in the kernel part. By Claim 87, the kernel part of satisfies the GBV . Recall that, by Definition 80, , which implies that is a solution of MATCH, since we assume that . Therefore, we have
Note that the edge contributes only to the left-hand side of the equality. On the other hand, every edge from to with 2-type contributes one to each side, as does every edge from to with . Therefore, one of the following holds: (i) there exists another edge from to where is in , is in and ; or (ii) there exists another edge from to where is in the kernel, is in and . Otherwise - if there
XX:42 Deciding two-variable logic with global and local Presburger quantification
is no such edge – then the left-hand side would be strictly larger than the right-hand side, contradicting the equality above and hence the fact that is a solution of MATCH. Then, we can perform swapping between these two edges and to remove and and add one new edge from to and another new edge from to . When , this creates a self-loop in the kernel, but this is allowed in the kernel. The 2-types of the new edges are defined as in Lemma 32.
We argue for some properties of .
▷ Claim 89 ( properties).
-
The following structural properties hold for .
-
There are no edges between any two shadow vertices and .
-
There are no multi-edges incident to any .
-
There are no edges between the kernel part and the village part.
-
The kernel part of realizes the GBV , with witness as a witness.
-
The village part of realizes the GBV , with witness as a witness.
Proof.
-
Note that the swapping procedure does not involve any or . The structural properties for follow from the construction and properties for in Claim 87.
-
By Lemma 32, the swapping operation does not change the behavior of any vertex. Since witness is a realization witness of , for every vertex of we have
In Claim 87, we showed that the kernel part of realizes with witness witness. Since the swapping operation changes neither the set of vertices in the kernel part nor their assigned LBVs under the realization witness, the kernel part of also realizes with witness witness.
- The property follows by an argument similar to the previous one.
Step 3C: showing that the kernel part is the desired kernel. In Claim 83, we showed that the target assignment is a solution to the homogeneous village system . Our remaining goals are to construct a bounded size kernel of the target linear representation and and to show that the target assignment is friendly with this kernel.
Let be the D-structure corresponding to the kernel part of , and let witness be the witness obtained by restricting witness to the kernel part of . We argue that is a kernel of and , where the serve as kings, the kernel-vertices serve as nobles, and the kernel-vertices serve as phantom nobles.
▷ Claim 90. is a kernel of and .
Proof. We verify that satisfies the conditions for a kernel in Definition 51. By Claim 89, the kernel part of realizes by witness, which implies that realizes by witness. K1. Since is just the kernel part of and there are no phantom vertices with king 1-types in the kernel part of by Claim 89, the same holds for .
K2. Since is just the kernel part of and no multi-edge of the kernel part of involves a by Claim 89, the same holds for . Moreover, there is no edge in connecting a to a phantom vertex by Claim 89, and hence the same holds for .
XX:43
It remains to show that the size of is bounded by a computable function, and the target assignment (Definition 80) is -friendly.
▷ Claim 91. The size of is bounded by a computable function.
Proof. By Claim 90, realizes the GBV . Thus, the size of is bounded by . Moreover, the size of is bounded by a computable function, as shown in Step 2. Hence, the size of is also bounded by a computable function.
▷ Claim 92. The target assignment from Definition 82, , is -friendly (Definition 64).
Proof.
-
(Absorption of phantom nobles in constraint) Note that, by definition, every peasant 1-type is incorporated basely by some for . The assignment constructed in Step 2 guarantees that for every . Thus for every phantom noble in realizing the peasant 1-type , there exists such that and is incorporated basely by . Therefore the assignment satisfies the constraint.
-
(Absorption of multi-edges in constraint) The only multi-edges that may arise in the kernel part of are those created by swapping an edge between the kernel part and the village part of . In the construction of , we showed in Claim 89 that for such an edge of 2-type , there exists a corresponding edge from the village part to the kernel part of 2-type . Since the village part realizes GBV (Definition 86), there exists some such that incorporates . Hence, the desired property holds.
-
(Absorption of self-loops in constraint) The only self-loops in the kernel part of that are present after the swapping procedure emerge from swapping with an edge between vertices in the kernel part of and vertices in the village part of . Thus the property holds by an argument similar to the previous property.
4.6 Putting it all together to prove Theorem 5
We now complete the proof of Theorem 5. First, as outlined in Section 3, the satisfiability of a GandLP sentence can be effectively reduced to the satisfiability of a conjunction of a GP sentence in normal form and a GCC.
Next, Lemmas 39 and 50 show that it suffices to consider the realizability problem for a strongly concretifying linear subset of . Moreover, there exists an algorithm to decide whether a village system is kernel-friendly.
► Lemma 93. Let be a kernel of and . There is an algorithm that decides whether the homogeneous village system has a -friendly solution.
Proof. Observe that the conditions of -friendly can each be expressed as systems of integer linear inequalities over the variables of the village system.
Therefore, the conjunction of the homogeneous village system and the three extra “friendly conditions” is again an existential Presburger formula. Consequently, deciding whether the
XX:44 Deciding two-variable logic with global and local Presburger quantification
homogeneous village system has a -friendly solution reduces to deciding the satisfiability of an existential Presburger formula, which can be done effectively.
We are now ready to prove Theorem 5.
Proof of Theorem 5. Let be a conjunction of a sentence and a GCC. By Lemma 50, we can construct a finite family of linear sets of GBVs such that for every , and are strongly concretifying and . Moreover, every GBV realized by a finite model of belongs to one of these linear sets.
For each , we enumerate all of size at most ; all subsets such that and are strongly concretifying; and all kernels that realize . Since the bound is computable, all of these can be enumerated effectively.
For every such kernel , we construct the corresponding homogeneous village system . By Lemma 93, we can decide whether this system has a -friendly solution. The procedure returns SAT if a kernel has a homogeneous village system with a -friendly solution, and returns UNSAT otherwise.
We verify the correctness of this procedure. Suppose first that the procedure returns SAT. Then there exists , , , and a kernel of and realizing , such that the homogeneous village system has a -friendly solution. By Theorem 65, there exists a village compatible with ; by Theorem 54, there is an asymmetric self-loop free structure realizing a GBV in . Since , by Lemma 39, the structure is a model of . Hence is satisfiable.
Conversely, suppose that has a finite model . Let be a GBV realized by . By Lemma 50, there exists such that . Since is realizable, Theorem 70 yields within the prescribed size bound, , and a kernel for and realizing , such that the corresponding homogeneous village system has a -friendly solution. This kernel is considered by the enumeration, so the procedure returns SAT.
The procedure performs only finitely many effective computations. Therefore, the finite satisfiability problem of is decidable.
5 Discussion
We have shown decidability of a logic with both “local counting quantifiers” and “global counting quantifiers”, the first such result we are aware of. The result has immediate applications to verifying graph neural networks with global readout.
There are a number of extensions of our techniques. First, although we follow the literature in referring to “Presburger quantifiers”, the quantifiers we consider do not support modulus-class restrictions (e.g. the number must be divisible by 3 etc), which are allowed in Presburger arithmetic. It is routine to add support for these in both local and global quantifiers. The static analysis problem we focus on is satisfiability. Decidability for other problems like equivalence follows immediately. But in fact we can support more sophisticated statements like “is there a model where the fraction of elements satisfying is at least ”: this is again easy, since we can encode the property in another GCC. A natural subclass of our logic is where local aggregation is “outgoing only”. Here the proofs simplify substantially; see the appendix.
XX:45
We leave open the exact complexity of the satisfiability problem, noting only that our procedure gives a tower bound. We also note that our logic is incomparable to , since we do not allow new one-variable formulas to be formed via unguarded counting (e.g. constraints on the number of non-neighbors). Ideally one would like a logic that subsumes and also two-variable logic with unbounded almost-periodic counting [5].
We have also applied the techniques we developed to provide a new result on the spectrum for sentences. The spectrum of a logical sentence is the set of cardinalities of finite models of the sentence. It has been shown that the spectrum of is a semilinear set: definable in Presburger arithmetic [22, 14]. We can show that the same holds for . This result is surprising, given the negative result on 1-type spectra from [4] mentioned above. To keep this manuscript manageable, we leave the details for a second preprint.
Finally we note that our results deal with satisfiability over structures which (by definition) are free of self-loops. We believe it is easy to reduce the general case to this one, but have not verified this.
References
1 Pablo Barceló, Egor V. Kostylev, Mikaël Monet, Jorge Pérez, Juan L. Reutter, and Juan Pablo Silva. The Logical Expressiveness of Graph Neural Networks. In ICLR, 2020. 2 Bartosz Bednarczyk and Oskar Fiuk. Presburger Büchi Tree Automata with Applications to Logics with Expressive Counting. In WoLLIC, 2022. 3 Bartosz Bednarczyk, Maja Orlowska, Anna Pacanowska, and Tony Tan. On classical decidable logics extended with percentage quantifiers and arithmetics. In FSTTCS, 2021. 4 M. Benedikt, Chia-Hsuan Lu, and T. Tan. Analysis of logic with arithmetic. In CSL, 2026. 5 Michael Benedikt, Egor V. Kostylev, and Tony Tan. Two variable logic with ultimately periodic counting. SIAM Journal on Computing, 2024. 6 Michael Benedikt, Chia-Hsuan Lu, and Tony Tan. Decidability of Graph Neural Networks via Logical Characterizations. ACM Transactions on Computational Logic, 27(2):13:1–13:65, 2026. 7 Egon Börger, Erich Grädel, and Yuri Gurevich. The Classical Decision Problem. Springer-Verlag, Berlin, Heidelberg, 2001. 8 Artem Chernobrovkin, Marco Sälzer, François Schwarzentruber, and Nicolas Troquard. Verifying Quantized GNNs With Readout Is Decidable But Highly Intractable. In KR, 2026. 9 Dmitry Chistikov and Christoph Haase. The Taming of the Semi-Linear Set. In ICALP, 2016. 10 Maurice Funk and Daumantas Kojelis. Towards Understanding the Expressive Power of GNNs with Global Readout. CoRR, abs/2604.22870, 2026. 11 Seymour Ginsburg and Edwin H. Spanier. Semigroups, Presburger formulas, and languages. Pacific Journal of Mathematics, 16(2):285–296, 1966. 12 Erich Grädel, Martin Otto, and Eric Rosen. Two-variable logic with counting is decidable. In LICS, 1997. 13 Daumantas Kojelis. On homogeneous models of fluted languages. In CSL, 2025. 14 Eryk Kopczynski and Tony Tan. Regular graphs and the spectra of two-variable logic with counting. SIAM J. Comput., 44(3):786–818, 2015. 15 V. Kuncak and M. Rinard. Towards Efficient Satisfiability Checking for Boolean Algebra with Presburger Arithmetic. In CADE, 2007. 16 Chia-Hsuan Lu and Tony Tan. On two-variable guarded fragment logic with expressive local Presburger constraints. Logical Methods in Computer Science, 20(3), 2024. 17 Pierre Nunn, Marco Sälzer, François Schwarzentruber, and Nicolas Troquard. A Logic for Reasoning about Aggregate-Combine Graph Neural Networks. In IJCAI, 2024. 18 Leszek Pacholski, Wieslaw Szwast, and Lidia Tendera. Complexity of two-variable logic with counting. In LICS, 1997.
XX:46 Deciding two-variable logic with global and local Presburger quantification
19 Loïc Pottier. Minimal solutions of linear diophantine systems: Bounds and algorithms. In RTA, 1991. 20 Ian Pratt-Hartmann. Complexity of the two-variable fragment with counting quantifiers. Journal of Logic, Language and Information, 14:369–395, 2005. 21 Ian Pratt-Hartmann. Complexity of the guarded two-variable fragment with counting quantifiers. Journal of Logic and Computation, 17(1):133–155, 2007. 22 Ian Pratt-Hartmann. The Two-Variable Fragment with Counting. In WoLLIC, 2010. 23 Mojżesz Presburger. Über die vollständigkeit eines gewissen systems der arithmetik ganzer zahlen, in welchem die addition als einzige operation hervortritt. In Comptes Rendus du I Congrès des Mathématiciens des Pays Slaves, pages 92–101, Warszawa, 1929. 24 "Johann" Sebastian Rudolph. Presburger Concept Cardinality Constraints in Very Expressive Description Logics - Allegro sexagenarioso ma non ritardando. In Description Logic, Theory Combination, and All That - Essays Dedicated to Franz Baader on the Occasion of His 60th Birthday, 2019. 25 Marco Sälzer and Martin Lange. Fundamental Limits in Formal Verification of Message-Passing Neural Networks. In ICLR, 2023. 26 Marco Sälzer, François Schwarzentruber, and Nicolas Troquard. Verifying Quantized Graph Neural Networks is PSPACE-complete. In IJCAI, 2025. 27 Alexander Schrijver. Theory of Linear and Integer Programming. Wiley Interscience Series in Discrete Mathematics and Optimization. John Wiley & Sons, Chichester, UK, 1998. 28 Michal Zawidzki, Renate A. Schmidt, and Dmitry Tishkovsky. Satisfiability problem for modal logic with global counting operators coded in binary is NExpTime-complete. Information Processing Letters, 113(1–2):34–38, 2013.
XX:47
A Bounds on solution size
The following lemma on the solutions of linear systems is used throughout the body.
► Lemma 94 ([19], also see Proposition 4 in [9]). For every integer linear system : , where and , and for every non-negative solution of , there exists another non-negative solution such that each entry of is bounded by , where is the maximum absolute value of the entries of and , and componentwise.
B Proof of Lemma 16: Normal form for GandLP
► Lemma 16 (Normal form). Every GandLP sentence can be effectively converted to a sentence of the form over an extended vocabulary where is a sentence in normal form:
with is quantifier-free and asserts that holds for each binary relation , each a binary atom, each quantifier-free, each a unary atom, each is a “lower bound Presburger quantifier”, of the form
with each a binary atom, while is a GCC defined in Def. 15, such that has a model of size if and only if has a model of size .
Proof. We will need to define an inductive translation that handles formulas that may have free variables; they will translate to a conjunction of a formula with the same free variables and a GCC. We recall that a global Presburger quantifier is an open formula with one implicit free variable, so it will translate to a formula with one free variable as well.
Suppose that the input GandLP formula is over the vocabulary V. We normalize the formula in the following three steps.
Step 1: Convert global Presburger quantifiers into GCCs.
We recall from Definition 15 that a GCC is a Boolean combination of atomic GCCs, and thus a GCC can include both and inequalities with constants. Our first part will thus be a straightforward normalization that converts global cardinality constraints into a GCC. Formally a global Presburger quantifier has an implicit free variable, while a GCC defines a property of a structure: the GCC that the generate will be equivalent to the global Presburger quantifier in the sense that the GCC holds in a structure if and only if the global Presburger quantifier holds for all elements of the structure.
We simultaneously define four mappings by structural induction on : , which inputs a -ary GandLP formula and produces a -ary GP formula; , which inputs a GandLP formula and produces a GP sentence; , which inputs a GandLP formula and produces a GCC; , which inputs a GandLP formula and produce an extended vocabulary; and another function , which takes as input a GandLP formula and a V-structure and produces a -structure expanding .
(Atomic formulas) For atomic formulas , define
XX:48 Deciding two-variable logic with global and local Presburger quantification
= (Negation) For , define
= (Conjunction) For , define
The structure is the common expansion of and .
= (Ordinary quantification) For , where , define
= (Guarded quantification) For guarded quantification, define
For both forms, , , and are inherited from , and the structure translation is .
= (Local Presburger quantifier) For ,
The structure is the common expansion of for all .
= (Global Presburger quantifier) Finally, for , letting be a fresh unary predicate symbol associated with this occurrence of , and be fresh unary predicates, define
where is the GCC defined by
XX:49
Above is a fresh unary predicate. For structures that satisfy is just the cardinality of the domain; we do this because we do not allow a term in a GCC. Let be the common expansion of for all . We define as the expansion of interpreting by the whole domain, and interpreting and by
Note that since is a global Presburger quantifier, if there exists an element satisfies , then it holds for every such that . Therefore, either or .
The intuition behind the translation is that the truth value of a global Presburger quantifier is independent of the choice of elements in the model. Thus, it is either satisfied by all elements or by none. We encode this truth value using a fresh predicate symbol, and the constraints generated by and ensure that this predicate has the intended interpretation in the extended structure.
We conclude Step 1 by arguing for the correctness of the translations.
▷ Claim 95. For every formula , for every V-structure , the following properties hold.
= For every pair of elements ,
The analogous invariant holds also for formulas with one or zero free variables.
Proof. We prove the claim by structural induction on the formula. The base case of atomic formulas is trivial. For the inductive step, we consider only conjunction and global Presburger quantification. The remaining cases – negation, ordinary quantification, guarded quantification, and local Presburger quantification – follow by arguments similar to that for conjunction.
= (Conjunction) Suppose that .
= Suppose , then it holds that
By the induction hypothesis, it holds that
Since is the common expansion of and . We have
Therefore
On the other hand, suppose . It holds that
XX:50 Deciding two-variable logic with global and local Presburger quantification
Since is the common expansion of and , and each is a formula over for , the truth values of both formulas are preserved in the common expansion. We have
By the induction hypothesis, it holds that
Hence, .
= For the second property, by the induction hypothesis, we have
Again by the fact that is the common expansion of and , we have
Hence
= The last property follows by an argument similar to that for the previous property.
(Global Presburger quantifier) Suppose that . Let be the fresh unary predicate symbol associated with this occurrence of in the translation.
= By the definition of ,
if and only if .
Recall that . Thus we have
= For the second property, we focus on the first conjunct. For every and , by the definition of ,
if and only if .
By the induction hypothesis,
Since is the expansion of , we have
Therefore
= For every , for every , by the definition of ,
XX:51
which implies that
Recall that we defined the expanded structure so that the predicate held of every element, thus the count of is the same as the number of elements in th domain. Therefore for every ,
Recall that by the definition of ,
It follows that if , then ; otherwise, . Hence, satisfies the first two conjuncts of .
▷ Claim 96. For every GandLP² formula , for every -structure , let be the -structure obtained by restricting to the vocabulary . It holds that if , then for every with , it holds that
The analogous property holds for formulas with zero or one free variable.
Proof. We prove the claim by structural induction on . The base case of atomic formulas and the inductive cases for Boolean connectives, ordinary quantification, guarded quantification, and local Presburger quantification are straightforward. We therefore consider only the case of global Presburger quantification, where . Let be the fresh unary predicate symbols associated with this occurrence of in the translation.
Firstly, since , for and , it holds that
Moreover, ensures that the conditions required to apply the induction hypothesis to each , , are satisfied. Hence, for every and ,
Consequently, the corresponding counting terms are equal
Since and use the same comparison operator and constant , it follows that, for every ,
XX:52 Deciding two-variable logic with global and local Presburger quantification
Finally, since , the constraints ensure that if , then . Otherwise if , then . Combining this with the equivalence above, we obtain, for every ,
To conclude this step, Claims 95 and 96 imply that, for every formula and every , has a model with elements if and only if has a model with elements.
Step 2: Convert local Presburger quantifiers to use only the comparison operator .
In Step 1, we showed that every formula can be translated into an equisatisfiable formula while preserving the cardinalities of models. It remains to normalize the part. The first issue is to ensure that we only use “lower bound Presburger quantifiers”, as required by our normal form.
We use the following equivalences between local Presburger quantifiers.
Therefore, we can further transform the GP formula so that all local Presburger quantifiers use only the comparison operator .
Step 3: Normalize the GP component.
Finally, we normalize the GP component using the procedure of [16, Lemma 3.3]. In that result, there is no explicit statement about the use of or in Presburger quantifiers. But inspection of the procedure shows that it preserves the comparison operators in local Presburger quantifiers. Thus the resulting formula continues to use only .
C Proof of Lemma 32: operations preserve realized GBVs
▶ Lemma 32. For a -structure , each of the following operations preserves the realized GBVs. 1. (Merge) Merge a phantom vertex into a concrete or phantom vertex , where . We will typically apply this where we want to preserve the property that there are no self-loops. In such a case, we must further require that and are not adjacent. 2. (Swap) Let be an -edge from to , and an -edge from to with and . Suppose that and are distinct. Remove the edges and . Add an edge from to and an edge from to . Assign the 2-types so that .
XX:53
Let be a D-structure realizing a GBV gbv with witness witness. By definition of realization, the following property holds.
= For every vertex , realizes witness(). If is a concrete vertex, then witness() is a valid LBV; if is a phantom vertex, then witness() is a homogeneously valid LBV.
= For every 1-type , , and ,
where is the set of vertices with 1-type .
We prove that the resulting D-structure also realizes gbv, by constructing the corresponding witness.
= (Merge) Let be obtained from by merging a phantom vertex into a concrete or phantom vertex , producing a new vertex , where and there is no edge between and .
Define witness' by
It is immediate that, for every 1-type , the sum of the witnesses of type is preserved. Thus, it suffices to show that realizes .
Observe that the behavior of in is exactly the sum of the behaviors of and in . Since realizes and realizes , we have
Hence, realizes .
= (Swap) Let be obtained from by swapping a pair of edges satisfying the conditions described in the statement of the lemma. It is clear that the behavior of every vertex remains unchanged. Hence, the witness showing that realizes gbv is also a witness showing that realizes gbv.
D Proof of Proposition 23: the set of conformant behaviors is hybrid linear
Recall from the body that is the formula obtained from a normal-form sentence by discarding the outer quantifier :
where is a quantifier-free formula, each is a binary predicate, each is a quantifier-free formula, each is a unary predicate and each is a local Presburger quantifier using only the comparison operator :
with each a binary atom,
XX:54 Deciding two-variable logic with global and local Presburger quantification
Recall from Definition 18 that a 1-type is conformant (w.r.t. ), if . A 2-type is conformant with 1-types and (w.r.t. ), if and for every .
Lastly, recall from Definition 22 that a (local) behavior is conformant with and if there exists a structure and an element having that behavior, with 1-type , such that every one type and non-null two-type is conformant.
We now recall the statement of Proposition 23:
► Proposition 23. For any 1-type , , the set of conformant behaviors is hybrid linear, and a hybrid linear representation can be effectively generated from and .
The proof is quite straightforward. Consider the following linear constraints, a variation of those introduced in prior work (e.g. [4]).
► Definition 97 (Characteristic system). For a sentence in normal form and conformant 1-type , the characteristic system of and , denoted , is the integer linear system defined as follows:
-
For every a conformant one-type and , there is a non-negative variables in .
-
(Counting) For , if then the following constraint is in :
▷ Claim 98. For any conformant 1-type , the solutions of the characteristic system are exactly the conformant behaviors.
Proof. In one direction, we argue that a conformant behavior satisfies the system. By definition, this is the behavior of an element in a structure with only conformant types. Recall also that we only consider structures that are loopless; thus the in a local Presburger quantifier is irrelevant for such structures. Thus a local Presburger constrains the neighbors of an element so that its behavior satisfies the inequality constraint above. Satisfaction of the other constraints is straightforward.
On the other hand, suppose we have a solution with . We create a tree-shaped structure with a root element , labeled so as to satisfy . For each two-type and 1-type such that both and are conformant, we link via edges consistent with to distinct vertices, each labeled to satisfy .
We claim that the root node in the resulting structure witnesses that the behavior is conformant. That is, we claim that the root node satisfies . The fact that it satisfies follows from the fact that is conformant. We now consider a constraint . This is only relevant for edges between the root node and one of the children created below, and these are all arranged to satisfy a conformant 2-type, which guarantees that the implication holds. Finally we consider a constraint of the form . We only need concern ourselves with contained in , since otherwise the implication holds vacuously. But then the counting constraint applies to guarantee .
To complete the proof of Proposition 23, note that the characteristic system contains no disjunctions and can therefore be expressed in the form . Hence, its solution set is hybrid linear [9, Proposition 4].
XX:55
E Proof of the rewiring lemma, Lemma 40, and Lemma 41 (constructing a decomposed structure from a GBV satisfying MATCH)
► Lemma 40 (Rewiring lemma). Let be 1-types and be an asymmetric 2-type as in Definition 18. Let be a -structure, be the set of concrete and phantom vertices of with 1-type , and be the set of concrete and phantom vertices of with 1-type . Suppose that for every , ; and for every , . Let and be functions satisfying the “local match equation” .
Then there exists a -structure with the same sets of concrete and phantom vertices as , obtained by adding edges of 2-type between vertices in and , such that:
■ For every vertex , .
■ For every vertex , , while all other entries of coincide with the corresponding entries of .
■ For every vertex , , while all other entries of coincide with the corresponding entries of .
■ For every vertex such that , .
Furthermore, if is asymmetric, the new structure is asymmetric as well.
Proof. Let be . We define the D-structure extended by adding edges according to the following procedure. For every vertex , we write for the behavior of in . The D-structure is obtained as follows:
-
Pick a vertex such that .
-
Pick a vertex such that .
-
Add an edge from to of 2-type .
Let . We argue that the following invariants are preserved for each for .
- For every vertex , .
For the base case, by assumption, we have .
For the induction step, we consider three cases.
= Suppose that is picked in the iteration. Then . Since we add only one edge from with 2-type to a vertex with 1-type , . Combining these two inequalities, we obtain .
= If is not picked and the added edge is not incident to , then clearly the behavior of remains unchanged, so the invariant continues to hold.
= Otherwise, if is not picked but the added edge is incident to , this can only occur when , which implies that . Here we use that is asymmetric, so and are distinct. Thus, the added edge does not affect the entry of the behavior of , and hence .
The analogous bounds hold for every vertex in , .
- We have
We prove this by induction on . The base case is immediate, since all the relevant behavior values are zero by assumption.
XX:56 Deciding two-variable logic with global and local Presburger quantification
For the induction step, suppose that an edge from to of 2-type is added. Then and , while all other relevant behavior values remain unchanged. Thus, both sides of the equality increase by 1, and the equality is preserved.
Note that the second invariant implies that suitable vertices and can always be chosen at every iteration . Otherwise, we would have
which contradicts the second invariant.
Therefore, after iterations, every vertex satisfies , and every satisfies .
Moreover, the procedure affects only the -entries of the behaviors of vertices in and the -entries of the behaviors of vertices in . Therefore, is the desired D-structure .
Note that if is an asymmetric D-structure, since the construction only add edges with asymmetric 2-type , the resulting D-structure is also asymmetric.
► Lemma 41 (Assembling a D-structure from a MATCH solution). For every gbv satisfying MATCH, there exists a D-structure realizing gbv. In particular, this holds for any gbv satisfying .
Proof. Let gbv be a GBV that satisfies MATCH. That is, for every 1-type , and 2-type ,
Our goal is to construct a D-structure such that for every 1-type ,
for every , there are exactly concrete vertices with 1-type and behavior ;
for every , there are exactly phantom vertices with 1-type and behavior .
It is straightforward that such a D-structure realizes gbv. Indeed, we can construct a realization witness witness as follows. For every concrete vertex with 1-type and behavior , set , and set all other entries to 0. For every phantom vertex with 1-type and behavior , set , and set all other entries to 0.
We now construct a D-structure satisfying the required properties. We start with the following D-structure . For every 1-type ,
for every , there are concrete vertices with 1-type , called concrete vertices. We define the intended behavior of those vertices to be ;
for every , there are phantom vertices with 1-type , called phantom vertices. We define the intended behavior of those vertices to be .
XX:57
There are no edges in .
We fix an enumeration of all triples , where are 1-types and is an asymmetric 2-type, and let denote the length of this enumeration. We filter the enumeration so that it does not contain and . We construct a sequence of D-structures as follows.
For each , let be the triple in the enumeration. We let be a function from vertices with 1-type to non-negative integers, and be a function from vertices with 1-type to non-negative integers defined as follows.
By condition MATCH, the sum of the -entries of intended behaviors of the concrete and phantom vertices equals the sum of the intended -behavior entries of the concrete and phantom vertices, which implies that the sum of over vertices with 1-type is equal to the sum of over vertices with 1-type . We obtain from by applying the rewiring lemma, Lemma 40.
We write for the behavior of a vertex in . By the conclusion of Lemma 40, the following invariant holds for every :
for every triple occurring among the first triples in the enumeration, every concrete vertex satisfies , and every phantom vertex satisfies .
Notice that each application of the lemma only adds edges of a specific 2-type and specific 1-types: all other triples are unaffected.
Since the enumeration contains all triples of 1-types and 2-types, every vertex has its intended behavior in . Hence, is the desired D-structure
F Outgoing-only aggregation
We recall from the body that we stated that our decision procedure simplifies dramatically for a “modal” fragment. Indeed, we do not require the machinery of D-structures which is the main technical innovation in this paper. Instead, we can make use of a “homogeneous model property” that has been established in other contexts [13, 28]. We now formalize this.
► Definition 99 (Outgoing-only full logic (OutP²), unmixed version OutGandLP²). We let OutP² denote the variant of GandLP² formed by closing unary atoms under the usual connectives, with the use of quantifiers restricted as follows.
If is a formula, then so are and .
If is a formula, then so are and , for some binary relation .
(Mixing local and global Presburger formulas) If is a set of formulas, is a set of atoms. and are integers, and is another set of formulas, then is also a formula.
We let OutGandLP² be the variant where we do not allow the mixing of local and global counts.
XX:58 Deciding two-variable logic with global and local Presburger quantification
Note that the standard modal formula and can be expressed in terms of local Presburger quantifiers: and .
We can now formalize our main claim:
► Theorem 100. The satisfiability problem for OutP and OutGandLP is complete for NEXP. In addition, the spectrum of such sentences is semilinear.
To prove the upper bound and the semilinearity claim, we start with a normalization result. Unlike Lemma 16, this is a straightforward Scott normal form normalization, with no additional restrictions put on the Presburger quantifiers.
► Lemma 101 (Normal form). From an OutP sentence we can create, in exponential time, a normal form sentence, which is a disjunction of normal form disjunct sentences over an extended vocabulary where
■ each normal form disjunct has the form:
Here each is a Presburger quantifier in the “modal form”:
each is a unary relation, is a binary relation, and and each is quantifier-free. We also require that each does not contain atoms of the form .
■ has a model of size if and only if has a model of size .
■ the size of each disjunct is polynomial in the size of .
Proof. The normalization procedure presented here is based on the corresponding procedure for in [16, Lemma 3.3], which in turn follows the usual normalization procedure for two-variable logic. Each -ary subformula of is associated with a fresh -ary predicate, which encodes the truth value of the corresponding subformula.
We describe the key new step, for mixed local and global Presburger quantifiers. Suppose that
Since we consider only self-loop-free models, never holds for any . Hence, is equivalent to
We introduce two fresh unary predicates associated with , together with fresh binary predicates and fresh unary predicates . We then replace every occurrence of in with and conjoin the resulting formula with the following
XX:59
constraints:
where is defined as follows: if is =, then is ; if is , then is =; if is , then is <.
Note that the conditions guarantee that U and partition the domain, and thus we have implications in both directions.
The remainder of the inductive steps are as in [16, Lemma 3.3]. These steps will be integrated into a bottom-up inductive procedure. We omit the details, but observe that the normalization procedure in [16, Lemma 3.3] does not introduce binary atoms which reverse the argument order from the original atoms. In particular, the fresh binary predicates introduced above preserve the direction of the original binary relations. Consequently, the normalization procedure preserves the outgoing-only restriction.
The inductive invariant will be that every structure and valuation satisfying the original formula expands to a model of the revised formula, and every structure and valuation satisfying the revised formula restricts to a model of the original formula.
We now show that the satisfiability of sentences in normal form as defined in Lemma 101 is NEXP-complete. We fix a normal form disjunct. We start with the main observation that simplifies the outgoing-only case. We can always restrict our attention to models where the 1-type determines the behavior, and thus we can describe a model with a much simpler set of linear constraints.
▶ Definition 102 (Outgoing 2-type, Outgoing behavior, TwoTps_{ }). A 2-type is outgoing if it consists only of binary predicates and , and contains at least one positive atom. We define the outgoing behavior of an element as the behavior whose indices are restricted to being outgoing 2-types.
We say that an outgoing 2-type is conformant with 1-types and (w.r.t. ), if for every ,
Following Definition 17, we denote by OneTps the 1-types that are conformant with the input sentence . We now let TwoTps_{ } denote the outgoing 2-types that are conformant with , , and .
▶ Definition 103 (Behavior homogeneity). We say a structure is behavior homogeneous if for all :
XX:60 Deciding two-variable logic with global and local Presburger quantification
We will show that if there is a satisfying structure, there is a behavior homogeneous one. We first give a sufficient condition for a transformation to preserve normal form disjuncts.
▷ Claim 104. Let and be structures. Suppose that there exists a bijection from to which preserves 1-types of vertices. Suppose also that for every , there exists such that and have the same 1-type and the same outgoing behavior, Then for every normal form disjunct if , then .
Proof. Suppose that
We show that by checking every component in .
For every , there exists , such that and have the same 1-type . Since , it holds that , which implies that . Therefore, .
For every edge with outgoing 2-type from with 1-type to with 1-type in , there exists with 1-type in such that and have the same outgoing behavior. Therefore, there exists an edge with outgoing 2-type from to some with 1-type in . Since , this implies that . Therefore .
We first observe that for every 1-type , since is a bijection that preserves 1-types, the number of elements in with 1-type is the same as the number in .
Next, note that for every vertex in , the evaluation of depends only on the outgoing behavior of and the count of elements with specific 1-types in . A similar property holds for in . By assumption, there exists an element in such that and have the same outgoing behavior. Since , if , then holds in , which implies that holds in .
The following key lemma gives the crucial property of outgoing-only languages: for the purposes of satisfiability, we can always deal with a behavior homogeneous structure. Again we emphasize that a similar homogeneity property was observed in earlier work, either concerning a different logic [13], or for a different purpose [10, Lemma 18]. And similar bounds were established – again for a different logic – in [28].
Lemma 105. If there is a structure that satisfies a normal form disjunct , then there exists a behavior homogeneous structure with the same cardinality which also satisfies .
Proof. We construct as follows. The set of elements is the same as . For any 1-type , let be the set of elements with that 1-type in . If is empty, then there is nothing to do. Otherwise, take an arbitrary , and for every other , ensure that the outgoing relations are exactly those of in . In the case that there is an relation from to in , we do not add a self-loop , but add instead.
Clearly the resulting structure has the same elements, is behavior homogeneous, and does not introduce new outgoing behaviors; in particular, note that making a change to the outgoing relations on one element cannot impact the outgoing behavior vector of another. The identity is a bijection satisfying the hypothesis of Claim 104, so the conclusion follows.
We are now ready to reduce satisfiability to solving a linear system.
XX:61
► Definition 106 (Linear system for an OutP² normal form disjunct). For any OutP² normal form disjunct , for any nonempty set of conformant 1-types, we define the integer linear system OutLinSysSat as follows:
There is a non-negative integer variable for every . Informally, this stands for the number of realizers of the 1-type in . We denote by the vector of these variables.
There is a non-negative integer variable for every and outgoing . Intuitively, this stands for the -degree of a element for edges linking to elements. We denote by the vector of these variables.
(Presburger constraint) For every 1-type , for , if , we include the following constraint, corresponding to a conjunct where the Presburger quantifier is in the normal form :
For each , if , then . To cover the case , we have .
(Sanity) For each
The following result shows that this system captures the cardinalities of finite models, which implies the semilinearity of the spectrum:
► Theorem 107. has a satisfying model of size exactly when there is some non-empty such that has a solution where .
Proof. Suppose has a satisfying model of size . Let be the set of 1-types realized in . Since is non-empty, is non-empty. By Lemma 105 and Claim 104, we may assume that is a behavior homogeneous structure. For each , let be the set of elements with 1-type . Since each is nonempty, by realizability of , we pick an arbitrary element . For each , , let be the set where denotes the outgoing-only two-type of the pair. Since is behavior homogeneous, the cardinality of does not depend on the choice of .
We claim that is a solution of OutLinSysSat. First, each Presburger constraint in OutLinSysSat is satisfied because , and thus for each element satisfying a considered in the constraint for , must hold of that element. Second, to see that the Capacity constraint is satisfied, note that . Thus in the case we have the desired bound. When we note that there cannot be a self-loop, by definition of a structure, and thus the upper bound follows for this case. The Sanity constraint is easily seen to hold by definition.
For the converse direction, suppose for some non-empty set , OutLinSysSat has a solution . We show how to construct a model that satisfies . For each , we have a set of elements and these sets are pairwise disjoint. By the sanity constraint, all are nonempty, and we will let their union be the domain of our structure. We set the 1-type of all the elements in to be . Then, for each element , we do the following.
XX:62 Deciding two-variable logic with global and local Presburger quantification
For each with and , we choose from the set a set of elements, while in the case , we choose from the set ; we do this in such a way that the sets for different and are pairwise disjoint.
Such sets exist due to the Capacity constraint.
Then for each , we set the 2-type of to be . The exception for the case above guarantees that we are not creating self-loops, as required for a structure. The 2-types of the remaining pairs for are set to be the null type. We claim that the constructed model satisfies . Indeed, satisfies , since the system has only variable where . Moreover, when we add an edge with outgoing 2-type from a vertex with 1-type to a vertex with 1-type , is conformant with and . Therefore, for every . Finally, satisfies because satisfies the Presburger constraint in the system . This completes the proof.
Theorem 107 immediately implies the desired upper bound:
► Theorem 108. The satisfiability problem for is in NEXP.
Proof. We can guess the disjunct first, then guess , and there are exponentially many choices for each. The system contains exponentially many variables, and exponentially many constraints. Since solving such constraints is in NP [27], we can find a solution in NEXP.
For the matching lower bound, we note that subsumes the logic -MC which is shown to be NEXP-complete in [28]. For completeness, we present its definition here.
► Definition 109 (-MC). The syntax of outgoing-only two-variable modal logic with global counting (-MC), over a vocabulary with a single binary predicate and unary predicates , is built up according to the following rules:
For every unary , the atom is a formula.
If is a formula, then so is .
If and are formulas, then so is .
If is a formula, then so is
If is a formula, then so is
The semantics of the Boolean connectives and existential quantifier is as usual. For the counting quantifier,
It was shown in [28] that finite satisfiability for -MC is NEXP-complete, using a reduction from the exponential tiling problem.
► Theorem 110. The finite satisfiability problem of -MC is NEXP-complete.
We conclude the section with the proof of the main result:
Proof (of Theorem 100). By Lemma 101 we may consider a normal form sentence. The upper bound was shown in Theorem 108.
For the matching lower bound, observe that -MC is contained in . In particular, the counting quantifier in -MC may be expressed via: .