Intersection type theories were first introduced as a form of ad hoc polymorphism in (pure) -calculi à la Curry. The paper by Barendregt, Coppo, and Dezani  is a classic reference, while  is a definitive reference.
Intersection type assignment systems have been well-known in the literature for almost 40 years for many reasons: among them, characterization of strongly normalizing -terms , -models , automatic type inference , type inhabitation [43, 37], type unification . As intersection had its classical development for type assignment systems, many papers tried to find an explicitly typed -calculus à la Church corresponding to the original intersection type assignment systems à la Curry. The programming language Forsythe, by Reynolds 
, is probably the first reference, while Pierce’s Ph.D. thesis combines also unions, intersections and bounded polymorphism. In  intersection types were used as a foundation for typed intermediate languages for optimizing compilers for higher-order polymorphic programming languages; implementations of typed programming language featuring intersection (and union) types can be found in SML-CIDRE  and in StardustML [18, 19].
Annotating pure -terms with intersection types is not simple: a classical example is the difficulty to decorate the bound variable of the explicitly typed polymorphic identity such that the type of the identity is : previous attempts showed that the full power of the intersection type discipline can be easily lost.
In this paper, we define and prove the main properties of the -calculus, a generic intersection typed system for an explicitly typed -calculus à la Church enriched with strong pairs, denoted by , projections, denoted by , and type coercions, denoted by .
A strong pair is a special kind of cartesian product such that the two parts of a pair satisfies a given property on their “essence”, that is .
An essence of a -term is a pure -term obtained by erasing type decorations, projections and choosing one of the two elements inside a strong pair. As examples,
and so on. Therefore, the essence of a -term is its untyped skeleton: a strong pair can be typechecked if and only if is verified, otherwise the strong pair will be ill-typed. The essence also gives the exact mapping between a term and its typing à la Church and its corresponding term and type assignment à la Curry. Changing the parameters and results in defining a totally different intersection typed system. For the purpose of this paper, we study the four well-known intersection type theories , namely Coppo-Dezani , Coppo-Dezani-Sallé , Coppo-Dezani-Venneri  and Barendregt-Coppo-Dezani . We will inspect the above type theories using three equivalence relations on pure -terms, namely and .
The combination of the above and allows to define ten meaningful typed systems for the -calculus that can be pictorially displayed in a “-chair” (see Definition 2.2). Following the same style as in the Barendrengt et al. book , the edges in the chair represent an inclusion relation over the set of derivable judgments.
A type coercion is a term of type whose type-decoration denotes an application of a subsumption rule to the term of type such that : if we omit type coercions, then we lose the uniqueness of type property.
Section 3 shows a number of typable examples in the systems presented in the -chair: each example is provided with a corresponding type assignment derivation of its essence. Some historical examples of Pottinger , Hindley  and Ben-Yelles  are essentially re-decorated and inhabited (when possible) in the -calculus. The aims of this section is both to make the reader comfortable with the different intersection typed systems, and to give a first intuition of the correspondence between Church-style and Curry-style calculi.
Section 4 proves the metatheory for all the systems in the -chair: Church-Rosser, unicity of type, subject reduction, strong normalization, decidability of type checking and type reconstruction and studies the relations between intersection type assignment systems à la Curry and the corresponding intersection typed systems à la Church. Notions of soundness, completeness and isomorphism will relate type assignment and typed systems. We also show how to get rid of type coercions defining a translation function, denoted by , inspired by the one of Tannen et al. : the intuition of the translation is that if has type and , then is a -term of type , has type and is the identity .
1.1 -calculi with intersection types à la Church
Several calculi à la Church appeared in the literature: they capture the power of intersection types; we briefly review them.
The Forsythe programming language by Reynolds  annotates a -abstraction with types as in . However, we cannot type a typed term, whose type erasure is the combinator , with the type .
Pierce  improves Forsythe by using a for
construct to build ad hoc polymorphic typing, as in
. However, we cannot type a typed term, whose type
erasure is ,
with the type
Freeman and Pfenning  introduced refinement types, that is types that allow ad hoc
polymorphism for ML constructors. Intuitively, refinement types can be seen as subtypes of a standard type: the user first defines a type and then the refinement types of this type. The main motivation for these refinement types is to allow non-exhaustive pattern matching, which becomes exhaustive for a given refinement of the type of the argument. As an example, we can define a type
boolexpfor boolean expressions, with constructors
Var, and a refinement type
groundfor boolean expressions without variables, with the same constructors except
Var: then, the constructor
Truehas type , the constructor
Andhas type and so on. However, intersection is meaningful only when using constructors.
Wells et al.  introduced , a typed intermediate -calculus for optimizing compilers for higher-order programming languages. The calculus features intersection, union and flow types, the latter being useful to optimize data representation. can faithfully encode an intersection type assignment derivation by introducing the concept of virtual tuple, i.e. a special kind of pair whose type erasure leads to exactly the same untyped -term. A parallel context and parallel substitution, similar to the notion of [27, 28], is defined to reduce expressions in parallel inside a virtual tuple. Subtyping is defined only on flow types and not on intersection types: this system can encode the type assignment system.
Wells and Haak  introduced , a more compact typed calculus encoding of : in fact, by comparing Fig. 1 and Fig. 2 of  we can see that the set of typable terms with intersection types of and are the same. In that paper, virtual tuples are removed by introducing branching terms, typable with branching types, the latter representing intersection type schemes. Two operations on types and terms are defined, namely expand, expanding the branching shape of type annotations when a term is substituted into a new context, and select, to choose the correct branch in terms and types. As there are no virtual tuples, reductions do not need to be done in parallel. As in , the type assignment system can be encoded.
Frisch et al.  designed a typed system with intersection, union, negation and recursive types. The authors inherit the usual problem of having a domain space that contains all the terms and, at the same time, all the functions from to . They prevent this by having an auxiliary domain space which is the disjoint union of and . The authors interpret types as sets in a well-suited model where the set-inspired type constructs are interpreted as the corresponding to set-theoretical constructs. Moreover, the model manages higher-order functions in an elegant way. The subtyping relation is defined as a relation on the set-theoretical interpretation of the types. For instance, the problem will be interpreted as , where becomes the set intersection operator, and the decision program actually decides whether is the empty set.
Bono et al.  introduced a relevant and strict parallel term constructor to build inhabitants of intersections and a simple call-by-value parallel reduction strategy. An infinite number of constants is applied to typed variables such that is upcasted to type . It also uses a local renaming typing rule, which changes type decoration in -abstractions, as well as coercions. Term synchronicity in the tuples is guaranteed by the typing rules. The calculus uses van Bakel’s strict version  of the intersection type theory.
1.2 Logics for intersection types
Proof-functional (or strong) logical connectives, introduced by Pottinger , take into account the shape of logical proofs, thus allowing for polymorphic features of proofs to be made explicit in formulæ. This differs from classical or intuitionistic connectives where the meaning of a compound formula is only dependent on the truth value or the provability of its subformulæ.
Pottinger was the first to consider the intersection as a proof-functional connective. He contrasted it to the intuitionistic connective as follows: “The intuitive meaning of can be explained by saying that to assert is to assert that one has a reason for asserting which is also a reason for asserting , while to assert is to assert that one has a pair of reasons, the first of which is a reason for asserting and the second of which is a reason for asserting ”.
A simple example of a logical theorem involving intuitionistic conjunction which does not hold for proof-functional conjunction is . Otherwise there would exist a term which behaves both as and as . Later, Lopez-Escobar  and Mints  investigated extensively logics featuring both proof-functional and intuitionistic connectives especially in the context of realizability interpretations.
It is not immediate to extend the judgments-as-types Curry-Howard paradigm to logics supporting proof-functional connectives. These connectives need to compare the shapes of derivations and do not just take into account their provability, i.e. the inhabitation of the corresponding type.
1.3 Raising the -calculus to a -framework.
Our goal is to build a prototype of a theorem prover based on the -calculus and proof-functional logic. Recently , we have extended a subset of the generic -calculus with other proof-functional operators like union types, relevant arrow types, together with dependent types as in the Edinburgh Logical Framework : a preliminary implementation of a type checker appeared in  by the authors. In a nutshell:
Strong disjunction is a proof-functional connective that can be interpreted as the union type [15, 40]: it contrasts with the intuitionistic connective . As Pottinger did for intersection, we could say that asserting is to assert that one has a reason for , which is also a reason to assert and . A simple example of a logical theorem involving intuitionistic disjunction which does not hold for strong disjunction is . Otherwise there would exist a term which behaves both as and as .
Strong (relevant) implication is yet another proof-functional connective that was interpreted in  as a relevant arrow type . As explained in , it can be viewed as a special case of implication whose related function space is the simplest one, namely the one containing only the identity function. Because the operators and differ, is not derivable.
Dependent types, as introduced in the Edinburgh Logical Framework  by Harper et al., allows considering proofs as first-class citizens albeit differently with respect to proof-functional logics. The interaction of both dependent and proof-functional operators is intriguing: the former mentions proofs explicitly, while the latter mentions proofs implicitly. Their combination therefore opens up new possibilities of formal reasoning on proof-theoretic semantics.
2 Syntax, Reduction and Types
[Type atoms, type syntax, type theories and type assignment systems] We briefly review some basic definition from Subsection 13.1 of , in order to define type assignment systems. The set of atoms, intersection types, intersection type theories and intersection type assignment systems are defined as follows:
(Atoms). Let denote a set of symbols which we will call type atoms, and let be a special type atom denoting the universal type. In particular, we will use with being different from and .
(Syntax). The syntax of intersection types, parametrized by , is: .
(Intersection type theories ). An intersection type theory is a set of sentences of the form satisfying at least the axioms and rules of the minimal type theory defined in Figure 1. The type theories , and are the smallest type theories over satisfying the axioms and rules given in Figure 3. We write if, for all such that , we have that . In particular and . We will sometime note, for instance, instead of .
(Intersection type assignment systems ). We define in Figure 2444Although rules are derivable with , we add them for clarity. an infinite collection of type assignment systems parametrized by a set of atoms and a type theory . We name four particular type assignment systems in the table below, which is an excerpt from Figure 13.4 of . denotes a derivable type assignment judgment in the type assignment system . Type checking is not decidable for , , , and .
Figure 3: Type theories , , , and . The ref. column refers to the original article these theories come from.
2.1 The -calculi
Intersection type assignment systems and -calculi have in common their type syntax and intersection type theories. The generic syntax of the -calculus is defined as follows. [Generic -calculus syntax]
denotes an infinite set of constants, indexed with a particular untyped -term. denotes an explicit coercion of to type . The expression denotes a pair that, following the Lopez-Escobar jargon , we call “strong pair” with respective projections and . The essence function is an erasing function mapping typed -terms into pure -terms. It is defined as follows.
One could argue that the choice of is arbitrary and could have been replaced with . However, the typing rules will ensure that, if is typable, then, for some suitable equivalence relation , we have that . Thus, strong pairs can be viewed as constrained cartesian products. The generic reduction semantics reduces terms of the -calculus as follows. [Generic reduction semantics] Syntactical equality is denoted by .
(Substitution) Substitution on -terms is defined as usual, with the additional rules:
(One-step reduction). We define three notions of reduction:
Observe that is not a redex, because the -abstraction is coerced. The contextual closure is defined as usual except for reductions inside the index of that are forbidden (even though substitutions are propagated). We write for the contextual closure of the and notions of reduction, for the contextual closure of . We also define a synchronous contextual closure, which is like the usual contextual closure except for the strong pairs, as defined in point . Synchronous contextual closure of the notions of reduction generates the reduction relations and .
(Synchronous closure of ). Synchronous closure is defined on the strong pairs with the following constraint:
Note that we reduce in the two components of the strong pair;
(Multistep reduction). We write (resp. ) as the reflexive and transitive closure of (resp. );
(Congruence). We write as the symmetric, reflexive, transitive closure of .
We mostly consider -reductions, thus to ease the notation we omit the subscript in -reductions.
The next definition introduces a notion of synchronization inside strong pairs. [Synchronization] A -term is synchronous if and only if, for all its subterms of the shape , we have that .
It is easy to verify that preserves synchronization, while it is not the case for . The next definition introduces a generic intersection typed system for the -calculus that is parametrizable by suitable equivalence relations on pure -terms and type theories as follows.
[Generic intersection typed system] The generic intersection typed system is defined in Figure 4. We denote by a particular typed system with the type theory and under an equivalence relation and by a corresponding typing judgment. The typing rules are intuitive for a calculus à la Church except rules , and .
The typing rule for a strong pair is similar to the typing rule for a cartesian product, except for the side-condition , forcing the two parts of the strong pair to have essences compatible under , thus making a strong pair a special case of a cartesian pair. For instance, is not typable in ; is not typable in but it is in ; is not typable in nor but it is in . In the typing rule , the subscript in is not necessarily typable so can easily be any arbitrary -term. The typing rule allows to change the type of a -term from to if : the term in the conclusion must record this change with an explicit type coercion , producing the new term : explicit type coercions are important to keep the unicity of typing derivations.
The next definition introduces a partial order over equivalence relations on pure -terms and an inclusion over typed systems as follows.
[ and ]
Let . if, for all pure -terms such that , we have that ;
if and , then .
if and .
2.2 The -chair
The next definition classifies ten typed systems for the-calculus: some of them already appeared (sometime with a different notation) in the literature by the present authors.
This section shows examples of typed derivations and highlights the corresponding type assignment judgment in they correspond to, in the sense that we have a derivation and another derivation . The correspondence between intersection typed systems and intersection type assignment will be defined in Subsection 5.1.
[Polymorphic identity] In all of the intersection type assignment systems we can derive A corresponding -term is: that can be typed in all of the typed systems of the -chair as follows
[Auto application] In all of the intersection type assignment systems we can derive A corresponding -term is: that can be typed in all of the typed systems of the -chair as follows
[Some examples in ] In we can derive , and using this type assignment, we can derive . A corresponding -term is: that can be typed in as follows
As another example, we can also derive . A corresponding -term is: that can be typed in as follows
[An example in ] In we can prove the commutativity of intersection, i.e. A corresponding -term is: that can be typed in as follows
where is .
[Another polymorphic identity in ] In all the you can type this -term: The typing derivation is thus
[Two examples in and ] In we can can type any term, including the non-terminating term More precisely, we have: A corresponding -term whose essence is is: that can be typed in as follows
In we can type A corresponding -term whose essence is is: that can be typed in as follows
Note that the condition has an interesting loophole, as it is well-known that does not enjoy -conversion property. Theorem B.1(1) will show that we can construct a -term which does not correspond to any derivation.
[Pottinger] The following examples can be typed in all the type theories of the -chair (we also display in square brackets the corresponding pure -terms typable in ). These are encodings from the examples à la Curry given by Pottinger in .
In the same paper, Pottinger lists some types that cannot be inhabited by any intersection type assignment () in an empty context, namely: . It is not difficult to verify that the above types cannot be inhabited by any of the type systems of the -chair because of the failure of the essence condition in the strong pair type rule.
[Intersection is not the conjunction operator] This counter-example is from the corresponding counter-example à la Curry given by Hindley  and Ben-Yelles . The intersection type where the left part of the intersection corresponds to the type for the combinator I and the right part for the combinator S cannot be assigned to a pure -term. Analogously, the same intersection type cannot be assigned to any -term.
3.1 On synchronization and subject reduction
For the typed systems , strong pairs have an
intrinsic notion of synchronization: some redexes need to be reduced
in a synchronous fashion unless we want to create meaningless
-terms that cannot be typed. Consider the -term
. If we use
the reduction relation, then the following reduction
paths are legal
More precisely, the first and second redexes are rewritten asynchronously, thus they cannot be typed in any typed system , because we fail to check the left and the right part of the strong pair to be the same: the reduction relation prevents this loophole and allows to type all redexes. In summary, can be thought of as the natural reduction relation for the typed systems .
4 Metatheory of
4.1 General properties
Unless specified, all properties applies to the intersection typed systems . For lack of space all proofs are omitted: the interested reader can found more technical details in the Appendix. The Church-Rosser property is proved using the technique of Takahashi . The parallel reduction semantics extends Definition 2.1 and it is inductively defined as follows. [Parallel reduction semantics]
Intuitively, means that is obtained from by simultaneous contraction of some -redexes possibly overlapping each other. Church-Rosser can be achieved by proving a stronger statement, namely where is a -term determined by and independent from . The statement (1) is satisfied by the term which is obtained from by contracting all the redexes existing in simultaneously.
[The map ]
Now we have to prove the Church-Rosser property for the parallel reduction. [Confluence property for ] If , then .
The Church-Rosser property follows. [Confluence] If and , then there exists such that and .
The next lemma says that all type derivations for have an unique type. [Unicity of typing] If , then is unique. The next theorem states that all the typed systems preserve synchronous -reduction, and all the and typed systems preserve