检查程序的观察纯度
Checking Observational Purity of Procedures
摘要:
判断一个过程在观察上是否是纯的在许多软件工程场景中是有用的。一个纯观测过程总是为相同的参数返回相同的值,因此模仿一个数学函数。当过程使用私有可变全局变量时,问题是具有挑战性的,例如,用于经常返回的答案的记忆,以及当它们涉及递归时。我们提出了一种新的验证方法,这个问题。我们的方法涉及到编码过程的代码作为一个公式,是一个析取路径约束,与递归调用被替换在公式中引用一个数学函数符号。然后,调用一个定理证明器来检查已经构造的公式是否与上面提到的函数符号在所有参数的输入输出行为方面一致。我们评估我们的方法上的一组现实的例子,使用Boogie中间语言和定理证明。我们的评估表明,不变量很容易手动构建,我们的方法是有效的,在验证观测纯程序。
英文摘要:
Verifying whether a procedure is observationally pure is useful in many software engineering scenarios. An observationally pure procedure always returns the same value for the same argument, and thus mimics a mathematical function. The problem is challenging when procedures use private mutable global variables, e.g., for memoization of frequently returned answers, and when they involve recursion. We present a novel verification approach for this problem. Our approach involves encoding the procedure's code as a formula that is a disjunction of path constraints, with the recursive calls being replaced in the formula with references to a mathematical function symbol. Then, a theorem prover is invoked to check whether the formula that has been constructed agrees with the function symbol referred to above in terms of input-output behavior for all arguments. We evaluate our approach on a set of realistic examples, using the Boogie intermediate language and theorem prover. Our evaluation shows that the invariants are easy to construct manually, and that our approach is effective at verifying observationally pure procedures.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。