arXiv:2610.39108cs.LOOct 2026

Manuscript Offprint

arXiv:2610.39108

Deciding two-variable logic with global and local Presburger quantification

Michael Benedikt, Chia-Hsuan Lu, Alex Perry, Tony Tan

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 ϕ\phi 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 yy such that ϕ(x,y)\phi(x, y)”. 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 xx in a colored graph like “xx 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 xx via linear inequalities between the counts of subformulas ϕi(x,y)\phi_i(x, y). 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.