决定不决定:高阶多态存在下的健全且完备的效果推断
Deciding not to Decide: Sound and Complete Effect Inference in the Presence of Higher-Rank Polymorphism
AI总结:
本文提出一种针对带子类型和高阶多态的类型-效果系统的效果推断算法,通过将约束转为命题逻辑延迟求解,证明其健全性与完备性,并在现实语言中实现。
摘要:
类型-效果系统帮助程序员组织程序中的数据与计算效果。虽然对于传统类型系统,已开发出具有复杂推断算法的表达性变体,并在编程语言中被广泛使用,但类型-效果系统尚未获得广泛采用。原因之一是类型-效果系统更为复杂,且现有的推断算法在表达性、直观性和可判定性之间做出妥协。在本工作中,我们提出了一种针对具有子类型、表达性高阶多态以及直观的集合式效果语义的类型-效果系统的效果推断算法。为了处理高阶多态的作用域问题,我们将效果约束的求解延迟,通过将其转换为命题逻辑公式。我们证明了我们的算法相对于声明式类型-效果系统的健全性和完备性。所有呈现的结果已在Rocq证明助手中形式化,并且该算法已在一个现实编程语言中成功实现。
英文摘要:
Type-and-effect systems help the programmer to organize data and computational effects in a program. While for traditional type systems expressive variants with sophisticated inference algorithms have been developed and widely used in programming languages, type-and-effect systems did not yet gain widespread adoption. One reason for this is that type-and-effect systems are more complex and the existing inference algorithms make compromises between expressiveness, intuitiveness, and decidability. In this work, we present an effect inference algorithm for a type-and-effect system with subtyping, expressive higher-rank polymorphism, and intuitive set-like semantics of effects. In order to deal with scoping issues of higher-rank polymorphism, we delay solving of effect constraints by transforming them into formulae of propositional logic. We prove soundness and completeness of our algorithm with respect to a declarative type-and-effect system. All the presented results have been formalized in the Rocq proof assistant, and the algorithm has been successfully implemented in a realistic programming language.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。