Preliminary Investigation of a Calculus with Intersection and Union Types

Type systems based on the concept of intersection types 3, 4, 5] have been extensively studied in recent years, both as tools for the analysis of the pure-calculus and, more recently, as the basis for practical programming languages such as Forsythe 16]. The dual construction, union types, also appears to be of potential practical interest. For example, by expressing more reened types for functions, union types allow a restricted form of abstract interpretation to be performed during typechecking. This report summarizes the results of a preliminary investigation of a simple typed-calculus with intersection and union types. Section 1 introduces the concrete syntax and typing rules of the language. Section 2 presents a number of small programs illustrating various aspects of the language and indicating some of its expressive power. Section 3 gives a semantics in the form of rules for equality between typed terms and exhibits a PER model validating these rules. Section 4 discusses the decidability of typechecking. Section 5 relates this work to some other recent investigations of similar formulations of union types. Section 6 describes planned future work. N.b. This report describes work in a preliminary stage of development. It is likely that further investigation of both semantic considerations (e.g. the validity of deMorgan's laws and the general categorical characterization of union types) and algorithmic issues (e.g. the correctness and eeciency of the typechecking procedure proposed here) will lead to substantial changes in the formulation of the language and its interpretation. 1 Syntax 1.1 Notational Conventions This section introduces the notational conventions used in the rest of the report and deenes the concrete syntax of a simple typed-calculus _ (\lambda union") with intersection and union types. b range over terms; x ranges over a set Var of variables.