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

Research output: Contribution to journalJournal articleResearchpeer-review

Standard

Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems. / Madsen, Magnus; van de Pol, Jaco; Henriksen, Troels.

In: Proceedings of the ACM on Programming Languages, Vol. 7, No. OOPSLA2, 240, 2023.

Research output: Contribution to journalJournal articleResearchpeer-review

Harvard

Madsen, M, van de Pol, J & Henriksen, T 2023, 'Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems', Proceedings of the ACM on Programming Languages, vol. 7, no. OOPSLA2, 240. https://doi.org/10.1145/3622816

APA

Madsen, M., van de Pol, J., & Henriksen, T. (2023). Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems. Proceedings of the ACM on Programming Languages, 7(OOPSLA2), [240]. https://doi.org/10.1145/3622816

Vancouver

Madsen M, van de Pol J, Henriksen T. Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems. Proceedings of the ACM on Programming Languages. 2023;7(OOPSLA2). 240. https://doi.org/10.1145/3622816

Author

Madsen, Magnus ; van de Pol, Jaco ; Henriksen, Troels. / Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems. In: Proceedings of the ACM on Programming Languages. 2023 ; Vol. 7, No. OOPSLA2.

Bibtex

@article{c5388cf115e746bb980a31f08b0b68e8,
title = "Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect Systems",
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.",
keywords = "Boolean unification, Hindley-Milner type systems, type inference",
author = "Magnus Madsen and {van de Pol}, Jaco and Troels Henriksen",
note = "Publisher Copyright: {\textcopyright} 2023 Owner/Author.",
year = "2023",
doi = "10.1145/3622816",
language = "English",
volume = "7",
journal = "Proceedings of the ACM on Programming Languages",
issn = "2475-1421",
publisher = "ACM",
number = "OOPSLA2",

}

RIS

TY - JOUR

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

AU - Madsen, Magnus

AU - van de Pol, Jaco

AU - Henriksen, Troels

N1 - Publisher Copyright: © 2023 Owner/Author.

PY - 2023

Y1 - 2023

N2 - 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.

AB - 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.

KW - Boolean unification

KW - Hindley-Milner type systems

KW - type inference

U2 - 10.1145/3622816

DO - 10.1145/3622816

M3 - Journal article

AN - SCOPUS:85174938299

VL - 7

JO - Proceedings of the ACM on Programming Languages

JF - Proceedings of the ACM on Programming Languages

SN - 2475-1421

IS - OOPSLA2

M1 - 240

ER -

ID: 390399735