Semiring Programming: A Framework for Search, Inference and Learning

Vaishak Belle, Luc De Raedt

Abstract: To solve hard problems, AI relies on a variety of disciplines such as logic, probabilistic reasoning, machine learning and mathematical programming. Although it is widely accepted that solving real-world problems requires an integration amongst these, contemporary representation methodologies offer little support for this. In an attempt to alleviate this situation, we introduce a new declarative programming framework that provides abstractions of well-known problems such as SAT, Bayesian inference, generative models, and convex optimization. The semantics of programs is defined in terms of first-order structures with semiring labels, which allows us to freely combine and integrate problems from different AI disciplines.

Introduction: The Fragmentation of AI

Artificial Intelligence is currently a fragmented landscape. Solving a logic puzzle typically requires SAT solvers; calculating probabilities necessitates probabilistic programming; and minimizing costs relies on mathematical programming. While real-world applications—such as robotics or complex logistics—demand an integration of these disciplines, contemporary representation methodologies offer little support for a unified approach.

To address this, the authors introduce Semiring Programming (SP), a declarative framework that provides a "universal language" for AI. By labeling first-order logic structures with semiring values, SP allows researchers to model hybrid problems—like a robot that must simultaneously plan paths, learn from sensors, and optimize its grip—within a single, mathematically rigorous system.

The Semiring Programming Framework

The core of Semiring Programming is defined by a simple yet powerful equation:

Program = Logical Theory + Semiring + Solver

  • Logical Theory: This defines the "world" using first-order logic, specifying what is possible (e.g., "a robot cannot occupy two distinct locations simultaneously").
  • Semiring: An algebraic structure $(S, \oplus, \otimes, 0, 1)$ that defines how to "sum" ($\oplus$) and "multiply" ($\otimes$) values. By swapping the semiring, the nature of the problem changes. For instance, using $(+, \times)$ performs probabilistic inference, while $(\min, +)$ performs mathematical optimization.
  • Weight Function: This assigns values (weights) to the "models" or "worlds" allowed by the logic.

Handling the Infinite and Non-Classical

A key innovation of SP is its extension to infinite and continuous domains. By incorporating measure theory (specifically $\sigma$-algebras), the framework can calculate the volume of a polyhedron or the probability density of a continuous variable. Furthermore, the authors introduce Compositionality, a formal method to merge different semiring programs, such as combining a linear regression model with a discrete logic planner.

Theoretical Subsumption and Expressiveness

The authors argue that nearly all hard AI problems are essentially "Sum-Product" problems. The primary difference lies in the underlying logic and the specific operators used for summation and multiplication. By abstracting the "how" of computation, SP allows users to describe constraints and values while the "count" (the result of semiring operations) provides the solution.

Classification of AI problems within the Semiring Programming framework.

Unlike previous frameworks like Algebraic Model Counting (AMC), which were limited to propositional logic, SP handles first-order logic and non-standard semantics like Answer Set Programming (ASP). As shown in the classification table above, SP formally subsumes a wide range of problems across finite and infinite domains. This includes classic logic tasks like SAT and Graph Coloring, machine learning tasks like Matrix Factorization, and hybrid tasks like Robot Navigation that combine linear regression with probabilistic belief updating.

Challenges and Future Outlook

While SP offers immense expressive power, it faces a classic trade-off: Tractability vs. Expressiveness. Moving to first-order logic and continuous domains makes efficient solving significantly harder, as the framework loses the "easy" tractability of propositional arithmetic circuits.

The current focus is on the semantics (the mathematical meaning) of the programs. While the authors suggest Optimization Modulo Theories (OMT) as a promising path for building a general-purpose solver, a fully realized, high-performance SP solver remains a goal for future work. Additionally, researchers must carefully handle richer fragments of logic to avoid undecidability—problems that are mathematically impossible for a computer to solve.

Ultimately, Semiring Programming represents a significant step toward a unified AI, providing the mathematical foundation needed to bridge the gap between discrete reasoning and continuous optimization.

Summary updated

BibTeX
@misc{belle2016semiring,
  author = {Vaishak Belle and Luc De Raedt},
  title = {{Semiring Programming: A Framework for Search, Inference and Learning}},
  year = {2016},
  eprint = {1609.06954},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1609.06954},
}
Figure