Non-idempotent Intersection Types in Logical Form

Intersection types are an essential tool in the analysis of operational and denotational properties of lambda-terms and functional programs. Among them, non-idempotent intersection types provide precise quantitative information about the evaluation of terms and programs. However, unlike simple or second-order types, intersection types cannot be considered as a logical system because the application rule (or the intersection rule, depending on the presentation of the system) involves a condition stipulating that the proofs of premises must have the same structure. Using earlier work introducing an indexed version of Linear Logic, we show that non-idempotent typing can be given a logical form in a system where formulas represent hereditarily indexed families of intersection types.


Introduction
Intersection types, introduced in the work of Coppo and Dezani [4,5] and developed since then by many authors, are still a very active research topic. As quite clearly explained in [13], the Coppo and Dezani intersection type system DΩ can be understood as a syntactic presentation of the denotational interpretation of λ-terms in the Engeler's model, which is a model of the pure λ-calculus in the cartesian closed category of prime-algebraic complete lattices and Scott continuous functions.
Intersection types can be considered as formulas of the propositional calculus with implication ⇒ and conjunction ∧ as connectives. However, as pointed out by Hindley [12], intersection types deduction rules depart drastically from the standard logical rules of intuitionistic logic (and of any standard logical system) by the fact that, in the ∧-introduction rule, it is assumed that the proofs of the two premises are typings of the same λ-term, which means that, in some sense made precise by the typing system itself, they have the same structure. Such requirements on proofs premises, and not only on formulas proven in premises, are absent from standard (intuitionistic or classical) logical systems where the proofs of premises are completely independent from each other. Many authors have addressed this issue, we refer to [14] for a discussion on several solutions which mainly focus on the design of à la Church presentations of intersection typing systems, thus enriching λ-terms with additional structures. Among the most recent and convincing contributions to this line of research we should certainly mention [15].
In our "new" approach to this problem -not so new actually since it dates back to [3] -, we change formulas instead of changing terms. It is based on a specific model of Linear Logic (and thus of the λ-calculus): the relational model. It is fair to credit Girard for the introduction of this model since it appears at least implicitly in [11]. It was probably known by many people in the Linear Logic community as a piece of folklore since the early 1990's and is presented formally in [3]. In this quite simple and canonical denotational model, types are interpreted as sets (without any additional structure) and a closed term of type σ is interpreted as a subset of the interpretation of σ. It is quite easy to define, in this semantic framework, analogues of the usual models of the pure λ-calculus such as Scott's D ∞ or Engeler's model, which in some sense are simpler than the original ones since the sets interpreting types need not to be pre-ordered. As explained in the work of De Carvalho [6,7], the intersection type counterpart of this semantics is a typing system where "intersection" is nonidempotent (in sharp contrast with the original systems introduced by Coppo and Dezani), sometimes called system R. Notice that the precise connection between the idempotent and non-idempotent approaches is analyzed in [8], in a quite general Linear Logic setting by means of an extensional collapse.
In order to explain our approach, we restrict first to simple types, interpreted as follows in the relational model: a basic type α is interpreted as a given set α and the type σ ⇒ τ is interpreted as the set M fin ( σ ) × τ (where M fin (E) is the set of finite multisets of elements of E). Remember indeed that intersection types can be considered as a syntactic presentation of denotational semantics, so it makes sense to define intersection types relative to simple types (in the spirit of [10]) as we do in Section 3: an intersection type relative to the base type α is an element of α and an intersection type relative to σ ⇒ τ is a pair ([ a 1 , . . . , a n ], b) where the a i s are intersection types relative to σ and b is an intersection type relative to τ ; with more usual notations 1 ([ a 1 , . . . , a n ], b) would be written (a 1 ∧ · · · ∧ a n ) → b. Then, given a type σ, the main idea consists in representing an indexed family of elements of σ as a formula of a new logical system. If σ = (ϕ ⇒ ψ) then the family can be written 2 ([ a k | k ∈ K and u(k) = j ], b j ) j∈J where J and K are indexing sets, u : K → J is a function such that f −1 ({j}) is finite for all j ∈ J, (b j ) j∈J is a family of elements of ψ (represented by a formula B) and (a k ) k∈K is a family of elements of ϕ (represented by a formula A): in that case we introduce the implicative formula (A ⇒ u B) to represent the family ([ a k | k ∈ K and u(k) = j ], b j ) j∈J . It is clear that a family of simple types has generally infinitely many representations as such formulas; this huge redundancy makes it possible to establish a tight link between inhabitation of intersection types with provability of formulas representing them (in an indexed version LJ(I) of intuitionistic logic). Such a correspondence is exhibited in Section 3 in the simply typed setting and the idea is quite simple: given a type σ, a family (a j ) j∈J of elements of σ , and a closed λ-term of type σ, it is equivalent to say that ⊢ M : a j holds for all j and to say that some (and actually any) formula A representing (a j ) j∈J has an LJ(I) proof 3 whose underlying λ-term is M .
In Section 4 we extend this approach to the untyped λ-calculus taking as underlying model of the pure λ-calculus our relational version R ∞ of Scott's D ∞ . We define an adapted version of LJ(I) and establish a similar correspondence, with some slight modifications due to the specificities of R ∞ .

Notations and preliminary definitions
If E is a set, a finite multiset of elements of E is a function m : E → N such that the set {a ∈ E | m(a) = 0} (called the domain of m) is finite. The cardinal of such a multiset m is #m = a∈E m(a). We use + for the obvious addition operation on multisets, and if a 1 , . . . , a n are elements of E, we use [ a 1 , . . . , a n ] for the corresponding multiset (taking multiplicities into account); for instance [ 0, 1, 0, 2, 1 ] is the multiset m of elements of N such that m(0) = 2, m(1) = 2, m(2) = 1 and m(i) = 0 for i > 2. If (a i ) i∈I is a family of elements of E and if J is a finite subset of I, we use [ a i | i ∈ J ] for the multiset of elements of E which maps a ∈ E to the number of elements i ∈ J such that a i = a (which is finite since J is). We use M fin (E) for the set of finite multisets of elements of E.
We use + to denote set union when we we want to stress the fact that the involved sets are disjoint. A function u : J → K is almost injective if #u −1 {k} is finite for each k ∈ K (equivalently, the inverse image of any finite subset of K under u is finite). If s = (a 1 , . . . , a n ) is a sequence of elements of E and i ∈ {1, . . . , n}, we use (s) \ i for the sequence (a 1 , . . . , a i−1 , a i+1 , . . . , a n ). Given sets E and F , we use F E for the set of function from E to F . The elements of F E are sometimes considered as functions u (with a functional notation u(e) for application) and sometimes as indexed families a (with index notations a e for application) especially when E is countable.

The relational model of the λ-calculus
Let Rel ! the category whose objects are sets 4 and , a) | a ∈ X} and composition of s ∈ Rel ! (X, Y ) and t ∈ Rel ! (Y, Z) given by
With any type atom we associate a set α . This interpretation is extended to all types by σ ⇒ τ = σ ⇒ τ = M fin ( σ ) × τ . The relational semantics of this λ-calculus can be described as a non-idempotent intersection type system, with judgments of shape x 1 : m 1 : σ 1 , . . . , x n : m n : σ n ⊢ M : a : σ where the x i 's are pairwise distinct variables, M is a term, a ∈ σ and m i ∈ M fin ( σ i ) for each i. Here are the typing rules: 3.1 Why do we need another system?
The trouble with this deduction system is that it cannot be considered as the term decorated version of an underlying "logical system for intersection types" allowing to prove sequents of shape m 1 : σ 1 , . . . , m n : σ n ⊢ a : σ (where nonidempotent intersection types m i and a are considered as logical formulas, the ordinary types σ i playing the role of "kinds") because, in the application rule above, it is required that all the proofs of the k right hand side premises have the same shape given by the λ-term N . We propose now a "logical system" derived from [3] which, in some sense, solves this issue. The main idea is quite simple and relies on three principles: (1) replace hereditarily multisets with indexed families in intersection types, (2) instead of proving single types, prove indexed families of hereditarily indexed types and (3) represent syntactically such families (of hereditarily indexed types) as formulas of a new system of indexed logic.

Minimal LJ(I)
We define now the syntax of indexed formulas. Assume to be given an infinite countable set I of indices. Then we define indexed types A; with each such type we associate an underlying type A, a set d(A) and a family A ∈ A d(A) . These formulas are given by the following inductive definition: Proposition 1. Let σ be a type, J be a subset of I and f ∈ σ J . There is a formula A such that A = σ, d(A) = J and A = f (actually, there are infinitely many such A's as soon as σ is not an atom and J = ∅).
Proof. The proof is by induction on σ. If σ is an atom α then we take Since each m j is finite and I is infinite, we can find a family (K j ) j∈J of pairwise disjoint finite subsets of I such that #K j = #m j . Let K = j∈J K j , there is a function g : K → ρ such that m j = [ g(k) | k ∈ K j ] for each j ∈ J (choose first an enumeration g j : K j → ρ of m j for each j and then define g(k) = g j (k) where j is the unique element of J such that k ∈ K j ). Let u : K → J be the unique function such that k ∈ K u(k) for all k ∈ K; since each K j is finite, this function u is almost injective. By inductive hypothesis there is a formula A such that A = ρ, d(A) = K and A = g, and there is a formula B such that B = τ , d(B) = J and B = (b j ) j∈J . Then the formula A ⇒ u B is well formed (since u is an almost injective function d(A) = K → d(B) = J) and satisfies As a consequence, for any type σ and any element a of σ (so a is a nonidempotent intersection type of kind σ), one can find a formula A such that A = σ, d(A) = {j} (where j is an arbitrary element of I) and A j = a. In other word, any intersection type can be represented as a formula (in infinitely many different ways in general of course, but up to renaming of indices, that is, up to "hereditary α-equivalence", this representation is unique).
For any formula A and J ⊆ I, we define a formula A↾ J such that Using these two auxiliary notions, we can give a set of three deduction rules for a minimal natural deduction allowing to prove formulas in this indexed intuitionistic logic. This logical system allows to derive sequents which are of shape where for each i = 1, . . . , n, the function ). Notice that the expressions A ui i are not formulas; this construction A u is part of the syntax of sequents, just as the "," separating these pseudo-formulas. Given a formula A and u : The crucial point here is that such a sequent (1) involves no λ-term. The main difference between the original system LL(I) of [3] and the present system is the way axioms are dealt with. In LL(I) there is no explicit identity axiom and only "atomic axioms" restricted to the basic constants of LL; indeed it is well-known that in LL all identity axioms can be η-expanded, leading to proofs using only such atomic axioms. In the λ-calculus, and especially in the untyped λ-calculus we want to deal with in next sections, such η-expansions are hard to handle so we prefer to use explicit identity axioms.
The axiom is so that for j = i, the function u j is empty. A special case is . . , A un n ⊢ A i which may look more familiar, but the general axiom rule, allowing to "delocalize" the proven formula A i by an arbitrary bijection u i , is required as we shall see. The ⇒ introduction rule is quite simple Last the ⇒ elimination rule is more complicated (from a Linear Logic point of view, this is due to the fact that it combines 3 LL logical rules: ⊸ elimination, contraction and promotion). We have the deduction 1 , . . . , E wn n ⊢ B under the following conditions, to be satisfied by the involved formulas and functions: for each i = 1, . . . , n one has d( Let π be a deduction tree of the sequent A u1 1 , . . . , A un n ⊢ B in this system. By dropping all index information we obtain a derivation tree π of A 1 , . . . , A n ⊢ B, and, upon choosing a sequence − → x of n pairwise distinct variables, we can associate with this derivation tree a simply typed λ-term π− → x which satisfies

Basic properties of LJ(I)
We prove some basic properties of this logical system. This is also the opportunity to get some acquaintance with it. Notice that in many places we drop the type annotations of variables in λ-terms, first because they are easy to recover, and second because the very same results and proofs are also valid in the untyped setting of Section 4.
Lemma 1 (Weakening). Assume that Φ ⊢ A is provable by a proof π and let B be a formula such that The proof is an easy induction on the proof of Φ ⊢ A.
The proof is a straightforward induction on π.
Lemma 3 (Restriction). Let π be a proof of (A ui i ) n i=1 ⊢ A and let J ⊆ d(A).
Proof. By induction on π. Assume that π consists of an axiom (A With the notations of the lemma, and hence we have a proof π ′ of (A i ↾ Assume last that π ends with a ⇒-elimination rule: Though substitution lemmas are usually trivial, the LJ(I) substitution lemma requires some care in its statement and proof 6 .
\i /x i as soon as for each j = 1, . . . , n − 1, d(C j ) = d(A s(j,i) ) + d(B j ) for each j = 1, . . . , n − 1 (remember that this requires also that d(A s(j,i) ) ∩ d(B j ) = ∅) with: Proof. By induction on the proof µ. Assume that µ is an axiom, so that there is a k ∈ {1, . . . , n} such that A = u k * (A k ), u k is a bijection and d(A j ) = ∅ for all j = k. In that case we have µ − → x = x k . There are two subcases to consider. Assume first that k = i. By Lemma 2 there is a proof ρ ′ of (B We set C n = A n+1 and w n = u n+1 . Then by inductive hypothesis applied to θ we have a proof π 0 of (C wj j ) n j=1 ⊢ A ′ which satisfies π 0 ( − → x )\i,xn+1 = θ− → x ,xn+1 ρ ( − → x )\i /x i and applying a ⇒-introduction rule we get a proof π of (C wj j ) n−1 j=1 ⊢ A such that The idea is to "share" the substituting proof ρ of (B vj j ) n j=1 ⊢ A i among ϕ and ψ according to what they need, as specified by the formulas E i and F i . So we write ) and by Lemma 3 Now we want to apply the inductive hypothesis to ϕ and ρ L , in order to get a proof of the sequent (G (A s(j,i) ) and L j ⊆ d(B j ) and hence are disjoint by our assumption that d(C j ) = d(A s(j,i) ) + d(B j )) and w L j = w j ↾ d(E s(j,i) )+Lj . With these definitions, and by our assumptions about C j and w j , we have for all j = 1, . . . , n − 1 Therefore the inductive hypothesis applies yielding a proof ϕ ′ of (G Next we want to apply the inductive hypothesis to ψ and ρ R , in order to get a proof of the sequent (H rj j ) n−1 j=1 ⊢ E where, for j = 1, . . . , n − 1, H j = C j ↾ d(F s(j,i) )+Rj (again d(F s(j,i) ) ⊆ d(A s(j,i) ) and R j ⊆ d(B j ) are disjoint by our assumption that d(C j ) = d(A s(j,i) ) + d(B j )) and r j is defined by r j ↾ d(F s(j,i) ) = t s(j,i) and To end the proof of the lemma, it will be sufficient to prove that we can apply a ⇒-elimination rule to the sequents (G w L j j ) n−1 j=1 ⊢ E ⇒ s A and (H rj j ) n−1 j=1 ⊢ E in order to get a proof π of the sequent (C wj j ) n−1 j=1 ⊢ A. Indeed, the proof π obtained in that way will satisfy We have w j ↾ d(Gj ) = w L j by definition of w L j as w j ↾ d(E s(j,i) )+Lj . We have and therefore w j ↾ d(Hj ) = s • r j as required. ✷ We shall often use the two following consequences of the Substitution Lemma.
Lemma 5. Given a proof µ of (A uj j ) n j=1 ⊢ A and a proof ρ of B v ⊢ A i (for some i ∈ {1, . . . , n}), there is a proof π of (A uj The proof is similar to the previous one. If A and B are formulas such that A = B, d(A) = d(B) and A = B , we say that A and B are similar and we write A ∼ B. One fundamental property of our deduction system is that two formulas which represent the same family of intersection types are logically equivalent.
Proof. Assume that A = α[f ], then we have B = A and A Id ⊢ B is an axiom.
Assume that A = (C ⇒ u D) and B = (E ⇒ v F ). We have D ∼ F and hence D Id ⊢ F with a proof ρ such that ρ x ∼ η x. And there is a bijection w : d(E) → d(C) such that w * (E) ∼ C and u • w = v. By inductive hypothesis we have a proof µ of w * (E) Id ⊢ C such that µ y ∼ η y, and hence using the axiom E w ⊢ w * (E) and Lemma 5 we have a proof µ ′ of E w ⊢ C such that µ ′ x = µ x . There is a proof π 1 of (C ⇒ u D) Id , C u ⊢ D such that π 1 x,y = (x) y (consider the two axioms (C ⇒ u D) Id , C↾ , C Id ⊢ C and use a ⇒-elimination rule). So by Lemma 5 there is a proof π 2 of (C ⇒ u D) Id , E u•w ⊢ D, that is of (C ⇒ u D) Id , E v ⊢ D, such that π 2 x,y = (x) µ y . Applying Lemma 6 we get a proof π 3 of (C ⇒ u D) Id , E v ⊢ F such that π 3 x,y = ρ z (x) µ y /z . We get the expected proof π by a ⇒-introduction rule so that π x = λy ρ z (x) µ y /z . By inductive hypothesis π x ∼ η x. ✷

Relation between intersection types and LJ(I)
Now we explain the precise connection between non-idempotent intersection types and our logical system LJ(I). This connection consists of two statements: the first one means that any proof of LJ(I) can be seen as a typing derivation in non-idempotent intersection types (soundness) -and the second one means that any non-idempotent intersection typing can be seen as a derivation in LJ(I) (completeness).
Theorem 2 (Soundness). Let π be a deduction tree of the sequent (A ui i ) n i=1 ⊢ B and − → x a sequence of n pairwise distinct variables. Then the λ-term π− → x sat- Proof. We prove the first part by induction on π (in the course of this induction, we recall the precise definition of π− → x ). If π is the proof Assume that π is the proof where π 0 is the proof of the premise of the last rule of π. By inductive hypothesis the λ-term π 0 − → x ,x satisfies (x i : A ui i j : Assume last that π ends with 1 , . . . , E wn n ⊢ B with: for each i = 1, . . . , n there are two disjoint sets L i and R i such that Let j ∈ d(B). By inductive hypothesis, the judgment (x i : C ui i j : is derivable in the intersection type system. Let K j = u −1 ({j}), which is a finite subset of d(A). By inductive hypothesis again, for For this, since E wi , consider an element l of d(E i ) such that w i (l) = j. There are two possibilities: (1) either l ∈ L i and in that case we know that E i l = C i l since E i ↾ Li = C i and moreover we have u i (l) = w i (l) = j (2) or l ∈ R i . In that case we have Assume also that A i = σ i for each i = 1, . . . , n and that B = τ . Last assume that, for all j ∈ J, one has B j = b j and A ui i j = m j i for i = 1, . . . , n. Then the judgment (A ui i ) n i=1 ⊢ B has a proof π such that π− → x ∼ η M .
Proof. By induction on M . Assume first that M = x i for some i ∈ {1, . . . , n}.
Then we must have τ = σ i , m j q = [ ] for q = i and m j i = [ b j ] for all j ∈ J. Therefore d(A q ) = ∅ and u q is the empty function for q = i, u i is a bijection By Theorem 1 we know that the judgment (u i * (A i )) Id ⊢ B is provable in LJ(I) with a proof ρ such that ρ x ∼ η x. We have a proof θ of (A ui i ) n i=1 ⊢ u i * (A i ) which consists of an axiom so that θ− → x = x i and hence by Lemma 6 we have a proof π of (A ui ) and that we have a family of deductions (for j ∈ J) of (x i : m j i : σ i ) n i=1 ⊢ M : (m j , c j ) : σ ⇒ ϕ with b j = (m j , c j ) and the premise of this conclusion in each of these deductions is (x i : m j i : σ i ) n i=1 , x : m j : σ ⊢ N : c j : ϕ. We must have B = (C ⇒ u D) with D = ϕ, C = σ, d(D) = J, u : d(C) → d(D) almost injective, D j = c j and [ C k | k ∈ d(C) and u(k) = j ] = m j , that is C u j = m j , for each j ∈ J. By inductive hypothesis we have a proof ρ of (A ui i ) n i=1 , C u ⊢ D such that ρ − → x ,x ∼ η N from which we obtain a proof π of (A ui i ) n i=1 ⊢ C ⇒ u D such that π− → x = λx σ ρ − → x ,x ∼ η M as expected. Assume last that M = (N ) P and that we have a J-indexed family of deduc- . . , A n , u 1 , . . . , u n and B be LJ(I) formulas and almost injective functions as in the statement of the theorem.
Let j ∈ J. There is a finite set L j ⊆ I and multisets m j,0 i , (m j,l i ) l∈Lj such that we have deductions 7 of (x i : m j,0 i : We assume the finite sets L j to be pairwise disjoint (this is possible because I is infinite) and we use L for their union. Let u : L → J be the function which maps l ∈ L to the unique j such that l ∈ L j , this function is almost injective. Let A be an LL(J) formula such that A = σ, d(A) = L and A l = a u(l) l ; such a formula exists by Proposition 1.
Let i ∈ {1, . . . , n}. For each j ∈ J we know that = l ] = m j,l i and A l = a j l where j = u(l). By an application rule we get a proof π of (A ui

The untyped Scott case
Since intersection types usually apply to the pure λ-calculus, we move now to this setting by choosing in Rel ! the set R ∞ as model of the pure λ-calculus. The R ∞ intersection typing system has the elements of R ∞ as types, and the typing rules involve sequents of shape (x i : We use Λ for the set of terms of the pure λ-calculus, and Λ Ω as the pure λcalculus extended with a constant Ω subject to the two following ❀ ω reduction rules: λx Ω ❀ ω Ω and (Ω) M ❀ ω Ω. We use ∼ ηω for the least congruence on Λ Ω which contains ❀ η and ❀ ω and similarly for ∼ βηω . We define a family (H(x)) x∈V of subsets of Λ Ω minimal such that, for any sequence − → x = (x 1 , . . . , x n ) and − → y = (y 1 , . . . , y k ) such that − → x , − → y is repetition-free, and for any terms The typing rules of R ∞ are where we use the following convention: when we write Φ + Ψ it is assumed that Φ is of shape (x i : m i ) n i=1 and Ψ is of shape (x i : p i ) n i=1 , and then Φ + Ψ is (x i : m i + p i ) n i=1 . This typing system is just a "proof-theoretic" rephrasing of the denotational semantics of the terms of Λ Ω in R ∞ .

Formulas
We define the associated formulas as follows, each formula A being given together with d(A) ⊆ I and A ∈ R d(A) ∞ .
-If J ⊆ I then ε J is a formula with d(ε J ) = J and ε J j = e for j ∈ J and if A and B are formulas and u : We can consider that there is a type o of pure λ-terms interpreted as R ∞ in Rel ! , such that (o ⇒ o) = o, and then for any formula A we have A = o.
Operations of restriction and relocation of formulas are the same as in Section 3 (setting ε J ↾ K = ε J∩K ) and satisfy the same properties, for instance A↾ K = A ↾ K and one sets u * (ε J ) = ε K if u : J → K is a bijection.
The deduction rules are exactly the same as those of Section 3, plus the axiom ⊢ ε ∅ . With any deduction π of (A ui i ) n i=1 ⊢ B and sequence − → x = (x 1 , . . . , x n ) of pairwise distinct variables, we can associate a pure π− → x ∈ Λ Ω defined exactly as in Section 3 (just drop the types associated with variables in abstractions). If π consists of an instance of the additional axiom, we set π− → x = Ω.
The proof is a straightforward induction on A using the additional axiom, Lemma 1 and the observations that if d(B ⇒ u C) = ∅ then u = 0 ∅ . One can easily define a size function sz : R ∞ → N such that sz(e) = 0 and sz([ a 1 , . . . , a k ], a) = sz(a) + k i=1 (1 + sz(a i )). First we have to prove an adapted version of Proposition 1; here it will be restricted to finite sets. Proof. Observe that, since J is finite, there is an N ∈ N such that ∀j ∈ J ∀q ∈ N q ≥ N ⇒ f (j) q = [ ] (remember that f (j) ∈ M fin (R ∞ ) N ). Let N (f ) be the least such N . We set sz(f ) = j∈J sz(f (j)) and the proof is by induction on (sz(f ), N (f )) lexicographically.
If sz(f ) = 0 this means that f (j) = e for all j ∈ J and hence we can take A = ε J . Assume that sz(f ) > 0, one can write 8 f (j) = (m j , a j ) with m j ∈ M fin (R ∞ ) and a j ∈ R ∞ for each j ∈ J. Just as in the proof of Proposition 1 we choose a set K, a function g : K → R ∞ and an almost injective function u : K → J such that m j = [ g(k) | u(k) = j ]. The set K is finite since J is and we have sz(g) < sz(f ) because sz(f ) > 0. Therefore by inductive hypothesis there is a formula B such that d(B) = K and B = g. Let f ′ : J → R ∞ defined by f ′ (j) = a j , we have sz(f ′ ) ≤ sz(f ) and N (f ′ ) < N (f ) and hence by inductive hypothesis there is a formula C such that C = f . We set A = (B ⇒ u C) which satisfies A = f as required. Theorem 4. If A and B are such that A ∼ B then A Id ⊢ B with a proof π which satisfies π x ∈ H(x).
Proof. By induction on the sum of the sizes of A and B. Assume that A = ε J so that d(B) = J and ∀j ∈ J B j = e. There are two cases as to B. In the first case B is of shape ε K but then we must have K = J and we can take for π an axiom so that π x = x ∈ H(x). Otherwise we have B = (C ⇒ u D) with d(D) = J, ∀j ∈ J D j = e and d(C) = ∅, so that u = 0 J . We have A ∼ D and hence by inductive hypothesis we have a proof ρ of A Id ⊢ D such that ρ x ∈ H(x). By weakening and ⇒-introduction we get a proof π of A Id ⊢ B which satisfies π x = λy ρ x ∈ H(x).
Assume that A = (C ⇒ u D). If B = ε J then we must have d(C) = ∅, u = 0 J and D ∼ B and hence by inductive hypothesis we have a proof ρ of D Id ⊢ B such that ρ x ∈ H(x). By Lemma 7 there is a proof θ of ⊢ C such that θ ∼ ω Ω. Hence there is a proof π of A Id ⊢ B such that π x = ρ y [(x) θ/y] ∈ H(x).
Assume last that B = (E ⇒ v F ), then we must have D ∼ F and there must be a bijection w : d(E) → d(C) such that u • w = v and w * (E) ∼ C. We reason as in the proof of Lemma 1: by inductive hypothesis we have a proof ρ of D Id ⊢ F and a proof µ of w * (E) Id ⊢ C from which we build a proof π of A Id ⊢ B such that π x = λy ρ z (x) µ y /z ∈ H(x) by inductive hypothesis. ✷ Theorem 5 (Soundness). Let π be a deduction tree of A u1 1 , . . . , A un n ⊢ B and − → x a sequence of n pairwise distinct variables. Then the λ-term π− → x ∈ Λ Ω satisfies The proof is exactly the same as that of Theorem 2, dropping all simple types.
For all λ-term M ∈ Λ, we define H Ω (M ) as the least subset of element of Λ Ω such that: The elements of H Ω (M ) can probably be seen as approximates of M .
Theorem 6 (Completeness). Let J ⊆ I be finite. Let M ∈ Λ Ω and x 1 , . . . , x n be pairwise distinct variables, such that (x i : m j i ) n i=1 ⊢ M : b j in the R ∞ intersection type system for all j ∈ J. Let A 1 , . . . , A n and B be formulas and let u 1 , . . . , u n be almost injective functions such that u i : d(A i ) → J = d(B). Assume also that, for all j ∈ J, one has B j = b j and A ui i j = m j i for i = 1, . . . , n. Then the judgment A u1 1 , . . . , A un n ⊢ B has a proof π such that π− → x ∈ H Ω (M ). The proof is very similar to that of Theorem 3.

Concluding remarks and acknowledgments
The results presented in this paper show that, at least in non-idempotent intersection types, the problem of knowing whether all elements of a given family of intersection types (a j ) j∈J are inhabited by a common λ-term can be reformulated logically: is it true that one (or equivalently, any) of the indexed formulas A such that d(A) = J and ∀j ∈ A j = a j is provable in LJ(I)? Such a strong connection between intersection and Indexed Linear Logic was already mentioned in the introduction of [2], but we never made it more explicit until now.
To conclude we propose a typed λ-calculus à la Church to denote proofs of the LJ(I) system of Section 4. The syntax of pre-terms is given by s, t . . .  (x, t). Then a pre-term s is a term if any subterm of t which is of shape (s 1 ) s 2 satisfies dom(x, s 1 )∩dom(x, s 2 ) = ∅ for all variable x. A typing judgment is an expression where the x i 's are pairwise distinct variables, s is a term and each u i is an almost injective function d(A i ) → d(B). The following typing rules exactly mimic the logical rules of LJ(I): The properties of this calculus, and more specifically of its β-reduction, and its connections with the resource calculus of [9] will be explored in further work.
Another major objective will be to better understand the meaning of LJ(I) formulas, using ideas developed in [3] where a phase semantics is introduced and related to (non-uniform) coherence space semantics. In the intuitionistic present setting, it is tempting to look for Kripke-like interpretations with the hope of generalizing indexed logic beyond the (perhaps too) specific relational setting we started from.
Last, we would like to thank Luigi Liquori and Claude Stolze for many helpful discussions on intersection types and the referees for their careful reading and insightful comments and suggestions.