Convergence Laws for Extensions of First-Order Logic with Averaging

Sam Adam-Day, Michael Benedikt, Alberto Larrauri

Abstract

This paper investigates the asymptotic behavior of real-valued logics that extend first-order logic (FO) with averaging and supremum operators. While classical FO obeys zero-one laws on random graphs—where properties are either almost surely true or almost surely false—modern data processing tasks such as Graph Neural Network (GNN) message passing and SQL aggregation require a more nuanced, real-valued approach. We present a framework for proving convergence laws for the logic Agg[Mean, LMean, Sup] on both dense and sparse Erdős-Rényi graphs. By introducing "controllers" as asymptotic proxies and developing real-valued pebble games, we demonstrate that complex statistical queries remain asymptotically stable, converging in probability for dense graphs and in distribution for sparse graphs.

Introduction

In the study of finite model theory, the zero-one law for first-order logic is a foundational result: for a wide class of random graphs, any property expressible in FO has a probability that tends to either 0 or 1 as the number of vertices $n$ grows to infinity. However, this binary framework is insufficient for modern computational needs. Today's data systems frequently compute averages, percentages, and maximums—operations that standard FO cannot express.

This paper addresses the gap by providing a mathematical foundation for the asymptotic behavior of queries involving aggregation. The authors define a real-valued logic that incorporates global and local averaging, proving that even as structures grow infinitely large, these aggregate queries follow predictable statistical laws.

The Logic: Agg[Mean, LMean, Sup]

The authors introduce Agg[Mean, LMean, Sup], a logic designed to capture the essence of modern aggregate-heavy computations. The logic consists of several key components:

  • Global Mean: Computes the average value of a term across all nodes in the graph.
  • Local Mean (LMean): Computes the average value of a term across a node's immediate neighbors. This specifically mimics the message-passing mechanism found in GNNs.
  • Global Supremum (Sup): Identifies the maximum value of a term, acting as a continuous generalization of the existential quantifier ($\exists$).
  • Lipschitz Connectives: Rather than relying solely on Boolean operators (AND/OR), the logic allows for any Lipschitz continuous function to combine terms, facilitating "fuzzy" or continuous logical reasoning.

Methodology

To establish convergence, the research utilizes two primary theoretical innovations:

1. Aggregate Elimination and Controllers

The authors demonstrate that for sufficiently large graphs, complex terms containing averages can be replaced by "controllers." These are simpler functions that depend only on local graph structures or global constants. The core insight is that in a large random graph, the law of large numbers ensures that the average of a local property is essentially a constant. As $n \to \infty$, the difference between a logical term and its controller vanishes.

2. Real-Valued Pebble Games

Classical Ehrenfeucht-Fraïssé games are used to determine if two graphs are logically indistinguishable. The authors adapt this into a real-valued version. These games determine if two featured graphs are "close enough" such that the logic cannot distinguish them beyond a small error margin $\epsilon$. This provides a metric for logical equivalence in a continuous space.

Convergence on Random Structures

The paper evaluates the logic against standard probabilistic models, revealing a critical divergence between dense and sparse environments:

  • Dense Erdős-Rényi Graphs ($G(n, p)$): In these models, where edge probability $p$ is constant, every closed term in the logic converges in probability to a constant. This effectively extends the classical FO zero-one law to real-valued aggregates.
  • Linear Sparse Erdős-Rényi Graphs ($G(n, c/n)$): In sparse models where the average degree remains constant, the logic converges in distribution. Because sparse graphs retain "jittery" local structures (like small cycles) even as they grow, the queries do not settle on a single constant but rather a predictable random variable. This generalizes earlier work by Lynch (1992) regarding FO on sparse structures.

Key Results and Insights

The research provides a roadmap for "eliminating" global aggregators, showing that the value of a complex query on a massive graph is determined by the distribution of small local neighborhoods (the "$r$-core"). The primary findings include:

  1. Stability of Averages: In large random graphs, the "Mean" operator can be replaced by an expected value because the graph is "locally similar" almost everywhere.
  2. Quantifier Elimination: The authors prove that global aggregators can be systematically reduced to local properties, allowing for the simplification of complex queries on large-scale data.

Limitations and Future Directions

While the paper establishes a robust foundation, several areas remain for future exploration:

  • The Summation Problem: The logic explicitly excludes the SUM operator. Unlike means, sums typically grow with the size of the graph ($n$), meaning they do not converge without specific normalization.
  • Computational Complexity: While the authors suggest that computing these limits in the dense case might be in PSPACE, a full algorithmic complexity analysis is still required.
  • Intermediate Growth Rates: The behavior of this logic on graphs with edge probabilities like $p = n^{-\alpha}$ (for irrational $\alpha$) remains unknown; these are known to produce complex, non-convergent behavior in standard FO.
  • Relational Structures: The current focus is on binary relations (graphs). Extending this framework to general relational databases with higher-arity relations is a logical next step for the theory.

Summary updated

Abstract

For many standard models of random structure, first-order logic sentences exhibit a convergence phenomenon on random inputs. The most well-known example is for random graphs with constant edge probability, where the probabilities of first-order sentences converge to 0 or 1. In other cases, such as certain ``sparse random graph'' models, the probabilities of sentences converge, although not necessarily to 0 or 1. In this work we deal with extensions of first-order logic with aggregate operators, variations of averaging. These logics will consist of real-valued terms, and we allow arbitrary Lipschitz functions to be used as ``connectives''. We show that some of the well-known convergence laws extend to this setting.
BibTeX
@inproceedings{adamday2025convergence,
  author = {Sam Adam-Day and Michael Benedikt and Alberto Larrauri},
  title = {{Convergence Laws for Extensions of First-Order Logic with Averaging}},
  booktitle = {LICS},
  year = {2025},
}
Figure