arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.19053cs.PL
收藏

通过 eta 展平子类型化

Flattening subtyping by eta expansion

Jana Dunfield

AI总结:

本文介绍了通过 eta 展开来避免深度子类型化复杂性的技术,提供了完整证明并探讨其在类型系统设计中的应用。

摘要:

为了设计使用子类型化的类型系统,我们必须做出权衡。深度子类型化比浅层子类型化更具表达力,因为深度子类型化比较类型的整个结构。然而,浅层子类型化更容易推理。通过对源程序进行 eta 展开,我们可以获得深度子类型化的效果,同时减少其复杂性。一篇关于过滤模型的早期论文(Barendregt 等人,1983年)考察了两个相似的 intersection 类型系统。第一个系统包含一个使用丰富子类型化关系的 subsumption 规则,包括针对 top 类型的多条规则和一条 distributivity 规则。他们的第二个类型系统去掉了 subsumption 规则,但增加了一条允许项在类型化之前进行 eta 展开的规则。第二个类型系统中的这条规则弥补了缺乏 subsumption 的不足:在第一个类型系统使用子类型化来操作类型深处的 intersection 的地方,第二个类型系统直接在 eta 展开创建的子项上使用引入和消除规则。作为计算来看,他们对第二个(浅层)系统的完备性证明执行了 eta 展开。因此,我们可以将他们的证明视为发明了应用 eta 展开来避免深度子类型化。本文作为使用 eta 展开来消除深度子类型化的教程,将 Barendregt 等人(1983年)对该技术的发明置于上下文中,给出了相关引理的完整证明,并讨论了如何将该技术应用于类型系统设计。

英文摘要:

To design type systems that use subtyping, we have to make tradeoffs. Deep subtyping is more expressive than shallow subtyping, because deep subtyping compares the entire structure of types. However, shallow subtyping is easier to reason about. By eta-expanding source programs, we can get the effect of deep subtyping with less of its complexity. An early paper on filter models (Barendregt et al. 1983) examined two similar intersection type systems. The first included a subsumption rule that used a rich subtyping relation, including multiple rules for the top type and a distributivity rule. Their second type system dropped the subsumption rule, but added a rule that allowed a term to be eta-expanded before typing it. This rule in their second type system compensated for the lack of subsumption: where their first type system used subtyping to manipulate intersections deep inside types, their second type system used introduction and elimination rules directly on the subterms created by eta-expansion. Viewed as a computation, their proof of completeness for the second (shallow) system performs eta-expansion. Thus, we can regard their proof as inventing the application of eta-expansion to avoid deep subtyping. This paper serves as a tutorial on using eta-expansion to obviate deep subtyping, puts the invention of the technique by Barendregt et al. (1983) into context, gives a complete proof of the relevant lemma, and discusses how the technique can be used in type system design.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑