To support the understanding of declarative probabilistic programming languages, we introduce a lambda-calculus with a fair binary probabilistic choice that chooses between its arguments with equal probability. The reduction strategy of the calculus is a call-by-need strategy that performs lazy evaluation and implements sharing by recursive let-expressions. Expected convergence of expressions is the limit of the sum of all successful reduction outputs weighted by their probability. We use contextual equivalence as program semantics: two expressions are contextually equivalent if and only if the expected convergence of the expressions plugged into any program context is always the same. We develop and illustrate techniques to prove equivalences including a context lemma, two derived criteria to show equivalences and a syntactic diagram-based method. This finally enables us to show correctness of a large set of program transformations with respect to the contextual equivalence.
翻译:为支持对宣示性概率编程语言的理解,我们引入了一种具有公平二进制概率选择的羊排计算法,该计算法在两个参数之间作出选择的概率相等。微积分的削减战略是一种按需要进行慢用的战略,进行懒惰的评价,并通过循环式人工表达方式进行共享。预期表达式的趋同性是所有按概率加权的成功减序输出的总和的极限。我们使用环境等值作为程序语义:两种表达法在背景上是等同的,如果而且只有在任何程序背景中插入的表达法的预期趋同性总是相同。我们开发和演示了证明等同性的技术,包括上下文 Lemma、两个显示等同的衍生标准以及一个组合式图表法方法。这最终使我们能够显示与上下文等同性有关的大量程序转换的正确性。