1 Introduction
Intersection types were invented by Coppo, DezaniCiancaglini, and Salle, as a tool for studying normalization in the lambda calculus (Coppo:1979aa). By varying the subtyping rules and atom types, researchers use intersection type systems to model many different calculi (Coppo:1980ab; Coppo:1981aa; Engeler:1981aa; Coppo:1984aa; Honsell:1992aa; Abramsky:1993fk; Plotkin:1993ab; Honsell:1999aa; Ishihara:2002aa; Rocca:2004aa; DezaniCiancaglini:2005aa; Alessi:2006aa). Perhaps the bestknown of them is the BCD intersection type system of Barendregt:1983aa. For this article we focus on the BCD system, following the presentation of Barendregt:2013aa. We conjecture that our results apply to other intersection type systems as well.
The BCD intersection type systems extends the simplytyped lambda calculus with the addition of intersection types, written , a top type , and an infinite collection of type constants. Figure 1 defines the grammar of types.
The BCD intersection type system includes a subsumption rule which states that a term in environment can be given type if it has type and is a subtype of , written .
Figure LABEL:fig:BCDsubtyping reviews the BCD rules for subtyping. Note that in the (trans) rule, the type that appears in the premises does not appear in the conclusion. Thus, the BCD subtyping judgment does not enjoy the subformula property. For other systems, it is straightforward to remove the (trans) rule, modify the other rules, and then then prove transitivity (Muehlboeck:2018aa). Unfortunately, the rule of the BCD system significantly complicates the situation.
The subformula property is a useful one. For example, the author is using intersection types to create a denotational semantics for the ISWIM language, which includes constants and primitive operations (Landin:1966la; G.D.Plotkin:1975on; Felleisen:2009aa). It seems that doing so requires placing extra conditions on types and it is much easier to do so when subtyping satisfies the subformula property.
Laurent:2018aa introduces the ISC sequentstyle system, written , where is a sequence of types . The intuition is that corresponds to . The ISC system satisfies the subformula property and is equivalent to the BCD system. To prove this, Laurent establishes six lemmas that culminate in cutelimination, from which transitivity follows.
This article presents a more direct route to the subformula property and transitivity. We present a subtyping relation and directly prove transitivity without using an auxiliary sequentstyle system. Nevertheless, the intuitions are based on those of Laurent. The key to is a rule for function types based on the soundness property (Barendregt:2013aa), just as in ISC. The definitions and results in this article have been machine checked in Agda.
We describe the new subtyping relation in Section 2, prove transitivity in Section 3, and prove its equivalence to BCD subtyping in Section 4. We make some concluding remarks in Section LABEL:sec:conclude.
2 A New Subtyping Judgment
Our new subtyping judgment relies on several auxiliary notions that help us avoid the use of ellipses, which we define in Figure 2. These include the and functions, the and predicates, and the relations and . The and functions return the domain or codomain if is a function type, respectively. If is an intersection , then is the intersection of the domain of and . If is an atom, is undefined. Likewise for . For example, if , then and . When or appears in lemma or theorem statement, we implicitly assume that is a type such that and are defined. The predicate identifies types that are equivalent to . The predicate identifies types that have in their codomain. The relation indicates whether is syntactically a part of . The relation holds when every part of is a part of . We say that contains if .
Proposition 1.
If , then and .
toptop 
The new intersection subtyping judgment, , is defined in Figure 2. First, it does not include the (trans) rule. It also replaces the (refl) rule with reflexivity for atoms (refl). The most important rule is the one for function types , which subsumes and in BCD subtyping. The rule essentially turns the soundness property into a subtyping rule. The rule says that a type is a subtype of a function type if a subset of , call it , has domain and codomain that are larger and smaller than and , respectively. The use of a subset of enables this rule to absorb uses of (incl) and (incl) on the left. The side conditions and are needed because of the rule, which in turn is needed to preserve types under reduction. In a system that does not involve reduction, the rule can be omitted, as well as those side conditions. The rules (lb) and (lb) adapt (incl) and (incl) to a system without transitivity, and have appeared many times in the literature (Bakel:1995aa). The rule generalizes the rule, replacing the on the left with any type , because for transitivity, any type is below . The rule also replaces the in the codomain on the right with any type that is equivalent to .
Before moving on, we make note of some basic facts regarding the relation and the predicate.
Proposition 2 (Basic Properties of ).

(reflexivity)

If , then and .

If and , then .

If and , then .
Proof.

The proof of reflexivity is by induction on . In the case , we proceed by cases on whether . If it is, deduce by rule . Otherwise, apply rule

The proof is by induction on the derivation of .

The proof is by induction on . In the case where , either or , but in either case part 2 of this proposition fulfills the premise of the induction hypothesis, from which the conclusion follows.

The proof is by induction on , using part 3 of this proposition in the cases for atoms and function types.
∎
Proposition 3 (Properties of ).

If then .

If and , then .

If and , then .

If and , then .

If , then .
Proof.

The proof is a straightforward induction on .

The proof is also a straightforward induction on .

The proof is a straightforward induction on .
∎
Next we turn to the subtyping inversion principle for function types. The idea is to generalize the rule with respect to the type on the right, allowing any type that contains a function type. The premises of are somewhat complex, so we package most of them into the following definition.
Definition 4 (factors).
We say factors if there exists some type such that , , , and .
Proposition 5 (Inversion Principle for Function Types).
If , , and , then factors .
Proof.
The proof is a straightforward induction on . ∎
3 Transitivity
The proof of transitivity relies on the following lemma, which is traditionally needed to prove the inversion principle for function types. However, it was not needed for our system because the rule is already quite close to the inversion principle. The lemma states that if every function type in A factors , then also factors .
Lemma 6.
If

for any , if and , then factors , and

,
then factors .
Proof.
The proof is by induction on .

Case is an atom. The statement is vacuously true.

Case is a function type. Then we conclude by applying the premise with and instantiated to and respectively.

Case . By the induction hypothesis for and for , we have that factors and so does . So there exists and such that , , , and similarly for . We need to show that factors . We choose the witness . Clearly we have and . Also, we have
and
Thus, we have that and , and this case is complete.
∎
We now turn to the proof of transitivity, that if and , then . The proof is by wellfounded induction on the lexicographical ordering of the sum of the depths of and followed by the sum of the sizes of and . To be precise, we define this ordering as follows.
where is
and is
Theorem 7 (Transitivity of ).
If and , then .
Proof.
The proof is by wellfounded induction on the relation . We proceed by cases on the last rule applied in the derivation of .
 Case (refl)

We have . From the premise we immediately conclude that .
 Case (lb)
 Case (lb)
 Case (glb)

We have , , and . By the induction hypothesis, we have and , noting that because , , , and . We conclude by rule (glb).
 Case

So , , and there exists such that , , , and . From and , we have (Proposition 2 part 4). Thus, for any , factors (Proposition 5). We have satisfied the premises of Lemma 6, so factors . That means there exists such that , , , and . Then by the induction hypothesis, we have
noting that because and because . We conclude that by rule witnessed by .
 Case

We have and conclude by rule .
 Case

We have and . We conclude by rule .
∎
4 Equivalence with BCD Subtyping
Having proved (trans), we next prove and and then show that is equivalent to .
Lemma 8 ().
If and , then .
Proof.
Lemma 9 ().
Proof.
We consider the cases for whether or .
 Case and

Then and we conclude that by rule .
 Case and
 Case and
 Case and

Again we apply rule , but with witness .
∎
We require one more lemma.
Lemma 10.
.
Proof.
The proof is by induction on . ∎
Now for the proof of equivalence
2 A New Subtyping Judgment
Our new subtyping judgment relies on several auxiliary notions that help us avoid the use of ellipses, which we define in Figure 2. These include the and functions, the and predicates, and the relations and . The and functions return the domain or codomain if is a function type, respectively. If is an intersection , then is the intersection of the domain of and . If is an atom, is undefined. Likewise for . For example, if , then and . When or appears in lemma or theorem statement, we implicitly assume that is a type such that and are defined. The predicate identifies types that are equivalent to . The predicate identifies types that have in their codomain. The relation indicates whether is syntactically a part of . The relation holds when every part of is a part of . We say that contains if .
Proposition 1.
If , then and .
toptop 
The new intersection subtyping judgment, , is defined in Figure 2. First, it does not include the (trans) rule. It also replaces the (refl) rule with reflexivity for atoms (refl). The most important rule is the one for function types , which subsumes and in BCD subtyping. The rule essentially turns the soundness property into a subtyping rule. The rule says that a type is a subtype of a function type if a subset of , call it , has domain and codomain that are larger and smaller than and , respectively. The use of a subset of enables this rule to absorb uses of (incl) and (incl) on the left. The side conditions and are needed because of the rule, which in turn is needed to preserve types under reduction. In a system that does not involve reduction, the rule can be omitted, as well as those side conditions. The rules (lb) and (lb) adapt (incl) and (incl) to a system without transitivity, and have appeared many times in the literature (Bakel:1995aa). The rule generalizes the rule, replacing the on the left with any type , because for transitivity, any type is below . The rule also replaces the in the codomain on the right with any type that is equivalent to .
Before moving on, we make note of some basic facts regarding the relation and the predicate.
Proposition 2 (Basic Properties of ).

(reflexivity)

If , then and .

If and , then .

If and , then .
Proof.

The proof of reflexivity is by induction on . In the case , we proceed by cases on whether . If it is, deduce by rule . Otherwise, apply rule

The proof is by induction on the derivation of .

The proof is by induction on . In the case where , either or , but in either case part 2 of this proposition fulfills the premise of the induction hypothesis, from which the conclusion follows.

The proof is by induction on , using part 3 of this proposition in the cases for atoms and function types.
∎
Proposition 3 (Properties of ).

If then .

If and , then .

If and , then .

If and , then .

If , then .
Proof.

The proof is a straightforward induction on .

The proof is also a straightforward induction on .

The proof is a straightforward induction on .
∎
Next we turn to the subtyping inversion principle for function types. The idea is to generalize the rule with respect to the type on the right, allowing any type that contains a function type. The premises of are somewhat complex, so we package most of them into the following definition.
Definition 4 (factors).
We say factors if there exists some type such that , , , and .
Proposition 5 (Inversion Principle for Function Types).
If , , and , then factors .
Proof.
The proof is a straightforward induction on . ∎
3 Transitivity
The proof of transitivity relies on the following lemma, which is traditionally needed to prove the inversion principle for function types. However, it was not needed for our system because the rule is already quite close to the inversion principle. The lemma states that if every function type in A factors , then also factors .
Lemma 6.
If

for any , if and , then factors , and

,
then factors .
Proof.
The proof is by induction on .

Case is an atom. The statement is vacuously true.

Case is a function type. Then we conclude by applying the premise with and instantiated to and respectively.

Case . By the induction hypothesis for and for , we have that factors and so does . So there exists and such that , , , and similarly for . We need to show that factors . We choose the witness . Clearly we have and . Also, we have
and
Thus, we have that and , and this case is complete.
∎
We now turn to the proof of transitivity, that if and , then . The proof is by wellfounded induction on the lexicographical ordering of the sum of the depths of and followed by the sum of the sizes of and . To be precise, we define this ordering as follows.
where is
and is
Theorem 7 (Transitivity of ).
If and , then .
Proof.
The proof is by wellfounded induction on the relation . We proceed by cases on the last rule applied in the derivation of .
 Case (refl)

We have . From the premise we immediately conclude that .
 Case (lb)
 Case (lb)
 Case (glb)

We have , , and . By the induction hypothesis, we have and , noting that because , , , and . We conclude by rule (glb).
 Case

So , , and there exists such that , , , and . From and , we have (Proposition 2 part 4). Thus, for any , factors (Proposition 5). We have satisfied the premises of Lemma 6, so factors . That means there exists such that , , , and . Then by the induction hypothesis, we have
noting that because and because . We conclude that by rule witnessed by .
 Case

We have and conclude by rule .
 Case

We have and . We conclude by rule .
∎
4 Equivalence with BCD Subtyping
Having proved (trans), we next prove and and then show that is equivalent to .
Lemma 8 ().
If and , then .
Comments
There are no comments yet.