Affiliation:
1. Microsoft Research, Cambridge, United Kingdom
2. Saarland University, Saarbrucken, Germany
3. Microsoft Corporation, Redmond, WA, USA
Abstract
We study a first-order functional language with the novel combination of the ideas of refinement type (the subset of a type to satisfy a Boolean expression) and type-test (a Boolean expression testing whether a value belongs to a type). Our core calculus can express a rich variety of typing idioms; for example, intersection, union, negation, singleton, nullable, variant, and algebraic types are all derivable. We formulate a semantics in which expressions denote terms, and types are interpreted as first-order logic formulas. Subtyping is defined as valid implication between the semantics of types. The formulas are interpreted in a specific model that we axiomatize using standard first-order theories. On this basis, we present a novel type-checking algorithm able to eliminate many dynamic tests and to detect many errors statically. The key idea is to rely on an SMT solver to compute subtyping efficiently. Moreover, interpreting types as formulas allows us to call the SMT solver at run-time to compute instances of types.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
9 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Revisiting occurrence typing;Science of Computer Programming;2022-05
2. Safety at speed: in-place array algorithms from pure functional programs by safely re-using storage;Proceedings of the 8th ACM SIGPLAN International Workshop on Functional High-Performance and Numerical Computing - FHPNC 2019;2019
3. Lessons learned from developing mbeddr: a case study in language engineering with MPS;Software & Systems Modeling;2017-01-09
4. A Logical Approach to Deciding Semantic Subtyping;ACM Transactions on Programming Languages and Systems;2015-10-16
5. Deciding Type-Based Partial-Order Constraints for Path-Sensitive Analysis;ACM Transactions on Software Engineering and Methodology;2015-05-13