Type-Directed Discretization of Probabilistic Programs (Extended Version)
2026-08-17 • Programming Languages
Programming Languages
AI summaryⓘ
The authors study a way to turn recursive, higher-order probabilistic programs that use continuous values into equivalent discrete versions without losing meaning. They focus on programs where continuous values are only compared against a finite set of constants, allowing the problem to be simplified. Their main idea, called Slice, analyzes and rewrites the program so that continuous values are divided into a finite number of important regions. They prove their method is correct and show it helps existing discrete inference tools work on tricky continuous problems, performing well compared to existing exact inference methods.
probabilistic programmingdiscretizationcontinuous distributionsrecursive functionshigher-order functionsexact inferenceoperational semanticscouplingtype-directed analysislogical relations
Authors
Katherine Wu, Jules Jacobs, Kevin Batz, Alexandra Silva
Abstract
We study exact discretization as a semantics-preserving transformation for recursive, higher-order probabilistic programs with continuous distributions. We target programs where continuous values are compared against finitely many constants, so exact inference reduces to a discrete problem. Our central technical contribution is a non-local, type-directed analysis that infers where continuous values can be partitioned into finitely many observationally relevant regions, then rewrites sampling and comparison behavior over those regions. We call this transformation Slice. Because this construction is global and type-directed, correctness requires reasoning beyond the local syntax: we formalize the transformation and prove soundness for boolean queries using a coupling-style logical relations argument over operational semantics. As an application, transformed programs can be executed by discrete engines such as Dice, Roulette, and Storm. Our empirical evaluation shows two complementary strengths of Slice when paired with discrete backends: it enables exact inference for challenging continuous programs that lie beyond the reach of previous exact systems, and, on benchmarks where direct comparison is possible, it is competitive with state-of-the-art exact inference systems for continuous programs.