This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A...

40

Transcript of This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A...

Page 1: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

This is a preprint of a paper that will appear in the Proceedings of the

1991 Mathematical Foundations of Programming Semantics Conference,

ed. S. Brookes, M. Main, A. Melton, M. Mislove, and D. A. Schmidt, to

be published in the Springer-Verlag Lecture Notes in Computer Science.

Types, Abstraction,

and Parametric Polymorphism,

Part 2�

QingMing Ma and John C. Reynolds

School of Computer Science

Carnegie Mellon University

Pittsburgh, PA 15213-3890, USA

[email protected] [email protected]

Abstract

The concept of relations over sets is generalized to relations over an arbitrary cate-

gory, and used to investigate the abstraction (or logical-relations) theorem, the iden-

tity extension lemma, and parametric polymorphism, for Cartesian-closed-category

models of the simply typed lambda calculus and PL-category models of the poly-

morphic typed lambda calculus. Treatments of Kripke relations and of complete

relations on domains are included.

In [1], the idea that type structure enforces abstraction was formalized by an \abstrac-tion theorem" that was proved for both the simply typed (or �rst-order) lambda calculus

and the polymorphic (or second-order) lambda calculus [2, 3, 4]. In the polymorphic casethis theorem led naturally to a de�nition of \parametric" polymorphism that capturedthe intuitive concept �rst described by Strachey [5]. Unfortunately, however, most of the

results of [1] were limited to a classical set-theoretic model. Thus the abstraction theorem

for the simply typed case was merely a repetition of the logical-relations theorem for thetyped lambda-calculus [6], while the developments for the polymorphic case were vacuous,

since it was later shown that there is no classical set-theoretic model of the polymorphiclambda calculus [7, 8].

�This research was sponsored in part by National Science Foundation Grant CCR-8922109 and in partby the Avionics Lab, Wright Research and Development Center, Aeronautical Systems Division (AFSC),U.S. Air Force, Wright-Patterson AFB, OH 45433-6543 under Contract F33615-90-C-1465, Arpa OrderNo. 7597. The views and conclusions contained in this document are those of the author and should notbe interpreted as representing the o�cial policies, either expressed or implied, of the U.S. Government.

1

Page 2: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

2

In the present paper, we will recast these ideas in a general category-theoretic setting,

using the framework of Cartesian closed categories for the simply typed case and the

framework of PL-categories [9, 10, 11] for the polymorphic case.

Abstraction or logical-relations theorems, parametric polymorphism, and related top-

ics have been explored by a variety of researchers. A comparison with their work is given

in the �nal section of this paper.

We use the category-theoretic notations of [8], except that we write ObK to denote

the class of objects of a category K, and ObF to denote the object part of a functor F .

Also, for Cartesian closed categories, we will extend the exponentiation operator ) to

accept morphisms as well as objects as its righthand argument: If K is a Cartesian closed

category and f 2 k0 ��!K

k00, we write k ===)K

f for the unique morphism from k ��!K

k0 to

k ��!K

k00 such that

(k ) k0)� k

k0

(k ) k00)� k

k00?

ap

?

ap

-(k ) f )� I

-f

commutes in K. (It is well known that k ) (�) is a functor that is the right adjoint of(�)� k.)

1 Syntax

In de�ning the syntax of the polymorphic lambda calculus, we take a slightly unusualview based on [11]. We use natural numbers as type variables, and also regard a naturalnumber as the set of its predecessors, so that each n is both a �nite set of type variables

and the �rst type variable not in that set. Let n be the least family of sets satisfying:

Type Variables If i 2 n then i 2 n :

Functional Types If !, !0 2 n then ! ! !0 2 n :

Polymorphic Types If ! 2 n+1 then �n: ! 2 n :

Then n is the set of type expressions, over the type variables in n, of the second-order or

polymorphic typed lambda calculus (or, if the �nal property is omitted, of the �rst-order

or simply typed lambda calculus).

The novelty here is that the outermost bound type variable of a type expression in n

must be n. This has the advantage that expressions are canonical with respect to alpha

variation, but the disadvantage that n is not a subset of n+1. Instead, for each ! 2 n,there is a corresponding b! 2 n+1 obtained by incrementing each bound variable.

Page 3: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

3

More generally, if ! 2 m and � 2 (n)m then the type substitution !=� 2 n is de�ned

by

i=� = �i

(! ! !0)=� = (!=�)! (!0=�)

(�m: !)=� = �n: (!=[ � j m:n ]) ;

where [� j m:n ] denotes the function with domain dom� [ fmg such that [� j m:n ]k =

if k = m then n else �k. As special cases, if ! 2 n then

b! def= !=Jn�n+1 2 n+1 ;

where Jn�n+1 is the identity injection from n to n+1, and if ! 2 n+1 and !02 n then

!=n! !0def= !=[ In j n:!

0 ] :

For type assignments and ordinary expressions, we treat type variables (but not ordi-nary variables) in the same way. A type assignment � over n is a function from some �nite

set dom� of ordinary variables to n; we write �n for the set of type assignments over

n. Type substitution is de�ned pointwise on type assignments, i.e. (�=�)vdef= (�v)=�. As

with type expressions, we write b� for �=Jn�n+1 and �=n! !0 for �=[ In j n:!0 ].

The typing judgement � `n e : !, that the ordinary expression e has type ! 2 n underthe type assignment � 2 �n, holds i� it can be derived from the following inference rules:

Ordinary Variables

� `n v : �v when v 2 dom�

Applications� `n e1 : ! ! !0 � `n e2 : !

� `n e1 e2 : !0

Abstractions[� j v:! ] `n e : !

0

� `n �v!: e : ! ! !0

Type Applications

� `n e : �n: !

� `n e[!0] : !=n ! !0

when !0 2 n

Type Abstractionsb� `n+1 e : !

� `n �n: e : �n: !

(For the �rst-order typed lambda calculus, the last two rules are omitted.) We write En�!

for the set of ordinary expressions e such that � `n e : !.

The operation of type substitution can also be de�ned for ordinary expressions. If

� `m e : ! and � 2 (n)m then one can de�ne e=� such that (�=�) `n (e=�) : (!=�). (We

omit the de�nition, which is equivalent to that given in [11].) As with type expressions,we write be for e=Jn�n+1 and e=n! !0 for e=[ In j n:!

0 ].

Page 4: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

4

2 The First-Order Case

For the simply typed lambda calculus, semantics is provided by Cartesian closed cate-

gories. For such a category K, the meaning of type expressions and assignments is given

by a family of semantic functions

[[�]]K

n2 (n [ �n)! (ObK)(ObK)n

satisfying:

Type Variables If i 2 n then

[[i]]n� = �i :

Functional Types If !, !0 2 n then

[[! ! !0]]n� = [[!]]n� ===)K [[!0]]n� :

Type Assignments If � 2 �n then

[[�]]n� =YK

v2dom�

[[�v]]n� :

(where k ===)K

k0 denotes the exponentiation of k0 by k), and the meaning of ordinaryexpressions is given by a family

[[�]]Kn�! 2 En�! !Y

�2(ObK)n

�[[�]]Kn � ��!K [[!]]Kn �

satisfying:

Ordinary Variables If � `n v : �v then [[v]]n� �v is the projection morphism

from [[�]]n� =QK

v2dom�[[�v]]n� to [[�v]]n�.

Applications If � `n e1 : ! ! !0 and � `n e2 : ! then

[[e1e2]]n�!0� =D[[e1]]n� !!!0�; [[e2]]n�!�

E; ap ;

whereD[[e1]]n� !!!0�; [[e2]]n�!�

Eis the mediating morphism from [[�]]n� to the

product ([[!]]n� ===)K [[!0]]n�)� [[!]]n�, and ap is the application morphism from

this product to [[!0]]n�.

Abstractions If [� j v:! ] `n e : !0 then

[[�v!: e]]n� !!!0� = ab

�{ ; [[e]]n [�jv:!]!0�

�;

where { is the mediating morphism from [[�]]n��[[!]]n� to [[[� j v:! ]]]n� (whichis an isomorphism when v =2 dom�).

Page 5: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

5

The classical set-theoretic model is obtained by taking K to be SET, the category

of sets and functions. In [1], an abstraction theorem for this model was developed by

introducing an additional semantic function that interprets types as binary relations (or

more generally as relations of some �xed arity). Let ObREL denote the class of binary

relations (anticipating that we will extend this class to a category momentarily), and let

[[�]]RELn

2 (n [ �n)! (ObREL)(ObREL)n

be the semantic function satisfying:

Type Variables If i 2 n then

hx1; x2i 2 [[i]]RELn i� hx1; x2i 2 i :

Functional Types If !, !0 2 n then

hf1; f2i 2 [[! ! !0]]RELn i� (8hx1; x2i 2 [[!]]RELn ) hf1x1; f2x2i 2 [[!

0]]RELn :

Type Assignments If � 2 �n then

h�1; �2i 2 [[�]]RELn i� (8v 2 dom�) h�1v; �2vi 2 [[�v]]

RELn :

Then the �rst-order abstraction theorem of [1] (or the logical-relations theorem of [6]) was

Suppose maps each i 2 n into a binary relation i between the sets �1i and�2i. If � `n e : ! and h�1; �2i 2 [[�]]

RELn then

h[[e]]n�!�1�1; [[e]]n�!�2�2i 2 [[!]]RELn :

In retrospect, it is easy to see how to restate this theorem categorically. One de�nesa category REL whose objects are relations:

hr1; r2; r>i 2 ObREL i�

r1; r2; r> 2 ObSET and r> � r1 � r2 ;

hf1; f2i 2 hr1; r2; r>i ����!RELhr01; r

02; r

0>i i�

f1 2 r1 ! r01 and f2 2 r2 ! r02 and�8hx1; x2i 2 r>

�hf1x1; f2x2i 2 r

0

>;

with componentwise composition and identities, and a forgetful functor U from REL to

SET � SET:

Uhr1; r2; r>i = hr1; r2i and Uhf1; f2i = hf1; f2i :

Then the key to the abstraction theorem is:

Page 6: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

6

The category REL is Cartesian closed, with componentwise products and

hr1; r2; r>i ====)RELhr01; r

0

2; r0

>i = hr1 ! r01; r2 ! r02; hr1; r2; r>i ����!REL

hr01; r0

2; r0

>ii ;

and the functor U is a morphism of Cartesian closed categories (i.e. preserving

products and exponentiations, including terminal objects and projection and

application morphisms).

From a categorical viewpoint, this is all there is to the matter, since the abstraction

theorem becomes a consequence of the fact that a morphism of Cartesian closed categories

preserves the meaning of the simply typed lambda calculus:

Proposition 1 If U is a morphism of Cartesian closed categories from R to

K and

n ObR

ObK

-

@@@@@@R

?

ObU

commutes, then both

n [ �n ObR

ObK

QQQQQQQQs

[[�]]Kn �

?

ObU

-[[�]]Rn

and

En�! [[�]]Rn ��!R

[[!]]Rn

[[�]]Kn � ��!K [[!]]Kn �

HHHHHHHHHHj

[[�]]Kn�!�

?

MorU

-[[�]]Rn�!

commute.

Proof : This is often proved by constructing a free Cartesian closed category from equiva-lence classes of typed lambda expressions (as in [12]). A more elementary approach is to

use structural induction on type expressions for the left diagram and on ordinary expres-

sions for the right diagram. (End of Proof )

Now we can ask how to generalize REL beyond relations on sets. The �rst step is to

realize that an equivalent reformulation of REL and U is given by replacing each subsetr> � r? by a monic (i.e. injective) function whose image is that subset:

hr1; r2; r>; r#i 2 ObREL i�

r1; r2; r> 2 Ob SET; and r# 2 r> ! r1 � r2 is monic ;

Page 7: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

7

hf1; f2; f>i 2 hr1; r2; r>; r#i ����!RELhr01; r

02; r

0>; r0

#i i�

f1 2 r1 ! r01 and f2 2 r2 ! r02 and f> 2 r> ! r0>

and

r>

r1 � r2?

r#

r0>

r01 � r02

?

r0#

-f>

-f1 � f2

commutes in SET,

with componentwise composition and identities, and

Uhr1; r2; r>; r#i = hr1; r2i and Uhf1; f2; f>i = hf1; f2i :

The essential idea is that hx1; x2i belongs to the relation hr1; r2; r>; r#i i� there is a \wit-ness" z 2 r> such that hx1; x2i = r#z. Then in the morphism hf1; f2; f>i, the existence

of the function f> insures that related arguments hx1; x2i are mapped into related resultshf1x1; f2x2i since f> maps a witness to hx1; x2i into a witness to hf1x1; f2x2i.

In this formulation, except for the monicity requirement, REL is simply a commacategory. (Requiring the r# to be monic has little importance in the �rst-order case, butwill be vital for dealing with polymorphism.) This suggests the following generalization:

De�nition Let K and B be categories and F be a functor from K to B.Then REL(K;B;F ), called a category of relations over K, is the category suchthat:

hr?; r>; r#i 2 ObREL(K;B;F ) i�

r? 2 ObK;r> 2 ObB; and r# 2 r> ��!B Fr? is monic ;

hf?; f>i 2 hr?; r>; r#i ����������!REL(K;B;F )hr0

?; r0

>; r0

#i i�

f? 2 r? ��!K r0?and f> 2 r> ��!B r0

>

and

r>

Fr?

?

r#

r0>

Fr0?

?

r0#

-f>

-Ff?

commutes in B,

with componentwise composition and identities, and U is the functor from

REL to K such that

U hr?; r>; r#i = r? and Uhf?; f>i = f? :

Page 8: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

8

(Notice that the monicity condition on r0#insures that U is a faithful functor.) This

generalization includes our previous REL as the category REL(SET�SET;SET;��SET�)

of binary relations over SET. But the crucial test of the generalization is that, under

reasonable conditions, one has a Cartesian closed structure:

Proposition 2 If K and B are Cartesian closed, B has pullbacks, and F

preserves �nite products, then REL(K;B;F ) is Cartesian closed and U is a

morphism of Cartesian closed categories.

(Note that F need not be a morphism of Cartesian closed categories.)

Proof : The reader may verify that products can be de�ned componentwise. To de�ne

exponentiation, suppose r and r0 are relations, i.e. objects of R = REL(K;B;F ). Since

B is Cartesian closed, we can de�ne t to be the unique morphism such that

F (r? ===)K

r0?)� r>

F (r? ===)K

r0?)� Fr?

(r> ==)B

Fr0?)� r>

Fr0?

?

I � r#

?

ap

-t� I

-F ap

(1)

commutes inB. (To keep the proof straightforward, we are assuming here that F preserves

distinguished products.) We also introduce r> ==)B

r0#, which is the unique morphism such

that

(r> ==)B

r0>)� r>

r0>

(r> ==)B

Fr0?)� r>

Fr0?

?

ap

?

ap

-(r> ==)

Br0#)� I

-r0#

(2)

commutes. Since r0#is monic, r> ==)

Br0#is monic, for if f1 ; (r> ==)

Br0#) = f2 ; (r> ==)

Br0#)

then

(f1 � I) ;�(r> ==)

Br0#)� I

�; ap = (f2 � I) ;

�(r> ==)

Br0#)� I

�; ap

(f1 � I) ; ap ; r0#= (f2 � I) ; ap ; r0

#by 2

(f1 � I) ; ap = (f2 � I) ; ap since r0#is monic

and f1 = f2 by the uniqueness property for exponentiation.

Next we de�ne the exponentiation r ==)R

r0, along with a morphism u, to be the

pullback(r ==)

Rr0)>

F�(r ==)

Rr0)?

def= r? ===)

Kr0?

r> ==)B

r0>

r> ==)B

Fr0?

?

(r ==)R

r0)#

?

r> ==)B

r0#

-u

-t

(3)

Page 9: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

9

Because this is a pullback and r> ==)B

r0#is monic, (r ==)

Rr0)# is monic (see [13, Section

1.6, Lemma 2]). Moreover, since

�(r ==)

Rr0)# � r#

�; F ap

=�(r ==)

Rr0)# � I

�; (I � r#) ; F ap

=�(r ==)

Rr0)# � I

�; (t� I) ; ap by 1

= (u� I) ;�(r> ==)

Br0#)� I

�; ap by 3

= (u� I) ; ap ; r0#; by 2

the following diagram commutes and can be used to de�ne the application morphism

apRrr0:

(r ==)R

r0)> � r>

F (r? ===)K

r0?)� Fr?

r0>

Fr0?

(r> ==)B

r0>)� r>

����1u� I PPPPPPq

ap

?

(r ==)R

r0)# � r#

?

r0#

-

(apRrr0)>def= (u� I) ; ap

-F�(apRrr0)?

def= ap

K�

(4)

Now suppose r is any object of R and f = hf?; f>i 2 r � r ��!Rr0, so that

r> � r>

F (r? � r?)

r0>

Fr0?

?

r# � r#

?

r0#

-f>

-Ff?

(5)

Then

�(r# ; F (ab

K f?) ; t)� I�; ap

= (r# � I) ;�F (abK f?)� I

�; (t� I) ; ap

= (r# � I) ;�F (abK f?)� I

�; (I � r#) ; F ap by 1

= (r# � r#) ;�F (abK f?)� I

�; F ap

= (r# � r#) ; F�(abK f? � I) ; ap

= (r# � r#) ; Ff? by de�nition of ab

= f> ; r0

#by 5

= (abB f> � I) ; ap ; r0#

by de�nition of ab

Page 10: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

10

= (abB f> � I) ;�(r> ==)

Br0#)� I

�; ap by 2

=�(abB f> ; (r> ==)

Br0#))� I

�; ap ;

so by the uniqueness property of exponentiation, the perimeter of

(r ==)R

r0)>

F (r? ===)K

r0?)

r> ==)B

r0>

r> ==)B

Fr0?

r>

F r?

?

(r ==)R

r0)#

?

r> ==)B

r0#

-u

-t

?

r#

@@@@R

F (abK f?)

PPPPPPPPPPPPPq

abB f>@

@@@R

g>

(6)

commutes and is a cone for the pullback in Diagram 3.

Finally, we note that g is a morphism in r ��!R

(r ==)R

r0) that makes

r � r (r ==)R

r0)� r

r0?

apR

QQQQQQQQQs

f

-g � I

(7)

commute in R i� g = hg?; g>i, where

r>

F r?

(r ==)R

r0)>

F (r ==)R

r0)??

r#

?

(r ==)R

r0)#

-g>

-Fg?

r? � r? (r? ===)K

r0?)� r?

r0?

?

apK

QQQQQQQQs

f?

-g? � Ir> � r> (r ==)

Rr0)> � r>

r0>

?

(apRrr0)>

QQQQQQQQs

f>

-g> � I

all commute. But the middle diagram is equivalent to g? = abK f?, which makes the left

diagram equivalent to the parallelogram on the left of 6, and, by 4, the right diagram is

equivalent to f> = ((g> ; u)� I) ; apB, which is equivalent to abB f> = g> ; u, which is the

triangle in 6. Thus all three diagrams commute i� g? = abK f? and g> is the mediating

morphism in 6. Thus the uniqueness of the mediating morphism for pullbacks makesthe solution of 7 unique, and it follows that R = REL(K;B;F ) is Cartesian closed with

abR f = g.

From (r ==)R

r0)? = (r? ===)K

r0?) and (apRrr0)? = ap

Kr?r

0?, and similar properties of the

componentwise product, it is evident that U is a morphism of Cartesian closed categories.

(End of Proof )

From Propositions 1 and 2, we have the following \abstract" version of the abstraction

theorem:

Page 11: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

11

Proposition 3 Suppose R = REL(K;B;F ), where K and B are Cartesian

closed, B has pullbacks, and F preserves �nite products. Let U be the forgetful

functor from R to K . If e 2 En�! , 2 (ObR)n, and � = ; ObU 2 (ObK)n,

then there is a unique

g 2 [[�]]R

n ��!R

[[!]]R

n

such that

[[e]]K

n�!� = Ug :

Proof : Let g = [[e]]R

n�! . Since U is faithful, g is unique. (End of Proof )

At �rst sight, it might appear that this proposition is limited to unary relations. But

multinary relations are encompassed by taking K to be a product of Cartesian closed

categories (which will also be Cartesian closed). Speci�cally, relations of arity a over

K1; . . . ;Ka are the objects of

REL�K1 � � � � �Ka; B; F1(�1)�B � � � �B Fa(�a)

�;

where each Fi is a �nite-product-preserving functor from Ki to B. When dealing with

such categories of multinary relations, we will write Ui for the composition of the functorU with the projection functor from K1 � � � � �Ka to Ki.

As a special case, relations of arity a over a single category K are the objects of

REL�Ka;B; F (�1)�B � � � �B F (�a)

�;

where F is a �nite-product-preserving functor from K to B. Since it will eventually bepertinent to our discussion of parametricity, we give here the specialization of Proposition3 to this case:

Proposition 4 Suppose R = REL(Ka; B; F (�1)�B � � � �B F (�a)), where Kand B are Cartesian closed, B has pullbacks, and F preserves �nite products.

If e 2 En�!, 2 (ObR)n, and, for all i 2 a, �i = ; ObU i 2 (ObK)n, thenthere is a unique

g 2 [[�]]Rn ��!R

[[!]]Rn

such that

h[[e]]K

n�!�1; . . . ; [[e]]K

n�!�ai = Ug :

In the case of multinary relations over a single category, we can introduce the concept

of identity relations. Speci�cally, we can de�ne a functor J mapping each object k of Kinto the identity relation on k:

De�nition Given a category R = REL(Ka; B; F (�1) �B � � � �B F (�a)) ofrelations of arity a over K, we write J for the functor from K to R such that

Jk = hhk; . . . ; ki; Fk;DIFk; . . . ; IFk

Ei ;

whereDIFk; . . . ; IFk

Eis the mediating morphism from Fk to Fk�B � � ��BFk =

(Fk)a, and

Jf = hhf; . . . ; fi; Ffi ;

Page 12: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

12

or diagrammatically,

Fk

(Fk)a

Fk0

(Fk0)a?

DIFk; . . . ; IFk

E

?

DIFk0; . . . ; IFk0

E

-Ff

-(Ff )a

In [1], the set-theoretic relational semantics of the simply typed lambda calculus was

shown to satisfy a further proposition, called the \Identity Extension Lemma", that any

type expression denotes an identity relation if its free type variables all denote identity

relations. In the present setting, this result follows from proposition that, under reasonable

conditions that are somewhat more stringent than for the abstraction theorem, J is amorphism of Cartesian closed categories. Speci�cally:

Proposition 5 IfK and B are Cartesian closed, B has pullbacks, F preserves�nite products, and either a = 1 or abB(F ap

Kkk0) is monic for all k; k0 2 ObK,

then J is a morphism of Cartesian closed categories, and the compositions

K REL�Ka; B; F (�1)�B � � � �B F (�a)

�K-J -Ui

are identity functors.

Proof : The only nonobvious argument is to show that J preserves exponentiations andapplication morphisms. Let R = REL(Ka;B; F (�1) �B � � � �B F (�a)), r = Jk, andr0 = Jk0. We want to show that (r ==)

Rr0) = J(k ===)

Kk0) and ap

Rrr0 = J ap

Kkk0 .

In the construction of the proof of Proposition 2, Diagram 1 becomes

�F (k ===)

Kk0)�a� Fk

�F (k ===)

Kk0)�a� (Fk)a

�Fk ==)

B(Fk0)a

�� Fk

(Fk0)a�F (k ===)

Kk0) � Fk

�a?

I �DI; . . . ; I

E

?

ap

-t� I

-' -(F ap)a

(8)

(where the isomorphism ' arises because, although the functor F (�1) �B � � � �B F (�a)

preserves products, it does not preserve distinguished products), and the pullback of

Diagram 3 becomes

(r ==)R

r0)>

�F (k ===)

Kk0)�a

Fk ==)B

Fk0

Fk ==)B

(Fk0)a?

(r ==)R

r0)#

?

Fk ==)B

DI; . . . ; I

E

-u

-t

(9)

Page 13: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

13

We will show that this pullback condition is satis�ed by

F (k ===)K

k0)

�F (k ===)

Kk0)�a

Fk ==)B

Fk0

Fk ==)B

(Fk0)a?

DI; . . . ; I

E

?

Fk ==)B

DI; . . . ; I

E

-ab(F ap)

-t

(10)

This implies that, to within an isomorphism, r ==)R

r0 is the left side of Diagram 10, which

is J(k ===)K

k0), and u = abB(F ap

Kkk0). Then Diagram 4 gives (apRrr0)> = (u�I) ;apBFk;Fk0 =

F apKkk0 and (apRrr0)? = hapKkk0 ; . . . ; ap

Kkk0i, which implies apRrr0 = J ap

Kkk0 .

To show that Diagram 10 commutes, let pi denote the ith projection morphism forvarious a-ary products in B. Then (using various properties of products) we have

�(t ; (Fk ==)

Bpi))� I

�; ap

= (t� I) ;�(Fk ==)

Bpi)� I

�; ap

= (t� I) ; ap ; pi by de�nition of Fk ==)B

(�)

=�I �

DI; . . . ; I

E�;' ; (F ap)a ; pi by 8

=�I �

DI; . . . ; I

E�;' ; pi ; F ap

=�I �

DI; . . . ; I

E�; (pi � pi) ; F ap

= (pi � I) ; F ap

= (pi � I) ;�ab(F ap)� I

�; ap by de�nition of ab

=�(pi ; ab(F ap))� I

�; ap ;

so that the uniqueness property of exponentiation gives

t ; (Fk ==)B

pi) = pi ; ab(F ap) :

More simply, the functorial nature of Fk ==)B

(�) gives

�Fk ==)

B

DI; . . . ; I

E�; (Fk ==)

Bpi) = Fk ==)

B

�DI; . . . ; I

E; pi

�= I :

Since the functor Fk ==)B

(�) is a right adjoint, it preserves products, so that theFk ==)

Bpi are projections. Thus Diagram 10 commutes i� its composition with each of the

Fk ==)B

pi commutes, which follows from the above equations for t and Fk ==)B

DI; . . . ; I

E.

Page 14: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

14

Finally, to complete the argument that Diagram 10 is a pullback, consider

F (k ===)K

k0)

�F (k ===)

Kk0)�a

Fk ==)B

Fk0

Fk ==)B

(Fk0)a

b

?

DI; . . . ; I

E

?

Fk ==)B

DI; . . . ; I

E

-ab(F ap)

-t

AAAAAAAAAAAU

g

PPPPPPPPPPPPPPPPq

f@@@@@R

h

(11)

and assume the perimeter commutes. Composing the perimeter with Fk ==)B

pi and using

the equations for t and Fk ==)B

DI; . . . ; I

Egives

b

F (k ===)K

k0)

Fk ==)B

Fk0

?

g ; pi

-f

��������3

ab(F ap) (12)

Since ab(F ap) is monic (or trivially in the case of unary relations) the g ; pi are equal.Then the lefthand triangle in 11 commutes i� h = g ; pi, and this equation and 12 implythat the upper triangle in 11 commutes. Thus g ; pi is the unique mediating morphism in

Diagram 11. (End of Proof )

The identity extension lemma is an immediate consequence of this result and Propo-sition 1 (with R and K interchanged):

Proposition 6 Let R = REL(Ka; B; F (�1) �B � � � �B F (�a)). If K andB are Cartesian closed, B has pullbacks, F preserves �nite products, andeither a = 1 or ab

B(F apKkk0) is monic for all k; k0 2 ObK, then, whenever

! 2 n [ �n is a type or type assignment of the �rst-order typed lambdacalculus and � 2 (ObK)n,

[[!]]Rn (� ; J) = ([[!]]Kn �) ; J :

3 The Second-Order Case

We will develop the semantics of the polymorphic typed lambda calculus in the framework

of PL categories [9, 10, 11]. To ease the introduction of this highly abstract framework,we proceed in two stages: Before de�ning the full- edged PL categories that are needed

for the second-order case, we de�ne \pre-PL" categories, which give a more abstract

Page 15: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

15

semantics to the simply typed lambda calculus with type variables than that given in

Section 2.

The idea behind pre-PL categories is that type and ordinary expressions in n type

variables have abstract meanings in a Cartesian closed category Kn, which are obtained

directly without any application to assignments of objects to type variables. However,

such assignments induce relationships between the di�erent Kn: For any assignment � 2

(ObKn)m, there is a morphism of Cartesian closed categories K� from Km to Kn that

describes the e�ect of substituting (a type expression whose meaning is) �i for each type

variable i in m.

The rest of the story is that the sets n of type variables and the assignments � can be

organized into a base category jKj that is a Lawvere theory [14, 15] of type expressions, and

that K itself then becomes a functor from jKjop

to the large category CCC of Cartesian

closed categories (i.e. a model of the theory jKj in CCC). Thus we have:

De�nition A pre-PL category K = hjKj;Ki consists of a base category jKjsuch that

� Ob jKj is the set of natural numbers,

� 0 is terminal and + is a binary product, so that n is the nth power of 1,

� IjKjn i is the ith projection morphism from n to 1 (applied to the unique

member of the set 1),

and a functor K from jKjop

to CCC such that

jKjop CCC

CLASSCLASS?

Ob

-K

?

HomjKj(�;m)

� (�)m

(13)

(Here CLASS is the large category of classes and functions.) Applying the functors in the

above diagram to n 2 Ob jKj gives

n ���!jKj

m = (ObKn)m :

Note that a member of this set can be composed in two ways: either as a morphism

in jKj or as an ordinary function (from m to ObKn). The relationship between these

two composition operators is obtained by applying the functors in the above diagram to� 2 n1 ���!jKj n2 and then applying the results to �0 2 n2 ���!jKj m, which gives

� ;jKj �0 = �0 ; Ob(K�) : (14)

Also note that the application I jKjn i makes sense when i 2 n, since I jKjn 2 n ���!jKj

n =

(ObKn)n.

Page 16: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

16

Each pre-PL category K determines an abstract meaning of the simply typed lambda

calculus, as opposed to the concrete meanings described in Section 2. Speci�cally, the

abstract meaning of type expressions and assignments is given by a family of semantic

functions

hh�iiK

n2 (n [ �n)! ObKn

satisfying:

Type Variables If i 2 n then

hhiiin = IjKjn i :

Functional Types If !, !0 2 n then

hh! ! !0iin = hh!iin ===)Knhh!0iin :

Type Assignments If � 2 �n then

hh�iin =YKn

v2dom�

hh�viin :

and the abstract meaning of ordinary expressions is given by a family

hh�iiKn�! 2 En�! !�hh�iiKn ���!Kn hh!iiKn

satisfying:

Ordinary Variables If � `n v : �v then hhviin� �v is the projection morphismfrom hh�iin =

QKnv2dom�hh�viin to hh�viin.

Applications If � `n e1 : ! ! !0 and � `n e2 : ! then

hhe1e2iin�!0 =Dhhe1iin� !!!0 ; hhe2iin�!

E; ap ;

whereDhhe1iin� !!!0; hhe2iin�!

Eis the mediating morphism from hh�iin to the

product (hh!iin ===)Knhh!0iin)� hh!iin, and ap is the application morphism from

this product to hh!0iin.

Abstractions If [� j v:! ] `n e : !0 then

hh�v!: eiin� !!!0 = ab

�{ ; hheiin [�jv:!]!0

�;

where { is the mediating morphism from hh�iin � hh!iin to hh[� j v:! ]iin.

As in [11], one can show that these abstract semantic functions (and their extensions

to the second-order case) satisfy a substitution law:

Page 17: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

17

Proposition 7 Suppose ! 2 m, � 2 �m, e 2 Em�!, and � 2 (n)m. Then

hh!=�iin = K(�i 2 m: hh�iiin)hh!iim

hh�=�iin = K(�i 2 m: hh�iiin)hh�iim

hhe=�iin (�=�) (!=�) = K(�i 2 m: hh�iiin)hheiim�! :

As a special case, hhb�iin+1 = �nhh�iin, where

�ndef= K(�i 2 n: hhiiin+1) = K(�i 2 n: I

jKj

n+1i) = K(Jn�n+1 ; IjKj

n+1) ; (15)

and Jn�n+1 is the identity injection from n to n+ 1. (It is easily seen that Jn�n+1 ; IjKj

n+1

is the mediating morphism from the product n+ 1 to n.)

Now consider what must be added to the above semantic equations to give meaning tothe polymorphic calculus. For each type ! 2 n+1, there is a polymorphic type �n: ! 2

n. Thus there should be a function �n from ObKn+1 to ObKn such that

Polymorphic Types If ! 2 n+1 then

hh�n: !iin = �nhh!iin+1 :

For each ordinary expression e satisfying b� `n+1 e : ! there is a type abstraction �n: esatisfying � `n �n: e : �n: !. Thus there should be a function tabn from

hhb�iin+1 ����!Kn+1hh!iin+1 = �nhh�iin ����!Kn+1

hh!iin+1

tohh�iin ���!Kn hh�n: !iin = hh�iin ���!Kn �nhh!iin+1

such that

Type Abstractions If b� `n+1 e : ! then

hh�n: eiin��n:! = tabnhheiin+1b� ! :

Moreover, one can argue that the soundness of �-type-reduction requires tabn to be in-jective, and the soundness of �-type-reduction requires tabn to be surjective. Thus it isnatural to require �n to be a right adjoint of �n. This motivates the following de�nition:

De�nition A PL category K = hjKj;K;�Ki consists of

� A pre-PL category hjKj;Ki,

� A natural transformation �K2 K(� + 1) ���������!

jKjop)CAT

K such that each

�Kn is a right adjoint of �Kn = K(�i 2 n: I

jKj

n+1i) and, for all � 2 n ���!jKj

m,

K(� + 1);K� is a map of adjunctions [16, Section IV.7] from �m;�m to

�n;�n.

Page 18: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

18

Here + denotes the product functor for jKj. It can be shown that

� + 1 = [� ; Ob�n j m: IjKjn+1n ] : (16)

We write tapn for the counits and tabn for the isomorphisms of the adjunctions. As is

well known [16, Section IV.1, Theorem 2(iv)], each adjunction is completely determined

by giving, for each k0 2 ObKn+1, an object �nk02 ObKn and a morphism tapn k

02

�n(�nk0) ����!

Kn+1k0 such that, for all k 2 ObKn and f 0 2 �nk ����!Kn+1

k0, there is a unique

morphism tabn f02 k ���!

Kn�nk

0 making

�nk

�n(�nk0) k0

?

�n(tabn f0)

QQQQQQQQQs

f 0

-tapn k

0

(17)

commute in Kn+1. Moreover, for � 2 n ���!jKj

m, since K� ; �n = �m ;K(� + 1) holds for

any pre-PL category, it can be shown that a su�cient condition for K(�+ 1);K� to be amap of adjunctions is that

K�(�mk0) = �n

�K(�+ 1)k0

K(� + 1)(tapm k0) = tapn

�K(� + 1)k0

should hold for all k0 2 ObKm+1.

Given a PL category, the abstract semantics of the second-order typed lambda calculusis determined by the semantic equations we have given above, plus

Type Applications If � `n e : �n: ! and !0 2 n then

hhe[!0]iin� (!=n!!0) = hheiin��n:! ;Kn KDIjKjn ; hh!0iin

E�tapnhh!iin+1

�;

whereDIjKjn ; hh!0iin

Eis the mediating morphism in n ���!

jKjn+1 (regarding n+1

as the product of n and 1).

(This semantic equation can be derived from the substitution law and the soundness of�-type-reduction.)

Next, we introduce morphisms of pre-PL and PL categories:

De�nition A pre-PL morphism U = hjUj;Ui from R to K consists of a

product-preserving functor jUj from jRj to jKj that is an identity on objects,

and a natural transformation

U 2 R ���������!jRjop)CCC

jUj ;K

Page 19: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

19

that satis�es

jUj� = � ; ObUn

for all � 2 n ���!jRj

m = (ObRn)m.

A PL morphism U = hjUj;Ui from R to K is a pre-PL morphism such that,

for each n, the pair Un+1;Un is a map of adjunctions from �Rn ;�

Rn to �K

n ;�Kn .

Since the naturality of U implies Un ; �Kn = �R

n ; Un+1, it can be shown that a su�cient

condition for Un+1;Un to be a map of adjunctions is that

Un(�Rn r

0) = �Kn (Un+1r

0)

Un+1(tapRn r

0) = tapKn (Un+1r

0)

should hold for all r0 2 Rn+1.

Either pre-PL or PL categories, along with the corresponding morphisms, form acategory. In both cases, the composition of U with U 0 is hjU 00j;U 00i, where jU 00j is thefunctorial composition jUj ; jU 0j and each U 00

n is the functorial composition Un ; U0jUjn (or

more simply, Un ;U0n, since jUj is an identity on objects), and the identity on K is hIjKj;Ii,

where IjKj is the identity functor on jKj and each In is the identity functor on Kn.

As one might expect, PL morphisms preserve abstract semantics:

Proposition 8 If U is a PL morphism (or in the �rst-order case, a pre-PL

morphism), then both

n [ �n ObRn

ObKn

QQQQQQQQs

hh�iiKn

?

ObUn

-hh�iiRn

and

En�! hh�iiRn ���!Rn hh!ii

Rn

hh�iiKn ���!Kn hh!ii

Kn

HHHHHHHHHHj

hh�iiKn�!

?

MorUn

-hh�iiRn�!

commute.

Proof : This was originally proved by Seely [9]. A more elementary approach is to use

structural induction on type expressions for the left diagram and on ordinary expressionsfor the right diagram. (End of Proof )

From the abstract semantic functions hh�ii�, we can de�ne concrete semantic functions,akin to those of Section 2, that give to all expressions meanings in the category K0 (which

plays the same role as K did previously). We de�ne

[[�]]Kn2 (n [ �

n)! (ObK0)(ObK0)

n

[[�]]Kn�! 2 En�! !Y

�2(ObK0)n

�[[�]]Kn � ��!K0

[[!]]Kn ��

Page 20: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

20

by

[[!]]Kn � = K�hh!ii

Kn

[[e]]Kn�!� = K�hheii

Kn�! :

(18)

Using this de�nition and taking K = K0, one can derive the concrete semantic equations

given in Section 2. Thus, in the �rst-order, pre-PL case the [[�]]K� de�ned here coincide

with the the [[�]]K

� de�ned earlier. In the second-order case, however, the concrete seman-

tics must be de�ned in terms of the abstract semantics, since one cannot give semantic

equations directly for the concrete semantics of the additional constructions.

Nevertheless, one can prove the obvious generalization of Proposition 1:

Proposition 9 If U is a PL morphism (or, in the �rst-order case, a pre-PL

morphism) from R to K and

n ObR0

ObK0

-

@@@@@@R

?

ObU0

commutes, then both

n [ �n ObR0

ObK0

QQQQQQQQs

[[�]]Kn �

?

ObU0

-[[�]]Rn

and

En�! [[�]]Rn ���!R0[[!]]Rn

[[�]]Kn � ��!K0[[!]]Kn �

HHHHHHHHHHj

[[�]]Kn�!�

?

MorU0

-[[�]]Rn�!

commute.

Proof : From Proposition 8, using the naturality of U . (End of Proof )

Just as the key to the �rst-order abstraction theorem was to show that categories of

relations are Cartesian closed, so the key in the second-order case is to show that such

categories can be extended to PL categories. As a �rst step, we consider the extension to

pre-PL categories:

Proposition 10 Suppose K is a pre-PL category, R is a Cartesian closed

category, and U is a morphism of Cartesian closed categories from R to K =K0. Then there is a pre-PL category R and a pre-PL morphism U from R to

K such that R = R0 and U = U0.

Page 21: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

21

Proof : Intuitively, the essence of constructing R and U is that the naturality of U requires

Rn

Kn

?

Un

R0 = R

K0 = K?

U0 = U

-R

-K(jUj ) = K( ; ObU )

to commute for all 2 0 ���!jRj

n = (ObR)n. Since this requires each Rn to be a certain

kind of cone, we de�ne it to be the limiting cone.

This leads to the following construction, in which the objects and morphisms of the

Rn are pairs:

� The category Rn is such that hk; ri 2 ObRn i�

k 2 ObKn and r 2 (ObR)(ObR)n

and (8 2 (ObR)n) K( ; ObU)k = U (r )

and hf ;gi 2 hk; ri ���!Rn

hk0; r0i i�

f 2 k ���!Kn

k0 and g 2 r �������!R(ObR)n

r0 and (8 2 (ObR)n) K( ; ObU)f = U (g ) ;

with composition and identities de�ned by pointwise extension from Kn and R.

� For � 2 n ���!jRj

m = (ObRn)m, the functor R� from Rm to Rn is such that

R�hk; ri = hK��i 2 m: (�i)1

�k; � 2 (ObR)n: r

��i 2 m: (�i)2

�i (19)

when hk; ri is either an object or morphism of Rm.

� For all i 2 n,IjRjn i = hIjKjn i; � 2 (ObR)n: ii : (20)

� Un is the functor such that

Unhk; ri = k ; (21)

when hk; ri is either an object or morphism of Rn.

� For all � 2 n ���!jRj

m,

jUj� = �i 2 m: (�i)1 : (22)

We leave it to the reader to check that these entities have the required properties.

(End of Proof )

The further extension to PL categories requires an additional assumption about the

relation categories:

Page 22: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

22

De�nition We say that R = REL(K;B;F ) is suitable for polymorphism

when, for each r? 2 ObK, r 2 (ObR)ObR, and f 2Q�2ObR r? ��!K (r�)?, there

is a limit r>, r#, g that makes

r> (r�)>

Fr? F (r�)?

-g�

-F (f�)?

r#

?

(r�)# (23)

commute in B for all � 2 ObR.

(It is easily shown that the monicity of the (r�)# implies the monicity of r#, so that the

left side of this diagram is an object of R.)

One might expect suitability for polymorphism to be rare since � ranges over the entireclass ObR. But this di�culty is neutralized by the monicity of the (r�)#. For example,REL(K;B;F ) is suitable for polymorphism whenever B is SET , for then one can taker> to be the set of x 2 Fr? such that, for all � 2 ObR, F (f�)x belongs to the image of(r�)#. Then r#x = x, and g�x is the unique x0 2 (r�)> such that (r�)#x

0 = F (f�)x.

Using the assumption of suitability for polymorphism, we obtain:

Proposition 11 Suppose K is a PL category, R = REL(K0; B;F ) is a Carte-sian closed category that is suitable for polymorphism, and the forgetful func-tor U from R to K = K0 is a morphism of Cartesian closed categories. Thenthere is a PL categoryR and a PL morphism U fromR to K such that R = R0

and U = U0.

Proof : Much of the argument that follows will be quanti�ed over the variables 2 (ObR)n

and � 2 ObR. In such contexts, we will use the following abbreviations:

def= ; ObU 0

def= [ j n: � ] 0

def= 0 ; ObU = [ j n:U� ] :

Let jRj, R, jUj, and U be as in the proof of Proposition 10. If hk; ri is an objector morphism of Rn then, for all 2 (ObR)n, (r )? = U (r ) = K k. Thus an object

hk; ri 2 ObRn is exactly speci�ed by giving k 2 ObKn and, for each 2 (ObR)n, (r )> 2

ObB and (r )# 2 (r )> ��!B F (K k). Similarly, a morphism hf ;gi 2 hk1; r1i ���!Rn hk2; r2i

is exactly speci�ed by giving f 2 k1 ���!Kn k2 and, for each 2 (ObR)n, a morphism (g )>making

(r1 )> (r2 )>

F (K k1) F (K k2)

?

(r1 )#

?

(r2 )#

-(g )>

-F (K f )

(24)

Page 23: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

23

commute in B.

Now suppose 2 (ObR)n and � 2 ObR. Then, whenever hk; ri is an object or

morphism of Rn, by Equations 15, 19, and 20,��Rn hk; ri

�2 0 =

�R(�i 2 n: I

jRjn+1i)hk; ri

�2 0 =

r��i 2 n: (I

jRjn+1i)2

0�= r(�i 2 n: 0i) = r ;

(25)

and thus

K 0��Rn hk; ri

�1= U

�(�R

n hk; ri)2 0�= U(r ) = K k : (26)

Our �rst task is to specify, for each hk0; r0i 2 ObRn+1, the object �Rn hk

0; r0i 2 ObRn

and the morphism tapRn hk0; r0i 2 �R

n (�Rn hk

0; r0i) �����!Rn+1

hk0; r0i. The �rst components of

these entities are determined by Equation 21 and the requirement that U must preserve

adjunctions:

(�Rn hk

0; r0i)1 = Un(�Rn hk

0; r0i) = �Kn (Un+1hk

0; r0i) = �Knk

0

(tapRn hk0; r0i)1 = Un+1(tap

Rn hk

0; r0i) = tapKn (Un+1hk

0; r0i) = tapKn k

0 :

To complete the speci�cation, we note that ((tapRn hk0; r0i)2

0)> must satisfy a diagramsimilar to 24. Using Equations 25 and 26 to eliminate the occurrences of �R

n , we �nd that

�(�R

n hk0; r0i)2

�>

(r0 0)>

F�K (�K

nk0)�

F (K 0k0)

?

�(�R

n hk0; r0i)2

�#

?

(r0 0)#

-

�(tapRn hk

0; r0i)2 0�>

-F�K 0(tapKn k

0)�

(27)

must commute inB for all 2 (ObR)n and � 2 ObR. To insure this, for each 2 (ObR)n,we specify ((�R

n hk0; r0i)2 )>, ((�

Rn hk

0; r0i)2 )#, and ��: ((tapRn hk

0; r0i)2 0)> to be the limit

that makes Diagram 27 commute for all � 2 ObR. (The existence of these limits is assured

by the assumption that R is suitable for polymorphism.)

Our next task is to show that we have an adjunction. Suppose hk; ri 2 ObRn andhf 0;g0i 2 �R

n hk; ri �����!Rn+1hk0; r0i. We must show that there is exactly one tab

Rn hf

0;g0i 2

hk; ri ���!Rn

�Rn hk

0; r0i such that

�Rn hk; ri

�Rn (�

Rn hk

0; r0i) hk0; r0i

?

�Rn (tab

Rn hf

0;g0i)

HHHHHHHHHHHj

hf 0;g0i

-tapRn hk

0; r0i

(28)

commutes in Rn+1. This will be true i� there is exactly one (tabRn hf0;g0i)1 2 k ���!

Kn�Knk

0

and, for each 2 (ObR)n, exactly one ((tabRn hf0;g0i)2 )> 2 (r )> ��!B (�R

n hk0; r0i)2 )>

such that the following conditions all hold:

Page 24: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

24

� The diagram obtained from 28 by taking �rst components commutes in Kn+1. Since

K is a PL category, the uniqueness of tabKn f0 in Diagram 17 insures that this will

occur i�

(tabRn hf0;g0i)1 = tab

Kn f

0 : (29)

� For all 2 (ObR)n and � 2 ObR, the diagram obtained from 28 by taking second

components, applying them to 0, and taking >-components commutes in B. With

the use of Equation 25 to eliminate the occurrences of �Rn , this diagram becomes

the upper triangle in

F (K k)

�(�R

n hk0; r0i)2

�>

F�K (�K

nk0)�

F (K 0k0)

(r )>

(r0 0)>

AAAAAAAU

F�K (tabKn f

0)�

?

(r )#

?

(r0 0)#

PPPPPPPPPPPPPPPPPPPPPPPq

(g0 0)>

PPPPPPPPPPPPPPPPPPPPPq

F (K 0f 0)

?

�(�R

n hk0; r0i)2

�#

AAAAAAAU

�(tabRn hf

0;g0i)2 �>

-�(tapRn hk

0; r0i)2 0�>

-F�K 0(tapKn k

0)�

(30)

� For all 2 (ObR)n, ((tabRn hf0;g0i)2 )> must satisfy a diagram similar to 24. With

the use of Equations 25 and 26 to eliminate the occurrences of �Rn , and the substi-

tution of Equation 29, this diagram becomes the lefthand parallelogram in 30.

The lower triangle in Diagram 30 can be obtained from Diagram 17 by applying K 0

and using Equation 26. The large parallelogram commutes since it is the version of

Diagram 24 for the morphism hf 0;g0i in Rn+1. Thus the perimeter of 30 commutes, and

since the rectangle is a limit, the last two conditions above hold i� ((tabRn hf0;g0i)2 )>

is the unique mediating morphism. In conjunction with Equation 29, this determines

tabRn hf

0;g0i uniquely, so that �Rn is a right adjoint of �R

n .

Our �nal task is to show that, for all � 2 n ���!jRj

m, R(� + 1);R� is a map of

adjunctions, i.e. that, for all hk0; r0i 2 ObRm+1,

R���Rmhk

0; r0i�= �R

n

�R(� + 1)hk0; r0i

R(� + 1)�tap

Rm hk

0; r0i�= tap

Rn

�R(� + 1)hk0; r0i

�:

To show the equalities between the �rst components of each side of these equations, we

use Equations 19 and 22, and the fact that jUj preserves products and thus distributes

Page 25: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

25

with +, to rewrite these equalities as

K(jUj�)(�Kmk

0) = �Kn

�K(jUj� + 1)k0

K(jUj� + 1)(tapKm k0) = tap

Kn

�K(jUj� + 1)k0

�;

which hold because K(jUj� + 1);K(jUj�) is a map of adjunctions.

To complete the proof we must show that, for all 2 (ObR)n,��R�(�R

mhk0; r0i)

�2 �>=���Rn (R(� + 1)hk0; r0i)

�2 �>��

R�(�Rmhk

0; r0i)�2 �#=���Rn (R(� + 1)hk0; r0i)

�2 �#;

and for all 2 (ObR)n and � 2 ObR,��R(� + 1)(tapRm hk

0; r0i)�2 0�>=��

tapRn (R(� + 1)hk0; r0i)

�2 0�>:

Using Equation 19, these equations may be rewritten as�(�R

mhk0; r0i)2�

�>=�(�R

n hk00; r00i)2

�>�

(�Rmhk

0; r0i)2��#=�(�R

n hk00; r00i)2

�#

(31)�(tapRm hk

0; r0i)2�0�>=�(tapRn hk

00; r00i)2 0�>;

where� = �i 2 m: (�i)2

�0 = �i 2 m+ 1: ((� + 1)i)2 0

k00 = K��i 2 m+ 1: ((� + 1)i)1

�k0 = K(jUj� + 1)k0

r00 = � 0 2 (ObR)n+1: r0�0 :

Moreover, from Equations 16, 15, 19, and 20, when i < m,�(� + 1)i

�2 0 =

��Rn (�i)

�2 0 =

�R(�i 2 n: IRn+1i)(�i)

�2 0 =

(�i)2��i 2 n: (IRn+1i)2

0�= (�i)2

��i 2 n: 0i

�= (�i)2 ;

and when i = m, �(� + 1)i

�2 0 = (IRn+1n)2

0 = 0n = � ;

so that�0 = [�i 2 m: (�i)2 j m:� ] = [� j m:� ] :

Thus Equations 31 assert the equality of the limits that make

�(�R

mhk0; r0i)2�

�>

(r0�0)>

F�K�(�K

mk0)�

F (K�0k0)

?

�(�R

mhk0; r0i)2�

�#

?

(r0�0)#

-

�(tapRm hk

0; r0i)2�0�>

-F�K�0(tapKm k

0)�

Page 26: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

26

(where � = � ; ObU and �0 = �0 ; ObU = [ � j m:U� ]), and

�(�R

n hk00; r00i)2

�>

(r00 0)>

F�K (�K

nk00)�

F (K 0k00)

?

�(�R

n hk00; r00i)2

�#

?

(r00 0)#

-

�(tapRn hk

00; r00i)2 0�>

-F�K 0(tapKn k

00)�

commute in B for all � 2 ObR. To show that these limits are equal, we show the equality

of the righthand sides and of the bottoms. We have already seen that r00 0 = r0�0. For

the bottoms, we �rst note that, since (� + 1)i 2 ObRn+1, Equation 22, the fact that jUj

preserves products, and Equation 14 give

�0 = �i 2 m+ 1: U�((� + 1)i)2

0�= �i 2 m+ 1: K 0((� + 1)i)1 =

jUj(� + 1) ; Ob(K 0) = (jUj� + 1) ; Ob(K 0) = 0 ;jKj (jUj� + 1) :

Then

K�0(tapKm k0) = K 0

�K(jUj� + 1)(tapKm k

0)�=

K 0�tap

Kn (K(jUj� + 1)k0)

�= K 0(tapKn k

00)

since K(jUj� + 1);K(jUj�) is a map of adjunctions. (End of Proof )

Finally, from Propositions 2, 9 and 11, we obtain the second-order abstraction theorem:

Proposition 12 Suppose K is a PL category, R = REL(K0; B; F ) is suitablefor polymorphism, B is Cartesian closed and has pullbacks, and F preserves�nite products. Let U be the forgetful functor from R to K0 and R and Ube the PL category and morphism constructed in Proposition 11 such thatR = R0 and U = U0. If e 2 En�!, 2 (ObR)n, and � = ; ObU 2 (ObK0)

n,

then there is a uniqueg 2 [[�]]Rn ��!R [[!]]Rn

such that

[[e]]Kn�!� = Ug :

Proof : Let g = [[e]]Rn�! . As before, since U is faithful, g is unique. (End of Proof )

4 Parametricity

When Strachey originally introduced the notion of polymorphism [5], he distinguishedparametric polymorphic functions, whose behavior does not depend upon the types to

which they are applied, from ad hoc polymorphic functions, which can exhibit arbitrarily

di�erent behavior for di�erent types. In [1], this distinction was connected with the iden-tity extension lemma: the lemma does not hold for arbitrary models of the polymorphic

Page 27: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

27

lambda calculus, but when it does hold, it implies that the model is parametric, in a

reasonable formalization of Strachey's intuitive concept.

To recast this development in the more general setting of PL categories, we begin with

what we believe is the appropriate generalization of the identity extension lemma, in its

role as a hypothesis that insures parametricity:

De�nition Two (pre-)PL categories K and R, such that R0 is the category

REL(K a0; B; F (�1)�B � � ��BF (�a)) of relations of arity a over K0, are said to

satisfy the parametricity hypothesis i� there are (pre-)PL morphisms J from

K to R, and U1; . . . ;Ua from R to K such that J0 is the identity-relation

functor J, each U i0is the forgetful projection functor Ui, and the compositions

K R K-J -U i

are (pre-)PL identity morphisms.

An immediate consequence of this de�nition, via Proposition 9, is that the parametric-ity hypothesis indeed implies the identity extension lemma, i.e. the second-order analogueof Proposition 6:

Proposition 13 If PL categories K and R satisfy the parametricity hypoth-esis, with R0 = REL(K a

0; B; F (�1) �B � � � �B F (�a)), then, whenever ! 2

n [ �n is a type or type assignment of the second-order typed lambda cal-

culus and � 2 (ObK0)n,

[[!]]Rn (� ; J) = ([[!]]

Kn �) ; J :

The reader will note that the parametricity hypothesis is de�ned for pre-PL categories

as well as PL categories. Of course, pre-PL categories only su�ce to model the �rst-order typed lambda calculus, and in this case Proposition 6 asserts the same thing asProposition 13 without requiring the parametricity hypothesis. Nevertheless, even in the

�rst-order case, the hypothesis is connected with parametricity.

Even in the simply-typed lambda calculus, the inclusion of type variables introducesa kind of polymorphism, since we can regard ordinary expressions in n type variables, say

in En�!, as denoting polymorphic functions in n type arguments. However, we cannot

use such polymorphic functions as arguments to ordinary functions, so that polymorphicfunctions are not \�rst-class values". We have a limited form of polymorphism similar to

the kind that Milner introduced in ML [17, 18, 19].

From this viewpoint, the �rst-order abstraction theorem, especially in the multinary

form of Proposition 4, asserts that the meaning of an ordinary expression containing type

variables is a parametric polymorphic function. In particular, it asserts that the values ofsuch a function at di�erent types must satisfy a rich family of relations.

However, the kind of model described in Section 2 is not itself parametric. Althoughthe expressions in En�! all have parametric meanings, the only \set" prescribed for these

Page 28: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

28

meanings is the enormous productQ�2(ObK)n([[�]]

K

n � ��!K [[!]]K

n �), which imposes no con-

straining relation between the values obtained by applying a member to di�erent �, and

thus contains all the type-correct functions that Strachey called \ad hoc".

On the other hand, when the simply typed lambda calculus is modeled by a pre-PL

category, the above product is replaced by the potentially more restricted morphism class

hh�iiKn ���!Kn hh!ii

Kn . In this situation (and also when the second-order calculus is modeled

by a PL category) the parametricity hypothesis implies that all members of the morphism

class satisfy the relations that are imposed by Proposition 4 on just those members that

are meanings of expressions:

Proposition 14 Suppose pre-PL categories (PL categories) K and R satisfy

the parametricity hypothesis, with R = R0 = REL(K a0; B; F (�1) �B � � � �B

F (�a)), and ! 2 n and � 2 �n are a type and type assignment of the �rst-

order (second-order) calculus. If f 2 hh�iiKn ���!Kn hh!ii

Kn , 2 (ObR)n, and, for

all i 2 a, �i = ; ObU i 2 (ObK)n, then there is a unique

g 2 [[�]]Rn ��!R [[!]]

Rn

such thathK�1f ; . . . ;K�afi = Ug :

Proof : By the parametricity hypothesis and Proposition 8,

Jnf 2 Jnhh�iiKn ���!Rn Jnhh!ii

Kn = hh�ii

Rn ���!Rn hh!ii

Rn :

Since 2 0 ���!jRj

n, the de�nition of concrete semantics by Equation 18 gives

R (Jnf) 2 R hh�iiRn ��!R R hh!ii

Rn = [[�]]Rn ��!R [[!]]Rn ;

so that we make take g to be R (Jnf). Then the naturality of the Ui makes the diagram

of functors

Rn Kn

R0 K0

-U in

-U i0= Ui

?

R

?

K(jU ij ) = K( ; ObU i0) = K( ; ObUi) = K�i

commute, so that the parametricity hypothesis gives

K�if = K�i�U in(Jnf)

�= Ui

�R (Jnf)

�= Uig = Pi(Ug) ;

and since the Pi are projection functors, hK�1f ; . . . ;K�afi = Ug. Since U is faithful, g is

unique. (End of Proof )

Page 29: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

29

Finally, when the parametricity hypothesis holds for a PL category modeling the

second-order typed lambda calculus, it implies parametricity in the sense of [1], i.e. for

the morphism sets hh�iiKn ���!Kn hh�n: !ii

Kn corresponding to polymorphic types. (Actually,

the result is stated more simply in terms of the isomorphic sets hhb�iiKn+1 ����!Kn+1hh!ii

Kn+1.)

Proposition 15 Suppose PL categories K and R satisfy the parametricity

hypothesis, withR = R0 = REL(K a0; B; F (�1)�B� � ��BF (�a)), and ! 2 n+1

and � 2 �n are a type and type assignment of the second-order typed lambda

calculus. If f 2 hhb�iiKn+1 ����!Kn+1hh!ii

Kn+1, � 2 (ObK0)

n, r 2 ObR, and, for all

i 2 a, ki = Uir, then there is a unique

g 2 [[�]]Rn (� ; ObJ) ��!R [[!]]

Rn+1[ � ; Ob J j n: r ]

such thathK[ � j n: k1 ]f ; . . . ;K[ � j n: ka ]fi = Ug :

Proof : In Proposition 14, take n to be n + 1, � to be b�, to be 0def= [ � ; ObJ j n: r ],

and �i to be [ � j n: ki ]. It follows that there is a unique

g 2 [[b�]]Rn+1 0 ��!R [[!]]Rn+1 0

such that hK[ � j n: k1 ]f ; . . . ;K[ � j n: ka ]fi = Ug. However, by Equation 14,

0 ;jRj (Jn�n+1 ; IjRjn+1) = Jn�n+1 ; I

jRjn+1 ; Ob(R

0) =

Jn�n+1 ; ( 0 ;jRj I

jRjn+1) = Jn�n+1 ;

0 = � ; ObJ ;

so that[[b�]]Rn+1 0 = R 0hh�ii

Rn+1 = R 0(�R

n hh�iiRn ) =

R 0�R(Jn�n+1 ; I

jRjn+1)hh�ii

Rn

�= R(� ; ObJ)hh�iiRn = [[�]]Rn (� ; Ob J) :

(End of Proof )

5 Kripke Relations

In [20], G. D. Plotkin generalized the abstraction (or logical-relations) theorem for thesimply typed lambda calculus by introducing Kripke relations, and showed that the re-

sult characterizes \lambda-de�nabilty": every meaning satisfying the generalized logical-

relations property (what we might call every meaning that is parametric in the Kripke

sense) is the meaning of some expression. This generalization �ts nicely into our present

framework.

Conventionally, an a-ary Kripke relation on sets r1; . . . ; ra is a family of relations

f r>w � r1� � � �� ra j w 2W g indexed by a preordered set W and satisfying r>w � r>w0

whenever w � w0. From our viewpoint, each r>w becomes the domain of a monic function

Page 30: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

30

r#w into r1�� � ��ra. Moreover, r> is extended to a functor fromW to SET and a naturality

condition is imposed on r#: whenever w � w0, the diagram

r>w r>w0

r1 � � � � � ra

-r>(w � w0)

SSSSSSw

r#w

������/

r#w0

commutes in SET, so that the image of r#w is a subset of the image of r#w0.

Thus the category of a-ary Kripke relations is REL(K;B;F ), where K is SETa, B is

SETW , and F is the functor from SETa to SETW such that

F hs1; . . . ; saiw = s1 � � � � � sa F hs1; . . . ; sai(w � w0) = Is1�����sa

whenever hs1; . . . ; sai is an object or morphism of SETa.

An obvious generalization is to let K be any Cartesian closed category and F be suchthat

Fkw = Gk Fk(w � w0) = IGk ;

where G is any product-preserving functor fromK to SET. It is well-known that SETW isCartesian closed, and easy to see that SETW has pointwise pullbacks and that F preservesproducts. Thus Proposition 2 applies and the �rst-order abstraction theorem holds.

However, in REL(K;SETW ; F ) it is the natural transformations r# that must be monic,while in a Kripke relation we have said that the component functions r#w must be monic(i.e. injective). Fortunately these two conditions are equivalent:

Proposition 16 Suppose r# 2 r> �����!SET

WFr? where F is such that Fkw = Gk

and Fk(w � w0) = IGk. Then r# is monic i� r#w is injective for all w 2 W .

Proof : It is easy to see that r# is monic when every r#w is monic. To complete the proof,we will show that r# is not monic whenever some r#w is not injective. So suppose that

there are w0 2W and distinct x1; x2 2 r>w0 such that r#w0x1 = r#w0x2.

Let b be the functor fromW to SET such that bw is the singleton set fyg when w0 � w

and the empty set otherwise, and b(w � w0) is the unique function from bw to bw0. (One

cannot have bw = fyg and bw0 empty when w � w0.) For i 2 f1; 2g, let �i 2 b �����!SET

Wr> be

such that �iwy = r>(w0 � w)xi when w0 � w, and �iw is the empty function otherwise.The naturality of the �i is easily seen. Moreover, �iw ; r#w is independent of i, since when

w0 � w, r#w(�iwy) = r#w(r>(w0 � w)xi) = r#w0xi by the naturality of r#, and when

w0 � w is false, �iw ; r#w is the empty function.

Thus �i ;SETW r# is independent of i, while the �i themselves are distinct (when applied

to w0). Therefore r# is not monic. (End of Proof )

As a consequence of this proposition, the limits in Diagram 23 can be taken pointwise.

Thus Kripke relations are suitable for polymorphism, Proposition 11 applies, and thesecond-order abstraction theorem holds.

Page 31: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

31

6 Complete Relations on Domains

In [1], in a brief lapse from the set-theoretic view, the abstraction theorem was proved for

complete relations over a model of the simply typed lambda calculus using the category

CPO of complete partial orders (posets with least elements and least upper bounds of

directed sets) and continuous functions. Conventionally, a complete (unary) relation on a

c.p.o. r? is a complete subset r> � r?, i.e. a subset containing the least element of r? and

closed under least upper bounds (in r?) of directed subsets. From our present viewpoint,

such a relation is a triple hr?; r>; r#i where r# 2 r> ����!CPOr? is strict and bimonotone, i.e.

r#(?) = ? and r#x v r#y i� x v y ;

since the images of such functions are exactly the complete subsets of r?. (Note that

bimonotonicity implies monicity.)

Unfortunately, the category of complete relations does not quite �t the Procrusteanbed developed in the previous sections; it is not a category of the form REL(K;B;F ),although it is a full subcategory of REL(CPO;CPO; I). Nevertheless it is Cartesianclosed, so that the �rst-order abstraction theorem still holds.

Before proving this, we generalize to allow K to be any Cartesian closed categorywith a product-preserving functor F from K to CPO that satis�es a certain strictnesscondition. This is necessary to deal with multinary relations, and also to encompassa variety of models of the polymorphic lambda calculus in which K0 is a subcategoryof CPO or a category whose objects represent c.p.o.'s. (Examples include categories of

closures [21], �nitary retracts [22], �nitary projections [23], qualitative domains [24], andDI-domains [25]. Such models are formulated as PL categories in [11]. A more concreteviewpoint is found in [26].)

De�nition Let K be a category and F be a functor from K to CPO. ThenCOMREL(K;F ) is the full subcategory of REL(K;CPO; F ) whose objectshr?; r>; r#i are such that r# is strict and bimonotone.

Proposition 17 If K is Cartesian closed, F is product-preserving, and the

function abCPO(F apKkk0) is strict for all k; k

0 2 ObK, then COMREL(K;F ) isCartesian closed, and the forgetful functor U from COMREL(K;F ) to K is a

morphism of Cartesian closed categories.

Proof : Essentially, we recapitulate the proof of Proposition 2 while showing that expo-

nentiation preserves the special nature of objects. (A super�cial complication is that CPOdoes not have all pullbacks; however it has pullbacks of diagrams whose morphisms are

strict, which is all that is necessary.) Thus we will assume that r0#is strict and bimonotone

(a similar condition on r# is unnecessary), and show that this implies that the pullback

de�ning r ==)R

r0 is well-de�ned and that (r ==)R

r0)# is strict and bimonotone.

Page 32: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

32

By applying the composition of functions in Diagram 1 to h?; xi 2 F (r? ===)K

r0?)� r>,

and using the speci�c nature of CPO (including the fact that the least element of a function

space is the constant function giving the least result) and the strictness condition on F ,

we have

t?x = apht?; xi =�(t� I) ; ap

�h?; xi =

�(I � r#) ; F ap

�h?; xi = F ap h?; r#xi = ab(F ap)?(r#x) = ?(r#x) = ? ;

and since this holds for all x 2 r>, t is strict.

A similar argument applied to Diagram 2 shows that r> =====)CPO

r0#is strict since r0

#is

strict. Moreover, when applied to hfi; xi, Diagram 2 gives

(r> =====)CPO

r0#)fix = aph(r> =====)

CPOr0#)fi; xi =

�((r> =====)

CPOr0#)� I) ; ap

�hfi; xi =

(ap ; r0#)hfi; xi = r0

#(fix) ;

so that (r> =====)CPO

r0#)f1x v (r> =====)

CPOr0#)f2x implies r0

#(f1x) v r0

#(f2x), and since r0

#is

bimonotone, f1x v f2x. Since this holds for all x 2 r>,

(r> =====)CPO

r0#)f1 v (r> =====)

CPOr0#)f2 implies f1 v f2 ;

and since the opposite implication holds for all continuous functions, r> =====)CPO

r0#is

bimonotone.

Since pullbacks in CPO are essentially the same as in SET, the pullback in Diagram 3is

(r ==)R

r0)> = f hf; gi j f 2 F (r? ===)K

r0?) and g 2 r> =====)

CPOr0>and tf = (r> =====)

CPOr0#)g g

with pointwise ordering; the functions (r ==)R

r0)# and u are the obvious projections. Since

t and r> =====)CPO

r0#are strict, the pullback is a c.p.o. and, as is easily seen, the projections

are strict.

Moreover, suppose (r ==)R

r0)#hf1; g1i v (r ==)R

r0)#hf2; g2i. Since (r ==)R r0)# is the �rst

projection, f1 v f2. Then tf1 v tf2, and by the equation constraining the hf; gi 2 (r ==)R

r0)>, (r> =====)CPO

r0#)g1 v (r> =====)

CPOr0#)g2, and since r> =====)

CPOr0#is bimonotone, g1 v g2.

Thus hf1; g1i v hf2; g2i, so that (r ==)R r0)# is bimonotone. (End of Proof )

This establishes the abstraction theorem for the �rst-order typed lambda calculus,

but the second-order case is more complex, since COMREL(K;F ) is not \suitable for

polymorphism". The construction of the necessary limits is the same for CPO as forSET, but | much as with the pullbacks in the previous proof | it may give an r> that

has no least element. However, the limit exists in CPO whenever the functions F (f�) atthe bottom of Diagram 23 are strict for all � 2 ObR. (The functions at the right of this

diagram must be strict since r� is a complete relation.) Thus, for the proof of Proposition

11 to go through, it is su�cient for the functions at the bottom of Diagram 27 to bestrict. Happily, this is a reasonable property to expect of domain-theoretic PL-category

models of any extension of the second-order polymorphic lambda calculus that includes

a polymorphic �xed-point operator.

Page 33: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

33

If the language contains a polymorphic �xed-point operator then, for any type ex-

pression ! 2 n, one can write a closed ordinary expression e 2 Enhi! (where hi is the

empty type assignment) denoting the least element of type !. In terms of concrete se-

mantics, this means that, for all � 2 (ObK0)n, F ([[e]]nhi!�) is a constant function yielding

the least element of F ([[!]]n�) (at least if F preserves least morphisms). Then the con-

nection with abstract semantics given by Equation 18 shows that there is a morphism

hheiinhi! 2 > ���!Kn

hh!iin (where > is the distinguished terminal object of Kn) such that

F (K�hheiinhi!) is a constant function yielding a least element.

It is reasonable to assume that this property holds, not just for the objects hh!iin of

Kn that are the meanings of type expressions, but for all objects of Kn. Thus:

De�nition A PL category K and a functor F from K0 to CPO are said to

express least elements polymorphically i�, for all k 2 Kn, there is a morphism

f 2 > ���!Kn

k such that, for all � 2 (ObK0)n, F (K�f) is a constant function

yielding the least element of F (K�k).

Then the following proposition establishes the abstraction theorem for the second-ordercase:

Proposition 18 Suppose K is a PL category and R = COMREL(K0; F ). IfF is product-preserving, abCPO(F ap

K0kk0) is strict for all k; k

0 2 ObK0, and Kand F express least elements polymorphically, then there is a PL category Rand a PL morphism U from R to K such that R = R0 and U = U0.

Proof : In Diagram 17, take k to be the terminal object of Kn; then since �n is a morphismof Cartesian closed categories, �nk is the terminal object of Kn+1. For

0 2 (ObK0)n+1,

applying the functors K 0 and F to this diagram gives

F (K 0(>))

F (K 0(�n(�nk0))) F (K 0(k0))

?

F (K 0(�n(tabn f0)))

HHHHHHHHHHHHHj

F (K 0(f 0))

-F (K 0(tapn k

0))

Since K and F express least elements polymorphically, there is an f 0 such that F (K 0(f 0))

is a constant function yielding the least element of F (K 0(k0)). But then the diagramcan commute only if F (K 0(tapn k

0)) is a strict function.

The rest of the proof is the same as that of Proposition 11, except that the limit in

Diagram 27 exists because the functions at the bottom of the diagram are strict.

(End of Proof )

Page 34: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

34

7 Summary and Connections with Other Work

We have generalized the concept of relations over sets to that of a category REL(K;B;F )

of relations over a category K, which we have used to investigate the abstraction theorem,

the identity extension lemma, and parametric polymorphism, in three cases:

� CCC: where a Cartesian closed category models the �rst-order lambda calculus,

� pre-PL: where a pre-PL category models the �rst-order lambda calculus,

� PL: where a PL category models the second-order lambda calculus.

In each of the last two cases, we de�ned a \parametricity hypothesis".

Under reasonable conditions, the abstraction theorem holds in the CCC case (Propo-sition 3), and also in the pre-PL case since the concrete semantics for a pre-PL category Kis the same as that for the Cartesian closed category K0. Under more stringent conditions,the abstraction theorem also holds in the PL case (Proposition 12).

The identity extension lemma holds under reasonable conditions in the CCC case(Proposition 6), and also in the pre-PL case since the concrete semantics is the same. It

does not hold for all reasonable models in the PL case, but it is implied by the para-metricity hypothesis (Proposition 13).

Even in the simply typed lambda calculus, polymorphic functions appear as the mean-ings of ordinary expressions containing type variables. One can regard the abstractiontheorem as asserting that the meanings of such expressions are parametric polymorphicfunctions. But in general, the sets (or classes) of meanings that are prescribed for various

types by a model will also contain ad hoc parametric functions. Such ad hoc functionsoccur in all nontrivial instances of the CCC case.

In the pre-PL and PL cases, however, the parametricity hypothesis implies the para-metricity of all members of the sets (or classes) hh�iiKn ���!Kn hh!ii

Kn of meanings appropriate

to expressions containing type variables (Proposition 14). In the PL case, the parametric-

ity hypothesis also implies the parametricity of the sets hh�iiKn ���!Kn hh�n: !iiKn of meanings

appropriate to expressions with polymorphic types (Proposition 15). (Of course, the para-

metricity hypothesis may be unnecessarily strong: there may be parametric models for

which the hypothesis is false, e.g. in which abB(F apK) is not monic.)

Kripke relations �t nicely into our framework (Proposition 16). On the other hand,complete relations on domains are more problematical; they are a full subcategory of acategory REL(K;CPO; F ) of relations. Nevertheless, the �rst-order abstraction theorem

still holds under reasonable conditions (Proposition 17), and the second-order abstraction

theorem holds under more stringent conditions that are reasonable for models that canaccommodate a polymorphic �xed-point operator (Proposition 18).

We have used the term \PL category" even though R. Seely's original de�nition [9]

di�ers from ours in requiring the base category jKj to be Cartesian closed, in order tomodel the -order typed lambda calculus. (However, Seely does discuss modeling of

Page 35: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

35

the second-order language brie y.) Our de�nition is closer to the 2T�C-hyperdoctrine of

A. Pitts [10], except that Pitts only requires Diagram 13 to hold within an isomorphism.

Closest to our de�nition is the \framework" of B. Narayanan [11]. His Kn is the same

as ours, his An is our I jKjn , and for � 2 (ObKn)m, his Hmn� is our K�. Thus his � is the

dual of our base category jKj, and his adjoint functors �n and �n are the same as ours.

Although we have retained the term \abstraction theorem" to emphasize continuity

with [1], the term \logical relations" was used in what seems to be the earliest instance

of the theorem (for the set-theoretic model of the simply typed lambda calculus), which

appeared in [6], where G. D. Plotkin attributed it to M. Gordon. A special case of

the concept, where the relation assigned to the single primitive type is the ordering of

the natural numbers, was also devised by W. A. Howard (in order to de�ne hereditarily

majorizable functionals) in [27].

In [6], Plotkin also proved a logical-relations theorem for Scott models of the untypedlambda calculus. We will not attempt to survey the other papers that have exploredor used logical relations for either the simply typed or the untyped lambda calculus, ineither syntactic or semantic (though usually not category-theoretic) versions; important

examples include [20] (where Kripke relations were introduced) and [28].

Closer to our concerns is [29], where Mitchell and Meyer give a logical-relations the-orem for the polymorphic lambda calculus, using the Bruce-Meyer-Mitchell concept of amodel [30]. It is tricky to compare the Bruce-Mitchell-Meyer framework with that of PLcategories [31, 32]. Nevertheless, we suspect that the \fundamental theorem of S� logicalrelations" in [29] is weaker than our corresponding Proposition 11, since their Condition

LR.3 (in Section 4.2) imposes a single relation between the applications of polymorphicfunctions c and d to particular arguments a and b, while our limit condition 27 is quanti�edover all � 2 ObR, where (in the binary case) ObR contains many (indeed all) relationswith domain a and codomain b.

The approach of [29] is also used by P. Wadler in [33], where the \parametricitytheorem" is what we would call an abstraction theorem. The proof is murky, but the paper

contains fascinating examples of the use of parametricity. A treatment of parametricity

by an extension of the Bruce-Mitchell-Meyer framework is given by R. Hasegawa [34].

There are also a variety of category-theoretic ideas that are relevant to our work. The\scone" [35, Section 1(10)] or \Freyd cover" [12, Part II, Section 22] of a category K

with a terminal object > would be the same as REL(K;SET;HomK(>;�)) if we had not

imposed monicity on the r#'s. As it is, REL(K;SET;HomK(>;�)) is a full sub-Cartesian

closed category of the scone of K (and is equivalent to a \subscone" as de�ned in [36]).

In [37], Bainbridge, Freyd, Scedrov, and Scott explicate parametricity by means of di-natural transformations [16, Section IX.4]. Although their general development is limited

to the �rst-order case, a relational approach to second-order parametricity is worked outfor the speci�c case of PER models. Dinaturality also plays a major role in [38]. We do

not fully understand the connection between dinaturality and the work presented here.

More recently, Freyd introduced the idea of \structors" [39] and connected it withparametricity. Let C and K be categories and R be REL(K �K;K;�1 �K �2) without

the monicity requirement. Then (from our point of view) a structor from C to K is a pair

Page 36: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

36

of maps k 2 (ObK)ObC and r 2 (ObR)MorC such that, for all c 2 ObC and all � 2 MorC,

k(dom�) = U1(r�) k(cod�) = U2(r�) r(id c) = J(kc) ;

where dom and cod map morphisms of C into their domains and codomains, while id maps

objects into their identity morphisms. Similarly, a morphism of structors from hk; ri to

hk0; r0i is a pair of maps f 2Qc2ObC kc ��!K k0c and g 2

Q�2MorC r� ��!R r0� such that, for

all c 2 ObC and all � 2 MorC,

f(dom�) = U1(g�) f (cod�) = U2(g�) g(id c) = J(fc) :

From a more abstract perspective, the category of structors from C to K is the limit in

the category of categories of the diagram

KObC

KMorC

KMorC

RObC RMorC

�����>Kdom

ZZZZZ~

Kcod

-JObCZ

ZZ

ZZ} UMorC1

��

���=

UMorC2

�Rid

Still closer to our ideas is current work by Mitchell and Scedrov [36] (with contributionsby S. Abramsky and P. Wadler in the initial phase). These authors state Proposition 2,which they describe as \category-theoretic folklore", and they treat generalized relations inthe framework of \iml-categories", which are equivalent to pre-PL categories. Proposition2 has also been discovered independently by G. M. Kelly [40].

Central to [36] is the concept of \relators", which, like structors, can be described aslimits. Let R = REL(K �K;SET;HomK(>;�1) � HomK(>;�2)) and R = REL(K 0 �

K 0;SET;HomK0(>;�1)�HomK0(>;�2)). Then the category of (binary) relators from K

to K 0 is the limit of

K 0ObK

K 0ObR

K 0ObR

R0ObR��

��*K 0ObU1

HHHHjK 0ObU2

HHHHY U 0ObR

1

����� U 0ObR2

A slightly di�erent de�nition, where relators are required to preserve identity relations,is used by Abramsky and Jensen in [41]. Their category of relators is the limit of

K 0ObK

K 0ObR

K 0ObR

R0ObK R0ObR�����>K 0ObU1

ZZZZZ~

K 0ObU2

-J 0ObKZ

ZZ

ZZ} U 0ObR1

��

���=

U 0ObR2

�R0Ob J

Page 37: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

37

In [1], it was stated without proof that, in the (nonexistent) parametric set-theoretic

model of the polymorphic calculus, types in which the � operations occur on the outside

and!'s do not nest more than two deep on the left have meanings that are sorts of initial

anarchic many-sorted algebras. (The analogous syntactic result, that the corresponding

sets of closed normal forms are such algebras, was shown by B�ohm and Berarducci [42],

and by Leivant [43]. The basic idea is anticipated in the work of Martin-L�of [44] and was

probably known to early proof theorists such as Takeuti.) The simplest nontrivial case

is that the meanings of type �0: (0 ! 0)! (0! 0) are in a one-to-one correspondence

(given by the Church numerals) with the natural numbers.

The generalization of this result (to models that exist) has been a concern in, for

example, [37], [45], [8], [39], and [34]. The question of whether such a result can be

obtained from our parametricity hypothesis is undoubtedly the outstanding open problem

raised by the ideas in this paper. Beyond this we hope to investigate particular models

to determine whether they are, or can be modi�ed to be, parametric.

References

[1] Reynolds, J. C. Types, Abstraction and Parametric Polymorphism. in: Informa-

tion Processing 83, Proceedings of the IFIP 9th World Computer Congress, Paris,September 19{23, 1983, edited by R. E. A. Mason. Elsevier Science Publishers B. V.(North-Holland), Amsterdam, 1983, pp. 513{523.

[2] Girard, J.-Y. Une Extension de l'Interpr�etation de G�odel �a l'Analyse, et son Ap-

plication �a l'Elimination des Coupures dans l'Analyse et la Th�eorie des Types. in:Proceedings of the Second Scandinavian Logic Symposium, University of

Oslo, June 18{20, 1970, edited by J. E. Fenstad. Studies in Logic and the Foun-

dations of Mathematics, vol. 63, North-Holland, Amsterdam, 1971, pp. 63{92.

[3] Girard, J.-Y. Interpr�etation Fonctionnel le et Elimination des Coupures de l'Arith-

m�etique d'Ordre Sup�erieur, Th�ese de doctorat d'�etat. Universit�e Paris VII, June

1972.

[4] Reynolds, J. C. Towards a Theory of Type Structure. in: Programming Sympo-

sium, Proceedings, Colloque sur la Programmation, Paris, April 9{11, edited by B.

Robinet. Lecture Notes in Computer Science, vol. 19, Springer-Verlag, Berlin,1974, pp. 408{425.

[5] Strachey, C. Fundamental Concepts in Programming Languages. Unpublished lec-

ture notes, International Summer School in Computer Programming, Copenhagen,

August 1967.

[6] Plotkin, G. D. Lambda-De�nability and Logical Relations. Memorandum, no. SAI-RM-4, University of Edinburgh, School of Arti�cial Intelligence, October 1973.

[7] Reynolds, J. C. Polymorphism is not Set-Theoretic. in: Semantics of Data Types,International Symposium, Sophia-Antipolis, France, June 27{29, edited by G. Kahn,

Page 38: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

38

D. B. MacQueen, and G. D. Plotkin. Lecture Notes in Computer Science, vol.

173, Springer-Verlag, Berlin, 1984, pp. 145{156.

[8] Reynolds, J. C. and Plotkin, G. D. On Functors Expressible in the Polymorphic Typed

Lambda Calculus. Report, no. CMU-CS-90-147, Carnegie Mellon University, School

of Computer Science, July 6, 1990. Also to appear in Information and Computation.

[9] Seely, R. A. G. Categorical Semantics for Higher Order Polymorphic Lambda Calcu-

lus. Journal of Symbolic Logic, vol. 52 (1987), pp. 969{989.

[10] Pitts, A. M. Polymorphism is Set Theoretic, Constructively. in: Category Theory

and Computer Science, Edinburgh, Scotland, September 7{9, edited by D. H.

Pitt, A. Poign�e, and D. E. Rydeheard. Lecture Notes in Computer Science, vol.

283, Springer-Verlag, Berlin, 1987.

[11] Narayanan, B. R. A General Framework for Models of Type Polymorphism,Ph. D. Dissertation. Syracuse University, December 1988, vi+155 pp. Report

No. CIS-89-1.

[12] Lambek, J. and Scott, P. J. Introduction to Higher Order Categorical Logic.Cambridge Studies in Advanced Mathematics, vol. 7, Cambridge UniversityPress, Cambridge, England, 1986, ix+293 pp.

[13] Barr, M. and Wells, C. Toposes, Triples, and Theories. Grundlehren der

mathematischen Wissenschaften, vol. 278, Springer-Verlag, New York, 1985,xiii+345 pp.

[14] Lawvere, F. W. Functorial Semantics of Algebraic Theories. Proceedings of theNational Academy of Sciences of the United States of America, vol. 50

(1963), pp. 869{872.

[15] Lawvere, F. W. Some Algebraic Problems in the Context of Functorial Semantics of

Algebraic Theories. in: Reports of the Midwest Category Seminar II, edited

by S. Mac Lane. Lecture Notes in Mathematics, vol. 61, Springer-Verlag, Berlin,1968, pp. 41{61.

[16] Mac Lane, S. Categories for the Working Mathematician. Graduate Textsin Mathematics, vol. 5, Springer-Verlag, New York, 1971, ix+262 pp.

[17] Milner, R. A Theory of Type Polymorphism in Programming. Journal of Computer

and System Sciences, vol. 17 (1978), pp. 348{375.

[18] Damas, L. and Milner, R. Principal Type-Schemes for Functional Programs. in:

Conference Record of the Ninth Annual ACM Symposium on Principles

of Programming Languages, Albuquerque, New Mexico, January 25{27. 1982,pp. 207{212.

[19] Harper, R. and Mitchell, J. C. On the Type Structure of Standard ML. ACM

Transactions on Programming Languages and Systems, To appear.

Page 39: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

39

[20] Plotkin, G. D. Lambda-De�nability in the Full Type Hierarchy. in: To H. B. Curry:

Essays on Combinatory Logic, Lambda Calculus and Formalism, edited by

J. P. Seldin and J. R. Hindley. Academic Press, London, 1980, pp. 363{373.

[21] McCracken, N. J. An Investigation of a Programming Language with a Polymorphic

Type Structure, Ph. D. Dissertation. Syracuse University, June 1979, iv+126 pp.

[22] McCracken, N. J. A Finitary Retract Model for the Polymorphic Lambda-Calculus.

Unpublished, Syracuse University, 1982.

[23] Amadio, R., Bruce, K. B., and Longo, G. The Finitary Projection Model for Sec-

ond Order Lambda Calculus and Solutions to Higher Order Domain Equations. in:

Proceedings Symposium on Logic in Computer Science, Cambridge, Mas-

sachusetts, June 16{18. 1986, pp. 122{130.

[24] Girard, J.-Y. The System F of Variable Types, Fifteen Years Later. TheoreticalComputer Science, vol. 45 (1986), pp. 159{192.

[25] Coquand, T., Gunter, C. A., and Winskel, G. DI-Domains as a Model of Polymor-

phism. in: Mathematical Foundations of Programming Language Seman-

tics, 3rd Workshop, Tulane University, New Orleans, April 8{10, 1987, edited by M.Main, A. Melton, M. Mislove, and D. A. Schmidt. Lecture Notes in Computer

Science, vol. 298, Springer-Verlag, Berlin, 1988, pp. 344{363.

[26] Coquand, T., Gunter, C. A., and Winskel, G. Domain Theoretic Models of Polymor-

phism. Information and Computation, vol. 81 (1989), pp. 123{167.

[27] Howard, W. A. Hereditarily Majorizable Functionals of Finite Type. in: Metamath-

ematical Investigation of Intuitionistic Arithmetic and Analysis, edited by

A. S. Troelstra. Lecture Notes in Mathematics, vol. 344, Springer-Verlag, Berlin,1973, pp. 454{461. Appendix.

[28] Statman, R. Logical Relations and the Typed �-Calculus. Information and Con-

trol, vol. 65 (1985), pp. 85{97.

[29] Mitchell, J. C. and Meyer, A. R. Second-order Logical Relations (Extended Abstract).

in: Logic of Programs, Brooklyn, New York, June 17{19, edited by R. Parikh.

Lecture Notes in Computer Science, vol. 193, Springer-Verlag, Berlin, 1985,pp. 225{236.

[30] Bruce, K. B., Meyer, A. R., and Mitchell, J. C. The Semantics of Second-Order

Lambda Calculus. Information and Computation, vol. 85 (1990), pp. 76{134.

[31] Jacobs, B. P. F. On the Semantics of Second Order Lambda Calculus: From Bruce-

Meyer-Mitchell Models to Hyperdoctrine Models and Vice-Versa. in: Category The-ory and Computer Science, Manchester, UK, September 5{8, edited by D. H.

Pitt, D. E. Rydeheard, P. Dybjer, A. M. Pitts, and A. Poign�e. Lecture Notes in

Computer Science, vol. 389, Springer-Verlag, Berlin, 1989, pp. 198{212.

Page 40: This is a preprint of a pap er that will app ear in the Pro ceedings …qma/papers/mfps.pdf · A 15213-3890, USA qingming.m a@cs.cm u.edu john.reynolds@cs.cm Abstract The concept

40

[32] Jacobs, B. P. F. Semantics of the second order Lambda Calculus. Mathematical

Structures in Computer Science, To appear.

[33] Wadler, P. Theorems for Free. in: Functional Programming Languages and

Computer Architecture, FPCA '89 Conference Proceedings Fourth International

Conference, Imperial College, London, September 11{13. ACM, 1989, pp. 347{359.

[34] Hasegawa, R. Categorical Data Types in Parametric Polymorphism. Unpublished,

November 16, 1990.

[35] Freyd, P. J. and Scedrov, A. Categories, Allegories. North-Holland Mathe-

matical Library, vol. 39, North-Holland, Amsterdam, 1990, xviii+296 pp.

[36] Mitchell, J. C. and Scedrov, A. Sconing, Relators, and Parametricity. Unpublished

draft, October 21, 1991.

[37] Bainbridge, E. S., Freyd, P. J., Scedrov, A., and Scott, P. J. Functorial Polymor-

phism. Theoretical Computer Science, vol. 70 (1990), pp. 35{64. Corrigendum

in (3) 71, 10 April 1990, p. 431.

[38] Girard, J.-Y., Scedrov, A., and Scott, P. J. Normal Forms and Cut-Free Proofs as

Natural Transformations. in: Logic from Computer Science, A MathematicalSciences Research Institute Workshop, Berkeley, California, November 1989, editedby Y. N. Moschovakis. MSRI Series, vol. 21, Springer-Verlag, 1991, pp. 217{241.

[39] Freyd, P. J. Structural Polymorphism. Unpublished, January 23, 1989.

[40] Kelly, G. M. Private communication. July 1991.

[41] Abramsky, S. and Jensen, T. P. A Relational Approach to Strictness Analysis for

Higher-Order Polymorphic Functions. in: Conference Record of the Eighteenth

Annual ACM Symposium on Principles of Programming Languages, Or-lando, Florida, January 21{23. 1991, pp. 49{54.

[42] B�ohm, C. and Berarducci, A. Automatic Synthesis of Typed �-Programs on Term

Algebras. Theoretical Computer Science, vol. 39 (1985), pp. 135{154.

[43] Leivant, D. Reasoning About Functional Programs and Complexity Classes Associ-

ated with Type Disciplines. in: 24th Annual Symposium on Foundations of

Computer Science, IEEE, Tucson, Arizona, November 7{9. 1983, pp. 460{469.

[44] Martin-L�of, P. A Construction of the Provable Wellorderings of the Theory of Species.

Unpublished.

[45] Freyd, P. J. POLYNAT in PER. in: Categories in Computer Science and Logic,

Boulder, Colorado, June 14{20, 1987, edited by J. W. Gray and A. Scedrov. Con-temporary Mathematics, vol. 92, American Mathematical Society, Providence,

Rhode Island, 1989, pp. 67{68.