HAL Id: hal-00660832
https://hal.archives-ouvertes.fr/hal-00660832
Preprint submitted on 17 Jan 2012
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, estdestiné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.
An alternate proof of Statman’s finite completeness theorem
B. Srivathsan, Igor Walukiewicz
To cite this version:
B. Srivathsan, Igor Walukiewicz. An alternate proof of Statman’s finite completeness theorem. 2010.
�hal-00660832�
An alternate proof of Statman’s finite completeness theorem
B. Srivathsan, Igor Walukiewicz
LaBRI, Universit´e de Bordeaux, 351 cours de la lib´eration, 33400 Talence, France
Abstract
Statman’s finite completeness theoremsays that for every pair of non-equivalent terms of simply-typed lamda-calculus there is a model that separates them. A direct method of constructing this model is provided using a simple induction on the B¨ohm tree of the term.
Keywords: Simply typed lambda calculus, formal semantics, theory of computation
1. Introduction
Statman’s finite completeness theorem [5, 6] shows that standard models are strong enough to separate terms, uptoβηreductions. It states that given a simply typed lambda termM, there exists a finitestandard model [1] such that for every termN that is notβη-equivalent toM there is a variable assignement separating the two terms: making their values in the model different. At the time of publication of this work, a crucial corollary of this theorem, again proved in [5, 6], was that theλ-definability conjecture implies the higher order matching conjecture [5, 6, 7]. However,λ-definability was shown to be undecidable later by Loader in [2].
The first proof of this theorem appeared in [5]. It was explained in more detail in [6] since the previous proof was considered “not accessible to readers not familiar with this subject” [6]. The proof proceeds by definining a suitable syntactic equivalence over the lambda terms. The required model is then the set of lambda terms quotient with respect to this equivalence.
Salvati in [4] proves thatsingleton sets, that is sets of the form{N|N =βη M} can be characterized by suitableintersection types. In another paper [3], Salvati gives a notion of recognizability of languages of lambda terms based on these intersection types. Additionally, another definition of recognizability is also provided using finite standard models in the same work, and it is shown to be equivalent to the recognizability in terms of intersection types. This provides an alternate proof to Statman’s finite completeness theorem.
In this paper, we give yet another proof of this theorem. Our proof carries a semantic flavour, constructing the required model for a termM step-by-step,
by performing an induction on the B¨ohm tree of the η-long β normal form of M. The B¨ohm trees are the only syntactic tools used. This proof is very direct, especially in comparison to the existing proofs mentioned above. The proof also gives a slightly stronger result: for every term M there is a model and a valuation such that ifN evaluates to the same value asM thenM =βη N.
In Section 2, we give the necessary preliminaries. In Section 3, we define the notion of anextended model, and explain the relation between the elements of the initial model and the extended model. Section 4 contains our proof of the finite completeness theorem.
2. Simply typed λ-calculus
The set oftypes T is constructed from a uniquebasic type 0 using a binary operator →. Thus 0 is the unique basic type, and if α, β are types, then α→ β is also a type. The order of a type is defined by: order(0) = 1, and order(α→β) =max(1 +order(α), order(β)).
The set of simply typed λ terms is defined inductively as follows. For each typeα, there is a countable set of variables xα, yα, . . . which are also terms of typeα. IfM is a term of typeβ and xis a variable of typeα, thenλxα.M is a term of typeα→β. Such a term is called aλ-abstraction. IfM is a term of typeα→β andN is a term of typeαthenM N is a term of typeβ. Terms of this kind are calledapplications.
Astandard finite model Dis a family of finite sets (Dα)α∈T indexed by the set of types. Dis determined byD0 which is a finite set of elements of type 0.
For typesα,β, the setDα→β is the set of functions fromDαtoDβ.
Avariable assignmentis a function assigning to every variablexαan element ofDα. Ifdis an element ofDαandxαis a variable of typeα,v[d/xα] denotes the variable assignment which assignsdtoxαand is identical tov otherwise.
Theinterpretation of a simply typedλ-termM in the modelDand variable assignmentvis defined inductively:
• [[xα]]vD=v(xα)
• [[M N]]vD = [[M]]vD[[N]]vD
• [[λxα.M]]vD is a function mappingd∈Dαto [[M]]v[d/x
α] D
We recall the two types of reduction over simply typedλterms.
β-reduction (λx.M)N→βM[N/x]
η-reduction (λx.M x)→ηM, providedxis not free inM.
A lambda term in long normal form is of the shape λ~x.zM1. . . Mk where M1, . . . , Mk are in long normal form,z is a variable, the termzM1. . . Mk is of type 0 and the sequenceλ~xmight be empty.
For a lambda termM in long normal form, its B¨ohm tree,BT(M) is defined inductively as follows. IfM =λ~x.zM1. . . Mk, withzbeing a variable, then the root ofBT(M) is labeledλ~x.zand it hasBT(M1) toBT(Mk) as its children.
2
M is said to beuniquely determinedin a modelDwith a variable assignment vif for all lambda terms N, [[N]]vD= [[M]]vD iffN =βη M.
In the following sections, we prove Statman’s finite completeness theorem in a slighlty stronger form:
Theorem 1 For everyλ-termM, there exists a finite model Dand a variable assignmentv such that M is uniquely determined in Dandv.
To prove this theorem, we consider a lambda term in long normal form.
We construct a model in which all its subterms are uniquely determined. An additional element is added and the interpretations then altered to make the lambda term interpret uniquely to this newly added element.
3. Extended model
Consider a lambda term M of type 0. Let D be a standard finite model andv a variable assignment, so that [[M]]vD =e, with e∈D0. In general, there exist many lambda terms that interpret to e. Our objective is to add a new element toD0and makeM interpret to this new element. In addition, the other lambda terms of type 0 should interpret as before. This would ensure thatM interprets uniquely to this new element. Intuitively, the other lambda terms should not “notice” a difference betweene and this new element. We call this new elementeclone. Given a model D= (Dα)α∈T and an elemente∈D0, the extended model De= (Deα)α∈T is the model determined byD0e=D0] {eclone}.
As a consequence of adding this extra element, many new higher order functions are generated. Hence we force theλ-terms to interpret to those functions that behave identically oneclone and one. In the subsequent sections, we study this newextended model and furnish a variable assignment so thatM gets uniquely interpreted toeclone.
3.1. Relating the models
Consider the functionf ∈D0→0 shown in Figure 1. The same figure shows some functions in the extended modelDe. The functionf10 acts the same way as f on all the common elements. However,f10(eclone) is not equal tof10(e) which is undesirable. Hence we would like to ignore such a function. The functionf20 on the other hand acts the same way asf on all the common elements and in additionf20(eclone) is equal tof20(e). We consider f20 as the representative off in De. An interesting case is given byf30 that instead of mapping the element toemaps it toeclone. By the intuition thatecloneisequivalent toe, we wish to say thatf30 isequivalent to f20.
We define two notions to relate the elements of the extended model De to elements of the original modelD:
• an injection functioninαα→Deαthat for every elementf ∈Dα gives its representative f0∈Deα,
D0 D0
e e
f
De0 De0 e
eclone
e eclone f10
D0e D0e e
eclone
e eclone f20
De0 De0
e eclone
e eclone f30
Figure 1: Higher order functions in the extended modelDe
• an equivalence relation ↔α over Dαe that groups e and eclone at type 0 and propagates this basic equivalence to higher order functions.
In general, we would like to visualize each setDαe as shown in Figure 2.
Before formally defining these notions we designate anull element for every type.
Definition 2 Thenull element∆0is any arbitrary element ofDe0different from eclone. For a typeα→β, element ∆α→βis the constant function mapping every element to ∆β.
The definitions of inα and ↔α are mutually dependent. For an element d0 in Deα, let [d0] denote the equivalence class of d0 with respect to ↔α. For a higher order type α → β and for a function f ∈ Dα→β, inα→β(f) maps every element d0 in [inα(d)] to inβ(f(d)). We say that a functionf0 ∈Dα→βe simulatesa functionf ∈Dα→β, written assim(f0, f) iff0maps every element in an equivalence class [inα(d)] to an element in the equivalence class [inβ(f(d))].
These notions are pictorially represented in Figure 3. The equivalence relation
↔α→βgroups functions ofDethatsimulatethe same function ofD. The formal definitions follow.
Definition 3 inα,simα,↔α
4
Dα Dαe
d1
d2 d3
[inα(d1)]
[inα(d2)]
[inα(d3)]
equivalence class representing elements that can be ignored
Figure 2: Visualizing a set in the extended model
• in0,sim0, ↔0
– in0:D0→De0 is the identity.
– sim0(d, d) for every elementd∈D0.
– ↔0 is the smallest equivalence containinge↔0eclone.
• inα→β
For an elementf ∈Dα→β, inα→β(f) is a functionf0 ∈Dα→βe such that for all elementsd0∈Dαe,
f0(d0) =
(inβ(f(d)) ifd0∈[inα(d)]
∆β otherwise
• simα→β
Forf ∈Dα→β, f0∈Dα→βe , we sayf0 simulates f, written as sim(f0, f), if for alld∈Dα, for alld0∈[inα(d)]: f0(d0)↔β inβ(f(d)).
• ↔α→β
Forf0, g0∈Dα→βe ,f0↔α→βg0 if for allh∈Dα→β, sim(f0, h)⇔sim(g0, h).
Remark 4 Subsequently, we drop the type subscript ininα, simαand↔αsince it is the same as the type of the elements associated.
Lemma 5 For everyd∈ D,in(d)simulates d.
Proof
The lemma is direct for type 0. For a higher order functionf ∈Dα→β, it follows
from the definitions.
Lemma 6 Ford, d1, d2∈Dα andd0 ∈Dαe, 1. sim(d0, d1) andsim(d0, d2) impliesd1=d2,
Dα Dβ f
d f(d)
Deα Deβ inα→β(f)
[inα(d)]n
inβ(f(d))
Deα Deβ inα→β(f),f0
Figure 3:f,inα→β(f),sim(f0, f)
2. sim(d0, d)⇔d0 ↔in(d), 3. d16=d2⇒in(d1)=in(d1).
Proof
The proof proceeds by induction on the types. The lemma is clear for type 0.
We prove the lemma for a higher order typeα→β. Considerf, f1, f2∈Dα→β andf0∈Dα→βe .
1. Supposesim(f0, f1) and sim(f0, f2). Taked ∈Dα and d0 ∈ [in(d)]. By definition of sim, f0(d0) ↔ in(f1(d)) and f0(d0) ↔ in(f2(d)). Hence in(f1(d)) ↔ in(f2(d)) and by 3), f1(d) = f2(d). Since d is arbitrary, f1=f2.
2. Supposesim(f0, f). By 1) ifsim(f0, h) thenh=f. Since from Lemma 5, sim(in(f), f), the same holds forin(f). Therefore, for allh,sim(f0, h)⇔ sim(in(f), h) and hence by definition of↔,f0↔in(f).
Suppose f0 ↔ in(f). By Lemma 5, sim(in(f), f) and by definition of sim,sim(f0, f).
3. Suppose f1 6= f2. From Lemma 5, sim(in(f1), f1). Hence by 1), not sim(in(f1), f2). But sincesim(in(f2), f2), we getin(f1)=in(f2).
3.2. Interpreting the lambda terms in the extended model
To interpret the lambda terms in De, we need to define the variable as- signmentve that interprets the variables. We intend to pick one from a set of variable assignments thatsimulate v.
6
Definition 7 A variable assignmentv0 onDe simulates a variable assignment vonDif for all variablesx: sim(v0(x), v(x)).
Lemma 8 Ifv0 simulates v then for every lambda termM: sim(JMK
v0 De,JMK
v D) Proof
We proceed by induction on the structure of the lambda term.
1. For variables, the lemma follows from the hypothesis.
2. Consider an application M N, with M of type α → β and N of type α. By induction, sim([[N]]vD0e,[[N]]vD) and hence from 2) of Lemma 6, [[N]]v
0
De ↔ in([[N]]vD). Also by induction, sim([[M]]v
0
De,[[M]]vD) and hence from definition, [[M]]vD0e([[N]]vD0e) ↔ in([[M]]vD([[N]]vD)). Therefore by 2) of Lemma 6,sim([[M N]]vD0e,[[M N]]vD).
3. Consider a lambda abstraction λxα.M. Take d ∈ Dα and d0 ∈ [in(d)].
Since sim(v0, v), we have sim(v0[d0/xα], v[d/xα]) and hence by induc- tionsim([[M]]vD0e[d0/xα],[[M]]v[d/xD α]). From 2) of Lemma 6, [[M]]vD0[de0/xα] ↔ [[M]]v[d/xD α]. This is true for alld∈Dα. Hence, by definitionsim([[λxα.M]]vD0e, [[λxα.M]]vD).
Corollary 9 If v0 simulates v, then every term uniquely determined in (D, v) is uniquely determined in (De, v0).
Proof
LetM be uniquely determined in (D, v) but not in (De, v0). Therefore, there existsN 6=βη M such that [[N]]vD0e = [[M]]vD0e. From Lemma 8, this would mean that sim([[M]]vD0e,[[M]]vD) and sim([[M]]vD0e,[[N]]vD). Hence by 1) of Lemma 6,
[[M]]vD = [[N]]vD. A contradiction.
4. Proof of the theorem
The proof proceeds by an induction on the size of the B¨ohm tree BT(M) of the lambda term M. Let BT(M) contain m nodes. Consider an ordering s1<· · ·< smof the nodes ofBT(M) that satisfies the condition that if a node si is a child ofsj, thensi < sj. Assume thatDk is a model andvk a variable assignment such that all the lambda terms rooted in the nodessiwithi≤kare uniquely determined in (Dk, vk). We then construct (Dk+1, vk+1) where all the lambda terms rooted in the nodes si with i ≤k+ 1 are uniquely determined.
ConsequentlyM gets uniquely determined in (Dm, vm).
Base case
The base case refers to (D1, v1) which uniquely determines a leaf ofBT(M).
A leaf is variablez of type 0. Starting with the trivial modelD0 which has a singleton{⊥}in its basic set and the trivial variable assignmentv0, we construct the extended modelD0eby adding a new element⊥clone to the atomic set. The new variable assignmentv0eassignszto⊥clone and the rest of the variables are maintained with the same interpretation. Clearly,z is uniquely determined in (De0, ve0). SetD1as D0eandv1 asv0e.
Induction case
Let the lambda term rooted atskbeλ~x.yM1. . . Mnand let [[yM1. . . Mn]]vDk
k = e. For notational simplicity let D=Dk and v=vk. By induction hypothesis, M1, . . . , Mn are uniquely determined in (D, v).
Construct the extended model Deby adding an elementeclone to the basic setD0 ofD. Consider the variable assignmentvedefined below.
• ve(x) =in(v(x)), ifx6=y.
• For the variabley,
ve(y)(d01, . . . , d0n) =
eclone ifd0i∈[in(JMiK
v D)], fori∈ {1, . . . , n}
in(v(y))(d01, . . . , d0n) otherwise Sinceeclone↔e,vesimulates v. Hence we infer the following.
1. From Lemma 8, for every lambda term N, [[N]]vDee simulates [[N]]vD, and hence from Lemma 6
[[N]]vDee ↔in([[N]]vD) 2. [[yM1. . . Mn]]vDee =eclone.
We now prove that [[yM1. . . Mn]]vDee is uniquely interpreted to eclone. Let zN1. . . Np be a lambda term such that [[zN1. . . Np]]vDee = eclone. If z 6= y, thenve(z) =in(v(z)). However, observe that there does not exist an element d∈D0such that in(d) =eclone. Also, note that ∆06=eclone. Hence by defini- tion,in(v(z))(d01, . . . , d0p) cannot be equal to eclone for any values of d01, . . . , d0p implyingz=y.
Sincez=y, pequals n. We show thatNi =Mi for alli. Now, if [[Ni]]vDe
e ∈/ [in([[Mi]]vD)] for some i, by the same reasoning as above, [[zN1. . . Np]]vDee cannot be equal to eclone. Therefore, [[Ni]]vDe
e ↔ [[Mi]]vD for all i. In addition, from Lemma 8, we know that [[Ni]]vDe
e ↔ [[Ni]]vD too. Hence from the third part of Lemma 6, [[Ni]]vD = [[Mi]]vD. From the assumption that each Mi is uniquely determined in (D, v), one can deduce that Ni = Mi for i ∈ {1, . . . , n}. We hence infer thatyM1. . . Mk is uniquely determined in (De, ve).
8
Note that this impliesλ~x.yM1. . . Mk is uniquely determined too in (De, ve) since, for another lambda termλ~x.N, if [[λ~x.N]]vDee = [[λ~x.yM1. . . Mk]]vDee, then N with~xsubstituted by values from veand yM1. . . Mk with~xsubstituted by values fromve interpret to the same element ofDe, contradicting the fact that yM1. . . Mk is uniquely determined with the variable assignmentve.
Set Dk+1 = De and vk+1 = ve. Therefore, from the above argument and from Corollary 9, the lambda terms rooted at nodes si with i ≤ k+ 1 are uniquely determined in (Dk+1, vk+1), thus proving the inductive step.
[1] L. Henkin. Completeness in the theory of types. Journal of symbolic logic, 15(2):81–91, 1950.
[2] R. Loader. The undecidability of-definability. Logic, meaning, and compu- tation: essays in memory of Alonzo Church, page 331, 2001.
[3] S. Salvati. Recognizability in the simply typed lambda-calculus. Logic, Language, Information and Computation, pages 48–60, 2009.
[4] S. Salvati. On the membership problem for non-linear Abstract Categorial Grammars. Journal of Logic, Language and Information, 19(2):163–183, 2010.
[5] R. Statman. Completeness, invariance andλ-definability. Journal of Sym- bolic Logic, 47(1):17–26, 1982.
[6] R. Statman and G. Dowek. On Statman’s Finite Completeness Theorem.
Carnegie Mellon University, School of Computer Science, 1992.
[7] DA Wolfram. The clausal theory of types. PhD thesis, 1989.