arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2106.00937cs.PLcs.CC
收藏

压缩数组程序:通过归纳降秩的循环验证

Putting the Squeeze on Array Programs: Loop Verification via Inductive Rank Reduction

Oren Ish Shalom, Shachar Itzhaky, Noam Rinetzky, Sharon Shoham

摘要:

数组操作程序的自动验证是一个具有挑战性的问题,因为它往往相当于归纳量化循环不变量的推理,在某些情况下,甚至可能不是一阶可表达的。在本文中,我们提出了一种新的验证技术,这是基于归纳的用户定义的排名程序状态作为一种替代循环不变。我们的技术,被称为归纳降秩,分为两步。首先,我们简化了验证问题,证明了当输入状态包含长度为B或更小的输入数组时,程序是正确的,使用数组的长度作为状态的秩。其次,我们利用一个压缩函数g将一个长度> B的数组的程序状态sigma转换为一个长度小于等于1的数组的状态g(sigma),证明了当g满足一定的自然条件时,如果程序违反了sigma的规范,那么它也违反了g(sigma)的规范。程序对任意长度数组的输入的正确性由归纳法得出。我们使我们的技术自动数组程序的执行长度是成比例的输入数组的长度,(i)执行的第一步使用符号执行,(ii)验证所需的条件g使用Z3,和(iii)提供一个启发式的过程合成g。我们实现了我们的技术,并成功地将其应用到几个有趣的arraymanipulating程序,包括双向求和程序,其循环不变量不能表示在一阶逻辑,而其规范是量词自由。

英文摘要:

Automatic verification of array manipulating programs is a challenging problem because it often amounts to the inference of in ductive quantified loop invariants which, in some cases, may not even be firstorder expressible. In this paper, we suggest a novel verification tech nique that is based on induction on userdefined rank of program states as an alternative to loopinvariants. Our technique, dubbed inductive rank reduction, works in two steps. Firstly, we simplify the verification problem and prove that the program is correct when the input state con tains an input array of length B or less, using the length of the array as the rank of the state. Secondly, we employ a squeezing function g which converts a program state sigma with an array of length > B to a state g(sigma) containing an array of length minus 1 or less. We prove that when g satisfies certain natural conditions then if the program violates its specification on sigma then it does so also on g(sigma). The correctness of the program on inputs with arrays of arbitrary lengths follows by induction. We make our technique automatic for array programs whose length of execution is proportional to the length of the input arrays by (i) perform ing the first step using symbolic execution, (ii) verifying the conditions required of g using Z3, and (iii) providing a heuristic procedure for syn thesizing g. We implemented our technique and applied it successfully to several interesting arraymanipulating programs, including a bidirec tional summation program whose loop invariant cannot be expressed in firstorder logic while its specification is quantifier free.

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

↑