FUNCTIONALITY, POLYMORPHISM, AND CONCURRENCY: A MATHEMATICAL INVESTIGATION OF PROGRAMMING PARADIGMS Peter Selinger A Dissertation in Mathematics

Presented to the Faculties of the University of Pennsylvania in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy

1997

Supervisor of Dissertation Graduate Group Chairperson

ii

COPYRIGHT PETER SELINGER

iv

In Memory of Moez Alimohamed 1967–1994

Acknowledgments

This research was supported by graduate fellowships from the Institute for Research in Cognitive Science and from the School of Arts and Sciences at the University of Pennsylvania, and by an Alfred P. Sloan Doctoral Dissertation Fellowship.

Some of the results in Chapters 3 and 4 were announced in a paper that appeared in the Proceedings of the Eleventh Annual IEEE Symposium on Logic in Computer Science [57]. Parts of Chapter 6 are scheduled to appear in the Proceedings of CONCUR ’97 [58].

Part of this research was done while I was visiting the Isaac Newton Institute at the University of Cambridge as an affiliated participant of the Semantics of Computation Program in the Fall of 1995.

I am grateful to Gordon Plotkin for introducing me to the problem of partial orders on term models, and for many stimulating and enjoyable discussions on the lambda calculus. He has kindly consented to the inclusion of his previously unpublished proof of Theorem 3.16, as well as the material in Section 3.4, some of which resulted from his discussions with Alex Simpson.

I would also like to thank Peter Freyd, Furio Honsell, Martin Hyland, Catuscia Palamidessi, Benjamin Pierce, Simona Ronchi, Davide Sangiorgi, Dana Scott, Phil Scott, and Glynn Winskel. They all have contributed valuable comments on parts of this work at various stages of its completion.

Thanks to Peter Freyd, David Harbater, Andre Scedrov, and Scott Weinstein for serving on my Ph.D. committee.

Thanks to the staff at the Math Department at the University of Pennsylvania for helping me time and again with the administrative aspects of being a graduate student.

Thanks to Jeny Carden, for her love and support.

Finally, I would like to express my special gratitude to my advisor Andre Scedrov for his guidance, support, candid criticism, and for his faith in my ability to complete this task.

Philadelphia, June 1997

ABSTRACT

FUNCTIONALITY, POLYMORPHISM, AND CONCURRENCY:

A MATHEMATICAL INVESTIGATION OF PROGRAMMING PARADIGMS

Peter Selinger

Andre Scedrov

The search for mathematical models of computational phenomena often leads to problems that are of independent mathematical interest. Selected problems of this kind are investigated in this thesis. First, we study models of the untyped lambda calculus. Although many familiar models are constructed by order-theoretic methods, it is also known that there are some models of the lambda calculus that cannot be non-trivially ordered. We show that the standard open and closed term algebras are unorderable. We characterize the absolutely unorderable T-algebras in any algebraic variety T. Here an algebra is called absolutely unorderable if it cannot be embedded in an orderable algebra. We then introduce a notion of finite models for the lambda calculus, contrasting the known fact that models of the lambda calculus, in the traditional sense, are always non-recursive. Our finite models are based on Plotkin’s syntactical models of reduction. We give a method for constructing such models, and some examples that show how finite models can yield useful information about terms. Next, we study models of typed lambda calculi. Models of the polymorphic lambda calculus can be divided into environment-style models, such as Bruce and Meyer’s non-strict set-theoretic models, and categorical models, such as Seely’s interpretation in PL-categories. Reynolds has shown that there are no set-theoretic strict models. Following a different approach, we investigate a notion of non-strict categorical models. These provide a uniform framework in which one can describe various classes of non-strict models, including set-theoretic models with or without empty types, and Kripke-style models. We show that completeness theorems correspond to categorical representation theorems, and we reprove a completeness result by Meyer et al. on set-theoretic models of the simply-typed lambda calculus with possibly empty types. Finally, we study properties of asynchronous communication in networks of communicating processes. We formalize several notions of asynchrony independently of any particular concurrent process paradigm. A process is asynchronous if its input and/or output is filtered through a communication medium, such as a buffer or a queue, possibly with feedback. We prove that the behavior of asynchronous processes can be equivalently characterized by first-order axioms. viii

Contents

Introduction 1

1 Preliminaries 5

1.1 Basic category theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1.1 Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1.2 Functors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.1.3 Natural transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1.4 Adjunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1.5 Limits and colimits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1.6 Cartesian-closed categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.2 Basic domain theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.2.1 Preorders and posets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.2.2 Complete partial orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2.3 Bounded complete partial orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2.4 Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2.5 Domain equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.2.6 The D_{∞}-construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1.3 Basic universal algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3.1 Σ-algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3.2 Term algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.3.3 Algebraic varieties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.3.4 Indeterminates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.3.5 Ordered algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.3.6 Dcpo-algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 The Lambda Calculus is Algebraic 19

2.1 The lambda calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.1.1 Lambda conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.1.2 Lambda reduction and consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.2 Combinatory models of the lambda calculus . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.2.1 Combinatory algebras and combinatory logic . . . . . . . . . . . . . . . . . . . . . 22 2.2.2 The derived lambda abstractor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.2.3 The local interpretation of lambda terms . . . . . . . . . . . . . . . . . . . . . . . . 23 2.2.4 Lambda algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

2.3 Lambda algebras and indeterminates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.3.1 A characterization of A[x] for lambda algebras . . . . . . . . . . . . . . . . . . . . 25 2.3.2 The absolute interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.3.3 Soundness and completeness for lambda algebras . . . . . . . . . . . . . . . . . . . 28

2.4 Lambda theories and lambda algebras form equivalent categories . . . . . . . . . . . . . . . 28 2.5 Lambda models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.6 Models of the lambda-βη-calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

2.6.1 Curry algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.6.2 Extensional models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

2.7 Lambda algebras and categorical models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.7.1 Reflexive ccc models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.7.2 Reflexive ccc models and lambda algebras . . . . . . . . . . . . . . . . . . . . . . . 31

3 Unorderability 35

3.1 Lambda terms cannot be ordered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.1.1 Plotkin’s unorderable algebra: Separability . . . . . . . . . . . . . . . . . . . . . . 36 3.1.2 The standard term algebras are unorderable . . . . . . . . . . . . . . . . . . . . . . 36

3.2 The Topological Completeness Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.3 A characterization of absolutely unorderable algebras . . . . . . . . . . . . . . . . . . . . . 39

3.3.1 Absolutely unorderable algebras and generalized Mal’cev operators . . . . . . . . . 39 3.3.2 An application to ordered algebras and dcpo-algebras . . . . . . . . . . . . . . . . . 40

3.4 Absolutely unorderable combinatory algebras . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.5 Relating different notions of unorderability . . . . . . . . . . . . . . . . . . . . . . . . . . 43

3.5.1 Local notions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.5.2 Absolute notions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

4 Finite Lambda Models 47

4.1 Models of reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.1.1 Syntactical models of reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.1.2 Categorical models of reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.1.3 Models of βη-reduction: Order-extensionality . . . . . . . . . . . . . . . . . . . . . 49

4.2 Tree models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.2.1 Recapturing convertibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.2.2 A method for constructing models . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

4.3 Partial models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 4.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

4.4.1 A class of finite models to distinguish the terms Ω_{n} . . . . . . . . . . . . . . . . . . 52 4.4.2 A non-trivial 3-element model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

4.5 Completeness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 4.6 Relating models of reduction to D_{∞}-models . . . . . . . . . . . . . . . . . . . . . . . . . . 54

5 Henkin Representations, Polymorphism, and Empty Types 57

5.1 Henkin representations of cartesian-closed categories . . . . . . . . . . . . . . . . . . . . . 58 5.1.1 Henkin representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5.1.2 Henkin representations and well-pointed ccc’s . . . . . . . . . . . . . . . . . . . . . 59 5.1.3 Freely adjoining arrows to a ccc . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 5.1.4 Henkin representation theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

5.2 The interpretation of the simply-typed lambda calculus . . . . . . . . . . . . . . . . . . . . 64 5.2.1 The simply-typed lambda calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5.2.2 Strict interpretation in a cartesian-closed category . . . . . . . . . . . . . . . . . . . 65 5.2.3 The cartesian-closed category associated to a theory . . . . . . . . . . . . . . . . . 67 5.2.4 Henkin representations of a free ccc . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.2.5 The non-strict interpretation of the simply-typed lambda calculus . . . . . . . . . . 67

5.3 From Henkin representation theorems to completeness theorems . . . . . . . . . . . . . . . 68 5.3.1 The problem with empty types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.3.2 A categorical analysis of the rule (non-empty) . . . . . . . . . . . . . . . . . . . . . 69 5.3.3 Set-theoretic models with non-empty types . . . . . . . . . . . . . . . . . . . . . . 69 5.3.4 Set-theoretic models with empty types . . . . . . . . . . . . . . . . . . . . . . . . . 69 5.3.5 Kripke lambda models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.3.6 A remark on the principal model property . . . . . . . . . . . . . . . . . . . . . . . 72

5.4 Henkin representations of PL-categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.4.1 PL-categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.4.2 Henkin-PL-representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 5.4.3 Standard structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.4.4 Freely adjoining arrows to the base of a PL-category . . . . . . . . . . . . . . . . . 76 5.4.5 Henkin-PL-representation theorems . . . . . . . . . . . . . . . . . . . . . . . . . . 77

5.5 The interpretation of the polymorphic lambda calculus . . . . . . . . . . . . . . . . . . . . 78 5.5.1 The polymorphic lambda calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.5.2 Strict interpretation in a PL-category . . . . . . . . . . . . . . . . . . . . . . . . . 79 5.5.3 The PL-category associated to a theory . . . . . . . . . . . . . . . . . . . . . . . . 81 5.5.4 The non-strict interpretation of the polymorphic lambda calculus . . . . . . . . . . . 81

5.6 From Henkin-PL-representation theorems to polymorphic completeness theorems . . . . . . 82 5.6.1 Set-theoretic models with non-empty types . . . . . . . . . . . . . . . . . . . . . . 82 5.6.2 Polymorphic Kripke models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

6 First-Order Axioms for Asynchrony 83

6.1 An elementary definition of asynchrony . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 6.1.1 Labeled transition systems and bisimulation . . . . . . . . . . . . . . . . . . . . . . 84 6.1.2 Input, output and sequential composition . . . . . . . . . . . . . . . . . . . . . . . 85 6.1.3 Buffers and queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 6.1.4 Notions of asynchrony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 6.1.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

6.2 First-order axioms for asynchrony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6.2.1 Out-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6.2.2 In-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 6.2.3 Out-queued and in-queued agents . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

6.3 More agent constructors and asynchrony with feedback . . . . . . . . . . . . . . . . . . . . 93 6.3.1 Some operations on agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 6.3.2 Asynchrony with feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

6.4 Example: Asynchronous CCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 6.5 Example: The core join calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 6.6 Other characterizations of asynchrony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

6.6.1 Out-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 6.6.2 In-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 6.6.3 Out-queued and in-queued agents . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 xii

List of Tables

1.1 Some posets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.2 Equational rules for Σ-algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.3 Inequational rules for Σ-algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.1 The axioms and rules of the lambda calculus . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.2 Reduction rules of the lambda calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.3 The axioms and rules of combinatory logic . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4.1 Multiplication table for a partial model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.2 Values for ψ(c, b, a) and k · c · b · a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

5.1 Typing rules for the simply-typed lambda calculus . . . . . . . . . . . . . . . . . . . . . . . 64 5.2 Equational rules for the simply-typed lambda calculus . . . . . . . . . . . . . . . . . . . . . 65 5.3 Rules for the simply-typed lambda calculus with emptiness assertions . . . . . . . . . . . . 70 5.4 Typing rules for the polymorphic lambda calculus . . . . . . . . . . . . . . . . . . . . . . . 78 5.5 Equational rules for the polymorphic lambda calculus . . . . . . . . . . . . . . . . . . . . . 78

6.1 First-order axioms for out-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6.2 First-order axioms for in-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.3 First-order axioms for out-queued agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.4 First-order axioms for in-queued agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.5 First-order axioms for out-buffered agents with feedback . . . . . . . . . . . . . . . . . . . 95 6.6 Transitions rules for asynchronous CCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 6.7 Transitions rules for the core join calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 6.8 Second-order axioms for out-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . 101 6.9 Second-order axioms for in-buffered agents . . . . . . . . . . . . . . . . . . . . . . . . . . 103 6.10 Second-order axioms for out-queued agents . . . . . . . . . . . . . . . . . . . . . . . . . . 103 6.11 Second-order axioms for in-queued agents . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Introduction

The central aim in giving mathematical meaning to computer programs is to represent computational objects, such as procedures, data types, or communication channels, by mathematical objects, such as functions, sets, or more generally, points in suitable mathematical spaces. Often, one begins with an idealized programming language, such as the lambda calculus or Milner’s calculus of communicating systems, and then seeks to find a mathematical model that reflects the relevant computational properties. The search for such models is guided by computational as well as mathematical intuitions, and it often leads to problems that are of independent mathematical interest. Some selected problems of this kind are investigated in this dissertation.

The first part of this thesis is devoted to the model theory of the untyped lambda calculus. D. Scott discovered in the late 1960’s that models of the untyped lambda calculus can be constructed by a combination of order-theoretic and topological methods. Scott’s methods have been widely studied and adapted to numerous situations, and today one can choose from a wide array of model constructions that are based on Scott’s principles. On the other hand, there are results that indicate that Scott’s methods may not in general be complete: Honsell and Ronchi Della Rocca [27] have shown that there exists a lambda theory that does not arise as the theory of a reflexive model in the cartesian-closed category of complete partial orders and Scott-continuous functions. Moreover, there are properties that one may desire in a model, but that are incompatible with the presence of a partial order: for instance, Plotkin [50] has recently shown that there exists an extensional lambda algebra which is finitely separable. By definition, a lambda algebra X is finitely separable if for every finite subset A ⊆ X and for every function f : A → X, there exists an element f̂ ∈ X such that f̂·x = f(x) for all x ∈ X. It is not hard to see that a finitely separable algebra cannot be non-trivially partially ordered in a way such that the order is compatible with the algebra structure.

In general, we define a lambda algebra X to be unorderable if there does not exist a non-trivial partial order on X for which the application operation is monotone. Our first main result is the following: The standard open and closed term algebras of the λβ- and λβη-calculi are unorderable. Recall that the standard term algebras are just made up from lambda terms, taken up to β- or βη-equivalence. The unorderability of the standard term algebras is a surprising fact, because the algebras that were previously known to be unorderable, such as Plotkin’s finitely separable algebra, require a much more delicate syntactic construction. As a consequence of this result, it follows that if a partially ordered model of the untyped lambda calculus is complete for one of the theories \underline{λβ} or \underline{λβη}, then the denotations of closed terms in that model are pairwise incomparable, i.e.the term denotations form an anti-chain.

Closely related to the question of unorderability is the question of order-incompleteness: does there exist a lambda theory that does not arise as the theory of a non-trivially partially ordered model? Or, expressed in terms of algebras: does there exist a lambda algebra which cannot be embedded in an orderable one? We call such an algebra absolutely unorderable. The concept of absolute unorderability can be formulated in any algebraic variety T, and our second main result is a theorem in universal algebra: In any algebraic variety T, an algebra A is absolutely unorderable if and only if, for some n ⩾ 1, there exist polynomials M_{1}, …, M_{n} ∈ A[x_{1}, x_{2}, x_{3}] such that the equations t = M_{1}(t, u, u), M_{i}(t, t, u) = M_{i+1}(t, u, u) for 1 ⩽ i < n, and M_{n}(t, t, u) = u hold in A[u, t]. Operators M_{1}, …, M_{n} satisfying this condition are called generalized Mal’cev operators. Such operators were first used by Hagemann and Mitschke [25] to characterize varieties with n-permutable congruences. The connection to unorderability was first noticed by Taylor [63, 11], who proved that algebras in a variety with n-permutable congruences are unorderable; the converse is a new result.

As a consequence, the question of order-incompleteness for the untyped lambda calculus has been reduced to the question whether it is consistent, for some n ⩾ 1, to add generalized Mal’cev operators M_{1}, …, M_{n} to the lambda calculus. It was proved by Plotkin and Simpson that a Mal’cev operator is inconsistent with the lambda calculus for n = 1. Later, Plotkin and myself showed that it is also inconsistent for n = 2. In the remaining cases, the answer is not known.

We continue our investigation of models of the untyped lambda calculus by introducing a notion of finite lambda models. These models provide a tool for predicting the evaluation behavior of a lambda term by finitary means. This yields a novel proof method for proving inequalities of untyped lambda terms. Finite models differ from traditional models of the untyped lambda calculus, which are always infinite and in fact never even recursive, in that they are models of reduction, rather than models of conversion. This means that they are equipped with a partial order and a soundness property of the form M ⟶ N ⇒ [[M]] ⩽ [[N]], where ⟶ denotes either β- or βη-reduction. Models of reduction were considered by several authors [23, 30, 49], and we use a formulation which was given by Plotkin [49] in the spirit of the familiar syntactical lambda models [5]. We focus on practical methods of constructing such models, and we show in two examples that, despite their simplicity, finite models can yield useful information about lambda terms.

The second part of this thesis is devoted to models of the simply-typed and the polymorphic lambda calculus. The models in the literature follow one of two basic designs: set-theoretic environment-style models, such as Henkin models for the simply-typed lambda calculus [21] or Bruce-Meyer models for polymorphism [10], and categorical models, such as the interpretation of the simply-typed calculus in a cartesian closed category [33] or of the polymorphic calculus in a PL-category [56]. Environment-style models are typically non-strict, in the sense that a function type σ → τ is interpreted as a subset of the set of functions from σ to τ. On the other hand, categorical models are always strict.

Reynolds has shown that there are no strict set-theoretic models of the polymorphic lambda calculus [52]. Here, we take the opposite approach and consider non-strict categorical models. This generalizes both environment-style models and strict categorical models. The central concept is that of a Henkin representation: a functor H between cartesian-closed categories that preserves finite products, such that for all objects A, B, the canonical morphism H(B^{A}) → H(B)^{H(A)} is monic. Henkin representations provide a uniform framework in which one can describe various classes of non-strict models, including set-theoretic models with possibly empty types [39], set-theoretic models with non-empty types [21], and Kripke-style models [42]. We show that completeness theorems for each of these classes of models correspond naturally to categorical Henkin representation theorems. One such Henkin representation theorem characterizes those cartesian-closed categories that can be Henkin-embedded in the category of sets: we show that this is the case if and only if every object A is either partially initial, or the canonical morphism A → 1 is epic. This allows a new proof of a result by Meyer et al. [39] on the semantic consequences that hold in set-theoretic models of the simply-typed lambda calculus with possibly empty types.

The last part of this dissertation is concerned with the study of properties of asynchronous communication in networks of communicating processes. Informally, communication in such a network is said to be synchronous if message transmission is instantaneous, such that sender and receiver must be available at the same time in order to communicate. It is asynchronous if messages are assumed to travel through a communication medium with possible delay, such that the sender cannot be certain when a message has been received. Asynchronous communication is often studied in the framework of a concurrent process calculus such as the asynchronous π-calculus [26, 9] or the join calculus [17, 18]. Here, we study asynchronous communication in general, independently of any particular process paradigm. We model processes by labeled transition systems with input and output. These transition systems are similar to the input/output automata by Lynch and Stark [35], but our presentation is more category-theoretic in a style that resembles Abramsky’s interaction categories [1, 2]. In particular, we adopt Abramsky’s notation S; T for the sequential composition of two processes, by which we mean the process obtained by connecting the output of S to the input of T.

First, we formalize the intuitive notion of asynchrony in elementary terms: we define a process to be asynchronous if its input and/or output is filtered through an explicitly modeled communication medium, such as a buffer or a queue, possibly with feedback. For instance, we call a process out-buffered if it is, up to weak bisimulation, of the form S; B, where B is a special buffer process. Our main result about asynchronous processes is a characterization of various different such notions of asynchrony in terms of first- and second-order axioms. These axioms refer directly to the behavior of a process, without mentioning buffers or queues explicitly. For instance, a process is out-buffered if and only if it is weakly bisimilar to a process satisfying three properties which we call output-commutativity, output-confluence, and outputdeterminacy. We illustrate these concepts by applying them to an asynchronous version of Milner’s CCS and to the core join calculus.

This thesis is organized as follows: Chapter 1 is a summary of standard concepts of category theory, domain theory, and universal algebra, which are needed throughout the thesis. Chapter 2 is an introduction to the untyped lambda calculus and its combinatory models. In Chapter 3, we investigate unorderable and absolutely unorderable models of the untyped lambda calculus. Chapter 4 is devoted to finite lambda models. In Chapter 5, we study Henkin representation theorems and their applications to non-strict models of the simply-typed and polymorphic lambda calculi. In Chapter 6, we investigate properties of asynchronous communication.

4

Chapter 1

Preliminaries

We begin by gathering some basic concepts from category theory, domain theory, and universal algebra. This is mostly for the purpose of fixing terminology and notation for the later chapters of this thesis, and to provide a brief reference. We do not give any proofs in this chapter. For a more complete and detailed introduction to category theory, see e.g. [20] or [36]. For an introduction to domain theory, see e.g. [3] or [47]. For an introduction to universal algebra, see e.g.[24] or [13].

1.1 Basic category theory

1.1.1 Categories

A category C = ⟨|C|, (−, −), id, ∘⟩ consists of a class |C| of objects, together with a set (A, B) of morphisms for each pair of objects A, B ∈ |C|, and together with operations

\begin{matrix}id_{A} ∈ (A, A) \\ ∘_{A,B,C} : (B, C) × (A, B) → (A, C) \end{matrix}

for all A, B, C ∈ |C|, satisfying

id_{B} ∘ f = f = f ∘ id_{A}, for f ∈ (A, B)
(h ∘ g) ∘ f = h ∘ (g ∘ f) for f ∈ (A, B), g ∈ (B, C), h ∈ (C, D).

We will often omit the subscripts on id and ∘. A morphism id_{A} is called an identity morphism, and g ∘ f is called the composition of f and g. The set (A, B) is called the hom-set of A and B. If we want to make the category unambiguous, we also write hom-sets as C(A, B). A morphism f ∈ (A, B) is also written f : A → B or A →^{f} B, and we call A the source or the domain and B the target or the codomain of f. If f : A → B and g : B → C, then we sometimes write the composition g ∘ f in diagrammatic order as

A →^{f} B →^{g} C or as f; g.

Example 1.1. The category 𝒮 of sets has sets as its objects, and functions as its morphisms. Notice that the collection of all sets is not itself a set; this is why, in the definition of a category, one allows the collection of objects to be a proper class. A category is said to be small if the collection of its objects is a set.

A category is discrete if its only morphisms are identity morphisms. If C is any category, then its dual category C^{op} is defined by |C^{op}| = |C| and C^{op}(A, B) = C(B, A), i.e. by reversing the direction of all morphisms. If C and D are categories, then their product C × D is defined by |C × D| = |C| × |D| and (⟨A, A′⟩, ⟨B, B′⟩) = (A, B) × (A′, B′), with the pointwise identities and composition.

A diagram

\xymatrix{A \ar[r]^{f} \ar[d]_{h} & B \ar[d]^{g} \\ C \ar[r]_{k} & D}

is used as a notation for the statement

f ∈ (A, B) and g ∈ (B, D) and h ∈ (A, C) and k ∈ (C, D) and g ∘ f = k ∘ h,

and similarly for other diagrams. Note that this notation is not meant to imply that A, B, C, D or f, g, h, k are different. In the diagrammatic notation, we may also omit the names of the objects. Of course, it is then still understood that the appropriate morphisms are composable. The symbol in a diagram removes exactly one equation, such that

[figure: ·; g; h; ·; f; ·]

means f ∘ g = f ∘ h. This diagram does not say whether g = h. Diagrams are just a notation for ordinary mathematical statements, and we may use them together with logical symbols, quantifiers etc. Example 1.2. A morphism f is said to be monic or a monomorphism if

∀g, h  ( [figure: ·; g; h; ·; f; ·]  ⇒  g = h).

Dually, f is said to be epic or an epimorphism if

∀g, h  ( [figure: ·; f; ·; g; h; ·]  ⇒  g = h).

Also, f is said to be iso or an isomorphism if

∃g \xymatrix{· \ar[rr]^{id} \ar[dr]_{g} & & · \ar[dr]^{g} \\ & · \ar[rr]_{id} \ar[ur]_{f} & & ·}

If f is an isomorphism, then g is uniquely determined. g is called the inverse of f and it is denoted by f^{−1}. If there is an isomorphism f : A → B, then A and B are said to be isomorphic objects. We sometimes write f : A ↣ B for a monomorphism, f : A ↠ B for an epimorphism, and f : A ⟶^{∼} B for an isomorphism. Notice that if f : A → B has a left inverse g ∘ f = id_{A}, then f is a monic, called a split monic, and g is an epic, called a split epic. A collection of morphisms (A ⟶^{f_{i}} B_{i})_{i∈I} with the same source is called collectively monic or a monic cone if for all g, h : C → A, whenever f_{i} ∘ g = f_{i} ∘ h for all i ∈ I, then g = h.

1.1.2 Functors

If C and D are categories, then a (covariant) functor F : C → D is a map F : |C| → |D| of objects, together with a map F : C(A, B) → D(F A, F B) for each hom-set, such that

\begin{matrix}F id_{A} = id_{F A} \\ F (g ∘ f) = F g ∘ F f \end{matrix}

The category of small categories, together with functors between them, is denoted Cat. A functor F : C^{op} → D is also called a contravariant functor from C to D.

Example 1.3. For any category C, there is a functor Hom : C^{op}×C → 𝒮, which is defined by Hom(A, B) = C(A, B) and Hom(f, g)(x) = g∘x∘f. For any object A ∈ |C|, the functor (A, −) : C → 𝒮 is called the Ath (covariant) representable functor. Dually, the functor (−, A) : C^{op} → 𝒮 is called the A-th contravariant representable functor.

A functor F : C → D is full if each F : (A, B) → (F A, F B) is onto. F is an embedding if each F : (A, B) → (F A, F B) is one-to-one. We say F is faithful if it is an embedding and it reflects isomorphisms, i.e., whenever F f is an isomorphism, then so is f.

A category C is a subcategory of D if |C| ⊆ |D|, and for all A, B ∈ |C|, C(A, B) ⊆ D(A, B). The corresponding inclusion functor I : C → D, with IA = A and If = f, is always an embedding. C is said to be a full subcategory if I is full, and a faithful subcategory if I is faithful.

1.1.3 Natural transformations

A natural transformation η : F → G between functors F, G : C → D is a family (η_{A})_{A∈|C|} of morphisms η_{A} : F A → GA such that for all f : A → B,

\xymatrix{F A \ar[d]_{F f} \ar[r]^{η_{A}} & GA \ar[d]^{Gf} \\ F B \ar[r]_{η_{B}} & GB}

There is a category whose objects are functors F : C → D, for fixed C and D (say, C is small). The morphisms are natural transformations. For any functor F, the identity natural transformation id_{F} : F → F is defined by (id_{F})_{A} = id_{F A}. Composition of natural transformations η : F → G and η′ : G → H is defined by (η′ ∘ η)_{A} = η′_{A} ∘ η_{A}. The resulting category is written D^{C}, and it is called a functor category.

Two functors F, G : C → D are said to be naturally isomorphic, in symbols F ≅ G, if there are natural transformations η : F → G and η^{−1} : G → F such that η ∘ η′ = id_{G} and η′ ∘ η = id_{F}.

We sometimes write η : F (A) →_{A} G(A), η : F (A, B) →_{A,B} G(A, B) etc. to express that η, as a transformation of functors, is natural in the indicated arguments. Similarly, we write F (A) ≅_{A} G(A) etc. to express that F and G are naturally isomorphic. Notice that this is different from writing (∀A)F (A) ≅ G(A); the latter statement expresses only a condition on objects, and not on morphisms.

An equivalence of categories C and D is a pair of functors F : C → D and G : D → C such that G ∘ F and F ∘ G are naturally isomorphic to the identity functors on C and D, respectively.

1.1.4 Adjunctions

An adjunction between functors F : C → D and G : D → C is a natural isomorphism

φ : (F A, B) ⟶^{∼}_{A,B} (A, GB).

In this case, the pair of functors F and G is called an adjoint pair, and we write φ : F ⊣ G, or simply F ⊣ G. F is a left adjoint of G and G is a right adjoint of F. The unit u : id_{C} → G ∘ F of an adjunction φ is the natural transformation given by u_{A} = φ(id_{F A}) ∈ (A, GF A), and the co-unit c : F ∘ G → id_{D} is defined dually. Each of the entities φ, u and c determines the two others uniquely. Moreover, F and G determine each other up to natural isomorphism.

1.1.5 Limits and colimits

Let I be a small category, C a category. A diagram in C modeled on I is a functor Δ : I → C. A cone over a diagram Δ is a pair ⟨D, (d_{i})_{i∈|I|}⟩, consisting of an object D and a family of morphisms d_{i} : D → Δ(i) for each i ∈ |I|, such that for each f : i → j in I,

\xymatrix{Δ(i) \ar[rr]^{Δ(f)} &  & Δ(j). \\  & D \ar[ul]^{d_{i}} \ar[ur]_{d_{j}}}

A morphism between cones ⟨E, (e_{i})_{i∈|I|}⟩ and ⟨D, (d_{i})_{i∈|I|}⟩ over a diagram Δ is an arrow f : E → D such that e_{i} = d_{i} ∘ f for all i ∈ |I|. A cone ⟨D, (d_{i})_{i∈|I|}⟩ is called limiting or a limit if it is terminal among cones over Δ, i.e. from any other cone ⟨E, (e_{i})_{i∈|I|}⟩, there is a unique morphism of cones f : E → D. Sometimes, we also call the object D a limit. The morphisms e_{i} of a limiting cone are called limiting morphisms. Limiting cones, if they exist at all, are uniquely determined up to isomorphism. Limiting cones are collectively monic. Cocones, colimits and colimiting morphisms are defined dually.

Some special limits are of interest: A limit of a diagram that is modeled on a discrete category is called a product. The limiting morphisms of a product are called projections. A limit of the empty diagram is called a terminator or a terminal object. A limit of a diagram that is modeled on the category

[figure: ·; ·]

is called an equalizer. A limit of a diagram that is modeled on the category

\xymatrix{ & · \ar[d] \\ · \ar[r] & ·}

is called a pullback. The dual concepts are coproduct, coterminator or initial object, co-equalizer, and pushout.

Definition. A category is complete if every small diagram has a limit, and cocomplete if every small diagram has a colimit.

Proposition 1.4. A category is complete iff it has products and equalizers. It is cocomplete iff it has coproducts and co-equalizers.

1.1.6 Cartesian-closed categories

Recall that an object B is a terminator if for all A, (A, B) is a singleton. A terminator is unique up to isomorphism. If we have chosen a terminator in a category, we denote it by 1. The unique morphism in (A, 1) is then denoted _{A}.

A diagram

\xymatrix{ & P \ar[dl]_{f} \ar[dr]^{g} \\ B &  & C}

is called a (binary) product diagram if for every pair of morphisms q : A → B and r : A → C, there exists a unique s : A → P such that f ∘ s = q and g ∘ s = r. This is the case if and only if

(A, P) ≅_{A} (A, B) × (A, C)

via a natural isomorphism that relates id_{P} to the pair ⟨f, g⟩. Product diagrams are determined (for fixed B and C) uniquely up to isomorphism. If we have chosen, for any B and C, a product diagram, then we denote it by

\xymatrix{ & B × C \ar[dl]_{π} \ar[dr]^{π′} \\ B &  & C.}

The unique morphism s : A → B × C such that π ∘ s = q : A → B and π′ ∘ s = r : A → C is then denoted ⟨q, r⟩. The operation that takes q and r to ⟨q, r⟩ is called pairing. If b : B → B′ and c : C → C′, then we denote by b × c the morphism ⟨b ∘ π, c ∘ π′⟩ : B × B′ → C × C′. This makes F (B, C) = B × C into a functor.

In a category with chosen products, a diagram

\xymatrix{D × B \ar[r]^{f} & C}

is called an exponential diagram if for every morphism g : A × B → C there is a unique h : A → D such that

\xymatrix{D × B \ar[r]^{f} & C. \\ A × B \ar[u]^{h×id_{B}} \ar[ur]_{g}}

This is the case if and only if

(A, D) ≅_{A} (A × B, C)

via a natural isomorphism that relates id_{D} to f. For given B and C, exponential diagrams are determined uniquely up to isomorphism. If we have chosen, for any B and C, an exponential diagram, then we denote it by

\xymatrix{C^{B} × B \ar[r]^{ε} & C.}

The unique morphism h : A → C^{B} such that ε ∘ (h × id_{B}) = g : A × B → C is then denoted g^{⋆}. The operation that takes g into g^{⋆} is called currying. The inverse operation, which takes h to h_{⋆} = ε ∘ (h × id_{B}), is called uncurrying. If b : B′ → B and c : C → C′, then c^{b} denotes the morphism (c ∘ ε ∘ (id_{C^{B}} × b))^{⋆} : C^{B} → C′^{B′}. This makes F (B, C) = C^{B} into a functor, contravariant in the first argument and covariant in the second. Remark. The following identities are often useful, where a : A′ → A, h : A → C^{B}, g : A × B → C:

(g ∘ (a × id_{B}))^{⋆} = g^{⋆} ∘ a  : A′ → C^{B}
ε^{⋆} = id  : C^{B} → C^{B}
(h ∘ a)_{⋆} = h_{⋆} ∘ (a × id_{B}) : A′ × B → C
id_{⋆} = ε  : C^{B} × B → C

Definition. A cartesian-closed category (ccc) is a category with chosen terminator, chosen binary product diagrams and chosen exponential diagrams. A ccc-representation is a functor that preserves the chosen terminator, product and exponential diagrams. A functor that preserves ccc structure up to isomorphism is called a ccc-representation up to isomorphism.

Example 1.5. For any small category C, the functor category 𝒮^{C^{op}} is cartesian-closed. The Yoneda embedding Y : C → 𝒮^{C^{op}} maps an object A to the functor (−, A) : C^{op} → 𝒮. The Yoneda embedding is full and faithful, and if C is cartesian-closed, then Y is a ccc-representation up to isomorphism. The functor category 𝒮^{C^{op}} is called the category of presheaves over C.

Table 1.1: Some posets

[figure: 0; 1; 2; ⋯; n; ⋯; ⊥]  ⋮ ; n ; ⋮ ; 2 ; 1 ; 0

(1) The flat natural numbers  (2) The ordinal ω

1.2 Basic domain theory

We gather some basic domain-theoretic concepts. For a more detailed introduction, consult e.g. the texts by Abramsky and Jung [3] or Plotkin [47].

1.2.1 Preorders and posets

A binary relation ⩽ on a set D is called a preorder if

1. ∀x ∈ D. x ⩽ x (Reflexivity).

2. ∀x, y, z ∈ D. x ⩽ y and y ⩽ z ⇒ x ⩽ z (Transitivity).

A preorder ⩽ is a partial order if, in addition,

3. ∀x, y ∈ D. x ⩽ y and y ⩽ x ⇒ x = y (Antisymmetry).

A partially ordered set ⟨D, ⩽⟩ is also called a poset. A function f : D → E between posets is monotone if x ⩽ y implies fx ⩽ fy, for all x, y ∈ D. We denote the category of posets and monotone functions by POSET . It is cartesian-closed. The exponential E^{D} is given by the set of all monotone functions from D to E, with the pointwise order, f ⩽ g if for all x ∈ D, fx ⩽ gx.

For A ⊆ D, let ↓A be the set {y ∈ D | ∃x ∈ A.y ⩽ x}. A set A is called downward closed or a downdeal if A = ↓A. If A = {x} is a singleton, we also write ↓x = ↓{x}. The sets ↑A and ↑x are defined dually. An element x ∈ A is said to be minimal in A if ↓x ∩ A = {x}. Also, x ∈ A is said to be a minimum or a least element of A if A ⊆ ↑x. Maximal elements and greatest elements are defined dually. An element b ∈ D is said to be an upper bound of A if a ⩽ b for all a ∈ A. If among the upper bounds of A there is a least one, it is called the least upper bound, the join or the supremum of A, and it is denoted by ⋁ A or ⋁_{x∈A} x. We also write x ∨ y for the supremum of {x, y}, if it exists. Lower bounds are defined dually, and a greatest lower bound, denoted ⋀ A, is also called a meet or an infimum. A poset D is called a lattice if it has finite suprema and infima, and a complete lattice if it has arbitrary suprema and infima.

A poset ⟨D, ⩽⟩ is pointed if it has a least element ⊥. D is flat if it is pointed and if all elements a ≠ ⊥ are maximal. An example of a flat poset are the “flat natural numbers”, shown in Table 1.1(1). Two elements x, y ∈ D are called compatible, in symbols x ⌣ ⌢ y, if there exists z ∈ D with x ⩽ z and y ⩽ z. Notice that two elements in a flat poset are compatible iff and of them is ⊥.

Remark. Any poset ⟨D, ⩽⟩ can itself be regarded as a category with hom-sets

D(x, y) = \{ \begin{matrix}\{∗\} & if x ⩽ y \\ ∅ & else. \end{matrix}

Under this interpretation, a least element ⊥ is just an initial object, suprema are colimits, functors are monotone maps, and an adjunction is a pair of monotone maps f : D → E and g : E → D such that

fx ⩽ y ⟺ x ⩽ gy.

1.2.2 Complete partial orders

A poset I is directed if it is non-empty and if for all x, y ∈ I, there exists z ∈ I with x, y ⩽ z. A poset ⟨D, ⩽⟩ is directed complete if every directed subset has a supremum. A directed complete poset is also called a dcpo. Directed suprema are also denoted by [figure]I or [figure]_{x∈I} x. A function f : D → E between dcpo’s is called Scott-continuous if it is monotone and it preserves directed suprema. We denote the category of dcpo’s and Scott-continuous functions by DCPO. The full subcategory of pointed dcpo’s is denoted by DCPO_{⊥}. Both these categories are cartesian-closed. The exponential E^{D} is given by the set of all Scott-continuous functions from D to E with the pointwise order. Directed suprema in E^{D} can be computed pointwise, i.e.

([figure: i]f_{i})(x) = [figure: i](f_{i}x)

A poset I is linearly ordered or a chain if for all x, y ∈ I, either x ⩽ y or x ⩾ y. An example of a linearly ordered set is the ordinal ω, which is the set of natural numbers with their natural order, as shown in Table 1.1(2). A set I which is isomorphic to ω is called an ω-chain. A poset ⟨D, ⩽⟩ is ω-complete if every ω-chain I ⊆ D has a supremum in D. An ω-complete poset is also called a complete partial order or a cpo. A function f : D → E between cpo’s is called ω-continuous if it is monotone and it preserves suprema of ω-chains. We denote the category of cpo’s and ω-continuous functions by CPO, and its full subcategory of pointed cpo’s by CPO_{⊥}. These categories are cartesian-closed, with the exponential E^{D} given by the set of all ω-continuous functions from D to E with the pointwise order, and pointwise suprema of ω-chains. Remark. The categories CPO and DCPO have similar properties. DCPO is a subcategory of CPO, but is neither full, nor is it a sub-ccc.

1.2.3 Bounded complete partial orders

A subset A of a partially ordered set D is called bounded if there is d ∈ D with A ⊆ ↓d. A cpo D is bounded complete if every bounded subset A ⊆ D has a supremum. Bounded complete cpo’s and ωcontinuous functions form a full sub-ccc CPO^{bc} of CPO. Notice that we do not require the morphisms to preserve all bounded suprema. The categories CPO _{⊥}^{bc}, DCPO^{bc}, and DCPO _{⊥}^{bc} are defined analogously.

1.2.4 Stability

A cpo D is a meet cpo if it has bounded binary meets which act continuously. This means, that for every x ∈ D, the set ↓x has binary meets, and the function ⟨a, b⟩ ↦ a ∧ b is continuous on ↓x × ↓x. A function f : D → E between meet cpo’s is stable if it preserves bounded binary meets. We denote the category of meet cpo’s and stable maps by CPO^{∧}, and its full subcategory of pointed meet cpo’s by CPO _{⊥}^{∧}. These categories are cartesian-closed too, and the exponential E^{D} is given by the set of all stable functions from D to E, not with the pointwise order, but with the Berry order or stable order:

f ⩽_{s} g ⟺ (∀x, y ∈ D. x ⩽ y ⇒ f(x) = f(y) ∧ g(x))

Directed suprema, as well as bounded infima, with respect to the Berry order are taken pointwise. The cartesian-closed categories DCPO^{∧} and DCPO _{⊥}^{∧} are defined analogously.

The theory of meet cpo’s and stable functions is due to Berry [7], who used them to study the semantics of sequential computations.

1.2.5 Domain equations

Let D be any one of the pointed categories DCPO_{⊥}, CPO_{⊥}, DCPO _{⊥}^{∧}, CPO _{⊥}^{∧}, DCPO _{⊥}^{bc}, or CPO _{⊥}^{bc}. The objects of D are called domains. One of the main features of these categories of domains is that they can be used to solve domain equations, such as

D ≅ D^{D}.

A solution to such an equation in a category D consists of an object D, together with an isomorphism φ : D → D^{D}. The ability to solve domain equations is an essential tool in mathematical programming semantics to give meaning to a variety of programming language constructs, such as recursive data types. We are particularly interested in solutions to the “classic” domain equation D ≅ D^{D}, whose solutions yield models of the untyped lambda-βη-calculus (see Section 2.7).

General methods for solving domain equations were pioneered by D. Scott [53], and further developed by Smyth and Plotkin [61]. In general, a domain equation takes the form D ≅ F (D). Notice that, since the right-hand-side may contain positive (covariant) as well as negative (contravariant) occurrences of D, F will not in general be a functor. The problem of mixed variance can be solved by passing from the category D to a category D^{e} of embeddings. The objects of D^{e} are the same as the objects of D. The morphisms of D^{e} are embeddings, where e : D → E in D is called an embedding if there exists a projection p : E → D in D such that

p ∘ e = id_{D} e ∘ p ⩽ id_{E},

where the inequality is understood to be with respect to the relevant order on functions, i.e.the pointwise order in the case of DCPO_{⊥}, CPO_{⊥}, etc., and the stable order in the case of DCPO _{⊥}^{∧} or CPO _{⊥}^{∧}. An embedding e is uniquely determined by its associated projection p and vice versa. We write p = e^{∗} and e = p_{∗}. One also speaks of D^{e} as a category of embedding-projection pairs.

An expanding sequence in D^{e} is a diagram modeled on the ordinal ω, i.e. a functor Δ : ω → D^{e}. In more concrete terms, an expanding sequence is a sequence (D_{n})_{n∈ℕ} of objects, together with embeddings e_{nm} : D_{n} → D_{m} for all n ⩽ m, such that e_{mm} = id_{D_{m}} and e_{mn} ∘ e_{pm} = e_{pn}, for all p ⩽ m ⩽ n.

Proposition 1.6. Limit-colimit coincidence. Every expanding sequence ⟨(D_{n})_{n}, (e_{nm})_{n⩽m}⟩ in D^{e} has a colimit D in D^{e}, with colimiting morphisms e_{n} : D_{n} → D. Moreover, ⟨D, (e_{n})_{n}⟩ is also a colimit in D, and ⟨D, (e_{n}^{∗})_{n}⟩ is a limit of ⟨(D_{n})_{n}, (e_{nm}^{∗})_{n⩽m}⟩ in D. This is called the limit-colimit coincidence, and D is also called a bilimit. □

Proposition 1.7. Characterization of bilimits. Let ⟨D, (e_{n})_{n}⟩ be a cocone over the expanding sequence ⟨(D_{n})_{n}, (e_{nm})_{n⩽m}⟩ in D^{e}. Then ⟨D, (e_{n})_{n}⟩ is a bilimit if and only if

id_{D} = [figure: n]e_{n} ∘ e_{n}^{∗}.
□

Definition. A functor F : D^{e} → D^{e} is continuous if for every expanding sequence ⟨(D_{n})_{n}, (e_{nm})_{n⩽m}⟩ with colimit ⟨D, (e_{n})_{n}⟩, the sequence ⟨(F D_{n})_{n}, (F e_{nm})_{n⩽m}⟩ has colimit ⟨F D, (F e_{n})_{n}⟩.

Proposition 1.8. Solution of domain equations. Consider a domain equation D ≅ F (D), where F : D^{e} → D^{e} is a continuous functor. Starting with a domain D_{0} and an embedding e_{01} : D_{0} → F (D_{0}), let D_{n+1} = F (D_{n}) and e_{n+1,n+2} = F (e_{n,n+1}) for all n ∈ ℕ. Let D be the colimit of the expanding sequence ⟨(D_{n})_{n}, (e_{nm})_{n⩽m}⟩, where e_{nm} = e_{m−1,m} ∘ ⋯ ∘ e_{n,n+1}, for n ⩽ m. Then D ≅ F (D).

Proof. Since F is continuous, the sequence ⟨(F D_{n})_{n}, (F e_{nm})_{n⩽m}⟩ = ⟨(D_{n+1})_{n}, (e_{n+1,m+1})_{n⩽m}⟩ has colimit F (D). On the other hand, D is a colimit of the same sequence, hence one gets D ≅ F (D). □

The question remains how to identify a given functor as continuous. A useful criterion was given by Smyth and Plotkin [61], who observed that a continuous functor F on D^{e} can be obtained from a locally continuous functor F̂ on D. This works even if F̂ is of mixed variance.

Definition. A functor F̂ : D^{op} × D → D is locally continuous if for all objects D, D′, E, E′ ∈ D,

F̂ : D(D, D′) × D(E, E′) → D(F̂(D′, E), F̂(D, E′))

if continuous as a map between hom-sets (with the pointwise order in the case of DCPO_{⊥} and CPO_{⊥}, and the stable order in the case of DCPO _{⊥}^{∧} and CPO _{⊥}^{∧}).

Proposition 1.9. Every locally continuous functor F̂ : D^{op} × D → D gives rise to a continuous functor F : D^{e} → D^{e}, defined by

F (D) = F̂(D, D) F (e) = F̂(e^{∗}, e)
□

1.2.6 The D_{∞}-construction

The method of Proposition 1.8, applied to the locally continuous functor F (D, E) = E^{D}, serves to solve the “classic” domain equation D ≅ D^{D}. This construction is due to D. Scott, and it is called the D_{∞}- construction.

Remark. Notice that the construction of a D_{∞}-model is dependent on some parameters, namely a category D, an object D_{0} and an embedding e_{01} : D_{0} → D_{0}^{D_{0}}. Hence, there is a whole class of such models. Among these, we distinguish the standard D_{∞}-model to be the one model constructed in CPO_{⊥} from the cpo D_{0} with two elements ⊥ ⩽ ⊤, and the embedding e_{01} : D_{0} → D_{0}^{D_{0}} which maps ⊥ to the constant ⊥ function and ⊤ to the constant ⊤ function.

1.3 Basic universal algebra

1.3.1 Σ-algebras

An algebraic signature Σ is a pair ⟨Ω, α⟩ consisting of a set Ω of function symbols and a map α : Ω → ℕ, assigning an arity k ⩾ 0 to each f ∈ Ω. We let Ω_{k} = {f ∈ Ω | α(f) = k} be the set of k-ary function symbols. A Σ-algebra A = ⟨A, I⟩ is a set A together with an interpretation I(f) of every function symbol as a map from A^{α(f)} → A. We often write |A|, or even A for the underlying set A of an algebra, and f_{A} or even f for the interpretation I(f). A homomorphism of Σ-algebras φ : A → B is a function φ : |A| → |B| such that for all f ∈ Ω_{k} and all a_{1}, …, a_{k} ∈ A

φ(f_{A}(a_{1}, …, a_{k})) = f_{B}(φa_{1}, …, φa_{k})

We denote the category of Σ-algebras and homomorphisms by Σ-Alg. The category Σ-Alg has all limits, and the forgetful functor U : Σ-Alg → 𝒮 preserves and reflects them. For instance, binary products are given by |A × B| = |A| × |B| and f_{A×B}(⟨a_{1}, b_{1}⟩, …, ⟨a_{k}, b_{k}⟩) = ⟨f_{A}(a_{1}, …, a_{k}), f_{B}(b_{1}, …, b_{k})⟩. A Σ-algebra A is a subalgebra of another Σ-algebra B if |A| ⊆ |B| and for all f ∈ Ω_{k} and a_{1}, …, a_{k} ∈ A, f_{A}(a_{1}, …, a_{k}) = f_{B}(a_{1}, …, a_{k}). The inclusion map A → B of a subalgebra is a homomorphism.

Definition 1.10. A binary relation R on a Σ-algebra A is compatible if it is a subalgebra of A × A. This is the case if and only if whenever ⟨a_{i}, b_{i}⟩ ∈ R for i = 1 … k, then ⟨fa_{1} … a_{k}, fb_{1} … b_{k}⟩ ∈ R, for each k-ary function symbol f ∈ Ω_{k}. A congruence on a Σ-algebra A is a compatible equivalence relation. If ∼ is a congruence, then the quotient algebra A/∼ is a well-defined Σ-algebra via f_{A/∼}([x_{1}]_{∼}, …, [x_{k}]_{∼}) = [f_{A}(x_{1}, …, x_{k})]_{∼}. The natural map A → A/∼ is a homomorphism of Σ-algebras. The kernel ker φ of a homomorphism φ : A → B is the congruence relation ∼ on A defined by a ∼ a′ iff φ(a) = φ(a′).

1.3.2 Term algebras

Let X be a set. For each x ∈ X, pick a distinct symbol c_{x}, which is not in Ω. Let W (X, Ω) be the set of words (i.e.finite sequences) from the alphabet {c_{x} | x ∈ X} ∪ Ω.

Definition. The set of Σ-terms over X is defined to be the smallest subset T ⊆ W (X, Ω) such that

\frac{x ∈ X}{c_{x} ∈ T}  \frac{f ∈ Ω_{k}  t_{1} ∈ T  …  t_{k} ∈ T}{ft_{1} … t_{k} ∈ T} .

Let Σ_{X} be the set of Σ-terms thus defined. It has a natural Σ-algebra structure via f_{Σ_{X}} (t_{1}, …, t_{k}) = ft_{1} … t_{k}. The algebra Σ_{X} is called the Σ-term algebra over X.

Remark. We have represented terms as words from some alphabet. There are other possible choices; for instance, one could represent a term ft_{1} … t_{k} as a labeled rooted tree with label f at the root and with immediate subtrees t_{1}, …, t_{k}. In general, we will not be too concerned here with the details of how to represent syntax; rather, we will treat syntax as a primitive notion. Independently of which concrete representation for terms one chooses, Σ_{X}, together with its natural map ȷ : X → Σ_{X} : x ↦ c_{x}, is completely determined by the following universal property:

Proposition 1.11. For any Σ-algebra B and any map ρ : X → B, there is a unique homomorphism ρ̂ : Σ_{X} → B such that

\xymatrix{X \ar[r]^{ȷ} \ar[dr]_{ρ} & Σ_{X} \ar[d]^{ρ̂} \\  & B.}

Equivalently, the forgetful functor U : Σ-Alg → 𝒮 has a left adjoint F : 𝒮 → Σ-Alg with F(X) = Σ_{X}, and with X → Σ_{X} as the unit of the adjunction. □

A map ρ : X → B is also called a valuation in B. If ρ̂ is the unique extension of ρ to terms, then we often write [[t]]_{ρ} instead of ρ̂(t) for the interpretation of a term t ∈ Σ_{X}. The defining equations for [[ ]] are

[[x]]_{ρ} = ρ(x),  for x a variable,
[[ft_{1} … t_{k}]]_{ρ} = f_{A}([[t_{1}]]_{ρ}, …, [[t_{k}]]_{ρ}), for f ∈ Ω_{k}.

If X = {x_{1}, …, x_{n}} is a finite set of variables, then a term t ∈ Σ_{X} is also called a n-ary operation in Σ. We write t = t(x_{1}, …, x_{n}). If b_{1}, …, b_{n} are elements of a Σ-algebra B, then we sometimes write t(b_{1}, …, b_{n}) for [[t]]_{ρ} where ρ : X → B : x_{i} ↦ b_{i}.

1.3.3 Algebraic varieties

Fix a countable set V of variables. A Σ-equation is a pair of terms ⟨t, s⟩ ∈ Σ_{V} × Σ_{V}. Equations are often written in the form t = s. A Σ-algebra A satisfies an equation t = s, in symbols A ⊧ t = s, if for all homomorphisms φ : Σ_{V} → A, φ(t) = φ(s). Equivalently, A ⊧ t = s if for all valuations ρ : V → A, [[t]]_{ρ} = [[s]]_{ρ}.

Definition. Let Σ be a signature, and let E be a set of Σ-equations. A Σ-algebra A that satisfies all equations in E is called a (Σ, E)-algebra. The (Σ, E)-algebras form a full subcategory of Σ-Alg, which we denote by (Σ, E)-Alg. Any full subcategory T of Σ-Alg that arises in this way is called an algebraic variety. The algebras of an algebraic variety T are also called T-algebras.

Let T be an algebraic variety, defined by a signature Σ and equations E. We construct T_{X}, the free T-algebra over a set X, as follows: On the term algebra Σ_{X}, consider the smallest congruence relation ∼ such that

\frac{⟨s, t⟩ ∈ E ρ : Σ_{V} → Σ_{X}}{ρ(s) ∼ ρ(t)} .

Table 1.2: Equational rules for Σ-algebras

(refl)  \overline{s = s}
(symm)  \frac{s = t}{t = s}
(trans) \frac{s = t  t = u}{s = u}

(cong) \frac{f ∈ Ω_{k}  s_{i} = t_{i}  (i = 1 … k)}{fs_{1} … s_{k} = ft_{1} … t_{k}}
(subst)  \frac{s = t  φ : Σ_{V} → Σ_{V}}{φ(s) = φ(t)}

Let T_{X} be the algebra Σ_{X}/∼. Then T_{X} is a T-algebra. Together with the natural map ȷ : X → T_{X}, it has the universal property:

Proposition 1.12. For any T-algebra B and any map ρ : X → B, there is a unique homomorphism ρ̂ : T_{X} → B such that

\xymatrix{X \ar[r]^{ȷ} \ar[dr]_{ρ} & T_{X} \ar[d]^{ρ̂} \\  & B.}

□

We say that a set of equations E entails an equation s = t, in symbols E ⊢_{eq} s = t, if s = t can be derived from the hypotheses E by the rules in Table 1.2. We write E ⊧_{Σ-Alg} s = t if for all Σ-algebras A, if A ⊧ E, then A ⊧ s = t.

Proposition 1.13. Soundness and Completeness for Σ-algebras.

E ⊢_{eq} s = t if and only if E ⊧_{Σ-Alg} s = t
□

1.3.4 Indeterminates

Let T be a variety with signature Σ and equations E. Let A be a T-algebra, and let X be a set. Assume without loss of generality that X and |A| are disjoint. Relative to the variety T, the polynomial algebra A[X] is defined as follows: On the term algebra Σ_{|A|+X}, consider the smallest congruence relation ∼ such that

\frac{a = f_{A}a_{1} … a_{k}}{c_{a} ∼ fc_{a_{1}} … c_{a_{k}}}  \frac{⟨s, t⟩ ∈ E  ρ : Σ_{V} → Σ_{|A|+X}}{ρ(s) ∼ ρ(t)} .

Let A[X] be the algebra Σ_{|A|+X}/∼. Together with A[X], consider the natural maps ι : A → A[X] defined by ι(a) = [c_{a}]_{∼}, and ȷ : X → A[X] defined by ȷ(x) = [c_{x}]_{∼}.

Proposition 1.14. A[X] is a T-algebra with the following universal property: For any T-algebra B, any homomorphism f : A → B of T-algebras, and any map g : X → B, there is a unique homomorphism h : A[X] → B such that

\xymatrix{X \ar[r]^{ȷ} \ar[dr]_{g} & A[X] \ar[d]^{h} & A \ar[l]_{ι} \ar[dl]^{f} \\  & B.}

□

Remark. The map ι : A → A[X] is always an injection; we will often regard it as an inclusion. Notice that A[X][Y] ≅ A[X + Y]. In the case where X = {x_{1}, …, x_{n}} is finite, we write A[X] = A[x_{1}, …, x_{n}]. The elements of A[X] are called polynomials, and X is called a set of indeterminates.

Table 1.3: Inequational rules for Σ-algebras

(refl)  \overline{s ⩽ s}
(trans) \frac{s ⩽ t  t ⩽ u}{s ⩽ u}

(cong) \frac{f ∈ Ω_{k}  s_{i} ⩽ t_{i}  (i = 1 … k)}{fs_{1} … s_{k} ⩽ ft_{1} … t_{k}}
(subst)  \frac{s ⩽ t  φ : Σ_{V} → Σ_{V}}{φ(s) ⩽ φ(t)}

1.3.5 Ordered algebras

Let A be a Σ-algebra, and let ⩽ be a partial order on the carrier set |A|. The pair ⟨A, ⩽⟩ is called an ordered Σ-algebra if the order ⩽ is a compatible relation on A in the sense of Definition 1.10. Concretely, this is the case iff for each f ∈ Ω_{k}, f_{A} : A^{k} → A is a monotone map with respect to ⩽. A homomorphism of ordered Σ-algebras is a homomorphism of Σ-algebras that is monotone. We denote the resulting category of ordered Σ-algebras by Σ-Ord .

Just as we considered sets of equations for Σ-algebras, we may consider sets of inequations for ordered Σ-algebras. Recall that V is a countable set of variables, and that Σ_{V} is the Σ-term algebra. A Σ-inequation is a pair of terms ⟨t, s⟩ ∈ Σ_{V} × Σ_{V}, often written t ⩽ s. An ordered Σ-algebra ⟨A, ⩽⟩ satisfies an inequation t ⩽ s, in symbols A ⊧ t ⩽ s, if for all homomorphisms φ : Σ_{V} → A of Σ-algebras, φ(t) ⩽ φ(s). Equivalently, A ⊧ t ⩽ s if for all valuations ρ : V → A, [[t]]_{ρ} ⩽ [[s]]_{ρ}.

Definition. An ordered Σ-algebra that satisfies a given set I of inequations is called an ordered (Σ, I)- algebra. The ordered (Σ, I)-algebras form a full subcategory of Σ-Ord , which we denote by (Σ, I)-Ord . A full subcategory O of Σ-Ord that arises in this way is called an ordered variety.

Let O be an ordered variety, defined by a pair (Σ, I) of a signature and a set of inequations. The free ordered (Σ, I)-algebra over a poset P, denoted O_{P}, is constructed as follows: On the term algebra Σ_{P}, consider the smallest compatible preorder ≼ satisfying

\frac{⟨s, t⟩ ∈ I  ρ : Σ_{V} → Σ_{P}}{ρ(s) ≼ ρ(t)}  \frac{x ⩽ y ∈ P}{c_{x} ≼ c_{y}} .

Let ∼ be the congruence ≼ ∩ ≽ on Σ_{P}, and let O_{P} be the algebra Σ_{P} /∼, together with the partial order ⩽ induced by ≼ via [x]_{∼} ⩽ [y]_{∼} iff x ≼ y. Then O_{P} is an ordered (Σ, I)-algebra, and the natural map ȷ : P → O_{P} is monotone. The following universal property holds:

Proposition 1.15. For any ordered (Σ, I)-algebra B and any monotone map ρ : P → B, there is a unique homomorphism of ordered (Σ, I)-algebras ρ̂: O_{P} → B such that

\xymatrix{P \ar[r]^{ȷ} \ar[dr]_{ρ} & O_{P} \ar[d]^{ρ̂} \\  & B.}

□

Rules for deriving inequations are given in Table 1.3. We say that a set of inequations I entails an inequation s ⩽ t, in symbols I ⊢_{ineq} s ⩽ t, if s ⩽ t can be derived from the hypotheses I by these rules. We write E ⊧_{Σ-Ord} s ⩽ t if for all ordered Σ-algebras A, if A ⊧ E, then A ⊧ s ⩽ t.

Proposition 1.16. Soundness and Completeness for ordered Σ-algebras.

E ⊢_{eq} s ⩽ t if and only if E ⊧_{Σ-Ord} s ⩽ t
□

We also sometimes write I ⊢_{ineq} s = t as an abbreviation for I ⊢_{ineq} s ⩽ t and I ⊢_{ineq} t ⩽ s.

1.3.6 Dcpo-algebras

Let Σ be a signature. An ordered Σ-algebra ⟨A, ⩽⟩ is called a Σ-dcpo-algebra if the partial order ⩽ is directed complete, and if each interpreted operation f_{A} : A^{k} → A is Scott-continuous. A homomorphism of Σ-dcpo-algebras is a Scott-continuous homomorphism of ordered Σ-algebras. We denote the resulting category of Σ-dcpo-algebras by Σ-DCPO. Each set I of inequations determines a full subcategory of Σ-DCPO, which we denote by (Σ, I)-DCPO. We call such a subcategory a dcpo-variety.

Let D be a dcpo-variety, defined by (Σ, I). For every dcpo D, there exists a free (Σ, I)-dcpo-algebra D_{D} over D, with an associated continuous map ȷ : D → D_{D}, satisfying the usual universal property. The construction of the free dcpo-algebra is less trivial than in the case of ordered algebras, and it relies an Freyd’s Adjoint Functor Theorem. A proof of the existence of D_{D} can be found in Abramsky and Jung [3].

18

The Lambda Calculus is Algebraic

The correspondence between Church’s untyped lambda calculus and Curry’s and Schönfinkel’s combinatory algebras is among the oldest known, and most esthetically pleasing, facts about the lambda calculus. However, the combinatory interpretation is also known to be somewhat imperfect, as Curry’s combinatory abstraction operator does not in general satisfy the rule

(ξ) \frac{M = N}{λx.M = λx.N} .

One usually resolves this problem by moving from the class of lambda algebras to the smaller class of lambda models, which are, by definition, those lambda algebras in which (ξ) holds. However, unlike the class of lambda algebras, the class of lambda models is not equationally definable. Therefore, it fails to enjoy some useful closure properties such as being closed under subalgebras.

In this chapter, we point out that the failure of the ξ-rule, and the subsequent need for a non-equational class of models, is not due to the lambda calculus itself, but to the way free variables are usually interpreted in these models. The usual interpretation of a lambda term is defined relative to a valuation of its free variables. Essentially, this amounts to interpreting a term M with n free variables as a function A^{n} → A. We argue that it is more natural to model free variables as algebraic indeterminates and to interpret M as an element of a polynomial algebra A[x_{1}, …, x_{n}]. Based on this interpretation, we show that the class of lambda algebras is sound and complete for arbitrary lambda theories. In particular, the notorious rule (ξ) is sound with respect to this interpretation.

This chapter is intended to serve as a self-contained, brief introduction to the lambda calculus and its combinatory models. We do not claim originality for the results in this chapter, which follow from known results in Barendregt’s book [5] and in the work of Koymans [31]. We do however hope to present these issues from a fresh point of view, particularly where the interpretation of free variables is concerned. Maybe this exposition will help to clarify the precise relationship between the lambda calculus, lambda algebras, and lambda models, which are sometimes confused in the literature.

Lambda conversion and reduction are introduced in Section 2.1. Combinatory algebras and lambda algebras are defined in Section 2.2. Section 2.3 contains a detailed analysis of the behavior of indeterminates in the theory of lambda algebras, which leads to a streamlined interpretation of the lambda calculus. In Section 2.4, we show that the categories of lambda theories and of lambda algebras are equivalent. This, to some extent, justifies the slogan “the lambda calculus is algebraic”. Lambda models are the subject of Section 2.5, and Section 2.6 is devoted to models of the lambda-βη-calculus. Finally, in Section 2.7, we relate the different kinds of algebraic models to reflexive ccc models.

Table 2.1: The axioms and rules of the lambda calculus

(refl)  \overline{M = M}
(symm)  \frac{M = N}{N = M}
(trans) \frac{M = N  N = P}{M = P}

(cong) \frac{M = M′  N = N′}{MN = M′N′}_{(ξ)  \frac{M = N}{λx.M = λx.N}}_{(β) \overline{(λx.M)N = M[N/x]}}

2.1 The lambda calculus

The lambda calculus is a theory of functions as rules. Its two basic constructions are functional application, where (fx) denotes the application of a function f to an argument x, and functional abstraction, where λx.t denotes the function that maps x to t.

Definition. Let V be a countable set of variables, fixed throughout the rest of this chapter. Let C be a set of constants. The set of raw lambda terms Λ_{C}^{raw} is defined to be the least set of terms such that

\frac{x ∈ V}{x ∈ Λ_{C}^{raw}}  \frac{c ∈ C}{c ∈ Λ_{C}^{raw}}  \frac{M, N ∈ Λ_{C}^{raw}}{(MN) ∈ Λ_{C}^{raw}}  \frac{x ∈ V  M ∈ Λ_{C}^{raw}}{(λx.M) ∈ Λ_{C}^{raw}} .

Notation: We often use upper case letters M, N, …, as well as lower case letters s, t, u, … to denote lambda terms. We use x, y, … to denote variables. To save parentheses, we write MNP instead of ((MN)P), λx.MN instead of (λx.(MN)), and λx_{1} … x_{n}.M instead of (λx_{1}.(… (λx_{n}.M) …)). The set FV(M) ⊆ V of free variables of a raw lambda term M is defined recursively:

FV(x) = {x}  FV(c) = ∅  FV(MN) = FV(M) ∪ FV(N)  FV(λx.M) = FV(M) \ {x}.

Variables that are not free are bound. We write M =_{α} N if M and N are equal up to renaming of bound variables. The set Λ_{C} of lambda terms is then defined to be the set Λ_{C}^{raw}/=_{α} of α-equivalence classes of raw terms. From now on, we will consider terms up to α-equivalence without further mentioning it. A term with no free variables is closed. The set of closed terms is denoted Λ_{C}^{0}. We write M[N/x] for the result of substituting N for x in M, taking appropriate care to ensure that neither x nor any of the free variables of N are bound in M. For a rigorous treatment of α-equivalence and substitution, see e.g.[5].

2.1.1 Lambda conversion

The axioms and rules for deriving equations between lambda terms are shown in Table 2.1. If E is a set of equations, we write E ⊢_{β} M = N if M = N is derivable from E by using these rules. A lambda theory is a set T of closed equations that is closed under derivability, i.e.T ⊢_{β} M = N implies M = N ∈ T , for closed M and N. For a given set of constants, there is a unique smallest theory \underline{λβ}, called the pure theory or the theory of β-conversion. We also write ⊢_{β} M = N as M =_{β} N and we say that M and N are β-convertible.

The lambda-βη-calculus is the lambda calculus with the additional axiom

(η) \frac{x ∉ FV(M)}{λx.Mx = M} .

We write E ⊢_{βη} M = N if M = N is derivable from a set of equations E and the axiom (η). A lambda theory T which is closed under ⊢_{βη} is called a lambda-βη-theory. The unique smallest such theory is called the theory of βη-conversion, and it is denoted \underline{λβη}. If ⊢_{βη} M = N, then we write M =_{βη} N and we say that M and N are βη-convertible.

Table 2.2: Reduction rules of the lambda calculus

(refl)  \overline{M ⟶ M}
(trans) \frac{M ⟶ N  N ⟶ P}{M ⟶ P}

(cong) \frac{M ⟶ M′  N ⟶ N′}{MN ⟶ M′N′}_{(ξ)  \frac{M ⟶ N}{λx.M ⟶ λx.N}}_{(β) \overline{(λx.M)N ⟶ M[N/x]}}

Remark. The notion of theory given here is a slightly more liberal than the one given in [5], where the equations of a theory are not allowed to contain any constants. Notice that the lambda calculus is not given by a signature and equations in the sense of universal algebra. However, we will show in Section 2.3 that the lambda calculus is equivalent, in a suitable sense, to an algebraic theory.

2.1.2 Lambda reduction and consistency

When considering functions as rules, it is natural to think of the evaluation of a function applied to an argument as a dynamic process. This process is made explicit in the notions of β-reduction and βη-reduction.

A term of the form (λx.M)N is called a β-redex, and it β-reduces to M[N/x]. The relation ^{β} ⟶ is the reflexive, transitive and contextual closure of this one-step β-reduction. More precisely, ^{β} ⟶ is the smallest relation on lambda terms satisfying the axioms and rules in Table 2.2. A term of the form λx.Mx, where x ∉ FV(M), is called an η-redex, and it η-reduces to M. The relation ^{βη} ⟶ is the reflexive, transitive and contextual closure of the one-step β- and η-reductions, i.e., it is the smallest relation satisfying the axioms and rules in Table 2.2 and also the axiom

(η) \frac{x ∉ FV(M)}{λx.Mx ⟶ M} .

A term M is said to be in β-normal form no subterm is a β-redex, i.e. if M ^{β} ⟶M′ ⇒ M = M′. Similarly, M is in βη-normal form if it contains no β- or η-redex, i.e. if M ^{βη} ⟶M′ ⇒ M = M′. Examples of terms in β-normal form include the booleans T = λxy.x and F = λxy.y, as well as the Church numerals ¯0 = λxy.x, ¯1 = λxy.xy, ¯2 = λxy.x(xy) etc.; all of these except for ¯1 are also in βη-normal form.

Definition. A binary relation ⟶ is said to have the diamond property if whenever a ⟶ b and a ⟶ c, then there exists d such that b ⟶ d and c ⟶ d. In diagrams:

\xymatrix{ & a \ar[dl] \ar[dr] \\ b &  & c}  ⇒  \xymatrix{ & a \ar[dl] \ar[dr] \\ b \ar[dr] &  & c \ar[dl] \\  & d}

Also, a relation ⟶ is said to be Church-Rosser if the transitive closure ⟶^{∗} has the diamond property.

Theorem 2.1 (Church, Rosser [12]). The relations ^{β} ⟶ and ^{βη} ⟶ are Church-Rosser. □

This theorem was first proved by Church and Rosser in 1936 [12]. Since then, the proof has been adapted and streamlined in various ways by Tait, Martin-Löf, Girard and others. One can find a proof in Barendregt’s book [5].

The Church-Rosser Theorem has several important consequences. As a first consequence, one proves that for each pair of β-convertible lambda terms M =_{β} N, there is a term P with M ^{β} ⟶P and N ^{β} ⟶P. This

Table 2.3: The axioms and rules of combinatory logic

(refl)  \overline{A = A}
(symm)  \frac{A = B}{B = A}
(trans) \frac{A = B  B = C}{A = C}

(cong) \frac{A = A′  B = B′}{AB = A′B′}
(k)  \overline{KAB = A}
(s) \overline{SABC = AC(BC)}

is easily shown by induction on the derivation of M =_{β} N, using the rules in Table 2.1. This immediately implies consistency of the lambda calculus:

Corollary 2.2. Consistency. If M and N are two different terms in β-normal form, then M ≠_{β} N. If M and N are two different terms in βη-normal form, then M ≠_{βη} N. □

2.2 Combinatory models of the lambda calculus

2.2.1 Combinatory algebras and combinatory logic

Definition. An applicative structure (A, ·) is a set A together with a binary operation. A combinatory algebra (A, ·, k, s) is an applicative structure with distinguished elements k and s such that for all x, y, z ∈ A,

kxy = x sxyz = xz(yz)

Here we write kxy for (k · x) · y, etc. A homomorphism of combinatory algebras is f: A → B such that fk = k, fs = s and f(x · y) = fx · fy, for all x, y ∈ A.

Example. The closed term algebra associated with a lambda theory T is (Λ_{C}^{0}/T , ·, K, S), where Λ_{C}^{0}/T is the set of T -equivalence classes of closed terms, M · N = (MN), K = λxy.x and S = λxyz.xz(yz). Similarly, the open term algebra is (Λ_{C}/T , ·, K, S).

Combinatory algebras form an algebraic variety. The corresponding algebraic language is combinatory logic: let V be a set of variables and C a set of constants as before. The set ℭ_{C} of combinatory terms or terms of combinatory logic is defined to be the smallest set of terms such that

\frac{x ∈ V}{x ∈ ℭ_{C}}  \frac{c ∈ C}{c ∈ ℭ_{C}}  \frac{A, B ∈ ℭ_{C}}{(AB) ∈ ℭ_{C}}  \overline{K ∈ ℭ_{C}}  \overline{S ∈ ℭ_{C}} .

Again, we economize the use of parentheses by writing ABC instead of ((AB)C). A combinatory term is closed if it contains no variables. The set of closed terms is denoted by ℭ_{C}^{0}. A closed and constant-free term, i.e.a term that is made up only from K and S, is also called a combinator. The axioms and rules for deriving equations of combinatory logic are shown in Table 2.3. We write E ⊢_{CL} A = B if A = B can be derived from a set of equations E by these rules. A theory of combinatory logic is a set of closed equations that is closed under derivability. The minimal theory is denoted CL, and we also write A =_{CL} B instead of ⊢_{CL} A = B.

Terms of combinatory logic can be interpreted in a combinatory algebra A, relative to a valuation ρ of variables an an interpretation I of constants. We call this the local interpretation to distinguish it from the absolute interpretation that we will consider in Section 2.3.2.

Definition. Local interpretation of combinatory logic. Let A be a combinatory algebra, and let I : C → A be an interpretation of constants in A. A valuation of variables in A is a map ρ: V → A. The local interpretation [[A]]_{ρ}^{I} of a term A ∈ ℭ_{C} is defined inductively:

[[x]]_{ρ}^{I} = ρ(x)  [[c]]_{ρ}^{I} = I(c)  [[K]]_{ρ}^{I} = k  [[S]]_{ρ}^{I} = s  [[AB]]_{ρ}^{I} = [[A]]_{ρ}^{I} · [[B]]_{ρ}^{I}.

For terms A, B ∈ ℭ_{C}, we say that the interpretation I locally satisfies the equation A = B, notation I ⊧ A = B, if for all valuations ρ in A, [[A]]_{ρ}^{I} = [[B]]_{ρ}^{I}. We write E ⊧_{CA} A = B if for all combinatory algebras A and all interpretations I : C → A, if I ⊧ E then I ⊧ A = B.

Proposition 2.3. Soundness and Completeness for combinatory logic. Let E be a set of closed equations of combinatory logic. For combinatory terms A and B,

E ⊢_{CL} A = B if and only if E ⊧_{CA} A = B.
□

2.2.2 The derived lambda abstractor

The significance of the two combinators K and S of combinatory logic lies in the fact that they can be used to simulate lambda abstraction. Define I = SKK. Notice that Ix =_{CL} x, for all x. For a combinatory term A ∈ ℭ_{C} and a variable x ∈ V, define the term λ^{∗}x.A ∈ ℭ_{C} inductively:

λ^{∗}x.x = I
λ^{∗}x.B = KB,  if x ∉ FV(B)
λ^{∗}x.BC = S(λ^{∗}x.B)(λ^{∗}x.C), otherwise.

Notice that (λ^{∗}x.A)x =_{CL} A can be shown by induction for any term A. Also, FV(λ^{∗}x.A) = FV(A) \ {x}. We call λ^{∗} the derived lambda abstractor of combinatory logic. It is important to remark here that, in general, the operator λ^{∗} is well-defined only on terms, and not on equivalence classes of terms. For this reason, the λ^{∗} operator does not, in general, yield an operator λ^{∗}: A[x] → A, for a combinatory algebra A. We will see in Section 2.3.2 that we do get such an operator when A is a lambda algebra.

Proposition 2.4. Combinatory completeness. For every term B ∈ ℭ_{C} with variables in x_{1}, …, x_{n}, there exists a closed term A such that B =_{CL} Ax_{1} ⋯ x_{n}.

Proof. Let B = λ^{∗}x_{1} … x_{n}.A. □

As a consequence, in the variety of combinatory algebras, all elements of A[x_{1}, …, x_{n}] can be written in the form Ax_{1} … x_{n}, where A ∈ A. However, such A is not necessarily unique.

2.2.3 The local interpretation of lambda terms

Using the derived lambda abstractor λ^{∗} of combinatory logic, we can define translations cl: Λ_{C} → ℭ_{C} and λ: ℭ_{C} → Λ_{C} from lambda terms to combinatory terms and vice versa:

x_{cl} = x
c_{cl} = c
(MN)_{cl} = M_{cl}N_{cl}
(λx.M)_{cl} = λ^{∗}x.M_{cl}

x_{λ} = x_{c_{λ} = c}_{(AB)_{λ} = A_{λ}B_{λ}}_{K_{λ} = λxy.x}_{S_{λ} = λxyz.xz(yz)}

Notice: Again, these translations are defined on terms, rather than equivalence classes of terms. For example, (λz.(λx.x)z)_{cl} = S(KI)I and (λz.z)_{cl} = I are not equivalent in combinatory logic. The following hold:

Lemma 2.5. For any lambda term M, we have M_{cl,λ} =_{β} M. For combinatory terms A, B, if A =_{CL} B then A_{λ} =_{β} B_{λ}. For lambda terms M, N, if M_{cl} =_{CL} N_{cl}, then M =_{β} N. For a combinatory term A, (λ^{∗}x.A)_{λ} =_{β} λx.A_{λ}. □

We can now interpret lambda terms in any combinatory algebra, by first translating them into combinatory logic via cl:

Definition. Local interpretation of lambda terms. Let A be a combinatory algebra and I : C → A an interpretation of constants. For lambda terms M, N ∈ Λ_{C} and a valuation ρ: V → A, define

[[M]]_{ρ}^{I} = [[M_{cl}]]_{ρ}^{I}
I ⊧ M = N iff I ⊧ M_{cl} = N_{cl}
Th(I) = {M = N | M, N ∈ Λ_{C}^{0}, I ⊧ M = N}

This interpretation is not sound for the lambda calculus, since there are derivable equations, such as for instance λz.(λx.x)z = λz.z, that do not hold in all combinatory algebras. In particular, Th(I) need not be a lambda theory!

This leads us to consider the class of lambda algebras, which are precisely those combinatory algebras that satisfy all the equations of the lambda calculus.

2.2.4 Lambda algebras

Let A be a combinatory algebra. Then ℭ_{A} is the set of combinatory terms with one constant symbol for each element of A. Let I_{0} : A → A be the canonical interpretation of each constant symbol as itself, i.e. the identity function. For A, B ∈ ℭ_{A}, we write A ⊧ A = B instead of I_{0} ⊧ A = B.

Definition. A combinatory algebra A is called a lambda algebra if for all combinatory terms A, B ∈ ℭ_{A},

A_{λ} =_{β} B_{λ}  ⇒  A ⊧ A = B.

A homomorphism of lambda algebras is a homomorphism of combinatory algebras.

Example. For any lambda theory T , the open term algebra Λ_{C}/T and the closed term algebra Λ_{C}^{0}/T are lambda algebras. In the open terms algebra, Λ_{C}/T ⊧ A = B iff T ⊢_{β} A_{λ} = B_{λ}.

Proposition 2.6 (Curry). Lambda algebras form an algebraic variety. In fact, the class of lambda algebras can be axiomatized over the class of combinatory algebras by the following five closed equations, known as the Curry axioms:

1. k = s(s(ks)(s(kk)k))(k(skk))

2. s = s(s(ks)(s(k(s(ks)))(s(k(s(kk)))s)))(k(k(skk)))

3. s(kk) = s(s(ks)(s(kk)(s(ks)k)))(kk)

4. s(ks)(s(kk)) = s(kk)(s(s(ks)(s(kk)(skk)))(k(skk)))

5. s(k(s(ks)))(s(ks)(s(ks))) = s(s(ks)(s(kk)(s(ks)(s(k(s(ks)))s))))(ks)

Proof. See [5]. We will give a different axiomatization of lambda algebras in Remark 2.20. □

We denote the variety of lambda algebras by LA. We write ⊢_{LA}for provability from the axioms and rules of combinatory logic plus the five Curry axioms. We also write A =_{LA} B instead of ⊢_{LA} A = B. The following complements Lemma 2.5:

Lemma 2.7. For any combinatory term A, we have A_{λ,cl} =_{LA} A. For lambda terms M, N, if M =_{β} N, then M_{cl} =_{LA} N_{cl}. For combinatory terms A, B, if A_{λ} =_{β} B_{λ}, then A =_{LA} B. □

If E is a set of equations, we write E ⊧_{LA} A = B if for all lambda algebras A and all interpretations I : C → A, if I ⊧ E then I ⊧ A = B. The following is a soundness and completeness theorem for the pure lambda calculus, i.e.for equations M = N that are provable in the pure theory \underline{λβ}. In Section 2.3.3, we prove a more general theorem for arbitrary theories.

Theorem 2.8. Soundness and completeness for the pure lambda calculus. For lambda terms M, N ∈ Λ_{C},

⊢_{β} M = N if and only if ⊧_{LA} M = N.

Proof. Soundness follows directly from the definition of lambda algebras. For completeness, notice that the open term algebra Λ/\underline{λβ} of the lambda beta calculus is a lambda algebra in which M = N iff M =_{β} N. □

Remark 2.9. Failure of (ξ) for the local interpretation. The reason that we state the soundness and completeness only for the pure lambda calculus at this point is that in general, the local interpretation in a lambda algebra does not satisfy the rule (ξ), i.e.it is not in general true that I ⊧ A = B implies I ⊧ λ^{∗}x.A = λ^{∗}x.B. A counterexample is the closed term algebra M^{0} of the lambda-β-calculus. Plotkin [46] shows that there exist closed terms M, N such that for all closed terms Z, MZ =_{β} NZ, but Mx ≠_{β} Nx for a variable x. Hence M^{0} ⊧ Mx = Nx, but M^{0} |̸= λx.Mx = λx.Nx. The absolute interpretation, to be defined in Section 2.3.2, takes care of this problem.

2.3 Lambda algebras and indeterminates

2.3.1 A characterization of A[x] for lambda algebras

Recall that for a combinatory algebra A, we denote by A[x] the algebra obtained by freely adjoining an indeterminate x to A in the variety of combinatory algebras. If A is a lambda algebra then so is A[x]. More generally, if A is a lambda algebra and f: A → B is a homomorphism of combinatory algebras, then B is a lambda algebra. This is because lambda algebras are definable by closed equations (Proposition 2.6).

If A is a lambda algebra, then A[x] has an interesting explicit description. The following construction is similar to constructions given by Krivine [32] and, in the case of Curry algebras, by Freyd [19]. Let A = (A, ·, k, s), and define B = (B, •, K, S), where

B = {a ∈ A | a = 1a}, where 1 = s(ki), i = skk
a • b = sab
K = kk
S = ks

Note: ab denotes application in A, and a • b denotes application in B.

Proposition 2.10. 1. B is a well-defined combinatory algebra.

2. The map ι: A → B with ι(a) = ka is a well-defined homomorphism.

3. For every homomorphism f: A → C and every x ∈ C, there is a unique homomorphism g: B → C such that f = g ∘ ι and g(i) = x. Consequently, B ≅ A[x].

Notice that 1ab =_{CL} ab, and 1_{λ} =_{β} λxy.xy. The proof of Proposition 2.10 relies on the following seven properties of lambda algebras. We will see later that lambda algebras are already characterized by these properties (see Remark 2.20).

Lemma 2.11. The following hold in any lambda algebra:

\begin{aligned}(a) & 1(sa) & = & sa, \\ (b) & 1(sab) & = & sab, \\ (c) & 1(ka) & = & ka, \\ (d) & s(s(kk)a)b & = & 1a, \\ (e) & s(s(s(ks)a)b)c & = & s(sac)(sbc), \\ (f) & k(ab) & = & s(ka)(kb), \\ (g) & s(ka)i & = & 1a, \end{aligned}

Proof. One easily checks that (1(sa))_{λ} =_{β} (sa)_{λ}, and similarly for the other equations. □

Proof of Proposition 2.10:

1.: It follows by Lemma 2.11(a)–(c) that all of K, S, a • b, i and 1 are elements of B, for any a, b ∈ B. In particular, the operations on B are well-defined. Moreover, for all a, b, c ∈ B,

K • a • b = s(s(kk)a)b =^{2.11(d)} 1a = a, and

S • a • b • c = s(s(s(ks)a)b)c =^{2.11(e)} s(sac)(sbc) = a • c • (b • c).

2.: Using Lemma 2.11(f),

ι(ab) = k(ab) = s(ka)(kb) = ι(a) • ι(b).

3.: Define g(a) = f(a) · x, and check that this has the desired properties. For uniqueness, take any homomorphism h: B → C such that f = h ∘ ι and h(i) = x. Then for all a ∈ B,

h(a) = h(1a) =^{2.11(g)} h(s(ka)i) = h((ka) • i) = h(ka) · h(i) = h(ιa) · h(i) = f(a) · x = g(a). □

Corollary 2.12. Let A be a lambda algebra, and a, b ∈ A. Then ax = bx holds in A[x] if and only if 1a = 1b holds in A.

Proof. ⇒: Suppose a, b ∈ A and ax = bx in A[x]. By Proposition 2.10, items 1. and 2., there is a unique map h: A[x] → B extending ι and sending x to i. Then

1a =^{2.11(g)} s(ka)i = (ka) • i = h(ax) = h(bx) = (kb) • i = s(kb)i =^{2.11(g)} 1b.

⇐: 1a = 1b in A ⇒ 1a = 1b in A[x] ⇒ ax = 1ax = 1bx = bx in A[x]. □

2.3.2 The absolute interpretation

Let M ∈ ℭ_{C} be a lambda term whose free variables are among x_{1}, …, x_{n} = x̄. Let A be a combinatory algebra, and let I : C → A be an interpretation of constants. The local interpretation [[M]]_{ρ}^{I}, defined in Section 2.2.1, depends on a valuation of variables ρ: V → A. Since, in fact, it depends only on the values of ρ at x_{1}, …, x_{n}, the local interpretation can be viewed as a function [[M]]I ; x̄: A^{n} → A, sending an n-tuple ā ∈ A^{n} to [[M]]_{(x̄:=ā)}^{I}. In these terms, an equation M = N holds locally in A if M and N define the same function A^{n} → A.

We will now consider a different interpretation of terms, interpreting M as an element in A[x̄], i.e. as a polynomial. We call this the absolute interpretation of M. The absolute interpretation distinguishes more terms than the local one, since, in general, two different polynomials may define the same function. For closed terms, however, the absolute and the local interpretations coincide.

Definition. Absolute interpretation. Let A be a combinatory algebra, and let I : C → A be an interpretation of constants in A. For each combinatory term A ∈ ℭ_{C} whose variables are among x̄ = x_{1}, …, x_{n}, we define its absolute interpretation [[A]]abs ; x̄ as an element of A[x̄] by the following inductive clauses. Notice that although the absolute interpretation depends on I, we omit the extra superscript.

[[x_{i}]]abs ; x̄ = x_{i}  [[c]]abs ; x̄ = I(c)  [[K]]abs ; x̄ = k  [[S]]abs ; x̄ = s  [[AB]]abs ; x̄ = [[A]]abs ; x̄ · [[B]]abs ; x̄

We say that the interpretation I absolutely satisfies the equation A = B, in symbols I ⊧^{abs} A = B, if [[A]]abs ; x̄ = [[B]]abs ; x̄, where F V (A, B) ⊆ x̄. Notice that, since the canonical homomorphism A[x̄] → A[ȳ] is one-to-one for x̄ ⊆ ȳ, this notion is independent of the choice of variables x̄. The absolute interpretation of lambda terms M ∈ Λ_{C} is defined via the translation cl:

[[M]]abs ; x̄ = [[M_{cl}]]abs ; x̄
I ⊧^{abs} M = N iff I ⊧^{abs} M_{cl} = N_{cl}

Remark. In the language of universal algebra, [[ ·]]abs ; x̄ is just the unique map making the following diagram commute. Hence the local and the absolute interpretation can be defined in any algebraic variety.

\xymatrix{ & Σ_{C} \ar[dd]_{Î} \ar[rr]^{ȷ} &  & Σ_{C+x̄}. \\ C \ar[dr]_{I} \ar[ur]^{ȷ} &  & [[ ·]]abs ; x̄ \ar[dr] &  & \{x̄\} \ar[ul]_{ȷ} \ar[dl]^{ȷ} \\  & A \ar[rr]_{ι} &  & A[x̄]}

The terminology “an equation holds absolutely” is justified by the following lemma:

Lemma 2.13. Let A, B ∈ ℭ_{C} be combinatory terms with variables in x̄. Let A be a combinatory algebra and I : C → A an interpretation of constants. The following are equivalent:

1. I ⊧^{abs} A = B,

2. ι ∘ I ⊧ A = B, where ι : A → A[x̄] is the canonical map,

3. f ∘ I ⊧ A = B for all homomorphisms f: A → B.

Proof. \underline{1.⇒3.:} Consider f: A → B and ρ: V → B. Let g: A[x̄] → B be the unique map extending f such that g(x_{i}) = ρ(x_{i}) for all i. Then [[A]]_{ρ}^{f∘I} = g[[A]]abs ; x̄ and [[B]]_{ρ}^{f∘I} = g[[B]]abs ; x̄, hence [[A]]_{ρ}^{f∘I} = [[B]]_{ρ}^{f∘I}, which proves f ∘ I ⊧ A = B. \underline{3.⇒2.:} Trivial. \underline{2.⇒1.:} ι ∘ I ⊧ A = B iff for all ρ : V → A[x̄], [[A]]_{ρ}^{ι∘I} = [[B]]_{ρ}^{ι∘I}. Take ρ(x_{i}) = x_{i} to get [[A]]abs ; x̄ = [[B]]abs ; x̄. □

Lemma 2.14. In any lambda algebra, 1(λ^{∗}x.A) = λ^{∗}x.A.

Proof. By definition of λ^{∗} and Lemma 2.11(b) and (c). □

The next lemma, which is crucial for the soundness of the interpretation of the lambda calculus, holds for absolute, but not for local interpretations.

Lemma 2.15. The rule (ξ) is sound for the absolute interpretation. Let A be a lambda algebra, I : C → A an interpretation and A, B ∈ ℭ_{C} combinatory terms. Then

I ⊧^{abs} A = B  ⟺  I ⊧^{abs} λ^{∗}x.A = λ^{∗}x.B

Proof. Assume the variables of A and B are contained in x, y_{1}, …, y_{n}.

⇒: Suppose A[x, ȳ] ⊧ A = B. Then A[x, ȳ] ⊧ (λ^{∗}x.A)x = A = B = (λ^{∗}x.B)x, hence by Corollary 2.12, A[ȳ] ⊧ 1(λ^{∗}x.A) = 1(λ^{∗}x.B). The claim follows by Lemma 2.14. ⇐: Suppose A[ȳ] ⊧ λ^{∗}x.A = λ^{∗}x.B. Then A[x, ȳ] ⊧ A = (λ^{∗}x.A)x = (λ^{∗}x.B)x = B. □

It follows from this lemma that the derived lambda abstractor λ^{∗}x is a well-defined operator λ^{∗}x : A[x] → A if A is a lambda algebra. When A[x] is explicitly constructed as (B, •, K, S) like in Section 2.3.1, then λ^{∗}x: B → A turns out to be the map that sends every element a to itself. Using this λ^{∗} operator, the absolute interpretation of a lambda term can be defined directly, i.e.without relying on the translation cl into combinatory logic:

[[c]]abs ; x̄ = c  [[x_{i}]]abs ; x̄ = x_{i}  [[MN]]abs ; x̄ = [[M]]abs ; x̄ · [[N]]abs ; x̄  [[λx.M]]abs ; x̄ = λ^{∗}x.[[M]]_{x,x̄}^{abs}

Proposition 2.16. In the category of lambda algebras, the derived lambda abstractor λ^{∗}x : A[x] → A is natural in A, i.e.for all φ : A → B,

\xymatrix{A[x] \ar[d]_{λ^{∗}x} \ar[r]^{φ[x]} & B[x]. \ar[d]^{λ^{∗}x} \\ A \ar[r]_{φ} & B}

Proof. Any element of A[x] can be written (not uniquely) as ax, where a ∈ A. Then φ(λ^{∗}x.ax) = φ(1a) = 1(φa) = λ^{∗}x.(φa)x = λ^{∗}x.φ[x](ax). □

2.3.3 Soundness and completeness for lambda algebras

Proposition 2.17. Soundness. The set of equations that hold absolutely in a lambda algebra A is closed under the axioms and rules of the lambda calculus. As a consequence, Th(A) is a lambda theory for any lambda algebra A.

Proof. Consider each axiom and rule of the lambda calculus. (α) and (β) are satisfied because A is a lambda algebra. The rules (refl), (symm), (trans) or (cong) are trivially satisfied. Finally, the rule (ξ) is satisfied by Lemma 2.15. For the second claim, notice that a closed equation holds absolutely iff it holds locally. □

Theorem 2.18. Soundness and Completeness for lambda algebras. Let E be a set of closed equations of the lambda calculus. Then for lambda terms M, N,

E ⊢_{β} M = N if and only if E ⊧_{LA} M = N.

Proof. Soundness follows by Proposition 2.17. For completeness, observe that the open term algebra Λ/T associated with the theory T is a lambda algebra satisfying M = N iff T ⊢_{β} M = N. □

Corollary 2.19. For a set E of closed equations of the lambda calculus, let E_{cl} be its translation into combinatory logic. Then for lambda terms M and N,

E ⊢_{β} M = N if and only if E_{cl} ⊢_{LA} M_{cl} = N_{cl}.
□

Remark 2.20. It is worth noting that Corollary 2.12, Lemma 2.15, and Proposition 2.17 were all proved using only the seven properties of Lemma 2.11. Hence, if a combinatory algebra A satisfies 2.11(a)–(g), then Th(A) is a lambda theory, which implies that A is a lambda algebra. Thus, the class of lambda algebras is axiomatized over the class of combinatory algebras by the properties in Lemma 2.11. Of course, these axioms can be closed by using the derived lambda abstractor. However, after spelling everything out in terms of s and k, the axioms given in Proposition 2.6 are considerably shorter.

2.4 Lambda theories and lambda algebras form equivalent categories

In this section, we define the category of lambda theories, and we show that it is equivalent to the category of lambda algebras.

Definition. The category LT of lambda theories is defined as follows: An object is a pair ⟨C, T ⟩, where C is a set of constants and T a lambda theory in the language Λ_{C}^{0}. The pair ⟨C, T ⟩, like T itself, is called a lambda theory. A translation from C to C′ is a function φ: C → Λ_{C′}^{0}. Any such φ extends uniquely to a function φ̃: Λ_{C}^{0} → Λ_{C′}^{0}, defined by φ̃M(c_{1}, …, c_{n}) = M(φc_{1}, …, φc_{n}), where c_{1}, …, c_{n} are the constants that appear in M. A morphism from ⟨C, T ⟩ to ⟨C′, T′⟩ is named by a translation from C to C′ such that T ⊢_{β} M = N implies T′ ⊢_{β} φ̃M = φ̃N for all M, N ∈ Λ_{C}^{0}. φ and ψ name the same morphism if T′ ⊢_{β} φ̃M = ψ̃M for all M ∈ Λ_{C}^{0}. Composition is defined by φ ∘ ψ := φ̃ ∘ ψ.

Theorem 2.21. The category LT of lambda theories is equivalent to the category LA of lambda algebras.

Proof. We define a pair of functors F: LT → LA and G: LA → LT. F sends a lambda theory ⟨C, T ⟩ to its closed term algebra Λ_{C}^{0}/T , which is always a lambda algebra. F sends a morphism φ: ⟨C, T ⟩ → ⟨C′, T′⟩ to the homomorphism f: Λ_{C}^{0}/T → Λ_{C′}^{0}/T′ induced by φ̃: Λ_{C}^{0} → Λ_{C′}^{0}. G sends a lambda algebra A to ⟨A, Th(A)⟩, which is a lambda theory by Proposition 2.17. G sends a homomorphism f: A → B to the translation φ: A → Λ_{B}^{0} with φa = fa.

Next, we describe a natural isomorphism η: id_{LA} → F ∘ G. For every lambda algebra A, define η_{A} : A → F ∘G(A) = Λ_{A}^{0}/Th(A) by η_{A}(a) = a. This is clearly a homomorphism, and it is natural in A. To see that this is an isomorphism, notice that for every M ∈ Λ_{A}^{0} there is a unique a ∈ A with Th(A) ⊢_{β} M = a, namely, a = [[M]].

In order to show the existence of a natural isomorphism G∘F ≅ id_{LT}, it now suffices to show that F is full and faithful. F is one-to-one on hom-sets by definition of morphisms in LT. F is also full: if f: Λ_{C}^{0}/T → Λ_{C′}^{0}/T′ is any homomorphism, then f maps a closed lambda term M(c_{1}, …, c_{n}) to M(fc_{1}, …, fc_{n}), where c_{1}, …, c_{n} are the constants that appear in M. This is because M is equivalent to an applicative term made up from c_{1}, …, c_{n} and the combinators k and s, which are preserved by f. It follows that f = F φ, where φ: C → Λ_{C′}^{0} is defined by choosing a representative φ(c) of f(c), for every c ∈ C. □

2.5 Lambda models

The notion of lambda model arises, as in [5], if one attempts to prove Proposition 2.17 with respect to the equations that hold locally. To do this, one needs the “local” equivalent of Lemma 2.15:

A ⊧ A = B  ⇒  A ⊧ λ^{∗}x.A = λ^{∗}x.B.

This property, which is called weak extensionality, does not hold in general. Hence one defines a lambda model to be a weakly extensional lambda algebra.

From our point of view, lambda models can be characterized as those lambda algebras which are intrinsically local: in a lambda model, an equation holds absolutely if and only if it holds locally. Or in other words: in a lambda model, every polynomial is determined by its behavior as a function. In the language of category theory, such a property is called well-pointedness, and indeed lambda models correspond to well-pointed lambda algebras in a sense that will be made precise in Proposition 2.27.

Proposition 2.22. The following are equivalent for a lambda algebra A:

1. A is weakly extensional.

2. A satisfies the following Meyer-Scott axiom: for all a, b ∈ A,

\frac{∀x ∈ A.ax = bx}{1a = 1b} (MS), where 1 = S(KI),

3. every equation that holds locally in A already holds absolutely.

Proof. 1. ⇒ 3.: Let A be weakly extensional and A ⊧ A = B. Assume F V (A, B) ⊆ x̄. By weak extensionality, A ⊧ λ^{∗}x̄.A = λ^{∗}x̄.B. This is a closed equation, hence A ⊧^{abs} λ^{∗}x̄.A = λ^{∗}x̄.B, and finally A ⊧^{abs} A = B by Lemma 2.15.

3. ⇒ 2.: We show (MS): Suppose for all x ∈ A, ax = bx. Then A ⊧^{abs} ax = bx by 3., i.e. ax = bx ∈ A[x]. Hence 1a = 1b by Corollary 2.12.

2. ⇒ 1.: To show weak extensionality, suppose A ⊧ A = B. Then A ⊧ (λ^{∗}x.A)x = A = B = (λ^{∗}x.B)x, hence by 2., A ⊧ 1(λ^{∗}x.A) = 1(λ^{∗}x.B), hence by Lemma 2.14, A ⊧ λ^{∗}x.A = λ^{∗}x.B. □

Lambda models are less natural than lambda algebras, because they do not form an algebraic variety. Historically, lambda models were a vehicle for proving soundness and completeness theorems such as Theorem 2.18, see e.g.[5, Thm. 5.2.18]. We conclude this section by remarking that every lambda algebra can be embedded in a weakly extensional one:

Proposition 2.23. If A is a lambda algebra and X an infinite set, then A[X] is a lambda model.

Proof. We show the Meyer-Scott axiom: assume a, b ∈ A[X] and ax = bx for all x ∈ A[X]. Then there is some finite Y ⊆ X with a, b ∈ A[Y]. Let x ∈ X \ Y, then ax = bx in A[Y][x], hence 1a = 1b in A[Y] by Corollary 2.12. □

2.6 Models of the lambda-βη-calculus

2.6.1 Curry algebras

A Curry algebra [33] is a lambda algebra with 1 = I. Note that Curry algebras form an algebraic variety.

Proposition 2.24. A lambda algebra A is a Curry algebra if and only if Th(A) is a lambda-βη-theory.

Proof. If x ∉ FV(M), then λx.Mx =_{β} (λxy.xy)M = 1_{λ}M. Hence in any Curry algebra, λx.Mx = 1M = M. Conversely, if Th(A) is a lambda-βη-theory, then A ⊧ 1 = λxy.xy = λx.x = I. □

Hence Curry algebras are to the lambda-βη-calculus what lambda algebras are to the lambda-β-calculus.

2.6.2 Extensional models

An applicative structure is extensional if for all a, b ∈ A,

\frac{∀x ∈ A.ax = bx}{a = b} .

Extensional combinatory algebras are Curry algebras, and hence models of the λβη-calculus. Although extensionality is an intuitive property, extensional models do not form an algebraic variety: e.g. the closed term algebra of the lambda-βη-calculus is extensional, but the subalgebra of closed terms is not (see [5, Thm. 20.1.2] and [46]). In fact, a Curry algebra is extensional if and only if it is a lambda model, since the Meyer-Scott axiom from Proposition 2.22 is equivalent to extensionality in the presence of the equation 1 = I.

2.7 Lambda algebras and categorical models

2.7.1 Reflexive ccc models

In this section, we relate the combinatory models of the lambda calculus to the models that arise from a reflexive object in a cartesian-closed category. An object D in a cartesian-closed category C is called reflexive if there exists morphisms e and p such that

\xymatrix{D^{D} \ar[d]_{p} \ar[dr]^{id} \\ D \ar[r]_{e} & D^{D}}

The triple ⟨D, e, p⟩ is called a reflexive C-model or a categorical model of β-conversion. If also p∘e = id_{D}, we speak of a categorical model of βη-conversion.

One defines an interpretation [[M]]_{x_{1},... ,x_{n}} of each lambda term M with FV(M) ⊆ {x_{1}, …, x_{n}} as a morphism D^{n} → D. Assume that bound variables are renamed as appropriate. Recall that g^{⋆} and e_{⋆} are our notations for the curry and uncurry operations, respectively.

[[x_{i}]]_{x_{1},... ,x_{n}} = D^{n} ⟶^{π_{i}} D  (the ith projection)
[[MN]]_{x_{1},... ,x_{n}} = D^{n} ⟶^{⟨[[M]]_{x_{1},... ,xn} ,[[N]]_{x_{1},... ,xn} ⟩} D × D ⟶^{e_{⋆}} D
[[λx_{n+1}.M]]_{x_{1},... ,x_{n}} = D^{n} ⟶^{([[M]]_{x_{1},... ,x_{n+1}} )^{⋆}} D^{D} ⟶^{p} D.

Proposition 2.25. The following are properties of categorical models of β-conversion:

1. Permutation. The interpretation is independent of the ordering of the free variables, or of the addition of dummy variables, in the following sense: If σ : {1, …, n} → {1, …, m} is injective and FV(M) ⊆ {x_{σ1}, …, x_{σn}}, then

\xymatrix{D^{m} \ar[rr]^{[[M]]_{x_{1},... ,xm}} \ar[dr]_{⟨π_{σ1},... ,π_{σn}⟩} &  & D. \\  & D^{n} \ar[ur]_{[[M]]_{x_{σ1},... ,xσn}}}

2. Substitution. Let FV(M) ⊆ {x_{1}, …, x_{n}} and F V (N_{1}, …, N_{n}) ⊆ {y_{1}, …, y_{m}}, and let M[N̄/x̄] denote the simultaneous substitution of N_{1}, …, N_{n} for x_{1}, …, x_{n} in M. Then

\xymatrix{D^{m} \ar[rr]^{[[M[N̄/x̄]]]ȳ} \ar[dr]_{⟨[[N_{1}]]ȳ,... ,[[N_{n}]]ȳ⟩} &  & D. \\  & D^{n} \ar[ur]_{[[M]]_{x_{1},... ,xn}}}

3. Soundness. If M =_{β} N, then [[M]]x̄ = [[N]]x̄. In a categorical model of βη-conversion, if M =_{βη} N, then [[M]]x̄ = [[N]]x̄.

Proof. 1. and 2. are straightforward by induction on the term M. For 3., define M ∼ N iff [[M]]x̄ = [[N]]x̄; by 1., this is independent of the sequence of variables x̄, as long as FV(M, N) ⊆ x̄. Clearly, ∼ satisfies the properties (refl), (symm), (trans) from Table 2.1. Moreover, it satisfies (cong) and (ξ) by 2.; to see that it also satisfies (β), first note that e_{⋆} ∘ (p × id_{D}) = (e ∘ p)_{⋆} = (id_{D^{D}})_{⋆} = ε. Hence

\xymatrix{ & D × D \ar[dr]^{e_{⋆}} \\ D^{n} \ar[ur]^{⟨[[λx.M]]x̄,[[N]]x̄⟩} \ar[r]^{⟨([[M]]_{x̄,x})^{⋆},[[N]]x̄⟩} \ar[dr]_{⟨id_{D^{n}} ,[[N]]x̄⟩} & D^{D} × D \ar[u]|{p×id_{D}} \ar[r]^{ε} & D. \\  & D^{n} × D \ar[u]|{⟨([[M]]_{x̄,x})^{⋆},id_{D}⟩} \ar[ur]_{[[M]]_{x̄,x}}}

By definition, the composition along the top is [[(λx.M)N]]x̄, while by the Substitution Property 2., the composition along the bottom is [[M[N/x]]]x̄. This shows (λx.M)N ∼ M[N/x]. Hence =_{β} ⊆ ∼, and we are done with the first claim. The case for η-conversion follows by a similar diagram chase. □

2.7.2 Reflexive ccc models and lambda algebras

From a categorical model ⟨D, e, p⟩, one can define a lambda algebra ⟨A, ·, k, s⟩:

A = (1, D)  (the hom-set)
a · b = 1 ⟶^{⟨a,b⟩} D × D ⟶^{e_{⋆}} D
k = 1 ⟶^{[[λxy.x]]} D
s = 1 ⟶^{[[λxyz.xz(yz)]]} D.

Lemma 2.26. ⟨A, ·, k, s⟩ is a well-defined lambda algebra.

Proof. It is easy to show by induction on terms that for any combinatory term A,

[[A]]_{ρ} = 1 ⟶^{⟨ρx_{1},...ρx_{n}⟩} D^{n} ⟶^{[[A_{λ}]]_{x_{1},... ,xn}} D.

Hence, A_{λ} =_{β} B_{λ} ⇒ [[A_{λ}]]x̄ = [[B_{λ}]]x̄ ⇒ [[A]]_{ρ} = [[B]]_{ρ} ⇒ A ⊧ A = B. □

Remark. Every lambda algebra arises from a reflexive model. The construction of a cartesian-closed category from a lambda algebra is due to Scott [54], and it is also described in [31].

The following proposition relates various concepts of lambda algebras to corresponding concepts of the categorical interpretation. An object D in a category is well-pointed if for all f, g : D → E,

(∀x. [figure: 1; x; D; f; g; E] )  ⇒  f = g.

We say that D is locally well-pointed if the same holds for all f, g : D → D.

Proposition 2.27.

1. A is a lambda model iff D is locally well-pointed.
2. A is a Curry algebra iff p ∘ e = id_{D}.
3.  A is extensional iff D is locally well-pointed and p ∘ e = id_{D}.
4.  A[x] ≅ (1, D^{D}) ≅ (D, D).
5.  A[x_{1}, …, x_{n}] ≅ (D^{n}, D).
6.  A ⊧ M = N iff M = N: (1, D)^{n} → (1, D).
7.  A ⊧^{abs} M = N iff M = N ∈ (D^{n}, D).

Proof. In A, one first computes I = [[λx.x]] = p ∘ (id_{D})^{⋆}, 1 = [[λxy.xy]] = p ∘ (p ∘ e)^{⋆}, and for all a ∈ A, 1 · a = p ∘ e ∘ a.

1. ⇒: Suppose A is a lambda model and suppose f, g : D → D such that for all x : 1 → D, f ∘ x = g ∘ x. Let f̂ = p ∘ f^{⋆} and ĝ = p ∘ g^{⋆} ∈ A. Then f̂ · x = f ∘ x = g ∘ x = ĝ · x for all x ∈ A, hence 1 · f̂ = 1 · ĝ ⇒ p ∘ e ∘ p ∘ f^{⋆} = p ∘ e ∘ p ∘ g^{⋆} ⇒ f = g. ⇐: Suppose D is locally well-pointed. We show the Meyer-Scott axiom (see Proposition 2.22). Suppose a, b ∈ A such that for all x ∈ A, ax = bx. This implies for all x : 1 → 1 × D,

[figure: D × D; e_{⋆}; 1; x; 1 × D; a×id_{D}; b×id_{D}; D,; D × D; e_{⋆}]

hence, by local well-pointedness, the square commutes. Currying the square, we get e ∘ a = e ∘ b, hence 1 · a = 1 · b.

2. ⇒: Suppose A is a Curry algebra. Then

(p ∘ e)^{⋆} = e ∘ p ∘ (p ∘ e)^{⋆} = e ∘ 1 = e ∘ I = e ∘ p ∘ (id_{D})^{⋆} = (id_{D})^{⋆},

hence p ∘ e = id_{D}.

⇐: Suppose p ∘ e = id_{D}, then 1 = p ∘ (p ∘ e)^{⋆} = p ∘ (id_{D})^{⋆} = I.

3. From 1. and 2.

4. and 5. Consider the following two retracts:

\xymatrix{A[x] \ar[d]_{λ^{∗}x} \ar[dr]^{id} &  & and & D^{D} \ar[d]_{p} \ar[dr]^{id} \\ A \ar[r]_{(−)·x} & A[x] &  & D \ar[r]_{e} & D^{D}.}

As we have seen in Section 2.3, the set A[x] can be identified with those a ∈ A such that 1 · a = a. On the other hand, arrows 1 → D^{D} can be identified with those a : 1 → D such that p ∘ e ∘ a = a, which is again just 1 · a = a. This gives a one-to-one correspondence between the points of A[x] and (1, D^{D}) ≅ (D, D). The correspondence A[x_{1}, …, x_{n}] ≅ (D^{n}, D) is similar. Moreover, this correspondence induces a lambda algebra structure on (D^{n}, D), which turns out to be the natural “pointwise” one given by

\begin{aligned}a · b & = & D^{n} ⟶^{⟨a,b⟩} D × D ⟶^{e_{⋆}} D \\ k & = & D^{n} ⟶ 1 ⟶^{[[λxy.x]]} D \\ s & = & D^{n} ⟶ 1 ⟶^{[[λxyz.xz(yz)]]} D. \end{aligned}

6. We have A ⊧ M = N iff [[M]]_{ρ} = [[N]]_{ρ} for all ρ : V → (1, D), iff [[M]]x̄ ∘ f = [[N]]x̄ ∘ f ∈ (1, D) for all f ∈ (1, D^{n}).

7. Follows from 5. and Lemma 2.13. □

34

Unorderability

The formulation of the untyped lambda calculus, by Church and Curry in the 1930’s, has preceded its modern semantic theory by more than 30 years. It was not until the 1960’s that Dana Scott constructed the first truly “mathematical” models of the lambda calculus. Scott discovered that such models can be constructed by a combination of order-theoretic and topological methods. Specifically, he observed that there exist non-trivial diagrams of the form

\xymatrix{D^{D} \ar[d]_{p} \ar[dr]^{id} \\ D \ar[r]_{e} & D^{D}}

in certain cartesian-closed categories of complete partial orders and Scott-continuous functions. Recall that an object D in this situation is called reflexive, and that it gives rise to a model of the lambda calculus in a canonical way as described in Chapter 2.

The question now arises whether all models of the lambda calculus can be constructed in this way. This question must be modified, since a simple analysis reveals that every reflexive CPO-model is uncountable [48], while there are some countable models of the lambda calculus. Instead, one can ask the refined question: can every model of the lambda calculus be embedded in a reflexive CPO-model? Alternatively: does every lambda theory arise as the theory of a reflexive CPO-model? The answer is known to be negative: Honsell and Ronchi Della Rocca [27] have exhibited a lambda theory that does not arise from such a model. One may now further relax this question by asking:

(i) Can every model of the lambda calculus be partially ordered?

(ii) Can every model of the lambda calculus be embedded in one that admits a partial order?

These two questions are the subject of this chapter. Let us call a lambda algebra unorderable if it does not admit a non-trivial partial order that is compatible with the algebra structure. Unorderable algebras are known to exist. Plotkin has recently constructed a finitely separable algebra, a property with implies unorderability. In Section 3.1, however, we show that one does not have to look very far to find unorderable algebras: the most natural term models of the lambda calculus, namely the standard open and closed term algebras, are unorderable. An application to reflexive CPO-models is discussed in Section 3.2.

Question (ii) is more difficult to answer, as indicated by the fact that the answer is still unknown. Let us call a lambda algebra absolutely unorderable if it cannot be embedded in an orderable one. In Section 3.3, we give an algebraic characterization of absolutely unorderable T-algebras in any algebraic variety T. We show that a T-algebra is absolutely unorderable if and only if it has a family of so-called generalized Mal’cev operators. The question (ii) thereby reduces to the syntactic question whether it is consistent to add such Mal’cev operators to the lambda calculus. This is an open problem in general, but we discuss some special cases in Section 3.4. Finally, in Section 3.5, we relate various different notions of unorderability.

3.1 Lambda terms cannot be ordered

In this section, we investigate unorderable models of the lambda calculus. Let us first fix some terminology. Preorders and partial orders were defined in Section 1.2.1. The unique minimal preorder on any set X is called discrete, the unique maximal preorder is called indiscrete, and discrete or indiscrete preorders are called trivial. By convention, if we wish to refer to a preorder that satisfies x ⩽ y ⇒ y ⩽ x, we will not call it trivial, but symmetric. Of course, a partial order is symmetric iff it is discrete iff it is trivial.

Applicative structures and combinatory algebras were defined in Section 2.2.1. Let (X, ·) be an applicative structure. Recall that a preorder ⩽ on X is called compatible if the application operation is monotone in both arguments with respect to ⩽, i.e.if

∀a, b, a′, b′ ∈ X. a ⩽ a′ and b ⩽ b′ ⇒ a · b ⩽ a′ · b′.

An applicative structure is called unorderable if it does not allow a non-trivial compatible partial order.

Notice that if (X, ·, k, s) is a combinatory algebra, then a preorder ⩽ is compatible if and only if application is monotone in just the second argument. Monotonicity in the first argument then follows by considering f = λ^{∗}x.x · b, because a ⩽ a′ implies a · b = f · a ⩽ f · a′ = a′ · b.

Recall that the open term algebra of the λβ-calculus is the combinatory algebra (Λ_{C}/=_{β}, ·, K, S), where Λ_{C} is the set of untyped lambda terms with constants from C, · is the application operation on terms, and K and S are the terms λxy.x and λxyz.xz(yz), respectively. The closed term algebra (Λ_{C}^{0}/=_{β}, ·, K, S) is defined analogously, and similarly for the λβη-calculus.

3.1.1 Plotkin’s unorderable algebra: Separability

In a recent paper [50], G. Plotkin has constructed a finitely separable lambda, a property which implies unorderability. Following an idea of Flagg and Myhill [43], Plotkin calls a subset A of a lambda algebra X separable if every function φ: A → X is realized by some element φ̂ ∈ X, meaning that for all a ∈ A, φ(a) = φ̂ · a. A lambda algebra is said to be finitely separable if every finite subset is separable. Flagg and Myhill noticed that finitely separable algebras do not allow non-trivial compatible preorders: This is because if a < b are two distinct comparable elements in X, then all pairs x, y of elements are comparable via some φ̂ ∈ X with φ̂ · a = x and φ̂ · b = y.

3.1.2 The standard term algebras are unorderable

We will now show that the standard open and closed term algebras cannot be non-trivially partially ordered. Notice that these are not finitely separable. For instance, consider the terms ω = (λx.xx)(λx.xx) and I = λx.x. The term ω is unsolvable, while I is in normal form. Let T be another term in normal form. By the Genericity Lemma (Barendregt [5], Proposition 14.3.24), whenever Rω = T, then RI = T. Hence, ω and I cannot be separated.

How would one go about constructing a partial order on, say, the open term algebra of the λβ-calculus? As a first approximation, one might take two distinct variables x and y, and let ⊑ be the preorder generated by a single inequality x ⊑ y. For this preorder, one has M ⊑ N iff N is obtained from M up to β-equivalence by replacing some, but not necessarily all occurrences of the variable x by y. In other words, M ⊑ N iff there is a term P (not itself containing x or y) such that M =_{β} P xxy and N =_{β} P xyy. This preorder is non-trivial, because y ⋢ x. But is it a partial order? The following lemma, to be proved in Section 4.4, shows that this is not the case:

Lemma 3.1. There exists a closed term A of the untyped lambda calculus with Axxxy =_{β} Axyyy, but Axxxy ≠_{βη} Axxyy ≠_{βη} Axyyy for variables x ≠ y. □

Notice that in the preorder that we have just defined, Axxxy ⊑ Axxyy ⊑ Axyyy = Axxxy. But since Axxxy ≠ Axxyy, the preorder ⊑ is not antisymmetric, hence not a partial order. By the same reasoning, x and y cannot be related in any compatible partial order on open terms. To show this section’s main result, we need to replace the variables x and y by arbitrary terms u and t. This is achieved by the following lemma, which states that, if s is a fresh variable, then su and st behave essentially like indeterminates: any equation that holds for su and st will hold for variables x and y. Let T be one of the theories \underline{λβ} or \underline{λβη}.

Lemma 3.2. Let u_{1}, …, u_{n} be terms that are distinct with respect to T . If s is a variable not free in u_{1}, …, u_{n}, then su_{1}, su_{2}, …, su_{n} behave like generic arguments. More precisely, for all terms M, N with s ∉ FV(M, N), and for variables x_{1}, …, x_{n},

M(su_{1})(su_{2}) … (su_{n}) =_{T} N(su_{1})(su_{2}) … (su_{n})

implies Mx_{1}x_{2} … x_{n} =_{T} Nx_{1}x_{2} … x_{n}.

Proof. Let {z_{1}, z_{2}, …, z_{m}} be a list of all the free variables of the terms u_{1}, …, u_{n}. Choose fresh, distinct constants c_{1}, …, c_{m} and d_{1}, …, d_{n}. For i = 1 … n, let \overline{u_{i}} be the closed term obtained from u_{i} by replacing free variables with the appropriate constants: \overline{u_{i}} = u_{i}[c_{1}/z_{1}, …, c_{m}/z_{m}]. Further, add to the lambda calculus a new constant σ ∉ C and equations σ\overline{u_{i}} = d_{i}, for i = 1 … n. Let T + σ denote the theory that is obtained in this way on Λ_{C+{σ}}. Then

M(su_{1})(su_{2}) … (su_{n}) =_{T} N(su_{1})(su_{2}) … (su_{n})
⇒ M(σ\overline{u_{1}}) … (σ\overline{u_{n}}) =_{T +σ} N(σ\overline{u_{1}}) … (σ\overline{u_{n}})  (by renaming)
⇒ Md_{1} … d_{n} =_{T +σ} Nd_{1} … d_{n}

The claim now follows from the fact that T + σ is conservative over T . This is a consequence of Plotkin’s separability result [50]: the closed term algebra can be embedded in a separable algebra. Let ι : Λ_{C}^{0}/T → A be such an embedding. Then choose φ̂ ∈ A such that φ̂ · ιu_{i} = ιd_{i}, for i = 1 … n. There is a unique extension ι′ : Λ_{C+σ}^{0}/T → A of ι, sending σ to φ̂. Clearly, the theory induced by ι′ is a conservative extension of T satisfying the additional equations. □

Theorem 3.3. Let M be the open or the closed term algebra of the λβ- or λβη-calculus. Then M does not allow a non-trivial compatible partial order.

Proof. Let ⩽ be a compatible partial order on M. Let u ≠ t ∈ M, and assume, by way of contradiction, that u ⩽ t. Let A be as in Lemma 3.1, and let s be a fresh variable. Then by compatibility,

λs.A(su)(su)(su)(st) ⩽ λs.A(su)(su)(st)(st)
⩽ λs.A(su)(st)(st)(st)
= λs.A(su)(su)(su)(st),

hence, by antisymmetry,

A(su)(su)(su)(st) = A(su)(su)(st)(st)

Applying Lemma 3.2 to M = λxy.Axxxy and N = λxy.Axxyy, one gets Axxxy = Axxyy for variables x and y, contradicting the choice of A. Consequently, the order is trivial. □

3.2 The Topological Completeness Problem

Recall that, for any cartesian-closed category C, a reflexive C-model is a model of the lambda calculus that arises from a diagram

\xymatrix{D^{D} \ar[d]_{p} \ar[dr]^{id} \\ D \ar[r]_{e} & D^{D}}

in the category C (see Section 2.7). These models have been particularly well studied in the category CPO of cpo’s and Scott-continuous functions. Reflexive CPO-models are sometimes referred to as continuously complete, because every Scott-continuous function f : D → D is definable by an element f̂ ∈ D. Honsell and Ronchi Della Rocca [27] also use the term topological model. The following is a long standing open problem ([27]):

Open Problem. (Topological Completeness) Is there a reflexive CPO-model whose theory is \underline{λβ} or \underline{λβη}?

Two related questions have been answered: Honsell and Ronchi Della Rocca [27] have shown that there is a lambda theory C_{Λ_{0}} which is not induced by any reflexive CPO-model. The reflexive CPO-models are thus incomplete for arbitrary lambda theories. On the other hand, Di Gianantonio et al. [16] have shown that \underline{λβη} can arise as the theory of a reflexive CPO_{1}-model. If ω_{0} and ω_{1} denote, respectively, the first infinite ordinal and the first uncountable ordinal, then CPO_{1} is the category whose objects are ω_{0}- and ω_{1}-complete partial orders, and whose morphisms preserve limits of ω_{1}-chains (but not necessarily of ω_{0}-chains). However, the construction given in [16] makes decisive use of non-Scott-continuous functions.

We will now explore some consequences of Theorem 3.3 for topological completeness. First, one notices that in all models whose theory is \underline{λβ} or \underline{λβη}, the denotations of closed lambda terms necessarily form a discrete subset:

Corollary 3.4. In any partially ordered lambda algebra whose theory is \underline{λβ} or \underline{λβη}, the denotations of closed terms are pairwise incomparable.

Proof. The set of closed term denotations is a sub-lambda algebra which is isomorphic to the closed term algebra; hence the partial order is discrete on it by Theorem 3.3. □

Recall that two elements x, y of a partially ordered set D are called compatible if there exists z ∈ D with x ⩽ z and y ⩽ z. We can now show that any complete reflexive CPO_{⊥}-model, if such a model exists, must satisfy one of two peculiar properties:

Theorem 3.5. Suppose D is a reflexive CPO_{⊥}-model whose theory is \underline{λβ} or \underline{λβη}. Then either:

1. The denotations of closed terms are pairwise incompatible, or

2. There exist closed lambda terms M and N such that, for all x, y ∈ D,

(x ⩽ y or y ⩽ x)  ⟺  Mxy = Nxy.

Proof. Suppose 1. does not hold, i.e. there are two distinct closed terms u and t whose denotations have an upper bound v ∈ D. Let A be as in Lemma 3.1, and let M = λxyrs.A(s(rx))(s(rx))(s(rx))(s(ry)) and N = λxys.A(s(rx))(s(rx))(s(ry))(s(ry)).

⇒: Suppose x ⩽ y or y ⩽ x. Then Mxy = Nxy by the same reasoning as in the proof of Theorem 3.3.

⇐: Suppose, by way of contradiction, that Mxy = Nxy for incomparable x, y ∈ D. Define r : D → D by

r(z) = \{ \begin{matrix}⊥ & if z ⩽ x and z ⩽ y \\ u & if z ⩽ x and z ⩽̸ y \\ t & if z ⩽̸ x and z ⩽ y \\ v & if z ⩽̸ x and z ⩽̸ y \end{matrix}

Then r is continuous; suppose it is represented by r̂ ∈ D. Then

D ⊧ λs.A(su)(su)(su)(st) = Mxyr̂ = Nxyr̂ = λs.A(su)(su)(st)(st).

But the proof of Theorem 3.3 shows that the first and the last term are \underline{λβη}-different, contradicting the assumption that D was a complete model. □

3.3 A characterization of absolutely unorderable algebras

In Section 3.1, we have shown that the combinatory algebra of open lambda terms cannot be non-trivially ordered. However, it can be embedded in an orderable algebra; this follows e.g. from the work of Di Gianantonio et al. [16]. Plotkin conjectures in [50] that there exists a combinatory algebra which is absolutely unorderable, i.e.which cannot be embedded in an orderable combinatory algebra. In this section, we characterize, for any algebraic variety T, those T-algebras which are absolutely unorderable.

Let T be an algebraic variety. Recall that a preorder ⩽ on a T-algebra A is compatible if whenever a_{i} ⩽ b_{i} for i = 1 … k, then fa_{1} … a_{k} ⩽ fb_{1} … b_{k}, for each k-ary function symbol f ∈ Ω_{k}. Notice that monotone preorders are closed under arbitrary intersections. If ⩽ is monotone, then so is the dual preorder ⩾. Every monotone preorder determines a congruence ∼_{⩽} on A, which is the intersection of ⩽ and ⩾. Also notice that ⩽ naturally defines a partial order on A/∼_{⩽}.

A T-algebra A is said to be unorderable if it does not allow a non-trivial compatible partial order. Also, A is said to be absolutely unorderable if for any embedding A → B of T-algebras, B is unorderable.

3.3.1 Absolutely unorderable algebras and generalized Mal’cev operators

Consider a T-algebra A. Let ≼ be the smallest compatible preorder on A[u, t] such that u ≼ t.

Lemma 3.6. ≼ is trivial on A, i.e.a ≼ b ⇒ a = b for a, b ∈ A.

Proof. Let ∼ be the kernel of the canonical morphism A[u, t] → A[x] which sends both u and t to x. Then ∼ is a congruence, hence in particular a compatible preorder on A[u, t]. Since also u ∼ t, by definition ≼ is contained in it. But ∼, hence ≼, is trivial on A. □

Lemma 3.7. A is absolutely unorderable if and only if t ≼ u.

Proof. ⇒: Suppose A is absolutely unorderable. Consider the natural map A → A[u, t] → A[u, t]/∼_{≼}. Lemma 3.6 implies that, the composition is an embedding, hence ≼ must be trivial as a partial order on A[u, t]/∼_{≼}. Equivalently, ≼ as a preorder on A[u, t] is symmetric. Since u ≼ t, it follows that t ≼ u.

⇐: Suppose A is not absolutely unorderable. Then there is an embedding F : A → B of T-algebras where B has a non-trivial compatible partial order ⩽. Hence there are U ≠ T ∈ B such that U ⩽ T. Consider the unique map G : A[u, t] → B such that u ↦ U, t ↦ T and G|_{A} = F. Define a ⩽ b in A[u, t] iff G(a) ⩽ G(b) in B. Then ⩽ is a compatible preorder on A[u, t]. But u ⩽ t, hence ≼ is contained in ⩽. But t ⩽̸ u, hence t ⋠ u. □

Further, ≼ has the following explicit description: On A[u, t], define a ⊲ b if and only if there is a polynomial A(x_{1}, x_{2}, x_{3}) ∈ A[x_{1}, x_{2}, x_{3}] such that A(t, u, u) = a and A(t, t, u) = b.

Lemma 3.8. ≼ is the transitive closure of ⊲.

Proof. Notice that ⊲ is reflexive. Let ⊲^{∗} be the transitive closure. Clearly, ⊲, and hence ⊲^{∗}, is contained in ≼. On the other hand, ⊲^{∗} is a preorder on A[u, t] satisfying u ⊲^{∗} t. To see that ⊲^{∗} is compatible, let f be a k-ary function symbol in Σ. First assume a_{i} ⊲ b_{i} for i = 1 … k. Then there are A_{i}(x_{1}, x_{2}, x_{3}) ∈ A[x_{1}, x_{2}, x_{3}], for i = 1 … k, such that A_{i}(t, u, u) = a_{i} and A_{i}(t, t, u) = b_{i} for each i. By considering A(x_{1}, x_{2}, x_{3}) = f(A_{1}(x_{1}, x_{2}, x_{3}) … A_{k}(x_{1}, x_{2}, x_{3})), it follows that fa_{1} … a_{k} ⊲ fb_{1} … b_{k}. Hence ⊲ is compatible, which readily implies compatibility for ⊲^{∗}. Therefore, ≼ is contained in ⊲^{∗}. □

Putting this together with Lemma 3.7, we get the following characterization of absolutely unorderable algebras. Recall that an equation p(u, t) = q(u, t) holds absolutely in A iff it holds in A[u, t].

Theorem 3.9. Characterization of absolutely unorderable T-algebras. Let T be an algebraic variety. A T-algebra A is absolutely unorderable if and only if, for some n ⩾ 1, there exist polynomials M_{i}(x_{1}, x_{2}, x_{3}) ∈ A[x_{1}, x_{2}, x_{3}], for i = 1 … n, such that the following equations hold absolutely in A:

t = M_{1}(t, u, u)
M_{1}(t, t, u) = M_{2}(t, u, u)
M_{2}(t, t, u) = M_{3}(t, u, u)  (3.1)
⋮
M_{n}(t, t, u) = u

Proof. By Lemmas 3.7 and 3.8, A is absolutely unorderable if and only if there are t_{1}, …, t_{n−1} ∈ A[u, t] such that t ⊲ t_{1} ⊲ … ⊲ t_{n} ⊲ u. The corollary follows by definition of ⊲. □

In the case n = 1, the equations (3.1) have the simple form t = M(t, u, u) and M(t, t, u) = u. These equations were first studied by A.I. Mal’cev [37] to characterize varieties of congruence-permutable algebras (so-called Mal’cev varieties). A ternary operator M satisfying these equations is called a Mal’cev operator. Accordingly, we call M_{1}, …, M_{n} satisfying (3.1) a family of (generalized) Mal’cev operators, and we call the equations (3.1) the (generalized) Mal’cev axioms. Hagemann and Mitschke [25] have shown that an algebraic variety has n-permutable congruences if and only if it has operators satisfying the axioms (3.1). It was proved by W. Taylor [63, 11] that algebras in a variety with n-permutable congruences are unorderable; however, the converse, to the best of my knowledge, is a new result. Also note that Theorem 3.9 characterizes individual algebras that are absolutely unorderable, rather than varieties of unorderable algebras.

3.3.2 An application to ordered algebras and dcpo-algebras

Recall from Section 1.3.5 that an algebraic signature Σ and a set of inequations I define a variety O of ordered algebras. The free ordered (Σ, I)-algebra over any poset P was denoted by O_{P}. One may ask under which circumstances the canonical map ȷ : P → O_{P} is order-reflecting. The following theorem shows that the answer depends only on the presence of Mal’cev operators in (Σ, I). Recall that a k-ary operation in Σ is simply a Σ-term t(x_{1}, …, x_{k}).

Theorem 3.10. Let Σ be a signature and I a set of inequations. Let P be a non-trivially ordered poset and let ȷ : P → O_{P} be the canonical map from P into the free ordered (Σ, I)-algebra over P. The following are equivalent:

1. ȷ is not order-reflecting.

2. Every ordered (Σ, I)-algebra is trivially ordered.

3. There are ternary operations M_{1}, …, M_{n} in Σ such that I entails

t ⩽ M_{1}(t, u, u)
M_{1}(t, t, u) ⩽ M_{2}(t, u, u)
M_{2}(t, t, u) ⩽ M_{3}(t, u, u)  (3.2)
⋮
M_{n}(t, t, u) ⩽ u

Proof. 1. ⇒ 2.: Suppose B is a non-trivially ordered (Σ, I)-algebra with elements a < b. We show that ȷ is order-reflecting. Let x, y ∈ P with ȷ(x) ⩽ ȷ(y). Define g : P → B by

g(z) = \{ \begin{matrix}a & if z ⩽ y \\ b & if z ⩽̸ y \end{matrix}

Then g is monotone; therefore, by the universal property of O_{P}, there exists a unique homomorphism of ordered algebras h : O_{P} such that g = h ∘ ȷ. By monotonicity of h, we get g(x) = h(ȷ(x)) ⩽ h(ȷ(y)) = g(y) = a, hence x ⩽ y.

2. ⇒ 3.: Suppose every ordered (Σ, I)-algebra is trivially ordered. Then, in particular, O_{V} is trivially ordered, and hence I ⊢_{ineq} s ⩽ t iff I ⊢_{ineq} t ⩽ s. We can therefore regard I as a set of equations. The claim follows by applying Theorem 3.9 to A = O_{∅}.

3. ⇒ 2.: Suppose (Σ, I) has operators satisfying (3.2). Then for any (Σ, I)-algebra B, if a ⩽ b ∈ B, then b ⩽ M_{1}(b, a, a) ⩽ M_{1}(b, b, a)⩽ … ⩽ M_{n}(b, b, a) ⩽ a, hence B is trivially ordered.

2. ⇒ 1.: A map ȷ : P → O_{P} from a non-trivially ordered set into a trivially ordered one cannot be orderreflecting. □

Remark. Notice that the proof of 3. ⇒ 2. shows that the inequalities (3.2) already imply the corresponding equalities (3.1).

The equivalent of Theorem 3.10 holds for dcpo-algebras as well. This is due to the following lemma, which relates the existence of non-trivial dcpo-algebras to the existence of non-trivial ordered algebras:

Lemma 3.11. Let Σ be a signature and I a set of inequations. There exists a non-trivially ordered (Σ, I)- dcpo-algebra if and only if there exists a non-trivially ordered (Σ, I)-algebra.

Proof. ⇒: Trivial, since every dcpo-algebra is an ordered algebra.

⇐: Let ⟨A, ⩽⟩ be an ordered (Σ, I)-algebra. We consider the ideal completion of A: A subset I ⊆ A is an ideal if it is downward closed and directed. Let J = Idl(A), the ideal completion of A, be the set of all ideals, ordered by inclusion. Abramsky and Jung [3] prove that J is a (Σ, I)-dcpo-algebra. Moreover, the map A → J : x ↦ ↓x is order preserving and reflecting, and hence J is non-trivially ordered if A is.

Corollary 3.12. Let Σ be a signature and I a set of inequations. Let D be a non-trivially ordered dcpo and let ȷ : D → D_{D} be the canonical map from D into the free ordered (Σ, I)-algebra over D. The following are equivalent:

1. ȷ is not order-reflecting.

2. Every (Σ, I)-dcpo-algebra is trivially ordered.

3. There are ternary operations M_{1}, …, M_{n} in Σ such that I entails (3.2).

Proof. The equivalence of 2. and 3. follows from Theorem 3.10 and Lemma 3.11. The implication 2. ⇒ 1. is trivial, and 1. ⇒ 2. follows as in the proof of Theorem 3.10; notice that the function g defined there is continuous. □

3.4 Absolutely unorderable combinatory algebras

If A is a combinatory algebra, then the statement of Theorem 3.9 takes a particularly simple form, due to combinatory completeness: A combinatory algebra A is absolutely unorderable if and only if there are a number n ⩾ 1 and elements M_{1}, …, M_{n} ∈ A such that the following hold absolutely in A:

t = M_{1}tuu
M_{1}ttu = M_{2}tuu
M_{2}ttu = M_{3}tuu  (3.3)

⋮

M_{n}ttu = u

Note that if A is a lambda algebra, one can replace these equations by the closed equations λ^{∗}tu.t = M_{1}tuu etc.

But does an absolutely unorderable combinatory algebra exist? Unfortunately, this is not known. Clearly, an absolutely unorderable combinatory algebra exists if and only if the equations (3.3) are consistent with the axioms of combinatory algebras for some n. The answer is only known in the cases n = 1 and n = 2. In these cases, (3.3) is inconsistent with combinatory logic, as we will now show. Notice that if the axioms are consistent for some n, then also for all m ⩾ n, by letting M_{n+1}, …, M_{m} = λxyz.z

Let Y be any fixpoint operator of combinatory logic, for instance the paradoxical fixpoint combinator Y = λf.(λx.f(xx))(λx.f(xx)). Write μx.M for Y (λx.M). The operator μ satisfies the fixpoint property:

μx.A(x) = A(μx.A(x)). (fix)

The diagonal axiom is

μy.μx.A(x, y) = μx.A(x, x). (Δ)

The following lemma is due to G. Plotkin and A. Simpson:

Lemma 3.13 (Plotkin, Simpson). Assuming the diagonal axiom, the Mal’cev axioms (3.3) are inconsistent with combinatory logic for all n.

Proof. Let x be arbitrary. Let A = μz.M_{1}xzz. Then A = μz.x = x. Also,

x = A = μz.M_{1}xzz
= μy.μz.M_{1}xyz by (Δ)
= μz.M_{1}xxz  by (fix)
= μz.M_{2}xzz  by (3.3)
= …
= μz.M_{n−1}xxz
= μz.z  by (3.3)

Hence x = μz.z for all x, which is an inconsistency. □

Theorem 3.14 (Plotkin, Simpson). For n = 1, the Mal’cev axioms are inconsistent with combinatory logic.

Proof. Suppose M is a Mal’cev operator. Let x be arbitrary and let A = μy.μz.Mxyz. Then

A =^{(fix)} μz.MxAz =^{(fix)} MxAA =^{(Malcev_{1})} x,

hence x = μz.MxAz = μz.Mxxz = μz.z. □

Theorem 3.15 (Plotkin, Selinger). For n = 2, the Mal’cev axioms are inconsistent with combinatory logic.

Proof. Suppose M_{1} and M_{2} are operators satisfying the Mal’cev axioms (3.3). Define A and B by mutual recursion such that

\begin{aligned}A & = & μx.f(M_{1}xAB)(M_{1}xAB) \\ B & = & μy.μz.f(M_{2}ABy)(M_{2}ABz). \end{aligned}

Then

B = f(M_{2}ABB)(M_{2}ABB) by (fix)
= f(M_{1}AAB)(M_{1}AAB) by (3.3)
= A.  by (fix)

So μx.fxx = μx.f(M_{1}xAA)(M_{1}xAA) = A = B = μy.μz.f(M_{2}AAy)(M_{2}AAz) = μy.μz.fyz, which is the diagonal axiom. By Lemma 3.13, this leads to an inconsistency. □

3.5 Relating different notions of unorderability

3.5.1 Local notions

We defined a combinatory algebra to be unorderable if it does not allow a non-trivial compatible partial order. There are other notions of unorderability that are worth investigating. For instance, one can ask for the existence of non-symmetric preorders instead of partial orders. Or one can ask for the (pre)order to be compatible with abstraction as well as with application: ⩽ is called a lambda-(pre)order if it is compatible and

\frac{∀x ∈ A.ax ⩽ bx}{1a ⩽ 1b} .

We thus arrive at the following four unorderability notions for a combinatory algebra A:

1. unorderable if every compatible partial order on A is trivial.

2. un-preorderable if every compatible preorder on A is symmetric.

3. un-λ-orderable if every lambda-order on A is trivial.

4. un-λ-preorderable if every lambda-preorder on A is symmetric.

Between these notions, only the obvious implications hold:

\xymatrix{ & unorderable \ar@{=>}[dr] \\ un-preorderable \ar@{=>}[ur] \ar@{=>}[dr] &  & un-λ-orderable \\  & un-λ-preorderable \ar@{=>}[ur]}

To see that no other implications hold, first observe that the open term algebra is unorderable, but λ-pre-orderable: let M ⩽ N iff for all valuations ρ, [[M]]_{ρ} ⩽ [[N]]_{ρ} in the standard D_{∞}-model. It follows from [29, 64] that this preorder is non-trivial; it is a lambda-preorder because the order on the standard D_{∞}-model is pointwise.

The counterexample in the other direction is due to G. Plotkin, and it is given in the following theorem:

Theorem 3.16. (G. Plotkin) There is an extensional, partially ordered lambda algebra A that does not allow a non-trivial lambda-preorder.

Proof. The idea of the construction is to work in a category where the order relation on function spaces is not pointwise. We use the category of meet cpo’s and stable functions CPO^{∧}, which was defined in Section 1.2.4. Recall that the objects of this category are cpo’s with bounded binary meets which act continuously, and that the morphisms are stable functions, i.e. continuous functions preserving the bounded meets. As we outlined in Section 1.2.5, the usual Scott D_{∞}-construction of models of the lambda-βη-calculus goes through in this category.

Let D_{0} be the cpo with two elements ⊥ ⩽ ⊤. Define D_{n+1} to be the stable function space D_{n}^{D_{n}}. Then D_{1} has three elements B, I, T, where B is the constantly ⊥ function, T is the constantly ⊤ function, and I is the identity. Notice that the stable order on D_{1} is as shown:

[figure: ⊤; T; I; ⊥; B; D_{0}; D_{1}]

Define e_{01} : D_{0} → D_{1} to send ⊤ to T and ⊥ to B, and define p_{10} : D_{1} → D_{0} to send f to f(⊥). The pair ⟨e_{01}, p_{10}⟩ is is an embedding-projection pair in the category CPO^{∧}, in particular, e_{01} ∘ p_{10} is stably less than the identity. From this, one constructs the other embedding projection pairs and takes the inverse limit D as usual. Then D ≅ D^{D}, and as a lambda algebra, D is extensional by Proposition 2.27. Clearly the order ⩽ on D is non-trivial and compatible.

For convenience, we identify all relevant function spaces with the corresponding subspaces of D. Let p_{n} : D → D_{n} be the projection of D onto D_{n}, and e_{n} the corresponding embedding.

Now suppose that ⊑ is a lambda-preorder. We will show it is trivial, i.e.it is either discrete or indiscrete. First notice that, since we are in an extensional model, 1 = I and hence

\frac{∀x ∈ D.ax ⊑ bx}{a ⊑ b} .  (3.4)

Chasing the definition of the D_{∞}-model, one calculates that for f ∈ D_{n+1} = D_{n}^{D_{n}} and x ∈ D, the application f · x is given by e_{n} ∘ f ∘ p_{n}(x). From this and (3.4), it follows that f ⊑ g ∈ D_{n+1} iff f · x ⊑ g · x for all x ∈ D_{n}. One distinguishes three cases:

Case 1: I ⊑ T. For any pair of elements x, y ∈ D, define f : D_{1} → D by f(I) = x and f(T) = y and f(B) = ⊥. This is stable and therefore realized by some f̂ ∈ D. We get that x ⊑ y and hence ⊑ is indiscrete. Case 2: T ⊑ I. Similar. Case 3: Neither I ⊑ T nor T ⊑ I. Suppose, by way of contradiction, that there are distinct elements x, y ∈ D such that x ⊑ y. Then for some n the projections x_{n} = p_{n}(x) and y_{n} = p_{n}(y) are distinct. Since the projection p_{n} itself is realized by some p̂_{n} ∈ D, one gets x_{n} ⊑ y_{n}. But then, since x_{n} ≠ y_{n}, there are z_{n−1}, …, z_{0} in D_{n−1}, …, D_{0} such that a = x_{n}z_{n−1} … z_{0} and a′ = y_{n}z_{n−1} … z_{0} are distinct elements of D_{0}. One then knows that a ⊑ a′, and hence it must be the case that either ⊥ ⊑ ⊤ or ⊤ ⊑ ⊥. In the first case, one has

⊤ = I · ⊤ ⊑ T · ⊤ = ⊤
⊥ = I · ⊥ ⊑ T · ⊥ = ⊤,

hence, since ⊑ is a lambda-preorder, I ⊑ T. Similarly, in the second case, one has T ⊑ I, the required contradiction. □

3.5.2 Absolute notions

There is a multitude of notions of absolute unorderability that one can consider. Fortunately, we will see that all of them coincide. Recall that we defined a combinatory algebra A to be absolutely unorderable if for every embedding A ↪ B, the algebra B is unorderable. First, one can adapt this with respect to preorders, lambda-orders etc. Second, one can replace the word “embedding” by “homomorphism”. Third, one can restrict attention to certain subcategories, e.g.lambda algebras or lambda models.

Instead of cataloging some 30 different notions and showing them all to be equivalent, we start with some simple observations. If P is some property of objects in a category, we say that an object A absolutely satisfies P if for all A → B, B satisfies P.

First notice that, since lambda algebras are defined by closed equations, their full subcategory is rightclosed in the category of combinatory algebras: i.e., if A → B is a homomorphism of combinatory algebras, and A is a lambda algebra, then so is B. Hence, a lambda algebra A satisfies some property absolutely as a lambda algebra iff it does so as a combinatory algebra. The corresponding property is true for Curry algebras.

Next, there are some obvious implications: if A absolutely satisfies P with respect to homomorphisms, then also with respect to embeddings. We also have the implications that were discussed in Section 3.5.1.

It therefore suffices to show, for each of the categories of combinatory algebras, lambda algebras, and Curry algebras, that the weakest notion that we are considering implies the strongest one. This is done in the following proposition.

Proposition 3.17. For a combinatory algebra A, the following are equivalent:

1. There is A → B for some non-symmetrically preordered combinatory algebra B.

2. There is A ↪ B for some non-trivially partially ordered combinatory algebra B.

For a lambda algebra A, the following are equivalent:

3. There is A → B for some non-symmetrically preordered lambda algebra B.

4. There is A ↪ B for some non-trivially lambda-ordered lambda model B.

For a Curry algebra A, the following are equivalent:

5. There is A → B for some non-symmetrically preordered Curry algebra B.

6. There is A ↪ B for some non-trivially lambda-ordered extensional algebra B.

Proof. 1. ⇒ 2.: Suppose A → B and B is non-symmetrically preordered. Let B′ = B/(⩽ ∩ ⩾), then B′ is non-trivially partially ordered and A → B′. Now let B′′ = B′ × A, which is non-trivially ordered by the componentwise order where A is discrete. We have A ↪ B′′.

3. ⇒ 4.: Suppose A → B and B is non-symmetrically preordered. First, construct A ↪ B′′ as in 2.; then consider A ↪ B′′ ↪ B′′[X] for a countable set X. We know that B′′[X] is a lambda model by Proposition 2.23. It has a non-trivial lambda order by Lemma 3.18 below.

5. ⇒ 6.: Same as 3.⇒4. □

Lemma 3.18. Suppose ⩽ is a non-trivial partial order on a lambda algebra B. Then ⩽ extends naturally to a lambda-order on B[X], for countable X.

Proof. First, consider the case of adjoining a single indeterminate A ⊆ A[x]. Let ⩽ be a partial order on A, and define on A[x] the partial order a ⩽ b iff λ^{∗}x.a ⩽ λ^{∗}x.b. Notice that if a and b were in A, then λ^{∗}x.a = Ka and λ^{∗}x.b = Kb, hence a ⩽ b in A[x] iff Ka ⩽ Kb in A iff a ⩽ b in A, i.e. the order on A[x] is an extension of the order on A. Now consider B[X], which can be regarded as a union of an ascending chain of subsets B ⊆ B[x_{1}] ⊆ B[x_{1}, x_{2}] ⊆ · · ·. Starting with a partial order on B, one can extend it step by step to all of B[X]. In the limit, we obtain a lambda-order, because if ax ⩽ bx for all x, then a, b ∈ A = B[x_{1}, …, x_{n−1}] for some n and one can take x = x_{n}. But ax_{n} = bx_{n} in A[x_{n}] iff λ^{∗}x_{n}.ax_{n} = λ^{∗}x_{n}.bx_{n} in A, i.e.1a = 1b. □

Finally, notice that none of the local notions of unorderability that we have considered implies absolute unorderability: Plotkin’s finitely separable algebra [50], although it cannot be non-trivially preordered, can still be embedded in an orderable algebra (for example by Theorem 3.9).

46

Finite Lambda Models

It has long been known that a model of the untyped lambda calculus, in the traditional sense, can never be finite or even recursive [5]. For instance, no consistent lambda theory equates any two of the countably many Church numerals ¯0 = λxy.y, ¯1 = λxy.xy, ¯2 = λxy.x(xy), etc.; hence, these terms must have distinct denotations in any non-trivial model. Consequently, model constructions of the lambda calculus typically involve passing to an infinite limit, yielding unwieldy models in which term denotations or equality of terms are not effectively computable.

By contrast, we introduce a notion of finite models for the lambda calculus. These finite models are models of reduction, rather than of conversion. Therefore, as we shall see, they are not subject to the usual limitations on size and complexity. Informally, by a model of conversion, we mean a model with a soundness property of the form

M ≅ N ⇒ [[M]] = [[N]],

where ≅ is e.g.β- or βη-convertibility, and [[ ]] is the function that carries a lambda term to its interpretation in the model. On the other hand, a model of reduction has an underlying partial order and a soundness property of the form

M ⟶ N ⇒ [[M]] ⩽ [[N]],

where ⟶ is e.g. β- or βη-reduction. Models of reduction have been considered by different authors [23, 30, 49]. We will focus here on a formulation which was given by Plotkin [49] in the spirit of the familiar syntactical lambda models [5]. The key observation here is that models of reduction, unlike models of conversion, may be finite, and that they can be easily constructed. In special cases, models of reduction allow a limited form of reasoning about convertibility of terms. This is the case for instance if the underlying partial order is a tree.

We begin by reviewing syntactical and categorical models of reduction in Section 4.1. In Section 4.2, we introduce a reasoning principle for models whose underlying order is a tree. We also give a method for efficiently constructing such models. In Section 4.3, this is further specialized to the case where the underlying order is flat. Examples are given in Section 4.4. Some reflections on completeness properties follow in Section 4.5. In Section 4.6, we investigate the connection between models of reduction and the D_{∞}-construction.

4.1 Models of reduction

4.1.1 Syntactical models of reduction

Definition. (Plotkin [49]) An ordered applicative structure ⟨P, ·⟩ is a poset P, together with a monotone binary operation ·: P × P → P. Let P^{V} be the set of all valuations, i.e. functions from variables to P. A syntactical model of β-reduction ⟨P, ·, [[ ]]⟩ is an ordered applicative structure together with an interpretation function

[[ · ]]_{·}: Λ × P^{V} → P

with the following properties:

1. [[x]]_{ρ} = ρ(x)

2. [[MN]]_{ρ} = [[M]]_{ρ} · [[N]]_{ρ}

3. [[λx.M]]_{ρ} · a ⩽ [[M]]_{ρ(x:=a)}, for all a ∈ P

4. ρ|_{FV(M)} = ρ′|_{FV(M)} ⇒ [[M]]_{ρ} = [[M]]_{ρ′}

5. (∀a.[[M]]_{ρ(x:=a)} ⩽ [[N]]_{ρ(x:=a)}) ⇒ [[λx.M]]_{ρ} ⩽ [[λx.N]]_{ρ}

Moreover, we say ⟨P, ·, [[ ]]⟩ is a syntactical model of βη-reduction, if it also satisfies the property

6. [[λx.Mx]]_{ρ} ⩽ [[M]]_{ρ}, if x ∉ FV(M).

A syntactical model of conversion is a syntactical model of β-reduction ⟨X, ·, [[ ]]⟩, where X is discretely ordered, i.e., a set. Notice that this notion coincides with the familiar syntactical lambda models as defined e.g.in [5].

Remark. Properties 1.–3. do not form an inductive definition; rather they state properties of a function [[ ]] which is given a priori. In particular, 3. does not uniquely determine the interpretation of a lambda abstraction [[λx.M]]_{ρ}. We have seen in Chapter 3 that many models of conversion are equipped with a partial order. This, however, is entirely different from the partial order we consider on a model of reduction. Models of conversion have an approximation order, where a ⩽ b is often understood to mean that a is “less defined” or “diverges more often” than b. On the other hand, models of reduction have a reduction order, where a ⩽ b means a reduces to b. More precisely, one has the following soundness theorem:

Proposition 4.1 (Plotkin [49]). The following are properties of syntactical models of β-reduction:

1. Monotonicity. If ρ(x) ⩽ ρ′(x) for all x, then [[M]]_{ρ} ⩽ [[M]]_{ρ′}.

2. Substitution. [[M[N/x]]]_{ρ} = [[M]]_{ρ(x:=[[N]]_{ρ})}.

3. Soundness for reduction. If M ^{β} ⟶N, then [[M]]_{ρ} ⩽ [[N]]_{ρ}. In a syntactical model of βη-reduction: If M ^{βη} ⟶N, then [[M]]_{ρ} ⩽ [[N]]_{ρ}. □

Syntactical models of β-reduction are easily constructed. One may, for example, start with any pointed poset P and monotone function ·: P × P → P, and define, somewhat uningeniously, [[λx.M]]_{ρ} = ⊥. Among the possible interpretation functions on a given ordered applicative structure, this choice is the minimal one. Much more interesting is the situation in which there exists a maximal such choice. We will explore such a situation in Section 4.2.2.

4.1.2 Categorical models of reduction

Let D be a cartesian-closed category of posets and monotone functions, with the pointwise order on hom-sets.

Definition. A categorical model of β-reduction ⟨P, e, p⟩ is given by an object P ∈ D, together with a pair of morphisms e: P → P^{P} and p: P^{P} → P, such that

\xymatrix{P^{P} \ar[d]_{p} \ar[dr]^{id}_{⩽} \\ P \ar[r]_{e} & P^{P} .}

If moreover p ∘ e ⩽ id_{P}, then ⟨P, e, p⟩ is a categorical model of βη-reduction.

Categorical models of reduction have been studied by various authors, e.g. by Girard [23] for the case of qualitative domains, or by Jacobs et al. [30], where they are called models of expansion. For a detailed discussion of these and other references, see Plotkin [49].

From a categorical model of reduction ⟨P, e, p⟩, one can construct a syntactical model of reduction ⟨P, ·, [[ ]]⟩ by letting a · b = e(a)(b) and by defining [[ ]] inductively:

\begin{aligned}[[x]]_{ρ} & = & ρ(x), \\ [[MN]]_{ρ} & = & e([[M]]_{ρ})([[N]]_{ρ}), \\ [[λx.M]]_{ρ} & = & p(λa.[[M]]_{ρ(x:=a)}). \end{aligned}

Proposition 4.2. If ⟨P, e, p⟩ is a categorical model of β-reduction, then the above construction yields a well-defined syntactical model of β-reduction ⟨P, ·, [[ ]]⟩. Moreover, ⟨P, e, p⟩ is a categorical model of βηreduction, then ⟨P, ·, [[ ]]⟩ is a syntactical model of βη-reduction.

Proof. To see that the inductive definition is well-defined, and in particular that the function λa.[[M]]_{ρ(x:=a)} indeed defines an element in P^{P}, it is best to work directly in the category D and to define an interpretation [[M]]_{x_{1},... ,x_{n}} of each lambda term M with FV(M) ⊆ {x_{1}, …, x_{n}} as a morphism P^{n} → P, just as we did for categorical models of conversion:

[[x_{i}]]_{x_{1},... ,x_{n}} = P^{n} ⟶^{π_{i}} P  (the ith projection)
[[MN]]_{x_{1},... ,x_{n}} = P^{n} ⟶^{⟨[[M]]_{x_{1},... ,xn} ,[[N]]_{x_{1},... ,xn} ⟩} P × P ⟶^{p_{⋆}} P
[[λx_{n+1}.M]]_{x_{1},... ,x_{n}} = P^{n} ⟶^{([[M]]_{x_{1},... ,x_{n+1}} )^{⋆}} P^{P} ⟶^{e} P.

It is easily seen that the two definitions coincide in the sense that

[[M]]_{ρ} = 1 ⟶^{⟨ρ(x_{1}),... ,ρ(x_{n})⟩} P^{n} ⟶^{[[M]]_{x_{1},... ,xn}} P.

The verification that this is a syntactical model of β-, respectively, βη-reduction is now routine. □

4.1.3 Models of βη-reduction: Order-extensionality

We have seen in Chapter 2 that an extensional model of β-conversion is always a model of βη-conversion. The property that corresponds to extensionality for models of reduction is order-extensionality: An ordered applicative structure ⟨P, ·⟩ is called order-extensional if

\frac{∀x ∈ P. ax ⩽ bx}{a ⩽ b} .

Lemma 4.3. If a syntactical model of β-reduction ⟨P, ·, [[ ]]⟩ is order-extensional, then it is a model of βηreduction.

Proof. Suppose x ∈ FV(M). Then for all a ∈ P, [[λx.Mx]]_{ρ}·a ⩽ [[Mx]]_{ρ(x:=a)} = [[M]]_{ρ(x:=a)}·[[x]]_{ρ(x:=a)} = [[M]]_{ρ} · a, hence [[λx.Mx]]_{ρ} ⩽ [[M]]_{ρ}. □

4.2 Tree models

4.2.1 Recapturing convertibility

The soundness property for models of reduction does not in general yield useful information about convertibility, since interconvertible terms M ≅ N may have different denotations. However, if the reduction under consideration is Church-Rosser, then M ≅ N implies that there is a term Q with M ⟶ Q and N ⟶ Q.

Therefore, the denotations [[M]]_{ρ} and [[N]]_{ρ} must be compatible. Recall that a and b are compatible, in symbols a ⌣ ⌢ b, if there exists c with a ⩽ c and b ⩽ c. In a model of reduction, one has the following restricted form of soundness for convertibility:

M ≅ N ⇒ [[M]]_{ρ} ⌣ ⌢ [[N]]_{ρ}.  (4.1)

The latter property is especially useful if the underlying poset P has many pairs of incompatible elements. Therefore, we will pay special attention to the cases where P is a tree or a flat partial order.

Definition. A pointed poset P is called a tree if for all a, b ∈ P, a ⌣ ⌢ b implies a ⩽ b or a ⩾ b. Equivalently, for each x ∈ P, the downdeal ↓x is linearly ordered. A tree P is said to be bounded if there is a number n ∈ ℕ such that each ↓x has at most n elements. The smallest such n is called the height of P.

A model of reduction is called a tree model if the underlying poset is a tree.

4.2.2 A method for constructing models

In general, there may be many different ways of defining an interpretation function [[ ]] that makes a given ordered applicative structure ⟨P, ·⟩ into a syntactical model of reduction. Even if one restricts attention to those cases where [[ ]] is defined inductively from a categorical model ⟨P, e, p⟩, with e(a)(b) = a · b, there is a choice involved in determining the morphism p : P^{P} → P. In general, the greater p is chosen with respect to the pointwise order, the greater the resulting interpretation [[ ]] will be, and the better one will be able to make use of the soundness property for convertibility 4.1.

The best possible situation arises if we can find a right adjoint p of e, because if p is such a right adjoint, then it is maximal with the property e∘p ⩽ id. It is well-known that if P is a complete lattice, then e : P → Q has a right adjoint if and only if e preserves suprema. In this case, one can define p(y) = ⋁{x ∈ P | e(x) ⩽ y}. But following the remarks in Section 4.2.1, we are interested in posets P that have incompatible pairs of elements, and which can therefore not be complete lattices. In the case of bounded trees, the existence of a right adjoint is characterized by a property which we call strong extensionality:

Definition. Let P be a bounded tree. We say that an ordered applicative structure ⟨P, ·⟩ is strongly extensional if for all a, b ∈ P,

\frac{∀x ∈ P. ax ⌣ ⌢ bx}{a ⌣ ⌢ b} .

Proposition 4.4. Let ⟨P, ·⟩ be an ordered applicative structure, where P is a bounded tree. Let e : P → P^{P} be the map defined by e(a)(b) = a · b. Then e has a right adjoint in the category of posets if and only if ⟨P, ·⟩ is strongly extensional.

Proof. ⇒: Suppose e has a right adjoint p : P^{P} → P. Let a, b ∈ P such that ax ⌣ ⌢ bx for all x. Since P is a tree, one has ax ⩽ bx or ax ⩾ bx for every x. Define a monotone map f : P → P by f(x) = max(ax, bx). Since e(a)(x) = ax ⩽ f(x) for all x, one has e(a) ⩽ f and hence a ⩽ p(f), and similarly for b. Hence a ⌣ ⌢ b, and ⟨P, ·⟩ is strongly extensional.

⇐: Suppose ⟨P, ·⟩ is strongly extensional. For any f ∈ P^{P}, consider the subset P_{f} = {x ∈ P | e(x) ⩽ f} ⊆ P. Notice that for any a, b ∈ P_{f}, e(a) ⌣ ⌢ e(b), hence ax ⌣ ⌢ bx for all x, hence a ⌣ ⌢ b by strong extensionality. Since P is a tree, either a ⩽ b or a ⩾ b. Therefore P_{f} is linearly ordered. Since P is bounded, the set P_{f} is finite, and hence it has a maximal element p(f). Clearly, the function p thus defined is monotone, and x ⩽ p(f) iff x ∈ P_{f} iff e(x) ⩽ f. Therefore e ⊣ p. □

Corollary 4.5. The last proposition yields a practical method for constructing a tree model of reduction: Begin with a tree P and a monotone binary operation ·: P × P → P, such that ⟨P, ·⟩ is strongly extensional. Define [[ ]] inductively as follows:

1. [[x]]_{ρ} = ρ(x)

2. [[MN]]_{ρ} = [[M]]_{ρ} · [[N]]_{ρ}

3. [[λx.M]]_{ρ} is the maximal b ∈ P such that b · a ⩽ [[M]]_{ρ(x:=a)} for all a ∈ P. Then ⟨P, ·, [[ ]]⟩ is a well-defined model of β-reduction. Proof. Proposition 4.4, together with Proposition 4.2, ensures that this is well-defined, in particular, that a maximal b exists in 3. □ The following lemma is sometimes useful for reasoning about such a model: Lemma 4.6. If [[ ]] is defined as in Corollary 4.5, then for all n ⩾ 1, the denotation of an n-fold lambda abstraction [[λx_{1} … x_{n}.M]]_{ρ} is the maximal b ∈ P such that for all a_{1} … a_{n} ∈ X,

b · a_{1} ⋯ a_{n} ⩽ [[M]]_{ρ(x_{1}:=a_{1})...(x_{n}:=a_{n})}.

Proof. By induction on n. □

If ⟨P, ·⟩ is order-extensional, then the construction in Corollary 4.5 yields a model of βη-reduction by Lemma 4.3. We end this section with a lemma that relates order-extensionality to strong extensionality for tree models: Lemma 4.7. If P is a tree, and if ⟨P, ·⟩ is strongly extensional and extensional, then it is also orderextensional. Proof. Suppose for all x, ax ⩽ bx, hence ax ⌣ ⌢ bx, hence a ⌣ ⌢ b by strong extensionality. Since P is a tree, either a ⩽ b or a ⩾ b. In the first case, we are done; in the second case, ax ⩾ bx, and hence ax = bx, for all x, which implies a = b by extensionality. □

4.3 Partial models

As the examples in Section 4.4 will show, it often suffices to consider tree models whose underlying poset P is flat, i.e.P = X_{⊥} for a discrete set X. If one also assumes that the application operation ·: P × P → P is strict in each argument, then one can think of ⊥ as the undefined element, and of · and [[ ]] as partial functions. Since it is sometimes convenient to think in terms of these partial operations, we restate the definition of a model of reduction in this special case. The venturi-tube [figure] denotes directed equality: A [figure] B means that if A is defined, then so is B, and they are equal. Definition. A partial applicative structure ⟨X, ·⟩ is a set X with a partial binary operation ·: X × X ⇀ X. Let Val(X) be the set of partial valuations V ⇀ X. A partial syntactical lambda model ⟨X, ·, [[ ]]⟩, or partial model for short, is given by a partial applicative structure together with a partial map

[[ · ]]_{·}: Λ_{X} × Val(X) ⇀ X,

such that 1. [[x]]_{ρ} = ρ(x)

2. [[MN]]_{ρ} = [[M]]_{ρ} · [[N]]_{ρ}

3. [[λx.M]]_{ρ} · a [figure] [[M]]_{ρ(x:=a)}, for all a ∈ X

4. ρ|_{FV(M)} = ρ′|_{FV(M)} ⇒ [[M]]_{ρ} = [[M]]_{ρ′}

5. (∀a.[[M]]_{ρ(x:=a)} [figure] [[N]]_{ρ(x:=a)}) ⇒ [[λx.M]]_{ρ} [figure] [[λx.N]]_{ρ} Moreover, if

6. [[λx.Mx]]_{ρ} [figure] [[M]]_{ρ}, if x ∉ FV(M).

then ⟨X, ·, [[ ]]⟩ is a partial βη-model.

Here, equality is understood to be Kleene equality, meaning A = B if and only if A and B are either both undefined or both defined and equal. Notice that the directed equality [figure] on X is just the partial order on the flat poset X_{⊥}. Thus, the axioms 1–5 and 6 correspond exactly to the axioms for a syntactical model of β-, respectively, βη-reduction.

In a partial model, the denotation of some terms may be undefined. The idea of using partiality in models for the lambda calculus is not new. In fact, Kleene’s “first model”, which consists of Gödel numbers of partial recursive functions and their application, is partial. The models we consider here are even “more” partial; we do not even assume that the interpretations of basic combinators such as S and K are defined. The following soundness properties ensure that the class of terms whose denotation is defined is closed under reduction, and that interconvertible terms have the same denotation if they are both defined.

Proposition 4.8. The following are properties of partial models:

1. Soundness for reduction. If M ^{β} ⟶N, then [[M]]_{ρ} [figure] [[N]]_{ρ}.

2. Soundness for convertibility. If M =_{β} N, and if [[M]]_{ρ} and [[N]]_{ρ} are both defined, then [[M]]_{ρ} = [[N]]_{ρ}.

3. In a partial βη-model, the respective properties hold for ^{βη} ⟶ and =_{βη}.

Proof. Soundness for reduction follows from Proposition 4.1. Soundness for convertibility follows from the Church-Rosser property. □

Partial applicative structures are particularly easy to manipulate in practice, since they are just given by a set X and a “multiplication table” such as the one in Table 4.1. It is easy to read properties such as strong extensionality off the table: A partial applicative structure is strongly extensional if no two rows of the multiplication table are compatible, and it is order-extensional if no row is subsumed by another. In particular, if the table is everywhere defined, i.e.if ⟨X, ·⟩ is a total applicative structure, then both strong extensionality and order-extensionality coincide with (ordinary) extensionality.

4.4 Examples

4.4.1 A class of finite models to distinguish the terms Ω_{n}

Let x be a variable and define x^{1} = x and x^{n+1} = x^{n}x for n ⩾ 1. Let ω_{n} = λx.x^{n} and Ω_{n} = ω_{n}ω_{n}. None of these terms has a normal form, e.g. Ω_{2} = (λx.xx)(λx.xx) reduces only to itself. The terms Ω_{n} are unsolvable; therefore, their interpretations coincide with ⊥ in the D_{∞}-model [29, 64]. We will now give a class of finite partial models that distinguishes these terms.

Fix an integer p ⩾ 1 and let X = ℤ_{p} = {1, 2, …, p}. Addition and subtraction in X are modulo p; let =_{p} denote equality modulo p. Define ·: X → X by

n · m =_{p} \{ \begin{matrix}n + 1 & if m =_{p} 1 \\ m + 1 & if m ≠_{p} 1. \end{matrix}

A “multiplication table” for this operation is shown in Table 4.1. Clearly, ⟨X, ·⟩ is a strongly extensional applicative structure. Define [[ ]] as in Corollary 4.5 to get a partial model. For n ⩾ 2, we calculate 1^{n} =_{p} n and m^{n} =_{p} m + 1 for m ≠ 1. Hence, for all x ∈ X and n ⩾ 2,

x^{n} =_{p} (n − 1) · x
⇒  [[ω_{n}]] = [[λx.x^{n}]] =_{p} n − 1
⇒  [[Ω_{n}]] = [[ω_{n}ω_{n}]] =_{p} (n − 1) · (n − 1) =_{p} n.

Hence, [[Ω_{n}]] is always defined for n ⩾ 2, and we have [[Ω_{n}]] = [[Ω_{m}]] iff n =_{p} m.

Table 4.1: Multiplication table for a partial model

\begin{matrix}· & 1 & 2 & 3 & ⋯ & p − 1 & p \\ 1 & 2 & 3 & 4 & ⋯ & p & 1 \\ 2 & 3 & 3 & 4 & ⋯ & p & 1 \\ 3 & 4 & 3 & 4 & ⋯ & p & 1 \\ ⋮ & ⋮ & ⋮ & ⋮ & ... & ⋮ & ⋮ \\ p − 1 & p & 3 & 4 & ⋯ & p & 1 \\ p & 1 & 3 & 4 & ⋯ & p & 1 \end{matrix}

4.4.2 A non-trivial 3-element model

In this section, we provide the proof of Lemma 3.1 from Chapter 3. At the heart of the proof is a 3-element partial model which distinguishes two appropriately chosen unsolvable terms Auuut and Auutt.

Lemma. There is a closed term A of the untyped lambda calculus with Auuut =_{β} Auttt, but Auuut ≠_{βη} Auutt ≠_{βη} Auttt for variables u ≠ t.

Proof. Define terms

h = λzyx.zzy(zzy(zzyx))
f = hh
A = λuvwt.λx.fu(fv(fw(ftx))).

Then for all x, y:

fyx ⟶^{β} fy(fy(fyx)),

hence for all u, t:

λx.fu(ftx) ⟶^{β} λx.fu(fu(fu(ftx))) = Auuut
λx.fu(ftx) ⟶^{β} λx.fu(ft(ft(ftx))) = Auttt.

To see that Auuut ≠_{βη} Auutt for variables u and t, we will construct a partial model. Let X = {k, 0, 1}, and let · be defined by the following “multiplication table”:

\begin{matrix}· & k & 0 & 1 \\ k & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \end{matrix}

Then ⟨X, ·⟩ is a strongly extensional applicative structure. Define [[ ]] inductively as in Corollary 4.5. Although ⟨X, ·⟩ is total, [[ ]] will be partial.

Consider the function ψ(c, b, a) := [[zzy(zzy(zzyx))]]_{ρ(z:=c)(y:=b)(x:=a)} = ccb(ccb(ccba)). Table 4.2 shows the values of this function, and one observes that ψ(c, b, a) = k · c · b · a for all c, b, a ∈ X. Hence by Corollary 4.5, [[h]] = [[λzyx.zzy(zzy(zzyx))]] is defined and equal to k, and consequently [[f]] = [[hh]] = kk = 0. If ρ(u) = ρ(x) = 0 and ρ(t) = 1, then

[[fu(fu(fu(ftx)))]]_{ρ} = 1
[[fu(fu(ft(ftx)))]]_{ρ} = 0.

By soundness, fu(fu(fu(ftx))) ≠_{βη} fu(fu(ft(ftx))) ⇒ Auuut ≠_{βη} Auutt. □

Table 4.2: Values for ψ(c, b, a) and k · c · b · a

c  b a ψ(c, b, a) k · c · b · a
k or 0 or 1 k k  0  0
k 0  0  0
k 1  1  1
0 k  0  0
0 0  0  0
0 1  1  1
1 k  0  0
1 0  1  1
1 1  0  0

4.5 Completeness

Given a syntactical model of β- or βη-reduction ⟨P, ·, [[ ]]⟩, one can define its lift ⟨P_{⊥}, •, [[ ]]′⟩ as follows:

a • b = \{ \begin{matrix}a · b & if a, b ≠ ⊥ \\ ⊥ & else, \end{matrix}

[[M]]′_{ρ} = \{ \begin{matrix}[[M]]_{ρ} & if ρ(x) ≠ ⊥ for all x ∈ FV(M) \\ ⊥ & else. \end{matrix}

It is easily checked that this is again a model of β-, respectively, βη-reduction. As a trivial consequence, one has the following completeness theorem for partial models:

Proposition 4.9. Completeness: If M ≠_{β} N, then there is a partial model and ρ for which [[M]]_{ρ}, [[N]]_{ρ} are defined and [[M]]_{ρ} ≠ [[N]]_{ρ}. If M ≠_{βη} N, then the model can be chosen to be strongly extensional. □

Proof. Take a model of conversion such that [[M]]_{ρ} ≠ [[N]]_{ρ} for some ρ, e.g. a term model. Then its lift is a partial model with [[M]]′_{ρ} ⌣̸ ⌢ [[N]]′_{ρ}. □

Of course much more interesting questions can be asked, e.g.how close one can come to a finite completeness theorem for models of reduction? In other words: can every inequality M ≠_{β} N be demonstrated in a finite model of reduction? The answer to this question must be no, since such a finite completeness theorem would yield a decision procedure for convertibility of lambda terms, which is known to be an undecidable problem. It is an open problem to identify subclasses of terms for which a finite completeness property holds, or to describe the class of equations that hold in all finite models of reduction, tree models, partial models etc.

4.6 Relating models of reduction to D_{∞}-models

Consider a finite categorical model of reduction ⟨P, e, p⟩, such that e ∘ p ⩽ id_{P^{P}} and p ∘ e = id_{P}. Since P is finite, it is a dcpo and e and p form a Scott-continuous embedding-projection pair. Therefore, one can take P, e and p as the basis for carrying out the D_{∞}-construction in the category CPO, as outlined in Section 1.2.6.

Let D_{0} = P and D_{n+1} = D_{n}^{D_{n}}. Let e_{0} = e : D_{0} → D_{1} and p_{0} = p : D_{1} → D_{0}. From this, construct the other embedding-projection pairs and take the bilimit D_{∞} as usual. Let ι_{n} : D_{n} → D_{∞} and π_{n} : D_{∞} → D_{n} be the limiting morphisms. For each n ⩾ 0 one has

[figure: D_{n}; e_{n}; ι_{n}; D_{n}^{D_{n}}; ι_{n}^{πn}; D_{∞}; e_{∞}; D_{∞}^{D_{∞}}; and; D_{n}; p_{n}; π_{n}; D_{n}^{D_{n}}; π_{n}^{ιn}; D_{∞}; p_{∞}; D_{∞}^{D_{∞}}.]

Note that each ⟨D_{n}, e_{n}, p_{n}⟩ and ⟨D_{∞}, e_{∞}, p_{∞}⟩ is a categorical model of reduction. Let [[ ]]^{n} and [[ ]]^{∞} be the respective interpretation functions. How are they related? For a valuation of variables ρ : V → D_{∞}, denote by ρ_{n} the valuation π_{n} ∘ ρ : V → D_{n}. One may expect that [[M]]_{ρ_{n}}^{n} = π_{n}[[M]]_{ρ}^{∞}. However, this is in general not the case. The following proposition relates [[ ]]^{n} and [[ ]]^{∞}:

Proposition 4.10. For all lambda terms M,

[[M]]_{ρ}^{∞} = [figure: n⩾0] ι_{n}[[M]]_{ρ_{n}}^{n}.

Proof. First recall from Proposition 1.7 that id_{D_{∞}} = [figure]_{n} ι_{n}∘π_{n}. Also note that π_{n}∘p_{∞}∘ι_{n}^{π_{n}} = p_{n}∘π_{n}^{ι_{n}}∘ι_{n}^{π_{n}} = p_{n}. The proposition is proved by induction on M. There are three cases:

Case 1: [[x]]_{ρ}^{∞} = ρ(x) = [figure]_{n} ι_{n} ∘ π_{n} ∘ ρ(x) = [figure]_{n} ι_{n} ∘ ρ_{n}(x) = [figure]_{n} ι_{n}[[x]]_{ρ_{n}}^{n}.
Case 2: \begin{aligned}[[MN]]_{ρ}^{∞} & = & e_{∞}([[M]]_{ρ}^{∞})([[N]]_{ρ}^{∞}) =^{(IH)} e_{∞}([figure]_{n} ι_{n}[[M]]_{ρ_{n}}^{n})([figure]_{n} ι_{n}[[N]]_{ρ_{n}}^{n}) \\ & = & [figure]_{n} e_{∞}(ι_{n}[[M]]_{ρ_{n}}^{n})(ι_{n}[[N]]_{ρ_{n}}^{n}) = [figure]_{n} ι_{n}^{π_{n}}(e_{n}[[M]]_{ρ_{n}}^{n})(ι_{n}[[N]]_{ρ_{n}}^{n}) \\ & = & [figure]_{n}(ι_{n} ∘ (e_{n}[[M]]_{ρ_{n}}^{n}) ∘ π_{n})(ι_{n}[[N]]_{ρ_{n}}^{n}) = [figure]_{n} ι_{n}(e_{n}([[M]]_{ρ_{n}}^{n})([[N]]_{ρ_{n}}^{n})) \\ & = & [figure]_{n} ι_{n}[[MN]]_{ρ_{n}}^{n}. \end{aligned}

Case 3: \begin{aligned}[[λx.M]]_{ρ}^{∞} & = & p_{∞}(λa ∈ D_{∞}.[[M]]_{ρ(x:=a)}^{∞}) =^{(IH)} p_{∞}(λa. [figure]_{n} ι_{n}[[M]]_{ρ_{n}(x:=π_{n}a)}^{n}) \\ & = & [figure]_{n} p_{∞}(λa.ι_{n}[[M]]_{ρ_{n}(x:=π_{n}a)}^{n}) = [figure]_{n} p_{∞} ∘ ι_{n}^{π_{n}}(λb ∈ D_{n}.[[M]]_{ρ_{n}(x:=b)}^{n}) \\ & = & [figure]_{n} ι_{n} ∘ π_{n} ∘ p_{∞} ∘ ι_{n}^{π_{n}}(λb ∈ D_{n}.[[M]]_{ρ_{n}(x:=b)}^{n}) \\ & = & [figure]_{n} ι_{n} ∘ p_{n}(λb ∈ D_{n}.[[M]]_{ρ_{n}(x:=b)}^{n}) = [figure]_{n} ι_{n}[[λx.M]]_{ρ_{n}}^{n}. \end{aligned}

□

In particular, it follows that ι_{n}[[M]]_{ρ_{n}}^{n} ⩽ [[M]]_{ρ}^{∞} for every M, and by applying π_{n} to both sides, it also follows that [[M]]_{ρ_{n}}^{n} ⩽ π_{n}[[M]]_{ρ}^{∞}. To see that equality does not in general hold, notice that D_{∞}, by construction, is a model of conversion. Hence for all M =_{β} N, one has π_{n}[[M]]_{ρ}^{∞} = π_{n}[[N]]_{ρ}^{∞}. On the other hand, D_{n} is finite and hence a proper model of reduction. Therefore, it is possible to find M, N with M =_{β} N and [[M]]_{ρ_{n}}^{n} ≠ [[N]]_{ρ_{n}}^{n}.

Corollary 4.11. If M and N are lambda terms such that, for some n, [[M]]_{ρ_{n}}^{n} ⌣̸ ⌢ [[N]]_{ρ_{n}}^{n}, then [[M]]_{ρ}^{∞} ⌣̸ ⌢ [[N]]_{ρ}^{∞}. The converse holds if D_{∞} is bounded complete (this is the case, for instance, if P is a tree).

Proof. Suppose [[M]]_{ρ}^{∞} ⌣ ⌢ [[N]]_{ρ}^{∞}. Let c ∈ D_{∞} such that [[M]]_{ρ}^{∞}, [[N]]_{ρ}^{∞} ⩽ c. Then [[M]]_{ρ_{n}}^{n} ⩽ π_{n}[[M]]_{ρ}^{∞} ⩽ π_{n}c, and similarly for [[N]]_{ρ_{n}}^{n}. For the converse, assume D_{∞} is bounded complete. Assume that for all n ⩾ 0, [[M]]_{ρ_{n}}^{n} ⌣ ⌢ [[N]]_{ρ_{n}}^{n}. Then ι_{n}[[M]]_{ρ_{n}}^{n} ⌣ ⌢ ι_{n}[[N]]_{ρ_{n}}^{n} for all n. Let c_{n} = ι_{n}[[M]]_{ρ_{n}}^{n} ∨ ι_{n}[[N]]_{ρ_{n}}^{n} in D_{∞}. Then (c_{n})_{n⩾0} is an increasing sequence and [[M]]_{ρ}^{∞} = [figure]_{n} ι_{n}[[M]]_{ρ_{n}}^{n} ⩽ [figure]_{n} c_{n}, and similarly [[N]]_{ρ}^{∞} ⩽ [figure]_{n} c_{n}, hence [[M]]_{ρ}^{∞} ⌣ ⌢ [[N]]_{ρ}^{∞}. □

56

Henkin Representations, Polymorphism, and Empty Types

The polymorphic lambda calculus was independently discovered by Girard [22] and Reynolds [51]. It has been extensively studied as a prototypical programming language because of its great expressive power and economy of syntax. The basic idea is to augment the simply-typed lambda calculus with type variables α, β, … and with explicit universal quantification over types. This allows the formulation of algorithms that uniformly handle data of more than one type. Type instantiation and type abstraction is made explicit on terms: If t is a term of type ∀α.τ, then tσ is a term of type τ[σ/α], for all types σ. Conversely, if s is a term of type τ, then Λα.s is a term of type ∀α.τ. Now consider for instance the type

Polybool = ∀α.α → α → α.

A term t of this type yields a term tσ of type σ → σ → σ, for every type σ. Moreover, following Strachey’s concept of parametric polymorphism [62], one expects the behavior of tσ to vary uniformly with the choice of σ. In the polymorphic lambda calculus, there are only two such uniform functions of type Polybool, i.e. there are exactly two closed terms of type Polybool, corresponding to the first and second projections:

p_{1} = Λα.λx:α.λy:α.x and p_{2} = Λα.λx:α.λy:α.y.

Several notions of models for the polymorphic lambda calculus have been proposed in the 1980’s. These models follow one of two basic designs:

1. Environment-style models, which have been considered by Bruce and Meyer [10], extend the familiar Henkin models of the simply-typed lambda calculus. These models are non-strict, in the sense that a function type σ → τ is interpreted as a subset of the set of functions from σ to τ, and similarly a universal type ∀α.τ is interpreted as a subset of an infinite product ∏_{σ} τ[σ/α].

2. Categorical models, introduced by Seely [56], are based on general principles for the interpretation of quantifiers in categorical hyperdoctrines. Seely’s PL-categories are a canonical extension of the ccc interpretation of the simply-typed lambda calculus. These interpretations are strict, in the sense that both function types and universal types are interpreted directly by their categorical counterparts.

These two classes of models do not readily mesh, because it is known that strict interpretations collide with the classical foundations: Reynolds showed that there are no set-theoretic strict models of the polymorphic lambda calculus [52].

The aim of this chapter is to reconcile the categorical and the set-theoretical approaches by giving a categorical treatment of non-strict models. This generalizes both Seely’s models and the models of Bruce and Meyer. The central concept is that of a Henkin representation: a functor H between ccc’s is a Henkin representation if it preserves finite products and if for all objects A, B, the canonical morphism H(B^{A}) ↣ H(B)^{H(A)} is monic.

In Section 5.1, we prove three Henkin representation theorems characterizing those ccc’s which can be Henkin-represented, respectively, in the category of non-empty sets 𝒮^{+}, the category of sets 𝒮, and a category 𝒮^{P} of presheaves over some poset P. After reviewing the simply-typed lambda calculus in Section 5.2, we show in Section 5.3 that the three Henkin representation theorems correspond naturally to completeness theorems for three different classes of non-strict models: Friedman’s set-theoretic models with non-empty types [21], set-theoretic models with possibly empty types, as investigated by Meyer et al. [39], and Mitchell and Moggi’s Kripke lambda models [42], respectively. Sections 5.4 through 5.6 are devoted to Henkin representations of PL-categories and their relationship to completeness theorems for the polymorphic lambda calculus.

5.1 Henkin representations of cartesian-closed categories

5.1.1 Henkin representations

Definition. Let C and D be cartesian-closed categories. A functor H : C → D is called a Henkin representation if it preserves terminator and binary products, and if for all objects A, B ∈ C, the canonical arrow (Hε_{A,B})^{⋆} : H(B^{A}) ↣ HB^{HA} is monic.

Recall that a ccc-representation F : C → D is a functor that preserves all ccc structure, and in particular F (B^{A}) = F B^{F A} and (F ε_{A,B})^{⋆} = F (ε_{A,B}^{⋆}) = id. Thus, every ccc-representation is a Henkin representation, but not vice versa. Henkin representations arise naturally as the forgetful functors of various concrete ccc’s into 𝒮. Even though Henkin representations do not in general preserve exponentials, they are ‘compatible’ with ccc structure in an essential way: their kernels are ccc-congruences. This is why they correspond to useful notions of ‘model’ for typed lambda calculi.

Definition 5.1. A ccc-congruence ∼ on a ccc C is given by an equivalence relation ∼_{A,B} on each hom-set (A, B), such that the following hold:

1. \frac{f ∼_{A,B} f′  g ∼_{B,C} g′}{g ∘ f ∼_{A,C} g′ ∘ f′}  2. \frac{f ∼_{A,B} f′  g ∼_{A,C} g′}{⟨f, g⟩ ∼_{A,B×C} ⟨f′, g′⟩}  3. \frac{f ∼_{A×B,C} f′}{f^{⋆} ∼_{A,C^{B}} f′^{⋆}}

The kernel of a functor F : C → D is defined by f ∼_{A,B} f′ iff F f = F f′, for all f, f′ : A → B. Clearly, the kernel of a ccc-representation is a ccc-congruence. The same is true for Henkin representations:

Lemma 5.2. The kernel of a Henkin representation H : C → D is a ccc-congruence.

Proof. 1. and 2. are obvious, since H preserves binary products. For 3., suppose f ∼_{A×B,C} f′, i.e. Hf = Hf′. One has

\xymatrix{C^{B} × B \ar[r]^{ε} & C \\ A × B \ar[u]^{f^{⋆}×id_{B}} \ar[ur]_{f}} ⇒ \xymatrix{H(C^{B}) × HB \ar[r]^{Hε} & HC \\ HA × HB \ar[u]^{H(f^{⋆})×id_{HB}} \ar[ur]_{Hf}} ⇒ [figure: HA; H(f^{⋆}); ^{(Hf)^{⋆}}; H(C^{B}); ^{(Hε)^{⋆}}; HC^{HB},]

and similarly for f′. Since (Hf)^{⋆} = (Hf′)^{⋆}, and since (Hε)^{⋆} is monic, one gets H(f^{⋆}) = H(f′^{⋆}). □

Remark 5.3. Henkin representations do not form a category, since they do not in general compose. If H_{1} and H_{2} are Henkin representations, then the composition H_{2} ∘H_{1} will be a Henkin representation if H_{2} preserves monics or if H_{1} is a ccc-representation.

Henkin representations can also be described in terms of partial exponential diagrams. We say that a diagram D × B ⟶^{f} C is a partial exponential diagram if for every morphism g : A × B → C, there is at most one h : A → D such that

\xymatrix{D × B \ar[r]^{f} & C. \\ A × B \ar[u]^{h×id_{B}} \ar[ur]_{g}}

We have dropped the condition for the existence of h from the definition of exponential diagrams in Section 1.1.6. In general, the word “partial” stipulates that one requires uniqueness, but not existence, while the word “weak” or the prefix “pre-” indicates the opposite.

A Henkin representation of a ccc C can now be characterized as a finite product preserving functor

H : C → D such that for all A, B ∈ C, the arrow H(B^{A}) × HA ⟶^{Hε_{A,B}} HB is a partial exponential diagram. The advantage of this definition is that it makes sense for a category D with finite products, even if it is not cartesian-closed. Our definition of Henkin representations for PL-categories in Section 5.4.2 will make use of a similar notion of partial ∀-diagrams.

5.1.2 Henkin representations and well-pointed ccc’s

Definition. An object A is well-pointed if for every f ≠ g : A → B, there is a point p : 1 → A such that f ∘ p ≠ g ∘ p. A category D is well-pointed if all its objects are well-pointed.

Note that for a ccc D, the following are equivalent:

1. D is well-pointed.

2. The point functor Γ = (1, −) is an embedding.

3. Γ is a Henkin representation.

Proposition 5.4. Every ccc representation F : C → D from a ccc C into a well-pointed ccc D gives rise to a Henkin representation H = Γ ∘ F : C → 𝒮. Conversely, every Henkin representation H : C → 𝒮 arises in this way.

Proof. If D is well-pointed, then Γ ∘ F : C → 𝒮 is a Henkin representation by Remark 5.3. For the converse, suppose H : C → 𝒮 is a Henkin representation. Define D by |D| = |C| and D(A, B) = H(B^{A}). Composition and identities are given by the respective H-images of the canonical morphisms ∘ : C^{B}×B^{A} → C^{A} and id^{⋆} : 1 → A^{A} in C. Associativity and the identity laws follow from the commutativity of the following diagrams in C, and of their images under H:

\xymatrix{D^{C} × C^{B} × B^{A} \ar[r]^{id×∘} \ar[d]_{∘×id} & D^{C} × C^{A} \ar[d]^{∘} & B^{A} \ar[r]^{⟨id,id^{⋆}⟩} \ar[d]_{⟨id^{⋆},id⟩} \ar[dr]^{id} & B^{A} × A^{A} \ar[d]^{∘} \\ D^{B} × B^{A} \ar[r]_{∘} & D^{A} & B^{B} × B^{A} \ar[r]_{∘} & B^{A}}

Define F : C → D as the identity on objects, and by sending f : A → B to H(f^{⋆}) : 1 → H(B^{A}) = D(A, B). It is routine to check that D is a well-pointed ccc, that F is a ccc representation, and Γ ∘ F = H.

□ 5.1.3 Freely adjoining arrows to a ccc

If A is an object of a ccc C, let C[1⟶^{x}A] be the ccc obtained from C by freely adjoining an indeterminate arrow x : 1 → A. The category C[1⟶^{x}A], together with the canonical ccc-representation ȷ : C → C[1⟶^{x}A], is uniquely determined by the following universal property: for every ccc-representation F : C → D and every arrow f : 1 → F A in D, there is a unique ccc-representation F̂ : C[1⟶^{x}A] → D such that

\xymatrix{C \ar[r]^{ȷ} \ar[dr]_{F} & C[1⟶^{x}A] \ar[d]^{F̂} \\  & D}

and F̂x = f. The category C′ = C[1⟶^{x}A] has a concrete description as the Kleisli category of the comonad T (B) = A × B (see Lambek and Scott [34]). This means, the objects of C′ are those of C, and the hom-sets are given by C′(B, C) = C(A×B, V). The identity at B in C′ is π′ : A×B → B in C, and the composition

g ∘ f in C′ is A × B ⟶^{⟨π,f⟩} A × C ⟶^{g} D in C. x : 1 → A in C′ is id : A → A in C. The canonical functor ȷ : C → C′ sends f : B → C to f ∘ π′ : A × B → C.

It is an interesting question to ask which properties are preserved or reflected by the canonical functor ȷ : C → C[1⟶^{x}A]. We will pay particular attention to the question under what conditions ȷ is an embedding, and under what conditions it is faithful (i.e., isomorphism reflecting).

Definition. In any category, a morphism f : A → B is called a cover if, whenever f factors through a monic m,

[figure: A; f; B; U,; m]

then m is necessarily iso. We sometimes write f : A −▷ B for a cover. Notice that any morphism f : A → B with a right inverse f ∘ g = id_{B} is a cover, called a split cover. Also notice that any f is iso iff it is a monic cover. An object A is called well-supported if for each object B, the second projection π′ : A × B −▷ B is a cover.

An object A is partially initial if every hom-set (A, B) has at most one element.

Lemma 5.5. Suppose F : C → D has a right adjoint. Then F preserves epics and partial initial objects. Moreover, if C has pullbacks, then F preserves covers.

Proof. Let φ : F ⊣ G be the adjunction. Suppose e : B ↠ C is epic and

[figure: F B; F e; F C; g; h; D]  ⇒  [figure: B; e; C; φg; φh; GD,]

which implies φg = φh, hence g = h. Hence F e is epic. Dually, right adjoints preserve monics. Now suppose A is partially initial. Then |(F A, B)| ≅ |(A, GB)| ⩽ 1, hence F A is partially initial. Now assume C has pullbacks, and suppose f : A −▷ B is a cover. Assume F f = F A →^{g} U ↣^{m} F B. Since G is a right adjoint, Gm : GU ↣ GF B is monic, and we can consider

[figure: A; f; φg; ·; m′; u′; B; u; GU; Gm; GF B]  ⇒  [figure: B; u; GU; Gm; GF B]  ⇒  [figure: F B; id; U; m; F B,]

where u is the unit of the adjunction. Notice that pullbacks always preserve monics, hence m′ is monic, and it must be iso since f is a cover. The last diagram implies that m is iso, and it follows that F f is a cover. □

Lemma 5.6. Let C′ = C[1⟶^{x}A] and ȷ : C → C′ the canonical functor. The following hold:

1. ȷ preserves epics, monic cones, partial initial objects, and well-pointed objects.

2. ȷ is an embedding if and only if the unique morphism A ↠ 1 is epic in C.

3. ȷ is faithful if and only if it is an embedding and A is well-supported.

Proof. 1.: Recall that in a ccc, the product functor T (B) = A × B has a right adjoint; hence it preserves epics and partial initial objects by Lemma 5.5. Now suppose f : B ↠ C is epic in C and g ∘ ȷf = h ∘ ȷf in C′. By the characterization of C[1⟶^{x}A], this means

[figure: A × B; id_{A}×f; A × C; g; h; D,]

holds in C, and hence g = h. Thus, ȷf is epic. Now, suppose B is a partial initial object in C. Then A × B is also partially initial, hence |C′(B, C)| = |C(A × B, C)| ⩽ 1, hence B is partially initial in C′. Moreover, T, and hence ȷ, preserves monic cones. Now, suppose B is well-pointed in C, and suppose f ≠ g : B → C in C′. Then f ≠ g : A × B → C, hence f^{⋆} ≠ g^{⋆} : B → C^{A} in C, and since B is well-pointed, there is p : 1 → B with f^{⋆} ∘ p ≠ g^{⋆} ∘ p. This implies f ∘ (id_{A} × p) ≠ g ∘ (id_{A} × p), hence f ∘ ȷp ≠ g ∘ ȷp in C′.

2.: ⇒: Certainly A ↠ 1 is epic in C[1⟶^{x}A] (it splits). But embeddings reflect epics. ⇐: Suppose A ↠ 1 is epic in C. Then π′ : A × B ↠ B is epic for all B. Consider f, g : B → C in C with ȷf = ȷg. Then f ∘ π′ = g ∘ π′ : A × B → C, hence f = g.

3.: First notice that any monic-preserving embedding F reflects isos iff it reflects covers: Suppose F reflects isos and F f is a cover. Suppose f factors through a monic m, then F f factors through F m, hence F m is iso, hence m is iso, hence f is a cover. Conversely, suppose F reflects covers. If F f is iso, then F f, hence f, is a monic cover, hence an iso. Since ȷ : C → C[1⟶^{x}A] preserves monics, it suffices to show that ȷ reflects covers iff A is well-supported.

⇒: Suppose ȷ reflects covers. Clearly, A×B −▷ B is a split cover in C[1⟶^{x}A], hence a cover in C, making A well-supported in C. ⇐: Suppose A is well-supported in C, and suppose f : C → B is such that F f is a cover in C[1⟶^{x}A]. Suppose f factors through a monic m : D ↣ C. Then F f factors through F m, hence F m is iso in C[1⟶^{x}A]. This means, there is m^{−1} ∈ C′(C, D) = C(A × C, D) such that in C,

[figure: A × C; m^{−1}; π′; C; D.; m]

But π′ is a cover, therefore m an iso in C. This shows f is a cover. □

Lemma 5.7. If f ≠ g : A → B in C, then ȷf ∘ x ≠ ȷg ∘ x in C[1⟶^{x}A].

Proof. ȷf ∘ x = f ∘ π′ ∘ ⟨id_{A}, id_{A}⟩ = f in C, and similarly for ȷg ∘ x. □

Proposition 5.8. Let C be a small ccc. If A ⊆ |C| is a set of objects such that A ↠ 1 for all A ∈ A, then there is a ccc-embedding F_{A} : C → D such that F A is well-pointed for all A ∈ A. F_{A} preserves monic cones. Moreover, if each A ∈ A is well-supported, then F_{A} can be chosen to be faithful, i.e. isomorphismreflecting.

Proof. We adjoin countably many arrows 1 → A to each A ∈ A. More precisely, let I be the directed poset of finite subsets X ⊆ ℕ × A, ordered by inclusion. Let Δ : I → CCC be the diagram that associates to each

X = {⟨i_{1}, A_{1}⟩, …, ⟨i_{n}, A_{n}⟩} ∈ I a ccc C[X] := C[1⟶^{x_{i_{1},A_{1}}}A_{1}, …, 1⟶^{x_{in,An}}A_{n}], and to each inclusion

ι : X ↪ Y ∈ I the canonical ccc-representation Δ_{ι} : C[X] → C[Y]. Notice that by Lemma 5.6, Δ_{ι} is a monic-preserving embedding, and moreover, if each A ∈ A is well-supported, then Δ_{ι} is faithful. We can take D to be the colimit of the diagram Δ. Concretely, assume that each C[X] has the same objects as C, and that the embeddings Δ_{ι} are actual inclusions on hom-sets. Then D can be described as follows: the objects of D are those of C, and the hom-set D(B, C) is the directed union of the hom-sets C[X](B, C), where X ∈ I. One checks that D is a ccc and that the inclusion F : C ↪ D is a ccc-embedding preserving collective monics, and moreover, F is faithful if the Δ_{ι} are. To show that A is well-pointed in D, let A ∈ A and assume f ≠ g : A → B in D. Then there is X ∈ I with f, g ∈ C[X]. Let ⟨i, A⟩ ∉ X and consider C[X, 1⟶^{x_{i,A}}A]: one has f ∘ x_{i,A} ≠ g ∘ x_{i,A} by Lemma 5.7. Hence A is well-pointed in D. □

5.1.4 Henkin representation theorems

A Henkin representation theorem characterizes those ccc’s which can be Henkin embedded in a given category, or in a category from a given class. We consider Henkin representations into the category of non-empty sets 𝒮^{+}, into the category of sets 𝒮, and into a category 𝒮^{P} of presheaves over a poset P. We will see in Section 5.3 how each of these target categories corresponds to a certain class of models of the simply-typed lambda calculus. The first one corresponds to Friedman’s set-theoretic models with non-empty types [21]; the second one corresponds to set-theoretic models with possibly empty types, as investigated by Meyer et al. [39], and the third one corresponds to Mitchell and Moggi’s Kripke models [42]. Our Henkin representation theorems will translate into completeness theorems for each of these classes of models.

Representation Theorems for cartesian-closed categories have been considered in the papers of Čubrić [14] and Simpson [60]. The difference to our representation theorems is that Čubrić and Simpson work with strict ccc representations rather than Henkin representations, and they only consider representations of a free cartesian-closed category.

Henkin representations in 𝒮^{+}

Theorem 5.9. A small ccc C can be Henkin-embedded in 𝒮^{+} if and only if for every object A, the morphism A ↠ 1 is epic.

Proof. ⇒: In 𝒮^{+}, one has A ↠ 1 for all A; moreover, embeddings reflect epics.

⇐: Consider the ccc-embedding F_{A} : C → D from Proposition 5.8, with A = |C|. Then C ⟶^{F_{A}} D ⟶^{Γ} 𝒮^{+} is a Henkin-embedding. □

Corollary 5.10. If for every object A in a small ccc C, the morphism A ↠ 1 is epic and A is well-supported, then there is a faithful (i.e., isomorphism-reflecting) Henkin-embedding H : C → 𝒮^{+}. □

Henkin representations in 𝒮

Definition. A cartesian-closed category C is called special if for every object A, either the morphism A ↠ 1 is epic, or A is partially initial.

Theorem 5.11. A small ccc C can be Henkin-embedded in 𝒮 if and only if it is special.

Proof. ⇒: The category 𝒮 is special, because each non-empty set A satisfies A ↠ 1, while the empty set is (partially) initial. Moreover, embeddings reflect epics and partial initial objects, and hence specialness.

⇐: Suppose C is special. Consider the ccc-embedding F_{A} : C → D from Proposition 5.8, with A = {A ∈ |C| | A ↠ 1}. Then each A ∈ A is well-pointed in D by construction of D; moreover, each A ∉ A is partially initial and therefore trivially well-pointed. Hence C ⟶^{F_{A}} D ⟶^{Γ} 𝒮 is a Henkin-embedding. □

Corollary 5.12. Let M be a monoid, i.e. a one-object category. A small ccc C can be Henkin-embedded in 𝒮^{M} if and only if C is special.

Proof. ⇒: 𝒮^{M} is special, and embeddings reflect specialness.

⇐: There is an obvious ccc-embedding H : 𝒮 → 𝒮^{M} which preserves monics. If C is special, it can be Henkin-embedded in 𝒮 and hence, by Remark 5.3 in 𝒮^{M}. □

Corollary 5.13. Let I be a set. A small ccc C can be Henkin-embedded in 𝒮^{I} if and only if there is a family (∼_{i})_{i∈I} of ccc-congruences on C such that each quotient C/∼_{i} is special, and such that ⋂_{i∈I} ∼_{i} is the identity relation. □

Remark. If a ccc C has an object A such that A is partially initial and A ↠ 1, then C is a preorder, i.e.every hom-set has at most one element. Indeed, if f, g : B → C, then

[figure: A; 1; f^{⋆}; g^{⋆}; C^{B},]

hence f = g. As a consequence, if C has a non-trivial hom-set, then any Henkin embedding C → 𝒮 not only reflects, but also preserves partial initial objects and epics A ↠ 1.

Henkin representations in 𝒮^{P}

Any small ccc C can be ccc-embedded in a category of presheaves 𝒮^{A}, for instance by the Yoneda embedding (see Example 1.5). If one takes A to be a poset, it is still possible to obtain a Henkin embedding:

Theorem 5.14. Any small ccc C can be Henkin-embedded in 𝒮^{P} for some poset P. Moreover, the embedding preserves monic cones.

Let A and B be small categories, and let F : A → B be a functor. This induces a functor 𝒮^{F} : 𝒮^{B} → 𝒮^{A}, which we denote by F_{∗}. Note that F_{∗} always preserves monic cones and limits, since these are taken pointwise in 𝒮^{A} and 𝒮^{B}. The following two lemmas give sufficient conditions for F_{∗} to be a Henkin representation, respectively, an embedding.

Definition. A functor F : A → B is called left-full if for all g : F A → B in B, there exists f : A → A′ in A such that B = F A′ and g = F f.

Lemma 5.15. If F : A → B is left-full, then F_{∗} : 𝒮^{B} → 𝒮^{A} is a Henkin representation.

Proof. We need to show that the canonical natural transformation φ : F_{∗}(Q^{P}) → F_{∗}Q^{F_{∗}P} is monic for all P, Q ∈ 𝒮^{B}. Let A ∈ A. Unraveling the definition of exponentiation in a functor category yields that φ_{A} : 𝒮^{B}(B(F A, −) × P, Q) → 𝒮^{A}(A(A, −) × F_{∗}P, F_{∗}Q) is given by (φ_{A}η)_{A′}(f, x) = η_{F A′}(F f, x), where η : B(F A, −) × P → Q, A′ ∈ A, f : A → A′ and x ∈ (F_{∗}P)A′ = P (F A′). To show that φ_{A} is one-to-one, assume η ≠ η′A(F A, −) × P → Q. Then there are B ∈ B, g : F A → B and x ∈ P B such that η_{B}(g, x) ≠ η′_{B}(g, x). Since F is left-full, there is f : A → A′ in A such that B = F A′ and g = F f, hence

(φ_{A}η)_{A′}(f, x) = η_{F A′}(F f, x) = η_{B}(g, x) ≠ η′_{B}(g, x) = η′_{F A′}(F f, x) = (φ_{A}η′)_{A′}(f, x),

and therefore φ_{A}η ≠ φ_{A}η′. This shows that φ_{A} is one-to-one for every A, hence φ is monic. □

Lemma 5.16. If F : A → B is onto objects, then F_{∗} : 𝒮^{B} → 𝒮^{A} is an embedding.

Proof. Let P, Q ∈ 𝒮^{B} and η ≠ η′ : P → Q. Then η_{B} ≠ η′_{B} : P B → QB for some B ∈ B. Let A ∈ A with B = F A. Then (F_{∗}η)_{A} = η_{F A} ≠ η′_{F A} = (F_{∗}η′)_{A}, hence F_{∗}η ≠ F_{∗}η′. □

Table 5.1: Typing rules for the simply-typed lambda calculus

(var)  \overline{Γ, x:σ ⊳ x : σ}
(const)  \overline{Γ ⊳ c^{σ} : σ}
(∗)  \overline{Γ ⊳ ∗ : 1}
(pair) \frac{Γ ⊳ M : σ  Γ ⊳ N : τ}{Γ ⊳ ⟨M, N⟩ : σ × τ}
(π_{1})  \frac{Γ ⊳ M : σ × τ}{Γ ⊳ π_{1}M : σ}
(π_{2})  \frac{Γ ⊳ M : σ × τ}{Γ ⊳ π_{2}M : τ}

(app) \frac{Γ ⊳ M : σ → τ  Γ ⊳ N : σ}{Γ ⊳ MN : τ}
(abs)  \frac{Γ, x:σ ⊳ M : τ}{Γ ⊳ λx:σ.M : σ → τ}
(weaken)  \frac{Γ ⊳ M : σ  Γ ⊆ Γ′}{Γ′ ⊳ M : σ}

The proof of Theorem 5.14 now rests on the fact that every small category A is, in the terminology of Freyd and Scedrov [20], dominated by some poset P, i.e. there is a left-full functor F : P → A which is onto objects.

Lemma 5.17 (Freyd, Scedrov [20]). Every small category A is dominated by some poset P.

Proof. Let the objects of P be finite sequences of objects and morphisms A_{0} ⟶^{f_{0}} A_{1} ⟶^{f_{1}} … ⟶^{f_{n−1}} A_{n}, ordered by the prefix ordering. Then P is a poset, and the obvious functor F : P → A is left-full and onto objects. □

Proof of Theorem 5.14: Let C be a small ccc. Then C^{op} is dominated by some poset P by Lemma 5.17; let F : P → C^{op}. By Lemmas 5.15 and 5.16, the functor F_{∗} : 𝒮^{C^{op}} → 𝒮^{P} is a Henkin embedding; moreover it preserves monic cones. By precomposing F_{∗} with the Yoneda embedding, one obtains a Henkin embedding F_{∗} ∘ Y : C → 𝒮^{P}. □

5.2 The interpretation of the simply-typed lambda calculus

5.2.1 The simply-typed lambda calculus

Let T C be a set of type constants t, u, . . .. Simple types σ, τ, … are given by the grammar:

σ ::= t 1 σ × τ σ → τ

Let V be an infinite set of variables x, y, . . .. For each type σ, let C_{σ} be a set of individual constants c^{σ}, d^{σ}, . . .. The collection ⟨T C, (C_{σ})_{σ}⟩ is also called a simply-typed signature. Raw typed lambda terms M, N, … are given by the grammar:

M ::= x c^{σ} ∗ ⟨M, N⟩ π_{1}M π_{2}M MN λx:σ.M Mσ

We have the usual notions of free and bound variables, and we write FV(M) for the free variables of a term M. We identify raw terms up to renaming of bound variables, and we write M[N/x] for the result of substituting N for x in M.

Table 5.2: Equational rules for the simply-typed lambda calculus

(refl)  \overline{Γ ⊳ M = M : σ}
(symm)  \frac{Γ ⊳ M = N : σ}{Γ ⊳ N = M : σ}
(trans)  \frac{Γ ⊳ M = N : σ  Γ ⊳ N = P : σ}{Γ ⊳ M = P : σ}
(cong_{1})  \frac{Γ ⊳ M = M′ : σ  Γ ⊳ N = N′ : τ}{Γ ⊳ ⟨M, N⟩ = ⟨M′, N′⟩ : σ × τ}
(cong_{2})  \frac{Γ ⊳ M = M′ : σ × τ}{Γ ⊳ π_{1}M = π_{1}M′ : σ}
(cong_{3})  \frac{Γ ⊳ M = M′ : σ × τ}{Γ ⊳ π_{2}M = π_{2}M′ : τ}
(cong_{4}) \frac{Γ ⊳ M = M′ : σ → τ Γ ⊳ N = N′ : σ}{Γ ⊳ MN = M′N′ : τ}
(cong_{5})  \frac{Γ, x:σ ⊳ M = M′ : τ}{Γ ⊳ λx:σ.M = λx:σ.M′ : σ → τ}

(unit)  \overline{Γ ⊳ M = ∗ : 1}
(proj_{1})  \overline{Γ ⊳ π_{1}⟨M, N⟩ = M : σ}
(proj_{2})  \overline{Γ ⊳ π_{2}⟨M, N⟩ = N : τ}
(surj) \overline{Γ ⊳ ⟨π_{1}M, π_{2}M⟩ = M : σ × τ}
(β) \overline{Γ ⊳ (λx:σ.M)N = M[N/x] : τ}
(η) \frac{x ∉ FV(M)}{Γ ⊳ λx:σ.(Mx) = M : σ → τ}
(add-var)  \frac{Γ ⊳ M = M′ : σ  Γ ⊆ Γ′}{Γ′ ⊳ M = M′ : σ}

A type assignment Γ = x_{1}:σ_{1}, x_{2}:σ_{2}, …, x_{m}:σ_{m} is a finite, possibly empty sequence of pairs of a variable and a type, such that x_{i} ≠ x_{j} for all i ≠ j. We write Γ ⊆ Γ′ if Γ is contained in Γ′ as a set. A valid typing judgment is an expression of the form Γ ⊳ M : σ which can be derived by the rules in Table 5.1. An equation of the simply-typed lambda calculus is an expression of the form Γ⊳M = N : σ, where Γ⊳M : σ and Γ ⊳ N : σ are valid typing judgments. If E is an equation and E is a set of equations, we write E ⊢_{s} E if E can be derived from E by the rules in Table 5.2. As usual, E is called a theory if it is closed under derivability, i.e. if E ⊢_{s} E implies E ∈ E. The smallest theory of the simply-typed lambda calculus (for a fixed signature) is denoted by \underline{λ}. It is also called the pure theory.

5.2.2 Strict interpretation in a cartesian-closed category

Fix a simply-typed signature. An (strict) interpretation I of the simply-typed lambda calculus in a ccc C, which we schematically write as I : \underline{λ} → C, consists of an interpretation of types and an interpretation of typing judgments. A type σ is interpreted as an object [[σ]]^{I} of C. A valid typing judgment Γ ⊳ M : τ is interpreted as a morphism [[Γ ⊳ M : τ]]^{I}. A strict interpretation I is uniquely determined by its values on type constants and individual constants.

Let I : T C → |C| be an interpretation of type constants as objects of C. This extends uniquely to an interpretation [[σ]]^{I} of every type:

\begin{aligned}[[t]]^{I} & = & I(t) \\ [[1]]^{I} & = & 1 \\ [[σ × τ]]^{I} & = & [[σ]]^{I} × [[τ]]^{I} \\ [[σ → τ]]^{I} & = & ([[τ]]^{I})^{[[σ]]^{I}} \end{aligned}

If Γ = x_{1}:σ_{1}, …, x_{m}:σ_{m} is a type assignment, we write [[Γ]]^{I} = [[σ_{1}]]^{I} × ⋯ × [[σ_{m}]]^{I}. Let I_{σ} : C_{σ} → (1, [[σ]]^{I}) be an interpretation of term constants as morphisms of C, for each type σ. This extends uniquely to an interpretation [[Γ ⊳ M : τ]]^{I} of valid typing judgments:

[[Γ ⊳ x_{j} : σ_{j}]]^{I} = [[Γ]]^{I} ⟶^{π_{j}} [[σ_{j}]]^{I}, the jth projection
[[Γ ⊳ c^{σ} : σ]]^{I} = [[Γ]]^{I} \underrightarrow{}1 ⟶^{I_{σ}(c^{σ})} [[σ]]^{I}
[[Γ ⊳ ∗ : 1]]^{I} = [[Γ]]^{I} \underrightarrow{}1 = [[1]]^{I}
[[Γ ⊳ ⟨M, N⟩ : σ × τ]]^{I} = [[Γ]]^{I} ⟶^{⟨[[Γ⊳M:σ]]^{I},[[Γ⊳N:τ]]^{I}⟩} [[σ]]^{I} × [[τ]]^{I} = [[σ × τ]]^{I}
[[Γ ⊳ π_{1}M : σ]]^{I} = [[Γ]]^{I} ⟶^{[[Γ⊳M:σ×τ]]^{I}} [[σ]]^{I} × [[τ]]^{I} ⟶^{π} [[σ]]^{I}
[[Γ ⊳ π_{2}M : τ]]^{I} = [[Γ]]^{I} ⟶^{[[Γ⊳M:σ×τ]]^{I}} [[σ]]^{I} × [[τ]]^{I} ⟶^{π′} [[σ]]^{I}
[[Γ ⊳ MN : τ]]^{I} = [[Γ]]^{I} ⟶^{⟨[[Γ⊳M:σ→τ]]^{I},[[Γ⊳N:σ]]^{I}⟩} ([[τ]]^{I})^{[[σ]]^{I}} × [[σ]]^{I} ⟶^{ε} [[τ]]^{I}
[[Γ ⊳ λx:σ.M : σ → τ]]^{I} = [[Γ]]^{I} ⟶^{([[Γ,x:σ⊳M:τ]]^{I}) ^{⋆}} ([[τ]]^{I})^{[[σ]]^{I}} = [[σ → τ]]^{I}

Lemma 5.18. The interpretation of the simply-typed lambda calculus in a ccc has the following properties, which are proved by induction on M:

1. Permutation of Individual Variables. If s : {1, …, l} → {1, …, m} is injective and FV(M) ⊆ {x_{s1}, …, x_{sl}}, and if Γ′ = x_{1}:σ_{1}, … x_{m}:σ_{m} and Γ = x_{s1}:σ_{s1}, … x_{sl}:σ_{sl} then

\xymatrix{[[Γ′]]^{I} \ar[rr]^{[[Γ′⊳M:τ]]^{I}} \ar[dr]_{⟨π_{s1},... ,π_{sl}⟩} &  & [[τ]]^{I}. \\  & [[Γ]]^{I} \ar[ur]_{[[Γ⊳M:τ]]^{I}}}

2. Term Substitution. Let Γ = x_{1}:σ_{1}, … x_{m}:σ_{m} and Γ′ = y_{1}:ρ_{1}, … y_{l}:ρ_{l}, and suppose Γ ⊳ M : τ and Γ′ ⊳ N_{j} : σ_{j} for j = 1, …, m. Let M[N̄/x̄] denote the simultaneous substitution of N_{1}, …, N_{n} for x_{1}, …, x_{n} in M. Then

\xymatrix{[[Γ′]]^{I} \ar[rr]^{[[Γ′⊳M[N̄/x̄]:τ]]^{I}} \ar[dr]_{⟨[[Γ′⊳N_{1}:σ_{1}]]^{I},... ,[[Γ′⊳N_{n}:σ_{n}]]^{I}⟩} &  & [[τ]]^{I}. \\  & [[Γ]]^{I} \ar[ur]_{[[Γ⊳M:τ]]^{I}}}

□

We say that an interpretation I satisfies an equation Γ ⊳ M = N : τ, in symbols, I ⊧ Γ ⊳ M = N : τ, if [[Γ ⊳ M : τ]]^{I} = [[Γ ⊳ N : τ]]^{I}. If E is a set of equations, then we write I ⊧ E if I ⊧ E for all E ∈ E. The set of all equations that an interpretation I satisfies is written Th(I). If M is a class of ccc’s, then we write E ⊧_{M} E, for an equation E and a set of equations E, if for every strict interpretation I in a ccc C ∈ M, I ⊧ E implies I ⊧ E.

Proposition 5.19. Soundness of the strict ccc interpretation.

E ⊢_{s} E implies E ⊧_{CCC} E.
□

If T is a theory and I : \underline{PL} → C is an interpretation such that I ⊧ T , then we also write I : T → C. An interpretation can be post-composed with a ccc-representation in an evident way: T ⟶^{I} C ⟶^{F} C is the interpretation J defined by [[σ]]^{J} = F [[σ]]^{I} and [[Γ ⊳ M : τ]]^{J} = F [[Γ ⊳ M : τ]]^{I}.

5.2.3 The cartesian-closed category associated to a theory

From a theory T over a simply-typed signature, one constructs a cartesian-closed category 𝔉_{ccc}(T ) as follows: The objects are simple types σ, and the morphisms f_{M} ∈ (σ, τ) are named by terms M such that x:σ ⊳ M : τ is a valid typing judgment. Two terms M and N name the same morphism if T ⊢_{s} x:σ ⊳ M = N : τ.

Proposition 5.20. The above construction yields a well-defined cartesian-closed category 𝔉_{ccc}(T ). There is a canonical strict interpretation I_{0} : T → 𝔉_{ccc}(T ) with [[σ]]^{I_{0}} = σ and [[x:σ ⊳ M : τ]]^{I_{0}} = f_{M} : σ → τ. Moreover, I_{0} has the following universal property: For any strict interpretation J : T → C, there is a unique ccc-representation F : 𝔉_{ccc}(T ) → C such that

\xymatrix{T \ar[d]_{I_{0}} \ar[dr]^{J} \\ 𝔉_{ccc}(T ) \ar[r]_{F} & C.}

□

Corollary 5.21. Completeness of the strict ccc interpretation. Each theory T of the simply-typed lambda calculus arises as the theory of some ccc-interpretation. Consequently, for any set of equations E,

E ⊧_{CCC} E implies E ⊢_{s} E. □

5.2.4 Henkin representations of a free ccc

Definition. The free ccc over a simply-typed signature is the cartesian-closed category associated to the pure theory \underline{λ} over that signature.

Čubrić proved in [14] that for any object A in a free ccc, the unique morphism A ↠ 1 is epic, and hence the condition of Theorem 5.9 is satisfied. The proof uses a strongly normalizing system of Mints reductions. Let us remark here that, using these Mints reductions, one can show more about the morphism A → 1:

Proposition 5.22. In a free ccc, the morphism A → 1 is a coequalizer of the diagram

[figure: A × A; π; π′; A.]

Proof sketch: Let f : A → B be named by the term x:A ⊳ M : B, and assume f ∘ π = f ∘ π′. This means ⊢_{s} y:A, z:A ⊳ M[y/x] = M[z/x]. Suppose M′ is the unique normal form of M with respect to the system of Mints reductions. Then M′[y/x] and M′[z/x] are the respective unique normal forms of M[y/x] and M[z/x], hence they are syntactically equal. It follows that M′ does not contain x freely, and therefore f

factors as A → 1 ⟶^{M′} B. We already know that the factorization is unique because A ↠ 1. □

As a consequence, in a free ccc, every object A is well-supported, i.e. π′ : A × B −▷ B for all B. Indeed, products preserve coequalizers, and coequalizers are covers. With Corollary 5.10, one gets:

Corollary 5.23. Any free ccc has a faithful (i.e.isomorphism-reflecting) Henkin-embedding into 𝒮^{+}. □

5.2.5 The non-strict interpretation of the simply-typed lambda calculus

Let C be a ccc. A non-strict interpretation of the simply-typed lambda calculus I : \underline{λ} → C is a Henkin representation H : 𝔉_{ccc}(\underline{λ}) → C. One defines [[σ]]^{I} = H[[σ]]^{I_{0}} and [[Γ ⊳ M : τ]]^{I} = H[[Γ ⊳ M : τ]]^{I_{0}}. A non-strict interpretation I satisfies an equation Γ ⊳ M = N : τ, in symbols I ⊧ Γ ⊳ M = N : τ, if [[Γ ⊳ M : τ]]^{I} = [[Γ ⊳ N : τ]]^{I}. As before, we denote by Th(I) the set of equations that are satisfied in I. For a class M of ccc’s we write E ⊧_{M}^{non-strict} E if any non-strict interpretation in some C ∈ M that satisfies E also satisfies E. The following soundness theorem is an obvious consequence of Lemma 5.2:

Proposition 5.24. Soundness of the non-strict ccc-interpretation.

E ⊢_{s} E implies E ⊧_{CCC}^{non-strict} E.
□

Remark. Completeness is also evident, because the strict ccc-interpretations are among the non-strict ones. More interesting are completeness theorems with respect to certain smaller classes of models. This is the subject of the next section.

5.3 From Henkin representation theorems to completeness theorems

5.3.1 The problem with empty types

By a set-theoretic model of the simply-typed lambda calculus, we mean a non-strict interpretation in 𝒮. The equational rules for the lambda calculus from Table 5.2 are not complete for equational reasoning in set-theoretic models. This was first noticed by Meyer et al. in [39]. If in some model, the interpretation [[σ]]^{I} of a type σ is the empty set, then the model satisfies every equation of the form

x:σ, Γ ⊳ M = N : τ.  (5.1)

On the other hand, if [[σ]]^{I} is non-empty, then the model satisfies the rule

(non-empty)  \frac{x:σ, Γ ⊳ M = N : τ  x ∉ FV(M, N)}{Γ ⊳ M = N : τ}  (5.2)

for that type σ. (By this we mean, for every instance of the rule, if the model satisfies the premise, then it satisfies the conclusion. We also say the rule is sound for the model.) So in any particular set-theoretic model, for each σ, either (5.1) or (5.2) holds. However, in a general theory of the simply-typed lambda calculus, this is not true. Meyer and his co-authors give the following example: Let σ and τ be type constants, and let f : (σ → σ → σ) → τ be an individual constant. Let p_{1} = λx:σ.λy:σ.x and p_{2} = λx:σ.λy:σ.y. Then the following is sound for any set-theoretic interpretation:

\frac{x:σ ⊳ fp_{1} = fp_{2} : τ}{⊳fp_{1} = fp_{2} : τ} .  (5.3)

This is because, if [[σ]]^{I} is empty, then p_{1} = p_{2} holds as a consequence of (5.1), while if [[σ]]^{I} is non-empty, then (5.3) follows from (5.2). On the other hand, (5.3) is not sound for arbitrary theories of the lambda calculus: specifically, let 2 be the poset with two elements ⊥ ⩽ ⊤, and consider the following interpretation I : \underline{λ} → 𝒮^{2}: for types, we let

[[σ]]^{I}(⊥) = ∅,  [[σ]]^{I}(⊤) = {s_{1}, s_{2}},  [[τ]]^{I}(⊥) = {t_{1}, t_{2}},  [[τ]]^{I}(⊤) = {u},

with the unique maps [[σ]]^{I}(⊥) → [[σ]]^{I}(⊤) and [[τ]]^{I}(⊥) → [[τ]]^{I}(⊤). Let A = [[σ → σ → σ]]^{I}, and notice that A(⊥) = A(⊤) = {s_{1}, s_{2}}^{{s_{1},s_{2}}^{2}}. Let π_{2} : {s_{1}, s_{2}}^{2} → {s_{1}, s_{2}} be the first projection. Now define [[f]]^{I} : [[σ → σ → σ]]^{I} → [[τ]]^{I} via

[[f]]^{I}(⊥)(x) = \{ \begin{matrix}t_{1} & if x = π_{1} \\ t_{2} & else, \end{matrix} [[f]]^{I}(⊤)(x) = u.

With respect to this interpretation, [[fp_{1}]]^{I}(⊥) = t_{1} ≠ t_{2} = [[fp_{2}]]^{I}(⊥). On the other hand, there is a unique morphism [[σ]]^{I} → [[τ]]^{I}. Hence, x:σ ⊳ fp_{1} = fp_{2} : τ holds for the interpretation I, while ⊳fp_{1} = fp_{2} : τ does not. Consequently, the rule (5.3) is not admissible for arbitrary lambda theories.

As the example shows, the equational rules in Table 5.2 are not complete for the class of set-theoretic models. On the other hand, the rule (non-empty)is sound only for set-theoretic models with non-empty types. Hence, the need arises to consider the following three classes of models, and their associated completeness theorems, separately:

1. One may consider set-theoretic models where all types are non-empty. This is the classical approach [21]. In this case, the rules in Table 5.2, together with (non-empty), are sound and complete.

2. One may consider all set-theoretic models. This necessitates a more elaborate system of inference rules. A sound and complete system was given in [39].

3. One may enlarge the class of models to allow non-set-theoretic ones. The class of Kripke lambda models, introduced in [42], is a convenient such class, and for it, the rules in Table 5.2 are sound and complete.

Each of the three classes of models can be described in terms of Henkin representations, and the completeness theorems in each of the three cases can be derived from the three respective Henkin representation theorems of Section 5.1.4.

5.3.2 A categorical analysis of the rule (non-empty)

We have already remarked that in a set-theoretic model, the rule (non-empty)is sound for a type σ if [[σ]]^{I} is non-empty. More generally, if I : \underline{λ} → C is a non-strict interpretation of the simply-typed lambda calculus, and if [[σ]]^{I} is an object such that [[σ]]^{I} ↠ 1 is epic, then the rule (non-empty)is sound for σ with respect to I. Because if x ∉ FV(M, N), and if [[x:σ, Γ ⊳ M : τ]]^{I} = [[x:σ, Γ ⊳ N : τ]]^{I}, then, using Lemma 5.18,

[figure: [[σ]]^{I} × [[Γ]]^{I}; π′; [[Γ]]^{I}; [[Γ⊳M:τ]]^{I}; [[Γ⊳N:τ]]^{I}; [[τ]]^{I},]

and hence I ⊧ Γ ⊳ M = N : τ. Conversely, assume that (non-empty)is sound for σ in some theory T . Then [[σ]]^{I_{0}} ↠ 1 is epic in the ccc 𝔉_{ccc}(T ), for the canonical interpretation I_{0}.

5.3.3 Set-theoretic models with non-empty types

Fix a simply-typed signature. By a set-theoretic model with non-empty types of the simply-typed lambda calculus, we mean a non-strict interpretation I : \underline{λ} → 𝒮^{+}. We write E ⊧_{𝒮^{+}}^{non-strict} E for semantic consequence with respect to that class of models. We write E ⊢_{s}^{non-empty} E if E can be derived from the equations E by the usual simply-typed lambda calculus rules, together with the rule (non-empty).

Theorem 5.25. Soundness and Completeness for non-strict interpretations in 𝒮^{+}. The rule (non-empty) is sound for non-strict interpretations in 𝒮^{+}. Moreover, any theory that is closed under (non-empty)arises from such an interpretation. As a consequence,

E ⊧_{𝒮^{+}}^{non-strict} E if and only if E ⊢_{s}^{non-empty} E.

Proof. Soundness: It follows from the remarks in Section 5.3.2 that the rule (non-empty) is sound for ⊧_{𝒮^{+}}^{non-strict}.

Completeness: Assume E ⊧_{𝒮^{+}}^{non-strict} E. Let T be the theory generated by E and (non-empty). We need to show E ∈ T . Let I_{0} : T → 𝔉_{ccc}(T ) be the canonical interpretation. Then A ↠ 1 for all objects of 𝔉_{ccc}(T ), hence there is a Henkin embedding H : 𝔉_{ccc}(T ) → 𝒮^{+} by Henkin Representation Theorem 5.9. Let I = H ∘ I_{0} : T → 𝒮^{+}. Then Th(I) = Th(I_{0}) = T , hence I ⊧ E ⇒ I ⊧ E ⇒ E ∈ T . □

5.3.4 Set-theoretic models with empty types

For reasoning about possibly empty types, we use the extended proof system of Meyer et al. [39]. Fix a simply-typed signature. An emptiness assertion is an expression e(τ), where τ is a type. We use the letter Δ to denote a sequence of emptiness assertions, and we write Δ ⊆ Δ′ if Δ is contained in Δ′ as a set. An Table 5.3: Rules for the simply-typed lambda calculus with emptiness assertions

(empty)  \overline{Δ, e(σ), x:σ, Γ ⊳ M = N : τ}
(cases) \frac{Δ, e(σ), Γ ⊳ M = N : τ  Δ, x:σ, Γ ⊳ M = N : τ}{Δ, Γ ⊳ M = N : τ}
(add-emp)  \frac{Δ, Γ ⊳ M = N : τ  Δ ⊆ Δ′}{Δ′, Γ ⊳ M = N : τ}

extended equation is an expression of the form Δ, Γ ⊳ M = N : τ, where Γ ⊳ M : τ and Γ ⊳ N : τ are valid typing judgments (note that no Δ appears in typing judgments). The intuitive meaning of an extended equation e(τ_{1}), …, e(τ_{k}), Γ ⊳ M = N : τ is: if τ_{1} through τ_{k} are empty, then Γ ⊳ M = N : τ holds. We freely use suggestive notation such as e(σ)⊳E to denote an extended equation whose left-hand side contains an emptiness assertion e(σ), and x:σ ⊳ E to denote an extended equation whose left-hand side contains a type assertion x:σ, where E may contain other emptiness or type assertions.

We consider three special rules for extended equations, which are shown in Table 5.3. Notice that in the rule (cases), the variable x cannot be free in M, N. We write E ⊢_{s}^{ext} E for derivability using these rules, together with the equational rules of the simply-typed lambda calculus. Throughout this subsection, we will write E for an extended equation, and E for a set of extended equations. An extended theory is a set of extended equations that is closed under derivability. If T is an extended theory, then we write T^{∘} for its subset of equations, i.e. those extended equations of T that contain no emptiness assertions. T^{∘} is a theory, which we call the core of T .

Recall that a ccc C is special if for every object A, either A ↠ 1 is epic or A is partially initial. Let I : \underline{λ} → C be an interpretation of the simply-typed lambda calculus in a special ccc, and let E be an extended equation, say, e(τ_{1}), …, e(τ_{k}), Γ ⊳ M = N : τ. We say that I satisfies E, in symbols I ⊧ E, if

[[τ_{1}]]^{I}, …, [[τ_{k}]]^{I} partially initial  ⇒  [[Γ ⊳ M : τ]]^{I} = [[Γ ⊳ N : τ]]^{I}.

If M is a class of special ccc’s, we write E ⊧_{M} E, respectively E ⊧_{M}^{non-strict} E, if I ⊧ E implies I ⊧ E for all strict, respectively non-strict, interpretations I in a ccc in M.

Definition 5.26. An extended theory T is called principal if for each type σ, either T contains all extended equations of the form x:σ ⊳ E′, or it contains all extended equations of the form e(σ) ⊳ E′.

Proposition 5.27. The correspondence between principal extended theories and special ccc’s.

1. Let I : \underline{λ} → C be a strict or non-strict interpretation of the simply-typed lambda calculus in a special ccc. Then the set T = {E | I ⊧ E} is a principal extended theory.

2. Conversely, every principal extended theory arises in this way from some strict interpretation I.

Proof. 1.: First, we need to check that T is indeed an extended theory. It is easily checked that the rules (empty), (cases) and (add-emp) are sound with respect to any interpretation I in a special ccc C. For (cases), one uses the fact that C is special: the conclusion follows from the first premise if [[σ]]^{I} is partially initial, and from the second premise if [[σ]]^{I} ↠ 1. The fact that T is principal follows directly from the definition of I ⊧ E: consider any type σ. If [[σ]]^{I} is partially initial, then T contains all extended equations of the form x:σ ⊳ E′. If [[σ]]^{I} is not partially initial, then T (trivially) contains all extended equations of the form e(σ) ⊳ E′.

2.: Let T be a principal extended theory. Let T^{∘} be the core of T , i.e.the subset of those extended equations of T that contain no emptiness assertions. Let C = 𝔉_{ccc}(T^{∘}) be the cartesian-closed category associated to the theory T^{∘}, and let I_{0} : T^{∘} → C be the canonical interpretation. We show that C is a special ccc. Consider any object σ. If T contains all extended equations of the form x:σ ⊳ E′, then [[σ]]^{I_{0}} is partially initial. Otherwise, T contains all extended equations of the form e(σ) ⊳ E′. Therefore, the first premise of (cases) always holds for the type σ, and hence the rule (add-emp) is sound for T at type sigma. By the remarks in Section 5.3.2 this means that [[σ]]^{I_{0}} ↠ 1. Therefore C is special.

We now claim that T ⊧ E iff I_{0} ⊧ E, for any extended equation E. Let E be e(τ_{1}), …, e(τ_{k}) ⊳ E_{0}, where E_{0} is an equation, i.e.E_{0} contains no more emptiness assertions.

First, assume T ⊧ E. Assume that [[τ_{1}]]^{I_{0}}, …, [[τ_{k}]]^{I_{0}} are partially initial in C. Under this hypothesis, we need to show I_{0} ⊧ E_{0}. Since C is the ccc associated to the theory T^{∘}, this implies that T^{∘} ⊢ x_{i}:τ_{i} ⊳ E_{0} for i = 1 … k. With E, by repeated application of the rules (cases) and (add-emp), one gets T ⊢_{s}^{ext} E_{0}. Since E_{0} is a (non-extended) equation, it must be in the core, i.e.T^{∘} ⊢_{s}^{ext} E_{0}, hence I_{0} ⊧ E_{0}.

Conversely, assume that T |̸= E. We claim that I_{0} |̸= E. Since T is a principal extended theory and T ⊬_{s}^{ext} E, it must be the case that T contains all extended equations of the form x:τ_{j}⊳E′, for each j = 1 … k. Therefore, each [[τ_{j}]]^{I_{0}} is partially initial in C. Also, from T ⊬_{s}^{ext} E, by (add-emp) one has T ⊬_{s}^{ext} E_{0}, hence I_{0} |̸= E_{0}. This shows that I_{0} |̸= E. □

The proof of the completeness result for set-theoretic models rests on the following lemma, which implies that any extended theory is an intersection of principal ones:

Lemma 5.28. Maximal extended theories are principal. Let E be an extended equation and let T be a maximal extended theory such that T ⊬_{s}^{ext} E. Then T is principal.

Proof. Consider the following two hypothetical arguments:

1.: If there is some extended equation x:σ⊳E′ that is not in T , then, by maximality, T ∪{x:σ⊳E′} ⊢_{s}^{ext} E. Consider any derivation of E from T ∪ {x:σ ⊳ E′}. Alter this derivation by adding an emptiness assertion e(σ) to each extended equation throughout. An inspection of the proof rules in Tables 5.2 and 5.3 shows that this alteration yields a valid derivation of e(σ)⊳T ∪{e(σ), x:σ ⊳E′} ⊢_{s}^{ext} e(σ)⊳E, where e(σ)⊳T denotes the set of equations {e(σ) ⊳ E′′ | E′′ ∈ T }. Applying the rules (add-emp) and (empty)at the leaves, one gets T ⊢_{s}^{ext} e(σ) ⊳ E. 2.: If there is some extended equation e(σ) ⊳ E′ that is not in T , then, by the same reasoning as in 1., T ⊢_{s}^{ext} x:σ ⊳ E.

Now observe that cases 1. and 2. cannot happen simultaneously, since otherwise T ⊢_{s}^{ext} E by (cases). It follows that T is principal. □

Theorem 5.29. Soundness and Completeness for special ccc’s. Let CCC_{spec} be the class of special ccc’s. Then

E ⊧_{CCC_{spec}} E iff E ⊧_{CCC_{spec}}^{non-strict} E iff E ⊢_{s}^{ext} E.

Proof. Soundness is an immediate consequence of the first part of Proposition 5.27. For completeness, assume E ⊬_{s}^{ext} E. Let T be a maximal extended theory containing E such that T ⊬_{s}^{ext} E. T is principal by Lemma 5.28. By the second part of Proposition 5.27, it follows that T is the extended theory of some strict interpretation I : \underline{λ} → C. Hence I ⊧ E but I |̸= E, which implies E |̸=_{CCC_{spec}} E. □

Soundness and completeness for set-theoretic models now follows by applying the Henkin Representation Theorem 5.11. We write ⊧_{𝒮}^{non-strict} for semantic consequence for extended equations with respect to settheoretic models.

Theorem 5.30. Soundness and Completeness for non-strict interpretations in 𝒮.

E ⊧_{𝒮}^{non-strict} E if and only if E ⊢_{s}^{ext} E.

Proof. Soundness is a special case of Theorem 5.29. For completeness, suppose E ⊬_{s}^{ext} E. By Theorem 5.29, there is a special ccc C and a strict interpretation I_{0} : \underline{λ} → C such that I_{0} ⊧ E but I_{0} |̸= E. By Theorem 5.11, there is a Henkin embedding H : C → 𝒮. Let I = H ∘ I_{0} : \underline{λ} → 𝒮. It follows from Remark 5.1.4 that I validates the same extended equations as I_{0}. □

5.3.5 Kripke lambda models

By a Kripke lambda model, we mean a a non-strict interpretation I : \underline{λ} → 𝒮^{P} in a presheaf category over some poset P. We write E ⊧_{Kripke}^{non-strict} E for semantic consequence in the class of Kripke lambda models.

Theorem 5.31. Soundness and Completeness for non-strict interpretations in 𝒮^{P}. Each simply-typed lambda theory arises from some non-strict interpretation in a presheaf category 𝒮^{P} over some poset P. As a consequence,

E ⊧_{Kripke}^{non-strict} E if and only if E ⊢_{s} E.

Proof. Soundness is a special case of Proposition 5.24. Completeness is an immediate consequence of Theorem 5.14. □

5.3.6 A remark on the principal model property

The class of set-theoretic models with non-empty types and the class of Kripke lambda models each have the principal model property: any lambda theory that arises from the class actually arises as the theory of a single model. However, the principal model property does not hold for interpretations in 𝒮. Indeed, among the extended theories, the ones that arise from a single model are the principal ones in the sense of Definition 5.26—but not all theories are principal.

The reason for the failure of the principal model property lies with the categorical properties of 𝒮. Unlike the category of non-empty sets, the category of sets does not embed its own discrete powers. Notice that any discrete power (𝒮^{+})^{I} of the category of non-empty sets has enough points to be Henkin-embedded in 𝒮^{+} via the point functor Γ = (1, −). As a consequence, a ccc C can be Henkin-embedded in (𝒮^{+})^{I} if and only if it can be Henkin-embedded in 𝒮^{+}, and a lambda theory arises as the theory of a family of models with non-empty types if and only if it arises as the theory of a single such model. A similar property holds for the class of Kripke lambda models, because any discrete power of a presheaf category 𝒮^{P} is again of this form.

What the proofs of Theorems 5.29 and 5.30 really show about set-theoretic models is that any extended theory is the theory of some interpretation in a discrete power 𝒮^{I} of the category of sets. The proof is indirect, by first showing that any extended theory is an intersection of principal (namely, maximal) ones. In the process, the categorical meaning of the extended equations gets lost. Is it possible to give a more direct proof in the spirit of categorical logic, via a construction of a category directly from an extended theory? This would be the ultimate form of Theorem 5.30. Presumably such a proof would require a categorical characterization of those ccc’s that can be Henkin-embedded in 𝒮^{I}. Unfortunately, the characterization given in Corollary 5.13 is not very elegant, and a more satisfactory Henkin Representation Theorem for the class 𝒮^{I} is not known.

5.4 Henkin representations of PL-categories

5.4.1 PL-categories

Let U : CCC → Cat and |−| : CCC → 𝒮 be the forgetful functors that map a small ccc to its underlying category and to its set of objects, respectively.

Definition. A PL-category B = ⟨B, Ω, F, γ, ∀, η⟩ consists of

1. a small base category B with finite products and a distinguished object Ω,

2. a contravariant fiber functor F : B^{op} → CCC, together with a natural isomorphism

γ : (V, Ω) ⟶^{∼}_{V} |F_{V} |,

3. a natural transformation ∀ : U(F_{V ×Ω}) →_{V} U(F_{V}), together with a natural isomorphism

η : (F_{π_{V}} C, D)_{V ×Ω} ⟶^{∼}_{V,C,D} (C, ∀_{V} D)_{V} .

We sometimes write a PL-category as ⟨B, F, ∀⟩ if the remaining parts of the structure are understood.

Remarks. We assume that the finite products of the base category are chosen. We use the letters V, W, … for objects of B. The fiber functor F maps an object V to a cartesian-closed category F_{V}, called the fiber at V . We also call F_{Ω^{n}} the n-fiber, and in particular, F_{1} is called the 0-fiber. We use the letters C, D, … for objects and f, g, … for morphisms of the fibers, and we denote hom-sets of F_{V} by (C, D)_{V}. Each morphism of the base φ : V → W gives rise to a ccc-representation of fibers F_{φ} : F_{W} → F_{V}. For an object V ∈ B, let π_{V} : V × Ω → V be the first projection. The resulting functor F_{π_{V}} : F_{V} → F_{V ×Ω} is called the dummy functor at V , and we denote it by Δ_{V}. Notice that Δ_{V}, like π_{V}, is natural in V. Each Δ_{V} has a right adjoint ∀_{V} : F_{V ×Ω} → F_{V}. Notice that ∀_{V} is not assumed to be a ccc-representation. Both the functor ∀_{V} and the adjunction η_{V} : Δ_{V} ⊣ ∀_{V} are assumed to be natural in V. The naturality of η in V means that for all C ∈ F_{W} and D ∈ F_{W ×Ω} and for all φ : V → W,

\xymatrix{(Δ_{W} C, D)_{W ×Ω} \ar[d]_{F_{φ×Ω}} \ar[r]^{η_{W,C,D}}_{∼} & (C, ∀_{W} D)_{W} \ar[d]^{F_{φ}} \\ (Δ_{V} C′, D′)_{V ×Ω} \ar[r]_{η_{V,C′,D′}}^{∼} & (C′, ∀_{V} D′)_{V} ,}  (5.4)

where C′ = F_{φ}C and D′ = F_{φ×Ω}D. In the literature on hyperdoctrines and universal quantification [55, 15], the condition that ∀ is natural in V is sometimes relaxed: one only requires that F_{φ}∀_{W} and ∀_{V} F_{φ×Ω} are naturally isomorphic as functors F_{W ×Ω} → F_{V}. In this case, condition (5.4) is replaced by the so-called Beck-Chevalley condition. In our setting, the Beck-Chevalley condition and (5.4) are equivalent.

The adjunction Δ_{V} ⊣ ∀_{V} can be described concretely in terms of its co-unit Δ_{V} ∀_{V} D ⟶^{θ_{V,D}} D by the following property: for every object C ∈ F_{V} and every morphism g : Δ_{V} C → D, there exists a unique h = η_{V} g : C → ∀_{V} D such that

\xymatrix{Δ_{V} ∀_{V} D \ar[r]^{θ_{V,D}} & D \\ Δ_{V} C. \ar[u]^{Δ_{V} h} \ar[ur]_{g}}

In analogy to product diagrams and exponential diagrams (see Section 1.1.6), we call a diagram of the form Δ_{V} E ⟶^{f} D with the above universal property a ∀-diagram. Condition (5.4) is equivalent to the requirement that F_{φ} preserves ∀-diagrams, i.e.F_{φ}θ_{W,D} = θ_{V,F_{φ}D} for all φ : V → W and D ∈ F_{W ×Ω}.

Definition. Let B = ⟨B, Ω, F, γ, ∀, η⟩ and B′ = ⟨B′, Ω′, F′, γ′, ∀′, η′⟩ be PL-categories. A PL-repre-sentation ⟨B, G⟩ : B → B′ is a finite product preserving functor B : B → B′ together with a natural transformation G : F → F′ ∘ B, such that BΩ = Ω′ and for all V ∈ B, C ∈ F_{V}, and D ∈ F_{V ×Ω}:

\xymatrix{B(V, Ω) \ar[r]^{γ_{V}}_{∼} \ar[d]_{B} & |F_{V} | \ar[d]^{|G_{V} |} & F_{V ×Ω} \ar[r]^{∀_{V}} \ar[d]_{G_{V ×Ω}} & F_{V} \ar[d]^{G_{V}} & (Δ_{V} C, D)_{V ×Ω} \ar[r]^{η_{V,C,D}}_{∼} \ar[d]_{G_{V ×Ω}} & (C, ∀_{V} D)_{V} \ar[d]^{G_{V}} \\ B′(BV, Ω′) \ar[r]_{γ′_{BV}}^{∼} & |F′_{BV} |, & F′_{BV ×Ω′} \ar[r]_{∀′_{BV}} & F′_{BV} , & (Δ′_{BV} C′, D′)_{BV ×Ω′} \ar[r]_{η′_{BV,C′,D′}}^{∼} & (C′, ∀_{BV} D′)_{BV} ,}

where C′ = G_{V} C and D′ = G_{V ×Ω}D. The condition that G preserves η can be equivalently expressed in terms of ∀-diagrams by requiring G_{V ×Ω}(θ_{V,D}) = θ′_{BV,D′}.

Notice that G is a natural transformation of functors B → CCC; in particular, each G_{V} : F_{V} → F′_{BV} is a ccc-representation.

Small PL-categories and PL-representations form a category, which we denote by PL.

We will now consider a notion of congruence relation on a PL-category. We are only concerned about congruences on the morphisms of the fibers, and not on the morphisms or objects of the base.

Definition. A PL-congruence ∼ on a PL-category B is given by a family of equivalence relations on the hom-set of the fibers, i.e., an equivalence relation ∼_{V,C,D} on (C, D)_{V} for each V ∈ B and C, D ∈ F_{V}, such that for each V, ∼_{V} is a ccc-congruence on F_{V} (see Definition 5.1), and in addition:

\frac{f ∼_{V ×Ω,Δ_{V} C,D} f′}{η_{V} f ∼_{V,C,∀_{V} D} η_{V} f′}

If ⟨B, G⟩ : B → B′ is a PL-representation, then its kernel is a PL-congruence on B, defined by f ∼_{V,C,D} g iff G_{V} f = G_{V} g, for all f, g ∈ (C, D)_{V}.

Conversely, let ∼ be a PL-congruence on B. One can define the quotient B/∼ by taking the quotient (C, D)_{V} /∼_{V,C,D} at each hom-set of the fibers; one checks that this is a well-defined PL-category with the same base category as B.

5.4.2 Henkin-PL-representations

A pre-structure P = ⟨P, M⟩ consists of a base category P with finite products and a contravariant functor M : P^{op} → CCC. For any pair of objects V, W ∈ P, we consider the first projection π_{V,W} : V × W → V, and the associated functor M_{π_{V,W}} : M_{V} → M_{V ×W}, which we again call the dummy functor, and which we

denote by Δ_{V,W}. We say that a diagram Δ_{V,W} C ⟶^{f} D in M_{V ×W} is a partial ∀-diagram if for every object C′ ∈ M_{V} and every morphism g : Δ_{V,W} C′ → D, there exists at most one h : C′ → C such that

\xymatrix{Δ_{V,W} C \ar[r]^{f} & D \\ Δ_{V,W} C′. \ar[u]^{Δ_{V,W} h} \ar[ur]_{g}}

A Henkin natural transformation between functors F, G : B → CCC is a natural transformation H : UF → UG such that for each V ∈ B, H_{V} is a Henkin representation of ccc’s.

Analogous to Henkin representations of cartesian-closed categories, we can now define Henkin representations of PL-categories:

Definition. Let B = ⟨B, Ω, F, γ, ∀, η⟩ be a PL-category and P = ⟨P, M⟩ be a pre-structure. A Henkin-PL-representation⟨B, H⟩ : B → P is a finite product preserving functor B : B → P together with a Henkin natural transformation H : UF → UM ∘ B, such that for all V ∈ B and D ∈ F_{V ×Ω},

Δ_{BV,BΩ}(H_{V} ∀_{V} D) = H_{V ×Ω}Δ_{V} ∀_{V} D ⟶^{H_{V ×Ω}θ_{V,D}} H_{V ×Ω}D

is a partial ∀-diagram. Notice that, by naturality of H,

\xymatrix{F_{V} \ar[r]^{H_{V}} \ar[d]_{Δ_{V} =F_{π_{V}}} & M_{BV} \ar[d]^{Δ_{BV,BΩ}=M_{Bπ_{V}}} \\ F_{V ×Ω} \ar[r]_{H_{V ×Ω}} & M_{BV ×BΩ}.}

Lemma 5.32. The kernel of a Henkin-PL-representation ⟨B, H⟩ : B → P, defined for all f, g ∈ (C, D)_{V} by f ∼_{V,C,D} g iff H_{V} f = H_{V} g, is a PL-congruence on B.

Proof. For each V ∈ B, H_{V} : F_{V} → M_{BV} is a Henkin representation of ccc’s, and hence ∼_{V} is a ccccongruence on F_{V} by Lemma 5.2. It remains to be seen that for C ∈ F V and D ∈ F V × Ω, f ∼_{V ×Ω,Δ_{V} C,D} f′ implies η_{V} f ∼_{V,C,∀_{V} D} η_{V} f′. Suppose f, f′ ∈ (Δ_{V} C, D)_{V ×Ω} with H_{V ×Ω}f = H_{V ×Ω}f′. One has

\xymatrix{Δ_{V} ∀_{V} D \ar[r]^{θ_{V,D}} & D \\ Δ_{V} C \ar[u]^{Δ_{V} η_{V} f} \ar[ur]_{f}} ⇒ [figure: Δ_{BV,BΩ}H_{V} ∀_{V} D; H_{V ×Ω}Δ_{V} ∀_{V} D; H_{V ×Ω}θ_{V,D}; H_{V ×Ω}D; Δ_{BV,BΩ}H_{V} C; Δ_{BV,BΩ}H_{V} η_{V} f; H_{V ×Ω}Δ_{V} C.; H_{V ×Ω}Δ_{V} η_{V} f; H_{V ×Ω}f]

The top row is a partial ∀-diagram, hence the arrow H_{V} η_{V} f is uniquely determined by H_{V ×Ω}f. Since there is an identical diagram for f′, and since H_{V ×Ω}f = H_{V ×Ω}f′ by assumption, one has H_{V} η_{V} f = H_{V} η_{V} f′.□

Definition. We say that a Henkin-PL-representation ⟨B, H⟩ is a Henkin-PL-embedding if its kernel is the trivial congruence, i.e. if H_{V} is a Henkin embedding for each V. Notice that we do not require B to be an embedding of the base; it seems unnecessary to do so since we are only concerned with equality in the fibers.

5.4.3 Standard structures

Consider a cartesian-closed category D. Let D̃ be the pre-structure ⟨𝒮 , M⟩, where the base category is the category of sets, and the functor M : 𝒮 → CCC maps a set X to D^{X}, the X-fold power of D. We call this pre-structure the standard structure over D.

For a ccc, we considered the point functor Γ : C → 𝒮. We now consider an analogue to this functor for PL-categories. Consider a PL-category B = ⟨B, Ω, F, γ, ∀, η⟩, together with a functor H^{0} : F_{1} → D. We define Γ_{H^{0}} = ⟨B, H⟩, where B : B → 𝒮 is the point functor of the base category, mapping V to the hom-set B(1, V), and H : F_{V} →_{V} M_{BV} = D^{BV} is the natural transformation defined on objects by H_{V} C(x) = H^{0}(F_{x}C), where C ∈ F_{V} and x ∈ BV = (1, V). The following proposition gives a sufficient condition for ⟨B, H⟩ to be Henkin-PL-embedding.

Proposition 5.33. The pair ⟨B, H⟩ is a Henkin-PL-embedding B → D̃ if the following hold:

1. H^{0} is a Henkin embedding,

2. H^{0} preserves monic cones, and

3. the functors F_{x} : F_{V} → F_{1}, where x : 1 → V, form a collective embedding for each V ∈ B.

Proof. Clearly B preserves products and H is natural. What remains to be shown is that each H_{V} is a Henkin embedding, and that the condition on ∀-diagrams is satisfied. First, notice that H_{V} : F_{V} → C^{BV} factors as

\xymatrix{F_{V} \ar[d]_{(F_{x})_{x∈BV}} \ar[dr]^{H_{V}} \\ F_{1}^{BV} \ar[r]_{(H^{0})^{BV}} & C^{BV} .}

Clearly, (F_{x})_{x∈BV} is a ccc representation; by assumption 3, it is also an embedding. Assumption 1 implies that (H^{0})^{BV} is a Henkin embedding, hence H_{V} is a Henkin embedding for every V. Now suppose

Δ_{V} ∀_{V} D ⟶^{θ_{V,D}} D is a ∀-diagram in B. We need to show that

Δ_{BV,BΩ}(H_{V} ∀_{V} D) = H_{V ×Ω}Δ_{V} ∀_{V} D ⟶^{H_{V ×Ω}θ_{V,D}} H_{V ×Ω}D

is a partial ∀-diagram. Unraveling the definitions, this amounts to showing that for each y ∈ BV, the collection of morphisms

(H^{0}∀_{1}C ⟶^{H^{0}F_{z}θ_{1,C}} H^{0}F_{z}C)_{z:1→Ω}

is collectively monic, where C = F_{y×Ω}D. Since H^{0} preserves monic cones by assumption 2, it suffices to show that for every C ∈ F_{Ω}, the family

(∀_{1}C ⟶^{F_{z}θ_{1,C}} F_{z}C)_{z:1→Ω}

is collectively monic. Let f ≠ g : A → ∀_{1}C. Then η^{−1}f ≠ η^{−1}g : Δ_{1}A → C. By assumption 3, there is z : 1 ∈ Ω with F_{z}η^{−1}f ≠ F_{z}η^{−1}g, i.e. F_{z}(θ_{1,C} ∘ Δ_{1}f) ≠ F_{z}(θ_{1,C} ∘ Δ_{1}g). But F_{z}Δ_{1} = id_{F_{1}}, hence (F_{z}θ_{1,C}) ∘ f ≠ (F_{z}θ_{1,C}) ∘ g, which proves the claim. □

5.4.4 Freely adjoining arrows to the base of a PL-category

Given a PL-category B = ⟨B, Ω, F, γ, ∀, η⟩, we may freely adjoin an arrow x : 1 → U to the base as follows: Let B′ be the Kleisli category of the comonad T (V) = U × V, i.e. B′ has the same objects as B and B′(V, W) = B(U × V, W) (compare Section 5.1.3). Define F′ : B′^{op} → CCC by F′_{V} = F_{U×V}; this is natural in V. Define Ω′ = Ω, γ′_{V} = γ_{U×V}, ∀′_{V} = ∀_{U×V}, and η′_{V,C,D} = η_{U×V,C,D}. It is trivial to check that B′ = ⟨B′, Ω′, F′, γ′, ∀′, η′⟩ is indeed a PL-category; for instance ∀′_{V} = ∀_{U×V} : F_{U×V ×Ω} → F_{U×V} is indeed right adjoint to Δ′_{V} = Δ_{U×V} : F_{U×V} → F_{U×V ×Ω}. Let ȷ = ⟨B_{0}, G_{0}⟩ : B → B′ be the natural PL-representation, defined by B_{0}φ = φ ∘ π′ and (G_{0})_{V} = Δ_{V} : F_{V} → F′_{V} = F_{U×V}. Let x ∈ B′(1, U) be id ∈ B(U, U). We write B′ as B[1⟶^{x}U], which is justified by its universal property:

Proposition 5.34. B[1⟶^{x}U] has the following universal property: for any PL-representation ⟨B, G⟩ : B → D and any arrow ψ : 1 → BU in D, there is a unique PL-representation ⟨B̂, Ĝ⟩ : B[1⟶^{x}U] → D such that

\xymatrix{B \ar[r]^{ȷ} \ar[dr]_{⟨B,G⟩} & B[1⟶^{x}U] \ar[d]^{⟨B̂,Ĝ⟩} \\  & D}

and B̂x = ψ.

Proof. Let B′ map an object V to BV and a morphism φ ∈ B′(V, W) = B(U × V, W) to BV ⟶^{ψ×id}

BU × BV ⟶^{Bφ} BW. Define G′_{V} by

[figure: F′_{V}; G′_{V}; D_{BV} .; F_{U×V}; G_{U×V}; D_{BU×BV}; D_{ψ×id}]

It is readily checked that this is the unique PL-representation with the desired properties. □

Lemma 5.35. The canonical PL-representation ȷ : B → B[1⟶^{x}Ω] is a PL-embedding.

Proof. In B, there is always a point ψ : 1 ∈ Ω, for instance γ^{−1}1. The unique extension B[1⟶^{x}Ω] → B of the identity that sends x to ψ is a left inverse to ȷ. □

Proposition 5.36. Any PL-category B can be PL-embedded in a PL-category B′ such that the functors F′_{z} : F′_{Ω^{n}} → F′_{1}, where z : 1 → Ω^{n}, form a collective embedding for each n.

Proof. To B, adjoin countably many arrows 1 → Ω by constructing a sequence B = B_{0} ⟶^{ȷ_{0}} B_{1} ⟶^{ȷ_{1}} ⋯ of PL-categories, where B_{i+1} = B_{i}[1⟶^{x_{i}}Ω] and ȷ_{i} is the canonical embedding. Notice that the n-fiber of B_{i} is the n + i-fiber of B. Let B′ be the colimit of this sequence, i.e.the objects of the base are the same as for each B_{i}, and the hom-sets of the base and objects and hom-sets of the fibers are constructed as the directed unions of the respective parts of the B_{i}. It is easily checked that B′ is a PL-category with a canonical PL-embedding ȷ : B → B′. To show that the functors F′_{z} : F′_{Ω^{n}} → F′_{1} form a collective embedding, it suffices to show that for every V, the functors F′_{V ×x} : F′_{V ×Ω} → F′_{V} form a collective embedding, where x : 1 → Ω. Consider two morphisms f ≠ g : C → D in F′_{V ×Ω}. Then C, D, f, and g already exist in some B_{i}. Consider x_{i} : 1 → Ω in B_{i+1}. Writing F^{i} for the fiber functor of B_{i}, one has

\xymatrix{F_{V ×Ω}^{i} \ar[dr]^{id} \ar@{^{(}->}[d]_{ȷ_{i}} \\ F_{V ×Ω}^{i+1} \ar[r]_{F_{V ×x_{i}}^{i+1}} & F_{V}^{i+1},}

hence F_{V ×x_{i}}^{i+1}ȷ_{i}f ≠ F_{V ×x_{i}}^{i+1}ȷ_{i}g, which implies F′_{V ×x_{i}}f ≠ F′V × x_{i}g. □

5.4.5 Henkin-PL-representation theorems

Henkin-PL-representations in 𝒮̃^{+}

Lemma 5.37. If the 0-fiber of a PL-category has the property that A ↠ 1 for every object A, then the same is true for any n-fiber.

Proof. Let ∀_{n} : F_{Ω^{n}} → F_{1} be the right adjoint of the canonical functor Δ_{n} = F : F_{1} → F_{Ω^{n}}. Let C, D be objects of F_{Ω^{n}} and consider f, g : 1 → D such that

[figure: C; 1; f; g; D]

⇒ [figure: ∀_{n}C; 1 = ∀_{n}1; ∀_{n}f; ∀_{n}g; ∀_{n}D]

⇒  [figure: Δ_{n}∀_{n}1; 1; f; g; D.]

But both Δ_{n} and ∀_{n} preserve terminators, hence Δ_{n}∀_{n}1 = 1 and f = g. □

Theorem 5.38. Let B be a PL-category whose base is generated by Ω. Then B can be Henkin-PL-embedded in 𝒮̃^{+}, the standard structure over 𝒮^{+}, if and only if for every object A of the 0-fiber, the morphism A ↠ 1 is epic.

Proof. ⇒: Trivial, because a Henkin-PL-embedding B → 𝒮̃^{+} gives rise to a Henkin embedding F_{1} → 𝒮^{+}, and embeddings reflect epics.

⇐: By Lemma 5.37, C ↠ 1 holds for all objects of all fibers. By Proposition 5.36, B can be embedded in a PL-category B′ such that the functors F′_{z} : F′_{V} → F′_{1} form a collective embedding, for every V ∈ B. Note that in the sequence of PL-categories (B_{i})_{i} constructed in the proof of Proposition 5.36, the 0-fiber of B_{i} is the n-fiber of B. Hence, C ↠ 1 holds for all objects of F_{1}^{i}, and therefore for all objects of F′_{1} as well. By Theorem 5.9, there is a Henkin embedding H^{0} : F′_{1} ⟶^{F_{A}} D ⟶^{Γ} 𝒮^{+}. By Lemma 5.6, F_{A} preserves monic cones, and so does the point functor Γ. Therefore, Proposition 5.33 is applicable and we obtain a Henkin-PL-embedding B′ → 𝒮̃^{+}. □

Henkin-PL-representations in 𝒮̃^{P}

Theorem 5.39. Any PL-category B can be Henkin-PL-embedded in 𝒮̃^{P}, for some poset P.

Table 5.4: Typing rules for the polymorphic lambda calculus

(typeapp)  \frac{Γ ⊳ M : ∀α.τ}{Γ ⊳ Mσ : τ[σ/α]}
(typeabs) \frac{Γ ⊳ M : τ  α ∉ FTV(Γ)}{Γ ⊳ Λα.M : ∀α.τ}

Table 5.5: Equational rules for the polymorphic lambda calculus

(cong_{6})  \frac{Γ ⊳ M = M′ : ∀α.τ}{Γ ⊳ Mσ = M′σ : τ}
(cong_{7}) \frac{Γ ⊳ M = M′ : τ  α ∉ FTV(Γ)}{Γ ⊳ Λα.M = Λα.M′ : ∀α.τ}

(B) \overline{Γ ⊳ (Λα.M)σ = M[σ/α] : τ}_{(H) \frac{α ∉ FTV(M)}{Γ ⊳ Λα.(Mα) = M : ∀α.τ}}

Proof. By Proposition 5.36, B can be embedded in a PL-category B′ such that the functors F′_{z} : F′_{V} → F′_{1} form a collective embedding, for every V ∈ B. By Theorem 5.14, there is a Henkin embedding H^{0} : F′_{1} → 𝒮^{P}, for some poset P, such that H^{0} preserves monic cones. With Proposition 5.33, one obtains a Henkin-PL-embedding of B′ in 𝒮̃^{P}. □

5.5 The interpretation of the polymorphic lambda calculus

5.5.1 The polymorphic lambda calculus

The polymorphic lambda calculus was independently introduced by Girard [22] and Reynolds [51]. Here, we describe a version of the second order lambda calculus with surjective pairing and a unit type.

Let T V be an infinite set of type variables α, β, …, and let T C be a set of type constants t, u, . . .. Polymorphic types σ, τ, … are given by the grammar:

σ ::= α t 1 σ × τ σ → τ ∀α.σ.

Let V be an infinite set of individual variables x, y, . . .. For each closed type σ, let C_{σ} be a set of individual constants c^{σ}, d^{σ}, . . .. The collection ⟨T C, (C_{σ})_{σ}⟩ is also called a polymorphic signature. Raw polymorphic lambda terms M, N, … are given by the grammar:

M ::= x c^{σ} ∗ ⟨M, N⟩ π_{1}M π_{2}M MN λx:σ.M Mσ Λα.M.

As usual, the individual variable x is bound in the term λx:σ.M. Moreover, the type variable α is bound in the term Λα.M and in the type ∀α.σ. All other occurrences of variables are free, and we write FV(M) for the free individual variables and FTV(M) for the free type variables of a term M, as well as FTV(σ) for the free type variables of a type σ. We identify types, as well as raw terms, up to renaming of bound variables. There are three kinds of substitution: substitution of types in types τ[σ/α], substitution of types in terms M[σ/α], and substitution of terms in terms M[N/x].

A type assignment Γ = x_{1}:σ_{1}, x_{2}:σ_{2}, …, x_{m}:σ_{m} is defined as for the simply-typed lambda calculus. We write FTV(Γ) = FTV(σ_{1}) ∪ … ∪ FTV(σ_{m}). The valid typing judgments Γ ⊳ M : σ of the polymorphic lambda calculus are derived by the rules in Tables 5.1 and 5.4. An equation is again an expression of the form Γ ⊳ M = N : σ, where Γ ⊳ M : σ and Γ ⊳ N : σ are valid typing judgments. If E is an equation and E is a set of equations, we write E ⊢_{p} E if E can be derived from E by the rules for the simply-typed lambda calculus in Table 5.2, together with the one for the polymorphic lambda calculus in Table 5.5. E is called a theory if it is closed under derivability. The smallest theory of the polymorphic lambda calculus (for a fixed polymorphic signature) is denoted by \underline{PL}.

5.5.2 Strict interpretation in a PL-category

Fix a polymorphic signature. A (strict) interpretation I of the polymorphic lambda calculus in a PL-category B, which we schematically write as I : \underline{PL} → B, consists of an interpretation of types and an interpretation of typing judgments, both relative to a sequence ᾱ = α_{1}, … alpha_{n} of type variables. A type σ with FTV(σ) ⊆ {ᾱ} is interpreted as an object [[σ]]I ; ᾱ of F_{Ω^{n}}. A valid typing judgment Γ ⊳ M : τ with FTV(Γ, M, τ) ⊆ {ᾱ} is interpreted as a morphism [[Γ ⊳ M : τ]]I ; ᾱ of F_{Ω^{n}}. Like for the simply-typed lambda calculus, an interpretation I is uniquely determined by its values on type constants and individual constants.

Let I : T C → |F_{1}| be an interpretation of type constants as objects of the 0-fiber. This extends uniquely to an interpretation [[σ]]_{α_{1},... ,α_{n}}^{I} of every type. Recall that γ is the natural isomorphism (V, Ω) ⟶^{∼}_{V} |F_{V} |, and that F : F_{1} → F_{Ω^{n}} is the ccc-representation induced by the unique morphism : Ω^{n} → 1. We assume that bound variables are renamed as necessary.

[[α_{i}]]I ; ᾱ = γ_{Ω^{n}}π_{i}, where π_{i} ∈ (Ω^{n}, Ω) is the ith projection
[[t]]I ; ᾱ = F I(t)
[[1]]I ; ᾱ = 1
[[σ × τ]]I ; ᾱ = [[σ]]I ; ᾱ × [[τ]]I ; ᾱ
[[σ → τ]]I ; ᾱ = ([[τ]]I ; ᾱ)^{[[σ]]I ; ᾱ}
[[∀α′.σ]]I ; ᾱ = ∀_{Ω^{n}}[[σ]]_{ᾱ,α′}^{I}

If C is any object of F_{V}, then it corresponds, via γ, to a morphism of the base φ : V → Ω. The morphism ⟨id_{V} , φ⟩ : V → V × Ω gives rise to a functor F_{⟨id_{V} ,φ⟩} : F_{V ×Ω} → F_{V}, which we denote by [C]_{V}. We call this functor the substitution functor.

Lemma 5.40. The following are properties of the interpretation of polymorphic types:

1. Permutation of Type Variables. The interpretation is independent of the ordering of the free type variables, or of the addition of dummy variables, in the following sense: If s : {1, …, k} → {1, …, n} is injective and FTV(τ) ⊆ {α_{s1}, …, α_{sk}}, then

[[τ]]_{α_{1},... ,α_{n}}^{I} = F_{⟨π_{s1},... ,π_{sk}⟩}[[τ]]_{α_{s1},... ,α_{sk}}^{I}.

In particular, if α′ ∉ FTV(σ), then [[σ]]_{ᾱ,α′}^{I} = Δ_{Ω^{n}}[[σ]]I ; ᾱ.

2. Type Substitution. For all types σ and τ with FTV(σ) ⊆ {ᾱ} and FTV(τ) ⊆ {ᾱ, α′},

[[τ[σ/α′]]]I ; ᾱ = [[[σ]]I ; ᾱ]_{Ω^{n}}[[τ]]_{ᾱ,α′}^{I}. □

Notice that [C]_{V} ∘Δ_{V} = F_{⟨id_{V} ,φ⟩} ∘F_{π_{V}} = id_{F_{V}}. Therefore, applying [C]_{V} to the co-unit θ_{V,D} : Δ_{V} ∀_{V} D → D yields a natural transformation inst_{V,C,D} : ∀_{V} D →_{D} [C]_{V} D, which will be useful for the interpretation of type application.

If Γ = x_{1}:σ_{1}, …, x_{m}:σ_{m} is a type assignment, we write [[Γ]]I ; ᾱ = [[σ_{1}]]I ; ᾱ × ⋯ × [[σ_{m}]]I ; ᾱ. Let I_{σ} : C_{σ} → (1, [[σ]]^{I})_{1} be an interpretation of term constants as morphisms of the 0-fiber, for each closed type σ. This extends uniquely to an interpretation [[Γ ⊳ M : τ]]I ; ᾱ of valid typing judgments:

[[Γ ⊳ x_{j} : σ_{j}]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{π_{j}} [[σ_{j}]]I ; ᾱ, the jth projection
[[Γ ⊳ c^{σ} : σ]]I ; ᾱ = [[Γ]]I ; ᾱ \underrightarrow{}1 ⟶^{F I_{σ}(c^{σ})} [[σ]]I ; ᾱ
[[Γ ⊳ ∗ : 1]]I ; ᾱ = [[Γ]]I ; ᾱ \underrightarrow{}1 = [[1]]I ; ᾱ
[[Γ ⊳ ⟨M, N⟩ : σ × τ]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{⟨[[Γ⊳M:σ]]I ; ᾱ,[[Γ⊳N:τ]]I ; ᾱ⟩} [[σ]]I ; ᾱ × [[τ]]I ; ᾱ = [[σ × τ]]I ; ᾱ
[[Γ ⊳ π_{1}M : σ]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{[[Γ⊳M:σ×τ]]I ; ᾱ} [[σ]]I ; ᾱ × [[τ]]I ; ᾱ ⟶^{π} [[σ]]I ; ᾱ
[[Γ ⊳ π_{2}M : τ]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{[[Γ⊳M:σ×τ]]I ; ᾱ} [[σ]]I ; ᾱ × [[τ]]I ; ᾱ ⟶^{π′} [[σ]]I ; ᾱ
[[Γ ⊳ MN : τ]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{⟨[[Γ⊳M:σ→τ]]I ; ᾱ,[[Γ⊳N:σ]]I ; ᾱ⟩} ([[τ]]I ; ᾱ)^{[[σ]]I ; ᾱ} × [[σ]]I ; ᾱ ⟶^{ε} [[τ]]I ; ᾱ
[[Γ ⊳ λx:σ.M : σ → τ]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{([[Γ,x:σ⊳M:τ]]I ; ᾱ) ^{⋆}} ([[τ]]I ; ᾱ)^{[[σ]]I ; ᾱ} = [[σ → τ]]I ; ᾱ
[[Γ ⊳ Mσ : τ[σ/α′]]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{[[Γ⊳M:∀α′.τ]]I ; ᾱ} ∀_{Ω^{n}}[[τ]]_{ᾱ,α′}^{I} ⟶^{inst} [[[σ]]I ; ᾱ]_{Ω^{n}}[[τ]]_{ᾱ,α′}^{I} = [[τ[σ/α′]]]I ; ᾱ
[[Γ ⊳ Λα′.M : ∀α′.τ]]I ; ᾱ = [[Γ]]I ; ᾱ ⟶^{η_{Ω^{n}} ([[M]]_{ᾱ,α′}^{I})} ∀_{Ω^{n}}[[τ]]_{ᾱ,α′}^{I} = [[∀α′.τ]]I ; ᾱ

Lemma 5.41. The interpretation of the polymorphic lambda calculus in a PL-category, defined inductively as above, has the expected properties:

1. Permutation of Type Variables. If s : {1, …, k} → {1, …, n} is injective and the free type variables FTV(Γ, M, τ) ⊆ {α_{s1}, …, α_{sk}}, then

[[Γ ⊳ M : τ]]_{α_{1},... ,α_{n}}^{I} = F_{⟨π_{s1},... ,π_{sk}⟩}[[Γ ⊳ M : τ]]_{α_{s1},... ,α_{sk}}^{I}.

2. Permutation of Individual Variables. If s : {1, …, l} → {1, …, m} is injective and FV(M) ⊆ {x_{s1}, …, x_{sl}}, and if Γ′ = x_{1}:σ_{1}, … x_{m}:σ_{m} and Γ = x_{s1}:σ_{s1}, … x_{sl}:σ_{sl} then

\xymatrix{[[Γ′]]I ; ᾱ \ar[rr]^{[[Γ′⊳M:τ]]I ; ᾱ} \ar[dr]_{⟨π_{s1},... ,π_{sl}⟩} &  & [[τ]]I ; ᾱ. \\  & [[Γ]]I ; ᾱ \ar@{-->}[ur]_{[[Γ⊳M:τ]]I ; ᾱ}}

3. Type Substitution. Whenever FTV(Γ, M, τ) ⊆ {ᾱ, α′} and FTV(σ) ⊆ {ᾱ}, then

[[(Γ ⊳ M : τ)[σ/α′]]]I ; ᾱ = [[[σ]]I ; ᾱ]_{Ω^{n}}[[Γ ⊳ M : τ]]_{ᾱ,α′}^{I}.

4. Term Substitution. Let Γ = x_{1}:σ_{1}, … x_{m}:σ_{m} and Γ′ = y_{1}:ρ_{1}, … y_{l}:ρ_{l}, and suppose Γ ⊳ M : τ and Γ′ ⊳ N_{j} : σ_{j} for j = 1, …, m. Then

\xymatrix{[[Γ′]]I ; ᾱ \ar[rr]^{[[Γ′⊳M[N̄/x̄]:τ]]I ; ᾱ} \ar[dr]_{⟨[[Γ′⊳N_{1}:σ_{1}]]I ; ᾱ,... ,[[Γ′⊳N_{n}:σ_{n}]]I ; ᾱ⟩} &  & [[τ]]I ; ᾱ. \\  & [[Γ]]I ; ᾱ \ar@{-->}[ur]_{[[Γ⊳M:τ]]I ; ᾱ}}

□

As usual, we say that an interpretation I satisfies an equation Γ ⊳ M = N : τ, in symbols I ⊧ Γ ⊳ M = N : τ, if [[Γ ⊳ M : τ]]I ; ᾱ = [[Γ ⊳ N : τ]]I ; ᾱ. This notion is independent of ᾱ, as long as FTV(Γ, M, N, τ) ⊆ ᾱ. We write ⊧_{M} for semantic consequence in a class M of PL-categories, meaning E ⊧_{M} E if all interpretations in a PL-category in M that satisfy E also satisfy E.

Proposition 5.42 (Seely [56]). Soundness.

E ⊢_{p} E implies E ⊧_{PL} E.
□

If T is a theory and I : \underline{PL} → B is an interpretation such that I ⊧ T , then we also write I : T → B. An interpretation can be post-composed with a PL-representation in an evident way: T ⟶^{I} B ⟶^{G} B′ is the interpretation J defined by [[σ]]J ; ᾱ = G[[σ]]I ; ᾱ and [[Γ ⊳ M : τ]]J ; ᾱ = G[[Γ ⊳ M : τ]]I ; ᾱ.

5.5.3 The PL-category associated to a theory

From a theory T over a polymorphic signature, one constructs a PL-category 𝔉_{PL}(T ) = ⟨B, Ω, F, γ, ∀, η⟩ as follows: Fix an enumeration α_{1}, α_{2}, … of type variables, and fix an individual variable x. The base B has countably many objects, which we denote 1, Ω, Ω^{2}, …; the hom-set (Ω^{n}, Ω^{k}) is given by all ktuples ⟨σ_{1}, …, σ_{k}⟩ of polymorphic types with FTV(σ_{1}, …, σ_{k}) ⊆ {α_{1}, …, α_{n}}. Composition is given by substitution:

Ω^{n} ⟶^{⟨σ_{1},... ,σ_{k}⟩} Ω^{k} ⟶^{⟨τ_{1},... ,τ_{l}⟩} Ω^{l} = ⟨τ_{1}[σ_{i}/α_{i}], …, τ_{l}[σ_{i}/α_{i}]⟩,

where τ[σ_{i}/α_{i}] denotes the simultaneous substitution of σ_{1}, …, σ_{k} for α_{1}, …, α_{k}. The identity at Ω^{n} is ⟨α_{1}, …, α_{n}⟩. One checks that the base has finite products.

The objects of the n-fiber are defined via |F_{Ω^{n}}| = (Ω^{n}, Ω), i.e. they are polymorphic types σ with FTV(σ) ⊆ {α_{1}, …, α_{n}}. The morphisms f_{M} ∈ (σ, τ)_{Ω^{n}} of the n-fiber are named by terms M such that x:σ ⊳ M : τ is a valid typing judgment. Two terms M and N name the same morphism if T ⊢_{p} x:σ ⊳ M = N : τ. Just as in the construction of the ccc associated to a simply-typed theory (see Section 5.2.3), one checks that F is indeed cartesian-closed. The action of F on morphisms φ : Ω^{n} → Ω^{k} of the base is as follows: F_{⟨σ_{1},... ,σ_{k}⟩} maps objects τ to τ[σ_{i}/α_{i}] and morphisms f_{M} to f_{M[σ_{i}/α_{i}]}. This defines a ccc-representation F_{Ω^{k}} → F_{Ω^{n}}. Notice that Δ_{Ω^{n}}σ = σ. The right adjoint ∀_{Ω^{n}} acts on objects as ∀_{Ω^{n}}σ = ∀α_{n+1}.σ. The adjunction η_{Ω^{n},σ,τ} : (σ, τ)_{Ω^{n+1}} → (σ, ∀α_{n+1}.τ)_{Ω^{n}} is given by η_{Ω^{n},σ,τ} f_{M} = f_{Λα_{n+1}.M}.

Proposition 5.43 (Seely [56]). The above construction yields a well-defined PL-category 𝔉_{PL}(T ). There is a canonical strict interpretation I_{0} : T → 𝔉_{PL}(T ) with [[σ]]I_{0} ; ᾱ = σ and [[x:σ ⊳ M : τ]]I_{0} ; ᾱ = f_{M} : σ → τ. Moreover, I_{0} has the following universal property: For any strict interpretation J : T → B, there is a unique PL-representation G : 𝔉_{PL}(T ) → B such that

\xymatrix{T \ar[d]_{I_{0}} \ar[dr]^{J} \\ 𝔉_{PL}(T ) \ar[r]_{G} & B.}

□

Corollary 5.44. Completeness of PL-categories for the polymorphic lambda calculus. Each theory T of the polymorphic lambda calculus arises as the theory of some strict interpretation in a PL-category. Hence,

E ⊧_{PL} E implies E ⊢_{p} E.
□

5.5.4 The non-strict interpretation of the polymorphic lambda calculus

A non-strict interpretation of the polymorphic lambda calculus in a pre-structure P, denoted I : \underline{PL} → P, is a Henkin-PL-representation H : 𝔉_{PL}(\underline{PL}) → P. One defines [[σ]]I ; ᾱ = H[[σ]]I_{0} ; ᾱ and [[Γ ⊳ M : τ]]I ; ᾱ = H[[Γ ⊳ M : τ]]I_{0} ; ᾱ. The notations I ⊧ E, as well as E ⊧_{M}^{non-strict} E, have their usual meanings. The following Soundness Theorem is a consequence of Lemma 5.32. Again, completeness is evident, since the class of non-strict interpretations includes the class of strict ones.

Proposition 5.45. Soundness of the Non-Strict Interpretation.

E ⊢_{p} E implies E ⊧_{PL}^{non-strict} E.
□

A non-strict interpretation of the polymorphic lambda calculus in a standard structure D̃ is called a standard model. The case D = 𝒮^{+} gives rise to set-theoretic models with non-empty types which are closely related to the environment-style models that were described by Bruce and Meyer [10]. The case D = 𝒮^{P} gives rise to polymorphic Kripke models. Finally, the case D = 𝒮 gives rise to set-theoretic models of polymorphism with possibly empty types. We will leave the discussion of the latter class of models for elsewhere.

5.6 From Henkin-PL-representation theorems to polymorphic completeness theorems

5.6.1 Set-theoretic models with non-empty types

A set-theoretic model of polymorphism with non-empty types is a non-strict interpretation in the standard structure 𝒮̃^{+}. Write ⊧non-strict ; 𝒮̃^{+} for semantic consequence with respect to this class of models.

Theorem 5.46. Soundness and Completeness for set-theoretic models of polymorphism with non-emp-ty types. The rule (non-empty) is sound for set-theoretic models of polymorphism with non-empty types. Moreover, any theory that is closed under (non-empty)arises from such an interpretation. Consequently,

E ⊧non-strict ; 𝒮̃^{+} E if and only if E ⊢_{p}^{non-empty} E.

Proof. Soundness follows from Lemma 5.37 and the remarks in Section 5.3.2. For completeness, let T be a theory that is closed under (non-empty). Let I_{0} : T → 𝔉_{PL}(T ) be the canonical interpretation. Because of the rule (non-empty), one has C ↠ 1 for all objects of the base, hence, by Theorem 5.38, there is a Henkin-PL-embedding H : 𝔉_{PL}(T ) → 𝒮̃^{+}. Then the interpretation I = H ∘ I_{0} satisfies exactly T . □

5.6.2 Polymorphic Kripke models

A polymorphic Kripke model is a non-strict interpretation in a standard structure 𝒮̃^{P} where P is a poset. Semantic consequence for this class of models is denoted by ⊧_{Kripke}^{non-strict}.

Theorem 5.47. Soundness and Completeness for polymorphic Kripke models. Each polymorphic lambda theory is the theory of some polymorphic Kripke model. Therefore,

E ⊧_{Kripke}^{non-strict} E if and only if E ⊢_{p} E.

Proof. This is a direct consequence of Theorem 5.39. □

First-Order Axioms for Asynchrony

The distinction between synchronous and asynchronous communication is a relevant issue in the design and analysis of distributed and concurrent networks. Intuitively, communication is said to be synchronous if messages are sent and received simultaneously, via a ‘handshake’ or ‘rendez-vous’ of sender and receiver. It is asynchronous if messages travel through a communication medium with possible delay, such that the sender cannot be certain if or when a message has been received.

Asynchronous communication is often studied in the framework of concurrent process paradigms such as the asynchronous π-calculus, which was originally introduced by Honda and Tokoro [26], and which was independently discovered by Boudol [9] as a result of his work with Berry on chemical abstract machines [8]. Another such asynchronous paradigm is the join calculus, which was recently proposed by Fournet and Gonthier as a calculus of mobile agents in distributed networks with locality and failure [17, 18].

In this chapter, we study properties of asynchronous communication in general, not with regard to any particular process calculus. We give a general-purpose, mathematically rigorous definition of asynchrony, and then we show that this notion can be equivalently characterized by a small number of first-order axioms. We model processes by labeled transition systems with input and output, a framework that is sufficiently general to fit concurrent process paradigms such as the π-calculus or the join calculus, as well as data flow models and other such formalisms. These transition systems are similar to Lynch and Stark’s input/output automata [35], but our treatment is more category-theoretic and close in spirit to Abramsky’s interaction categories [1, 2].

Various properties of asynchrony have been exploited in different contexts by many authors. For instance, Lynch and Stark [35] postulate a form of input receptivity for their automata. Palamidessi [45] makes use of a certain confluence property to prove that the expressive power of the asynchronous π-calculus is strictly less than that of the synchronous π-calculus. Axioms similar to the ones that are presented here have been postulated by Shields [59] and Bednarczyk [6] for a notion of asynchronous labeled transition systems, but without the input/output distinction which is central to the present approach.

The main novelty of our approach is that the axioms are not postulated a priori, but derived from more primitive notions. We define asynchrony in elementary terms: an agent is asynchronous if its input and/or output is filtered through a communication medium, such as a buffer or a queue, possibly with feedback. We then show that our first- and second-order axioms precisely capture each of these notions. This characterization justifies the axioms a posteriori. As a testbed and for illustration, we apply these axioms to an asynchronous version of Milner’s CCS, and to the core join calculus.

6.1 An elementary definition of asynchrony

If R is a binary relation, we write R^{−1} for the inverse relation and R^{∗} for the reflexive, transitive closure of R. We also write ⟵ for ⟶^{−1}, etc. The binary identity relation on a set is denoted Δ. The composition of two binary relations R and Q is written R ∘ Q or simply RQ, i.e. xRQz if there exists y such that xRyQz.

We write xR for the unary relation {y|xRy}, and similarly Ry for {x|xRy}. The disjoint union of sets X and Y is denoted by X + Y.

6.1.1 Labeled transition systems and bisimulation

To keep this chapter self-contained, we summarize the standard definitions for labeled transition systems and weak and strong bisimulation.

Definition. A labeled transition system (LTS) is a tuple S = ⟨S, A, ⟶_{S}, s_{0}⟩, where S is a set of states, A is a set of actions, ⟶_{S} ⊆ S × A × S is a transition relation and s_{0} ∈ S is an initial state. We call A the type of S, and we write S: A.

We often omit the subscript on ⟶_{S}, and we write |S| for the set of states S. For α ∈ A, we regard ⟶^{α} as a binary relation on |S| via s ⟶^{α} s′ iff ⟨s, α, s′⟩ ∈ ⟶. The definitions of strong and weak bisimulation rely on the following principle of co-inductive definition:

Principle 6.1. Let X be a set and P a property of subsets of X. If P (R) is defined by clauses of the form F_{i}(R) ⊆ G_{i}(R), where F_{i} and G_{i} are set-valued, monotone operators, and if F_{i} preserves unions, then P is closed under unions. In particular, there is a maximal R_{max} ⊆ X with P (R_{max} ).

Proof. Since F_{i} preserves unions, it has a right adjoint F′_{i}. Then P (R) ⟺ ∀i.F_{i}(R) ⊆ G_{i}(R) ⟺ R ⊆ ⋂_{i} F′_{i}G_{i}(R). Hence P is the set of pre-fixpoints of a monotone operator and therefore closed under least upper bounds. Let R_{max} = ⋃{R | P (R)}. □

Definition. Let S and T be LTSs of type A. A binary relation R ⊆ |S| × |T| is a strong bisimulation if for

all α ∈ A, R⟶^{α} ⊆ ⟶^{α}R and R^{−1}⟶^{α} ⊆ ⟶^{α}R^{−1}. In diagrams:

[figure: s; R; t; α; t′] ⇒ ∃s′. [figure: s; R; α; t; α; s′; R; t′]  and  [figure: s; R; α; t; s′] ⇒ ∃t′. [figure: s; R; α; t; α; s′; R; t′]

Next, we consider LTSs with a distinguished action τ ∈ A, called the silent or the unobservable action. Let ⇒^{τ} be the relation ⟶^{τ}^{∗}. For a ∈ A \ τ, let ⇒^{a} be the relation ⟶^{τ}^{∗}⟶^{a}⟶^{τ}^{∗}. A binary relation R ⊆ |S| × |T| is a weak bisimulation if for all α ∈ A, R⟶^{α} ⊆ ⇒^{α}R and R^{−1}⟶^{α} ⊆ ⇒^{α}R^{−1}. In diagrams:

[figure: s; R; t; α; t′] ⇒ ∃s′. [figure: s; R; α; t; α; s′; R; t′]  and  [figure: s; R; α; t; s′] ⇒ ∃t′. [figure: s; R; α; t; α; s′; R; t′]

By Principle 6.1, it follows that there is a maximal strong bisimulation, which we denote by ∼, and a maximal weak bisimulation, which we denote by ≈. We say that s ∈ |S| and t ∈ |T| are strongly (weakly) bisimilar if s ∼ t (s ≈ t). Finally, S and T are said to be strongly (weakly) bisimilar if s_{0} ∼ t_{0} (s_{0} ≈ t_{0}).

Remark. Note that R ⊆ |S| × |T| is a weak bisimulation if and only if for all α ∈ A, R⇒^{α} ⊆ ⇒^{α}R and

R^{−1}⇒^{α} ⊆ ⇒^{α}R^{−1}.

If S, T, U are labeled transition systems and if R ⊆ |S| × |T| and Q ⊆ |T| × |U| are weak (respectively, strong) bisimulations, then so are the identity relation Δ ⊆ |S| × |S|, the inverse R^{−1} ⊆ |T| × |S|, and the composition R∘Q ⊆ |S|×|U|. Hence weak and strong bisimilarity each define a global equivalence relation on the class of all states of all possible labeled transition systems.

In particular, ∼ and ≈, as binary relations on an LTS S, are equivalence relations. We denote the respective equivalence classes of a state s by [s]_{∼} and [s]_{≈}. On the quotient S/∼, we define transitions [s]_{∼} ⟶^{a} [t]_{∼} iff s ⟶^{a}∼ t, making it into a well-defined transition system. Similarly, on S/≈, we define [s]_{≈} ⟶^{a} [t]_{≈} iff s ⟶^{a}≈ t. For all s ∈ S, one has s ∼ [s]_{∼} and s ≈ [s]_{≈}, and hence S ∼ (S/∼) and S ≈ (S/≈). We say that S is ∼-reduced if S = S/∼, and ≈-reduced if S = S/≈.

6.1.2 Input, output and sequential composition

So far we have distinguished only one action: the silent action τ. We will now add further structure to the set of actions by distinguishing input and output actions. Let in and out be constants. For any sets X and Y, define a set of input actions InX := {in} × X, and a set of output actions OutY := {out} × Y. Note that InX and OutY are disjoint. We will write input and output actions as inx and outx instead of ⟨in, x⟩ and ⟨out, x⟩, respectively. Let B be a set whose elements are not of the form inx, outy or τ. The elements of B + {τ} are called internal actions.

Definition. We define X→_{B}Y to be the set InX + OutY + B + {τ}. A labeled transition system S of type X→_{B}Y is called an LTS, or simply an agent. If B is empty, we will omit the subscript in X→_{B}Y.

The traditional CCS notation is “x” for input actions and “x̄” for output actions. We use inx and outx instead to emphasize the distinction between a message inx and its content x.

Our labeled transition systems with input and output are similar to the input/output automata of Lynch and Stark [35]. However, we consider a notion of sequential composition that is more in the spirit of Abramsky’s interaction categories [1, 2]. Given two agents S: X→_{B}Y and T: Y →_{B}Z, we define S; T: X→_{B}Z by feeding the output of S into the input of T. This is a special case of parallel composition and hiding. Notice that this notion of sequential composition is different from the one of CSP or ACP, where T cannot start execution until S is finished.

Sequential composition, together with certain other agent constructors that we will investigate in Section 6.3.1, can be used to build arbitrary networks of agents.

Definition 6.2. Let S: X→_{B}Y and T: Y →_{B}Z be agents with respective initial states s_{0} and t_{0}. The sequential composition S; T is of type X→_{B}Z. It has states |S| × |T| and initial state ⟨s_{0}, t_{0}⟩. The transitions are given by the following rules:

\frac{s ⟶^{α}_{S} s′  α not output}{⟨s, t⟩ ⟶^{α}_{S;T} ⟨s′, t⟩}  \frac{t ⟶^{α}_{T} t′  α not input}{⟨s, t⟩ ⟶^{α}_{S;T} ⟨s, t′⟩}  \frac{s ⟶^{outy}_{S} s′  t ⟶^{iny}_{T} t′}{⟨s, t⟩ ⟶^{τ}_{S;T} ⟨s′, t′⟩}

Example 6.3. For any set X, define an agent I_{X} of type X→X with states X + {⊥}, initial state ⊥ and transitions ⊥ ⟶^{inx} x and x ⟶^{outx} ⊥, for all x ∈ X. I_{X} acts as a buffer of capacity one: A possible sequence of transitions is

⊥ ⟶^{inx} x ⟶^{outx} ⊥ ⟶^{iny} y ⟶^{outy} ⊥ ⟶^{inz} z ⟶^{outz} ⊥ …

Let X = {x}. Then I_{X} and I_{X}; I_{X} are the following agents:

I_{X} = [figure: ⊥; inx; x; outx] I_{X}; I_{X} = [figure: ⟨⊥, ⊥⟩; inx; ⟨⊥, x⟩; outx; inx; ⟨x, ⊥⟩; τ; ⟨x, x⟩; outx]

Here the initial state of each agent is circled. When representing agents in diagrams like these, it is often convenient to omit the names of the states, and to identify weakly bisimilar states. With that convention, we write:

I_{X} = [figure: •; inx; •; outx] I_{X}; I_{X} ≈ [figure: •; inx; •; outx; inx; •; outx]

Note that I_{X}; I_{X} is a queue of capacity 2. Let Y = {y, z}. The following diagrams represent I_{Y} and I_{Y}; I_{Y}:

I_{Y} = [figure: •; outz; •; inz; iny; •; outy] I_{Y}; I_{Y} ≈ [figure: •; outz; •; outz; •; outz; iny; inz; •; iny; inz; •; iny; inz; outy; •; outy; •; outy]

Again, I_{Y}; I_{Y} is a queue of capacity 2. Notice that it is first-in, first-out. Two LTSs S and T of type A are isomorphic if there is a bijection between |S| and |T| preserving ⟶ and initial states.

Lemma 6.4. 1. Sequential Composition of labeled transition systems is associative up to isomorphism.

2. The following hold for the composition S; T:

\frac{s ⇒^{α}_{S} s′  α not output}{⟨s, t⟩ ⇒^{α}_{S;T} ⟨s′, t⟩}  \frac{t ⇒^{α}_{T} t′  α not input}{⟨s, t⟩ ⇒^{α}_{S;T} ⟨s, t′⟩}  \frac{s ⟹^{outy}_{S} s′  t ⟹^{iny}_{T} t′}{⟨s, t⟩ ⇒^{τ}_{S;T} ⟨s′, t′⟩}

3. Sequential Composition of agents respects both weak and strong bisimulation, i.e.

\frac{S_{1} ≈ S_{2}  T_{1} ≈ T_{2}}{S_{1}; T_{1} ≈ S_{2}; T_{2}}  and  \frac{S_{1} ∼ S_{2}  T_{1} ∼ T_{2}}{S_{1}; T_{1} ∼ S_{2}; T_{2}}

Proof. 1. It is easy to check that ⟨⟨s, t⟩, u⟩ ⟶^{α} ⟨⟨s′, t′⟩, u′⟩ if and only if ⟨s, ⟨t, u⟩⟩ ⟶^{α} ⟨s′, ⟨t′, u′⟩⟩.

2. The first two statements are trivial from Definition 6.2. For the third one, assume s ⟶^{τ}^{∗} s_{1} ⟶^{outy} s_{2} ⟶^{τ}^{∗} s′

and t ⟶^{τ}^{∗} t_{1} ⟶^{iny} t_{2} ⟶^{τ}^{∗} t′. Then ⟨s, t⟩ ⟶^{τ}^{∗} ⟨s_{1}, t⟩ ⟶^{τ}^{∗} ⟨s_{1}, t_{1}⟩ ⟶^{τ} ⟨s_{2}, t_{2}⟩ ⟶^{τ}^{∗} ⟨s′, t_{2}⟩ ⟶^{τ}^{∗} ⟨s′, t′⟩.

3. Let S_{1}, S_{2} : X→_{B}Y and T_{1}, T_{2} : Y →_{B}Z. Suppose Q ⊆ |S_{1}| × |S_{2}| and R ⊆ |T_{1}| × |T_{2}| are weak bisimulations. We show that Q × R = {⟨⟨s_{1}, t_{1}⟩, ⟨s_{2}, t_{2}⟩⟩ | s_{1}Qs_{2} and t_{1}Rt_{2}} ⊆ |S_{1}; T_{1}| × |S_{2}; T_{2}| is a weak bisimulation. It suffices without loss of generality to show one of the two directions. Suppose

[figure: ⟨s_{1}, t_{1}⟩; Q × R; α; ⟨s_{2}, t_{2}⟩; ⟨s′_{1}, t′_{1}⟩]

for some α ∈ X→_{B}Z. There are three cases, depending on which of the three rules in Definition 6.2 was

used to derive ⟨s_{1}, t_{1}⟩ ⟶^{α} ⟨s′_{1}, t′_{1}⟩:

Case 1: s_{1} ⟶^{α} s′_{1}, t_{1} = t′_{1} and α is not output: By Q there is s′_{2} such that s_{2} ⇒^{α} s′_{2} and s′_{1}Qs′_{2}. Let t′_{2} = t_{2}. Case 2: t_{1} ⟶^{α} t′_{1}, s_{1} = s′_{1} and α is not input: By R there is t′_{2} such that t_{2} ⇒^{α} t′_{2} and t′_{1}Rt′_{2}. Let s′_{2} = s_{2}. Case 3: s_{1} ⟶^{outy} s′_{1}, t_{1} ⟶^{iny} t′_{1} and α = τ: By Q and R, there are s′_{2} and t′_{2} such that s_{2} ⟹^{outy} s′_{2}, s′_{1}Qs′_{2},

t_{2} ⟹^{iny} t′_{2} and t′_{1}Rt′_{2}.

In each case, by 2.,

[figure: ⟨s_{1}, t_{1}⟩; Q × R; τ; ⟨s_{2}, t_{2}⟩; α; ⟨s′_{1}, t′_{1}⟩; Q × R; ⟨s′_{2}, t′_{2}⟩.]

For strong bisimulation, the proof is similar. □

Unfortunately, agents do not form a category under sequential composition: there are no identity morphisms. In Section 6.1.4, we will introduce two categories of agents, one of which has unbounded buffers as its identity morphisms, and the other one queues.

6.1.3 Buffers and queues

For any set X, let X^{∗} be the free monoid and X^{∗∗} the free commutative monoid generated by X. The elements of X^{∗} are finite sequences. The empty sequence is denoted by ϵ. The elements of X^{∗∗} are finite multisets. The empty multiset is denoted by ∅. We define the following agents of type X→_{B}X:

1. The buffer B_{X} has states X^{∗∗}, initial state ∅, and transitions w ⟶^{inx} wx and xw ⟶^{outx} w, for all w ∈ X^{∗∗} and x ∈ X.

2. The queue Q_{X} has states X^{∗}, initial state ϵ, and transitions w ⟶^{inx} wx and xw ⟶^{outx} w, for all w ∈ X^{∗} and x ∈ X.

The only difference between the definitions of B_{X} and Q_{X} is whether the states are considered as sequences or multisets. We will write B and Q without subscript if X is clear from the context. B acts as an infinite capacity buffer which does not preserve the order of messages. For example, one possible sequence of transitions is

∅ ⟶^{inx} x ⟶^{iny} xy ⟶^{inz} xyz ⟶^{outy} xz ⟶^{outx} z ⟶^{inw} wz …

Q acts as an infinite capacity first-in, first-out queue. A possible sequence of transitions is

ϵ ⟶^{inx} x ⟶^{iny} xy ⟶^{outx} y ⟶^{inz} yz ⟶^{inw} yzw ⟶^{outy} zw …

Lemma 6.5. 1. B; B ≈ B and B; B ≁ B.

2. Q; Q ≈ Q and Q; Q ≁ Q.

3. Q; B ≈ B and Q; B ≁ B.

4. If |X| ⩾ 2, then B; Q ≉ B and B; Q ≉ Q.

Proof. 1.-3.: Define ⟨u, v⟩Rw iff vu = w, where u, v and w are multisets or sequences, as appropriate. In each case, R is a weak bisimulation. To see that strong bisimilarity does not hold, observe that in each case, the composite agent has silent actions, while B and Q do not.

4.: Observe that B; Q has a transition s_{0} ⟹^{inx}⟹^{iny} s_{1} from its initial state such that s_{1} ⟹^{outy}⟹^{outx} is possible, but s_{1} ⟹^{outx}⟹^{outy} is not. This is not the case for either B or Q. Such properties are preserved under weak bisimulation. □

The remainder of this chapter is devoted to examining the effect of composing arbitrary agents with buffers and queues.

6.1.4 Notions of asynchrony

In the asynchronous model of communication, messages are assumed to travel through a communication medium or ether. Sometimes, the medium is assumed to be first-in, first-out (a queue); sometimes, as in the asynchronous π-calculus, messages might be received in any order (a buffer).

Our approach is simple: we model the medium explicitly. An asynchronous agent is one whose output and/or input behaves as if filtered through either a buffer B or a queue Q.

Definition 6.6. An agent S: X→_{B}Y is

out-buffered if S ≈ S; B
in-buffered if S ≈ B; S
buffered if S ≈ B; S; B

out-queued if S ≈ S; Q
in-queued if S ≈ Q; S
queued if S ≈ Q; S; Q

We use the word asynchrony as a generic term to stand for any such property. The reason we distinguish six different notions is that, although it is probably most common to think of asynchrony as part of the output behavior of an agent, it is equally sensible to regard it as part of the input behavior, or both. Since input and output behave somewhat differently, we will study them separately. Yet another notion of asynchrony, incorporating feedback, will be defined in Section 6.3.2.

Remark. Because of Lemma 6.5, the operation of pre- or post-composing an agent with B or Q is idempotent up to ≈. Consequently, any agent of the form S; B is out-buffered, any agent of the form B; S is in-buffered, an agent is buffered iff it is in- and out-buffered, and so on. Also, each of the six properties is invariant under weak bisimulation.

Notice that it is almost never the case that an agent S is strongly bisimilar to S; B or to B; S. This will be clear from the examples in Section 6.1.5. Weak bisimulation appears to be the finest equivalence relation that is sensible for studying asynchrony. It is also possible to consider coarser equivalences; the results of this chapter generalize in a straightforward way to any equivalence on processes that contains weak bisimulation; see Remark 6.12.

Let B be a set. Buffered agents S: X→_{B}Y form the morphisms of a category Buf_{B}, whose objects are sets X, Y, etc.; the identity morphism on X is given by the buffer B_{X}. Similarly, queued agents form a category Que_{B}. These categories have a symmetric monoidal structure, which will be described, along with other constructions on agents, in Section 6.3.1.

6.1.5 Examples

Example 6.7. The first example shows the effect of post-composing different agents with the buffer B. Notice that although B has infinitely many states, S; B may have only finitely many states up to weak bisimulation.

S = [figure: s; outy; t; inx; u]  S; B_{{y}} = [figure: ⟨s, ∅⟩; τ; ⟨s, y⟩; outy; τ; ⟨s, y^{2}⟩; outy; ⋯; ⟨t, ∅⟩; inx; ⟨t, y⟩; outy; inx; ⟨t, y^{2}⟩; outy; ⋯; inx; ⟨u, ∅⟩; ⟨u, y⟩; outy; ⟨u, y^{2}⟩; outy; ⋯]  ≈ [figure: •; inx; outy; •; inx; •; outy; •]

Example 6.8.

S = [figure: •; inx; outy; outz; •; •; •] S; B ≈ [figure: •; inx; τ; τ; •; outy; •; •; •; outz; •]

Example 6.9. Here is an example on in-bufferedness. Notice that an input action is possible at every state of B; S.

S = [figure: •; inx; inx; •; outy; •; outz; •] B_{{x}}; S ≈ [figure: •; outy; inx; •; inx; •; τ; τ; inx; •; inx; •; outz; inx]

Table 6.1: First-order axioms for out-buffered agents

\xymatrix{s \ar[r]^{outy} & s′ \ar[d]^{α} \\ & t} ⇒ \xymatrix{s \ar[r]^{outy} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{outy} & t}

output-commutativity (ob1)

\xymatrix{s \ar[r]^{outy} \ar[d]_{α} & s′ \\ s′′} ⇒ \xymatrix{s \ar[r]^{outy} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{outy} & t}

where α ≠ outy output-confluence (ob2)

\xymatrix{s \ar[r]^{outy} \ar[d]_{outy} & s′ \\ s′′} ⇒ s′ = s′′

output-determinacy (ob3)

6.2 First-order axioms for asynchrony

In this section, we will give necessary and sufficient conditions for each of the notions of asynchrony from Definition 6.6. These conditions are in the form of first-order axioms, by which we mean axioms that use quantification only over states and actions, but not over subsets of states or actions. The axioms, which are shown in Tables 6.1 through 6.4, characterize each of our notions of asynchrony up to weak bisimulation; this means, an LTS is asynchronous iff it is weakly bisimilar to one satisfying the axioms. It is possible to lift the condition “up to weak bisimulation” at the cost of introducing second-order axioms; this is the subject of Section 6.6.

6.2.1 Out-buffered agents

Table 6.1 lists three axioms for out-buffered agents. We use the convention that variables are implicitly existentially quantified if they occur only on the right-hand-side of an implication, and all other variables are implicitly universally quantified. Thus the axioms are:

(ob1) Output-commutativity: output actions can always be delayed.

(ob2) Output-confluence: when an output action and some other action are possible, then they can be performed in either order with the same result. In particular, neither action precludes the other.

(ob3) Output-determinacy: from any state s, there is at most one transition outy for each y ∈ Y.

Each of these axioms is plausible for the behavior of a buffer. Output-determinacy is maybe the least intuitive of the three properties; the idea is that once an output action is stored in a buffer, there is only one way of retrieving it. Together, these axioms characterize out-bufferedness up to weak bisimulation:

Theorem 6.10 (Characterization of out-buffered agents). An agent S is out-buffered if and only if S ≈ T for some T satisfying (ob1)–(ob3).

This is a direct consequence of the following proposition:

Proposition 6.11.

1. Every agent of the form S; B satisfies (ob1)–(ob3).

2. If S satisfies (ob1)–(ob3), then S ≈ S; B.

Table 6.2: First-order axioms for in-buffered agents

\xymatrix{s \ar[r]^{α} & s′ \ar[d]^{inx} \\ & t} ⇒ \xymatrix{s \ar[r]^{α} \ar[d]_{inx} & s′ \ar[d]^{inx} \\ s′′ \ar[r]^{α} & t}

input-commutativity (ib1)

\xymatrix{s \ar[r]^{inx} \ar[d]_{α} & s′ \\ s′′} ⇒ \xymatrix{s \ar[r]^{inx} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{inx} & t}

input-confluence (ib2)

\xymatrix{s \ar[r]^{inx} \ar[d]_{inx} & s′ \\ s′′} ⇒ s′ = s′′

input-determinacy (ib3)

s ⇒ s ⟶^{inx} t

input-receptivity (ib4)

Table 6.3: First-order axioms for out-queued agents

\xymatrix{s \ar[r]^{outy} & s′ \ar[d]^{α} \\ & t} ⇒ \xymatrix{s \ar[r]^{outy} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{outy} & t}

where α not output output-commutativity’ (oq1)

\xymatrix{s \ar[r]^{outy} \ar[d]_{α} & s′ \\ s′′} ⇒ \xymatrix{s \ar[r]^{outy} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{outy} & t}

where α not output output-confluence’ (oq2)

\xymatrix{s \ar[r]^{outy} \ar[d]_{outz} & s′ \\ s′′} ⇒ \begin{matrix}y = z \\ and \\ s′ = s′′ \end{matrix}

output-determinacy’ (oq3)

Table 6.4: First-order axioms for in-queued agents

\xymatrix{s \ar[r]^{α} & s′ \ar[d]^{inx} \\ & t} ⇒ \xymatrix{s \ar[r]^{α} \ar[d]_{inx} & s′ \ar[d]^{inx} \\ s′′ \ar[r]^{α} & t}

where α not input input-commutativity’ (iq1)

\xymatrix{s \ar[r]^{inx} \ar[d]_{α} & s′ \\ s′′} ⇒ \xymatrix{s \ar[r]^{inx} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{inx} & t}

where α not input input-confluence’ (iq2)

\xymatrix{s \ar[r]^{inx} \ar[d]_{inx} & s′ \\ s′′} ⇒ s′ = s′′

input-determinacy (iq3)

s ⇒ s ⟶^{inx} t

input-receptivity (iq4)

Proof. 1. Clearly, the buffer B satisfies (ob1)–(ob3). Moreover, these conditions are preserved by arbitrary sequential composition from the left. We show this for (ob1); the other cases are similar. Suppose B satisfies (ob1). To show that S; B satisfies (ob1), consider transitions

\xymatrix{⟨u, s⟩ \ar[r]^{outy} & ⟨u, s′⟩ \ar[d]^{α} \\  & ⟨u′, t⟩.}

Then s ⟶^{outy} s′ in B. By Definition 6.2, there are three cases for ⟨u, s′⟩ ⟶^{α} ⟨u′, t⟩:

Case 1: s′ = t, u ⟶^{α} u′, α not output. Case 2: u = u′, s′ ⟶^{α} t, α not input. Hence, by hypothesis there is s′′ such that s ⟶^{α} s′′ ⟶^{outy} t. Case 3: α = τ, u ⟶^{outx} u′, s′ ⟶^{inx} t. Hence, by hypothesis there is s′′ such that s ⟶^{inx} s′′ ⟶^{outy} t.

In each of the three cases, the diagram can be completed:

Case 1:

\xymatrix{⟨u, s⟩ \ar[r]^{outy} \ar[d]_{α} & ⟨u, t⟩ \ar[d]^{α} \\ ⟨u′, s⟩ \ar[r]^{outy} & ⟨u′, t⟩}

Case 2:

\xymatrix{⟨u, s⟩ \ar[r]^{outy} \ar[d]_{α} & ⟨u, s′⟩ \ar[d]^{α} \\ ⟨u, s′′⟩ \ar[r]^{outy} & ⟨u, t⟩}

Case 3:

\xymatrix{⟨u, s⟩ \ar[r]^{outy} \ar[d]_{τ} & ⟨u, s′⟩ \ar[d]^{τ} \\ ⟨u′, s′′⟩ \ar[r]^{outy} & ⟨u′, t⟩}

2. Suppose S: X→_{B}Y satisfies (ob1)–(ob3). For any sequence w = y_{1}y_{2} ⋯ y_{n} ∈ Y^{∗}, we write s ⟶^{outw} t if s ⟶^{outy_{1}}⟶^{outy_{2}} ⋯ ⟶^{outy_{n}} t (n ⩾ 0). Note that if w′ ∈ Y^{∗} is a permutation of w, then s ⟶^{outw′} t iff s ⟶^{outw} t by (ob1). Consider the relation R ⊆ |S| × |S; B| given by sR⟨t, w⟩ iff s ⟶^{outw} t. Clearly, R relates initial states. We show that R is a weak bisimulation. In one direction, suppose

[figure: s; R; α; ⟨t, w⟩; s′.]

Two cases arise:

Case 1: α = outy for some y ∈ w. By the definition of R, s ⟶^{outy} s′′ ⟶^{outw′} t, where w = yw′. By (ob3),

we have s′ = s′′. Therefore s′R⟨t, w′⟩, and also ⟨t, w⟩ ⟶^{α} ⟨t, w′⟩.✓

Case 2: α ≠ outy for all y ∈ w. From s ⟶^{outw} t and s ⟶^{α} s′, we get s′ ⟶^{outw} t′ and t ⟶^{α} t′ by repeated application of (ob2). Therefore s′R⟨t′, w⟩ and ⟨t, w⟩ ⇒^{α} ⟨t′, w⟩ (notice the use of ⇒ here, which is necessary in case α is an output action).✓

In the other direction, suppose

[figure: s; R; ⟨t, w⟩; α; ⟨t′, w′⟩.]

We distinguish three cases for ⟨t, w⟩ ⟶^{α} ⟨t′, w′⟩, depending on which rule in Definition 6.2 was used.

Case 1: t ⟶^{α} t′, w = w′ and α not output. Then s ⟶^{outw} t ⟶^{α} t′, which implies s ⟶^{α} s′ ⟶^{outw} t′ by repeated application of (ob1), i.e.s ⟶^{α} s′R⟨t′, w⟩.✓ Case 2: t = t′, w ⟶^{α} w′ and α not input. Since B has only input and output transitions, α must be outy for

some y ∈ Y with w = yw′. Then s ⟶^{outy} s′ ⟶^{outw′} t, i.e.s ⟶^{α} s′R⟨t, w′⟩.✓

Case 3: t ⟶^{outy} t′, w ⟶^{iny} w′ and α = τ. In this case, w′ = wy and s ⟶^{outw} t ⟶^{outy} t′, hence sR⟨t′, w′⟩.✓ □

Remark 6.12. Theorem 6.10 generalizes to other notions of equivalence of processes, as long as they are coarser than weak bisimulation. Indeed, if ≅ is an equivalence of processes such that ≈ ⊆ ≅, then for any agent S, there exists some out-buffered T with S ≅ T iff there exists T′ satisfying (ob1)–(ob3) and S ≅ T′. This is a trivial consequence of Theorem 6.10. Similar remarks apply to the other results in this section and in Section 6.3.

6.2.2 In-buffered agents

The axioms for in-buffered agents are listed in Table 6.2. The main difference to the out-buffered case is the property input-receptivity: an in-buffered agent can perform any input action at any time. This was illustrated in Example 6.9. The input/output automata of Lynch and Stark [35] have this property, and so does Honda and Tokoro’s original version of the asynchronous π-calculus [26]. Remark. Somewhat surprisingly, the axioms in Table 6.2 are not independent. In fact, (ib1) and (ib2) are equivalent in the presence of (ib3) and (ib4). We present all four axioms in order to highlight the analogy to the output case.

Theorem 6.13 (Characterization of in-buffered agents). An agent S is in-buffered if and only if S ≈ T for some T satisfying (ib1)–(ib4).

This is a consequence of the following proposition:

Proposition 6.14.

1. Every agent of the form B; S satisfies (ib1)–(ib4).

2. If S satisfies (ib1)–(ib4), then S ≈ B; S.

Proof. The proof is much like the proof of Theorem 6.11. We give the details of 2. to demonstrate how each of the properties (ib1)–(ib4) is used.

2. Suppose S: X→_{B}Y satisfies (ib1)–(ib4). For any sequence w = x_{1}x_{2} ⋯ x_{n} ∈ X^{∗} we write s ⟶^{inw} t if s ⟶^{inx_{1}}⟶^{inx_{2}} ⋯ ⟶^{inx_{n}} t (n ⩾ 0). Again, notice that if w′ ∈ X^{∗} is a permutation of w, then s ⟶^{inw′} t iff s ⟶^{inw} t by (ib1). Consider the relation R ⊆ |B; S| × |S| given by ⟨w, s⟩Rt iff s ⟶^{inw} t. R relates initial states, and we show that it is a weak bisimulation. In one direction, suppose

[figure: ⟨w, s⟩; R; t; α; t′.]

Then s ⟶^{inw} t, hence ⟨w, s⟩ ⇒^{τ} ⟨∅, t⟩ ⇒^{α} ⟨∅, t′⟩. But clearly ⟨∅, t′⟩Rt′.

In the other direction, suppose

[figure: ⟨w, s⟩; R; α; t; ⟨w′, s′⟩.]

We distinguish the usual three cases by Definition 6.2.

Case 1: s = s′, w ⟶^{α} w′ and α not output. In this case, α = inx for some x ∈ X with w′ = wx. By definition of R, s ⟶^{inw} t ⟶^{inx} t′, hence ⟨w′, s⟩Rt′.✓ Case 2: s ⟶^{α} s′, w = w′ and α not input. To s ⟶^{α} s′ and s ⟶^{inw} t repeatedly apply (ib2) to get t ⟶^{α} t′ and

s′ ⟶^{inw} t′, hence ⟨w, s′⟩Rt′.✓

Case 3: w ⟶^{outx} w′, s ⟶^{inx} s′ and α = τ. Then w = xw′ and s ⟶^{inx} s′′ ⟶^{inw′} t. But by (ib3), s′ = s′′, hence s′ ⟶^{inw′} t, therefore ⟨w′, s′⟩Rt.✓ □

6.2.3 Out-queued and in-queued agents

The results for buffers are easily adapted to queues. The relevant properties are given in Tables 6.3 and 6.4. Notice that the conditions for commutativity and confluence differ from the respective rules in the buffered case only in their side conditions. Different outputs (respectively, different inputs) no longer commute or conflow. Output-determinacy is strengthened: from each state, there is at most one possible output transition.

Note that (ib1)–(ib4) imply (iq1)–(iq4). This is due to the fact that every in-buffered agent is also inqueued as a consequence of Lemma 6.5(3). On the other hand, no implication holds between (oq1)–(oq3) and (ob1)–(ob3), since out-bufferedness and out-queuedness are incomparable notions due to Lemma 6.5(4).

Just like in the buffered case, the axioms for input are not independent: we have (iq1) ⟺ (iq2) in the presence of the other axioms.

Theorem 6.15 (Characterization of in- and out-queued agents). An agent S is out-queued if and only if S ≈ T for some T satisfying (oq1)–(oq3). Moreover, S is in-queued if and only if S ≈ T for some T satisfying (iq1)–(iq4). □

6.3 More agent constructors and asynchrony with feedback

6.3.1 Some operations on agents

In this section, we will introduce some operations on agents, such as renaming and hiding of actions, parallel composition and feedback.

1. Domain extension. If S is an LTS of type A, and if A ⊆ A′, then S can also be regarded as an LTS of type A′.

2. Domain restriction (hiding). If S is an LTS of type A, and if τ ∈ A′ ⊆ A, then S|_{A′} is defined to be the LTS of type A′ which has the same states as S, and whose transitions are those of S restricted to |S| × A′ × |S|.

3. Composition with functions. Let S: X→_{B}Y, and let f: X′ → X and g: Y → Y′ be functions. By f; S; g we denote the agent of type X′→_{B}Y′ with the same states as S, and with input transitions s ⟶^{inx′}_{f;S;g} t if s ⟶^{infx′}_{S} t, output transitions s ⟶^{outgy}_{f;S;g} t if s ⟶^{outy}_{S} t, and with s ⟶^{α}_{f;S;g} t iff s ⟶^{α}_{S} t when α is an internal action.

Domain extension, domain restriction and composition with functions are special cases of the following, general renaming construct:

4. General renaming and hiding. Let S be an LTS of type A and let r ⊆ A × A′ be a relation such that τrα′ iff τ = α′. Define S_{r} to be the LTS of type A′ that has the same states and initial state as S and transitions s ⟶^{α}_{S_{r}} t iff s ⟶^{α′}_{S} t for some αrα′.

Let us now turn to various forms of parallel composition.

5. Parallel composition without interaction. Let S and T be LTSs of type A. Then S∥T is the LTS of type A with states |S| × |T| and initial state ⟨s_{0}, t_{0}⟩, and whose transitions are given by the rules

\frac{s ⟶^{α}_{S} s′}{⟨s, t⟩ ⟶^{α}_{S∥T} ⟨s′, t⟩} \frac{t ⟶^{α}_{T} t′}{⟨s, t⟩ ⟶^{α}_{S∥T} ⟨s, t′⟩} .

6. Symmetric monoidal structure. Let X ⊕ X′ be the disjoint union of sets. For S: X→_{B}Y and T: X′→_{B}Y′, define S ⊕ T: X ⊕ X′→_{B}Y ⊕ Y′ to be the agent S_{r}∥T_{q}, where r and q are the inclusions of X→_{B}Y, respectively X′→_{B}Y′ into X ⊕ X′→_{B}Y ⊕ Y′. Then ⊕ defines a symmetric monoidal structure on the categories Buf and Que. The tensor unit is given by the agent I of type ∅→∅ with one state and no transitions.

The constructors we have considered so far, including sequential composition, are not sufficient to build arbitrary networks. What is missing is the ability to construct loops. The next constructor allows the output of an agent to be connected to its own input:

7. Self-composition (feedback). Let S: X→_{B}Y. Let O ⊆ Y × X be a set of pairs. Define S ⟲ O, the self-composition of S along O, to be the LTS of type X→_{B}Y whose states are identical with those of S, and whose transitions are given by the rules

\frac{s ⟶^{α}_{S} t}{s ⟶^{α}_{S⟲O} t}  \frac{s ⟶^{outy}⇒^{τ}⟶^{inx}_{S} t  ⟨y, x⟩ ∈ O}{s ⟶^{τ}_{S⟲O} t} .

In the common case where S: X→_{B}X and O = {⟨x, x⟩ | x ∈ X}, we will write S^{∘} instead of S ⟲ O.

We can use self-composition to define both sequential and parallel composition.

8. Sequential composition. The sequential composition of agents was defined in Definition 6.2. Alternatively, one can define it from the more primitive notions of direct sum, feedback and hiding: Let S: X→_{B}Y and T: Y →_{B}Z. Then S ⊕ T: X ⊕ Y →_{B}Y ⊕ Z, and with ΔY = {⟨y, y⟩ | y ∈ Y }, one gets S; T ≈ ((S ⊕ T) ⟲ ΔY)|_{X→_{B}Z}.

9. Parallel composition (with interaction). Let S, T: X→_{B}X. The parallel composition S|T is defined to be the agent (S∥T)^{∘}.

Proposition 6.16. All of the agent constructors in this section respect weak bisimulation. For instance, if S ≈ S′ and T ≈ T′, then S_{r} ≈ S′_{r} and S∥T ≈ S′∥T′, etc. □

6.3.2 Asynchrony with feedback

In concurrent process calculi such as CCS or the π-calculus, we do not think of channels as edges in a data flow graph, but rather we think of a single global ether through which all messages travel. This idea is most visible in the chemical semantics of these calculi [8]. There the ether is modeled as a “chemical solution”, which is a multiset of processes, some of which are transient messages. As a consequence, messages that are emitted from a process are immediately available as input to all processes, including the sending process itself. In our setting, this is best modeled by requiring that all processes are of type X→X for one fixed set X, and by using self-composition to feed the output back to the input.

In the presence of feedback, out-bufferedness takes a slightly different form, which is expressed in the following definition.

Definition. An agent S: X→_{B}X is out-buffered with feedback if S ≈ R^{∘} for some out-buffered agent R.

Example 6.17. The following agent S is out-buffered with feedback, but not out-buffered:

S = [figure: •; inx; outx; τ; •; inx; outx; τ; •; inx; •; outx; •; outx; •.]

Remark. Recently, Amadio, Castellani and Sangiorgi [4] have given a definition of asynchronous bisimulation, which accounts for the fact that an agent of type X→X might receive a message, and then immediately send it again, without this interaction being observable on the outside. Feedback is concerned with the dual phenomenon, namely a process that sends a message and then immediately receives it again.

Out-bufferedness with feedback is characterized up to weak bisimulation by the first-order axioms that are listed in Table 6.5.

Table 6.5: First-order axioms for out-buffered agents with feedback

\xymatrix{s \ar[r]^{outx} & s′ \ar[d]^{α} \\ & t} ⇒ \xymatrix{s \ar[r]^{outx} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{outx} & t}

output-commutativity (fb1)

\xymatrix{s \ar[r]^{outx} \ar[d]_{α} & s′ \\ s′′} ⇒ \xymatrix{s \ar[r]^{outx} \ar[d]_{α} & s′ \ar[d]^{α} \\ s′′ \ar[r]^{outx} & t}

where α ≠ outx and α ≠ τ output-confluence (fb2)

\xymatrix{s \ar[r]^{outx} \ar[d]_{outx} & s′ \\ s′′} ⇒ s′ = s′′

output-determinacy (fb3)

\xymatrix{s \ar[r]^{outx} & s′ \ar[d]^{inx} \\ & t} ⇒ \xymatrix{s \ar[r]^{outx} \ar[dr]_{τ} & s′ \ar[d]^{inx} \\ & t}

feedback (fb4)

\xymatrix{s \ar[r]^{outx} \ar[d]_{τ} & s′ \\ s′′} ⇒ \xymatrix{s \ar[r]^{outx} \ar[d]_{τ} & s′ \ar[d]^{τ} \\ s′′ \ar[r]^{outx} & t} or \xymatrix{s \ar[r]^{outx} \ar[d]_{τ} & s′ \ar[dl]^{inx} \\ s′′}

output-tau (fb5)

Theorem 6.18 (Characterization of out-buffered agents with feedback). An agent S: X→_{B}X is out-buf-fered with feedback if and only if S ≈ T for some agent T satisfying (fb1)–(fb5).

Before we prove this theorem, we need two lemmas. The first one gives a useful consequence of the axioms for out-bufferedness with or without feedback.

Lemma 6.19. Suppose an agent S satisfies either (ob1)–(ob3) or (fb1)–(fb5). Then it satisfies the following property, which we call backwards output-determinacy:

[figure: s; outx; s′; outx; t; ≈; t′] ⇒ s ≈ s′.

Proof. The proof is straightforward. The relation R := {⟨s, s′⟩ | s ≈ s′ or (∃t, t′)s ⟶^{outx} t ≈ t′ ⟵^{aoutx} s′} is weak bisimulation that relates s and s′. □

The next lemma establishes a technical property needed in the proof of Theorem 6.18. Recall that an agent T is ≈-reduced if T = T/≈.

Lemma 6.20. Assume T is ≈-reduced and satisfies (fb1)–(fb5). Define a subset A ⊆ {⟨s, t⟩ | s ⟶^{τ} t} as follows: ⟨s, t⟩ ∈ A iff for all sequences w ∈ X^{∗},

\xymatrix{s \ar[r]^{outw} \ar[d]_{τ} & u \\ t} ⇒ \xymatrix{s \ar[r]^{outw} \ar[d]_{τ} & u \ar[d]^{τ} \\ t \ar[r]^{outw} & v.}

Then the following hold:

1. Whenever s ⟶^{τ} t ⟶^{outx} t′ and s ⟶^{outx} s′ ⟶^{τ} t′, then ⟨s, t⟩ ∈ A iff ⟨s′, t′⟩ ∈ A.

2. If s ⟶^{τ} t and ⟨s, t⟩ ∉ A, then s ⟶^{outx}⟶^{inx} t for some x ∈ X.

Proof. 1. ⇒: Assume ⟨s, t⟩ ∈ A and s′ ⟶^{outw} u. Then there are v and t′′ with u ⟶^{τ} v and t ⟶^{outx} s′′ ⟶^{outw} v. By (fb3), s′ = s′′, hence s′ ⟶^{outw} v and u ⟶^{τ} v. This shows ⟨s′, t′⟩ ∈ A.

⇐: Conversely, assume ⟨s′, t′⟩ ∈ A and s ⟶^{outw} u. We show that there exists v with u ⟶^{τ} v and t ⟶^{outw} v.

Case 1: x ∉ w. We get s′ ⟶^{outw} u′ and u ⟶^{outx} u′ by (fb2), and t′ ⟶^{outw} v′ and u′ ⟶^{τ} v′ by the assumption that ⟨s′, t′⟩ ∈ A, then u ⟶^{τ} v_{1} ⟶^{outx} v′ and also t ⟶^{outw} v_{2} ⟶^{outx} v′ by (fb1). By Lemma 6.19, v_{1} ≈ v_{2}, hence, since T is ≈-reduced, v_{1} = v_{2}. We can take v = v_{1}. Case 2: x ∈ w. Let xw′ be a permutation of w that begins with x. By (fb1), s ⟶^{outx} s′′ ⟶^{outw′} u, and by (fb3), s′ = s′′. Since ⟨s′, t′⟩ ∈ A, one has u ⟶^{τ} v and t′ ⟶^{outw′} v for some v, hence t ⟶^{outxw′} v and again by (fb3), t ⟶^{outw} v.

2. Assume s ⟶^{τ} t and ⟨s, t⟩ ∉ A. By definition of A, there exists w ∈ X^{∗} with s ⟶^{outw} u such that there exists no v with t ⟶^{outw} v and u ⟶^{τ} v. Choose such a w of minimal length, and let w = w′x (note w cannot be the empty sequence). Then s ⟶^{outw′} s′ ⟶^{outx} u, t ⟶^{outw′} t′, and s′ ⟶^{τ} t′, and there is no v with t′ ⟶^{outx} v and u ⟶^{τ} v. By (fb5), there is a transition u ⟶^{inx} t′. From s ⟶^{outw′} s′ ⟶^{outx} u ⟶^{inx} t′ and (fb1), one gets s ⟶^{outx}⟶^{inx} t′′ ⟶^{outw′} t′. By Lemma 6.19, t′′ ≈ t, hence t′′ = t since T is ≈-reduced. This shows s ⟶^{outx}⟶^{inx} t. □

Proof of Theorem 6.18: Consider the following auxiliary operation on agents: For R: X→_{B}X, define R^{•} by

\frac{s ⟶^{α}_{R} t}{s ⟶^{α}_{R^{•}} t} \frac{s ⟶^{outx}_{R}⟶^{inx}_{R} t}{s ⟶^{τ}_{R^{•}} t} .

In general, (−)^{•} does not respect weak bisimulation. Notice that if R satisfies (ob1) or (ib1), then R^{∘} ≈ R^{•}.

⇒: Suppose S: X→_{B}X is out-buffered with feedback. Then there is some R satisfying (ob1)–(ob3), such that S ≈ R^{∘}. It is straightforward to verify that R^{•} satisfies (fb1)–(fb5), and we can take T = R^{•} ≈ R^{∘} ≈ S.

⇐: Suppose T: X→_{B}X satisfies (fb1)–(fb5). We will show T is out-buffered with feedback. Notice that T/≈ also satisfies (fb1)–(fb5), hence we can without loss of generality assume that T is ≈-reduced. Define a subset A ⊆ {⟨s, t⟩ | s ⟶^{τ} t} as in Lemma 6.20. Let R: X→_{B}X be the agent obtained from T by removing all transitions of the form s ⟶^{τ} t where ⟨s, t⟩ ∉ A. More precisely, |R| = |T| and s ⟶^{α}_{R} t iff α ≠ τ and s ⟶^{α}_{T} t, or α = τ and ⟨s, t⟩ ∈ A. We claim that R satisfies (ob1)–(ob3). Indeed, (ob1) and (ob2) follow from the respective properties of T in the case where α ≠ τ. In the case where α = τ, (ob1) for R follows from (fb1) for T and Lemma 6.20(1,⇐); whereas (ob2) follows from the definition of A and Lemma 6.20(1,⇒). Finally, (ob3) for R follows directly from (fb3) for T.

We now show that T = R^{•}. The two agents have the same states. For transitions, first note that ⟶_{R} ⊆ ⟶_{T}, and hence ⟶_{R^{•}} ⊆ ⟶_{T^{•}} = ⟶_{T}, with the latter equality holding because of (fb4). For the converse, assume s ⟶^{α}_{T} t. If α ≠ τ or ⟨s, t⟩ ∈ A, then s ⟶^{α}_{R} t and we are done. Else α = τ and ⟨s, t⟩ ∉ A, and by Lemma 6.20(2), s ⟶^{outx}⟶^{inx} t holds in T, hence in R. This shows s ⟶^{τ}_{R^{•}} t.

We have shown that T = R^{•} = R^{∘} for some R satisfying (ob1)–(ob3). Hence, T is out-buffered with feedback, which finishes the proof of Theorem 6.18. □

6.4 Example: Asynchronous CCS

In this section, we will show that an asynchronous version of Milner’s calculus of communicating systems (CCS) [40, 41] fits into the framework of out-buffered labeled transition systems with feedback.

Table 6.6: Transitions rules for asynchronous CCS

(act)  \overline{α.P ⟶^{α} P}
(sum) \frac{G ⟶^{α} P}{G + G′ ⟶^{α} P}
(sum′) \frac{G′ ⟶^{α} P}{G + G′ ⟶^{α} P}
(comp) \frac{P ⟶^{α} P′}{P |Q ⟶^{α} P′|Q}
(comp′) \frac{Q ⟶^{α} Q′}{P |Q ⟶^{α} P |Q′}

(synch) \frac{P ⟶^{α} P′  Q ⟶^{ᾱ} Q′}{P |Q ⟶^{τ} P′|Q′}
(res) \frac{P ⟶^{α} P′  α ∉ L ∪ L̄}{P \ L ⟶^{α} P′ \ L}
(rel)  \frac{P ⟶^{α} P′}{P [f] ⟶^{fα} P′[f]}
(rec)  \frac{P ⟶^{α} P′  A^{def} = P}{A ⟶^{α} P′}

Let X = {a, b, c, … } be an infinite set of names, and let X̄ = {ā, b̄, c̄, … } be a corresponding set of conames, such that X and X̄ are disjoint and in one-to-one correspondence via (¯ ). We also write ¯ ā = a. Names correspond to input-actions, and co-names to output-actions. Let τ ∉ X + X̄, and let Act = X + X̄ + {τ} be the set of actions. We use the letters α, β, … for actions. We use the letter L for sets of names, and we write L̄ for {ā | a ∈ L}. We use the letter f for relabeling functions, which are functions f : X → X. Any relabeling function extends to f : Act→ Actby letting fā = \overline{fa} and fτ = τ.

Let A, B, C, … range over a fixed set of process constants. Asynchronous CCS processes P, Q, … and guards G, H, … are given by the following grammars:

\begin{matrix}P ::= ā.0 P |P Q \ L P [f] A G \\ G ::= a.P τ.P G + H 0 \end{matrix}

Notice that the choice operator + is restricted to input- and τ-guarded processes. Output-guarded choice is traditionally disallowed in asynchronous process calculi. This is in accordance with the results of this chapter, since output-guarded choice violates the two asynchronous principles of output-determinacy and output-confluence. For the π-calculus, Nestmann and Pierce [44] have recently shown that input-guarded choice can be encoded from the other constructs; hence they include it in their version of the asynchronous π-calculus, and we include it here for asynchronous CCS as well.

Assume a set of defining equations A^{def} = P, one for each process constant A. The operational semantics of asynchronous CCS is given in terms of a labeled transition system S_{CCS} = ⟨S, Act, ⟶⟩, which is defined in Table 6.6. The states are CCS processes. Notice that we have not specified a distinguished initial state; this is more convenient in this context, and no harm is done. Also notice that there is no rule for 0. This is because the process 0 is inert, i.e.there are no transitions 0 ⟶^{α} P.

Lemma 6.21. If G ⟶^{α} P for a guard G, then α ∉ X̄, i.e.α is not an output action.

Proof. By induction on the derivation of G ⟶^{α} P. □

To fit the labeled transition system S_{CCS} into our framework of labeled transition systems with input and output, we simply identify the set X of names with InX, and the set X̄ of co-names with OutX. Then S_{CCS} is a labeled transition system of type X→X. Before we prove that this system is out-buffered with feedback, observe that output-determinacy fails for S_{CCS}:

\xymatrix{ā.0|ā.0 \ar[r]^{ā} \ar[d]_{ā} & 0|ā \\ ā|0,}

and 0|ā ≠ ā|0. The following lemma helps to remedy the situation:

Lemma 6.22. An agent S is out-buffered with feedback if it satisfies (fb1), (fb2), (fb5), (fb4) and the following property (weak-fb3), which we call weak output-determinacy:

\xymatrix{s \ar[r]^{outy} \ar[d]_{outy} & s′ \\ s′′} ⇒ \xymatrix{s \ar[r]^{outy} \ar[d]_{outy} & s′ \ar[d]^{outy} \\ s′′ \ar[r]^{outy} & t} or s′ = s′′

Proof. First notice that if S satisfies the hypothesis, then so does S/≈, hence one can without loss of generality assume that S is ≈-reduced. Next, one shows backwards output-determinacy as in Lemma 6.19. For a ≈-reduced process, backwards output-determinacy and (weak-fb3) already implies (fb3), and therefore S is out-buffered with feedback by Theorem 6.18. □

Theorem 6.23. The labeled transition system S_{CCS} is out-buffered with feedback.

Proof. By Lemma 6.22, it suffices to show that S_{CCS} satisfies the axioms (fb1), (fb2), (weak-fb3), (fb5), and (fb4). Each of these is proved in a similar fashion. (fb1), (fb2), (weak-fb3) and (fb4) can be proved independently, while (fb5) relies on (fb2) and (weak-fb3) as hypotheses. Since this is the most interesting case, we show only the proof of (fb5). Suppose therefore that (fb2) and (weak-fb3) have already been proved. We want to show

\xymatrix{P \ar[r]^{b̄} \ar[d]_{τ} & Q \\ R} ⇒ \xymatrix{P \ar[r]^{b̄} \ar[d]_{τ} & Q \ar[d]^{τ} \\ R \ar[r]^{b̄} & S} or \xymatrix{P \ar[r]^{b̄} \ar[d]_{τ} & Q \ar[dl]^{b} \\ R} .

We show this by induction on the derivation of P ⟶^{b̄} Q. We distinguish six cases based on the last rule in that derivation. Remember that this last rule cannot have been (sum) or (sum′) by Lemma 6.21.

(act): P = b̄.0 and Q = 0. This is impossible, since b̄.0 −̸ →^{τ} R.

(comp): P = P′|P′′ and Q = Q′|P′′, where P′ ⟶^{b̄} Q′. Then P ⟶^{τ} R must have been inferred by one of the rules (comp), (comp′) or (synch). Therefore, R = R′|R′′, and one of the following holds:

Case 1: P′ ⟶^{τ} R′ and P′′ = R′′. By induction hypothesis on P′ ⟶^{τ} R′ and P′ ⟶^{b̄} Q′, either there is S′ with R′ ⟶^{b̄} S′ and Q′ ⟶^{τ} S′, in which case we can choose S = S′|P′′; or else Q′ ⟶^{b} R′, and hence

Q = Q′|P′′ ⟶^{b} R′|P′′ = R.

Case 2: P′ = R′ and P′′ ⟶^{τ} R′′. Then one can choose S = Q′|R′′.

Case 3: P′ ⟶^{α} R′ and P′′ ⟶^{ᾱ} R′′. In case α ≠ b̄, we can use (fb2) to get R′ ⟶^{b̄} S′ and Q′ ⟶^{α} S′, and we let S = S′|R′′. In case α = b̄, we can use (weak-fb3) to get either R′ ⟶^{b̄} S′ and Q′ ⟶^{b̄} S′, and we

let again S = S′|R′′; or else R′ = Q′, and hence Q = Q′|P′′ ⟶^{b=ᾱ} Q′|R′′ = R.

(comp′): This case is symmetric to the previous one.

Table 6.7: Transitions rules for the core join calculus

(str1 )  Δ ⊢_{N} Π, P |Q ⇀ Δ ⊢_{N} Π, P, Q
(str2 ) Δ ⊢_{N} Π, def R_{1} ∧ … ∧ R_{m} in P ⇀ Δ, R_{1}, …, R_{m} ⊢_{N′} Π, P
where N′ = N + dn(R_{1}, …, R_{m})
(join)  Δ ⊢_{N} Π, x_{1}⟨ỹ_{1}⟩, …, x_{n}⟨ỹ_{n}⟩ ↦ Δ ⊢_{N} Π, [ỹ_{1}/ṽ_{1}, …, ỹ_{n}/ṽ_{n}]P
where (x_{1}(ṽ_{1})| … |x_{n}(ṽ_{n}) ⊳ P) ∈ Δ

(res): P = P′ \ L and Q = Q′ \ L, where P′ ⟶^{b̄} Q′ and b ∉ L. Then R = R′ \ L and P′ ⟶^{τ} R′. By induction hypothesis, we get either Q′ ⟶^{τ} S′ and R′ ⟶^{b̄} S′ for some S′, and we can let S = S′ \ L. Or else we get Q′ ⟶^{b} R′, hence Q ⟶^{b} R.

(rel): P = P′[f] and Q = Q′[f], where P′ ⟶^{c̄} Q′ and b̄ = fc̄. Then R = R′[f] and P′ ⟶^{τ} R′. By induction hypothesis, we get either Q′ ⟶^{τ} S′ and R′ ⟶^{c̄} S′ for some S′, and we can let S = S′[f]. Or else we get

Q′ ⟶^{c} R′, hence Q ⟶^{b} R.

(rec): P = A where A^{def} = P′ and P′ ⟶^{b̄} Q. Since A ⟶^{τ} R, we must also have P′ ⟶^{τ} R, and the claim follows by induction hypothesis. □

6.5 Example: The core join calculus

The join calculus was introduced by Fournet and Gonthier in [17] and further developed in [18]. It is a concurrent, message passing calculus like the π-calculus. However, the reaction rule is simpler and closer to the semantics of a chemical abstract machine. Moreover, the scoping rules of the join calculus are such that locality can be easily modeled. The full join calculus deals with a distributed system of locations, and it contains features that deal with such issues as migration and failure. Here, we will only be concerned with the core join calculus, which is the fragment of the join calculus that pertains to a single location.

Let N be a countable set of names. We use x, y, … to denote names, and x̃, ỹ, … to denote sequences of names. Core join calculus processes P, Q, … and rule R, S, … are given by the following grammars:

P ::= x⟨ỹ⟩ P |Q def R_{1} ∧ … ∧ R_{m} in P R ::= x_{1}(ṽ_{1})| … |x_{n}(ṽ_{n}) ⊳ P

A process of the form x⟨ṽ⟩ is called a message. In the rule R = x_{1}(ṽ_{1})| … |x_{n}(ṽ_{n}) ⊳ P, the names ṽ_{1} … ṽ_{n} are bound, and they are assumed to be distinct. The names x_{1} … x_{n} are called the defined names of R, denoted dn(R). Finally, all of the defined names of R_{1}, …, R_{m} are bound in the process def R_{1} ∧ … ∧ R_{m} in P. For a more comprehensive treatment, see [17, 18].

The semantics of the core join calculus is given in the style of a chemical abstract machine. A state Δ ⊢_{N} Π is a multiset Δ of rules together with a multiset Π of processes. N is a set of names, such that fn(Δ, Π) ⊆ N. We identify states up to α-equivalence, i.e.up to renaming of bound variables. The transitions of this machine follow a simple idea: the processes on the right hand side evolve according to the rules on the left-hand side. There are two kinds of transitions: structural transitions, denoted ⇀, and reactions, denoted ↦. The transition rules are shown in Table 6.7. The rule (join) is of course only applicable is the length of ỹ_{i} and ṽ_{i} are the same, for all i. Note that in the rule (str2 ), the sets N and dn(R_{1}, …, R_{m}) must be disjoint; this may necessitate renaming some bound variables in def R_{1} ∧ … ∧ R_{m} in P.

Remark. In the original formulation of the join-calculus [17, 18], the structural rules are assumed to be reversible. We adopt a different convention here. Especially the inverse of rule str2 causes problems in our setting, as it allows a state under certain conditions to rename its free names.

To make make the join calculus into a labeled transition system with input and output, let X = {x⟨ỹ⟩ | x ∈ N , ỹ ∈ N^{∗}} be the set of messages. We add input and output transitions:

(in)  Δ ⊢_{N} Π ⟶^{inx⟨ỹ⟩} Δ ⊢_{N∪{x,ỹ}} Π, x⟨ỹ⟩
(out) Δ ⊢_{N} Π, x⟨ỹ⟩ ⟶^{outx⟨ỹ⟩} Δ ⊢_{N} Π

Further, we let ⟶^{τ} = ⇀ ∪ ↦. With these definitions, the join calculus defines a labeled transition system S_{join}: X→X.

Theorem 6.24. The labeled transition system S_{join} defined by the core join calculus is out-buffered with feedback.

6.6 Other characterizations of asynchrony

In Sections 6.2 and 6.3, we have characterized notions of asynchrony by first-order axioms up to weak bisimulation. It is possible to remove the words “up to weak bisimulation”, i.e.to characterize asynchrony directly. This happens at the cost of introducing second-order axioms. The shift to second-order seems to be inevitable, since weak bisimulation itself is a second-order notion.

6.6.1 Out-buffered agents

Consider the two different output transitions in

S = [figure: s; inx; τ; outy; t; outy; u.; v]

The transition s ⟶^{outy} u has the implicit effect of disabling the action inx. The transition t ⟶^{outy} u has no such side effect. Roughly, out-bufferedness is characterized by the fact that every output transition ⟶^{outy}

factors into a silent part ⇒^{τ} and a part ≈≻^{outy} without side effects.

The second-order axioms for out-buffered agents are given in Table 6.8. A state s in an LTS S is reachable if there exist transitions s_{0} ⟶^{α_{1}} … ⟶^{α_{n}} s from the initial state s_{0}. If S ≈ T, then for every reachable s ∈ S, there is reachable t ∈ T with s ≈ t.

Theorem 6.25. An agent S: X→_{B}Y is out-buffered if and only if there exists a binary relation ≈≻^{outy} ⊆ |S| × |S| for each y ∈ Y, satisfying (ob1*)–(ob5*).

Proof. ⇒: Suppose S is out-buffered. By Theorem 6.10, S ≈ T for some T satisfying (ob1)–(ob3). For

s, t ∈ |S|, define s ≈≻^{outy} t iff there exist s′, t′ ∈ |T| with s ≈ s′ ⟶^{outy} t′ ≈ t. It is easy to verify that ≈≻^{outy} satisfies (ob1*)–(ob5*).

⇐: Suppose S satisfies (ob1*)–(ob5*). Notice that if a relation ≈≻^{outy} satisfies (ob1*)–(ob5*), then so does

≈ ∘ ≈≻^{outy} ∘ ≈. Hence assume without loss of generality that ≈≻^{outy} is invariant under weak bisimulation. For any

sequence w = y_{1}y_{2} ⋯ y_{n} ∈ Y^{∗}, write s ≈≻^{outw} t if s ≈≻^{outy_{1}} ≈≻^{outy_{2}} ⋯ ≈≻^{outy_{n}}≈ t. Note that in the case n = 0 this

Table 6.8: Second-order axioms for out-buffered agents

[figure: s; ≈≻^{outy}; α; t; s′] ⇒ [figure: s; ≈≻^{outy}; α; t; α; s′; ≈≻^{outy}; t′]

where α ≠ outy (ob1*)

[figure: s; ≈≻^{outy}; t; α; t′] ⇒ [figure: s; ≈≻^{outy}; α; t; α; s′; ≈≻^{outy}; t′]

where α ≠ outy (ob2*)

[figure: s; ≈≻^{outy}; outy; t; s′] ⇒ [figure: s; ≈≻^{outy}; outy; t; τ; s′; ≈; t′]

(ob3*)

s ≈≻^{outy} t ⇒ s ⟹^{outy}≈ t

(ob4*)

s ⟶^{outy} t ⇒ s ⇒^{τ}≈≻^{outy} t

where s reachable (ob5*)

means s ≈ t. Consider the relation R ⊆ |S| × |S; B| defined by R = {⟨s, ⟨t, w⟩⟩ | s ≈≻^{outw} t and t reachable}. Clearly, R relates initial states: s_{0}R⟨s_{0}, ∅⟩. We show that R is a weak bisimulation. Suppose

[figure: s; R; α; ⟨t, w⟩; s′,]

where w = y_{1} ⋯ y_{n}. Case 1: α is outy_{i} for some 1 ⩽ i ⩽ n. Take the minimal such i. Then

[figure: s; ≈≻^{outy_{1}}; outy_{i}; ⋯; ≈≻^{outy_{i−1}}; •; ≈≻^{outy_{i}}; outy_{i}; •; ≈≻^{outy_{i+1}}; τ; ⋯; ≈≻^{outy_{n}}; •; ≈; τ; t; τ; s′; ≈≻^{outy_{1}}; ⋯; ≈≻^{outy_{i−1}}; •; ≈; •; ≈≻^{outy_{i+1}}; ⋯; ≈≻^{outy_{n}}; •; ≈; t′]

by (ob1*) and (ob3*). With w′ = y_{1} ⋯ y_{i−1}y_{i+1} ⋯ y_{n} we hence have s′R⟨t′, w′⟩, and also ⟨t, w⟩ ⟹^{outy_{i}} ⟨t′, w′⟩.✓

Case 2: α ≠ outy_{i} for all i. From s ⟶^{α} s′ and s ≈≻^{outw} t, by repeated application of (ob3*), we get s′ ≈≻^{outw} t′

and t ⇒^{α} t′ for some t′, hence s′R⟨t′, w⟩ and ⟨t, w⟩ ⇒^{α} ⟨t′, w⟩.✓

Now suppose

[figure: s; R; ⟨t, w⟩; α; ⟨t′, w′⟩.]

We distinguish three cases for ⟨t, w⟩ ⟶^{α} ⟨t′, w′⟩ by Definition 6.2:

Case 1: t ⟶^{α} t′, w = w′ and α not output. Then s ≈≻^{outw} t ⟶^{α} t′ implies s ⇒^{α} s′ ≈≻^{outw} t′ by repeated application of (ob2*), i.e.s ⇒^{α} s′R⟨t′, w⟩.✓ Case 2: t = t′, w ⟶^{α} w′ and α not input. If w = y_{1} ⋯ y_{n}, then α = outy_{i} for some 1 ⩽ i ⩽ n. Let i be the minimal such index. Then

[figure: s; ≈≻^{outy_{1}}; outy; ⋯; ≈≻^{outy_{i−1}}; •; ≈≻^{outy_{i}}; outy; •; ≈≻^{outy_{i+1}}; ⋯; ≈≻^{outy_{n}}; •; ≈; t; s′; ≈≻^{outy_{1}}; ⋯; ≈≻^{outy_{i−1}}; •; ≈; •]

by (ob4*) and (ob2*), hence s ⟹^{outy} s′R⟨t, w′⟩.✓ Case 3: t ⟶^{outy} t′, w ⟶^{iny} w′ and α = τ. Then w′ = wy. By (ob5*), since t is reachable, there is t′′

with t ⇒^{τ} t′′ ≈≻^{outy} t′. Then s ≈≻^{outw} t and repeated application of (ob2*) give s ⇒^{τ} s′ ≈≻^{outw} t′′ ≈≻^{outy} t′, hence sR⟨t′, w′⟩.✓ □

Remark. Notice that Principle 6.1 can be applied to obtain a unique maximal relation ≈≻^{outy}, for every y, satisfying (ob1*)–(ob4*). Thus, S is out-buffered if this unique relation also satisfies (ob5*). Notice in particular how (ob1*) and (ob2*) resemble the definition of weak bisimulation; one may think of the relation

≈≻^{outy} as a weak bisimulation up to a suspended output.

6.6.2 In-buffered agents

The second-order axioms for in-buffered agents are given in Table 6.9. This is similar to the axioms for out-buffered agents, but notice that there is no analogue to (ob2*). This reflects the fact that unlike output transitions, input transitions can enable, but not disable other transitions.

Theorem 6.26. An agent S: X→_{B}Y is in-buffered if and only if there exists a binary relation ≈≻^{inx} for each x ∈ X, satisfying (ib1*)–(ib4*).

Proof. ⇒: As in the proof of Theorem 6.25.

⇐: Suppose S satisfies (ib1*)–(ib4*). Again, we can without loss of generality assume that ≈≻^{inx} is invariant

under weak bisimulation. For any sequence w = x_{1}x_{2} ⋯ x_{n} ∈ X^{∗}, write s ≈≻^{inw} t if s ≈≻^{inx_{1}}≈≻^{inx_{2}} ⋯ ≈≻^{inx_{n}}≈ t

(n ⩾ 0). Consider the relation R ⊆ |B; S| × |S| defined by R = {⟨⟨w, s⟩, t⟩ | s ≈≻^{inw} t and t reachable}. Notice that R relates initial states: ⟨∅, s_{0}⟩Rs_{0}. To see that R is a weak bisimulation, suppose

[figure: ⟨w, s⟩; R; t; α; t′,]

where w = x_{1} ⋯ x_{n}. From s ≈≻^{inw} t, with (ib3*) and weak bisimulation we get s ⟹^{inw} s′ ≈ t, hence s′ ⇒^{α} s′′ for some s′′ ≈ t′. Consequently ⟨w, s⟩ ⇒^{τ} ⟨∅, s′⟩ ⇒^{α} ⟨∅, s′′⟩Rt′. Conversely, suppose

[figure: ⟨w, s⟩; R; α; t; ⟨w′, s′⟩.]

Again, we distinguish three cases: Case 1: s = s′, w ⟶^{α} w′ and α not output. Then α = inx and w′ = wx for some x ∈ X. By (ib4*),

t ≈≻^{inx} t′′ for some t′′, and by (ib3*), t ⟹^{inx} t′ ≈ t′′, hence also t ≈≻^{inx} t′, and we get s ≈≻^{inw} t ≈≻^{inx} t′, i.e.

⟨w′, s⟩Rt′ and t ⟹^{inx} t′.✓

Case 2: s ⟶^{α} s′, w = w′ and α not input. From s ≈≻^{inw} t by repeated application of (ib1*), we get t ⇒^{α} t′

and s′ ≈≻^{inw} t′, i.e.⟨w, s′⟩Rt′.✓

Case 3: w ⟶^{outx} w′, s ⟶^{inx} s′ and α = τ. If w = x_{1}x_{2} ⋯ x_{n}, then x must be x_{i} for some 1 ⩽ i ⩽ n. Let such i be minimal and construct

[figure: s; ≈≻^{inx_{1}}; inx; ⋯; ≈≻^{inx_{i−1}}; •; ≈≻^{inx_{i}}; inx; •; ≈≻^{inx_{i+1}}; τ; ⋯; ≈≻^{inx_{n}}; •; ≈; τ; t; τ; s′; ≈≻^{inx_{1}}; ⋯; ≈≻^{inx_{i−1}}; •; ≈; •; ≈≻^{inx_{i+1}}; ⋯; ≈≻^{inx_{n}}; •; ≈; t′]

by (ib1*) and (ib2*). This shows ⟨s′, w′⟩Rt′.✓ □

Table 6.9: Second-order axioms for in-buffered agents

[figure: s; ≈≻^{inx}; α; t; s′] ⇒ [figure: s; ≈≻^{inx}; α; t; α; s′; ≈≻^{inx}; t′]

where α ≠ inx (ib1*)

[figure: s; ≈≻^{inx}; inx; t; s′] ⇒ [figure: s; ≈≻^{inx}; inx; t; τ; s′; ≈; t′]

(ib2*)

s≈≻^{inx}t ⇒ s ⟹^{inx} s′ ≈ t ; (ib3*)

s ⇒ s ≈≻^{inx} s′

where s reachable (ib4*)

Table 6.10: Second-order axioms for out-queued agents

[figure: s; ≈≻≻^{outy}; α; t; s′] ⇒ [figure: s; ≈≻≻^{outy}; α; t; α; s′; ≈≻≻^{outy}; t′]

where α not output (oq1*)

[figure: s; ≈≻≻^{outy}; t; α; t′] ⇒ [figure: s; ≈≻≻^{outy}; α; t; α; s′; ≈≻≻^{outy}; t′]

where α not output (oq2*)

[figure: s; ≈≻≻^{outy}; outz; t; s′] ⇒ y = z and [figure: s; ≈≻≻^{outy}; outz; t; τ; s′; ≈; t′]

(oq3*)

s≈≻≻^{outy}t ⇒ s ⟹^{outy}≈ t

(oq4*)

s ⟶^{outy} t ⇒ s ⇒^{τ}≈≻≻^{outy} t

where s reachable (oq5*)

Table 6.11: Second-order axioms for in-queued agents

[figure: s; ≈≻≻^{inx}; α; t; s′] ⇒ [figure: s; ≈≻≻^{inx}; α; t; α; s′; ≈≻≻^{inx}; t′]

where α not input (iq1*)

[figure: s; ≈≻≻^{inx}; inx; t; s′] ⇒ [figure: s; ≈≻≻^{inx}; inx; t; τ; s′; ≈; t′]

(iq2*)

s≈≻≻^{inx}t ⇒ s ⟹^{inx}≈ t ; (iq3*)

s ⇒ s ≈≻≻^{inx} s′

where s reachable (iq4*)

6.6.3 Out-queued and in-queued agents

The second-order axioms for out- and in-queued agents are given in Tables 6.10 and 6.11, respectively. Notice that the only difference to the buffered case are the side conditions. Theorem 6.27. An agent S: X→_{B}Y is out-queued if and only if there are relations ≈≻≻^{outy} satisfying (oq1*)– (oq5*). S is in-queued if and only if there are relations ≈≻≻^{inx} satisfying (iq1*)–(iq4*). □

Bibliography

[1] S. Abramsky. Interaction categories and communicating sequential processes. In A. W. Roscoe, editor, A Classical Mind: Essays in honour of C. A. R. Hoare, pages 1–16. Prentice Hall International, 1994.

[2] S. Abramsky, S. Gay, and R. Nagarajan. Interaction categories and typed concurrent programming. In Proceedings of the 1994 Marktoberdorf Summer School. Springer, 1994.

[3] S. Abramsky and A. Jung. Domain theory. In S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, editors, Handbook of Logic in Computer Science, volume 3, pages 1–168. Clarendon Press, 1994.

[4] R. M. Amadio, I. Castellani, and D. Sangiorgi. On bisimulations for the asynchronous π-calculus. In Proc. CONCUR ’96, Springer LNCS 1119, pages 147–162, 1996.

[5] H. P. Barendregt. The Lambda Calculus, its Syntax and Semantics. North-Holland, 2nd edition, 1984.

[6] M. A. Bednarczyk. Categories of asynchronous systems. PhD thesis, University of Sussex, 1988.

[7] G. Berry. Stable models of typed λ-calculi. In Proceedings of the 5th International Colloquium on Automata, Languages and Programming, Springer LNCS 62, pages 72–89, 1978.

[8] G. Berry and G. Boudol. The chemical abstract machine. Theoretical Computer Science, 96:217–248, 1992.

[9] G. Boudol. Asynchrony and the π-calculus. Technical Report 1702, INRIA, Sophia-Antipolis, 1992.

[10] K. B. Bruce and A. R. Meyer. The semantics of second-order polymorphic lambda calculus. In G. Kahn, D. B. MacQueen, and G. Plotkin, editors, Proc. Conf. on Semantics of Data Types, Sophia-Antipolis, 1984, Springer LNCS 173, pages 131–144, 1984.

[11] S. Bulman-Fleming and W. Taylor. Union-indecomposable varieties. Colloquium Mathematicum, 35:189–199, 1976.

[12] A. Church and J. B. Rosser. Some properties of conversion. Transactions of the American Mathematical Society, 39:472–482, 1936.

[13] P. M. Cohn. Universal Algebra, Revised Edition. D. Reidel Publishing, Holland, 1981.

[14] D. Čubrić. Embedding of a free cartesian closed category into the category of sets. Journal of Pure and Applied Algebra, 1995.

[15] D. Čubrić. On the semantics of the universal quantifier. Annals of Pure and Applied Logic, 1997. To appear.

[16] P. Di Gianantonio, F. Honsell, S. Liani, and G. D. Plotkin. Countable non-determinism and uncountable limits. In Proceedings of CONCUR ’94, Springer LNCS 836, 1994. See also: Uncountable limits and the Lambda Calculus, Nordic Journal of Computing 2, 1995.

[17] C. Fournet and G. Gonthier. The reflexive cham and the join-calculus. In POPL ’96: Proceedings of the 23rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1996.

[18] C. Fournet, G. Gonthier, J.-J. Levy, L. Maranget, and D. Remy. A calculus of mobile agents. In Proceedings of CONCUR ’96, Springer LNCS 1119, pages 406–421, 1996.

[19] P. J. Freyd. Combinators. In Proc. Mathematical Applications to Computer Science. American Mathematical Society, 1989.

[20] P. J. Freyd and A. Scedrov. Categories, Allegories. North-Holland, 1989.

[21] H. Friedman. Equality between functionals. In R. Parikh, editor, Proceedings of the Logic Colloquium ’73, Springer Lecture Notes in Mathematics 453, pages 22–37, 1975.

[22] J.-Y. Girard. Une extension de l’interpretation de Gödel à l’analyse, et son application a l’elimination des coupures dans l’analyse et la théorie des types. In J. E. Fenstad, editor, Proceedings of the Second Scandinavian Logic Symposium, pages 63–92. North-Holland, 1971.

[23] J.-Y. Girard. The system F of variable types, fifteen years later. Theoretical Computer Science, 45:159– 192, 1986.

[24] G. Grätzer. Universal Algebra. D. Van Nostrand, 1968.

[25] J. Hagemann and A. Mitschke. On n-permutable congruences. Algebra Universalis, 3:8–12, 1973.

[26] K. Honda and M. Tokoro. An object calculus for asynchronous communication. In Proc. ECOOP 91, Geneve, 1991.

[27] F. Honsell and S. Ronchi Della Rocca. An approximation theorem for topological lambda models and the topological incompleteness of lambda calculus. Journal of Computer and System Sciences, 45(1), 1992.

[28] G. Huet, editor. Logical Foundations of Functional Programming. Addison-Wesley, 1990.

[29] M. Hyland. A syntactic characterization of the equality in some models for the lambda calculus. J. London Math. Soc., 12:361–370, 1976.

[30] B. Jacobs, I. Margaria, and M. Zacchi. Filter models with polymorphic types. Theoretical Computer Science, 95:143–158, 1992.

[31] C. P. J. Koymans. Models of the lambda calculus. Information and Control, 52:306–332, 1982.

[32] J.-L. Krivine. Lambda-calculus, types and models. Masson, 1993.

[33] J. Lambek. From λ-calculus to cartesian closed categories. In J. P. Seldin and J. R. Hindley, editors, To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, pages 375–402. Academic Press, London, New York, 1980.

[34] J. Lambek and P. J. Scott. An Introduction to Higher Order Categorical Logic. Cambridge Studies in Advanced Mathematics 7. Cambridge University Press, New York, 1986.

[35] N. A. Lynch and E. W. Stark. A proof of the Kahn principle for input/output automata. Information and Computation, 82:81–92, 1989.

[36] S. MacLane. Categories for the Working Mathematician. Springer GTM 5. 1971.

[37] A. I. Mal’cev. K obščeǐ teorii algebraičeskih sistem. Mat. Sb. N. S. 35 (77), pages 3–20, 1954.

[38] A. R. Meyer. What is a model of the lambda calculus? Information and Control, 52:87–122, 1982.

[39] A. R. Meyer, J. C. Mitchell, E. Moggi, and R. Statman. Empty types in polymorphic lambda calculus. In Proceedings of the 14th ACM Symposium on Principles of Programming Languages, pages 253–262, 1987. Reprinted in [28].

[40] R. Milner. A Calculus of Communicationg Systems. Springer LNCS 92. 1980.

[41] R. Milner. Operational and algebraic semantics of concurrent processes. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B. Elsevier, 1990.

[42] J. C. Mitchell and E. Moggi. Kripke-style models for typed lambda calculus. Annals of Pure and Applied Logic, 51:99–124, 1991.

[43] J. Myhill and R. Flagg. A type-free system extending (ZFC). Annals of Pure and Applied Logic 43, pages 79–97, 1989.

[44] U. Nestmann and B. C. Pierce. Decoding choice encodings. In Proceedings of CONCUR ’96, Springer LNCS 1119, pages 179–194, 1996.

[45] C. Palamidessi. Comparing the expressive power of the synchronous and the asynchronous π-calculus. In POPL ’97: Proceedings of the 24th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Paris), 1997.

[46] G. D. Plotkin. The λ-calculus is ω-incomplete. The Journal of Symbolic Logic, 39:313–317, 1974.

[47] G. D. Plotkin. Domains. Department of Computer Science, University of Edinburgh, 1983.

[48] G. D. Plotkin. Set-theoretical and other models of the lambda-calculus. Theoretical Computer Science, 121:351–409, 1993.

[49] G. D. Plotkin. A semantics for static type inference. Information and Computation, 109:256–299, 1994.

[50] G. D. Plotkin. On a question of H. Friedman. Information and Computation, 126(1):74–77, 1996.

[51] J. C. Reynolds. Towards a theory of type structure. In Proceedings, Colloque sur la Programmation, Springer LNCS 19, pages 408–425, 1974.

[52] J. C. Reynolds. Polymorphism is not set-theoretic. In International Symposium on Semantics of Data Types, Springer LNCS 173, pages 145–156, 1984.

[53] D. S. Scott. Continuous lattices, toposes, algebraic geometry and logic. In F. W. Lawvere, editor, Proc. 1971 Dalhousie Conference, Springer Lecture Notes in Mathematics 274, pages 97–136, 1972.

[54] D. S. Scott. Relating theories of the λ-calculus. In To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, pages 403–450. Academic Press, London, New York, 1980.

[55] R. A. G. Seely. Hyperdoctrines, natural deduction and the Beck condition. Zeitschrift für mathematische Logik und Grundlagen der Mathematik, 29:505–542, 1983.

[56] R. A. G. Seely. Categorical semantics for higher order polymorphic lambda calculus. The Journal of Symbolic Logic, 52(4), Dec. 1987.

[57] P. Selinger. Order-incompleteness and finite lambda models. Extended abstract. In Proceedings of the Eleventh Annual IEEE Symposium on Logic in Computer Science, pages 432–439, 1996.

[58] P. Selinger. First-order axioms for asynchrony. In Proceedings of CONCUR ’97, Springer LNCS, 1997. To appear.

[59] M. W. Shields. Concurrent machines. Theoretical Computer Science, 28:449–465, 1985.

[60] A. K. Simpson. Categorical completeness results for the simply-typed lambda-calculus. In Proc. TLCA ’95, Springer LNCS 902, pages 414–427, 1995.

[61] M. B. Smyth and G. D. Plotkin. The category-theoretic solution of recursive domain equations. SIAM Journal on Computing, 11(4):761–783, 1982.

[62] C. Strachey. Fundamental concepts in programming languages. Unpublished lecture notes, International Summer School in Computer Programming, Copenhagen, Aug. 1967.

[63] W. Taylor. Structures incompatible with varieties, Abstract 74T-A224. Notices of the American Mathematical Society, 21:A-529, 1974.

[64] C. P. Wadsworth. The relation between computational and denotational properties for Scott’s D_{∞}- models of the lambda-calculus. SIAM Journal on Computing, 5:488–521, 1976.

Index

absolute interpretation in an algebra, 27, 39 of the lambda calculus, 26

absolutely unorderable algebra, 39 action, 84

in CCS, 97 input and output, 85 internal, 85 silent or unobservable, 84

adjunction, 7 agent, 85

buffer B, 87 buffered, 87 composition with function, 93 domain extension and restriction, 93 feedback, 94 hiding, 93 in-buffered, 87 in-queued, 87 input and output action, 85 internal action, 85 isomorphism of, 86 operations on, 93 out-buffered, 87 out-buffered with feedback, 94 out-queued, 87 output action, 85 parallel composition

with interaction, 94 without interaction, 93

queue Q, 87 queued, 87 renaming, 93 self-composition, 94 sequential composition, 85 silent action, 84 symmetric monoidal structure, 93

algebra, 13 dcpo-algebra, 17, 41 free, 14 ordered, 16, 40 polynomial, 15 quotient, 13

term algebra, 14 algebraic signature, 13 algebraic variety, 14

of combinatory algebras, 22 of lambda algebras, 24

∀-diagram, 73 α-equivalence, 20 antisymmetry, 10 applicative structure, 22 extensional, 30 order-extensional, 49 ordered, 47 partial, 51 unorderable, 36

arity, 13

asynchronous CCS, 96 asynchrony, 83, 87

backwards output-determinacy, 95

base category, 72

Beck-Chevalley condition, 73

Berry order, 11 β-conversion, 20 β-reduction, 21 bilimit, 12 binary product, 8 bisimulation

strong, 84 weak, 84

bound name, in join calculus, 99

bound variable, in lambda calculus, 20, 64, 78 bound, upper and lower, 10 bounded complete cpo, 11 bounded tree, 50 buffer B, 87 buffered agent, 87

calculus of communicating systems, 96 cartesian-closed category, see ccc categorical model

of conversion, 30 of reduction, 48

categories

equivalence of, 7 category, 5

cartesian-closed, see ccc cocomplete, 8 complete, 8 discrete, 5 dominated by a poset, 64 dual, 5 functor category, 7 of complete partial orders CPO, 11 of directed complete partial orders DCPO,

11 of non-empty sets 𝒮^{+}, 62 of presheaves 𝒮^{C^{op}}, 9 of presheaves over a poset 𝒮^{P}, 63 of sets 𝒮, 5, 62 PL-category, 72 small, 5 standard structure D̃, 75

ccc, 9 associated to a theory, 67 congruence, 58 free, 67 representation, 9

Henkin representation, 58 special, 62, 70

CCS, 96 chain, 11 channel

asynchronous, 83, 87 synchronous, 83

Church numerals, 21 Church-Rosser property, 21 closed combinatory term, 22 closed lambda term, 20 closed term algebra, 22, 36 co-name, in CCS, 97 co-unit of adjunction, 7 cocomplete category, 8 cocone, 8 codomain of a morphism, 5 colimit, 8 collectively monic, 6 combinator, 22 combinatory algebra, 22

homomorphism of, 22 unorderable, 36 valuation in, 22

combinatory completeness, 23 combinatory logic, 22

derived lambda abstractor, 23 combinatory term, 22 communication

asynchronous, 83, 87 synchronous, 83

commutativity input, 90 output, 89

compatible elements, 10, 38, 50 compatible relation, 13 preorder, 36, 39 complete category, 8 complete lattice, 10 complete partial order, 11

bounded complete, 11

meet cpo, 11 composition, 5

agent and function, 93 parallel

with interaction, 94 without interaction, 93

sequential, 85, 94 cone, 7

collectively monic, 6

limiting, 8 confluence

Church-Rosser, 21

input, 90 output, 89

congruence on algebra, 13 on ccc, 58 on PL-category, 74

consistency of the lambda calculus, 22 of the Mal’cev axioms, 42

constant, 20 individual, 64, 78 process, 97 type, 64

continuity ω-continuity, 11 Scott-continuity, 11

continuous functor, 12 locally, 13

continuously complete model, 38 contravariant functor, 6 conversion, 20

categorical model of, 30 syntactical model of, 48

core join calculus, 99

core of an extended theory, 70 covariant functor, 6 cover, 60

split, 60 cpo, 11

bounded complete, 11 meet cpo, 11

Curry algebra, 30 Curry axioms for lambda algebras, 24 currying, 9

D_{∞}-model, 13, 54 dcpo, 11 dcpo-algebra, 17, 41 dcpo-variety, 17, 41 defined name, in join calculus, 99 derived lambda abstractor, 23 determinacy

input, 90 output, 89

backwards, 95 weak, 98

diagonal axiom, 42 diagram, 7

∀-diagram, 73 binary product, 8 exponential, 9 limit of, 8 partial ∀-diagram, 74 partial exponential, 59 product, 8

diamond property, 21 directed complete partial order, 11 directed equality, 51 directed poset, 11 discrete category, 5 discrete preorder, 36 domain, 12 domain equations, 12 domain extension and restriction, 93 domain of a morphism, 5 dominated category, 64 downdeal, 10 downward closed set, 10 dual category, 5 dummy functor, 73, 74

embedding Henkin, 62–71 Henkin-PL, 75 of categories, 7 Yoneda, 9

embedding-projection pair, 12 emptiness assertion, 69 empty types, 68, 69, 82 epic, 6

split, 6 epimorphism, 6 equalizer, 8 equation

defining CCS process, 97

extended, 70 in algebra, 14 inequation, 16 of polymorphic lambda calculus, 78 of simply-typed lambda calculus, 65

equivalence of categories, 7

η-conversion, 20 η-reduction, 21 expanding sequence, 12 exponential diagram, 9 extended equation, 70 extended theory, 70 core of, 70 principal, 70 extensionality, 30 order, 49 strong, 50 weak, 29

faithful functor, 7 faithful subcategory, 7 feedback, 94 fiber, 72 finitely separable lambda algebra, 36 flat poset, 10 free

algebra, 14 ccc, 67 dcpo-algebra, 17 ordered algebra, 16, 40 variable, 20, 64, 78

full functor, 7 full subcategory, 7 function

continuous, 11 monotone, 10 stable, 11 function symbol, 13 functor, 6

adjoint, 7

ccc-representation, 9

continuous, 12 contravariant, 6 covariant, 6 embedding, 7 faithful, 7 full, 7 Henkin representation, 58 Henkin-PL-representation, 74 inclusion, 7 kernel, 58 left-full, 63 locally continuous, 13 PL-representation, 73 representable, 7 Yoneda, 9

functor category, 7

generalized Mal’cev operators, 40 greatest lower bound, 10 guard in CCS, 97

height of a bounded tree, 50 Henkin natural transformation, 74 Henkin representation, 58

in 𝒮, 62 in 𝒮^{P}, 63 in 𝒮^{+}, 62

Henkin-PL-embedding, 75 Henkin-PL-representation, 74

in 𝒮̃^{P}, 77 in 𝒮̃^{+}, 77

hiding, 93 hom-set, 5 homomorphism, 13

ideal completion, 41 ideal in a poset, 41 identity morphism, 5 in-buffered agent, 87

first-order axioms for, 90 second-order axioms for, 103

in-queued agent, 87 first-order axioms for, 90 second-order axioms for, 103

inclusion functor, 7 indeterminate, 15 indiscrete preorder, 36 individual constant, 64, 78 individual variable, 78 inequation, 16 infimum, 10 initial state of labeled transition system, 84 input actions, 85 input and output

labeled transition system with, see agent input-commutativity, 90 input-confluence, 90 input-determinacy, 90 input-receptivity, 90 internal actions, 85 interpretation

in ccc, 65

non-strict, 67 in PL-category, 79

non-strict, 81 inverse, 6 iso, 6 isomorphism, 6

natural, 7 of labeled transition systems, 86

join and meet, 10 join calculus, 99

kernel of a functor, 58 of a Henkin representation, 58 of a Henkin-PL-representation, 74 of a homomorphism, 13 of a PL-representation, 74

Kleene equality, 52 Kripke lambda model

polymorphic, 82 simply-typed, 72

labeled transition system, 84

with input and output, see agent lambda algebra, 24

and reflexive ccc models, 31 finitely separable, 36 homomorphism of, 24 soundness and completeness, 28 soundness of (ξ)-rule, 27

lambda calculus absolute interpretation, 26 closed term algebra, 22 consistency, 22 conversion, 20 local interpretation, 24 model, see model open term algebra, 22 polymorphic, 78 reduction, 21 simply-typed, 64 untyped, 20

lambda conversion, 20 categorical model of, 30 syntactical model of, 48

lambda model, 29 lambda reduction, 21 lambda term

boolean, 21 Church numeral, 21 closed, 20 normal form of, 21 raw, 20, 64, 78 substitution of, 20 untyped, 20

lambda theories

category of, 28 lambda theory, 20

\underline{λβ}, 20 \underline{λβη}, 20 pure, 20, 65

lambda-order, 43 lambda-preorder, 43 lattice, 10

complete, 10 least upper bound, 10 left-full functor, 63 lift of a model of reduction, 54 limit, 8 limit-colimit coincidence, 12 limiting cone, 8 limiting morphism, 8 linear order, 11 local interpretation

failure of rule (ξ), 25 of combinatory logic, 23 of the lambda calculus, 24

locally continuous functor, 13 locally well-pointed object, 32 lower bound, 10 LTS, see labeled transition system

Mal’cev axioms, 40 Mal’cev operator, 40 Mal’cev variety, 40 map, see function maximum and minimum, 10 meet and join, 10 meet cpo, 11 message, in join calculus, 99 Meyer-Scott axiom, 29 minimum and maximum, 10 model

continuously complete, 38 D_{∞}, 13 finitely separable, 36 Kripke, 72, 82 non-strict, 67, 81 of lambda conversion

categorical, 30 syntactical, 48

of lambda reduction categorical, 48 syntactical, 48

of polymorphic lambda calculus, 79, 81 of simply-typed lambda calculus, 65, 67 partial, 51 reflexive ccc model, 30 set-theoretic, 68, 82 standard models of polymorphism, 82 strict, 65, 79 topological, 38 tree model, 50 with empty types, 68, 69, 82 with non-empty types, 69, 82

monic, 6 collective, 6 cone, 6 split, 6

monomorphism, 6 monotone function, 10 morphism, 5

colimiting, 8 cover, 60 currying, 9 epic, 6 identity, 5 inverse, 6 iso, 6 limiting, 8 monic, 6 pairing, 9 projection, 8 uncurrying, 9

n-permutability, 40 name

defined, 99 free and bound, 99 in CCS, 97 in join calculus, 99

natural isomorphism, 7 natural transformation, 7

Henkin, 74 (non-empty)rule, 68 non-empty types, 69, 82 non-strict interpretation

of polymorphic lambda calculus, 81 of simply-typed lambda calculus, 67

normal form, 21 object in category, 5 ω-chain, 11 ω-complete poset, see cpo ω-continuity, 11 open term algebra, 22, 36 operation in algebra, 14 order, 10

Berry, 11

complete, see cpo

directed, 11

directed complete, 11

linear, 11

ω-complete, see cpo

partial, 10 pointwise, 10 preorder, 10 stable, 11

order-extensionality, 49 ordered algebra, 16, 40 ordered applicative structure, 47

order-extensional, 49 strongly extensional, 50

ordered variety, 16, 40 out-buffered agent, 87

first-order axioms for, 89 second-order axioms for, 101 with feedback, 94

first-order axioms for, 95 out-queued agent, 87

first-order axioms for, 90 second-order axioms for, 103

output actions, 85 output-commutativity, 89 output-confluence, 89 output-determinacy, 89

backwards, 95 weak, 98

pairing, 9 parallel composition

with interaction, 94 without interaction, 93

partial ∀-diagram, 74 partial applicative structure, 51 partial exponential diagram, 59 partial initial object, 60 partial model, 51 partial order, see order

complete, see cpo directed complete, 11

partial syntactical lambda model, 51 PL-category, 72 base, 72 congruence, 74 fiber, 72 representation of, 73

Henkin-PL-representation, 74 pointed poset, 10 pointwise order, 10 polymorphic Kripke model, 82 polymorphic lambda calculus, 78 polymorphic signature, 78 polynomial, 15 polynomial algebra, 15 poset, see order

directed, 11

directed complete, 11 flat, 10 linearly ordered, 11 ω-complete, see cpo pointed, 10 pre-structure, 74 preorder, 10

discrete, 36 indiscrete, 36 symmetric, 36 trivial, 36 presheaf, 9, 63 principal extended theory, 70 process

in CCS, 97

in join calculus, 99 process constant in CCS, 97 product, 8

binary, 8

of categories, 5 projection morphism, 8 projection-embedding pair, 12 pullback, 8 pure lambda theory, 20 polymorphic, 79 simply-typed, 65

queue Q, 87 queued agent, 87 quotient algebra, 13

raw lambda term, 20 polymorphic, 78 simply-typed, 64

reachable state, 100

reaction in join calculus, 99

receptivity, 90 redex, 21 ∼-reduced agent, 84 ≈-reduced agent, 84, 95 reduction, 21

categorical model of, 48 syntactical model of, 48

reflexive ccc model, 30, 37

and lambda algebras, 31 reflexive object, 30 reflexivity, 10 relabeling function in CCS, 97 relation

compatible, 13 congruence, 13

representable functor, 7 representation

Henkin-PL, 74 of ccc’s, 9 of PL-categories, 73

rule (non-empty), 68 rule, in join calculus, 99

Scott-continuity, 11 self-composition of agent, 94 separable subset of lambda algebra, 36 sequence, expanding, 12 sequential composition, 85, 94 set-theoretic model

of polymorphism, 82

of simply-typed lambda calculus, 68 with empty types, 68, 69, 82 with non-empty types, 69, 82

Σ-algebra, 13 Σ-term, 14 signature

algebraic, 13 polymorphic, 78 simply-typed, 64

silent action, 84 simple type, 64 simply-typed lambda calculus, 64 simply-typed signature, 64 small category, 5 source of a morphism, 5 special ccc, 62, 70 split cover, 60 split epic, 6 split monic, 6 stable function, 11 stable order, 11 standard model, 82 standard structure, 75 standard term algebra, 22, 36 state

in join calculus, 99

initial, 84

of labeled transition system, 84 reachable, 100 strict interpretation

of polymorphic lambda calculus, 79 of simply-typed lambda calculus, 65

strong bisimulation, 84 strong extensionality, 50 structural transition in join calculus, 99 subalgebra, 13 subcategory, 7 faithful, 7 full, 7 substitution, 20 supremum, 10 symmetric preorder, 36 synchrony, 83 syntactical model

of conversion, 48 of reduction, 48

T-algebra, 14

target of a morphism, 5

term combinatory, 22 lambda, 20 Σ-term, 14 term algebra, 14

open and closed, 22, 36 terminal object, 8 terminator, 8 theory

extended, 70

of combinatory logic, 22

polymorphic, 79 simply-typed, 65 untyped, 20

topological completeness problem, 38

topological model, 38 transition relation, 84

in join calculus, 99 transition system, see labeled transition system transitivity, 10 translation of lambda theories, 28 tree, 50

bounded, 50 tree model, 50 trivial preorder, 36 type

constant, 64, 78 of a labeled transition system, 84 polymorphic, 78 simple, 64 variable, 78

type assignment polymorphic, 78 simply-typed, 65

typed lambda calculus, 64, 78 typing judgment

polymorphic, 78 simply-typed, 65

un-λ-orderable, 43 un-λ-preorderable, 43 un-preorderable, 43 uncurrying, 9 unit of adjunction, 7 unobservable action, 84 unorderable

absolutely, 39

combinatory algebra, 36, 43

T-algebra, 39 untyped lambda calculus, 20 updeal, 10 upper bound, 10

valid typing judgment polymorphic, 78 simply-typed, 65

valuation in algebra, 14 in applicative structure, 22 in ordered applicative structure, 47

variable, 14, 20, 64 free and bound, 20, 64, 78 individual, 78 type, 78

variety algebraic, 14 dcpo, 17, 41 ordered, 16, 40

weak bisimulation, 84 weak extensionality, 29 weak output-determinacy, 98 well-pointed object, 32, 59

locally, 32 well-supported object, 60

Yoneda embedding, 9

0-fiber, 73