We address the problem of verifying that the functions of a program meet their contracts, specified by pre/postconditions. We follow an approach based on constrained Horn clauses (CHCs) by which the verification problem is reduced to the problem of checking satisfiability of a set of clauses derived from the given program and contracts. We consider programs that manipulate algebraic data types (ADTs) and a class of contracts specified by catamorphisms, that is, functions defined by simple recursion schemata on the given ADTs. We show by several examples that state-of-the-art CHC satisfiability tools are not effective at solving the satisfiability problems obtained by direct translation of the contracts into CHCs. To overcome this difficulty, we propose a transformation technique that removes the ADT terms from CHCs and derives new sets of clauses that work on basic sorts only, such as integers and booleans. Thus, when using the derived CHCs there is no need for induction rules on ADTs. We prove that the transformation is sound, that is, if the derived set of CHCs is satisfiable, then so is the original set. We also prove that the transformation always terminates for the class of contracts specified by catamorphisms. Finally, we present the experimental results obtained by an implementation of our technique when verifying many non-trivial contracts for ADT manipulating programs.
翻译:我们处理的是核查某一方案的职能是否符合其合同的问题,由预先/附加条件加以规定。我们采取基于限制的合恩条款(CHCs)的方法,将核查问题减到检查源自特定方案和合同的一组条款的相对性问题。我们考虑的是操纵代数数据类型(ADTs)和一种由变异主义规定的合同类型的程序,即由给定的ADTs上的简单重复计划确定的功能。我们用几个例子来表明,先进的CHC可视性工具在解决通过将合同直接转换为CHCs获得的可视性问题方面是无效的。为了克服这一困难,我们提出了一种转换技术,将ADTs条款从CHCs中删除,并产生一套仅对基本内容起作用的新的条款,例如整数和布林亚。因此,当使用衍生的CHCs在给定的ADTs上岗规则时,不需要对ADTs进行上岗规则。我们证明,这种转换是有道理的,如果直接将合同转换为CHCsrevis最终通过实验程序来验证我们的原始程序,那么,我们所制定的Ctrealfisalalalalalizalizal laction合同也是可以实现的。