Finding the type of an application

The following lemma suggests how we can ascribe a type to a function-application, where the function belongs to a type-intersection.

Lemma

Let p D1 R1 D2 R2 ...Dn Rn . Let d D1 D2..Dn . Then (p d) R1/\R2...Rn .

Proof

For all i of 1..n, d of Di. Now p of Di Ri. Hence (p d) of Ri for all i of 1..n.


To apply this lemma, suppose we have an expression (p x) where p D1 R1 D2 R2 ...Dn Rn , and x X, for some type X. Then we choose a subsequence Dj1 ...Djk of the Di for which XDj1 ...Djk . Then we can infer that (p x) Rj1 ...Rjk

From the covariance-contravariance lemma, we can readily infer the following.

Lemma

(D1D2) (R1/\R2) (D1 R1) (D2 R2).