一句话:提出合并共享索引的归纳关系的算法,生成等价合取关系,显著提升自动生成性能并简化 Coq 机械化证明。
归纳关系是证明助手 Coq 中表达程序规约并支持组合推理的常用方式,QuickChick 可自动派生满足归纳关系的值生成器。但当多个归纳关系约束同一数据时,生成器性能会急剧下降。本文提出一种合并两个共享索引的归纳定义性质的算法:它识别两关系间的共享结构,构造一个可证明等价于二者合取的单合并关系。案例研究表明,合并后的关系可将自动生成性能提升数个数量级,并通过消除嵌套归纳和繁琐的低层簿记来简化机械化证明。
Inductive relations offer a powerful and expressive way of writing program specifications while facilitating compositional reasoning. Their widespread use by proof assistant users has made them a particularly attractive target for proof engineering tools such as QuickChick, a property-based testing tool for Coq which can automatically derive generators for values satisfying an inductive relation. However, while such generators are generally efficient, there is an infrequent yet seemingly inevitable situation where their performance greatly degrades: when multiple inductive relations constrain the same piece of data. In this paper, we introduce an algorithm for merging two such inductively defined properties that share an index. The algorithm finds shared structure between the two relations, and creates a single merged relation that is provably equivalent to the conjunction of the two. We demonstrate, through a series of case studies, that the merged relations can improve the performance of automatic generation by orders of magnitude, as well as simplify mechanized proofs by getting rid of the need for nested induction and tedious low-level book-keeping.