论文标题

自动合成随机发电机,用于数值约束代数递归类型

Automatic Synthesis of Random Generators for Numerically Constrained Algebraic Recursive Types

论文作者

Ziat, Ghiles, Botbol, Vincent, Dien, Matthieu, Gotlieb, Arnaud, Pépin, Martin, Dubois, Catherine

论文摘要

在程序验证中,基于约束的随机测试是一种强大的技术,旨在生成满足程序功能属性的随机测试用例。但是,在递归受约束的数据结构(例如,排序的列表,二进制搜索树,四分之一)上,更一般而言,当结构受到高度约束时,很难生成均匀分布的输入。在本文中,我们介绍了作证:用户可以在其中定义用高级约束装饰的代数数据类型的框架。这些约束被解释为限制类型居民集的成员谓词。从这些定义中,作证会自动合成程序的部分规范,因此没有函数会产生违反约束的值(例如,插入节点不正确的二进制搜索树)。我们的框架通过检查此类属性的测试来增强原始程序。为了实现这一目标,我们会自动产生均匀的随机采样器,以产生满足约束的值并验证测试函数的输出的有效性。通过使用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.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源