**HAL Id: inria-00446785**

**https://hal.inria.fr/inria-00446785**

### Submitted on 13 Jan 2010

**HAL** is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

### L’archive ouverte pluridisciplinaire **HAL, est** destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

**On the Membership Problem for Non-Linear Abstract** **Categorial Grammars**

### Sylvain Salvati

**To cite this version:**

### Sylvain Salvati. On the Membership Problem for Non-Linear Abstract Categorial Grammars. Journal

### of Logic, Language and Information, Springer Verlag, 2010, 19 (2), pp.163-183. �10.1007/s10849-009-

### 9110-0�. �inria-00446785�

(will be inserted by the editor)

### On the membership problem for non-linear Abstract Categorial Grammars

Sylvain Salvati

Abstract In this paper we show that the membership problem for second order non- linear Abstract Categorial Grammars is decidable. A consequence of that result is that Montague-like semantics yield to a decidable text generation problem. Furthermore the proof we propose is based on a new tool, Higher Order Intersection Signatures, which grasps statically dynamic properties ofλ-terms and presents an interest in its own.

1 Introduction

Abstract Categorial Grammars (ACGs) have been introduced in [dG01] as a simple tool to model the interface between syntax and semantics. In those grammars, there is a distinction between the abstract level in which deep structures are represented as proofs in linear logic and the object level which accounts for the surface structures.

Thelexiconis formalized as a homomorphism which performs the translation between those two levels. This lexicon is bound to be described by means of higher order linear λ-terms (each bound variable occurs exactly once). In this paper we are concerned with the consequences on the membership problem when the linearity constraint on the lex- icons is dropped. Extending ACGs in that direction is natural since linearity has many shortcomings especially when one is concerned with semantics. But also, many struc- tures can be encoded in the simply typedλ-calculus, such as tuples, enumerated types, conditionals, lists or even relational databases [Hil94]. All those structures can serve both in the modelisation of the syntax and of the semantics of natural languages. We show here that in the particular case of second order ACGs, the membership problem remains decidable while non-linear lexicons are used. This result is of particular impor- tance since it means that, in general, generating texts from meaning representations is decidable when the semantics is Montague-like [Mon74].

This work was done while the author was at the National Institute of Informatics as a post- doctoral fellow of the Japan Society for the Promotion of Science, and was supported by the Grant-in-Aid for Scientific Research (18-06739).

Sylvain Salvati

INRIA Bordeaux Sud-Ouest, LaBRI, Universit´e de Bordeaux, Unit´e Mixte de Recherche CNRS (UMR 5800), 351, cours de la Lib´eration, F-33405 Talence cedex France

Tel.: +33(0)5 4000 35 23, Fax: +33(0)5 4000 66 69 E-mail: sylvain.salvati@labri.fr

Modern approaches of Montague semantics are mainly concerned with describing the interface between syntax and semantics by using an intermediate structure, usually called the deep structure of the sentence, and interpreting this structure with a homo- morphism so as to obtain a representation of the meaning of that sentence. Usually this meaning is represented as a formula in a given logic. For example we can use the following operators so as to define the deep structure of a toy language:

1. seek:np→np→s, 2. and:np→np→np, 3. John:np,

4. Mary:np, 5. a:n→np, 6. unicorn:n.

The terms built with these operators can be interpreted with the homomorphismLsyn

such that:

1. Lsyn(seek) =λxy.xcherchenty, 2. Lsyn(and) =λxy.xety,

3. Lsyn(John) = Jean, 4. Lsyn(Mary) = Marie, 5. Lsyn(a) =λx.unex, 6. Lsyn(unicorn) = licorne.

The termsentence=seek(and John Mary)(a unicorn) is interpreted as the French sentenceJean et Marie cherchent une licornewith the homomorphismLsyn. We may then try to give a semantics to this language by defining a homomorphismLsemsuch that:

1. Lsem(seek) =λS O.O(λx.S(λy.seeky x)), 2. Lsem(and) =λN1N2P.∧(N1P)(N2P), 3. Lsem(John) =λP.Pj,

4. Lsem(Mary) =λP.Pm,

5. Lsem(a) =λP Q.∃(λx.∧(P x)(Q x)), 6. Lsem(unicorn) =λx.unicornx.

ThenLsemmapssentenceto the term

∃(λx.∧(unicornx)(∧(seek jx)(seek mx)))

Given such a term, one may wonder whether the grammar we use contains a sentence whose meaning representation is precisely that term. We here show that answering such a question is decidable in general and our results can be used so as to generate such a sentence. Note that we do not answer the problem of generation in general which should take into account some problem of logical equivalence, we rather solve the problem of exact generation as proposed in [Kan07]. Indeed given the semantic term

∃(λx.∧(unicornx)(∧(seek jx)(seek jx)))

we will generate the sentenceJean et Jean cherchent une licorne. Contrary to [Kan07], and besides well-typedness, we do not have any restrictions on theλ-terms that can be used to define the correspondence between syntax and semantics. One may in particular

use duplication and deletion as much as one wishes to describe the translation of syntactic structures into meaning representations.

The approach that leads to this result is similar to one generally used in formal language theory that consists in showing the closure of the class of languages under investigation by intersection with regular sets. ACGs do not define strings or trees languages but languages ofλ-terms. Thus the main question we face is related to the definition of a suitable notion of regularity for the simply typedλ-calculus. The tools involved to cope with that problem are based on intersection types [DCGdL98]. Even though we won’t discuss the issue of defining a relevant notion of regularity for the simply typed λ-calculus here, all that we do is closely related to such a notion, and the proofs we get are quite similar to the usual syntactic proofs of closure of Context Free Languages under intersection with regular sets. They also resemble to the proofs of [Kan06] where it is showed that Abstract Categorial Languages (languages defined by ACGs) are closed under the inverse of a relabeling. Actually, restricted to strings or trees languages, second-order non-linear ACGs coincide with level-n IO grammars introduced and studied in [Dam82]. Our result somehow extends Damm’s result which shows that level-n IO grammars are closed under intersection with regular sets.

The outline of the paper is as follows, in section 2 we introduce the necessary
technical notions. In section 3, we define and show the principal properties of the
main tool on which our results are based, Higher Order Intersection Signatures. We
give and prove the main theorem,the singleton set theorem, concerning higher-order
intersection signatures in section 4. This theorem shows that singleton sets,i.e.sets like
{N|N =_{βη}M}, can be characterized by typing properties expressed on Higher Order
Intersection Signatures. Section 5 shows that the class of languages ofλ-terms defined
by second order non-linear ACGs is closed under typing judgements over Higher Order
Intersection Signature. Finally section 6 gives some conclusions and future directions
of research.

2 Simply typedλ-calculus and non-linear ACGs

A higher order signature (HOS) Σ is a triple (A,C, τ) such thatA is a finite set of
atomic types,C is a finite set ofconstants, andτ is a function fromC toT_{A}, the set of
simple types (ortypes).TAis the smallest set containingAand verifying the property
that whenever it containsα1andα2then it contains (α1→α2); we may also writeTΣ

instead ofTA. We will use Greek lowercase letters,α,β,γ, . . . to denote types, when
necessary we will also use indices and superscripts. We will writeα1→ · · · →αn→β
for the type (α1→(· · · →(αn →β)· · ·)). Moreover, higher order signatures will be
denoted byΣ (sometimes with subscripts),Σ1,Σ2, . . . and, unless stated otherwise,
we will assume thatΣis the triple (A,C, τ),Σ_{sub}is the triple (Asub,Csub, τ_{sub}) with
subbeing either a subscript or an index. In general, we will use the roman lowercase
lettersa, b, c, d, eto denote constants. The orderord(α) of a typeαis defined to be 1
if that type is atomic andmax(ord(α1) + 1, ord(α2)) ifα=α1→α2. The notion of
order is extended to higher order signatures, andord(Σ) =max{c∈ C|ord(τ(c))}.

We then assume that we are given an infinite and countable setVofλ-variables; in general,x,y andz (possibly with indices) will range overλ-variables. Theλ-calculus we will use is typed `a la Church so that terms have a unique type. In particular λ- variables (or simply variables when it is unambiguous) explicitly convey their types.

Given a finite set of atomic typesA, the association ofλ-variables with types is simply

obtained by considering the setV × TA. Givenα∈ TA, we writeV^{α}for the setV × {α},
the set ofλ-variables of typeα; and the setS

α∈TAV^{α}will be denoted byVA orVΣ.
In general the elements ofV^{α}will be writtenx^{α},y^{α}andz^{α}instead of (x, α), (y, α) or
(z, α), we may also sometimes omit the type annotation when it is irrelevant.

The set,Λ_{Σ}, ofλ-terms built onΣ, is the union of the sets of the family (Λ^{α}_{Σ})_{α∈T}A

which is defined as the smallest family verifying:

1. ifx∈ Vandα∈ TA, thenx^{α}∈Λ^{α}_{Σ},
2. ifc∈ C thenc∈Λ^{τ(c)}_{Σ} ,

3. ifM1∈Λ^{α→β}_{Σ} ,M2∈Λ^{α}_{Σ}, then (M1M2)∈Λ^{β}_{Σ},
4. ifM ∈Λ^{β}_{Σ}, thenλx^{α}.M ∈Λ^{α→β}_{Σ} .

The notationF V(M) stands for the set of free variables ofM and is defined as usual.

Note that the variablesx^{α}andx^{β} are considered to be distinct whenα6=β. This in
particular has the consequence thatF V(λx^{o}.x^{o→o}) = {x^{o→o}}. We will use the let-
tersM, N, P, Q, possibly with some indices, to denoteλ-terms. GivenM1∈Λ^{α}_{Σ}^{n}, . . . ,
Mn ∈Λ^{α}_{Σ}^{n}, we define M[x^{α}_{1}^{1} :=M1;. . .;x^{α}_{n}^{n} :=Mn] to be the result of the simulta-
neous capture-avoiding substitution ofx^{α}_{1}^{1} byM1, . . . and ofx^{α}_{n}^{n} byMn. Givenγ in
{β;η;βη}, we writeM →γM^{′}to denote thatM γ-contracts toM^{′},M→^{∗}γM^{′}denotes
the fact thatM isγ-reducible to M^{′} andM =γ M^{′} stands forM isγ-convertible to
M^{′}; we assume that the reader is familiar with these notions and that of normal form;

we otherwise refer him/her to [Bar84]. In general we will writeM_{1}M_{2}. . . M_{n} instead
of (. . .(M1M2). . . Mn) andλx^{α}_{1}^{1}. . . x^{α}n^{n}.M instead ofλx^{α}_{1}^{1}. . . . λx^{α}n^{n}.M.

A context is a term with a hole, generally writtenC[], the termC[N] is obtained
by grafting the termN in the hole. Note that grafting a term in a context may bind
some variable; for example ifC[] =λx.[] andN =xthenC[x] =λx.x. GivenMinΛ_{Σ},
M is said inη-long form, or inlong form, if for everyC[] andN such thatC[N] =M
andN∈Λ^{α→β}_{Σ} , one of the following properties holds:

1. N is of the formλx^{α}.N^{′},
2. C[] is of the formC^{′}[[]N^{′}].

When a term is in long form, the structure of the types of its sub-terms is made explicit
in the syntax of the term itself. If its has a complex type then this sub-term is either
aλ-abstraction or it is applied to some argument. The set of terms in long form are
closed under β-reduction and also whenM is in long form and M^{′} →η M we have
that M^{′} →_{β} M. For example,λy_{1}.(λy_{2}.xy_{2})y_{1}→η λy_{1}.xy_{1} andλy_{1}.(λy_{2}.xy_{2})y_{1} →_{β}
λy1.xy1. Working with terms in long form allow us to compare terms modulo βη-
convertibility only usingβ-conversion. Indeed, whenM1=_{βη} M2then ifM_{1}^{′} andM_{2}^{′}
are long forms of M1 and M2 then M_{1}^{′} =_{β} M_{2}^{′} and the converse also hold. Long
forms have been introduced in [Hue76] where their main properties have also been
proved. It is quite usual to work with the long normal forms of terms in order to prove
properties about the simply typedλ-calculus (e.g.[GTL89]) since they are a canonical
representation of the proofs denoted by the terms.

A homomorphism between two higher order signatures Σ1 andΣ2 is a pair (g, h)
such thatgmapsTA1 toTA2,hmapsΛ_{Σ}1 toΛ_{Σ}2 and the following holds:

1. g(α→β) =g(α)→g(β)
2. h(x^{α}) =x^{g(α)}

3. forc∈ C1,h(c) is a closed element (i.e.F V(h(c)) =∅) ofΛ^{τ}_{Σ}^{1}_{1}^{(c)}
4. h(M1M2) =h(M1)h(M2)

5. h(λx^{α}.M) =λx^{g(α)}.h(M).

It is easy to establish that whenever M ∈ Λ^{α}_{Σ}_{1} then h(M) ∈ Λ^{g(α)}_{Σ}_{2} . In general, if
H= (g, h) is a homomorphism, we will writeH(α) forg(α) andH(M) forh(M).

Non-linear^{1}Abstract Categorial Grammars are 4-tuplesG= (Σ_{1}, Σ_{2},L, S) where:

1. Σ_{1}is a higher order signature,the abstract vocabulary,
2. Σ_{2}is a higher order signature,the object vocabulary,
3. Lis a homomorphism fromΣ1toΣ2,the lexicon and,
4. S is an element ofA1,the distinguished type.

Note that contrary to the usual definition we do not require thatΣ1orΣ2are linear signatures or the lexicon to be linear. Theorder of a non-linear ACG is the order of its abstract vocabulary. A non-linear ACGG= (Σ1, Σ2,L, S) defines two languages:

– The abstract language: A(G) ={M ∈Λ^{S}_{Σ}_{1}|M is closed},
– The object language: O(G) ={M∈Λ^{L(S)}_{Σ}

2 |∃N∈ A(G).L(N) =_{βη} M}

3 Higher order intersection signatures

In this section we definehigher order intersection signatures(HOIS). This new kind of
signatures is used as a second layer of typing over simply typedλ-calculus. The reader
must be careful not to get confused between the simple type aλ-term may have and the
intersection types higher order intersection signatures may assign to it. HOIS adapt
intersection types [DCGdL98], usually dedicated to the untyped λ-calculus, to the
simply typedλ-calculus. Intuitively, the reason why we use intersection type comes from
the fact that we want to obtain a notion of regularity for the simply typedλ-calculus^{2}.
Such a notion should define sets that are closed underβη-convertibility and expressing
invariants ofλ-terms under conversion is usually done with types. Thus regular sets of
λ-terms should be defined in terms of typing. Furthermore a notion of regularity for
the simply typedλ-calculus should extend the usual notions of regularities for strings
and trees. If we take a tree automaton, the abstract machine that recognizes regular
set of trees, its behavior is defined by rules of the forma(q1, . . . , qn)→q, which could
intuitively be rephrased with types by the fact thatahas typeq1→ · · · →qn→q. But
a tree automaton can have several such rules concerninga, it would then be as ifahad
several types. A natural way of giving several types to a constant in type theory is to
use intersection types. We stop here concerning the motivations of using intersection
types and we now define higher order intersection signatures.

Given a higher order signature Σ, a finite set I and a function ρ from I to A,
we define the set of intersection types∩ρ as the union of the member of the family
(∩^{α}ρ)_{α∈T}A which is the smallest family verifying:

1. ∩^{α}_{ρ} =ρ^{−1}(α) ifα∈ A
2. ∩^{α→β}ρ =P(∩^{α}ρ)× {α} × ∩^{β}ρ

whereP(A) is the powerset ofA.

1 as opposed to the usual ACGs defined in [dG01].

2 we will develop the reasons why we can actually define regular sets ofλ-terms with HOIS in a future paper.

The traditional notation for the intersection types is (α∩β). It is provable that the

∩connector enjoys properties like idempotence, associativity, commutativity and has
a neutral elementω.^{3} Since, for technical reasons, we want to use types modulo these
equivalence relations, we use a different notation for intersection types. The intersection
of several types will be denoted by the set containing those types. Intuitively the
intersection type (S, α, p)∈ ∩^{α→β}ρ would be written in the usual syntax as p1∩. . .∩
pn→pwhenS6=∅andS={p1;. . .;pn}orωα→p^{4}whenS=∅. The fact that we use
P(∩^{α}ρ)× {α} × ∩^{β}ρ instead ofP(∩^{α}ρ)× ∩^{β}ρ in the definition∩^{α→β}ρ has the consequence
that ifpbelongs to∩ρthen there is a uniqueαsuch thatp∈ ∩^{α}ρ. Thus an intersection
type pthat belongs to∩^{α}ρ is, as one may expect, only used to type the terms of Λ^{α}_{Σ}.
In examples we will feel free to use the more traditional notation that uses∩andω_{α}.
Note that givenα∈ A, we have| ∩^{α}_{ρ}| ≤ |I|givenα→β∈ TAwe have| ∩^{α→β}_{ρ} |=
2^{|∩}^{α}^{ρ}^{|}× | ∩^{β}ρ |. Thus∩^{α}_{ρ} is finite for everyα∈ TA.

Then, ahigher order intersection signatureΠ is a 4-tuple (Σ, I, ρ, f) where:

1. Σ is a higher order signature, 2. I is a finite set of atomic types.

3. ρis a mapping fromI toA,

4. f associates to anyc∈ Ca subset of∩^{τ(c)}ρ .

Such a higher order intersection signature is also called an intersection signature
overΣ. In general we shall write∩^{α}_{Π} instead of∩^{α}_{ρ} and∩_{Π} instead of∩ρ for a HOIS
Π= (Σ, I, ρ, f). AΠ-type environment is a function fromV_{Σ} toP(∩_{Π}) verifying:

1. Γ(x^{α}) is a subset of∩^{α}_{Π},

2. Γ associates a non-empty subset of∩Π only to a finite number of variables.

A Π-type environment Γ may be represented as a finite sequence such as x^{α}_{1}^{1} :
S1, . . . , x^{α}_{n}^{n} :Sn where for all i,Γ(x^{α}_{i}^{i}) = S_{i} and ifz^{β} 6=x^{α}_{i}^{i} for alli ∈[1;n] then
Γ(z^{β}) =∅. Given twoΠ-type environmentsΓ and∆, we writeΓ, ∆theΠ-type envi-
ronment such thatΓ, ∆(x^{α}) =Γ(x^{α})∪∆(x^{α}). In particular, when we writeΓ, x^{α}:S,
we implicitly consider thatΓ(x^{α}) =∅.

Given an intersection signatureΠ= (Σ, I, ρ, f), we define derivations which estab-
lishjudgements of the form:Γ ⊢_{Π} M :pwhereΓ is aΠ-type environment,M ∈Λ_{Σ}
and p∈ ∩_{Π}. The term M is called the subject of the judgementΓ ⊢_{Π} M :p. The
judgments are obtained with the following deduction rules:

p∈S

Axiom

Γ, x^{α}:S⊢_{Π}x^{α}:p

p∈f(c)

Const

Γ ⊢_{Π}c:p

Γ, x^{α}:S⊢_{Π}M:p

Abstraction

Γ ⊢_{Π} λx^{α}.M: (S, α, p)
Γ ⊢_{Π}M : (S, α, p) N∈Λ^{α}_{Σ} ∀q∈S. Γ ⊢_{Π}N:q

Γ ⊢_{Π}M N:p App

As a shorthand we may write thatΓ ⊢M :S is derivable to express that for allpin S,Γ ⊢M :pis derivable.

An immediate consequence of the fact that ∩^{α}_{Π} is finite for everyα∈ TΣ is that
type checking is decidable.

3 ωstands for the universal type,*i.e.*every term can be typed byω, and thusωrepresents
the set of allλ-terms.

4 intuitivelyωαstands for the simply typed version ofωand it is the universal intersection
type of the terms that belong toΛ^{α}_{Σ}.

The properties of terms which are typed in an intersection signature are quite sim- ilar to the properties one usually obtains with intersection types. The most important one is that judgements are invariant moduloβ-convertibility.

Before we come to prove this strong property we formulate some simple technical lemmas. In the following we assume that we are given a HOSΣ and a HOIS overΣ, Π.

Lemma 1 IfΓ ⊢Π M :p is derivable then there isαin TA such that M ∈Λ^{α}_{Σ} and
p∈ ∩^{α}_{Π}.

Proof Simple induction on the derivation ofΓ ⊢_{Π}M :p.

Lemma 2 IfΓ ⊢Π M :pis derivable and ∆is aΠ-type environment thenΓ, ∆⊢Π

M :pis derivable.

Proof Simple induction on the derivation ofΓ ⊢_{Π}M :p.

Lemma 3 IfΓ ⊢_{Π}M :pis derivable then for all Π-type environments∆verifying:

1. for allx^{α}∈ V,∆(x^{α})⊆Γ(x^{α}) and
2. for allx^{α}∈F V(M),∆(x^{α}) =Γ(x^{α}).

∆⊢_{Π}M :pis derivable.

Proof Simple induction on the derivation ofΓ ⊢_{Π}M :p.

We now prove that this derivation system enjoys the substitution lemma.

Lemma 4 Given N ∈Λ^{α}_{Σ}, if Γ, x^{α}:S ⊢_{Π} M :pand if for all q∈S,Γq ⊢_{Π} N :q
thenΓ, Γ_{S} ⊢_{Π}M[x^{α}:=N] :p, whereΓ_{S}(y^{β}) =S

q∈SΓ_{q}(y^{β}).

Proof We proceed by induction on the derivation ofΓ, x^{α}:S⊢_{Π}M:p:

1. If the derivation is of the form

p∈Γ(z^{γ})
Γ, x^{α}:S⊢Π z^{γ}:p

there are two cases: eitherz^{γ}=x^{α}, then using Lemma 2 we get thatΓ, Γ_{S}⊢Π N:α
is derivable and the conclusion follows immediately; orz^{γ} 6=x^{α} and in that case
the conclusion is also trivial with the use of Lemma 2 and Lemma 3.

2. If the derivation is of the form:

p∈f(c)
Γ, x^{α}:S⊢_{Π}c:p
then the conclusion is trivial.

3. If the derivation is of the form:

Γ, x^{α}:S, y^{γ} :S^{′}⊢_{Π}M :p
Γ, x^{α}:S⊢_{Π}λy^{γ}.M : (S^{′}, γ, p)

we suppose that y^{γ} ∈/ F V(N) (this is possible thanks to α-conversion), thus
λy^{γ}.M[x^{α} := N] = (λy^{γ}.M)[x^{α} := N]. By induction hypothesis, we get that
Γ, Γ_{S}, y^{γ} : S^{′} ⊢ M[x^{α} := N] : p is derivable, and thus we obtain the result by
abstracting overy^{γ}.

4. Suppose the derivation is of the form:

Γ, x^{α}:S⊢_{Π}M_{1}: (S^{′}, γ, p) M_{2}∈Λ^{γ}_{Σ} ∀q∈S^{′}. Γ, x^{α}:S⊢_{Π}M_{2}:q
Γ, x^{α}:S⊢M_{1}M_{2}:p

By induction hypothesis,Γ, Γ_{S}⊢ΠM1[x^{α}:=N] : (S^{′}, γ, p) is derivable and for all
q∈S^{′},Γ, Γ_{S} ⊢ΠM_{2}[x^{α}:=N] :qis derivable. The conclusion follows usingApp.

We now prove that the converse of the substitution lemma, the extraction lemma, holds for this system.

Lemma 5 IfN ∈Λ^{α}_{Σ},Γ ⊢_{Π}M[x^{α}:=N] :pthen there isS⊆ ∩^{α}_{Π} such that:

1. Γ, x^{α}:S⊢M:pis derivable

2. for allq∈S,Γ ⊢_{Π}N:q is derivable

Proof We proceed by induction on the structure ofM:

1. IfM =z^{γ} (resp. M =c) withz^{γ}6=x^{α}, then it suffices to takeS=∅.

2. IfM =x^{α}then we have thatΓ ⊢_{Π}N:pis derivable and sinceN∈Λ^{α}_{Π}, lemma 1
implies thatp∈ ∩^{α}_{Π}. Thus,Γ, x^{α}:{p} ⊢_{Π}x^{α}:pis also derivable. The conclusion
trivially follows with the choiceS={p}.

3. IfM =M1M2, and the derivation ofΓ ⊢ΠM[x^{α}:=N] :pis of the form:

Γ ⊢ΠM1[x^{α}:=N] : (S^{′}, β, p) M2∈Λ^{β}_{Σ} ∀q∈S^{′}. Γ⊢ΠM2[x^{α}:=N] :q
Γ ⊢(M1M2)[x^{α}:=N] :p

by induction hypothesis, we have the existence ofS1such that:

(a) for allq∈S_{1},Γ ⊢_{Π}N:qis derivable
(b) Γ, x^{α}:S_{1}⊢_{Π}M_{1}: (S^{′}, β, p) is derivable

The induction hypothesis also implies that for allq∈S^{′} there isSq such that:

(a) for allq^{′}∈Sq,Γ ⊢ΠN :q^{′} is derivable
(b) Γ, x^{α}:Sq ⊢ΠM2:qis derivable

We let S = S_{1}∪S

q∈S^{′}Sq. Then, with Lemma 2, we obtain the derivability of
Γ, x^{α}:S ⊢_{Π}M_{1}: (S^{′}, β, p) andΓ, x^{α}:S ⊢_{Π} M_{2} :qfor all q∈S^{′}. This ends the
proof in this case.

4. IfM =λy^{β}.M^{′}, then p= (S^{′}, β, p^{′}) and the derivation ofΓ ⊢_{Π} M[x^{α}:=N] :p
must be of the form:

Γ, y^{β}:S^{′}⊢Π M^{′}[x^{α}:=N] :p^{′}
Γ ⊢Π(λy^{β}.M^{′})[x^{α}:=N] : (S^{′}, β, p^{′})

we may suppose without loss of generality that y^{β} ∈/ F V(N) which implies that
(λy^{β}.M^{′})[x^{α} :=N] = λy^{β}.M^{′}[x^{α} := N]. By induction hypothesis, we have the
existence ofS⊆ ∩^{α}_{Π}, such that:

(a) for allq∈S,Γ, y^{β}:S^{′}⊢_{Π}N:qis derivable
(b) Γ, x^{α}:S, y^{β}:S^{′}⊢_{Π}M :pis derivable

From Lemma 3, and the fact that y^{β} ∈/ F V(N) we have that Γ ⊢Π N : q is
derivable. By using the abstraction rule, we obtain that Γ, x^{α} : S ⊢Π λy^{β}.M :
(S^{′}, β, p) is derivable and this concludes the proof.

We are now in position to prove the subject reduction and the subject expansion theorems.

Theorem 1 IfΓ ⊢ΠM :pis derivable andM →^{∗}βNthenΓ ⊢N :pis also derivable.

Proof We first prove that the property holds whenM →_{β}N. In such a case we have
M =C[((λx^{α}.M1)M2)] and N =C[M1[x^{α} :=M2]]. The proof is done by a trivial
induction on the structure ofC[], the initial case being proved using the substitution
lemma for intersection types.

We then iterate this result to obtain the theorem.

Theorem 2 IfM∈Λ_{Σ},M →^{∗}_{βη} N andΓ ⊢_{Π}N :pis derivable thenΓ ⊢_{Π}M :pis
also derivable.

Proof To prove this theorem, we first prove that:

1. if Γ ⊢_{Π} M : (S, β, p) is derivable, x^{β} ∈/ F V(M) and Γ(x^{β}) = ∅ then Γ ⊢_{Π}
λx^{β}.(M x^{β}) : (S, β, p) is derivable with the following derivation:

Γ, x^{β}:S⊢ΠM : (S, β, p) x^{β}∈Λ^{β}_{Σ} ∀q∈S.

q∈S
Γ, x^{β}:S⊢Πx^{β}:q
Γ, x^{β}:S⊢Π(M x^{β}) :p

Γ ⊢Π λx^{β}.(M x^{β}) : (S, β, p)

We indeed have thatΓ, x^{β}:S⊢ΠM : (S, β, p) (by Lemma 2 and sinceΓ ⊢Π M :
(S, β, p) is derivable).

2. ifM_{2}∈Λ^{α}_{Σ} and Γ ⊢_{Π}M_{1}[x^{α}:=M_{2}] :pis derivable thenΓ ⊢_{Π} (λx^{α}.M_{1})M_{2}:p
is derivable. Indeed, from the extraction lemma we know that there existsS⊆ ∩^{α}_{Π},
such that:

(a) for allq∈S,Γ ⊢ΠM2:qis derivable
(b) Γ, x^{α}:S⊢ΠM1:pis derivable

We then get:

Γ, x^{α}:S ⊢ΠM_{1}:p

Γ ⊢_{Π}λx^{α}.M_{1}: (S, α, p) M_{2}∈Λ^{α}_{Σ} ∀q∈S. Γ ⊢_{Π} M_{2}:q
Γ ⊢_{Π} (λx^{α}.M1)M2:p

Observe that this also works in the case wherex^{α}is not free inM1(in that case,
S=∅).

Then these results are extended to the case of a one step reduction by induction on the structure onM. The theorem is finally obtained by iterating the one step reduction case.

Note that this last theorem only holds when M ∈Λ_{Σ}, that is whenM is simply
typed.

As one may remark, Theorem 1 only gives subject reduction forβ-reduction. This is actually due to the fact that derivability is not preserved underη-contraction. One can derive the sequentx:a→c⊢λy.xy:a∩b→cwith the following derivation:

y:a∩b, x:a→c⊢x:a→c y:a∩b, x:a→c⊢y:a y:a∩b, x:a→c⊢xy:c

x:a→c⊢λy.xy:a∩b→c

whileλy.xy→ηxand it is not possible to derivex:a→c⊢x:a∩b→c.

In order to fix this problem in the typing system, we need define the following subtyping relation on intersection types:

ι∈ρ^{−1}(α)
ι⊑^{α}ι

T ⊆ ∩^{α}_{Π} ∀p∈S.∃q∈T.q⊑^{α}p
T✂^{α}S

S✂^{α}T q⊑^{β}p
(T, α, q)⊑^{α→β}(S, α, p)
We may add the following typing rule:

Γ ⊢_{Π}M :p p⊑^{α}q
Γ ⊢_{Π}M:q

When a derivation uses this subtyping rule, we write the judgement Γ ⊢^{⊑}_{Π} M : p.

Actually on terms in long form we will see that any derivation established by⊢^{⊑}_{Π} can
also be derived by⊢_{Π}.

We first give some basic properties concerning⊑^{α}.

We first state that⊑^{α}is a preorder on∩^{α}_{Π} (we leave the proof to the reader).

Lemma 6 The relation⊑^{α} verifies the following properties:

1. ifp⊑^{α}qthenp, q∈ ∩^{α}_{Π}
2. ifp∈ ∩^{α}_{Π} thenp⊑^{α}p,

3. ifp1, p2, p3∈ ∩^{α}_{Π}, p1⊑^{α}p2 andp2⊑^{α}p3 thenp1⊑^{α}p3.

Lemma 7 IfΓ ⊢^{⊑}_{Π}M :pis derivable andM →^{∗}ηN thenΓ ⊢^{⊑}_{Π} N:pis derivable.

Proof We use the same method as for subject reduction for the type system⊢_{Π}. We
show that if M = λx^{α}.N x^{α} so that x^{α} ∈/ F V(N), then whenever Γ ⊢^{⊑}_{Π} M : p is
derivable we have thatΓ ⊢^{⊑}_{Π} N :pis also derivable. We extend this property to the
case where M →η N by an easy induction on the structure of M. Finally we obtain
the result by iterating this last property.

Lemma 8 Suppose that Γ ⊢Π M : p is derivable and that p ⊑^{α} q then there is
M^{′ ∗}→ηM such thatΓ ⊢_{Π}M^{′}:qis derivable.

Proof By Lemma 6 we know thatp∈ ∩^{α}_{Π}, thus, with Lemma 1 we obtain thatM∈Λ^{α}_{Σ}.
We then prove this lemma by induction on the structure ofα:

1. ifαis atomic then obviouslyp=qand we may conclude by choosingM^{′}=M.
2. ifα=α1→ · · · →αn→α0 withα0being atomic then we have that:

(a) p= (S1, α1,(· · ·(Sn, αn, ι)· · ·)) (b) q= (T1, α1,(· · ·(Tn, αn, ι)· · ·))

(c) for allk ∈[1, n],T_{k}✂^{α}^{k}S_{k} so that for all p^{′} ∈S_{k} there isq^{′} ∈T_{k} such that
q^{′} ⊑p^{′},

(d) andι∈ρ(α0).

Let’s take fresh variables,y^{α}_{1}^{1}, . . . ,y_{n}^{α}^{n}, which are not free inM and are associated
to the empty set byΓ. We let∆=y_{1}^{α}:T1, . . . , y_{n}^{α}:Tnthen for allk∈[1, n] and all
q^{′}∈T_{k},Γ, ∆⊢Πy^{α}_{k}^{k}:q^{′}is derivable. Thus givenp^{′}∈S_{k}, the induction hypothesis
gives us the existence of M^{p}

′

k such that M^{p}

′

k

→∗η y_{k}^{α}^{k} and Γ, ∆ ⊢_{Π} M^{p}

′

k : p^{′} is
derivable. Since derivability is preserved by η-expansion and that η-expansion is

confluent, there isM_{k} such thatM_{k}→^{∗}ηy^{α}_{k}^{k} and for allp^{′}∈S_{k},Γ, ∆⊢ΠM_{k}:p^{′}.
Thus we have thatΓ, ∆⊢Π M M_{1}. . . Mn:ιis derivable and then

Γ ⊢Πλy_{1}^{α}^{1}. . . y_{n}^{α}^{n}.M M1. . . Mn: (T1, α1,(· · ·(Tn, αn, ι)· · ·))
is derivable. The proof is finished since we have:

λy^{α}_{1}^{1}. . . y^{α}n^{n}.M M1. . . Mn ∗

→η λy_{1}^{α}^{1}. . . y^{α}n^{n}.M y^{α}_{1}^{1}. . . y^{α}n^{n}

→∗η M

Together with Lemma 7, this last lemma shows that the subject reduction and the
subject expansion theorems can easily be transferred from the type system⊢Π to the
system⊢^{⊑}_{Π}.

Theorem 3 If M is in long form, Γ ⊢_{Π} M : p is derivable and p ⊑^{α} q. Then
Γ ⊢ΠM:q is derivable.

Proof From the previous lemma we have the existence ofM^{′}such thatM^{′ ∗}→ηM and
Γ ⊢_{Π}M^{′}:qis derivable. But sinceM is in long form,M^{′ ∗}→_{β}M and from the subject
reduction theorem forβ-reduction we get thatΓ ⊢_{Π}M :q is derivable.

Theorem 4 Suppose thatM^{′} is the long form ofM thenΓ ⊢^{⊑}_{Π} M :p is derivable if
and only ifΓ ⊢ΠM^{′}:pis derivable.

Proof The first direction of the implication is an immediate consequence of the previous theorem. For the second direction it suffices to use Lemma 7.

So the judgments of the derivation system ⊢^{⊑}_{Π} are closed under βη-convertibility
when the subjects are elements of Λ_{Σ}, but derivability in ⊢^{⊑}_{Π} is equivalent to deriv-
ability in⊢_{Π} on long forms. This gives us a nice tool to avoid the subsumption rule in
inductions.

HOIS may express very strong properties about the terms. In particular the theorem we prove in the next section shows that they can characterizeβη-convertible classes of λ-terms.

4 Defining singleton sets with intersection types

The main interest for this paper of higher order intersection signatures is that they
can be used to describe with static typing anysingleton set,i.esets of the form{N∈
Λ_{Σ}|N =_{βη} M}. Characterizing singleton sets with simple types has already been
explored. The first result we are aware of is [BS82] which proves that simple typing
enables to define any singleton sets of affine terms. This result has been extended
in several directions by [AO94], [Aot99], [Tat99] and [HT00]. But it is well known
that simple types cannot sufficiently constrain the set of terms they type so as to
define any singleton set. The simplest example is given by Church numerals which,
when greater than 2, have (o → o) → o → o as most general type. Therefore, a
singleton set containing any church numeral greater than 2 cannot be defined by means
simple types. This is why a stronger notion of typing is necessary. In this section
we show that this can be done with HOIS. As an example, we can illustrate how
intersection types can discriminate Church numerals. Indeed, one can see that M =

λf^{o→o}x^{o}. f^{o→o}(. . .(f^{o→o}

| {z }

n×

x^{o}). . .), the church numeraln, is the onlyλ-term, modulo
βη-convertibility, that can be typed with (0→1∩. . .∩(n−1)→n)→0→nin the
HOIS (Σ,{0;. . .;n}, ρ, f) where Σ is a signature that does not declare any constant
and only uses one atomic type, namelyo,ρis a function that maps everykin{0;. . .;n}

too, andf is the empty function.

As usual in what follows, unless stated otherwise, we assume that we are given a HOSΣ and an intersection signature overΣ notedΠ.

Our theorem, the singleton set theorem, relies on a precise account of the occur- rences of atomic formulae.

Definition 1 Given ι∈ I and p∈ ∩_{Π}, the number of occurrences of ιinp, |p|ι is
defined as:

1. ifp∈I then|p|ι=

0 ifp6=ι
1 ifp=ι
2. ifp= (S, α, p^{′}) then|p|ι=|p^{′}|ι+P

q∈S|q|ι

GivenΓ, aΠ-type environment, the number of occurrences ofιinΓ, written|Γ|ι, is equal toP

x^{α}∈VΣ

P

q∈Γ(x^{α})|q|ι. The number of occurrences ofι in the types of the
constants ofΠ is defined as|Π|ι=P

c∈C

P

q∈f(c)|q|ι.

We also need the usual notion of polarity which in a formula distinguishes, for any derivation, the subformulae that are bound to be used as hypothesis (i.e.used as the type of a variable) and the subformulae that will have to be proved (i.e. used as the type of aλ-term).

Definition 2 Given a higher order intersection signatureΠ andp∈ ∩_{Π}, we say that
q∈ ∩Π (resp. S⊆ ∩Π) occurs positively inpif and only if:

1. q=por,

2. p= (T, α, p^{′}) and eitherq(resp. S) occurs positively in p^{′} orqoccurs negatively
inp^{′′}∈T (resp. orS occurs negatively inp^{′′}∈T).

We say thatq∈ ∩Π (resp. S ⊆ ∩Π) occurs negatively inpif and only ifp= (T, α, p^{′})
and eitherq (resp. S) occurs negatively in p^{′} orq occurs positively in p^{′′}∈T (resp.

S=T orS occurs positively inp^{′′}∈T).

We say thatq (resp. S) occurs positively or negatively in aΠ-type environment
Γ whenever there isx^{α}∈ VΣ such thatq(resp. S) occurs positively or negatively in
p∈Γ(x^{α}).

The difference between constants and variables is rather small. It stems from the fact that variables are declared directly inΠ-type environments whereas constants are declared in Π, the HOIS. The proof of the singleton set theorem requires a precise management of theΠ-type environments for the variables. Concerning constants, such a management is performed by operations on higher order intersection signatures.

So we give here an operation that allows to discard a type assignment in a Π-type environment and its counter-part at the level of higher order intersection signatures.

Definition 3 GivenΓ aΠ-type environment, we defineΓ\x^{α}:qto be theΠ-context
such that:

(Γ\x^{α}:q)(y^{β}) =

(Γ(x^{α})\{q}wheny^{β}=x^{α}
Γ(y^{β}) otherwise

Definition 4 Given a higher order intersection signatureΠ = (Σ, I, ρ, f) we define the signature obtained fromΠ by suppressing the declarationc:p, writtenΠ\c:p= (Σ, I, ρ, g), where:

g(d) =

f(d) ifd6=c f(d)\{p}ifd=c

Definition 5 GivenΓ aΠ-type environment andp∈ ∩Π, we say that the pair (Γ, p) is balanced relatively toΠ if it fulfills the following properties:

1. Each elementι∈Ihas at most two occurrences inΓ,pandΠ,i.e.|Γ|ι+|p|ι+|Π|ι≤ 2.

2. There is no negative occurrence of∅inΓ andS

c∈Cf(c).

3. There is no positive occurrence of∅inp.

A sequent Γ ⊢^{⊑}_{Π} M : p is said to be balanced whenever the pair (Γ, p) is balanced
relatively toΠ.

WhenΠis clear from the context we will simply write that a pair (Γ, p) is balanced.

We now show that if (Γ, p) is balanced then all the terms such thatΓ ⊢_{Π}M :pis
derivable are pairwiseβη-convertible. The proof of this property relies on the following
lemma:

Lemma 9 Givenq= (S1, α1,(· · ·(Sn, αn, ι)· · ·))∈ ∩_{Π} such that|q|ι= 1we have:

1. If Γ ⊢^{⊑}_{Π} M : p is derivable, q ∈ Γ(x^{α}) and |Γ\x^{α} : q|ι+|p|ι+|Π|ι = 0 then
Γ\x^{α}:q⊢_{Π}M:pis derivable.

2. IfΓ ⊢^{⊑}_{Π} M :p is derivable,q∈f(c)for some c∈C, |Γ|ι+|p|ι+|Π\c:q|ι = 0
thenΓ ⊢^{⊑}_{Π\c:q} M:pis derivable.

Proof Using the subject reduction and the subject expansion theorems, we may assume without loss of generality thatM is in long normal form; furthermore, the use of the Theorem 4 allows us to consider that the derivation does not use the subsumption rule.

Thus, in general, eitherM=y^{β}M1. . . Mm, orM =bM1. . . Mm, orM=λy^{β}.M^{′}. As
the second statement of this lemma can be proved in the same way as the first one, we
only give the proof of the first statement.

To prove the first statement of the lemma we proceed by induction on the structure ofM,:

1. ifM =y^{β}M_{1}. . . M_{m}(resp. M =bM_{1}. . . M_{m}) then there is
q^{′}= (T1, β1,(· · ·(Tm, βm, p)· · ·))
such that:

(a) q^{′} ∈Γ(y^{β}) (resp. q^{′}∈f(b))

(b) Since|p|ι= 0,q6=q^{′} andq^{′}∈(Γ\x^{α}:q)(y^{β})
(c) M_{i} is in long normal form andM_{i}∈Λ^{β}_{Σ}^{i}
(d) Since|Γ\x^{α}:q|ι= 0, for allq^{′′}∈T_{i},|q^{′′}|ι= 0

(e) For allq^{′′}∈T_{i},Γ ⊢ΠM_{i}:q^{′′}is derivable

Then by induction hypothesis, we get that for all i ∈ [1, m] and all q^{′′} ∈ T_{i},
Γ\x^{α} : q ⊢_{Π} M_{i} : q^{′′} is derivable. Since q^{′} ∈ (Γ\x^{α} : q)(y^{β}) and Γ\x^{α} : q is
Π-type environment, we obtain that Γ\x^{α} : q ⊢_{Π} y^{β} : q^{′} (resp. Γ\x^{α} : q ⊢_{Π}
b:q^{′}) is derivable. Thus by a repeated use of the application rule we obtain that
Γ\x^{α}:q⊢Πy^{β}M1. . . Mm:p(resp. Γ\x^{α}:q⊢ΠbM1. . . Mm:p) is derivable.

2. ifM =λy^{β}.M^{′} thenp= (S, β, p^{′}) and the derivation ofΓ ⊢ΠM :pmust be like:

Γ, y^{β}:S⊢_{Π}M^{′}:p^{′}
Γ ⊢Πλy^{β}.M^{′}: (S, β, p^{′})

as there is no occurrence of ι in the elements of S or in p^{′}, we can apply the
induction hypothesis and obtain that (Γ\x^{α} : q), y^{β} :S ⊢_{Π} M^{′} : p^{′} is derivable
and then thatΓ\x^{α}:q⊢_{Π}M :pis also derivable.

We are now in a position to prove the property we wanted for balanced judgements.

Theorem 5 IfΓ ⊢^{⊑}_{Π} M :pandΓ ⊢^{⊑}_{Π} N :pare balanced and derivable thenM =_{βη}
N.

Proof Because we have the subject reduction and the subject expansion theorems for
derivations in higher-order intersection signatures with Theorem 4, proving this theo-
rem boils down to proving that given a balanced pair (Γ, p) there is at most one long
normal termM such thatΓ ⊢_{Π}M :pis derivable.

So let us suppose we are given a balanced pair (Γ, p) and a long normal termM such thatΓ ⊢Π M :pis derivable. We prove thatM is unique. The uniqueness of M is shown by induction on its structure:

1. ifM =x^{α}M_{1}. . . M_{n} thenp∈I and:

(a) there isq= (S1, α1,(· · ·(Sn, αn, p)· · ·)) inΓ(x^{α}).

(b) For alli∈[1, n] andq^{′}∈S_{i},Γ ⊢M_{i}:q^{′}is derivable.

(c) Since (Γ, p) is balanced,|Γ\x^{α}:q|p+|Π|p= 0 and for alli∈[1, n],S_{i}6=∅.

Let Γ^{′} = Γ\x^{α} : q, from the previous lemma, we have that Γ^{′} ⊢Π M_{i} : q^{′} is
derivable for all q^{′} ∈S_{i}. We also have that for ι∈I,|Γ^{′}|ι+|Π|ι+|q^{′}|ι ≤ |Γ|ι+

|Π|ι+|p|ι ≤ 2 which implies that (Γ^{′}, q^{′}) is balanced. We can then apply the
induction hypothesis toΓ^{′}⊢_{Π} M_{i}:q^{′}which gives that anyN in long normal form
such thatΓ^{′}⊢ΠN :q^{′} is equal toM_{i}. Now let us suppose that there isN, a term
in long normal form, such that Γ ⊢Π N :q^{′} is derivable. The use of the previous
lemma gives thatΓ^{′}⊢ΠN :q^{′} is also derivable and finally thatN=M_{i}. The fact
that there is no negative occurrence of ∅ implies that noS_{i} is empty and, then,
that each of the M_{i} is uniquely defined. Since there is no other possible choice
concerning the head ofM we can conclude thatM is unique.

2. ifM =cM1. . . Mn then we proceed similarly to the previous case.

3. ifM =λx^{α}.M^{′} then the derivation must be of the form:

Γ, x^{α}:S⊢ΠM^{′}:p^{′}
Γ ⊢Πλx^{α}.M^{′}: (S, α, p^{′})

Obviously the pair (Γ, x^{α} :S;p^{′}) is balanced, then by induction hypothesis, M^{′}
is the unique long normal term such that Γ, x^{α}:S ⊢Π M^{′} :p^{′} is derivable ; the
unicity ofM follows.

This theorem proves that balanced sequents of higher-order intersection signatures define singleton sets. The question is now whether all the βη-equivalence classes of terms built on a higher order signature Σ can be captured that way. The answer is positive and it leads to the singleton set theorem.

Definition 6 Given two intersection signatures overΣ,Π1= (Σ, I1, ρ1, f1) andΠ2= (Σ, I2, ρ2, f2) such that for allι∈I1∩I2,ρ1(ι) =ρ2(ι) thenΠ1∪Π2, the union ofΠ1

andΠ2, is defined as the intersection signature (Σ, I1∪I2, ρ, f) where:

1. ρ(ι) =

ρ1(ι) ifι∈I1

ρ_{2}(ι) ifι∈I_{2}
2. f(c) =f1(c)∪f2(c)

Definition 7 Two signatures overΣ, Π1 = (Σ, I1, ρ1, f1) and Π2 = (Σ, I2, ρ2, f2), are independent ifI1∩I2=∅.

The union of two independent intersection signatures is always defined. Remark that the union operation between signatures is associative and commutative.

Theorem 6 Given M a term in long normal form then there is an intersection sig-
natureΠ and a pair(Γ, p)such thatΓ ⊢^{⊑}_{Π}M :pis derivable and balanced.

Proof We proceed by induction on the structure ofM:

1. ifM =x^{β}M1. . . Mn then by induction hypothesis there is a family of intersection
signatures (Π_{k})_{k∈[1,n]} and a family of pairs ((Γ_{k}, p_{k}))_{k∈[1,n]} such that for allk∈
[1, n],Γ_{k} ⊢^{⊑}_{Π}_{k}M_{k}:p_{k} is derivable and balanced.

We may suppose that the Π_{k} are pairwise independent. Let ι^{′} be a new atomic
intersection type such that for allk ∈[1, n],ι^{′} ∈/I_{k}. Ifβ=β1 → · · · →βn →α,
we let Π^{′} = (Σ,{ι^{′}}, ρ^{′}, f^{′}) with ρ^{′}(ι^{′}) = α and f^{′} is the empty function. We
then letΠ=Π^{′}∪S

k∈[1,n]Π_{k},p= ({p1}, β1,(· · ·({pn}, βn, ι^{′})· · ·)) andΓ be the
Π-context verifying:

Γ(y^{α}) =

({p} ∪S

k∈[1,n]Γ_{k}(x^{α}) ify^{α}=x^{β}
S

k∈[1,n]Γ_{k}(y^{α}) otherwise

we have that for allι∈I_{k} (for somek∈[1, n]),|Γ|ι+|Π|ι=|Γk|ι+|Πk|ι+|pk|ι

and obviouslyΓ ⊢^{⊑}_{Π}M :ι^{′} is derivable. To prove that (Γ, ι^{′}) is balanced relatively
toΠ we just have to note that|Γ|_{ι}^{′}+|Π|_{ι}^{′}+|ι^{′}|_{ι}^{′}= 2 and use the fact that (Γ_{k}, p_{k})
is balanced relatively toΠ_{k}.

2. ifM=cM1. . . Mnthen the conclusion is proved using the same principle as in the previous case.

3. ifM=λx^{β}.M^{′}the conclusion is a direct consequence of the induction hypothesis.

Finally we get the singleton set theorem as a corollary.

Theorem 7 Given M ∈Λ_{Σ}, there isΠ,Γ andpsuch that Γ ⊢^{⊑}_{Π} N :pis derivable
if and only ifM=_{βη}N.

5 Decidability of the membership problem for second order ACGs

To obtain the decidability result we aim at, we start by showing a closure property of the languages ofλ-terms defined by second order non-linear ACGs. We indeed prove that the class of languages defined by second order non-linear ACGs is closed under intersection with the set of terms typable on a higher-order intersection signature with all the types of a given setP. Then the use of the singleton set theorem reduces the membership problem to the problem of the emptiness of the language of a second order ACG, which is trivially decidable (it amounts to checking whether a local tree language is empty or not).