当前位置: X-MOL 学术arXiv.cs.PL › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Tabled Typeclass Resolution
arXiv - CS - Programming Languages Pub Date : 2020-01-13 , DOI: arxiv-2001.04301
Daniel Selsam, Sebastian Ullrich, Leonardo de Moura

Typeclasses provide an elegant and effective way of managing ad-hoc polymorphism in both programming languages and interactive proof assistants. However, the increasingly sophisticated uses of typeclasses within proof assistants, especially within Lean's burgeoning mathematics library, mathlib, have elevated once-theoretical limitations of existing typeclass resolution procedures into major impediments to ongoing progress. The two most devastating limitations of existing procedures are exponential running times in the presence of diamonds and divergence in the presence of cycles. We present a new procedure, tabled typeclass resolution, that solves both problems by tabling, which is a generalization of memoizing originally introduced to address similar limitations of early logic programming systems. We have implemented our procedure for the upcoming version (v4) of Lean, and have confirmed empirically that our implementation is exponentially faster than existing systems in the presence of diamonds. Although tabling is notoriously difficult to implement, our procedure is notably lightweight and could easily be implemented in other systems. We hope our new procedure facilitates even more sophisticated uses of typeclasses in both software development and interactive theorem proving.

中文翻译:

表类型类解析

类型类提供了一种优雅而有效的方式来管理编程语言和交互式证明助手中的临时多态性。然而,类型类在证明助手中的日益复杂的使用,尤其是在 Lean 蓬勃发展的数学库 mathlib 中,已经将现有类型类解析程序的一度理论限制提升为正在进行的进展的主要障碍。现有程序的两个最具破坏性的限制是存在菱形时的指数运行时间和存在循环时的发散。我们提出了一个新的过程,表格类型类解析,它通过表格解决了这两个问题,这是最初为解决早期逻辑编程系统的类似限制而引入的记忆化的概括。我们已经为即将推出的精益版本 (v4) 实施了我们的程序,并根据经验证实,在存在钻石的情况下,我们的实施速度比现有系统快得多。虽然制表是出了名的难以实现,但我们的程序非常轻量级,可以很容易地在其他系统中实现。我们希望我们的新程序能够在软件开发和交互式定理证明中促进更复杂的类型类使用。
更新日期:2020-01-22
down
wechat
bug