Inmathematical logic, theintersection type discipline is a branch oftype theory encompassingtype systems that use theintersection type constructor to assign multiple types to a single term.[1]In particular, if a term can be assignedboth the type and the type, then can be assigned theintersection type (and vice versa).Therefore, the intersection type constructor can be used to express finite heterogeneousad hoc polymorphism (as opposed toparametric polymorphism).For example, theλ-term can be assigned the type in most intersection type systems, assuming for the term variable both the function type and the corresponding argument type.
Prominent intersection type systems include the Coppo–Dezani type assignment system,[2] the Barendregt-Coppo–Dezani type assignment system,[3] and the essential intersection type assignment system.[4]Most strikingly, intersection type systems are closely related to (and often exactly characterize) normalization properties ofλ-terms underβ-reduction.
In programming languages, such as TypeScript[5] and Scala,[6] intersection types are used to expressad hoc polymorphism.
The intersection type discipline was pioneered by Mario Coppo,Mariangiola Dezani-Ciancaglini, Patrick Sallé, and Garrel Pottinger.[2][7][8]The underlying motivation was to study semantic properties (such asnormalization) of theλ-calculus by means oftype theory.[9]While the initial work by Coppo and Dezani established a type theoretic characterization of strong normalization for the λI-calculus,[2] Pottinger extended this characterization to the λK-calculus.[7]In addition, Sallé contributed the notion of the universal type that can be assigned to any λ-term, thereby corresponding to the empty intersection.[8]Using the universal type allowed for a fine-grained analysis of head normalization, normalization, and strong normalization.[10]In collaboration withHenk Barendregt, a filter λ-model for an intersection type system was given, tying intersection types ever more closely to λ-calculus semantics.
Due to the correspondence with normalization,typability in infinite intersection type systems isundecidable. However restricting intersection types to finite rank makes their typeability decidable for any finite rank, which is in contrast withsystem F, where (quatifier) restrictions to finite ranks above 3 still have undecidable typeability.[11] On the other hand, ifrecursive types are added to a system with rank-2 or higher intersection types, typability becomes undecidable, in general.[12]
To deal with the difficulties in applying theCurry-Howard correspondence to intersection types, Kamareddine and Wells have replaced the intersection constructor in the deduction system with finite-set declarations (FSD) for the domain of each variable in a lambda abstraction, turning them intoΠ types. And they extended thelambda cube to what they call the f-cube, which has with FSD-encoded intersection types at all vertices.Urzyczyn’s term U, which is untypable in the λ-cube, is typable in the f-cube.[16]
Characterization of λI-normalization: has a normal form in the λI-calculus, if and only if for some and.
If the type language is extended to contain the empty intersection, i.e., then is closed under β-equality and is sound and complete for inference semantics.[17]
Intersection typesubtyping is defined as the smallestpreorder (reflexive andtransitive relation) over intersection types satisfying the following properties:
Intersection type subtyping is decidable in quadratic time.[18]
Semantics: is sound and complete wrt. a filter λ-model, in which the interpretation of a λ-term coincides with the set of types that can be assigned to it.[3]
Characterization ofstrong normalization: is strongly normalizing wrt. β-reduction, if and only if is derivable without rule for some and.[19]
Principal pairs (also known as "principal typings"[20]): If is strongly normalizing, then there exists a principal pair such that for any typing the pair can be obtained from the principal pair by means of type expansions, liftings, and substitutions.[21]
^abcdeBarendregt, Henk; Coppo, Mario; Dezani-Ciancaglini, Mariangiola (1983). "A filter lambda model and the completeness of type assignment".Journal of Symbolic Logic.48 (4):931–940.doi:10.2307/2273659.JSTOR2273659.S2CID45660117.
^abPottinger, G. (1980). A type assignment for the strongly normalizable λ-terms. To HB Curry: essays on combinatory logic, lambda calculus and formalism, 561-577.
^abCoppo, Mario; Dezani-Ciancaglini, Mariangiola; Sallé, Patrick (1979). "Functional Characterization of Some Semantic Equalities inside Lambda-Calculus". In Hermann A. Maurer (ed.).Automata, Languages and Programming, 6th Colloquium, Graz, Austria, July 16-20, 1979, Proceedings. Vol. 71. Springer. pp. 133–146.doi:10.1007/3-540-09510-1_11.ISBN3-540-09510-1.
^Coppo, Mario; Dezani-Ciancaglini, Mariangiola (1978). "A new type assignment for λ-terms".Archiv für mathematische Logik und Grundlagenforschung.19 (1):139–156.doi:10.1007/BF02011875.S2CID206809924.
^Kfoury, A.J.; Wells, J.B. (January 2004). "Principality and type inference for intersection types using expansion variables".Theoretical Computer Science:1–70.
^Terauchi, T., Aiken, A.: On typability for rank-2 intersection types with polymorphic recursion. In: LICS, IEEE Computer Society (2006) pp. 111–122
^Urzyczyn, Paweł (2009). "Inhabitation of low-rank intersection types".International Conference on Typed Lambda Calculi and Applications. TLCA 2009. Vol. 5608. Springer. pp. 356–370.doi:10.1007/978-3-642-02273-9_26.ISBN978-3-642-02272-2.
^Dudenhefner, Andrej; Rehof, Jakob (2019). "Principality and approximation under dimensional bound".Proceedings of the ACM on Programming Languages. POPL 2019. Vol. 3. ACM. pp. 8:1–8:29.doi:10.1145/3290321.ISSN2475-1421.
^Wells, J.B. (2003). "The Essence of Principal Typings".ICALP '02: Proceedings of the 29th International Colloquium on Automata, Languages and Programming. pp. 913–925.