In
mathematical logic
Mathematical logic is the study of formal logic within mathematics. Major subareas include model theory, proof theory, set theory, and recursion theory. Research in mathematical logic commonly addresses the mathematical properties of formal ...
, the intersection type discipline is a branch of
type theory
In mathematics, logic, and computer science, a type theory is the formal system, formal presentation of a specific type system, and in general type theory is the academic study of type systems. Some type theories serve as alternatives to set theor ...
encompassing
type system
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
s that use the intersection type constructor
to assign multiple types to a single term.
[
In particular, if a term can be assigned ''both'' the type and the type , then can be assigned the ]intersection type
In type theory, an intersection type can be allocated to values that can be assigned both the type \sigma and the type \tau. This value can be given the intersection type \sigma \cap \tau in an intersection type system.
Generally, if the ranges o ...
(and vice versa).
Therefore, the intersection type constructor can be used to express finite heterogeneous ad hoc polymorphism
In programming languages, ad hoc polymorphismC. StracheyFundamental concepts in programming languages Lecture notes for International Summer School in Computer Programming, Copenhagen, August 1967 is a kind of polymorphism in which polymorphic fun ...
(as opposed to parametric polymorphism
In programming languages and type theory, parametric polymorphism allows a single piece of code to be given a "generic" type, using variables in place of actual types, and then instantiated with particular types as needed. Parametrically polymorph ...
).
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,[ the Barendregt-Coppo–Dezani type assignment system,][ and the essential intersection type assignment system.][
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] and Scala, intersection types are used to express ad hoc polymorphism
In programming languages, ad hoc polymorphismC. StracheyFundamental concepts in programming languages Lecture notes for International Summer School in Computer Programming, Copenhagen, August 1967 is a kind of polymorphism in which polymorphic fun ...
.
History
The intersection type discipline was pioneered by Mario Coppo, Mariangiola Dezani-Ciancaglini
Mariangiola Dezani-Ciancaglini (born 22 December 1946) is an Italian logician and theoretical computer scientist whose research topics include type theory and intersection type disciplines, lambda calculus, and programming language semantics ...
, Patrick Sallé, and Garrel Pottinger.[
The underlying motivation was to study semantic properties (such as ]normalization
Normalization or normalisation refers to a process that makes something more normal or regular. Most commonly it refers to:
* Normalization (sociology) or social normalization, the process through which ideas and behaviors that may fall outside of ...
) of the λ-calculus by means of type theory
In mathematics, logic, and computer science, a type theory is the formal system, formal presentation of a specific type system, and in general type theory is the academic study of type systems. Some type theories serve as alternatives to set theor ...
.[
While the initial work by Coppo and Dezani established a type theoretic characterization of strong normalization for the λI-calculus,][ Pottinger extended this characterization to the λK-calculus.][
In addition, Sallé contributed the notion of the universal type that can be assigned to any λ-term, thereby corresponding to the empty intersection.][
Using the universal type allowed for a fine-grained analysis of head normalization, normalization, and strong normalization.][
In collaboration with ]Henk Barendregt
Hendrik Pieter (Henk) Barendregt (born 18 December 1947, Amsterdam) is a Dutch logician, known for his work in lambda calculus and type theory.
Life and work
Barendregt studied mathematical logic at Utrecht University, obtaining his master's de ...
, 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 prominent intersection type systems (excluding the universal type) is undecidable.
Complementarily, undecidability of the dual problem of type inhabitation In type theory, a branch of mathematical logic, in a given typed calculus, the type inhabitation problem for this calculus is the following problem: given a type \tau and a typing environment \Gamma, does there exist a \lambda-term M such that \Ga ...
in prominent intersection type systems was proven by Paweł Urzyczyn.[
Later, this result was refined showing exponential space completeness of rank 2 intersection type inhabitation and undecidability of rank 3 intersection type inhabitation.][
Remarkably, ''principal'' type inhabitation is decidable in ]polynomial time
In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by ...
.[
]
Coppo–Dezani type assignment system
The Coppo–Dezani type assignment system extends the simply typed λ-calculus by allowing multiple types to be assumed for a term variable.
Term language
The term language of is given by λ-terms (or, lambda expressions Lambda expression may refer to:
*Lambda expression in computer programming, also called an anonymous function
In computer programming, an anonymous function (function literal, lambda abstraction, lambda function, lambda expression or block) is a ...
):
:
Type language
The type language of is inductively defined by the following grammar:
:
The intersection type constructor () is taken modulo associativity, commutativity and idempotence.
Typing rules
The typing rule
In type theory, a typing rule is an inference rule that describes how a type system assigns a type to a syntactic construction. These rules may be applied by the type system to determine if a program is well-typed and what type expressions have. ...
s , , , and of are:
:
Properties
Typability and normalization are closely related in by the following properties:[
* ]Subject reduction In type theory, a type system has the property of subject reduction (also subject evaluation, type preservation or simply preservation) if evaluation of expressions does not cause their type
Type may refer to:
Science and technology Computing
* ...
: If and , then .
* Normalization
Normalization or normalisation refers to a process that makes something more normal or regular. Most commonly it refers to:
* Normalization (sociology) or social normalization, the process through which ideas and behaviors that may fall outside of ...
: If , then has a β-normal form.
* Typability of strongly normalizing
In abstract rewriting, an object is in normal form if it cannot be rewritten any further, i.e. it is irreducible. Depending on the rewriting system, an object may rewrite to several normal forms or none at all. Many properties of rewriting systems ...
λ-terms: If is strongly normalizing
In abstract rewriting, an object is in normal form if it cannot be rewritten any further, i.e. it is irreducible. Depending on the rewriting system, an object may rewrite to several normal forms or none at all. Many properties of rewriting systems ...
, then for some and .
* 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.[
]
Barendregt–Coppo–Dezani type assignment system
The Barendregt–Coppo–Dezani type assignment system extends the Coppo–Dezani type assignment system in the following three aspects:[
* introduces the universal type constant (akin to the empty intersection) that can be assigned to any λ-term.
* allows the intersection type constructor to appear on the right-hand side of the arrow type constructor .
* introduces the intersection type subtyping partial order on types together with a corresponding typing rule.
]
Term language
The term language of is given by λ-terms (or, lambda expressions Lambda expression may refer to:
*Lambda expression in computer programming, also called an anonymous function
In computer programming, an anonymous function (function literal, lambda abstraction, lambda function, lambda expression or block) is a ...
):
:
Type language
The type language of is inductively defined by the following grammar:
:
Intersection type subtyping
Intersection type subtyping is defined as the smallest preorder
In mathematics, especially in order theory, a preorder or quasiorder is a binary relation that is reflexive and transitive. Preorders are more general than equivalence relations and (non-strict) partial orders, both of which are special c ...
( reflexive and transitive relation) over intersection types satisfying the following properties:
:
Intersection type subtyping is decidable in quadratic time.[
]
Typing rules
The typing rule
In type theory, a typing rule is an inference rule that describes how a type system assigns a type to a syntactic construction. These rules may be applied by the type system to determine if a program is well-typed and what type expressions have. ...
s , , , , , and of are:
:
Properties
* 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.[
* ]Subject reduction In type theory, a type system has the property of subject reduction (also subject evaluation, type preservation or simply preservation) if evaluation of expressions does not cause their type
Type may refer to:
Science and technology Computing
* ...
: If and , then .[
* Subject expansion: If and , then .][
* Characterization of ]strong normalization
In abstract rewriting, an object is in normal form if it cannot be rewritten any further, i.e. it is irreducible. Depending on the rewriting system, an object may rewrite to several normal forms or none at all. Many properties of rewriting systems ...
: is strongly normalizing wrt. β-reduction, if and only if is derivable without rule for some and .[
* Principal pairs: 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.][
]
References
{{Reflist, refs=
[{{cite journal , doi=10.1007/BF02011875 , title=A new type assignment for λ-terms , journal=Archiv für mathematische Logik und Grundlagenforschung , volume=19 , issue=1 , pages=139–156 , year=1978 , last1=Coppo , first1=Mario , last2=Dezani-Ciancaglini , first2=Mariangiola , s2cid=206809924 ]
[{{cite conference , title=Functional Characterization of Some Semantic Equalities inside Lambda-Calculus , last1=Coppo , first1=Mario , last2=Dezani-Ciancaglini , first2=Mariangiola , last3=Sallé , first3=Patrick , year=1979 , editor=Hermann A. Maurer , volume=71 , book-title=Automata, Languages and Programming, 6th Colloquium, Graz, Austria, July 16-20, 1979, Proceedings , publisher=Springer , pages=133–146 , isbn=3-540-09510-1 , doi=10.1007/3-540-09510-1_11 ]
[{{cite journal , doi=10.1305/ndjfl/1093883253 , title=An extension of the basic functionality theory for the λ-calculus , journal=Notre Dame Journal of Formal Logic , volume=21 , issue=4 , pages=685–693 , year=1980 , last1=Coppo , first1=Mario , last2=Dezani-Ciancaglini , first2=Mariangiola , s2cid=29748788 , doi-access=free ]
[Pottinger, G. (1980). A type assignment for the strongly normalizable λ-terms. To HB Curry: essays on combinatory logic, lambda calculus and formalism, 561-577.]
[{{cite journal , doi=10.1002/malq.19810270205 , title=Functional characters of solvable terms , journal=Mathematical Logic Quarterly , volume=27 , issue=2–6 , pages=45–58 , year=1981 , last1=Coppo , first1=Mario , last2=Dezani-Ciancaglini , first2=Mariangiola , last3=Venneri , first3=Betti ]
[{{cite journal , doi=10.2307/2273659 , jstor=2273659 , title=A filter lambda model and the completeness of type assignment , journal=Journal of Symbolic Logic , volume=48 , issue=4 , pages=931–940 , year=1983 , last1=Barendregt , first1=Henk , last2=Coppo , first2=Mario , last3=Dezani-Ciancaglini , first3=Mariangiola , s2cid=45660117 ]
[{{cite journal , doi=10.1016/0304-3975(83)90069-5 , title=Principal type schemes for an extended type theory , journal=Theoretical Computer Science , volume=28 , issue=(1-2) , pages=151–169 , year=1983 , last1=Ronchi Della Rocca , first1=Simona , last2=Venneri , first2=Betti , doi-access=free ]
[{{cite journal , doi=10.1016/0304-3975(92)90297-S , title=Complete restrictions of the intersection type discipline , journal=Theoretical Computer Science , volume=102 , issue=1 , pages=135–163 , year=1992 , last1=Van Bakel , first1=Steffen , citeseerx=10.1.1.310.903 ]
[{{cite journal , doi=10.1305/ndjfl/1040067315 , title=Strong normalization and typability with intersection types , journal=Notre Dame Journal of Formal Logic , volume=37 , issue=1 , pages=44–52 , year=1996 , last1=Ghilezan , first1=Silvia , doi-access=free ]
[{{cite journal , doi=10.2307/2586625 , title=The emptiness problem for intersection types , journal=Journal of Symbolic Logic , volume=64 , issue=3 , pages=1195–1215 , year=1999 , last1=Urzyczyn , first1=Paweł , jstor=2586625 , s2cid=36979036 ]
[{{cite conference , title=Inhabitation of low-rank intersection types , last1=Urzyczyn , first1=Paweł , year=2009 , volume=5608 , book-title=International Conference on Typed Lambda Calculi and Applications , conference=TLCA 2009 , publisher=Springer , pages=356–370 , isbn=978-3-642-02272-2 , doi=10.1007/978-3-642-02273-9_26 ]
[{{cite journal , doi=10.1145/1922649.1922657 , title=Strict intersection types for the Lambda calculus , journal=ACM Computing Surveys , volume=43 , issue=3 , pages=20:1–20:49 , year=2011 , last1=van Bakel , first1=Steffen , s2cid=5537689 , citeseerx=10.1.1.310.2166 ]
[{{cite book , author1=Henk Barendregt , author2=Wil Dekkers , author3=Richard Statman , title=Lambda Calculus with Types , url=https://books.google.com/books?id=2UVasvrhXl8C&pg=PR1 , date=20 June 2013 , publisher=Cambridge University Press , isbn=978-0-521-76614-2 , pages=1–]
[{{cite journal , doi=10.23638/LMCS-13(3:9)2017 , title=The algebraic intersection type unification problem , journal=Logical Methods in Computer Science , volume=13 , issue=3 , year=2017 , last1=Dudenhefner , first1=Andrej , last2=Martens , first2=Moritz , last3=Rehof , first3=Jakob , s2cid=31640337 ]
[{{cite conference , title=Principality and approximation under dimensional bound , last1=Dudenhefner , first1=Andrej , last2=Rehof , first2=Jakob , year=2019 , volume=3 , book-title=Proceedings of the ACM on Programming Languages , conference=POPL 2019 , publisher=ACM , pages=8:1–8:29 , issn=2475-1421 , doi=10.1145/3290321 , doi-access=free ]
Type theory
Type systems
Lambda calculus
Theory of computation
Polymorphism (computer science)