A NOTE ON REWRITING THEORY FOR UNIQUENESS OF
ITERATION
Dediated to our friend and olleague Jim Lambek
M.OKADA 1
ANDP. J.SCOTT 2
ABSTRACT. Uniqueness for higher type termonstrutors in lambda aluli (e.g.
surjetivepairingforproduttypes,oruniquenessofiteratorsonthenaturalnumbers)is
easilyexpressedusinguniversallyquantiedonditionalequations. Weuseatehniqueof
Lambek[18℄involvingMal'evoperatorstoequationallyexpressuniquenessof iteration
(more generally, higher-order primitive reursion) in a simply typed lambda alulus,
essentiallyGodel'sT[29,13℄. Weprovethefollowingfatsabouttypedlambdaalulus
with uniqueness for primitive reursors: (i) It is undeidable, (ii) Churh-Rosser fails,
although ground Churh-Rosser holds, (iii) strong normalization (termination) is still
valid. This entails the undeidability of the oherene problem for artesian losed
ategorieswithstrongnaturalnumbersobjets,aswellasprovidinganaturalexampleof
thefollowingomputationalparadigm:anon-CR,groundCR,undeidable,terminating
rewritingsystem.
1. Introdution
Consider the usual primitive reursion equations of the addition funtion: x+0 = x,
x+(Sy)=S(x+y). How dowe know these uniquely speify addition? More generally,
onsider a possibly higher-order primitive reursor, Rahxy, where a : A ) B;h : A )
N)B )B, satisfying:
Rahx0 = ax
Rahx(Sy) = hxy(Rahxy)
Againwe may ask: how dowe know suh primitivereursive denitions uniquely speify
the intended funtion?
Suh uniqueness questions make sense in many ontexts: arithmeti theories [29℄,
rst-order term rewriting theories [9℄ , primitive reursive arithmetis [14℄, simply and
higher-order typed lambda aluli and related funtional languages[13, 20, 29℄,
ategor-ial programming languages [5, 15℄ and more generally wherever we dene a proedure
iteratively on an indutive data type[15 , 16℄. If mathematial indution is provided
ex-pliitly within the formal theory, the problem of uniqueness often beomes trivial (e.g.
1
ResearhsupportedbyAidsinResearhoftheMinistryofEduation,SieneandCultureofJapan,
and the OogataKenkyu Josei grant of Keio University 2
Researh supported byan operating grant
fromtheNaturalSienes andEngineeringResearhCounilofCanada
Reeivedbytheeditors1999Marh8and,inrevisedform,1999November15.
Publishedon1999November30.
Key words and phrases: typed lambda alulus, rewriting theory, strong normalization, Mal'ev
operations.
M.Okada 1
andP.J.Sott 2
[20℄, p.192.) But usual funtional programming languages, term rewriting languages,
or ategorial languages do not expliitly have indution, hene the uniqueness issue is
more problemati. We shouldmentionthat similarproblems alsoappear inthetheory of
higher-order mathing [10℄.
The question of (provable) uniqueness of terms also arises quite naturally from the
viewpoint of ategory theory [20, 21℄. For example, whenever we demand that arrows
arise from anassoiated universal mapping property,then weare immediatelyled tothe
question of the (provable) uniqueness of terms in an appropriate language. Here we are
onernedwiththepropertyofbeinga(strong)naturalnumbersobjetinafreeartesian
losed ategory,equivalently the problemofuniqueness ofiterationinGodel's T[29, 13℄.
For many equational aluli, a simple-minded solution to the uniqueness problem
involves adding a kind of extensionality or uniqueness rule. This rule says: \any term t
satisfyingthesame dening equationsasagiven term,must beequaltothat term." The
uniquenessrulemaybeexpressedinrstorderlogiasauniversallyquantiedonditional
equation, possibly between terms of highertype [22℄ .
However, in many interesting ases (e.g. produt and oprodut types ) we an do
muhbetter: wean presentuniqueness equationallyandbuildaterminating(=strongly
normalizing) higher-typed rewrite system for the theory [20℄. 1
Here we use a tehnique
of Lambek[18℄involvingMal'ev operationstoequationallydeneuniqueness of iterators
(reursors) in Godel's T. We then prove this lambda theory is undeidable; thus it is
impossible to simultaneously have onuene (Churh Rosser) and termination. In fat,
weshowthatonuenefails,butgiveaproofofterminationusingarenedomputability
prediate argument (Setion 4). This answers a question of J. Lambek. On the other
hand, the theory is ground-CR (=Churh-Rosser for losed terms of base type), thus it
formsanatural, undeidableomputationtheory. Thissuggests the existeneof natural,
strongly normalizing funtional languages whih are Turing omplete and ould serve as
the basis of interesting programminglanguages. Another onsequene of this workis the
undeidabilityoftheohereneproblemforartesianlosedategorieswithstrongnatural
numbers objets. We end with a brief disussion of some extensions of these results, for
example tothe data type of Brouwer ordinals.
2. Typed Lambda Caluli
We use the usual expliitly typed lambda alulus (with reursors) and its notational
onventions, f. [13, 20,29℄.
Types
TypesarefreelygeneratedfromabasitypeN(fornaturalnumbers)undertheoperation
1
Fortypedlambdaaluliwithproduttypes,uniquenessofpairingisgivenbythesurjetivepairing
equation [20℄. For oproduttypes, thedual equation is obviousin a ategoriallanguage[20℄, Part I,
Terms
For eah type A, there is an innite set of variables x A
i
of type A, as well as speied
onstants for primitivereursion, typed as follows:
0:N S:N)N R
A;B
:(A)B))(A )N)B )B))A)N)B
Terms are freely generated from the variables and onstants by appliation and
-abstration,with the usual typing onstraints. In shorthand, terms have the form
variable j onstant j M`N j x:A:'
where M :A )B ; N :A. Weusually write MN for M`N.
Equations
Weidentifytermsuptohangeofboundvariables( -ongruene). Equalityisthesmallest
ongruene relationlosed under substitution,satisfying ;and
R
A;B
ahx0 = ax
R
A;B
ahx(Sy) = hxy(R
A;B ahxy)
for all a:A; h:A)N)B )B;x:A;y:N.
Lambda Theories
Amongstandardextensionsoflambdaalulitowhihourmethodsapply,wemention:
(a) Lambdaaluliwithproduttypesandsurjetivepairing[20,13℄. Suhsystemsare
losely onnetedtoartesian losedategories (='s). Howeverfor thepurposes
of onstruting free 's, produt types are unneessary ([25℄); f Setion 5 below.
In the presene of produt types with surjetive pairing, the reursor R may be
dened in terms of the simpler notion of iteratorI
A
: A)(A)A))N)A (f
[20℄, p. 259,[13℄, p. 90 ) The type N with iterators orresponds to the ategorial
notionof weak natural numbers objet in 's [20℄.
In this paperwe shall use reursors R sine (i)we do not neessarilyassume
prod-ut types, (ii) reursors are neessary for more generaltype theories (e.g. Girard's
system F) as well as for more general ategorial frameworks (e.g. Lambek's
mul-tiategories, [19℄).
(b) Wemay onsider extensions of typed lambdaalulusby adding rst-order logito
theequationaltheory[23,22℄. Thiswillbedisussedinthenextsetion. Finally,we
Notation: As usual, the type expression A
1 ) A
2
) ) A
n abbreviates A 1 ) (A 2
) (A
n 2
) (A
n 1 ) A
n
))) , i.e. assoiation to the right. Even if there
are no produt types, we sometimes abbreviate A
1 ) A
2
) ) A
n
by the Curried
expression (A
1
A
n 1
) ) A
n
but we still write terms in the usual way without
pairing. The reader an easily add pairing to terms if there are genuine produt types.
The term expression a
1 a
2 a
n
abbreviates (((a
1 `a
2 )`a
3 )`a
n 1 )`a
n
, i.e. assoiation
tothe left.
3. Uniqueness of Reursors
3.1. Natural Numbers Objets. In ategorial logi [20℄, a natural numbers objet (=
NNO) in a artesian losed ategory (= ) C is an objet N together with arrows
1 0
!N S
!Nwhihis initialamongalldiagramsofthe shape 1 a
!A g
!A. This means:
forallarrowsa:1!Aandg :A !AthereisauniqueiterationarrowIt
A
(a;g):N!A
satisfying: (i) It
A (a;g)
o
0=a and (ii) It
A (a;g)
o
S =g o
It
A
(a;g). A weak naturalnumbers
objet N in a C merely postulates the existene, but not uniqueness, of the iterator
arrowabove. Inthe typed lambdaalulusassoiatedtoC,a weak NNOis equivalent to
having aniterator I
A
:A(A)A)N)A inthe language (f. [20℄, p. 70).
3.2. Lambek'sUniquenessConditions. We nowonsider uniquenessof lambdaterms
de-ned by iterators or, more generally, reursors. Girard disusses the subtleties of suh
questions, and the defets of standard syntax, in[13℄, pp. 51, 91.
The use of rst-order logi to strengthen lambda alulus is familiar, for example in
disussing extensionality, lambda models, and well-pointedness of 's, f. [22℄. In a
similarmanner, uniqueness ofIt
A
in's an beguaranteedbythe followingonditional
rule: given arrowsa:1!A andg :A!A,if f :N!Aisany arrowsatisfyingf o
0=a
and f o
S =g o
f then f =It
A
(a;g). Letus translatethis intolambdaalulus.
More generally, we onsider typed lambda aluli L presented with reursors R
A;B .
Given any terms a and h of appropriate type, uniqueness of R
A;B
ah may be guaranteed
by the following uniqueness rule: for any term f : AN ) B, and variables x;y of
appropriate types:
(U
f;h )
8x8y[fx(Sy)=hxy(fxy)℄
f =R
A;B
ah where a=x:A:fx0
Here, for any x, the initialvalue of the reursion, fx0, issimply dened to beax .
Lambek[18, 17℄proved that itispossibletoequationally represent the rst-orderrule
U
f;h
, provided we assume the existene of ertain Mal'ev operators. Let us reall his
proof.
Suppose all the types A in the lambda alulus L have a Mal'ev operation; i.e. a
losed term m
A :A
3
)A satisfying the following equations (inunurried form):
for all x;y : A . Fix a family fm
A
jA a type g of suh Mal'ev operations (we omit type
subsripts). ConsiderthetermH,whereHmfh=xyz:m(hxyz)(hxy(fxy))(fx(Sy))for
variablesf;h(where f hasthe sametypeasR
A;B
ah andHmfhhas the sametypeash),
and the following equationalrule:
(M
f;h
) R
A;B
a(Hmfh)=f
Notation. From now on, when the ontext islear, we shall omit typesubsripts.
3.3. Theorem. [Lambek([18℄)℄ The following impliations hold:
(i) M
f;h
implies U
f;h
(ii) U
f;h
0 implies M
f;h
where h 0
=Hmfh .
Proof. In this proof, we freely use ()-rule, i.e. extensionality. (i): Suppose M
f;h and
the hypotheses of U
f;h
, i.e. suppose fx(Sy)=hxy(fxy). Sine m is a Mal'ev operator,
Hmfh = h. Therefore by M
f;h
, fxy = Ra(Hmfh)xy = Rahxy, so f = Rah, by (),
whihis the onlusion of U
f;h .
(ii) Suppose U
f;h 0.
Note that the hypothesis of this rule is always true, sine it says
fx(Sy) = h 0
xy(fxy) = m(hx(fxy))(hx(fxy))(fx(Sy)) = fx(Sy): Thus, the onlusion
of the rule is true; so f =Rah 0
, i.e. M
f;h
,as required.
Thetheoremaboveexpresses thesenseinwhihweanreplaetheonditional
unique-ness rulesU
f;h
bythe equationsM
f;h
. Theproblemofequationallydening the
appropri-ate Mal'ev operatorsis addressed in setion3.2 below.
TheruleU
f;h
aboveguaranteesuniquenessofthereursorR
A;B
ahforgivena;h,whih
suÆesformanypurposes(e.g. inLambek'swork,itguaranteesuniquenessoftheiterator
arrow in a strong natural number objet). But it does not guarantee the uniqueness of
the term R
A;B
itself. The uniqueness of suh R is a muh stronger ondition whih we
shall not disuss here.
Oneadvantage ofassumingtheuniqueness ruleU
f;h
ispointed outin[20℄, Proposition
2.9, p. 263: in simply typed lambda alulus with the uniqueness rule (equivalently, in
thefreewithNNO)allprimitivereursivefuntionsandtheAkermann funtionmay
be dened by their usual free variable equations. But in fat more is true: in the next
propositionwe show many familiarset-theoreti equationsbeomeprovable forvariables
(not just for numerals). In what follows, +; .
; .
are terms dened (using R) by the usual
primitivereursive equations onN (f. [14℄) .
3.4. Proposition. [Goodstein[14℄, Lambek[18℄, Roman[27℄℄ In typed lambda alulus
(i) Sx Sy=x y
(ii) x .
x=0
(iii) x .
(1 .
x)=0
(iv) x .
(1 .
y)=x .
(x .
y)
(v) (x+y) .
y=x
(vi) Assoiativity of + and .
(vii) jx;yj=jy;xj, where
jx;yj=(x .
y)+(y .
x)
(viii) Commutativity of + and .
(ix) x+(y .
x)=y+(x .
y)
Proof. Detailed arguments are given in Goodstein [14℄ and/or Lambek[18℄ (f. also
Roman [27℄). Re (ix), whih is an important identity, either follow [14℄, 5.17 (p.108)
or alternatively, note that both sides of (ix) (as funtions of x;y) satisfy the following
double reursion formula: '(0;0) = 0;'(0;y +1) = y +1;'(x+1;0) = x+1;'(x +
1;y+1)='(x;y)+1. Hene by uniqueness the equality follows, provided we an show
'is representable intyped lambdaalulus(equivalently,in the free with NNO).We
omit the onstrution of ' exept to remark it is similar to the proof that Akermann's
funtion isrepresentable (f. [1℄, p. 570,[20℄, p. 258 ).
Notation. Weextend the arithmetialoperationsinthe set S =f0;+; .
; .
g toalltypes
by indution: (i) at type N the operations inS have their usual meanings. (ii)Suppose
we know the operations in S at types A and B. Then we extend these operations to
type A ) B by lambdaabstration, i.e. 0
A)B =
def
x : A:0
B
, and f ?
A)B g =
def x :
A:fx?
B
gx, for any operation ? 2 f+; .
; .
g. Sine all types have the form A A
1 )
A
2
))A
n 1
)N,anoperationa?
A
b isessentiallyx
1 x n :ax 1 x n N bx 1 x n
, where x
i : A
i
. Finally, we may now disuss the usual dierene funtion in Goodstein
athigher types: jM;Nj=(M .
N)+(N .
M)
If we add expliit produt types, we ould also dene the arithmetial operations
0
AB
and ?
AB
\omponentwise". We shall use the usual notation (without subsripts)
for +; .
; .
;0at alltypes when the meaningis lear.
3.5. Proposition. In typed lambda alulus with theuniqueness rule U
f;h
, thefollowing
rst-order shema holds for arbitrary terms M;N of the same type: ` jM;Nj = 0 $
M =N :
Proof. The(!)diretionistheinterestingone. Arguinginformally,weprovetheresult
for variables of type N , the other ases followingfrom appropriate lambda abstrations
and substitutions. Suppose jx;yj= 0; then by Proposition 3.4(v;vii), jx;yj .
(y .
x)= 0,
so x .
y = 0. Similarly, y .
x = 0. Hene, using equation Proposition 3.4(ix) above, we
obtain: x =x+(y .
x)=y+(x .
y)=y.
3.6. DenableMal'evOperations. TheruleM
f;h
isequational,providedthespeiation
oftheMal'evoperationsm
A
are. Inthepuretypedlambdaalulus,Lambek[19℄showed
that Mal'ev operations are atually denable from ut-o subtration .
losed terms m
A
: A ) A, uniquely determined (by funtional ompleteness) by the
followinglauses inunurried form:
1. m
N
xyz =(x+z) .
y,for variablesx;y;z :N.
2. m
A)B
uvw=x:A:m
B
(ux)(vx)(wx),for variables u;v;w:A)B.
Remark. Iftypedlambdaalulusisextendedwithprodutsand terminaltype,wemay
extend m
A
(usingexpliit tupling)asfollows: m
1
hx;y;zi=,forvariablesx;y;z :1and
m
AB
= hm
A o
hp
A1 ;p
A2 ;p
A3 i;m
B o
hp
B1 ;p
B2 ;p
B3
ii, where p
Ai
denotes the projetion onto
the ith-fator of the A omponent, et.
To say m
N
xyz = (x+z) .
y gives a Mal'ev operator at type N means we must be
able to prove (x+z) .
x = z and (x+y) .
y = x for variables x;y;z. Alas, in the pure
theory these equations are onlyprovable for losednumerals0;S0;S 2
0;: to guarantee
the result for variables we must postulate it,as follows:
3.7. Theorem. Let L be pure typed lambda alulus (alltypes freely generated from N).
The indutively-dened family of terms fm
A
jAa typeg given above denes Mal'ev
op-erations at eah type, provided that at type N we add the axioms: (x+z) .
x = z and
(x+y) .
y=x, for variables x;y;z.
Proof. By diret alulation.
3.8. Uniqueness, Indution, and Undeidability. We now show that the uniqueness rule
isin fatequivalenttoa version of quantier-free indution. Weshall then give proofsof
the undeidabilityof L with uniqueness.
3.9. Lemma. Thefollowing are equivalent for any type B:
1. Uniqueness rule: for any losed term f :A)(N)B)
(U
f;h )
8x8y[fx(Sy)=hxy(fxy)℄
f =R
A;B
ah where a=x:A:fx0
2. Goodstein Indution at type B: for any losed term f :A )N)B
(GoodsteinInd:)
8x8y[fx0=0 (1 .
fxy) .
fx(Sy)=0℄
f =xy:0
where x:A and y:N.
3. The indution rule : for any losed terms F;G:A)N)B
(Indution)
8x;y: Fx0=Gx0
[Fxy =Gxy℄
.
.
.
.
Fx(Sy)=Gx(Sy)
F =G
Proof. We show (1))(2))(3))(1), in eah ase by indution onthe type B.
(a). (U
f;h
) ) (Goodstein indution) : this is essentially Goodstein's argument, [14℄,
p.35, using the identities of Proposition 3.4 (this proposition assumes U
f;h
.) For
om-pleteness, we sketh the proof.
Case 1. B = N. Let f : A ) N ) N be given satisfying the hypotheses of Goodstein
Indution. Then (1 . fxy) . (1 .
fx(Sy)) = (1 . fxy) . ((1 . fxy) .
fx(Sy)) = 1 .
fxy (1)
Dene g : A ) N ) N by primitive reursion as follows (where x : A and y : N are
variables): gx0=1,gx(Sy)=gxy .
(1 .
fxy). Lethxy=gx(Sy). Then using equation (1)
hx(Sy) = gx(Sy) .
(1 .
fx(Sy)) = gxy .
(1 .
fxy)=gx(Sy) (2)
Also hx0 = 1 = gx0. An easy argument ([14℄, p.34) then shows hxy = gxy. Hene,
gx0=1andgx(Sy)=gxy. By[14℄,2.7304(p. 55), g =xy:1. Inpartiular,1 .
fxy=1.
Hene fxy=fxy .
(1 .
fxy)=0,by Proposition3.4, (iii) .
Case 2: In general, any type has the form B = A
1 ) A
2
) A
n 1
) N. Thus a
losed term f : A ) N ) B means f : A ) N ) A
1 ) A
2
) A
n 1
) N. Thus
f = x A y N z A 1 1 z A n 1 n 1 :fxy~z i
, where fxy~z
i
: N. Now apply the same argument as in
Case 1 (with extra parameters z~
i ).
(b). (GoodsteinIndution) ) (Indution):
Case 1: B =N.Letbethe losedtermxy:jFxy;Gxyj. ByProposition3.5, Indution
is equivalent to saying:
8x;y: x0 =0
[xy=0℄
.
.
.
.
x(Sy)=0
=0
The proof that Goodstein Indution implies the above rule is (slightly) modied from
Goodstein [14℄, p.109. Note that Goodstein's proof assumes terms F;G : N ) N; the
same proof goes through verbatim if we assume there isanextra parameter y of typeA,
i.e. that F;G are atually of typeA )N)N.
Case 2: B = A
1 ) A
2
) A
n 1
) N. Hene, as above, the problem redues to the
ase B =N, with extra parameters z
i :A
i .
(). (Ind.) ) (U
f;h
): The following proof is valid for all types B. Suppose the
hypotheses of U
fh
. Let F = xy:fxy and G =xy:Rahxy . We wish to prove F = G,
i.e. Fxy = Gxy, for all x;y. Clearly Fx0 = fx0 = ax = Rahx0 = Gx0. Now suppose
Fxy=Gxy,i.e. fxy=Rahxy. Then, using the hypothesis of U
fh ,
Fromtheavailabilityofindutioninthesimplytypedlambdaaluluswithuniqueness,
it follows that the rst-order presentation is undeidable. Butthere are diret proofsfor
the equational presentation aswell:
3.10. Theorem. ThetypedlambdaalulusLwithuniquenessU
f;h
isundeidable. Hene
we annot simultaneouslyhave SN and CR for any assoiated rewriting system.
Proof. Observethatwithuniquenessweanrepresentpolynomialswithpositiveinteger
oeÆients (f the remarks before Proposition 3.4). Thus, from the undeidability of
Hilbert's 10th problem, the general question of deiding if two suh lambda terms are
equalor not is undeidable. The onlusion about rewriting systems is familiar. SN and
CR implythe word problem isdeidable: to deideif two terms are equalor not, redue
themusing SNtotheirunique normalforms,thenhek ifthe normalformsare idential
(up to hange of bound variables).
Let usend this setionwith a few remarks.
(i) A related result by G. Dowek [10℄ yields the undeidability of pattern mathing in
lambdaaluli supporting indutivetypes (aswell asother theories).
(ii) Simply typed lambda aluluswith produt types and uniqueness L+U
f;h
is very
losetoTroelstra'stheoryqf--E-HA !
p
ofthequantier-freepartofextensional
arith-meti in all higher types, lambda operator and produt types with surjetive pairing
[29℄, p. 46, 62(f. the formof indution inthe Lemma above.)
We an also give an indiret proof of undeidability based on Troelstra's theory;
note, in partiular, our alulus satises the -rule: s = t ) x:s = x:t. We
follow Troelstra's proof [29℄, p. 62 that S = fhdme;dnei j ` m = ng and S 0
=
fhdme;dneij `m6=ngare reursivelyinseparable. Note, however, thatTroelstra's
proof alsorequires ([29℄, pp. 51-59) oding various equations of primitivereursive
arithmeti,aswellassimultaneousreursion, allprovedusingindution. Ourproofs
of similar equationsin Proposition3.4used the uniqueness axiomU
f;h
instead.
4. Rewriting theory for Uniqueness: SN and CR
Let L be the typed lambda alulus with primitive reursors and Mal'ev operators,
onsidered as a rewrite system[16 , 20, 13℄. To this end we orient all basi equations as
usual,i.e. fromleft-handsidetoright-handside,abbreviatedLHSRHS.Inpartiular,
weorientinthismannerthebasi Mal'evequationsattypeN: mxxy x,mxyyy,
the equations required for dening Mal'ev operators (see Proposition 3.7), as well as
and .
4.1. Proposition. The system L of typed lambda alulus, reursors (without
unique-ness) and Mal'ev equations onsidered as a rewriting theory oriented as above satises
R a(Hmfh)
R
f
R ah
R a(Hmfh)xy
R
fxy
R ahxy
?
0
Figure1: Failure of CR
We nowturn tothe Mal'ev uniqueness rule. Consider the following two basi
orien-tations:
1. Redution R a(Hmfh)f
2. Expansion f R a(Hmfh)
Let L
red
= the rewriting theory obtained from L with the above redution rule and
L
exp
= the rewriting theory obtained fromL with the aboveexpansion rule.
4.2. Proposition. The system L
exp
is CR but not SN.
Proof. Sine the LHS of the expansionrule is a(higher-type)variable and the original
system L is CR, any ritial pair is joinable by 1-step parallel redution, [2℄ Hene, the
system is CR. Obviously, the system L
exp
with the expansion rule aboveis not SN,sine
the RHS expands with eahredution.
The system L
red
is onsiderably more interesting. In what follows we showthat L
red
is SN,not CR, but is groundCR (i.e. CRfor losed terms of groundtype ).
4.3. Proposition. Thesystem L
red
isnotCR.Indeed,it isnoteven CR foropen terms
of ground type.
Proof. Consider f =xy:0andh=xyz:0,wheref isofthetypeofthereursor Rah.
Consider the following ritialpair between the redution rule and the Mal'ev rule:
(i) R a(Hmfh)f , (ii) R a(Hmfh)R ah
Redution (i) omes from our orientation of the Mal'ev equation M
f;h
. Redution (ii)
arises as follows: sine hxy(fxy)=0=fx(Sy), then
Hmfh =xyz:m(hxyz)(hxy(fxy))(fx(Sy))xyz:0h
where f and R ah are irreduible. Note that all other ritial pairs are atually joinable.
4.4. Proposition. ThesystemL
red
isgroundCR,i.e. CR forlosedtermsof base type.
Proof. The only important aseis shown by diagram (ii)of Figure1,where we
substi-tute losedtermsx^:Aand y^:Nforthe variablesx;y,respetively. Assuming L
red is SN
(see below), then by anindutive argument([29℄, p. 104) oneshows `y^=S n
0(forsome
n 2Z +
) or`y^=0. In eitherase, wenotethat (ii)isjoinableineitherone ortwosteps,
with R ah^x^y
0.
Strong Normalization of L
red
4.5. Theorem. ThesystemL
red
isSN,i.e. iftisanarbitraryterm,theneveryredution
path starting from t halts (at an irreduible).
The proof uses the Tait omputability method ([29℄). For tehnial reasons it does
not suÆe to diretly dene omputability for L
red
, but rather we must introdue an
auxiliarylanguageL 0
red
(see Remark 4.8below) 2
.
The language L 0
is L but with a kindof \parametrized" Mal'ev operatorm 0
A :A
3
N)A dened as follows:
1. m 0
N
xyzw =(x+z) .
y forvariablesx;y;z :N
2. m 0
A)B
fghw=x:Ay :N:m 0
B
(fx)(gx)(hx)y for variablesf;g;h:A)B, w:N.
Notethatfor everytypeA, variablesx;y;z :A,w:N,thetwodened Mal'ev operators
are indistinguishable, in the sense that: ` m 0
A
xyzw = m
A
xyz, i.e. m 0
is essentially m
with anextra dummy variable w.
In L 0
, analogouslytoL, we introdue the term
H 0
m 0
fh=xyz~p :m 0
(hxyz~p )(hxy(fxy) ~p)(fx(Sy) ~p)(fxy~p)
where ~pis a sequene of variablessuh that fxy~pis of typeN.
Wenowformthe lambdaalulusL 0
red
ompletelyanalogouslytoL
red
, but withM
f;h
replaed by the redution
(M 0 fh ) R A;B a(H 0 m 0
fh)f
4.6. Theorem. ThesystemL 0
red
isSN,i.e. iftisanarbitraryterm,theneveryredution
path starting from t halts (at an irreduible).
The proof is a modiation of the well-known Tait omputability method [29℄. One
rst denes the omputable terms of type A, Comp
A
, by indution ontypes asin [29℄:
t2Comp
A
, t 2SN for atomi typesA: (3)
t2Comp
A)B
, 8a(a 2Comp
A
)t`a 2Comp
B
): (4)
2
KnownSN tehniquesdonotsuÆe. Forexample,in ordertoadapt Blanqui,Jouannaud,Okada[3℄
f in the Mal'ev uniqueness rule must be an aessible subterm, whih is not generallytrue if f is of
One now proves the following by indution ontypes:
CR1. If t isomputable, then t is SN.
CR2. If t isomputable and t t 0 then t 0 is omputable.
We now need toprove a lemma (by indution on terms): All terms are omputable ,
from whih the main theorem follows by CR1. In the proof of the lemma, one needs a
stronger indutive hypothesis to handle the ase of lambda abstration. This is
summa-rized by the following (f. [13℄, p. 46) :
4.7. Lemma. LetL 0
red
besimplytypedlambdaaluluswithredutiononthenewMal'ev
operator, as above. If t(x
1 ;:::;x
n
): B is any term with free variables x
i :A
i
, and if the
termsa
i :A
i
areallomputable,thent(a
1 ;:::;a
n
)isitself omputable. Inpartiular, sine
variables are omputable, any term t(x
1 ;:::;x
n
):B is omputable.
Proof. The proof is on the omplexity of t. We onsider the substitution instane
t[ ~
d=~x℄ ~
b , where the d
i
are omputable, and the b
j
are also omputable so that t[ ~
d=~x℄ ~
b is
of type N. It suÆes to verify that this term is SN. All ases proeed as usual, exept
the ritialasewhent[ ~
d=~x℄ ~
b isR a(H 0 m 0 fh) ~ b 0
,the redexof theMal'ev redution(M 0
fh ).
We show that after (M 0 fh ), f ~ b 0
: N is SN. There are essentially two key forms of suh t
: (i) either t R^a(H 0 m 0 ^ f ^ h) (so ^ f[ ~
d=~x℄ = f (for the f in R a(H 0
m 0
fh)) ) or (ii) t is not
of the form (i); then f must be a proper subterm of some d
i or b
j
. Case (i) is very easy
to prove: by indution hypotheses, sine ^
f is a subterm of t, ^
f[ ~
d=~x℄ is omputable, so f
is omputable, so f ~
b is SN. For ase (ii) H 0
m 0
fh is ontained in either some d
i
or some
b
j
. Hene, sine these are SN, H 0
m 0
fh is SN. In partiular using the hosen formula for
H 0
in terms of m 0
the subterm fxy~p is strongly normalizable for any omputable terms
substituted for x;y;~p; in partiular f ~
b 0
isSN.
4.8. Remark. The reader should note that in the proof above, the key fat that H 0
ontains the subterms fxy~p is ritial{the original Mal'ev rule, using Hmfh, will not
diretly work.
Sine the tree of redutionsof m isa subtree of that of m 0
, we obtain:
Corollary. (Theorem 4.5) L
red
is SN.
4.9. Remark. Although we do not assume genuine produt types here, they may be
aounted for, just as in the setting of Jouannaud-Okada [16℄. Produts use the T
ait-Girard omputability method [13℄, Chap. 6 (f. also [20℄, pp. 88-92)), along with an
auxiliary notion of \neutral term" and an extended omputability prediate satisfying
CR3 (f. [13℄). All this extends tothe setting here.
5.2. Example. The undeidability ofthe word problem(CohereneProblem)for
equal-ity of arrows in the free artesian losed ategory with (strong) NNO generated by the
empty graph.
Here, the free with strong NNO F an be presented in several ways from term
models:
(i) FollowingPitts[25,8℄(4.2.1)wemayonstrutFfromsimplytypedlambdaalulus
withoutproduttypes(e.g. our languageLabove) asfollows: the objetsof F will
be nite lists of types; arrows will be equivalene lasses of nite lists of terms in
ontext. The Mal'ev equationsguarantee that the NNO isstrong.
(ii) Following Lambek and Sott [20℄, we may onstrut F using our language L with
produt and terminal types; here objets are types, and arrows are equivalene
lasses of termswith at mostone free variable. Again, the Mal'ev equations
guar-antee that the NNOis strong.
In either ase above we know the equational theory so generated is undeidable, so
equality of arrows is too(for the Pitts' onstrution use Theorem 3.10; for the
Lambek-Sott, we use the extension of Theorem 3.10 to produttypes (f. Remark 4.9).
Remarks:
1. Godel'sT (i.e. simplytyped lambdaaluluswith reursors) isknown tobe
deid-able, sine it is CR and SN. We wish to emphasize that the extended theory with
Uniqueness L
red
isundeidable beause of failureof Churh-Rosser, not beause of
failureof SN.
2. We should like to emphasize that simply typed lambda alulus with uniqueness
of iterators (as an equational theory) is a mathematially natural extension of T,
ontainingapurelyequationalequivalenttoindution,andloselyrelatedtofamiliar
theoriesof arithmeti of nite types.
5.3. Example. The equational theory L
red
of typed lambda alulus with Mal'ev's
equations is a natural example of an SN, non-CR, ground-CR, undeidable rewriting
system.
Natural examples of suh theories are not ommon. Suh a theory an provide a
omputationalmodel forfuntionallanguages,sineomputationoftermsofgroundtype
(by normalization) gives unique values. Moreover, L
red
is undeidable, unlike most SN,
CR typed lambda aluli whih only represent a proper sublass of the total reursive
funtions.
L
red
an also be used for veriation of indutive properties: the uniqueness rule for
terms dened by reursion is equivalent to an indution rule, and hene ould be used
as an alternative proof tehnique to traditional indutive arguments. We would like to
5.4. ExtensiontoBrouwerOrdinals. Weshallnowskethhowtoextendthetreatmentto
alargerlassofdatatypes. Suhdatatypessatisfyadomainequation
=A ) , where
the type variable appears ovariantly; in partiular, we onsider 62 A (f. [20, 15℄).
To illustrate, we onsider the data type of Brouwer Ordinals added to the simply type
lambdaaluli L above.
5.5. Definition. The type of Brouwer ordinals Ord is a type with distinguished
on-stants: 0:Ord;S :Ord)Ord; lim:(N)Ord))Ord. The reursor R is dened on
Ordby postulatingthe followingrules:
Rahgx0 = ax (5)
Rahgx(Sy) = hxy(Rahgxy) (6)
Rahgx(lim k) = gxk(z(Rahgx(kz))) (7)
Here: a:A )Ord; h:A)N)Ord; g :A )((N)Ord))(N)Ord));and x:A
. For simpliity we are assuming Rahgx0 is of type Ord, but it ould be of any higher
type.
We wish to remark that this denition is merely the data type of Brouwer ordinals,
and has nothingtodo with set-theoretitransnite reursion.
WeextendouranalysisofLambek'suniquenessonditionsinSetion3asfollows. The
rule U
f;h;g
now has two premisses:
(U
f;h;g )
8x8y[fx(Sy)=hxy(fxy) ℄ 8xk[ fx(lim k)=gxk(z(fx(kz))) ℄
f =Rah
where a=x :A:fx0. Similarly,wehave
(M
f;h;g
) Ra(Hmfh)(H
0
mfg)=f
Here, Hmfh is the same as before, while
H 0
mfg =
def
xku[m(gxku)(gxk(z(fx(kz))))(fx(lim k))℄:
The followingis analagous toLambek'sTheorem 3.3, inSetion 3.
5.6. Theorem. The followingimpliations hold:
(i) M
f;h;g
implies U
f;h;g
(ii) U
f;h 0
;g 0
implies M
f;h;g
where h 0
=Hmfh and g 0
=H 0
mfg .
Proof. Re(i),assumethetwopremisesofU
f;h;g
. Inpartiular,fromtheseondpremise,
fx(limk)=gxk(z(fx(kz))). Therefore, by the property ofthe Mal'ev operatorm and
by the denition of H 0
mfg, we have H 0
mfg =xku(gxku) =g. In the same way, from
Re (ii),below we prove the followingtwo equations:
fx(Sy) = h 0
xy(fxy) (8)
fx(limk) = g 0
xk(z(fx(kz))): (9)
Byusingequations(8)and(9) asthetwopremisses ofU
f;h 0
;g 0
,thenby U
f;h 0
;g 0
f =R ah 0
g 0
;
namely,f =R a(Hmfh)(H 0
mfg),i.e., M
f;h;g
holds.
Sine the proof of (8) is the same as the type N ase in the original
Lam-bek theorem, we prove (9) only: g 0
xk(z(fx(kz))) =
def (H
0
mfg)xk(z(fx(kz))) =
m(gxk(z(fx(kz))))(gxk(z(fx(kz))))(fx(lim k))=fx(lim k), asrequired.
As fortherewriting theoryof thisOrdsystem,the analogofProposition4.1, thatthe
ombinedsystemofrst-orderMal'evrulesandtheOrd-reursorrulesisSNfollowsfrom
a reent theorem of Blanqui, Jouannaud, and Okada [3℄. Letting again L
red
denote this
new languagewith the redution ordering, L
red
is not CRbut isground CRby the same
proof asProposition 4.3. The analogof Theorem 4.5establishing SN similarlyapplies to
this extended language.
Finally,onerning thedisussion inLemma3.9onthe equivalene ofuniqueness and
various formsof indution, the situation is a littlemore omplex here. First we observe
that the Ord-indution rule is:
(Ord Ind)
Fx0=Gx0
[Fxy=Gxy℄
.
.
.
.
Fx(Sy)=Gx(Sy)
[ 8z(Fx(fz)=Gx(fz) ℄
.
.
.
.
Fx(lim f)=Gx(lim f)
F =G
where y and f are eigenvariables.
In order to naturally extend the equivalene in Lemma 3.9, it is neessary to disuss
the omputations used inGoodsteinIndution inthis more general framework. Forthis,
it appears neessary to set up a primitive reursive ordinal notationsystem to represent
+; .
;m, et. in order to simulate (in our now more general system) the basi properties
used in the standard N-ase (f. also the disussion after Theorem 3.6). This appears
routine,but we omitthe detailedveriation here.
Finally, we remark that from a ategorial viewpoint, the datatype Ord makes sense
inany withnatural numbers objetN: it isanobjetOrdwith arrows 1 !Ord;S :
Ord ! Ord;lim : Ord N
! Ord satisfying the appropriate equations (analogous to a
parametrizednatural numbers objet [20, 27℄)
5.7. Remark. Conerning more general indutive data types (f. [7, 3℄) the above
re-sults an be extended under the ondition that we an dene Mal'ev operationson the
data type. In the examples we know, this involves dening some analog of .
(or, for
multipliative operations, ( ) 1
). This is not always easy to do. For example, for the
datatypeoflistsofintegers,`ist(N),thereisnoobvioushoiefor .
. Ontheother hand,
the data type of listsoflength k,`ist
k
(N), doeshave a Mal'ev operatorusing pointwise
subtration: (a ;;a ) .
(b ;;b )=(a .
b ;;a .
Another way to extend these results is simply to postulate a Mal'ev operator, and
the assoiated rewriting rule, ateah type.
Referenes
[1℄ H. P. Barendregt. The Lambda Calulus, North-Holland,1984.
[2℄ J. Bergstra and J. W. Klop, Conditional rewrite rules; onuene and termination.
J. Comput. Systems Si.32 (1986) pp. 323-362.
[3℄ Blanqui, J-P. Jouannaud, and M. Okada. Calulus of Indutive Construtions, in:
RTA99(Rewriting Theory and Appliations), Springer LNCS 1631, pp. 301-316.
[4℄ V.Breazu-TannenandJ.Gallier,Polymorphirewritingonserves algebrai
normal-ization,Theoretial Computer Siene, 83 (1), 1991, pp. 2-28.
[5℄ J.R.B. Cokett and D. Spener. Strong Categorial Datatypes I, Category Theory
1991,Pro.SummerCategoryTheoryMeeting,Montreal,CMSConferene
Proeed-ings v.13, Can. Math. So.(ed. by R.A.G.Seely), 1992.
[6℄ H. Comon, P. Narendran, R. Nieuwenhuis, M. Rusinowith. Deision Problems in
Ordered Rewriting, 13th Annual IEEE Symposium on Logi in Computer Siene
(LICS),1998, pp. 276-286.
[7℄ T. Coquand and C. Paulin-Mohering, Indutively dened types. In P. Martin-Lof
and G. Mints,eds. Pro. Colog '88, LNCS 417, Springer 1990, pp. 50-66
[8℄ D.
Cubri, P. Dybjer and P.J.Sott, Normalization and the Yoneda Embedding,
Math. Strutures in Computer Siene, Camb. U. Press, 8, No.2, 1998, pp. 153-192.
[9℄ N.DershowitzandJ.-P.Jouannaud,RewriteSystems,Handbook ofTheoretial
Com-puter Siene,Chapter 15,North-Holland, 1990.
[10℄ G.Dowek,Theundeidabilityofpatternmathinginaluliwhereprimitivereursive
funtions are representable, TheoretialComputer Siene107 (1993)pp. 349-356.
[11℄ N. Ghani, -equality for oproduts. Typed Lambda Caluli and Appliations,
SLNCS 902, 1995, pp. 171-185.
[12℄ J-Y. Girard,Linear Logi, Theoretial ComputerSiene, 50, 1987.
[13℄ J-Y. Girard,Y.Lafont, and P. Taylor.Proofs and Types, Cambridge Trats in
[15℄ T. Hagino. A ategorial programming language, Phd Thesis, Univ. of Edinburgh
(1987).
[16℄ J-P.Jouannaudand M. Okada, AbstratDataTypeSystems, TheoretialComputer
Siene 173 (1997), pp. 349-391. This is a revised version of an extended abstrat
by the same authors: A omputation Model for Exeutable Higher-Order Algebrai
Speiation Languages, in Logi in Computer Siene (LICS), 1991, Amsterdam,
IEEE Computer So. Press, pp. 350-361..
[17℄ J. Lambek, Cartesian losed ategories and typed -aluli, in: Cousineau, Curien,
and Robinet (eds.), Combinators and funtional programming languages, SLNCS
242 (1986), pp. 136-175.
[18℄ J.Lambek,Onthe Unity ofalgebraandLogi, SLNM1348, CategorialAlgebra and
its appliations,F. Boreux, ed. Springer-Verlag, 1988.
[19℄ J. Lambek, MultiategoriesRevisited. Contemp. Math.92, 1989, pp. 217-239.
[20℄ J.LambekandP.J.Sott.IntrodutiontoHigherOrderCategorialLogi,Cambridge
Studies inAdvaned Mathematis 7, CambridgeUniversity Press, 1986.
[21℄ S. Ma Lane. Categories for the Working Mathematiian, Graduate Texts in
Math-ematis 5,Springer-Verlag, 1971.
[22℄ J. C. Mithell and P. J. Sott,Typed Lambda Models and Cartesian Closed
Cate-gories, Contemp. Math. 92, 1989, pp. 301-316.
[23℄ J. C. Mithell, Foundationsfor Programming Languages,MIT Press, 1996.
[24℄ M. Okada, Strong normalizability of the ombined system of simply typed lambda
alulusand anarbitrary onvergent term rewriting system, Int. Symp. on Symboli
and Algebrai Computation 89, ACM, 1989.
[25℄ A.M.Pitts,CategorialLogi,HandbookofLogiinComputerSieneS.Abramsky,
D. M.Gabbayand T. S.E. Maibaum,eds.Oxford University Press, 1996,Vol.6(to
appear)
[26℄ D. Prawitz. Natural Dedution , Almquist&Wilksell, Stokhom, 1965.
[27℄ L.Roman, CartesianCategories withNatural Numbers Objet, J.Pure and Applied
Algebra 58(1989),pp. 267-278.
[28℄ S. Stenlund, Combinators, lambda terms, and proof theory,D. Reidel, 1972.
[30℄ B. Werner, Une theorie des onstrutionsindutives, These de dotorat, U. Paris 7,
1994.
Department ofPhilosophy, Keio University,
2-15-45Mita, Minatoku,Tokyo,
Japan,108
and
Department ofMathematis, University ofOttawa,
585King Edward, Ottawa,Ont.,
Canada K1N6N5
Email: mitsuabelard.flet.mita.k eio. a.j p and philmathstat.uottawa.a
This artile may beaessed via WWW at http://www.ta.mta.a/ta / orby
tionstomathematialsieneusing ategorialmethods. Thesopeofthejournal inludes: allareasof
pureategorytheory,inludinghigherdimensionalategories;appliationsofategorytheorytoalgebra,
geometry and topology and other areas of mathematis; appliations of ategorytheory to omputer
siene,physisandothermathematialsienes;ontributionstosientiknowledgethatmakeuseof
ategorialmethods.
Artiles appearingin thejournalhavebeenarefullyandritially refereedunder theresponsibility
ofmembersoftheEditorialBoard. Onlypapersjudgedtobebothsigniantandexellentareaepted
forpubliation.
Themethod ofdistributionofthejournalisviatheInternettoolsWWW/ftp. Thejournalisarhived
eletroniallyandin printedpaperformat.
Subsription information. Individual subsribers reeive (by e-mail) abstrats of artiles as they
are published. Full textof published artilesis available in .dvi andPostsriptformat. Detailswill be
e-mailed to new subsribers and are available by WWW/ftp. To subsribe, send e-mail to tamta.a
inludingafullnameandpostaladdress. Forinstitutionalsubsription,sendenquiriestotheManaging
Editor,RobertRosebrugh,rrosebrughmta.a.
Informationfor authors. ThetypesettinglanguageofthejournalisT
E
X,andL a
T
E
Xisthepreferred
avour. T
E
Xsoureofartilesforpubliationshould besubmittedbye-maildiretlyto anappropriate
Editor. They are listed below. Please obtain detailed information on submission format and style
lesfrom thejournal's WWWserveratURL http://www.ta.mta.a/ta/or by anonymousftpfrom
ftp.ta.mta.ain thediretory pub/ta/info. Youmayalso write to tamta.ato reeivedetails
bye-mail.
Editorialboard.
JohnBaez,UniversityofCalifornia,Riverside: baezmath.ur.edu
MihaelBarr,MGillUniversity: barrbarrs.org
LawreneBreen,UniversitedeParis13: breenmath.univ-paris13.fr
RonaldBrown,UniversityofNorthWales: r.brownbangor.a.uk
Jean-LuBrylinski,PennsylvaniaStateUniversity: jlbmath.psu.edu
AurelioCarboni,UniversitadellInsubria: arbonifis.unio.it
P.T.Johnstone,UniversityofCambridge: ptjpmms.am.a.uk
G.MaxKelly,UniversityofSydney: maxkmaths.usyd.edu.au
AndersKok,UniversityofAarhus: kokimf.au.dk
F.WilliamLawvere,StateUniversityofNewYorkat Bualo: wlawvereasu.buffalo.edu
Jean-LouisLoday,UniversitedeStrasbourg: lodaymath.u-strasbg.fr
IekeMoerdijk,UniversityofUtreht: moerdijkmath.ruu.nl
SusanNieeld, UnionCollege: niefielsunion.edu
RobertPare,DalhousieUniversity: paremss.dal.a
AndrewPitts,UniversityofCambridge: apl.am.a.uk
RobertRosebrugh,MountAllisonUniversity: rrosebrughmta.a
JiriRosiky,MasarykUniversity: rosikymath.muni.z
JamesStashe, UniversityofNorthCarolina: jdsharlie.math.un.edu
RossStreet, MaquarieUniversity: streetmath.mq.edu.au
WalterTholen,YorkUniversity: tholenmathstat.yorku.a
MylesTierney,RutgersUniversity: tierneymath.rutgers.edu
RobertF.C.Walters,UniversityofSydney: walters bmaths.usyd.edu.au