Skip to Main content Skip to Navigation

Polymorphic set-theoretic types for functional languages

Abstract : We study set-theoretic types: types that include union, intersection, and negation connectives. Set-theoretic types, coupled with a suitable subtyping relation, are useful to type several programming language constructs – including conditional branching, pattern matching, and function overloading – very precisely. We define subtyping following the semantic subtyping approach, which interprets types as sets and defines subtyping as set inclusion. Our set-theoretic types are polymorphic, that is, they contain type variables to allow parametric polymorphism. We extend previous work on set-theoretic types and semantic subtyping by showing how to adapt them to new settings and apply them to type various features of functional languages. More precisely, we integrate semantic subtyping with three important language features. In Part I we study implicitly typed languages with let-polymorphism and type inference (previous work on semantic subtyping focused on explicitly typed languages). We describe an implicitly typed lambda-calculus and a declarative type system for which we prove soundness. We study type inference and prove results of soundness and completeness. Then, we show how to make type inference more precise when programs are partially annotated with types. In Part II we study gradual typing. We describe a new approach to add gradual typing to a static type system; the novelty is that we give a declarative presentation of the type system, while previous work considered algorithmic presentations. We first illustrate the approach on a Hindley-Milner type system without subtyping. We describe declarative typing, compilation to a cast language, and sound and complete type inference. Then, we add set-theoretic types, defining a subtyping relation on set-theoretic gradual types, and we describe sound type inference for the extended system. In Part III we consider non-strict semantics. The existing semantic subtyping systems are designed for call-by-value languages and are unsound for non-strict semantics. We adapt them to obtain soundness for call-by-need. To do so, we introduce an explicit representation for divergence in the types, allowing the type system to distinguish the expressions that are already evaluated from those that are computations which might diverge.
Document type :
Complete list of metadatas

Cited literature [136 references]  Display  Hide  Download
Contributor : Tommaso Petrucciani <>
Submitted on : Saturday, May 4, 2019 - 4:15:46 PM
Last modification on : Friday, April 10, 2020 - 5:28:41 PM
Long-term archiving on: : Wednesday, October 2, 2019 - 9:49:59 AM


Files produced by the author(s)


  • HAL Id : tel-02119930, version 1


Tommaso Petrucciani. Polymorphic set-theoretic types for functional languages. Programming Languages [cs.PL]. Università di Genova; Université Sorbonne Paris Cité – Université Paris Diderot, 2019. English. ⟨tel-02119930⟩



Record views


Files downloads