Model Enumeration of Two-Variable Logic with Quadratic Delay Complexity
Qiaolan Meng, Juhua Pu, Hongting Niu, Yuyi Wang, Yuanhong Wang, Ondřej Kuželka
TL;DR
This work studies model enumeration for the two-variable fragment of first-order logic ($\mathbf{FO}^2$) over a finite domain, fixed sentence, and variable domain size $n$. It introduces a refined domain-recursion approach that enumerates unary and binary substructures separately, achieving a delay of $\tilde{O}(n^2)$ between consecutive models (for a fixed $\Gamma$), which is near-optimal given the $\Omega(n^2)$ bits needed to specify binary predicates. The key technical engine converts substructure consistency checks into a configuration decision problem via domain reduction, Tseitin encoding, and unary encoding of binary facts, enabling constant-time qualification of configurations and a quadratic-delay overall enumeration. The method extends to $\mathbf{FO}^2$ with equality, and empirical results show stable, low-delay performance, outperforming all-SAT-based approaches. This establishes fixed-parameter tractability for FO$^2$ model enumeration and suggests avenues for extending the approach to other tractable fragments and multi-sorted logics.
Abstract
We study the model enumeration problem of the function-free, finite domain fragment of first-order logic with two variables ($FO^2$). Specifically, given an $FO^2$ sentence $Γ$ and a positive integer $n$, how can one enumerate all the models of $Γ$ over a domain of size $n$? In this paper, we devise a novel algorithm to address this problem. The delay complexity, the time required between producing two consecutive models, of our algorithm is quadratic in the given domain size $n$ (up to logarithmic factors) when the sentence is fixed. This complexity is almost optimal since the interpretation of binary predicates in any model requires at least $Ω(n^2)$ bits to represent.
