Singleton kinds and singleton types

In this dissertation I study the properties of singleton kinds and singleton types. These are extremely precise classifiers for types and values, respectively: the kind of all types equal to [a given type], and the type of all values equal to [a given value]. Singletons are interesting because they provide a very general and modular form of definition, allow fine-grained control of type computations, and allow many equational constraints to be expressed within the type system. This is useful, for example, when modeling the type sharing and type definition constraints appearing in module signatures in the Standard ML language; singletons are used for this purpose in the TILT compiler for Standard ML. However, the decidability of typechecking in the presence of singletons is not obvious. In order to typecheck a term, one must be able to determine whether two type constructors are provably equivalent. But in the presence of singleton kinds, the equivalence of type constructors depends both on the typing context in which they are compared and on the kind at which they are compared. In this dissertation I present MIL0, a lambda calculus with singletons that is based upon the representation used by the TILT compiler. I prove important properties of this language, including type soundness and decidability of typechecking. The main technical result is decidability of equivalence for well-formed type constructors. Inspired by Coquand's result for type theory, I prove decidability of constructor equivalence for MIL 0 by exhibiting a novel—though slightly inefficient—type-directed comparison algorithm. The correctness of this algorithm is proved using an interesting variant of Kripke-style logical relations: unary relations are indexed by a single possible world (in our case, a typing context), but binary relations are indexed by two worlds. Using this result I can then show the correctness of a natural, practical algorithm used by the TILT compiler.

[1]  Alan Mycroft,et al.  Polymorphic Type Schemes and Recursive Definitions , 1984, Symposium on Programming.

[2]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[3]  Matthias Felleisen,et al.  The theory and practice of first-class prompts , 1988, POPL '88.

[4]  John C. Mitchell,et al.  Higher-order modules and the phase distinction , 1989, POPL '90.

[5]  Robin Milner,et al.  Definition of standard ML , 1990 .

[6]  Robin Milner,et al.  Commentary on standard ML , 1990 .

[7]  Bjarne Stroustrup,et al.  The C++ Programming Language, Second Edition , 1991 .

[8]  Luca Cardelli,et al.  Subtyping recursive types , 1991, POPL '91.

[9]  B. Pierce Programming with intersection types and bounded polymorphism , 1992 .

[10]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.

[11]  Xavier Leroy,et al.  Manifest types, modules, and separate compilation , 1994, POPL '94.

[12]  T Bell,et al.  An Implementation of Higher-Order FunctorsPierre Cr , 1994 .

[13]  Mads Tofte,et al.  A Semantics for Higher-Order Functors , 1994, ESOP.

[14]  Mark Lillibridge,et al.  A type-theoretic approach to higher-order modules with sharing , 1994, POPL '94.

[15]  Erik Poll,et al.  Pure Type Systems with Definitions , 1994, LFCS.

[16]  Giorgio Ghelli,et al.  Decidability and Confluence of \beta\eta\hboxtop_\le Reduction in F_\le , 1994, Inf. Comput..

[17]  David Aspinall,et al.  Subtyping with Singleton Types , 1994, CSL.

[18]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[19]  Greg Morrisett,et al.  Compiling with Types , 1995 .

[20]  Xavier Leroy,et al.  Applicative functors and fully transparent higher-order modules , 1995, POPL '95.

[21]  M. Hofmann Extensional concepts in intensional type theory , 1995 .

[22]  David Tarditi,et al.  Design and Implementation of Code Optimizations for a Type-Directed Compiler for Standard ML. , 1996 .

[23]  Robert Harper,et al.  Typed closure conversion , 1996, POPL '96.

[24]  John C. Mitchell,et al.  Foundations for programming languages , 1996, Foundation of computing series.

[25]  Andrew Shalit,et al.  The Dylan Reference Manual: The Definitive Guide to the New Object-Oriented Dynamic Language , 1996 .

[26]  David Aspinall,et al.  Type systems for modular programs and specifications , 1997 .

[27]  Robert Harper,et al.  An Interpretation of Standard ML in Type Theory , 1997 .

[28]  M. Lillibridge Translucent Sums: A Foundation for Higher-Order Module Systems , 1997 .

[29]  Andrew W. Appel,et al.  Lambda-splitting: a higher-order approach to cross-module optimizations , 1997, ICFP '97.

[30]  Karl Crary Type-Theoretic Methodology for Practical Programming Languages , 1998 .

[31]  Matthias Blume,et al.  Hierarchical modulatory and intermodule optimization , 1998 .

[32]  Robert Harper,et al.  Transparent and Opaque Interpretations of Datatypes , 1998 .

[33]  George C. Necula,et al.  Compiling with proofs , 1998 .

[34]  Zhong Shao Typed cross-module compilation , 1998, ICFP '98.

[35]  Karl Crary A simple proof technique for certain parametricity results , 1999, ICFP '99.

[36]  MorrisettGreg,et al.  From system F to typed assembly language , 1999 .

[37]  David Aspinall Subtyping with Power Types , 2000, CSL.

[38]  Robert Harper,et al.  Abstract 1 Introduction , 2022 .

[39]  Robert Harper,et al.  A type-theoretic interpretation of standard ML , 2000, Proof, Language, and Interaction.

[40]  J. Palsberg,et al.  and Flexible Matching of Recursive Types , 2001 .