Weighted First-Order Model Counting in the Two-Variable Fragment With Counting Quantifiers

Ondrej Kuzelka

Abstract

Probabilistic inference in large-scale relational domains is often hindered by the exponential growth of possible configurations. This paper establishes that the two-variable fragment of first-order logic with counting quantifiers ($C^2$) is domain-liftable, meaning weighted first-order model counting (WFOMC) can be performed in polynomial time relative to the domain size. By employing a reduction to global cardinality constraints and leveraging polynomial interpolation, the proposed method expands the class of tractable logic-based models for statistical relational learning.

Introduction

In Statistical Relational Learning (SRL), the challenge of scaling inference to domains with millions of objects is central. Weighted First-Order Model Counting (WFOMC) serves as a foundational tool for calculating probabilities in these domains. A key milestone in the field was the discovery that the two-variable fragment ($FO^2$) is domain-liftable. However, $FO^2$ lacks the expressivity to handle counting constraints, such as functional dependencies or specific degree requirements in graphs. This work addresses this limitation by proving domain-liftability for the $C^2$ fragment, which incorporates counting quantifiers like $\exists_{=k}$ and $\exists_{\le k}$.

Methodology

The core contribution of this work is a constructive proof based on two primary techniques: reduction and interpolation.

Reduction to Global Cardinality

The author demonstrates that local counting quantifiers can be "compiled" into global constraints. By introducing auxiliary relations and appropriate "bookkeeping" predicates, complex counting requirements are transformed into constraints on the total number of true atoms (cardinality) within a relation. This allows the problem to be solved using standard $FO^2$ logic augmented with global cardinality constraints.

Polynomial Interpolation

To compute the model counts efficiently, the WFOMC problem is framed as a polynomial evaluation. The author introduces Weighted Model-Counting Functions (WMC-functions), which output a distribution of counts. By querying a standard WFOMC oracle at specific points, the coefficients of the polynomial—representing the desired counts—are extracted using Lagrange interpolation. Notably, this approach utilizes rational weights, avoiding the implementation complexities associated with complex-valued weights in Fourier-based methods.

Experimental Validation

The theoretical framework was validated using several combinatorial benchmarks, including $k$-regular graphs and the distribution of fixed points in random functions.

Joint distributions of counts $N(\xi_1, \omega)$ and $N(\xi_2, \omega)$ for combinatorial structures, illustrating the output of WMC-functions.

As shown in Figure 1, the method can compute the joint distribution of multiple properties. For instance, in the study of functional structures, these heatmaps represent the frequency of specific configurations (e.g., number of fixed points vs. number of cycles) across the domain. The accuracy of the method was further confirmed by counting 2-regular graphs on domains of up to 10 vertices, with results perfectly aligning with the On-Line Encyclopedia of Integer Sequences (OEIS A001205).

Conclusion

The proof of Theorem 4 establishes that $C^2$ is domain-liftable, providing a significant theoretical advancement for relational AI. The interpolation-based "oracle" approach offers a practical pathway for enhancing existing inference tools. Future work will focus on extending these results to asymmetric weights—currently a #P-complete problem—and optimizing the transformation process for high-degree counting constraints. The observed connection between these logical methods and generating functions in enumerative combinatorics suggests further opportunities for cross-disciplinary optimization.

Summary updated

BibTeX
@article{kuzelka2021weighted,
  author = {Ondrej Kuzelka},
  title = {{Weighted First-Order Model Counting in the Two-Variable Fragment With Counting Quantifiers}},
  journal = {J. Artif. Intell. Res.},
  year = {2021},
  doi = {10.1613/jair.1.12320},
}
Figure