This paper presents the first slicing approach for probabilistic programs based on specifications. We show that when probabilistic programs are accompanied by their specifications in the form of pre- and post-condition, we can exploit this semantic information to produce specification-preserving slices strictly more precise than slices yielded by conventional techniques based on data/control dependency. To achieve this goal, our technique is based on the backward propagation of post-conditions via the greatest pre-expectation transformer -- the probabilistic counterpart of Dijkstra weakest pre-condition transformer. The technique is termination-sensitive, allowing to preserve the partial as well as the total correctness of probabilistic programs w.r.t. their specifications. It is modular, featuring a local reasoning principle, and is formally proved correct. As fundamental technical ingredients of our technique, we design and prove sound verification condition generators for establishing the partial and total correctness of probabilistic programs, which are of interest on their own and can be exploited elsewhere for other purposes. On the practical side, we demonstrate the applicability of our approach by means of a few illustrative examples and a case study from the probabilistic modelling field. We also describe an algorithm for computing least slices among the space of slices derived by our technique.
翻译:本文介绍了基于规格的概率方案的第一个筛选方法。 我们表明,当概率方案及其规格以预产期和后期形式附以其规格时,我们可以利用这种语义信息来制作严格比基于数据/控制依赖性的常规技术产生的切片更为精确的规格保存片段。为了实现这一目标,我们的技术是基于通过最先进的预产期前变压器(Dijkstra最弱的预产期变压器的概率对应器)来后向传播后方。这种技术对终止敏感,允许保留部分和完全正确性概率方案的规格。它是模块化的,具有局部推理原理,并被正式证明是正确的。作为我们技术的基本技术成分,我们设计和证明健全的核查条件的产生者是确定概率方案的部分和完全正确性,这种方案本身很有意义,可以在别处用于其他目的。在实际方面,我们展示了我们方法的实用性,我们的方法是用少数说明性例子来保存概率方案的局部和完全正确性。我们用一种模型来描述我们从空间分析模型的模型中最差的方法。