Realizability Toposes and Language Semantics

John R. Longley

Doctor of Philosophy University of Edinburgh

Abstract

Realizability toposes are “models of constructive set theory” based on abstract notions of computability. They arose originally in the study of mathematical logic, but since then various realizability toposes (particularly the effective topos) have found their way into several areas of computer science. This thesis investigates the general theory of realizability toposes, and their application to the semantics and logic of some simple programming languages.

In the earlier chapters we study the “pure theory” of realizability toposes. Each realizability topos is constructed from a partial combinatory algebra (PCA), which may be regarded as providing a notion of untyped computation. We introduce a new notion of morphism between PCAs, and show that these exactly correspond to certain functors between the toposes. Using this we are able to establish some previously unknown inequivalences between realizability toposes.

Next we develop some “domain theory” in realizability toposes. The search for a theory that works well for a wide class of models leads us to identify a new category of predomains, the well-complete objects, whose properties we study.

Finally we consider several versions of the programming language PCF and their semantics. We show how these languages may be adequately interpreted in realizability toposes, and prove a variety of universality and full abstraction results for particular languages with respect to particular models. We also obtain some more model-independent results asserting the “equivalence” between the call-by-name, call-by-value and lazy variants of PCF. We end with a discussion of how our models give rise to simple and intuitive “program logics” for these languages.

Acknowledgements

The first person to thank here is my supervisor, Mike Fourman. His diversity of intellectual interests and breadth of understanding have been a great source of inspiration to me, and I have enjoyed many wide-ranging discussions with him. He also introduced me to the area of research which has absorbed my interest for the last three years. My second supervisor, Gordon Plotkin, was also very helpful and supportive, and I have always found his incisive mental energy a great stimulation.

I have had useful and interesting discussions with many people, including Samson Abramsky, Marcelo Fiore, Martin Hofmann, Zhaohui Luo, James McKinna, Luke Ong, Andy Pitts, John Power, Thomas Streicher and Paul Taylor (whose diagram macros were a great help in the production of this thesis). But there remain three people whom I would like to thank individually. During his year in Edinburgh Wesley Phoa taught me a great deal in lectures and discussions that I would have found it very difficult to learn otherwise. Martin Hyland has been a great inspiration to me for many years now, and his support and involvement in my work have meant a lot to me. And Alex Simpson has spent literally hundreds of hours patiently discussing with me the ideas in this thesis at all stages in their development, and often in minute technical detail. His enthusiasm for my work frequently surpassed my own, and his sustained interest in my progress did a lot to keep me going.

Before coming to Edinburgh I spent a year working in the Formal Methods group at Roke Manor Research Ltd. (formerly Plessey Research and Technology). It was there that my interest in computer science was awakened, and in retrospect I feel that the time I spent there influenced my approach to the subject quite deeply.

I have made many friends through the computer science department in Edinburgh. I would particularly like to thank Benjamin Pierce for many enjoyable hours of musical collaboration, and Savi Maharaj, Peter Sewell and Alex Simpson for their company on hillwalking expeditions, as well as endless discussions about the Munros (and their recursive analogues).

My flatmates and other close friends over the last three years have helped me a great deal by their sympathy and companionship, and have provided distractions from work when necessary. A big thankyou to Steven Bradley, Louise Stephenson (now Bradley), Andrew Wilson, Stephen Fulton, Stephen Hughes, Catharine Sharman and especially Julie Mathieson.

Lastly, I would like to thank all my friends at St. Catherine’s–Argyle Church, too numerous to mention, for their love and support. They have enriched my life immeasurably since I came to Edinburgh, and their concern was particularly appreciated at an emotionally difficult time during the final stages of writing this thesis.

Declaration

I hereby declare that this thesis was composed by myself, and the work described in it is my own except where otherwise stated.

John Longley How precious to me are your thoughts, O God!

How vast is the sum of them! Were I to count them,

they would outnumber the grains of sand. Psalm 139:17–18.

Table of Contents

0. Introduction 11

0.1 Background and motivation . . . . . . . . . . . . . . . . . . . . . . 12 0.1.1 History of realizability toposes . . . . . . . . . . . . . . . . . 12 0.1.2 Realizability toposes in computer science . . . . . . . . . . . 16 0.1.3 Motivation for this thesis . . . . . . . . . . . . . . . . . . . . 19

0.2 Overview of this thesis . . . . . . . . . . . . . . . . . . . . . . . . . 21

1. PCAs and realizability toposes 28

1.1 Partial combinatory algebras . . . . . . . . . . . . . . . . . . . . . . 29 1.1.1 Definitions and examples . . . . . . . . . . . . . . . . . . . . 29 1.1.2 Combinatory completeness . . . . . . . . . . . . . . . . . . . 31 1.1.3 Some important combinators . . . . . . . . . . . . . . . . . . 34

1.2 Assemblies and modest sets . . . . . . . . . . . . . . . . . . . . . . 37 1.2.1 The categories Ass(A) and Mod(A) . . . . . . . . . . . . . 38 1.2.2 Regular categories . . . . . . . . . . . . . . . . . . . . . . . 40 1.2.3 Uniform assemblies . . . . . . . . . . . . . . . . . . . . . . . 43

1.3 Realizability toposes . . . . . . . . . . . . . . . . . . . . . . . . . . 45 1.3.1 The exact completion of a regular category . . . . . . . . . . 45 1.3.2 The topos RT(A) . . . . . . . . . . . . . . . . . . . . . . . . 48 Table of Contents 7

1.4 A universal property of Ass(A) . . . . . . . . . . . . . . . . . . . . 50 1.4.1 Γ-categories and ∇Γ-categories . . . . . . . . . . . . . . . . 50 1.4.2 Proof of the universal property . . . . . . . . . . . . . . . . 52

2. Morphisms between PCAs 64 2.1 Applicative morphisms . . . . . . . . . . . . . . . . . . . . . . . . . 65 2.2 Functors between categories of assemblies . . . . . . . . . . . . . . . 68

2.2.1 Building functors from applicative morphisms . . . . . . . . 68 2.2.2 Recovering applicative morphisms . . . . . . . . . . . . . . . 70 2.2.3 The equivalence theorem . . . . . . . . . . . . . . . . . . . . 73

2.3 Functors between realizability toposes . . . . . . . . . . . . . . . . . 77 2.4 Some special morphisms . . . . . . . . . . . . . . . . . . . . . . . . 81

2.4.1 Discrete morphisms . . . . . . . . . . . . . . . . . . . . . . . 81 2.4.2 Projective morphisms . . . . . . . . . . . . . . . . . . . . . . 83 2.4.3 Decidable morphisms . . . . . . . . . . . . . . . . . . . . . . 87

2.5 Adjoint pairs of morphisms . . . . . . . . . . . . . . . . . . . . . . . 92

3. Examples of applicative morphisms 96 3.1 K_{1} and Turing degrees . . . . . . . . . . . . . . . . . . . . . . . . . 97 3.2 Term models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

3.2.1 Combinatory logic and λ-calculus . . . . . . . . . . . . . . . 101 3.2.2 Open and closed term models . . . . . . . . . . . . . . . . . 105 3.2.3 Lazy λ-calculus . . . . . . . . . . . . . . . . . . . . . . . . . 105 3.2.4 Call-by-value λ-calculus . . . . . . . . . . . . . . . . . . . . 107 3.2.5 Inequivalence of λ_{N} and λ_{V} . . . . . . . . . . . . . . . . . . 110 Table of Contents 8

3.3 The Scott graph model . . . . . . . . . . . . . . . . . . . . . . . . . 114 3.3.1 The PCAs Pω and Pω_{re} . . . . . . . . . . . . . . . . . . . . 114 3.3.2 Applicative morphisms involving Pω_{re} . . . . . . . . . . . . 117

4. Dominances 121

4.1 Dominances and partial maps . . . . . . . . . . . . . . . . . . . . . 122 4.1.1 Classes of admissible monos . . . . . . . . . . . . . . . . . . 122 4.1.2 Pre-dominances and dominances . . . . . . . . . . . . . . . . 124

4.2 Dominances in realizability models . . . . . . . . . . . . . . . . . . 128 4.3 Divergences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

5. Completeness and fixed points 140

5.1 ω-chains and limits . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 5.1.1 ω-chains in Ass(A) . . . . . . . . . . . . . . . . . . . . . . . 142 5.1.2 Well-complete objects . . . . . . . . . . . . . . . . . . . . . 146

5.2 The completeness axiom . . . . . . . . . . . . . . . . . . . . . . . . 148 5.2.1 The weak completeness axiom . . . . . . . . . . . . . . . . . 148 5.2.2 The strong completeness axiom . . . . . . . . . . . . . . . . 151

5.3 Models satisfying completeness . . . . . . . . . . . . . . . . . . . . 155 5.4 The fixed point property . . . . . . . . . . . . . . . . . . . . . . . . 160

5.4.1 The Σ-preorder . . . . . . . . . . . . . . . . . . . . . . . . . 160 5.4.2 PCF-models . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

6. Interpretations of PCF 168

6.1 Syntax and operational semantics . . . . . . . . . . . . . . . . . . . 169 6.1.1 Sequential PCF . . . . . . . . . . . . . . . . . . . . . . . . . 169 Table of Contents 9

6.1.2 Parallel extensions of PCF . . . . . . . . . . . . . . . . . . . 173 6.2 Denotational semantics of PCF . . . . . . . . . . . . . . . . . . . . 174

6.2.1 Interpretation of PCF . . . . . . . . . . . . . . . . . . . . . 175 6.2.2 The adequacy theorem . . . . . . . . . . . . . . . . . . . . . 178 6.2.3 Interpretations of PCF^{+} and PCF^{++} . . . . . . . . . . . . . 182

6.3 Relating variants of PCF . . . . . . . . . . . . . . . . . . . . . . . . 185 6.3.1 Type hierarchies in PCF-models . . . . . . . . . . . . . . . . 186 6.3.2 Translations between variants . . . . . . . . . . . . . . . . . 191

6.4 Full abstraction and universality . . . . . . . . . . . . . . . . . . . . 198 6.4.1 The definability lemmas . . . . . . . . . . . . . . . . . . . . 200 6.4.2 A more abstract approach . . . . . . . . . . . . . . . . . . . 206

7. Examples of realizability models 208

7.1 Review of classical domain theory . . . . . . . . . . . . . . . . . . . 209 7.1.1 Domains and continuous maps . . . . . . . . . . . . . . . . . 209 7.1.2 Effective domains . . . . . . . . . . . . . . . . . . . . . . . . 212 7.1.3 Interpretation of PCF^{++} . . . . . . . . . . . . . . . . . . . . 214

7.2 The model Mod(K_{1}) . . . . . . . . . . . . . . . . . . . . . . . . . . 216 7.2.1 Embedding EDom in Mod(K_{1}) . . . . . . . . . . . . . . . 217 7.2.2 Interpreting PCF^{++} in Mod(K_{1}) . . . . . . . . . . . . . . . 223

7.3 The models Mod(Pω) and Mod(Pω_{re}) . . . . . . . . . . . . . . . 226 7.3.1 Embedding EDom in Mod(Pω_{re}) . . . . . . . . . . . . . . 227 7.3.2 Interpreting PCF^{++} in Mod(Pω_{re}) . . . . . . . . . . . . . . 233

7.4 Term models and sequential PCF . . . . . . . . . . . . . . . . . . . 235 7.4.1 Some partial results . . . . . . . . . . . . . . . . . . . . . . . 236 7.4.2 A strategy for proving universality . . . . . . . . . . . . . . 246 Table of Contents 10 8. Program logics 251

8.1 Classical logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 8.2 Constructive logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

9. Conclusions and further work 267 9.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 9.2 Directions for further work . . . . . . . . . . . . . . . . . . . . . . . 274

Bibliography 278

Chapter 0

Introduction

This thesis can be seen as a contribution to the study of denotational semantics for programming languages. Denotational semantics attempts to provide mathematically rigorous descriptions of programming languages by giving “interpretations” of programs in terms of previously understood mathematical notions. For instance, if P is a program that takes an input and produces an output, we might take its interpretation to be some kind of function from the set of possible input-values to the set of output-values. One of the aims of denotational semantics is to provide precise formal definitions of programming languages, in contrast to informal language definitions which often contain ambiguities. Another aim is to deepen our understanding of the logic of programming languages: one can use mathematical reasoning about the interpretations of programs to prove facts about the programs themselves. A very long-term goal is to provide a mathematical foundation for ways of reasoning about programs that could be used by programmers.

Different approaches to denotational semantics have made use of different mathematical structures in giving interpretations of programs, and the kinds of mathematics involved have been extremely varied. The most widely-known approach is that of traditional domain theory: here the mathematical structures involved are usually sets equipped with a partial ordering (or more than one!) satisfying certain conditions. This approach was initiated by Scott and Strachey in [91]; since then it has developed into a large and fruitful research field (see e.g. [35]). But other very different sorts of mathematics have also been used—as a random selection of examples we mention concrete data structures [11], functor categories [66], and games [3,43].

In this thesis we focus on one particular approach to denotational semantics, involving mathematical structures known as realizability toposes. These originally arose in the study of mathematical logic, but have recently started to find applications in computer science. As settings for denotational semantics they possess some interesting and distinctive features: for instance, they provide a kind of “domain theory” in which every function between domains is “computable” in some sense. We will explore both the pure-mathematical theory of realizability toposes and their applications to the semantics and logic of programming languages. The languages we consider will be very simple in comparison with “real” programming languages, but they will serve to illustrate certain theoretical issues.

The study of realizability toposes can involve some quite sophisticated mathematics, and so we should make an effort to explain why this is worth the trouble. In this introductory chapter we will try to provide some orientation and motivation for the reader, and indicate broadly what this thesis achieves. In Section 0.1 we outline the history of the ideas that led to the discovery of realizability toposes, and discuss some of the reasons why they are interesting from the point of view of computer science. We also explain the general motivations behind the thesis. In Section 0.2 we outline more specifically the contents of the thesis and give a highlevel overview of each chapter. Throughout this introduction we will presuppose some familiarity with basic ideas from logic, recursion theory and category theory.

0.1 Background and motivation

0.1.1 History of realizability toposes

We first give a historical account of the ideas behind realizability toposes. It seems possible (in retrospect) to see them as representing the convergence of two distinct strands of thought, which we discuss separately.

Logic and realizability

The first strand is the study of realizability interpretations for constructive logic. This started with Kleene in [48], who gave such an interpretation for first-order Heyting arithmetic and also coined the term “realizability”. Kleene’s idea was to define a relation “n realizes φ” between natural numbers and logical sentences, intended to express the idea that n provides computational “evidence” for the constructive content of the formula φ:

• n realizes t = t′ iff t = t′ holds;

• n realizes φ ∧ ψ iff fst(n) realizes φ and snd(n) realizes ψ;

• n realizes φ ∨ ψ iff either fst(n) = 0 and snd(n) realizes φ or fst(n) = 1 and snd(n) realizes ψ;

• n realizes φ ⇒ ψ iff whenever m realizes φ, {n}(m) exists and realizes ψ;

• n realizes ¬φ iff nothing realizes φ;

• n realizes ∃x.φ iff snd(n) realizes φ[fst(n)/x];

• n realizes ∀x.φ iff for every m, {n}(m) exists and realizes φ[m/x].

(Here {n}(m) denotes the result (if defined) of applying the nth partial recursive function to m, and fst, snd are the projections corresponding to some recursive and surjective “pairing” function N × N → N.) This definition of realizability can be seen as a way of giving an interpretation of constructive arithmetic within classical mathematics. Kleene showed that all provable sentences of Heyting arithmetic were realizable; however, there are many realizable sentences that are not provable in Heyting arithmetic, and even some that are classically false. The realizability interpretation can thus be used to show that certain counter-classical assertions are consistent with Heyting arithmetic.

Many other notions of realizability were subsequently introduced—for instance, the “modified realizability” of Kreisel [51] and the “function realizability” of Kleene-Vesley [50]—though Kleene’s original notion remained the “canonical” one.

The motivation for all these notions seems to have been mainly metamathematical: various notions of realizability could be used to provide interpretations of constructive logic showing the consistency of various intuitionistic principles. (For instance, the motivation for function realizability was to provide a classically understood model for second-order logic in which the “bar induction” principle was valid.) An extensive survey of applications of this nature is contained in [99].

One of the original motivations for the construction of realizability toposes was (or might have been) to show how these realizability interpretations could be extended to higher-order intuitionistic logic. A topos is a category that can be seen as a model for impredicative higher-order logic: types in the logic denote objects of the topos, and terms of the logic (including predicates) are interpreted by morphisms. In 1978, Hyland constructed the best-known example of a realizability topos, the effective topos, showing how Kleene’s original interpretation of firstorder arithmetic could be generalized to higher-order logic. (A similar construction was carried out by Powell at around the same time, yielding a “set-theoretic” rather than a categorical model.) Later Hyland, Johnstone and Pitts showed that a similar construction could be performed for a large class of other realizability interpretations, using an abstract framework known as tripos theory [76,41].

In fact, all the examples of realizability toposes explicitly considered in [41] were based on so-called standard realizability—a simple generalization of Kleene’s original notion in which the realizing objects need not be natural numbers but may be elements of any partial combinatory algebra (cf. Section 1.1). The standard realizability toposes are certainly a natural class of models to consider, and we will concentrate almost exclusively on them in this thesis. Other realizability toposes have also been studied by other people, notably van Oosten [68], who has investigated them mainly from a logical and metamathematical angle.

“Datatypes” and effective computations

The second strand of thought that we wish to mention emphasizes computation rather than logic, and it is this strand that is closer to the concerns of this thesis. We may sketch the idea briefly as follows.

We would like a general theory of “computable functions” in the context of programming languages. Of course the theory of recursive functions gives us a good understanding of computations over the natural numbers, but what do we mean by a “computable function” over an arbitrary datatype? In order to address this question it is clearly not sufficient to understand the datatype simply as the set of its values, since this would give no way of distinguishing computable functions from non-computable ones.

The key observation is that the elements of any datatype are represented in a computer by more “primitive” objects (e.g. sequences of binary digits) for which we already have a good notion of computation, and “computations” on elements of the datatype actually consist of computations on these underlying representations. This suggests that we should understand a datatype as a set of values together with a set of “machine representations” for each value. More or less equivalently, we could understand it as an equivalence relation on some set of “machine values”, two machine values being deemed equivalent iff they represent the same value of the datatype.

In an abstract mathematical theory it seems reasonable to take our “machine representations” to be natural numbers rather than actual sequences of bits, and to use the notion of computation given by basic recursion theory. We are thus led to view datatypes as partial equivalence relations (PERs) on the natural numbers, and computable functions as morphisms between PERs. The category of PERs can ultimately be traced back to Kreisel [51]; it also appeared in Girard’s thesis [32], where it was used to give an interpretation of the datatypes of System F. The idea of using natural numbers to represent elements of datatypes seems more explicit in the work of Ershov [22], who considers in effect the category of total equivalence relations on the natural numbers.

In fact we can be slightly more general: instead of taking natural numbers as our machine values we could take elements of any partial combinatory algebra, e.g. a term model for the untyped λ-calculus. From a computer science point of view this would not be completely unrealistic: indeed implementations of functional languages are often based on reduction in the untyped λ-calculus.

We should now explain what all this has to do with realizability toposes. Hyland showed in [38] that the effective topos contains a full subcategory equivalent to the category of PERs on N (the situation for other standard realizability toposes is similar). This subcategory will play a very important role in this thesis, where it will be called the category of modest sets. The definition of modest set that we will give in Section 1.2 closely follows the above idea of a datatype as a set of values with machine representations for each value. A slightly larger subcategory is the category of assemblies—the only difference between these and modest sets is that in assemblies we allow the same machine value to represent more than one value of the datatype.

Subsequently, Freyd et al [15] showed that rather than constructing the realizability topos and then “discovering” these subcategories, one can take the category of assemblies as primary and then obtain the topos as its “completion” in a suitable abstract sense. This is the construction that we will use in this thesis (see Section 1.3)—for our purposes it seems preferable to the “logical” construction via tripos theory since it lays greater emphasis on the computational aspects of realizability toposes.

0.1.2 Realizability toposes in computer science

We have seen that notions of “computation” are built into the nature of realizability toposes. We now turn to examine the reasons why these toposes are interesting from the point of view of computer science itself, and some of the applications they have found there. Research in this field seems to fall roughly into two distinct (but overlapping) areas.

Modelling polymorphism

The first area of application has been in modelling polymorphic languages. Polymorphic programs embody algorithms that can be applied to values of many different datatypes: for example, the algorithm for reversing a list of values of type t is the same no matter what t is, and so this algorithm can be represented by a polymorphic program. In a typed programming language, such a polymorphic program will have a polymorphic type. Polymorphic types thus often involve an (explicit or implicit) quantification over all datatypes of the language, and in fact this is a serious obstacle to modelling them using classical set theory (see [82]). However, it turns out that polymorphic types can be interpreted “set-theoretically” using realizability toposes. (We will not go into the reason why this is so here.)

We mentioned earlier that Girard had used the category of PERs to model the second-order polymorphic λ-calculus (System F) in [32]. In 1985 Moggi and Hyland discovered that the subcategory of modest sets in the effective topos was closed under arbitrary products, at least from the point of view of the topos itself (see [39]). This was the technical breakthrough that made it possible to give explicitly “set-theoretic” interpretations of System F (see e.g. [77,56]). Later, Hyland et al [44] showed that the subcategory of modest sets was actually “complete” in an even stronger sense, thereby allowing set-theoretic interpretations of more powerful polymorphic systems such as the Calculus of Constructions (e.g. [19,95]). In a slightly different vein, Hyland and Ong [42] showed that strong normalization results for many polymorphic type theories could be proved using toposes based on modified realizability.

These “type-theoretic” applications of realizability toposes have been very successful, but we will not touch on them much in this thesis.

Synthetic domain theory

The concerns of this thesis are much closer to the second area of application: the use of realizability toposes as a source of “categories of domains” for denotational semantics. This idea goes back to Scott, who in a talk given in 1979 suggested that one should try to find “domains” that could be regarded as just sets in some constructive “universe” (e.g. a topos). Domain-theoretic constructions would then be reduced to familiar “set-theoretic” ones, and in particular we would be able to exploit the higher-order logic of the topos to reason about domains. The study of such categories of domains inside toposes became known as synthetic domain theory (the use of the adjective “synthetic” here stemmed from an analogy with synthetic differential geometry). From the beginning, the motivation seems to have been the hope that the “domains as sets” idea would yield a simpler and cleaner form of domain theory than the classical one.

It later turned out that realizability toposes did indeed provide examples of constructive universes in which suitable domain-like objects could be found. This accorded well with the idea that many of the objects in realizability toposes could be understood as “datatypes”. In [60,59] McCarty showed that (essentially) the classical category of effective Scott domains arose as a full subcategory of the effective topos. The Ph.D. theses of Rosolini [85] and Phoa [71] studied particular categories of domains in the effective topos (and other models) whose definitions were completely “internal” (i.e. given entirely in the higher-order logic of the topos). Hyland [40] and Taylor [97] have subsequently proposed more “axiomatic” approaches to synthetic domain theory, with domains in the effective topos as the motivating example.

Other people have also studied categories of domains in realizability models but from a more “external” point of view, in the traditional spirit of classical mathematics (see e.g. [26,1,5]). A few people have actually used some of these domains for denotational semantics, e.g. Amadio [6] and Phoa [75], who has used realizability models to give an interesting proof of the adequacy of translations of PCF into the untyped λ-calculus.

The overall impression gained from the literature to date is that many realizability toposes do contain categories of domains with a great deal of interesting structure, rich enough to model strong polymorphism, recursive types, subtypes and non-determinism, for instance. However, much of the work cited above depends on some fairly sophisticated mathematical machinery, and synthetic domain theory sometimes appears to outsiders as obscure and impenetrable. So despite many interesting developments, it seems only fair to admit that the original aim of “simplicity” has not yet been achieved. Also it seems that the techniques used to study different realizability toposes, or different categories of domains within the same topos, have been rather ad hoc and have not exhibited much of a general pattern, in spite of the axiomatic work of Hyland and Taylor.

0.1.3 Motivation for this thesis

Having set the historical scene, we now explain the general motivation (both practical and philosophical) behind the work in this thesis.

In [25] Fourman and Phoa proposed that synthetic domain theory could be used to give a “set-theoretic” semantics for the functional fragment of the ML programming language. The idea was that this would provide a formal justification for a “naive” way of reasoning about programs, and could give a semantic foundation for program logics in the spirit of Extended ML [47]. As originally conceived, this thesis was to have been an attempt to work out the details of such a semantics for a fragment of ML in the effective topos, and hence to obtain a sound program logic for this fragment.

However, in pursuing this direction I became increasingly aware that the effective topos was probably not the best model to use, and that other realizability toposes deserved further attention. It was therefore natural to ask: what are the important similarities and differences between realizability toposes when it comes to doing denotational semantics? Most work in synthetic domain theory had concentrated on the effective topos, and even though some people had considered other realizability models (e.g. in [71,5]), there had been very little investigation of the general theory of realizability toposes. It was from a consideration of these more theoretical issues that the present thesis emerged.

It is worth recounting the particular observation that first sparked my interest in these questions. This concerned a difference between the effective topos and the realizability topos based on a term model for the untyped λ-calculus. Both these toposes are constructed from notions of “computability”, and one might have thought that these notions were somehow “equivalent” in view of the fact that in each case the definable partial functions from N to N are precisely the partial recursive ones. (Indeed Freyd conjectured, perhaps for this reason, that the two toposes were actually equivalent, though this was refuted in [46].) However, although the two toposes indeed contain the same functions N → N_{⊥}, it turns out that they give different classes of functions at more complex types: for instance, the effective topos contains a morphism corresponding to the “parallel-or” function, but the topos based on the λ-calculus does not (see [72]). Thus the two models appear to embody different “notions of computability”. To understand the difference, It is instructive to think about the nature of “computations” in the two partial combinatory algebras. In the PCA consisting of the natural numbers with Kleene’s application, a computation may perform any arithmetical operation whatsoever on its argument, and different computations can be performed “in parallel” by interleaving them. In the term model for the λ-calculus, however, there is no way in which a computation can “look inside” a λ-term and examine its syntax—the only way in which a computation can use its argument is as a “black box” (e.g. it can apply it to other arguments).

This fact came as a surprise to me, and I was intrigued by the nature of the difference between the two PCAs. It suggested some connection with the work of Plotkin [79] and Sazonov [86] on “sequential” and “parallel” versions of the programming language PCF. From a practical point of view, it seemed likely that the λ-term model would yield a better (e.g. more fully abstract) model than the effective topos for a sequential language such as ML.

The starting-point of this thesis, then, is the informal idea that a PCA represents a “notion of untyped computation”. Of course, there are PCAs that are not intuitively “implementable”, and so in these cases the notion of computation will not be a very realistic one! Nevertheless, it is possible to view any PCA as giving an abstract notion of computability: we can regard the PCA as defining what is meant by “computation”, and proceed from there. In terms of our earlier remarks on modest sets and assemblies, we can think of a PCA as an “abstract machine” on top of which we can implement various interesting “datatypes” (as modest sets). The PCAs discussed above provide a good example of two very different “flavours” of computation. In this thesis we will develop some general theory that is common to all (or several) PCAs, and also investigate some of the differences between particular PCAs (and the corresponding realizability toposes). We will also study how our models relate to various versions of the language PCF.

Besides considering PCAs as abstract machines in isolation from one another, it is also natural to ask what are the relationships between different PCAs. We mentioned earlier that many functional languages are (or can be) implemented in terms of reduction algorithms for the untyped λ-calculus; but these algorithms are themselves implemented in terms of sequences of binary digits—thus our highlevel language can be seen as implemented on either of two abstract machines, corresponding to two “levels of abstraction”. Moreover, the fact that one of these abstract machines is implemented on the other suggests a way of relating the two PCAs. In the earlier chapters of this thesis we will introduce a notion of applicative morphism between PCAs that makes this idea precise. We will only study applicative morphisms from a pure-mathematical point of view here, but the definition was actually inspired by this metaphor from computer science.

0.2 Overview of this thesis

Having discussed the general motivation, we now describe more specifically what is contained in this thesis.

In the thesis we study the general theory of standard realizability toposes (and certain subcategories of them), and their application to the semantics and logic of simply-typed functional programming languages. The overall structure of the thesis exhibits a gradual progression from theory to practice. In Chapters 1–3 we study the abstract theory of realizability toposes and the relationships between them. This material can be viewed as pure mathematics, and there is hardly any discussion of computer science applications in these chapters. In Chapters 4–5 we start to move towards computer science, and develop some “domain theory” in realizability toposes. In Chapters 6–7 we use this theory to give denotational semantics for several versions of PCF. Finally in Chapter 8 we discuss how our models give rise to logics for reasoning about programs in these languages.

Prerequisites

First, a few words on the prerequisites for reading the thesis. I have tried to keep these to a minimum; in particular I have consciously avoided reference to sophisticated ideas from “advanced” category theory as far as possible. No familiarity with fibrations, internal categories, general topos theory or the internal logic of toposes is presupposed. However, it has been necessary to assume a reasonable degree of fluency in “basic” category theory: categories, functors, natural transformations, limits and colimits, adjunctions, and cartesian-closed categories (the first five chapters of [57] should suffice). A vague acquaintance with monads and with enriched categories is required in one or two places.

The only other formal prerequisites are a knowledge of basic recursion theory (e.g. the first seven chapters of [17]) and some knowledge of the untyped λ-calculus (e.g. Chapter 2 of [8]). In a few parts of the thesis (Sections 3.2, 5.3, 7.4) we use some rather more technical facts about the λ-calculus (e.g. the theory of Böhm trees), but the reader unfamiliar with these will not be at much of a disadvantage except in these sections.

Some knowledge of classical domain theory and denotational semantics would also be extremely helpful. For background in this area, we strongly recommend Plotkin’s classic paper “LCF considered as a programming language” [79].

Synopsis

We now give a chapter-by-chapter summary of the contents of the thesis and point out some of the important landmarks.

The first three chapters are “pure theory”. In Chapter 1 we give a brief introduction to the general theory of partial combinatory algebras. For an arbitrary PCA A we then construct the category Ass(A) of assemblies and the category Mod(A) of modest sets over A, and review some of their standard properties. Next we give Freyd’s construction of the realizability topos RT(A) as a “completion” of Ass(A). We also obtain a new result saying that Ass(A) can itself be seen as the completion of Mod(A) in a suitable sense (Theorem 1.4.5).

In Chapter 2 we introduce the notion of applicative morphism between PCAs (Definition 2.1.1), inspired by the idea of “implementing” one abstract machine in terms of another. Mathematically, the main interest in these lies in the fact that applicative morphisms A → B correspond precisely to certain functors Ass(A) → Ass(B) (Theorem 2.2.20). Similar results hold for RT and Mod. A pleasing consequence of these results is a precise characterization of when two realizability toposes are equivalent (Corollary 2.3.8). We also investigate how certain properties of applicative morphisms correspond to certain properties of the functors they give rise to.

Chapter 3 is devoted to applications of the theory developed in Chapter 2. It turns out that applicative morphisms arise from a wide variety of situations in mathematics and computer science. Besides giving a selection of examples, we use our theory to prove two new inequivalence results. One of these states that term models for the call-by-name and call-by-value λ-calculi give rise to inequivalent realizability toposes (Theorem 3.2.18). The other states that the topos arising from Scott’s graph model Pω_{re} is not equivalent to one arising from a λ-term model. The proof of this latter result is especially interesting computationally, as it relies on the idea that λ-term models embody a “sequential” notion of computation while Pω_{re} embodies a “parallel” one.

In Chapter 4 we start to build the mathematical machinery we need in order to do denotational semantics. Since the languages we wish to model allow partial functions to be defined, we need a theory of partial maps in our categories—this is provided by Rosolini’s theory of dominances (see [85]). We review this theory and discuss dominances within realizability models. We also introduce the notion of a divergence on a PCA (Definition 4.3.1). A divergence is essentially a subset of the PCA consisting of the elements (if any) that we wish to regard as representing non-terminating computations. We discover that every divergence gives rise to a dominance, and that several examples of dominances that have previously been considered can be obtained via the notion of divergence.

We also need the mathematical machinery to interpret recursion in our programming languages, so we would like a theory of fixed points. We develop such a theory in Chapter 5, working in the general setting of an arbitrary realizability model with dominance. Much of the material here is joint work with Alex Simpson—specific details of the attribution are given in loco. We show that in our setting one simple “Completeness Axiom” suffices to ensure that the model contains a category of “predomains” with very good closure properties—we call this the category of well-complete objects. We also show that several natural examples of models do indeed satisfy the Completeness Axiom, and hence that our approach offers a unified treatment of various models previously studied separately. In fact, our work here seems to be the first treatment of synthetic domain theory that unifies “sequential” and “parallel” models of computation.

In Chapter 6 we use our models for some denotational semantics. We consider the sequential language PCF, as well as extensions PCF^{+} and PCF^{++} obtained by adding a “parallel-or” operator and an “exists” functional. Moreover, we consider call-by-name, call-by-value and lazy variants of each of these languages. We show that any realizability model equipped with a dominance satisfying the Completeness Axiom admits adequate interpretations of all three variants of sequential PCF, and consider the circumstances under which these extend to interpretations of the “parallel” languages. In fact, in this chapter we will not work concretely with realizability models, but with an abstract categorical notion of “PCF-model”. There are many examples of PCF-models other than realizability models, and it is just as easy to prove our results at this greater level of generality.

We also obtain some general results concerning the related properties of full abstraction and universality. An interpretation of a programming language is called fully abstract if observationally equivalent terms of the language are always assigned the same denotation in the model; it is called universal if every element of the model (of an appropriate type) is denotable by some term of the language. We show that the call-by-name, call-by-value and lazy variants of each of our languages are “equivalent” in some sense, at least from the point of view of questions of full abstraction and universality. We obtain these results by means of syntactic translations between the variants. These results may be seen as a slight digression from the main line of the thesis in that they are not specific to realizability models; however, we apply them to realizability models in Chapter 7.

Chapter 7 can be seen as the climax of the thesis. Here we investigate more fully the idea that some PCAs embody “sequential” notions of computation while others embody “parallel” ones. We focus on three particular PCAs: the model K_{1} consisting of the natural numbers with Kleene application; the Scott graph model Pω_{re}; and a term model Λ^{0}/B for the untyped λ-calculus. We show that the classical category of effective Scott domains can be regarded as a full subcategory of either Mod(K_{1}) or Mod(Pω_{re}) (the former result is due essentially to McCarty), and hence that both these categories provide universal and fully abstract models of all three variants of PCF^{++}. We also discover a sense in which Mod(Pω_{re}) is mathematically the nicer of the two models.

The main open problem raised by this thesis is the conjecture that the model Mod(Λ^{0}/B) provides a universal (and hence fully abstract) model for sequential PCF. Although we have been unable to prove this conjecture, we obtain some partial results, for instance the fact that this model is fully abstract at type 3 (at least for call-by-value PCF). We discuss the evidence for the conjecture and some of our attempts at proving it.

In Chapter 8 we consider logics for reasoning about programs. We examine two different ways in which our models give rise to program logics. The first of these involves a very simple-minded classical logic, for which we can give a (classical) set-theoretic interpretation using our models. The second involves a constructive logic, which we can interpret essentially as the internal logic of a realizability topos. In both cases we can give an alternative interpretation of the logic in terms of purely “operational” concepts intelligible to programmers. We investigate the problem of finding models in which the denotational interpretation of the logic coincides with the operational one—this property has been called logical full abstraction by Plotkin.

We conclude in Chapter 9 with some philosophical discussion of our results, and some suggestions for further research.

Interdependence of chapters

The approximate interdependence of the chapters in this thesis is given by the partial order generated by 1 ⪯ 2 ⪯ 3, 1 ⪯ 4 ⪯ 5 ⪯ 6 ⪯ 7 ⪯ 8. There are a few points at which this dependence relation is violated, but in these cases we give an explicit backward reference.

As mentioned earlier, the material in Chapters 2 and 3 is of mainly puremathematical interest and at present has no direct application in computer science. For readers whose main interest is in computer science, we therefore recommend the following short cuts. Sections 1.1 and 1.2 should be read in detail, but Section 1.3 could be skimmed, since in practice the topos RT(A) plays a much smaller role than Mod(A) and Ass(A) in later chapters. Section 1.4 could be omitted completely. We would then suggest skipping the whole of the next two chapters and proceeding straight to Chapter 4. However, the reader unfamiliar with the construction of the Scott graph models Pω and Pω_{re} will need to refer to the beginning of Section 3.3, since these PCAs reappear in Section 5.3 and play major roles in Chapters 7 and 8.

In principle Chapter 6 is logically almost entirely independent of the rest of the thesis, and may contain material of interest to workers in other areas of semantics. It interfaces with the rest of the thesis via Paragraph 5.4.2, where the abstract categorical notion of “PCF-model” is introduced. It would thus be possible to read just Paragraph 5.4.2, ignoring all references to realizability models, and then the whole of Chapter 6. (Of course, we hope that by then the reader would want to understand the applications of this material in Chapter 7!)

Notation

The set-theoretic and categorical notation used in this thesis is mostly fairly standard. We draw a few points to the reader’s attention here.

First some set-theoretic notation: If X and Y are sets, we write f : X ⇀ Y to mean that f is a partial function from X to Y. If f is a partial or total function, we write Dom f, Im f to denote the set-theoretic domain and image of f respectively. We also write r : X ⟶^{|} Y to mean that r is a total relation from X to Y, i.e. r ⊆ X × Y satisfies ∀x ∈ X. ∃y ∈ Y. r(x, y). We write PX to denote the powerset of X; P_{1}X for the set of non-empty subsets of X; and P_{fin}X for the set of finite subsets of X. We take (−, −) to be some standard pairing operation, and write X × Y for the set {(x, y) | x ∈ X, y ∈ Y }. We write X + Y for the set {(0, x) | x ∈ X} ∪ {(1, y) | y ∈ Y }. We also write X ⊔ Y for the union of X and Y where these are implicitly assumed to be disjoint. We write N for the set of natural numbers (including 0); we sometimes write ω in place of N where this seems to suit the context better.

Now some categorical conventions: If f is a morphism in some category, we may write dom f and cod f for its domain and codomain in the categorical sense. Given two morphisms f : A → B and g : B → C, we write their composition as either gf or g ∘ f, without much consistency. We write id or id_{A} for the identity morphism on an object A, reserving the symbol 1 for the terminal object of a category. Given morphisms f : C → A and g : C → B, we write ⟨f, g⟩ for the induced morphism C → A × B. Likewise, given f : A → C and g : B → C we write [f, g] for the induced morphism A+B → C. In general we use N (as distinct from N) to denote the natural number object in a category.

We sometimes abbreviate a finite list of variables x_{1}, …, x_{n} by a vector x⃗. If M and N are terms in some syntax, we write M[N/x] for the result of substituting N for all occurrences of x in M (renaming bound variables if necessary).

PCAs and realizability toposes

In this chapter we introduce the categories that we will study in this thesis, and summarize the facts about assemblies, modest sets and realizability toposes that we will need. We presuppose some elementary category theory and recursion theory, but no knowledge of topos theory is assumed.

The material in Sections 1–3 is not original. In Section 1.1 we give a brief review of the theory of partial combinatory algebras (PCAs), the structures from which the various categories of interest are built. In Section 1.2 we introduce two categories that can be constructed from a PCA A: the category Ass(A) of assemblies and the category Mod(A) of modest sets. In Section 1.3 we obtain the realizability topos RT(A) as the exact completion of Ass(A). Throughout these sections we draw freely on results from the literature, and give proofs only when these contribute extra information that we require later on.

In Section 1.4 we give a characterization of Ass(A) via a universal property. This result appears to be new; however, the proof is rather technical and we only use the result once in the rest of the thesis. The reader would therefore be well advised to skip the whole of Paragraph 1.4.2 on a first reading.

There are many ways in which the material in this chapter could be presented. We have given particular prominence to Ass(A) and Mod(A), since it is these categories that are most important from the point of view of programming language semantics. In order to keep our account as elementary as possible, we have also avoided using the sophisticated conceptual apparatus of categorical logic. Inevitably this has meant giving a rather one-sided picture. For readers interested in understanding the logical aspects of these categories, we warmly recommend the paper [41] as a supplement to our account.

1.1 Partial combinatory algebras

We begin with an introduction to the theory of partial combinatory algebras (PCAs). Most of this material is covered in Chapter VI of [10]; detailed accounts of the theory of total combinatory algebras may also be found in [7,8,36].

PCAs can be regarded loosely as “abstract machines”, within which certain “computations” can be performed. It is this computational aspect of PCAs that we emphasize here, since this is what gives rise to the computational flavour of the categories that we will consider. We begin with some definitions and notation.

1.1.1 Definitions and examples

Definition 1.1.1 A partial applicative structure (A, ·) is just a set A equipped with a partial binary operation (x, y) ↦ x · y.

We think of the operation · as a kind of “function application”; note, however, that we are in an untyped setting where functions can be applied to other functions and even to themselves. We normally denote application by left-associative juxtaposition, so that we write e.g. xy(zx) in place of (x · y) · (z · x).

If a, b ∈ A, note that the expression ab need not denote an element of A; hence we need to be careful to distinguish elements of A from expressions over A. We can formalize the notion of expression as follows.

Definition 1.1.2 Assume we have an infinite supply of variables x_{0}, x_{1}, …, and for each a ∈ A we have a constant c_{a}. The set E(A) of formal expressions over A is freely constructed from the variables and constants using juxtaposition:

x_{i} ∈ E(A),  c_{a} ∈ E(A),  e, e′ ∈ E(A) ⇒ (ee′) ∈ E(A).

When writing expressions we normally write just a in place of c_{a}, and omit unnecessary parentheses. We use e, e′, … as meta-variables ranging over E(A). If e, e′ are expressions and x is a variable, then e[e′/x] means the expression obtained by substituting e′ for x in e. We call a formal expression closed if it contains no variables. Note that a closed expression e ∈ E(A) may or may not denote an element of A; we write e↓ to mean “e is defined” (i.e. e denotes an element of A), and e↑ to mean “e is undefined”. Note that if ee′ ↓ then both e↓ and e′ ↓. If e, e′ are closed, we write e = e′ to mean “e, e′ are both defined and denote the same value” (strict equality), and e ≃ e′ to mean “if either e or e′ is defined then so is the other and they denote the same value” (Kleene equality). More generally, if e, e′ are expressions whose variables are among x_{1}, …, x_{n}, we write

e↓  to mean e[a⃗/x⃗]↓ for all a_{1}, …, a_{n} ∈ A;
e ≃ e′ to mean e[a⃗/x⃗] ≃ e′[a⃗/x⃗] for all a_{1}, …, a_{n} ∈ A

and so on. Using this notation we can now give our main definition.

Definition 1.1.3 (PCA) A partial combinatory algebra (PCA) is an applicative structure (A, ·) such that there exist elements k, s ∈ A satisfying

kxy = x, sxyz ≃ xz(yz), sxy↓

(where x, y, z are variables). A total combinatory algebra is just a PCA in which application is total (i.e. ab↓ for all a, b ∈ A).

Remarks 1.1.4 (i) By abuse of language we normally say “A is a PCA”, where the application operation is understood.

(ii) Note that in this definition k, s need not be unique, and the choice of k, s is not part of the data for a PCA. Nevertheless, we often implicitly assume that PCAs do come equipped with a chosen k and s, and so use these symbols (or sometimes k_{A}, s_{A}) without apology as constants denoting elements of A.

(iii) It is traditional in the definition of PCA to require also that k ≠ s; however, for our purposes it seems more natural not to insist this. It is easy to show that k = s iff A contains just one element. We write 1 to denote the trivial (one-element) PCA.

(iv) We will write i to denote the element skk. Note that i represents the identity function: ix = x for all x ∈ A.

We now give a couple of examples of PCAs for motivation. Many more examples will be introduced in Chapter 3.

Examples 1.1.5 (i) Consider the set N of natural numbers equipped with Kleene application: m · n ≃ {m}(n), where {m} denotes the partial recursive function coded by m. The existence of k, s with the required properties is an immediate consequence of the S-m-n theorem (see e.g. [17, Chapter 4]). We refer to this PCA as K_{1}, or Kleene’s first model. Technically, the definition of K_{1} is dependent on a particular encoding of the partial recursive functions as natural numbers; however, for most purposes the choice of encoding will be irrelevant.

(ii) Let Λ denote the set of terms of the untyped lambda-calculus (over a countably infinite set of variables). Let Λ/β be its quotient modulo β-equality (see e.g. [8, Chapter 4]), with the inherent application. This defines a total combinatory algebra: for k, s we may take (the equivalence classes of) the lambda-terms k ≡ λxy.x, s ≡ λxyz.xz(yz).

1.1.2 Combinatory completeness

The definition of PCA may seem somewhat mysterious. It is motivated by the fact that the axioms for a PCA imply the following crucial property, which says that all “definable functions on A” are representable by an element of A itself.

Proposition 1.1.6 (Combinatory completeness) Let A be a PCA. Then for any e ∈ E(A) there is a formal expression λ^{∗}x.e ∈ E(A), whose variables are just those of e excluding x, such that (λ^{∗}x.e)↓ and (λ^{∗}x.e)a ≃ e[a/x] for all a ∈ A.

Proof We define λ^{∗}x.e by induction on the structure of e: λ^{∗}x.x is i; λ^{∗}x.y is ky if y is a constant or variable other than x; and λ^{∗}x.uv is s(λ^{∗}x.u)(λ^{∗}x.v). □

Remarks 1.1.7 (i) It is easy to see that any partial applicative structure with the combinatory completeness property is in fact a PCA.

(ii) If e ∈ E(A), the notation λ^{∗}x.e is to be seen as meta-syntactic sugar for some expression e′ involving k and s. A meta-expression such as λ^{∗}x.λ^{∗}y.e can be translated to a formal expression by first translating λ^{∗}y.e to e′, then translating λ^{∗}x.e′ to e′′. We abbreviate λ^{∗}x.λ^{∗}y.e to λ^{∗}xy.e.

(iii) For any e ∈ E(A), we have λ^{∗}x.e↓ whether or not e↓. However, note that we may have e ≃ e′ but not λ^{∗}x.e ≃ λ^{∗}x.e′ (consider e ≡ s, e′ ≡ kss).

(iv) The following is easy to prove by structural induction on e: if e′ ↓ and x does not appear in e′, then (λ^{∗}x.e)e′ ≃ e[e′/x].

(v) Note that in the PCA Λ/β the meanings of λx.e, λ^{∗}x.e coincide. However, we retain the distinction in notation since the lambda-term given by the definition of λ^{∗}x.e is in general not syntactically identical to λx.e.

We emphasize that the λ^{∗}-notation is meta-notation and is not part of the syntax of formal expressions. Consequently there are pitfalls associated with the use of λ^{∗}: for instance, it is not true in general that (λ^{∗}xy.x)e ≃ λ^{∗}y.e for every closed expression e, even if A is total (consider e ≡ ss). Since we would prefer to use λ^{∗}-notation where possible rather than long expressions involving k and s, it is worth taking some trouble to establish what instances of the “β-rule” are valid. (Other expositions seem to gloss over this rather delicate issue.)

Let M(A) be the set of formal meta-expressions over A, defined inductively as follows:

\begin{matrix}x_{i} ∈ M(A),  c_{a} ∈ M(A),  M, M′ ∈ M(A) ⇒ (MM′) ∈ M(A), \\ M ∈ M(A) ⇒ (λ^{∗}x_{i}.M) ∈ M(A). \end{matrix}

(Here M and M′ are meta-variables ranging over M(A).) We define the notions of free and bound variable in the obvious way, and call a meta-expression closed if it contains no free variables. We also write M[M′/x] to mean the meta-expression obtained by substituting M′ for x in M (renaming bound variables to avoid clashes). Clearly every meta-expression “evaluates” to a unique expression (which in turn might denote an element of A); we write M ↠ e to mean “M evaluates to e”. If M ↠ e and M′ ↠ e′, we can write M ↓ and M ≃ M′ to mean e ↓ and e ≃ e′ respectively. It is worth observing that λ^{∗}x.M ↓ for all M ∈ M(A).

Unfortunately, substitution at the levels of expressions and meta-expressions do not always agree: for example, we have (λ^{∗}y.x) ↠ kx and ss ↠ ss but not (λ^{∗}y.ss) ↠ k(ss). However, the two meanings of substitution do agree in certain instances:

Lemma 1.1.8 Suppose M, M′ ∈ M(A), e, e′ ∈ E(A), x, y are variables and a is a constant or variable. Then

(i) if λ^{∗}y.e ↠ e′ then λ^{∗}y.(e[a/x]) ↠ e′[a/x];

(ii) if M ↠ e then M[a/x] ↠ e[a/x];

(iii) if M ↠ e, M′ ↠ e′ and no free occurrence of x in M occurs under a λ^{∗}-abstraction, then M[M′/x] ↠ e[e′/x].

Proof (i) Easy by induction on the structure of e. The cases e ≡ x, e ≡ y and e some other variable need to be treated separately.

(ii) By induction on the structure of M. The cases M ≡ x, M a constant or variable other than x and M ≡ M_{1}M_{2} are easy. For the case M ≡ λ^{∗}y.M′, note that if M′ ↠ e′ then λ^{∗}y.e′ ↠ e. Hence by (i) we have λ^{∗}y.(e′[a/x]) ↠ e[a/x], and by the induction hypothesis we have M′[a/x] ↠ e′[a/x]. Hence M[a/x] ≡ λ^{∗}y.(M′[a/x]) ↠ e[a/x].

(iii) Easy by induction on the structure of M. Again the case M ≡ x has to be treated separately. □

Theorem 1.1.9 (Valid β-rules) Suppose M, M′ ∈ M(A), x is a variable and a is a constant or variable. Then

(β1) (λ^{∗}x.M)a ≃ M[a/x];

(β2) if M′ ↓, x ∉ FV(M′) and no free occurrence of x in M occurs under a λ^{∗}-abstraction, then (λ^{∗}x.M)M′ ≃ M[M′/x].

Proof (i) First note that if M ↠ e then regarding e as a meta-expression we have M ≃ e. So by Proposition 1.1.6 and part (ii) of the above lemma we have

(λ^{∗}x.M)a ≃ (λ^{∗}x.e)a ≃ e[a/x] ≃ M[a/x]

(note that e[a/x] has the same meaning whether e is regarded as an expression or a meta-expression).

(ii) Suppose M ↠ e and M′ ↠ e′. Then similarly by Remark 1.1.7(iv) and part (iii) of the above lemma we have

(λ^{∗}x.M)M′ ≃ (λ^{∗}x.e)e′ ≃ e[e′/x] ≃ M[M′/x]. □

We will use these two rules incessantly when performing calculations with combinators (i.e. elements of a PCA defined by meta-expressions). Note that M ≃ M′ implies MN ≃ M′N and NM ≃ NM′, and so we can legally perform βreductions of the above kinds on certain subterms of meta-expressions. However, we are not entitled to perform β-reductions underneath a λ^{∗}-abstraction, since M ≃ M′ does not imply λ^{∗}x.M ≃ λ^{∗}x.M′ (cf. Remark 1.1.7(iii)).

Although we will continue to make use of formal meta-expressions, henceforth we will never need to refer explicitly to the sets M(A), E(A) or the relation ↠.

1.1.3 Some important combinators

The relatively simple axioms for a PCA yield a surprising amount of “computational” structure. For instance, it turns out that all the partial recursive functions can be simulated in any PCA (other than 1). We now explore some of this structure in the setting of a general PCA.

The following proposition typically illustrates the use of the above β-rules in calculations involving combinators.

Proposition 1.1.10 (Pairing and booleans) Let A be any PCA.

(i) There exist elements pair, fst, snd ∈ A such that

pair x y↓, fst (pair x y) = x, snd (pair x y) = y (ii) There exist true, false, if ∈ A such that

if x y↓, if true y z = y, if false y z = z

Proof (i) Take pair = λ^{∗}xyz.zxy, fst = λ^{∗}v.v(λ^{∗}xy.x), snd = λ^{∗}v.v(λ^{∗}xy.y). First note that by rule β1 we have pair x y ≃ (λ^{∗}yz.zxy)y ≃ λ^{∗}z.zxy, and so pair x y↓. Next note that

fst (pair x y) ≃ (λ^{∗}v.v(λ^{∗}xy.x))(λ^{∗}z.zxy)
≃ (λ^{∗}z.zxy)(λ^{∗}xy.x)  (by β2)
≃ (λ^{∗}xy.x)xy  (by β2)
≃ (λ^{∗}y.x)y  (by β1)
≃ x  (by β1).

But clearly x↓, so fst (pair x y) = x. Similarly we can show snd (pair x y) = y.

(ii) Take true = λ^{∗}yz.y, false = λ^{∗}yz.z, if = λ^{∗}xyz.xyz. By a similar style of reasoning we can verify that these have the above properties. □

We will sometimes write pair_{A}, true_{A} etc. if A is not evident from the context. We will also write ⟨M, M′⟩ as syntactic sugar for (pair M M′).

We now show how the natural numbers can be represented in a PCA. Many different representations are possible, but the following is especially convenient:

Definition 1.1.11 (Curry numerals) Let A be a PCA. For each n ∈ N, we define an element \overline{n} ∈ A as follows: \overline{0} = i, \overline{n + 1} = ⟨false, \overline{n}⟩. We call \overline{n} the numeral for n.

Proposition 1.1.12 There exist elements succ, pred, iszero ∈ A such that

succ \overline{n} = \overline{n + 1}, pred \overline{0} = \overline{0}, pred \overline{n + 1} = \overline{n},
iszero \overline{0} = true, iszero \overline{n + 1} = false

for all n ∈ N.

Proof Take succ = λ^{∗}x.⟨false, x⟩, iszero = fst, pred = λ^{∗}x.if (iszero x) \overline{0} (snd x). Using Proposition 1.1.10 it is routine to check that these combinators have the required properties. □

Next we will show how to define functions by recursion in PCAs. The following combinators are very powerful tools for performing recursive definitions.

Proposition 1.1.13 (Fixed point combinators) There exist elements Y, Z ∈ A such that

Y f ≃ f(Y f), Zf ↓, (Zf)z ≃ f(Zf)z

Proof Let W = λ^{∗}xy.y(xxy), X = λ^{∗}xyz.y(xxy)z and take Y = W W, Z = XX. Then we have

Y f ≃ (λ^{∗}xy.y(xxy))W f
≃ (λ^{∗}y.y(W W y))f (by β1)
≃ f(W W f)  (by β1)
≃ f(Y f)

Similarly we can show that Z has the required properties. □

(Note in passing that in this proof we genuinely need the rule β1, whereas in the previous proofs we in fact only needed β2.)

One use for the combinator Z is to define a “primitive recursion” operator for the natural numbers. This gives us a convenient way of defining many functions on the numerals.

Proposition 1.1.14 There exists an element rec ∈ A such that

rec x f \overline{0} = x, rec x f \overline{n + 1} ≃ f \overline{n} (rec x f \overline{n}).

Proof Let R = λ^{∗}r. λ^{∗}xfm. if (iszero m) (kx) (λ^{∗}y. f (pred m) (rxf (pred m) i)) and take rec = λ^{∗}xfm. (ZR)xfmi. It is a good exercise in the use of β-rules to check that rec has the above two properties. □

In future we will often write down some combinator and claim that it satisfies some equations, leaving it to the conscientious reader to check that these can be proved using β1 and β2.

Notice that (in any PCA except 1) \overline{n_{1}} = \overline{n_{2}} implies n_{1} = n_{2} and so our PCA contains a faithful copy of the natural numbers. We mentioned above that other representations are possible: for instance, in the case A = K_{1} we could simply take \overline{n} = n. In fact it is immaterial what representation we choose, providing there exist elements corresponding to succ and rec:

Proposition 1.1.15 Suppose we have elements \overline{0}′, \overline{1}′, … ∈ A, and there are elements succ′, rec′ ∈ A satisfying

succ′ \overline{n}′ = \overline{n + 1}′, rec′ x f \overline{0}′ = x, rec′ x f \overline{n + 1}′ = f \overline{n}′ (rec′ x f \overline{n}′).

Then there exist c, d ∈ A such that c \overline{n} = \overline{n}′ and d \overline{n}′ = \overline{n} for all n.

Proof Take c = rec \overline{0}′ succ′ and d = rec′ \overline{0} succ. □

Using the constant rec, it is easy to see how any primitive recursive function can be represented in a PCA. In fact, with a little more work, one can show how to represent any partial recursive function. This gives some support to the informal idea that “PCAs are models of untyped computation.”

Theorem 1.1.16 Let A be a PCA. Then any partial recursive φ : N^{k} ⇀ N is (weakly) representable in A, i.e. there is e ∈ A such that for all m_{1}, …, m_{k}, n ∈ N we have

φ(m_{1}, …, m_{k}) = n ⟹ e \overline{m_{1}} … \overline{m_{k}} = \overline{n}.

Proof See [10, Section VI.2.8]. □

1.2 Assemblies and modest sets

Before constructing the realizability topos over a PCA, we need to discuss two other important categories: the category of assemblies and the category of modest sets. In this section we construct these categories and summarize some of their important properties. For a more thorough account of this material (worked out for the PCA K_{1}) we refer the reader to [39] or [74].

1.2.1 The categories Ass(A) and Mod(A)

Throughout this section A denotes a PCA. We first define the category of assemblies on A.

Definition 1.2.1 (Assemblies) (i) An assembly X on A consists of a set |X| together with a function assigning to each element x ∈ |X| a non-empty subset ∥x∥ of A. We call |X| the underlying set of X; and if a ∈ ∥x∥, we say a realizes (or is a realizer for) x. To avoid ambiguity we sometimes write ∥x∥_{X} or ∥x ∈ X∥ for ∥x∥.

(ii) Suppose X, Y are two assemblies on A. A function f : |X| → |Y | is said to be tracked by an element r ∈ A if for all x ∈ |X| and a ∈ A we have

a ∈ ∥x∥_{X} ⟹ ra ∈ ∥fx∥_{Y} .

A morphism f : X → Y is a function f : |X| → |Y | that is tracked by some r ∈ A. We write Ass(A) for the category of assemblies on A and morphisms between them.

Remarks 1.2.2 (i) It is easy to see that assemblies and their morphisms do form a category: for any assembly X the identity function id_{|X|} is tracked by i; and if f,g are composable morphisms tracked by r, t respectively, then gf is tracked by λ^{∗}a.t(ra).

(ii) In the above definition, the membership symbol ∈ is to be understood as a strict relation. Hence ra ∈ ∥fx∥_{Y} implies ra↓.

(iii) The category Ass(K_{1}) is frequently called the category of ω-sets in the literature (see e.g. [56]).

One way of understanding the definition of Ass(A) intuitively is as follows. We may think of an assembly X as a “datatype”, with |X| as the set of “values” of the datatype and ∥x∥ as the set of “machine-level representations” of the value x. A function f between datatypes maps values to values. If r tracks f, we may think of r as a “machine implementation” of f, since it operates on representations of x to produce representations of f(x). Thus, in Ass(A), the only morphisms that exist between datatypes are those that are “implementable”.

Following this intuition, it is natural to consider the class of “good” datatypes for which a value is determined by any of its machine representations. This motivates the following definition:

Definition 1.2.3 (Modest sets) An assembly X is called a modest set if for all x, x′ ∈ |X| we have

x ≠ x′ ⟹ ∥x∥ ∩ ∥x′∥ = ∅

Let Mod(A) denote the full subcategory of Ass(A) consisting of modest sets, and let J denote the inclusion functor Mod(A) ↪ Ass(A).

It is not difficult to see that Mod(A) is equivalent to the perhaps more familiar category of partial equivalence relations (PERs) on A.

We now review some categorical facts about Mod(A) and Ass(A), and give explicit descriptions of some of the structure. Our proofs are somewhat sketchy— for more details see e.g. [74].

Proposition 1.2.4 Both Mod(A), Ass(A) are cartesian-closed categories, and the inclusion J preserves the cartesian-closed structure.

Proof In both Mod(A) and Ass(A), the terminal object 1 is given by |1| = {∗}, ∥ ∗ ∥ = A. The product of X and Y is given by

\begin{matrix}|X × Y | = |X| × |Y |, \\ ∥(x, y) ∈ X × Y ∥ = \{ ⟨a, b⟩ | a ∈ ∥x∥_{X}, b ∈ ∥y∥_{Y} \} \end{matrix}

and the two projections are tracked by fst, snd. The exponential Y^{X} is given by

|Y^{X}| = {f : X → Y | f is tracked by some r ∈ A},

∥f ∈ Y^{X}∥ = {r ∈ A | r tracks f}

and the evaluation function X × Y^{X} → Y is tracked by λ^{∗}a.(snd a)(fst a). □

Proposition 1.2.5 In both Mod(A) and Ass(A), a morphism f : X → Y is mono iff f : |X| → |Y | is injective.

Proof Straightforward. □

Proposition 1.2.6 Both Mod(A), Ass(A) have finite limits (and J preserves them).

Proof Finite products were discussed above, so we only need to consider equalizers. Given f, g : X\overrightarrow{→}Y, let Z be defined by

|Z| = {x ∈ |X| | fx = gx} ∥x∥_{Z} = ∥x∥_{X}.

Clearly Z is a modest set if X is. The inclusion function e : |Z| → |X| is tracked by i; and it is easy to verify that e is the equalizer of f, g. □

Proposition 1.2.7 Both Mod(A), Ass(A) have finite sums (and J preserves them).

Proof The initial object 0 is defined by |0| = ∅. The sum of X and Y is given by

|X + Y | = |X| + |Y |,
∥(0, x) ∈ X + Y ∥ = { ⟨true, a⟩ | a ∈ ∥x∥_{X}},
∥(1, y) ∈ X + Y ∥ = { ⟨false, a⟩ | a ∈ ∥x∥_{X}}. □

Proposition 1.2.8 Both Mod(A), Ass(A) have a natural number object (and J preserves it).

Proof Let N be the modest set given by

|N| = N, ∥n ∈ N∥ = \{\overline{n}\}

and let 1 →^{Z} N →^{S} N be the morphisms tracked by λ^{∗}a.\overline{0}, succ respectively. If X is an assembly and we have maps 1 → X → X tracked by r, t respectively, then the unique mediating morphism N → X is tracked by rec (ri)(kt). So N is a natural number object in both categories. □

1.2.2 Regular categories

One important aspect of Mod(A) and Ass(A) is that they are both examples of regular categories—this is the aspect that we will concentrate on in the first three chapters of this thesis. Here we give only the definition of a regular category and a few very basic facts. For more background on regular categories and their significance in other areas of mathematics, see [29] or [9].

The following remarks may help to motivate the definition. Given f : X → Y, recall that h, k : Z\overrightarrow{→}X are a kernel-pair of f iff the diagram

[figure: Z; k; X; X; h; f; Y; f]

is a pullback. In this case we can think of the coequalizer of h, k as giving a categorical definition of the “image” of f. In Set, for instance, if c : X → W is the coequalizer of the kernel-pair of f, then c is the quotient of X by the equivalence relation induced by f; hence W ≅ Im f. We can view regular categories as categories in which good “images” exist:

Definition 1.2.9 (Regular category) A category is regular if it has finite limits and coequalizers of kernel-pairs, and furthermore the pullback of a regular epi along any morphism is a regular epi.

Recall that a regular epi is one that arises as a coequalizer. It is easy to check that (in any category with pullbacks) a morphism is a regular epi iff it is the coequalizer of its own kernel-pair. We may regard the “pullback” condition in the definition as saying that images are “well-behaved”.

The next two propositions, together with Proposition 1.2.6, show that Mod(A) and Ass(A) are regular categories.

Proposition 1.2.10 Both Mod(A), Ass(A) have coequalizers of kernel-pairs (and J preserves them).

Proof If f : X → Y is tracked by t, its kernel-pair h, k : Z\overrightarrow{→}X is given by:

|Z| = {(x, x′) | fx = fx′},
∥(x, x′) ∈ Z∥ = { ⟨a, a′⟩ | a ∈ ∥x∥_{X}, a′ ∈ ∥x′∥_{X}},

h, k are the evident projections tracked by fst, snd respectively. Now define the assembly W by

|W | = Im f, ∥y ∈ W ∥ = ⋃_{fx=y} ∥x ∈ X∥.

If X is a modest set then so is W. The evident function c : X → W is tracked by i, and it is easy to check that c is the coequalizer of h, k. □

Proposition 1.2.11 Given a diagram in Ass(A) of the form

[figure: Z′; h′; k′; X′; c′; W′; Z; h; k; X; c; W; g]

in which c is the coequalizer of its kernel-pair h, k, and the three evident squares are pullbacks. Then c′ is a coequalizer of its kernel-pair h′, k′.

Proof Without loss of generality we may suppose h, k, c are as in the proof of Proposition 1.2.10. Given g : W′ → W we may obtain explicit descriptions of the pullbacks; it is then routine to verify that h′, k′ are a kernel-pair of c′ and that c′ is a coequalizer of h′, k′. □

In diagrams we will frequently use arrows^{}^{}for monos and [figure] for regular epis. We mention here a few general facts about regular categories that will be useful later. The proofs are straightforward diagram-chases.

Proposition 1.2.12 The following hold in any regular category.

(i) Regular epis are closed under composition;

(ii) Every morphism f can be factored, uniquely up to isomorphism, as a regular epi followed by a mono. (We refer to this as the image factorization of f); (iii) Given a commutative diagram

[figure: X; e; W; m; Y; X′; e′; W′; m′; Y′]

there is a unique fill-in morphism W → W′ making both squares commute. □

The relevant structure-preserving maps between regular categories are exact functors (sometimes called regular functors). A functor is exact iff it preserves finite limits and coequalizers of kernel-pairs (or equivalently, preserves finite limits and regular epis). For example, the above propositions tell us that the inclusion J : Mod(A) ↪ Ass(A) is an exact functor. Exact functors play a very important role in what follows.

1.2.3 Uniform assemblies

We now turn our attention to a subcategory of Ass(A) that is equivalent to a much more familiar category: the category of sets!

Definition 1.2.13 Let ∇ : Set → Ass(A) be the functor defined as follows:

• |∇X| = X and ∥x ∈ ∇X∥ = A for all x ∈ X.

• If f : X → Y then ∇f = f (this is tracked for instance by i ∈ A).

We sometimes write ∇_{A} for ∇ to avoid ambiguity.

It is easy to see that ∇ is a full, faithful and exact functor and preserves exponentials (note that it does not preserve finite sums or the natural number object).

We call an assembly X uniform if its elements are “uniformly realized” by some a ∈ A, i.e. we have a ∈ ∥x∥ for all x ∈ |X|. It is simple to show that X is uniform iff it is isomorphic to an assembly in the image of ∇; hence the full subcategory of uniform assemblies is equivalent to Set. Uniform objects and modest sets in some sense represent opposite extremes in the class of assemblies— in fact, the only objects in both subcategories are (those isomorphic to) the initial and terminal objects 0 and 1. Note also that if X is uniform and Y is modest then every morphism X → Y is constant.

There is another important functor that we need to introduce:

Definition 1.2.14 Let Γ : Ass(A) → Set be the functor defined as follows:

• ΓX = |X|.
• If f : X → Y then Γf = f.

We sometimes write Γ_{A} for Γ to avoid ambiguity.

It is easy to see that Γ is naturally isomorphic to the “global elements” functor Hom(1, −). It is also clear that Γ is faithful, exact and preserves finite sums and the natural number object (however it does not preserve exponentials). The crucial fact about Γ is the following:

Proposition 1.2.15 The functor Γ : Ass(A) → Set is left adjoint to ∇, and Γ∇ = id.

Proof The fact that Γ∇ = id is obvious. For the unit of the adjunction, let η_{X} : X → ∇ΓX be the morphism determined by id_{|X|} and tracked by i. Given any morphism f : X → ∇Y, clearly f is the unique set-theoretic function f′ : |X| → Y such that f = (∇f′) ∘ η_{X}. (Note that η : id → ∇Γ is a natural transformation and that each component η_{X} is mono.) □

Remarks 1.2.16 (i) Alternatively we could define Γ to be the functor Hom(1, −); this is of course a more “categorical” definition. However, the definition we have given is technically more convenient, since we have Γ∇ = id “on the nose”.

(ii) In what follows we will write η : id → ∇Γ to denote the unit of the adjunction. However, we will also frequently abuse notation and write η_{X} : X → Y where Y is some object canonically isomorphic to ∇ΓX.

1.3 Realizability toposes

We now embark on the construction of the realizability topos RT(A). Many different (equivalent) constructions have been given (see e.g. [41,15,84])—our approach is based on that in [15], where RT(A) is defined as the exact completion of Ass(A). Actually, the fact that RT(A) is a topos will not really be exploited in this thesis, except perhaps in Section 8.2. In this section we concentrate mostly on some of the more basic categorical properties of RT(A).

1.3.1 The exact completion of a regular category

We begin by recalling some definitions concerning relations in a regular category. All the concepts here are straightforward abstractions of familiar concepts in the category of sets. In any regular category, a relation from X to Y is represented simply by a monomorphism ρ : R ↣ X × Y. For example, for any object X we always have the diagonal relation δ_{X} : X ↣ X × X. We say that ρ, ρ′ represent the same relation iff they are isomorphic as subobjects of X × Y (usually we will blur the distinction between representatives and their equivalence classes). If ρ, σ are two relations from X to Y, we write ρ ⊆ ρ′ if ρ = ρ′θ for some θ. Given ρ : R ↣ X × Y, we write ρ^{∘} for the corresponding reciprocal relation R ↣ Y × X. Finally, given relations ρ : R ↣ X × Y, σ : S ↣ Y × Z, we may define their relational composition σ.ρ as follows: take the pullback

[figure: P; k; S; R; h; π′ρ; Y; πσ]

and let σ.ρ : T ↣ X × Z be the mono appearing in the image factorization of the morphism ⟨πρh, π′σk⟩ : P → X × Z.

We are now in a position to give a categorical definition of an equivalence relation. Again this is a simple generalization of the set-theoretic notion:

Definition 1.3.1 In any category with pullbacks, an equivalence relation on an object X is a relation ρ : R ↣ X × X that is

reflexive:  δ_{X} ⊆ ρ,
symmetric: ρ^{∘} ⊆ ρ,
transitive: ρ.ρ ⊆ ρ.

It is easy to check that if h, k : Z\overrightarrow{→}X are a kernel-pair for f : X → Y then ⟨h, k⟩ : Z → X × X is an equivalence relation. If c is the coequalizer of h and k, we may think of c as the “quotient” of X by this equivalence relation. We will now consider categories in which good quotients exist for all equivalence relations.

Definition 1.3.2 A regular category is called exact if for every equivalence relation R ⟶^{r} X × X, the pair of morphisms πr, π′r : R\overrightarrow{→}X arises as a kernel-pair (and hence has a coequalizer).

Note that in [29] exact categories are called “effective regular categories”.

It can easily be seen that Ass(A) is not an exact category. The idea now is to turn it into one by formally “adding” good quotients of equivalence relations. We do this by means of a general construction that works for any regular category.

Definition 1.3.3 (Exact completion) Given a regular category C, let EC(C) be the category defined as follows:

• objects are pairs (X, ρ), where X is an object of C and ρ is an equivalence relation on X;

• morphisms (X, ρ) → (Y, σ) are relations τ : T ↣ X × Y that are

extensional:  σ.τ.ρ ⊆ τ,
total:  ρ ⊆ τ^{∘}.τ,
single-valued: τ.τ^{∘} ⊆ σ;

• the identity on (X, ρ) is the relation ρ from X to X;

• composition of morphisms is given by relational composition.

Remark 1.3.4 The intuition behind the definition of morphism in EC(C) is as follows. Recall that, in the category of sets, a relation τ : T ↣ X × Y is the graph of a function iff it is single-valued and total. But τ is single-valued precisely when τ.τ^{∘} ⊆ δ_{Y}, and total precisely when δ_{X} ⊆ τ^{∘}.τ. The conditions in the above definition are obtained by replacing the equality relation δ by a general equivalence relation.

It is easy to check that EC(C) is indeed a category, and that there is a faithful functor I : C → EC(C) defined by

I(X) = (X, δ_{X}); I(f : X → Y) = ⟨id_{X}, f⟩ : X ↣ X × Y.

The reader can now verify the following directly, or consult [29, §2.16]:

Proposition 1.3.5 EC(C) is an exact category, and I is an exact functor. □

Note that if ρ : R ↣ X × X is an equivalence relation in C, then the two morphisms I(πρ), I(π′ρ) : IR\overrightarrow{→}IX have as their coequalizer the evident morphism (X, δ_{X}) →^{ρ} (X, ρ). This justifies the remark that EC(C) is obtained by “adding quotients” to C.

The next theorem says that these quotients have in fact been added in a “universal” way. Here Ex[D, E] denotes the category of exact functors D → E and all natural transformations between them.

Theorem 1.3.6 For any exact category E, the functor (− ∘ I) : Ex[EC(C), E] → Ex[C, E] is part of an equivalence of categories. In particular, for any exact functor F : C → E, there is an exact functor F̃ : EC(C) → E, unique up to isomorphism, such that the triangle

C
[figure: F]
[figure: EC(C); I; F̃; E]

commutes up to natural isomorphism.

Proof See [29, §2.169]. □

Note that Ex(C) is determined uniquely up to equivalence by this universal property.

1.3.2 The topos RT(A)

We now apply the above construction to the regular category Ass(A). The surprise is that the category we obtain is not merely exact but in fact a topos (that is, a category with finite limits, exponentials and a subobject classifier).

Definition 1.3.7 The category EC(Ass(A)) is called the (standard) realizability topos on A, and is denoted by RT(A). We call RT(K_{1}) the effective topos, and denote it also by Eff.

The proof that RT(A) is a topos is non-trivial—see e.g. [29, §2.4]. (In fact the proof there is given just for K_{1}, but it is easily adapted to work for a general PCA.) For the reader wanting to learn about topos theory, a good recent text is [58]; other references include [45,33,9,52,29]. For most of this thesis, however, the following facts about RT(A) will suffice:

Theorem 1.3.8 RT(A) has exponentials, finite sums and a natural number object. Moreover, the functor I : Ass(A) → RT(A) is full and preserves all this structure.

Proof See e.g. [38]. □

There is one more piece of information about RT(A) that we need. Recall from Section 1.2.3 that ∇ : Set → Ass(A) is right adjoint to Hom(1, −). This situation extends to the whole of RT(A) as follows:

Proposition 1.3.9 Let Γ′ = Hom(1, −) : RT(A) → Set and ∇′ = I∇. Then Γ′, ∇′ are exact, Γ ≅ Γ′I, Γ′∇′ ≅ id and Γ′ ⊣ ∇′.

Proof Clearly ∇′ is exact since ∇ and I are exact, and it is easy to check that Γ′ preserves finite limits. To see that Γ′ preserves regular epis, we use the fact that for any object Z ≅ 0̸ of RT(A) there exists a morphism 1 → Z. Given f : X → Y regular epi and y ∈ Hom(1, Y), let w : Z → X be the pullback of Y along f. Then Z → 1 is regular epi, so in particular Z ≅ 0̸. Take any morphism z : 1 → Z and let x = wz : 1 → X; then fx = y. Hence Hom(1, f) is surjective, i.e. a regular epi in Set.

Clearly Γ ≅ Γ′I since Γ ≅ Hom(1, −) and I is full. Hence Γ′∇′ ≅ Γ′I∇ ≅ Γ∇ ≅ id. Also ∇′Γ′I ≅ I∇Γ, so by Theorem 1.3.6 the natural transformation Iη : I → I∇Γ extends to a natural transformation η′ : id → ∇′Γ′. The triangle laws for the adjunction Γ′ ⊣ ∇′ are easy to verify using Theorem 1.3.6. □

Our final proposition summarizes the most important facts from the last two sections.

Proposition 1.3.10 We have a diagram of regular categories and exact functors:

[figure: Mod(A); ⊂; Ass(A); I; RT(A)]

Set [figure: Γ; ∇]

in which

• all the categories are cartesian-closed and have finite sums and a NNO;

• all the functors are faithful;

• all the functors except Γ are full and preserve exponentials;

• all the functors except ∇ preserve finite sums and the NNO;

• Γ ≅ Hom(1, −), Γ ⊣ ∇ and Γ∇ ≅ id;

• RT(A) is a topos and is the exact completion of Ass(A). □

1.4 A universal property of Ass(A)

In the last section we gave an explicit description of RT(A), and saw how it could be characterized by a universal property involving Ass(A). In Section 1.2 we gave explicit descriptions of Mod(A) and Ass(A), and so it is natural to ask: Can Ass(A) be characterized by a universal property involving Mod(A)? In this section we give a positive answer to this question. The material here seems closely related to that in [14], though we have not yet explored the connections.

The following remarks may help to explain why the above question is interesting. We can use Mod(A) to provide a model e.g. for first-order arithmetic corresponding to the (standard) realizability interpretation over A (see [99,100] for background). One of the original motivations for constructing RT(A) was to provide a model of full higher-order logic (i.e. a topos) that extended this realizability interpretation. So it would be nice to know that RT(A) is in some sense the canonical way to extend Mod(A) to a topos. The results of the last section show how RT(A) canonically extends Ass(A); this section closes the gap and shows how Ass(A) canonically extends Mod(A). (Of course, since Ass(A) contains Set as a subcategory, this extension can only really be “canonical” relative to an ambient universe of sets!)

1.4.1 Γ-categories and ∇Γ-categories

Before stating our universal property, we introduce some technical definitions. This material is needed both for this section and for Chapter 2.

First recall that Mod(A) comes equipped with an exact functor Γ : Mod(A) → Set, whereas Ass(A) comes equipped with exact functors Γ, ∇ satisfying certain conditions. We now define 2-categories in which Mod(A), Ass(A) live as objects.

Definition 1.4.1 (Γ-category) A Γ-category is a regular category C equipped with an exact functor Γ_{C} : C → Set. A Γ-functor between Γ-categories is an exact functor F : C → D such that Γ_{D}F ≅ Γ_{C}. We write ΓReg for the 2-category of Γ-categories, Γ-functors and natural transformations.

Definition 1.4.2 (∇Γ-category) A ∇Γ-category is a regular category C equipped with exact functors Γ_{C} : C → Set and ∇_{C} : Set → C such that Γ ⊣ ∇ and Γ∇ ≅ id. A ∇Γ-functor between ∇Γ-categories is an exact functor F : C → D such that Γ_{D}F ≅ Γ_{C} and F ∇_{C} ≅ ∇_{D}. We write ∇ΓReg for the 2-category of ∇Γ-categories, ∇Γ-functors and natural transformations.

Remark 1.4.3 Mod(A) is a Γ-category, Ass(A) is a ∇Γ-category, and the inclusion J : Mod(A) ↪ Ass(A) is a Γ-functor. Also it follows from Theorem 1.3.8 and Proposition 1.3.9 that RT(A) is a ∇Γ-category and I : Ass(A) → RT(A) is a ∇Γ-functor.

The following proposition says that a ∇Γ-functor automatically preserves the unit of the adjunction Γ ⊣ ∇ modulo the obvious isomorphisms.

Proposition 1.4.4 If η, η′ are the units of the adjunctions Γ_{C} ⊣ ∇_{C}, Γ_{D} ⊣ ∇_{D} respectively and F : C → D is a ∇Γ-functor, then F η ≅ η′_{F} via the isomorphism F ∇_{C}Γ_{C} ≅ ∇_{D}Γ_{D}F.

Proof Naturality of η′ at F η_{X} gives

[figure: F X; η′_{F X}; ∇_{D}Γ_{D}F X; F ∇_{C}Γ_{C}X; F η_{X}; η′_{F ∇_{C}Γ_{C}X}; ∇_{D}Γ_{D}F ∇_{C}Γ_{C}X.; ∇_{D}Γ_{D}F η_{X}]

But ∇_{D}Γ_{D}F η_{X} ≅ F ∇_{C}Γ_{C}η_{X}, where Γ_{C}η_{X} is an isomorphism; also we have η′_{F ∇_{C}Γ_{C}X} ≅ η′_{∇_{D}Γ_{D}F X} which is an isomorphism. Hence F η_{X} ≅ η′_{F X} via the isomorphism F ∇_{C}Γ_{C}X ≅ ∇_{D}Γ_{D}F X. Moreover, this isomorphism is natural in X, and so F η ≅ η′_{F}. □

We are now ready to state the universal property of Ass(A). The rest of this section will devoted to its proof.

Theorem 1.4.5 For (B, Γ_{B}, ∇_{B}) any ∇Γ-category, the functor

(− ∘ J) : ∇ΓReg [Ass(A), B] ⟶ ΓReg [Mod(A), B]

is part of an equivalence of categories. In particular, for any Γ-functor F : Mod(A) → B, there is a ∇Γ-functor \overline{F} : Ass(A) → B, unique up to isomorphism, such that the diagram

Mod(A)
[figure: F]
[figure: Ass(A); J; \overline{F}; B]

commutes up to natural isomorphism.

Clearly this property determines Ass(A) uniquely up to equivalence.

1.4.2 Proof of the universal property

This paragraph is devoted entirely to the proof of Theorem 1.4.5. We start with some important definitions:

Definition 1.4.6 Suppose X is an object of Ass(A).

(i) Let A_{X} denote the set ⋃_{x∈|X|} ∥x∥. Let R_{X} be the modest set defined by

|R_{X}| = A_{X}, ∥a ∈ R_{X}∥ = {a}.

We call R_{X} the object of realizers for X.

(ii) Let X_{0} be the assembly defined by

|X_{0}| = {(x, a) | x ∈ |X|, a ∈ ∥x∥}, ∥(x, a) ∈ X_{0}∥ = {a}.

Note the obvious “projection” morphisms π : X_{0} → X, π′ : X_{0} → R_{X} (both tracked by i). It is easy to see that the square

[figure: X_{0}; η_{X_{0}}; ∇|X_{0}|; R_{X}; π′; η_{R_{X}}; ∇A_{X}; ∇π′]

is a pullback, and that X is the object appearing in the image factorization of the composite

[figure: X_{0}; η_{X_{0}}; ∇|X_{0}|; ∇π; ∇|X|.]

The idea behind the proof of Theorem 1.4.5 is as follows: Given F, the action of \overline{F} on both modest sets and uniform assemblies is already “determined”; hence \overline{F} X_{0} is determined since \overline{F} must preserve pullbacks. But now the action of \overline{F} on the above map X_{0} → ∇|X| is determined; hence \overline{F} X is determined since \overline{F} must preserve image factorizations. We use these facts to construct \overline{F}, and then show that it is indeed a ∇Γ-functor.

For the rest of this section F : Mod(A) → B is some fixed Γ-functor. Given X an assembly, the object \overline{F} X is defined as follows:

• Let F_{0}X_{0} be the object appearing in the pullback

[figure: F_{0}X_{0}; θ_{X}; ∇_{B}|X_{0}|; F R_{X}; η_{F R_{X}}; ∇_{B}A_{X}; ∇_{B}π′]

• Let \overline{F} X be the object appearing in the image factorization of ∇Γπ ∘ θ_{X} (see Proposition 1.2.12(ii)):

[figure: F_{0}X_{0}; θ_{X}; ∇_{B}|X_{0}|; \overline{F} X; ∇_{B}|X|; ∇_{B}π]

Given a morphism f : X → Y, choose t ∈ A such that t tracks f, and let α_{t} : A_{X} → A_{Y} be the function determined by t. Clearly α_{t} is a morphism R_{X} → R_{Y} tracked by t. There is also an obvious function f_{0} : |X_{0}| → |Y_{0}| given by

f_{0}(x, a) = (fx, ta).

We can now define the morphism \overline{F} f as follows:

• Let F_{0}f_{0} : F_{0}X_{0} → F_{0}Y_{0} be the unique morphism making the following

diagram commute:

F_{0}X_{0}  \overline{}∇_{B}|X_{0}|
[figure: F_{0}f_{0}; ∇_{B}f_{0}]
F_{0}Y_{0}  \overline{}∇_{B}|Y_{0}|

[figure: F R_{X}; ∇_{B}A_{X}]
[figure: F α_{t}; ∇_{B}α_{t}]
[figure: F R_{Y}; ∇_{B}A_{Y}]

• Let \overline{F} f : \overline{F} X → \overline{F} Y be the unique morphism making the following diagram commute (see Proposition 1.2.12(iii)):

[figure: F_{0}X_{0}; \overline{F} X; ∇_{B}|X|; F_{0}Y_{0}; F_{0}f_{0}; \overline{F} Y; \overline{F} f; ∇_{B}|Y |; ∇_{B}f]

Note here that \overline{F} f is independent of the choice of t since \overline{F} Y ↪ ∇_{B}|Y | is mono. Note also that \overline{F} is a functor for a similar reason, and that F_{0} is a functor on the subcategory of Ass(A) consisting of morphisms f_{0}. We now work towards showing that \overline{F} is a ∇Γ-functor. The details are not particularly illuminating and the majority of readers may prefer to skip them.

Proposition 1.4.7 Γ_{B}\overline{F} ≅ Γ_{A}.

Proof Since Γ_{B} preserves pullbacks, for any X the following diagram is a pullback in Set:

[figure: Γ_{B}F_{0}X_{0}; Γ_{B}θ_{X}; Γ_{B}∇_{B}|X_{0}|; Γ_{B}R_{X}; Γ_{B}∇_{B}A_{X}; Γ∇π]

Here the bottom arrow is a bijection, hence so is Γ_{B}θ_{X}. Since Γ_{B} preserves image factorizations, we have a diagram

Γ_{B}F_{0}X_{0} [figure: Γ_{B}θ_{X}] Γ_{B}∇_{B}|X_{0}| ≅ Γ_{A}X_{0}

[figure: Γ_{B}\overline{F} X; Γ_{B}∇_{B}|X|; ≅; Γ_{A}X.; Γ_{A}π]

But Γ_{A}π is surjective, and so the bottom arrow is a bijection; hence Γ_{B}\overline{F} X ≅ Γ_{A}X. Naturality follows from the commutativity of

[figure: \overline{F} X; ∇_{B}|X|; \overline{F} Y; \overline{F} f; ∇_{B}|Y |.; ∇_{B}f; □]

Proposition 1.4.8 \overline{F} ∇_{A} ≅ ∇_{B}.

Proof First define a functor ∇′ : Set → Ass(A) by

|∇′Z| = Z, ∥z ∈ ∇′Z∥ = {i}, ∇′(g : Z → W) = g.

Clearly ∇′ ≅ ∇_{A}. Suppose X = ∇′Z; then we have A_{X} ≅ 1, R_{X} ≅ 1 and X_{0} ≅ X. So we have

F_{0}X_{0} ≅ ∇_{B}|X_{0}| ≅ ∇_{B}|X| = ∇_{B}Z,

and hence \overline{F} ∇_{A}Z ≅ \overline{F} X ≅ ∇_{B}Z. Naturality follows from the commutativity of

[figure: \overline{F} ∇′Z; ∇_{B}|∇′Z|; \overline{F} ∇′W; \overline{F} ∇′g; ∇_{B}|∇′W |.; ∇_{B}g; □]

Proposition 1.4.9 \overline{F} preserves finite products.

Proof Clearly \overline{F} preserves the terminal object, since \overline{F} 1 ≅ \overline{F} ∇_{A}1 ≅ ∇_{B}1 ≅ 1. Given assemblies X, Y, it is easy to see from Proposition 1.2.4 that

A_{X×Y} ≅ A_{X} × A_{Y} , R_{X×Y} ≅ R_{X} × R_{Y} , (X × Y)_{0} ≅ X_{0} × Y_{0}.

Hence, as pullbacks commute with products, we have F_{0}(X_{0} × Y_{0}) ≅ F_{0}X_{0} × F_{0}Y_{0}. Also the product of two monos [resp. regular epis] is a mono [resp. regular epi], and so we obtain morphisms

[figure: F_{0}(X_{0} × Y_{0}); \overline{F} X × \overline{F} Y; ∇_{B}|X × Y |.]

By the uniqueness of image factorizations, we thus have \overline{F} (X × Y) ≅ \overline{F} X × \overline{F} Y. Clearly \overline{F} also preserves the projections modulo this isomorphism. □

Proposition 1.4.10 \overline{F} preserves equalizers.

Proof An exhilarating diagram-chase. Suppose e : Z → X is the equalizer of f, g : X\overrightarrow{→}Y in Ass(A) as in the proof of Proposition 1.2.6. We begin with two simple observations:

(1) It is easy to check by direct calculation that the diagram

[figure: Z_{0}; e_{0}; X_{0}; πf_{0}; πg_{0}; Y]

is an equalizer. But Γ_{A} and ∇_{B} are exact, and so

[figure: ∇_{B}|Z_{0}|; ∇_{B}e_{0}; ∇_{B}|X_{0}|; ∇_{B}(πf_{0}); ∇_{B}(πg_{0}); ∇_{B}|Y |]

is an equalizer in B.

(2) It is also easy to verify directly that the square

[figure: R_{Z}; ∇_{A}A_{Z}; R_{X}; α_{i}; ∇_{A}A_{X}; ∇_{A}α_{i}]

is a pullback. Hence, since F is exact, the bottom face of the appropriate instance of the cube on page 54 is a pullback. But the front and back faces are also pullbacks, and so by the pullback lemma the top face

[figure: F_{0}Z_{0}; θ_{Z}; ∇_{B}|Z_{0}|; F_{0}X_{0}; F_{0}e_{0}; θ_{X}; ∇_{B}|X_{0}|; ∇_{B}e_{0}]

is a pullback in B.

We now claim that F_{0}e_{0} is the equalizer of the two composites:

[figure: F_{0}X_{0}; θ_{X}; ∇_{B}|X_{0}|; ∇_{B}(πf_{0}); ∇_{B}(πg_{0}); ∇_{B}|Y_{0}|; ∇_{B}π; ∇_{B}|Y |.]

For suppose h : W → F_{0}X_{0} is such that the two composite morphisms W \overrightarrow{→}∇_{B}|Y | are equal. Then observation (1) gives us a unique h′ : W → ∇_{B}|Z_{0}| such that (∇_{B}e_{0})h′ = θ_{X}h. But now observation (2) gives us a unique h′′ : W → F_{0}Z_{0} such that (F_{0}e_{0})h′′ = h and θ_{Z}h′′ = h′. Clearly h′′ is also the unique morphism such that (F_{0}e_{0})h′′ = h.

Next note that we have the commutative diagram

F_{0}X_{0}  \overline{θ_{X} ^{}}∇_{B}|X_{0}|

[figure: F_{0}Y_{0}; F_{0}f_{0}; F_{0}g_{0}; θ_{Y}; ∇_{B}|Y_{0}|; ∇_{B}f_{0}; ∇_{B}g_{0}]

[figure: \overline{F} Y; ϵ_{Y}; μ_{Y}; ∇_{B}|Y |.; ∇_{B}π]

Let ϕ_{f} = ϵ_{Y} (F_{0}f_{0}), ϕ_{g} = ϵ_{Y} (F_{0}g_{0}). Then F_{0}e_{0} is the equalizer of μ_{Y} ϕ_{f} and μ_{Y} ϕ_{g}, and hence of ϕ_{f}, ϕ_{g} since μ_{Y} is mono.

We now have the following diagram in which all three rows are image factorizations, and the left and right columns are equalizers:

[figure: F_{0}Z_{0}; ϵ_{Z}; \overline{F} Z; μ_{Z}; ∇_{B}|Z|]

[figure: F_{0}X_{0}; F_{0}e_{0}; ϵ_{X}; \overline{F} X; \overline{F} e; μ_{X}; ∇_{B}|X|; ∇_{B}e]

[figure: \overline{F} Y; ϕ_{f}; ϕ_{g}; \overline{F} Y; \overline{F} f; \overline{F} g; μ_{Y}; ∇_{B}|Y |; ∇_{B}f; ∇_{B}g]

We wish to show that the middle column is also an equalizer. Clearly we have (\overline{F} f)(\overline{F} e) = (\overline{F} g)(\overline{F} e). So suppose we are given h : W → \overline{F} X such that (\overline{F} f)h = (\overline{F} g)h. We first form the pullback

[figure: V; a; W; F_{0}X_{0}; b; ϵ_{X}; \overline{F} X.; h]

It is easy to see that ϕ_{f}b = ϕ_{g}b, so we have a morphism c : V → F_{0}Z_{0} such that (F_{0}e_{0})c = b. Also we have (∇_{B}f)μ_{X}h = (∇_{B}g)μ_{X}h and so there is a morphism d : W → ∇_{B}|Z| such that (∇_{B}e)d = μ_{X}h. We now have the diagram

[figure: V; a; W; d; ∇_{B}|Z|; F_{0}Z_{0}; c; ϵ_{Z}; \overline{F} Z; μ_{Z}; ∇_{B}|Z|.]

To see that this commutes, verify that (∇_{B}e)da = (∇_{B}e)μ_{Z}ϵ_{Z}c and observe that ∇_{B}e is mono. Let W →^{j} U →^{i} ∇_{B}|Z| be the image factorization of d; then by Proposition 1.2.12(i,iii) we have a morphism k : U → \overline{F} Z such that μ_{Z}k = i. Let h′ = kj. Then μ_{X}(\overline{F} e)h′ = μ_{X}h, so (\overline{F} e)h′ = h since μ_{X} is mono.

For uniqueness, suppose we have (\overline{F} e)h′_{1} = (\overline{F} e)h′_{2} = h. Then (∇_{B}e)μ_{Z}h′_{1} = (∇_{B}e)μ_{Z}h′_{2} = μ_{X}h. But (∇_{B}f)μ_{X}h = (∇_{B}g)μ_{X}h as above, and so μ_{Z}h_{1} = μ_{Z}h_{2} since the right-hand column is an equalizer. But μ_{Z} is mono, so h_{1} = h_{2}. □

Proposition 1.4.11 \overline{F} preserves regular epis.

Proof Suppose f : X → Y is the coequalizer of its own kernel-pair. By Proposition 1.2.10 we may assume that f is tracked by i and that ∥y∥_{Y} = ⋃_{fx=y} ∥x∥_{X}. Hence A_{X} = A_{Y}, R_{X} = R_{Y} and the morphism α_{i} : R_{X} → R_{Y} is the identity. Thus the bottom face of the relevant instance of the cube on page 54 is trivially a pullback. Hence by the pullback lemma the top square

[figure: F_{0}X_{0}; θ_{X}; ∇_{B}|X_{0}|; F_{0}Y_{0}; F_{0}f_{0}; θ_{Y}; ∇_{B}|Y_{0}|; ∇_{B}f_{0}]

is a pullback. Now it is easy to see that the obvious function f_{0} : |X_{0}| → |Y_{0}| is surjective; hence ∇_{B}f_{0} is regular epi and so F_{0}f_{0} is regular epi. So we have the commutative square

[figure: F_{0}X_{0}; F_{0}f_{0}; F_{0}Y_{0}; \overline{F} X; ϵ_{X}; \overline{F} f; \overline{F} Y.; ϵ_{Y}]

To show \overline{F} f is regular epi, suppose by Proposition 1.2.12(i) that ϵ_{Y} (F_{0}f_{0}) is the coequalizer of some h, k : Z\overrightarrow{→}F_{0}X_{0}. We claim \overline{F} f is the coequalizer of ϵ_{X}h, ϵ_{X}k. Clearly (\overline{F} f)ϵ_{X}h = (\overline{F} f)ϵ_{X}k. So suppose we have g : \overline{F} → W such that gϵ_{X}h = gϵ_{X}k. Then there is a unique g′ : \overline{F} Y → W such that

gϵ_{X} = g′ϵ_{Y} (F_{0}f_{0}) = g′(\overline{F} f)ϵ_{X}.

But ϵ_{X} is epi, so g = g′ϵ_{X}; and clearly g′ is the unique such morphism. □

Proposition 1.4.12 \overline{F} J ≅ F. Proof We first check that \overline{F} X ≅ F X for objects X of the form R_{Y}. Note that R_{X} = X for such objects, and the projection X_{0} → R_{X} is an isomorphism, so ∇_{B}|X| ≅ ∇_{B}A_{X} and F_{0}X_{0} ≅ F R_{X}. Moreover η_{F R_{X}} : F R_{X} → ∇_{B}A_{X} is mono, since F η_{R_{X}} is mono and η_{F R_{X}} ≅ F η_{R_{X}} by Proposition 1.4.4. Also π = π′ : |X_{0}| → A_{X}. Thus (∇_{B}π)θ_{X} : F_{0}X_{0} → ∇_{B}A_{X} is mono, and so we have \overline{F} X ≅ F_{0}X_{0} ≅ F R_{X} = F X. Moreover, if f : X_{1} → X_{2} is a morphism between such objects, it is easy to check that this isomorphism identifies \overline{F} f with F f.

For a general modest set X, let r_{X} : R_{X} → X be the morphism tracked by i. The kernel-pair of r_{X} consists of the two projections p_{X}, p′_{X} : P_{X} → R_{X}, where

|P_{X}| = {(a, a′) | r_{X}a = r_{X}a′}, ∥(a, a′) ∈ P_{X}∥ = {⟨a, a′⟩},

and clearly r_{X} is the coequalizer of this pair in Mod(A). But also P_{X} ≅ R_{P_{X}}, and so by the above we have \overline{F} P_{X} ≅ F P_{X}, \overline{F} R_{X} ≅ F R_{X} and \overline{F} p_{X} ≅ F p_{X}, \overline{F} p′_{X} ≅ F p′_{X}. But both F, \overline{F} J preserve coequalizers of kernel-pairs, so \overline{F} J(X) ≅ F (X). It is routine to check that this isomorphism is natural in X. □

Proposition 1.4.13 \overline{F} is, up to isomorphism, the unique ∇Γ-functor such that \overline{F} J ≅ F. Proof By the above six propositions, \overline{F} is a ∇Γ-functor and \overline{F} J = F, so it only remains to check uniqueness. Given any ∇Γ-functor F′ : Ass(A) → B such that F′J ≅ F, for any object X we have the pullback

[figure: F′X_{0}; F′θ_{X}; F′∇_{A}|X_{0}|; F′R_{X}; F′π′; F′η_{R_{X}}; F′∇_{A}A_{X}.; F′∇_{A}π′]

But F′η_{R_{X}} ≅ η_{F′R_{X}} ≅ η_{F R_{X}} by Proposition 1.4.4, and F′∇_{A}π′ ≅ ∇_{B}π′. Hence F′X_{0} ≅ F_{0}X_{0} by an isomorphism that identifies the morphism F′((∇_{A}π)η_{X_{0}}) with (∇_{B}π)θ_{X}. But the objects appearing in the image factorizations of these two morphisms are F′X and \overline{F} X respectively, so F′X ≅ \overline{F} X. Again, naturality in X is routine, so F′ ≅ \overline{F} as required. □

To complete the proof of Theorem 1.4.5, we have to show that the correspondence between F and \overline{F} extends to an equivalence of categories. The following small lemma will be helpful.

Lemma 1.4.14 Suppose F, G : Mod(A) → B [resp. Ass(A) → B] are two Γfunctors, and β : F → G is any natural transformation. Then for Y any modest set [resp. assembly], the following triangle commutes:

F Y \overline{η_{F Y}_{}}∇_{B}|Y |
[figure: η_{GY}]
GY^{β_{Y} ^{}}

Proof For every morphism y : 1 → Y we have β_{Y} (F y) = (Gy)β_{1} by naturality of β, and so the morphism Γ_{B}β_{Y} is identified with id_{|Y |} under the isomorphisms Γ_{B}F ≅ Γ_{A} ≅ Γ_{B}G. Thus ∇_{B}Γ_{B}β_{Y} ≅ id_{∇_{B}|Y |}, and so the triangle commutes by naturality of η at β_{Y}. □

Proposition 1.4.15 Suppose given Γ-functors F, G : Mod(A) → B and a natural transformation β : F → G. Then there is a unique \overline{β} : \overline{F} → \overline{G} such that \overline{β}J is canonically isomorphic to β. Proof Let X be any assembly. Applying the lemma to the modest set R_{X}, define β_{0X_{0}} to be the unique morphism making the diagram

F_{0}X_{0}  \overline{θ_{X}  ^{}}∇_{B}|X_{0}|
[figure: β_{0X_{0}}; θ′_{X}]
G_{0}X_{0}

[figure: F R_{X}; \overline{η_{F R_{X}}}; ∇_{B}A_{X}; ∇_{B}π′]
[figure: β_{R_{X}}; η_{GR_{X}}]
GR_{X}^{}

commute, and define \overline{β}_{X} to be the unique morphism making the diagram

[figure: F_{0}X_{0}; \overline{F} X; ∇_{B}|X_{0}|; G_{0}X_{0}; β_{0X_{0}}; \overline{G}X; ^{\overline{β}^{X}}; ∇_{B}|X_{0}|]

commute. (Note that the outer rectangle commutes since we have (∇_{B}π)θ_{X} = p(∇_{B}π)θ′_{X}β_{0X_{0}}.) To see that \overline{β} is natural, given f : X → Y we have β_{R_{Y}} (F f) = (Gf)β_{R_{X}} by naturality of β, so β_{0Y_{0}}(F_{0}f_{0}) = (G_{0}f_{0})β_{0X_{0}} by uniqueness of mediating morphisms, hence \overline{β}_{Y} (\overline{F} f) = (\overline{G}f)\overline{β}_{X} by uniqueness of fill-in morphisms.

To check that \overline{β}J ≅ β under the canonical isomorphisms, note that for X a modest set we have

(∇_{B}π)θ_{X} ≅ (F ∇_{A}π)(F η_{X_{0}}) ≅ (F η_{X})(F π) ≅ η_{F X}(F r_{X})(F π′)

and similarly for G, so by uniqueness of image factorizations and fill-ins it suffices to check the commutativity of

[figure: F_{0}X_{0}; F π′; F R_{X}; F r_{X}; F X; η_{F} X; ∇_{B}|X|; G_{0}X_{0}; β_{0X_{0}}; Gπ′; GR_{X}; β_{R_{X}}; Gr_{X}; GX; β_{X}; η_{G}X; ∇_{B}|X|.]

But here the left square is the left face of the above prism; the middle square commutes by naturality of β; and the right square commutes by the above lemma.

To show uniqueness, suppose we have β′ : \overline{F} → \overline{G} such that β′J ≅ β. For any assembly X, by the proof of Proposition 1.4.13 we have F_{0}X_{0} ≅ \overline{F} X_{0}, θ_{X} ≅ η_{\overline{F} X_{0}} and similarly for G. Hence, replacing β_{0X_{0}} by β′X_{0} in the above prism, the top face commutes by the lemma and the left face by naturality since β_{R_{X}} ≅ β_{R_{X}}. So β′_{X_{0}} = β_{0X_{0}}. But now replacing \overline{β}_{X} by β′_{X} in the rectangle used to define \overline{β}_{X}, we see that the left square commutes by naturality of β′ and the right square by the lemma. Hence β′_{X} = \overline{β}_{X}. □

It is now clear that the functor

(− ∘ J) : ∇ΓReg [Ass(A), B] ⟶ ΓReg [Mod(A), B]

is part of an equivalence of categories: by Proposition 1.4.13 it is essentially bijective on objects; hence Proposition 1.4.15 implies that it is also full and faithful. The proof of Theorem 1.4.5 is now complete.

Remark 1.4.16 It would be interesting to know whether the existence of the universal ∇Γ-category Ass(A) reflects a particular property of Mod(A), or whether the passage from Mod(A) to Ass(A) is an instance of some general construction of the “free ∇Γ-category on a ∇-category”. In particular, the above proof is in many respects strongly reminiscent of the Freyd glueing or scone construction (see [29, §1(10)] or [52, II.22]), though we have not yet made this connection precise.

Morphisms between PCAs

In this chapter we introduce a new kind of morphism between PCAs, and show how these morphisms give rise to ∇Γ-functors between the corresponding categories of assemblies. Quite surprisingly, it turns out that essentially every ∇Γ-functor between the categories of assemblies arises in this way, and so we obtain an equivalence between PCA morphisms A → B and ∇Γ-functors Ass(A) → Ass(B). One application of this result is to show that the categories Ass(A), Ass(B) are equivalent iff the PCAs A, B are “equivalent” in a certain sense. We also obtain similar results for RT and Mod.

The first three sections of this chapter run roughly parallel to Sections 1–3 of Chapter 1. In Section 2.1 we consider PCAs by themselves, and introduce the 2-category PCA of PCAs, applicative morphisms and applicative transformations. In Section 2.2 we consider categories of assemblies, and show how the construction Ass of Chapter 1 extends to a 2-functor from PCA to the 2-category ∇ΓReg; we also prove the equivalence result mentioned above. Most of the hard work is done in this section. In Section 2.3 we show how these results can be extended to realizability toposes without much effort.

It is natural to ask whether particular properties of applicative morphisms are reflected in properties of the functors they give rise to. In Section 2.4 we consider three such properties, and give categorical characterizations of the corresponding functors. In Section 2.5 we conclude the chapter with a discussion of adjoint pairs of applicative morphisms and some of the properties they enjoy.

2.1 Applicative morphisms

We start by introducing a new notion of morphism between PCAs. One might think that the natural choice of “morphisms” between PCAs would be PCA homomorphisms (i.e. functions that respect k, s and application); however, our notion is much more general than this, and seems more appropriate for studying the categories introduced in Chapter 1.

Definition 2.1.1 (Applicative morphism) Let A, B be two PCAs. An applicative morphism from A to B is a total relation γ : A ⟶^{|} B such that there exists r ∈ B satisfying

\begin{matrix}γ(a, b) ⟹ rb↓; \\ γ(a, b) ∧ γ(a′, b′) ∧ aa′↓ ⟹ γ(aa′, rbb′) \end{matrix}

for all a, a′ ∈ A, b, b′ ∈ B. We say that such an element r realizes γ.

Remarks 2.1.2 (i) The condition γ(a, b) ⟹ rb↓ is not strictly necessary, since if r satisfies just the second condition then λ^{∗}xy.rxy satisfies both conditions (see Proposition 1.1.6). Nevertheless, when we say “r realizes γ” we mean that r satisfies both conditions.

(ii) We will overload our notation and write γ(a) for {b ∈ B | γ(a, b)}. If P ⊆ A, we write γ^{+}(P) for ⋃_{a∈P} γ(a).

The second condition in Definition 2.1.1 may be summarized by the slogan: “application in A is effective in B.” If we think of A, B informally as “abstract machines”, we may think of γ as specifying an “implementation” of A on B. The predicate γ(a, b) may be read as “b is a representation of a in B”, and r may be thought of as a kind of “interpreter” for A in B. We now give some examples for motivation—many more examples will appear in Chapter 3.

Examples 2.1.3 (i) Let ⌈−⌉ : Λ → N be some effective encoding of lambdaterms as natural numbers. From ⌈−⌉ we can define a total relation γ : Λ/β ⟶^{|} N by γ(m) = {⌈M⌉ | M ∈ m}. If our encoding is sensibly chosen, juxtaposition of lambda-terms is effective—there is a partial recursive function φ : N×N ⇀ N such that φ(⌈M⌉, ⌈N⌉) = ⌈MN⌉. Hence γ is an applicative morphism Λ/β ⟶^{|} K_{1}: for a realizer take any r ∈ K_{1} such that r · x · y ≃ φ(x, y).

(ii) Any PCA homomorphism can be seen as an applicative morphism. In fact, suppose f : A → B is any function satisfying

aa′↓ ⟹ f(aa′) = f(a) · f(a′)

(f need not respect k and s). Then f regarded as a total relation is an applicative morphism: indeed λ^{∗}xy.xy ∈ B is a realizer for f.

It is easy to see that PCAs and applicative morphisms form a category. The identity applicative morphism on A is given by the identity relation—this is realized by λ^{∗}xy.xy. Given γ : A ⟶^{|} B, δ : B ⟶^{|} C realized by q, r respectively, their composition is defined by (δγ)(a) = δ^{+}(γ(a)), and δγ is realized by λ^{∗}xy.r(rq′x)y for any q′ ∈ δ(q). We now show how to make this category into a 2-category.

Definition 2.1.4 (Applicative transformation) Let γ, δ : A ⟶^{|} B be two applicative morphisms. We say there is an applicative transformation from γ to δ (and write γ ⪯ δ) if there exists t ∈ B such that

γ(a, b) ⟹ δ(a, tb)

for all a, b ∈ B. (In this case we say that t realizes γ ⪯ δ.) We write γ ∼ δ if both γ ⪯ δ and δ ⪯ γ.

Continuing our analogy with abstract machines, γ ⪯ δ can be read as “there is a program that translates γ-implementations into δ-implementations”. Note that there can be at most one applicative transformation from γ to δ; hence there is usually no need to give letters as names for applicative transformations.

Example 2.1.5 Let ⌈−⌉_{1}, ⌈−⌉_{2} : Λ → N be two effective encodings of closed lambda-terms as natural numbers, with γ_{1}, γ_{2} : Λ/β ⟶^{|} K_{1} the resulting applicative morphisms as above. Then there are partial recursive functions α, β such that for all M ∈ Λ we have α(⌈M⌉_{1}) = ⌈M⌉_{2} and β(⌈M⌉_{2}) = ⌈M⌉_{1}. It follows easily that γ_{1} ∼ γ_{2}.

Proposition 2.1.6 PCAs, applicative morphisms and applicative transformations form a preorder-enriched category PCA.

Proof We have already seen that PCAs and applicative morphisms form a category. The set of applicative morphisms A ⟶^{|} B is preordered by ⪯, since γ ⪯ γ is realized by i, and if γ ⪯ δ, δ ⪯ ϵ are realized by t, u respectively then γ ⪯ ϵ is realized by λ^{∗}x.u(tx). Finally, composition of applicative morphisms respects ⪯: if t realizes γ ⪯ γ′ : A ⟶^{|} B, u realizes δ ⪯ δ′ : B ⟶^{|} C and r realizes δ, then λ^{∗}x.u(rt′x) realizes δγ ⪯ δ′γ′ for any t′ ∈ δ(t). □

From PCA we obtain the poset-enriched category PCA/∼ by identifying γ, δ whenever γ ∼ δ. The categories PCA, PCA/ ∼ both seem to be very poor in their categorical structure, but it is worth observing the following:

Proposition 2.1.7 The PCA 1 is both initial and terminal in PCA/∼.

Proof Terminality is trivial (in fact 1 is also terminal in PCA). For initiality, any non-empty subset A′ ⊆ A determines an applicative morphism 1 ⟶^{|} A (realized by λ^{∗}xy.a for any a ∈ A′). And given γ, γ′ : 1 ⟶^{|} A, we have γ ⪯ γ′ ⪯ γ (these are realized by λ^{∗}x.a, λ^{∗}x.a′ respectively, where a ∈ γ(∗), a′ ∈ γ′(∗)). □

It is also perhaps worth remarking that the morphisms from A to B in PCA/∼ form a semilattice when ordered by ⪯: given γ, δ : A ⟶^{|} B, their meet γ ∧ δ may be defined by

(γ ∧ δ)(a, b) ⟺ γ(a, fst b) ∧ δ(a, snd b).

If q, r realize γ, δ respectively then γ ∧ δ is realized by the element

λ^{∗}xy. ⟨ q(fst x)(fst y), r(snd x)(snd y) ⟩.

However, PCA/∼ is not semilattice-enriched with respect to ⪯_{Σ}, since composition does not in general preserve meets.

2.2 Functors between categories of assemblies

Our purpose in this section is to show how applicative morphisms between PCAs are related to functors between the corresponding categories of assemblies. This section is independent of Section 1.3.

2.2.1 Building functors from applicative morphisms

We first show how an applicative morphism γ : A ⟶^{|} B gives rise to a functor Ass(A) → Ass(B). The idea is very simple:

Definition 2.2.1 Suppose γ : A ⟶^{|} B is an applicative morphism. We define the functor γ_{∗} : Ass(A) → Ass(B) by

\begin{matrix}|γ_{∗}X| = |X|, ∥x ∈ γ_{∗}X∥ = γ^{+}∥x ∈ X∥; \\ γ_{∗}(f : X → Y) = f : γ_{∗}X → γ_{∗}Y. \end{matrix}

To see that this is a good definition, note that if r realizes γ and the morphism f : X → Y is tracked by t, then f : γ_{∗}X → γ_{∗}Y is tracked by rt′ for any t′ ∈ γ(t). The fact that γ_{∗} preserves identities and composition is trivial. The next three propositions give some important properties of γ_{∗}.

Proposition 2.2.2 The functor γ_{∗} preserves finite limits.

Proof Finite products: It is easy to see that γ_{∗}(1) ≅ 1. Given X, Y in Ass(A), consider the two objects

P = γ_{∗}X × γ_{∗}Y, Q = γ_{∗}(X × Y).

From the proof of Proposition 1.2.4, we see that |P | = |Q| = |X| × |Y |, but that

\begin{aligned}∥(x, y) ∈ P ∥ & = & \{⟨b, b′⟩ | b ∈ γ^{+}∥x∥, b′ ∈ γ^{+}∥y∥\}, \\ ∥(x, y) ∈ Q∥ & = & γ^{+}\{⟨a, a′⟩ | a ∈ ∥x∥, a′ ∈ ∥y∥\}. \end{aligned}

To see that P ≅ Q, note that the identity map |P | → |Q| is tracked by

λ^{∗}b. r(r pair′ (fst_{B} b))(snd_{B} b),

where r realizes γ and pair′ ∈ γ(pair_{A}); and its inverse is tracked by

λ^{∗}b. ⟨ (r fst′ b), (r snd′ b) ⟩,

where fst′ ∈ γ(fst_{A}), snd′ ∈ γ(snd_{A}). Clearly γ_{∗} also preserves the projections up to this isomorphism.

Equalizers: Given f, g : X\overrightarrow{→}Y in Ass(A), we see from 1.2.6 that the equalizer of γ_{∗}(f), γ_{∗}(g) is e : Z → γ_{∗}(X), where

|Z| = {x ∈ X | fx = gx}, ∥x∥_{Z} = γ^{+}∥x∥_{X},

and e is the evident morphism tracked by i. But Z →^{e} γ_{∗}(X) is precisely γ_{∗}(d), where d is the equalizer of f, g as described in 1.2.6. Thus γ_{∗} preserves these “chosen” equalizers on the nose. □

Proposition 2.2.3 The functor γ_{∗} preserves coequalizers of kernel-pairs.

Proof Given f : X → Y in Ass(A), we see from 1.2.10 that the coequalizer of the kernel-pair of γ_{∗}(f) is c : γ_{∗}(X) → W, where

|W | = Im f, ∥y∥_{W} = ⋃_{fx=y} γ^{+}∥x∥_{X} = γ^{+}( ⋃_{fx=y} ∥x∥_{X}),

and c is the evident morphism tracked by i. But γ_{∗}(X) →^{c} W is precisely γ_{∗}(b), where b is the coequalizer of the kernel-pair of f. Thus γ_{∗} preserves chosen coequalizers of kernel-pairs on the nose. □

Proposition 2.2.4 The following diagrams commute up to natural isomorphism:

[figure: Ass(A); γ_{∗}; Ass(B); Ass(A); γ_{∗}; Ass(B)]
[figure: ∇_{B}; Γ_{B}]
[figure: Set; ∇_{A}; Set; Γ_{A}]

Proof For Z any set, the identity map |γ_{∗}∇_{A}Z| → |∇_{B}Z| is tracked by i, and its inverse is tracked by λ^{∗}x.a for any a ∈ γ^{+}(A). Thus γ_{∗}(∇_{A}Z) ≅ ∇_{B}Z. Naturality in X is trivial, so γ_{∗}∇_{A} ≅ ∇_{B}. The second diagram actually commutes on the nose by definition of γ_{∗} and ∇. □

The above three propositions together say that γ_{∗} is a ∇Γ-functor (see Definition 1.4.2). It is easy to see that id_{∗} = id and (δγ)_{∗} = δ_{∗}γ_{∗}, and so by setting Ass(γ) = γ_{∗} we obtain a functor Ass : PCA → ∇ΓReg. It is now easy to extend this functor to a 2-functor:

Definition 2.2.5 Given γ, δ : A ⟶^{|} B in PCA and an applicative transformation ζ : γ ⪯ δ, let ζ_{∗} : γ_{∗} → δ_{∗} be the natural transformation defined by

ζ_{∗X} = id_{|X|} : γ_{∗}X → δ_{∗}X.

This is a good definition: if t ∈ B realizes γ ⪯ δ then t tracks each ζ_{∗X}, and the naturality condition is trivial. The construction of ζ_{∗} from ζ is clearly functorial: (id_{γ})_{∗} = id_{γ_{∗}}, and if ζ : γ ⪯ δ and ξ : δ ⪯ ϵ then (ξζ)_{∗} = ξ_{∗}ζ_{∗}. Finally, the construction ζ ↦ ζ_{∗} trivially respects horizontal composition of 2-cells: given γ, γ′ : A\overrightarrow{→}B, δ, δ′ : B\overrightarrow{→}C and ζ : γ ⪯ γ′, ξ : δ ⪯ δ′, we have (ξ | ζ)_{∗} = ξ_{∗} | ζ_{∗}. So we have proved

Theorem 2.2.6 Setting Ass(ζ) = ζ_{∗} for ζ an applicative transformation, we obtain a 2-functor Ass : PCA → ∇ΓReg. □

Remark 2.2.7 Recall that 1 is both initial and terminal in PCA/ ∼. It is easy to check that Ass(1) ≃ Set, and for any A the essentially unique applicative morphisms 1 ⟶^{|} A ⟶^{|} 1 give rise to the functors ∇_{A} and Γ_{A} respectively.

2.2.2 Recovering applicative morphisms

We now work towards the main result of this section: every ∇Γ-functor Ass(A) → Ass(B) is naturally isomorphic to γ_{∗} for some γ : A ⟶^{|} B, and every natural transformation between such functors arises from an applicative transformation. Throughout this paragraph F will denote some fixed ∇Γ-functor Ass(A) → Ass(B). First we show how we can recover an applicative morphism A ⟶^{|} B from F.

Definition 2.2.8 (Cf. Definition 1.4.6.) Let R be the assembly (over A) defined by

|R| = A; ∥a ∈ R∥ = {a}

(We call R the object of realizers in Ass(A).) Let ι : A = Γ_{A}R → Γ_{B}(F R) denote the canonical bijection, and let App(F) be the total relation A ⟶^{|} B defined by

App(F)(a) = ∥ι(a) ∈ F R∥.

To show that App(F) is an applicative morphism, it is helpful to introduce the following definition:

Definition 2.2.9 (Cartesian morphism) A morphism f : X → Y of Ass(A) is cartesian if the following square is a pullback:

[figure: X; f; Y; ∇ΓX; η_{X}; ∇Γf; ∇ΓY; η_{Y}]

Lemma 2.2.10 (i) A morphism f : X → Y is cartesian iff f ≅ f′ : X′ → Y for some f′ such that ∥x ∈ X′∥ = ∥f′x ∈ Y ∥ for all x ∈ |X′|.

(ii) Any ∇Γ-functor H : Ass(A) → Ass(B) preserves cartesian morphisms.

Proof (i) For both implications, it suffices to note that for any f there is a “canonical” pullback f′ : X′ → Y of ∇Γf along η_{Y} described by:

|X′| = |X|, ∥x ∈ X′∥ = ∥fx ∈ Y ∥, f′ = f : |X′| → |Y |.

(ii) Note that Hη_{X} ≅ η_{HX} by Proposition 1.4.4 and H preserves pullbacks. □

Proposition 2.2.11 App(F) is an applicative morphism.

Proof Write γ for App(F); we just need to obtain a realizer for γ. Let C ⊆ A×A be the set C = {(a, a′) | aa′↓}, and define P, Q ∈ Ass(A) by

|P | = |Q| = C, ∥(a, a′) ∈ P ∥ = {⟨a, a′⟩}, ∥(a, a′) ∈ Q∥ = {aa′}.

Let p : P → R, q : Q → R be the cartesian morphisms tracked by i ∈ A. By the Lemma, F p and F q are cartesian and so are isomorphic to morphisms P′ →^{p′} F R, Q′ →^{q′} F R respectively, where |P′| = |Q′| = C and p′, q′ are tracked by i. Now let h : P → Q be the morphism determined by id_{C} (and tracked by λ^{∗}xy.xy), and let h′ be the evident morphism P′ → Q′ such that h′ ≅ F h. Also let j : R × R → R be the map (a, a′) ↦ ⟨a, a′⟩ (this is tracked by i); and let l be the morphism

F R × F R ≅ F (R × R) →^{F j} F R.

Suppose t ∈ B tracks h′ and u tracks l. We claim r = λ^{∗}xy.t(u⟨x, y⟩) is a realizer for γ. For suppose b ∈ γ(a), b′ ∈ γ(a′) and aa′ ↓. Then b ∈ ∥a ∈ F R∥, b′ ∈ ∥a′ ∈ F R∥ and so u⟨b, b′⟩ ∈ ∥⟨a, a′⟩ ∈ F R∥. Thus u⟨b, b′⟩ ∈ ∥(a, a′) ∈ P′∥ by choice of P′. Hence t(u⟨b, b′⟩) ∈ ∥(a, a′) ∈ Q′∥. But now we have ∥(a, a′) ∈ Q′∥ = ∥aa′ ∈ F R∥ = γ(aa′), so rbb′ ∈ γ(aa′). □

We now show that, for given A, B, the operation App can be made into a functor. In the following propositions, F, G both denote ∇Γ-functors Ass(A) → Ass(B), and α : F → G is a natural transformation.

Lemma 2.2.12 For any set X, the morphism α_{∇X} : F ∇X → G∇X is isomorphic to id_{∇X} via the canonical isomorphisms F ∇_{A} ≅ ∇_{B} ≅ G∇_{A}.

Proof Suppose β : ∇_{B}X → ∇_{B}X is the morphism isomorphic to α_{∇X}. For every function x : 1 → X, naturality of α gives β(x(∗)) = x(∗). Hence β = id. □

Proposition 2.2.13 App(F) ⪯ App(G).

Proof Consider the diagram

[figure: F R; α_{R}; GR; F ∇ΓR; F η_{R}; α_{∇ΓR}; G∇ΓR.; Gη_{R}]

Note first that all four of these objects have underlying set isomorphic to A. So by applying the functor Γ_{B} we obtain a commutative square in Set in which all four objects are A. In this diagram, the bottom arrow is the identity by the Lemma, and the two sides are easily seen to be the identity since F η_{R} ≅ η_{F R} etc. Hence the function underlying α_{R} is isomorphic to id_{A}. Suppose t tracks α_{R}; then for all a ∈ A and all b ∈ App(F)(a) we have tb ∈ App(G)(a). So t realizes App(F) ⪯ App(G). □

Since the hom-category PCA [A, B] is a preorder, it is now immediate that App is a functor from ∇ΓReg [Ass(A), Ass(B)] to PCA [A, B]. Moreover, it is trivial from the definitions that App(γ_{∗}) = γ for any applicative morphism γ, and so App ∘ Ass = id.

2.2.3 The equivalence theorem

In this paragraph we show that Ass∘App ≅ id, completing the proof of the “equivalence” between applicative morphisms and ∇Γ-functors. Again, F : Ass(A) → Ass(B) denotes some fixed ∇Γ-functor, and we write γ for App(F).

First we wish to show that γ_{∗} ≅ F. We start by showing that γ_{∗}X ≅ F X for two particular objects X:

Definition 2.2.14 (i) Let E be the object of Ass(A) defined by

|E| = {(a, S) | a ∈ S ⊆ A}, ∥(a, S) ∈ E∥ = {a}.

(ii) Let D be the object of Ass(A) defined by

|D| = P_{1}A, ∥S ∈ D∥ = S.

We call D the generic object of Ass(A).

Lemma 2.2.15 There are canonical isomorphisms F E ≅ γ_{∗}E and F D ≅ γ_{∗}D.

Proof Write π : E → R for the obvious projection tracked by i. Note that π is cartesian, and so by Lemma 2.2.10(ii) both the following squares are pullbacks:

[figure: F E; F π; F R; γ_{∗}E; γ_{∗}π; γ_{∗}R; ∇_{B}|E|; η_{F E}; ∇_{B}π; ∇_{B}A; η_{F R}; ∇_{B}|E|; η_{γ_{∗}E}; ∇_{B}π; ∇_{B}A.; η_{γ_{∗}R}]

But F R ≅ γ_{∗}R by definition of γ_{∗}, hence η_{F R} ≅ η_{γ_{∗}R}, and so F E ≅ γ_{∗}E.

Now let π′ : E → D be the projection (a, S) ↦ S (this is tracked by i). Note that

∥S ∈ D∥ = ⋃_{π′(a,S′)=S} ∥(a, S′) ∈ D∥,

and so π′ is regular epi. Also η_{F D} ≅ F η_{D} and η_{D} is mono, so η_{F D} is mono. So we have the commutative squares

[figure: F E; η_{F E}; ∇_{B}|E|; γ_{∗}E; η_{γ_{∗}E}; ∇_{B}|E|; F D; F π′; η_{F D}; ∇_{B}|D|; ∇_{B}π′; γ_{∗}D; γ_{∗}π′; η_{γ_{∗}D}; ∇_{B}|D|.; ∇_{B}π′]

But F E ≅ γ_{∗}E so η_{F E} ≅ η_{γ_{∗}E}; hence F D ≅ γ_{∗}D by uniqueness of image factorizations. □

To obtain the F X ≅ γ_{∗}X for a general object X, we exploit the following property of D. (It is because of this property that D is called a generic object.)

Lemma 2.2.16 For any object X of Ass(A), there exists a cartesian morphism ϕ : X → D. (Note that ϕ is not unique in general!)

Proof Define ϕ : |X| → P_{1}A by ϕ(x) = ∥x∥_{X}; note that ϕ is tracked by i. Clearly ∥x∥_{X} = ∥ϕ(x)∥_{D} for all x ∈ |X|, so ϕ is cartesian by Lemma 2.2.10(i). □

Proposition 2.2.17 F ≅ γ_{∗}.

Proof Given X in Ass(A), take ϕ : X → D cartesian as in Lemma 2.2.16. Then both the following squares are pullbacks:

[figure: F X; F ϕ; F D; γ_{∗}X; γ_{∗}ϕ; γ_{∗}D; ∇_{B}|X|; η_{F X}; ∇_{B}ϕ; ∇_{B}|D|; η_{F D}; ∇_{B}|X|; η_{γ_{∗}X}; ∇_{B}ϕ; ∇_{B}|D|.; η_{γ_{∗}D}]

But F D ≅ γ_{∗}D so η_{F D} ≅ η_{γ_{∗}D}; hence these two pullbacks are isomorphic and F X ≅ γ_{∗}X.

To show naturality, suppose we are given f : Y → X. Then we have

[figure: F Y; F f; F X; F ϕ; F D; ∇_{B}|Y |; η_{F Y}; ∇_{B}f; ∇_{B}|X|; η_{F X}; ∇_{B}ϕ; ∇_{B}|D|; η_{F D}]

and a similar diagram for γ_{∗}. Now η_{F Y} ≅ η_{γ_{∗}Y} and η_{F D} ≅ η_{γ_{∗}D} under the canonical isomorphisms, and η_{F D} is mono, so we have η_{F X}(F f) ≅ η_{γ_{∗}X}(γ_{∗}f) and (F ϕ)(F f) ≅ (γ_{∗}ϕ)(γ_{∗}f). But also η_{F X} ≅ η_{γ_{∗}X} and F ϕ ≅ γ_{∗}ϕ; hence F f ≅ γ_{∗}f by uniqueness of the mediating morphism F Y → F X. Hence we have F ≅ γ_{∗}. □

We now wish to show that the isomorphism F ≅ (App(F))_{∗} is natural in F. Suppose that F, G are two ∇Γ-functors and α : F → G is a natural transformation. Let us write γ = App(F) and δ = App(G). By Proposition 2.2.13 there is an applicative transformation ζ : γ ⪯ δ. We need to show that ζ_{∗} ≅ α via the canonical isomorphisms γ_{∗} ≅ F, δ_{∗} ≅ G.

Lemma 2.2.18 α_{E} ≅ ζ_{∗E} and α_{D} ≅ ζ_{∗D} under the above isomorphisms.

Proof Let j : E → R × ∇_{A}|D| be the obvious monomorphism (tracked by λ^{∗}x.⟨x, i⟩). By naturality the following squares commute:

[figure: F E; F j; F (R × ∇_{A}|D|); γ_{∗}E; γ_{∗}j; γ_{∗}(R × ∇_{A}|D|); GE; α_{E}; Gj; G(R × ∇_{A}|D|); α_{R×∇|D|}; δ_{∗}E; ζ_{∗E}; δ_{∗}j; δ_{∗}(R × ∇_{A}|D|); ζ_{∗R×∇|D|}]

But ζ_{∗R} ≅ α_{R} by definition, and ζ_{∗∇|D|} ≅ α_{∇|D|} ≅ id_{∇|D|} by Lemma 2.2.12. So under the canonical isomorphisms we have

F j ≅ γ_{∗}j, Gj ≅ δ_{∗}j, α_{R×∇|D|} ≅ ζ_{∗R×∇|D|}.

Hence also α_{E} ≅ ζ_{∗E}, since Gj is mono.

Next note that the following squares commute by naturality:

[figure: F E; (∇π′)η_{F E}; ∇_{B}|D|; γ_{∗}E; (∇π′)η_{γ_{∗}E}; ∇_{B}|D|; GE; α_{E}; (∇π′)η_{GE}; ∇_{B}|D|; id; δ_{∗}E; ζ_{∗E}; (∇π′)η_{δ_{∗}E}; ∇_{B}|D|.; id]

Moreover under the canonical isomorphisms we have

α_{E} ≅ ζ_{∗E}, (∇π′)η_{F E} ≅ (∇π′)η_{γ_{∗}E}, (∇π′)η_{GE} ≅ (∇π′)η_{δ_{∗}E}.

Hence, by taking image factorizations of the top and bottom of each of the above squares, we obtain α_{D} ≅ ζ_{∗D} as required. □

Proposition 2.2.19 For any object X of Ass(A), we have α_{X} ≅ ζ_{∗X} under the canonical isomorphisms.

Proof Let ϕ : X → D be a cartesian morphism. The isomorphisms identify the two pullback squares in the proof of Proposition 2.2.17, as well as a similar pair for G and δ_{∗}. Moreover, by naturality of α we have the equations η_{F X} = η_{GX}α_{X} and α_{D}(F ϕ) = (Gϕ)α_{X}; and by naturality of ζ_{∗} we have η_{γ_{∗}X} = η_{δ_{∗}X}ζ_{∗X} and ζ_{∗D}(γ_{∗}ϕ) = (δ_{∗}ϕ)ζ_{∗X}. But α_{D} ≅ ζ_{∗D} by the Lemma, and so α_{X} ≅ ζ_{∗X} by uniqueness of the mediating morphism F X → GX. □

Propositions 2.2.17 and 2.2.19 together say that Ass∘App is equivalent to the identity functor on ∇ΓReg [Ass(A), Ass(B)]. The proof of the following theorem is now complete:

Theorem 2.2.20 The 2-functor Ass : PCA → ∇ΓReg is locally an equivalence, that is, for any A, B the functor

Ass : PCA [A, B] ⟶ ∇ΓReg [Ass(A), Ass(B)]

is part of an equivalence of categories. □

Corollary 2.2.21 If A, B are PCAs then Ass(A) ≃ Ass(B) iff there are applicative morphisms γ : A ⟶^{|} B and δ : B ⟶^{|} A such that δγ ∼ id_{A} and γδ ∼ id_{B}. (In this case we say that A, B are equivalent, and write A ≃ B.)

Proof Given γ, δ as above, it is clear that γ_{∗}, δ_{∗} constitute an equivalence of categories. Conversely, if F : Ass(A) → Ass(B) and G : Ass(B) → Ass(A) are the two halves of an equivalence then clearly F, G are exact functors and Γ_{B}F ≅ Γ_{A}, Γ_{A}G ≅ Γ_{B}. Hence, by taking right adjoints, we also have G∇_{B} ≅ ∇_{A}, F ∇_{A} ≅ ∇_{B}. So F, G are both ∇Γ-functors. It now follows easily from Theorem 2.2.20 that App(F), App(G) constitute an equivalence of PCAs. □

2.3 Functors between realizability toposes

We now extend the results of the last section to realizability toposes. First we need a technical result which allows us to state Theorem 2.2.20 in a slightly sharper form. We can then obtain the corresponding theorem for RT cheaply via the characterization of RT(A) in Section 1.3.

We start by introducing another definition in the spirit of 1.4.1 and 1.4.2:

Definition 2.3.1 (∇-category) A ∇-category is a regular category C equipped with an exact functor ∇ : Set → C. A ∇-functor between ∇-categories (C, ∇_{C}) and (D, ∇_{D}) is an exact functor F : C → D such that F ∇_{C} ≅ ∇_{D}. We write ΓReg for the 2-category of Γ-categories, Γ-functors and natural transformations.

Note that if C, D are ∇Γ-categories, then F : C → D is a ∇Γ functor iff it is both a ∇-functor and a Γ-functor.

The result we need is that every ∇-functor Ass(A) → Ass(B) is a Γ-functor. This fact follows immediately from the following proposition:

Proposition 2.3.2 If F : Ass(A) → Ass(B) is a ∇-functor, then Γ_{B}F ≅ Γ_{A}.

Proof Given an object X of Ass(A), an element of Γ_{A}X is a morphism x : 1 → X. Define α_{X} : Γ_{A}X → Γ_{B}F X by α_{X}(x) = F x. Then α_{X} is natural in X, since given f : X → Y we have α_{Y} ((Γ_{A}f)x) = F (fx) = (F f)(F x) = Γ_{B}(F f)(α_{X}x). It suffices to show that each α_{X} is a bijection.

To see that α_{X} is injective, suppose F x = F x′ for x, x′ : 1 → X. Since η_{1} is iso, naturality of η gives ∇_{A}Γ_{A}x ≅ η_{X}x, and similarly for x′. So we have ∇_{B}Γ_{A}x ≅ F ∇_{A}Γ_{A}x ≅ F (η_{X}x) ≅ (F η_{X})(F x) and similarly for x′; hence ∇_{B}Γ_{A}x = ∇_{B}Γ_{A}x′. But ∇_{B} and Γ_{A} are faithful, so x = x′.

To see that α_{X} is surjective, given y ∈ Γ_{B}F X we have

(F η_{X})y : 1 ⟶ F ∇_{A}Γ_{A}X ≅ ∇_{B}Γ_{A}X.

Since ∇_{B} is full we obtain a morphism 1 → Γ_{A}X and hence a morphism x : 1 → X. But now (F η_{X})(F x) = F (η_{X}x) ≅ F ∇_{A}Γ_{A}x ≅ ∇_{B}Γ_{A}x ≅ (F η_{X})y. Since η_{X} is mono and F preserves monos, we have F x = y. □

For the record, we note that the following converse to Proposition 2.3.2 is also true. The proof we give is non-constructive.

Proposition 2.3.3 If F : Ass(A) → Ass(B) is a Γ-functor, then F ∇_{A} ≅ ∇_{B}.

Proof Given a set X, take Y such that card Y ≥ card X ×card A, and consider the assembly F ∇_{A}Y. We have Γ_{B}F ∇_{A}(Y) ≅ Γ_{A}∇_{A}Y ≅ Y, and so there are b ∈ B and Z ⊆ |F ∇_{A}Y | such that card Z ≥ card X and b ∈ ∥z∥ for all z ∈ Z. Let Y′ be the subset of Y corresponding to Z under the above bijection. Choose functions X →^{f} Y →^{g} X such that Im f ⊆ Y′ and gf = id. Suppose r ∈ B tracks F ∇_{A}(g). Then clearly rb ∈ ∥x∥ for all x ∈ |F ∇_{A}X|. Thus F ∇_{A}X is uniform.

But Γ_{B}F ∇_{A}X ≅ X, and so F ∇_{A}X ≅ ∇_{B}X. Naturality in X follows easily from naturality of Γ_{B}F ∇_{A} ≅ id. □

We can thus give two alternative formulations of Theorem 2.2.20 :

Theorem 2.3.4 The 2-functor Ass : PCA → ∇Reg [resp. PCA → ΓReg] is locally an equivalence. □

It is now easy to obtain the analogous result for RT. We regard RT(A) as a ∇Γ-category, equipped with exact functors ∇′ = I∇ and Γ′ = Hom(1, −) (see Proposition 1.3.9).

Lemma 2.3.5 For any A, B, the canonical functor

(I_{B} ∘ −) : ∇Reg [Ass(A), Ass(B)] ⟶ ∇Reg [Ass(A), RT(B)].

is part of an equivalence of categories.

Proof Clearly (I ∘ −) is faithful since I is faithful. We now show that it is essentially surjective. Given a ∇-functor G : Ass(A) → RT(B), for any object X of Ass(A) we have a mono X ↣ ∇′_{A}Γ′_{A}X and hence a mono GX ↣ ∇′_{B}Γ′_{A}X. But by the remark following Proposition 1.3.5 we have a regular epi IY ↠ GX for some Y in Ass(B). Now I_{B} is full, so the composite IY ↠ GX ↣ ∇′_{B}Γ′_{A}X is equal to Ig for some g : Y → ∇_{B}Γ′_{A}X in Ass(B). Let HX be the object appearing in the image factorization of g. Since I preserves image factorizations, we have GX ≅ IHX. Now since I is full, for any morphism f : X → Y there is a morphism Hf : HX → HY such that IHf is identified with Gf. So we obtain a functor H : Ass(A) → Ass(B) such that G ≅ IH. It is clear that H is an exact ∇-functor.

It is now easy to see that (I ∘ −) is also full: given G, G′ : Ass(A) → RT(B), any natural transformation G → G′ restricts to a natural transformation H → H′ since I is full. Thus (I ∘ −) is part of an equivalence. □

Proposition 2.3.6 There is a canonical equivalence of categories

∇Reg [Ass(A), Ass(B)] ≃ ∇Reg [RT(A), RT(B)].

In particular, for every ∇-functor F : Ass(A) → Ass(B) there is an essentially unique ∇-functor F̂ : RT(A) → RT(B) such that F̂I_{A} ≅ I_{B}F; and for every natural transformation α : F → G between ∇-functors there is a unique natural transformation α̂ : F̂ → Ĝ such that α̂I_{A} ≅ I_{B}α under this isomorphism.

Proof By Theorem 1.3.6, the functor (− ∘ I_{A}) is part of an equivalence

Ex[Ass(A), RT(B)] ≃ Ex[RT(A), RT(B)].

Moreover, if we have an exact functor F̃ : RT(A) → RT(B) and F ≅ F̃I_{A} then F̃∇′_{A} ≅ F ∇_{A}; hence F̃ is a ∇-functor iff F is a ∇-functor. So we have an equivalence

∇Reg [Ass(A), RT(B)] ≃ ∇Reg [RT(A), RT(B)].

Combining this with the Lemma we obtain the desired equivalence. □

Let us define RT : PCA → ∇Reg by setting RT(γ) = γ̂_{∗} for γ an applicative morphism, and RT(ζ) = ζ̂_{∗} for ζ an applicative transformation. (From now on we will write γ̂ and ζ̂ instead of γ̂_{∗} and ζ̂_{∗}.) Then it is trivial to check using the above proposition that RT is a 2-functor; moreover, combining the above proposition with Theorem 2.3.4 we obtain

Theorem 2.3.7 The 2-functor RT : PCA → ∇Reg is locally an equivalence. □

Corollary 2.3.8 If A, B are PCAs, we have RT(A) ≃ RT(B) iff A ≃ B.

Proof Similar to Corollary 2.2.21. □

Remarks 2.3.9 (i) If γ : A ⟶^{|} B is an applicative morphism, it is easy to check that γ̂ : RT(A) → RT(B) is isomorphic to the functor described explicitly by

\begin{matrix}γ̂(X, ρ) = (γ_{∗}X, γ_{∗}ρ), \\ γ̂ ((X, ρ) ⟶^{τ} (Y, σ)) = γ_{∗}(T ↣^{τ} X × Y). \end{matrix}

(ii) It can easily be shown that the analogue of Proposition 2.3.2 holds for RT: every ∇-functor RT(A) → RT(B) is a Γ-functor. Moreover, it seems plausible that the converse is also true (cf. Proposition 2.3.3), though we have not been able to settle this question.

2.4 Some special morphisms

We now turn to investigate certain properties of applicative morphisms, and how these are reflected in properties of the corresponding functors. One might expect that categorical properties of applicative morphisms, such as being a mono or an epi in PCA or PCA/∼, would play some special role. However, this appears not to be the case, perhaps because of the poor categorical structure of PCA. (In fact, it is surprisingly difficult even to identify the monos in PCA or PCA/∼!) It thus seems more fruitful to consider concrete properties of morphisms. In this section we examine three natural classes of applicative morphisms: discrete, projective and decidable morphisms, and give categorical characterizations of the functors they give rise to.

2.4.1 Discrete morphisms

In Section 2.1 we remarked that an applicative morphism A ⟶^{|} B may be thought of informally as an “implementation” of A in B. It seems natural to consider the class of morphisms for which no element of B may implement two different elements of A.

Definition 2.4.1 (Discrete morphism) An applicative morphism γ : A ⟶^{|} B is called discrete if

γ(a, b) ∧ γ(a′, b) ⟹ a = a′

for all a, a′ ∈ A, b ∈ B. We write dPCA for the 2-category of PCAs, discrete morphisms and applicative transformations.

We now characterize the functors γ_{∗}, γ̂ arising from discrete morphisms. For this we need the following notion (introduced in [44]):

Definition 2.4.2 (Discrete object) An object X of Ass(A) or RT(A) is discrete if the canonical morphism X → X^{∇2} (or X → X^{∇′2}) is iso.

Clearly X is discrete in Ass(A) iff IX is discrete in RT(A). Note that if X is discrete then in particular every morphism ∇2 → X (or ∇′2 → X) is constant (i.e. factors through 1). Discrete objects are extensively studied in [44], where it is shown that they form an “internally complete” subcategory of RT(A). In that paper the following characterization of discrete objects was given:

Proposition 2.4.3 (i) An object X of Ass(A) is discrete iff it is a modest set.

(ii) An object Y of RT(A) is discrete iff there exist a modest set X and a regular epi IX ↠ Y.

Proof (i) Suppose 2 = {0, 1}; then ∥0 ∈ ∇2∥ = ∥1 ∈ ∇2∥ = A. If X is modest, then for any f : ∇2 → X tracked by r say, we have ri ∈ ∥x∥_{X} for a unique x and so f0 = f1 = x. Hence the morphism X^{∇2} → X given by evaluation at 0 is inverse to the canonical morphism X → X^{∇2}, so X is discrete. Conversely, if X is not modest, take x ≠ x′ ∈ |X| with a ∈ ∥x∥ ∩ ∥x′∥. Then there is a morphism f : ∇2 → X tracked by ka such that f0 = x, f1 = x′. Hence the morphism |X| → |X^{∇2}| is not surjective, so X is not discrete.

(ii) See [44, Section 6]. □

The notion of discrete object may thus be seen as generalizing the notion of modest set. We may now identify the functors arising from discrete morphisms:

Theorem 2.4.4 The following are equivalent for an applicative morphism γ : A ⟶^{|} B:

(i) γ is discrete;

(ii) γ_{∗} preserves modest sets;

(iii) γ̂ preserves discrete objects.

Proof (i) ⇒ (ii): Suppose γ is discrete and X is modest in Ass(A). Given x ≠ x′ ∈ |X| we have ∥x∥ ∩ ∥x′∥ = ∅ so γ^{+}∥x∥ ∩ γ^{+}∥x′∥ = ∅, thus γ_{∗}X is modest.

(ii) ⇒ (iii): Suppose γ_{∗} preserves modest sets and Y is discrete in RT(A). Take X modest and e : IX ↠ Y regular epi by Proposition 2.4.3(ii). Then γ_{∗}X is modest and γ̂(e) : I(γ_{∗}X) → γ̂Y is regular epi since γ̂ is exact. Hence γ̂Y is discrete.

(iii) ⇒ (ii): Trivial, since we know that I_{B}γ_{∗} ≅ γ̂I_{A}.

(ii) ⇒ (i): The object of realizers R in Ass(A) is modest (see Definition 2.2.8); and if γ_{∗}R is modest then clearly γ is discrete. □

Using discrete morphisms we can formulate the analogue of Theorems 2.2.20 and 2.3.7 for Mod. First note that the functor Γ : Mod(A) → Set is exact, so Mod(A) is a Γ-category in the sense of Definition 1.4.1. Next, if γ : A ⟶^{|} B is a discrete morphism then it is clear from the above proposition that γ_{∗} restricts to a Γ-functor Mod(γ) : Mod(A) → Mod(B). Moreover, if ζ : γ ⪯ δ then ζ_{∗} restricts to a natural transformation Mod(ζ) : Mod(γ) → Mod(δ) since Mod(B) is full in Ass(B). Thus we have a 2-functor Mod : dPCA → ΓReg. We can now prove the following without much effort:

Theorem 2.4.5 The 2-functor Mod is locally an equivalence.

Proof By Theorems 1.4.5 and 2.2.20 we have equivalences

ΓReg [Mod(A), Ass(B)] ≃ ∇ΓReg [Ass(A), Ass(B)] ≃ PCA [A, B].

But Proposition 2.4.4 shows that a Γ-functor Mod(A) → Ass(B) factors through I_{B} iff the corresponding morphisms A ⟶^{|} B is discrete. So the above equivalence restricts to an equivalence between the full subcategories:

ΓReg [Mod(A), Mod(B)] ≃ dPCA [A, B]. □

Corollary 2.4.6 If A, B are PCAs, we have Mod(A) ≃ Mod(B) iff A ≃ B.

Proof It is not hard to show that if γ, δ form an equivalence of PCAs then both γ, δ are discrete; hence we obtain an equivalence Mod(A) ≃ Mod(B). For the converse, note that if F, G form an equivalence Mod(A) ≃ Mod(B) then both F, G are Γ-functors; hence by the Theorem we have A ≃ B. □

2.4.2 Projective morphisms

When working with applicative morphisms, it is convenient to deal wherever possible with single-valued morphisms A ⟶^{|} B—that is, with functions A → B— since these are much easier to calculate with than general applicative morphisms. We therefore make the following definition:

Definition 2.4.7 (Projective morphism) A morphism γ : A ⟶^{|} B is projective if there is a morphism γ′ ∼ γ such that γ′ is single-valued (i.e. for each a ∈ A the set γ′(a) is a singleton).

It turns out that the functors arising from projective morphisms can be characterized as those that preserve projective objects:

Definition 2.4.8 (Projective object) An object X in any category is called projective (or sometimes regular projective) if for any regular epimorphism e : Y ↠ Z and any morphism f : X → Z there is a morphism g : X → Y such that f = eg.

Proposition 2.4.9 (i) An object X is projective in Ass(A) iff IX is projective in RT(A).

(ii) If Y is projective in RT(A) then Y ≅ IX for some X in Ass(A).

Proof (i) The right-to-left implication is trivial since I is full. Conversely, suppose X is projective in Ass(A), e : Y ↠ Z is a regular epi in RT(A), and we are given f : IX → Z. Let Z′ in Ass(A) be such that there is a regular epi h_{Z} : IZ′ ↠ Z; let Y′′ be the object obtained by pulling back h_{Z} along e; and let Y′ in Ass(A) be such that there is a regular epi IY′ ↠ Y′′. Since pullbacks preserve regular epis, we have a square

[figure: IY′; Ie′; IZ′; Y; h_{Y}; e; Z.; h_{Z}]

Now let X′′ → IX be the pullback of h_{Z} along f, and take X′ in Ass(A) such that there is a regular epi IX′ ↠ X′′. We now have a square

[figure: IX′; If′; IZ′; IX; Ih_{X}; f; Z.; h_{Z}]

Clearly I reflects regular epis, and so h_{X} is regular epi. Since X is projective, we obtain k : X → X′ such that h_{X}k = id_{X}. Now we have f′k : X → Z′ and e′ : Y′ ↠ Z′ regular epi, so we have j : X → Y′ such that e′j = f′k. Let g = h_{Y} (Ij). Then eg = eh_{Y} (Ij) = h_{Z}(Ie′)(Ij) = h_{Z}(If′)(Ik) = f(Ih_{X})(Ik) = f as required.

(ii) Suppose Y is projective in RT(A); take X in Ass(A) such that there is a regular epi h : IX ↠ Y. Take k : Y → IX such that hk = id_{Y}. Then k is mono. Now suppose kh = If : IX → IX, and let Z be the object appearing in the image factorization of f. Then IZ appears in the image factorization of kh, so Y ≅ IZ by uniqueness of factorizations. □

It is now easy to characterize the projective objects concretely:

Proposition 2.4.10 X is projective in Ass(A) iff there is X′ ≅ X such that for each x ∈ |X′| the set ∥x∥_{X′} is a singleton. (We say that such an object X′ has the singleton property.)

Proof Suppose X′ satisfies the singleton property, e : Y ↠ Z is regular epi and we are given f : X′ → Z tracked by r ∈ A. By the proof of Proposition 1.2.10, we may assume w.l.o.g. that e is tracked by i and that ∥z∥_{Z} = ⋃_{ey=z} ∥y∥_{Y} for all z ∈ |Z|. We define a function g : |X′| → |Y | as follows: for each x ∈ |X′| let a_{x} be the unique element of ∥x∥_{X′}, and let gx be some element of |Y | such that e(gx) = fx and ra_{x} ∈ ∥gx∥_{Y} (here we use the axiom of choice in the meta-theory). Clearly g : X′ → Y is tracked by r and eg = f. Thus X′ is projective, and so if X ≅ X′ then X is projective.

Conversely, suppose X is projective. As in Definition 1.4.6, let X_{0} be the assembly defined by

|X_{0}| = {(x, a) | x ∈ |X|, a ∈ ∥x∥}, ∥(x, a) ∈ X_{0}∥ = {a}

and let e : X_{0} → X be the obvious projection tracked by i. Clearly e is regular epi, and so there is a morphism g : X → X_{0} such that eg = id_{X}. Let X′ ↣ X_{0} be the subobject defined by

|X′| = Im g, ∥x∥_{X′} = x_{X_{0}}.

Then clearly we have morphisms e′ : X′ → X and g′ : X → X′ such that e′g′ = id_{X} and g′ is a bijection on the underlying sets. Hence X ≅ X′. But X_{0} has the singleton property, hence so does X′. □

Remark 2.4.11 Note that if X is a modest set then so is X_{0}, and if X′ ≅ X then X′ is also modest. Thus the above proposition also holds with Ass(A) replaced by Mod(A). It follows that an object X is projective in Mod(A) iff JX is projective in Ass(A).

It is now easy to characterize the functors arising from projective morphisms:

Theorem 2.4.12 The following are equivalent for an applicative morphism γ : A ⟶^{|} B:

(i) γ is projective;

(ii) γ_{∗} preserves projectives;

(iii) γ̂ preserves projectives.

Proof (i) ⇒ (ii): Suppose γ ∼ γ′ where γ′ is single-valued, and X is projective in Ass(A). Take X′ ≅ X where X′ has the singleton property. Now γ_{∗}X ≅ γ′_{∗}X ≅ γ′_{∗}X′, and clearly γ′_{∗}X′ has the singleton property. Thus γ_{∗}X is projective.

(ii) ⇒ (i): Let R be the object of realizers in Ass(A); then R has the singleton property and so is projective. Suppose γ_{∗} preserves projectives; let S = γ_{∗}R and take S′ ≅ S such that S′ has the singleton property. We may assume that |S| = |S′| = A. By definition of S we have γ(a) = ∥a ∈ S∥ for each a ∈ A. Now let γ′ be the relation defined by γ′(a) = ∥a ∈ S′∥. Suppose r realizes γ, and p, q realize the isomorphisms S → S′, S′ → S respectively. Then γ′ : A ⟶^{|} B is an applicative morphism as it is realized by λ^{∗}xy.p(r(qx)(qy)); moreover p realizes γ ⪯ γ′ and q realizes γ′ ⪯ γ. So we have γ ∼ γ′ where γ′ is single-valued. Thus γ is projective.

(ii) ⇔ (iii) is immediate from Proposition 2.4.9. □

Remark 2.4.13 It is interesting to note that an applicative morphism γ is projective iff the object γ_{∗}R is projective, and discrete iff γ_{∗}R is discrete.

2.4.3 Decidable morphisms

The properties of being discrete or single-valued were purely “set-theoretic” properties of an applicative morphism A ⟶^{|} B—that is, they were defined without reference to the application operation in A or B. We now turn to consider a more “recursion-theoretic” property of applicative morphisms.

Definition 2.4.14 (Decidable morphism) A morphism γ : A ⟶^{|} B is decidable if there is an element d ∈ B (called a decider for γ) such that for all b ∈ B we have

b ∈ γ(true_{A}) ⟹ db = true_{B}, b ∈ γ(false_{A}) ⟹ db = false_{B}.

Remarks 2.4.15 (i) Note that there is always an element c ∈ B such that c true_{B} ∈ γ(true_{A}), c false_{B} ∈ γ(false_{A}) (take c = λ^{∗}x. if x b b′ where b ∈ γ(true_{A}), b′ ∈ γ(false_{A})). Thus γ is decidable iff the booleans in B are “equivalent” to the image of the booleans in A.

(ii) It is easy to check that PCAs and decidable morphisms form a category.

An equivalent definition of decidable morphisms can be given involving a similar criterion for the numerals in a PCA:

Proposition 2.4.16 An applicative morphism γ : A → B is decidable iff there exists f ∈ B such that for all n ∈ N we have

b ∈ γ(\overline{n}_{A}) ⟹ fb = \overline{n}_{B}.

Proof Suppose r ∈ B realizes γ. First suppose we have f as above. Let a = λ^{∗}x. if_{A} x \overline{0} \overline{1}, take a′ ∈ γ(a), and let d = λ^{∗}x. iszero_{B} (f(ra′x)). Then for b ∈ γ(true_{A}) we have ra′b ∈ γ(a true_{A}) = γ(\overline{0}_{A}) and so f(ra′b) = \overline{0}_{B}, hence db = true_{B}. Similarly, if b ∈ γ(false_{A}) then db = false_{B}. Thus γ is decidable.

Conversely, suppose d is a decider for γ. We will construct an element f using the fixed point combinator Z of Proposition 1.1.13. First take iszero′ ∈ γ(iszero_{A}), and let Iszero = λ^{∗}x. d (r iszero′ x). Note that

b ∈ γ(\overline{0}) ⟹ Iszero b = true_{B}, b ∈ γ(\overline{n + 1}) ⟹ Iszero b = false_{B}.

Next, take pred′ ∈ γ(pred) and let Pred = r pred′. Then we have

b ∈ γ(\overline{0}) ⟹ Pred b ∈ γ(\overline{0}), b ∈ γ(\overline{n + 1}) ⟹ Pred b ∈ γ(\overline{n}).

Informally we wish to define f by the following recursive definition:

“fun f x = if (Iszero x) then 0 else succ(f(Pred x)).”

To achieve this in combinatory logic, we define

next = λ^{∗}gx. succ_{B} (g (Pred x)i),
F = λ^{∗}gx. if_{B} (Iszero x) (k \overline{0}) (next g), f = λ^{∗}x. (ZF)xi.

We show by induction on n that if b ∈ γ(\overline{n}) then fb = \overline{n}. First, if b ∈ γ(\overline{0}) then we have

fb ≃ (ZF)bi
≃ F (ZF)bi
≃ if (Iszero b) (k \overline{0}) (next (ZF)) i
≃ if true (k \overline{0}) (next (ZF)) i
≃ k \overline{0} i (since next (ZF)↓)
≃ \overline{0}.

Next, if b ∈ γ(\overline{n + 1}) and the result holds for n, then we have

fb ≃ if false (k \overline{0}) (next (ZF)) i
≃ next (ZF) i (since k \overline{0} ↓)
≃ succ ((ZF)(Pred b)i)
≃ succ (f(Pred b))
≃ succ \overline{n} (by induction hypothesis)
≃ \overline{n + 1}.  □

Remark 2.4.17 Again, there is always an element g ∈ B such that g\overline{n}_{B} ∈ γ(\overline{n}_{A}) for all n. So γ is decidable if the numerals in B are “equivalent” to the image under γ of the numerals in A.

One application of the above proposition is the following interesting property of the PCA K_{1}.

Proposition 2.4.18 K_{1} is initial in the category of PCAs and decidable applicative morphisms modulo ∼.

Proof Given any P CA, define κ : K_{1} ⟶^{|} A by κ(n) = \{\overline{n}_{A}\}. To see that κ is an applicative morphism, let φ : N × N ⇀ N be the partial recursive function defined by φ(m_{1}, m_{2}) ≃ {m_{1}}(m_{2}). Then by Theorem 1.1.16 there exists e ∈ B such that e \overline{m_{1}} \overline{m_{2}} = \overline{n} whenever φ(m_{1}, m_{2}) = n. Clearly e is a realizer for κ. Moreover κ is decidable by Proposition 2.4.16, since if a ∈ κ(\overline{n}_{A}) then ia = \overline{n}_{B}. For uniqueness, suppose κ′ : K_{1} ⟶^{|} A is any other decidable morphism. By Proposition 2.4.16 there exists f ∈ A such that if a ∈ κ′(n) then fa ∈ κ(n); and by Remark 2.4.17 there exists g ∈ A such that if a ∈ κ(n) then ga ∈ κ′(n). Thus f, g realize κ′ ⪯ κ ⪯ κ′ respectively, so κ′ ∼ κ. □

The functors arising from decidable morphisms enjoy many good properties, and can be characterized in a variety of ways. We first consider functors between categories of assemblies:

Theorem 2.4.19 The following are equivalent for an applicative morphism γ : A ⟶^{|} B:

(i) γ is decidable;

(ii) γ_{∗}2 ≅ 2, where 2 ≅ 1 + 1;

(iii) γ_{∗} preserves finite sums;

(iv) γ_{∗} preserves the natural number object.

Proof (i) ⇔ (ii): In both Ass(A) and Ass(B) we may take 2 to be the object given by

|2| = {0, 1}, ∥0∥ = {true}, ∥1∥ = {false}.

So it is clear by Remark 2.4.15(i) that γ is decidable iff the canonical morphism 2_{B} → γ_{∗}2_{A} has an inverse. And it is also clear that if there is any isomorphism 2 → γ_{∗}2 then the canonical morphism is one.

(i) ⇒ (iii): Suppose r realizes γ, d decides γ and c is as in Remark 2.4.15(i). Clearly γ_{∗}0 ≅ 0 whether or not γ is decidable. So suppose X, Y are objects of Ass(A). From the description of sums in Proposition 1.2.7, we see that if x ∈ |X| then

∥(0, x) ∈ γ_{∗}X + γ_{∗}Y ∥ = { ⟨true_{B}, b⟩ | b ∈ ∥x∥_{γ_{∗}X}},
∥(0, x) ∈ γ_{∗}(X + Y)∥ = γ^{+}{ ⟨true_{A}, a⟩ | a ∈ ∥x∥_{X}};

and similarly if y ∈ |Y |. Hence the canonical morphism γ_{∗}X +γ_{∗}Y → γ_{∗}(X +Y) is tracked by λ^{∗}x. r (r pair′ (c (fst x)))(snd x), where pair′ ∈ γ(pair_{A}); and its inverse is tracked by λ^{∗}x. ⟨d (r fst′ x), r snd′ x⟩, where fst′ ∈ γ(fst_{A}), snd′ ∈ γ(snd_{A}).

(iii) ⇒ (ii) is trivial.

(i) ⇔ (iv): By Proposition 2.4.16 and the remark following it, it is clear that γ is decidable iff the canonical morphism N_{B} → γ_{∗}N_{A} has an inverse. □

We can also give a similar result for functors between realizability toposes. First we recall a general result due to Peter Freyd:

Lemma 2.4.20 Suppose C, D are categories with finite limits, finite colimits and natural number object, and suppose F : C → D is exact and preserves finite sums and the NNO. Then F preserves coequalizers, and hence all finite colimits.

Proof An easy adaptation of the argument in [27, Section 5.5]. □

Theorem 2.4.21 The following are equivalent for an applicative morphism γ : A ⟶^{|} B:

(i) γ is decidable;

(ii) γ̂ preserves finite sums;

(iii) γ̂ preserves the natural number object;

(iv) γ̂ preserves finite colimits.

Proof (i) ⇒ (ii): Clearly γ̂0 ≅ 0 whether or not γ is decidable. Given objects (X, ρ) and (Y, σ) of RT(A) where ρ : R ↣ X × X and σ : S ↣ Y × Y, let τ be the composite morphism

R + S ⟶^{ρ+σ} (X × X) + (Y × Y) ⟶ (X + Y) × (X + Y).

It is straightforward to check that τ is an equivalence relation on X + Y, and that (X + Y, τ) is the sum of (X, ρ) and (Y, σ) in RT(A). Now by Remark 2.3.9 we have γ̂(X +Y, τ) ≅ (γ_{∗}(X +Y), γ_{∗}τ). But if γ is decidable then γ_{∗} preserves sums, and so γ_{∗}(X + Y) ≅ γ_{∗}X + γ_{∗}Y and γ_{∗}τ is isomorphic to the composite

γ_{∗}R + γ_{∗}S ⟶ (γ_{∗}X × γ_{∗}X) + (γ_{∗}Y × γ_{∗}Y) ⟶ (γ_{∗}X + γ_{∗}Y) × (γ_{∗}X + γ_{∗}Y).

Thus γ̂(X + Y, τ) ≅ γ̂(X, ρ) + γ̂(Y, σ). It is easy to check that γ̂ also preserves the inclusions modulo this isomorphism.

(ii) ⇒ (i): Clearly γ̂ preserves finite sums then so does γ_{∗}; hence γ is decidable by Theorem 2.4.19.

(i) ⇔ (iii): Clearly γ̂ preserves the NNO iff γ_{∗} does, so both implications follow by Theorem 2.4.19.

(iv) ⇒ (ii) is trivial.

(i) ⇒ (iv): Suppose γ is decidable. We already know that γ̂ preserves finite sums and the NNO, so by the Lemma γ̂ preserves finite colimits. □

Combining this with Proposition 2.4.18 we obtain an attractive property of the effective topos.

Corollary 2.4.22 Let A be any PCA. Then there is (up to natural isomorphism) a unique functor Eff → RT(A) that preserves finite limits and colimits and commutes with ∇. □

2.5 Adjoint pairs of morphisms

We close this chapter with a discussion of adjoint pairs of applicative morphisms. The notion of an adjoint pair makes sense in any 2-category, though we give the definition just for PCA.

Definition 2.5.1 (Adjoint pair) An adjoint pair (γ ⊣ δ) : A → B consists of a pair of applicative morphisms δ : A ⟶^{|} B, γ : B ⟶^{|} A such that id_{B} ⪯ δγ and γδ ⪯ id_{A}. We say that γ is left adjoint to δ, or that δ is right adjoint to γ.

Note that the “triangular identities” for the adjunction hold automatically as PCA is preorder-enriched.

The category of PCAs and adjoint pairs seems to have much better properties than PCA itself, although we will not pursue these here. In the next chapter we will see that there are many interesting examples of adjoint pairs in PCA. In fact, we will meet many examples of pairs for which three out of the four possible applicative transformations exist:

Definition 2.5.2 (Inclusion, retraction) Suppose (γ ⊣ δ) : A → B is an adjoint pair. We say (γ, δ) is an (applicative) inclusion if γδ ∼ id_{A}, and an (applicative) retraction if δγ ∼ id_{B}.

We now obtain some simple but powerful facts about adjoint pairs:

Theorem 2.5.3 Suppose δ : A ⟶^{|} B and γ : B ⟶^{|} A are applicative morphisms. (i) If γδ ⪯ id_{A}, then δ is discrete and γ is decidable; (ii) If γ ⊣ δ, then γ is also projective.

Proof Suppose r realizes γ and t realizes γδ ⪯ id_{A}.

(i) To see that δ is discrete, suppose b ∈ δ(a_{1})∩δ(a_{2}), and take b′ ∈ γ(b). Then b′ ∈ γδ(a_{1}) ∩ γδ(a_{2}), so a_{1} = tb′ = a_{2}. To see that γ is decidable, take true′ ∈ δ(true_{A}), false′ ∈ δ(false_{A}). Let e = λ^{∗}x. if_{B} x true′ false′ and take e′ ∈ γ(e). Now if a ∈ γ(true_{B}) then re′a ∈ γ(true′) ⊆ γδ(true_{A}), so t(re′a) = true_{A}. Similarly if a ∈ γ(false_{B}) then t(re′a) = false_{A}. So λ^{∗}a. t(re′a) is a decider for γ.

(ii) Suppose u realizes id_{B} ⪯ δγ and take u′ ∈ γ(u). For any b ∈ B we have ub ∈ δγ(b), so ub ∈ δ(c_{b}) for some c_{b} ∈ γ(b). Moreover c_{b} is unique since δ is discrete. Define a total relation γ′ : B ⟶^{|} A by γ′(b) = {c_{b}}. Then since c_{b} ∈ γ(b), we have that γ′ ⪯ γ is realized by i (note that ⪯ can be defined for total relations just as for applicative morphisms). Also if a ∈ γ(b) then ru′a ∈ γ(ub) ⊆ γδ(c_{b}), so t(ru′a) = c_{b}. So λ^{∗}a. t(ru′a) realizes γ ⪯ γ′. Thus γ′ ∼ γ, so clearly γ′ is an applicative morphism. Moreover γ′ is single-valued, so γ is projective. □

Corollary 2.5.4 If (γ ⊣ δ) is a retraction, then both δ and γ are discrete and decidable, and γ is projective. □

One application of Theorem 2.5.3 is to give an improved characterization of “equivalence” between PCAs:

Corollary 2.5.5 Suppose (γ, δ) : A\overleftarrow{→}B form an equivalence of PCAs. Then there is an equivalence (γ′, δ′) : A\overleftarrow{→}B where both δ and γ are single-valued (i.e. are functions).

Proof Both δ and γ are projective by Theorem 2.5.3. □

Functions between PCAs are much more manageable to work with than general relations, and it is this criterion for equivalence between PCAs that we will use in practice in the next chapter. For convenience we summarize our characterizations of equivalence here:

Theorem 2.5.6 The following are equivalent for two PCAs A, B:

(i) A ≃ B ;

(ii) There is an equivalence A ≃ B consisting of single-valued morphisms; (iii) Mod(A) ≃ Mod(B) ; (iv) Ass(A) ≃ Ass(B) ;

(v) RT(A) ≃ RT(B).

Proof Combine Corollaries 2.2.21, 2.3.8, 2.4.6 and 2.5.5. □

We now turn our attention to the functors arising from adjoint pairs. The basic result is the following:

Proposition 2.5.7 If δ : A ⟶^{|} B, γ : B ⟶^{|} A are applicative morphisms, then

γ ⊣ δ iff γ_{∗} ⊣ δ_{∗} iff γ̂ ⊣ δ̂.

Proof Trivial by Theorems 2.2.20 and 2.3.7. □

The main interest seems to lie with the functors δ̂, γ̂. Here we import a standard notion from topos theory (cf. [45]):

Definition 2.5.8 (Geometric morphism) Suppose E, F are toposes. A geometric morphism (H, G) : E → F consists of a pair of functors G : E → F, H : F → E such that H ⊣ G and H preserves finite limits. We say (H, G) is a geometric inclusion if the counit HG → id is an isomorphism. We will also say (H, G) is a geometric retraction if the unit id → GH is an isomorphism.

Geometric inclusions E → F are especially interesting since they correspond to sheaf subtoposes of F, which in turn are precisely equivalent to topologies on F (see Chapter 3 of [45]). The notion of geometric retraction is less intrinsically interesting—note that the definition is stronger than the (more standard) definition of geometric surjection (see [45, Definition 4.11]).

We will call a geometric morphism (H, G) exact if both H and G are exact functors. Note that since H ⊣ G we know that G preserves existing limits and H preserves existing colimits; hence H is automatically exact, and (H, G) is exact iff G preserves regular epis. (In fact every epi in a topos is regular, so it is enough to require that G preserves epis!) The following facts are now clear from Theorem 2.3.7:

Proposition 2.5.9 If δ : A ⟶^{|} B, γ : B ⟶^{|} A are applicative morphisms, then (i) (γ ⊣ δ) is an adjoint pair iff (γ̂, δ̂) is an exact geometric morphism; (ii) (γ ⊣ δ) is an inclusion iff (γ̂, δ̂) is an exact geometric inclusion; (iii) (γ ⊣ δ) is a retraction iff (γ̂, δ̂) is an exact geometric retraction. □

Example 2.5.10 Suppose A = 1. Let δ : 1 ⟶^{|} B, γ : B ⟶^{|} 1 be the (essentially unique) morphisms given by Proposition 2.1.7. Then clearly (γ ⊣ δ) is an applicative inclusion. Moreover, we have Ass(1) ≃ RT(1) ≃ Set, and the functors δ_{∗}, γ_{∗} are (up to isomorphism) none other than ∇, Γ respectively. Thus (γ ⊣ δ) gives rise to the geometric inclusion (Γ′, ∇′) : Set → RT(B) between toposes (cf. Proposition 1.3.9).

We close with some special properties of the functors arising from inclusions and retractions.

Proposition 2.5.11 (i) If (γ ⊣ δ) is an inclusion then δ_{∗}, δ̂ are full and faithful and preserve exponentials.

(ii) If (γ ⊣ δ) is a retraction then δ̂ preserves finite colimits, and γ_{∗}, γ̂ are faithful and reflect isomorphisms.

Proof (i) For any adjoint pair of functors H ⊣ G, where G : C → D, if the counit is iso then G is full and faithful (see [57, Chapter 4.3]). If moreover both C and D are cartesian-closed and H preserves binary products, then for any object X of C we have natural isomorphisms

H(− × GX) ≅ H(−) × HGX ≅ H(−) × X : D ⟶ C.

Hence by taking right adjoints we obtain G((−)^{X}) ≅ (G(−))^{GX}.

(ii) The fact that δ̂ preserves finite colimits is immediate from Theorem 2.4.21 and Corollary 2.5.4. Moreover, for any adjoint pair H ⊣ G, it is trivial to show that if the unit is iso then H is faithful and reflects isos. □

Examples of applicative morphisms

In this chapter we give some applications of the theory developed in Chapter 2. Our intention is to survey a variety of PCAs and to illustrate the diversity embraced by the concept of applicative morphism. We give two kinds of applications. Firstly, by constructing applicative morphisms we show the existence of certain functors between the categories. Secondly, by showing that two PCAs are inequivalent we are able to show the inequivalence of the corresponding categories. The spirit of this chapter is exploratory—it contains a somewhat loose assortment of the results we have found to date rather than a comprehensive survey of all known PCAs. We hope that more results in the same vein will be forthcoming in the future.

In Section 3.1 we consider K_{1} and similar PCAs arising from the notion of relative computability. In Section 3.2 we discuss term models for combinatory logic and for various λ-calculi, and the morphisms between them. The highlight of this section is a proof that the call-by-name and call-by-value λ-calculi have inequivalent term models. In Section 3.3 we consider Scott’s graph model Pω and its submodel Pω_{re}. These two PCAs will play an important role in subsequent chapters. Among other things we discover a pleasing proof that Pω_{re} is inequivalent to certain term models.

Many of the results in this chapter are (at present) of purely theoretical interest, and are not used in later chapters. The reader wanting only to follow the main line of the thesis should concentrate on Sections 3.2.1 and 3.3.

3.1 K_{1} and Turing degrees

In this section we consider PCAs based on the notion of “computability relative to an oracle”. The material here is not really new—our aim is simply to show how some known facts can be conveniently presented in terms of applicative morphisms. First we recall some definitions concerning relative computability—for more details see Chapter 9 of [17].

Given a subset A ⊆ N, we write χ_{A} for the characteristic function of A:

χ_{A}(n) = \{ \begin{matrix}1 & if n ∈ A \\ 0 & if n ∉ A. \end{matrix}

We write deg(A) for the set of partial functions that are recursive in A (that is, the smallest set of partial functions N^{k} ⇀ N containing χ_{A} and the basic functions and closed under substitution, recursion and minimalization). We call deg(A) the Turing degree of A. If A, B ⊆ N, we write A ≤_{T} B if χ_{A} ∈ deg(B); in this case we say A is reducible to B. Clearly deg(A) = deg(B) iff A ≤_{T} B and B ≤_{T} A.

We may think of deg(A) as the set of partial functions computable by a Turing machine equipped with an oracle for A (i.e. a device that magically computes χ_{A}). We can view such a device as a machine requiring two inputs: a number n supplied on the “input tape”, and an oracle χ plugged into the “oracle socket”. Let M_{0}, M_{1}, … be some fixed effective enumeration of such machines. We write {e}^{A}(n) to denote the result (if any) returned by the machine M_{e} when supplied with the number n and the oracle χ_{A}. For each A we thus have an enumeration {0}^{A}, {1}^{A}, … of the partial A-recursive functions N ⇀ N. We can now introduce the PCAs we wish to study.

Definition 3.1.1 For any A ⊆ N, let K_{1}^{A} be the partial applicative structure (N, ·), where application is defined by x · y ≃ {x}^{A}(y).

Proposition 3.1.2 K_{1}^{A} is a PCA.

Proof (Sketch.) Since the enumeration M_{0}, M_{1}, … is “effective”, one can show that there are k, s ∈ N (independent of A) such that for all x, y, z ∈ N we have

k · x · y = x, s · x · y ↓, s · x · y · z ≃ (x · z) · (y · z). □

Remark 3.1.3 In fact k, s may be chosen such that for any x, y the values of {k}^{A}(x) and {{s}^{A}(x)}^{A}(y) are independent of A. (Intuitively, these values can be computed without “consulting the oracle”.)

It is clear from the definitions that any partial A-recursive function is represented by an element of K_{1}^{A} in the sense of Theorem 1.1.16. This observation is useful in clearing up a small technical point:

Proposition 3.1.4 Suppose M_{0}, M_{1}, … and M′_{0}, M′_{1}, … are two effective enumerations of Turing machines as above, giving rise to PCAs K_{1}^{A}, K′_{1}^{A} for some A. Then K_{1}^{A} ≃ K′_{1}^{A}.

Proof Write ·, ·′ for the application operations in K_{1}^{A}, K′_{1}^{A} respectively. The partial function (x, y) ↦ x · y is clearly A-recursive, and so there exists r ∈ K′_{1}^{A} such that (r ·′ x) ·′ y ≃ x · y. Hence the identity relation γ : K_{1}^{A} ⟶^{|} K′_{1}^{A} is an applicative morphism realized by r. Similarly the identity relation δ : K′_{1}^{A} ⟶^{|} K_{1}^{A} is an applicative morphism, and trivially δγ = id, γδ = id. Thus K_{1}^{A} ≃ K′_{1}^{A}. □

Exactly the same argument can be used to prove a similar result for K_{1}:

Proposition 3.1.5 Suppose N_{0}, N_{1}, … and N′_{0}, N′_{1}, … are two effective enumerations of Turing machines (without oracle socket), giving rise to PCAs K_{1}, K′_{1}. Then K_{1} ≃ K′_{1}. Moreover, if A is a recursive set then K_{1} ≃ K_{1}^{A}. □

It is easy to see when two PCAs of the form K_{1}^{A} are equivalent:

Proposition 3.1.6 Suppose A, B ⊆ N. Then A ≤_{T} B iff there is a (necessarily essentially unique) decidable morphism δ : K_{1}^{A} ⟶^{|} K_{1}^{B}. Hence K_{1}^{A} ≃ K_{1}^{B} iff deg(A) = deg(B).

Proof Suppose A ≤_{T} B. Then application in K_{1}^{A} is B-recursive, and so as above the identity relation id : K_{1}^{A} ⟶^{|} K_{1}^{B} is an applicative morphism. Clearly id is decidable. Conversely, suppose δ : K_{1}^{A} ⟶^{|} K_{1}^{B} is any decidable morphism. Then by Proposition 2.4.16 there exists r ∈ K_{1}^{B} such that if m ∈ δ(n) then {r}^{B}(m) = n; and by Remark 2.4.17 there exists t such that {t}^{B}(n) ∈ δ(n) for all n. Thus id : K_{1}^{A} ⟶^{|} K_{1}^{B} is a decidable morphism and δ ∼ id. Take q representing χ_{A} in K_{1}^{A}, u realizing id, and d a decider for id. Then λ^{∗}x.d(uqx) (interpreted in K_{1}^{B}) represents χ_{A} in K_{1}^{B}. Thus χ_{A} ∈ deg(B) as required.

It clearly follows that if K_{1}^{A} ≃ K_{1}^{B} then deg(A) = deg(B). Conversely if A ≤_{T} B ≤_{T} A then we have decidable morphisms δ : K_{1}^{A} ⟶^{|} K_{1}^{B} and ϵ : K_{1}^{B} ⟶^{|} K_{1}^{A}. Now ϵδ is decidable, so ϵδ ∼ id by uniqueness. Similarly δϵ ∼ id, and so K_{1}^{A} ≃ K_{1}^{B}. □

If A ≤_{T} B, the existence of a morphism K_{1}^{A} ⟶^{|} K_{1}^{B} is hardly surprising. What is more surprising is that there is a morphism in the other direction:

Proposition 3.1.7 If A ≤_{T} B then there is an applicative inclusion (δ ⊣ γ) : K_{1}^{B} → K_{1}^{A}.

Proof Let δ = id; then δ is an applicative morphism by Proposition 3.1.6. Define the relation γ : K_{1}^{B} → K_{1}^{A} by γ(n) = {x | {x}^{B}(0) = n}, and write ·^{A}, ·^{B} for the application operations in K_{1}^{A}, K_{1}^{B} respectively. If the combinator s is well-chosen as in Remark 3.1.3, then for any x ∈ γ(m), y ∈ γ(n) we have

(s ·^{A} x ·^{A} y) ·^{B} 0 ≃ s ·^{B} x ·^{B} y ·^{B} 0 ≃ (x ·^{B} 0) ·^{B} (y ·^{B} 0) ≃ {m}^{B}(n)

and so s ·^{A} x ·^{A} y ∈ γ({m}^{B}(n)). Thus γ is realized by s.

Clearly id ⪯ δγ is realized by k and δγ ⪯ id is realized by λ^{∗}x.x0 (interpreted in K_{1}^{B}). Moreover, if k is well-chosen as in Remark 3.1.3 then k realizes id ⪯ γδ. So δ, γ constitute an inclusion K_{1}^{B} → K_{1}^{A}. □

We thus have an alternative proof for an already known result: for any A there is a geometric inclusion Eff^{A} → Eff (where Eff^{A} denotes RT(K_{1}^{A})), and indeed the lattice of Turing degrees embeds into the lattice of topologies on Eff. This result appears in [70] (= Section 2.8 of [71]), where an explicit description of the topology induced by A is also given.

We close this section by using applicative morphisms to obtain a proof of another known result: the effective topos is not equivalent to RT(C) for any total combinatory algebra C (see [46]). The original proof depended on finding a categorical property of Eff not shared by C; our proof is very similar except that we work entirely with the PCAs. Recall that a PCA C has decidable equality if there exists q ∈ C such that for all x, y ∈ C we have

q x y = \{ \begin{matrix}true & if x = y \\ false & if x ≠ y. \end{matrix}

Theorem 3.1.8 Suppose B, C are PCAs and B ≃ C. If B has decidable equality then so does C.

Proof Suppose γ : B ⟶^{|} C and δ : C ⟶^{|} B form an equivalence, where both γ, δ are single-valued. Let q ∈ B be a decider for equality as above. Since δ is discrete, we have

q (δx) (δy) = \{ \begin{matrix}true & if x = y \\ false & if x ≠ y. \end{matrix}

for all x, y ∈ C. Now suppose that r realizes γ, d decides γ and t realizes id ⪯ γδ. Then it is easy to see that the element p = λ^{∗}xy. d(q′ (tx) (ty)) decides equality in C, where q′ = γq. □

Corollary 3.1.9 No PCA K_{1}^{A} is equivalent to a total combinatory algebra.

Proof First note that K_{1}^{A} has decidable equality. However, suppose C is total and p decides equality in C. Then Y (p false) ↓; let v = Y (p false) and note that v = p false v. But if v = false then p false v = true; and if v ≠ false then p false v = false. So we obtain a contradiction. Thus K_{1}^{A} ≄ C. □

3.2 Term models

We now consider applicative morphisms arising in connection with term models for combinatory logic and for various λ-calculi. We will presuppose some acquaintance with the theory of the untyped λ-calculus—see [8] for background. We will also make frequent use of the following facts about applicative morphisms arising from algebraic homomorphisms of PCAs:

Proposition 3.2.1 Suppose f : A → B is a function between PCAs such that f(aa′) = f(a) · f(a′) whenever aa′↓. Then

(i) f : A ⟶^{|} B is a projective applicative morphism;

(ii) if f : A → B is injective then f is discrete;

(iii) if f : A → B is surjective and moreover aa′↓ whenever f(a) · f(a′)↓, then f has a right adjoint g, and (f ⊣ g) : B → A is an applicative inclusion.

Proof (i) The element λ^{∗}xy.xy realizes f (see Example 2.1.3(ii)), and f is projective since it is single-valued. (ii) Trivial. (iii) Define g : B ⟶^{|} A by g(b) = {a | f(a) = b}. Then g is total since f is surjective, and moreover g is realized by λ^{∗}xy.xy. Clearly fg = id_{A}, and id_{B} ⪯ gf is realized by i. □

3.2.1 Combinatory logic and λ-calculus

We start by considering term models for combinatory logic. For definiteness we concentrate mostly on closed term models, though most of our results have obvious counterparts for open term models. Recall that the set C^{0} of closed terms of combinatory logic is defined inductively by:

K, S ∈ C^{0}, p, q ∈ C^{0} ⟹ pq ∈ C^{0}.

When writing down elements of C^{0} we adopt the convention that juxtaposition is left-associative. A congruence on C^{0} is an equivalence relation ∼ such that

p ∼ q ⟹ rp ∼ rq ∧ pr ∼ qr

for all p, q, r ∈ C^{0}. A congruence ∼ is called a CL-theory if it is consistent (i.e. not every pair of terms is related) and contains all equivalences of the forms

Kpq ∼ p, Spqr ∼ (pr)(qr).

We will write CL to denote the least CL-theory.

If T is a CL-theory then the set C^{0}/T of equivalence classes has an applicative structure induced by that of C^{0}, and is a total combinatory algebra (take k, s to be the equivalence classes of K, S respectively). We call C^{0}/CL the closed term model for combinatory logic. We now obtain our first result:

Proposition 3.2.2 If T, T′ are CL-theories and T ⊆ T′ then there is an applicative inclusion C^{0}/T′ → C^{0}/T. Moreover, this inclusion is an equivalence iff T = T′. (Thus the lattice of CL-theories embeds into the lattice of topologies on RT(C^{0}/CL).)

Proof Clearly the quotient map C^{0}/T → C^{0}/T′ is surjective and preserves application, hence by Proposition 3.2.1 we have an inclusion (δ ⊣ γ) : C^{0}/T′ → C^{0}/T. Now suppose this inclusion is an equivalence. Given p, q ∈ C^{0} such that T′ ⊢ p = q, let [p], [q] denote the equivalence classes of p, q respectively in C^{0}/T. Then γ([p]) = γ([q]), so [p] = [q] since γ is discrete. Hence T ⊢ p = q; thus T = T′. □

Remark 3.2.3 It seems reasonable to conjecture that if T, T′ are distinct CLtheories then the PCAs C^{0}/T, C^{0}/T′ are inequivalent. However, so far we have been unable to prove any inequivalences at all between PCAs of the form C^{0}/T !

An important class of CL-theories is the class of λ-theories. Let Λ^{0}/β denote the set of closed terms of the untyped λ-calculus modulo β-equality; recall from Section 7.3 of [8] that for some CL-theory β we have Λ^{0}/β ≅ C^{0}/β. By a λ-theory we will mean an equivalence relation T on Λ^{0}/β such that

M =_{T} N ⟹ P M =_{T} P N ∧ MP =_{T} NP,

or equivalently a CL-theory T such that β ⊆ T. (It is easy to show that this agrees with the notion of λ-theory in [8, Chapter 4].) We will use the same letter to denote both the CL-theory and the equivalence relation on Λ^{0}/β. The following can now be seen as a consequence of the previous proposition:

Proposition 3.2.4 If T, T′ are λ-theories and T ⊆ T′ then there is an applicative inclusion Λ^{0}/T′ → Λ^{0}/T. This inclusion is an equivalence iff T = T′. □

Recall that a λ-theory T is called sensible if it equates all unsolvable terms (i.e. terms with no head normal form), The following are some important λ-theories:

K, the smallest sensible λ-theory;

B, the theory that equates terms iff they have the same Böhm tree; K^{∗}, the theory that equates terms iff their Böhm trees are η-equivalent (in fact this gives us the unique maximal sensible theory).

We use these symbols to denote both the λ-theories and the corresponding CLtheories. Thus we have the inclusions

CL ⊂ β ⊂ K ⊂ B ⊂ K^{∗}.

Proposition 3.2.5 Suppose T, T′ are CL-theories and β ⊆ T ⊆ T′ ⊆ B. Then the canonical applicative morphism C^{0}/T′ ⟶^{|} C^{0}/T is decidable.

Proof If T′ ⊢ M = true then B ⊢ M = true; hence M =_{β} true since true has a β-normal form, and so T ⊢ M = true. Similarly for false. Thus i is a decider for the morphism C^{0}/T′ ⟶^{|} C^{0}/T. □

For T any CL-theory, we know already that C^{0}/T ≄ K_{1} since C^{0}/T is total. However, it is natural to ask what morphisms do exist between K_{1} and C^{0}/T.

Theorem 3.2.6 For any T, there is an adjoint pair (κ ⊣ ν) : C^{0}/T → K_{1}. Moreover, if T ⊆ K^{∗} then this pair is an applicative retraction.

Proof Let κ be the essentially unique decidable morphism K_{1} ⟶^{|} C^{0}/T as in Proposition 2.4.18. Let ⌈−⌉ be some effective Gödel-numbering C^{0} → N, and define ν : C^{0}/T ⟶^{|} K_{1} by ν([p]) = {⌈q⌉ | T ⊢ p = q}. Take r ∈ K_{1} such that r · ⌈p⌉ · ⌈q⌉ = ⌈pq⌉; then r realizes ν. Let \overline{n} denote the standard CL-term representing a natural number n (see Proposition 1.1.11); clearly the function n ↦ ⌈\overline{n}⌉ is recursive and ⌈\overline{n}⌉ ∈ νκ(n), so we have id ⪯ νκ.

To see that κν ⪯ id, it suffices construct a CL-term E (called an enumerator for C^{0}) such that CL ⊢ E\overline{⌈p⌉} = p for all p ∈ C^{0}. First, by Theorem 1.1.16 there exist elements isK, isS, left, right ∈ C^{0} such that for all p, q ∈ C^{0} we have

isK \overline{⌈p⌉} = \{ \begin{matrix}true & if p ≡ K \\ false & otherwise, \end{matrix} isS \overline{⌈p⌉} = \{ \begin{matrix}true & if x ≡ S \\ false & otherwise, \end{matrix}
left \overline{⌈pq⌉} = \overline{⌈p⌉}, right \overline{⌈pq⌉} = \overline{⌈q⌉}.

Informally, we wish to define E as follows:

“fun E x = if (isK x) then K else if (isS x) then S else (E(left x))(E(right x)).”

More formally, let

E = Z(λ^{∗}gx. if (isK x) (K) (if (isS x) (S) ((g(left x))(g(right x))))).

It is straightforward to show by structural induction that CL ⊢ E\overline{⌈p⌉} = p.

Finally, if p ∈ CL then let p_{Λ} denote the λ-term obtained via the translation:

K_{Λ} = λxy.x, S_{Λ} = λxyz.(xz)(yz), (pq)_{Λ} = p_{Λ}q_{Λ}.

If ⌈⌈−⌉⌉ is an effective Gödel-numbering of λ-terms then clearly there is a recursive function h such that h(⌈p⌉) = ⌈⌈p_{Λ}⌉⌉. Moreover, there is a partial recursive function j such that if M ≂_{η} \overline{n} then j(⌈⌈M⌉⌉) = n (Informally, j computes the leftmost branch of the Böhm tree of M—see 10.2 of [8].) But M ≂_{η} \overline{n} iff K^{∗} ⊢ M = \overline{n} (see Theorem 16.2.7 of [8]). Hence if T ⊆ K^{∗} and T ⊢ p = \overline{n} then p_{Λ} ≂_{η} \overline{n} and so jh(⌈p⌉) = n. Thus νκ ⪯ id, so (κ ⊣ ν) is an applicative retraction. □

3.2.2 Open and closed term models

Before continuing our survey of different λ-calculi we digress briefly to touch on the relationship between open and closed term models. Recall that Λ denotes the set of λ-terms over a countably infinite set of variables. We write Λ^{0}(x) for the set of λ-terms M such that FV(M) ⊆ {x}.

Proposition 3.2.7 For any λ-theory T, there is a retraction Λ^{0}(x)/T → Λ^{0}/T.

Proof Let γ be the applicative morphism determined by the inclusion Λ^{0}/T ↪ Λ^{0}(x)/T, and let δ : Λ^{0}(x)/T ⟶^{|} Λ^{0}/T be the applicative morphism given by δ(M) = {λx.M} (this is realized by λyzx.(yx)(zx)). Then id ⪯ δγ is realized by λyx.y; δγ ⪯ id is realized by λy.yi; and γδ ⪯ id is realized by λy.yx. □

This retraction will not be an equivalence in general: e.g. if T = β and M realizes id ⪯ γδ then Mx =_{β} λx.x so MN =_{β} λx.x for all N, and so λx.N =_{β} λx.x, a contradiction. We would conjecture that for any theory T the PCAs Λ^{0}/T, Λ^{0}(x)/T are in fact inequivalent. However, so far we have only managed to prove the following:

Theorem 3.2.8 For any theory T generated by equations between closed terms, the PCAs Λ^{0}/T, Λ/T are inequivalent.

Proof Recall that k, s generate the whole of Λ^{0}/T under application. Suppose γ : Λ^{0}/T ⟶^{|} Λ/T and δ : Λ/T ⟶^{|} Λ^{0}/T form an equivalence, and take R realizing γ, U realizing γδ ⪯ id, K ∈ γ(k) and S ∈ γ(s). Given any N ∈ Λ/T, take N′ ∈ δ(N); then N′ is generated by k, s in Λ^{0}/T. Thus some N′′ ∈ γ(N′) is generated by R, K, S in Λ/T. But T ⊢ UN′′ = N. Thus R, K, S and U generate the whole of Λ^{0}/T. This is impossible since R, K, S, U between them contain only finitely many free variables. □

3.2.3 Lazy λ-calculus

In this paragraph we briefly consider the lazy λ-calculus, a variant of the standard untyped λ-calculus. This system has been studied extensively by Abramsky and Ong (see e.g. [2,4]); it was conceived as a prototypical lazy functional language in which terms are evaluated to weak head normal form rather than head normal form as in the classical theory.

The set of terms of the lazy λ-calculus is just the usual set Λ of untyped λterms, but the fundamental notion of equality between terms is a restricted form of β-equality which does not allow the contraction of redexes under abstractions. More formally, let ℓ be the least equivalence relation on Λ (or Λ^{0}) such that

(λx.M)N =_{ℓ} M[N/x]; M =_{ℓ} N ⟹ MP =_{ℓ} NP ∧ P M =_{ℓ} P N

for all M, N, P ∈ Λ. Then the quotient Λ^{0}/ℓ is clearly a total PCA (with k, s as before)—we call it the closed term model for the lazy λ-calculus. In general, a congruence T on Λ^{0} is called a lazy λ-theory if T is consistent and contains ℓ. So just as before we have

Proposition 3.2.9 If T, T′ are lazy λ-theories and T ⊆ T′ then there is an applicative inclusion Λ^{0}/T′ → Λ^{0}/T. This inclusion is an equivalence iff T = T′. □

Remark 3.2.10 Note that the usual β-equality on Λ^{0} provides an example of a lazy λ-theory. Thus any standard λ-theory may be regarded as a lazy λ-theory containing β. In particular we have an applicative inclusion between term models Λ^{0}/β → Λ^{0}/ℓ.

Thus the term model Λ^{0}/β may be regarded as a quotient either of C^{0}/CL or of Λ^{0}/ℓ. However, neither of C^{0}/CL, Λ^{0}/ℓ is (canonically) a quotient of the other: on the one hand, the term λx.x is not ℓ-equivalent to any λ-term built from k, s using juxtaposition; and on the other hand, the combinator S is not CL-equivalent to any combinator in the image of the standard translation Λ^{0} → C^{0}.

Again, we would conjecture that distinct lazy λ-theories never give rise to equivalent PCAs, and that if T is a CL-theory and T′ is a lazy λ-theory then C^{0}/T, Λ^{0}/T′ are equivalent iff they are canonically isomorphic.

3.2.4 Call-by-value λ-calculus

We now turn to consider another variant of the λ-calculus: the call-by-value λcalculus studied by Plotkin [78]. This system is also called the λ_{V} -calculus, and by contrast the standard theory is sometimes called the λ_{N}-calculus or call-by-name λ-calculus.

The λ_{V} calculus may be described as follows. We say that a λ-term M is a value if it is a variable, a constant or an abstraction (i.e. if it is not of the form M_{1}M_{2}). We write V ⊂ Λ for the set of values, and V^{0} for V ∩ Λ^{0}. We now define the reduction relation →_{V} to be the smallest reflexive-transitive relation such that

(λx.M)N →_{V} M[N/x] whenever N ∈ V;
M →_{V} N ⟹ MP →_{V} NP ∧ P M →_{V} P N ∧ λx.M →_{V} λx.N

for all M, N, P ∈ Λ. Let V denote the equivalence relation generated by →_{V}. We can endow V^{0}/V with a partial applicative structure by declaring that

[M] · [N] = [P] iff MN =_{V} P

for all M, N, P ∈ V^{0}. (It is easy to see that this does define a partial binary operation on V^{0}/V.) We will often abuse our notion and write M instead of [M]. Note that M · N ↓ iff there is a value P such that M →_{V} P and N →_{V} P, since the Church-Rosser property holds for →_{V} (see Section 4 of [78]).

Proposition 3.2.11 (V^{0}/V, ·) is a PCA.

Proof First note that for M, N, P ∈ V^{0} we have

\begin{matrix}k · M · N ≃ (λy.M) · N ≃ M; \\ s · M · N ≃ (λyz.Mz(yz)) ≃ (λz.Mz(Nz)) ↓ . \end{matrix}

Now if (M · P) · (N · P)↓ then (M · P) · (N · P) = (MP)(NP); but (s · M · N)P = (MP)(NP) and so s · M · N · P = (M · P) · (N · P). Finally, if s · M · N · P ↓ then (MP)(NP) →_{v} Q for some value Q. Suppose UV is the last term in the reduction sequence that is not a value. Then U, V are values and M · P = U, N · P = V. Thus (M · P) · (N · P)↓. □

We say that an equivalence relation T on V^{0} is a λ_{V} -theory if T is consistent and contains V, and moreover T is a congruence in the following sense:

\begin{matrix}M =_{T} N ∧ M · P ↓ ⟹ M · P =_{T} N · P; \\ M =_{T} N ∧ P · M ↓ ⟹ P · M =_{T} P · N. \end{matrix}

We call T a sensible λ_{V} -theory if T identifies all terms M such that M · N ↑ for all N ∈ V^{0}. If T is a λ_{V} -theory then clearly V^{0}/T is a PCA, and as before we have

Proposition 3.2.12 If T, T′ are λ_{V} -theories and T ⊆ T′ then there is an applicative inclusion Λ^{0}/T′ → Λ^{0}/T. This inclusion is an equivalence iff T = T′. □

Remark 3.2.13 Although V^{0}/T is not a total combinatory algebra, it is easy to see that it does not have decidable equality (and hence V^{0}/T ≄ K_{1}^{A}). For if V^{0}/T has decidable equality then there exists p ∈ V^{0}/T such that for all q ∈ V^{0}/T we have

p · q = \{ \begin{matrix}true & if T ⊢ q = ⊥ \\ false & otherwise \end{matrix}

(where ⊥ = λy.(λx.xx)(λx.xx)). Now take r such that r · true = i and r · false↑, and let t = λ^{∗}x.r(px). Then we have t · q ↓ iff T ⊢ q = ⊥. But by the context lemma for the λ_{V} -calculus, if t · ⊥ ↓ then t · q ↓ for all q ∈ V^{0}/T, so we have a contradiction.

Remark 3.2.14 It is also possible to formulate a “lazy call-by-value λ-calculus”, where in the definition of the reduction relation →_{V} we omit the clause

M →_{V} N ⟹ λx.M →_{V} λx.N.

This system has been studied in [18]. From the point of view of applicative morphisms, the relationship between this theory and the λ_{V} -calculus is analogous to that between the lazy and standard λ-calculi.

The rest of this section is devoted to investigating the relationship between the call-by-name and call-by-value term models. Firstly, there is a rather trivial morphism from the call-by-value to the call-by-name model:

Proposition 3.2.15 Suppose T is a λ_{V} -theory and U is a λ_{N}-theory. Then the inclusion V^{0} ↪ Λ^{0} gives rise to an applicative morphism ι : V^{0}/T ⟶^{|} Λ^{0}/U. Moreover, this morphism is decidable and projective if T ⊆ U, but never discrete. Proof The relation ι is defined as follows:

ι([M]) = {[N] ∈ Λ^{0}/U | T ⊢ N = M}.

This relation is well-defined and total, and is an applicative morphism realized by λ^{∗}xy.xy, since if M_{1}, M_{2} ∈ V^{0}, M_{1} · M_{2} ↓ and T ⊢ N_{1} = M_{1}, N_{2} = M_{2} then T ⊢ N_{1}N_{2} = M_{1} · M_{2}. If T ⊆ U then clearly ι([M]) = {[M]}, so ι is projective; moreover ι(true) = {true} and ι(false) = {false} so ι is decidable. However, if ι is discrete then for all M, N ∈ V^{0} with M =_{β} N we must have T ⊢ M = N. In particular, if M = λxy.y and N = λx.(λzy.y)(⊥i) then T ⊢ M = N. But M · i↓ and N · i↑, so we have a contradiction. □

More interestingly, applicative morphisms arise from the simulations of callby-value in call-by-name λ-calculus and vice versa given by Plotkin [78]. In that paper, a syntactic translation V → Λ, M ↦ \overline{M} was defined inductively as follows:

\overline{x} = λz.zx,  \overline{λx.M} = λz.z(λx.\overline{M}),  \overline{MN} = λz.\overline{M}(λa.\overline{N}(λb.abz)).

Also a translation Λ → V, M ↦ \underline{M} was defined by:

\underline{x} = x,  \underline{λx.M} = λz.z(λx.\underline{M}),  \underline{MN} = λz.\underline{M}(λa.a\underline{N}z).

Clearly these translations restrict to functions V^{0} → Λ^{0} and Λ^{0} → V^{0} respectively. It is not hard to show that these functions give rise to applicative morphisms:

Proposition 3.2.16 Suppose T is a λ_{V} -theory and U is a λ_{N}-theory. Then there are applicative morphisms γ : V^{0}/T ⟶^{|} Λ^{0}/U and δ : Λ^{0}/U ⟶^{|} V^{0}/T defined by

\begin{matrix}γ([M]) = \{[\overline{N}] ∈ Λ^{0}/U | T ⊢ N = M\}, \\ δ([M]) = \{[\underline{N}] ∈ V^{0}/T | U ⊢ N = M\}. \end{matrix}

Proof The relations γ, δ are clearly well-defined and total. But γ is realized by R = λxyz.x(λa.y(λb.abz)), since if M_{1}, M_{2} ∈ V^{0}, M_{1} · M_{2} ↓ and T ⊢ N_{1} = M_{1}, T ⊢ N_{2} = M_{2} then R \overline{N_{1}} \overline{N_{2}} =_{β} \overline{N_{1}N_{2}} and T ⊢ N_{1}N_{2} = M_{1} · M_{2}, so R \overline{N_{1}} \overline{N_{2}} ∈ γ([M_{1}M_{2}]). A similar argument proves that δ is realized by λxyz.x(λa.ayz). □

The morphisms γ, δ turn out to be particularly well-behaved in the case of the term models V^{0}/V and Λ^{0}/β:

Proposition 3.2.17 Suppose T = V and U = β in the above proposition. Then both γ and δ are discrete, projective and decidable.

Proof It is proved in [78] that for M, N ∈ V^{0} we have v ⊢ M = N iff β ⊢ \overline{M} = \overline{N}. Thus γ([M]) = \{[\overline{M}]\}, γ is discrete and projective. To see that γ is decidable, note that

\overline{true} = λz.z(λxw.w(λyv.vx)), \overline{false} = λz.z(λxw.w(λyv.vy)).

Take D = λt.t(λu.u true (λq.q false i)); then it is easily checked that

β ⊢ D \overline{true} = true, β ⊢ D \overline{false} = false.

Thus D is a decider for γ.

The argument for δ is similar. We know from [78] that for M, N ∈ Λ^{0} we have β ⊢ M = N iff v ⊢ \underline{M} = \underline{N}; hence δ is discrete and projective. Moreover it is routine to verify that the term λt.t(λu.u true (λq.q false)) is a decider for δ. □

It would be interesting to know whether there are other “matching” pairs of theories T, U for which the corresponding morphisms γ, δ are similarly wellbehaved.

3.2.5 Inequivalence of λ_{N} and λ_{V}

We conclude this section by showing that the PCAs V^{0}/T, Λ^{0}/U are inequivalent, at least when T, U are sensible theories. This result is particularly striking since it gives rise to a previously unknown inequivalence between realizability toposes. (In fact, we do not know of any purely categorical way of showing that RT(V^{0}/T) and RT(Λ^{0}/U) are inequivalent.)

We first fix on some notation. Write I, Ω to denote the equivalence classes in Λ^{0}/U of the terms λx.x, (λx.xx)(λx.xx) respectively, and write ⊤, ⊥ for the equivalence classes in V^{0}/T of Y K, λy.(λx.xx)(λx.xx) respectively. Note that M ∈ Λ^{0} is unsolvable iff U ⊢ M = Ω; and N ∈ V^{0} satisfies ∀P.N · P ↑ iff T ⊢ N = ⊥. We define the observational preorder ≲ on Λ^{0}/U by

M_{1} ≲ M_{2} iff ∀P ∈ Λ^{0}. (P M_{1} solvable) ⟹ (P M_{2} solvable)

(note that ≲ is well-defined on U-equivalence classes). We also define the preorder ≲ on V^{0}/T by

N_{1} ≲ N_{2} iff ∀P ∈ V^{0}. P · N_{1}↓ ⟹ P · N_{2}↓

(this relation is similarly well-defined). It is easy to see that in both cases we have M ≲ N ⟹ C[M] ≲ C[N] for any context C. In both cases we write M ≈ N to mean M ≲ N ∧ N ≲ M. Note that Ω ≲ M for all M ∈ Λ^{0}/U, and ⊥ ≲ N ≲ ⊤ for all N ∈ V^{0}/T.

The rest of this section is devoted to the proof of the following:

Theorem 3.2.18 Suppose T is a sensible λ_{V} -theory, U a sensible λ_{V} -theory. Then V^{0}/T ≄ Λ^{0}/U.

To prove this, we suppose that we have morphisms

γ : V^{0}/T ⟶^{|} Λ^{0}/U, δ : Λ^{0}/U ⟶^{|} V^{0}/T

forming an equivalence, and head for a contradiction. We assume without loss of generality that both γ, δ are single-valued relations, and for notational convenience regard them as functions between PCAs. The proof is easy once we have established that γ is monotone with respect to ≲. We show this by the following series of lemmas.

Lemma 3.2.19 δI ≉ δΩ and γ⊤ ≉ γ⊥.

Proof Suppose δI ≈ δΩ. Let M = λx.x true in Λ^{0}/U; note that MI = true and MΩ = Ω in Λ^{0}/U. So there exists M′ ∈ V^{0}/T such that M′ · δI = δ true and M′ · δΩ = δΩ; thus δ true ≈ δΩ. Similarly δ false ≈ δΩ, so δ true ≈ δ false. But δ is decidable, so true ≈ false in V^{0}/T —a contradiction.

Similarly, suppose γ⊤ ≈ γ⊥. Let N = λxz.(λy.true)(xi) in V^{0}/T; note that N · ⊤ = λz.true but N · ⊥ = λz.(λy.true)(⊥i), hence N · ⊥ = ⊥ as ⊥i has no value. So as before we have γ true ≈ γ⊥ and similarly γ false ≈ γ⊥. But γ is decidable, so true ≈ false in Λ^{0}/T —a contradiction. □

Lemma 3.2.20 γ⊤ ≴ γ⊥.

Proof Let P = λxyw.((λz.i)(xi))((λz.⊤)(yi)) in V^{0}/T. Then clearly P · ⊤ · ⊤ = λw.⊤ = ⊤ in V^{0}/T. Also P · ⊤ · ⊥ = λw.(λz.⊤)(⊥i) = ⊥ in V^{0}/T, and similarly P · ⊥ · ⊤ = ⊥. So there exists P′ ∈ Λ^{0}/U such that

P′(γ⊤)(γ⊤) = γ⊤, P′(γ⊤)(γ⊥) = P′(γ⊥)(γ⊤) = γ⊥ (in Λ^{0}/U).

Suppose γ⊤ ≲ γ⊥. We already know that γ⊤ ≉ γ⊥; the idea now is that the existence of P′ contradicts Berry’s stability theorem on the non-existence of “parallel” functions in the λ_{N}-calculus. Unfortunately, the form of this theorem given in [8] concerns stability with respect to Böhm tree inclusion rather than our relation ≲, and so a little hacking is required before we can invoke the theorem.

Note that according to Theorem 19.2.9(i) of [8] we have BT(γ⊤) ^{η} ⊆^{η} BT(γ⊥), and so by Exercise 10.6.7(ii) of [8] there exist G, H ∈ Λ^{0}/T such that

BT(γ⊤) ≤_{η} BT(G) ⊆ BT(H) ≥_{η} BT(γ⊥).

Now BT(γ⊤) =_{η} BT(G), and so γ⊤ ≈ G by Theorem 19.2.9; similarly γ⊥ ≈ H. Thus G ≉ H. Note also that we have

P′GG ≈ G, P′GH ≈ P′HG ≈ H.

Take Q such that QG is unsolvable but QH is solvable. Suppose Q(P′GH) and Q(P′HG) have principal head normal forms

Q(P′GH) = λx_{1} … x_{m}.x_{i}R_{1} … R_{p}, Q(P′HG) = λy_{1} … y_{n}.y_{j}S_{1} … S_{q}.

Then i = j and p−m = q−n (see Theorem 10.2.31 of [8]). Assume m ≥ n without loss of generality, and let J = λzx_{1} … x_{n}.zx_{1} … x_{n}. Let M_{1} = J(Q(P′GH)) and M_{2} = J(Q(P′HG)); note that the Böhm trees of M_{1}, M_{2} intersect non-trivially (in particular BT(M_{1}) ∩ BT(M_{2}) ⊇ BT(λx_{1} … x_{m}.x_{i}Ω_{1} … Ω_{p}) ).

Now let X = {λx.xGH, λx.xHG}. In the notation of Section 14.4 of [8], clearly ↑ X and ⊓X ≂ λx.xGG. Let C[M] ≡ J(Q(P′(fst M)(snd M))). By Theorem 14.4.10 of [8] we have

BT(C[λx.xGG]) = BT(C[λx.xGH]) ∩ BT(C[λx.xHG])

⊇ BT(λx_{1} … x_{m}.x_{i}Ω_{1} … Ω_{p}).

But C[λx.xGG] ≈ J(QG) which is unsolvable—a contradiction. □

Lemma 3.2.21 δΩ ≲ δI.

Proof Suppose there exists N ∈ V^{0}/T such that N · δΩ↓ but N · δI ↑. Consider P = λzw.(λx.⊤)(Nz); note that P · δΩ = ⊤ and P · δI = ⊥. So there exists P′ ∈ Λ^{0}/U such that P′(γδΩ) = γ⊤ and P′(γδI) = γ⊥. Hence, since id ⪯ γδ, there exists Q ∈ Λ^{0}/U such that QΩ = γ⊤ and QI = γ⊥. But Ω ≲ I and so γ⊤ ≲ γ⊥, contradicting Lemma 3.2.20. □

Lemma 3.2.22 δ reflects ≲, i.e. if δM_{1} ≲ δM_{2} then M_{1} ≲ M_{2}.

Proof Suppose M_{1}, M_{2} ∈ Λ^{0}/U are such that δM_{1} ≲ δM_{2} but M_{1} ≴ M_{2}. Then there exists P ∈ Λ^{0}/U such that P M_{1} = I, P M_{2} = Ω. Thus there exists P′ ∈ V^{0}/T such that P′ · δM_{1} = δI and P′ · δM_{2} = δΩ. Next note that, since δΩ ≲ δI but δΩ ≉ δI, there exists Q ∈ V^{0}/T such that Q · δI ↓ but Q · δΩ↑. Take R = λxw.⊤(Q(P′x)); then R · δM_{1} = ⊤ and R · δM_{2} = ⊥. But δM_{1} ≲ δM_{2} and so ⊤ ≲ ⊥, a contradiction. □

Lemma 3.2.23 γ preserves ≲.

Proof Suppose N_{1}, N_{2} ∈ V^{0}/T and N_{1} ≲ N_{2}. Then δγN_{1} ≲ δγN_{2} since id ⪯ δγ; hence γN_{1} ≲ γN_{2} by the last lemma. □

We can now prove Theorem 3.2.18. Observe that true, false ≲ ⊤ in V^{0}/T; hence γ(true), γ(false) ≲ γ⊤ in Λ^{0}/U. Suppose Q ∈ Λ^{0}/U is a decider for γ; then we have true, false ≲ Q(γ⊤) in Λ^{0}/U. This is a contradiction since true, false have no upper bound with respect to ≲ (since clearly there can be no M ∈ Λ^{0}/U such that BT (true), BT(false) ^{η} ⊆^{η} BT(M)). The proof of the theorem is now complete. □

3.3 The Scott graph model

There is a large class of PCAs based on the idea of “continuous function application”. Examples are Scott’s graph model Pω ([89]), Kleene’s second model K_{2} ([50]), and lattice-theoretic and CPO-models such as Scott’s D_{∞} ([88]). In this section we concentrate on the graph models Pω and Pω_{re}, though we anticipate that it will be possible to obtain results in the same spirit for many other PCAs.

3.3.1 The PCAs Pω and Pω_{re}

We start by explaining the construction of Scott’s graph model. Let ω denote the set of natural numbers, and let Pω be its powerset. The idea is to give Pω the structure of a (total) combinatory algebra by “encoding” functions Pω → Pω as subsets of ω. Of course it will not be possible to encode all such functions in this way, since card (Pω → Pω) > card (Pω), so the idea is to encode just the continuous functions. Recall that a function f : PX → PX is continuous if f preserves inclusion and f(⋃ A_{i}) = ⋃ fA_{i} whenever A_{0} ⊆ A_{1} ⊆ … ⊆ Pω.

The crucial observation is that such a function is completely determined by its action on finite subsets of ω, since any A ∈ Pω can be expressed as the union of a chain of finite subsets. Suppose that (−; −) : ω × ω → ω is some (injective) “coding” function for pairs of natural numbers, and that [−, …, −] : P_{fin}ω → ω is a coding function for finite subsets of ω. Given f : Pω → Pω a continuous function, the action of f on finite sets can be captured by the set

Graph f = { ([x_{1}, …, x_{n}]; y) | y ∈ f{x_{1}, …, x_{n}}} ⊆ ω.

To see now that f is indeed completely determined by Graph f, note that for any B ∈ Pω we have f(B) = { y | ∃x_{1}, …, x_{n} ∈ B. ([x_{1}, …, x_{n}]; y) ∈ Graph f}. This motivates the following definition:

Definition 3.3.1 Let (Pω, ·) be the total applicative structure given by

A · B = { y | ∃x_{1}, …, x_{n} ∈ B. ([x_{1}, …, x_{n}]; y) ∈ A}.

Note that (Graph f) · B = f(B), but not all A ∈ Pω are of the form Graph f. However, for any A the function B ↦ A · B is a continuous function Pω → Pω. In fact we have

Proposition 3.3.2 The application operation · : Pω × Pω → Pω is continuous, and Pω equipped with this application is a PCA.

Proof See e.g. Section 18.1 of [8]. □

Technically, the definition of the PCA Pω depends on particular choices of encoding functions (−; −) and [−, …, −]; and in fact different choices can give rise to non-isomorphic PCAs (see [87]). However, we are really interested in PCAs up to equivalence rather than isomorphism, and so the following fact is reassuring:

Proposition 3.3.3 Suppose (−; −)_{1}, (−; −)_{2} are two codings for pairs; […]_{1}, […]_{2} are two codings for finite sets; and ·_{1}, ·_{2} are the resulting application operations. Then the PCAs (Pω, ·_{1}) and (Pω, ·_{2}) are equivalent.

Proof Define both γ, δ : Pω ⟶^{|} Pω to be the identity relation. Clearly γδ = id and δγ = id, so we just need to show that γ : (Pω, ·_{1}) ⟶^{|} (Pω, ·_{2}) and δ : (Pω, ·_{2}) ⟶^{|} (Pω, ·_{1}) are applicative morphisms. Let R ∈ Pω be the set

{ ([x_{1}, …, x_{m}]_{2}; ([y_{1}, …, y_{n}]_{2}; z)_{2})_{2} | z ∈ {x_{1}, …, x_{m}} ·_{1} {y_{1}, …, y_{n}} }.

Suppose A, B ∈ P_{fin}ω. It is easy to see that R ·_{2} A ·_{2} B ⊇ A ·_{1} B. Conversely, if z ∈ R ·_{2} A ·_{2} B then there exist x_{1}, …, x_{m} ∈ A and y_{1}, …, y_{n} ∈ B such that ([x_{1}, …, x_{m}]_{2}; ([y_{1}, …, y_{n}]_{2}; z)_{2})_{2} ∈ R. So z ∈ {x_{1}, …, x_{m}} ·_{1} {y_{1}, …, y_{n}}, whence z ∈ A·_{1} B since ·_{1} is monotone. Thus R·_{2} A·_{2} B = A·_{1} B for finite A, B, and hence for all A, B since ·_{1} and ·_{2} are continuous. Thus γ is an applicative morphism realized by R. Similarly δ is an applicative morphism. □

Hence the categories Mod(Pω), Ass(Pω), RT(Pω) are (up to equivalence) independent of the choice of coding functions.

The PCA Pω is of limited usefulness in the study of computation since its definition has no “recursion-theoretic” content. However, we can define a PCA Pω_{re} which is a kind of recursive analogue of Pω. (Pω_{re} is called the r.e. graph model.) This PCA will play an important role in later chapters.

To define Pω_{re}, we need to consider recursive coding functions. We already know what it means for a pairing function (−; −) to be recursive; we say that a coding […] : P_{fin}ω → ω is recursive if there is a partial recursive binary function ψ such that for all x_{1}, …, x_{n}, y ∈ ω we have

ψ([x_{1}, …, x_{n}], y) = [x_{1}, …, x_{n}, y].

It follows from this that the image of the function […] is an r.e. set, and that other natural operations and predicates on finite sets are recursive. For example, there are partial recursive functions member, size such that for all x_{1}, …, x_{n}, y we have

member (y, [x_{1}, …, x_{n}]) = \{ \begin{matrix}0 & if y = x_{i} for some i \\ 1 & otherwise, \end{matrix}
size ([x_{1}, …, x_{n}]) = card {x_{1}, …, x_{n}}.

Now suppose · : Pω × Pω → Pω is the application operation obtained from the recursive codings (−; −) and […], and let Pω_{re} denote the set of r.e. subsets of ω. It is easy to check that if A, B ∈ Pω_{re} then A · B ∈ Pω_{re}; hence we obtain a total applicative structure (Pω_{re}, ·). Moreover, the elements k, s ∈ Pω may be chosen to be r.e. sets, and so Pω_{re} is a PCA. As with Pω, it turns out that the particular choice of codings is not important:

Proposition 3.3.4 Suppose (−; −)_{1}, (−; −)_{2} are two recursive codings for pairs; […]_{1}, […]_{2} are two recursive codings for finite sets; and ·_{1}, ·_{2} are the resulting application functions. Then the PCAs (Pω_{re}, ·_{1}) and (Pω_{re}, ·_{2}) are equivalent.

Proof It suffices to check that the realizer R for γ given in the proof of Proposition 3.3.3 is an r.e. set. But this is clear since there is a partial recursive ternary function φ such that for all x_{1}, …, x_{m}, y_{1}, …, y_{n}, z we have

φ ([x_{1}, …, x_{m}]_{2}, [y_{1}, …, y_{n}]_{2}, z) = \{ \begin{matrix}0 & if z ∈ \{x_{1}, …, x_{m}\} ·_{1} \{y_{1}, …, y_{n}\} \\ 1 & otherwise. □ \end{matrix}

Remark 3.3.5 Note that (for a fixed choice of recursive encodings) the inclusion Pω_{re} ↪ Pω preserves application, and hence gives rise to a discrete and projective applicative morphism.

3.3.2 Applicative morphisms involving Pω_{re}

We now consider the relationships between Pω_{re} and the PCAs K_{1} and Λ^{0}/U, where U is a λ-theory. In particular we show that there are an applicative retraction Pω_{re} → K_{1} and an applicative morphism Λ^{0}/U ⟶^{|} Pω_{re}, but that Pω_{re} and Λ^{0}/U are inequivalent. (Note that Pω_{re} and K_{1} are inequivalent by Corollary 3.1.9.)

First, note that we can represent the numerals in Pω_{re} by taking \overline{n} = \{n\}. To show that this representation is equivalent to the “canonical” representation given in Definition 1.1.11, it suffices by Proposition 1.1.15 to show the following:

Proposition 3.3.6 There exist elements succ, rec ∈ Pω_{re} such that

succ \overline{n} = \overline{n + 1}, rec A B \overline{0} = A, rec A B \overline{n + 1} ≃ B \overline{n} (rec A B \overline{n}).

Proof Take succ = {([n]; n + 1) | n ∈ ω}; clearly succ is an r.e. set. For rec, note first that if A = {x_{1}, …, x_{m}} and B = {y_{1}, …, y_{n}} then for each n the set

R(A, B, n) ≡ B · \overline{n} · (B · \overline{n − 1} · (… (B · \overline{0} · A) …))

is finite; and indeed if A = {x_{1}, …, x_{m}}, B = {y_{1}, …, y_{p}} and R(A, B, n) = {z_{1}, …, z_{q}} then [z⃗] can be computed recursively from [x⃗], [y⃗] and n. Now take

rec = { ([x⃗]; ([y⃗]; ([n]; z))) | x⃗, y⃗, n ∈ ω; z ∈ R({x_{1}, …, x_{m}}, {y_{1}, …, y_{p}}, n) }

Then rec is an r.e. set. Moreover the two equations for rec are clearly satisfied when A, B are finite, and hence for all A, B by continuity of application. □

Note in passing that this argument also shows that \overline{0}, \overline{1}, … are a good choice of numerals for Pω. From this it follows immediately that the applicative morphism Pω_{re} ⟶^{|} Pω mentioned in Remark 3.3.5 is decidable.

We now consider the relationship between Pω_{re} and K_{1}.

Proposition 3.3.7 There is an applicative retraction (δ ⊣ γ) : Pω_{re} → K_{1}.

Proof Let δ : K_{1} ⟶^{|} Pω_{re} be defined by δ(n) = \{\overline{n}\}; by Proposition 2.4.18 we know that δ is a decidable applicative morphism. Now define γ : Pω_{re} ⟶^{|} K_{1} by γ(A) = {e ∈ N | Im {e} = A}. To see that γ is an applicative morphism, note that the predicates

([x_{1}, …, x_{n}]; y) ∈ Im {e}, {x_{1}, …, x_{n}} ⊆ Im {e′}

are both semi-decidable (regarded as predicates in [x⃗], y, e, e′). Hence, since we can recursively enumerate the natural numbers of the form [x_{1}, …, x_{n}], the predicate

P (y, e, e′) ≡ ∃x⃗. ([x⃗]; y) ∈ Im {e} ∧ x_{1}, …, x_{n} ∈ Im {e′}

is semi-decidable. Hence we may construct a total recursive function f : N×N → N such that for all y, e, e′ we have

{f(e, e′)}(y) = y if P (y, e, e′), {f(e, e′)}(y)↑ otherwise.

Now note that if A, B ∈ Pω_{re} and e ∈ γ(A), e′ ∈ γ(B) then f(e, e′) ∈ γ(A · B). So from an index for f we may easily obtain a realizer for γ.

Next note that for any n ∈ N we have Im \{\{k\}(n)\} = \overline{n}; hence k realizes id ⪯ γδ. Conversely, if Im \{e\} = \overline{n} then we may recursively recover n from e by computing {e}(0), {e}(1), … “in parallel”. (More formally, using Kleene’s notation we may define n(e) = U(μy.∃m.T (e, m, y)).) Hence γδ ⪯ id. Finally, to see that δγ ⪯ id note that if A ∈ Pω_{re} then δγ(A) = \{\overline{e} | Im \{e\} = A\}. Take R = \{([e]; x) | x ∈ Im \{e\}\}; clearly R is an r.e. set, and if \overline{e} ∈ δγ(A) then R·\overline{e} = A. □

Remark 3.3.8 It seems worth observing that an alternative “presentation” of the morphism γ is possible. Define γ′(A) = {e ∈ N | Dom {e} = A}; then it is easy to show that γ′ is also an applicative morphism and that γ′ ∼ γ.

We now turn our attention to the relationship between Pω_{re} and Λ^{0}/U. Clearly we now have morphisms in both directions factoring through K_{1}; however, a more natural morphism to consider is that given by the interpretation of λ-terms in Pω_{re}. If Γ is a partial function from variables to elements of Pω_{re}, the interpretation [[ M ]]_{Γ} of a term M in the environment Γ is defined inductively as follows:

[[ x]]_{Γ} = Γ(x) (x ∈ Dom Γ);
[[ MN ]]_{Γ} = [[ M ]]_{Γ} · [[ N ]]_{Γ};
[[ λx.M ]]_{Γ} = {([y_{1}, …, y_{n}]; z) | z ∈ [[ M ]]_{Γ(x↦{y_{1},...,y_{n}})}}.

If M is closed then [[ M ]]_{Γ} is independent of Γ, so we may write just [[ M ]].

Proposition 3.3.9 For U any λ-theory, let ϵ_{U} : Λ^{0}/U ⟶^{|} Pω_{re} be defined by ϵ_{U}(M) = {[[ N ]] | U ⊢ N = M}. Then

(i) ϵ_{U} is an applicative morphism;

(ii) ϵ_{U} is discrete iff U ⊇ B;

(iii) ϵ_{U} is projective if U ⊆ B. Proof (i) Clearly ϵ_{U} is realized by λ^{∗}xy.xy in Pω_{re}.

(ii),(iii) follow from the fact that [[ M ]] = [[ N ]] iff BT(M) = BT(N) (cf. [8, Theorem 19.1.19]). □

Finally we give a proof that Pω_{re} ≄ Λ^{0}/U, at least when U is a semi-sensible theory, i.e. U does not equate a solvable and an unsolvable term. (Note that any sensible theory is semi-sensible.) The proof relies on the fact that computations in Λ^{0}/U are “sequential”, whereas Pω_{re} allows “parallelism”—it thus provides some insight into the computational nature of the difference between the two PCAs.

Theorem 3.3.10 Suppose U is a semi-sensible λ-theory. Then the PCAs Pω_{re} and Λ^{0}/U are inequivalent. Proof Suppose γ : Λ^{0}/U ⟶^{|} Pω_{re} and δ : Pω_{re} ⟶^{|} Λ^{0}/U are single-valued morphisms forming an equivalence. As in Section 3.2.5, let I, Ω denote the equivalence classes in Λ^{0}/U of λx.x, (λx.xx)(λx.xx) respectively. Let A ⊂ ω be the set

{([x]; ([ ]; x)) | x ∈ γI} ∪ {([ ]; ([x]; x)) | x ∈ γI} ∪ {([y]; ([y]; y)) | y ∈ γΩ}. Clearly A is r.e. Moreover, it is easy to check that, whatever γI and γΩ are, we have

A · γI · γΩ = A · γΩ · γI = γI, A · γΩ · γΩ = γΩ.

Now suppose N realizes δ, P realizes id ⪯ δγ and Q realizes δγ ⪯ id. Let M = λxy.Q(N(N(δA)(P x))(P y)). Then in Λ^{0}/U we have

MIΩ = MΩI = I; MΩΩ = Ω.

Now U is semi-sensible so U ⊆ K^{∗} (see [8, Section 17.1]), so these equalities hold also in Λ^{0}/K^{∗}. By the argument used in the proof of Lemma 3.2.20 it is now easy to construct M′ such that in Λ^{0}/B we have

M′IΩ = M′ΩI = I; M′ΩΩ = Ω.

But this contradicts Berry’s sequentiality theorem for the untyped λ-calculus (see [8, Section 14.4]). □

Remark 3.3.11 In fact this argument shows that there do not exist morphisms γ : Λ^{0}/U ⟶^{|} Pω_{re} and δ : Pω_{re} ⟶^{|} Λ^{0}/U where γ is projective and δγ ∼ id.

From the point of view of programming language semantics, the above proof provides a useful hint. It suggests that Λ^{0}/U might yield a good category of domains for modelling sequential programming languages (such as PCF), whereas Pω_{re} might be useful for modelling languages with parallelism. (This idea appears already in the work of Phoa [72], who showed that there is no morphism in RT(Λ^{0}/B) corresponding to “parallel or”.) We will explore this idea in more detail in Chapter 7.

Dominances

In the previous chapters we introduced categories such as Mod(A) and examined them from a pure-mathematical standpoint. In the following chapters we wish to show how these categories can be used to give semantics for programming languages such as PCF. An important aspect of these languages is that they allow partial functions to be defined, and permit definitions of functions by recursion. In this chapter we introduce the categorical structure that we need in order to model partiality; in the next chapter we will consider recursion.

A clean categorical account of partial maps is provided by Rosolini’s theory of dominances (see [85]). A dominance in a category C is essentially a small piece of extra structure on C that determines a notion of “partial map” in C. The most familiar example is probably the r.e. subobject classifier Σ in the effective topos. Phoa [71] has considered dominances in other realizability toposes, in particular RT(Pω_{re}) and RT(Λ^{0}/B); Amadio [6] has also implicitly used a notion of partiality arising from a dominance in Mod(D) where D is a domain-theoretic model of the λ-calculus. Our aim here is to give a uniform account of these (and other) examples in the setting of an arbitrary realizability model.

The chapter is structured as follows: In Section 4.1 we review Rosolini’s theory of dominances and partial maps—the material here is not original. In Section 4.2 we consider dominances in RT(A), and give an explicit description of the lift functor in this setting. In Section 4.3 we introduce the notion of a divergence, an attractive and computationally motivated way of specifying a divergence in RT(A) via some extra structure on A. We show how all the above examples of dominances, and many others, arise from divergences.

4.1 Dominances and partial maps

We start with a brief summary of the theory of dominances and partial maps. All the ideas in this section appear in [85] or in [40], though our presentation of them is tailored to suit our purposes. We omit many of the easy proofs.

4.1.1 Classes of admissible monos

Our motivation is to give an account of partial maps in categories such as Mod(A). As we saw in Chapter 1, Mod(A) can be regarded as a category in which “all morphisms are computable”, and we would like if possible to maintain this intuition when considering partial maps.

In the category of sets, a partial function X ⇀ Y is given by a subset X′ ⊆ X and a total function X′ → Y. So a first approximation to the definition of partial map in a general category C might be the following:

Definition 4.1.1 (Partial morphism) A partial morphism X ⇀ Y in C is given by a pair (m, f), where m : X′ ↣ X and f : X′ → Y. We regard (m, f) and (m′, f′) as giving the same partial morphism X ⇀ Y if there is an isomorphism dom m ≅ dom m′ that identifies m with m′ and f with f′.

However, there may be many such partial morphisms that are not intuitively “computable”. For instance, in Mod(K_{1}) we could take a partial morphism (m, f) : N ⇀ N, where dom m corresponded to some non-r.e. subset of N. Thus we would like some way of cutting down the class of partial morphisms. One way of doing this is to specify a class M of subobjects (i.e. a class of monos closed under isomorphisms) giving the domains of the partial morphisms we wish to regard as “admissible”.

Definition 4.1.2 (Class of admissible monos) For any class M of subobjects in C, let M(X, Y) denote the set of partial morphisms (m, f) : X ⇀ Y such that m ∈ M.

(i) A class M is representable if for any object Y there is a morphism η_{Y} : Y → Y_{⊥} such that for every X we have a bijective correspondence M(X, Y) ≅ C(X, Y_{⊥}), where (m, f) corresponds to g iff the square

[figure: X′; f; Y; X; m; g; Y_{⊥}; η_{Y}]

is a pullback. In this situation we say that (m, f) is a partial map (relative to M), and that it is classified by g.

(ii) A class M of subobjects is a class of admissible monos if it is representable and is closed under composition.

The definition of representable class is inspired by the tradition in domain theory of representing partial maps by total maps into a “lifted” object. Note at once the following trivial consequences:

Proposition 4.1.3 Suppose M is a representable class in C. Then (i) M contains all isomorphisms; (ii) for all objects Y we have η_{Y} ∈ M; (iii) for any Y, the object Y_{⊥} and morphism η_{Y} are determined up to isomorph-

ism by their defining property; (iv) pullbacks of monos in M exist and are monos in M;

(v) the mapping Y ↦ Y_{⊥} canonically extends to a functor ⊥ : C → C (called the lift functor associated with M), and the morphisms η_{Y} form a natural transformation η : id → ⊥. □

In the definition of class of admissible monos, the extra requirement that M is closed under composition is added to ensure that the partial maps associated with M form a category. It also has the consequence that the lift functor is monadic: for any X the mono η_{X_{⊥}} ∘η_{X} is admissible, and so we obtain a morphism μ_{X} : X_{⊥⊥} → X_{⊥} classifying the partial map (η_{X_{⊥}} ∘ η_{X}, id_{X}). It is easy to verify that these form a natural transformation μ : ⊥^{2} → ⊥, and that (⊥, η, μ) is a monad on C (we call it the lift monad associated with M). Finally, note that any class M of admissible monos is closed under binary products.

In general a representable class M is a rather large object, so it is natural to ask whether M can be determined by a smaller piece of structure on C. It is easy to see that this is indeed the case:

Proposition 4.1.4 Suppose C has a terminal object, and M is a representable class of subobjects in C. Then m ∈ M iff m arises as a pullback of η_{1}.

Proof Suppose (m : X → Y) ∈ M, and let u denote the unique morphism X → 1. Then by Definition 4.1.2(i) there is a unique morphism g such that the diagram

[figure: X; u; 1; Y; m; g; 1_{⊥}; η_{1}]

is a pullback. Conversely, if such a morphism g exists then m ∈ M, since η_{1} ∈ M and M is closed under pullbacks. □

We can thus regard η_{1} as the “generic” subobject in M. In recognition of its special role we write Σ for the object 1_{⊥}, and ⊤ : 1 → Σ for the morphism η_{1}. If m and g are such that the above square is a pullback then we say that g classifies the mono m.

4.1.2 Pre-dominances and dominances

We have seen how a representable class of subobjects is completely determined by the morphism η_{1}. We now ask whether we can characterize the morphisms in C that arise as η_{1} for some representable class, or indeed for some class of admissible monos. We will give a precise answer to these questions in the case that C is a locally cartesian-closed category. We first recall the definition:

Definition 4.1.5 A category C is locally cartesian-closed if it has finite limits and, for every f : X → Y in C, the pullback functor f^{∗} : C/Y → C/X has a right adjoint Π_{f}.

We first give a simple characterization of the representable classes in a locally cartesian-closed category C:

Definition 4.1.6 (Pre-dominance) Let ⊤ : 1 ↣ Σ be an arbitrary mono in C. We say (Σ, ⊤) is a pre-dominance in C if, for every pair f, g : X\overrightarrow{→}Σ in C, f^{∗}(⊤) ≅ g^{∗}(⊤) implies f = g.

Proposition 4.1.7 For any pre-dominance (Σ, ⊤), the class

M(⊤) = {m | m is a pullback of ⊤}

is representable. Moreover, the mapping ⊤ ↦ M(⊤) gives a bijection between (isomorphism classes of) pre-dominances and representable classes of subobjects in C.

Proof Assume (Σ, ⊤) is a pre-dominance. For each Y ∈ C define Y_{⊥} via (Y_{⊥} → Σ) = Π_{⊤}(Y → 1), and let η_{Y} : Y → Y_{⊥} be the morphism corresponding under the adjunction ⊤^{∗} ⊣ Π_{⊤} to

id : ⊤^{∗}(Y → 1 →^{⊤} Σ) ⟶ (Y → 1).

Some routine diagram-chasing is required to check that Y_{⊥} indeed classifies the partial maps X ⇀ Y in P; moreover we clearly have η_{1} = ⊤. Conversely, if M is any representable class it is easy to see from the definition that (1_{⊥}, η_{1}) is a pre-dominance. Finally, by Proposition 4.1.4 we have M(η_{1}) = M. □

Thus if (Σ, ⊤) is a pre-dominance then we obtain a lift functor ⊥ and a natural transformation η by Proposition 4.1.3(v). We say m represents a Σ-subobject if m ∈ M(⊤). We can now characterize precisely the pre-dominances in C that give rise to classes of admissible monos:

Definition 4.1.8 (Dominance) Suppose (Σ, ⊤) is a pre-dominance. We say (Σ, ⊤) is a dominance if the composite morphism η_{Σ} ∘⊤ : 1 → Σ_{⊥} is a Σ-subobject (i.e. “the generic composition of Σ-subobjects is a Σ-subobject”).

Proposition 4.1.9 Suppose (Σ, ⊤) is a pre-dominance, and M(⊤) is defined as above. Then M(⊤) is a class of admissible monos iff (Σ, ⊤) is a dominance. Thus we have a bijection between (isomorphism classes of) dominances and classes of admissible monos in C.

Proof Note that ⊤, η_{Σ} are Σ-subobjects, and so if M(⊤) is a class of admissible monos then η_{Σ}⊤ is a Σ-subobject. Conversely, suppose η_{Σ} ∘ ⊤ is a Σ-subobject; we need to show that if m : X → Y, p : Y → Z are both Σ-subobjects then so is pm. But by Definition 4.1.2(i) we obtain a diagram

[figure: X; 1; 1]

[figure: Y; m; Σ; ⊤]

[figure: Z; p; Σ_{⊥}; η_{Σ}; Σ; ⊤]

in which all three rectangles are pullbacks; hence the outer square is a pullback, and so pm ∈ M(⊤). □

We will often abuse language and say “Σ is a (pre-)dominance” when the morphism ⊤ is evident. By our earlier remarks, a dominance Σ in C thus gives rise to a lift monad (⊥, η, μ) on C. Note that for any class of admissible monos the object 1_{⊥} is a dominance even if C is not locally cartesian-closed.

We will sometimes have occasion to refer to the following natural order relation on (pre-)dominances in C: if (Σ_{1}, ⊤_{1}) and (Σ_{2}, ⊤_{2}) are pre-dominances, we take Σ_{1} ⪯ Σ_{2} iff ⊤_{1} is a Σ_{2}-subobject. Clearly ⪯ is a preorder, and if Σ_{1} ⪯ Σ_{2} ⪯ Σ_{1} then Σ_{1} ≅ Σ_{2}. We also have the following simple facts:

Proposition 4.1.10 Suppose Σ_{1}, Σ_{2} are pre-dominances in C, and M_{1}, M_{2} are the corresponding representable classes. Then

(i) Σ_{1} ⪯ Σ_{2} iff M_{1} ⊆ M_{2}.

(ii) If Σ_{1} ⪯ Σ_{2} then the morphism h : Σ_{1} → Σ_{2} classifying ⊤_{1} is mono. Proof (i) If Σ_{1} ⪯ Σ_{2} then clearly all pullbacks of ⊤_{1} are pullbacks of ⊤_{2}. Conversely if M_{1} ⊆ M_{2} then ⊤_{1}, ∈ M_{2} so ⊤_{1} is a Σ_{2}-subobject.

(ii) Suppose hf = hg for f, g : X\overrightarrow{→}Σ_{1}. Then hf, hg classify the same Σ_{2}- subobject of X, whence f, g classify the same Σ_{1}-subobject of X, so f = g. □

We conclude this section with some simple examples of dominances. Many more examples will be given in Section 4.3.

Examples 4.1.11 (i) For any C, there is a dominance given by Σ = 1—we call this the trivial dominance. This is the least dominance on C with respect to the ordering ⪯: the admissible monos are precisely the isomorphisms, so the partial maps we obtain are just the total ones.

(ii) At the other extreme, suppose C is a topos, Ω its subobject classifier (see e.g. [45, Chapter 1]). Then the morphism true : 1 → Ω gives a dominance. This is the greatest dominance on C: all monos are admissible, and all partial morphisms are partial maps.

(iii) Suppose C has binary sums. Let Σ = 1 + 1 and take ⊤ to be the left inclusion; it is easy to verify that this is a dominance. A mono X ↣ Y is a Σ-subobject if it is “classified” by a morphism Y → 1 + 1; hence this dominance is sometimes known as the decidable subobject classifier.

(iv) The motivating example: Let C = Mod(K_{1}), and define Σ by

|Σ| = {⊤, ⊥}, ∥⊤∥ = {n | {n}(0)↓}, ∥⊥∥ = {n | {n}(0)↑}.

Let ⊤ : 1 → Σ be the morphism that picks out ⊤. We will show in Example 4.2.9(ii) below that (Σ, ⊤) is a dominance. Moreover, the Σ-subobjects of N correspond precisely to the r.e. subsets of N, and the Σ-partial maps N ⇀ N in C are just the partial recursive functions. Thus in this case it appears that we have successfully captured our intuitive idea of a “computable partial map”.

4.2 Dominances in realizability models

We now turn to discuss dominances within realizability toposes. Our aim is to give a concrete characterization of dominances in terms of realizers, and to give an explicit description of the lift functor arising from a pre-dominance.

In fact we will restrict attention to dominances (Σ, ⊤) where Σ is an assembly. One reason for doing this is obviously that such dominances are easy to work with. Another reason is that assemblies are the objects which we can understand informally as “datatypes”: recall from Chapter 1 that if X is an assembly then |X| represents the set of values of a datatype and ∥x∥_{X} represents the set of “machine representations” of the value x. We certainly want the object 1_{⊥} to be a “datatype” (corresponding e.g. to the type of partial functions from the unit type to itself)—in other words Σ should be an assembly. Note that we are thus excluding the dominance given in Example 4.1.11(ii), since the subobject classifier Ω in RT(A) is not an assembly.

First, recall that Mod(A), Ass(A) and RT(A) are all locally cartesian-closed (see e.g. [74]); moreover, the inclusions Mod(A) ↪^{J} Ass(A) ↪^{I} RT(A) preserve the locally cartesian-closed structure (that is, they preserve finite limits and commute with Π-functors up to natural isomorphism). Hence we obtain the following pleasant facts:

Proposition 4.2.1 (i) Suppose given ⊤ : 1 → Σ in Mod(A). Then (Σ, ⊤) is a dominance in Mod(A) iff (JΣ, J⊤) is a dominance in Ass(A).

(ii) Suppose given ⊤ : 1 → Σ in Ass(A). Then (Σ, ⊤) is a dominance in Ass(A) iff (IΣ, I⊤) is a dominance in RT(A).

Proof (i) First note that (Σ, ⊤) is a pre-dominance iff (JΣ, J⊤) is a predominance, as J is full and faithful and preserves pullbacks. Let ⊥ : Mod(A) → Mod(A) and ⊥′ : Ass(A) → Ass(A) be the lift functors obtained from Σ and JΣ respectively, and let η : id → ⊥ and η′ : id → ⊥′ be the corresponding natural transformations. Note that J ∘ Π_{⊤} ≅ Π_{J⊤} ∘ J, and so by the constructions of ⊥ and η in the proof of Proposition 4.1.7(ii) we see that J ∘ ⊥ ≅ ⊥′ ∘ J and Jη ≅ η′_{J}. Hence in particular we have J(Σ_{⊥}) = (JΣ)_{⊥′} and J(η_{Σ} ∘ ⊤) = η′_{JΣ} ∘ J⊤. But J is full and preserves and reflects pullbacks, so η_{Σ} ∘ ⊤ is a pullback of ⊤ iff η′_{JΣ} ∘ J⊤ is a pullback of J⊤. Thus (Σ, ⊤) is a dominance iff (JΣ, J⊤) is a dominance. The proof of (ii) is precisely similar. □

Remark 4.2.2 In [72] Phoa gives a short proof that a certain object is a dominance in Ass(Λ^{0}/B), and then a much longer (concrete) proof that it is in fact a dominance in RT(Λ^{0}/B). The above proposition shows that the latter can be bypassed, for quite general abstract reasons.

We now go about characterizing the dominances in Ass(A). First note that if (Σ, ⊤) is a pre-dominance in Ass(A) then card |Σ| ≤ 2, since otherwise we can find distinct morphisms f, g : 1\overrightarrow{→}Σ with f^{∗}⊤ = g^{∗}⊤ = (0 ↣ 1). Moreover, if card |Σ| < 2 then Σ is the trivial dominance. So for any non-trivial pre-dominance we have card |Σ| = 2. This suggests the following definition.

Definition 4.2.3 A pre-dominance on a PCA A consists of a pair (T, U) of nonempty subsets of A. To each pre-dominance (T, U) we associate an object Σ ∈ Ass(A) and a morphism ⊤ : 1 → Σ as follows:

|Σ| = {⊤, ⊥}, ∥⊤∥ = T, ∥⊥∥ = U, ⊤(∗) = ⊤.

We write (T, U) ⪯ (T′, U′) if there exists r ∈ A such that r(T) ⊆ T′ and r(U) ⊆ U′ (i.e. for all a ∈ T we have ra ∈ T′ etc.). We also write (T, U) ∼ (T′, U′) if (T, U) ⪯ (T′, U′) ⪯ (T, U).

The letters T, U here are chosen to stand for “top” and “undefined”. It is easy to see that in this definition the pair (Σ, ⊤) is always a pre-dominance, since for any subobject X′ ↣ X in Ass(A) there is a unique set-theoretic function |X| → |Σ| classifying m. Moreover, the above construction clearly induces an equivalence of preorders between pre-dominances on A and non-trivial pre-dominances in Ass(A).

Next note that if (T, U) is a pre-dominance and T ∩ U = ∅ then the associated object Σ is a modest set; otherwise Σ is a uniform assembly and so Σ ≅ ∇2 (see Section 1.2.3). In the latter case we call Σ the uniform pre-dominance; note that it is the largest pre-dominance in Ass(A) with respect to ⪯. However, this predominance is rather boring since it yields too many Σ-subobjects: e.g. for any X and any subset |X′| ⊆ |X|, the evident regular mono X′ ↣ X gives a Σ-subobject of X.

We now ask: when does a pre-dominance (T, U) give rise to a dominance in Ass(A)? In order to answer this question, it is convenient first to give an explicit description of the lift functor associated with (T, U). We need some notation: if P, Q ⊆ A then we write

\begin{aligned}P ∧ Q & = & \{⟨a, b⟩ | a ∈ P, b ∈ Q\}, \\ P ⇒ Q & = & \{a | ∀b ∈ P. ab ∈ Q\}. \end{aligned}

We also write I for the set {i}.

Proposition 4.2.4 Suppose (T, U) is a pre-dominance on A, Σ the corresponding pre-dominance in Ass(A), and ⊥ the associated lift functor. Then for any X, the object X_{⊥} and morphism η_{X} are given as follows (up to isomorphism):

\begin{matrix}|X_{⊥}| = |X| ⊔ \{⊥\}, η_{X}(x) = x, \\ ∥x ∈ X_{⊥}∥ = T ∧ (I ⇒ ∥x ∈ X∥), ∥⊥ ∈ X_{⊥}∥ = U ∧ A. \end{matrix}

Proof First note that η_{X} as defined above is tracked by λ^{∗}x.⟨a, kx⟩, where a ∈ T. It suffices to check that the object X_{⊥} defined above does indeed classify the partial maps into X. So suppose (m, f) : Y ⇀ X is a partial map, where m : Y′ ↣ Y is classified by e : Y → Σ. Then m is a regular mono, so without loss of generality we can assume that m : |Y′| ↣ |Y | is a set-theoretic inclusion, and that ∥y ∈ Y′∥ = ∥y ∈ Y ∥ for all y ∈ |Y′|. Define g : |Y | → |X_{⊥}| by

g(y) = \{ \begin{matrix}f(y) & if y ∈ |Y′| \\ ⊥ & otherwise. \end{matrix}

Suppose f, e are tracked by t, u respectively; we claim g : Y → X_{⊥} is tracked by r = λ^{∗}a. ⟨ua, λ^{∗}w.ta⟩. For if y ∈ Y′ and a ∈ ∥y∥_{Y} then e(y) = ⊤ and a ∈ ∥y∥_{Y′}; hence ua ∈ T and ta ∈ ∥fy∥_{X}, and so

ra = ⟨ua, λ^{∗}w.ta⟩ ∈ T ∧ (I ⇒ ∥fy∥_{X}).

On the other hand if y ∉ Y′ and a ∈ ∥y∥_{Y} then e(y) = ⊥ so ua ∈ U; but λ^{∗}w.ta↓ and so ra ∈ U ∧ A.

We now need to check that g is the unique morphism such that

[figure: Y′; f; X; Y; m; g; X_{⊥}; η_{X}]

is a pullback. But given any f′ : Z → X and m′ : Z → Y such that η_{X}f′ = gm′, clearly there is a unique function h : |Z| → |Y′| such that f′ = fh and m′ = mh; and if v tracks m′ then v also tracks h. To see that g is unique, just note that g : |Y | → |X_{⊥}| is the unique function such that the underlying square in Set is a pullback. □

Remarks 4.2.5 (i) The action of the lift functor on morphisms of Ass(A) is obvious: if f : X → Y, then f_{⊥} : X_{⊥} → Y_{⊥} is given by f_{⊥}(x) = f(x), f_{⊥}(⊥) = ⊥. If f is tracked by t then f_{⊥} is tracked by λ^{∗}a. ⟨fst a, λ^{∗}z. t((snd a)i)⟩.

(ii) The choice of the set I is arbitrary; any non-empty set would do. The role of I is simply to “delay the evaluation” of a realizer for x ∈ X. It is easy to check that if A is total then the following simpler description of X_{⊥} suffices:

|X_{⊥}| = |X| ⊔ {⊥}, ∥x ∈ X_{⊥}∥ = T ∧ ∥x ∈ X∥, ∥⊥ ∈ X_{⊥}∥ = U ∧ A.

We are now in a position to characterize the pre-dominances on A that give rise to dominances.

Definition 4.2.6 A pre-dominance (T, U) on A is called a dominance if the corresponding pre-dominance Σ in Ass(A) is a dominance.

Proposition 4.2.7 A pre-dominance (T, U) is a dominance iff for some r ∈ A we have

r(T ∧ (I ⇒ T)) ⊆ T,  r(T ∧ (I ⇒ U)) ⊆ U,  r(U ∧ A) ⊆ U.

Proof By Proposition 4.2.4 we obtain the following description of Σ_{⊥}:

\begin{aligned}& |Σ_{⊥}| = \{⊤, M, ⊥\}, \\ ∥⊤∥ = T ∧ (I ⇒ T), & ∥M∥ = T ∧ (I ⇒ U), & ∥⊥∥ = U ∧ A. \end{aligned}

Now the morphism η_{Σ}⊤ : 1 → Σ_{⊥} is given by η_{Σ}⊤(∗) = ⊤, and so a morphism μ : Σ_{⊥} → Σ is a classifier for η_{Σ}⊤ iff it satisfies μ(⊤) = ⊤, μ(M) = ⊥, μ(⊥) = ⊥. But a realizer for such a morphism is precisely an element r satisfying the above conditions. □

Remarks 4.2.8 (i) The above characterization of dominances is rather unsightly, and is too close to the definition of dominance in Ass(A) to be of much interest in itself. But we will use it to give a much more illuminating (though less general) way of specifying dominances in the next section.

(ii) If A is total, it is easy to see that the above condition can be replaced by a slightly simpler one: there exists q ∈ A such that

q(T ∧ T) ⊆ T,  q(T ∧ U) ⊆ U,  q(U ∧ A) ⊆ U.

Examples 4.2.9 (i) The uniform pre-dominance ∇2 mentioned above is clearly a dominance: in Proposition 4.2.7 we may take r = ka where a ∈ T ∩ U.

(ii) We can now verify that the r.e. subobject classifier Σ in Mod(K_{1}) is indeed a dominance (see Example 4.1.11(iv)). Note that the object Σ arises from the predominance (T, U), where T = {n | {n}(0)↓}, U = {n | {n}(0)↑}. Let

r = λ^{∗}a.λ^{∗}z. k(fst a 0)(snd a i 0).

It is easy to see that r satisfies the three conditions of Proposition 4.2.7, and so Σ is a dominance.

It is natural to ask how (pre-)dominances on PCAs interact with the applicative morphisms introduced in Chapter 2. The relevant notion of morphism between PCAs-with-pre-dominance seems to be the following:

Definition 4.2.10 Suppose (A, T, U) and (B, T′, U′) are PCAs equipped with predominances. A dominical morphism from (A, T, U) to (B, T′, U′) is an applicative morphism γ : A ⟶^{|} B such that (γ^{+}T, γ^{+}U) ∼ (T′, U′).

Proposition 4.2.11 Suppose (A, T, U), (B, T′, U′) are PCAs equipped with predominances, and suppose Σ, Σ′, ⊤, ⊤′, ⊥, ⊥′, η, η′ have the obvious meanings. Then the following are equivalent for an applicative morphism γ : A ⟶^{|} B:

(i) γ is a dominical morphism;

(ii) γ_{∗}(Σ) ≅ Σ′, via an isomorphism identifying γ_{∗}(⊤) with ⊤′;

(iii) (If B is total.) γ_{∗} ∘ ⊥ ≅ ⊥′ ∘ γ_{∗} : Ass(A) → Ass(B), via a natural isomorphism identifying γ_{∗}η with η′_{γ_{∗}}.

Proof (i) ⇔ (ii): Immediate from the definition of Σ and Σ′.

(iii) ⇒ (ii): Trivial, since Σ = 1_{⊥}, ⊤ = η_{1} etc. and γ_{∗}(1) ≅ 1.

(i) ⇒ (iii): Suppose B is total. Then for any X ∈ Ass(A) the objects Y = γ_{∗}(X_{⊥}) and Z = (γ_{∗}X)_{⊥′} may be described explicitly as follows:

|Y | = |Z| = |X| ⊔ \{⊥\}, ; \begin{matrix}∥x ∈ Y ∥ = γ^{+}(T ∧ (I ⇒ ∥x∥_{X})), & ∥⊥ ∈ Y ∥ = γ^{+}(U ∧ A), \\ ∥x ∈ Z∥ = T′ ∧ γ^{+}∥x∥_{X}, & ∥⊥ ∈ Z∥ = U′ ∧ B. \end{matrix}

Suppose r realizes γ, t realizes (γ^{+}T, γ^{+}U) ⪯ (T′, U′) and u realizes (T′, U′) ⪯ (γ^{+}T, γ^{+}U). Then id : |Y | → |Z| is tracked by λ^{∗}b. ⟨t(r fst′ b), r(r snd′ b)i′⟩ where fst′ ∈ γ(fst), snd′ ∈ γ(snd), i′ ∈ γ(i); moreover id : |Z| → |Y | is tracked by λ^{∗}b. r(r pair′ (u(fst b)))(r k′ (snd b)) where pair′ ∈ γ(pair), k′ ∈ γ(k). Thus γ_{∗}(X_{⊥}) ≅ (γ_{∗}X)_{⊥′}. It is easy to see that this isomorphism is natural in X and identifies γ_{∗}η with η′_{γ_{∗}}. □

Curiously, the implication (i) ⇒ (iii) in the above proposition seems to fail if B is not total. The problem is that we cannot construct an element v ∈ B such that vb↓ for all b ∈ B and v(I ⇒ γ^{+}P) ⊆ γ^{+}(P) for all P ⊆ A.

4.3 Divergences

In Proposition 4.2.7 we showed that dominances in Ass(A) correspond to pairs of subsets T, U ⊆ A satisfying certain properties. This characterization of dominances was not very interesting as it was too close to the definition of a dominance. In this section we offer a simpler and more “computational” way of looking at dominances as extra structure on a PCA, and show that it gives rise to many natural examples of dominances. The idea was inspired by a suggestion of Gordon Plotkin; a similar idea appears in [4, Section 3] (also under the name “divergence”!) in the context of models for the lazy λ-calculus.

Let us return to our analogy of “PCAs as abstract machines”. To specify a dominance in RT(A), we want to specify a notion of “partial computation” in A itself. If A is non-total, then of course undefined applications in A give a perfectly good notion of non-terminating computations. But the existence of interesting total combinatory algebras prompts us to seek a more general notion. In general, it ought to be enough to specify which elements of A (if any) correspond to “infinite” or “diverging” computations. This leads us to the following definition.

Definition 4.3.1 (Divergence) A divergence on a PCA A is a subset D ⊆ A such that

(i) if A is total then D ≠ ∅;

(ii) if a ∈ D and ab↓ then ab ∈ D.

The first condition ensures that diverging computations are possible: this condition perhaps looks more natural when rephrased as ∃ a, b. ab ↓ ⇒ ab ∈ D. The second condition says that if a represents a diverging computation then ab cannot represent a converging computation—a divergence is thus a kind of “weak right ideal”. Both these conditions seem to be natural in terms of the “abstract machine” viewpoint. We now show that every divergence gives rise to a dominance:

Definition 4.3.2 Given any set D ⊆ A, we define sets T_{D}, U_{D} by

T_{D} = {a | ai = i}, U_{D} = {a | ai↓ ⇒ ai ∈ D}.

Proposition 4.3.3 If D is a divergence then (T_{D}, U_{D}) is a dominance on A.

Proof First note that ki ∈ T_{D} so T_{D} ≠ ∅, and if a, b are such that ab ↓ ⇒ ab ∈ D then λ^{∗}x.ab ∈ U_{D} so U_{D} ≠ ∅. Thus (T_{D}, U_{D}) is a pre-dominance. Now let r = λ^{∗}xz.(fst x i)(snd x i i). We check that r satisfies the three conditions of Proposition 4.2.7. First, if a ∈ T_{D} and b ∈ (I ⇒ T_{D}) then ai = bii = i so r⟨a, b⟩ = λ^{∗}z.(ai)(bii) ∈ T_{D}; thus r(T_{D} ∧ (I ⇒ T_{D})) ⊆ T_{D}. Next, if a ∈ T_{D} and b ∈ (I ⇒ U_{D}) then ai = i and bii ↓ ⇒ bii ∈ D, so λ^{∗}z.(ai)(bii) ∈ U_{D}; thus r(T_{D} ∧ (I ⇒ U_{D})) ⊆ U_{D}. Finally, if a ∈ U_{D} and b ∈ A then ai↓ ⇒ ai ∈ D; hence (ai)(bii)↓ ⇒ (ai)(bii) ∈ D. Thus λ^{∗}z.(ai)(bii) ∈ U_{D}, and so r(U_{D} ∧ A) ⊆ U_{D}. □

Remark 4.3.4 If A is total, we could more simply define T_{D} = {i}, U_{D} = D. It is easy to see that this gives a dominance equivalent to that given by the above definition.

We now show how various known dominances arise from divergences:

Examples 4.3.5 (i) The set A itself is trivially a divergence on A; in fact, if D is a divergence on A then D = A iff i ∈ D. Hence ki ∈ T_{A} ∩ U_{A}, and so (T_{A}, U_{A}) is the uniform dominance on A, giving rise to the dominance ∇2 in RT(A) (see Example 4.2.9(i) above).

(ii) If A is non-total, clearly ∅ is a divergence on A—this corresponds to the “natural” notion of diverging computation in the PCA. The corresponding dominance is easily seen to be equivalent to that defined by

T = {a | ai↓}, U = {a | ai↑}.

In the case A = K_{1}, this is in turn equivalent to the r.e. dominance Σ (see Example 4.2.9(ii) above). Thus Σ is in some sense the natural dominance associated with K_{1}.

(iii) Let A = Λ^{0}/S where S is any semi-sensible λ-theory, and let D be the set of (equivalence classes of) unsolvable terms, i.e. terms with no head normal form. Clearly D is a divergence, since if M is unsolvable then so is MN. In the case S = B, by Remark 4.3.4 we see that the associated dominance is given by T_{D} = {i}, U_{D} = {Ω}. This corresponds to the dominance on RT(Λ^{0}/B) considered by Phoa in [71,72].

(iv) Let A be the graph model Pω (or its r.e. submodel), and take D = {∅}. From the definition of application in A it is clear that ∅ · X = ∅ for any X ∈ A, so D is a divergence. The corresponding dominance is easily seen to be equivalent to that defined by T_{D} = {{0}}, U_{D} = {∅}—this gives rise to the dominance on RT(A) considered by Phoa in [71,73].

(v) The following situation is considered by Amadio in [6]. Let A be a directedcomplete partial order such that the partial function space (A ⇀ A) is a retract of A. Then A has the structure of a PCA. In [6], a partial morphism X ⇀ Y in Mod(A) is (essentially) defined to be a partial function f : |X| → |Y | such that there exists r ∈ A satisfying

∀x ∈ |X|. ∀a ∈ ∥x∥, (f(x)↓ ∧ ra ∈ ∥f(x)∥) ∨ (f(x)↑ ∧ ra↑).

It is easy to see that these correspond precisely to the partial maps for the dominance arising from the empty divergence on A. This gives us a more categorical way of understanding this notion of partial morphism.

In fact the notion of divergence seems to embrace all known examples of dominances that are interesting from the point of view of semantics. However, not all dominances on PCAs arise from divergences. For example, consider the dominance 2 in Mod(K_{1}) (cf. Example 4.1.11(iii)). First note that this corresponds to the dominance on K_{1} given by T = {true}, U = {false}. Suppose this is equivalent to (T_{D}, U_{D}) for some divergence D; then there exists r such that rT_{D} ⊆ T and rU_{D} ⊆ U. Define t = λ^{∗}x.r(λ^{∗}y.ki(xi)); then for all a we have ta = true if ai↓ and ta = false if ai ↑, contradicting the undecidability of the halting problem. Thus this dominance does not arise from a divergence.

We can recast some of the definitions and results from Section 4.2 in terms of divergences—this will make it simpler to perform calculations for particular models. First we note that the order relation between dominances can be expressed at the level of divergences. If D_{1}, D_{2} are divergences on A, we write D_{1} ⪯ D_{2} if there exists r ∈ A such that

ri = i, a ∈ D_{1} ⇒ (ra↓ ⇒ ra ∈ D_{2}).

We also write D_{1} ∼ D_{2} if D_{1} ⪯ D_{2} ⪯ D_{1}.

Proposition 4.3.6 Suppose D_{1}, D_{2} are divergences on A. Then (i) D_{1} ⪯ D_{2} iff (T_{D_{1}}, U_{D_{1}}) ⪯ (T_{D_{2}}, U_{D_{2}}); (ii) D_{1} ∼ D_{2} iff (T_{D_{1}}, U_{D_{1}}) ∼ (T_{D_{2}}, U_{D_{2}}).

Proof (i) If r is a realizer for D_{1} ⪯ D_{2}, take t = λ^{∗}ab.r(ab); then tT_{D_{1}} ⊆ T_{D_{2}} and tU_{D_{1}} ⊆ U_{D_{2}}. Conversely, if t realizes (T_{D_{1}}, U_{D_{1}}) ⪯ (T_{D_{2}}, U_{D_{2}}), take r = λ^{∗}a.t(ka)i. Then ki ∈ T_{D_{1}} so t(ki) ∈ T_{D_{2}} so ri = i; and if a ∈ D_{1} then ka ∈ U_{D_{1}} so t(ka) ∈ U_{D_{2}}, and so if ra↓ then ra ∈ D_{2}. Thus D_{1} ⪯ D_{2}. (ii) is immediate. □

Note that A and ∅ (if A is non-total) are respectively the greatest and least divergences with respect to ⪯. Next we show how the lift functor can be described directly in terms of a divergence:

Proposition 4.3.7 Suppose D is a divergence on A, ⊥ the lift functor on Ass(A) arising from the corresponding dominance. Then for any assembly X, the object X_{⊥} is given as follows (up to isomorphism):

∥x ∈ X_{⊥}∥ = {a | fst(ai) = i, snd(ai) ∈ ∥x ∈ X∥},
∥⊥ ∈ X_{⊥}∥ = {a | fst(ai)↓ ⇒ fst(ai) ∈ D}.

Proof Write X′_{⊥} for the assembly defined as in Proposition 4.2.4 (where T = T_{D}, U = U_{D}). Explicitly we have

\begin{aligned}∥x ∈ X′_{⊥}∥ & = & \{⟨b, c⟩ | bi = i, ci ∈ ∥x ∈ X∥\}, \\ ∥⊥ ∈ X′_{⊥}∥ & = & \{⟨b, c⟩ | bi↓ ⇒ bi ∈ D\}. \end{aligned}

Let r = λ^{∗}a. ⟨λ^{∗}w.fst(ai), λ^{∗}w.snd(ai)⟩; then for all z ∈ |X_{⊥}| we have r∥z∥_{X_{⊥}} ⊆ ∥z∥_{X′_{⊥}}. Conversely, let t = λ^{∗}aw. ⟨(fst a)i, (snd a)i⟩; then for all z ∈ |X_{⊥}| we have t∥z∥_{X′_{⊥}} ⊆ ∥z∥_{X_{⊥}}. Hence X_{⊥} ≅ X′_{⊥}. □

Remark 4.3.8 A much simpler description of X_{⊥} may be given if A is total:

∥x ∈ X_{⊥}∥ = I ∧ ∥x ∈ X∥, ∥⊥ ∈ X_{⊥}∥ = D ∧ A.

It is easy to check that this is isomorphic to the object X_{⊥} defined above.

We conclude this chapter with a few more examples of divergences. Some of these seem very natural and could yield useful categories of domains, while others are quite pathological (they might be useful as counterexamples). Our intention is not to be comprehensive but merely to indicate the generality of the concept.

Examples 4.3.9 (i) Let A be the term model Λ^{0}/ℓ for the lazy λ-calculus (see Paragraph 3.2.3). Let D ⊆ A be the set of (ℓ-classes of) terms with no head normal form, and D′ the set of terms with no weak head normal form (i.e. terms whose head reduction sequence contains no term of the form λx.M). Then D, D′ are both right ideals and hence divergences, and clearly D′ ⪯ D. To see that D ⪯̸ D′, let E be the canonical domain-theoretic model of the lazy λ-calculus considered in [4, Section 4]. Note that E has a bottom element ⊥_{E} and a top element ⊤_{E}; a term M denotes ⊥_{E} iff M has no whnf, and the unsolvable term Y k denotes ⊤_{E}. Thus if M realized D ⪯ D′ we would have E ⊧ Mi = i and E ⊧ M(Y k) = Ω; but this is impossible since application in E is monotone.

(ii) Let A be the term model V^{0}/V be the call-by-value λ-calculus (see Paragraph 3.2.4), and let D ⊆ V be the set of terms M such that M · N ↑ for all N ∈ V^{0}. Then D is trivially a divergence. Moreover it is easy to see that D ∼ ∅, since ∅ ⪯ D is realized by i and D ⪯ ∅ is realized by λx.xi.

(iii) For many PCAs with a “top” element, we can invert our usual intuition and take undefined to be represented by top rather than bottom. More precisely, let A be any PCA equipped with a preorder ≤ compatible with the application:

a ≤ a′ ∧ b ≤ b′ ∧ ab↓ ⇒ a′b′↓ ∧ ab ≤ a′b′,

and suppose there exists ⊤ ∈ A such that a ≤ ⊤ for all a ∈ A. Let D = {a ∈ A | ⊤ ≤ a}. Then D is a divergence: given a ∈ D and b ∈ A we have ab ≥ ⊤b ≥ (k⊤)b = ⊤, so ab ∈ D. We mention a few specific examples. If A = Λ^{0}/ℓ we may take ≤ to be the preorder induced by the order relation on the model E (see (i) above); in this case D is the set of infinite-order unsolvables, i.e. the set of terms M such that for all n the head reduction sequence of M contains a term λx_{1} … x_{n}.M′ (see [4, Section 2]). If A = V^{0}/V we may take ≤ to be the observational preorder considered in Paragraph 3.2.5. Using the context lemma it can be shown that Y k is a top element for this preorder; we thus obtain the divergence

D = {N | ∀P_{1}, …, P_{n}. N · P_{1} · . . . · P_{n}↓}.

If A = Pω or Pω_{re} we have the obvious order relation ⊆; from this we obtain D = {ω}. It is easy to show that none of these divergences are equivalent to any divergences considered above.

(iv) The union of two divergences on A is clearly a divergence. Using this fact we can construct bizarre examples such as the divergence {∅, ω} on Pω_{re}.

(v) Suppose we have a ∈ A such that ab = a for all b; then clearly {a} is a divergence. For instance, in any PCA at all we have Zkb = Zk for all b, so {Zk} is a divergence. A more artificial example: suppose A = Pω or Pω_{re}, where the coding functions (−; −) and [−, …, −] are chosen so that ([ ], 0) = 0 (it is easy to see that we can construct recursive coding functions with this property). Then {{0}} is a divergence on A.

Completeness and fixed points

We now have a good theory of partial maps in our categories of interest. However, in order to interpret languages such as PCF we also need to be able to model recursion. In particular, we would like to be able to obtain fixed points of morphisms X → X for certain non-trivial objects X. Of course this would be impossible in a topos such as Set, but one of the beautiful features of realizability toposes is that very often we can do precisely this. In this chapter we develop some machinery for modelling recursion and fixed points in the general setting of a realizability topos with dominance. The material in this chapter represents joint work with Alex Simpson, to whom I am grateful for many of the ideas and for much valuable discussion.

Our work here may be regarded as a contribution to synthetic domain theory (cf. [40,97,81]). The basic idea is the same as in these papers. Starting with a topos, we identify a subcategory D whose objects can be thought of as “predomains”. We then show—under certain axioms—that D contains all the objects we need for our denotational semantics, and hence that these objects have the fixed point property. Various candidates for the category D have been proposed, such as the replete objects [40,97] and the Σ-CPOs [81], the latter being an abstraction of the category of extensional PERs in Mod(K_{1}) [26]. Here we propose another alternative: the category of well-complete objects. One advantage of this category is that it allows us to give a uniform treatment of both “sequential” and “parallel” models of computation (cf. Theorem 3.3.10), whereas the papers cited above all make use of axioms that fail in “sequential” models such as RT(Λ^{0}/B).

Our approach also differs from that of [40,97,81] in two other respects. Firstly, it is less general—we work at the level of generality of a realizability topos rather than an arbitrary topos satisfying certain axioms. Nevertheless, we believe that the study of this class of concrete models can help guide the search for suitable axioms for a more abstract theory. Secondly, we have chosen to work “externally” with assemblies and realizers rather than exploit the internal logic of the topos, even where the latter might have been more elegant. We hope that by so doing we afford a firmer grasp of the situation to readers unversed in the mysteries of topos theory and constructive reasoning.

The chapter is structured as follows: In Section 5.1 we define objects ω, \overline{ω} playing the role of a generic chain and its completion—these allow us to talk about ω-chains and limits in RT(A). Using these notions we define our category D of well-complete objects. In Section 5.2 we introduce a simple “Completeness Axiom” saying that the object 2 is well-complete. We show that this single axiom suffices to develop all the properties of D that we require. In Section 5.3 we show that many of the examples of dominances introduced in Chapter 4 do indeed satisfy the Completeness Axiom; in particular, we see that the models considered by Phoa [71] and Amadio [6] can be recovered as instances of our general theory. In Section 5.4 we obtain the fixed point property for well-complete domains, and prepare the ground for our work in denotational semantics in the next chapter.

The material in Sections 5.1 and 5.2 in particular is joint work with Alex Simpson. It is hard to say precisely who was responsible for which of the ideas here, though I accept sole responsibility for the details of the proofs as they appear here. The material in Section 5.3 are mainly due to me. Section 5.4 essentially consists of an adaptation of ideas found e.g. in [71] and [28].

5.1 ω-chains and limits

In this section we construct an object ω playing the role of an infinite ascending series of points in classical domain theory, and an object \overline{ω} playing the role of its chain completion. The idea is that morphisms c : ω → X can then be regarded as “ascending chains in X”, and such a chain has a limit point iff c extends to a morphism \overline{ω} → X. We then define the category of well-complete objects— essentially the objects X such that X_{⊥} is chain-complete in a suitable sense.

5.1.1 ω-chains in Ass(A)

We work in the setting of an arbitrary PCA A equipped with a dominance (T, U). Our first goal is to construct an object ω that plays the role of an infinite ascending chain. By analogy with the classical situation we might expect such an object to satisfy ω ≅ ω_{⊥}, and moreover to be in some sense the initial solution to this equation.

Suppose we visualize Σ as a poset with ⊥ ≤ ⊤ (we will make this intuition precise in Section 5.4). Then one way of obtaining an infinite ascending series of points is to consider morphisms p : N → Σ such that p(m) ≥ p(m + 1) for all m. Formally, for each n let us define p_{n} : N → Σ by

p_{n}(m) = \{ \begin{matrix}⊤ & if m < n \\ ⊥ & if m ≥ n. \end{matrix}

(it is easy to give realizers for the p_{n}). Then p_{0} ≤ p_{1} ≤ … in the pointwise order. This suggests the following definition:

Definition 5.1.1 Let ω ∈ Mod(A) be the object defined by

|ω| = N, ∥n ∈ ω∥ = ∥p_{n} ∈ Σ^{N}∥

(This way of presenting the object ω first appeared in [40]; it is also used in [81]). To see that ω ≅ ω_{⊥}, let j : |ω_{⊥}| → |ω| be the function defined by j(⊥) = 0, j(n) = n + 1. Then from the description of lifting given by Proposition 4.2.4 we see that j is tracked by λ^{∗}qm. if (iszero m)(fst q)(snd q i (pred m)), and its inverse is tracked by λ^{∗}p. ⟨p \overline{0}, λ^{∗}zm.p (succ m)⟩.

The following proposition gives the crucial property of ω:

Proposition 5.1.2 The morphism j : ω_{⊥} → ω is the initial algebra for the lift functor in Ass(A): for any assembly X and morphism α : X_{⊥} → X there is a unique morphism f : ω → X such that the square

[figure: ω_{⊥}; f_{⊥}; X_{⊥}; ω; j; f; X; α]

commutes. Indeed, there is a morphism X^{X_{⊥}} → X^{ω} that computes f given α.

Proof First note that if f makes the diagram commute then we have

f(0) = (αf_{⊥}j^{−1})(0) = α(⊥), f(n + 1) = (αf_{⊥}j^{−1})(n + 1) = (αη_{X}f)(n),

and so if f exists it is unique. Now define f : |ω| → |X| recursively by f(0) = α(⊥), f(n + 1) = (αη_{X}f)(n). To show that f is a morphism making the diagram commute, we just need to construct a realizer for f.

Suppose t tracks α and v tracks j^{−1}. Let

R = λ^{∗}rp. t ⟨p \overline{0}, λ^{∗}z.r(snd (vp) i)⟩, r = ZR.

We claim that r tracks f. First observe that for all p ∈ A we have

rp ≃ Rrp ≃ t ⟨p \overline{0}, λ^{∗}z.r(snd (vp) i)⟩.

We now show by induction on n that if p ∈ ∥n ∈ ω∥ then rp ∈ ∥f(n) ∈ X∥. For the base case, if p ∈ ∥0 ∈ ω∥ then p \overline{0} ∈ U; hence ⟨p \overline{0}, λ^{∗}z.r(snd (vp) i)⟩ ∈ ∥⊥ ∈ X_{⊥}∥, whence rp ∈ ∥f(0) ∈ X∥. For the induction step, if p ∈ ∥n + 1 ∈ ω∥ then p\overline{0} ∈ T and snd (vp) i ∈ ∥n ∈ ω∥, so r(snd (vp) i) ∈ ∥f(n) ∈ X∥ by the induction hypothesis. Hence ⟨p \overline{0}, λ^{∗}z.r(snd (vp) i)⟩ ∈ ∥f(n) ∈ X_{⊥}∥, so rp ∈ ∥f(n+1) ∈ X∥. Thus r tracks f as required.

Finally, let h : |X^{X_{⊥}}| → |X^{ω}| be the set-theoretic function that given a morphism α : X_{⊥} → X returns the corresponding morphism f. Then it is immediate from the above proof that h is tracked by

λ^{∗}t. Z(λ^{∗}rp. t ⟨p \overline{0}, λ^{∗}z.r(snd (vp) i)⟩). □

Remark 5.1.3 (Warning for specialists.) In [40, Section 5] another way constructing a generic chain is suggested: let u be the unique morphism 0 → 1, and define ω′ to be the internal colimit of the internal N-indexed diagram:

0 ⟶^{u} 1 ⟶^{u_{⊥}} Σ ⟶^{u_{⊥⊥}} Σ_{2} ⟶^{u_{⊥⊥⊥}} ⋯

However, Alex Simpson has pointed out that this object is not the same as our object ω. The object ω′ can in fact be described concretely as follows:

|ω′| = N, ∥n ∈ ω′∥ = ∥n ∈ ω∥ ∧ \{\overline{m} | m ≥ n\}.

It is easy to show that (in the case A = K_{1}, for example) the objects ω and ω′ are not isomorphic: there is an obvious morphism ω′ → ω but it has no inverse.

We can informally regard morphisms ω → X as “ascending chains in X” (this will be made more precise later on). The above proposition thus shows how the iteration of a morphism X_{⊥} → X gives rise to an ascending chain in X. Just as in classical domain theory, we will be interested in finding limits for such chains. But in order to discuss these, we need another object \overline{ω} which we can regard as a “generic ascending chain with limit point”.

The idea is to add to the object ω a new point called ∞. The obvious candidate for ∞ is to take the “pointwise limit” of the morphisms p_{0}, p_{1}, …, namely the morphism p_{∞} : N → Σ defined by p_{∞}(m) = ⊤. We are thus led to the following definition:

Definition 5.1.4 Let \overline{ω} ∈ Mod(A) be the object defined by

|\overline{ω}| = N ⊔ \{∞\},  ∥n ∈ \overline{ω}∥ = ∥p_{n} ∈ Σ^{N}∥,  ∥∞ ∈ \overline{ω}∥ = ∥p_{∞} ∈ Σ^{N}∥.

Once again, it is easy to check that \overline{ω} ≅ \overline{ω}_{⊥}—in fact we can use exactly the same realizers that we used above to show that ω ≅ ω_{⊥}. We write h for the isomorphism \overline{ω} → \overline{ω}_{⊥}. The object \overline{ω} enjoys a universal property dual to that of ω:

Proposition 5.1.5 The morphism h is the terminal coalgebra for the lift functor in Ass(A): for any assembly Y and morphism β : Y → Y_{⊥} there is a unique morphism g : Y → \overline{ω} such that the square

[figure: Y_{⊥}; g_{⊥}; \overline{ω}_{⊥}; Y; β; g; \overline{ω}; h]

commutes. Indeed, there is a morphism (Y_{⊥})^{Y} → \overline{ω}^{Y} that computes g given β.

Proof The proof is very similar to that of Proposition 5.1.2. First note that g, if it exists, is uniquely determined by the requirements

g(y) = n if β^{m}y ≠ ⊥ for 1 ≤ m ≤ n and β^{n+1}y = ⊥,
g(y) = ∞ if β^{m}y ≠ ⊥ for all m.

So let g : |Y | → |\overline{ω}| be the function defined thus; we want a realizer for g. Suppose t tracks β. First define

u = λ^{∗}a. rec (λ^{∗}z.ta)(λ^{∗}mbz. t(snd (bi) i)).

Note that if a ∈ ∥y ∈ Y ∥ and β^{m}y ≠ ⊥ for m ≤ n then we have u a \overline{n} i ∈ ∥β^{n+1}y ∈ Y_{⊥}∥. Next take v = λ^{∗}anz. fst (u a \overline{n} i); then if y, a, n are as above then v a \overline{n} i ∈ ∥c(β^{n+1}y) ∈ Σ∥, where c : Y_{⊥} → Σ classifies η_{Y}. Now suppose w is a realizer for the dominance (T, U) as in Proposition 4.2.7, and let

r = λ^{∗}a. rec (v a \overline{0} i) (λ^{∗}mx. w⟨x, va(succ m)⟩).

We claim r realizes g. Suppose a ∈ ∥y ∈ Y ∥. First, if βy = ⊥ then r a \overline{0} ∈ U, and so by induction r a \overline{m} ∈ U for all m; hence ra ∈ ∥p_{0}∥. Next, if β^{m}y ≠ ⊥ for all m ≤ n where n ≥ 1, then r a \overline{0} ∈ T, and so by induction r a \overline{m} ∈ T for m < n. In particular, if β^{m}y ≠ ⊥ for all m then ra ∈ ∥p_{∞}∥. Lastly, if also β^{n+1}y = ⊥ for n ≥ 1 then r a \overline{(n − 1)} ∈ T and v a \overline{n} ∈ (I ⇒ U), hence r a \overline{n} ∈ U and so r a \overline{m} ∈ U for m ≥ n. Thus ra ∈ ∥p_{n}∥.

Finally, the above construction of a realizer for g is uniform in t, and so there is indeed a morphism (Y_{⊥})^{Y} → \overline{ω}^{Y} that computes g given β. □

We write θ to denote the obvious inclusion ω ↣ \overline{ω} tracked by i. This morphism will play a very important role in the next paragraph.

5.1.2 Well-complete objects

We now turn to the problem of finding a subcategory D of Ass(A) that will serve as a good “category of predomains”. We would like this category to contain all the objects that correspond to types of PCF, such as N_{⊥}. We would also like it to have good closure properties, e.g. to be closed under lifting, products, sums, exponentials and so on. Finally, as in classical domain theory, we would like all our “predomains” to possess limits of ascending chains. We start by considering this last requirement.

Recall that we are regarding morphisms ω → X as ascending chains in X, and morphisms \overline{ω} → X as ascending chains with limit point. This suggests that we define an object X to be “chain-complete” if every morphism ω → X extends to a unique morphism \overline{ω} → X. In fact, it turns out to be more fruitful to consider a slightly stronger condition—experts will recognize it as saying that X is chaincomplete in an “internal” sense:

Definition 5.1.6 (Complete object) An object X ∈ Ass(A) is complete if the map X^{θ} : X\overline{ω} → X^{ω} is an isomorphism. Given a morphism c : ω → X, we write \overline{c} for the unique morphism \overline{ω} → X extending c.

Note at once that any morphism f : X → Y between complete objects preserves limits of ω-chains: given c : ω → X the morphisms \overline{fc}, f\overline{c} both extend fc, so f(\overline{c}∞) = \overline{fc}(∞). This fact is expressed by the slogan “all maps are continuous”.

It might seem that the (full sub)category of complete objects is itself a good choice for a category of predomains: for instance, it is easy to see that it is closed under finite products and finite sums and is an exponential ideal. Unfortunately, however, it seems hard to find simple and natural axioms from which we can prove that the complete objects are closed under lifting. We overcome this difficulty by choosing a slightly different definition for our category of predomains:

Definition 5.1.7 (Well-complete object) An object X is well-complete if X_{⊥} is complete. We write D for the full subcategory of Ass(A) consisting of wellcomplete objects.

(We will see in Proposition 5.2.1 below that in all cases of interest every wellcomplete object is complete.)

Proposition 5.1.8 (i) The complete objects are closed under retracts: given X →^{f} Y →^{g} X such that gf = id_{X}, if Y is complete then so is X.

(ii) D is closed under retracts.

(iii) The complete objects are closed under binary products.

(iv) D is closed under binary products.

Proof (i) Suppose X, Y, f, g are as above, and Y is complete. Then the composite

X^{ω} ⟶^{f^{ω}} Y^{ω} ⟶^{(Y^{θ})^{−1}} Y \overline{ω} ⟶^{g\overline{ω}} X\overline{ω}

clearly gives us an inverse to X^{θ}, so X is complete.

(ii) Suppose Y is well-complete and X is a retract of Y. Then Y_{⊥} is complete and X_{⊥} is a retract of Y_{⊥}, so X_{⊥} is complete by (i). Thus X is well-complete.

(iii) Suppose X, Y are complete. Then the morphism (X^{θ})^{−1}×(Y^{θ})^{−1} is clearly an inverse to (X × Y)^{θ}, so X × Y is complete.

(iv) Suppose X, Y are well-complete. By (ii) and (iii), it suffices to show that (X × Y)_{⊥} is a retract of X_{⊥} × Y_{⊥}. Let p_{X} : (X × Y)_{⊥} → X_{⊥} classify the partial morphism (η_{X×Y} , π_{X}) : (X × Y)_{⊥} ⇀ X, and let p_{Y} classify (η_{X×Y} , π_{Y}). Also let q : X_{⊥} × Y_{⊥} → (X × Y)_{⊥} classify the partial morphism (η_{X} × η_{Y} , id_{X×Y}). By considering the action of these morphisms on the underlying sets, it is easy to see that q⟨p_{X}, p_{Y} ⟩ = id. □

5.2 The completeness axiom

In order to obtain further properties of our category D, we will adopt a Completeness Axiom—this will simply state that the object 2 is well-complete. In Section 5.3 we will give several examples of models satisfying this axiom. However, it is also useful to see how far we can travel with the weaker axiom “1 is wellcomplete”, and so we introduce this axiom first, adopting the stronger one only when it becomes necessary. (The phrase “Completeness Axiom” used without qualification will always refer to the stronger form). It turns out that under the Completeness Axiom the category D has very good closure properties indeed, and compares favourably with the categories of predomains proposed in [40,97,26,81].

5.2.1 The weak completeness axiom

We first postulate the following axiom. We can regard it as a condition on a PCA-with-dominance.

Axiom 1: 1 is well-complete.

Note that this is the same as the Axiom 9 of [40], which says that Σ is complete (or equivalently that θ is Σ-equable). A straightforward consequence of Axiom 1 is the following reassuring fact:

Proposition 5.2.1 Any well-complete object is complete.

Proof Suppose X is well-complete. Given c : ω → X, let d : \overline{ω} → X_{⊥} be the unique morphism extending η_{X}c. We claim d(∞) ≠ ⊥. For if g : X_{⊥} → Σ is the classifier of η_{X}, then gd : \overline{ω} → Σ extends the constant morphism ⊤ : ω → Σ, whence gd = ⊤ : \overline{ω} → Σ using Axiom 1. Thus we have d(y) ∈ |X| for all y ∈ |\overline{ω}|; hence if t tracks d then λ^{∗}z.snd(tz)i tracks a morphism \overline{c} : \overline{ω} → X extending c. Moreover \overline{c} is the unique such morphism since η_{X} is mono. Finally, the function |X^{ω}| → |X\overline{ω}| that computes \overline{c} from c is tracked by λ^{∗}r.λ^{∗}z.snd(q(λ^{∗}x.⟨v, k(rx)⟩)z)i, where q tracks ((X_{⊥})^{θ})^{−1} and v ∈ T. □

Another easy consequence of Axiom 1 is the following closure property:

Proposition 5.2.2 D is closed under lifting.

Proof Suppose X is well-complete; we wish to show that X_{⊥⊥} is complete. By Axiom 1 and Proposition 5.1.8(iii) we know that X_{⊥} × Σ is complete, and so by 5.1.8(i) it suffices to show that X_{⊥⊥} is a retract of X_{⊥}×Σ. Let g : X_{⊥⊥} → Σ classify η_{X_{⊥}} and let f : X_{⊥} × Σ → X_{⊥⊥} classify the partial map (⟨id_{X_{⊥}}, ⊤⟩, id_{X_{⊥}}). Then it is easy to see by considering elements of the underlying sets that f⟨μ_{X}, g⟩ = id_{X_{⊥⊥}}. □

It follows immediately from the above two propositions that an object of the form X_{⊥} is complete iff it is well-complete.

Using Axiom 1 we may also obtain the following interesting fact. It can be seen as an abstract version of the “undecidability of the halting problem”.

Proposition 5.2.3 There is no morphism H : Σ → Σ such that H(⊤) = ⊥ and H(⊥) = ⊤.

Proof Suppose H is such a morphism, and consider the lift-functor algebra Hμ_{1} : Σ_{⊥} → Σ. Let c be the unique morphism such that the diagram

[figure: ω_{⊥}; c_{⊥}; Σ_{⊥}; ω; j; c; Σ; Hμ_{1}]

commutes, as in Proposition 5.1.2. By induction on n it is easy to see that c(n) = ⊤ iff n is even. Now let d = Hc and d′ = cjη_{ω}. Then clearly d(n) = ⊤ iff n is odd, and similarly for d′; hence d = d′. Since all morphisms preserve limits of chains we have \overline{d} = H\overline{c}; but also \overline{d′} = \overline{c}h^{−1}η\overline{ω} since clearly h^{−1}η\overline{ω}θ = θjη_{ω}. But h^{−1}η\overline{ω}(∞) = ∞, so \overline{c}(∞) = \overline{d′}(∞) = \overline{d}(∞) = H\overline{c}(∞), contradicting the definition of H. □

Corollary 5.2.4 Given f : \overline{ω} → Σ, if f(∞) = ⊥ then f(n) = ⊥ for all n.

Proof Suppose f(∞) = ⊥ and f(n) = ⊤. Let t : 1 → \overline{ω} be the morphism that picks out ∞, and let g = (h^{−1}η\overline{ω})^{n} ∘ (h^{−1}t_{⊥}) : Σ → \overline{ω}. It is easy to check that g(⊤) = ∞ and g(⊥) = n. But now (fg)(⊤) = ⊥ and (fg)(⊥) = ⊤, contradicting the above proposition. □

Remark 5.2.5 Proposition 5.2.3 is closely related to Axiom 6 of [40] and the Phoa principle of [97]. However, both of these express a slightly stronger property which does not hold in “sequential” models such as RT(Λ^{0}/B).

Next we show that the well-complete objects form an exponential ideal: if X is well-complete and Y is any assembly then X^{Y} is well-complete. It is easy to see that the complete objects form an exponential ideal, since if X is complete we have canonical isomorphisms (X^{Y})\overline{ω} ≅ (X\overline{ω})^{Y} ≅ (X^{ω})^{Y} ≅ (X^{Y})^{ω}. The result for the well-complete objects is harder; the proof we give involves some rather messy calculations with realizers.

Proposition 5.2.6 D is an exponential ideal.

Proof Suppose X is well-complete, Y any assembly. If Y = 0 then X^{Y} ≅ 1 so X^{Y} is well-complete by Axiom 1. Otherwise, let f : (X^{Y})_{⊥} → (X_{⊥})^{Y} be the exponential transpose of the classifying morphism for the partial map

[figure: X^{Y} × Y; ev; X; (X^{Y})_{⊥} × Y.; η_{X^{Y}} × id_{Y}]

Given c : ω → (X^{Y})_{⊥} there is a unique d : \overline{ω} → (X_{⊥})^{Y} extending fc, since (X_{⊥})^{Y} is complete. We first check that d(∞) is in the set-theoretic image of f. Take any y ∈ |Y |; then either d(∞)(y) = ⊥ or d(∞)(y) ∈ |X|. If d(∞)(y) = ⊥ then d(n)(y) = ⊥ for all n by Corollary 5.2.4; thus c(n) = ⊥ for all n and so d(∞) = f(⊥). Otherwise if d(∞)(y) ∈ X then by Axiom 1 we obtain d(n)(y) ∈ X for some n; hence c(n) ∈ |X^{Y} | and d(n)(y′) ∈ X for all y′. Using Corollary 5.2.4 and the evident map X_{⊥} → Σ we thus have d(∞)(y′) ∈ X for all y′. Moreover, if r tracks d(∞) : Y → X_{⊥} then clearly λ^{∗}a. snd(ra)i tracks a morphism g : Y → X such that d(∞) = f(g).

Let Z ↣ (X_{⊥})^{Y} be the subobject determined by

|Z| = Im f, ∥z ∈ Z∥ = ∥z ∈ (X_{⊥})^{Y} ∥.

Then the above shows that d : \overline{ω} → (X_{⊥})^{Y} factors through Z. But f : (X^{Y})_{⊥} → Z is an isomorphism, since it is clearly a set-theoretic bijection and its inverse is tracked by λ^{∗}a. ⟨fst(ab), λ^{∗}w.snd(ab)i⟩ for any b ∈ ∥y∥. Thus we obtain a morphism \overline{c} = f^{−1}d : \overline{ω} → (X^{Y})_{⊥} extending c. Moreover \overline{c} is unique since d is unique. Finally, if t tracks f, u tracks f^{−1} and v tracks (((X_{⊥})^{Y})^{θ})^{−1}, then the function (X^{Y})_{⊥}^{ω} → (X^{Y})\overline{ω} ; ⊥ that computes \overline{c} from c is tracked by λ^{∗}r.λ^{∗}q.u(v(λ^{∗}p.t(rp))q). Thus (X^{Y})_{⊥}^{θ} is an isomorphism, and X^{Y} is well-complete. □

Remark 5.2.7 It seems that a more natural proof of this proposition can be obtained if one adopts a different (but equivalent) definition of well-completeness using the internal logic. The details may appear elsewhere.

5.2.2 The strong completeness axiom

As we have seen, under Axiom 1 the category D already has quite good closure properties. However, to make further headway we need to adopt the stronger form of our axiom.

Axiom 2: 2 is well-complete.

Note that Axiom 2 implies Axiom 1 by Proposition 5.1.8(ii) since 1 is a retract of 2. An easy consequence of this axiom is that the well-complete objects are closed under finite sums.

Proposition 5.2.8 (i) D is closed under finite sums.

(ii) D is closed under “smash sums”: if X_{⊥}, Y_{⊥} ∈ D then (X + Y)_{⊥} ∈ D.

Proof (i) It follows trivially from Axiom 1 that 0 is well-complete. Suppose X, Y are well-complete; we wish to show that X +Y is well-complete. If X ≅ 0 or Y ≅ 0 then the result is trivial, so suppose we have morphisms x : 1 → X, y : 1 → Y. Since D is closed under finite products and retracts, it suffices to show that X +Y is a retract of 2×X×Y. But it is easy to check that 2×X×Y ≅ (X×Y)+(X×Y), and the morphisms

X + Y [figure: ⟨id, y⟩ + ⟨x, id⟩; \underline{π_{X} + π_{Y}}] (X × Y) + (X × Y)

clearly compose to give id_{X+Y}.

(ii) Suppose X_{⊥}, Y_{⊥} are well-complete; then X, Y are well-complete by Proposition 5.2.1. Thus X + Y is well-complete by (i), and so (X + Y)_{⊥} is well-complete by Proposition 5.2.2. □

The next result is rather surprising: if 2 is well-complete then so is the natural number object N. The proof we give is essentially due to Alex Simpson.

Lemma 5.2.9 There exists a morphism min : \overline{ω} × ω → ω satisfying

min (m, n) = \{ \begin{matrix}m & if m ≤ n \\ n & if m > n; \end{matrix} min (∞, n) = n.

Proof The morphism min can in fact be defined abstractly using just the initialalgebra property of ω, but it is simpler to take advantage of the representation of ω, \overline{ω} as subobjects of Σ^{N}. Let ∧ : Σ×Σ → Σ classify the mono ⟨⊤, ⊤⟩ : 1 → Σ×Σ, and let m be the composite morphism Σ^{N} × Σ^{N} ≅ (Σ × Σ)^{N} ⟶^{∧^{N}} Σ^{N}. Clearly m restricts to a morphism min with the required properties. □

Lemma 5.2.10 There exists a morphism sup : (N_{⊥})^{ω} → N_{⊥} such that, for any chain c : ω → N_{⊥}, sup c is the least upper bound of c with respect to the usual partial order on |N_{⊥}|.

Proof It is convenient to work with the following presentation of the object 2:

|2| = {tt, ff },  ∥tt ∥ = {true},  ∥ff ∥ = {false}.

The strategy for computing sup c is as follows: for each natural number n in turn we compose c with the evident morphism =_{n}: N_{⊥} → 2_{⊥}, and so using Axiom 2 we test whether sup c = n. If we find an n such that this is true, we return n as the result. This process can only fail to terminate if sup c = ⊥.

Formally, let =: N × N → 2 be the equality testing morphism (clearly this exists by Theorem 1.1.16); let ϵ : N → (2_{⊥})^{N_{⊥}} be the exponential transpose of the classifying morphism of the partial map (id × η_{N}, =), and suppose q tracks ϵ. Suppose also t tracks ((2_{⊥})^{θ})^{−1} and v ∈ ∥∞ ∈ \overline{ω}∥. Since every chain c is monotone with respect to the usual ordering it has a least upper bound, and so there is a well-defined function sup : |(N_{⊥})^{ω}| → |N_{⊥}|. To construct a realizer for sup, first define

F = Z(λ^{∗}frn. if (snd(t(λ^{∗}p.qn(rp))v)i) n (fr(succ n))).

If r tracks c, sup c = n and m ≤ n, it is easy to show by induction on n − m that F r \overline{m} = \overline{n}; so in particular F r \overline{0} = \overline{n}. Moreover, if d = fst(t(λ^{∗}p.q\overline{0}(rp))v) it is clear that d ∈ T if sup c ∈ N and d ∈ U if sup c = ⊥. Thus sup is tracked by the element λ^{∗}r. ⟨ fst(t(λ^{∗}p.q\overline{0}(rp))v), λ^{∗}w.F r \overline{0} ⟩. □

Proposition 5.2.11 N is well-complete.

Proof We can obtain a morphism g : (N_{⊥})^{ω} → (N_{⊥})\overline{ω} as the composite

[figure: (N_{⊥})^{ω}; (N_{⊥})^{min}; (N_{⊥})^{\overline{ω}×ω}; ≅; (N_{⊥}^{ω})\overline{ω}; sup\overline{ω}; (N_{⊥})\overline{ω}]

By construction it is clear that g(N_{⊥})^{θ} = id. Moreover, if d : \overline{ω} → N_{⊥} extends c : ω → N_{⊥} then d is monotone and if c(n) = ⊥ for all n then d(∞) = ⊥ by Axiom 1; hence d = h(c). Thus (N_{⊥})^{θ}g = id, so (N_{⊥})^{θ} is an isomorphism. □

The following theorem summarizes the closure properties of D:

Theorem 5.2.12 If Axiom 2 holds, then D is closed under finite products, finite sums, exponentials, retracts and lifting, and contains the object N. □

Remark 5.2.13 We believe that D is also an internally small-complete and reflective subcategory of RT(A) in the sense of [39], and that D has initial solutions of recursive domain equations. To obtain these results, it seems easiest to use a characterization of the well-complete objects involving the internal logic. However, the details are beyond the scope of this thesis.

It is natural to ask how our category D compares with other “categories of predomains” in RT(A). The main advantage of our category is that it has very good closure properties which hold “uniformly” for a wide range of realizability models, as we shall see in Section 5.3. Other categories of predomains, such as the replete objects and the Σ-CPOs, share many but not all of these closure properties—for instance, in certain “sequential” models the objects 2 and N are neither replete nor Σ-CPOs! (The reason for this may appear elsewhere.) One can argue that this does not matter from the point of view of denotational semantics, since for abstract reasons these categories will contain their own objects 2 and N, different from those in the topos. Nevertheless, to us it seems more natural to try to use the existing natural number object in the topos as the “predomain of natural numbers”; and in any case desirable it seems that the inclusion from the category of predomains to the topos should preserve as much structure as possible.

We should point out, however, that so far we have only considered wellcomplete objects in the context of realizability models. It would be interesting to try to abstract away from this setting to give a more axiomatic treatment. At present we have not considered whether the well-complete objects work well in models other than realizability models—this obviously has a bearing on whether well-completeness is really a good notion from the point of view of synthetic domain theory.

Of the three categories we have mentioned, the category of replete objects seems the most natural and mathematically compelling. Hyland and Taylor have found several different definitions yielding this category, which provides some evidence for its “canonical” status. The price paid is the lack of a good concrete description of the replete objects. For both the Σ-CPOs and the well-complete objects, our concrete grasp is rather better. It is possible to prove facts about the well-complete objects by direct calculation, as some of the above proofs show.

5.3 Models satisfying completeness

In this section we show that several of our examples of dominances do indeed satisfy the Completeness Axiom. Note at once that not all of them do: for example, for both the decidable subobject classifier 2 and the uniform dominance ∇2 there is a morphism Σ → Σ interchanging ⊤ and ⊥, so these dominances cannot satisfy even the weak Completeness Axiom (see Proposition 5.2.3). However, it seems that many natural examples do satisfy the axiom, and so give rise to good categories of predomains.

We begin with the leading example, the r.e. dominance Σ in Eff (cf. Example 4.3.5(ii)). We require the following fact from classical recursion theory:

Theorem 5.3.1 (Myhill-Shepherdson) Every morphism F : (N_{⊥})^{N} → (N_{⊥})^{N} in Mod(K_{1}) is monotone and continuous (i.e. preserves existing lubs of chains) with respect to the pointwise order on (N_{⊥})^{N}.

Proof A simple reformulation of the classical Myhill-Shepherdson Theorem as stated e.g. in [17, Chapter 10]. □

Proposition 5.3.2 The r.e. dominance on K_{1} satisfies the Completeness Axiom.

Proof We wish to show that (2_{⊥})^{θ} : 2\overline{ω} ; ⊥ → 2_{⊥}^{ω} is an isomorphism. We first construct a morphism sup : 2_{⊥}^{ω} → 2_{⊥}. Since every morphism c : ω → 2_{⊥} is monotone with respect to the Σ-order, we may define a function sup by taking sup c to be the least upper bound of the image of c. To obtain a realizer for sup, let r be such that if t is any realizer for any c : ω → 2_{⊥} then

rt = n ⇒ c(n) ≠ ⊥, rt↑ ⇒ c(n) = ⊥ for all n

(here we use the ability to perform “parallel” computations in K_{1}). Suppose also v tracks the morphism N → ω given by n ↦ n. It is now easy to check that sup is tracked by λ^{∗}t. ⟨λ^{∗}z.rt, λ^{∗}z.snd (t(v(rt))) i⟩.

We can now obtain a morphism 2_{⊥}^{ω} → 2\overline{ω} ; ⊥ as in the proof of Proposition 5.2.11. Let g be the composite

[figure: (2_{⊥})^{ω}; (2_{⊥})^{min}; (2_{⊥})^{\overline{ω}×ω}; ≅; (2_{⊥}^{ω})\overline{ω}; sup\overline{ω}; (2_{⊥})\overline{ω};]

from the construction of g it is easy to see that g(2_{⊥})^{θ} = id. To see that (2_{⊥})^{θ}g = id, it suffices to show that for any d : \overline{ω} → 2_{⊥} we have d(∞) = sup(dθ). But this follows easily from the Myhill-Shepherdson Theorem, since \overline{ω}, 2_{⊥} can be exhibited as retracts of (N_{⊥})^{N}. □

In all the other examples we shall consider, the PCA comes with a natural order structure and the proof of Axiom 2 boils down to the fact that application in the PCA is continuous. We next consider the model introduced as Example 4.3.5(iii), a mild generalization of the model considered in [72]. Let S be a semi-sensible λ-theory and let D ⊆ Λ^{0}/S be the divergence consisting of unsolvable terms; let ω, \overline{ω} be the objects defined as in Paragraph 5.1.1, (taking T = \{i\}, U = D). Our first task is to find some more convenient objects that are isomorphic to ω, \overline{ω}:

Lemma 5.3.3 Let ω′, \overline{ω}′ be defined by

∥n ∈ ω′∥ = ∥n ∈ \overline{ω}′∥ = \{λf.f^{n}B | B unsolvable\},
∥∞ ∈ \overline{ω}′∥ = \{P | BT(P) = BT(Y)\}.

and let θ′ : ω′ ↣ \overline{ω}′ be tracked by i. Then there are isomorphisms ω ≅ ω′, \overline{ω} ≅ \overline{ω}′ identifying θ with θ′.

Proof Let M = λpm. if (iszero m) i (p(pred m)). Then M tracks the morphism e : \overline{ω} → \overline{ω} given by e(n) = n + 1, e(∞) = ∞, and it is easy to check that λx.xM tracks the evident map \overline{ω}′ → \overline{ω}. Conversely, let N = Y (λq.λnpf. (pnf) (q(succ n)pf)). Then for any n we have

N \overline{0} = λ^{∗}pf. (p \overline{0} f) ⋯ (p \overline{n} f)(N \overline{(n + 1)} p f).

Thus if P ∈ ∥p_{n}∥ then N \overline{0} P = λ^{∗}f.f^{n}B where B is unsolvable. Moreover if P ∈ ∥p_{∞}∥ then it is easy to see that BT(N \overline{0} P) = BT(Y). Thus N \overline{0} tracks the evident map \overline{ω} → \overline{ω}′. Hence we have an isomorphism \overline{ω} ≅ \overline{ω}′ which clearly restricts to an isomorphism ω ≅ ω′. □

In the case S = B the objects ω′, \overline{ω}′ are precisely the ones considered in [72]. Using standard facts about Böhm trees we now easily obtain:

Proposition 5.3.4 The above divergence D on Λ^{0}/S gives a dominance satisfying the Completeness Axiom. Proof To see that (2_{⊥})^{θ′} is an isomorphism, we simply use the fact that BT(Y) = ⋃ BT(λf.f^{n}Ω), and that application preserves unions of chains with respect to Böhm tree inclusion (see [8, Section 14.3]). Note that the object 2_{⊥} can be given by:

∥tt ∥ = {λxy.x}, ∥ff ∥ = {λxy.y}, ∥⊥∥ = {Ω}.

Thus if Q tracks a morphism c : ω′ → 2_{⊥} and P ∈ ∥∞ ∈ \overline{ω}′∥ then BT(QP) = BT(QY) = ⋃ BT(Q(λf.f^{n}Ω)) where λf.f^{n}Ω ∈ ∥n ∈ ω′∥; hence QP ∈ ∥z ∈ 2_{⊥}∥ where z is the least upper bound of c(0), c(1), … in the usual ordering. Hence Q tracks c iff Q tracks its unique continuous extension \overline{c} : \overline{ω}′ → 2_{⊥}. So (2_{⊥})^{θ′} has an inverse tracked by i. □

A very similar argument can be used to show a corresponding result for the lazy λ-calculus. Let S be any lazy λ-theory that is semi-sensible in the sense that if S ⊢ M = N and M has a whnf then so does N; and let D ⊂ Λ^{0}/S be the divergence consisting of terms with no weak head normal form (cf. Example 4.3.9(i)). To show that the corresponding dominance satisfies the Completeness Axiom, we make use of Longo trees (see [53]). Recall that if M has no whnf then LT(M) = ⊥; if M has principal whnf λx.M′ then LT(M) = λx.LT(M′); and if M has principal whnf yM_{1} … M_{n} then LT(M) is

y
[figure]
LT(M_{1}) ⋯ LT(M_{n}).

Proposition 5.3.5 The divergence D on Λ^{0}/S gives a dominance satisfying the Completeness Axiom. Proof Let ω, \overline{ω} be defined as in Paragraph 5.1.1, and define ω′, \overline{ω}′ by

∥n ∈ ω′∥ = ∥n ∈ \overline{ω}′∥ = \{M | LT(M) = LT(λf.f^{n}Ω)\},

∥∞ ∈ \overline{ω}′∥ = \{M | LT(M) = LT(Y)\}.

Then using exactly the same realizers λx.xM and N \overline{0} as in Lemma 5.3.3, we have isomorphisms ω ≅ ω′ and \overline{ω} ≅ \overline{ω}′ identifying θ with the inclusion θ′ : ω′ ↣ \overline{ω}′. Next note that LT(Y) = ⋃ LT(λf.f^{n}Ω) and that application preserves unions of chains with respect to Longo tree inclusion (see [53]). Hence M realizes a morphism ω′ → 2_{⊥} iff M realizes its unique extension \overline{ω}′ → 2_{⊥}. Thus (2_{⊥})^{θ′} is an isomorphism. □

Remark 5.3.6 It seems that a similar result could be obtained for the call-by-value λ-calculus, possibly by using an appropriate notion of tree based on call-by-value reduction to weak head normal form. However, this would involve proving that application in V^{0} was continuous with respect to the tree topology, which might require some effort.

Finally we consider a couple of continuous models, i.e. PCAs with a non-trivial CPO-structure for which application is continuous. Given that the Completeness Axiom expresses a kind of “continuity” principle, we would expect it to be easy to show that it holds for such models. In the case of Phoa’s dominance on the Scott graph model (see Example 4.3.5(iv)) this is indeed so:

Proposition 5.3.7 Let A = Pω or Pω_{re}. Then the divergence {∅} on A gives a dominance satisfying the Completeness Axiom.

Proof The corresponding dominance may be taken to be that given by T = {{0}}, U = {∅}, and the object 2 to be that given by ∥tt ∥ = {{0}}, ∥ff ∥ = {{1}}, ∥⊥∥ = \{∅\}. For convenience we take the numerals to be given by \overline{n} = \{n\}. Let ω, \overline{ω} be defined as in Paragraph 5.1.1. Given any X ∈ ∥∞ ∈ \overline{ω}∥, define X_{n} to be the set X − \{([m]; 0) | m ≥ n\}; then X_{n} ∈ ∥n ∈ \overline{ω}∥ and X = ⋃ X_{n}. Thus if Z tracks a morphism ω → 2_{⊥} then Z · X = ⋃ Z · X_{n} so Z tracks its unique extension \overline{ω} → 2_{⊥}. Hence (2_{⊥})^{θ′} is an isomorphism, its inverse being tracked by i. □

Somewhat surprisingly, the corresponding result for the model considered by Amadio (see Example 4.3.5(iv)) is much less trivial. The difficulty is that if x is a realizer for ∞ there is no reason to suppose that x is the lub of a chain x_{0}, x_{1}, …, where x_{n} ∈ ∥n∥. The following proof shows how this problem may be overcome in this particular case.

Proposition 5.3.8 Let A be a DCPO such that there are continuous maps ȷ : A → (A ⇀ A) and ı : (A ⇀ A) → A such that ȷı = id. Then the dominance arising from the empty divergence on A satisfies the Completeness Axiom.

Proof For each n, let B_{n} ⊆ A be the set \{a | a ≤ \overline{n}\}, and let C_{n} be the topological closure of the set ⋃_{m≥n} B_{m} with respect to the Scott topology on A. Let C = ⋂ C_{n}; then C is also a closed set. Note that for any closed set E the characteristic function e : A ⇀ A defined by

e(a)↑ if a ∈ C, e(a) = a if a ∉ C

is a partial continuous function; let c_{n}, c be the characteristic functions of C_{n}, C respectively. Note that \overline{n} ∉ C_{n+1} since there exists a ∈ A with a · \overline{n}↓ and a · \overline{m}↑ for m > n; hence \overline{n} ∉ C, and so c(\overline{n}) = \overline{n}.

Now let f : A → A be the continuous function defined by f(a) = ı(ȷ(a) ∘ c), and let ω′, \overline{ω}′ be defined by

\begin{matrix}∥n ∈ ω′∥ = ∥n ∈ \overline{ω}′∥ = \{f(a) | a ∈ ∥n ∈ ω∥\}, \\ ∥∞ ∈ \overline{ω}′∥ = \{f(a) | a ∈ ∥∞ ∈ \overline{ω}∥\}. \end{matrix}

By the above remarks we see that ∥z ∈ \overline{ω}′∥ ⊆ ∥z ∈ \overline{ω}∥ for each z ∈ |\overline{ω}|; thus there is an isomorphism \overline{ω}′ ≅ \overline{ω} tracked by i whose inverse is tracked by ı(f). Let θ′ : ω′ ↣ \overline{ω}′ be the obvious inclusion; we wish to show that (2_{⊥})^{θ′} is an isomorphism. Clearly the object 2_{⊥} may be presented by

∥tt ∥ = {true}, ∥ff ∥ = {false}, ∥⊥∥ = {ı(⊥)}

where ⊥ : A ⇀ A is the everywhere-undefined function. So as in the previous proof it is sufficient to show that every x ∈ ∥∞ ∈ \overline{ω}′∥ is the lub of a chain x_{0}, x_{1}, … where x_{n} ∈ ∥n ∈ ω′∥. Given x, take x_{n} = ı(ȷ(x) ∘ c_{n}). It is easy to check that x_{n} ∈ ∥n ∈ ω∥ and moreover that that f(x_{n}) = x_{n}; hence x_{n} ∈ ∥n ∈ ω′∥. Furthermore we have c = ⨆ c_{n}, so x = f(x) = ⨆ x_{n}. □

Remark 5.3.9 In the above example it is easy to check that ω is isomorphic to the “obvious” ascending chain ω′′ defined by ∥n ∈ ω′′∥ = {λ^{∗}f.f^{n}(ı(⊥))}. It is a consequence of the above argument that this can be extended to an isomorphism \overline{ω} ≅ \overline{ω}′′, where

∥∞ ∈ \overline{ω}′′∥ = \{ ⨆_{n} λ^{∗}f.f^{n}(ı(⊥)) \}.

We have thus shown that several different dominances provide instances of our general theory. It seems clear that there are many more examples one could consider. There are also several technical questions we have not addressed. For instance, is there a good model in which the complete and well-complete objects do not coincide? Is there a model in which Axiom 1 holds but not Axiom 2? Are there useful dominances satisfying Axiom 2 that do not arise from divergences? Do any of the more pathological divergences given in Section 4.3 satisfy Axiom 2? Nevertheless, we hope that we have given enough examples to show that our attempt to give a unified treatment of synthetic domain theory in a range of models has been successful.

5.4 The fixed point property

We now use the results of Section 5.2 to develop the machinery that we will need in the next chapter in order to interpret PCF. We will introduce an abstract categorical notion of “PCF-model” (a category with all the structure needed to model PCF), and show that any category Mod(A) equipped with a dominance satisfying the Completeness Axiom gives an example of a PCF-model. First, however, we pause to introduce the Σ-preorder and the general notion of Σ-limit.

5.4.1 The Σ-preorder

We begin by defining the Σ-preorder on an object X. The ideas here are fairly standard, though our presentation of them will be much more “external” than that in e.g. [71].

Let (C, Σ) be any category equipped with a class of admissible monos, X an object of C. The basic idea is to regard morphisms X → Σ as “observations” that can be performed on elements of X, and hence to define an “observational preorder” on Hom(1, X). We do this as follows:

Definition 5.4.1 (Σ-preorder) The (external) Σ-preorder on X is the relation ⪯_{Σ} on Hom(1, X) defined by

x ⪯_{Σ} x′ iff ∀ϕ : X → Σ. ϕ ∘ x = ⊤ ⇒ ϕ ∘ x′ = ⊤.

In the case C = Ass(A), we may regard ⪯_{Σ} as a relation on |X|. It is clear that ⪯_{Σ} is indeed a preorder. Moreover, it is easy to see that any morphism f : X → Y respects the Σ-preorder: if x ⪯_{Σ} x′ then fx ⪯_{Σ} fx′.

In fact, every morphism f is not only “monotone” but also “continuous” in an appropriate sense. In order to define continuity, we introduce the following notion:

Definition 5.4.2 (Σ-limit) Suppose x : 1 → X, S ⊆ Hom(1, X). We say x is a Σ-limit of S if

∀ϕ : X → Σ. ϕ ∘ x = ⊤ ⇔ ∃y ∈ S. ϕ ∘ y = ⊤.

Clearly all morphisms f are continuous in the following sense: if x is a Σ-limit of S then fx is a Σ-limit of {fy | y ∈ S}. Note that Σ-limits (if they exist) need not be unique, as ⪯_{Σ} need not be a partial order.

Suppose x is a Σ-limit of S; then clearly y ⪯_{Σ} x for all y ∈ S. Moreover x is a least upper bound of S with respect to ⪯_{Σ}: if y ⪯_{Σ} x′ for all y ∈ S then it is easy to see that x ⪯_{Σ} x′. However, not every least upper bound is a Σ-limit. For instance, in the model Ass(K_{1}) take X = Σ × Σ, x = ⟨⊤, ⊤⟩, S = {⟨⊤, ⊥⟩, ⟨⊥, ⊤⟩}; then x is a least upper bound but not a Σ-limit of S.

We now consider some examples of the relation ⪯_{Σ} and the notion of Σ-limit in our models of interest:

Proposition 5.4.3 Suppose C = Ass(A), and Σ is any non-trivial dominance satisfying Axiom 1. Then (i) The Σ-preorder on Σ is that generated by ⊥ ⪯_{Σ} ⊤. (ii) The Σ-preorder on ω is generated by n ⪯_{Σ} n + 1 for all n. (iii) The Σ-preorder on \overline{ω} is generated by n ⪯_{Σ} n + 1 ⪯_{Σ} ∞ for all n. (iv) In \overline{ω}, the element ∞ is a Σ-limit of the elements of ω.

Proof (i) The identity morphism on Σ shows that we do not have ⊤ ⪯_{Σ} ⊥. To see that ⊥ ⪯_{Σ} ⊤, suppose we have ϕ : Σ → Σ where ϕ ∘ ⊥ = ⊤. Then by Proposition 5.2.3 we cannot have ϕ ∘ ⊤ = ⊥, so ϕ ∘ ⊤ = ⊤ as required.

(ii) Using the isomorphism ω ≅ ω_{⊥} we may easily construct f_{0} : Σ → ω such that f⊥ = 0, f⊤ = 1. By repeated use of ω ≅ ω_{⊥} we may hence construct a morphism f_{n} for each n such that f_{n}⊥ = n and f_{n}⊤ = n + 1. Since all morphisms are monotone we thus have n ⪯_{Σ} n + 1 by (i). Moreover, using the morphism μ_{ω} we may also construct morphisms g_{n} : ω → Σ such that g_{n}(m) = ⊥ for m ≤ n and g_{n}(m) = ⊤ for m > n. Thus if m ⪯_{Σ} n for m > n then since g_{n} is monotone we have ⊤ ⪯_{Σ} ⊥, contradicting (i).

(iii) Since all morphisms ω → Σ extend uniquely to morphisms \overline{ω} → Σ, it is easy to see that we have m ⪯_{Σ} n in \overline{ω} iff m ≤ n. We also have n ⪯_{Σ} ∞ for each n by Corollary 5.2.4. Finally, since n + 1 ⪯_{Σ} ∞ and n + 1 ⪯̸_{Σ} n, we have ∞ ⪯̸_{Σ} n.

(iv) Immediate from Corollary 5.2.4. □

We have thus made precise our intuition that \overline{ω} is an infinite ascending sequence of points with a limit point ∞. It is now relatively easy to obtain a “fixed point property” for well-complete objects. Of course, as in classical domain theory we only expect the fixed point property to hold for domains with a bottom element, so we first need to give an appropriate notion of “object with bottom” in our setting.

Definition 5.4.4 (Pointed object) A pointed object is an object X together with a morphism α : X_{⊥} → X such that αη_{X} = id_{X}.

The informal idea here is that (in our concrete models) α(⊥) is a least element of X with respect to ⪯_{Σ}. Later we will see that in the cases of interest there is a unique morphism α with the above property.

Theorem 5.4.5 (Fixed point property) Suppose C = Ass(A) and Σ is a nontrivial dominance on C satisfying Axiom 1. Suppose (X, α) is a well-complete pointed object, and let ⊥_{X} denote the element α(⊥) ∈ |X| Then there is a morphism fix : X^{X} → X such that for all f : X → X we have

(i) fix(f) = f ∘ fix(f);

(ii) fix(f) is a Σ-limit of {⊥_{X}, f(⊥_{X}), f^{2}(⊥_{X}), …}.

Proof The argument we use is by now fairly standard in axiomatic domain theory (see e.g. [28]). We define the morphism fix to be the composite

[figure: X^{X}; X^{α_{X}}; X^{X_{⊥}}; g_{X}; X^{ω}; (X^{θ})^{−1}; X\overline{ω}; ev_{∞}; X,]

where g_{X} is the morphism given by Proposition 5.1.2. Given f, let c : ω → X be the unique morphism making the square

[figure: ω_{⊥}; c_{⊥}; X_{⊥}; ω; j; c; X; fα]

commute as in Proposition 5.1.2, and let \overline{c} be the unique morphism \overline{ω} → X extending c. Clearly \overline{c}(∞) = fix(f) and \overline{c}(n) = f^{n}(⊥_{X}) for each n. But ∞ is a limit of 0, 1, … in \overline{ω} and \overline{c} respects limits, so fix(f) is a Σ-limit of ⊥_{X}, f(⊥_{X}), . . .. This establishes (ii). To see (i), note first that f\overline{c} = \overline{c}h^{−1}η\overline{ω} (where h : \overline{ω} → \overline{ω}_{⊥} is as in Proposition 5.1.5), since clearly these extend the same morphism ω → X. But h^{−1}η\overline{ω}(∞) = ∞, and so

f ∘ fix(f) = f\overline{c}(∞) = \overline{c}h^{−1}η\overline{ω}(∞) = \overline{c}(∞) = fix(f). □

5.4.2 PCF-models

In the next chapter we will discuss interpretations of several versions of PCF in certain categories. Although our primary interest is in categories of the form Mod(A) or Ass(A), our results apply to other models as well and hold for quite general reasons, so it is convenient to formulate and prove them in an abstract categorical setting. For this reason we introduce a notion of PCF-model: essentially a category with all the structure we need in order to be able to interpret (various versions of) PCF. We first define a preliminary notion:

Definition 5.4.6 (PCF-premodel) A PCF-premodel is a cartesian-closed category C with a natural number object N and initial object 0, together with a class of admissible monos such that 0 and 1 are the only admissible subobjects of 1.

Note that the categories Mod(A), Ass(A), RT(A) equipped with any nontrivial dominance all provide examples of PCF-premodels. Other examples are the category CPO of (non-pointed) CPOs and continuous maps (where the admissible monos are given by Scott-opens), and the category Set (where we take all monos to be admissible). For any PCF-premodel we have a lift monad (⊥, η, μ) defined as in Section 4.1, and for every object X a morphism ⊥_{X_{⊥}} : 1 → X_{⊥} obtained as the classifier of the partial map (0 ↣ 1, 0 → X).

The condition that 0 and 1 are the only admissible subobjects of 1 could probably be relaxed, but it seems to simplify some of the proofs in Chapter 6. It is an easy consequence of this condition that every morphism 1 → X_{⊥} either factors through η_{X} or is equal to ⊥_{X_{⊥}}.

A PCF-model will essentially be a PCF-premodel such that we have fixed point operators for all the objects used to model PCF types. In order to express this we use the following rather ad hoc definition:

Definition 5.4.7 (Useful object) Suppose C is a PCF-premodel. The class of useful objects of C is inductively defined as follows: Σ and N_{⊥} are useful; if X is useful then so are X_{⊥} and X^{Y} for any Y; and that’s all.

Proposition 5.4.8 In any PCF-premodel, all useful objects X are pointed (i.e. there is a morphism α_{X} : X_{⊥} → X with α_{X}η_{X} = id).

Proof We define α_{X} by induction over the class of useful objects. If X is a useful object of the form Z_{⊥}, we take α_{X} = μ_{Z}. Now suppose we already have α_{X} as required, and consider X^{Y}. Let f : (X^{Y})_{⊥} → (X_{⊥})^{Y} be defined as in the proof of Proposition 5.2.6, and take α_{X^{Y}} = (α_{X})^{Y} ∘ f. It is easy to check that α_{X^{Y}} η_{X^{Y}} = id. □

Thus for every useful X we have a morphism ⊥_{X} = α_{X} ∘ ⊥_{X_{⊥}} : 1 → X; it is easy to see that ⊥_{X} is a least element of Hom(1, X) with respect to the Σ-preorder. We may now define our abstract notion of model for PCF:

Definition 5.4.9 (PCF-model) A PCF-premodel C is a PCF-model if for every useful object X there is a morphism F ix_{X} : X^{X} → X such that for all f : X → X we have

(i) fix_{X} ∘ \overline{f} = f ∘ fix_{X} ∘ \overline{f};

(ii) fix_{X} ∘ \overline{f} is a Σ-limit of \{⊥_{X}, f ∘ ⊥_{X}, f^{2} ∘ ⊥_{X}, …\}, where \overline{f} : 1 → X^{X} is the exponential transpose of f.

This definition is not especially natural or elegant, but it serves our purpose. Although our notion of PCF-model is relatively weak (we do not require CPOenrichment, for instance), it is likely that some of the conditions could be weakened still further, and it would be interesting to investigate this. It is easy to see that our categories of interest are indeed PCF-models:

Proposition 5.4.10 Suppose (A, T, U) is a PCA-with-dominance satisfying the (strong) Completeness Axiom. Then the categories Mod(A), Ass(A), RT(A) (equipped with the dominance given by (T, U)) are all PCF-models.

Proof Note that every useful object in these categories is well-complete by Theorem 5.2.12; moreover, every useful object is pointed by Proposition 5.4.8. Thus for every useful object X there is a morphism fix_{X} with the required properties by Theorem 5.4.5. □

Note also that the category CPO is a PCF-model, but that Set is not.

Besides the morphisms fix_{X}, we also have morphisms iter_{X}^{k} : X^{X} → X for each k ≥ 0 defined as follows:

iter_{X}^{0} = ⊥_{X} ∘ u, iter_{X}^{k+1} = eval ∘ ⟨id, iter_{X}^{k}⟩

(where u : X^{X} → 1 and eval is the evaluation morphism). Note that for any f : X → X we have iter_{X}^{k} ∘ \overline{f} = f^{k} ∘ ⊥. Wherever it is safe to do so we will write iter_{X}^{k}(f) in place of iter_{X}^{k} ∘ \overline{f}, and fix_{X}(f) in place of fix_{X} ∘ \overline{f}.

Recall from Proposition 5.4.3(i) that in PCF-models Ass(A) we have ⊥ ⪯_{Σ} ⊤ in Σ but not ⊤ ⪯_{Σ} ⊥. It is easy to see that this holds in any PCF-model: the identity morphism Σ → Σ refutes ⊤ ⪯_{Σ} ⊥; and if ϕ(⊥) = ⊤ then fix(ϕ) ≠ ⊥ and so fix(ϕ) = ⊤, whence ϕ(⊤) = ⊤. This has the following useful consequence:

Proposition 5.4.11 The Σ-preorder on an object X_{⊥} is given as follows: for all x, x′ ∈ Hom(1, X) we have ηx ⪯_{Σ} ηx′ iff x ⪯_{Σ} x′ in X; ⊥ ⪯_{Σ} ηx always; and ηx ⪯_{Σ} ⊥ never. Proof If x ⪯_{Σ} x′ then ηx ⪯_{Σ} ηx′ since η_{X} is monotone; and the converse holds because every morphism X → Σ extends to a morphism X_{⊥} → Σ. For any X the morphism x_{⊥} : Σ → X_{⊥} shows that ⊥ ⪯_{Σ} ηx; and the morphism X_{⊥} → Σ classifying η_{X} shows that ηx ⪯̸_{Σ} ⊥. □

We will say that a PCF-model is standard if it is well-pointed (i.e. the functor Hom(1, −) is faithful) and the only morphisms 1 → N are the evident “numerals”. Note that all PCF-models of the form Mod(A) or Ass(A) are standard (as is the PCF-model CPO), though RT(A) is not. Standard PCF-models are particularly pleasant to work with as they have the following good property:

Proposition 5.4.12 In any standard PCF-model C, every useful object X is a Σ-space, i.e. the Σ-preorder on Hom(1, X) is a partial order. Proof By induction on useful objects. The object Σ is clearly a Σ-space since ⊤ ⪯̸_{Σ} ⊥; and if X is a Σ-space then so is X_{⊥} by Proposition 5.4.11. To show that N_{⊥} is a Σ-space it thus suffices to see that N is a Σ-space. But for every numeral n : 1 → N one can construct a morphism t_{n} : N → N such that for all m : 1 → N we have t_{n} ∘ m = 0 iff m = n (see e.g. [52, Part III]); hence one can obtain s_{n} : N → Σ such that s_{n} ∘ m = ⊤ iff m = n.

It remains to check that if X is a Σ-space then so is X^{Y}. So suppose we have z, z′ : 1\overrightarrow{→}X^{Y} such that z ⪯_{Σ} z′ ⪯_{Σ} z. For any y : 1 → Y, define x = eval ∘ ⟨z, y⟩, x′ = eval ∘ ⟨z′, y⟩; then clearly x ⪯_{Σ} x′ ⪯_{Σ} x. But X is a Σ-space, so x = x′. Thus z = z′ by well-pointedness. □

It follows that for any useful X the set Hom(1, X) has a unique least element with respect to ⪯_{Σ}, and so there is a unique morphism α_{X} such that α_{X}η_{X} = id. Also the Σ-limit of a set S ⊆ Hom(1, X) is unique if it exists; hence it is easy to see that the morphisms fix_{X} are uniquely determined by conditions (i) and (ii) in Definition 5.4.9. These facts will be useful when we study further properties of standard PCF-models in Section 6.3.

Interpretations of PCF

We now turn our attention at last to programming languages, and in this chapter consider interpretations in realizability models of Plotkin’s language PCF (see [79]). In fact we will consider several versions of PCF, falling naturally into a three-by-three grid. Along one axis we have three different “degrees of parallelism” (cf. [86]), represented by the pure sequential PCF, the extension PCF^{+} including a “parallel-or” operator, and the further extension PCF^{++} including both parallelor and an “exists” functional. (All three of these languages essentially feature in [79].) Along the other axis we have different “evaluation mechanisms”, giving rise to call-by-name, call-by-value and lazy variants of PCF.

The goal of this chapter is twofold. First, we exploit the theory of well-complete objects developed in Chapter 5 to show that we can give an adequate interpretation of sequential PCF in any realizability model satisfying our strong completeness axiom (see Paragraph 5.2.2). But since there is a wide choice of realizability models available, it seems natural to try to find a good “fit” between particular languages and particular models—for example, to try to match up languages with models that are fully abstract or even universal for them. Our second goal in this chapter is to show that for these purposes it is only the degree of parallelism of the language that is significant, the three evaluation mechanisms being in some sense “equivalent”. Thus, for example, a category with certain structure yields a fully abstract model of call-by-name PCF^{+} iff it also yields a fully abstract model of call-by-value or lazy PCF^{+}; and similarly for universality.

The chapter is structured as follows. In Section 6.1 we review the syntax and operational semantics of the various versions of PCF—the material here will be familiar to many readers. In Section 6.2 we show how to give interpretations of these languages in our models, and prove an adequacy theorem. The material here is “folklore”—the ideas are essentially just a simple categorical generalization of those in [79]. In Section 6.3 we consider syntactic translations between different versions of PCF, and in 6.4 we use these translations to obtain theorems asserting the “equivalence” of different evaluation mechanisms. These results appear to be new, though they are very much in the same spirit as those in [92,83].

Throughout this chapter we work in the abstract categorical setting of an arbitrary PCF-model. Thus this chapter is in principle entirely independent of the rest of the thesis apart from Paragraph 5.4.2 (though we also assume familiarity with the background material on dominances in Section 4.1).

6.1 Syntax and operational semantics

We begin by summarizing the syntax and operational semantics of the languages in question. The material here will be very familiar to readers of papers such as [79,92,83]—such readers may safely skip this section and refer back to it if necessary. We follow fairly closely the economical presentation given in [83]. In Paragraph 6.1.1 we describe the three forms of sequential PCF; in Paragraph 6.1.2 we describe certain parallel extensions of these languages.

6.1.1 Sequential PCF

PCF is a “prototypical” functional programming language based on the simplytyped λ-calculus with some arithmetic and recursion, deriving from Scott’s LCF (see e.g. [34]). The original form of the language (see [79]) incorporated the following “design decisions”. Firstly, β-redexes were reduced in a call-by-name fashion: a redex (λx.M)N could be contracted to M[N/x] without any reduction of N.

Secondly, “observations” were admitted only on terms of ground type: if M was a term of higher type there was no way to observe whether the evaluation of M terminated. Other versions of PCF have since been studied that differ from the original version with respect to these decisions, and it is the relationship between these different versions of PCF that we wish to study here.

In the design of PCF there are thus two choices that we can make: whether the reduction is to proceed in a call-by-name or call-by-value fashion, and whether we are allowed to observe termination at higher types. In fact these choices are not independent, since if we adopt call-by-value reduction then it automatically becomes possible to observe termination at higher types via observations on ground types: the evaluation of (λx.5)M halts iff the evaluation of M halts. For call-by-name reduction there is a genuine choice regarding observations. One convenient way to force termination at higher types to be observable is to add a “convergencetesting” operator conv to the language: informally, the effect of conv MN is to evaluate M, discard the result, then evaluate N and return the result. We can then use the expression conv M 5 to “observe” the termination of M.

We thus have three versions of PCF to consider. First, there is the original version introduced in [79]: we call this PCF_{N} or call-by-name PCF. Second, there is the language obtained by adding the conv operator to PCF_{N}; this was studied in [13] and is called PCF_{L} or lazy PCF. Thirdly, there is the call-by-value language PCF_{V}; this was studied in [93]. We now describe the syntax and operational semantics of these languages.

The three languages have almost exactly the same syntax. Each language has a set of types freely constructed from a single ground type ι (representing the natural numbers) using the binary type constructor →. (We eschew a separate ground type for the booleans, representing “true” by 0 and “false” by any other natural number.) Each language also has rules for forming judgements of the form M : σ, we say M is a term of the language if M : σ is derivable for some σ. For each type σ we assume we have a countably infinite supply of variables x_{0}^{σ}, x_{1}^{σ}, … For PCF_{N} and PCF_{V} the term formation rules are as follows:

x_{i}^{σ} : σ (i ∈ N)  0, 1, 2, …: ι
\frac{M : ι}{(succ M) : ι}  \frac{M : ι}{(pred M) : ι}
\frac{M : ι N : σ P : σ}{(cond MNP) : σ}  \frac{M : σ}{(μx_{i}^{σ}.M) : σ}
\frac{M : τ}{(λx_{i}^{σ}.M) : σ → τ}  \frac{M : σ → τ N : σ}{(MN) : τ}

For PCF_{L} we add one extra formation rule:

\frac{M : σ N : τ}{(conv MN) : τ}

A term is a value if it is either a numeral or a λ-abstraction; we use V as a meta-variable ranging over values. We frequently omit unnecessary parentheses from terms, taking juxtaposition to be left-associative; we also sometimes omit the type ascriptions from variables where these are unimportant or can be inferred. We use M, N, P, … as meta-variables ranging over terms, m, n, … as meta-variables ranging over numerals, and x, y, z, … as meta-variables ranging over variables. We define the notions of free and bound variables and open and closed terms in the obvious way (note that both λ and μ act as binders). For technical simplicity we will consider only terms in which the bound variables have been renamed so that there are no “holes in scope”. We use the meta-notation M[N/x] for captureavoiding substitution.

If M is a term of type τ whose free variables are among x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}}, we may write x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}} ⊢ M : τ and say M is a term in the environment ⟨x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}}⟩. We regard the order in which variables appear in an environment as irrelevant; we may also restrict our attention to environments in which no variable appears twice. If Γ is an environment and x a variable not in Γ, we write Γ, x for the environment obtained by appending x to Γ.

We give the operational semantics of these languages by defining a single-valued “evaluation” relation ⇓ from closed terms to values; we read M ⇓ V as “M halts with value V ”. For each of the three languages, a relation ⇓ is defined inductively by a set of derivation rules. We sometimes write ⇓_{N}, ⇓_{V} , ⇓_{L} to distinguish between the evaluation relations.

The following derivation rules are common to all three languages. Here ⌣ denotes truncated subtraction: m ⌣ n = max(m − n, 0).

V ⇓ V (V a value)  \frac{M[μx.M/x] ⇓ V}{μx.M ⇓ V}
\frac{M ⇓ n}{succ M ⇓ n + 1}  \frac{M ⇓ n}{pred M ⇓ n ⌣ 1}
\frac{M ⇓ 0 N ⇓ V}{cond MNP ⇓ V}  \frac{M ⇓ n + 1 P ⇓ V}{cond MNP ⇓ V}

We also have some rules specific to particular languages:

For PCF_{N} :  \frac{M ⇓_{N} λx.M′ M′[N/x] ⇓_{N} V}{MN ⇓_{N} V}
For PCF_{L} :  \frac{M ⇓_{L} λx.M′ M′[N/x] ⇓_{L} V}{MN ⇓_{L} V}

\frac{M ⇓_{L} V′ N ⇓_{L} V}{conv MN ⇓_{L} V}

For PCF_{V} : \frac{M ⇓_{V} λx.M′ N ⇓_{V} V′ M′[V′/x] ⇓_{V} V}{MN ⇓_{V} V}

We write M ⇓ if M ⇓ V for some V, and M ⇑ otherwise. We also write ⇓_{N}, ⇑_{V} etc. when we need to be specific about which language we mean.

6.1.2 Parallel extensions of PCF

The languages defined above are all intuitively “sequential” in the sense that there is a single thread of computation—no two sub-expressions of an expression are ever evaluated in parallel. We now introduce some extensions PCF^{+} and PCF^{++} including parallel operators. Each of these comes in call-by-name, lazy and callby-value flavours.

The PCF^{+}-languages are obtained from PCF by the addition of a parallel-or operator. The term formation rules for each of the languages PCF_{N}^{+}, PCF_{L}^{+}, PCF_{V}^{+} are those for the corresponding sequential language plus the extra rule

\frac{M : ι N : ι}{(por MN) : ι}

The derivation rules for the evaluation relation are just those of the corresponding sequential language plus the following:

\frac{M ⇓ 0}{por MN ⇓ 0}  \frac{N ⇓ 0}{por MN ⇓ 0}  \frac{M ⇓ m + 1 N ⇓ n + 1}{por MN ⇓ 1}

Again we write ⇓_{N}, ⇓_{L}, ⇓_{V} when the languages need to be distinguished. Note that there is no need for a notational distinction between the evaluation relations for PCF_{N} and PCF_{N}^{+}, for instance, since these agree for all terms of PCF_{N}.

(Note: Other authors consider the language obtained by adding a “parallel conditional” operator to PCF (see e.g. [79]). This language is essentially equivalent to our PCF^{+}, since por and the parallel conditional are interdefinable. This was shown for call-by-name PCF in [94]; it is easy to check that in fact the same argument works in the lazy and call-by-value cases.)

In [79] it was shown that the standard domain-theoretic model was fully abstract for PCF_{N}^{+}. However, to obtain the definability of all r.e. elements it was necessary to add one further parallel operator, the exists functional. Our languages PCF^{++} will be essentially PCF^{+} with this functional added. In our presentation, the argument of exists will have a slightly more complicated type than in [79]—this is to allow us to define the three versions of PCF^{++} in a uniform way.

The term formation rules for each of the languages PCF_{N}^{++}, PCF_{L}^{++}, PCF_{V}^{++} are those for the corresponding version of PCF^{+} with the extra rule

\frac{M : (ι → ι) → ι}{(exists M) : ι}

The derivation rules for the ⇓ relation are those for the corresponding PCF^{+}- language plus the rules

\frac{M(λx.n) ⇓ 0}{exists M ⇓ 0}  \frac{M(λx.μy.y) ⇓ m + 1}{exists M ⇓ 1}

Here the role of the type ι → ι is simply to encode the lifted natural numbers: we represent the number n by the constant function λx.n, and bottom by the everywhere-undefined function (note that μy.y diverges under each of the evaluation mechanisms). This encoding trick is needed to give the correct definition in the call-by-value case. In the call-by-name case it is easy to see that our exists operator and the functional ∃ appearing in [79] are interencodable.

6.2 Denotational semantics of PCF

We now show how to interpret these languages in our models. More specifically, we show that in any PCF-model we can give adequate interpretations of the three forms of sequential PCF, and that these can be extended to PCF^{+} and PCF^{++} provided the model contains morphisms corresponding to por and exists . The material here may be reasonably regarded as “folklore”—most of the ideas are straightforward adaptations of those in [79]—though it does not seem to have appeared in the literature in the form we require. A similar “categorical” adequacy result has been proved by Fiore and Plotkin [23], who consider interpretations of FPC (a more powerful language than PCF) in a general setting given by CPOenriched categories.

6.2.1 Interpretation of PCF

We first present the interpretations of PCF_{N}, PCF_{L} and PCF_{V} in any PCF-model. If M is a term of type τ in environment Γ, the denotation of M (in environment Γ) will be a morphism from the object denoting the environment Γ to the object denoting the type τ. For each type σ we will distinguish between an object V^{σ} of values and an object C^{σ} of computations, in the spirit of [63]. We may think of values as the entities that may be bound to variables (and in particular which may be passed as parameters to a λ-abstraction), and computations as the entities which may be denoted by arbitrary terms.

The objects C^{σ}, V^{σ} are defined differently for each of the three evaluation mechanisms. For typographical convenience we write X → Y for Y^{X}.

\begin{aligned}V_{N}^{ι} & = N_{⊥}, & V_{L}^{ι} & = N_{⊥}, & V_{V}^{ι} & = N, \\ V_{N}^{σ→τ} & = V_{N}^{σ} → V_{N}^{τ}, & V_{L}^{σ→τ} & = (V_{L}^{σ} → V_{L}^{τ})_{⊥}, & V_{V}^{σ→τ} & = V_{V}^{σ} → V_{V ⊥}^{τ}, \\ C_{N}^{σ} & = V_{N}^{σ}, & C_{L}^{σ} & = V_{L}^{σ}, & C_{V}^{σ} & = V_{V ⊥}^{σ}. \end{aligned}

(The distinction between computations and values is only really important in the case of PCF_{V}.) Notice that all the objects C^{σ} are useful. In each case we have an obvious inclusion κ^{σ} : V^{σ} → C^{σ} given as follows:

κ_{N}^{σ} = id_{V_{N}^{σ}},  κ_{L}^{σ} = id_{V_{L}^{σ}},  κ_{V}^{σ} = η_{V_{V}^{σ}}.

The denotation [[ τ ]] of a type τ will be the object C^{τ}, and the denotation [[ Γ ]] of an environment Γ = ⟨x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}}⟩ will be the object V^{σ_{1}} × ⋯ × V^{σ_{n}}. (Strictly speaking, this object depends on the particular order of the x_{i}^{σ_{i}} and also on the choice of bracketing for the n-fold product. However, for simplicity we will ignore this fact and understand the denotation of an environment to be given only “up to canonical isomorphism”.) We also write [Γ] for the object C^{σ_{1}} × ⋯ × C^{σ_{n}}.

Next we introduce some basic general notions. If L is one of our nine languages, a pre-interpretation for L is a mapping assigning to each term M : τ in environment Γ a morphism [M]^{Γ} : [Γ] → [[ τ ]]. We say a pre-interpretation is compositional if whenever M is a term in environment Δ = ⟨x_{1}^{σ_{1}}, …, x_{m}^{σ_{m}}⟩ and N_{1} : σ_{1}, …, N_{m} : σ_{m} are terms in environment Γ we have

[M[N⃗/x⃗]]^{Γ} = [M]^{Δ} ∘ ⟨[N_{1}]^{Γ}, …, [N_{m}]^{Γ}⟩.

Given a pre-interpretation for L the corresponding interpretation assigns M : τ in environment Γ the morphism

[[ M ]]^{Γ} = [M]^{Γ} ∘ (κ^{σ_{1}} × ⋯ × κ^{σ_{n}}) : [[ Γ ]] ⟶ [[ τ ]].

Note that the pre-interpretation of M is slightly more informative than the interpretation since it tells us the semantic value of M when non-values are substituted for the free variables. We need this extra information in order to interpret the recursion operator. The reason for the final step from the pre-interpretation to the interpretation is that there are natural situations in which the interpretation is fully abstract but the pre-interpretation is not (this nicety is explained in [92]).

In order to define the (canonical) pre-interpretation of our languages in a PCFmodel, some more notation is helpful. For any X we write u_{X} for the unique morphism X → 1. Given f : X × Y → Z we write curry_{Y} (f) for its exponential transpose X → Z^{Y}. For any X, Y we write eval : Y^{X} × X → Y for the evaluation map. We also write strict : (Y_{⊥})^{X} → (Y_{⊥})^{X_{⊥}} for the exponential transpose of μ_{X} ∘ strict′, where strict′ : (Y_{⊥})^{X} × X_{⊥} → Y_{⊥⊥} is the classifier of the partial map (id×η_{X}, eval_{XY_{⊥}}). If X is a useful object, we write α_{X} : X_{⊥} → X for the morphism given by Proposition 5.4.8.

We also want some notation for morphisms corresponding to particular PCF constructs. For each n ∈ N we write k_{n} : 1 → N_{⊥} for the morphism corresponding to n. We write succ, pred : N_{⊥} → N_{⊥} for the lifts of the successor and predecessor morphisms respectively, where pred 0 = 0 (for a proof that such a predecessor morphism exists see e.g. [52, Part III]). For each X we define the morphism cond_{X} : N_{⊥}×X ×X → X as follows: First let C : N → X^{X×X} be the mediating morphism determined by the diagram

[figure: 1; \overline{π_{0}}; X^{X×X}; \overline{π_{1}} ∘ u; X^{X×X}]

using the defining property of the natural number object. Let C′ : N ×X ×X → X be the exponential transpose of C, let cond′_{X} be the classifier of the partial map (η_{N} × id × id, C′), and let cond_{X} = μ_{N} ∘ cond′_{X}. Note that

cond_{X} ∘ ⟨k_{0}, id⟩ = π_{0}, cond_{X} ∘ ⟨k_{n+1}, id⟩ = π_{1}, cond_{X} ∘ ⟨⊥, id⟩ = ⊥ ∘ u.

Finally, for any useful X, Y we define the morphism conv_{XY} : X_{⊥} × Y_{⊥} → Y_{⊥} to be μ_{Y} ∘ conv′_{XY}, where conv′_{XY} classifies the partial map (η_{X} × id, π_{Y_{⊥}}). Note that

conv_{XY} ∘ (η_{X} × id) = π_{Y_{⊥}}, conv_{XY} ∘ (⊥_{X} × id) = ⊥_{Y_{⊥}} ∘ u_{Y_{⊥}}.

We now define [M]^{Γ} by induction on the structure of M. The following clauses in the definition are common to all three evaluation mechanisms:

[x_{i}^{σ_{i}}]^{Γ} = κ^{σ_{i}} ∘ π_{i}
[n]^{Γ} = k_{n} ∘ u_{[Γ]}
[succ M]^{Γ} = succ ∘ [M]^{Γ}
[pred M]^{Γ} = pred ∘ [M]^{Γ}
[cond MNP]^{Γ} = cond_{[[ σ]]} ∘ ⟨[M]^{Γ}, [N]^{Γ}, [P]^{Γ}⟩
[μx^{σ}.M]^{Γ} = fix_{[[ σ]]} ∘ curry_{[[ σ]]}([M]^{Γ,x^{σ}})

We also have the following clauses specific to particular languages.

For PCF_{N} :  [λx^{σ}.M]^{Γ} = curry_{[[ σ]]} ([M]^{Γ,x^{σ}})
[MN]^{Γ} = eval ∘ ⟨[M]^{Γ}, [N]^{Γ}⟩
For PCF_{L} :  [λx^{σ}.M]^{Γ} = η ∘ curry_{[[ σ]]} ([M]^{Γ,x^{σ}})
[MN]^{Γ} = eval ∘ ⟨α_{V^{σ}→V^{τ}} ∘ [M]^{Γ}, [N]^{Γ}⟩
[conv MN]^{Γ} = conv_{[[ σ]][[ τ ]]} ∘ ⟨[M]^{Γ}, [N]^{Γ}⟩
For PCF_{V} :  [λx^{σ}.M]^{Γ} = η ∘ (C^{τ})^{κ^{σ}} ∘ curry_{[[ σ]]} ([M]^{Γ,x^{σ}})
[MN]^{Γ} = eval ∘ ⟨strict ∘ α_{V^{σ→τ}} ∘ [M]^{Γ}, [N]^{Γ}⟩

We write [−]_{N}, [[ −]]_{V} etc. when we need to be specific about the language. If M is a closed term then we may write [M] and [[ M ]] in place of [M]^{⟨⟩} and [[ M ]]^{⟨⟩} respectively. It is easy to see that these pre-interpretations are compositional in the sense defined above.

This completes the definition of the interpretations. Note that a closed term of type σ is interpreted as a morphism 1 → [[ σ]], or equivalently (in the case of Mod(A)) as an element of the set |[[ σ]]|.

6.2.2 The adequacy theorem

For any of our nine languages, the “correctness” of some interpretation with respect to the operational semantics is expressed by the following property:

Definition 6.2.1 Suppose L is one of our languages, [[ −]] an interpretation in some PCF-model. We say the interpretation is adequate if for all closed terms M : ι of L we have [[ M ]]_{L} = k_{n} if M ⇓_{L} n, and [[ M ]]_{L} = ⊥ if M ⇑.

This paragraph is devoted to the proof that the canonical interpretations of PCF_{N}, PCF_{L} and PCF_{V} defined above are adequate. For the remainder of the paragraph, we use L to stand for any one of the (sequential) languages PCF_{N}, PCF_{L}, PCF_{V}.

Theorem 6.2.2 (Adequacy for PCF) For any PCF-model C, the interpretation of L in C defined in Paragraph 6.2.1 is adequate.

The proof is very similar indeed to the proof of the adequacy theorem in [79]. In order to keep our account self-contained, however, we present the argument here but omit some of the details. For the most part our proof works uniformly for the three languages PCF_{N}, PCF_{L}, PCF_{V}.

To prove the theorem, it is convenient first to enrich L to a language L′ by adding a new binder μ^{k} for each k—these will serve as “approximants” to μ. More formally, the term formation rules of L′ are those of L augmented by rules

\frac{M : σ}{(μ^{k}x_{i}^{σ}.M) : σ}

for each k ≥ 0. The derivation rules for the evaluation relation of L′ are those for L together with rules

\frac{M[μ^{k}x.M/x] ⇓ V}{μ^{k+1}x.M ⇓ V}

(Note that the absence of a rule for μ^{0}x.M means that μ^{0}x.M ⇑.)

The introduction of the μ^{k} is purely a technical convenience, and adds nothing to the “expressivity” of L. (In fact the notation μ^{k}x.M can be viewed as syntactic sugar for a certain term of L.) If M is a closed term of L then clearly M ⇓_{L} V iff M ⇓_{L′} V. Moreover it is easy to check the following syntactic fact:

Lemma 6.2.3 Suppose D[−] is a one-place term context. Then D[μx.M] ⇓ iff D[μ^{k}x.M] ⇓ for some k; moreover D[μx.M] ⇓ n iff D[μ^{k}x.M] ⇓ n for some k. □

We can extend our interpretation of L to L′ by adding the following clause to our definition of the pre-interpretation of M:

[μ^{k}x^{σ}.M]^{Γ} = iter_{X}^{k} ∘ curry_{[[ σ]]}([M]^{Γ,x^{σ}})

where the morphism iter_{X}^{k} : X^{X} → X is defined as in Paragraph 5.4.2. It is now easy to verify the following:

Proposition 6.2.4 If M ⇓ V then [[ M ]] = [[ V ]].

Proof A straightforward induction on the derivation of M ⇓ V, with one induction case for each evaluation rule of L′. □

This proves one half of the Adequacy Theorem since [[ n]] = k_{n}. To prove the other half, we use the idea of computable terms as in [79]. We can define these uniformly in L as follows:

Definition 6.2.5 (Computable terms) A closed term M : ι is computable iff M ⇑ implies [[ M ]] = ⊥. A closed term M : σ → τ is computable iff M ⇑ implies [[ M ]] = ⊥, and N : σ closed and computable implies MN computable. An open term M with free variables x_{1}, …, x_{m} is computable iff M[N⃗/x⃗] is computable whenever N_{1}, …, N_{m} are computable terms of the appropriate types.

Our goal is to show that all terms of L′ are computable (this implies the second half of the Adequacy Theorem). The following facts will be useful:

Lemma 6.2.6 Suppose M, M′ are closed terms of type σ.

(i) If M ⇑ and [[ M ]] = ⊥, then M is computable.

(ii) If [[ M ]] = [[ M′]] and M ⇓ V ⇔ M′ ⇓ V, then M is computable iff M′ is computable.

(iii) If M ⇓ V then M is computable iff V is computable.

Proof (i) and (ii) are easy by induction on the structure of σ. (iii) follows from (ii), since V ⇓ V and [[ M ]] = [[ V ]] by Proposition 6.2.4. □

Proposition 6.2.7 All terms M are computable.

Proof By induction on the structure of M. Most of the proof is uniform in L. If M is a variable or a numeral then M is trivially computable. It is also an easy exercise to verify that if M, N, P : ι are computable then so are succ M, pred M, cond MNP.

If M : σ → τ, N : σ are computable then so is MN: If M, N are both closed this is immediate. If the free variables of M, N are among x_{1}, …, x_{m} then for any computable terms P_{1}, …, P_{m} we have M[P⃗ /x⃗], N[P⃗ /x⃗] computable so (MN)[P⃗ /x⃗] is computable; thus MN is computable.

If M : τ is computable then so is λx^{σ}.M: First suppose λx.M is closed. Note that λx.M ⇓ so the clause regarding divergence is trivial. Now suppose N : σ is closed and computable. The proof that (λx.M)N is computable depends on the particular language L.

• For PCF_{N} and PCF_{L} we have (λx.M)N ⇓ V ⇔ M[N/x] ⇓ V; moreover it is easy to check in each case that [(λx.M)N] = [M[N/x]] so [[ (λx.M)N ]] = [[ M[N/x] ]]. But M[N/x] is computable, so (λx.M)N is computable by Lemma 6.2.6(ii).

• For PCF_{V}, if N ⇓ V′ for some V′ then (λx.M)N ⇓ V ⇔ M[V′/x] ⇓ V and [[ (λx.M)N ]] = [[ M[V′/x] ]]. But M[V′/x] is computable, so (λx.M)N is computable. Otherwise N ⇑ and so [[ N ]] = ⊥; hence (λx.M)N ⇑ and [[ (λx.M)N ]] = ⊥, so (λx.M)N is computable by Lemma 6.2.6(i).

Thus for all three languages L we have that λx.M is computable. The extension to the case when λx.M is open is straightforward.

Next, if M, N are computable then so is conv MN (in the case of PCF_{L}). For closed terms this is easy by cases according to whether M ⇓; the extension to open terms is again straightforward.

It remains to show that if M is computable then so are μ^{k}x.M, μx.M. As in the above cases, the extension from closed terms to open terms is easy, so let us assume M is computable and μx.M is closed. The proof that μ^{k}x.M is computable is easy by induction on k. The fact that μx.M is computable is then immediate from the following lemma.

Lemma 6.2.8 Suppose D[−] is a one-place term context such that D[P] is computable whenever P is computable, and suppose M is computable and μx.M is closed. Then D[μx.M] is computable.

Proof By induction on the type of D[M]. First suppose D[M] : ι. If D[μx.M] ⇑ then for all k we have D[μ^{k}x.M] ⇑ by Lemma 6.2.3. But μ^{k}x.M is computable by the above, so D[μ^{k}x.M] is computable and thus [[ D[μ^{k}x.M] ]] = ⊥. But clearly [μx.M] is a Σ-limit of the [μ^{k}x.M] from the definitions, hence [[ D[μx.M] ]] is a Σ-limit of the [[ D[μ^{k}x.M] ]], and so we have [[ D[μx.M] ]] = ⊥. Thus D[μx.M] is computable.

Now suppose D[M] : σ → τ. If D[μx.M] ⇑ then exactly as above we have [[ D[μx.M] ]] = ⊥. So suppose N : σ is computable, and define D′[−] = D[−]N. Clearly if P is computable then so is D′[P], so by the induction hypothesis we have D′[μx.M] computable. Thus D[μx.M] is computable. □

This completes the proof of Theorem 6.2.2. Note that for all closed M : ι the morphism [[ M ]] is either ⊥ or k_{n} for some n, although there may be PCF-models in which not every morphism 1 → N_{⊥} is of one of these forms.

6.2.3 Interpretations of PCF^{+} and PCF^{++}

We have seen that any PCF-model provides an adequate and compositional interpretation for any version of sequential PCF. We now consider the circumstances under which this interpretation can be smoothly extended to PCF^{+} and PCF^{++}.

Suppose L is any one of our nine languages and L_{0} is the version of sequential PCF with the same evaluation mechanism as L. We say that a PCF-model C supports L if the interpretation of L_{0} given in Paragraph 6.2.1 can be extended to an adequate and compositional interpretation of L. (Thus any PCF-model supports any version of sequential PCF.) We first characterize the PCF-models that support the various versions of PCF^{+}.

Proposition 6.2.9 Suppose C is a PCF-model. Then the following conditions are equivalent:

(i) There is a morphism por : N_{⊥} × N_{⊥} → N_{⊥} in C such that whenever x is k_{n} or ⊥ and y is k_{n+1} or ⊥ we have

por ∘ ⟨x, k_{0}⟩ = por ∘ ⟨k_{0}, x⟩ = k_{0}, por ∘ ⟨k_{m+1}, k_{n+1}⟩ = k_{1},

por ∘ ⟨y, ⊥⟩ = por ∘ ⟨⊥, y⟩ = ⊥.

(ii) C supports PCF_{N}^{+};

(iii) C supports PCF_{L}^{+};

(iv) C supports PCF_{V}^{+}.

Proof (i) ⇒ (ii),(iii),(iv): For each of the three PCF^{+}-languages, we can extend the above interpretation of the corresponding sequential language by adding the clause

[por MN]^{Γ} = por ∘ ⟨[M]^{Γ}, [N]^{Γ}⟩

to the definition of the pre-interpretation. The resulting interpretation of PCF^{+} is clearly compositional. The proof of adequacy is a simple modification of the proof in the last section: we just add some easy extra induction steps to the proofs of Propositions 6.2.4 and 6.2.7.

(ii),(iii),(iv) ⇒ (i): Let Γ = ⟨x^{ι}, y^{ι}⟩, and take por = [por xy]^{Γ}. It is easy to check that por satisfies the above equations. □

If the object 2 = 1+1 exists in C, condition (i) above is obviously equivalent to the more natural requirement that there be a morphism 2_{⊥} × 2_{⊥} → 2_{⊥} satisfying certain equations. The reader may like to verify directly at this stage that for the PCF-models Mod(K_{1}) and Mod(Pω_{re}) (with the dominances of 4.3.5) the morphism por does exist, whereas in Mod(Λ^{0}/B) it does not (these facts will become obvious in the next chapter).

The following proposition characterizes the models that support PCF^{++}. For technical reasons it seems simplest to restrict our attention here to well-pointed PCF-models, although it seems that a similar result holds in the more general situation.

Proposition 6.2.10 Suppose C is a well-pointed PCF-model satisfying the equivalent conditions of Proposition 6.2.9. Then the following are equivalent:

(i) There is a morphism ∃ : (N_{⊥})^{N_{⊥}} → N_{⊥} in C such that for any f : N_{⊥} → N_{⊥} we have

∃ ∘ \overline{f} = \{ \begin{matrix}k_{0} & if f ∘ k_{n} = k_{0} for some n \\ k_{1} & if f ∘ ⊥ = k_{m+1} for some m \\ ⊥ & otherwise; \end{matrix}

(ii) C supports PCF_{N}^{++};

(iii) C supports PCF_{L}^{++};

(iv) C supports PCF_{V}^{++}.

Proof (i) ⇒ (ii),(iii),(iv): Let q : C^{(ι→ι)→ι} × C^{ι} → C^{ι} be [F (λy^{ι}.x)]^{Γ}, where Γ = ⟨F^{(ι→ι)→ι}, x^{ι}⟩; and let \overline{q} : C^{(ι→ι)→ι} → (N_{⊥})^{N_{⊥}} be the exponential transpose of q. We can extend the above interpretation of PCF^{+} by adding the clause

[exists M]^{Γ} = ∃ ∘ \overline{q} ∘ [M]^{Γ}

to the definition of the pre-interpretation. The resulting interpretation is clearly still compositional. To show that it is adequate we need some extra induction steps in the proofs of Propositions 6.2.4 and 6.2.7, but these are straightforward using the above properties of ∃.

(ii) ⇒ (i): Let Δ = ⟨h^{ι→ι}⟩, and take ∃ = [exists (λg^{ι→ι}.h(g0))]^{Δ}. Then it is easy to check that ∃ ∘ \overline{f} satisfies condition (i) whenever f is denotable (i.e. f = [P] for some closed P : ι → ι). Now suppose f : N_{⊥} → N_{⊥} is arbitrary; the idea is to exhibit f as the limit of a chain of denotable morphisms. Let G : (N_{⊥})^{N_{⊥}} → (N_{⊥})^{N_{⊥}} be the morphism [λx^{ι}. cond x 0 (succ (h(pred x)))]_{N}^{Δ}; let g be the exponential transpose of fix(G), and for each k let g_{k} : N_{⊥} → N_{⊥} be the transpose of iter_{X}^{k}(G). Then g = id, g_{k}(n) = n for n < k, and g_{k}(n) = ⊥ for n ≥ k. Moreover g is the Σ-limit of the g_{k}. Now define f_{k} = f ∘ g_{k} for each k; then the f_{k} are clearly denotable and hence satisfy condition (i) above. Hence f = f ∘g satisfies condition (i) by continuity.

(iii) ⇒ (i), (iv) ⇒ (i) are similar, except that in the definition ∃ we need some obvious coercion morphisms (N_{⊥})^{N_{⊥}} → C^{ι→ι}. □

Again, if C has an object 2, we may clearly replace condition (i) by the condition that there be a morphism (2_{⊥})^{N_{⊥}} → 2_{⊥} with certain properties. It is easy to verify directly that in both Mod(K_{1}) and Mod(Pω_{re}) the morphism ∃ does indeed exist (again we will prove this in the next chapter).

The following theorem is now immediate from Propositions 6.2.9 and 6.2.10:

Theorem 6.2.11 Suppose C is a well-pointed PCF-model, and L_{1}, L_{2} are two of our nine languages having the same degree of parallelism. Then C supports L_{1} iff C supports L_{2}. □

In view of this theorem, in future we shall simply say that a PCF-model supports PCF [resp. PCF^{+}, PCF^{++}], without reference to a particular evaluation mechanism.

6.3 Relating variants of PCF

It is natural to try to match our languages with PCF-models in which they have a fully abstract or even a universal interpretation (cf. Section 6.4). In the next chapter we will see several examples of such matching pairs. In this section and the next our goal is to show that for this purpose the evaluation mechanism of the language is irrelevant—it is only the degree of parallelism that matters. In particular we can show that our three evaluation mechanisms are in some sense equi-expressive, by exhibiting good syntactic translations between the respective languages.

In Paragraph 6.3.1 we consider the three type hierarchies in a PCF-model corresponding to the three evaluation mechanisms, and show how each of these type hierarchies can be “embedded” in the others. One consequence of the existence of these embeddings is that each of the type hierarchies is in some sense determined by either of the others. In Paragraph 6.3.2 we give syntactic translations between languages with different evaluation mechanisms, and show that these correspond exactly to our semantic embeddings. In Section 6.4 we will use this information to deduce results relating full abstraction and universality results for languages with different evaluation mechanisms.

We should admit that the proofs throughout this section and the next are in general less detailed than those elsewhere in the thesis—a lot of tedious checking is left to the long-suffering reader. Even so, our written proofs include some quite heavy calculation, and it seemed that more complete proofs would be almost unreadable. It would be interesting to find alternative ways of proving the main results that were at once clean and rigorous. (We suggest one possible approach at the end of the chapter.)

Throughout this section we take C to be a standard PCF-model in the sense of Paragraph 5.4.2. It is not clear how necessary this condition is for our results, but it seems to simplify the proofs considerably. We will frequently show that a pair of morphisms X\overrightarrow{→}Y are equal by checking that they agree on all global elements—this is often easier than a proof by diagram-chasing.

By an evaluation mechanism we will officially just mean one of the three formal symbols N, L, V. We will sometimes write “E is an evaluation mechanism”, meaning that E is a meta-variable ranging over the set {N, L, V }. If D[−, …, −] : τ is an r-place term context of PCF_{E}^{++}, with holes of type σ_{1}, …, σ_{r} and with no other free variables, we write [[ D]]_{E} for the evident interpretation of D as a morphism C_{E}^{σ_{1}} × ⋯ × C_{E}^{σ_{r}} → C_{E}^{τ}.

6.3.1 Type hierarchies in PCF-models

Recall from Paragraph 6.2.1 that for each evaluation mechanism E and each PCF type σ we may define objects V_{E}^{σ}, C_{E}^{σ} as follows:

\begin{aligned}V_{N}^{ι} & = N_{⊥}, & V_{L}^{ι} & = N_{⊥}, & V_{V}^{ι} & = N, \\ V_{N}^{σ→τ} & = V_{N}^{σ} → V_{N}^{τ}, & V_{L}^{σ→τ} & = (V_{L}^{σ} → V_{L}^{τ})_{⊥}, & V_{V}^{σ→τ} & = V_{V}^{σ} → V_{V ⊥}^{τ}, \\ C_{N}^{σ} & = V_{N}^{σ}, & C_{L}^{σ} & = V_{L}^{σ}, & C_{V}^{σ} & = V_{V ⊥}^{σ}. \end{aligned}

For each E we refer to the family of objects C_{E}^{σ} as the E-type hierarchy associated with C. (Thus we speak of the call-by-name, call-by-value and lazy type hierarchies.) Our main task in this paragraph is to show that each of these type hierarchies can be “embedded” in each of the others. Specifically, we show that the following “generic theorem” holds, where E, E′ are two different evaluation mechanisms:

Theorem 6.3.1 For any PCF type σ, there exist a type σ′ and a pair of morphisms C_{E}^{σ}\overleftarrow{→}C_{E′}^{σ′} such that following triangle commutes:

C_{E}^{σ}  \overline{}C_{E′}^{σ′}
[figure: id]
C_{E}^{σ}.^{}

We can abbreviate the statement of this theorem by the phrase “E embeds in E′.” To show that the theorem holds for all distinct E, E′ it will suffice to show that V embeds in L, N embeds in V and L embeds in N: the other three embeddings can then be obtained by composition.

Remark 6.3.2 The existence of these embeddings has an interesting consequence involving finite type structures (cf. [99]). Loosely speaking, for each evaluation mechanism E we can define a (partial) finite type structure F, consisting of the family of sets F^{σ} = Hom(1, V_{E}^{σ}) together with suitable (partial) application operations. Each of these type structures can be seen as giving a measure of the “computational power” associated with C. Using the above theorem it can be shown that each of the three finite type structures arising from C is determined up to isomorphism by either of the other two. Thus the three type structures all contain exactly the same amount of information about the computational power of C. However, we will not pursue this line of thought here, since formalizing the details is rather laborious and we will not need the result in what follows.

All three of the embeddings that we give will play a prominent role in the rest of this section, so we will introduce some specific notation pertaining to each one. We first describe the embedding of V in L; the notation introduced by the following proposition remains in force for the rest of the chapter.

Proposition 6.3.3 (Embedding V in L) For each type σ, define \overline{σ} = σ. Then for each σ there exist morphisms β^{σ} : C_{V}^{σ} → C\overline{σ} ; L and γ^{σ} : C\overline{σ} ; L → C_{V}^{σ} such that γ^{σ}β^{σ} = id. Moreover, there is a term context P^{σ}[−] of PCF_{L} such that β^{σ}γ^{σ} = [[ P^{σ}]]_{L}.

Proof We define β^{σ}, γ^{σ} simultaneously by induction on σ: Let β^{ι} = γ^{ι} = id_{N_{⊥}}; define β^{σ→τ} to be the composite

[figure: (V_{V}^{σ} → C_{V}^{τ})_{⊥}; strict_{⊥}; (C_{V}^{σ} → C_{V}^{τ})_{⊥}; ((β^{τ})^{γ^{σ}})_{⊥}; (C\overline{σ} ; L → C\overline{τ} ; L)_{⊥};]

and define γ^{σ→τ} to be the composite

[figure: (C\overline{σ} ; L → C\overline{τ} ; L)_{⊥}; ((γ^{τ})^{β^{σ}})_{⊥}; (C_{V}^{σ} → C_{V}^{τ})_{⊥}; ((C_{V}^{τ})^{η})_{⊥}; (V_{V}^{σ} → C_{V}^{τ})_{⊥}.]

We check by induction on σ that γ^{σ}β^{σ} = id. We trivially have γ^{ι}β^{ι} = id; and for the induction step we have

γ^{σ→τ}β^{σ→τ} = ((C_{V}^{τ})^{η})_{⊥} ∘ ((γ^{τ}β^{τ})^{γ^{σ}β^{σ}})_{⊥} ∘ strict_{⊥} = ((C_{V}^{τ})^{η})_{⊥} ∘ strict_{⊥} = id.

We now define term contexts P^{σ}[−] of PCF_{L} inductively by

P^{ι}[x\overline{ι}] ≡ x,
P^{σ→τ}[x\overline{σ→τ}] ≡ conv x(λy\overline{σ}. conv y(P^{τ}[x(P^{σ}[y])])).

We show by induction on σ that P^{σ} denotes the morphism β^{σ}γ^{σ}. The case ι is trivial; the induction step provides a good example of the “pointwise” style of reasoning about morphisms. Suppose given x : 1 → (C\overline{σ} ; L → C\overline{τ} ; L)_{⊥}. If x = ⊥ then by the definitions of β^{σ→τ} and γ^{σ→τ} we have β^{σ→τ}γ^{σ→τ}x = ⊥; but also [[ P^{σ→τ} ]]_{L} ∘ x = conv ∘ ⟨x, g⟩ = ⊥ for an appropriate morphism g. Otherwise we have x = η ∘ curry(f) for some f : C\overline{σ} ; L → C\overline{τ} ; L. It is now easy to see that

β^{σ→τ}γ^{σ→τ}x = η ∘ curry(β^{τ}f′γ^{σ}),
where curry(f′) = strict ∘ (C_{V}^{τ})^{η} ∘ curry(γ^{τ}fβ^{σ}).

But since conv ∘ ⟨η ∘ curry(f), g⟩ = g for any g, we also have

[[ P^{σ→τ} ]]_{L} ∘ x = [[ λy\overline{σ}. conv y Z[x, y] ]]_{L} = η ∘ curry([[ conv y Z[x, y] ]]_{L}^{y\overline{σ}})

where Z[x, y] ≡ P^{τ}[x(P^{σ}[y])]. (Here we abuse notation slightly and understand the syntactic variable x to be interpreted by the morphism x.) So it is enough to show that β^{τ}f′γ^{σ} = [[ conv y Z[x, y] ]]_{L}^{y}. Suppose given y : 1 → C\overline{σ} ; L. If y = ⊥ then γ^{σ}y = ⊥; but f′⊥ = ⊥ and so β^{τ}f′γ^{σ}y = ⊥. But also [[ conv y Z[x, y] ]]_{L}^{y} ∘ y = conv ∘ ⟨y, h⟩ = ⊥ for an appropriate h. If y ≠ ⊥ then γ^{σ}y ≠ ⊥, and so we have

β^{τ}f′γ^{σ}y = β^{τ}γ^{τ}f β^{σ}γ^{σ}y = [[ Z[x, y] ]]_{L}^{y} ∘ y = [[ conv y Z[x, y] ]]_{L}^{y} ∘ y. □

The syntactic definability of β^{σ}γ^{σ} is a technical fact that we will need in the next paragraph. The contexts P^{σ} given above are also used by Riecke in [83], where they play a very similar role. We have given the proof that P^{σ} denotes β^{σ}γ^{σ} in some detail as an example of this kind of reasoning. In future we will seldom give such arguments in full, since when written out they often seem harder than they really are. Typically we will claim that some equality can be “checked pointwise”, and leave it to the patient reader to fill in the details.

We next describe the embedding of N in V. This follows a very similar pattern, although the fact that the objects V_{V}^{σ}, C_{V}^{σ} are different adds a slight extra twist in the definition of the embedding.

Proposition 6.3.4 (Embedding N in V) For each type σ, define σ̂ by

ι̂ = ι → ι, { \atop σ → τ} = σ̂ → τ̂.

Then for each type σ there exist morphisms δ^{σ} : C_{N}^{σ} → C_{σ} ; V and ϵ^{σ} : C_{σ} ; V → C_{N}^{σ} such that ϵ^{σ}δ^{σ} = id. Moreover, there is a term context Q^{σ}[−] of PCF_{V} such that δ^{σ}ϵ^{σ} = [[ Q]]_{V}^{σ}.

Proof In order to define δ^{σ}, ϵ^{σ} we first define morphisms δ′^{σ} : C_{N}^{σ} → V _{σ} ; V and ϵ′^{σ} : V _{σ} ; V → C_{N}^{σ} as follows. Let δ′^{ι} : N_{⊥} → (N_{⊥})^{N} be the “constant” morphism (the transpose of the evident projection), and let ϵ′^{ι} : (N_{⊥})^{N} → N_{⊥} be the “evaluation at zero” morphism (the composite eval ∘ ⟨id, 0⟩). Define δ′^{σ→τ} to be the composite

[figure: (C_{N}^{σ} → C_{N}^{τ}); (δ′^{τ})^{ϵ′^{σ}}; (V _{σ} ; V → V _{τ} ; V); η^{V _{σ} ; V}; (V _{σ} ; V → C_{τ} ; V),]

and ϵ′^{σ→τ} to be the composite

[figure: (V _{σ} ; V → C_{τ} ; V); (α_{V _{τ} ; V})^{V _{σ} ; V}; (V _{σ} ; V → V _{τ} ; V); (ϵ′^{τ})^{δ′^{σ}}; (C_{N}^{σ} → C_{N}^{τ}).]

It is easy to check by induction on σ that ϵ′^{σ}δ′^{σ} = id. We now define

δ^{σ} = η_{V _{σ} ; V} ∘ δ′^{σ}, ϵ^{σ} = ϵ′^{σ} ∘ α_{V _{σ} ; V}.

Then ϵ^{σ}δ^{σ} = id since α_{X} ∘ η_{X} = id. The term contexts Q^{σ} may be defined thus:

Q^{ι}[x_{ι}] ≡ λy^{ι}. x0,  Q^{σ→τ}[x{ \atop σ→τ}] ≡ λy_{σ}. Q^{τ}[x(Q^{σ}[y])].

The proof that δ^{σ}ϵ^{σ} = [[ Q]]_{V}^{σ} is by induction on σ: both the base case and the induction step can be routinely checked pointwise. □

The description of the embedding of L in N is slightly more involved. We make use of the fact that for any object X = [[ σ]]_{N} we can embed X_{⊥} in the object (N_{⊥} → X). Informally, an “element” x : 1 → X_{⊥} can be represented by a “function” x′ : N_{⊥} → X. The intuitive idea is as follows: the value of x′ at 0 just flags whether or not x = ⊥, while the value of x′ at 1 determines x assuming x ≠ ⊥. This idea can be made more precise in two stages as follows:

Lemma 6.3.5 (i) For each type σ there exist morphisms s^{σ} : N_{⊥} → C_{N}^{σ} and t^{σ} : C_{N}^{σ} → N_{⊥}, denoted respectively by PCF_{N} term contexts S^{σ}[−] and T^{σ}[−], such that t^{σ}s^{σ} = id_{N_{⊥}}.

(ii) For each type σ there exist morphisms ϕ^{σ} : (C_{N}^{σ})_{⊥} → C_{N}^{ι→σ} and ψ^{σ} : C_{N}^{ι→σ} → (C_{N}^{σ})_{⊥} such that ψ^{σ}ϕ^{σ} = id.

Proof (i) Suppose σ = σ_{1} → ⋯ → σ_{r} → ι. Let Ω^{τ} ≡ μy^{τ}.y, and define term contexts S^{σ}, T^{σ} by

S^{σ}[z^{ι}] ≡ λx_{1}^{σ_{1}} … x_{r}^{σ_{r}}. z, T^{σ}[x^{σ}] ≡ xΩ^{σ_{1}} … Ω^{σ_{r}}.

Take s^{σ} = [[ S^{σ}]]_{N} and t^{σ} = [[ T^{σ}]]_{N}. It is easy to check pointwise that t^{σ}s^{σ} = id.

(ii) Let X = C_{N}^{σ}, and let v^{σ} : X_{⊥} → N_{⊥} be the lift of (X → 1 →^{0} N). Take ϕ^{σ} to be the exponential transpose of the composite

[figure: X_{⊥} × N_{⊥}; ⟨π_{N_{⊥}}, s^{σ}v^{σ}π_{X_{⊥}}, α_{X}π_{X_{⊥}}⟩; N_{⊥} × X × X; cond_{X}; X.]

For ψ^{σ}, let m : Y ↣ (N_{⊥} → X) be the Σ-mono obtained as the pullback of η_{N} along [[ λf^{ι→σ}. T^{σ}[f0] ]]_{N}, and let ψ^{σ} classify the partial map (m, eval ∘ (m × k_{1})) : (N_{⊥} → X) ⇀ X. It is easy to check pointwise that ψ^{σ}ϕ^{σ} = id. □

Proposition 6.3.6 (Embedding L in N) For each type σ, define σ̃ by

ι̃ = ι, { \atop σ → τ} = ι → σ̃ → τ̃.

Then for each type σ there exist morphisms ζ^{σ} : C_{L}^{σ} → C_{σ} ; N and ξ^{σ} : C_{σ} ; N → C_{L}^{σ} such that ξ^{σ}ζ^{σ} = id. Moreover, there is a context R^{σ}[−] of PCF_{N} denoting ζ^{σ}ξ^{σ}.

Proof Let ζ^{ι} = ξ^{ι} = id_{N_{⊥}}; define ζ^{σ→τ} to be the composite

[figure: (C_{L}^{σ} → C_{L}^{τ})_{⊥}; ((ζ^{τ})^{ξ^{σ}})_{⊥}; (C_{σ} ; N → C_{τ} ; N)_{⊥}; ϕ^{_{σ}→_{τ}}; (N_{⊥} → (C_{σ} ; N → C_{τ} ; N);]

and define ξ^{σ→τ} to be the composite

[figure: (N_{⊥} → (C_{σ} ; N → C_{τ} ; N); ψ^{_{σ}→_{τ}}; (C_{σ} ; N → C_{τ} ; N)_{⊥}; ((ξ^{τ})^{ζ^{σ}})_{⊥}; (C_{L}^{σ} → C_{L}^{τ})_{⊥}.]

Using the above lemma it is easy to check that ξ^{σ}ζ^{σ} = id for all σ. Now define the term contexts R^{σ}[−] of PCF_{N} as follows:

R^{ι}[x_{ι}] ≡ x,
R^{σ→τ}[x{ \atop σ→τ}] ≡ conv (T^{_{σ}→_{τ}}[x0]) (λz^{ι}. cond z (S[0]) (λy_{σ}. R^{τ}[x1(R^{σ}[y])])),

where conv ≡ (λp^{ι}q{ \atop σ→τ}. cond pqq). Again we can prove by induction on σ that ζ^{σ}ξ^{σ} = [[ R]]_{N}^{σ}: the base case is trivial, and the induction step is easily checked pointwise, arguing by cases according to whether [[ T [x0] ]]_{N} = ⊥. □

6.3.2 Translations between variants

We have shown above how each of the three type hierarchies associated with C can be embedded in the others. In this paragraph we define syntactic translations between languages that mirror these embeddings. Specifically, suppose L, L′ are two languages with the same degree of parallelism but with different evaluation mechanisms E, E′, and for each type σ let e^{σ} : C_{E}^{σ} → C_{E′}^{σ′} be the embedding defined above. Our task is to establish the following generic theorem:

Theorem 6.3.7 There is a syntactic translation M ↦ M′ from terms of L to terms of L′ such that

(i) if M : σ then M′ : σ′;

(ii) if M : σ is a closed L-term then [[ M′]]_{E′} = e^{σ} ∘ [[ M ]]_{E}.

As in the previous paragraph, we will prove our generic theorem in three instances—the remaining instances then follow by composing translations.

We first give a translation from call-by-value to lazy PCF, corresponding to the embeddings β^{σ} of the previous paragraph. This translation is not novel: it is essentially identical to one given by Riecke [83], who attributes it to Ong [67].

Definition 6.3.8 (Translating V to L) Recall that \overline{σ} = σ for all σ. The translation M ↦ \overline{M} from PCF_{V}^{++}-terms to PCF_{L}^{++}-terms is defined inductively as follows:

\overline{x^{σ}} ≡ P^{σ}[x\overline{σ}]  \overline{n} ≡ n
\overline{succ M} ≡ succ \overline{M}  \overline{pred M} ≡ pred \overline{M}
\overline{cond MNP} ≡ cond \overline{M} \overline{N} \overline{P}  \overline{MN} ≡ \overline{M} \overline{N}
\overline{λx^{σ}.M} ≡ λx\overline{σ}. conv x \overline{M}  \overline{μx^{σ}.M} ≡ μx\overline{σ}. \overline{M}
\overline{por MN} ≡ por \overline{M} \overline{N}  \overline{exists M} ≡ exists \overline{M}

Note at once that this restricts to give translations PCF_{V} → PCF_{L} and PCF_{V}^{+} → PCF_{L}^{+}, and that if M : σ then \overline{M} : \overline{σ}. We wish to show that [[ \overline{M} ]]_{L} = β^{σ} ∘ [[ M ]]_{V} for all closed M : σ. In order to establish this, we in fact need to prove a more general result for open terms. Given an environment Γ = ⟨x_{1}^{σ_{1}}, …, x_{m}^{σ_{m}}⟩, let us write \overline{Γ} for the environment ⟨x\overline{σ_{1}} ; 1, …, x\overline{σ_{m}} ; m⟩, and β^{Γ}, γ^{Γ} respectively for the morphisms

β^{σ_{1}} × ⋯ × β^{σ_{m}} : [Γ]_{V} → [\overline{Γ}]_{L}, γ^{σ_{1}} × ⋯ × γ^{σ_{m}} : [\overline{Γ}]_{L} → [Γ]_{V} .

The relationship between the translation and the embedding may then be expressed as follows. Here we use L as a meta-variable ranging over the lexical tokens PCF, PCF^{+}, PCF^{++}.

Proposition 6.3.9 Suppose C supports L, and M : σ is a term of L_{V} in environment Γ. Then the following diagram commutes:

[figure: [Γ]_{V}; [M]_{V}^{Γ}; [[ σ]]_{V}; [\overline{Γ}]_{L}; γ^{Γ}; [\overline{M}]\overline{Γ} ; L; [[ \overline{σ}]]_{L}; β^{σ}]

In particular, if M is closed then [[ \overline{M} ]]_{L} = β^{σ} ∘ [[ M ]]_{V}.

Proof By induction on the structure of M. If x^{σ} is a variable then by Proposition 6.3.3 we have

β^{σ} ∘ [x]_{V}^{Γ} ∘ γ^{Γ} = β^{σ} ∘ γ^{σ} ∘ [x]\overline{Γ} ; L = [P^{σ}[x]]\overline{Γ} ; L.

The cases corresponding to n, succ and pred are trivial: for instance, for succ we just need to observe that succ ∘ β^{ι} = β^{ι} ∘ succ. For cond it is enough to verify that

cond ∘ (β^{ι} × β^{σ} × β^{σ}) = β^{σ} ∘ Cond.

But this is easily checked pointwise, by cases according to whether the first component is ⊥, k_{0} or k_{n+1}. (Note that every morphism 1 → N_{⊥} is of one of these forms since C is standard.)

For the case corresponding to application, it suffices to check that

[xy]\overline{Δ} ; L ∘ β^{Δ} = β^{τ} ∘ [xy]_{V}^{Δ},

where Δ = ⟨x^{σ→τ}, y^{σ}⟩. But

[xy]\overline{Δ} ; L ∘ β^{Δ} = eval ∘ (α × id) ∘ (β^{σ→τ} × β^{σ})
= eval ∘ ((α ∘ ((β^{τ})^{γ^{σ}})_{⊥} ∘ strict_{⊥}) × β^{σ})
= eval ∘ ((β^{τ})^{γ^{σ}} × β^{σ}) ∘ ((strict ∘ α) × id)
= β^{τ} ∘ eval ∘ ((strict ∘ α) × id)
= β^{τ} ∘ [xy]_{V}^{Δ}.

For the case corresponding to λ-abstraction, suppose M is a term in environment Γ, x^{σ} for which the proposition holds. Then

[\overline{λx^{σ}.M}]\overline{Γ} ; L = η ∘ curry (conv ∘ ⟨π\overline{σ}, [\overline{M}]\overline{Γ,x} ; L⟩)
= η ∘ strict ∘ (C\overline{τ} ; L)^{η} ∘ curry (β^{τ} ∘ [M]_{V}^{Γ,x} ∘ (γ^{Γ} × γ^{σ}))
= η ∘ strict ∘ (C\overline{τ} ; L)^{η} ∘ (β^{τ})^{γ^{σ}} ∘ curry ([M]_{V}^{Γ,x}) ∘ γ^{Γ}
= ((β^{τ})^{γ^{σ}})_{⊥} ∘ strict_{⊥} ∘ η ∘ (C_{V}^{τ})^{η} ∘ curry ([M]_{V}^{Γ,x}) ∘ γ^{Γ}
= β^{σ→τ} ∘ [λx^{σ}.M]_{V}^{Γ} ∘ γ^{Γ}.

For the case corresponding to the fixed point operator, we first show that fix∘(β^{σ})^{γ^{σ}} = β^{σ} ∘fix for any σ. This can be checked pointwise as follows: given any f : C_{V}^{σ} → C_{V}^{σ} we have that fix∘(β^{σ})^{γ^{σ}} ∘\overline{f} is a Σ-limit of \{(β^{σ} ∘f ∘γ^{σ})^{k} ∘⊥ | k ≥ 0\}, and β^{σ} ∘ fix ∘ \overline{f} is a Σ-limit of \{β^{σ} ∘ f^{k} ∘ ⊥ | k ≥ 0\}. But for each k we have (β^{σ} ∘ f ∘ γ^{σ})^{k} ∘ ⊥ = β^{σ} ∘ f^{k} ∘ γ^{σ} ∘ ⊥ = β^{σ} ∘ f^{k} ∘ ⊥ (note that γ^{σ} ∘ ⊥ ⪯_{Σ} γ^{σ} ∘ β^{σ} ∘ ⊥ and so γ^{σ}∘⊥ = ⊥). Thus by Proposition 5.4.12 we have fix∘(β^{σ})^{γ^{σ}}∘\overline{f} = β^{σ}∘fix∘\overline{f} as required. Now suppose M is a term in environment Γ, x^{σ} for which the proposition holds. Then

[\overline{μx^{σ}.M}]\overline{Γ} ; L = fix ∘ curry ([\overline{M}]\overline{Γ,x} ; L)
= fix ∘ (β^{σ})^{γ^{σ}} ∘ curry ([M]_{V}^{Γ,x}) ∘ γ^{Γ}
= β^{σ} ∘ fix ∘ curry ([M]_{V}^{Γ,x}) ∘ γ^{Γ}
= β^{σ} ∘ [μx^{σ}.M]_{V}^{Γ} ∘ γ^{Γ}.

The case corresponding to por is trivial. For exists, it suffices to show that

[exists x]\overline{x} ; L ∘ β^{(ι→ι)→ι} = β^{ι} ∘ [exists x]_{V}^{x} .

But this can be checked pointwise, by cases according to whether [exists x]_{V} is k_{0}, k_{n+1} or ⊥. This completes the induction. The specialization to closed terms is immediate. □

The results for the other two translations follow a very similar pattern. We next give a translation from call-by-name to call-by-value, corresponding to the embeddings δ^{σ}.

Definition 6.3.10 (Translating N to V) Recall that ι̂ = ι → ι, { \atop σ → τ} = σ̂ → τ̂. The translation M ↦ M̂ from PCF_{N}^{++} to PCF_{V}^{++} is defined as follows:

x̂^{σ} ≡ Q^{σ}[x_{σ}]
n̂ ≡ λz^{ι}.n
{ \atop succ M} ≡ λz^{ι}. succ (M̂0)
{ \atop pred M} ≡ λz^{ι}. pred (M̂0)
{ \atop cond MNP} ≡ λx_{σ_{1}} ; 1 … x_{σ_{r}} ; r.λz^{ι}. cond (M̂0) (N̂x_{1} … x_{r}y) (P̂x_{1} … x_{r}y)
M̂N ≡ M̂N̂
{ \atop λx^{σ}.M} ≡ λx_{σ}.M̂
{ \atop μx^{σ}.M} ≡ μx_{σ}.M̂
{ \atop por MN} ≡ λz^{ι}. por (M̂0) (N̂0)
{ \atop exists M} ≡ λz^{ι}. exists (λf^{ι→ι}. M̂(λg^{ι→ι}.λw^{ι}. f(g0))0)

(where in the clause for cond we have N, P : σ_{1} → ⋯ → σ_{r} → ι).

Remark 6.3.11 A different translation from PCF_{N} to PCF_{V} appears in Riecke [83]. Our translation is in some sense structurally simpler, since at the level of types Riecke’s translation gives ι′ = ι → ι, (σ → τ)′ = ι → (σ′ → τ′).

Note as before that our translation restricts well to PCF and PCF^{+}, and that if M : σ then M̂ : σ̂. If Γ is an environment we define Γ̂, δ^{Γ}, ϵ^{Γ} in the obvious way by analogy with \overline{Γ}, β^{Γ}, γ^{Γ}. The following proposition now gives the relationship between the translation and the embedding. Since the proof is very similar in outline to that of Proposition 6.3.9, we omit many of the details and concentrate on the points at which it differs.

Proposition 6.3.12 Suppose C supports L, and M : σ is a term of L_{N} in environment Γ. Then [M̂]_{Γ} ; V = δ^{σ} ∘ [M]_{N}^{Γ} ∘ ϵ^{Γ}. In particular, if M is closed then we have [[ M̂]]_{V} = δ^{σ} ∘ [[ M ]]_{N}.

Proof By induction on M. The case for variables is as before. The cases for n, succ and pred are easy: for instance, for succ we just check pointwise that [λz^{ι}. succ (−0)]_{V} ∘δ^{ι} = δ^{ι} ∘succ. The cond case is somewhat delicate. Suppose σ = σ_{1} → ⋯ → σ_{r} → ι. First check by induction on σ that δ^{σ} ∘⊥ = [[ λx_{1} … x_{r}z.Ω^{ι}]]_{V} and that δ^{σ} = [[ λx_{1} … x_{r}z. − x_{1} … x_{r}z]]_{V} ∘ δ^{σ}; we can then verify pointwise that

[{ \atop cond x y y′}]_{V}^{x,y,y′} ∘ (δ^{ι} × δ^{σ} × δ^{σ}) = δ^{σ} ∘ cond,

arguing by cases according to whether the first component is ⊥, k_{0} or k_{n+1}.

For the application case, let Δ = ⟨x^{σ→τ}, y^{σ}⟩ as before. Then we have

[xy]_{Δ} ; V ∘ δ^{Δ} = eval ∘ ((strict ∘ α) × id) ∘ (δ^{σ→τ} × δ^{σ})
= eval ∘ (δ′^{σ→τ} × δ′^{σ})
= η ∘ eval ∘ ((δ′^{τ})^{ϵ′^{σ}} × δ′^{σ})
= η ∘ δ′^{τ} ∘ eval = δ^{τ} ∘ [xy]_{N}^{Δ}.

For the λ-abstraction case, we have

[{ \atop λx^{σ}.M}]_{Γ} ; V = η ∘ (C_{τ})^{η} ∘ curry (δ^{τ} ∘ [M]_{N}^{Γ,x} ∘ ϵ^{Γ,x})
= η ∘ (δ^{τ})^{ϵ′^{σ}} ∘ curry ([M]_{N}^{Γ,x}) ∘ ϵ^{Γ}
= δ^{σ→τ} ∘ [λx^{σ}.M]_{N}^{Γ} ∘ ϵ^{Γ}.

The case for the fixed point operator is precisely similar to the corresponding case in Proposition 6.3.9; and the case for por is easy. For exists it suffices to verify that

[{ \atop exists x}]_{x} ; V ∘ δ^{(ι→ι)→ι} = δ^{ι} ∘ [exists x]_{N}^{x}.

It is tedious but straightforward to check this pointwise, by cases according to the value of [exists x]_{N}. □

Finally we give a translation from lazy to call-by-name PCF, corresponding to the embeddings ζ^{σ}. Here we make use of the contexts S^{σ}, T^{σ} defined in Lemma 6.3.5. The idea behind this translation appears to be new.

Definition 6.3.13 (Translating L to N) Recall ι̃ = ι, { \atop σ → τ} = ι → σ̃ → τ̃. The translation M ↦ M̃ from PCF_{L}^{++} to PCF_{V}^{++} is defined as follows:

x̃^{σ} ≡ R^{σ}[x_{σ}]
ñ ≡ n
{ \atop succ M} ≡ succ M̃
{ \atop pred M} ≡ pred Ñ
{ \atop cond MNP} ≡ cond M̃ Ñ P̃
M̃N ≡ M̃ 1 Ñ
{ \atop λx^{σ}.M} ≡ λz^{ι}. cond z (S^{_{σ}→_{τ}}[0]) (λx_{σ}.M̃)
{ \atop conv MN} ≡ λx_{τ_{1}} ; 1 … x_{τ_{r}} ; r. conv (T^{σ}[M̃]) (Ñx_{1} … x_{r})
{ \atop μx^{σ}.M} ≡ μx_{σ}.M̃
{ \atop por MN} ≡ por M̃ Ñ
{ \atop exists M} ≡ exists (λf^{ι→ι}. M̃ 1 (λz^{ι}. cond z (S^{ι→ι}[0]) f))

(where in the clause for conv we have M : σ, N : τ_{1} → ⋯ → τ_{r} → ι and conv ≡ (λpq. cond pqq) ).

Again our translation restricts well to PCF and PCF^{+}, and if M : σ then M̃ : σ̃. Defining Γ̃, ζ^{Γ}, ξ^{Γ} in the obvious way, we have the following relationship between the translation and the embedding.

Proposition 6.3.14 Suppose C supports L, and M : σ is a term of L_{L} in environment Γ. Then [M̃]_{Γ} ; N = ζ^{σ} ∘ [M]_{L}^{Γ} ∘ ξ^{Γ}. In particular, if M is closed then we have [[ M̃]]_{N} = ζ^{σ} ∘ [[ M ]]_{L}.

Proof By induction on M. The cases for variables, numerals, succ, pred and cond are precisely similar to the corresponding cases of Proposition 6.3.9. For application, taking Δ = ⟨x^{σ→τ}, y^{σ}⟩ we have

[x 1 y]_{Δ} ; N ∘ ζ^{Δ} = eval ∘ ⟨eval ∘ ⟨π{ \atop σ→τ}, k_{1}⟩, π_{σ}⟩ ∘ (ζ^{σ→τ} × ζ^{σ})
= eval ∘ ((eval ∘ ⟨ϕ^{_{σ}→_{τ}} ∘ ((ζ^{τ})^{ξ^{σ}})_{⊥}, k_{1}⟩) × ζ^{σ})
= eval ∘ ((α ∘ ((ζ^{τ})^{ξ^{σ}})_{⊥}) × ζ^{σ})
= ζ^{τ} ∘ eval ∘ (α × id) = ζ^{τ} ∘ [xy]_{L}^{Δ}.

For λ-abstraction we have

[{ \atop λx^{σ}.M}]_{Γ} ; N = curry_{N_{⊥}} (cond ∘ ⟨π_{N_{⊥}}, s^{_{σ}→_{τ}} ∘ k_{0} ∘ u, curry ([M̃]{ \atop Γ,z^{ι},x} ; N)⟩)
= ϕ^{_{σ}→_{τ}} ∘ η ∘ curry (ζ^{τ} ∘ [M]_{L}^{Γ,z,x} ∘ ξ^{Γ,z,x})
= ϕ^{_{σ}→_{τ}} ∘ ((ζ^{τ})^{ξ^{σ}})_{⊥} ∘ η ∘ curry ([M]_{L}^{Γ,z,x}) ∘ ξ^{Γ}
= ζ^{σ→τ} ∘ [λx^{σ}.M]_{L}^{Γ} ∘ ξ^{Γ}.

For conv, suppose τ = τ_{1} → ⋯ → τ_{r} → ι. We wish to show that

[{ \atop conv x y}]{ \atop x^{σ},y^{τ}} ; N ∘ (ζ^{σ} × ζ^{τ}) = ζ^{τ} ∘ conv;

we do this by checking that these morphisms agree on all global elements ⟨x, y⟩. If x = ⊥ then [[ T^{σ}]]_{N} ∘ ζ^{σ} ∘ x = ⊥ and so we have

[{ \atop conv x y}]_{N}^{x,y} ∘ (ζ^{σ}x × ζ^{τ}y) = ⊥ = ζ^{τ} ∘ ⊥ = ζ^{τ} ∘ conv ∘ ⟨x, y⟩.

Otherwise we have [[ T^{σ}]]_{N} ∘ ζ^{σ} ∘ x ≠ ⊥ and so

[{ \atop conv x y}]_{N}^{x,y} ∘ (ζ^{σ}x × ζ^{τ}y) = [λx_{1} … x_{r}. yx_{1} … x_{r}]_{N}^{y} ∘ ζ^{τ} ∘ y

= ζ^{τ} ∘ y = ζ^{τ} ∘ conv ∘ ⟨x, y⟩.

The cases for μ and por are exactly analogous to the corresponding cases in Proposition 6.3.9. For exists we need to show that [{ \atop exists x}]_{x} ; N ∘ζ^{(ι→ι)→ι} = ζ^{ι}∘[exists x]_{L}^{x}; this can be checked pointwise using a case split as before. □

Remark 6.3.15 Note that this last translation is not functional in the sense of Riecke [83]—indeed he proves (in effect) that there can be no functional translation from PCF_{L} to PCF_{N}. This is essentially because the definition of functional translation requires that there should be a term-context D[−] such that M̃N and D[M̃]Ñ are observationally equivalent for all M, N, and also M ⇓ iff D[M̃] ⇓; whereas (under Riecke’s conventions) all PCF_{N}-terms of higher type converge. Riecke concludes that PCF_{N} is in some sense less expressive than PCF_{L} and PCF_{V}.

In our view, however, the above translation is a perfectly respectable one, and it is the definition of functional translation that is somewhat unnatural. In particular, it seems arbitrary to insist that the context D[−] used in translating applications should be the same as the context used for performing observations on translated terms. It seems that under a minor modification of Riecke’s definition the above translation is indeed “functional”.

6.4 Full abstraction and universality

We now apply the above results to obtain theorems concerning fully abstract and universal models for our languages. We first recall some standard definitions:

Definition 6.4.1 (Full abstraction) Suppose L is one of our nine languages, and C is a PCF-model supporting L.

(i) If M, N : σ are terms of L, we say M, N are observationally equivalent (and write M ≈ N or M ≈_{L} N) if for all contexts D[−] : ι with hole of type σ and no other free variables we have

D[M] ⇓ n ⟺ D[N] ⇓ n.

(ii) We say the interpretation of L in C is (equationally) fully abstract if for all closed terms M, N : σ we have

M ≈ N ⟹ [[ M ]] = [[ N ]].

The converse implication [[ M ]] = [[ N ]] ⇒ M ≈ N holds automatically since our interpretation of L is compositional. The reader may like to check that (for each of our languages) we obtain an equivalent definition of full abstraction if we omit the word “closed” in the above; however, the definition we have given is slightly more convenient for our purposes. The next definition is also fairly standard:

Definition 6.4.2 (Universality) Suppose L is one of our languages and C supports L. We say the interpretation of C in L is universal if, for each type σ, every morphism 1 → C_{L}^{σ} is of the form [[ M ]] for some closed term M : σ of L.

Again it is an easy exercise to check that this is equivalent to the following condition involving open terms: For each type σ and environment Γ, every morphism [[ Γ ]] → [[ σ]] is of the form [[ M ]]^{Γ} for some term M : σ in environment Γ.

The following relationship between these two notions is well-known:

Proposition 6.4.3 Suppose C is a well-pointed PCF-model supporting L. If the interpretation of L in C is universal then it is fully abstract.

Proof By induction on types. We prove the result for the call-by-value case, the other two cases being similar but easier. At type ι the result is trivial, since if M ≈ N then M ⇓ n ⇔ N ⇓ n and so [[ M ]] = [[ N ]]. So assume the result holds at type τ and suppose we have M, N : σ → τ such that M ≈ N. First, if M ⇑ then also N ⇑ and we have [[ M ]] = [[ N ]] = ⊥. Otherwise M ⇓ and N ⇓, so there exist f, g : V_{V}^{σ} → C_{V}^{τ} such that [[ M ]] = η ∘ \overline{f} and [[ N ]] = η ∘ \overline{g}. It suffices to show that f ∘ x = g ∘ x for all x : 1 → V_{V}^{σ}. Given x, we may take P : σ such that [[ P ]] = η ∘ x. Then [[ MP ]] = f ∘ x and [[ NP ]] = g ∘ x. But we have MP ≈ NP and so [[ MP ]] = [[ NP ]] by the induction hypothesis. □

We will show in this section that from the point of view of full abstraction and universality the three evaluation mechanisms may be regarded as “equivalent”. More specifically:

Theorem 6.4.4 Suppose C is a standard PCF-model; suppose also that L_{1}, L_{2} are two languages with the same degree of parallelism, and that C supports L_{1}, L_{2}. Then

(i) C is fully abstract for L_{1} iff it is fully abstract for L_{2};

(ii) C is universal for L_{1} iff it is universal for L_{2}.

We prove this theorem by chasing round the triangle given by our three translations: we use the translation from L_{L} to L_{N} to show that if C is fully abstract for L_{L} then it is fully abstract for L_{N}, and so on. In order to achieve this, however, we need some rather technical lemmas, asserting (for instance) that if we compose our embeddings β, δ, ζ going round the triangle then the composite morphism is definable by a term context of the appropriate language. Since fully formal proofs of all these lemmas would be very tedious, and the lemmas themselves are so unsurprising, the proofs we give will be somewhat condensed. On a first reading, the reader is advised to skip the proofs of these lemmas completely and to concentrate on the proof of Proposition 6.4.6.

6.4.1 The definability lemmas

We start by using the translation from N to V to relate full abstraction and universality properties for L_{V} and L_{N}. The appropriate definability lemma is the following:

Lemma 6.4.5 Let σ^{∗} = ((σ̂)–) . Then (omitting some superscripts) the composites ζβδ : C_{N}^{σ} → C_{N}^{σ^{∗}} and ϵγξ : C_{N}^{σ^{∗}} → C_{N}^{σ} are denotable by contexts of PCF_{N}. Proof First note that

ι^{∗} = ι → ι → ι, (σ → τ)^{∗} = ι → σ^{∗} → τ^{∗}.

Write Φ^{σ} = ζβδ : C_{N}^{σ} → C_{N}^{σ^{∗}} and Ψ^{σ} = ϵγξ : C_{N}^{σ^{∗}} → C_{N}^{σ}. We will inductively define contexts X^{σ}[−], Y^{σ}[−] such that [[ X^{σ}]]_{N} = Φ^{σ} and [[ Y^{σ}]]_{N} = Ψ^{σ}. For the base case, take

X^{ι}[x^{ι}] ≡ λz^{ι}. cond z (λw^{ι}.0) (λw^{ι}. conv w x),
Y^{ι}[y^{ι→ι→ι}] ≡ conv (y 0 0) (y 1 0).

It is easy to check pointwise that these have the required properties. For X^{σ→τ}, first check that Φ^{σ→τ} is equal to the composite

[figure: C_{N}^{σ→τ}; (Φ^{τ})^{Ψ^{σ}}; C_{N}^{σ^{∗}→τ^{∗}}; ϕ^{σ^{∗}→τ^{∗}} ∘ η; C_{N}^{ι→σ^{∗}→τ^{∗}}.]

But the two morphisms here are denoted respectively by the contexts

A[x^{σ→τ}] ≡ λy^{σ^{∗}}. X^{τ}[x(Y^{σ}[y])], B[x^{σ^{∗}→τ^{∗}}] ≡ λz^{ι}. cond z (S^{σ^{∗}→τ^{∗}}[0]) x.

So taking X^{σ→τ}[−] ≡ B[A[−]] gives a context with the desired property. Likewise for Y^{σ→τ}, first check that Ψ^{σ→τ} is equal to the composite

[figure: C_{N}^{ι→σ^{∗}→τ^{∗}}; α ∘ ψ^{σ^{∗}→τ^{∗}}; C_{N}^{σ^{∗}→τ^{∗}}; (Ψ^{τ})^{Φ^{σ}}; C_{N}^{σ→τ}.]

These two morphisms are denoted respectively by

\begin{matrix}B′[x^{(σ→τ)^{∗}}] ≡ λy^{σ^{∗}}.λz_{1} … z_{r}. conv (T^{σ^{∗}→τ^{∗}}[x0])(x 1 y z_{1} … z_{r}), \\ A′[x^{σ^{∗}→τ^{∗}}] ≡ λy^{σ}. Y^{τ}[x(X^{σ}[y])]. \end{matrix}

So the context Y^{σ→τ}[−] ≡ A′[B′[−]] has the desired property. □

Once we have this definability lemma, the relationships between the programming languages follow for quite general reasons. Here again, L stands for one of the tokens PCF, PCF^{+}, PCF^{++}.

Proposition 6.4.6 (i) If C is fully abstract for L_{L} then it is fully abstract for L_{N}. (ii) If C is universal for L_{L} then it is universal for L_{N}.

Proof (i) Assume C is fully abstract for L_{L}, and suppose M, N : σ are closed terms of L_{N} with M ≈ N. Let M′ ≡ (M̂)–, N′ ≡ (N̂)– and σ′ = (σ̂)–. We will first show that M′ ≈ N′ in L_{L}. Suppose D[−] : ι is a context of L_{L} with hole of type σ′. Since the translation ∼: L_{L} → L_{N} is compositional, there is clearly a context D̃[−] of L_{N} such that D̃[P̃] ≡ { \atop D[P]} for all P : σ′ in L_{V}. So by Proposition 6.3.14 we have [[ D̃[P̃] ]]_{N} = ζ^{ι} ∘ [[ D[P] ]]_{L} = [[ D[P] ]]_{L} since ζ^{ι} = id. Now suppose X^{σ}[−] denotes ζβδ as in the above lemma, and let E[−] ≡ D̃[X[−]]; then since M ≈ N we have

[[ D[M′] ]]_{L} = [[ E[M] ]]_{N} = [[ E[N] ]]_{N} = [[ D[N′] ]]_{L}

since M ≈ N and E[M], E[N] are of type ι. Hence, by the adequacy theorem for L_{L}, we have D[M′] ⇓ n iff D[N′] ⇓ n. Thus M′ ≈ N′. But now since C is fully abstract for L_{L} we have [[ M′]]_{L} = [[ N′]]_{L}, and so using Propositions 6.3.3 and 6.3.4 we have

[[ M ]]_{N} = ϵγβδ ∘ [[ M ]]_{N} = ϵγ ∘ [[ M′]]_{L} = ϵγ ∘ [[ N′]]_{L} = [[ N ]]_{N}.

(ii) Assume C is universal for L_{L}. Given a morphism x : 1 → C_{N}^{σ}, let y = βδ ∘ x and take M : σ′ in L_{L} such that [[ M ]]_{L} = y. Then [[ M̃]]_{N} = ζ ∘ y by Proposition 6.3.14. Now suppose Y^{σ}[−] denotes ϵγξ as in the lemma. Then

[[ Y [M̃] ]]_{N} = ϵγξζ ∘ y = ϵγ ∘ y = x. □

Next we prove that a similar relationship holds between L_{N} and L_{V} —for this we need a lemma asserting that certain morphisms are definable in L_{V}. However, we have to work slightly harder to obtain this lemma than we did for Lemma 6.4.5. First we need the following sublemma, which says essentially that under the embedding of C_{N}^{σ} in V _{σ} ; V the morphisms ϕ^{σ}, ψ^{σ} can be “simulated” by morphisms ϕ̂^{σ}, ψ̂^{σ}:

Lemma 6.4.7 For each type σ, there exist morphisms ϕ̂^{σ}, ψ̂^{σ} such that the following squares commute:

[figure: (C_{N}^{σ})_{⊥}; ϕ^{σ}; (N_{⊥} → C_{N}^{σ}); (C_{N}^{σ})_{⊥}; ψ^{σ}; (N_{⊥} → C_{N}^{σ}); (V _{σ} ; V)_{⊥}; ^{δ′{σ \atop ⊥}}; ϕ̂^{σ}; (N_{⊥} → V _{σ} ; V); (δ′^{σ})^{N_{⊥}}; (V _{σ} ; V)_{⊥}; ^{ϵ′{σ \atop ⊥}}; ψ̂^{σ}; (N_{⊥} → V _{σ} ; V); (ϵ′^{σ})^{N_{⊥}}]

Moreover, ϕ̂^{σ}, ψ̂^{σ} are “essentially denotable” in PCF_{V}, in the sense that there are contexts Z^{σ}[−_{σ}, −^{ι}] and W^{σ}[−^{ι→_{σ}}] of PCF_{V} such that

\begin{aligned}η^{N_{⊥}} ∘ ϕ̂^{σ} & = & curry_{N_{⊥}} ([[ Z^{σ}]]_{V}) & : C_{V}^{σ} → (N_{⊥} → C_{σ} ; V), \\ ψ̂^{σ} & = & [[ W^{σ}]]_{V} ∘ η ∘ (η^{η}) & : (N_{⊥} → V _{σ} ; V) → C_{σ} ; V. \end{aligned}

Proof Suppose σ = σ_{1} → ⋯ → σ_{r} → ι. First define contexts Ŝ^{σ}[−], T̂^{σ}[−] by

Ŝ^{σ}[z^{ι}] ≡ λx_{σ_{1}} ; 1 … x_{σ_{r}} ; r. λy^{ι}.z,  T̂^{σ}[x_{σ}] ≡ x (Ŝ^{σ_{1}}Ω^{ι}) … (Ŝ^{σ_{r}}Ω^{ι}) 0.

Clearly there are unique morphisms ŝ^{σ} : N_{⊥} → V _{σ} ; V and t̂^{σ} : V _{σ} ; V → N_{⊥} such that [[ Ŝ^{σ}]] = η ∘ ŝ^{σ} and [[ T̂^{σ}]] ∘ η = t̂^{σ}. It is easily checked that

ŝ^{σ} = δ′^{σ} ∘ s^{σ},  t̂^{σ} = t^{σ} ∘ ϵ′^{σ},  t̂^{σ} ∘ ŝ^{σ} = id_{N_{⊥}}.

Now define contexts Z^{σ} and W^{σ} by

Z^{σ}[x_{σ}, z^{ι}] ≡ λx_{1} … x_{r}.λy^{ι}. cond z (T̂^{σ}[x]) (xx_{1} … x_{r}y),
W^{σ}[x^{ι→_{σ}}] ≡ conv′ (T̂^{σ}[x 0]) (λy. x 1 y)

where conv′ ≡ (λpq.q); and let ϕ̂^{σ}, ψ̂^{σ} be the morphisms determined by the above two equations. Then it is straightforward to check pointwise that the two squares commute. □

Lemma 6.4.8 Let σ^{+} = ((\overline{σ}) ) . Then the composites δζβ : C_{V}^{σ} → C_{V}^{σ^{+}} and γξϵ : C_{V}^{σ^{+}} → C_{V}^{σ} are denotable by contexts of PCF_{V}. Proof First note that ι^{+} = ι → ι and (σ → τ)^{+} = (ι → ι) → σ^{+} → τ^{+}. Write Φ^{σ} = δζβ, Ψ^{σ} = γξϵ, Φ′^{σ} = δ′ζβ and Ψ′^{σ} = γξϵ′. We will inductively define contexts X^{σ}, Y^{σ} denoting Φ^{σ}, Ψ^{σ} respectively. For the base case, take

X^{ι}[x^{ι}] ≡ λz^{ι}.x, Y^{ι}[y^{ι→ι}] ≡ y 0.

It is easy to see that these have the required properties. For X^{σ→τ}, we first check via a diagram-chase involving the previous lemma that Φ^{σ→τ} is equal to the composite

[figure: C_{V}^{σ→τ}; strict_{⊥}; (C_{V}^{σ} → C_{V}^{τ})_{⊥}; ((Φ^{τ})^{Ψ′^{σ}})_{⊥}; C_{V}^{ρ} ⋯]
[figure: ⋯; η^{N_{⊥}} ∘ ϕ̂^{ρ}; (N_{⊥} → C_{V}^{ρ}); η ∘ (C_{V}^{ρ})^{ϵ′^{ι}}; C_{V}^{(σ→τ)^{+}}.]

where ρ = σ^{+} → τ^{+}. But here the composites of the first two and the last two morphisms are denoted respectively by the contexts

A[x^{σ→τ}] ≡ conv′ x (λy^{σ^{+}}. X^{τ}[x(Y^{σ}[y])]), B[x^{ρ}] ≡ λf^{ι→ι}. Z^{ρ}[x, f0]

with Z^{ρ} as in the previous lemma. Thus X^{σ→τ}[−] ≡ B[A[−]] denotes Φ^{σ→τ}. Likewise for Y^{σ→τ}, we check via a diagram-chase that Ψ^{σ→τ} is equal to the composite

[figure: C_{V}^{(σ→τ)^{+}}; (C_{V}^{ρ})^{δ′^{ι}} ∘ α; (N_{⊥} → C_{V}^{ρ}); ψ̂^{ρ} ∘ α^{N_{⊥}}; C_{V}^{ρ} ⋯; ⋯; ((Ψ^{τ})^{Φ′^{σ}})_{⊥}; (C_{V}^{σ} → C_{V}^{τ})_{⊥}; ((C_{V}^{τ})^{η})_{⊥}; C_{V}^{σ→τ}.]

Here the composites of the first two and the last two morphisms are denoted respectively by the contexts

B′[x^{(σ→τ)^{+}}] ≡ W^{ρ}[λz^{ι}. x(λy^{ι}.z)], A′[x^{ρ}] ≡ conv′ x (λy^{σ}. Y^{τ}[x(X^{σ}[y])]).

Thus Y^{σ→τ}[−] ≡ A′[B′[−]] denotes Ψ^{σ→τ}. □

We can now obtain the result for L_{N} and L_{V} analogous to Proposition 6.4.6:

Proposition 6.4.9 (i) If C is fully abstract for L_{N}, it is fully abstract for L_{V}.

(ii) If C is universal for L_{N}, it is universal for L_{V}. Proof (i) The proof of Proposition 6.4.6(i) works with just one small modification. Recall that there we exploited the fact that ι̃ = ι and ζ^{ι} = id. But here we have ι̂ = ι → ι. However, we do have [[ −0 ]]_{V} ∘ δ^{ι} = id_{N_{⊥}}, and so at the corresponding juncture in the proof we have [[ D̂[P̂] 0 ]]_{V} = [[ D[P] ]]_{N}. Thus we need to define E[−] ≡ D̂[X[−]] 0, and the rest of the proof works as before.

(ii) Exactly similar to the proof of Proposition 6.4.6(ii). □

Finally we prove the corresponding relationship between L_{V} and L_{L}. In this case, to obtain the appropriate definability lemma we need both Lemma 6.4.7 and a further sublemma:

Lemma 6.4.10 For each type σ, there exist morphisms \overline{ϕ̂}^{σ}, \overline{ψ̂}^{σ} such that the following squares commute:

[figure: C_{σ} ; V; η^{N_{⊥}} ∘ ϕ̂^{σ}; (N_{⊥} → C_{σ} ; V); C_{σ} ; V; ψ̂^{σ} ∘ α^{N_{⊥}}; (N_{⊥} → C_{σ} ; V); C\overline{_{σ}} ; L; β_{σ}; \overline{ϕ̂}^{σ}; (N_{⊥} → C\overline{_{σ}} ; L); (β_{σ})^{N_{⊥}}; C\overline{_{σ}} ; L; γ_{σ}; \overline{ψ̂}^{σ}; (N_{⊥} → C\overline{_{σ}} ; L); (γ_{σ})^{N_{⊥}}]

Moreover, the morphisms η ∘ \overline{ϕ̂}^{σ} : C\overline{_{σ}} ; L ⟶ C_{L}^{ι→\overline{_{σ}}} and \overline{ψ̂}^{σ} ∘ α : C_{L}^{ι→\overline{_{σ}}} ⟶ C\overline{_{σ}} ; L are denotable by contexts \overline{Z}^{σ}, \overline{W}^{σ} of PCF_{L} respectively. Proof Suppose σ̂ = ν_{1} → ⋯ → ν_{r} → ι. First define contexts \overline{Ŝ}^{σ}[−], \overline{T̂}^{σ}[−] by

\overline{Ŝ}^{σ}[z^{ι}] ≡ λx\overline{ν_{1}} ; 1. conv x_{1} (… (λx\overline{ν_{r}} ; r. conv x_{r} z) …),
\overline{T̂}^{σ}[x\overline{_{σ}}] ≡ x (\overline{Ŝ}^{ν_{1}}Ω^{ι}) … (\overline{Ŝ}^{ν_{r}}Ω^{ι}).

and let \overline{ŝ}^{σ} = [[ \overline{Ŝ}^{σ}]]_{L}, \overline{t̂}^{σ} = [[ \overline{T̂}^{σ}]]_{L}. It is easy to check that

\overline{ŝ}^{σ} = β_{σ} ∘ η ∘ ŝ^{σ},  \overline{t̂}^{σ} = t̂^{σ} ∘ α ∘ γ_{σ},  \overline{t̂}^{σ} ∘ \overline{ŝ}^{σ} = id_{N_{⊥}}.

Now define contexts \overline{Z}^{σ} and \overline{W}^{σ} by

\overline{Z}^{σ}[x\overline{_{σ}}] ≡ λz^{ι}.λx_{1}.conv x_{1}(… (λx_{r}.conv x_{r}(cond z(\overline{T̂}^{σ}[x])(xx_{1} … x_{r}))) …),
\overline{W}^{σ}[x^{ι→\overline{_{σ}}}] ≡ conv (\overline{T̂}^{σ}[x 0]) (λy. x 1 y),

and let \overline{ϕ̂}^{σ}, \overline{ψ̂}^{σ} be the morphisms determined by the equations η ∘ \overline{ϕ̂}^{σ} = [[ \overline{Z}^{σ}]]_{L} and \overline{ψ̂}^{σ} ∘ α = [[ \overline{W}^{σ}]]_{L}. Then it is routine to check pointwise that the above squares commute. □

Lemma 6.4.11 Let σ^{!} = ((σ̃) )–. Then the composites βδζ : C_{L}^{σ} → C_{L}^{σ^{!}} and ξϵγ : C_{L}^{σ^{!}} → C_{L}^{σ} are denotable by contexts of PCF_{L}.

Proof First note that ι^{!} = ι → ι and (σ → τ)^{!} = (ι → ι) → σ^{!} → τ^{!}. Let Φ^{σ} = βδζ, Ψ^{σ} = ξϵγ; we will construct contexts X^{σ}, Y^{σ} denoting Φ^{σ}, Ψ^{σ} respectively. First define

X^{ι}[x^{ι}] ≡ λz^{ι}. conv z x, Y^{ι}[y^{ι→ι}] ≡ y 0.

It is easy to check that these have the required properties. For X^{σ→τ}, a routine diagram-chase involving Lemmas 6.4.7 and 6.4.10 shows that Φ^{σ→τ} is equal to the composite

[figure: C_{L}^{σ→τ}; ((Φ^{τ})^{Ψ^{σ}})_{⊥}; C_{L}^{ρ}; η ∘ \overline{ϕ̂}^{(_{σ}→_{τ})}; C_{L}^{ι→ρ}; strict_{⊥} ∘ ((C_{L}^{ρ})^{e_{0}})_{⊥}; C_{L}^{(σ→τ)^{!}}]

where ρ = σ^{!} → τ^{!} and e_{0} : (N_{⊥})^{N_{⊥}} → N_{⊥} is given by evaluation at zero. But the three morphisms here are denoted respectively by the contexts

conv − (λy^{σ^{!}}. X^{τ}[−(Y^{σ}[y])]),  \overline{Z}^{σ}[−],  conv − (λf^{ι→ι}. − (f 0)).

So by composing these we get a context X^{σ→τ} denoting Φ^{σ→τ}. For Y^{σ→τ}, a similar diagram-chase shows that Ψ^{σ→τ} is equal to the composite

[figure: C_{L}^{(σ→τ)^{!}}; ((C_{L}^{ρ})^{η∘K})_{⊥}; C_{L}^{ι→ρ}; \overline{ψ̂}^{(_{σ}→_{τ})} ∘ α; C_{L}^{ρ}; ((Ψ^{τ})^{Φ^{σ}})_{⊥}; C_{L}^{σ→τ}]

where K : N_{⊥} → (N_{⊥})^{N_{⊥}} is the “constant” morphism. But these three morphisms are denoted respectively by the contexts

conv − (λz^{ι}. − (λy^{ι}.z)),  \overline{W}^{σ}[−],  conv − (λy^{σ}. Y^{τ}[−(X^{σ}[y])]).

So composing these we get a context Y^{σ→τ} as required. □

We thus obtain the following relationship between L_{V} and L_{L}:

Proposition 6.4.12 (i) If C is fully abstract for L_{V}, it is fully abstract for L_{L}. (ii) If C is universal for L_{V}, it is universal for L_{L}.

Proof The proof is exactly similar to that of Proposition 6.4.6. (Note that we have \overline{ι} = ι and β^{ι} = id, so the extra twist required in the proof of Proposition 6.4.9(i) is not needed here.) □

The proof of Theorem 6.4.4 is now complete.

6.4.2 A more abstract approach

The results in this section and the last show that our three evaluation mechanisms are equivalently powerful in some sense. However, our proofs using syntactic translations have been rather messy, and we would anticipate that our results could be presented more cleanly in abstract categorical terms.

One idea would be as follows. Given a language L, it should be possible to construct a “syntactic PCF-model” C(L) for L, whose objects are freely generated from 1 and N using products, exponentials and lifting, and whose morphisms are generated by the terms of L. One would then expect to be able to show that the canonical interpretation of L in C(L) was universal, both in the sense of Definition 6.4.2 and in the sense that adequate interpretations of L in D corresponded precisely to functors C(L) → D preserving the PCF-model structure. (This is analogous to the situation in categorical logic, where interpretations of a theory T in a category D correspond to certain functors C(T) → D, where C(T) is the classifying model for T —see e.g. [24].) Moreover, the translations L_{1} → L_{2} of the previous section should induce functors C(L_{1}) → C(L_{2}), and the contexts X^{σ}, Y^{σ} given in this section should give rise to natural transformations.

Now suppose that L_{1}, L_{2} have the same degree of parallelism. Then on the grounds of Theorem 6.2.11 we would conjecture that C(L_{1}) ≃ C(L_{2}) holds (for the right definition of C(L)!) The “equivalence” of the evaluation mechanisms, then, would be expressed by saying that they generate the same syntactic category. (Again this is analogous to categorical logic, where different presentations of a theory give rise to the same classifying model.) Furthermore, universal interpretations of L correspond to full functors C(L) → D, and so Theorem 6.4.4(ii) would also drop out as a corollary.

In general we would not expect the interpretation of L in C(L) to be fully abstract, since C(L) would not be well-pointed. However, we would expect that C(L) could be extensionally collapsed to a well-pointed PCF-model C_{0}(L) that furnished a fully abstract interpretation of L. Thus Theorem 6.4.4(i) would emerge as a corollary of the fact that C_{0}(L_{1}) ≃ C_{0}(L_{2}).

Examples of realizability models

This chapter continues our investigation of interpretations of PCF-like languages in realizability models. In Chapter 6 we developed a general categorical theory of such interpretations; in this chapter we focus on some specific examples and applications of the theory. We have already seen in Section 5.3 many concrete examples of PCFmodels of the form Mod(A); the emphasis in the present chapter is on special properties of particular models. Specifically, our interest is in finding models that provide fully abstract or universal interpretations of particular programming languages.

In obtaining such results as these, it turns out that we can save a great deal of work by showing how certain classical categories of domains can be embedded in realizability models. Using these embeddings, known full abstraction and universality results for the classical categories can be transferred directly to the realizability models. We begin in Section 7.1 by reviewing some standard results from classical domain theory—the material here is culled from [79,80]. In Section 7.2 we show that the category of effective domains can be fully embedded in Mod(K_{1}), and hence that Mod(K_{1}) provides a universal model for PCF^{++}. The results here may be seen as reformulations of results of McCarty (see [60,59]). In Section 7.3 we obtain similar results for Mod(Pω_{re}), and discover a sense in which this is mathematically a “better” model than Mod(K_{1}). We also show that the classical category of Scott domains (without effective structure) can be fully embedded in Mod(Pω), illustrating how one version of classical domain theory may be recovered as an instance of synthetic domain theory. The results in this section appear to be new.

Section 7.4 is independent of the other three—here we consider models of the form Mod(Λ^{0}/T). We conjecture that these provide universal (and hence fully abstract) models of sequential PCF, although we have been unable to prove this. However, we obtain some partial results in this direction; we also discuss a strategy for proving the conjecture and some of the difficulties that arise.

7.1 Review of classical domain theory

In this section we recall the standard material from classical domain theory that we will need. We define the category Dom of (Scott) domains and its subcategory EDom of effective domains, and discuss the interpretations of PCF-like languages in these categories. Readers familiar with Plotkin’s paper [79] may skim this section.

7.1.1 Domains and continuous maps

We first introduce the classical category Dom of domains and continuous maps. It is this category that is implicitly used in [79] for the denotational semantics of PCF. We start with some basic notions:

Definition 7.1.1 (DCPO) Suppose (D, ⊑) is a partially ordered set.

(i) A subset S ⊆ D is directed if S ≠ ∅ and for all x, y ∈ S there exists z ∈ S such that x ⊑ z, y ⊑ z.

(ii) We say (D, ⊑) is a (pointed) directed-complete partial order (DCPO) if D has a least element ⊥ and every directed subset S ⊆ D has a least upper bound in D (denoted ⨆ S).

(iii) A function f : D → E between DCPOs is a continuous map if for all directed S ⊆ D we have f(⨆ S) = ⨆{f(x) | x ∈ S}.

We write x ⊔ y for ⨆{x, y} when this exists; we also write x ↑ y to mean that x, y are bounded above (i.e. there exists z ∈ D such that x ⊑ z, y ⊑ z). The above definition gives us the category DCPO of DCPOs and continuous maps. This is already a good enough category for many purposes; however, in order to address questions of full abstraction and definability it is convenient to consider a somewhat smaller category. For this we require a few more definitions.

Definition 7.1.2 (Finite element) Suppose (D, ⊑) is a DCPO. An element d ∈ D is finite if whenever S ⊆ D is directed and d ⊑ ⨆ S we have d ⊑ x for some x ∈ S. For each x ∈ D we write F_{x} for the set of finite elements d ⊑ x in D.

The finite elements of D are elsewhere called the compact or isolated elements. One intuition (loosely) is that they are the elements that give only a “finite amount of information”. It is easy to see that if x, y are finite then x⊔y is finite if it exists. We now consider DCPOs for which the finite elements form a “basis”:

Definition 7.1.3 (Algebraic DCPO) A DCPO D is called algebraic if for all x ∈ D the set F_{x} is directed and ⨆ F_{x} = x. We say D is ω-algebraic if D is algebraic and has only countably many finite elements altogether.

It is not hard to see that an algebraic DCPO is determined up to isomorphism by the poset of its finite elements. Moreover, a continuous map between algebraic DCPOs is completely determined by what it does to the finite elements. The countability condition will come into its own in the next paragraph, when we will consider “effective” analogues of the notions introduced here.

There is one further condition on DCPOs that we need:

Definition 7.1.4 (Consistent completeness) A DCPO D is consistently complete if whenever x, y ∈ D and x ↑ y then x ⊔ y exists.

If D is consistently complete and d_{1}, …, d_{n} are finite elements of D with an upper bound in D, clearly ⨆{d_{1}, …, d_{n}} exists and is a finite element. (Thus the set F_{x} is automatically directed for any x ∈ D.) We now put all the above definitions together:

Definition 7.1.5 A Scott domain is a consistently complete, ω-algebraic DCPO. We write Dom for the category of Scott domains and continuous maps.

Henceforth we shall refer to Scott domains simply as domains. The following proposition gives us what we need to know about the structure of Dom. We give a sketch of the proof, since explicit descriptions of the structure will be useful later.

Proposition 7.1.6 (i) The DCPO N_{⊥} (the lifted natural numbers) is a domain; (ii) The category Dom is cartesian-closed; (iii) For every domain D there is a continuous map fix_{D} : D^{D} → D such that

for any f ∈ D^{D} the element fix_{D}(f) is the least fixed point of the map f.

Proof (Sketch.) (i) is trivial.

(ii) The terminal object is the one-element domain. The product of domains D_{1}, D_{2} is just their product as posets; The finite elements of D_{1} × D_{2} are precisely the elements of the form (d_{1}, d_{2}), where d_{i} is a finite element of D_{i}. One can easily check that D_{1} × D_{2} is indeed a domain, that the projections are continuous maps and that a pairing of continuous maps is a continuous map. For the exponential E^{D} of domains, take the set of continuous maps D → E equipped with the pointwise ordering. Given finite elements d, e of D, E respectively, let us write d ⇒ e for the continuous map D → E given by

(d ⇒ e)(x) = \{ \begin{matrix}e & if d ⊑ x \\ ⊥ & otherwise. \end{matrix}

It can be shown that the finite elements of E^{D} are precisely the existing finite lubs of elements of the form d ⇒ e where d, e are finite, and hence that E^{D} is indeed a domain. (The details are given in Section 4 of [79].) It is easy to check that the evaluation map E^{D} × D → E is continuous, and that currying a continuous map yields a continuous map.

(iii) Define fix_{D} : D^{D} → D by

fix_{D}(f) = ⨆{f^{k}(⊥) | k ≥ 0}.

It is easy to check that fix_{D}(f) is the least fixed point of f, and that the map fix_{D} is continuous. □

7.1.2 Effective domains

The category Dom gives us a clean mathematical setting for denotational semantics, in which the topological idea of continuity serves as a substitute for computability. However, for some purposes we wish to know what maps between domains are actually computable, not merely continuous. One way to make precise the idea of a computable map is to dirty our hands by adding in some “effective” structure to Dom. The key observation is that since continuous maps between domains are determined by their action on finite elements, it suffices to supply effective enumerations of the finite elements of each domain.

Definition 7.1.7 (Effective domain) (i) An enumerated domain consists of a domain D together with a set-theoretic function ν : N → D whose image consists of precisely the finite elements of D.

(ii) An effective domain is an enumerated domain (D, ν) such that the relations ν(m) ↑ ν(n) and ν(m) = ν(n) ⊔ ν(p) are decidable (that is, recursive in m, n, p).

(iii) A computable map between effective domains (D, ν) and (E, ν′) is a continuous map f : D → E such that the relation ν′(n) ⊑ f(ν(m)) is semi-decidable (that is, r.e. in m, n). We write EDom for the category of effective domains and computable maps.

It is easy to see that in an effective domain (D, ν) the relation ν(m) ⊑ ν(n) is decidable, and that there is a binary partial recursive function φ such that ν(m) ⊔ ν(n) = ν(φ(m, n)) whenever ν(m) ↑ ν(n). We will sometimes abuse language and say “D is an effective domain” omitting mention of the enumeration. The following notion is closely related to the idea of computable map:

Definition 7.1.8 (R.e. element) Given an element x of an effective domain (D, ν), define the support of x to be the set supp(x) = {n | ν(n) ⊑ x}. We say x is an r.e. element of D if supp(x) is r.e. We write D_{re} for the set of r.e. elements of D.

We think of the r.e. elements as the “computable” elements of an effective domain. It is easy to see that a map 1 → D is computable iff the corresponding element of D is r.e., and hence that a continuous map D → E is computable iff the corresponding element of E^{D} is r.e.

We write U : EDom → Dom for the obvious “forgetful” functor—note that U is trivially faithful. We now show that EDom has all the structure described in Proposition 7.1.6 for Dom, and that U preserves this structure. Again we give a sketch of the proof—for more details see Chapter 7 of [80].

Proposition 7.1.9 (i) The domain N_{⊥} can be equipped with a (standard) effective enumeration ν_{0};

(ii) The category EDom is cartesian-closed, and its cartesian-closed structure is inherited from Dom;

(iii) For any effective domain (D, ν), the continuous map fix_{D} : D → D is computable. Proof (Sketch.) (i) Note that all the elements of N_{⊥} are finite. We take the standard enumeration ν_{0} to be given by ν_{0}(0) = ⊥, ν_{0}(n) = n + 1; the enumerated domain (N_{⊥}, ν) is then clearly effective.

(ii) The terminal object of Dom can trivially be made into an effective domain, and for any effective domain D the unique map D → 1 is computable. For products, suppose (D_{1}, ν_{1}) and (D_{2}, ν_{2}) are effective domains. Take some recursive and surjective pairing function (−; −) : N × N → N, and let π_{1}, π_{2} : N → N be the corresponding (recursive) projections. Define an enumeration ν of the finite elements of D_{1} × D_{2} by ν((n_{1}; n_{2})) = (ν_{1}(n_{1}), ν_{2}(n_{2})). It is routine to check that this enumeration is effective, that the projection maps are computable, and that a pairing of computable maps is a computable map.

For exponentials, suppose (D, ν) and (E, ν′) are effective domains. Let […] be some recursive and surjective coding function for finite subsets of N (cf. Section 3.3), and define an enumeration ρ of the finite elements of E^{D} by

ρ([(m_{1}; n_{1}), …, (m_{j}; n_{j})]) = \{ \begin{matrix}⨆_{1≤i≤j}ν(m_{i}) ⇒ ν′(n_{i}) & if this exists \\ ⊥ & otherwise. \end{matrix}

It can be shown that given [(m_{1}; n_{1}), …, (m_{j}; n_{j})] it is decidable whether the lub ⨆_{1≤i≤j} ν(m_{i}) ⇒ ν′(n_{i}) exists; hence we can check that ρ is an effective enumeration.

Moreover, it can be checked that the evaluation map E^{D} × D → E is computable, and that currying a computable map yields a computable map.

(iii) Suppose f : D → D is any computable map and e is a recursive index for the set {(m; n) | ν(n) ⊑ f(ν(m))}. One can check that the set I_{k} = {n | ν(n) ⊑ f^{k}(⊥)} is r.e. uniformly in e and k. Thus the set supp(fix_{D}(f)) = ⋃ I_{k} is r.e. uniformly in e, and so the map fix_{D} is computable. □

7.1.3 Interpretation of PCF^{++}

Although the categories Dom and EDom are not PCF-models in the sense of Chapter 6, they can be used to give interpretations of the language PCF_{N}^{++}. In this paragraph we describe these interpretations and summarize the results obtained by Plotkin in [79].

We will write [[ −]] for the interpretation of PCF_{N}^{++} in EDom, and [[ −]]′ for its interpretation in Dom. The interpretations of PCF types are given by

\begin{matrix}[[ ι]] = (N_{⊥}, ν_{0}), & [[ σ → τ ]] = [[ τ ]]^{[[ σ]]}, \\ [[ ι]]′ = N_{⊥}, & [[ σ → τ ]]′ = [[ τ ]]′^{[[ σ]]′} \end{matrix}

where ν_{0} is the standard enumeration for N_{⊥} given above. Since U preserves exponentials, these are related by [[ σ]]′ = U([[ σ]]). Given an environment Γ = ⟨x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}}⟩, we define

[[ Γ ]] = [[ σ_{1} ]] × ⋯ × [[ σ_{n}]], [[ Γ ]]′ = [[ σ_{1} ]]′ × ⋯ × [[ σ_{n}]]′.

If M : σ is a term in environment Γ, its interpretation [[ M ]]^{Γ} will be a morphism [[ Γ ]] → [[ σ]] in EDom. Likewise, the interpretation [[ M ]]′^{Γ} will be a morphism [[ Γ ]]′ → [[ σ]]′ in Dom.

In order to define [[ M ]]^{Γ}, we first define continuous maps

k_{n,D} : D → N_{⊥} (n ∈ N)
succ, pred : N_{⊥} → N_{⊥}
cond_{D} : N_{⊥} × D × D → D
por : N_{⊥} × N_{⊥} → N_{⊥}

in the obvious way (cf. Paragraph 6.2.1). It is easy to check that these maps are computable, and so they may be regarded as morphisms in either Dom or EDom. We also define a map exists : (N_{⊥}^{N_{⊥}} → N_{⊥}) → N_{⊥} by

exists(F) = \{ \begin{matrix}0 & if F (k_{n,N_{⊥}}) = 0 for some n \\ 1 & if F (⊥) = m + 1 for some m \\ ⊥ & otherwise. \end{matrix}

Again it is easy to check that this map is computable.

We can now give the definition of [[ M ]]^{Γ} by induction on the structure of M. The definition is formally almost identical to the one appearing in Section 6.2:

[[ x_{i}^{σ_{i}}]]^{Γ} = π_{i}
[[ n]]^{Γ} = k_{n[[ Γ ]]}
[[ succ M ]]^{Γ} = succ ∘ [[ M ]]^{Γ}
[[ pred M ]]^{Γ} = pred ∘ [[ M ]]^{Γ}
[[ cond MNP ]]^{Γ} = cond_{[[ σ]]} ∘ ⟨[[ M ]]^{Γ}, [[ N ]]^{Γ}, [[ P ]]^{Γ}⟩
[[ μx^{σ}.M ]]^{Γ} = fix_{[[ σ]]} ∘ curry_{[[ σ]]}([[ M ]]^{Γ,x^{σ}})
[[ λx^{σ}.M ]]^{Γ} = curry_{[[ σ]]}([[ M ]]^{Γ,x^{σ}})
[[ MN ]]^{Γ} = eval ∘ ⟨[[ M ]]^{Γ}, [[ N ]]^{Γ}⟩
[[ por MN ]]^{Γ} = por ∘ ⟨[[ M ]]^{Γ}, [[ N ]]^{Γ}⟩
[[ exists M ]]^{Γ} = exists ∘ [[ M ]]^{Γ}

The definition of [[ M ]]′^{Γ} is given in exactly the same way. Since U preserves all the structure that we have used in giving the definition, we have [[ M ]]′^{Γ} = U([[ M ]]^{Γ}).

The following properties of these interpretations were proved by Plotkin in [79]. Theorem 7.1.12 was also discovered independently by Sazonov [86]. From our point of view these results are extremely useful as they allow us to bypass a great deal of technical work involving PCF_{N}^{++}.

Theorem 7.1.10 (Adequacy for PCF^{++}) Suppose M : ι is a closed PCF_{N}^{++} term. Then M ⇓ n iff [[ M ]] = k_{n,1} iff [[ M ]]′ = k_{n,1}. Thus [[ −]], [[ −]]′ are adequate interpretations of PCF_{N}^{++}.

Theorem 7.1.11 (Full abstraction for PCF^{+}) Suppose M, N : σ are closed terms of PCF_{N}^{+}. Then M ≈PCF_{N}^{+} N iff [[ M ]] = [[ N ]] iff [[ M ]]′ = [[ N ]]′. Thus [[ −]], [[ −]]′ give fully abstract interpretations of PCF_{N}^{++}.

Theorem 7.1.12 (Universality for PCF^{++}) Suppose x is an element of the effective domain [[ σ]]. Then the corresponding map 1 → [[ σ]] is denotable by a closed term M : σ of PCF_{N}^{++} iff x is an r.e. element. Hence the interpretation [[ −]] of PCF_{N}^{++} in EDom is universal.

Remark 7.1.13 We should point out that our language PCF_{N}^{++} differs from the language considered by Plotkin in a few technical respects. Perhaps most significantly, his language has an extra ground type o corresponding to the booleans, and the types for cond and exists are modified accordingly. He also incorporates a “zero testing” operation; the conditional operator is provided only for ground types; and in place of our por he has a “parallel conditional” operation. There are other minor differences: for instance, in his formulation the expression pred 0 diverges. However, the reader familiar with [79] will readily agree that these differences do not matter for the purposes of the above theorems, and only trivial modifications of Plotkin’s proofs are needed to yield these results for our language.

7.2 The model Mod(K_{1})

In this section we show that our category EDom admits a full, faithful and cartesian-closed embedding into Mod(K_{1}), the usual category of PERs. Combining this fact with the above results of Plotkin, we are able to obtain various universality and full abstraction results for Mod(K_{1}). Our embedding is essentially the same as the one discovered by McCarty [60,59]. However, McCarty’s setting is superficially different from ours: he considers the category of effectively given information systems and shows that it embeds fully in a model of intuitionistic ZF set theory based on Kleene realizability. In order to keep our exposition self-contained, therefore, we include our own account of this material adapted to our setting. First we introduce a useful piece of notation:

Definition 7.2.1 If R ⊆ N is an r.e. set, we write ind(R) for the set of (recursive) indices for R, i.e. the set

ind(R) = {e | Im {e} = R}

(where {e} denotes the partial recursive function coded by e).

Remark 7.2.2 Alternatively we could have taken the set of indices for R to be ind′(R) = {e | Dom {e} = R}. It is easy to see that ind(R) and ind′(R) are “recursively equivalent”, i.e. there exist b, c ∈ K_{1} such that x ∈ ind(R) ⇒ {b}(x) ∈ ind′(R) and y ∈ ind′(R) ⇒ {c}(y) ∈ ind(R).

7.2.1 Embedding EDom in Mod(K_{1})

We now define our embedding G : EDom → Mod(K_{1}) as follows:

Definition 7.2.3 If D is an effective domain with enumeration ν, let GD be the modest set over K_{1} defined by

|GD| = D_{re}, ∥x ∈ GD∥ = ind(supp(x)).

If f : D → E is a computable map between effective domains, let Gf : |GD| → |GE| be the restriction of f to D_{re}.

There are several things to check in connection with this definition. First, note that if x ∈ D_{re} then the set supp(x) is r.e. by definition, so ∥d ∈ GD∥ is non-empty. Secondly, if x, y are distinct elements of D_{re} then the sets supp(x), supp(y) are different, so ∥x ∈ GD∥ ∩ ∥y ∈ GD∥ = ∅; hence the assembly GD is indeed a modest set. Thirdly, if x is r.e. and f is computable then it is easy to see that f(d) is r.e.; hence f does indeed restrict to a function D_{re} → E_{re}. Thus the above definition is sound. Furthermore, we have:

Proposition 7.2.4 The above defines a functor G : EDom → Mod(K_{1}).

Proof Given f : D → E as above, we need to check that the function Gf has a realizer. So suppose D, E are equipped with enumerations ν, ν′ respectively, e is a recursive index for the set {(m; n) | ν′(n) ⊑ f(ν(m))}, and x is an element of D_{re}. Since each ν′(n) is finite, we have ν′(n) ⊑ f(x) iff ν′(n) ⊑ f(ν(m)) for some m ∈ supp(x). Thus

supp(f(x)) = ⋃_{ν(m)⊑x} supp(f(ν(m))).

Hence if r is an index for supp(x), it is easy to see that λ^{∗}z. k (p_{2}(ez)) ((br)(p_{1}(ez))) is an index for supp(f(x)), where b is as in Remark 7.2.2 and p_{1}, p_{2} are codes for the projections π_{1}, π_{2}. Thus Gf is tracked by λ^{∗}rz. k (p_{2}(ez)) ((br)(p_{1}(ez))). Finally it is trivial that G respects identities and composition, so G is a functor. □

In the next few propositions we establish some of the categorical properties of G: that it is full and faithful, and (roughly speaking) preserves all the structure given by Proposition 7.1.9.

Proposition 7.2.5 The functor G is faithful.

Proof Suppose Gf = Gg for f, g : D\overrightarrow{→}E. Then f, g agree on all r.e. elements of D, and so in particular on all finite elements. Thus for a general element x ∈ D we have f(x) = ⨆ f(F_{x}) = ⨆ g(F_{x}) = g(x), and so f = g. □

Proposition 7.2.6 G preserves finite products.

Proof Clearly G(1) ≅ 1. For binary products, note that if (D_{1}, ν_{1}) and (D_{2}, ν_{2}) are effective domains then according to our definitions we have

|G(D_{1} × D_{2})| = |GD_{1} × GD_{2}| = D_{1re} × D_{2re},
∥(x_{1}, x_{2}) ∈ G(D_{1} × D_{2})∥ = ind{(n_{1}; n_{2}) | n_{i} ∈ supp(x_{i})},
∥(x_{1}, x_{2}) ∈ GD_{1} × GD_{2}∥ = {⟨e_{1}, e_{2}⟩ | e_{i} ∈ ind(supp(x_{i}))}.

So the canonical morphism G(D_{1} × D_{2}) → GD_{1} × GD_{2} is tracked by the element λ^{∗}r. ⟨λ^{∗}z.p_{1}(rz), λ^{∗}z.p_{2}(rz)⟩, and its inverse by λ^{∗}rz. q ((fst r)(p_{1}z)) ((snd r)(p_{2}z)) where q codes the pairing function (−; −). Thus G(D_{1} × D_{2}) ≅ GD_{1} × GD_{2}, via an isomorphism that identifies the projections. □

Proposition 7.2.7 The object G(N_{⊥}, ν_{0}) is canonically isomorphic to N_{⊥}, where ⊥ is the lift functor on Mod(K_{1}) arising from the r.e. subobject classifier Σ.

Proof Let N′_{⊥} = G(N_{⊥}, ν_{0}). From our definitions and the description of the lift functor in Proposition 4.2.4, we see that

|N_{⊥}| = |N′_{⊥}| = N ⊔ {⊥},

\begin{matrix}∥n ∈ N_{⊥}∥ = T ∧ (I ⇒ \{n\}), & ∥⊥ ∈ N_{⊥}∥ = U ∧ N, \\ ∥n ∈ N′_{⊥}∥ = ind\{0, n + 1\}, & ∥⊥ ∈ N′_{⊥}∥ = ind\{0\}, \end{matrix}

where T = {m | {m}(0) ↓}, U = {m | {m}(0) ↑} and I = {i}. So the canonical morphism N_{⊥} → N′_{⊥} is tracked by

λ^{∗}rm. if (eq m 0) 0 (k(inc(snd r i))(fst r i)),

where eq codes equality testing and inc codes the successor operation. To give a realizer for the inverse, first take search ∈ K_{1} such that for all r ∈ K_{1} we have

either ∃n. (rn > 0 ∧ search r = rn)
or (¬∃n. rn > 0) ∧ search r↑ .

(Here we exploit the fact that we can compute r0, r1, … “in parallel”.) The canonical morphism N′_{⊥} → N_{⊥} is then tracked by

λ^{∗}r. ⟨λ^{∗}z. search r, λ^{∗}z. dec(search r)⟩,

where dec codes the predecessor operation. □

For the remaining properties of G we have to work rather harder. We need the following result from classical recursion theory—note the close kinship with the Myhill-Shepherdson Theorem (see Theorem 5.3.1).

Theorem 7.2.8 (Rice-Shapiro) Any morphism Σ^{N} → Σ in Mod(K_{1}) is monotone and continuous (i.e. preserves existing lubs of directed sets) with respect to the pointwise order on |Σ^{N}|.

Proof An easy consequence of the classical Rice-Shapiro Theorem as stated in [17, Chapter 7]. □

Lemma 7.2.9 Suppose (D, ν) is an effective domain. Then every morphism ϕ : GD → Σ is monotone and continuous with respect to the order ⊑ on |GD|.

Proof Let us call a set R ⊆ N consistent if {ν(n) | n ∈ R} has an upper bound in D. Clearly R is consistent iff ν(m) ↑ ν(n) for all m, n ∈ R. Since the relation ν(m) ↑ ν(n) is recursive, it is semi-decidable whether an r.e. set R is inconsistent: more formally, there exists t ∈ K_{1} such that for all e we have te ↓ iff Im {e} is inconsistent. Next, if R is consistent, define its directed closure to be the set

\overline{R} = \{ m | ν(m) ⊑ ν(n_{1}) ⊔ … ⊔ ν(n_{j}), n_{1}, … n_{j} ∈ R\}.

Since the relation ν(m) ⊑ ν(n) is recursive and there is a recursive φ such that ν(φ(m, n)) = ν(m) ⊔ ν(n) for all m, n ∈ R, we may effectively obtain \overline{R} from R. More formally, there exists u ∈ K_{1} such that whenever Im {e} is consistent we have ue↓ and Im \{ue\} = \overline{Im \{e\}}.

Now suppose ϕ : GD → Σ is a morphism tracked by r. Clearly if R is r.e. and consistent then \overline{R} = supp(x), where x = ⨆\{ν(n) | n ∈ \overline{R}\} ∈ D_{re}. Thus if R = Im {e} then ue ∈ ∥x ∈ GD∥. We will define a morphism ϕ′ : Σ^{N} → Σ using ϕ. First note that the object Σ^{N} can be presented thus:

|Σ^{N}| = {R ⊆ N | R is r.e.}, ∥R ∈ Σ^{N}∥ = ind(R).

Now define the function ϕ′ : |Σ^{N}| → |Σ| by

ϕ′(R) = \{ \begin{matrix}⊤ & if R is inconsistent \\ ϕ(x) & if R is consistent and \overline{R} = supp(x). \end{matrix}

Note that ϕ′ is tracked by λ^{∗}e. p ⟨λ^{∗}w.te, r(ue)⟩, where p tracks the “parallel convergence” morphism Σ × Σ → Σ.

To see that ϕ is monotone, suppose x_{1}, x_{2} ∈ D_{re} with x_{1} ⊑ x_{2}. Take R_{i} = supp(x_{i}); then R_{1}, R_{2} are r.e. and ϕ′(R_{i}) = ϕ(x_{i}). Moreover R_{1} ⊆ R_{2}, so by the Rice-Shapiro Theorem we have ϕ′(R_{1}) ≤ ϕ′(R_{2}) where ≤ is the evident order on |Σ|; thus ϕ(x_{1}) ≤ ϕ(x_{2}). To see that ϕ is continuous, suppose S ⊆ D_{re} is directed and x is the least upper bound of S in D_{re}. Then it is easy to see that x = ⨆ S in D. Take R_{x} = supp(x) and R_{y} = supp(y) for each y ∈ S; then R_{x} = ⋃_{y∈S} R_{y}. So by the Rice-Shapiro Theorem, ϕ′(R_{x}) = ⊤ iff ϕ′(R_{y}) = ⊤ for some y ∈ S. Thus ϕ(x) = ⊤ iff ϕ(y) = ⊤ for some y ∈ S. This completes the proof. □

Lemma 7.2.10 Suppose (D, ν) is an effective domain.

(i) The order ⊑ on D_{re} coincides with the Σ-order on GD.

(ii) Suppose S ⊆ D_{re} is directed. Then S has a least upper bound x in D_{re} iff S ⊆ |GD| has a Σ-limit x′ in the sense of Definition 5.4.2, and in this case x = x′.

Proof (i) First suppose x_{1} ⊑ x_{2} in D_{re}. Then for any ϕ : GD → Σ we have ϕ(x_{1}) ≤ ϕ(x_{2}) by the above lemma; thus x_{1} ⪯_{Σ} x_{2}. Conversely, if x_{1} ⋢ x_{2} then there exists n such that ν(n) ⊑ x_{1} but not ν(n) ⊑ x_{2}. Define ϕ : GD → Σ by ϕ(x) = ⊤ iff ν(n) ⊑ x. Note that ϕ is tracked by λzw.(bz)n, where b is as in Remark 7.2.2. Now ϕ(x_{1}) = ⊤ and ϕ(x_{2}) = ⊥, thus x_{1} ⪯̸_{Σ} x_{2}.

(ii) First suppose S has a least upper bound x in D_{re}. Then for any ϕ : GD → Σ, by the above lemma we have ϕ(x) = ⊤ iff ϕ(y) = ⊤ for some y ∈ S; thus x is a Σ-limit of S. Now suppose x′ is a Σ-limit of S. Then for all y ∈ S we have y ⪯_{Σ} x′, hence y ⊑ x′ by (i); thus x ⊑ x′ in D where x = ⨆ S. If x ≠ x′, take n such that ν(n) ⊑ x′ but not ν(n) ⊑ x, and as in (i) construct ϕ : GD → Σ such that ϕ(z) = ⊤ iff ν(n) ⊑ z. Then clearly ϕ(x′) = ⊤ but ϕ(y) = ⊥ for all y ∈ S, contradicting the assertion that x′ is a Σ-limit for S. Hence x′ = x. □

Proposition 7.2.11 The functor G is full.

Proof Suppose (D, ν) and (E, ν′) are effective domains, and h : GD → GE is a morphism tracked by r. Then h is monotone with respect to ⪯_{Σ}, and hence with respect to ⊑ by Lemma 7.2.10(i). Hence for every x ∈ D the set h(F_{x}) is directed. So define a function f : D → E by f(x) = ⨆ h(F_{x}). First note that f is monotone: if x ⊑ y then F_{x} ⊆ F_{y} so h(F_{x}) ⊆ h(F_{y}) so f(x) ⊑ f(y). Secondly, f is continuous: if S ⊆ D is directed and x = ⨆ S then

\begin{matrix}f(x) = ⨆ h(F_{x}) = ⨆ h(⋃_{y∈S} F_{y}) = ⨆(⋃_{y∈S} h(F_{y})) \\ = ⨆\{⨆ h(F_{y}) | y ∈ S\} = ⨆ f(S). \end{matrix}

Thirdly, f is computable: since the relation ν(m′) ⊑ ν(m) is recursive, we may construct v ∈ K_{1} such that for each m we have vm↓ and Im {vm} = supp(ν(m)).

Hence vm ∈ ∥ν(m) ∈ GD∥ and so r(vm) ∈ ∥h(ν(m)) ∈ GE∥. But since ν(m) is finite we clearly have h(ν(m)) = f(ν(m)). Hence we have ν′(n) ⊑ f(ν(m)) iff b(r(vm))n↓, where b is as in Remark 7.2.2. Thus the relation ν′(n) ⊑ f(ν(m)) is r.e. in m, n.

It remains to check that Gf = h. Clearly if d ∈ D is finite then f(d) = h(d). For a general element x ∈ D_{re}, note that x = ⨆ F_{x} and so x is a Σ-limit of F_{x} by Lemma 7.2.10(ii); thus h(x) is a Σ-limit of h(F_{x}) and so by Lemma 7.2.10(ii) we have h(x) = ⨆ h(F_{x}) = ⨆ f(F_{x}) = f(x) as required. □

Proposition 7.2.12 G preserves exponentials.

Proof Suppose (D, ν) and (E, ν′) are effective domains. Recall that the r.e. elements of E^{D} are precisely the computable maps D → E; thus since G is full and faithful there is a canonical bijection

|G(E^{D})| = (E^{D})_{re} ≅ Hom(GD, GE) = |GE^{GD}|.

If f : D → E is computable, let graph f = {(m; n) | ν′(n) ⊑ f(ν(m))}. We will show that each of the sets ∥f ∈ G(E^{D})∥, ∥f ∈ GE^{GD}∥ is recursively equivalent to ind(graph f) uniformly in f.

Note that (m; n) ∈ graph f iff (ν(m) ⇒ ν′(n)) ⊑ f iff [(m; n)] ∈ supp(f), since if ρ is the enumeration given in the proof of Proposition 7.1.9 then ρ([(m; n)]) = (ν(m) ⇒ ν′(n)). Take p, q ∈ K_{1} such that pz = [z] and q[z] = z. If r ∈ ∥f ∈ G(E^{D})∥ then clearly λ^{∗}z.p(rz) ∈ ind(graph f), and if e ∈ ind(graph f) then λ^{∗}z.q(ez) ∈ ∥f ∈ G(E^{D})∥. So ∥f ∈ G(E^{D})∥ and ind(graph f) are recursively equivalent.

Next note that if e ∈ ind(graph f) then from the proof of Proposition 7.2.4 we see that λ^{∗}rz. k (p_{2}(ez)) ((br)(p_{1}(ez)) tracks Gf. Conversely, if r tracks Gf then from the proof of Proposition 7.2.11 we see that c(λ^{∗}z. b(r(v(p_{1}z)))(p_{2}z)) ∈ ind(graph f), where b, c are as in Remark 7.2.2 and p_{1}, p_{2} are codes for π_{1}, π_{2}. Thus ind(graph f) and ∥f ∈ GE^{GD}∥ are recursively equivalent. Hence we see that G(E^{D}) ≅ GE^{GD}, via an isomorphism that clearly identifies the evaluation morphisms. □

Finally we will show that G respects the fixed point operators. First recall from Proposition 5.3.2 that Mod(K_{1}) equipped with the r.e. dominance gives a model satisfying the completeness axiom; hence for every useful object X we obtain a morphism fix_{X} as in Section 5.4. Next note that since G(N_{⊥}) ≅ N_{⊥} and G(E^{D}) ≅ GE^{GD}, for each type σ we have G([[ σ]]) ≅ [[ σ]]_{N}, where [[ σ]]_{N} is defined as in Paragraph 6.2.1. Thus we may state the following proposition:

Proposition 7.2.13 For each type σ we have G(fix_{[[ σ]]}) ≅ fix_{[[ σ]]_{N}} via the canonical isomorphisms G([[ σ → σ]]) ≅ [[ σ → σ]]_{N} and G([[ σ]]) ≅ [[ σ]]_{N}.

Proof Let D = [[ σ]]. Since Mod(K_{1}) is well-pointed and G is full, it suffices to check that G(fix(f)) agrees with fix(Gf) for all f : D → D in EDom. It follows from Lemma 7.2.10 that (|GD|, ⊑) and (|[[ σ]]_{N}|, ⪯_{Σ}) are isomorphic as posets. Moreover, G(fix(f)) corresponds to the least fixed point of f with respect to ⊑; and it is easy to see that fix(Gf) corresponds to the least fixed point of Gf with respect to ⪯_{Σ}. Thus the canonical isomorphism identifies G(fix(f)) with fix(Gf). □

The above six propositions may be summarized as follows:

Theorem 7.2.14 (McCarty) The functor G : EDom → Mod(K_{1}) is full, faithful and cartesian-closed, and preserves the object N_{⊥} and the morphisms fix_{[[ σ]]} up to isomorphism. □

7.2.2 Interpreting PCF^{++} in Mod(K_{1})

We can now reap the benefits of all this work. First notice that our interpretation of PCF_{N}^{++} in EDom is related via G to the interpretation in Mod(K_{1}) given by Chapter 6:

Proposition 7.2.15 The PCF-model Mod(K_{1}) supports PCF^{++}. Moreover, for any PCF_{N}^{++} term M : σ in environment Γ, the morphism G[[ M ]]^{Γ} : G[[ Γ ]] → G[[ σ]] is canonically isomorphic to the morphism [[ M ]]_{N}^{Γ} : [[ Γ ]]_{N} → [[ σ]]_{N}.

Proof To see that Mod(K_{1}) supports PCF^{++}, just take por = G([[ por xy]]^{Γ}) (where Γ = ⟨x^{ι}, y^{ι}⟩) and ∃ = G([[ λf^{ι→ι}. exists (λg^{ι→ι}.f(g 0)) ]]). Then it is easy to see that por and ∃ satisfy the equations given in Propositions 6.2.9 and 6.2.10. (This way of defining por and ∃ obviates the need to give explicit realizers for them.) The second clause is straightforward by induction on the structure of M, by comparing the definition of the interpretation in Section 6.2 with that in Paragraph 7.1.3 and noting that G preserves all relevant structure. □

Theorem 7.2.16 (i) The interpretations of PCF_{N}^{+}, PCF_{V}^{+}, PCF_{L}^{+} in Mod(K_{1}) are fully abstract.

(ii) The interpretations of PCF_{N}^{++}, PCF_{V}^{++}, PCF_{L}^{++} in Mod(K_{1}) are universal. Proof (i) Suppose M, N : σ are closed terms of PCF_{N}^{+} with M ≈ N. Then by Theorem 7.1.11 we have [[ M ]] = [[ N ]] in EDom. Hence by the above proposition we have [[ M ]]_{N} = [[ N ]]_{N} in Mod(K_{1}). So the interpretation of PCF_{N}^{+} in Mod(K_{1}) is fully abstract. The corresponding results for PCF_{V}^{+} and PCF_{L}^{+} are now immediate by Theorem 6.4.4(i).

(ii) Let h be any morphism 1 → [[ σ]]_{N} in Mod(K_{1}). Since G is full we may take f : 1 → [[ σ]] in EDom with Gf = h. Now by Theorem 7.1.12 there exists a closed term M : σ of PCF_{N}^{++} with [[ M ]] = f. So by the above proposition we have [[ M ]]_{N} = h. Thus the interpretation of PCF_{N}^{++} in Mod(K_{1}) is universal. The corresponding results for PCF_{V}^{++} and PCF_{L}^{++} follow by Theorem 6.4.4(ii). □

The second half of this theorem is particularly interesting, as it shows that two quite different styles of “computation at higher types” give rise to the same class of partial functionals. To make this precise, let us define a (call-by-name) partial type structure (PTS) to be a family of sets A_{σ}, one for each type σ, together with bijections A_{ι} ≅ N_{⊥} and A_{σ→τ} ≅ A′_{σ→τ} ⊆ [A_{σ}, A_{τ}], where [A_{σ}, A_{τ}] is the settheoretic function space. Then there are natural “application” functions A_{σ→τ} × A_{σ} → A_{τ} for each σ, τ. Moreover, Theorem 7.2.16(ii) immediately yields the following (similar results can also be formulated for PCF_{V}^{++} and PCF_{L}^{++}.)

Corollary 7.2.17 The PTS consisting of PCF_{N}^{++}-terms modulo ≈ is isomorphic to the PTS arising from global elements of the objects [[ σ]]_{N} in Mod(K_{1}). □

Surprisingly, this beautiful result does not seem to have appeared in the literature, although it follows immediately from the known theorems of Plotkin/Sazonov (Theorem 7.1.12) and McCarty (Theorem 7.2.14). Nonetheless, it seems to us to be even more significant from a computational point of view than either of these two results individually. The language PCF_{N}^{++} represents a very extensional style of computation in which functionals are treated as “oracles”—information about a functional can only be obtained by testing it on some argument. By contrast, the functionals arising from global elements in Mod(K_{1}) represent a highly intensional style—computations on functionals really work on their machine-level representation as natural numbers. A functional of type σ → τ is thus given by a recursive index that simply “happens” to behave in an extensional way on codes for functionals of type σ, and a priori it is far from obvious that there is any “extensional” programming language in which all such functionals may be expressed. The above result thus has much the same flavour as the Myhill-Shepherdson Theorem.

The functionals arising from Mod(K_{1}) may be termed the “hereditarily partial effective operations” (HPEOs), since they are the natural “partial” analogue of the hereditarily effective operations (see e.g. [51,99,38]). In view of Church’s Thesis, this PTS arguably has a certain philosophical significance in that it captures the most generous possible notion of “effectively computable functional”. There are in fact many other characterizations of this PTS, contributing to the impression that it is in some sense fundamental. We conclude this paragraph by mentioning some of these, and other related work in the area.

In [20] Ershov defined the “effective finite-type functionals” to be the effectively given elements in the category of f_{0}-spaces, a category very similar to our Dom. As early as 1972 Ershov stated [21] that the category of effective f_{0}-spaces (essentially our EDom) could be fully embedded in the category EN of enumerated sets (a full subcategory of Mod(K_{1})). This result is sometimes known as the Generalized Myhill-Shepherdson Theorem (for a proof see e.g. [31].) Ershov could thus define the “partial computable functionals” to be the partial functionals existing in EN, and showed that they coincided with the effective finite-type functionals. This closely foreshadows McCarty’s result above. However, this definition of the partial computable functionals is arguably less natural than that of the HPEOs, since it is not immediately obvious that EN has the required exponentials.

The category EN has poor closure properties in comparison with Mod(K_{1}). However, Mulry [64] showed that EN could be nicely embedded in the recursive topos—hence the above PTS may also be characterized as the one arising from this topos. Later, Longo and Moggi [54,62] gave another good category extending EN, the category of generalized enumerated sets.

Finally we mention the Hereditarily Partial Effective Functionals (HPEFs) introduced by Longo (see e.g. [55]). These can be defined either for the integer types or for the pure types—the definition is very ingenious, making use of an intermediate type n.5 in order to define type n + 1 from type n. As is shown in [55], the HPEFs correspond precisely to the effective elements of certain f_{0}-spaces. It follows that, if one works with the pure type hierarchy, one obtains essentially the call-by-value type structure arising from Mod(K_{1}). One disadvantage of the HPEF definition is that again it is not immediate that it is well-defined: the definition makes use of certain “pairing” operations at higher types, and it is non-trivial to show that these exist.

7.3 The models Mod(Pω) and Mod(Pω_{re})

In the last section we defined an embedding EDom → Mod(K_{1}), and used it to obtain full abstraction and universality results. In this section we carry out a precisely similar programme for the PCA Pω_{re} (see Section 3.3): we construct a full embedding I : EDom → Mod(Pω_{re}), and hence show that Mod(Pω_{re}) provides a fully abstract model for PCF^{+}, and a universal model for PCF^{++}. Thus we obtain yet another characterization of the HPEOs as the partial type structure arising from Mod(Pω_{re}). Somewhat incidentally, we also obtain a full embedding H : Dom → Mod(Pω), showing that Mod(Pω) provides a fully abstract model for PCF^{+}. (The line of investigation here follows a suggestion by Alex Simpson.)

Although these results hold less philosophical interest than those for K_{1}, mathematically they seem more elegant and their proofs are simpler. Moreover, as a model for PCF^{++}, Mod(Pω_{re}) possesses some good mathematical properties not shared by Mod(K_{1}). In particular, we will see that all the objects corresponding to PCF types are projective (see Section 2.4).

For technical reasons, we will in fact work in this section with the category NDom of enumerated domains and continuous maps (see Definition 7.1.7(i)) rather than Dom. However, it is easy to see that NDom ≃ Dom, either by invoking the axiom of choice or by understanding the countability condition in Definition 7.1.3 in a constructive sense. If (D, ν) is an enumerated domain and x ∈ D, we write supp(x) = {n | ν(n) ⊑ x} (note that this extends Definition 7.1.8 for effective domains). We sometimes write |D| for the underlying set of D.

Throughout this section we take (−; −) and [−, …, −] to be fixed recursive and surjective codings for pairs and finite sets of natural numbers, and take Pω, Pω_{re} to be the PCAs with the corresponding application operation (see Definition 3.3.1).

7.3.1 Embedding EDom in Mod(Pω_{re})

We define embeddings H : NDom → Mod(Pω) and I : EDom → Mod(Pω_{re}) as follows.

Definition 7.3.1 (i) If D is an enumerated domain, let HD be the modest set over Pω defined by |HD| = |D|, ∥x ∈ HD∥ = { supp(x) }. If f : D → E is a continuous map between enumerated domains, let Hf = f : |HD| → |HE|.

(ii) If D is an effective domain, let ID be the modest set over Pω_{re} defined by |ID| = D_{re}, ∥x ∈ ID∥ = { supp(x) }. If f : D → E is a computable map between effective domains, let If : |ID| → |IE| be the restriction of f to D_{re}.

Note that if x, y are distinct elements of D then supp(x) ≠ supp(y), so HD is indeed a modest set. Also if x ∈ D_{re} then supp(x) is r.e. so ID is a modest set over Pω_{re}. Moreover if f is computable then it restricts to a function D_{re} → E_{re}.

Proposition 7.3.2 The above defines functors H : NDom → Mod(Pω) and I : EDom → Mod(Pω_{re}).

Proof Suppose (D, ν), (E, ν′) are enumerated domains and f : D → E is continuous. Let A = {([m]; n) | ν′(n) ⊑ f(ν(m))}. Then A tracks Hf, since given x ∈ D and B ∈ ∥x∥ we have B = {m | ν(m) ⊑ x} and so

A · B = ⋃_{ν(m)⊑x}{n | ν′(n) ⊑ f(ν(m))} = {n | ν′(n) ⊑ f(x)} ∈ ∥f(x)∥.

Thus Hf is indeed a morphism in Mod(Pω). Furthermore, if D, E are effective domains and f is computable then clearly A is r.e. and A tracks If; thus If is a morphism in Mod(Pω_{re}). The fact that H, I preserve identities and composition is trivial. □

Note at once that for any D the objects HD, ID have the following property: for any element x, the set ∥x∥ consists of just one realizer. We will return to this point in the next paragraph. Meanwhile we establish some of the preservation properties of H, I. The proofs here, unlike some of those in Paragraph 7.2.1, are entirely elementary.

Proposition 7.3.3 The functors H, I are full and faithful.

Proof It is trivial that H is faithful, and the proof of Proposition 7.2.5 shows that I is faithful. To see that H is full, suppose h : HD → HE is a morphism tracked by A ∈ Pω. Define f = h : |D| → |E|. Then f is monotone: if x ⊑ y ∈ D and B ∈ ∥x∥, C ∈ ∥y∥ then B ⊆ C so A · B ⊆ A · C; hence h(x) ⊑ h(y) since h(x) = ⨆{ν′(n) | n ∈ A · B} and similarly for y. Also f is continuous: if x = ⨆ S, B_{x} ∈ ∥x∥ and B_{y} ∈ ∥y∥ for each y ∈ S then B_{x} = ⋃_{y∈S} B_{y}; hence A·B_{x} = ⋃ A·B_{y} and so

h(x) = ⨆ ν′(A · B_{x}) = ⨆_{y∈S}(⨆ ν′(A · B_{y})) = ⨆_{y∈S} h(y).

Thus f is a morphism in NDom, and trivially Hf = h.

To see that I is full, suppose h : ID → IE is a morphism tracked by A ∈ Pω_{re}. Define f : |D| → |E| by f(x) = ⨆ h(F_{x}); then f is monotone and continuous exactly as in the proof of Proposition 7.2.11. Furthermore f is computable: note that ν′(n) ⊑ f(ν(m)) iff ([m_{1}, …, m_{j}]; n) ∈ A for some m_{1}, …, m_{j} ∈ supp(ν(m)); but A is r.e. and the relation m′ ∈ supp(ν(m)) is decidable, so the relation ν′(n) ⊑ f(ν(m)) is r.e. in m, n. Thus f is a morphism in EDom. It remains to check that If = h. If x ∈ D is finite then clearly If(x) = ⨆ h(F_{x}) = h(x). More generally if x ∈ D_{re}, take B_{x} ∈ ∥x∥ and B_{y} ∈ ∥y∥ for each y ∈ F_{x}. Then B_{x} = ⋃ B_{y} so

supp(⨆ h(F_{x})) = ⋃_{y∈F_{x}} supp(h(y)) = ⋃_{y∈F_{x}} A · B_{y} = A · B_{x} = supp(h(x)),

and so If(x) = ⨆ h(F_{x}) = h(x); thus If = h as required. □

Proposition 7.3.4 H, I preserve products.

Proof Clearly H(1) ≅ 1 and I(1) ≅ 1. If D_{1}, D_{2} are enumerated domains, clearly we have

|H(D_{1} × D_{2})| = |HD_{1} × HD_{2}| = |D_{1}| × |D_{2}|,
∥(x_{1}, x_{2}) ∈ H(D_{1} × D_{2})∥ = {(n_{1}; n_{2}) | n_{i} ∈ supp(x_{i})},
∥(x_{1}, x_{2}) ∈ HD_{1} × HD_{2}∥ = { ⟨supp(x_{1}), supp(x_{2})⟩ }.

Define pair′, fst′, snd′ ∈ Pω by

pair′ = {([m]; ([n]; (m; n))) | m, n ∈ ω},
fst′ = {([(m; n)]; m) | m, n ∈ ω},
snd′ = {([(m; n)]; n) | m, n ∈ ω}.

Then the evident morphism H(D_{1} ×D_{2}) → HD_{1} ×HD_{2} is tracked by the element λ^{∗}z. pair(fst′ z)(snd′ z), and its inverse is tracked by λ^{∗}z. pair′(fst z)(snd z). Thus H preserves binary products. For I, note that if D_{1}, D_{2} are effective domains then

|I(D_{1} × D_{2})| = |ID_{1} × ID_{2}| = D_{1re} × D_{2re},

and that the realizers for (x_{1}, x_{2}) in I(D_{1} × D_{2}) and ID_{1} × ID_{2} are given by the same formulae as above. Moreover, the sets pair′, fst′, snd′ are clearly r.e., and so just as above we have I(D_{1} × D_{2}) ≅ ID_{1} × ID_{2}. □

Proposition 7.3.5 H, I preserve exponentials.

Proof Suppose (D, ν) and (E, ν′) are enumerated domains. Since H is full and faithful, there is a canonical bijection

|H(E^{D})| = Hom(D, E) ≅ Hom(HD, HE) = |HE^{HD}|.

If f : D → E is continuous, define graph f = {(m; n) | ν′(n) ⊑ f(ν(m))} as before. Then we have

∥f ∈ H(E^{D})∥ = { { [(m_{1}; n_{1}), …, (m_{j}; n_{j})] | (m_{i}; n_{i}) ∈ graph f for each i}},
∥f ∈ HE^{HD}∥ = {A | ∀x ∈ D. A · supp(x) = supp(f(x))}.

Note that if [(m_{1}; n_{1}), …, (m_{j}; n_{j})] ∈ ∥f ∈ H(E^{D})∥ then we also have [(m_{i}; n_{i})] ∈ ∥f ∈ H(E^{D})∥ for each i. Hence it is easy to see that the canonical morphism H(E^{D}) → HE^{HD} is tracked by B = { ([[(m; n)]]; ([m]; n)) | m, n ∈ ω}. For the inverse morphism, suppose A ∈ ∥f ∈ HE^{HD}∥. We first show how to extract graph f from A. Note that (m; n) ∈ graph f iff n ∈ A · supp(ν(m)) iff there exist m_{1}, …, m_{j} ∈ supp(ν(m)) such that ([m_{1}, …, m_{j}]; n) ∈ A. So consider the set

C = { ([([m_{1}, …, m_{j}]; n)] ; (m; n)) | m, n ∈ ω, m_{1}, …, m_{j} ∈ supp(ν(m)) }.

Clearly C · A = graph f. Next, take D = {(p; p) | p ∈ ω}; it is easy to check that D · (graph f) ∈ ∥f ∈ H(E^{D})∥. Thus the canonical morphism HE^{HD} → H(E^{D}) is tracked by λ^{∗}z. D(Cz). Clearly this isomorphism identifies the evaluation morphisms. Thus H preserves exponentials.

For I, suppose (D, ν) and (E, ν′) are effective domains. Since I is full and faithful, there is a canonical bijection

|I(E^{D})| = (E^{D})_{re} ≅ Hom(ID, IE) = |IE^{ID}|.

Moreover the sets B, C, D above are r.e., and so the canonical morphism I(E^{D}) → IE^{ID} is tracked by B, and its inverse by the element λ^{∗}z. D(Cz) of Pω_{re}. Hence I preserves exponentials. □

In the next proposition we regard Mod(Pω) and Mod(Pω_{re}) as equipped with the dominances given by Example 4.3.5. We write ⊥ for the lift functor arising from either of these dominances.

Proposition 7.3.6 We have H(N_{⊥}, ν_{0}) ≅ N_{⊥} in Mod(Pω), and I(N_{⊥}, ν_{0}) ≅ N_{⊥} in Mod(Pω_{re}).

Proof First note that we can conveniently define pairing in Pω and Pω_{re} by ⟨A, B⟩ = {2n | n ∈ A} ∪ {2n + 1 | n ∈ B}; it is easy to see that this is realizably equivalent to the pairing operation given in Proposition 1.1.10(i). Next, by Proposition 3.3.6 we can define the natural number object in Mod(Pω) or Mod(Pω_{re}) by ∥n ∈ N∥ = {{n}}. Hence by Remark 4.2.5(ii) the object N_{⊥} in Mod(Pω) may be defined by

∥n ∈ N_{⊥}∥ = {{0}} ∧ {{n}} = {{0, 2n + 1}}, ∥⊥ ∈ N_{⊥}∥ = {∅} ∧ Pω.

Moreover the object H(N_{⊥}, ν_{0}) is given by ∥n∥ = {{0, n + 1}}, ∥⊥∥ = {{0}}. To see that H(N_{⊥}) ≅ N_{⊥}, note that the evident morphism H(N_{⊥}) → N_{⊥} is tracked by { ([n + 1]; 0), ([n + 1]; 2n + 1) | n ∈ ω} since ∅ ∈ ({∅} ∧ Pω); and its inverse is tracked by { ([ ]; 0) } ∪ { ([0, 2n + 1]; n + 1) | n ∈ ω}. Since these realizers are both r.e. sets, similarly we have I(N_{⊥}, ν_{0}) ≅ N_{⊥}. □

To show that H, I respect the fixed point operators we need the following lemma. Its proof is very similar to that of Lemma 7.2.10.

Lemma 7.3.7 (i) If D is an enumerated domain, the order ⊑ on D coincides with the Σ-order on HD. Likewise if D is an effective domain, the order ⊑ on D_{re} coincides with the Σ-order on ID.

(ii) If S ⊆ D is directed, then S has a least upper bound x iff S ⊆ |HD| has a Σ-limit x′, and then x = x′. Likewise if S ⊆ D_{re} is directed, then S has a least upper bound x in D_{re} iff S ⊆ |ID| has a Σ-limit x′, and then x = x′.

Proof (i) Suppose x ⊑ y in D. Then if A ∈ ∥x ∈ HD∥ and B ∈ ∥y ∈ HD∥ then A ⊆ B. Hence if ϕ : HD → Σ is tracked by C then C · A ⊆ C · B and so ϕ(x) ≤ ϕ(y) in Σ; thus x ⪯_{Σ} y in HD. Conversely, if x ⋢ y then take n ∈ supp(x), n ∉ supp(y), and define ϕ : HD → Σ by ϕ(z) = ⊤ iff n ∈ supp(z) (it is easy to give a realizer for ϕ). Then ϕ(x) = ⊤ and ϕ(y) = ⊥, so x ⪯̸_{Σ} y. The proof for ID is exactly similar—just observe that the morphism ϕ defined above is tracked by an element of Pω_{re}.

(ii) Suppose S has a least upper bound x in D. If A_{x} ∈ ∥x∥ and A_{y} ∈ ∥y∥ for each y ∈ S, then A_{x} = ⋃ A_{y}; hence if ϕ : HD → Σ is tracked by C then C · A_{x} = ⋃ C · A_{y} and so ϕ(x) = ⊤ iff ϕ(y) = ⊤ for some y ∈ S; thus x is a Σ-limit of S. Conversely, if x′ is a Σ-limit of S in HD then for all y ∈ S we have y ⪯_{Σ} x′ and so y ⊑ x by (i); thus x ⊑ x′ where x = ⨆ S. If x ≠ x′ then take n ∈ supp(x), n ∉ supp(x) and construct ϕ as above. Then ϕ(x′) = ⊤ but ϕ(y) = ⊥ for all y ∈ S, a contradiction. Thus x = x′. The proof for ID is precisely similar. □

Now recall from Proposition 5.3.7 that our dominances on Mod(Pω) and Mod(Pω_{re}) satisfy the Completeness Axiom, so we obtain a morphism fix_{X} for every useful X. Next, since H, I both preserve N_{⊥} and exponentials, for any PCF type σ we have H([[ σ]]) ≅ [[ σ]]_{N} in Mod(Pω), and I([[ σ]]) ≅ [[ σ]]_{N} in Mod(Pω_{re}). This enables us to state the following:

Proposition 7.3.8 For each type σ we have H(fix_{[[ σ]]}) ≅ fix_{[[ σ]]_{N}} and I(fix_{[[ σ]]}) ≅ fix_{[[ σ]]_{N}} modulo the canonical isomorphisms.

Proof The proof is precisely similar to that of Proposition 7.2.13, and uses the above lemma. □

The above propositions may be summarized as follows:

Theorem 7.3.9 The functors H : NDom → Mod(Pω) and I : EDom → Mod(Pω_{re}) are full, faithful and cartesian-closed, and preserve the object N_{⊥} and the morphisms fix_{[[ σ]]} up to isomorphism. □

Remark 7.3.10 Although our main interest is in Mod(Pω_{re}), it is a pleasing observation that the category Dom of Scott domains arises as a full sub-CCC of the topos RT(Pω_{re}). In other words, classical domains may legitimately be thought of as “sets” in this realizability topos. This provides a non-trivial instance of how one kind of classical domain theory may be recovered as a special case of synthetic domain theory. It would be interesting to know whether this result extends further: for instance, does the embedding H preserve initial solutions of recursive domain equations?

7.3.2 Interpreting PCF^{++} in Mod(Pω_{re})

We are now in a position to give interpretations of PCF^{++} in Mod(Pω) and Mod(Pω_{re}) exactly as in Paragraph 7.2.2:

Proposition 7.3.11 The PCF-models Mod(Pω) and Mod(Pω_{re}) both support PCF^{++}. Moreover, for any PCF_{N}^{++} term M : σ in environment Γ, the morphisms H[[ M ]]′^{Γ} : H[[ Γ ]] → H[[ σ]] and [[ M ]]_{N} : [[ Γ ]]_{N} → [[ σ]]_{N} are canonically isomorphic in Mod(Pω). Likewise, the morphisms I[[ M ]]^{Γ} and [[ M ]]_{N} are canonically isomorphic in Mod(Pω_{re}).

Proof Precisely similar to the proof of Proposition 7.2.15. □

Theorem 7.3.12 (i) The interpretations of PCF_{N}^{+}, PCF_{V}^{+}, PCF_{L}^{+} in Mod(Pω) and in Mod(Pω_{re}) are fully abstract.

(ii) The interpretations of PCF_{N}^{++}, PCF_{V}^{++}, PCF_{L}^{++} in Mod(Pω_{re}) are universal.

Proof Precisely similar to Theorem 7.2.16. □

Remarks 7.3.13 (i) From Theorem 7.3.12 we thus obtain yet another characterization of the HPEOs (cf. Paragraph 7.2.2) as the partial functionals over N_{⊥} in the category Mod(Pω_{re}).

(ii) It similarly follows from Theorem 7.3.9 that the hierarchy of partial functionals over N in Mod(Pω) coincides with that in Dom. It is an easy exercise in classical domain theory to check that this in turn coincides with the hierarchy of partial functionals in the category of (chain-)CPOs. This answers affirmatively a question posed by Phoa in [75, Section 4].

(iii) As an aside, we note that the hierarchy of total functionals over N in Mod(Pω_{re}) also coincides with that in Mod(K_{1}). Beeson in [10, Section VI.8] mentions that the total functionals in Mod(Pω_{re}) are precisely Kreisel’s “hereditarily recursively continuous functionals”, also known as ECF(Rec); and it is proved in [99, Section 2.6] that these are equivalent to the hereditarily effective operations. Likewise, the total functionals in Mod(Pω) are precisely Kreisel’s “hereditarily continuous functionals”, also known as ECF (this is proved in [12, Chapter 7]). These are in fact the same as Kleene’s “countable functionals”—for a detailed study of this type structure see [37].

We now turn our attention to a property of Mod(Pω) and Mod(Pω_{re}) not shared by Mod(K_{1}): all objects corresponding to PCF types are projective in the sense of Definition 2.4.8. Recall from Proposition 2.4.9 and Remark 2.4.11 that for a modest set X the notions of projectivity in Mod(A), Ass(A) and RT(A) all coincide.

Proposition 7.3.14 Suppose E is one of the three evaluation mechanisms N, V, L (cf. Section 6.3). Then for any type σ, the objects C_{E}^{σ}, V_{E}^{σ} (in both Mod(Pω) and Mod(Pω_{re})) are projective.

Proof We have noted already that all objects of the form HD, ID have the “singleton property”, and hence are projective by Proposition 2.4.10. Thus all the objects C_{N}^{σ} = V_{N}^{σ} are projective. Now recall from Proposition 6.3.6 that each object C_{L}^{σ} is a retract of some C_{N}^{τ}, and hence is a retract of some object X the singleton property. It is thus easy to see that C_{L}^{σ} is isomorphic to an evident subobject of X, and hence that C_{L}^{σ} = V_{L}^{σ} is projective. Similarly, by Proposition 6.3.3 each object C_{V}^{σ} is a retract of some C_{L}^{τ}, whence C_{V}^{σ} is projective. Finally, it is easy to see that V_{V}^{σ} is a regular subobject of C_{V}^{σ} = (V_{V}^{σ})_{⊥}, and so V_{V}^{σ} is also projective. □

Experts will recognize that the projective objects in RT(A) are precisely those for which (a form of) the axiom of choice holds in the internal logic. From an external point of view, the force of this is as follows. Suppose X, Y are assemblies where X has the singleton property, and suppose r ∈ A is such that whenever a ∈ ∥x∥ for some x ∈ X we have ra ∈ ∥y∥ for some y ∈ |Y |. Then clearly r realizes a morphism X → Y, since the requirement that r should behave “extensionally” on realizers for the same element x ∈ X is vacuous. (We will return to this point in Section 8.2.)

It is worth pausing to see why Proposition 7.3.14 fails for Mod(K_{1}). We will show in particular that in this model the object N_{⊥}^{N} is not projective. Clearly the object N_{⊥}^{N} may be presented as follows:

|N_{⊥}^{N}| = {f : N ⇀ N | f is partial recursive}, ∥f ∈ N_{⊥}^{N}∥ = {e | {e} = f}.

Now suppose we have an isomorphism N_{⊥}^{N} → X tracked by t, where X has the singleton property. Then e, e′ code the same partial recursive function iff te = te′. Hence equality between partial recursive functions is decidable—a contradiction.

Remark 7.3.15 Curiously, although in Mod(Pω) and Mod(Pω_{re}) all the objects in the partial type hierarchy over N are projective, this is not true for the total type hierarchy. It can be shown that though the object N^{N} is projective, the object N^{(N^{N})} is not.

7.4 Term models and sequential PCF

In Chapter 3 we gave a proof that the PCAs Pω_{re} and Λ^{0}/T are inequivalent whenever T is a semi-sensible λ-theory, i.e. T does not equate a solvable and an unsolvable term (see Theorem 3.3.10). The proof depended on the absence of a certain “parallel” operation in Λ^{0}/T, and at the end of the chapter we suggested that one might expect the toposes RT(Λ^{0}/T) to provide good models for sequential programming languages. In this section we investigate this idea in more detail.

Let us consider categories of the form Mod(Λ^{0}/T) for T semi-sensible. By considering the set of unsolvable terms as a divergence we obtain natural dominances in these categories (see Example 4.3.5(iii)); moreover, in Proposition 5.3.4 we saw that these dominances satisfy the Completeness Axiom. Hence by the results of Chapter 6 we have an adequate interpretation of sequential PCF in these models. Encouraged by our success in obtaining universality theorems for parallel languages (Theorems 7.2.16 and 7.3.12 above), we are naturally led to conjecture the following:

Conjecture 7.4.1 For any semi-sensible theory T, the interpretation of PCF in Mod(Λ^{0}/T) is universal.

This result was (implicitly) conjectured by Phoa in [72] for a particular theory T. We strongly believe the conjecture to be true, though so far we have been unable to prove it. We also believe that a similar result should hold for many other term models, for instance for those obtained from the call-by-value λ-calculus (see Paragraph 3.2.4). We have concentrated mainly on the term models Λ^{0}/T because there is a particularly well developed and widely known body of theory for the classical λ-calculus (see [8]). However, our attempts at proving the conjecture have raised some interesting questions about the λ-calculus that do not seem to be addressed by this theory.

In Paragraph 7.4.1 we give a rather loose assortment of some partial results in the direction of the main conjecture, culminating in a proof that the interpretation of PCF_{V} in these models is fully abstract at type 3. In Paragraph 7.4.2 we describe a strategy for proving the main conjecture itself, and discuss some of the hard questions that arise from it.

7.4.1 Some partial results

In [72], Phoa considered the interpretation of PCF_{N} in the model Mod(Λ^{0}/B), where B is the theory that equates terms iff they have the same Böhm tree. We will first show that a universality result for this particular model would immediately imply a similar result for a large class of other semi-sensible theories. The proof is a simple but pleasing application of the theory developed in Chapter 2.

Proposition 7.4.2 Suppose T is any λ-theory such that T ⊆ B. Then (i) Mod(Λ^{0}/T) is a universal model for PCF iff Mod(Λ^{0}/B) is so; (ii) Mod(Λ^{0}/T) is a fully abstract model for PCF iff Mod(Λ^{0}/B) is so.

Proof First note that if T ⊆ B then T is semi-sensible. By Proposition 3.2.4 we have a canonical applicative inclusion (γ ⊣ δ) : Λ^{0}/B → Λ^{0}/T; moreover by Proposition 3.2.5 the applicative morphism δ : Λ^{0}/B ⟶^{|} Λ^{0}/T is decidable. Hence by Propositions 2.4.19 and 2.5.11(i) the functor δ_{∗} : Ass(Λ^{0}/B) → Ass(Λ^{0}/T) is full and faithful, and preserves exponentials and the natural number object. Moreover, for our choice of dominances on Λ^{0}/B and Λ^{0}/T, it is easy to see that δ is a dominical morphism in the sense of Definition 4.2.10; hence by Proposition 4.2.11 the functor δ_{∗} commutes with lifting up to isomorphism. Thus δ_{∗}([[ σ]]_{N}) = [[ σ]]_{N} for any PCF type σ. Finally, it is an easy exercise to check that δ_{∗}(fix_{[[ σ]]}) is identified with fix_{[[ σ]]} by the canonical isomorphisms. Thus δ_{∗} preserves the interpretations of terms of PCF_{N} (cf. Proposition 7.2.15). Both parts of the Proposition are now straightforward using the fact that δ_{∗} is full and faithful. □

Note that this argument breaks down if T ⊈ B. Although one always obtains an applicative morphism ϵ : Λ^{0}/T ⟶^{|} Λ^{0}/β such that ϵ_{∗} preserves exponentials, this morphism will not in general be decidable and so ϵ_{∗} may fail to preserve the natural number object. Nevertheless, the objects ϵ_{∗}(N) and N will look quite similar, and it is hard to believe that the partial type structures arising from Mod(T) and Mod(B) could be different!

Although we cannot prove Conjecture 7.4.1 even for some particular theory T, we can obtain universality and full abstraction results at certain “low” types. For example, the “first-order” functions (N_{⊥})^{k} → N_{⊥} representable by morphisms of Mod(Λ^{0}/T) are precisely the PCF-definable ones—here we will prove this result for the case T ⊆ B. First we fix on a convenient presentation of the object N_{⊥}. Define \overline{n} = λxf.f^{n}x; note that if T ⊢ M = \overline{n} then M =_{β} \overline{n} since T ⊆ B. Moreover the elements of Λ^{0}/T given by \overline{0}, \overline{1}, … are equivalent to the standard choice of numerals by Proposition 1.1.15. Hence the following is an acceptable presentation of N_{⊥}:

|n ∈ N_{⊥}| = \{\overline{n}\}, |⊥ ∈ N_{⊥}| = \{M | M unsolvable\}

(here we confuse λ-terms with their equivalence classes modulo T).

Theorem 7.4.3 Suppose T ⊆ B is some λ-theory. Then a set-theoretic function f : |(N_{⊥})^{k}| → |N_{⊥}| gives a morphism in Mod(Λ^{0}/T) iff there is a closed term F : \underbrace{ι → ⋯ → ι}_{k} → ι of PCF_{N} such that uncurry ([[ F ]]) = f.

Proof The right-to-left implication is trivial, since if such a term F exists then uncurry ([[ F ]]) is indeed a morphism (N_{⊥})^{k} → N_{⊥} in Mod(Λ^{0}/T). For the converse implication, suppose f : (N_{⊥})^{k} → N_{⊥} is a morphism in Mod(Λ^{0}/T). Then from a realizer for f it is easy to construct a term R ∈ Λ^{0} such that whenever T_{i} ∈ ∥m_{i} ∈ N_{⊥}∥ for 1 ≤ i ≤ k, we have RT_{1} … T_{k} ∈ ∥f(m_{1}, …, m_{k}) ∈ N_{⊥}∥. Hence if f(m_{1}, …, m_{k}) = n then RT_{1} … T_{k} ↠ \overline{n}, where ↠ denotes many-step leftmost reduction; and if f(m_{1}, …, m_{k}) = ⊥ then RT_{1} … T_{k} has an infinite leftmost reduction sequence (see [8, Section 13.2]).

The basic strategy now is as follows: we write a PCF program F which, given arguments m_{1}, …, m_{k}, simulates the leftmost reduction of the term RT_{1} … T_{k} using a Gödel-numbering for untyped λ-terms. If this ever terminates, it does so with (a code for) a term of the form \overline{n}, and this can be “decoded” to obtain the result n. This strategy depends on the fact that from the argument m_{i} we can effectively obtain (a code for) the realizer T_{i}. Of course, one must be careful to do all this in a “lazy” way, only evaluating each m_{i} when it is needed, since one cannot hope to obtain a code for T_{i} when m_{i} is undefined.

More formally, let Λ^{0}(z_{1}, …, z_{k}) be the set of terms M ∈ Λ such that FV(M) ⊆ {z_{1}, …, z_{k}}. (Here the z_{i} are formal symbols used to stand for the realizers T_{i}.) For any T_{1}, …, T_{k} ∈ Λ^{0} there is an evident notion of βδ_{T_{1}...T_{k}}-reduction on Λ^{0}(z⃗) given by the δ-rules z_{1} → T_{1}, …, z_{k} → T_{k}. Given M ∈ Λ^{0}(z⃗), the leftmost βδredex L_{M} in M (if any) is defined to be the leftmost-outermost subterm of M of either of the forms (λx.N)P or z_{i} (i.e. the subterm of either form whose leftmost character appears leftmost in M). We write ↠_{T_{1}...T_{k}} (or just ↠_{T}) for the evident many-step leftmost βδ_{T_{1}...T_{k}}-reduction relation. We also say M is in βδ-normal form if it is in β-nf and contains no z_{i} free. The following fact is now evident:

Lemma 7.4.4 Suppose M, M′ ∈ Λ^{0}(z⃗) and M′ is in βδ-nf. Then M ↠_{T} M′ iff M[T_{1}/z_{1}, …, T_{k}/z_{k}] ↠ M′. Hence Rz_{1} … z_{k} ↠_{T} \overline{n} iff RT_{1} … T_{k} ↠ \overline{n}. □

Now suppose ⌈−⌉ is an effective Gödel-numbering for elements of Λ^{0}(z⃗). Since all partial recursive functions are expressible in PCF_{N}, it is clear that one can construct terms Encode, Decode, Normal : ι → ι of PCF_{N} satisfying the following specifications:

Encode n ⇓ ⌈\overline{n}⌉,  Decode ⌈\overline{n}⌉ ⇓ n,
Normal ⌈M⌉ ⇓ 0 (M in βδ-nf), Normal ⌈M⌉ ⇓ 1 (M not in βδ-nf).

With a little more effort, one can also construct a term OneStep : ι → ι → ⋯ → ι satisfying the following for every M ∈ Λ^{0}(z⃗), P_{1}, …, P_{k} : ι.

• If L_{M} is a β-redex then OneStep ⌈M⌉P_{1} … P_{k} ⇓ ⌈M′⌉, where M′ is obtained from M by contracting L_{M}. (Thus OneStep ⌈M⌉ is not strict in any of its k arguments.)

• If L_{M} = z_{i} and P_{i} ⇓ ⌈T_{i}⌉ then OneStep ⌈M⌉P_{1} … P_{k} ⇓ ⌈M′⌉, where M′ is obtained from M by replacing the subterm L_{M} with T_{i}. (Thus OneStep ⌈M⌉ is strict in its ith argument, but not in any of the others.)

Next we define a PCF-term Reduce : \underbrace{ι → ⋯ → ι}_{k+1} → ι by

Reduce = λy_{1}^{ι} … y_{k}^{ι}. μg^{ι→ι}. λx^{ι}. cond (Normal x) x (g(OneStep xy_{1} … y_{k})).

Let us say that an index i is needed for M with respect to T_{1}, …, T_{k} if there exists M′ such that M ↠_{T} M′ and L_{M′} = z_{i} (i.e. the δ-rule z_{i} → T_{i} is used in the leftmost reduction of M). Then we can easily prove the following properties for Reduce (we omit the boring details):

• Suppose P_{i} ⇓ ⌈T_{i}⌉ whenever i is needed for M w.r.t. T_{1}, …, T_{k}. Then Reduce P_{1} … P_{k}⌈M⌉ ⇓ ⌈M′⌉ if M ↠_{T} M′ where M′ is in βδ-nf; and

Reduce P_{1} … P_{k}⌈M⌉ ⇑ if M has no βδ-nf.

• Suppose for some i needed for M w.r.t. T_{1}, …, T_{k} we have P_{i} ⇑. Then

Reduce P_{1} … P_{k}⌈M⌉ ⇑.

Finally we define

F = λm_{1}^{ι} … m_{k}^{ι}. Decode (Reduce (Encode m_{1}) … (Encode m_{k}) ⌈Rz_{1} … z_{k}⌉).

We will show that uncurry ([[ F ]]) = f pointwise. Suppose f(m_{1}, …, m_{k}) = n where m_{1}, …, m_{k}, n ∈ N_{⊥} and m_{i} = [[ M_{i}]] for each i. We wish to check that [[ F M_{1} … M_{k}]] = n. We write T_{i} = \overline{m_{i}} for each i, where by convention \overline{⊥} = Ω. We also write R′ for Rz_{1} … z_{k}, and Reduce′ for Reduce (Encode M_{1}) … (Encode M_{k}).

First suppose n ∈ N. Then RT_{1} … T_{k} ↠ \overline{n}, so R′ ↠_{T} \overline{n}. In particular if i is needed for R′ then T_{i} is solvable (otherwise the head reduction sequence for T_{i} would yield an infinite leftmost reduction sequence for R′); hence m_{i} ∈ N and so Encode P_{i} ⇓ ⌈T_{i}⌉. Thus by the above properties of Reduce we have Reduce′ ⌈R′⌉ ⇓ ⌈\overline{n}⌉; hence F M_{1} … M_{k} ⇓ n and so [[ F M_{1} … M_{k}]] = n.

Now suppose n = ⊥; then RT_{1} … T_{k} is unsolvable and so R′ has no βδ-nf. If m_{i} ∈ N whenever i is needed for R′ then Encode M_{i} ⇓ ⌈T_{i}⌉ for all such i; thus by the above properties of Reduce we have Reduce′ ⌈R′⌉ ⇑. Hence F M_{1} … M_{k} ⇑ and so [[ F M_{1} … M_{k}]] = ⊥ by the Adequacy Theorem for PCF_{N}. Otherwise there exist i, R′′ such that R′ ↠_{T} R′′, L_{R′′} = z_{i} and m_{i} = ⊥. Consider the pair (i, R′′) with this property for which the length of the reduction R′ ↠_{T} R′′ is minimal. It is easy to see that Reduce′ ⌈R′⌉ ⇓ p iff Reduce′ ⌈R′′⌉ ⇓ p. But Encode M_{i} ⇑ and so Reduce′ ⌈R′′⌉ ⇑. Hence we again have F M_{1} … M_{k} ⇑ and so [[ F M_{1} … M_{k}]] = ⊥. □

Remarks 7.4.5 (i) In fact the condition T ⊆ B in the above theorem can be relaxed to the requirement that T is semi-sensible (i.e. T ⊆ K^{∗}; see [8, Section 17.1]). In this case we may have T ⊢ M = \overline{n} but not M ↠ \overline{n}, so instead of simulating the reduction of M to normal form we just have to reduce M until enough of the Böhm tree of M is “visible” to allow us to extract the answer n. However, the extra effort involved in proving this stronger result is considerable, so we have contented ourselves with giving a proof for the case T ⊆ B.

(ii) It follows easily from the above theorem that all morphisms f : (N_{⊥})^{k} → N_{⊥} in our model are denotable by k-ary term contexts of call-by-value PCF. For if F is a PCF_{N} term denoting f, by the translation given in Definition 6.3.10 we obtain a PCF_{V} term F̂ : (ι → ι) → ⋯ → (ι → ι). Now let G[−, …, −] be the PCF_{V} term context defined by

G[x_{1}^{ι}, …, x_{k}^{ι}] = F̂ (λz^{ι}.x_{1}) ⋯ (λz^{ι}.x_{k}) 0.

Then from Proposition 6.3.12 it is clear that [[ G]] = f.

(iii) It seems worth pointing out that, for computable functions f : (N_{⊥})^{k} → N_{⊥}, PCF-definability is actually a stronger condition than the Milner-Vuillemin notion of sequentiality (see e.g. [61]). This was pointed out by M.B. Trakhtenbrot in [98], who gave an example of a three-argument function that is computable and sequential but not PCF-definable. In fact one can give examples with just two arguments, e.g.:

f(x, y) = \{ \begin{matrix}0 & if x ⇓ and (x ∈ K or y ⇓) \\ ⊥ & otherwise \end{matrix}

where K is the halting set {n | {n}(0)↓}. (This example is similar to one given in Section 2 of [86].)

We now turn our attention to the functionals of higher type in Mod(Λ^{0}/T). Although one can easily show the absence of certain particular “parallel” functionals such as the ∃ functional (cf. Proposition 6.2.10), the problem of proving universality even at type 2 seems to present prodigious difficulties. In the next paragraph we will discuss a strategy for proving the following:

Conjecture 7.4.6 Every morphism (N_{⊥})^{N} → N_{⊥} in Mod(Λ^{0}/B) is denotable by a term of PCF_{V} of type (ι → ι) → ι.

(This seems slightly weaker—hence perhaps easier to prove—than the corresponding fact for call-by-name PCF.) Although we have not managed to prove this conjecture, we give below a proof of a closely related result, namely that the interpretation of PCF_{V} in Mod(Λ^{0}/B) is fully abstract at type 3. The proof uses the fact that the object (N_{⊥})^{N} has a particularly nice presentation—this gives us a very good grasp of the properties of this object.

The crucial observation is that any morphism f : N → N_{⊥} Mod(Λ^{0}/B) has a canonical realizer R_{f} in Λ^{0}/B. The Böhm tree corresponding to R_{f} may be schematically depicted as follows:

[figure: λx. if x = \overline{0}; \overline{f0}  if x = \overline{1}; \overline{f1}  ...]

(where again we take \overline{⊥} = Ω). Note that if f is partial recursive then this tree is r.e. and has no free variables; hence by [8, Theorem 10.1.23] it is indeed the Böhm tree of some term R_{f}. Intuitively BT(R_{f}) embodies the infinite “look-up table” for f. Moreover, as we shall shortly see, there is a realizer T that transforms any realizer for a morphism f into this canonical realizer. It may seem surprising that such a canonical choice of realizer exists at all, in view of the fact that there is no canonical “algorithm” for computing f. One way of explaining this apparent paradox is to say that by identifying terms with the same Böhm tree we abstract away from the “algorithmic” process by which f is actually computed.

The following proposition expresses these ideas slightly more formally:

Proposition 7.4.7 We may assign to every partial recursive f : N → N_{⊥} an element R_{f} ∈ Λ^{0}/B, in such a way that

(i) f ⊆ g iff BT(R_{f}) ⊆ BT(R_{g});

(ii) if S is a set of partial recursive functions such that f ⊆ g for each f ∈ S, then g = ⨆ S iff BT(R_{g}) = ⋃_{f∈S} BT(R_{f});

(iii) the object (N_{⊥})^{N} in Mod(Λ^{0}/B) may be presented by ∥f ∈ (N_{⊥})^{N}∥ = {R_{f}}. Thus (N_{⊥})^{N} is projective.

Proof To define R_{f} formally we need to clarify the meaning of the labels if x = \overline{n} in the picture above. In particular, to know that this picture does define a Böhm tree, we need to replace these labels with expressions that begin with a head variable. From Theorem 1.1.16 it is clear that there exists an element Q ∈ Λ^{0}/BB such that B ⊢ Q \overline{m} \overline{n} = λxy.x if m = n, and B ⊢ Q \overline{m} \overline{n} = λxy.y if m ≠ n. Rather than explicitly calculate Q we can use the following trick. Since \overline{m}ii = i for any m ∈ N (where i = λy.y), we have

\overline{m}ii (Q \overline{m} \overline{n}) P_{1}P_{2} = \{ \begin{matrix}P_{1} & if m = n \\ P_{2} & if m ≠ n. \end{matrix}

Thus we may define R_{f} to be the (unique) element of Λ^{0}/B whose Böhm tree is

[figure: λx. xii(Qx\overline{0}); BT(\overline{f0})  xii(Qx\overline{1}); BT(\overline{f1})  ...]

where of course xii(Qx\overline{n}) really stands for the tree fragment

x

[figure]
BT(i) BT(i) BT(Qx\overline{n}).

(As noted above, such an element R_{f} exists because this tree is closed and r.e.) Properties (i) and (ii) are now immediate since BT(\overline{⊥}) = ⊥. For (iii), first note that for any n ∈ N we have

R_{f} \overline{n} = \overline{n}ii (Q \overline{n} \overline{0}) \overline{f0} (… (\overline{n}ii (Q \overline{n} \overline{n}) \overline{fn} U) …)

for some term U; hence R_{f} \overline{n} = \overline{fn}. Thus R_{f} tracks f relative to the presentations of N, N_{⊥} given by ∥n ∈ N∥ = ∥n ∈ N_{⊥}∥ = \{\overline{n}\}, ∥⊥ ∈ N_{⊥}∥ = \{Ω\}. Now let T be the unique element of Λ^{0}/B whose Böhm tree is

λfx.xii(Qx\overline{0})
[figure]
f  xii(Qx\overline{1})
[figure]
BT(\overline{0})  f  ...
BT(\overline{1})

(again such a T exists since this tree is r.e.). Suppose M ∈ Λ^{0}/B tracks f relative to the above presentations of N, N_{⊥}; we claim that T M = R_{f} in Λ^{0}/B. To see this, for each k > 0 define T^{k}, R_{f}^{k} ∈ Λ^{0}/B by

\begin{aligned}T^{k} & = & λfx. xii (Qx\overline{0}) (f\overline{0}) (… (xii (Qx\overline{k − 1}) (f\overline{k − 1}) Ω) …) \\ R_{f}^{k} & = & λx. xii (Qx\overline{0}) \overline{f0} (… (xii (Qx\overline{k − 1}) \overline{f(k − 1)} Ω) …). \end{aligned}

Clearly T^{k}M = R_{f}^{k} for each k. But BT(T) = ⋃ BT(T^{k}) and BT(R_{f}) = ⋃ BT(R_{f}^{k}), so by [8, Theorem 14.3.22] we have T M = R_{f} in Λ^{0}/B. Property (iii) now follows easily: if X is the object (N_{⊥})^{N} defined as in Proposition 1.2.4 and Y is the object defined by |Y | = |X|, ∥f ∈ Y ∥ = {R_{f}}, then the canonical morphism Y → X is tracked by i, and its inverse is tracked by T. Finally, Y has the singleton property and so is projective by Proposition 2.4.10. □

Using this proposition, it is easy to show that both the Σ-order and the notion of Σ-limit in (N_{⊥})^{N} coincide with the pointwise notions:

Proposition 7.4.8 The following hold for the model Mod(Λ^{0}/B) equipped with the dominance given by the divergence {Ω}:

(i) If f, g ∈ |(N_{⊥})^{N}|, then f ⪯_{Σ} g iff f ⊆ g.

(ii) If g ∈ |(N_{⊥})^{N}|, S ⊆ |(N_{⊥})^{N}| and f ⊆ g for each f ∈ S, then g is the Σ-limit of S iff g = ⋃ S.

Proof (i) Suppose f ⊆ g, and ϕ : (N_{⊥})^{N} → Σ is any morphism, tracked by P say. Then BT(R_{f}) ⊆ BT(R_{g}) by the above proposition, hence BT(P R_{f}) ⊆ BT(P R_{g}) by [8, Corollary 14.3.20] and so ϕ(f) ≤ ϕ(g). Thus f ⪯_{Σ} g. Conversely, suppose f ⊈ g; then for some n we have ⊥ ≠ f(n) ≠ g(n). Using the “evaluate at n” morphism (N_{⊥})^{N} → N_{⊥} it is easy to construct a morphism (N_{⊥})^{N} → Σ refuting f ⪯_{Σ} g.

(ii) Suppose g = ⋃ S, and P tracks ϕ as in (i). Then BT(R_{g}) = ⋃_{f∈S} BT(R_{f}) by the above proposition, hence BT(P R_{g}) = ⋃_{f∈S} BT(P R_{f}) by [8, Theorem 14.3.22]. Thus ϕ(g) = ⊤ iff ϕ(f) = ⊤ for some f ∈ S. Conversely, if g ≠ ⋃ S then for some n we have g(n) ≠ ⊥ but f(n) = ⊥ for all f ∈ S; hence we may easily construct ϕ such that ϕ(g) = ⊤ but ϕ(f) = ⊥ for all f ∈ S. □

These results for (N_{⊥})^{N} seem to be something of a flash in the pan—there seems to be no easy way of obtaining similar results for (N_{⊥})^{N_{⊥}}, for instance. (In fact, we have not even been able to prove that the Σ-order on Σ^{Σ} coincides with the pointwise order!) However, it would follow easily from Conjecture 7.4.1 that for all objects [[ σ]] the Σ-order coincides with the pointwise order, and Σ-limits coincide with least upper bounds.

Proposition 7.4.8 seems quite interesting in its own right. However, in order to prove our full abstraction result we need a slightly different though related fact:

Lemma 7.4.9 For each k > 0, let D_{k}[−] be the PCF_{V} term context defined by

D_{k}[f^{ι→ι}] = λx^{ι}. cond (x < k) (fx) Ω^{ι}

where Ω^{ι} = μy^{ι}.y and < is some (infix) PCF_{V} term implementing the order relation. Let θ_{k} = [[ D_{k}]]_{V} : (N_{⊥})^{N} → (N_{⊥})^{N}. Then the Σ-limit of the morphisms θ_{k} exists and is the identity morphism. Proof We work with the presentation of (N_{⊥})^{N} given by ∥f∥ = {R_{f}}. It is easy to see that each morphism θ_{k} is tracked by the term T^{k} appearing in the proof of Proposition 7.4.7, and that the identity on (N_{⊥})^{N} is tracked by T. But BT(T) = ⋃_{k} BT(T_{k}), and the lemma follows easily by the continuity of application. □

Theorem 7.4.10 The interpretation of PCF_{V} in Mod(Λ^{0}/B) is fully abstract at type 3: given closed terms M, N : ((ι → ι) → ι) → ι, if M ≈ N then [[ M ]]_{V} = [[ N ]]_{V}. Proof Suppose [[ M ]]_{V} ≠ [[ N ]]_{V}; then there exists ϕ ∈ |(N_{⊥})^{N} → N_{⊥}| such that [[ M ]](ϕ) ≠ [[ N ]](ϕ) in N_{⊥}. We will construct elements ϕ_{1} ⪯_{Σ} ϕ_{2} ⪯_{Σ} … of |(N_{⊥})^{N} → N_{⊥}| whose Σ-limit is ϕ, and such that each ϕ_{k} is denotable by some term P_{k} : (ι → ι) → ι. This will suffice, since for some k we then have [[ M ]](ϕ_{k}) ≠ [[ N ]](ϕ_{k}) and so [[ MP_{k}]] ≠ [[ NP_{k}]], whence M ≉ N via the Adequacy Theorem.

For each k > 0 let θ_{k} be as in the above lemma, and define ϕ_{k} = ϕ ∘ θ_{k}. Then by the lemma we clearly have that ϕ is the Σ-limit of the ϕ_{k}. It remains to show that the ϕ_{k} are denotable. The informal idea is that for any f the value of ϕ_{k}(f) depends only on the k values of f(0), …, f(k − 1), so ϕ_{k} may be regarded as essentially a function of k arguments of type N_{⊥}; and we already know that all morphisms (N_{⊥})^{k} → N_{⊥} are denotable in PCF. More formally, for each k we may define a k-ary term context H_{k} of PCF_{V} by

H_{k}[x_{0}^{ι}, …, x_{k−1}^{ι}] = λy^{ι}. cond (y = 0) x_{0} (… (cond (y = k − 1) x_{k−1} Ω^{ι}) …))

where = implements equality testing. Let h_{k} = [[ H_{k}]] : (N_{⊥})^{k} → ((N_{⊥})^{N})_{⊥}, and let j_{k} = ϕ∘α∘h_{k} : (N_{⊥})^{k} → N_{⊥}. Then by Remark 7.4.5(ii) there is a k-ary context J_{k} of PCF_{V} such that [[ J_{k}]] = j_{k}. Now let P_{k} ≡ λf^{ι→ι}. J_{k}[f0, …, f(k − 1)]. We claim that ϕ_{k} = [[ P_{k}]]. For given any f ∈ |(N_{⊥})^{N}|, for each n ∈ |N| we clearly have

θ_{k}(f)(n) = (α ∘ h_{k})(f(0), …, f(k − 1))(n) = \{ \begin{matrix}f(n) & if n < k \\ ⊥ & if n ≥ k \end{matrix}

and so θ_{k}(f) = (α ∘ h_{k})(f(0), …, f(k − 1)) by well-pointedness. Thus

ϕ_{k}(f) = (ϕ ∘ α ∘ h_{k})(f(0), …, f(k − 1)) = j_{k}(f(0), …, f(k − 1)) = [[ P_{k}]](f),

and so by well-pointedness ϕ_{k} = [[ P_{k}]]. This completes the proof. □

Remark 7.4.11 An easy extension of this argument shows that in fact the interpretation of PCF_{V} in Mod(Λ^{0}/B) is fully abstract at any type σ of level 3 or less, where level(ι) = 0 and level(σ_{1} → ⋯ → ι) = max(level(σ_{i})) + 1. By the argument used in the proof of Proposition 7.4.2 the result also extends to the models Mod(Λ^{0}/T) for all semi-sensible T. Note, however, that we have been unable to obtain the corresponding theorem for call-by-name PCF, since we have a much poorer grasp of the object (N_{⊥})^{N_{⊥}} than of (N_{⊥})^{N}.

7.4.2 A strategy for proving universality

We end this chapter with a very informal discussion of a possible strategy for proving Conjecture 7.4.1 and some of the difficulties it raises. In the light of Theorem 6.4.4 it does not matter which version of sequential PCF we work with— our experience suggests that PCF_{V} is probably the easiest, since in PCF_{N} and PCF_{L} it is harder to determine statically which subterms of a term are actually evaluated. Also it suffices to consider universality for the pure types ι_{n} defined by ι_{0} = ι, ι_{n+1} = ι_{n} → ι, since it can be shown that any type σ can be “embedded” in a pure type in a suitable sense.

Our basic idea is to try to extend the technique used to prove Theorem 7.4.3 as follows. For each pure type ι_{n} we construct a PCF_{V} term I_{n} : ι → ι_{n}, called an interpreter for type n, and try to prove that it has the following property: for any element y of [[ ι_{n}]]_{V} and any realizer M ∈ ∥y∥ we have [[ I_{n} ⌈M⌉]] = y (where ⌈M⌉ is a Gödel-number for M). This would suffice to establish universality at type ι_{n}. It is a rather trivial exercise to construct interpreters I_{0}, I_{1} with the above property, and so we concentrate here on trying to prove universality at type 2. If the proof could be made to work in this case, we are optimistic that the same ideas would (in principle) allow us to prove the result for all pure types.

The idea behind the construction of I_{2} is similar to that used in Theorem 7.4.3. Given a morphism ϕ : (N_{⊥})^{N} → N_{⊥}, a realizer M ∈ Λ^{0}/B for ϕ and a PCF term F : ι → ι, the strategy used by to compute I_{2} ⌈M⌉ F would be as follows: we simulate the leftmost reduction of the untyped term Mz, where z is a formal symbol standing for the function F. If this terminates, we then “decode” the result to give a natural number. The problem is that in doing this we only have access to the “extension” of the function F, i.e. its values on particular arguments—we have no way of accessing a realizer for the morphism f = [[ F ]]. So if in the course of reducing Mz we are confronted with a subterm zP, we will first need to reduce and decode P itself to yield a natural number p say, then feed this to the function F, re-encode the result as ⌈ \overline{F p} ⌉ and resume the leftmost reduction of Mz. Since the subterm P itself may well contain occurrences of z, all this reduction and decoding must of course be done in a highly recursive fashion.

There are several problems with this strategy as we have outlined it. First, the right notion of reduction in Λ^{0} is the call-by-name one, whereas the above strategy gives us a very “call-by-value” treatment of subterms of the form zP.

More specifically, if N realizes f and we wish to compute the normal form (if any) of MN, then when confronted with NP [N/z] we will reduce this subterm before reducing P [N/z] itself. However, according to the above strategy, when we confronted with zP we must first reduce P to normal form! So one might be worried that even if the reduction of MN terminates, the reduction of Mz could be side-tracked indefinitely. Fortunately, this problem can be overcome by exploiting the fact that M behaves “extensionally” on codes for f: if N, N′ ∈ ∥f∥ and MN ↠ \overline{n} then MN′ ↠ \overline{n}. We use a trick similar to that employed in the proof of Proposition 7.4.7: let N be any realizer for f and take N′ = λx. xii (Nx). Then clearly N′ also realizes f, but N′ is always forced to “evaluate its argument”: the reduction of N′P begins (essentially) with a reduction of P to normal form. By keeping track of the lengths of the various reduction sequences, one can show that (for otherwise well-behaved M) if MN′ ↠ \overline{n} under call-by-name reduction then Mz ↠ \overline{n} under the strategy outlined above.

A second problem is that if we are trying to reduce a term M′ in which z occurs to the left of any β-redexes, there is no guarantee that this occurrence of z will be applied to a well-behaved term P. Indeed, it need not be applied to anything, as in the term M′ = λx.z. Alternatively, if the subterm zP occurs underneath an abstraction, then P might contain extraneous free variables, as in the term M′ = λx.zx. However, it seems that both of these rather annoying situations can be disposed of via technical arguments. The most interesting (and worst) case is when P has no free variables other than z, but for some (or all) realizers N ∈ ∥f∥ the term that P [N/z] is not a numeral, i.e. we do not have P [N/z] ↠ \overline{p} for any p.

We may respond to this problem by appealing again to the “extensional” behaviour of M. Suppose that we are confronted with a subterm zP such that P [N/z] is not a numeral for some N ∈ ∥f∥; suppose moreover that this is the first time in the reduction of Mz that this particular problem has arisen. One idea is to construct N′ that agrees with N on all bona fide numerals \overline{p}, but such that N′P “diverges”. So our simulation of the reduction of Mz will diverge because we will fail to reduce P to a numeral; but this will be the right thing to do anyway, since the reduction of MN′ in Λ^{0} diverges and so ϕ(f) = ⊥. By using (and extending) the Böhm tree “separation” technology in [8, Section 10.4], it turns out that we can do exactly this kind of thing: given any term Q ∈ Λ^{0} such that Q ≂̸_{η} \overline{p} for any p, we can indeed construct N′ such that N′\overline{p} = N\overline{p} for all p but N′Q = Ω.

We seem to be almost home and dry. However there remain two subtle problems. The first of these concerns the gap between the theories B and K^{∗}: we have not said what we do if Q ≂_{η} \overline{p} but B ⊬ Q = \overline{p}. This subtlety spawns another host of technical difficulties which we do not discuss here; but we believe that these can be overcome. The second problem seems at first sight to be very slight. Suppose as above we have P such that P [N/z] is a numeral, and we wish to construct N′ such that N′P diverges. Using our separation techniques we can obtain N′ such that N′P [N/z] = Ω in B; however, what we really need is that N′P [N′/z] = Ω. In fact there is an infinite supply of realizers N′ such that N′P [N/z] = Ω, and for each of these there is an infinite supply of realizers N′′ such that N′′P [N′/z] = Ω, so it seems almost inconceivable that there is no N′ ∈ ∥f∥ such that N′P [N′/z] = Ω! However, we have been unable to find any way of constructing such an N′, and appear to have reached an impasse.

We therefore propose the following conjecture as a “challenge problem”. Although the conjecture itself is rather weaker than the property we would need to solve our difficulties, it is easy to present as a simple self-contained problem, and it seems likely that a proof of it would provide the key to solving the problem described above.

Conjecture 7.4.12 Let S = {N ∈ Λ^{0} | Ni =_{β} i}, and suppose P ∈ Λ^{0}(z) is such that NP [N/z] =_{β} i for all N ∈ S. Then P [N/z] ≂_{η} i for all N ∈ S.

We believe that if one could prove this kind of assertion, one would be able to complete the whole of the proof of universality at type 2 outlined above. But even if this were possible, the technical difficulties involved in extending this result to all pure types (or even to type 3) would probably still be appalling!

One might ask whether the problem could be made easier by choosing a different term model in place of Λ^{0}/B, for instance a call-by-value term model. So far we have not found a model for which the problem seems to be any easier, though some of the difficulties that arise for other models seem to be different.

One final remark: it is also natural to ask what hierarchy of total functionals over N arises from Λ^{0}/B (or other term models). Nobody seems to know the answer to this question (cf. [10, VI.8]), although Martin Hyland has suggested that the answer is probably not the HEOs, as it seems that operations definable in the λ-calculus would be likely to have strong continuity properties, whereas not all the HEOs are continuous (see e.g. [30]).

Program logics

Traditionally, one of the main motivations for denotational semantics has been to gain insight into the logic of programming languages, and to provide conceptual and mathematical tools for reasoning about the languages themselves and about programs written in them. We end the main body of this thesis with a brief discussion of how our models can be used to give logics for reasoning about programs in PCF-like languages. This chapter is an account of “work in progress” and the material is not in a definitive state, so rather than attempt a detailed mathematical exposition we content ourselves with a rough outline of the main ideas. Nevertheless, we hope that the ideas sketched here will be of some help in explaining the motivations behind the work in previous chapters.

Denotational semantics can be used to establish relationships between a programming language L and a logic J. For instance, by giving interpretations of both L and J in some common mathematical structure M, we may be able to show that if ⊢ e ⇓ is provable in J then e really does terminate. Typically, then, certain simple formulae of the logic (such as e ⇓) will have not only a denotational interpretation in M but also an interpretation as a statement about programs in the real world (such as the statement that e terminates). Often this situation breaks down for more complicated formulae—for example, there may be no simple “real-world” explanation of the meaning of the quantifiers. However, here we are interested in finding program logics for which we do have such a naive real-world interpretation: in other words, logics in which every sentence has a “meaning” that can be explained in terms of the programming language itself, without reference to the model M. We might call this the operational interpretation of φ, in contrast to its denotational interpretation in M. Our contention is that a logic will be more easily grasped and used by a non-specialist if it has a good operational interpretation.

Given a logic J with both an operational and a denotational interpretation, it is natural to ask whether these “agree”, i.e. whether a sentence is satisfied by the model M precisely when it is true under the operational interpretation. In this kind of situation, we will say that the model M is logically fully abstract for L and J. A logically fully abstract model can be used to show that the operational interpretation of the logic is legitimate: if a sentence φ is provable in the logic then φ expresses a true fact about the real world. Notice that if J is a logic whose formulae are just equations between terms of L, then logical full abstraction corresponds to ordinary (equational) full abstraction if we take the operational interpretation of these equations to be “observational equivalence”. Thus logical full abstraction may be seen as generalizing the ordinary notion. Both the concept and the name “logical full abstraction” are due to Gordon Plotkin.

In this chapter we will investigate the idea of logical full abstraction for two different kinds of program logic. In Section 8.1 we consider a simple classical logic K(L) where L is a PCF-like language. This is the kind of logic we might expect to be useful in practice for specifying and proving interesting properties of programs. We give a very naive operational interpretation of sentences of this logic, and show how a denotational interpretation can be given in any PCF-model C that supports L. In this case we show that C is logically fully abstract provided it is a universal model for L; hence some of the realizability models discussed in Chapter 7 provide examples of logically fully abstract models. The material in this section is in a reasonably satisfactory state, although there are some details still to be filled in.

The material in Section 8.2 is much less well-developed. We consider a simple constructive logic J(L). This logic has a well-known denotational interpretation as the internal logic of a topos, and so it is natural to ask whether one can give an operational interpretation to match this. We tentatively suggest an operational interpretation based on typed realizability, and hence define a notion of “logical full abstraction” for J(L). This turns out to be a very strong condition indeed, and in fact we cannot show that it holds for any of the models considered in Chapter 7 (though some come closer than others). However, by modifying the definition of one of these models slightly we obtain an example of a logically fully abstract model for J(PCF_{N}^{++}). All the material in this section is exploratory in nature and we do not work out any of the details; thus this section may be read as a prospectus for future work.

8.1 Classical logic

We start by considering a simple classical logic for reasoning about programs. This logic has many features in common with LCF [34], and in other respects resembles Extended ML (see [47]). We believe that this is the kind of logic that would in principle be useful for specifying and proving the kinds of properties of programs that programmers are interested in. (We do not claim, however, that the particular logic presented here is especially practical or useful—our aim has been to make our logic as simple as possible for the purposes of illustrating the ideas. There are many delicate decisions involved in the design of a logic that may affect its usability, and it is not our purpose to discuss these here.)

For each of our languages L, we can define the syntax of a many-sorted logic K(L) as follows. The sorts of K(L) are precisely the types of L; expressions of sort σ in K(L) are precisely terms of type σ in L; and logical variables of sort σ are just term variables of type σ. The syntactic class of formulae of K(L) is distinct from that of expressions; we use φ, ψ to range over formulae and M, N, P, … to range over expressions. The syntax of formulae of K(L) is as follows:

\begin{aligned}φ ::= & false | M ≃ N | M ⇓ | φ_{1} ∧ φ_{2} | φ_{1} ∨ φ_{2} \\ & | φ_{1} ⇒ φ_{2} | ∀x^{σ}.φ_{1} | ∃x^{σ}.φ_{1}. \end{aligned}

(Note that K(L) is really a many-sorted first-order logic rather than a higher-order logic—we have a separate ground sort for each type σ.)

Informally, our intention is that ≃ denotes Kleene equality— if either expression terminates then so does the other and they are equal in some sense—and that both free and bound variables range over expressions definable in L, terminating or not. (We will make these intentions more explicit when we give the semantics of K(L) below.) Many other ways of treating non-terminating expressions in a logic are possible (see [16] for a good survey and discussion)— the choice we have made here is in some sense maximally expressive. For practical convenience we may wish to enrich the syntax with derived constructs such as the following:

(M = N) ≡ (M ⇓) ∧ (M ≃ N)
¬φ ≡ φ ⇒ false
true ≡ ¬false
∀′x^{σ}.φ ≡ ∀x^{σ}.(x ⇓) ⇒ φ
∃′x^{σ}.φ ≡ ∃x^{σ}.(x ⇓) ∧ φ

The axioms and inference rules of K(L) are essentially those of classical firstorder logic. For simplicity we consider here a Hilbert-style presentation of the logic: all judgements are of the form ⊢ φ. The axioms of are taken to be all tautologies of classical propositional logic, plus all judgements of the following forms:

\begin{aligned}⊢ M ≃ M & ⊢ φ[M/x] ∧ (M ≃ N) ⇒ φ[N/x] \\ ⊢ (M ≃ N) ⇒ (N ≃ M) & ⊢ (∀x.φ) ⇒ φ[M/x] \\ ⊢ (M ≃ N) ∧ (N ≃ P) ⇒ (M ≃ P) & ⊢ φ[M/x] ⇒ (∃x.φ). \end{aligned}

The rules of inference of K(L) are taken to be

\frac{⊢ φ ⇒ ψ ⊢ φ}{⊢ ψ}  \frac{⊢ φ ⇒ ψ x ∉ FV(φ)}{⊢ φ ⇒ (∀x.ψ)}  \frac{⊢ ψ ⇒ φ x ∉ FV(φ)}{⊢ (∃x.ψ) ⇒ φ}

We now give a very naive operational interpretation of K(L)—essentially, we give a way of translating formulae of K(L) into English statements about programs of L. First, we need to clarify what we mean by termination. For lazy and call-by-value languages, we will say that a closed term M of L terminates iff M ⇓ V for some V. For call-by-name languages, however, things are more subtle, since officially we are not allowed to observe termination at higher types. For the purposes of this chapter, then, we adopt the convention that all closed terms of higher type terminate. More precisely, we will say that a closed term M : σ terminates iff either M ⇓ V for some V or σ ≠ ι.

Having established this piece of terminology, we can now give a rather Tarskian definition of our operational interpretation of K(L):

Definition 8.1.1 (Operational truth) We define a relation ⊧_{op} φ (read “φ is operationally true”) on closed formulae φ of K(L) as follows.

• ⊧_{op} false doesn’t hold;

• ⊧_{op} (M ≃ N) iff M, N are observationally equivalent;

• ⊧_{op} (M ⇓) iff M terminates;

• ⊧_{op} φ ∧ ψ iff ⊧_{op} φ and ⊧_{op} ψ;

• ⊧_{op} φ ∨ ψ iff ⊧_{op} φ or ⊧_{op} ψ;

• ⊧_{op} φ ⇒ ψ iff either |̸=_{op} φ or ⊧_{op} ψ;

• ⊧_{op} ∀x^{σ}.φ iff ⊧_{op} φ[M/x] for all closed M : σ;

• ⊧_{op} ∃x^{σ}.φ iff ⊧_{op} φ[M/x] for some closed M : σ.

We may extend the relation ⊧_{op} to open formulae as follows: if φ is an open formula with free variables x_{1}, …, x_{n}, then ⊧_{op} φ iff ⊧_{op} φ[M⃗/x⃗] for all closed terms M_{1}, …, M_{n} of the appropriate types.

(We apologize for the slight mismatch between the use of the symbol ⇓ here and that in Chapter 6!) The above definition extends in a natural way to the derived constructs: for instance, we have ⊧_{op} (M = N) iff M, N are observationally equivalent terminating expressions. Notice that the notion of operational truth only requires concepts relating to the language L itself—there is no reference to a denotational semantics. We are thus hopeful that this interpretation of the logic would be readily understood by programmers.

Next we give a simple way of interpreting K(L) denotationally. Let C be any PCF-model supporting L. For each σ let S_{L}^{σ} = Hom(1, C_{L}^{σ}). The idea is to interpret the sort σ by the set S^{σ}, and a formula with free variables x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}} by a subset of S^{σ_{1}} × ⋯ × S^{σ_{n}}. To do this, we need subsets T^{σ} ⊆ S^{σ} corresponding to the “terminating” elements. We first define subobjects D^{σ} ↣ C^{σ} as follows:

\begin{aligned}D_{N}^{ι} & = N, & D_{L}^{ι} & = N, & D_{V}^{ι} & = N, \\ D_{N}^{σ→τ} & = V_{N}^{σ→τ}, & D_{L}^{σ→τ} & = (V_{L}^{σ} → V_{L}^{τ}), & D_{V}^{σ→τ} & = V_{V}^{σ→τ}. \end{aligned}

For each σ and L there is an evident morphism D_{L}^{σ} ↣ C_{L}^{σ}. We then define T_{L}^{σ} = Hom(1, D_{L}^{σ}); we regard T^{σ} as a subset of S^{σ}.

Definition 8.1.2 (External validity) For an environment Γ = ⟨x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}}⟩, define [[ Γ ]]_{K} = S^{σ_{1}} × ⋯ × S^{σ_{n}}. For any term M : τ in environment Γ, let [[ M ]]_{K}^{Γ} : [[ Γ ]]_{K} → S^{τ} be the set-theoretic function determined by composition with [M]^{Γ}. For any formula φ of K(L) with FV(φ) ⊆ Γ, we define the set [[ φ]]_{K}^{Γ} ⊆ [[ Γ ]]_{K} as follows:

z ∈ [[ false ]]_{K}^{Γ}  never;
z ∈ [[ M ≃ N ]]_{K}^{Γ} iff [[ M ]]_{K}^{Γ}(z) = [[ N ]]_{K}^{Γ}(z);
z ∈ [[ M ⇓]]_{K}^{Γ}  iff [[ M ]]_{K}^{Γ}(z) ∈ T^{τ};
z ∈ [[ φ ∧ ψ]]_{K}^{Γ}  iff z ∈ [[ φ]]_{K}^{Γ} and z ∈ [[ ψ]]_{K}^{Γ};
z ∈ [[ φ ∨ ψ]]_{K}^{Γ}  iff z ∈ [[ φ]]_{K}^{Γ} or z ∈ [[ ψ]]_{K}^{Γ};
z ∈ [[ φ ⇒ ψ]]_{K}^{Γ}  iff z ∉ [[ φ]]_{K}^{Γ} or z ∈ [[ ψ]]_{K}^{Γ};
z ∈ [[ ∀x^{σ}.φ]]_{K}^{Γ}  iff (z, w) ∈ [[ φ]]_{K}^{Γ,x^{σ}} for all w ∈ S^{σ};
z ∈ [[ ∃x^{σ}.φ]]_{K}^{Γ}  iff (z, w) ∈ [[ φ]]_{K}^{Γ,x^{σ}} for some w ∈ S^{σ}.

We say that φ is externally valid in C, and write C ⊧_{K} φ, if [[ φ]]_{K}^{Γ} = [[ Γ ]]_{K} where FV(φ) ⊆ Γ. In particular, if φ is closed then C ⊧_{K} φ iff [[ φ]]_{K} is inhabited.

It is trivial to check that the axioms and inference rules of K(L) are sound with respect to this interpretation. Note that by considering only global elements we are throwing away most of the interesting categorical structure of C. In particular, the functor Γ drastically fails to preserve exponentials, and so our interpretation of sorts as sets is no longer “compositional”.

Now that we have given both an operational and a denotational interpretation of K(L), there is a natural notion of logical full abstraction:

Definition 8.1.3 The interpretation of a language L in a PCF-model C is logically fully abstract for K(L) (or classically l.f.a.) if, for every formula φ of K(L), C ⊧_{K} φ iff ⊧_{op} φ.

Theorem 8.1.4 Suppose C is a well-pointed PCF-model supporting L. If the interpretation of L in C is universal, then it is logically fully abstract for K(L).

Proof Suppose C is a universal model for L; then it is also equationally fully abstract by Proposition 6.4.3. We first show by induction that C ⊧_{K} φ iff ⊧_{op} φ for all closed formulae φ. For formulae of the form M ≃ N, clearly M ≈ N iff [[ M ]] = [[ N ]] by full abstraction; hence ⊧_{op} (M ≃ N) iff C ⊧_{K} (M ≃ N). For formulae of the form M ⇓, note that M terminates iff [[ M ]] ∈ T^{σ} by adequacy; hence ⊧_{op} (M ⇓) iff C ⊧_{K} (M ⇓). The cases for the propositional connectives are all trivial. For the quantifiers, suppose first that C ⊧_{K} ∀x^{σ}.φ. Then for any closed M : σ we have [[ M ]] ∈ S^{σ}, and so C ⊧_{K} φ[M/x] by the definition of [[ ∀x.φ]]_{K}; hence ⊧_{op} φ[M/x] by the induction hypothesis. Thus ⊧_{op} ∀x^{σ}.φ. Conversely, suppose ⊧_{op} ∀x^{σ}.φ. For any w ∈ S^{σ}, by universality we have w = [[ M ]] for some closed M : σ. But we have ⊧_{op} φ[M/x] and so C ⊧_{K} φ[M/x] by the induction hypothesis; hence w ∈ [[ φ]]_{K}^{x}. Thus [[ φ]]_{K}^{x} = S^{σ}, so C ⊧ ∀x^{σ}.φ. The case for ∃ is similar; this completes the proof for closed formulae. To see that the result extends to open formulae, it is enough to observe that if ∀x⃗.φ is the universal closure of φ then ⊧_{op} φ iff ⊧_{op} ∀x⃗.φ, and C ⊧ φ iff C ⊧ ∀x⃗.φ. □

Examples 8.1.5 By the results of Chapter 7, the models Mod(K_{1}), Mod(Pω_{re}) are logically fully abstract for (any version of) K(PCF^{++}). If Conjecture 7.4.1 is true then the model Mod(Λ^{0}/B) is logically fully abstract for K(PCF). From the results in Section 7.4 we can see that the Mod(Λ^{0}/B) is logically fully abstract at least for a significant fragment of K(PCF_{V}), namely that in which all equations are at type level 3 or less, and all quantifications are at type level 1 or less.

It seems that the converse of Theorem 8.1.4 also holds: any logically fully abstract model is universal. To prove this, one could define an effective Gödelnumbering ⌈−⌉ of PCF terms as natural numbers, and for each type σ construct an “interpreter” K^{σ} : ι → σ such that K^{σ}⌈M⌉ ≈ M for all closed M : σ. We would then have ⊧_{op} ∀x^{σ}.∃n^{σ}. x = K^{σ}n; hence if the model C were logically fully abstract we would have that every element z ∈ S^{σ} was denoted by a term K^{σ}n. In general, the construction of suitable terms K^{σ} seems harder than one might expect, and we have not worked out the details. However, in the case of PCF^{++} we have a cheap proof that such terms exist:

Proposition 8.1.6 Suppose L is a version of PCF^{++}, and C is a logically fully abstract model of L. Then C is universal for L.

Proof (Sketch.) We do the proof for PCF_{V}^{++}; the proof is easily adapted to work for the other variants. Let G : EDom → Mod(K_{1}) be as in Section 7.2. An easy exercise in recursion theory shows that each object GD is isomorphic to some object X such that ⋃_{x∈|X|} ∥x∥ = N (cf. [31, Lemma 1.16]). For each σ, let X^{σ} ≅ C_{V}^{σ} be some object with this property; then there is a morphism N → X^{σ} tracked by i that is surjective on the underlying sets. But Mod(K_{1}) is universal for PCF_{V}^{++}, so there exists a term K^{σ} : ι → σ that denotes the corresponding morphism N → C_{V}^{σ}. The rest of the proof proceeds as outlined above. □

The axioms and rules of logic K(L) as we have presented it only allow us to deduce tautologies of predicate logic—it does not allow us to prove any interesting properties of programs. To turn K(L) into a useful program logic, we would have to add further axioms that gave information about the values of terms of L. For instance, we could “axiomatize” the fixed point operator by including as axioms all judgements of the forms

⊢ μx^{σ}.M ≃ M[μx^{σ}.M/x], ⊢ (N ≃ M[N/x]) ⇒ ((μx^{σ}.M) ⊑ N),

where M ⊑ N is syntactic sugar for ∀f^{σ→ι}. (fM ⇓) ⇒ (fN ⇓). We would then check that all these axioms were true in some universal model C under our denotational interpretation; Theorem 8.1.4 would then assure us that if we can prove ⊢ φ from the axioms then φ is operationally true. This would show that our operational interpretation was legitimate. It would be interesting to work out the details of some good sets of axioms for particular languages L. It seems that the logics obtained would be very much in the spirit of LCF, but with some extra “effectivity” principles (such as Church’s Thesis) arising from the fact that variables range over computable rather than continuous elements.

8.2 Constructive logic

Many people have claimed that an advantage of synthetic domain theory is that one can use the internal logic of a topos to reason about domains in a clean and familiar “set-theoretic” way (see e.g. [90,59,63]). Some of these people have also suggested that the internal logic might provide a convenient setting for “naive” reasoning about programs (see e.g. [25]). We are therefore prompted to ask: Can we give a naive operational interpretation of the internal logic, so that the meaning of the logical formulae can be made intelligible to programmers? In this section we discuss this question for the case of realizability models. The ideas here are at present rather tentative, and we do not attempt much more than a broad philosophical overview, omitting all the proofs. (We hope that these will appear elsewhere.)

The internal logic of RT(A) corresponds to (a generalization of) Kleene’s realizability interpretation of constructive logic (see the Introduction). Already this can be seen as having some operational content in that it refers to “computations” in the abstract machine A. However, from a programmer’s point of view this kind of operational meaning is not very satisfactory, since it is dependent on the way in which our high-level language L is implemented in terms of a low-level “machine language”—something that ought to be (and in practice is) hidden from the programmer. We would prefer an interpretation that made reference only to the operational semantics of L. Moreover, if such an interpretation is to agree with the internal logic then it should have some “constructive” content. This leads us to propose the notion of typed realizability: a formula will be operationally true iff it is “realized” by a term of the typed language L.

We will sketch the idea in the case that L is a call-by-name language. In fact we will need to extend L by adding a unit type υ and product types σ×τ; we also add a constant ∗ : υ and term constructors ⟨−, −⟩, fst, snd. The term formation and evaluation rules may be given in the obvious way; we write L^{×} for the extended language so obtained. We consider a constructive many-sorted logic J(L^{×}), whose sorts are the types of L^{×} and whose expressions are the terms of L^{×}. The syntax of formulae of J(L^{×}) is defined exactly as for K(L). The axioms and inference rules of J(L^{×}) (if we want them) are exactly like those of K(L), except that in place of the classical propositional tautologies we just take the intuitionistic ones.

We will define what it means for a term P of L^{×} to realize a sentence φ of J(L^{×}). To do this, we first associate with each formula φ a type ρ(φ); realizers for φ (if any) will then be certain terms P : ρ(φ). The type ρ(φ) is determined by the syntactic shape of φ as follows:

ρ(false) = ρ(M ≃ N) = ρ(M ⇓) = υ ; \begin{aligned}ρ(φ ∧ ψ) & = & ρ(φ) × ρ(ψ) & ρ(φ ⇒ ψ) & = & ρ(φ) → ρ(ψ) \\ ρ(∃x^{σ}.φ) & = & σ × ρ(φ) & ρ(∀x^{σ}.φ) & = & σ → ρ(φ) \end{aligned}

We can now define a relation P r φ between closed formulae φ and closed terms P : ρ(φ) of L^{×}:

• P r false never holds;

• P r (M ≃ N) iff M ≈ N and P ⇓;

• P r (M ⇓) iff M terminates and P ⇓;

• P r (φ ∧ ψ) iff (fst P) r φ and (snd P) r ψ;

• P r (φ ⇒ ψ) iff (P Q) r ψ whenever Q r φ;

• P r (∀x^{σ}.φ) iff (P Q) r φ[Q/x] for all closed Q : σ;

• P r (∃x^{σ}.φ) iff (snd P) r φ[fst P/x].

We say that a closed formula φ is typed-realizable (and write ⊧_{tr} φ) if P r φ for some P : ρ(φ). (Note that we have not considered disjunction here: it is not clear what ρ(φ ∨ ψ) should be since in general ρ(φ) and ρ(ψ) are different. The easiest solution seems to be to drop disjunction from the logic and translate φ ∨ ψ by the formula

∃n^{ι}. (n ⇓) ∧ ((n = 0) ⇒ φ) ∧ (¬(n = 0) ⇒ ψ).

Another solution might be by adding sum types to L^{×}.)

As an easy exercise, the reader might like to check that the axiom of choice is typed-realizable, i.e. for any two-place formula φ(x^{σ}, y^{τ}), we have

⊧_{tr} (∀x^{σ}.∃y^{τ}. φ(x, y)) ⇒ (∃f^{σ→τ}.∀x^{σ}. φ(x, fx)).

The definition of typed realizability has an obvious affinity with the “propositions as types” idea in type theory, though we have not explored this connection. It is not clear whether the notion of typed realizability is of any practical use— conceivably one could use it as a basis for some kind of extraction of programs from proofs. From our point of view, however, its interest lies in the fact that it is defined using purely “operational” concepts, and makes no reference to a denotational model.

It is also interesting to note that typed realizability is related to the notion of operational truth (Definition 8.1.1) via the well-known double-negation translation. More precisely, for any closed formula φ of K(L^{×}) we have ⊧_{op} φ iff ⊧_{tr} φ^{¬¬}, where φ^{¬¬} is the double-negation translation of φ. This is analogous to a more familiar fact for Kleene realizability: a formula φ of arithmetic is classically true iff φ^{¬¬} has a realizer in K_{1}.

How well does the typed realizability interpretation of J(L^{×}) agree with its interpretation as the internal logic of a topos? More precisely, can we find a topos C such that a sentence φ is typed-realizable iff it is internally true in C? In order to address this question, we will first specify how we interpret J(L^{×}) internally in C, using standard ideas from categorical logic. In fact, since the logic J(L^{×}) contains no impredicativity, we do not even require a topos; we therefore assume only that C is a PCF-model supporting L^{×}, and is regular and locally cartesianclosed (cf. Paragraphs 1.2.2 and 4.1.2). Concretely, this means that if Mod(A) supports L^{×}, we can model J(L^{×}) entirely within Mod(A) without reference to the topos RT(A). (Since the inclusion Mod(A) ↪ RT(A) is locally cartesianclosed and exact, we of course get the same interpretation by working in Mod(A) as in RT(A).)

Recall from Chapter 6 that if Γ = ⟨x_{1}^{σ_{1}}, …, x_{n}^{σ_{n}}⟩ then [[ Γ ]] = C_{N}^{σ_{1}} × ⋯ × C_{N}^{σ_{n}}. A formula φ of J(L^{×}) whose free variables are among those in Γ will be interpreted by a subobject [[ φ]]_{J}^{Γ} of [[ Γ ]] (i.e. an isomorphism class of monos with codomain [[ Γ ]])—we may think of this subobject as the extension of the predicate φ. We may define [[ φ]]_{J}^{Γ} as follows:

• [[ M ≃ N ]]_{J}^{Γ} is the equalizer of [[ M ]]^{Γ}, [[ N ]]^{Γ} : [[ Γ ]] \overrightarrow{→} C^{σ}.

• [[ M ⇓]]_{J}^{Γ} is the pullback of D^{σ} ↣ C^{σ} along [[ M ]]^{Γ}.

• [[ false ]]_{J}^{Γ} may be obtained as [[ 0 ≃ 1 ]]_{J}^{Γ}.

• [[ φ ∧ ψ]]_{J}^{Γ} is the intersection (given by pullback) of [[ φ]]_{J}^{Γ} and [[ ψ]]_{J}^{Γ}.

• [[ φ ∨ ψ]]_{J}^{Γ} is the subobject given by the image factorization of [[[ φ]]_{J}^{Γ}, [[ ψ]]_{J}^{Γ}].

• [[ φ ⇒ ψ]]_{J}^{Γ} = Π_{f}(f^{∗}([[ ψ]]_{J}^{Γ})), where f = [[ φ]]_{J}^{Γ}.

• [[ ∀x^{σ}.φ]]_{J}^{Γ} = Π_{π^{Γ}}([[ φ]]_{J}^{Γ,x^{σ}}), where π^{Γ} is the projection [[ Γ, x^{σ}]] → [[ Γ ]].

• [[ ∃x^{σ}.φ]]_{J}^{Γ} is the subobject given by the image factorization of π^{Γ} ∘ [[ φ]]_{J}^{Γ,x^{σ}}.

It can be shown that the axioms and inference rules of J(L^{×}) are sound with respect to this interpretation. We say φ is internally valid in C, and write C ⊧_{J} φ, if the subobject [[ φ]]_{J}^{Γ} is entire (i.e. is represented by id_{[[ Γ ]]}). In the case C = Mod(A), it can be shown that this interpretation corresponds to (a generalization of) Kleene’s realizability: a closed formula φ is internally valid in Mod(A) iff φ is realizable by an (untyped) element of A. For such models one can also show that the notions of external and internal validity are related via the double-negation translation: for closed formulae φ of K(L^{×}) we have C ⊧_{K} φ iff C ⊧_{J} φ^{¬¬}.

We declare a model C to be logically fully abstract for J(L), or constructively l.f.a., if for every closed formula φ of J(L) we have C ⊧_{J} φ iff ⊧_{tr} φ. This is evidently a very strong condition indeed, so we need to ask whether we have any examples at all of constructively l.f.a. models. From the above remarks it follows that a model is logically fully abstract for K(L^{×}) iff it is logically fully abstract for the double-negation fragment of J(L^{×}); hence any constructively l.f.a. model would also be classically l.f.a. This prompts us to look at our two known examples of classically l.f.a. models for L^{×} where L is PCF_{N}^{++}, namely Mod(K_{1}) and Mod(Pω_{re}). (Officially we have shown only that these models are classically l.f.a. for L, but the results extend easily to L^{×}.)

It is easy to see that the model Mod(K_{1}) is not constructively l.f.a. for L^{×}. In particular, every instance of the axiom of choice is typed-realizable (see above), though not every instance is internally valid in Mod(K_{1}). For example, suppose φ(f^{ι→ι}, e^{ι}) is a formula expressing “e tracks f”; then we have

Mod(K_{1}) ⊧_{J} ∀f.∃e. φ(f, e) but not Mod(K_{1}) ⊧_{J} ∃G.∀f. φ(f, Gf).

Intuitively, this is because although we can (trivially) transform codes for f into realizers for f, we cannot do this in an extensional way—there is no way to extract a canonical realizer for each f. This is exactly the same argument as that used in Paragraph 7.3.2 to show that N_{⊥}^{N} is not projective in Mod(K_{1}).

For Mod(Pω_{re}) the situation seems more promising. Here all objects C^{σ} are projective (see Proposition 7.3.14). In fact every instance of the axiom of choice is internally valid in Mod(Pω_{re}), and more generally if ∀x^{σ}.ψ is internally valid then it has an (untyped) realizer that behaves extensionally on elements of C^{σ}. Thus it is reasonable to ask whether this model is logically fully abstract for J(L^{×}). (In a talk given at the CLiCS II workshop in Paris I claimed this was true.) Curiously, this result holds for the fragment of J(L) without implication, though not for the whole of J(L). A counterexample is the following:

∀x^{υ}y^{υ}. ¬(x ⇓ ∧ y ⇓) ⇒ ∃n^{ι}. (x ⇓ ⇒ n = 0) ∧ (y ⇓ ⇒ n = 1).

This formula is internally valid in Mod(Pω_{re}). To see this, let S be the regular subobject of Σ × Σ determined by the predicate ¬(x ⇓ ∧ y ⇓). Intuitively, given a realizer for an element of S we can obtain a realizer for a suitable element n of N_{⊥}. In fact S is projective, so we even obtain a morphism S → N_{⊥}. However, the above formula is not typed-realizable. For if P were a typed realizer and Q were any term of type ρ(¬(x ⇓ ∧ y ⇓)), then P XY Q would yield an element of N_{⊥} for all X, Y : υ, whether or not these satisfied ¬(X ⇓ ∧ Y ⇓). But there is no monotone way to extend the above morphism S → N_{⊥} to the whole of Σ × Σ.

It seems that we can resolve this difficulty by switching to a slightly different model, one based on Kreisel’s modified realizability. The idea behind Kreisel’s notion is that for each formula φ we have not only a collection of “actual” realizers R, but also a larger domain of “potential” realizers P ⊇ R. The roles of R and P are different: the elements of R behave much like Kleene realizers and provide “computational evidence” for φ, whereas P is determined by the syntactic shape of φ and embodies “type information” about realizers. The modified realizability interpretation of implication is different from the standard one: a realizer for φ ⇒ ψ must not only map actual realizers for φ to actual realizers for ψ, but also map potential realizers for φ to potential realizers for ψ:

R_{φ⇒ψ} = (R_{φ} ⇒ R_{ψ}) ∩ (P_{φ} ⇒ P_{ψ}), P_{φ⇒ψ} = (P_{φ} ⇒ P_{ψ}).

Thus realizers for implications have a larger domain of definition than in standard realizability. So it seems at least plausible that modified realizability can help us to overcome the above deficiency of the model Mod(Pω_{re}).

Fortunately, it appears that we can obtain the result we want without reworking the whole of this thesis for the case of modified realizability! We give here a rough outline of the story—we hope the details will appear elsewhere. For any PCA A, we can define a category mMod(A) of modified modest sets as follows: The objects of mMod(A) are pairs (X, P_{X}), where X is an object of Mod(A) and P_{X} ⊆ A is such that ∥x∥ ⊆ P_{X} for each x ∈ |X|. (We regard P_{X} as the set of potential realizers for elements of X.) A morphism (X, P_{X}) → (Y, P_{Y}) is a function f : |X| → |Y | for which there exists r ∈ A such that r tracks f in the usual sense and additionally a ∈ P_{X} ⇒ ra ∈ P_{Y}. (This category in fact sits as a subcategory inside a modified realizability topos mRT(A), though we do not need this here.)

Let us say that a modified modest set (X, P_{X}) is tight if P_{X} = ⋃_{x∈|X|} ∥x∥. The full subcategory of tight objects is clearly isomorphic to Mod(A), so we have a full and faithful embedding E : Mod(A) → mMod(A), left adjoint to the forgetful functor. It is easy to see that mMod(A) is cartesian-closed, and that E preserves the cartesian-closed structure. One can also check that if Σ is a dominance in Mod(A) then EΣ is a dominance in mMod(A) and E commutes with lifting. Moreover, if (Mod(A), Σ) is a PCF-model then so is (mMod(A), EΣ), and E preserves the PCF-model structure. Thus the results of Section 7.3 transfer directly from Mod(Pω_{re}) to mMod(Pω_{re}): the latter is a universal model for L = PCF_{N}^{++}, and every object C_{N}^{σ} in mMod(Pω_{re}) is isomorphic to one with the “singleton property”. Furthermore, mMod(Pω_{re}) is locally cartesian-closed and regular, and so we can interpret the logic J(L^{×}) in mMod(Pω_{re}) as above. However, the embedding E crucially does not preserve this structure, and so the interpretation of J(L^{×}) in mMod(Pω_{re}) is different from that in Mod(Pω_{re}).

We believe that mMod(Pω_{re}) is indeed logically fully abstract for J(L^{×}). The idea of the proof is as follows: one first translates the above definition of the interpretation in mMod(Pω_{re}) into an equivalent “concrete” definition involving realizers—this turns out to correspond precisely to Kreisel’s modified realizability interpretation. One then checks that the potential (untyped) realizers for any formula φ are precisely the potential realizers for elements of the object C^{ρ(φ)}— these correspond to the codes for potential typed realizers. Hence one can show that the actual untyped realizers for φ correspond precisely to codes for actual typed realizers of φ. Thus φ has a typed realizer iff it has an untyped one. (Although this proof seems to work, we have not yet checked all the details.)

Assuming our result is true, we have a very strong connection indeed between the model mMod(Pω_{re}) and the language (PCF_{N}^{++})^{×}. It would be interesting to know whether one could obtain similar results for the call-by-value and lazy variants of this language.

We end with an intriguing question: Is it plausible that the model Mod(Λ^{0}/B) is constructively l.f.a. for (PCF_{N})^{×}? We have argued in Section 7.4 that this model is likely to be universal (and hence classically l.f.a.) for PCF_{N}. It also seems plausible that all the required instances of the axiom of choice are internally valid in Mod(Λ^{0}/B), even though in general the objects C_{N}^{σ} are not projective. Moreover, the formula given above as a counterexample for Mod(Pω_{re}) is not internally valid in the model Mod(Λ^{0}/B) (the Böhm tree enthusiast may enjoy checking this). However, these observations are not convincing evidence that constructive l.f.a. holds in general, and on this question I have no strong feelings either way! But it may be that many questions of this kind will remain out of reach until we have a much deeper understanding of the nature of sequential computation.

Conclusions and further work

We conclude with some philosophical remarks on the material in this thesis, and some suggestions for further research. Many of the opinions expressed in this chapter are quite personal, so it should be read with a degree of scepticism!

9.1 Conclusions

There are several philosophical points we wish to make about the material in this thesis. It seems best to discuss these under various headings.

Notions of computability

Throughout this thesis, our emphasis has been on studying PCAs and realizability models for their recursion-theoretic interest. We have regarded PCAs as models for a kind of abstract recursion theory, with different PCAs embodying different “notions of computability”. Many aspects of these notions of computability become more clearly visible when we construct the realizability models (for instance, we find that different PCAs give rise to different type structures). Moreover, some of our results on applicative morphisms in Chapters 2 and 3 indicate that the realizability models are “more abstract” than the PCAs, in the sense that non-isomorphic PCAs may give rise to “the same” realizability models. The realizability models thus seem to be the more natural setting for studying the notions of computability, in that they abstract away from uninteresting “coding” details associated with particular PCAs.

The PCF-like typed languages that we have considered can also be thought of as defining notions of computability at higher types. It appears that work in recursion theory at higher types has tended to concentrate more on total functionals than on partial ones (see e.g. [49,30]). However, to me it seems more natural to consider the partial functionals—not least because one can give languages with a decidable syntax (such as PCF^{++}) in which all the partial functionals of some natural hierarchy (and only they) are definable. (Contrast this with the fact that there is no recursive enumeration for the total recursive functions even at type 1.) Of course, there are choices to be made in the design of such languages, in particular the choice of evaluation mechanism—however, the results of Chapter 6 show that different choices give rise to languages that embody the same notion of computability in some deeper sense. The main theorems (and conjectures) of Chapter 7 can thus be viewed as recursion-theoretic facts expressing the harmony between certain “typed” and “untyped” notions of computation.

From a computer science point of view, the recursion-theoretic nature of realizability models has the benefit that one can obtain universality and full abstraction results for a variety of languages. Indeed, the fact that we have a choice of universal models for PCF^{++} prompts us to consider even stronger connections between languages and models (for instance, constructive logical full abstraction). We believe that the results of Chapter 8, although rather tentative, indicate that there are some interesting fine distinctions between different notions of computation that do not show up as differences in the corresponding type structures.

There are many other features of realizability toposes that spring from their recursion-theoretic content: for instance, the existence of internally complete subcategories, which allows us to solve domain equations and model strongly polymorphic languages. Although these have not been considered in this thesis, I hope that what I have done illustrates that realizability toposes are attractive objects of study from a recursion-theoretic point of view. It is in the recursion-theoretic aspects of realizability models that I believe their main interest lies.

The “domains as sets” philosophy

We now turn to consider a different (but related) aspect of realizability toposes: the fact that they contain categories of domains as full subcategories, and hence in principle allow one to treat domains simply as “sets”. It was first suggested by Scott [90] that because cartesian-closed categories could be embedded in toposes, one could use full higher-order intuitionistic logic for reasoning about the corresponding typed λ-calculi. This idea has been developed further by synthetic domain theory, although here the approach is usually slightly different: we start with a topos and then try to identify a full subcategory of “domains”. It is perhaps possible to separate out three distinct claims that are sometimes made in connection with this approach:

• It is intuitive: it allows us to think of a domain simply as a set.

• It saves us work: for instance, we never need to check that a function is continuous, as this is automatic.

• It is powerful: we use the higher-order logic of a topos to reason about domains and elements of them.

The first of these points is a conceptual rather than a technical one; it rests on the idea that a topos can be viewed as a universe of constructive set theory. However, one very soon discovers counter-classical features of synthetic domain theory which betray that we are not dealing with sets in the “usual” sense (for instance, the fact that there is no function interchanging the two points of Σ), and so it seems debatable whether this naive intuition is really helpful. Besides, some people (including myself) are left dissatisfied by an abstract high-level “naive” theory that hides the concrete details of the models—they feel a need to understand what is inside the “black box”.

The second point has been strongly advocated by McCarty [59], who cites several examples of “tiresome calculations” (e.g. the check that λ-terms define computable maps) that become superfluous if one believes that all functions are continuous and computable. To me it seems a moot point whether any of these calculations were ever particularly onerous anyway. But in any case, the benefit of saved labour is only enjoyed by theoreticians and semanticists, not by programmers or program verifiers. It seems that in the course of proving properties of programs one would rarely need to check that some function was continuous, once a theoretician had shown that all syntactically definable functions were so.

The last point concerns the internal logic of toposes. It seems clear that in the hands of specialists this is a powerful and effective weapon for proving mathematical facts about the toposes and their internal subcategories. Many of the proofs in [71] and [40], for example, would be much more cumbersome without the use of the internal logic, and it seems that some of our own proofs in Chapter 5 could be simplified by using it. Recently Reus and Streicher [81] have shown how the basic results of synthetic domain theory can be developed axiomatically by working entirely in the internal logic. So there does seem to be some substantial evidence for this last claim.

However, while the internal logic may be extremely useful as a tool for theoretical investigation, I personally believe that it is wrong to view it as the basis for a usable program logic. In Chapter 8 I suggested that a good program logic should not be simply a piece of formal machinery but should have have a clear and intuitive operational interpretation—not least so that the program verifier can understand (and explain) the meaning of the correctness property he has proved! The results in Chapter 8 show that a very simple-minded classical logic can be given a good operational interpretation of the kind that is wanted; and whilst in certain models the internal logic also seems to have an operational interpretation (typed realizability), it is rather esoteric and not obviously useful for proving the correctness of programs. Besides, whatever the philosophical arguments in favour of constructive logic may be, there seem to be good pragmatic reasons for preferring classical logics: for example, larger fragments of the logic are decidable, and decision algorithms for decidable fragments are often of a lower inherent complexity.

In defence of the internal logic, tt might be argued that one only really needs a good operational interpretation for particularly simple formulae of the logic—for example, for equalities between programs. But even if this is so, I do not know of any practical reason for wanting to use more than the double-negation fragment of the internal logic. (I reached this conclusion after carrying out the correctness proofs for some simple ML programs “in the internal logic”—I then noticed that exactly the same proofs could be much more naturally understood as classical proofs via the notion of operational truth given in Section 8.1.)

I also believe that the results in Chapter 8 illustrate another point: in order to have a good internal logic it is less essential to work in a topos than is sometimes assumed. Everything in this thesis from Chapter 4 onwards really takes place within Ass(A), including the “internal” interpretation of the logic J(L^{×}) in Section 8.2. (It seems that for our purposes the structure of a logos suffices—see [29].) The topos RT(A) only plays a background role, and at present we do not have a real use for it from the point of view of programming languages. It would be interesting to know whether for the study of programming languages there is any real advantage in working in RT(A).

Semantic versus syntactic methods

Next we discuss a question that seems to apply quite generally to much work in denotational semantics. We have seen how our denotational models can be used to obtain program logics for our languages and prove that they are “sound”. We end up with a result that can be seen as purely “syntactic”: all the judgements provable in some logic are true of the programming language under some operational interpretation. So we should ask: do our semantic (i.e. denotational) methods have any significant advantage over purely syntactic (i.e. operational) ones? This question seems particularly pertinent to our set-theoretic models of the classical logics K(L) in Section 8.1, since here the denotation of a type is (up to isomorphism) nothing other than the set of closed terms of that type modulo observational equivalence. Given that such a direct syntactic construction of this model is possible, one may reasonably ask whether one really learns anything new from more roundabout semantic constructions. In particular, could the soundness of our program logic not be proved just as simply by purely operational means?

I do not know the answer to this question, but there are two tentative suggestions I would like to make. The first is that for the simple PCF-like languages we have considered, the honest answer is probably that the semantic methods have no technical advantage over the syntactic ones. Even the validity of logical axioms expressing the minimality property of the fixed point operator could probably be proved operationally without too much effort. But it does seem at least plausible that for larger and more complex programming languages the syntactic approach would be far less feasible, but that the semantic approach would still be tractable and relatively clean. However, it should be stressed that this is speculation on my part—in this thesis we have not even worked out the details of logical axioms for our PCF-like languages!

My second suggestion is that even if there is no technical advantage in the use of semantic models, they may still be useful conceptually and methodologically. The fact that certain results in retrospect could have been proved syntactically does not mean that they could have been arrived at just as easily by syntactic considerations. Indeed, a consideration of the semantic models could guide us in the design of a good program logic—one for which we knew we would be able to obtain reasonable proof rules.

It would be interesting to know whether our models could shed any useful light on formalisms such as Extended ML [47], the design of which seems to have proceeded along much more syntactic lines. My personal feeling is that it will be very difficult to take an already complicated language definition and “add on” proof rules—in principle it would seem better to take a logic that arises “naturally” from some semantic setting. Of course, the fragment of ML treated in [47] is far more complex than the languages we have considered, and the technology needed for modelling it denotationally cannot yet be said to be fully-fledged!

Limitations of this thesis

We now point out a few of the limitations and shortcomings of the material presented in this thesis.

(1). Our account of realizability toposes has been somewhat one-sided: in particular, we have taken no account of the construction of RT(A) via tripos theory [76,41]. A tripos is essentially an indexed preorder with enough structure to allow us to model higher-order intuitionistic logic; every PCA gives rise to a “realizability tripos”, and every tripos gives rise to a topos. Since we know that our applicative morphisms correspond precisely to certain functors between the toposes, it is natural to ask what they correspond to at the level of triposes. For the benefit of the specialist we may simply state the answer here: they correspond to the indexed functors that preserve “regular logic” (i.e. that preserve finite limits in each fibre and commute with the functors ∃_{f} between fibres). The details may appear elsewhere.

(2). So far we have used the theory of applicative morphisms principally to obtain negative results, in particular the inequivalence of various toposes. It would be nice, however, if one could find some more positive applications, i.e. some good consequences of the existence of certain applicative morphisms. It is frustrating (and somewhat surprising) that we do not seem to obtain much interesting information from them about the relationships between the (total or partial) type structures in different models. We saw in Proposition 7.4.2 how in certain circumstances the existence of an applicative inclusion can be used to show that two models possess isomorphic type structures, but it seems that we can only obtain results of this kind in rather trivial cases when one of the PCAs is a homomorphic quotient of the other. None of our examples of applicative retractions seem to tell us anything interesting at all beyond the mere existence of the corresponding functors.

(3). We have not told the full story about the category of well-complete objects in Chapter 5. In particular, we have not shown that this category is internally complete—we would need to show this in order to justify our claim that it compares favourably with other proposed categories of domains in our models. An account of the details is in preparation.

(4). Finally, we note that with hindsight our exposition would have been cleaner if in Chapter 6 we had included product types and a unit type in the definition of PCF. Not only would this give greater continuity between Section 8.2 and the rest of the thesis, but it would also have allowed us to define the embedding of PCF_{L} in PCF_{N} in a more perspicuous way, since we could have taken { \atop σ → τ} to be υ ×(σ̃ → τ̃) rather than ι → σ̃ → τ̃. This in turn would have greatly simplified the rather messy proofs of the definability lemmas in Section 6.4.

9.2 Directions for further work

Other notions of realizability

In this thesis we have concentrated almost entirely on models based on so-called standard realizability—essentially the generalization of Kleene’s original notion [48] to an arbitrary PCA. One obvious line of inquiry would be to ask whether the ideas and results can be carried over to other notions of realizability. There is a rather bewildering array of “other realizabilities” that one could explore: a very useful survey is given in Chapter 1 of [68]. Perhaps the most natural one to consider next would be the notion of modified realizability—we touched on this in Section 8.2. Modified realizability toposes have already been studied in [68] and [42]. Another direction would be to consider the toposes based on van Oosten’s “≤-PCAs” [69], an attractive generalization of ordinary PCAs admitting some interesting examples.

For any of these notions, one can ask the following questions. Can we find a notion corresponding to applicative morphisms and prove a result analogous to Theorem 2.3.7? Can we find good “categories of predomains” in the corresponding toposes—in particular does an idea analogous to our notion of well-complete object work well? Can we obtain universality and full abstraction results for these models analogous to those in Chapter 7? What about constructive logical full abstraction? (In Chapter 8 we briefly discussed the last two of these questions for the case of modified realizability.)

Models for sequential computation

The general problem of understanding the nature of “sequential” computation is the subject of a great deal of current research. This problem is far broader than just the celebrated full abstraction problem for PCF, and would seem to be relevant to the study of all kinds of sequential programming languages. Some very interesting advances have recently been made (see e.g. [3,43,65]), although several open questions remain. It would therefore be very interesting to find realizability models that corresponded well to sequential notions of computation.

In Chapter 7 we conjectured that the category Mod(Λ^{0}/B) provides a universal model for sequential PCF. Although at present this particular conjecture seems (to me) rather intractable, it seems very likely that the problem could be made much easier by a different choice of PCA. None of the natural “sequential” PCAs that we have considered so far seem to fit the bill, but it does seem that for slightly artificial PCAs the situation is more hopeful. (It might not matter too much if the PCA underlying our model was slightly ugly, since we would be interested mainly in its abstract categorical properties.) It is also conceivable that the problem might be easier for some model based on a “non-standard” notion of realizability.

Once we had constructed such a model for PCF, we would want to ask whether it provided a good setting for modelling sequential computation more generally (whatever that means). It would also be interesting to see how it compared with other known fully abstract models for PCF. The most obvious difference would appear to be that our model would naturally live inside a topos, and this might be an advantage in some respects.

It would also be quite interesting to know whether there are natural examples of realizability models giving partial type structures in between those corresponding to PCF and PCF^{++}—in other words, models whose “degree of parallelism” lies between these (see [86]). A very strong conjecture would be that for any degree of parallelism there is a realizability model having the corresponding partial type structure.

Other programming language features

The programming languages that we have considered in this thesis have been particularly simple. It is therefore natural to ask what happens when we try to interpret richer languages in our models.

One obvious way of extending our PCF-languages would be to add recursive types. We can interpret these in our models using the fact that the category of wellcomplete objects (or some other category of predomains) is internally complete. It would be interesting to give an interpretation for a language such as Plotkin’s FPC in our models and try to obtain an adequacy theorem, perhaps along the lines of [23]. It would also be interesting to try and formulate an appropriate version of the limit-colimit coincidence for our models. On a related note, one could settle the question whether the embeddings of Sections 7.2 and 7.3 preserve initial solutions of domain equations. Finally, one could try to obtain universality and (equational or logical) full abstraction results for recursively-typed languages with respect to particular realizability models. We conjecture that a recursively-typed version of PCF^{++} has a universal interpretation in Mod(K_{1}) (some work of Streicher [96] seems to be relevant here).

Another way of extending our programming languages would be to incorporate polymorphism. It is known that the existence of internally complete subcategories in our models can be exploited to give interpretations of strongly polymorphic languages. An alternative approach—albeit applicable only to first-order (i.e. “ML-style”) polymorphism—is via polynomial categories (see [25]). This latter approach seems to have the advantage that we can naturally extend our notion of “operational truth” to polymorphic formulae and maintain a “logical full abstraction” property: a polymorphic formula is taken to be operationally true precisely when all ground instances of it are operationally true. This means we can prove polymorphic properties about polymorphic programs and then instantiate them as required—thus polymorphism gives us reusable proofs as well as reusable programs. It would be nice to work out these ideas in more detail.

One could easily imagine adding more and more language features until one attained the complexity of a “real” programming language. As our languages get larger, one challenging problem is to design good program logics that remain reasonably intuitive and tractable—it is here that we feel a semantic understanding of the languages becomes indispensable. Moreover, the concept of logical full abstraction might be useful in providing a “guiding philosophy” for the design of such logics: we try to find logical constructs for which we can give a simple operational interpretation, and then hope that we can match it by a denotational interpretation in some model. As we have seen, realizability models seem to be good candidates because of their inherently recursion-theoretic nature. And although notions of realizability by no means provide the only good source of suitable models, we believe that they should continue to be studied alongside other approaches to denotational semantics.

Bibliography

[1] M. Abadi and G. Plotkin. A PER model of polymorphism and recursive types. In Proc. of 5th Annual Symposium on Logic in Computer Science, 1990.

[2] S. Abramsky. The lazy lambda-calculus. In D.L. Turner, editor, Research Topics in Functional Programming. Addison-Wesley, 1989.

[3] S. Abramsky, R. Jagadeesan, and P. Malacaria. Full abstraction for PCF (Extended abstract). In Proceedings of TACS ’94. Springer LNCS 789, 1994.

[4] S. Abramsky and C.-H. L. Ong. Full abstraction in the lazy lambda calculus. Information and Computation, 105, 1993.

[5] R. Amadio. Recursion over realizability structures. Information and Computation, 91, 1991.

[6] R. Amadio. On the adequacy of PER models. Technical Report 1579, INRIA, 1992.

[7] H.P. Barendregt. The lambda calculus. In J. Barwise, editor, Handbook of Mathematical Logic. North-Holland, 1977.

[8] H.P. Barendregt. The Lambda Calculus: Its Syntax and Semantics. North-Holland, revised edition, 1984.

[9] M. Barr and C. Wells. Toposes, Triples and Theories. Springer, 1985.

[10] M. Beeson. Foundations of Constructive Mathematics. Springer, 1985.

[11] G. Berry and P.-L. Curien. Sequential algorithms on concrete data structures. Theoretical Computer Science, 20(3), 1982.

[12] I. Bethke. Notes on Partial Combinatory Algebras. PhD thesis, Universiteit van Amsterdam, 1988.

[13] B. Bloom and J.G. Riecke. LCF should be lifted. In Proc. Conf. Algebraic Methodology and Software Technology. Dept. Comp. Sci., University of Iowa, 1989.

[14] A. Carboni. Some free constructions in realizability and proof theory. Preprint, 1993.

[15] A. Carboni, P. Freyd, and A. Scedrov. A categorical approach to realizability and polymorphic types. In Lecture Notes in Computer Science 298. Springer, 1988.

[16] J.H. Cheng and C.B. Jones. On the usability of logics which handle partial functions. In C. Morgan and J. Woodcock, editors, Proc. Third Refinement Workshop. Springer, 1990.

[17] N.J. Cutland. Computability. Cambridge University Press, 1980.

[18] L. Egidi, F. Honsell, and S. Ronchi della Rocca. The lazy call-by-value λ-calculus. Preprint.

[19] T. Ehrhard. A categorical semantics of constructions. In Proc. of 3rd Annual Symposium on Logic in Computer Science, 1988.

[20] Yu.L. Ershov. Computable functionals of finite type. Algebra i Logika, 11(4), 1972.

[21] Yu.L. Ershov. The theory of A-spaces. Algebra i Logika, 12(4), 1972.

[22] Yu.L. Ershov. Theorie der Numerierungen I. Zeit. Math. Logik, 19, 1973.

Bibliography 280 [23] M.P. Fiore and G.D. Plotkin. An axiomatisation of computationally ad-

equate domain theoretic models of FPC. In Proc. of 9th Annual Symposium on Logic in Computer Science, 1994.

[24] M.P. Fourman. The logic of topoi. In J. Barwise, editor, Handbook of Mathematical Logic. North-Holland, 1977.

[25] M.P. Fourman and W.K.-S. Phoa. A proposed categorical semantics for pure ML. Technical Report ECS-LFCS-92-213, Department of Computer Science, University of Edinburgh, 1992.

[26] P. Freyd, P. Mulry, G. Rosolini, and D.S. Scott. Extensional PERs. In Proc. of 5th Annual Symposium on Logic in Computer Science, 1990.

[27] P.J. Freyd. Aspects of topoi. Bull. Austral. Math. Soc., 7, 1972.

[28] P.J. Freyd. Algebraically complete categories. In Category Theory, Proceedings, Como 1990. Springer LNCS 1488, 1990.

[29] P.J. Freyd and A. Scedrov. Categories, Allegories. North-Holland, 1990.

[30] R.O. Gandy and J.M.E. Hyland. Computable and recursively countable functions of higher type. In Logic Colloquium ’76. North-Holland, 1977.

[31] P. Giannini and G. Longo. Effectively given domains and lambda-calculus models. Information and Control, 62, 1984.

[32] J.-Y. Girard. Interprétation functionelle et élimination des coupures de l’arithmétique d’ordre supérieur. PhD thesis, Paris, 1972.

[33] R. Goldblatt. Topoi: the Categorial Analysis of Logic. North-Holland, 1979.

[34] M. Gordon, R. Milner, and C. Wadsworth. LCF: A Mechanised Logic of Computation. Springer, 1978.

[35] C.A. Gunter. Semantics of Programming Languages. MIT Press, 1992.

[36] J.R. Hindley, B. Lercher, and J.P. Seldin. Introduction to Combinatory Logic. Cambridge University Press, 1972.

[37] J.M.E. Hyland. Filter spaces and continuous functionals. Ann. Math. Logic, 16, 1979.

[38] J.M.E. Hyland. The effective topos. In The L.E.J. Brouwer Centenary Symposium. North-Holland, 1982.

[39] J.M.E. Hyland. A small complete category. Annals of Pure and Applied Logic, 40, 1988.

[40] J.M.E. Hyland. First steps in synthetic domain theory. In Category Theory, Proceedings, Como 1990. Springer LNM 1488, 1990.

[41] J.M.E. Hyland, P.T. Johnstone, and A.M. Pitts. Tripos theory. Math. Proc. Camb. Phil. Soc., 88, 1980.

[42] J.M.E. Hyland and C.-H. L. Ong. Modified realizability toposes and strong normalization proofs. In J.F. Groote and M. Bezem, editors, Typed Lambda Calculi and Applications. Springer LNCS 664, 1993.

[43] J.M.E. Hyland and C.-H. L. Ong. Observational full abstraction for PCF: dialogue games and innocent strategies. Draft, 1994.

[44] J.M.E. Hyland, E.P. Robinson, and G. Rosolini. The discrete objects in the effective topos. Proc. Lond. Math. Soc., 3(60), 1990.

[45] P.T. Johnstone. Topos Theory. Academic Press, 1977.

[46] P.T. Johnstone and E.P. Robinson. A note on inequivalence of realizability toposes. Math. Proc. Camb. Phil. Soc, 105, 1989.

[47] S. Kahrs, D. Sannella, and A. Tarlecki. The definition of Extended ML. Technical Report ECS-LFCS-94-300, Department of Computer Science, University of Edinburgh, 1994.

[48] S.C. Kleene. On the interpretation of intuitionistic number theory. J. Symb. Logic, 10, 1945.

[49] S.C. Kleene. Recursive functionals and quantifiers of finite types I. Trans. Amer. Math. Soc, 91, 1959.

[50] S.C. Kleene and R.E. Vesley. The Foundations of Intuitionistic Mathematics. North-Holland, 1965.

[51] G. Kreisel. Interpretation of analysis by means of functionals of finite type. In A. Heyting, editor, Constructivity in Mathematics. North-Holland, 1959.

[52] J. Lambek and P.J. Scott. Introduction to Higher-Order Categorical Logic. Cambridge University Press, 1986.

[53] G. Longo. Set-theoretical models of lambda calculus: Theories, expansions and isomorphisms. Ann. Pure Appl. Logic, 24, 1983.

[54] G. Longo and E. Moggi. Cartesian closed categories of enumerations for effective type structures. In G. Kahn, D. MacQueen, and G. Plopkin, editors, Semantics of Data Types. Springer, 1984.

[55] G. Longo and E. Moggi. The hereditary partial functionals and recursion theory in higher types. J. Symb. Logic, 49(4), 1984.

[56] G. Longo and E. Moggi. Constructive natural deduction and its ‘ω-set’ interpretation. Math. Structures in Computer Science, 1, 1991.

[57] S. Mac Lane. Categories for the Working Mathematician. Springer, 1971.

[58] S. Mac Lane and I. Moerdijk. Sheaves in Geometry and Logic. Springer, 1992.

[59] D.C. McCarty. Information systems, continuity and realizability. In E. Clarke and D. Cozen, editors, Logics of Programs, Lecture Notes in Computer Science 164. Springer, 1984.

[60] D.C. McCarty. Realizability and Recursive Mathematics. PhD thesis, Oxford, 1984.

[61] R. Milner. Fully abstract models of typed λ-calculi. Theoretical Computer Science, 4, 1977.

[62] E. Moggi. Partial morphisms in categories of effective objects. Information and Computation, 76, 1988.

[63] E. Moggi. Computational lambda calculus and monads. In Proc. of 5th Annual Symposium on Logic in Computer Science, 1989.

[64] P.S. Mulry. Generalized Banach-Mazur functionals in the topos of recursive sets. J. Pure Appl. Algebra, 26, 1982.

[65] P.W. O’Hearn and J.G. Riecke. Kripke logical relations and PCF. Preprint, 1994.

[66] P.W. O’Hearn and R.D. Tennent. Semantics of local variables. In M.P. Fourman, P.T. Johnstone, and A.M. Pitts, editors, Applications of Categories in Computer Science. CUP, 1992.

[67] C.-H. L. Ong. The Lazy Lambda Calculus: An Investigation into the Foundations of Functional Programming. PhD thesis, Imperial College, University of London, 1988.

[68] J. van Oosten. Exercises in realizability. PhD thesis, Universiteit van Amsterdam, 1991.

[69] J. van Oosten. Extensional realizability. Technical Report ML-93-18, University of Amsterdam, ILLC, 1993.

[70] W.K.-S. Phoa. Relative computability in the effective topos. Math. Proc. Camb. Phil. Soc, 106, 1989.

[71] W.K.-S. Phoa. Domain Theory in Realizability Toposes. PhD thesis, University of Cambridge, 1990. Available as CST-82-91, Department of Computer Science, University of Edinburgh.

[72] W.K.-S. Phoa. From term models to domains. In Proc. of Theoretical Aspects of Computer Software, Sendai. Springer LNCS 526, 1991.

[73] W.K.-S. Phoa. Building domains from graph models. Math. Structures in Computer Science, 2, 1992.

[74] W.K.-S. Phoa. An introduction to fibrations, topos theory, the effective topos and modest sets. Technical Report ECS-LFCS-92-208, Department of Computer Science, University of Edinburgh, 1992.

[75] W.K.-S. Phoa. Adequacy for untyped translations of typed λ-calculi. In Proc. of 8th Annual Symposium on Logic in Computer Science, 1993.

[76] A.M. Pitts. The theory of triposes. PhD thesis, University of Cambridge, 1980.

[77] A.M. Pitts. Polymorphism is set-theoretic, constructively. In Category Theory and Computer Science, Edinburgh 1987. Springer, 1987.

[78] G.D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1, 1975.

[79] G.D. Plotkin. LCF considered as a programming language. Theoretical Computer Science, 5, 1977.

[80] G.D. Plotkin. Domains. Technical report, Dept. Comp. Sci., University of Edinburgh, 1983.

[81] B. Reus and T. Streicher. Naive synthetic domain theory—a logical approach. Preprint, 1994.

[82] J.C. Reynolds. Polymorphism is not set-theoretic. In G. Kahn, D. Mac-Queen, and G. Plotkin, editors, Semantics of Data Types. Springer, 1984.

[83] J.G. Riecke. Fully abstract translations between functional languages. Math. Struct. in Comp. Science, 3, 1993.

[84] E. Robinson and G. Rosolini. Colimit completions and the effective topos. J. Symb. Logic, 55, 1990.

[85] G. Rosolini. Continuity and Effectiveness in Topoi. PhD thesis, Oxford; Carnegie-Mellon, 1986.

[86] V.Yu. Sazonov. Degrees of parallelism in computations. In Mathematical Foundations of Computer Science 1976. Springer LNCS 45, 1976.

[87] H. Schellinx. Isomorphisms and non-isomorphisms of graph models. J. Symb. Logic, 56, 1991.

[88] D.S. Scott. Continuous lattices. In F.W. Lawvere, editor, Toposes, Algebraic Geometry and Logic. Springer, 1972.

[89] D.S. Scott. The language LAMBDA (abstract). J. Symb. Logic, 39, 1974.

[90] D.S. Scott. Relating theories of the λ-calculus. In J.P. Seldin and J.R. Hindley, editors, To H.B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism. Academic Press, 1980.

[91] D.S. Scott and C. Strachey. Towards a mathematical semantics for computer languages. In J. Fox, editor, Computers and Automata. Polytechnic Institute of Brooklyn Press, 1971.

[92] K. Sieber. Relating full abstraction results for different programming languages. In Proc. 10th Conference on Foundations of Software Technology and Theoretical Computer Science, Bangalore. Springer LNCS 472, 1990.

[93] D. Sitaram and M. Felleisen. Reasoning with continuations II: Full abstraction for models of control. In Conference on Lisp and Functional Programming. ACM, 1990.

[94] A. Stoughton. Interdefinability of parallel operations in PCF. Theoretical Computer Science, 79, 1991.

[95] T. Streicher. Correctness and Completeness of a Categorical Semantics of the Calculus of Constructions. PhD thesis, University of Passau, 1988.

[96] T. Streicher. A universality theorem for PCF with recursive types, parallelor and ∃. Math. Struct. in Comp. Science, 4, 1994.

[97] P. Taylor. The fixed point property in synthetic domain theory. In Proc. of 6th Annual Symposium on Logic in Computer Science, 1991.

[98] M.B. Trakhtenbrot. On representation of sequential and parallel functions. In Proc. 4th Symposium on Mathematical Foundations of Computer Science. Springer LNCS 32, 1975.

[99] A.S. Troelstra. Metamathematical Investigation of Intuitionistic Arithmetic and Analysis. Springer, 1973.

[100] A.S. Troelstra. Realizability. Technical Report ML-92-09, University of Amsterdam, ILLC, 1992.