Affiliation:
1. University of Hong Kong, China
2. KU Leuven, Belgium
Abstract
Modern functional programming languages, such as Haskell or OCaml, use sophisticated forms of type inference. While an important topic in the Programming Languages research, there is little work on the mechanization of the metatheory of type inference in theorem provers. In particular we are unaware of any complete formalization of the type inference algorithms that are the backbone of modern functional languages.
This paper presents the first full mechanical formalization of the metatheory for higher-ranked polymorphic type inference. The system that we formalize is the bidirectional type system by Dunfield and Krishnaswami (DK). The DK type system has two variants (a declarative and an algorithmic one) that have been
manually
proven
sound
,
complete
and
decidable
. We present a mechanical formalization in the Abella theorem prover of DK’s declarative type system with a novel algorithmic system. We have a few reasons to use a new algorithm. Firstly, our new algorithm employs
worklist judgments
, which precisely capture the scope of variables and simplify the formalization of scoping in a theorem prover. Secondly, while DK’s original formalization comes with very well-written manual proofs, there are several details missing and some incorrect proofs, which complicate the task of writing a mechanized proof. Despite the use of a different algorithm we prove the same results as DK, although with significantly different proofs and proof techniques. Since such type inference algorithms are quite subtle and have a complex metatheory, mechanical formalizations are an important advance in type-inference research.
Funder
Hong Kong Research Grant Council
Research Foundation Flanders
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Contextual Typing;Proceedings of the ACM on Programming Languages;2024-08-15
2. When Subtyping Constraints Liberate: A Novel Type Inference Approach for First-Class Polymorphism;Proceedings of the ACM on Programming Languages;2024-01-05
3. Greedy Implicit Bounded Quantification;Proceedings of the ACM on Programming Languages;2023-10-16
4. Bidirectional Typing;ACM Computing Surveys;2022-06-30
5. Research Report: The Parsley Data Format Definition Language;2020 IEEE Security and Privacy Workshops (SPW);2020-05