We present Lilac, a separation logic for reasoning about probabilistic programs where separating conjunction captures probabilistic independence. Inspired by an analogy with mutable state where sampling corresponds to dynamic allocation, we show how probability spaces over a fixed, ambient sample space appear to be the natural analogue of heap fragments, and present a new combining operation on them such that probability spaces behave like heaps and measurability of random variables behaves like ownership. This combining operation forms the basis for our model of separation, and produces a logic with many pleasant properties. In particular, Lilac has a frame rule identical to the ordinary one, and naturally accommodates advanced features like continuous random variables and reasoning about quantitative properties of programs. Then we propose a new modality based on disintegration theory for reasoning about conditional probability. We show how the resulting modal logic validates examples from prior work, and give a formal verification of an intricate weighted sampling algorithm whose correctness depends crucially on conditional independence structure.
翻译:我们提出了一种分离逻辑Lilac,可以用于推理概率程序,其中分离合取可以捕获概率独立性。我们受到可变状态与动态分配的相似之处的启示,说明了如何建立在固定环境样本空间上的概率空间看作是堆碎片的自然模型,并且提出了一种新的组合操作,使得概率空间可以像堆一样工作,并且随机变量的可测性表现为所有权。这种组合操作是我们分离模型的基础,形成了一种具有许多良好特性的逻辑。特别地,Lilac具有与普通基本逻辑相同的帧规则,并自然包容先进的特征,如连续随机变量和对程序的数量性质进行推理等。然后,我们提出了一种基于分解理论的新的模态,用于推理条件概率。我们展示了由此产生的模态逻辑验证了以前工作中的例子,并给出了一个细致的有权重的抽样算法的形式化验证,其正确性关键取决于条件独立结构。