数值约束代数递归型随机生成器的自动综合
Automatic Synthesis of Random Generators for Numerically Constrained Algebraic Recursive Types
摘要:
在程序验证中,基于约束的随机测试是一种强有力的技术,其目的是生成满足程序功能特性的随机测试用例。然而,在递归约束数据结构(例如,排序列表、二叉搜索树、四叉树),并且更一般地,当结构受到高度约束时,难以生成均匀分布的输入。在本文中,我们提出了Testify:一个框架,在该框架中,用户可以定义代数数据类型装饰高层次的约束。这些约束被解释为限制类型的居民集的成员资格谓词。从这些定义中,Testify会自动合成程序的部分规范,这样就不会有函数产生违反约束的值(例如,节点插入不当的二叉搜索树)。我们的框架增加了原始程序的测试,检查这些属性。为了实现这一点,我们自动产生均匀的随机采样器,生成满足约束的值,并验证测试函数输出的有效性。通过使用Boltzmann采样生成递归数据结构的形状,并使用约束求解生成均匀分布的有限域变量值,我们的框架保证了测试用例的大小约束均匀采样。我们提供了我们的框架上的几个关键数据结构,是开发人员的实际相关的用例。实验结果令人鼓舞。
英文摘要:
In program verification, constraint-based random testing is a powerful technique which aims at generating random test cases that satisfy functional properties of a program. However, on recursive constrained data-structures (e.g., sorted lists, binary search trees, quadtrees), and, more generally, when the structures are highly constrained, generating uniformly distributed inputs is difficult. In this paper, we present Testify: a framework in which users can define algebraic data-types decorated with high-level constraints. These constraints are interpreted as membership predicates that restrict the set of inhabitants of the type. From these definitions, Testify automatically synthesises a partial specification of the program so that no function produces a value that violates the constraints (e.g. a binary search tree where nodes are improperly inserted). Our framework augments the original program with tests that check such properties. To achieve that, we automatically produce uniform random samplers that generate values which satisfy the constraints, and verifies the validity of the outputs of the tested functions. By generating the shape of a recursive data-structure using Boltzmann sampling and generating evenly distributed finite domain variable values using constraint solving, our framework guarantees size-constrained uniform sampling of test cases. We provide use-cases of our framework on several key data structures that are of practical relevance for developers. Experiments show encouraging results.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。