Bayesian probabilistic programming languages (BPPLs) let users denote statistical models as code while the interpreter infers the posterior distribution. The semantics of BPPLs are usually mathematically complex and unable to reason about desirable properties such as expected values and independence of random variables. To reason about these properties in a non-Bayesian setting, probabilistic separation logics such as PSL and Lilac interpret separating conjunction as probabilistic independence of random variables. However, no existing separation logic can handle Bayesian updating, which is the key distinguishing feature of BPPLs. To close this gap, we introduce Bayesian separation logic (BaSL), a probabilistic separation logic that gives semantics to BPPL. We prove an internal version of Bayes' theorem using a result in measure theory known as the Rokhlin-Simmons disintegration theorem. Consequently, BaSL can model probabilistic programming concepts such as Bayesian updating, unnormalised distribution, conditional distribution, soft constraint, conjugate prior and improper prior while maintaining modularity via the frame rule. The model of BaSL is based on a novel instantiation of Kripke resource monoid via $σ$-finite measure spaces over the Hilbert cube, and the semantics of Hoare triple is compatible with an existing denotational semantics of BPPL based on the category of $s$-finite kernels. Using BaSL, we then prove properties of statistical models such as the expected value of Bayesian coin flip, correlation of random variables in the collider Bayesian network, the posterior distributions of the burglar alarm model, a parameter estimation algorithm, and the Gaussian mixture model.
翻译:贝叶斯概率编程语言(BPPLs)允许用户将统计模型表示为代码,而解释器则推断后验分布。BPPLs的语义通常数学上较为复杂,且无法推理期望值和随机变量独立性等期望性质。为了在非贝叶斯设置中推理这些性质,概率分离逻辑(如PSL和Lilac)将分离合取解释为随机变量的概率独立性。然而,现有分离逻辑均无法处理贝叶斯更新——这是BPPLs的关键区别特征。为填补这一空白,我们提出了贝叶斯分离逻辑(BaSL),这是一种为BPPL提供语义的概率分离逻辑。我们利用测度论中称为Rokhlin-Simmons分解定理的结果,证明了贝叶斯定理的内部版本。因此,BaSL能够建模贝叶斯更新、非归一化分布、条件分布、软约束、共轭先验和不恰当先验等概率编程概念,同时通过框架规则保持模块性。BaSL的模型基于希尔伯特立方体上σ有限测度空间对克里普克资源幺半群的新实例化,其霍尔三元组语义与基于s有限核范畴的现有BPPL指称语义兼容。利用BaSL,我们进而证明了统计模型的性质,如贝叶斯硬币抛掷的期望值、碰撞贝叶斯网络中随机变量的相关性、入侵警报模型的后验分布、参数估计算法以及高斯混合模型。