Bayesian Separation Logic
Jialu Ho, Nicolas Wu, Azalea Raad ยท POPL 2026 ยท
arXiv:2507.15530
Prereqs: ๐ Staton 2025 (Hoare triples, wp). Some comfort with probabilistic programming helps.
Separation logic for Bayesian programs. The frame rule says: if a program only touches variables x, then independent variables y are unaffected. Independence IS the separating conjunction. Hoare logic for probabilistic programs where "separate" means "statistically independent."
Hoare triples for probabilistic programs
A Bayesian Hoare triple {P} c {Q} says: if the prior satisfies P, then after running the probabilistic program c, the posterior satisfies Q. The programs are written in a probabilistic language with sampling, conditioning (observe), and Bayesian inference built in.
s-finite kernels
The semantics uses s-finite kernels โ a generalization of probability kernels that allows unnormalized measures. This is necessary because conditioning (observe) can produce unnormalized distributions. The s-finite kernel framework makes composition well-defined even through observations.
The frame rule โ independence as separation
The frame rule is the core of separation logic: if {P} c {Q} and c doesn't touch variables in R, then {P * R} c {Q * R}. Here, * is the separating conjunction. In the Bayesian setting, P * R means P and R hold on independent variables. The frame rule says: independent variables stay independent after the program runs.
Composing Bayesian programs
Sequential composition of Bayesian programs chains the s-finite kernels. The COMP rule from ๐ Staton 2025 carries over: if {P} cโ {R} and {R} cโ {Q}, then {P} cโ;cโ {Q}. The handshake works for probabilistic programs too.
Notation reference
| Paper | Python | Meaning |
|---|---|---|
| {P} c {Q} | assert P(prior); c; assert Q(posterior) | Bayesian Hoare triple |
| P * R | # independent joint | Separating conjunction (independence) |
| observe(e) | weighted = {h: p*lk(h,e) ...} | Condition on evidence |
| s-finite kernel | # unnormalized dict | Generalized probability kernel |
| FRAME | # independent vars preserved | Frame rule (independence survives) |
Neighbors
Other paper pages
- ๐ Staton 2025 โ Hoare logic for deterministic programs (this extends it to Bayesian)
- ๐ Jacobs 2014 โ wp-semantics via fibrations (the theoretical backbone)
- ๐ Gaboardi 2021 โ graded Hoare logic (grades track side effects)
- ๐ Di Lavore 2025 โ partial Markov categories (conditioning as restriction)
Related foundations
- ๐ง Lovelace Ch.2 Bayesian Inference โ Bayesian updating in cognitive science, the applied side of the lens
Foundations (Wikipedia)
Translation notes
All examples use finite distributions as dicts. Ho, Wu, and Raad work with s-finite kernels on measurable spaces โ a generalization that handles continuous distributions, unnormalized measures, and measure-zero conditioning events. For example: the frame rule demonstration on this page uses a 2ร2 joint distribution over coin flips. In the paper, the frame rule applies to arbitrary probabilistic programs with continuous random variables, and the separating conjunction is defined via product ฯ-algebras and independence of ฯ-sub-algebras. The "independent variables stay independent" intuition is the same; the measure-theoretic formalization is not.
Every example is Simplified.
Read the paper. Start at ยง3 for the Bayesian Hoare logic, ยง5 for the frame rule, ยง4 for s-finite kernel semantics.
Framework connection: Bayesian separation logic extends the COMP rule to probabilistic programs โ the same handshake composition the Natural Framework pipeline uses, now with independence as the separating conjunction. (
Ambient Category,
The Handshake)