University of Pennsylvania
ScholarlyCommons Technical Reports (CIS)
Department of Computer & Information Science
January 1992
Statman's 1-Section Theorem Jon G. Riecke University of Pennsylvania
Follow this and additional works at: http://repository.upenn.edu/cis_reports Recommended Citation Riecke, Jon G., "Statman's 1-Section Theorem" (1992). Technical Reports (CIS). Paper 378. http://repository.upenn.edu/cis_reports/378
University of Pennsylvania Department of Computer and Information Science Technical Report No.MS-CIS-92-03. This paper is posted at ScholarlyCommons. http://repository.upenn.edu/cis_reports/378 For more information, please contact
[email protected].
Statman's 1-Section Theorem Abstract
Statman's 1-Section Theorem [17] is an important but little-known result in the model theory of the simplytyped λ-calculus. The λ-Section Theorem states a necessary and sufficient condition on models of the simplytyped λ-calculus for determining whether βη-equational reasoning is complete for proving equations that hold in a model. We review the statement of the theorem, give a detailed proof, and discuss its significance. Comments
University of Pennsylvania Department of Computer and Information Science Technical Report No.MSCIS-92-03.
This technical report is available at ScholarlyCommons: http://repository.upenn.edu/cis_reports/378
Statmans's 1-Section Theorem
MS-CIS-92-03 LOGIC & COMPUTATION 46
Jon G. Riecke
University of Pennsylvania School of Engineering and Applied Science Computer and Information Science Department Philadelphia, PA 19104-6389
January 1992
Statman's 1-Section Theorem J o n G. Riecke* D e p a r t m e n t of C o m p u t e r a n d Information Science University of Pennsylvania Philadelphia, PA 19104 J a n u a r y 17, 1992
Abstract Statman's 1-Section Theorem [17] is an important but little-known result in the model theory of the simply-typed A-calculus. The 1-Section Theorem states a necessary and sufficient condition on models of the simply-typed A-calculus for determining whether pq-equational reasoning is complete for proving equations that hold in a model. We review the statement of the theorem, give a detailed proof, and discuss its significance.
1
Introduction
T h e theory of the simply-typed A-calculus forms the foundation of call-by-name functional lan(P) and guages. T h e simply-typed A-calculus comes equipped with an equational theory-the (q) axioms together with the usual rules of equality-and a n independently-characterizable class of models. T h e equations (P) and ( 7 ) are sound for proving facts in models, viz., an equation derivable from the axioms is valid in all models. A more general fact encompassing soundness is completeness: an equation between simply-typed A-terms is provable via Pq-reasoning iff the equation holds in all models. An arbitrary model of the simply-typed A-calculus may, of course, satisfy more equations than those provable from (0)and (7). Here we shall discuss a simple necessary and sufficient criterion for determining whether the equational theory of a single model, or more generally a class of models, is captured completely by Pq-equality. T h e criterion, due t o Richard Statman, is crystallized in the 1-Section Theorem. Part of our purpose here will be t o state the theorem and present a rigorous proof: although it is cited in [17] and follows from results in [16], a complete proof has never appeared in the literature. Statman's criterion may be easily applied t o a host of models, and we will demonstrate its applicability t o show the completeness of ,@reasoning for some of the more familiar models of the simply-typed A-calculus. It is not hard t o find a model that satisfies exactly the equations provable from ( P ) and (q). One can construct such a model B out of Pq-equivalence classes of open terms; the (,b) and axioms are crucial in verifying that B is a model. Note that the non-soundness direction of the completeness theorem above follows as a corollary: if an equation is not provable from ( 0 ) and (q), there is a model, namely B, that denies the equation. But this "term model" has little independent
'(i)
'This research was partially supported by an ONR grant number N00014-88-K-0557, NSF grant number CCR8912778, NRL grant number N00014-91-J-2022, and NOSC grant number 19-920123-31.
Jon G. Riecke
2
interest beyond proving the completeness theorem. Another model, definable without reference to the ( p ) and (7) axioms, is the full set-theoretic model S over N, defined
S L = N ST'" = [ST+ S"] where [ A + B] is the set of all total functions from A t o B. From a mathematical point of view, the model S is important precisely because it contains all the higher-order functions one may encounter in mathematical statements and proofs. Of course, not all the functions in S are definable in the simply-typed A-calculus, since the set of simply-typed A-terms is countable and the set of elements in S is uncountable. For those functions that are definable, Pq-equality is complete: Theorem 1.1 (Friedman [4]) M =p, N iff S
+M =N.
Thus, if we wish to prove a fact about A-definable functions in S , we may substitute pq-reasoning (which is decidable, cf. [I]) for denotational reasoning. S is but one example of a model for which pq-reasoning is complete; standard denotational models of functional languages provide more examples. In denotational models, we usually use posets instead of sets and continuous functions rather than set-theoretic functions. Continuity allows an easy interpretation of recursion present in most programming languages [5].The model N built out of all continuous functions over the base Scott domain NI is a familiar example of a denotational model for the language P C F [9, 151. More formally,
Jv = NT'"
NI
= [NT+, N"]
where NI is the poset of natural numbers ordered discretely with an element Iordered below every element of N, and [NT+, N " ] is the Scott domain of continuous functions from NT to N u ordered pointwise [5].Then Theorem 1.2 (Plotkin [lo]) M =p, N iffni (= M = N .
Classes of models can also be complete for pq-equational reasoning: Theorem 1.3 (Plotkin [8]) M = p , N iff in all models M with finite base type,
M
M =N.
In particular, showing that M = N holds in all models with finite base type can be established by showing that A4 = p , N. The original proofs of Theorems 1.1 and 1.2, and 1.3 proceed quite differently: the proofs of the first two construct logical relations between the term model and the model in question, while the proof of the third relies on certain combinatorial facts about A-terms. In fact, the combinatorial arguments may be adapted to prove Theorems 1.1 and 1.2. (The logical relation argument has important uses in other contexts, cf. [ l l , 121.) The combinatorial argument is essentially captured by Statman's 1-Section Theorem, which states that if a certain algebra can be faithfully embedded in the first-order part of a class of models-in a sense to be made more precise in Section 3-then pq-equational reasoning is complete for proving all equations in the class of models. Section 4 describes a detailed proof of the 1-Section Theorem, showing how the combinatorial structure of the required embedded algebra can be used to deduce completeness.
Statman's ]-Section Theorem
-
Variables A-abstraction
x : a, where i E N
M:v (Ax:. M) : (T -+ v )
where c E C
Constants
cU : a ,
Application
M:(T+u) N:T ( M N) :v
Table 1: Syntactic formation rules of the simply-typed A-calculus.
T h e importance of the 1-Section Theorem lies not in its statement but in its applicability. In Section 5, we show how the 1-Section Theorem can be used t o prove Theorems 1.1, 1.2, and 1.3. We also show how these, and other similar theorems, can be used in reasoning about functional programming languages. Finally, Section 6 concludes the paper with a discussion of some open problems.
2
Review of the simply-typed A-calculus
We first briefly review the syntax, semantics, and equational theory of the simply-typed A-calculus. T h e reader familiar with the simply-typed A-calculus may care t o skim this section in order t o understand the notation we use.
2.1
Syntax
Each term in the simply-typed A-calculus comes with a simple type. Simple types are defined inductively t o be the base type 1, usually taken to be the type of natural numbers, and (r -t v), the type of functions from T t o v, where r and v themselves are types. For readability, we often drop parentheses from types with the understanding t h a t -t associates t o the right, e.g., (L-t (L -t 1)) is abbreviated (1 + i -+ 1). This convention implies that any simple type a can be written uniquely in the form (al--+ a;?-t . . .a, + L ) for some n 2 0. T h e set of simply-typed terms is parameterized by a signature, which is just a set of typed constants. The set of simply-typed terms over the signature C, together with their types, is defined in Table 1. We adopt many of the standard notational conventions of the A-calculus from [I]. For instance, the usual definitions of free and bound variables are used and F V ( M ) denotes the set of free variables of M. Terms are identified up t o renaming of bound variables, and are denoted by the letters M , N , P, Q ,S, and T. Parentheses may be dropped from applications under the assumption that applica.tion a.ssociates t o the left, i.e., (A4 N P) is short for ((A4 N ) P). We will also drop types from variables whenever the types are unimportant or can be deduced from the context, and use the letters u , u,W , x, y , and z t o denote variables. Finally, syntactic substitution is written M [ x := N ] , where the substitution renames the bound variables of M t o avoid capturing the free variables of N .
Jon G. Riecke
4
2.2
S e m a n t i c s via e n v i r o n m e n t m o d e l s
Although there are other equivalent definitions of models, here we assign meaning t o terms using environment models [4, 6, 71. Environment models have two components, the first of which is a type frame: D e f i n i t i o n 2.1 A t y p e f r a m e is a tuple ({Mu : a a type), {ApT*": r , v types)), where each Mu is a nonempty set and ApT*": MT" x M7 + Mu. T h e components of a type frame must also obey the e x t e n s i o n a l i t y p r o p e r t y : for any f , g E MT'", f = g iff for a11 d, Ap'fu( f , d) = Ap'lu(g, d). Intuitively, ApTlUis an abstract "application" function for applying elements in the set MTdUt o elements in the set Mr. The extensionality property states that the set M7"' can be regarded as a set of total functions from MTt o M u ; the most familiar type frames are constructed out of total functions. The second component of an environment model is a meaning function MI.] that assigns elements of a type frame t o terms. Since there is no way t o assign a meaning t o an open term a priori, an e n v i r o n m e n t is used t o assign meaning t o free variables. D e f i n i t i o n 2.2 Let M be a type frame. An M - e n v i r o n m e n t p is a map from variables t o elements of M that respects types, i.e., p(xa) E Ma. We use the notation p[xT H d] for a new environment that maps xT t o d and every other variable y t o P(Y). D e f i n i t i o n 2.3 An e n v i r o n m e n t m o d e l over a signature C is a type frame M with a meaning function M[.] defined inductively on the structure of terms as follows:
MI[x"IP = p(xU> M[ca]p = Z(cu) MU(M N)ilp = Ap(MilMIp7MIINDP) M([Ax7. M]p = f , where Ap(f,d) = M[M]p[xT
o
dl
where Z : C -+ M is a constant interpretation function that respects types, i.e., for all cu E C, Z(cu) E M u . Equations are interpreted in the obvious way in environment models: for any environment model M , we write M M = N iff for all environments p, M[M]p = M[N]p. Not every type frame is an environment model, since the definition requires the existence of an appropriate meaning for each A-abstraction. Some standard examples of environment models were given in the introduction. Another example is the type frame consisting of all set-theoretic functions over a base set X, defined by
+
X" X""
x = [X7 + X U ]
Ap(f, d) = f ( d ) There are other ways of defining environment models other than by explicit constructions. For example, we may construct a direct product out of a class of models.
5
Statman 's 1-Section Theorem
Definition 2.4 Let { M o , M 1 , M 2 , .. .) be a countable (possibly finite) class of models over a signature C. Then the direct product of {Mi) is a tuple ({M"),{Apa~r)) with
Mu = {(ao,al,a2, ...) : a ; E M ; } A ~ ( ( f 0fl,. , . .), (ao,a1,.
.)I
=
( A ~ o ( f o , a o ) , A ~ l ( fall,l , .. .)
We could, of course, generalize the definition to uncountable direct products, but we will only need countable direct products here. It is important t o note that this construction always yields a model.
Proposition 2.5 If M is the countable direct product of a class of models { M o , M 1 , M 2 , . . .} over a signature C, then M is a model over the same signature in which
M bM
= N i$ for all i,
Mi 'F M = N.
Proof: First we need t o verify that M is indeed a type frame, and so we need t o show that application in the structure is extensional. To that end, consider any f = (fo, fl, f 2 , . . .) and g = (g0,g1,g2,...) in the set MT'". If f = g, then it is easy to see that Ap(f,d) = Ap(g,d) for any d E M r . If f # g, then for some i, fi # g;. Since Mi is a type frame, there exists an element d; E MI such that Api( f;, d;) # Api(gi, d;). For all j # i, pick any dj E M 3 , and let d = (do,d l , . . . ,d;-1, di,di+l,. . .). Then
Therefore, M obeys the extensionality property. To see that M is a model, define
where p;(x) = d; if p(x) = (do,dl,d2,. . .). We claim that this matches the inductive definition of the meaning function in Definition 2.2; the proof is a straightforward induction on terms. Finally, we must show that M M = N iff for all i, Mi 'F M = N , which follows easily from the definition of b..
+
2.3
Pq-equational t h e o r y
Reasoning about equalities of A-terms can also be done purely syntactically. The equational theory of the simply-typed A-calculus appears in Table 2. All equational theories include the axiom ( r e n and the rules (symm), which axiomatize = as an equivalence relation; the rules (cong) and ( t ) similarly allow substitution of equals for equals. The only other axioms of the theory are ( P ) and (q), which can be justified by examining the intended class of models defined above. We write M =p, N when M and N are provably equivalent using the axioms and rules of Table 2. The equational axioms of (P) and (7) may be directed into a rewrite system. Table 2 also defines the rewriting relation +p,. We write M +p, N if M rewrites to N in 0 or more steps, and say that a term M is in normal form if M +p, N for any N [I]. An important fact about normal forms is summarized by the following proposition:
Proposition 2.6 Suppose M and N are terms of the same type in Pv-normal form, and M Then M #p, N.
#
N.
Jon
G.Riecke
7
(P) (rl)
(refr) Equational System (symm) (eOng)
Rewrite System
((Ax. M ) N ) = M [ x := N ] (Ax.Mx) = M , i f x # F V ( M ) M = M M=N N=M
M=N P=Q (M P) = (N Q)
(trans)
M=N N=P M=P
(t)
M=N (Ax. M ) = (Ax. N )
((Ax.M ) N ) +p, (Ax. M x ) +p,
M [ x := N ] M , if x # F V ( M )
M -+p, N (MP)+p,(NP)
M +p, N (PM)+p,(PN)
M -0, N (Ax. M ) -+p, (Ax. N ) Table 2: Equational and rewrite systems o f the simply-typed A-calculus. Each term appearing in these rules must be a well-formed term o f the simply-typed A-calculus.
T h e proposition follows easily from the Church-Rosser Theorem for the simply-typed A-calculus [I, 7, 181. For the proofs in this paper, we will use e x t e n d e d 0 7 - n o r m a l f o r m s instead of 0.17-normal forms. Definition 2.7 A term M of type ( a l --+ . . . -+ a, + L) is in e x t e n d e d 0 7 - n o r m a l f o r m if M has the form Ax:'. . . .Ax?. u (MI x1 . . .2,). . . (Mk 2 1 . . .x,) where k, n
3 0, u is either a variable or constant, and each Mi is in extended 07-normal form.
Extended 07-normal forms are called @-normal forms in [16]. Closed extended 07-normal forms are easier t o induct upon than &-normal forms, because the constituent terms M I , . . . ,M k are also closed extended 07-normal forms. It is also appropriate t o call these terms "normal forms" due t o the following proposition: P r o p o s i t i o n 2.8 For any M , there exists a unique extended ,f?~-normal form N such that M =pq N. P r o o f : By the Strong-Normalization Theorem for -+p, in the simply-typed A-calculus, there exists a term MI in 07-normal form such that M +p, MI. Note that MI must have the form Axl. . . . Ax,. u M1 . . . MI, where each M j is in 07-normal form and u is a variable or constant. If M has type ( a l -+ . . . -+ a, -+ . . . -+ a, -+ L),first let
, may be turned into a closed term by A-abstracting over all the Each M I , . . . ,M I ,x ~ +. .~. ,x, variables X I , .. . ,x,, resulting in the term MI" = Ax1.
. . . Ax,.
u ((AS. M I ) 5 ) . . . ((A?. M l ) 5 ) .. . ((A?. x m + i ) 2).. . ((XZ. x,) 5).
where M =p, M"' . The terms (AZ. Adi) and (AZ. x j ) may be then be turned into extended pqnormal forms recursively; the process eventually terminates a t a extended ,077-normal form that is 07-equivalent t o M . To prove uniqueness, suppose M and N are in extended 07-normal form and M =p, N; we will show tha.t M = N by induction on M . In the basis, M = Axl. . . . Ax,. u where u is a variable or constant of type L. Now because N is in extended 07-normal form,
But note that M and N must have the same 07-normal form by Proposition 2.6; thus, v = u and hence since u is of base type, k = 0. Thus, M = N . In the induction case, suppose
where each M j is in extended &-normal form. Since M and N have the same 07-normal form by Proposition 2.6, N must have the form Axl. . . . Ax,. u (N1 x l . . . x,) . . . ( N k X I . . . x,) where M j =pq Nj. Since M j and Nj are in extended 07-normal form, by induction M j = Nj. Thus, M = N as desired. W
Jon G. Riecke
3
Statement of the Theorem
Suppose two closed terms M and N are not equivalent in a model M ; then by the extensionality property, one may find arguments in the model driving MUM] and M[[N]t o different base type elements in the model. Thus, in order for Pq-reasoning to be complete for a model, there must be "enough elements'' in the model to distinguish all terms that are not Pq-equivalent. Informally, the 1-Section Theorem states a condition on the combinatorial structure of a model M that guarantees that M has enough elements. This condition is stated in the form of whether a certain algebra can be faithfully embedded in M. Recall that an a l g e b r a A = (A, fa, f i , . . .) over an algebraic signature {Fa, F l , . . .) is a tuple comprised of a carrier set A together with functions
where n ; 2 0 is the arity of F;. Here we have taken the liberty of currying the function symbols in anticipation of incorporating them into the A-calculus. One familiar example is algebra (N, 0 , +) over the signature (0, +), where 0 is the number zero and is the curried addition function. An a l g e b r a i c e q u a t i o n is an equation involving algebraic terms with variables, and an algebra satisfies an algebraic equation t l = t 2 , written A t l = t 2 ,if for any instantiation of the variables by elements of the carrier of A, the equation holds in A. For instance, (N, 0 , +) (+ x y) = (+ Y 2). Given a model of the simply-typed A-calculus, we may extend it to model of an algebraic signature. A model MI is an e x t e n s i o n of M if M and M' are based on the same type frame, and Mi extends the interpretation Z of constants in M t o a new interpretation Zi _> Z. When an extension preserves the equalities of an algebra, the algebra is faithfully embedded in the model.
+
+
+
Definition 3.1 Let A be an algebra over the function symbols F; of arity n ; 2 0. Suppose M is an environment model. Then A is faithfully e m b e d d e d i n M if there exists an extension M' of M such that M' gives meaning t o all the function symbols F;, and for any algebraic terms tl and t 2 (possibly involving variables), MI t l = t 2 iff A tl = ta.
+
+
We are now ready to give the statement of the 1-Section Theorem. Let 7 be the free closed term algebra on a single binary constant F and a single nullary constant C. In computer science terminology, the carrier set of 7 can be described by the context-free grammar T ::= C ( ( F T T )
+
where 7 To = Tl iff To and T l are syntactically equivalent. The name 7 stands for "tree algebra", since the elements in the algebra denote binary trees. S t a t m a n ' s 1-Section T h e o r e m 3.2 Let C be a class of models over the empty signature. Then ,@-equality completely axiomatizes the valid equations of C i f S 7 can be faithfully embedded i n some countable direct product of models i n C . The name of the 1-Section Theorem comes from the fact that an algebra is embeddable in the first-order part-the 1-section-of a model.
Statman's 1 -Section Theorem
4
Proof of the Theorem
One direction of the l-Section Theorem follows fairly straightforwardly from the fact that there are only a countable number of equations at any given type. Proof of Theorem 3.2, (e): Suppose =p, is complete for the valid equations in the class of models C (over the empty signature). Let Eo,E l , E 2 , . . . be an enumeration of equations of the form
AgL-L-L. AxL.t a, - AgL'L-L. AxL.t; where t; and t: are syntactically different terms in the grammar t ::= x 1 (g t t). Note t h a t the terms in each equation E; are in pq-normal form, and hence by Proposition 2.6 each equation E; is not provable by pq-equational reasoning. Since =p, is complete for C, for every equation Edthere exists a model A; E C such that M ik E;. In particular, there exist fi E M$'"L and c; E M t such t h a t Ap; (Ap; (Mi[AgL'L'L.
AxL.ti]],fi), c,) # APE(Api (Mi[AgL'L'L.
AxL.t:], f i ) , ci).
Define M to be the countable direct product of the models Ao, A1, Az, . . . and set
It is not hard to check that M Ei for every i 2 0. Let M ' be the extension of M such that M'[[FL+L+L ] = f and A'[CL] = c. By the construction, for every pair of distinct terms To and TI in the grammar T above, M1[To] # A1[T1]. Thus, the algebra 7 is faithfully embedded in some countable direct product (namely M ) of the elements of C as desired. 1 The PI-oof of the (+) direction of Theorem 3.2 is more difficult but more interesting. Given a countable direct product M of models into which the tree algebra 7 can be faithfully embedded and an equation M = N which is not provable by pq-reasoning, we wish t o show that the model M denies the equation M = N . The essential idea is to show that M and N can be transformed into closed terms of type ((L + L + L)+ L -. L )t h a t are not pq-equivalent: Lemma 4.1 Suppose M and N are closed terms over the empty signature of type a and M #p, N . Then there exists a closed term P (over the empty signature) of type (a + ( L + L + L ) + L + L) such that ( P M ) #@, ( P N ) .
T h e main combinatorial arguments lie in the proof of this lemma, which we shall explicate shortly. T h e interesting direction of the 1-Section Theorem is then relatively easy t o deduce from Lemma 4.1. Proof of Theorem 3.2, (e): Suppose the tree algebra 7 can be faithfully embedded in the countable direct product M , and suppose M and N are terms of type a such that M Z p , N . Let {xo7X I , . . . ,x,) be the set of free variables appearing in M and N , and let M ' = (Axo. . . . Ax,. M ) and similarly let N' = (Axo. . . . Ax,. N). We will show that M M ' = N'.
Jon G. Riecke By Lemma 4.1, choose a closed term P of type ( a --, (1 --, L + 1) --, L -. 1) such that ( P MI) Zp, ( P N'). Let M" be the pq-normal form of ( P MI), and similarly let N" be the pq-normal form of (P N'). Since M" and N" are closed,
M"
= Xg""'"'
Ax'". Mo
N"
= Xg""'"'
AxL.No
where Mo and No are Pq-normal forms of base type involving only the free variables g and x. Since M" #@, N", it must be the case that Mo # No. We claim that Mo and No are terms in the syntax t above. The proof of the claim is a little induction on the size of the term Mo (and similarly for No). In the basis, Mo has size 1 and hence Mo must be x. In the inductive case, Mo has size greater than 1 and must therefore be an application (Po P I . . . Pr), where Po is a X-abstraction or variable; it cannot be a X-abstraction because Mo has type 1. Since Mo is in pq-normal form, Po must be a variable, and since the only free variables in Mo are g and x, Mo = (g MA M:). By induction, MA and M: must be in the syntax t, so hJo is. Let f E ML'L'L and c E M Lbe the elements in M that we use to embed the algebra I.Then Ap(Ap(M([M"IJ,f ) , c ) and Ap(Ap(MIN1'], f ) , c ) must be different elements in the model, since Mo and No are different terms in the grammar t. Thus, M M" = N", from whence it follows that M MI = N'.
.
In order to complete the proof of the l-Section Theorem, we are left with proving Lemma 4.1. In outline, we first prove a restricted version of Lemma 4.1, where the terms M and N to be distinguished only take arguments of first-order type, i.e., those with type (1 --t . . . --t L). We then show, for the more general case when M and N's arguments are not of first-order type, how t o reduce the problem t o terms that take arguments of only first-order type. In proving the two lemmas, we will always assume that the terms are in extended Pq-normal form, which we may assume without loss of generality by Proposition 2.8. We begin by establishing the first claim. L e m m a 4.2 ( S t a t m a n [16]) Suppose M
#
N are closed extended pq-normal forms of type
where each a; is a first-order type. Then there is a closed L of type ( a where (L M ) #@, (L N ) .
--,
(L+ L --, 1) --t
i + 1)
Proof: Given M # N in extended pq-normal form, our goal is to find an appropriate L. In fact, the definition of L, which is done in two stages, will only depend on the types of M and N . First, and x', and define pick any variables g"'"""
Suppose the type
ai
Pi =
= (1 +
. . . + L)with ( k + 1) occurrences of 1; then define
ifk=O Xy;. . . . Xy;. g i (g yl (g yz (. . . (g y k - ~yk) . . .))) otherwise
Statman's I -Section Theorem and finally set L = Xwu. Xg"'"'". Ax" w PI . . .P,. We claim that ( L M ) #p, ( L N ) . The proof goes by induction on the extended pq-normal forms of M and N. In the basis, M = (Ax;'. . . .Ax:. x l ) and N = (Ax:'. . . . Ax:". 54) where i # j. Then calculating,
( L A4) =p, =p, =p,
Xg. A X . M P I . . . P, Xg. Ax. Pi Xg. Ax. i
and similarly, ( L M ) =p, Xg. Ax. j . Since both i and j are terms in pq-normal form and i # j, i #p, j by Proposition 2.6. Thus, ( L M ) #p, ( L N ) as desired. In the induction case, there are three cases (up to symmetry) depending on the form of M and N : 1. For some k 2 1,
2. For some k , l
2 1 and i # j,
3. For some k 2 1
The first two cases can be argued similarly t o the basis; the only difficult case is the third case. By our hypothesis on the types of the terms M and N , the variable xQ' has a first-order type. Thus, ( M j 2 1 . . . x,) must have type L and hence M j has type o. Likewise, N j has type a. Thus, since M j # N j , it follows from the induction hypothesis that ( L M j ) #p, ( L N j ) . Performing some calculation, ( L h$)
=p,
( L N j ) =p,
Xg.Xx. M j PI ... P, Xg. Ax. Nj PI ... P,
It therefore follows that ( M j PI . . . P,) #p, ( N j PI
( L M ) =p,, -0, -
( L N ) =p, =p,
Xg. AX. M Pl
. . . P,).
Thus, since
. . . P,
AS. Ax. 9 i (9 ( M l F ) (9 (M2 F) (. - .( 9 (Mk-1 Xg. AX. N P I . . . P,
X9- Ax. 9 i (9 (N1 P ) (9 (N2 P ) (. . . (9 (Nk-l
F ) (Mk F ) ) . . .)))
P ) (Nk P ) ). . .)))
it must be the case that ( L M ) #p, ( L N ) . This completes the induction case and hence the proof of the lemma. W
Jon G. Riecke
Now our goal is to reduce the original problem to the statement of Lemma 4.2. Let X be the set of first-order variables and let AX be the set of simply-typed A-terms which contain no constants and whose only free variables are in X. The second lemma for proving Lemma 4.1 states that we may apply M and N to terms in this set t o arrive at inequivalent terms: Lemma 4.3 (Statman [16]) Suppose M , N are closed extended pq-normal forms of type (al -+ . . . an + L ) , and M # N . Then there exist terms V, E Ax where
( M Vl
. . . V,)
fp, ( N fi
. . .V,).
Proof: By induction on the extended Pq-normal form structure of both M and N . In the basis, suppose M = AxT1. . . . Ax",". xt and N = Axyl. . . . Ax",". x; where by hypothesis, it must be the case that i # j. Pick distinct variables zh and 24, and let
Aw'. z;
ifp=i ifp= j otherwise
for which we will need the induction hypothesis. Since M # N , it must be the case that M j # N j for some 1 j 5 k. By induction, there exist terms Ul,. . . , U,, . . . ,Urn such that ( M i Ul . . . Urn)#p, ( N j Ul . . .Urn),and both (Mi Ul . . .Urn) and ( N j Ul . ..Urn) are of type L . Choose fresh variables h6+L+A and y l , . . . ,yk, i.e., variables not appearing free in any of the terms U1,. . . ,Urn. For any 1 5 p 5 n, define