Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

BGMS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Loader and Urzyczyn are Logically Related

Sylvain Salvati1 , Giulio Manzonetto2 , Mai Gehrke3 , and Henk Barendregt4


1
INRIA Bordeaux — Sud-Ouest, Talence, France.
sylvain.salvati@labri.fr
2
LIPN, CNRS UMR 7030, Université Paris-Nord, Villetaneuse, France
giulio.manzonetto@lipn.univ-paris13.fr
3
LIAFA, CNRS, Université Paris-Diderot, Paris, France.
mai.gehrke@liafa.jussieu.fr
4
Radboud University, Intelligent Systems, Nijmegen, The Netherlands
henk@cs.ru.nl

Abstract. In simply typed λ-calculus with one ground type the fol-
lowing theorem due to Loader holds. (i) Given the full model F over a
finite set, the question whether some element f ∈ F is λ-definable is un-
decidable. In the λ-calculus with intersection types based on countably
many atoms, the following is proved by Urzyczyn. (ii) It is undecidable
whether a type is inhabited.
Both statements are major results presented in [3]. We show that (i)
and (ii) follow from each other in a natural way, by interpreting inter-
section types as continuous functions logically related to elements of F.
From this, and a result by Joly on λ-definability, we get that Urzyczyn’s
theorem already holds for intersection types with at most two atoms.
Keywords: λ-calculus, λ-definability, inhabitation, undecidability.

Introduction
Consider the simply typed λ-calculus on simple types T0 with one ground type 0.
Recall that a hereditarily finite full model of simply typed λ-calculus is a col-
FA
lection of sets F = (FA )A∈T0 such that F0 6= ∅ is finite and FA→B = FB
(i.e. the set of functions from FA to FB ) for all simple types A, B. An element
f ∈ FA is λ-definable whenever, for some closed λ-term M having type A, we
have [M ] = f , where [M ] denotes the interpretation of M in F. The following
question, raised by Plotkin in [7], is known as the Definability Problem:
DP: “Given an element f of any hereditarily finite full model,
is f λ-definable?”
A natural restriction considered in the literature [5, 6] is the following:
DPn : “Given an element f of Fn , is f λ-definable?”
where Fn (for n ≥ 1) denotes the unique (up to isomorphism) full model whose
ground set F0 has n elements. Statman’s conjecture stating that DP is decidable
[9] was refuted by Loader [6], who proved in 1993 (but published in 2001) that
DPn is undecidable for every n > 6. Such a result was then strengthened by
Joly, who showed in [5] that DPn is undecidable for all n > 1.
2 Salvati, Manzonetto, Gehrke, Barendregt

Theorem 1. 1. (Loader) The Definability Problem is undecidable.


2. (Loader/Joly) DPn is undecidable for every n > 6 (resp. n > 1).
Consider now the λ-calculus endowed with the intersection type system CDV
(Coppo-Dezani-Venneri [4]) based on a countable set A of atomic types. Recall
that an intersection type σ is inhabited if `∧ M : σ for some closed λ-term M .
The Inhabitation Problem for this type theory is formulated as follows:
IHP: “Given an intersection type σ, is σ inhabited?”
We will also be interested in the following restriction of IHP:
IHPn : “Given an intersection type σ with at most n atoms, is σ inhabited?”
In 1999, Urzyczyn [10] proved that IHP is undecidable for suitable intersection
types, called “game types” in [3, §17E], and thus for the whole CDV. His idea
was to prove that solving IHP for a game type σ is equivalent to winning a
suitable “tree game” G. An arbitrary number of atoms may be needed since, in
the Turing-reduction, the actual amount of atoms in σ is determined by G.
Theorem 2 (Urzyczyn).
1. The Inhabitation Problem is undecidable.
2. The Inhabitation Problem for game types is undecidable.
The undecidability of DP and that of IHP are major results presented thoroughly
in [3, §4A] and [3, §17E]. In the proof these problems are reduced to well-known
undecidable problems (and eventually to the Halting problem). However, the
instruments used to achieve these results are very different — the proof by
Loader proceeds by reducing DP to the two-letter word rewriting problem, while
the proof by Urzyczyn reduces IHP to the emptiness problem for queue automata
(through a series of reductions). The fact that these proofs are different is not
surprising since the two problems, at first sight, really look unrelated.
Our main contribution is to show that DP and IHP are actually Turing-
equivalent, by providing a perhaps unexpected link between the two problems.
The key ideas behind our constructions are the following. Every intersection
α1 ∧ · · · ∧ αk of atoms can be viewed as a set {α1 , . . . , αk }, and every arrow type
σ → τ as a (continuous) step function. Moreover, Urzyczyn’s game types follow
the structure of simple types. Combining these ingredients we build a continu-
ous model S = (SA )A∈T0 over a finite set of atomic types, which constitutes a
“bridge” between intersection type systems and full models of simply typed λ-
calculus. Then, exploiting very natural semantic logical relations, we can study
the continuous model, cross the bridge and infer properties of the full model.
Our constructions allow us to obtain the following Turing-reductions (recall that
if the problem P1 is undecidable and P1 ≤T P2 , then also P2 is undecidable):
(i) Inhabitation Problem for game types ≤T Definability Problem,
(ii) Definability Problem ≤T Inhabitation Problem (cf. [8]),
(iii) DPn ≤T IHPn (cf. [8]).
Therefore, by (i) and (ii) we get that the undecidability of DP and IHP follows
from each other. Moreover, by (iii) and Theorem 1(2) we conclude that IHPn is
undecidable whenever n > 1, which is a new result refining Urzyczyn’s one.
Loader and Urzyczyn are Logically Related 3

Λ: M, N, P ::= x | M N | λx.M, where x ∈ Var


T0 : A, B, C ::= 0 | A → B
TA∧ : γ, ρ, σ, τ ::= α | σ → τ | σ ∧ τ, where α ∈ A
(a) Sets Λ of λ-terms, T0 of simple types, TA∧ of intersection types over A.

σ ≤ σ (refl) σ ∧ τ ≤ σ (inclL ) σ ∧ τ ≤ τ (inclR )


0 0
(σ → τ ) ∧ (σ → τ ) ≤ σ → (τ ∧ τ ) (→∧ )
σ≤γ γ≤τ σ ≤ τ σ ≤ τ0 σ0 ≤ σ τ ≤ τ 0
(trans) (glb) (→)
σ≤τ σ ≤ τ ∧ τ0 σ → τ ≤ σ0 → τ 0
(b) Rules defining the subtyping relation ≤ on intersection types TA∧ .

Γ `∧ M : τ → σ Γ `∧ N : τ
(ax) (→E )
x1 : σ1 , . . . , xn : σn `∧ xi : σi Γ `∧ M N : σ
Γ, x : σ `∧ M : τ Γ `∧ M : σ Γ `∧ M : τ Γ `∧ M : σ σ ≤ τ
(→I ) (∧I ) (≤)
Γ `∧ λx.M : σ → τ Γ `∧ M : σ ∧ τ Γ `∧ M : τ

(c) Rules defining the intersection type system CDV.

Fig. 1: Definition of terms, types, subtyping and derivation rules for CDV. The rules
for simply typed λ-calculus are obtained from those in (c) leaving out (∧I ) and (≤).

1 Preliminaries: Some Syntax, Some Semantics

To make this article more self-contained, this section summarizes some defini-
tions and results that we will use later in the paper. Given a set X, we write
P(X) for the set of all subsets of X, and Y ⊆f X if Y is a finite subset of X.

1.1 Typed Lambda Calculi

We take untyped λ-calculus for granted together with the notions of closed λ-
term, α-conversion, (β-)normal form and strong normalization. We denote by
Var the set of variables and by Λ the set of λ-terms. Hereafter, we consider
λ-terms up to α-conversion and we adopt Barendregt’s variable convention.
We mainly focus on two particular typed λ-calculi (see [3] for more details).
The simply typed λ-calculus à la Curry over a single atomic type 0. The
set T0 of simple types A, B, C, . . . is defined in Figure 1(a). Simple contexts ∆
are partial functions from Var to T0 ; we write ∆ = x1 : A1 , . . . , xn : An for the
function of domain {x1 , . . . , xn } such that ∆(xi ) = Ai for i in [1; n]. We write
∆ ` M : A if M has type A in ∆, and we say that such an M is simply typable.
The intersection type system CDV over an infinite set A of atomic
types. This system was first introduced by Coppo, Dezani and Venneri [4] to
characterize strongly normalizable λ-terms. The set TA
∧ of intersection types is
given in Figure 1(a) and it is partially ordered by the subtyping relation ≤
4 Salvati, Manzonetto, Gehrke, Barendregt

defined in Figure 1(b). Vn We denote by ' the equivalence generated by ≤. As


usual, we may write i=1 σi → τi for (σ1 → τ1 ) ∧ · · · ∧ (σn → τn ).
Contexts Γ = x1 : τ1 , . . . , xn : τn are handled as in the simply typed case. We
write Γ `∧ M : σ if the judgment can be proved using the rules of Figure 1(c).
As a matter of notation, given two sets Y, Z of intersection types, we let Y ∧ =
{σ1 ∧ · · · ∧ σn | σi ∈ Y for i ∈ [1; n]} and Y → Z = {τ → σ | τ ∈ Y, σ ∈ Z}.
We now present some well known properties of CDV. For their proofs, we
refer to [4], [3, Thm. 14.1.7] and [3, Thm. 14.1.9] respectively.
Theorem 3. A λ-term M is typable in CDV iff M is strongly normalizable.
Vk
Theorem 4 (β-soundness). For all k ≥ 1, if i=1Vσi → ρi ≤ V γ1 → γ2 then
there is a non-empty subset K ⊆ [1; k] such that γ1 ≤ i∈K σi and i∈K ρi ≤ γ2 .
Theorem 5 (Inversion Lemma). The following properties hold:
1. Γ `∧ x : σ iff Γ (x) ≤ σ,
2. Γ `∧ M N : σ iff there is ρ such that Γ `∧ M :Vρ → σ and Γ `∧ N : ρ,
n
3. Γ `∧ λx.M : σ iff there is n ≥ 1 such that σ = i=1 σi → σi0 for some σi , σi0 ,
4. Γ `∧ λx.M : σ → τ iff Γ, x : σ `∧ M : τ .

1.2 Type Structures Modelling the Simply Typed Lambda Calculus


A typed applicative structure M is a pair ((MA )A∈T0 , •) where each MA is a
structure whose carrier is non-empty, and • is a function that associates to every
d ∈ MA→B and every e ∈ MA an element d • e in MB . From now on, we shall
write d ∈ M to denote d ∈ MA for some A. We say that M is: hereditarily
finite if every MA has a finite carrier; extensional whenever, for all A, B ∈ T0
and d, d0 ∈ MA→B , we have that d • e = d0 • e for every e ∈ MA entails d = d0 .
A valuation in M is any map νM from Var to elements of M. A valuation
νM agrees with a simple context ∆ when ∆(x) = A implies νM (x) ∈ MA . Given
a valuation νM and an element d ∈ M, we write νM [x := d] for the valuation
0 0
νM that coincides with νM , except for x, where νM takes the value d. When
there is no danger of confusion we may omit the subscript M and write ν.
A valuation model M is an extensional typed applicative structure such
M
that the clauses below define a total interpretation function [ · ](·) which maps
derivations ∆ ` M : A and valuations ν agreeing with ∆ to elements of MA :
M
– [∆ ` x : A]ν = ν(x),
M M M
– [∆ ` N P : A]ν = [∆ ` N : B → A]ν • [∆ ` P : B]ν ,
M M
– [∆ ` λx.N : A → B]ν • d = [∆, x : A ` N : B]ν[x:=d] for every d ∈ MA .
When the derivation (resp. the model) is clear from the context we may simply
M
write [M ]ν (resp. [M ]ν ). For M closed, we simplify the notation further and
write [M ] since its interpretation is independent from the valuation.
The full model over a set X 6= ∅, denoted by Full(X), is the valuation model
FA
((FA )A∈T0 , •) where • is functional application, F0 = X and FA→B = FB .
The continuous model over a cpo (D, ≤), written Cont(D, ≤), is the val-
uation model ((DA , vA )A∈T0 , •) such that • is functional application and:
Loader and Urzyczyn are Logically Related 5

– D0 = D and f v0 g iff f ≤ g,
– DA→B = [DA → DB ] consisting of the monotone functions from DA to DB
with the pointwise partially ordering vA→B .
We will systematically omit the subscript A in vA when clear from the context.
Note that both Full(X) and Cont(D, ≤) are extensional. Moreover, whenever
X (resp. D) is finite Full(X) (resp. Cont(D, ≤)) is hereditarily finite.
Logical relations have been extensively used in the study of semantic prop-
erties of λ-calculus (see [2, §4.5] for a survey). As we will see in Sections 4 and
5 they constitute a powerful tool for relating different valuation models.
Definition 1. Given two valuation models M, N , a logical relation R between
M and N is a family {RA }A∈T0 of binary relations RA ⊆ MA × NA such that
for all A, B ∈ T0 , f ∈ MA→B and g ∈ NA→B we have:
f RA→B g iff ∀h ∈ MA , h0 ∈ NA [h RA h0 ⇒ f (h) RB g(h0 )].
Given f ∈SMA we define RA (f ) = {g ∈ NA | f RA g} and, for Y ⊆ MA ,

RA (Y ) = f ∈Y RA (f ). Similarly, for g ∈ NA and Z ⊆ NA we have RA (g) =
− −
{f ∈ NA | f RA g} and RA (Z) = g∈Z RA (g).
S
It is well known that a logical relation R is univocally determined by the
value of R0 , and that the fundamental lemma of logical relations holds [2, §4.5].
Lemma 1 (Fundamental Lemma). Let R be a logical relation between M
M N
and N then, for all closed M having simple type A, we have [M ] RA [M ] .

2 Uniform Intersection Types and CDVω


A useful approach to prove that a general decision problem is undecidable, is
to identify a “sufficiently difficult” fragment of the problem. For instance, Urzy-
czyn in [10] shows the undecidability of inhabitation for a proper subset G of
intersection types called game types in [3, §17E]. Formally, G = A ∪ B ∪ C where:
A = A∧ , B = (A → A)∧ , C = (D → A)∧ for D = {σ ∧ τ | σ, τ ∈ (B → A)}.
(Recall that the notations Y ∧ and Y → Z were introduced in Subsection 1.1.)
In our case we focus on intersection types that are uniform with simple types,
in the sense that such intersection types follow the structure of the simple types.
Let us fix an arbitrary set X ⊆ A. We write TX ∧ for the set of intersection
types based on X.
Definition 2. The set ΞX (A) of intersection types uniform with A ∈ T0 is
defined by induction on A as follows:
ΞX (0) = X ∧ , ΞX (B → C) = (ΞX (B) → ΞX (C))∧ .
When there is little danger of confusion, we simply write Ξ(A) for ΞX (A).
It turns out that game types are all uniform: A ⊆ ΞA (0), B ⊆ ΞA (0 → 0)
and D ⊆ ΞA ((0 → 0) → 0) thus C ⊆ ΞA (((0 → 0) → 0) → 0). Therefore the
inhabitation problem for uniform intersection types over A is undecidable too.
6 Salvati, Manzonetto, Gehrke, Barendregt

Theorem
S 6 (Urzyczyn revisited). The problem of deciding whether a type
σ ∈ A∈T0 ,X⊆f A ΞX (A) is inhabited in CDV is undecidable.
For technical reasons, that will be clarified in the next section, we need to
introduce the system CDVω over A ∪ {ω}, a variation of CDV where intersection
types are extended by adding a distinguished element ω at ground level.
In this framework, the set ΞX∪{ω} (A) of intersection types with ω uniform
ω
with A will be denoted by ΞX (A), or just Ξ ω (A) when X is clear. We write ωA
for the type in Ξ ω (A) defined by ω0 = ω and ωB→C = ωB → ωC .
The system CDVω over T∧
A∪{ω}
, whose judgments are denoted by Γ `ω∧ M : σ,
is generated by adding the following rule to the definition of ≤ in Figure 1(b):

σ ∈ ΞAω (A)
(≤A )
σ ≤ ωA

Therefore CDVω is different from the usual intersection type systems with ω.
By construction, for every A ∈ T0 , the type ωA is a maximal element of Ξ ω (A).
Using [3, Thm. 14A.7], we easily get that the Inversion Lemma (Theorem 5) still
works for CDVω , while the β-soundness holds in the following restricted form.
Recall that ' stands for the equivalence generated by ≤.
Theorem 7 (β-soundness for CDVω ). Let k ≥ 1. Suppose γ1 → γ2 6' ωA
Vk
for all A ∈ T0 and i=1 σVi → ρi ≤ γ1 V
→ γ2 , then there is a non-empty subset
K ⊆ [1; k] such that γ1 ≤ i∈K σi and i∈K ρi ≤ γ2 .
We now provide some useful properties of uniform intersection types.

Lemma 2. Let σ ∈ Ξ ω (A) and τ ∈ Ξ ω (A0 ). Then we have that σ ≤ τ entails


A = A0 .

To distinguish arbitrary contexts from contexts containing uniform intersec-


tion types (with or without ω) we introduce some terminology.
We say that a context Γ is a Ξ-context (resp. Ξ ω -context) if it ranges over
uniform intersection types (resp. with ω). A Ξ-context (resp. Ξ ω -context) Γ =
x1 : σ1 , . . . , xn : σn is uniform with ∆ = x1 : A1 , . . . , xn : An if every σi belongs
to Ξ(Ai ) (resp. to Ξ ω (Ai )).
A∪{ω}
Lemma 3. Let ρ ∈ T∧ , τ ∈ Ξ ω (B) and Γ be a Ξ ω -context. Then we have
that Γ, x : τ `∧ xN1 · · · Nk : ρ iff there are A, A1 , . . . , Ak ∈ T0 and σ ∈ Ξ ω (A)
ω

and τi ∈ Ξ ω (Ai ) for i in [1; k] such that B = A1 → · · · → Ak → A and:


1. σ ≤ ρ,
2. Γ, x : τ `ω
∧ xN1 · · · Nk : σ,
3. τ ≤ τ1 → · · · → τk → σ,
4. Γ, x : τ `ω
∧ Ni : τi for all i in [1; k].

Furthermore, if Γ is a Ξ-context, ρ ∈ TA ∧ and τ ∈ Ξ(B), then σ and the τi for


i in [1; k] may also be chosen as uniform intersection types without ω (while the
type judgments `ω ω
∧ still need to be in CDV ).
Loader and Urzyczyn are Logically Related 7

Theorem 8 (Uniform Inversion Lemma for CDVω ). Let σ ∈ Ξ ω (A) and


Γ be a Ξ ω -context. Then we have that (where we suppose that each term in a
type judgment is in normal form):
1. Γ `ω∧ x : σ iff Γ (x) ≤ σ,
2. Γ `ω 0 ω ω
∧ M N : σ iff there exist B ∈ T and τ ∈ Ξ (B) such that Γ `∧ M : τ → σ
ω
and Γ `∧ N : τ ,
3. Γ `ω∧ λx.NVn: σ iff A = B → C and there are τi ∈ Ξ ω (B), τi0 ∈ Ξ ω (C) such
that σ = i=1 τi → τi0 and Γ, x : τi `ω
∧ N : τi
0
for all i in [1; n].
Corollary 1. For M a normal λ-term, σ ∈ Ξ ω (A) and Γ a Ξ ω -context uniform
with ∆, we have that Γ `ω
∧ M : σ entails ∆ ` M : A.

Proof. A simple consequence of the Uniform Inversion Lemma (with Lemma 2


when M is a variable). t
u
The corollary above does not generalize to arbitrary λ-terms as the follow-
ing example illustrates. Let M = λzy.y and N = λx.xx, then we have that
`ω ω ω ω
∧ M N : α → α ∈ Ξ (0 → 0) since `∧ N : γ and `∧ M : γ → α → α where
γ = (β ∧ (β → β)) → β. However N is not simply typable, hence neither is M N .
Note that, while we consider only uniform intersection types, we do not restrict
the intersection type systems so that the type γ still may be used in a deduction.
CDV and CDVω are equivalent on normal forms in the following sense.
Lemma 4. For every normal M ∈ Λ, for every Ξ-context Γ = x1 : τ1 , . . . , xn : τn
uniform with ∆ = x1 : A1 , . . . , xn : An , and for every σ ∈ Ξ(A) we have:
Γ `∧ M : σ ⇐⇒ Γ `ω
∧ M : σ.

Proof. (⇒) Trivial, as CDV is a subsystem of CDVω .


(⇐) We proceed by induction on the structure of M . The cases where M is
a variable or a λ-abstraction can be treated thanks to Theorem 5 for CDVω and
the induction hypothesis. Concerning the case where M = xi N1 · · · Nk , from the
ω-free version of Lemma 3, we have that Ai = B1 → · · · → Bk → A, there exist
τ1 , . . . , τk respectively in Ξ(B1 ), . . . , Ξ(Bk ) such that τi ≤ τ1 → · · · → τk → σ
and Γ `ω ∧ Ni : τi for each i in [1; k]. Therefore, by the induction hypothesis, we
have that for every i in [1; k], Γ `∧ Ni : τi which entails that Γ `∧ M : σ. t
u

3 The Continuous Model over P(X)


Hereafter we consider fixed an arbitrary set X ⊆f A. We are going to represent
uniform intersection types based on X ∪{ω}, as elements of the continuous model
S over P(X), ordered by set-theoretical inclusion.
Let S = {(SA , vA )}A∈T0 = Cont(P(X), ⊆). Each SA is a finite join-semilattice
and thus a complete lattice. We denote the join by t and the bottom by ⊥A .
Given f ∈ SA , g ∈ SB we write f 7→ g for the corresponding step function:

g if f vA h,
(f 7→ g)(h) =
⊥B otherwise.
For all A we define a function ιA : Ξ ω (A) → SA by induction on A as follows.
8 Salvati, Manzonetto, Gehrke, Barendregt

Definition 3. For α ∈ X and σ, τ ∈ Ξ ω (0) we let ι0 (α) = {α}, ι0 (ω) = ⊥0 = ∅,


ι0 (σ ∧ τ ) = ι0 (σ) t ι0 (τ ). For σ, τ ∈ Ξ ω (A → B) we define:

ιA→B (σ → τ ) = ιA (σ) 7→ ιB (τ ), ιA→B (σ ∧ τ ) = ιA→B (σ) t ιA→B (τ ).

Remark 1. Given σ ∈ Ξ ω (A), we have that σ ' ωA entails ιA (σ) = ⊥A .


Thanks to the presence of the maximal element ωA , the correspondence be-
tween Ξ ω (A) and SA is actually very faithful (in the sense of Corollary 2).
Fn
Lemma 5. Let h = i=1 fi 7→ gi , then for every f we have:
F
(i) h(f ) = i∈K gi where K = {i ∈ [1; n] | fi v f }.
(ii) h v f iff gi v f (fi ) for all 1 ≤ i ≤ n.
F
Lemma 6. Step functions are generators: ∀f ∈ SA→B , f = g∈SA g 7→ f (g).
F
Proof. Let h = g∈SA g 7→ f (g). We need to prove F that, for every g ∈ SA , f (g) =
h(g). From Lemma 5(i), we have that h(g) = g0 vg f (g 0 ). Since F f is monotone,
we have that for every F g 0 v g, f (g 0 ) v f (g) and therefore 0
g 0 vg f (g ) v f (g).
0 0
F
Since obviously f (g) v g0 vg f (g ), we obtain f (g) = g0 vg f (g ) = h(g). t
u

Lemma 7. For all A ∈ T0 , σ, τ ∈ Ξ ω (A) we have σ ≤ τ iff ιA (τ ) v ιA (σ).


Proof. We proceed by induction on A. In case A = 0, the equivalence is clear
since P(X) is the free t-semilattice with bottom over X and Ξ ω (0)/' is the
free ∧-semilattice with top over X.
In case A = B → C, we have two subcases. Case 1, τ ' ωD for some
D ∈ T0 . Then by Lemma 2 we get D = A, by Remark 1 we get ιA (τ ) = ⊥A
and V Vm since both σ ≤ τ and ιA (τ ) v ιA (σ) hold. Case 2,
the equivalence follows
n
σ = i=1 σi → σi0 , τ = j=1 τj → τj0 and τ 6' ωD for any D ∈ T0 . By Remark 1
we can assume, without loss of generality, that for every j in [1; m] we have
τj → τj0 6' ωD for all D ∈ T0 . (Indeed for those k such that τk → τk0 ' ωD one
reasons as in Case 1.) We now prove the equivalence for this case.
(⇒) If σ ≤ τ , then by
V β-soundness,
V for every j in [1; m], there is Kj included
in [1; n] such that τj ≤ i∈Kj σi and i∈Kj σi0 ≤ τj0 . By the induction hypothesis:
G G
(1) ιB (σi ) v ιB (τj ) (2) ιC (τj0 ) v ιC (σi0 )
i∈Kj i∈Kj

We now prove that, F for every f ∈ SB , ιA (τ )(f ) v ιA (σ)(f ). From Lemma 5(i), we
0
get ιA (τ )(f ) = j∈J ι
F C j(τ ) where J = {j ∈ [1; m] | ιB (τjF ) v f }. By definition
of J, we have that j∈J ιB (τj ) v f so, by (1), we obtain j∈J,i∈Kj ιB (σi ) v f .
Therefore by Lemma 5(i), we get j∈J,i∈Kj ιC (σi0 ) v ιA (σ)(f ) and, using (2),
F

we obtain ιA (τ )(f ) v ιA (σ)(f ). As a conclusion we have ιA (τ ) v ιA (σ).


(⇐) If ιA (τ ) v ιA (σ), then we have in particular ιA (τ )(ιB (τj )) v ιF A (σ)(ιB (τj ))
for each j ∈ [1, m]. From Lemma 5(i), we have that ιA (τ )(ιB (τj )) = i∈Ij ιC (τi0 )
where Ij = {i ∈ [1; m] | τi ≤ τj }. Since τj ≤ τj we must have j ∈ Ij and there-
fore, we obtain ιC (τj0 ) v ιA (τ )(ιB (τj )). So, again by Lemma 5(i), we have that
Loader and Urzyczyn are Logically Related 9

ιA (σ)(ιB (τj )) = k∈Kj ιC (σk0 ) where Kj = {k ∈ [1; n] | τj ≤ σk }. Thus we get


F

ιC (τj0 ) v k∈Kj ιC (σk0 ) and hence, by the induction hypothesis, k∈Kj σk0 ≤ τj0 .
F V
V
Now, by definition of Kj , we also have τj ≤ k∈Kj σk . As we can find such a Kj
for every j in [1; m], we can finally conclude that σ ≤ τ . t
u
Corollary 2. The map ιA is an order-reversing bijection on Ξ ω (A)/ '.
Proof. If τ ≤ σ and σ ≤ τ , then Lemma 7 implies that ιA (τ ) = ιA (σ). From this
it ensues that ιA is an order-reversing injection. To prove that it is actually a
bijection, we need to show that ιA is surjective. We proceed by induction on A.
Clearly when A = 0, ιA is surjective. If A = B → C then we get from the
induction hypothesis that ιB and ιC are bijections between Ξ ω (B)/ ' and SB ,
and between Ξ ω (C)/
V ' and SC , respectively. Now, given f inF SA , we define
τf ∈ Ξ ω (A) to be g∈SB ι−1
B (g) → ι −1
C (f (g)). But, ιA→B (τf ) = g∈SB g 7→ f (g)
which is equal to f by Lemma 6. t
u
The above results are related to Stone duality for intersection types (cf. [1]).
Proposition 1. Let M be a normal term such that x1 : A1 , . . . , xn : An ` M : A.
Then for all τi ∈ Ξ ω (Ai ), σ ∈ Ξ ω (A) the following two sentences are equivalent:
1. x1 : τ1 , . . . , xn : τn `ω
∧ M : σ,
S
2. ιA (σ) v [M ]ν , for all valuations ν such that ν(xi ) = ιAi (τi ).
Proof. Let ∆ = x1 : A1 , . . . , xn : An and Γ = x1 : τ1 , . . . , xn : τn .
(1 ⇒ 2) We proceed by structural induction on M .
– In case M = xi , then τi ≤ σ and, by Lemma 7, ιAi (σ) v ιAi (τi ) = [xi ]ν .
– In case M = N P , then, from Theorem 8(2), there are B ∈ T0 and τ ∈ Ξ ω (B)
such that Γ `ω ω
∧ N : τ → σ and Γ `∧ P : τ . By induction ιB→A (τ → σ) v
[N ]ν and ιB (τ ) v [P ]ν , thus, ιA (σ) = ιB→A (τ → σ)(ιB (τ )) v [N ]ν (ιB (τ ))
and, by monotonicity, [N ]ν (ιB (τ )) v [N ]ν ([P ]ν ) = [N P ]ν . From this we
finally get ιA (σ) v [N P ]ν .
– In case M = λx.N , then by Theorem 8(3) we have that A = B V → C and, for
n
all j ∈ [1; n], there are σj ∈ Ξ ω (B), σj0 ∈ Ξ ω (C) such that σ = j=1 σj → σj0
and Γ, x : σj `∧ N : σj . Thus, by induction hypothesis, we get ιC (σj0 ) v
ω 0

[N ]ν[x:=ιB (σj )] . From Lemma 5(ii) it ensues that ιA (σ) v [M ]ν .


(2 ⇒ 1) It suffices to establish by induction that [M ]ν = ιA (σ), for all ν such that
ν(xi ) = ιAi (τi ), entails Γ `ω
∧ M : σ. Indeed, if τ is such that ιA (τ ) v [M ]ν then
by Lemma 7 and σ ≤ τ we obtain, using the subsumption rule, that Γ `ω ∧ M : τ.

– If M = xi , then [xi ]ν = ιAi (τi ) = ιA (σ) and σ ' τi . Thus Γ `ω∧ xi : σ.


– If M = N P , then there is B such that ∆ ` N : B → A and ∆ ` P : B.
By Corollary 2, there are τ ∈ Ξ ω (B → A), ρ ∈ Ξ ω (B) such that [N ]ν =
ιB→A (τ ) and [P ]ν = ιB (ρ). The induction hypothesis implies that Γ `ω ∧ N :
τ and Γ `ω ∧ P : ρ are derivable. By hypothesis we know that [M ] ν = ι A (σ).
From Lemma 5(ii), since ιA (σ) = [M ]ν = [N ]ν ([P ]ν ) = ιB→A (τ )(ιB (ρ)), we
have ιB (ρ) 7→ ιA (σ) v ιB→A (τ ) and thus, by Lemma 7, τ ≤ ρ → σ. Hence
Γ `ω ω
∧ N : ρ → σ is derivable, which implies that Γ `∧ M : σ is derivable.
10 Salvati, Manzonetto, Gehrke, Barendregt

– If M = λx.N , then A = B → C. By Corollary 2 we can choose, for every


g ∈ SB , σg ∈ Ξ ω (B) such that ιB (σg ) = g and τg ∈ Ξ ω (C) such that
ιC (τg ) = [N ]ν[x:=g] = [M ]ν (g). By the induction hypothesis, for every g ∈
ω
S
VB , we have Γ, x : σg `∧ N : τg . Therefore,
V Γ `ω
∧ M :F σg → τg and Γ `ω ∧ M :
g∈S
FB σ g → τg . By definition ι A ( g∈SB σ g → τg ) = g∈Sb ι B (σ g ) →
7 ι C (τg )
= g∈Sb g 7→ [M ]ν (g) which is equal, by Lemma 6, to [M ]ν . t
u

4 Inhabitation Reduces to Definability


We now prove that the undecidability of the Definability Problem follows from
the undecidability of the inhabitation problem (for game types) in CDV. A
preliminary version of this result was announced in the invited paper [8].
The proof we present here is obtained by linking via a suitable logical relation
I the continuous model S built in the previous section and F = {FA }A∈T0 =
Full(P(X)), where X ⊆f A. Let I be the logical relation between S and F
generated by taking the identity at ground level (indeed S0 = F0 = P(X)).
Lemma 8. I is a logical retract, i.e. at every level A ∈ T0 we have ∀f1 , f2 ∈
SA , IA (f1 ) ∩ IA (f2 ) 6= ∅ iff f1 = f2 . Equivalently, both next statements hold:
(i) for all f ∈ SA there is g ∈ FA such that f IA g,
(ii) for all f, f 0 ∈ SA , g ∈ FA if f IA g and f 0 IA g then f = f 0 .
Proof. We prove the main statement by induction on A, then both items follow.
The base case A = 0 is trivial, so we consider the case A = B → C.
(⇒) By definition of IA (f1 ), IA (f2 ) we have:
IA (f1 ) ∩ IA (f2 ) = {h | ∀g ∈ SB , ∀k ∈ IB (g), h(k) ∈ IC (f1 (g)) ∩ IC (f2 (g))}.
Now, IA (f1 ) ∩ IA (f2 ) 6= ∅ entails IC (f1 (g)) ∩ IC (f2 (g)) 6= ∅ for all g ∈ SB .
By induction, this holds when f1 (g) = f2 (g) for all g ∈ SB , i.e. when f1 = f2 .
(⇐) If f1 = f2 then IA (f1 ) = {h | ∀g ∈ SB , ∀k ∈ IB (g), h(k) ∈ IC (f1 (g))}.
To prove IA (f1 ) 6= ∅, we build a relation h ⊆ FB ×FC that is actually functional
and belongs to it. Fix any d ∈ FC and, for every g ∈ SB , an element rg ∈
IC (f1 (g)) which exists by induction hypothesis. Define h asSthe smallest relation
such that (k, rg ) ∈ h if k ∈ IB (g), and (k, d) ∈ h if k ∈ / g∈SB IB (g). As, by
induction hypothesis, IB (g1 ) and IB (g2 ) are disjoint for all g1 6= g2 then h is
functional. By construction, h ∈ IC (f1 (g)). t
u
As a consequence we get, for every subset S ⊆ SA , that IA− (IA (S)) = S.
Given f ∈ SA we write f ↑ for its upward closure in SA : {f 0 ∈ SA | f v f 0 }.
Proposition 2. Let σ ∈ Ξ(A). For every normal λ-term M having type A we
F
have `∧ M : σ iff [M ] ∈ IA (ιA (σ) ↑).
Proof. We have the following computable chain of equivalences:
`∧ M : σ ⇐⇒ `ω
∧ M : σ, by Lemma 4,
S
⇐⇒ [M ] ∈ ιA (σ) ↑, by Proposition 1,
F
⇐⇒ [M ] ∈ IA (ιA (σ)↑), by Lemma 1 plus Lemma 8. t
u
Loader and Urzyczyn are Logically Related 11

Theorem 9. The undecidability of the Definability Problem follows by a reduc-


tion from the one of the Inhabitation Problem for game types, Theorem 2(2).

Proof.
S Suppose by contradiction that DP is decidable. We want to decide whether
σ ∈ A∈T0 ,X⊆f A ΞX (A) is inhabited in CDV. By Theorem 3 and Corollary 1 we
can focus on normal simply typed λ-terms. Now we can take the set Y of all
atoms in σ, compute the simple type A such that σ ∈ ΞY (A), and effectively con-
struct the finite set IA (ιA (σ)↑) ⊆ Full(Y ). If DP is decidable, then we can also
decide with finitely many tests whether there is a λ-definable f ∈ IA (ιA (σ)↑).
By Proposition 2 such an f exists if and only if σ is inhabited. This yields a re-
duction of IHP for game types (hence for uniform types, Theorem 6) to DP. t u

5 Definability Reduces to Inhabitation

In this section we prove the converse of Theorem 9, namely that the undecid-
ability of inhabitation follows directly from the undecidability of λ-definability
in the full model F = Full(X) over a fixed set X ⊆f A. The main idea is a simple
embedding of the elements of F into the uniform intersection types.
Also in this proof the continuous model S = Cont(P(X), ⊆) will play a key
role. (Remark that the ground set of S is still P(X), while F is now over X.)
We start by defining an injection ϕA : FA → SA by induction on A:

– if A = 0, then ϕA (f ) = {f }, F
– if A = B → C, then ϕA (f ) = g∈FB ϕB (g) 7→ ϕC (f (g)).

Now, given f in FA we define an intersection type ξf in Ξ(A) as follows:

– if A = 0, then ξf = f , V
– if A = B → C, then ξf = g∈FB ξg → ξf (g) .

Lemma 9. For every f in FA , we have ϕA (f ) = ιA (ξf ).

We consider the logical relation J between the full model F and the con-
tinuous model S generated by J0 = {(f, F ) | f ∈ F ⊆ F0 }.

Lemma 10. For every f ∈ FA and g ∈ SA we have f JA g iff ϕA (f ) v g.

Proof. By induction on A, the case A = 0 being obvious. Let A = B → C.


(⇒) Suppose f JA g. We want to prove that ϕA (f ) v g. That is, for all
h ∈ SB , we have
F ϕA (f )(h) v g(h). Let h ∈ SB , then by definition of ϕA , we have
ϕA (f )(h) = {ϕC (f (k)) | ϕB (k) v h, k ∈ FB }. But ϕB (k) v h implies k JB h
by induction hypothesis, which implies that f (k) JC g(h) since f JA g. Now
using the induction hypothesis for C, we get ϕC (f (k)) v g(h). That is, ϕA (f )(h)
is a supremum of things all of which are below g(h), thus ϕA (f )(h) v g(h).
(⇐) Suppose ϕA (f ) v g. Let h ∈ FB and h0 ∈ SB with h JB h0 , that is, by
the induction hypothesis, with ϕB (h) v h0 . We want to show that f (h) JC g(h0 )
or, equivalently, again by the induction hypothesis, that ϕC (f (h)) v g(h0 ). Now,
12 Salvati, Manzonetto, Gehrke, Barendregt

by definition, ϕA (f )(h0 ) = {ϕC (f (k)) | ϕB (k) v h0 , k ∈ FB }, and by assump-


F
tion h ∈ FB and ϕB (h) v h0 , so ϕC (f (h)) v ϕA (f )(h0 ). On the other hand,
ϕA (f ) v g as functions on SA and h0 ∈ SB , so ϕA (f )(h0 ) v g(h0 ). By transitiv-
ity of the order we obtain ϕC (f (h)) v g(h0 ) as required. t
u
F
Proposition 3. Given f in FA , we have [M ] = f iff `∧ M : ξf .

Proof. We have the following computable chain of equivalences:


F S
[M ] = f ⇐⇒ f JA [M ] , by Lemma 1,
S
⇐⇒ ϕ(f ) v [M ] , by Lemma 10,
S
⇐⇒ ιA (ξf ) v [M ] , by Lemma 9,
⇐⇒ `∧ M : ξf , by Proposition 1. t
u

Therefore f is definable iff ξf is inhabited. This yields a reduction of the


Definability Problem (resp. DPn ) to the Inhabitation Problem (resp. IHPn ).

Theorem 10. 1. The undecidability of IHPn for all n > 1 follows by a reduc-
tion from the undecidability of DPn for all n > 1, Theorem 1(2).
2. The undecidability of the Inhabitation Problem follows by a reduction from
the undecidability of the Definability Problem, Theorem 1(1).

Acknowledgements. We are grateful to Antonio Bucciarelli for interesting dis-


cussions. This work is partly supported by NWO Project 612.000.936 CALMOC, ANR
2010 BLAN 0202 01 FREC and ANR 2010 BLAN 0202 02 FREC.

References
1. S. Abramsky. Domain theory in logical form. In Symposium on Logic and Computer
Science (LICS’87), IEEE Computer Science Press, pp. 47-53, 1987.
2. R. Amadio and P.-L. Curien. Domains and lambda-calculi. Cambridge Tracts in
Theoretical Computer Science, no. 46, Cambridge University Press, 1998.
3. H.P. Barendregt, W. Dekkers and R. Statman. Lambda calculus with types. To ap-
pear. Draft available at http://www.cs.ru.nl/∼henk/book.pdf.
4. M. Coppo, M. Dezani-Ciancaglini, and B. Venneri. Functional characters of solvable
terms. Mathematical Logic Quarterly, Volume 27, Issue 2-6, pages 45-58, 1981.
5. T. Joly. Encoding of the halting problem into the monster type & applications. Typed
Lambda Calculi and Applications (TLCA’03), LNCS, vol. 2701, pp. 153-166, 2003.
6. R. Loader. The undecidability of lambda definability. In Logic, Meaning and Com-
putation: Essays in Memory of Alonzo Church, 331-342, 2001.
7. G. Plotkin. Lambda definability and logical relations. Memorandum SAI-RM-4,
School of Artificial Intelligence, University of Edinburgh, 1973.
8. S. Salvati. Recognizability in the simply typed lambda-calculus. Logic, Language,
Information and Computation (WoLLIC’09), LNCS, vol. 5514, pp. 48-60, 2009.
9. R. Statman. Completeness, invariance and λ-definability. The Journal of Symbolic
Logic, vol. 47, no. 1, pp. 17-26, 1982.
10. P. Urzyczyn. The emptiness problem for intersection types. The Journal of Sym-
bolic Logic, vol. 64, no. 3, pp. 1195-1215, 1999.

You might also like