paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems

面向 Hindley-Milner 风格类型与效应系统的快速高效布尔合一
OOPSLA 7(OOPSLA2)2023匹配度 2/10 · 论文核心是 Hindley-Milner 风格类型与效应系统中的布尔合一算法及 Flix 编译器优化,属于程序语言与类型系统方向;但未涉及用户重点关注的 ML/Agentic 静态分析、LLM 与静态分析/形式化验证交叉、浮点程序分析或贝叶斯程序分析。引用 4 inbox
Magnus Madsen, Jaco van de Pol, Troels Henriksen
crossref: 2026-09-10

AI 速览

一句话:提出基于SVE的混合布尔合一算法并用于Flix,将类型与效应推断开销显著降低,编译吞吐提升1.8倍。

表达力更强的类型与效应系统对高效类型推断提出更高要求。本文面向基于布尔公式的多态效应系统,其推断需布尔合一;因涉及语义等价,语法驱动合一不足,已有布尔合一技术也不适合类型推断。作者提出基于 Boole 逐次变量消去(SVE)的混合算法,利用实际查询多为简单、灵活变量少、易重复且存在长尾复杂查询等特点,并结合 tabling 与二元决策图等公式最小化策略。该算法在 Flix 中实现,实验显示编译吞吐从 8,580 行/秒增至 15,917 行/秒(1.8 倍),类型与效应推断开销仅 16%,总编译开销低于 7%,各设计选择均提升性能。

问题
在表达力渐强的多态类型与效应系统中,类型推断需要布尔合一;传统语法驱动合一因语义等价而不足,已有布尔合一技术又不适合类型推断,成为编译性能瓶颈。
方法
提出基于 Boole 逐次变量消去(SVE)的混合算法,利用实际查询简单、灵活变量少、重复及长尾复杂等特征,并结合 tabling、二元决策图等公式最小化策略。
评估
在 Flix 编译器中实现并实验评估:编译吞吐从 8,580 行/秒提升至 15,917 行/秒(1.8 倍),类型与效应推断开销仅 16%,总编译开销低于 7%,并通过消融验证各设计选择有效。
原文摘要(Abstract)

As type and effect systems become more expressive there is an increasing need for efficient type inference. We consider a polymorphic effect system based on Boolean formulas where inference requires Boolean unification. Since Boolean unification involves semantic equivalence, conventional syntax-driven unification is insufficient. At the same time, existing Boolean unification techniques are ill-suited for type inference. We propose a hybrid algorithm for solving Boolean unification queries based on Boole’s Successive Variable Elimination (SVE) algorithm. The proposed approach builds on several key observations regarding the Boolean unification queries encountered in practice, including: (i) most queries are simple, (ii) most queries involve a few flexible variables, (iii) queries are likely to repeat due similar programming patterns, and (iv) there is a long tail of complex queries. We exploit these observations to implement several strategies for formula minimization, including ones based on tabling and binary decision diagrams. We implement the new hybrid approach in the Flix programming language. Experimental results show that by reducing the overhead of Boolean unification, the compilation throughput increases from 8,580 lines/sec to 15,917 lines/sec corresponding to a 1.8x speed-up. Further, the overhead on type and effect inference time is only 16% which corresponds to an overhead of less than 7% on total compilation time. We study the hybrid approach and demonstrate that each design choice improves performance.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1872,
  title = {Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems},
  author = {Magnus Madsen and Jaco van de Pol and Troels Henriksen},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {OOPSLA2},
  year = {2023},
  doi = {10.1145/3622816}
}