Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems
Magnus Madsen, Jaco van de Pol, Troels Henriksen
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 1 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Qualified Types with Boolean Algebras 引用了 Polymorphic types and effects with Boolean unification
- Qualified Types with Boolean Algebras 引用了 Fixpoints for the masses: programming with first-class Datalog constraints
- Qualified Types with Boolean Algebras 引用了 Relational nullable types with Boolean unification
- Relational nullable types with Boolean unification 引用了 Polymorphic types and effects with Boolean unification
- Relational nullable types with Boolean unification 引用了 Fixpoints for the masses: programming with first-class Datalog constraints
引用它的顶会 Paper1
它引用的 Paper3
- Fixpoints for the masses: programming with first-class Datalog constraintsMagnus Madsen, Ondrej LhotákOOPSLA 2020 · 22 次引用
- Polymorphic types and effects with Boolean unificationMagnus Madsen, Jaco van de PolOOPSLA 2020 · 18 次引用
- Relational nullable types with Boolean unificationMagnus Madsen, Jaco van de PolOOPSLA 2021 · 9 次引用
相关 Paper
- When Subtyping Constraints Liberate: A Novel Type Inference Approach for First-Class PolymorphismLionel Parreaux, Aleksander Boruch-Gruszecki, Andong Fan, Chun Yin ChauPOPL 2024 · 13 次引用
- Associated Effects: Flexible Abstractions for Effectful ProgrammingMatthew Lutze, Magnus MadsenPLDI 2024 · 9 次引用
- Let Generalization, Polymorphic Recursion, and Variable Minimization in Boolean-Kinded Type SystemsJoseph A. ZulloPOPL 2026 · 1 次引用
- Making Formulog Fast: An Argument for Unconventional Datalog EvaluationAaron Bembenek, Michael Greenberg, Stephen ChongOOPSLA 2024 · 3 次引用
- Flix: A Design for Language-Integrated DatalogMagnus Madsen, Ondrej LhotákOOPSLA 2025
