A Model Counter's Guide to Probabilistic Systems

Marcell Vazquez-Chanlatte, Markus N. Rabe, Sanjit A. Seshia

Abstract

Analyzing probabilistic systems, such as Markov Chains and discrete distributions, often requires specialized tools that struggle with scalability or rare-event detection. This paper introduces a systematic framework for translating these systems into unweighted model counting problems (#SAT). By representing unbiased coin flips as raw inputs to Boolean circuits, the authors enable the use of high-performance, general-purpose SAT-based model counters for complex probabilistic inference.

Introduction

The verification and analysis of probabilistic systems are critical in fields ranging from robotics to finance. However, traditional approaches face significant hurdles. Monte Carlo sampling, while versatile, is notoriously inefficient at finding "rare events"—scenarios with extremely low probability that may nonetheless be catastrophic. Conversely, formal methods like Binary Decision Diagram (BDD)-based probabilistic model checking often fail to scale as system dimensionality increases.

In parallel, the field of Boolean Satisfiability (SAT) has experienced "Herculean improvements" in performance. Modern SAT solvers can handle millions of variables and constraints. Model counting (#SAT), the task of determining the number of satisfying assignments for a Boolean formula, has benefited from these advances. While weighted model counting has been used for probability, its algorithms are often specialized and difficult to maintain. This paper bridges the gap by providing a "gadget-based" framework to encode probabilistic models as unweighted #SAT problems, leveraging the fastest available SAT tools.

Methodology: From Bits to Probabilities

The Biased Coin Gadget

The fundamental building block of the framework is the simulation of biased coins using unbiased bits. A biased coin with probability $p/2^n$ can be modeled by feeding $n$ unbiased bits into a Boolean predicate. This predicate checks if the integer represented by the bits is less than a specific threshold. This "less-than" operator on unsigned integers effectively reduces weighted problems to unweighted ones in an intuitive and implementable manner.

Biased Coin Gadget: Simulating a biased coin using $n$ unbiased bits and a thresholding circuit.

Sequential Circuit Unrolling

To analyze systems that evolve over time, such as Markov Chains, the authors employ a technique similar to Bounded Model Checking. The system is represented as a sequential circuit, which is then "unrolled" for a fixed number of time steps $\tau$. This process transforms a temporal process into a single, large Boolean function that captures the entire trajectory of the system.

Sequential Circuit Unrolling: Transforming a temporal process into a large Boolean function over multiple time steps $\tau$.

Distribution Encodings

The framework provides three primary algorithms for modeling distributions over finite sets:

  1. Common Denominator Method: Handles any rational probability by finding a shared power-of-two denominator.
  2. Knuth and Yao’s Algorithm: An optimal method for simulating distributions using a "parse tree" encoded directly as a circuit.
  3. Binomial Distribution: A specialized sequential circuit that counts "successes" over multiple independent trials.

Furthermore, the authors demonstrate that conditional probabilities ($P(A|B)$) can be computed by taking the ratio of two separate model counts: one for the intersection $A \land B$ and one for the condition $B$.

Case Study: The Drunken Sailor

To evaluate the framework, the authors utilized the "Drunken Sailor" random walk benchmark. In this 1D scenario, a "sailor" moves forward, backward, or remains stationary on a pier. The objective is to calculate the probability of the sailor reaching a specific point (breaking a plank) within 10 steps.

The results highlight a significant performance leap. While traditional BDD-based methods required approximately one minute to complete the calculation, the proposed encoding paired with a modern approximate model counter, ApproxMC3, finished in just one second. This order-of-magnitude speedup demonstrates the potential of #SAT-based approaches for complex probabilistic verification.

Discussion and Future Work

A key insight of this work is the emphasis on Boolean functions (circuits) over raw constraints. By composing circuits for policies, transition relations, and property monitors, researchers can avoid the accidental inflation of model counts caused by redundant paths. The authors also mathematically prove that their biased-coin approach is structurally equivalent to previous, more complex reductions, but offers a more intuitive path for implementation.

Despite its strengths, the method currently relies on fixed time horizons, making the analysis of infinite-horizon properties a challenge. Additionally, while rational probabilities are handled perfectly, irrational values require approximation by increasing the bit-depth of the inputs. Future research will focus on automating the pipeline from high-level probabilistic programming languages to these optimized #SAT encodings, as well as extending the framework to handle unbounded temporal properties.

The authors have released their implementation in the Python library py-aiger-coins.

Summary updated

BibTeX
@misc{vazquezchanlatte2019model,
  author = {Marcell Vazquez-Chanlatte and Markus N. Rabe and Sanjit A. Seshia},
  title = {{A Model Counter's Guide to Probabilistic Systems}},
  year = {2019},
  eprint = {1903.09354},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1903.09354},
}
Figure