Record Details
Field | Value |
---|---|
Title | Extending Type Inference to Variational Programs |
Names |
Chen, Sheng
(creator) Erwig, Martin (creator) Walkingshaw, Eric (creator) |
Date Issued | 2014-03 (iso8601) |
Note | This is an author's peer-reviewed final manuscript, as accepted by the publisher. The published article is copyrighted by the Association for Computing Machinery and can be found at: http://toplas.acm.org/. |
Abstract | Through the use of conditional compilation and related tools, many software projects can be used to generate a huge number of related programs. The problem of typing such variational software is difficult. The brute-force strategy of generating all variants and typing each one individually is (1) usually infeasible for efficiency reasons and (2) produces results that do not map well to the underlying variational program. Recent research has focused mainly on efficiency and addressed only the problem of type checking. In this work we tackle the more general problem of variational type inference and introduce variational types to represent the result of typing a variational program. We introduce the variational lambda calculus (VLC) as a formal foundation for research on typing variational programs. We define a type system for VLC in which VLC expressions are mapped to correspondingly variational types. We show that the type system is correct by proving that the typing of expressions is preserved over the process of variation elimination, which eventually results in a plain lambda calculus expression and its corresponding type. We identify a set of equivalence rules for variational types and prove that the type unification problem modulo these equivalence rules is unitary and decidable; we also present a sound and complete unification algorithm. Based on the unification algorithm, the variational type inference algorithm is an extension of algorithm W. We show that it is sound and complete and computes principal types. We also consider the extension of VLC with sum types, a necessary feature for supporting variational data types, and demonstrate that the previous theoretical results also hold under this extension. Finally, we characterize the complexity of variational type inference and demonstrate the efficiency gains over the brute-force strategy. |
Genre | Article |
Topic | variational lambda calculus |
Identifier | Chen, S., Erwig, M., & Walkingshaw, E. (2014). Extending type inference to variational programs. ACM Transactions on Programming Languages and Systems, 36(1), 1. doi:10.1145/2518190 |