arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2301.09997cs.LO
收藏

通过 CPS 变换实现的高阶最弱前置条件变换器

Higher-Order Weakest Precondition Transformers via a CPS Transformation

Satoshi Kura

AI总结:

本文针对具有一般计算效应和递归的高阶函数式语言,提出了最弱前置条件变换器与 CPS 变换之间的一般关系,将含效应程序验证归约为纯程序验证,并展示了该框架在多种验证方法中的实例化与扩展能力。

摘要:

最弱前置条件是程序验证中的一个有用概念,因为它将程序验证问题归约为约束求解问题。最弱前置条件的范畴论推广已被研究,用于在一个统一框架中捕获各种计算效应和各种性质。在本文中,我们针对具有一般计算效应和递归的高阶函数式语言,提出了一种关于最弱前置条件变换器和 CPS 变换之间的新颖且一般的关系。在技术上,这给出了 [Aguirre & Katsumata, 2020] 中范畴论定义的一般最弱前置条件变换器的语法对应物。我们结果的有用性体现在三个方面:(1) 由于 CPS 变换能够纯化含效应的程序,针对含效应程序的各种验证问题可以归约为针对纯程序的验证问题。这种语法归约使得验证问题更容易求解,并潜在地促进了与为纯程序量身定制的其他复杂验证方法的结合。(2) 我们将两种现有的验证方法,即事件序列验证 [Kobayashi et al., 2018] 和期望成本验证 [Avanzini et al., 2021],作为我们框架的实例进行了捕获。(3) 我们的结果简化了将命令式程序的最弱前置条件变换器扩展至高阶程序的过程。我们展示了两种此类扩展:成本高阶矩分析和针对高阶概率程序的条件最弱前置期望。这些扩展表明我们的理论框架能够产生新颖的验证方法。

英文摘要:

Weakest preconditions are a useful notion for program verification as they reduce a problem of program verification to a problem of constraint solving. Category-theoretic generalisations of weakest preconditions have been studied to capture various computational effects and various properties in a unified framework. In this paper, we propose a novel and general relationship between weakest precondition transformers and CPS transformations for higher-order functional languages with general computational effects and recursion. Technically, this gives a syntactic counterpart of the categorically-defined generic weakest precondition transformer in [Aguirre & Katsumata, 2020]. The usefulness of our results is threefold. (1) Since CPS transformations purify effectful programs, various verification problems for effectful programs can be reduced to verification problems for pure programs. This syntactic reduction makes it easier to solve the verification problems and potentially facilitates combinations with other sophisticated verification methods tailored for pure programs. (2) We capture two existing verification methods, namely, verification of event sequences [Kobayashi et al., 2018] and expected cost [Avanzini et al., 2021] as instances of our framework. (3) Our results streamline the process of extending weakest precondition transformers for imperative programs to those for higher-order programs. We show two such extensions: analysis of higher moments of cost and the conditional weakest pre-expectation for higher-order probabilistic programs. These extensions demonstrate that our theoretical framework can produce novel verification methods.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑