| | |
Summary: Subtyping with Singleton Types
David Aspinall
Department of Computer Science, University of Edinburgh, U.K.
email: da@dcs.ed.ac.uk
Abstract. We give syntax and a PERmodel semantics for a typed –calculus with
subtypes and singleton types. The calculus may be seen as a minimal calculus of sub
typing with a simple form of dependent types. The aim is to study singleton types
and to take a canny step towards more complex dependent subtyping systems. Single
ton types have applications in the use of type systems for specification and program
extraction: given a program P we can form the very tight specification fPg which is
met uniquely by P . Singletons integrate abbreviational definitions into a type system:
the hypothesis x : fMg asserts x = M . The addition of singleton types is a non
conservative extension of familiar subtyping theories. In our system, more terms are
typable and previously typable terms have more (nondependent) types.
1 Introducing Singletons and Subtyping
Type systems for current programming languages provide only coarse distinctions amongst
data values: Real, Bool, String, etc. Constructive type theories for program specification
can provide very fine distinctions such as fx 2 Nat j Prime(x)g, but often terms contain non
computational parts, or else typechecking is undecidable. We want to study type systems
in between where terms do not contain unnecessary codes and, ideally, typechecking is
|