Article
 

Extending Type Inference to Variational Programs

Public Deposited

Downloadable Content

Download PDF
https://ir.library.oregonstate.edu/concern/articles/kk91fn42h

Descriptions

Attribute NameValues
Creator
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.
  • 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/.
  • Keywords: variational type inference, variational types, variational lambda calculus
Resource Type
DOI
Date Available
Date Issued
Citation
  • 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
Journal Title
Journal Volume
  • 36
Journal Issue/Number
  • 1
Rights Statement
Funding Statement (additional comments about funding)
  • This work is supported by the Air Force Office of Scientific Research under the grant FA9550-09-1-0229 and by the National Science Foundation under the grants CCF-0917092 and CCF-1219165.
Publisher
Peer Reviewed
Language
Replaces

Relationships

Parents:

This work has no parents.

Items