Weighted Automata for Exact Inference in Discrete Probabilistic Programs
Dominik Geißler, Tobias Winkler
TL;DR
This work tackles exact inference for loop-free, discrete probabilistic programs by encoding distributions over $\mathbb{N}$-valued variables as Probability Generating Automata (PGA) and translating program constructs into automata operations. The core idea is to map prior distributions to posteriors through a recursive automata-transformer that implements operations such as label substitution, concatenation, and guard-product, ensuring the result is a valid PGA representing the (unnormalized) posterior and, after normalization, the posterior distribution. The authors prove soundness of these automata-transformations with respect to an established operational semantics based on Markov chains, and provide a complexity analysis highlighting potential exponential growth in the worst case. The framework enables exact inference for a rich class of loop-free probabilistic programs and lays groundwork for future extensions to broader syntactic forms and distributions, with potential integration into existing model-checking tooling.
Abstract
In probabilistic programming, the inference problem asks to determine a program's posterior distribution conditioned on its "observe" instructions. Inference is challenging, especially when exact rather than approximate results are required. Inspired by recent work on probability generating functions (PGFs), we propose encoding distributions on $\mathbb{N}^k$ as weighted automata over a commutative alphabet with $k$ symbols. Based on this, we map the semantics of various imperative programming statements to automata-theoretic constructions. For a rich class of programs, this results in an effective translation from prior to posterior distribution, both encoded as automata. We prove that our approach is sound with respect to a standard operational program semantics.
