论文标题

数据流细化类型推理

Data Flow Refinement Type Inference

论文作者

Pavlinovic, Zvonimir, Su, Yusen, Wies, Thomas

论文摘要

改进类型可以对功能程序进行轻巧验证。静态推断细化类型的算法通常是通过还原到从键入派生中提取的约束喇叭子从句的解决系统来起作用的。一个示例是液体类型推断,该推断使用谓词抽象解决了提取的约束。但是,减少对解决方案本身的减少已经表明了影响整体静态分析精度的程序语义的抽象。为了更好地理解这个问题,我们通过抽象解释的角度研究了类型的推理问题。我们提出了一个新的改进类型系统,该系统具有参数性的,可以选择类型细化的抽象领域以及跟踪上下文敏感控制流信息的程度。然后,我们得出一种随附的参数推理算法,作为对功能程序的新型数据流语义学的抽象解释。我们进一步表明,相对于构造的抽象语义,类型系统是合理的,并且完整。我们的理论发展揭示了改进类型推理算法固有的关键抽象步骤。这些抽象步骤的精确度和效率之间的权衡取决于类型系统的参数。现有的细化类型系统及其各自的推理算法(例如液体类型)由混凝土参数实例捕获。我们已经在原型工具中实现了框架,并将其用于一系列新的参数实例(例如,使用Octagons和Polyhedra来表达类型的改进)。该工具可以与其他现有工具进行比较。我们的评估表明,我们的方法可用于系统地构建既健壮又精确的新的改进类型推理算法。

Refinement types enable lightweight verification of functional programs. Algorithms for statically inferring refinement types typically work by reduction to solving systems of constrained Horn clauses extracted from typing derivations. An example is Liquid type inference, which solves the extracted constraints using predicate abstraction. However, the reduction to constraint solving in itself already signifies an abstraction of the program semantics that affects the precision of the overall static analysis. To better understand this issue, we study the type inference problem in its entirety through the lens of abstract interpretation. We propose a new refinement type system that is parametric with the choice of the abstract domain of type refinements as well as the degree to which it tracks context-sensitive control flow information. We then derive an accompanying parametric inference algorithm as an abstract interpretation of a novel data flow semantics of functional programs. We further show that the type system is sound and complete with respect to the constructed abstract semantics. Our theoretical development reveals the key abstraction steps inherent in refinement type inference algorithms. The trade-off between precision and efficiency of these abstraction steps is controlled by the parameters of the type system. Existing refinement type systems and their respective inference algorithms, such as Liquid types, are captured by concrete parameter instantiations. We have implemented our framework in a prototype tool and evaluated it for a range of new parameter instantiations (e.g., using octagons and polyhedra for expressing type refinements). The tool compares favorably against other existing tools. Our evaluation indicates that our approach can be used to systematically construct new refinement type inference algorithms that are both robust and precise.

扫码加入交流群

加入微信交流群

微信交流群二维码

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