PUBLICATIONS DE L’INSTITUT MATHÉMATIQUE Nouvelle série, tome 82(96) (2007), 85–91 DOI 102298/PIM0796085G

INTERSECTION TYPES FOR λ^{Gtz}-CALCULUS

Silvia Ghilezan and Jelena Ivetić

Abstract. We introduce an intersection type assignment system for Espirito-Santo’s λ^{Gtz}-calculus, a term calculus embodying the Curry–Howard correspondence for the intuitionistic sequent calculus. We investigate basic properties of this intersection type system. Our main result is Subject reduction property.

1. Introduction

Recently, several extensions of λ-calculus were developed in order to extend the Curry-Howard correspondence to intuitionistic sequent calculus. Herbelin [9] proposed the first “sequent” λ-calculus, named λ̄, for which bijective correspondence between normal simply typed terms and cut-free proofs of the appropriate restriction of the Gentzen’s LJ was obtained. However, this bijection failed to extend to sequent calculus with cuts. After that, intuitionistic sequent λ-calculi were proposed by Barendregt and Ghilezan [1], Dyckhoff and Pinto [4], Espirito-Santo and Pinto [5], among others. One of the most recently proposed systems is λ^{Gtz}- calculus, developed by Espirito-Santo [6], whose simply typed version corresponds to the sequent calculus for intuitionistic implicational logic.

Intersection type assignment systems were introduced by Coppo and Dezani [2]. These systems characterize exactly the strongly normalizing λ-terms (proved in Pottinger [13], Ghilezan [7], Krivine [10]) and that property couldn’t be obtained with basic simply typed λ-calculus. Since then, intersection types were introduced in several extensions of λ-calculus, like in Lengrand’s et al. [11] calculus with explicit substitutions, Matthes’s [12] calculus with generalized applications and Dougherty’s et al. [3] calculus for classical logic, each time in order to characterize strong normalization.

In this paper, we introduce intersection type assignment to slightly modified Espirito-Santo’s intuitionistic sequent λ^{Gtz}-calculus. The paper is organized as follows. In Section 2 untyped λ^{Gtz}-calculus is introduced. In Section 3 we propose a new, intersection type assignment system named λ^{Gtz}∩ and investigate some basic properties of this system. In Section 4 Subject reduction property is proved and Section 5 proposes some future work toward characterization of strong normalization in this calculus, which is our main goal.

2000 Mathematics Subject Classification: Primary 03B40; Secondary 68N18.

2. Syntax of λ^{Gtz}

The abstract syntax of λ^{Gtz} is given by:

(Terms)  t, u, v ::= x | λx.t | tk
(Contexts)  k ::= [x]t | u :: k

We distinguish terms, which could be variables, abstraction or application (also called cut) and contexts, which are either a selection or linear left introduction (usually called cons). The intuition is that a context is actually a list of arguments, since cut is of the form tk, i.e., a function applied to list. A list is made out of a term by the selection operator, and new elements are added by cons. An empty list is of the form [x]x (abbreviated with [ ]).

In λx.t and [x]t, t is the scope of the binders λx and [x], respectively. In order to save parentheses, we let the scope of binders extend to the right as much as possible.

Definition 2.1. The set of free variables of a term or a context, Fv( ), is defined with:

Fv(x) = {x}
Fv(λx.t) = Fv(t) ∖ {x}
Fv(tk) = Fv(t) ∪ Fv(k)
Fv([x]t) = Fv(t) ∖ {x}
Fv(t :: k) = Fv(t) ∪ Fv(k)

Remark 2.1. We can see that free variables in λ^{Gtz} calculus are those that are not bound neither by abstraction nor by selection operator and Barendregt’s convention should be applied in both cases.

Reduction rules of λ^{Gtz} are as follows:

(β) (λx.t)(u :: k) → t⟨x := u⟩k
(π)  (tk)k′ → t(k@k′)
(σ)  t[x]v → v⟨x := t⟩
(μ)  [x]xk → k, if x ∉ k

where

• x⟨x := u⟩ = u; y⟨x := u⟩ = y;
• (λy.t)⟨x := u⟩ = λy.t⟨x := u⟩;
• (tk)⟨x := u⟩ = t⟨x := u⟩k⟨x := u⟩;
• ([y]v)⟨x := u⟩ = [y]v⟨x := u⟩;
• (v :: k)⟨x := u⟩ = v⟨x := u⟩ :: k⟨x := u⟩;
• (u :: k)@k′ = u :: (k@k′);
• ([x]v)@k′ = [x]vk′.

INTERSECTION TYPES FOR λ^{Gtz}-CALCULUS 87

Normal forms of λ^{Gtz} are:

(Terms)  t_{nf}, u_{nf}, v_{nf} = x_{nf} | λx.t_{nf} | x(u_{nf} :: k_{nf})
(Contexts)  k_{nf} = [x]t_{nf} | t_{nf} :: k_{nf}

If application is seen as cut, then reductions aim at eliminating cuts, i.e., only trivial cuts are allowed in normal forms.

3. Intersection types for λ^{Gtz}

Definition 3.1. The set of types Types, ranged over by A, B, C, …, A_{1}, …, is inductively defined by: A, B ::= p | A → B | A ∩ B, where p ranges over a denumerable set of type atoms.

Definition 3.2. (i) A basic type assignment is an expression of the form x : A, where x is a term variable and A is a type.

(ii) A basis Γ is a set of basic type assignments, where all term variables are different.

(iii) There are two kinds of type assignment: Γ ⊢ t : A for typing terms; Γ; B ⊢ k : A for typing contexts.

The special place between the symbols ; and ⊢ is called the stoup. It was proposed by Girard [8]. Stoup contains a selected formula, the one with which we continue computation.

The following typing system for λ^{Gtz} is named λ^{Gtz}∩.

Γ, x : ⋂ A_{i} ⊢ x : A_{i} i ⩾ 1 (Ax)
{Γ, x : A ⊢ t : B \atop Γ ⊢ λx.t : A → B} (→_{R})  \begin{matrix}Γ ⊢ u : A_{i} i = 1, …, n & Γ; B ⊢ k : C \\ Γ; ⋂ A_{i} → B ⊢ u :: k : C \end{matrix} (→_{L})
\begin{matrix}Γ ⊢ t : A & Γ; A ⊢ k : B \\ Γ ⊢ tk : B \end{matrix} (Cut)  {Γ, x : A ⊢ v : B \atop Γ; A ⊢ [x]v : B} (Sel)

Proposition 3.1 (Admissible rule).

(i) If Γ, x : A ⊢ t : C, then Γ, x : A ∩ B ⊢ t : C. (ii) If Γ, x : A; D ⊢ k : C, then Γ, x : A ∩ B; D ⊢ k : C.

Proof. By mutual induction on the structure of t and k. □

Proposition 3.2 (Basis expansion).

(i) Γ ⊢ t : A ⇔ Γ, x : B ⊢ t : A and x ∉ Fv(t). (ii) Γ; C ⊢ k : A ⇔ Γ, x : B; C ⊢ k : A and x ∉ Fv(k).

Definition 3.3.

Γ_{1} ∩ Γ_{2} = {x : A|x : A ∈ Γ_{1} & x ∉ Γ_{2}}
∪ {x : A|x : A ∈ Γ_{2} & x ∉ Γ_{1}}
∪ {x : A ∩ B|x : A ∈ Γ_{1} & x : B ∈ Γ_{2}}.

Proposition 3.3 (Bases intersection). (i) Γ_{1} ⊢ t : A ⇒ Γ_{1} ∩ Γ_{2} ⊢ t : A. (ii) Γ_{1}; B ⊢ k : A ⇒ Γ_{1} ∩ Γ_{2}; B ⊢ k : A.

Proposition 3.4 (Generation Lemma – GL).

(i) Γ ⊢ x : A if and only if x : A ⋂ A_{i} ∈ Γ, i = 1, …, n for some n ⩾ 0. (ii) Γ ⊢ λx.t : A if and only if A ≡ ⋂ B_{i} → C and Γ, x : ⋂ B_{i} ⊢ t : C. (iii) Γ; A ⊢ [x]t : B if and only if Γ, x : A ⊢ t : B. (iv) Γ ⊢ tk : A if and only if there is a type B such that Γ ⊢ t : B and

Γ; B ⊢ k : A.

(v) Γ; T ⊢ t :: k : C if and only if T ≡ ⋂ A_{i} → B, and Γ; B ⊢ k : C and for all i, Γ ⊢ t : A_{i}.

Example 3.1. In λ-calculus with intersection types, the term λx.xx has the type (A∩(A → B)) → B. The corresponding term in λ^{Gtz}-calculus is λx.x(x :: [y]y). Although being a normal form this term is not typeable in the simply typed λ^{Gtz}- calculus. It is typeable in λ^{Gtz}∩ in the following way:

\overline{(Ax)} ; x : A ∩ (A → B) ⊢ x : A → B \overline{(Ax)} ; x : A ∩ (A → B) ⊢ x : A \overline{(Ax)} ; x : A ∩ (A → B), y : B ⊢ y : B ; \overline{(Sel)} ; x : A ∩ (A → B); B ⊢ [y]y : B ; \overline{(→_{L})} ; x : A ∩ (A → B); A → B ⊢ x :: [y]y : B
\overline{(Cut)}
x : A ∩ (A → B) ⊢ x(x :: [y]y) : B
\overline{(→_{R}).}
⊢ λx.x(x :: [y]y) : (A ∩ (A → B)) → B

4. Subject reduction

Now, in order to prove preservation of types under reductions, so called Subject reduction property, we need to examine how meta-operators ⟨ := ⟩ and @ behave under reductions.

Lemma 4.1 (Substitution lemma).

(i) If Γ, x : ⋂ A_{i} ⊢ t : B and Γ ⊢ u : A_{i}, for each i, then Γ ⊢ t⟨x := u⟩ : B. (ii) If Γ, x : ⋂ A_{i}; C ⊢k : B and Γ ⊢ u : A_{i}, for each i, then Γ ⊢k⟨x := u⟩ : B.

Proof. By induction on the structure of a term or a context.

• Basic case. 1. t ≡ x. In this case x⟨x := u⟩ = u. Then Γ, x: ⋂ A_{i} ⊢ x: B, by GL(i), implies that B ≡ A_{i}, for some i, so we are done by the second premise.

2. t ≡ y. In this case y⟨x := u⟩ = y, so from Γ, x : A ⊢ y : B and Proposition 3.2 we have that Γ ⊢ y : B.

• t ≡ λy.t′ From Γ, x : ⋂ A_{i} ⊢ λy.t′ : B and by GL(ii) we get that B ≡ ⋂ C_{j} → D and for some j Γ, x : ⋂ A_{i}, y : C_{j} ⊢ t′ : D. In the case of t′ by IH we get Γ, y : C_{j} ⊢ t′⟨x := u⟩ : D for all i. Since (λy.t′)⟨x := u⟩ = λy.t′⟨x := u⟩, we are done by Proposition 3.1 and →_{R}.

• t ≡ t′k Γ, x : ⋂ A_{i} ⊢ t′k : B , using GL(iv), yields that there exists a type C, for which Γ, x : ⋂ A_{i} ⊢ t′ : C and Γ, x : ⋂ A_{i}; C ⊢ k : B . Using IH for both t′ and k, we get:

{Γ ⊢ t′⟨x := u⟩ : C Γ; C ⊢ k⟨x := u⟩ : B \atop Γ ⊢ t′⟨x := u⟩k⟨x := u⟩ : B,}

what we had to prove, since (t′k)⟨x := u⟩ = t′⟨x := u⟩k⟨x := u⟩.

• k ≡ [y]v Γ, x : ⋂ A_{i}; C ⊢ [y]v : B, by GL(iii), yields Γ, x : ⋂ A_{i}, y : C ⊢ v : B. By IH applied to v, we get:

{Γ, y : C ⊢ v⟨x := u⟩ : B \atop Γ; C ⊢ [y]v⟨x := u⟩ : B,}

and that is what we needed, since ([y]v)⟨x := u⟩ = [y]v⟨x := u⟩.

• k ≡ t :: k′ From Γ, x : ⋂ A_{i}; C ⊢ t :: k′ : B and GL(v) we have that C ≡ ⋂ D_{j} → E, and Γ, x : ⋂ A_{i}; E ⊢ k′ : B and Γ, x : ⋂ A_{i} ⊢ t : D_{j} for each j. By IH applied both to t and k′ we get:

Γ ⊢ t⟨x := u⟩ : D_{j}, ∀j Γ; E ⊢ k′⟨x := u⟩ : B ; Γ; ⋂D_{j} → E ⊢ t⟨x := u⟩ :: k′⟨x := u⟩ : B,

and since (t :: k′)⟨x := u⟩ = t⟨x := u⟩ :: k′⟨x := u⟩, the proof is completed. □

Lemma 4.2 (Append lemma). If Γ; C ⊢ k : B and Γ; B ⊢ k′ : A, then Γ; C ⊢ k@k′ : A.

Proof. By induction on the structure of the context.

• Basic case of the context structure is selection. So, if k ≡ [x]v from Γ; C ⊢ [x]v : B and GL(iii) we have that Γ, x : C ⊢ v : B. Without loss of generality we can suppose that x ∉ Fv(k′) (because if it was free in it, we would have to rename this variable in k where it is bound) and then we can expand the basis to Γ, x : C; B ⊢ k′ : A. Now

{Γ, x : C ⊢ v : B Γ, x : C; B ⊢ k′ : A \atop Γ, x : C ⊢ vk′ : A} ; Γ; C ⊢ [x]vk′ : A.

Since ([x]v)@k′ = [x]vk′, the proof is completed.

• k ≡ v :: k′′ Γ; C ⊢ v :: k′′ : B , by GL(v), yields that C ≡ ⋂ D_{i} → E, Γ ⊢ v : D_{i} and Γ; E ⊢ k′′ : B. By applying IH to k′′ we get:

Γ ⊢ v : ⋂D_{i} Γ; E ⊢ k′′@k′ : A ; Γ; C ⊢ v :: (k′′@k′) : A.

Since (v :: k′′)@k′ = v :: (k′′@k′) the proof is completed. □

We are now able to prove Subject reduction theorem, which claims that the type of a term stays preserved under reduction.

Theorem 4.1 (Subject Reduction). If Γ ⊢ t : A and t → t′, then Γ ⊢ t′ : A.

Proof. We examine three different cases, according to the last applied reduction.

• (β): If Γ ⊢ (λx.t)(u :: k) : A, then we have to show that Γ ⊢ t⟨x := u⟩k : A. From Γ ⊢ (λx.t)(u :: k) : A and GL(iv) we have that there is the type B

such that Γ ⊢ λx.t : B and Γ; B ⊢ u :: k : A. GL(v) implies that B ≡ ⋂ C_{i} → D, Γ ⊢ u : C_{i} and Γ; D ⊢ k : A. On the other hand, from Γ ⊢ λx.t : ⋂ C_{i} → D we have from GL(ii) that Γ, x : ⋂ C_{i} ⊢ t : D. Applying Substitution lemma 4.1, we get that Γ ⊢ t⟨x := u⟩ : D, so we are now done by (Cut) rule.

• (σ): If Γ ⊢ t[x]v : A, it should be shown that Γ ⊢ v⟨x := t⟩ : A.

From Γ ⊢ t[x]v : A and GL(iv) it follows that there exists the type B such that Γ ⊢ t : B and Γ; B ⊢ [x]v : A. Further, by GL(iii) we have that Γ, x : B ⊢ v : A. Now, all assumptions of Lemma 4.1 are accomplished, so by applying it we get Γ ⊢ v⟨x := t⟩ : A.

• (π): If Γ ⊢ (tk)k′ : A, we have to show that Γ ⊢ t(k@k′) : A.

From Γ ⊢ (tk)k′ : A and GL(iv) we have that there is a type B such that Γ ⊢ tk : B and Γ; B ⊢ k′ : A. Further, Γ ⊢ tk : B , by GL(iv), yields that there is the type C such that Γ ⊢ t : C and Γ; C ⊢ k : B. Now from Γ; C ⊢ k : B and Γ; B ⊢ k′ : A, using Lemma 4.2 we get Γ; C ⊢ k@k′ : A, so we may conclude:

{Γ ⊢ t : C Γ; C ⊢ k@k′ : A \atop Γ ⊢ t(k@k′) : A.}  □

The reduction μ is of different nature, since it reduces contexts instead of terms. But it is possible to prove a similar result for this reduction rule.

Proposition 4.1. If Γ; ⋂ B_{i} ⊢ [x]xk : A, then Γ; B_{i} ⊢ k : A, for some i.

Proof. Assume Γ; ⋂ B_{i} ⊢ [x]xk : A. By GL(iv) we have Γ, x : ⋂ B_{i} ⊢ xk : A. Now, by GL(iii), there is a type C such that Γ, x : ⋂ B_{i} ⊢ x : C and Γ; C ⊢ k : A. Since x ∉ k, we are done by (Ax) and Proposition 3.2. □

5. Conclusion

We introduced an intersection type assignment system to an extension of the λ-calculus which corresponds to sequent calculus for intuitionistic implicational logic. For this system, we proved Subject reduction theorem. Our main goal, characterization of strongly normalizing terms via intersection types, is still in the domain of future work, as well as proving the confluence property for the system.

References

[1] H. Barendregt and S. Ghilezan, Lambda terms for natural deduction, sequent calculus and cut elimination, J. Funct. Program. 10:1 (2000), 121–134.

[2] M. Coppo and M. and Dezani-Ciancaglini, A new type-assignment for lambda terms, Arch. Math. Logik 19 (1978), 139–156.

[3] D. Dougherty, S. Ghilezan and P. Lescanne, Characterizing strong normalization in the Curien–Herbelin symmetric lambda calculus: extending the Coppo–Dezani heritage, Theoret. Comput. Sci. (2007), to appear

[4] R. Dyckhoff and L. Pinto, Cut-Elimination and a Permutation-Free Sequent Calculus for Intuitionistic Logic, Stud. Log. 60:1 (1998), 107–118.

[5] J. Espírito Santo and L. Pinto, Permutative Conversions in Intuitionistic Multiary Sequent Calculi with Cuts; in: Procedings of TLCA 2003, Lect. Notes Comput. Sci. 2071, 2003, 286–300.

[6] J. Espírito Santo, Private communication, 2006.

[7] S. Ghilezan, Strong normalization and typability with intersection types, Notre Dame J. Formal Logic 37 (1996), 44–52.

[8] J.-Y. Girard, A New Constructive Logic: Classical Logic, Math. Struct. Comput. Sci. 1:3 (1991), 255–296.

[9] H. Herbelin, A lambda calculus structure isomorphic to Gentzen-style sequent calculus structure; in: Computer Science Logic, CSL 1994, Lect. Notes Comput. Sci. 933, Springer-Verlag, 1995, 61–75.

[10] J. L. Krivine, Lambda-calcul, types et modèles, Masson, Paris, 1990.

[11] S. Lengrand, P. Lescanne, D. Dougherty, M. Dezani-Ciancaglini, and S. van Bakel, Intersection types for explicit substitutions, Inf. Comput. 189:1 (2004), 17–42.

[12] R. Matthes, Characterizing Strongly Normalizing Terms of a Calculus with Generalized Applications via Intersection Types; in: ICALP Satellite Workshops 2000, 339–354.

[13] G. Pottinger, A type assignment for the strongly normalizable λ-terms; in: J. P. Seldin and J. R. Hindley (eds.) To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, Academic Press, London, 1980, pp. 561–577

Fakultet tehnickih nauka Univerzitet u Novom Sadu Trg Dositeja Obradovica 6 21000 Novi Sad Serbia

gsilvia@uns.ns.ac.yu
jelena@imft.ftn.ns.ac.yu