โ† back to index

Bayesian Separation Logic

Jialu Ho, Nicolas Wu, Azalea Raad ยท POPL 2026 ยท arxiv arXiv:2507.15530

Prereqs: ๐Ÿž Staton 2025 (Hoare triples, wp). Some comfort with probabilistic programming helps.

wpSeparation 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."

prior P program c sample; observe posterior Q R (independent, untouched) R R P * R → c → Q * R * = separating conjunction (independence)

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.

Python

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.

Python

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.

Python

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.

Python

Notation reference

Paper Python Meaning
{P} c {Q}assert P(prior); c; assert Q(posterior)Bayesian Hoare triple
P * R# independent jointSeparating conjunction (independence)
observe(e)weighted = {h: p*lk(h,e) ...}Condition on evidence
s-finite kernel# unnormalized dictGeneralized probability kernel
FRAME# independent vars preservedFrame rule (independence survives)
Neighbors

Other paper pages

Related foundations

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.

Ready for the real thing? arxiv 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. (jkAmbient Category, jkThe Handshake)