Affiliation:
1. Queen's University, Canada
2. University of Cambridge, UK
Abstract
Bidirectional typechecking, in which terms either synthesize a type or are checked against a known type, has become popular for its applicability to a variety of type systems, its error reporting, and its ease of implementation. Following principles from proof theory, bidirectional typing can be applied to many type constructs. The principles underlying a bidirectional approach to indexed types (generalized algebraic datatypes) are less clear. Building on proof-theoretic treatments of equality, we give a declarative specification of typing based on focalization. This approach permits declarative rules for coverage of pattern matching, as well as support for first-class existential types using a focalized subtyping judgment. We use refinement types to avoid explicitly passing equality proofs in our term syntax, making our calculus similar to languages such as Haskell and OCaml. We also extend the declarative specification with an explicit rules for deducing when a type is principal, permitting us to give a complete declarative specification for a rich type system with significant type inference. We also give a set of algorithmic typing rules, and prove that it is sound and complete with respect to the declarative system. The proof requires a number of technical innovations, including proving soundness and completeness in a mutually recursive fashion.
Funder
Engineering and Physical Sciences Research Council
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
13 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. When Subtyping Constraints Liberate: A Novel Type Inference Approach for First-Class Polymorphism;Proceedings of the ACM on Programming Languages;2024-01-05
2. The Essence of Generalized Algebraic Data Types;Proceedings of the ACM on Programming Languages;2024-01-05
3. Focusing on Refinement Typing;ACM Transactions on Programming Languages and Systems;2023-12-20
4. Greedy Implicit Bounded Quantification;Proceedings of the ACM on Programming Languages;2023-10-16
5. Compilation Semantics for a Programming Language with Versions;Programming Languages and Systems;2023