Theory and Applications of Categories, Vol. 14, No. 5, 2005, pp. 75–110.

ADJUNCTION MODELS FOR CALL-BY-PUSH-VALUE WITH STACKS

PAUL BLAIN LEVY

Abstract. Call-by-push-value is a ”semantic machine code”, providing a set of simple primitives from which both the call-by-value and call-by-name paradigms are built. We present its operational semantics as a stack machine, suggesting a term judgement of stacks. We then see that CBPV, incorporating these stack terms, has a simple categorical semantics based on an adjunction between values and stacks. There are no coherence requirements.

We describe this semantics incrementally. First, we introduce locally indexed categories and the opGrothendieck construction, and use these to give the basic structure for interpreting the three judgements: values, stacks and computations. Then we look at the universal property required to interpret each type constructor. We define a model to be a strong adjunction with countable coproducts, countable products and exponentials.

We see a wide range of instances of this structure: we give examples for divergence, storage, erratic choice, continuations, possible worlds and games (with or without a bracketing condition), in each case resolving the strong monad from the literature into a strong adjunction. And we give ways of constructing models from other models.

Finally, we see that call-by-value and call-by-name are interpreted within the Kleisli and co-Kleisli parts, respectively, of a call-by-push-value adjunction.

1. Introduction

1.1. Background. Moggi [Mog91] introduced the use of a strong monad T on a cartesian category C to model call-by-value languages. As noted by [Fil96] and others, this structure can also be used to interpret call-by-name, where a type denotes a T -algebra.

Based on these ideas, the call-by-push-value (CBPV) paradigm was introduced [Lev99, Lev], subsuming call-by-value and call-by-name. Two key type constructors in CBPV are U and F, and their composite UF corresponds to Moggi’s type constructor T. This immediately prompts the question: surely CBPV decomposes Moggi’s monad into an adjunction? Now, this is certainly the case for all of the concrete models studied. For example the storage model decomposes Moggi’s S → (S × −) monad into S → − and

An extended abstract of this paper was presented at the 9th Conference on Category Theory and Computer Science, Ottawa, 2002 [Lev03].

Received by the editors 2004-01-15 and, in revised form, 2004-11-04. Transmitted by R. Blute. Published on 2005-03-25. 2000 Mathematics Subject Classification: 18C50. Key words and phrases: call-by-push-value, adjunction, CK-machine, monad, denotational semantics,

indexed category, continuations, possible worlds, game semantics, call-by-name, call-by-value. \begin{matrix}c \\ ◯ \end{matrix} Paul Blain Levy, 2005. Permission to copy for private use granted.

S × −, whilst the continuations model decomposes Moggi’s (− → R) → R monad into − → R and − → R.

However, the syntax of CBPV does not confirm this analysis. CBPV has two judgements, values and computations, and the former give us a value category C, but the other category required for an adjunction is absent. Thus, we are left with a “not-quite-adjunction” which can be formulated in several ways, none of them elegant [Lev01].

But fortunately, recent work on CK-machine semantics (a form of operational semantics [FF86]) for CBPV has brought to light a new judgement: that of stacks. (Independently, a stack judgement with some similar rules was introduced in [CH00], in the setting of call-by-name and call-by-value with control effects.) The categorical semantics of CBPV+stacks is precisely the adjunction structure noticed in each of the concrete models. The purpose of this paper is to present this adjunction semantics.

We will describe numerous such adjunctions, including models for divergence, storage, erratic choice, continuations, possible worlds in the style of [Lev02] and pointer games in the style of [AHM98, HO00]; as well as general ways of building these adjunctions. We do not motivate them individually in this paper, because they are given merely as examples of the categorical structure.

In the case of pointer games, it is noteworthy that our categorical structure includes not only unbracketed models [Lai97]—which are continuation models after all [Lai98]—but also well-bracketed models, which are not. (See also Remark 6.8.)

As usual in categorical semantics, we show a theory/model equivalence. In order to achieve this, we need to introduce additional constructs called complex values and complex stacks. Fortunately, however, these constructs can always be removed from a computation.

Finally, we look at some related topics, including CBV and CBN.

1.2. Adjunctions: A Discussion. Let C and D be categories; we will underline objects of D. It is well known that the notion of adjunction from C to D has numerous equivalent definitions. One of these requires functors U and F and an isomorphism

C(X, U\underline{Y}) ≅ D(F X, \underline{Y}) natural in X and \underline{Y}  (1)

Alternatively F can be specified on objects only and naturality in X removed. (This is equivalent to the first definition by the parametrized representability theorem.) But can we give a definition where both U and F are specified on objects only? Here is one way.

Let us say, in an adjunction, that an oblique morphism from X to \underline{Y} is a C-morphism from X to U\underline{Y} or a D-morphism from F X to \underline{Y} —it hardly matters which, since they correspond. Clearly an oblique morphism can be composed with a C-morphism on the left, or with a D-morphism on the right; it straddles the two categories, so to speak. Let us write O(X, \underline{Y}) for the oblique morphisms from X to \underline{Y}. Now an adjunction from C to D can be specified by a functor O : C^{op} ×D → Set (also called a left C-, right D-bimodule) and isomorphisms

C(X, U\underline{Y}) ≅ O(X, \underline{Y})  natural in X  (2)
O(X, \underline{Y}) ≅ D(F X, \underline{Y}) natural in \underline{Y}  (3)

Again the equivalence to the earlier definition follows from parametrized representability. To see the benefit of this definition, fix a set R and consider the adjunction

Set(X, Y → R) ≅ Set^{op}(X → R, Y)  (4)

We can decompose this isomorphism quite naturally by setting O(X, Y) to be Set(X × Y, R).

This is essentially what is happening in CBPV+stacks: we have three judgements, denoting C-morphisms (values), oblique morphisms (computations) and D-morphisms (stacks). But the above account is overly simplistic, for, as we shall see, we want D to be locally indexed by C.

1.3. Element Style vs. Naturality Style. Universal properties in category theory can usually be defined either in terms of elements or in terms of naturality of isomorphisms. Here is a well-known example. A product for a family of objects {A_{i}}_{i∈I} in a category C consists of an object V —the vertex—together with either of the following:

• for each i ∈ I, a morphism \xymatrix{V \ar[r]^{π_{i}} & A_{i}} , such that the function

C(X, V) ⟶ ∏_{i∈I} C(X, A_{i})  for all X  (5)
f ⟼ λi.(f; π_{i})

is an isomorphism

• an isomorphism

C(X, V) ≅ ∏_{i∈I} C(X, A_{i})  natural in X  (6)

The equivalence of these two definitions follows from the Yoneda Lemma.

For the universal properties we will treat in this paper, we will give definitions in element-style only, and leave the naturality-style formulation to future work—see also [Lev04]. Here is an important special case, adapted from [CLW93, Coc93] and used to interpret sum types.

1.4. Definition. A distributive coproduct for a family of objects {A_{i}}_{i∈I} in a cartesian

category C is an object V and a C-morphism \xymatrix{A_{i} \ar[r]^{^{in^{i}}} & V} for each i ∈ I, such that the functions

C(X × V, Y) ⟶ ∏_{i∈I}C(X × A_{i}, Y)  for all X, Y  (7)
f ⟼ λi.((X × in_{i}); f)

are isomorphisms.

Clearly, any distributive coproduct is a coproduct; the converse holds if C is cartesian closed but is false in general. A cartesian category with all finite (resp. countable) distributive coproducts is called a distributive (resp. countably distributive) category.

2. Review of Call-By-Push-Value

There are two variants of CBPV: finitary and infinitely wide. In this paper we treat infinitely wide CBPV; the finitary case is treated by substituting “finite” for “countable” throughout. (The reverse substitution would not work, because for both variants contexts are finite, and hence the value category requires only finite products.)

CBPV has two disjoint classes of terms: values and computations. It likewise has two disjoint classes of types: a value has a value type, while a computation has a computation type. For clarity, we underline computation types. The types are given by

value types  A ::= U\underline{B} | ∑_{i∈I}A_{i} | 1 | A × A
computation types \underline{B} ::= F A | ∏_{i∈I} \underline{B}_{i} | A → \underline{B}

where I can be any countable set (finite, in finitary CBPV). The meaning of F and U is as follows. A computation of type F A returns a value of type A. A value of type U\underline{B} is a thunk of a computation of type \underline{B}, i.e. the computation is frozen into a value so that it can be passed around. When later required, it can be forced i.e. executed.

Unlike in call-by-value, a function in CBPV is a computation, and hence a function type is a computation type. We will discuss this further in Sect. 3.

Like in call-by-value, an identifier in CBPV can be bound only to a value, so it must have value type. We accordingly define a context Γ to be a sequence

x_{0} : A_{0}, …, x_{n−1} : A_{n−1}

of identifiers with associated value types. We often omit the identifiers and write just A_{0}, …, A_{n−1}. We write Γ ⊢^{v} V : A to mean that V is a value of type A, and we write Γ ⊢^{c} M : \underline{B} to mean that M is a computation of type \underline{B}.

The terms of CBPV are given in Fig. 1. We assume formally that all terms are explicitly typed, but in this paper, to reduce clutter, we omit explicit typing information,

We explain some of the less familiar constructs as follows. M tox. N is the sequenced computation that first executes M, and when, this returns a value V proceeds to execute N with x bound to V. This was written in Moggi’s syntax using let, but we reserve let for mere binding. The keyword pm stands for “pattern-match”, and the symbol ‘ represents application in reverse order. Because we think of ∏_{i∈I} as the type of functions taking each i ∈ I to a computation of type \underline{B}_{i}, we have made its syntax similar to that of →.

Following Lawvere [Law63], we say that a context morphism q from Γ = A_{0}, …, A_{m−1} to Δ = B_{0}, …, B_{n−1} is a sequence of values V_{0}, …, V_{n−1} where Γ ⊢^{v} V_{i} : B_{i}. As usual, such a morphism induces (by induction [FPD99]) a substitution function q^{∗} from values Δ ⊢^{v} V : C to values Γ ⊢^{v} V : C and from computations Δ ⊢^{c} M : \underline{B} to Γ ⊢^{c} M : \underline{B}. We define identity and composite context morphisms in the usual way.

Γ, x : A, Γ′ ⊢^{v} x : A

Γ ⊢^{v} V : A Γ, x : A ⊢^{c} M : \underline{B}
Γ ⊢^{c} let V be x. M : \underline{B}

Γ ⊢^{v} V : A

Γ ⊢^{c} return V : F A

Γ ⊢^{c} M : F A Γ, x : A ⊢^{c} N : \underline{B}
Γ ⊢^{c} M to x. N : \underline{B}

Γ ⊢^{c} M : \underline{B}

Γ ⊢^{v} thunk M : U\underline{B}

Γ ⊢^{v} V : U\underline{B}
Γ ⊢^{c} force V : \underline{B}

Γ ⊢^{v} V : Aî ; î ∈ I ; Γ ⊢^{v} (î, V) : ∑_{i∈I}A_{i} Γ ⊢^{v} V : ∑_{i∈I}A_{i} ⋯ Γ, x : A_{i} ⊢^{c} M_{i} : \underline{B} ⋯ _{i∈I}

Γ ⊢^{c} pm V as \{…, (i, x).M_{i}, …\} : \underline{B}

{Γ ⊢^{v} V : A Γ ⊢^{v} V′ : A′ \atop Γ ⊢^{v} (V, V′) : A × A′} Γ ⊢^{v} V : A × A′ Γ, x : A, y : A′ ⊢^{c} M : \underline{B}

Γ ⊢^{c} pm V as (x, y).M : \underline{B}

⋯ Γ ⊢^{c} M_{i} : \underline{B}_{i} ⋯ _{i∈I} ; Γ ⊢^{c} λ\{…, i.M_{i}, …\} : ∏_{i∈I} \underline{B}_{i}  Γ ⊢^{c} M : ∏_{i∈I} \underline{B}_{i} ; î ∈ I ; Γ ⊢^{c} î‘M : \underline{B}î

{Γ, x : A ⊢^{c} M : \underline{B} \atop Γ ⊢^{c} λx.M : A → \underline{B}}  {Γ ⊢^{v} V : A Γ ⊢^{c} M : A → \underline{B} \atop Γ ⊢^{c} V ‘M : \underline{B}}

Figure 1: Terms of Call-By-Push-Value

3. The CK-Machine and the Stack Judgement

The operational semantics of CBPV is given in [Lev99] in big-step form, but here we use a CK-machine, a style of semantics introduce in [FF86] for CBV—there are many similar formulations [Kri85, PS98, SR98]. We describe it for computations on a fixed context Γ (by contrast with big-step semantics, which is defined for closed computations only). The machine is presented in Fig. 2, with types written explicitly. A configuration of the machine, with types, has the form

Γ |  M  \underline{B}  K  \underline{C}  (8)

where Γ ⊢^{c} M : \underline{B} is the computation we are currently evaluating and K is the stack (perhaps better known as an evaluation context, another concept that appeared in [FF86]). Notice that Γ and \underline{C} remain fixed throughout execution.

To begin with, we place the computation we wish to evaluate alongside the empty stack, and we apply transitions until we reach a terminal configuration. When the computation has the form M to x. N, we must first evaluate M, during which time we have no need of N. So we move the context [·] tox. N onto the stack, and proceed to evaluate M. Once we have evaluated M to the form return V, we remove that context from the stack and proceed to evaluate N[V/x]. Similarly, to evaluate V ‘M we leave the operand V on the stack while we evaluate M.

Classifying a function as a computation is a novelty of CBPV and, at first sight, seems counterintuitive. But the CK-machine provides an explanation. For λx is treated as an instruction “pop x” whilst V ‘ is treated as an instruction “push V ”. Thus a computation of type A → \underline{B} pops a value of type A and proceeds as a computation of type \underline{B}. Similarly, a computation of type ∏_{i∈I} \underline{B}_{i} pops a tag i ∈ I and proceeds as a computation of type \underline{B}_{i}.

In order to characterize the well-typed configurations, we require a judgement for stacks, of the form Γ|\underline{B} ⊢^{k} K : \underline{C}. Thus a configuration (8) will be well-typed precisely when Γ ⊢^{c} M : \underline{B} and Γ|\underline{B} ⊢^{k} K : \underline{C}.

By inspecting Fig. 2, we can see that the typing rules for this judgment should be as given in Fig. 3. This ensures that the well-typed configurations are precisely those obtainable from an initial configuration.

There are some evident operations on stacks.

1. Given a context-morphism \xymatrix{Γ \ar[r]^{q} & Δ} and a stack Δ|\underline{B} ⊢^{k} K : \underline{C} we can substitute q in L to give a stack Γ|\underline{B} ⊢^{k} q^{∗}K : \underline{C}.

2. Given a computation Γ ⊢^{c} M : \underline{B} and a stack Γ|\underline{B} ⊢^{k} K : \underline{C}, we can dismantle K onto M to give Γ ⊢^{c} M • K : \underline{C}, defined by induction on K. It is the computation whose evaluation leads to the configuration (8). Think of this operation as “running the CK-machine backwards”.

Initial configuration for evaluation of Γ ⊢^{c} M : \underline{C}

Γ | M  \underline{C}  nil     \underline{C}

Transitions

Γ | let V be x. M  \underline{B}  K  \underline{C}
⇝ Γ | M[V/x]  \underline{B}  K  \underline{C}
Γ | M to x. N  \underline{B}  K  \underline{C}
⇝ Γ | M  F A [·] to x. N :: K  \underline{C}
Γ | return V  F A [·] to x. N :: K  \underline{C}
⇝ Γ | N[V/x]  \underline{B}  K  \underline{C}

     Γ | force thunk M  \underline{B}  K  \underline{C}

⇝ Γ | M  \underline{B}  K  \underline{C}
Γ | pm (î, V) as \{…, (i, x).M_{i}, …\}  \underline{B}  K  \underline{C}
⇝ Γ | Mî[V/x]  \underline{B}  K  \underline{C}
Γ | pm (V, V′) as (x, y).M  \underline{B}  K  \underline{C}
⇝ Γ | M[V/x, V′/y]  \underline{B}  K  \underline{C}
Γ | î‘M  \underline{B}î  K  \underline{C}
⇝ Γ | M  ∏_{i∈I} \underline{B}_{i}  î:: K  \underline{C}
Γ | λ\{…, i.M_{i}, …\}  ∏_{i∈I} \underline{B}_{i}  î:: K  \underline{C}
⇝ Γ | Mî  \underline{B}î  K  \underline{C}
Γ | V ‘M  \underline{B}  K  \underline{C}
⇝ Γ | M  A → \underline{B}  V :: K  \underline{C}
Γ | λx.M  A → \underline{B}  V :: K  \underline{C}
⇝ Γ | M[V/x]  \underline{B}  K  \underline{C}

Figure 2: CK-Machine For CBPV, With Types

Γ|\underline{C} ⊢^{k} nil : \underline{C}

Γ, x : A ⊢^{c} M : \underline{B} Γ|\underline{B} ⊢^{k} K : \underline{C}

Γ|F A ⊢^{k} [·] to x. M :: K : \underline{C}

Γ|\underline{B}î ⊢^{k} K : \underline{C} ; î ∈ I ; Γ|∏_{i∈I} \underline{B}_{i} ⊢^{k} î:: K : \underline{C}  {Γ ⊢^{v} V : A Γ|\underline{B} ⊢^{k} K : \underline{C} \atop Γ|A → \underline{B} ⊢^{k} V :: K : \underline{C}}

Figure 3: Typing rules for stacks

3. Given two stacks Γ|\underline{B} ⊢^{k} K : \underline{C} and Γ|\underline{C} ⊢^{k} L : \underline{D}, we can concatenate^{1} K and L to give Γ|\underline{B} ⊢^{k} K ++L : \underline{D}. We can regard concatenation as a form of substitution, because K++L is K[L/nil].

3.1. Lemma. Substitution, dismantling and concatenation satisfy the following properties.

             nil++K = K  p^{∗}nil = nil

K++nil = K  p^{∗}(K++L) = (p^{∗}K)++(p^{∗}L)
(K++L)++L′ = K++(L++L′) p^{∗}(M • K) = (p^{∗}M) • (p^{∗}K)
M • nil = M  id^{∗}P = P
M • (K++K′) = (M • K) • K′  (p; q)^{∗}P = p^{∗}q^{∗}P

4. Basic Structure

4.1. Interpreting Values. Like Moggi, we interpret values in a cartesian category C, called the “value category”. As usual, the products in C are used for interpreting both × and context extension (comma). Although there is no value in the language of the form x : A × A′ ⊢^{v} V : A (for general A, A′), there will be after we extend the syntax in Sect. 7.

4.2. Interpreting Stacks. If values are interpreted in the cartesian category C, stacks will be interpreted in a locally C-indexed category D. This can be defined in various ways:

• as a strict C-indexed category (i.e. functor C^{op} ⟶ Cat) in which all the fibres D_{X} have the same set of objects ob D and all the reindexing functors D_{f} are identityon-objects

• as a [C^{op}, Set]-enriched category

• using the following concrete description.

1The reader who finds the idea of concatenating stacks to be strange need not worry, because concatenation and dismantling are never performed in the operational semantics. It is only for reasoning about stacks that we consider these operations.

4.3. Definition. A locally C-indexed category consists of

• a set ob D of D-objects which we underline (except where ob D = ob C)

• for each object X ∈ ob C and each pair of objects \underline{Y} , \underline{Z} ∈ ob D, a small set D_{X}(\underline{Y} , \underline{Z})

of D-morphisms written \xymatrix{\underline{Y} \ar[r]^{f}_{X} & \underline{Z}}

• for each object X ∈ ob C and each object \underline{Y} ∈ ob D, an identity morphism

\xymatrix{\underline{Y} \ar[r]^{^{id^{X,\underline{Y}}}}_{X} & \underline{Y}}

• for each morphism \xymatrix{\underline{Y} \ar[r]^{f}_{X} & \underline{Z}} and each morphism \xymatrix{\underline{Z} \ar[r]^{g}_{X} & \underline{W}} , a composite mor-

phism \xymatrix{\underline{Y} \ar[r]^{f;g}_{X} & \underline{W}}

• for each D-morphism \xymatrix{\underline{Y} \ar[r]^{f}_{X} & \underline{Z}} and each C-morphism \xymatrix{X′ \ar[r]^{k} & X} , a reindexed

D-morphism \xymatrix{\underline{Y} \ar[r]^{k^{∗}f}_{X′} & \underline{Z}}

such that

id; f = f  k^{∗}id = id  id^{∗}f = f
f; id = f  k^{∗}(f; g) = (k^{∗}f); (k^{∗}g) (l; k)^{∗}f = l^{∗}(k^{∗}f)
(f; g); h = f; (g; h)

It is easy to see that this is natural for interpreting stacks: a computation type will denote an object of D and a stack Γ|\underline{B} ⊢^{k} K : \underline{C} will denote a D-morphism over [[Γ]] from [[\underline{B}]] to [[\underline{C}]]. Then identity morphisms in D interpret nil, composition interprets concatenation of stacks, and reindexing interprets substitution.

Before proceeding further, we develop some theory of locally indexed categories. Firstly, it is clear that they form a 2-category, and we have operations −^{op} and ×. The most important example of a locally C-indexed category is called self C, and given by

ob self C = ob C
self C_{A}(B, C) = C(A × B, C)

with the evident composition and reindexing. This is used in the following result, mentioned in [Mog91].

4.4. Proposition. A strong monad on C corresponds to a monad on self C.

As with ordinary categories, we wish to speak of the “homset functor” associated with D, and we do this using the “opGrothendieck construction” as follows.

4.5. Definition.

1. Let D be a locally C-indexed category. We write opGr D for the ordinary category where

• an object is a pair _{X} \underline{Y} where X ∈ ob C and \underline{Y} ∈ ob D;

• a morphism from _{X} \underline{Y} to _{X′} \underline{Z} in opGr D consists of a pair _{k}h where \xymatrix{X′ \ar[r]^{k} & X}

in C and \xymatrix{\underline{Y} \ar[r]^{h}_{X′} & \underline{Z}} in D

• the identity on _{Γ}\underline{X} is given by _{id}id;

• the composite of \xymatrix{_{Γ}\underline{X} \ar[r]^{_{k}f} & _{Γ′} \underline{Y} \ar[r]^{_{l}g} & _{Γ′′} \underline{Z}} is _{l;k}((l^{∗}f); g).

2. For a locally D-indexed category, we write Hom_{D}, or D for short, for the functor

\xymatrix{opGr(D^{op} × D) \ar[r] & Set \\ _{X}(\underline{Y} , \underline{Z}) \ar@{|->}[r] & D_{X}(\underline{Y} , \underline{Z}) \\ _{k}(f, h) \ar@{|->}[r] & λg.(f; (k^{∗}g); h)}

4.6. Interpreting Computations. If we are interpreting values in a cartesian category C, and stacks in a locally C-indexed category D, then we will interpret computations in a functor O : opGr D ⟶ Set, also called a right D-module. This can be described in concrete terms.

4.7. Definition. A (locally C-indexed) right D-module is given by

• for each X ∈ ob C and \underline{Y} ∈ ob D, a small set O_{X} \underline{Y}, an element of which we call an O-morphism over X to \underline{Y} and write [figure: g; X; \underline{Y}]

• for each \xymatrix{X′ \ar[r]^{k} & X} and [figure: g; X; \underline{Y}] a reindexed O morphism [figure: k^{∗}g; X′; \underline{Y}]

• for each [figure: g; X; \underline{Y}] and \xymatrix{\underline{Y} \ar[r]^{h}_{X} & \underline{Y}′} a composite O morphism [figure: g;h; X; \underline{Y}′]

satisfying identity, associativity and reindexing laws:

\begin{aligned}g; id & = & g & id^{∗}g & = & g & k^{∗}(g; h) & = & (k^{∗}g); (k^{∗}h) \\ g; (h; h′) & = & (g; h); h′ & (k; l)^{∗}g & = & k^{∗}(l^{∗}g) \end{aligned}

where g is an O-morphism.

Our intention is that a computation Γ ⊢^{c} M : \underline{B} will denote an O-morphism over [[Γ]] to [[\underline{B}]] and that q^{∗}M will denote [[q]]^{∗}[[M]] while the dismantling M • K will denote [[M]]; [[K]].

We summarize the above discussion as follows.

4.8. Definition. A CBPV judgement model consists of

• a cartesian category C

• a locally C-indexed category D

• a right D-module O.

4.9. Examples. Here are some examples of CBPV judgement models. We do not motivate them individually, because they are given only as examples of the structure.

trivial Given a cartesian category C, set D to be self C and set O_{X}Y to be C(X, Y).

cpo Let C be Cpo (directed-complete posets and continuous maps). Let a D-object be a pointed cpo (a cpo with a least element) and a D-morphism over X from \underline{Y} to \underline{Z} be a right-strict continuous function from X × \underline{Y} to \underline{Z}. Let O_{X} \underline{Y} be continuous functions from X to \underline{Y}.

monad Given a strong monad T on a cartesian category C, we obtain a judgement model (C, C^{T} , O^{T}), where a C^{T} -object is a T -algebra, a C^{T} -morphism over X from (Y, θ) to

(Z, ϕ) is a C-morphism \xymatrix{X × Y \ar[r]^{f} & Z} satisfying
\xymatrix{X × T Y \ar[r]^{t(X,Y)} \ar[d]_{X×θ} & T (X × Y) \ar[r]^{T f} & T Z \ar[d]^{ϕ} \\ X × Y \ar[rr]_{f} &  & Z}

and let O_{X}^{T}(Y, θ) be C(X, Y).

storage Given a set S, let C be Set, let D be self Set and let O_{X}Y be Set(S × X, Y).

erratic choice Let C be Set, let D be the locally Set-indexed category Rel in which an object is a set and a morphism over X from Y to Z is a relation from X × Y to Z, and let an O-morphism over X to Y be a relation from X to Y.

continuations Given a set R, let C be Set, let D be (self Set)^{op} and let O_{X}Y be Set(X × Y, R).

4.10. Example: Possible Worlds. Our next example is a possible world semantics. This is a way of modelling dynamically generated storage cells that was introduced for CBN in [Ole82] and for CBV in [Mog90]. These were models of ground storage only, but a CBV model for general storage was presented in [Lev02], and our example is the CBPV version of it.

Let W be a countable category (countably many objects and morphisms), and for each w ∈ ob W let Sw be a set. (The storage model above is the special case where W is the unit category.) We define C to be [W, Set], and D to be the locally C-indexed category where • an object is a functor from W^{op} to Set

• a morphism over X from \underline{Y} to \underline{Z} is a dinatural transformation from X × \underline{Y} to \underline{Z}.

We define O_{X} \underline{Y} to be

∏_{w∈ob W} Set(Sw × Xw, \underline{Y} w)

(Thus there is no naturality condition on a computation-morphism, nor can there be, because S is not a functor.) Identity, composition and reindexing are defined in the evident way.

5. CBPV Adjunction Models

5.1. Universal Properties. So far, the only type constructors we can interpret are 1 and ×. The rest are interpreted using the following universal properties. The notation f^{∗}g means f; g in the case that g is a value morphism.

5.2. Definition. In a CBPV judgement model (C, D, O),

U\underline{B} a right adjunctive for a D-object \underline{B} is a C-object V and an O-morphism [figure: force; V; \underline{B}] , such that the functions

C(X, V) ⟶ O_{X} \underline{B}  for all X  (9)
f ⟼ f^{∗}force

are isomorphisms

F A a left adjunctive for a C-object A is a D-object \underline{V} and an O-morphism [figure: return; A; \underline{V}] , such that the functions

D_{X}(\underline{V} , \underline{Y}) ⟶ O_{X×A}\underline{Y}  for all X, \underline{Y}  (10)
h ⟼ (π_{X,A}^{′∗}return); (π_{X,A}^{∗}h)

are isomorphisms

∑_{i∈I}A_{i} a distributive coproduct for a family {A_{i}}_{i∈I} of C-objects is a C-object V and,

for each i ∈ I, a C-morphism \xymatrix{A_{i} \ar[r]^{^{in^{i}}} & V} , such that the functions

C(X × V, Y) ⟶ ∏_{i∈I}C(X × A_{i}, Y)  for all X, Y  (11)
O_{X×V} \underline{Y} ⟶ ∏_{i∈I}O_{X×A_{i}} \underline{Y}  for all X, \underline{Y}  (12)
D_{X×V} (\underline{Y} , \underline{Z}) ⟶ ∏_{i∈I}D_{X×A_{i}}(\underline{Y} , \underline{Z})  for all X, \underline{Y} , \underline{Z}  (13)
f ⟼ λi.((X × in_{i})^{∗}f)

are isomorphisms ∏_{i∈I}\underline{B}_{i} a product for a family \{\underline{B}_{i}\}_{i∈I} of D-objects is a D-object \underline{V} and, for each i ∈ I,

a D-morphism \xymatrix{\underline{V} \ar[r]^{π_{i}}_{1} & \underline{B}_{i}} , such that the functions

O_{X} \underline{V} ⟶ ∏_{i∈I}O_{X} \underline{B}_{i}  for all X  (14)
D_{X}(\underline{Y} , \underline{V}) ⟶ ∏_{i∈I}D_{X}(\underline{Y} , \underline{B}_{i})  for all X, \underline{Y}  (15)
h ⟼ λi.(h; ( )^{∗}π_{i})

are isomorphisms

A → \underline{B} an exponential from a C-object A to a D-object \underline{B} is a D-object \underline{V} and a Dmorphism \xymatrix{\underline{V} \ar[r]^{ev}_{A} & \underline{B}} , such that the functions

O_{X} \underline{V} ⟶ O_{X×A}\underline{B}  for all X  (16)
D_{X}(\underline{Y} , \underline{V}) ⟶ D_{X×A}(\underline{Y} , \underline{B})  for all X, \underline{Y}  (17)
h ⟼ (π_{X,A}^{∗}h); (π_{X,A}^{′∗}ev)

are isomorphisms.

5.3. Definition. A strong adjunction is a CBPV judgement model (C, D, O) with all right adjunctives and left adjunctives—we say that it goes from C to D.

As a variation of the characterization of adjunctions in Sect. 1.2, we have

5.4. Proposition. [Lev01] A strong adjunction from C to D is equivalent to an adjunction from self C to D.

Therefore a strong adjunction from C gives rise to a monad on self C i.e. (by Prop. 4.4) a strong monad on C; hence the word “strong”.

5.5. Definition. A CBPV adjunction is a strong adjunction (C, D, O) with all countable distributive coproducts, countable products and exponentials. We write U,F,→ etc. for the operations on objects. We write q^{U} for the inverse of (9), etc.

It is obvious how to define the interpretation of CBPV in such a structure. The following result shows that there is some redundancy in the definition of CBPV adjunction.

5.6. Proposition. In a CBPV judgement model with all left adjunctives,

products if the functions (15) are all isomorphisms then so are the functions (14)

exponentials if the functions (17) are all isomorphisms then so are the functions (16).

In a CBPV judgement model with all right adjunctives,

distributive coproducts if the functions (11) are all isomorphisms then so are the functions (12).

Proof.

products The isomorphism

\xymatrix{D_{X}(F 1, \underline{Y}) \ar[r]^{≅} & O_{X×1}\underline{Y} \ar[r]^{≅} & O_{X} \underline{Y}}

maps h to return; h, by calculation. So the diagram

\xymatrix{D_{X}(F 1, \underline{V}) \ar[r] \ar[d]_{≅} & ∏_{i∈I} D_{X}(F 1, \underline{B}_{i}) \ar[d]^{≅} \\ O_{X}(F 1, \underline{V}) \ar[r] & ∏_{i∈I} O_{X} \underline{B}_{i}}

commutes, by calculation. So if the top arrow is an isomorphism, the bottom arrow must be too.

exponentials Similar, using the diagram

\xymatrix{D_{X}(F 1, \underline{V}) \ar[r] \ar[d]_{≅} & D_{X×A}(F 1, \underline{B}) \ar[d]^{≅} \\ O_{X} \underline{V} \ar[r] & O_{X×A}\underline{B}}

distributive coproducts The diagram

\xymatrix{C_{X×V} U\underline{Y} \ar[r] \ar[d]_{≅} & ∏_{i∈I} C_{X×A_{i}}U\underline{Y} \ar[d]^{≅} \\ O_{X×V} \underline{Y} \ar[r] & ∏_{i∈I} O_{X×A_{i}} \underline{Y}}

commutes by calculation. So if the top arrow is an isomorphism, the bottom arrow must be too.

We draw attention to the requirement for (13) to be an isomorphism, which is not eliminated by Prop. 5.6. It was mistakenly omitted in [Lev01] (which merely required C to be countably distributive), and was brought to light by the stack judgement.

5.7. Examples. We now look again at the examples of CBPV judgement models described in Sect. 4.9 to see when they have all the required universal elements. Notice how the strong monad described in [Mog91] is recovered in all cases treated there. For the possible world model, where the strong monad mentioned in [Lev02] is recovered, and for the game model, the strong monad described in [AM98] is recovered. trivial The judgement model given by a cartesian category C is a CBPV adjunction iff C

is countably bicartesian closed, i.e. a ccc with all countable coproducts and products. Such “trivial” models interpret CBPV with no computational effects at all. Indeed, “CBPV adjunction” can be seen as a generalization of “countably bicartesian closed category” to accommodate computational effects.

cpo This is clearly a CBPV adjunction with F A given as the lift of A, and U\underline{B} = \underline{B}.

monad/algebra The judgement model given by a strong monad T on a cartesian category C is a CBPV adjunction iff

• C is countably distributive

• C has a product for every countable family of T -algebra carriers

• C has an exponential from every object to every T -algebra carrier.

where F A is the free T -algebra on A and U\underline{B} is the carrier of \underline{B}. Notice that these conditions imply that C has all Kleisli exponentials and all countable products of Kleisli exponentials.

storage, erratic choice, continuations The connectives are given by

model  _{∑i∈I} 1 × U  F  _{∏i∈I} →
storage  _{∑i∈I} 1 × S → − S × − _{∏i∈I} →

erratic choice

∑i∈I

1 × P −

∑i∈I

×

continuations ∑i∈I 1 × − → R − → R ∑i∈I ×

possible worlds The ∑ 1 × ∏ → connectives are given pointwise. For example, the exponential A → \underline{B} is given at w by Aw → \underline{B}w, which must be contravariant in w because A is covariant and \underline{B} is contravariant. For the adjunctives, recall the coslice category w/W, in which an object is a world w′ together with a morphism \xymatrix{w \ar[r]^{g} & w′} . The adjunctives are given at a world w by

(F A)w = ∑_{(w′,g)∈w/W}(Sw′ × Aw′)
(U\underline{B})w = ∏_{(w′,g)∈w/W}(Sw′ → \underline{B}w′)

and at a morphism \xymatrix{x \ar[r]^{f} & w} by

((F A)f)(w′, \xymatrix{w \ar[r]^{g} & w′} , s′, a) = (w′, (f; g), s′, a)
(((U\underline{B})f)α)(w′, \xymatrix{w \ar[r]^{g} & w′} , s′) = α(w′, (f; g), s′)

5.8. General Storage Models. We can generalize some of the examples in Sect. 5.7 (global store, possible worlds, continuations) into ways of building CBPV models from other CBPV models. This enables us to model combinations of effects, rather like the monad transformers of [CM93].

For global store, suppose that S is a C-object in a CBPV adjunction (C, D, O, …). Then we obtain a storage model (C, D, O′) where O′_{X} \underline{Y} is defined to be O_{S×X} \underline{Y}. The ∑ 1×∏→ connectives are unchanged, and the adjunctives are given by

F′A = F (S × A)
U′\underline{B} = U(S → \underline{B})

For possible worlds, suppose we are given a CBPV adjunction (C, D, O, …), a category W with countably many objects and morphisms, and a C-object Sw for each w ∈ W. We then obtain a possible world model (C′, D′, O′) as follows.

• C′ is defined to be [W, C]

• a D′-object is a functor from W^{op} to D_{1}

• a D′ morphism \xymatrix{\underline{Y} \ar[r]^{h}_{X} & \underline{Z}} provides for each world w a morphism \xymatrix{\underline{Y} w \ar[r]^{hw}_{Xw} & \underline{Z}w} , such that the diagram over Xw

\xymatrix{\underline{Y} w \ar[r]^{hw} & \underline{Z}w \\ \underline{Y} w′ \ar[r]_{(Xf)^{∗}(hw′)} \ar[u]^{( )^{∗}\underline{Y} f} & \underline{Z}w′ \ar[u]_{( )^{∗}\underline{Z}f}}

commutes for each \xymatrix{w \ar[r]^{f} & w′}

• O′_{X} \underline{Y} is defined to be

∏_{w∈W} O_{Sw×Xw}\underline{Y} w

• identity, composition and reindexing are defined in the evident way

• the ∑ 1×∏→ connectives are given pointwise

• the adjunctives are given at a world w by

(F A)w = F ∑_{(w′,g)∈w/W}(Sw′ × Aw′)
(U\underline{B})w = U ∏_{(w′,g)∈w/W}(Sw′ → \underline{B}w′)

and at a morphism \xymatrix{x \ar[r]^{f} & w} in the evident way.

Again, the global store construction is the special case that W is the unit category.

5.9. General Continuation Models. To see the general construction of continuation models, it is helpful to introduce a calculus. Let us write CBPV+\underline{R} for CBPV extended with a free computation type identifier \underline{R}. This has a special fragment called Jump-With-Argument (JWA), shown in Fig. 4–5. (Many similar continuation calculi appear in the literature [Dan92, LRS93, SF93, Sel01, Thi97].) JWA contains two kinds of terms: values and nonreturning commands. We write Γ ⊢^{n} M to say that M is a nonreturning command in context Γ.

Types

A ::= ¬A | ∑_{i∈I}A_{i} | 1 | A × A

Judgements

Γ ⊢^{v} V : A Γ ⊢^{n} M

Terms:

Γ, x : A, Γ′ ⊢^{v} x : A

Γ ⊢^{v} V : A Γ, x : A ⊢^{n} M

                                       Γ ⊢^{n} let V be x. M

Γ ⊢^{v} V : Aî ; î ∈ I ; Γ ⊢^{v} (î, V) : ∑_{i∈I}A_{i} Γ ⊢^{v} V : ∑_{i∈I}A_{i} ⋯ Γ, x_{i} : A_{i} ⊢^{n} M_{i} ⋯ _{i∈I}

Γ ⊢^{n} pm V as {…, (i, x_{i}).M_{i}, …}

{Γ ⊢^{v} V : A Γ ⊢^{v} V′ : A′ \atop Γ ⊢^{v} (V, V′) : A × A′} Γ ⊢^{v} V : A × A′ Γ, x : A, y : A′ ⊢^{n} M

Γ ⊢^{n} pm V as (x, y).M

{Γ, x : A ⊢^{n} M \atop Γ ⊢^{v} γx.M : ¬A}  {Γ ⊢^{v} V : A Γ ⊢^{v} W : ¬A \atop Γ ⊢^{n} V ↗ W}

Figure 4: Syntax of Jump-With-Argument

¬A is U(A → \underline{R})
Γ ⊢^{n} M is Γ ⊢^{c} M : \underline{R}
γx.M is thunk λx.M
V ↗ W is V ‘force W

Figure 5: JWA as fragment of CBPV+\underline{R}

We can substitute a context morphism \xymatrix{Γ \ar[r]^{q} & Δ} into a command Δ ⊢^{n} M, giving a command Γ ⊢^{n} q^{∗}M. This operation satisfies

id^{∗}M = M
p^{∗}q^{∗}M = (p; q)^{∗}M

For JWA, as for CBPV and CBV, we require a cartesian category to model the values. For nonreturning commands, we require a functor N : C^{op} ⟶ Set, also called a left C-module. This can be describe in concrete terms.

5.10. Definition.

1. A left C-module N consists of

• for each A ∈ ob C, a set N_{A} of N -morphisms from A, written [figure: A; g]

• for each C-morphism \xymatrix{A \ar[r]^{f} & A′} and N -morphism [figure: A′; g], a composite N -

morphism [figure: A; f;g]

satisfying identity and associativity laws

id; g = g
(f; f′); g = f; (f′; g)

where g is a N -morphism.

2. A JWA judgement model is a cartesian category C together with a left C-module N.

The only connectives we can interpret in a JWA judgement model are 1 and ×. To interpret the other connectives, we once again need appropriate universal properties.

5.11. Definition. In a JWA judgement model (C, N),

¬A a jumpwith for a C-object A is a C-object V and a N -morphism [figure: V × A; jump]such that the functions

C_{X}V ⟶ N_{X×A}  for all X  (18)
f ⟼ (f × A)^{∗}jump

are isomorphisms.

∑_{i∈I}A_{i} a distributive coproduct for a family {A_{i}}_{i∈I} of C-objects is a C-object V and,

for each i ∈ I, a C-morphism \xymatrix{A_{i} \ar[r]^{^{in^{i}}} & V} , such that the functions

C(X × V, Y) ⟶ ∏_{i∈I}C(X × A_{i}, Y)  for all X, Y  (19)
N_{X×V} ⟶ ∏_{i∈I}N_{X×A_{i}}  for all X  (20)
f ⟼ λi.((X × in_{i})^{∗}f)

are isomorphisms.

A JWA model is a JWA judgement model with all jumpwiths and all countable distributive coproducts, and we write ¬ and ∑ for the operations on objects.

There is some redundancy in the definition of JWA model, by analogy with Prop. 5.6.

5.12. Proposition. In a JWA judgement model with all jumpwiths,

distributive coproducts if the functions (19) are all isomorphisms then so are the functions (20).

Proof. The isomorphism

\xymatrix{C_{X}¬1 \ar[r]^{≅} & N_{X×1} \ar[r]^{≅} & N_{X}}

maps f to (f, ( ))^{∗}jump, by calculation. So the diagram

\xymatrix{C_{X×V} ¬1 \ar[r] \ar[d]_{≅} & ∏_{i∈I} C_{X×A_{i}} ¬1 \ar[d]^{≅} \\ N_{X×V} \ar[r] & ∏_{i∈I} N_{X×A_{i}}}

commutes by calculation. So if the top arrow is an isomorphism, the bottom must be too.

Now we know what a JWA model is, we can define 2 constructions.

1. Given a CBPV model (C, D, O) and D-object \underline{R}, we obtain a JWA model (C, N) by setting N_{X} = O_{X} \underline{R}. The ∑ 1× connectives are unchanged, and jumpwiths are given by ¬A = U(A → \underline{R}).

2. Suppose we are given a JWA model (C, N). Then we obtain a CBPV adjunction (C, D′, O′) where D′ is (self C)^{op} and O′_{X}Y is defined to be N_{X×Y}. The ∑ 1× connectives are unchanged, and the other connectives are given by

F′A = ¬A
U′B = ¬B
A →′ B = A × B
∏′_{i∈I}B_{i} = ∑_{i∈I}B_{i}

6. Game Models

We wish to show the game semantics of [AHM98] to be a CBPV adjunction. It is convenient to do this first without the bracketing condition, in the manner of [Lai97], which is easier because it is a continuation model. Then we adapt the definitions to incorporate the bracketing condition. It is also possible to treat models constrained by visibility and innocence in the manner of [HO00, AM98], but we do not describe this here.

6.1. JWA Model Without Bracketing Condition. We first construct the JWA model. The basic definitions are standard:

6.2. Definition.

1. An (unlabelled) arena is a countable forest, i.e. a countable set R of tokens together with a function enabler : R ⟶ {∗} + R such that, for every token r, the sequence

\xymatrix{r = r_{0} \ar@{|->}[r]^{enabler} & r_{1} \ar@{|->}[r]^{enabler} & ⋯}

eventually reaches ∗. We usually write R instead of (R, enabler), and we write rt R for the set of tokens enabled by ∗.

2. A play in an arena R is a sequence of tokens t_{0}, …, t_{n−1}, together with a function justifier : {0, …, n − 1} ⟶ {∗, 0, …, n − 1} such that, for all i ∈ {0, …, n − 1}, we have

• justifier i < i

• enabler t_{i} = t_{justifier i}

• justifier i is even iff i is odd

where ∗ is taken to be odd and < 0, and t_{∗} is defined to be ∗.

By contrast with the usual accounts, we make Player go first. So, for a play of length n, we call i ∈ {0, …, n − 1} a P-move if i is even and an O-move if i is odd. Similarly, we say the play is awaiting P if n is even, and awaiting O if n is odd.

6.3. Definition. A strategy for an arena R is a prefix-closed set σ of O-awaiting plays that is deterministic i.e. if sm ∈ σ and sn ∈ σ then m = n. We write strat R for the set of strategies on R.

This enables us to describe the homsets of the “thread-independent” category G of [AHM98] (without the bracketing condition) by

G(R, S) = ∏_{s∈rt S} strat(R ⊎ S↾_{s})  (21)

where we write ⊎ for disjoint union of arenas, and S↾_{s} for the arena of tokens in S strictly below s.

We then define our JWA model (C, N) in the manner of [AM98]. Thus, a C-object is a countable family of arenas, and the homsets are given by

C({R_{i}}_{i∈I}, {S_{j}}_{j∈J}) = ∏_{i∈I} ∑_{j∈J} G(R_{i}, S_{j})
N_{{R_{i}}_{i∈I}} = ∏_{i∈I} strat R_{i}

Identities and composition are defined in the usual way. The connectives are given as follows:

{R_{i}}_{i∈I} × {S_{j}}_{j∈J} = {R_{i} ⊎ S_{j}}_{(i,j)∈I×J}
∑_{i∈I}{R_{ij}}_{j∈J_{i}} = {R_{ij}}_{(i,j)∈∑_{i∈I} J_{i}}
¬{R_{i}}_{i∈I} = {pt_{i∈I}R_{i}}_{( )∈1}

where pt_{i∈I}R_{i} is the arena with I roots, and a copy of R_{i} pasted beneath the ith root.

6.4. CBPV Adjunction Model Without Bracketing Condition. We next apply the construction of Sect. 5.9 to obtain a CBPV model (C, D′, O′) from our JWA model. Let us write this out explicitly. An object of D, like an object of C, is a countable family of arenas. The homsets are described by

C({R_{i}}_{i∈I}, {S_{j}}_{j∈J}) = ∏_{i∈I} ∑_{j∈J} G(R_{i}, S_{j})
O′_{{R_{i}}_{i∈I}}{S_{j}}_{j∈J} = ∏_{i∈I} ∏_{j∈J} strat(R_{i} ⊎ S_{j})
D′_{{R_{i}}_{i∈I}}({S_{j}}_{j∈J}, {T_{k}}_{k∈K}) = ∏_{i∈I} ∏_{k∈K} ∑_{j∈J} G(R_{i} ⊎ T_{k}, S_{j})

The connectives are described by

{R_{i}}_{i∈I} × {S_{j}}_{j∈J} = {R_{i} ⊎ S_{j}}_{(i,j)∈I×J}
∑_{i∈I}{R_{ij}}_{j∈J_{i}} = {R_{ij}}_{(i,j)∈∑_{i∈I} J_{i}}
U{R_{i}}_{i∈I} = {pt_{i∈I}R_{i}}_{( )∈1}
F {R_{i}}_{i∈I} = {pt_{i∈I}R_{i}}_{( )∈1}
∏_{i∈I}{R_{ij}}_{j∈J_{i}} = {R_{ij}}_{(i,j)∈∑_{i∈I} J_{i}}
{R_{i}}_{i∈I} → {S_{j}}_{j∈J} = {R_{i} ⊎ S_{j}}_{(i,j)∈I×J}

6.5. CBPV Adjunction Model With Bracketing Condition. To describe the bracketing condition, we first need to classify tokens into “question” and “answer” tokens.

6.6. Definition.

1. A (Q/A-labelled) arena is an unlabelled arena (R, enabler) together with a labelling

function \xymatrix{R \ar[r]^{λ^{QA}} & \{Q, A\}} such that every token enabled by an answer is a question. We say the arena is Q-rooted when, moreover, every root is a question.

2. For a countable family of arenas {R_{i}}_{i∈I}, we write pt_{i∈I}^{Q}R_{i} for the arena with I roots, all labelled Q, and a copy of R_{i} placed below the ith root.

3. For a countable family of Q-rooted arenas {R_{i}}_{i∈I}, we write pt_{i∈I}^{A}R_{i} for the arena with I roots, all labelled A, and a copy of R_{i} placed below the ith root.

6.7. Definition.

1. Let s be a P-awaiting play. Its pending question is the O-move Q_{0} if s is of the form

[figure: ⋯; Q_{0}; [; Q; ⋯; A; ]^{∗}]

and ∗ if s is of the form

[figure: [; Q; ⋯; A; ]^{∗}]

2. Let s be an O-awaiting play. Its pending question is the P-move Q_{0} if s is of the

form

[figure: ⋯; Q_{0}; [; Q; ⋯; A; ]^{∗}]

and does not exist if s is of the form

[figure: ⋯; A_{0}; [; Q; ⋯; A; ]^{∗}]

where A_{0} is justified by ∗.

3. A play is well-bracketed when, for every prefix of the form sm where m is an A-move, m points to the pending question of s.

4. A strategy under the bracketing condition on an arena R is a prefix-closed set of O-awaiting well-bracketed plays on R satisfying determinism: if sm = σ and sn = σ then m = n. We write strat^{b} R for the set of all strategies under the bracketing condition on R.

By analogy with (21), we define

G^{b}(R, S) = ∏_{s∈rt S} strat^{b}(R ⊎ S↾_{s})

Now we construct our CBPV adjunction (C, D′, O′). A C-object is a family of Q-rooted arenas, whereas a D′-object is a family of arenas (not necessarily Q-rooted). The adjunctives are given by

U{R_{i}}_{i∈I} = {pt_{i∈I}^{Q}R_{i}}_{( )∈1}
F {R_{i}}_{i∈I} = {pt_{i∈I}^{A}R_{i}}_{( )∈1}

Everything else is as in Sect. 6.4, replacing strat by strat^{b} and G by G^{b}. All the (omitted) definitions of identity, reindexing and composition adapt to the well-bracketed setting. The value category and strong monad obtained are precisely those defined in [AHM98].

6.8. Remark. In [AHM98], the bracketing condition is imposed on both players, and the categorical structure used there is dependent on that. The formulation given here has the advantage that it works whether bracketing is imposed on both players, on neither player, or on Player alone (as in [Har99]).

7. The Equational Theory

7.1. Complex Values and Stacks. Since we want the term model of CBPV+stacks to be a CBPV adjunction, we require additional syntax—otherwise we cannot even form a projection x : A × A′ ⊢^{v} V : A to make a cartesian category of values. The rules for the formation of “complex” values and stacks using binding and pattern-matching are given in Fig. 6. We shall see in Sect. 7.2 that these new constructs can always be eliminated from a computation. For example, return (pm V as (x, y).W) can be simplified into

pm V as (x, y).return W.

We explain the where construct as follows. In any stack K to \underline{B} there is a unique occurrence of nil, and we can “bind” it to a stack L from \underline{B}, giving the concatenated stack K ++L. A stack L′ from A → \underline{B} is typically of the form V :: L, where V is a value of type A and L is a stack from \underline{B}; so it can be pattern-matched as x : nil in K.

We mention that omitting the let construct and the K where nil is L construct would not affect the theory/model equivalence of Sect. 8.2; they are only a convenience. The pattern-match constructs, on the other hand, are essential.

7.2. Properties of Equational Theory. The equational theory is the least congruence on terms-in-context containing the laws in Fig. 7. To reduce clutter, we omit the assumptions necessary to make each equation well-typed. Given a term P in context Γ, we explicitly write its weakening by x : A as ^{x:A}P or just ^{x}P. Since a context must consist of distinct identifiers, this notation implicitly assumes that x ∉ Γ, so we avoid the need for the traditional proviso x ∉ FV(P).

7.3. Lemma. Provable equality is closed under substitution, dismantling and concatenation.

Proof. Straightforward induction in each case.

7.4. Proposition. For any computation Γ ⊢^{c} M : \underline{B}, we can obtain a computation Γ ⊢^{c} M′ : \underline{B} that does not use the complex value constructs of Fig. 6, and a proof that M = M′ in the equational theory. Similarly, we can eliminate these constructs from any closed value ⊢^{v} V : A.

Prop. 7.4, which does not involve stacks, is proved in [Lev01].

One noteworthy equation of Fig. 7 is the η-law

M • K = M to x. ((return x) • ^{x}K)  (22)

This is equivalent to the two equations

                               M = M to x. return x  (23)

(M to x. N) • K = M to x. (N • ^{x}K)  (24)

Complex Values

Γ ⊢^{v} V : A Γ, x : A ⊢^{v} W : B
Γ ⊢^{v} let V be x. W : B

Γ ⊢^{v} V : ∑_{i∈I}A_{i} ⋯ Γ, x : A_{i} ⊢^{v} W_{i} : B ⋯ _{i∈I}

Γ ⊢^{v} pm V as {…, (i, x).W_{i}, …} : B
Γ ⊢^{v} V : A × A′ Γ, x : A, y : A′ ⊢^{v} W : B
Γ ⊢^{v} pm V as (x, y).W : B

Complex Stacks

Γ ⊢^{v} V : A Γ, x : A|\underline{B} ⊢^{k} K : \underline{C}

Γ|\underline{B} ⊢^{k} let V be x. K : \underline{C}

Γ ⊢^{v} V : ∑_{i∈I}A_{i} ⋯ Γ, x : A_{i}|\underline{B} ⊢^{k} K_{i} : \underline{C} ⋯ _{i∈I} Γ|\underline{B} ⊢^{k} pm V as \{…, (i, x).K_{i}, …\} : \underline{C} Γ ⊢^{v} V : A × A′ Γ, x : A, y : A′|\underline{B} ⊢^{k} K : \underline{C}

Γ|\underline{B} ⊢^{k} pm V as (x, y).K : \underline{C}
Γ|\underline{C} ⊢^{k} K : \underline{B} Γ|\underline{B} ⊢^{k} L : \underline{D}

                        Γ|\underline{C} ⊢^{k} K where nil is L : \underline{D}

⋯ Γ|\underline{C} ⊢^{k} K_{i} : \underline{B}_{i} ⋯ _{i∈I} Γ|∏_{i∈I} \underline{B}_{i} ⊢^{k} L : \underline{D} Γ|\underline{C} ⊢^{k} \{…, K_{i} where i :: nil, …\} is L : \underline{D} Γ, x : A|\underline{C} ⊢^{k} K : \underline{B} Γ|A → \underline{B} ⊢^{k} L : \underline{D}

                      Γ|\underline{C} ⊢^{k} K where x :: nil is L : \underline{D}

Figure 6: Complex Values and Stacks (24) makes it clear why a stack denotes an algebra homomorphism in the monad models of CBPV. As instances of (24) we have many familiar CBPV equations:

(M to x. N) to y. P = M to x. (N to y. ^{x}P)
λ{…, i.(M to x. N_{i}), …} = M to x. λ{…, i.N_{i}, …}
λy.(^{y}M to x. N) = M to x. λy.N

In [Lev01] rather complex lemmas were required to prove these valid in an adjunction semantics. It is an advantage of working with stacks that these equations become straightforward.

β-laws
let V be x. Q  =  Q[V/x]

                     K where nil is L  =  K++L

pm (î, V) as {…, (i, x).Q_{i}, …}  = Qî[V/x]
pm (V, V′) as (x, y).Q  = Q[V/x, V′/y]

                      force thunk M  =  M

(return V) to x. M  = M[V/x]
î‘λ{…, i.M_{i}, …} = Mî
{…, K_{i} where i :: nil, …} is î:: L =  Kî++L
V ‘λx.M  = M[V/x]
K where x :: nil is V :: L  = K[V/x]++L
η-laws
Q[V/z] =  pm V as {…, (i, x).^{x}Q[(i, x)/z], …}
Q[V/z] =  pm V as (x, y).^{xy}Q[(x, y)/z]

               V  =  thunk force V

M • K =  M to x. ((return x) • ^{x}K)
K++L =  [·] to x. ((return x) • ^{x}K) :: L
M =  λ{…, i.i‘M, …}
K++L = {…, (K++i :: nil) where i :: nil, …} is L
M =  λx.(x ‘ ^{x}M)

             K++L =  (^{x}K++x :: nil) where x :: nil is L

Figure 7: Equational laws for CBPV + stacks

8. General Theories

8.1. Signatures. We define a sequent to be a judgment without a term; thus a sequent is of the form Γ ⊢^{v} B or Γ ⊢^{c} \underline{B} or Γ|\underline{B} ⊢^{k} K : \underline{B}′. Here Γ is a finite sequence A_{0}, …, A_{r−1} of value types, with no associated identifiers.

In order to follow the approach of [LS86], we need the facility to add primitive operations to CBPV. Each operation has a “sorting” which is a sequent^{2}. For example, the sorting + is nat, nat ⊢^{v} nat. Applied to two values of type nat, it makes a value of type nat. An operation div that returns a natural number, or—if the divisor is zero—raises an error, has the sorting nat, nat ⊢^{c} F nat.

More distinctively, we could have stack-like operations that build a computation M into a computation f(V_{0}, …, V_{r−1}|M) whose execution begins by executing M, and so the context f(V_{0}, …, V_{r−1}|[·]) is placed on to the stack for future use.

\begin{aligned}& Γ | & f(V_{0}, …, V_{r−1}|M) & \underline{B}′ & K & \underline{C} \\ ⇝ & Γ | & M & \underline{B} & f(V_{0}, …, V_{r−1}|[·]) :: K & \underline{C} \end{aligned}

A signature is a collection of primitive operations; more formally, a function from sequents to sets. The associated rules are shown in Fig. 8, and in Fig. 9 we define dismantling and concatenation for the terms generated by a signature.

{Γ ⊢^{v} V_{0} : A_{0} ⋯ Γ ⊢^{v} V_{r−1} : A_{r−1} \atop Γ ⊢^{v} f(V_{0}, …, V_{r−1}) : B} f ∈ S (A_{0}, …, A_{r−1} ⊢^{v} B)

{Γ ⊢^{v} V_{0} : A_{0} ⋯ Γ ⊢^{v} V_{r−1} : A_{r−1} \atop Γ ⊢^{c} f(V_{0}, …, V_{r−1}) : \underline{B}} f ∈ S (A_{0}, …, A_{r−1} ⊢^{c} \underline{B})
Γ ⊢^{v} V_{0} : A_{0} ⋯ Γ ⊢^{v} V_{r−1} : A_{r−1} Γ ⊢^{c} M : \underline{B}

Γ ⊢^{c} f(V_{0}, …, V_{r−1}|M) : \underline{B}′ f ∈ S (A_{0}, …, A_{r−1}|\underline{B} ⊢^{k} \underline{B}′)

Γ ⊢^{v} V_{0} : A_{0} ⋯ Γ ⊢^{v} V_{r−1} : A_{r−1} Γ|\underline{B}′ ⊢^{k} K : \underline{C}

Γ|\underline{B} ⊢^{k} f(V_{0}, …, V_{r−1}|[·]) :: K : \underline{C}

f ∈ S (A_{0}, …, A_{r−1}|\underline{B} ⊢^{k} \underline{B}′)

Figure 8: Rules For A Signature S

8.2. Theory/Model Equivalence. We are now in a position to state a theory/model equivalence theorem. Our formulation of this theorem (though not the proof) follows [LS86], in particular the use of structure preservation on the nose. For the purposes of this section, we insist on defining a cartesian category to be a category with distinguished terminal object and binary products. We cannot define it to be a category with distinguished n-ary products for all n ∈ ℕ, because the operations on objects and on types must be identical for the on-the-nose approach to work. This is a flaw, pervasive in categorical semantics, and we leave its rectification to future work.

2In [LS86], the only primitive operations required are constants, because in simply typed λ-calculus every sequent is equivalent to a closed sequent, but in CBPV that is not true for value sequents.

K  M • K  K++L

nil  M

L

[·] to x. N :: K  (M to x. N) • K

[·] to x. N :: (K++L)

î:: K  (î‘M) • K

î:: (K++L)

V :: K  (V ‘M) • K

V :: (K++L)

let V be x. K  let V be x. (^{x}M • K)

let V be x. (K++^{x}L)

pm V as {…, (i, x).K_{i}, …}  pm V as {…, (i, x).(^{x}M • K_{i}), …}

pm V as {…, (i, x).K_{i}++^{x}L, …}

pm V as (x, y).K  pm V as (x, y).(^{xy}M • K)

pm V as (x, y).(K++^{xy}L)

K where nil is K′  (M • K) • K′

                                            K where nil is (K′++L)

{…, K_{i} where i :: nil, …} is K′ (λ{…, i.(M • K_{i}), …}) • K′

{…, K_{i} where i :: nil, …} is (K′++L)

K where x :: nil is K′  (λx.(M • K)) • K′

                                         K where x :: nil is (K′++L)

f(V_{0}, …, V_{r−1}|[·]) :: K  f(V_{0}, …, V_{r−1}|M) • K

f(V_{0}, …, V_{r−1}|[·]) :: (K++L)

Figure 9: Dismantling and Concatenation

P  [[P]]
x_{i}  π_{i}
let x be V. P  (id, [[V]])^{∗}[[P]]
return V  [[V]]^{∗}prod
M to x. N  [[M]]; q^{F} [[N]]
force V  [[V]]^{∗}force
thunk M  q^{U}[[M]]
λx.M  q^{→}[[M]]
V ‘M  [[M]]; [[V]]^{∗}ev
λ{…, i.M_{i}, …}  q∏λi.[[M_{i}]]
î‘M  [[M]]; ( )^{∗}πî
(V, V′)  ([[V]], [[V′]])
pm V as (x, y). P  ((id, ([[V]]; π)), ([[V′]]; π′))^{∗}[[P]]
(î, V)  [[V]]; inî
pm V as {…, (i, x).P_{i}, …}  (id, [[V]])^{∗}q∑λi.[[P_{i}]]

nil  id

[·] to x. M :: K  (q^{F} [[M]]); [[K]]
î:: K  (( )^{∗}πî); [[K]]
V :: K  ([[V]]^{∗}ev); [[K]]
K where nil is L  [[K]]; [[L]]
{…, K_{i} where i :: nil, …} is L (q∏λi.[[K_{i}]]); [[L]]
K where x :: nil is L  (q^{→}[[K]]); [[L]]
f(V_{0}, …, V_{r−1})  ([[V_{0}]], …, [[V_{r−1}]])^{∗}f
f(V_{0}, …, V_{r−1}|M)  [[M]]; ([[V_{0}]], …, [[V_{r−1}]])^{∗}f
f(V_{0}, …, V_{r−1}|[·]) :: K  ([[V_{0}]], …, [[V_{r−1}]])^{∗}f; [[K]]

Figure 10: Categorical semantics

f (equivalence class of terms) \overline{f} (an arbitrary member)
id  x_{0}
f^{∗}g  \overline{g}[\overline{f}/x_{0}]
g; h (g an O-morphism)  \overline{g} • \overline{h}

id  nil

h; k (h a D-morphism)  \overline{h}++\overline{k}
π  πx_{0}
π′  π′x_{0}
(f, g)  (\overline{f}, \overline{g})

force  force x_{0}
q^{U}f  thunk \overline{f}
return  return x_{0}

q^{F} f  [·] to x_{1}. (\overline{f}[(x_{0}, x_{1})/x_{0}]) :: nil
inî  (î, x_{0})
q∑λi.g_{i}  pm x_{0} as \{…, (x_{1}, (i, x_{2})).\overline{f_{i}}[(x_{1}, x_{2})/x_{0}], …\}
πî î:: nil
q∏λi.g_{i} (g_{i} an O-morphism) λ\{…, i.\overline{g_{i}}, …\}
q∏λi.h_{i} (h_{i} a D-morphism) \{…, \overline{h_{i}} where i :: nil, …\} is nil
ev  x_{0} :: nil
q^{→}g (g an O-morphism)  λx_{1}.\overline{g}[(x_{0}, x_{1})/x_{0}]
q^{→}h (h a D-morphism)  \overline{h}[(x_{0}, x_{1})/x_{0}] where x_{1} :: nil is nil

Figure 11: Classifying Model Of A Theory

We begin our account by defining an on-the-nose morphism from CBPV adjunction (C, D, O, …) to CBPV adjunction (C′, D′, O′, …) in the obvious way. We then define Adj to be the category of CBPV adjunctions and on-the-nose morphisms.

A theory for CBPV+stacks consists of

• a type structure τ, i.e. two (not necessarily small) sets valtypes τ and comptypes τ, equipped with a binary operation × on valtypes τ, and similarly with operations for all the other connectives—note that τ is not required to be freely generated

• a τ-signature S, i.e. a function from sequents in τ to sets

• a congruence ≡ on the terms-in-context in τ generated from S according to Fig. 1, 6 and 8, containing all the equations of Fig. 7, and closed under substitution, dismantling and concatenation.

8.3. Remark. An alternative formulation is followed in [Jef99, Lev96], avoiding the mention of congruence. For fixed type structure τ, it is clear that the terms-in-context on a given τ-signature S, quotiented by the equations of Fig. 7, form another τ-signature; we write this as T_{τ}S. Moreover, we can extend T_{τ} to a monad on the category S_{τ} of τ-signatures. (This makes use of Lemma. 7.3.) We then define a direct model to be a type structure τ together with an algebra for the monad T_{τ}. This is equivalent to a theory.

An on-the-nose morphism G from a theory (τ, S, ≡) to a theory (τ′, S′, ≡′) provides

• a function from value types of τ to value types of τ′, and similarly for computation types, preserving all connectives

• a function from ≡-equivalence classes of S-values A_{0}, …, A_{m−1} ⊢^{v} V : B to ≡′- equivalence classes of S′-values GA_{0}, …, GA_{m−1} ⊢^{v} W : GB, and similarly for computations and stacks, preserving all the term constructors.

We can prove by induction that G must preserve substitution, dismantling and concatenation. We write Th for the category of theories and on-the-nose morphisms, and can now formulate our main result.

8.4. Proposition. The categories Adj and Th are equivalent.

Proof. Let A = (C, D, O, …) be a CBPV adjunction. We define its internal language LA to be the following theory. The type structure τ is given by ob C and ob D. The signature S is given by

S(A_{0}, …, A_{r−1} ⊢^{v} B) = C(A_{0} × ⋯ × A_{r−1}, B)
S(A_{0}, …, A_{r−1} ⊢^{c} \underline{B}) = O_{A_{0}×···×A_{r−1}} \underline{B}
S(A_{0}, …, A_{r−1}|\underline{B} ⊢^{k} \underline{C}) = C_{A_{0}×···×A_{r−1}}(\underline{B}, \underline{C})

We state rather pedantically that we define n-ary product in C by left association, so the product of the singleton sequence A is 1 × A.

We next interpret the terms generated by S in A, using the definitions in Fig. 10. We then prove that M •K denotes [[M]]; [[K]] and similarly for substitution and concatenation. These are all straightforward inductions (the proof for substitution requires us to prove that all the isomorphisms in Def. 5.2 are natural in X). We therefore see that the kernel of the semantics preserves substitution, dismantling and concatenation; we set ≡ to be this congruence. Showing that it satisfies all the required equational laws is straightforward.

In the opposite direction, given a theory L = (τ, S, ≡) we define its classifying model CL to be the following CBPV adjunction. The objects are just the types of τ, and the operations on objects given by the type structure. The homsets are defined by

C(A, B) = S(A ⊢^{v} B)
O_{A}\underline{B} = S(A ⊢^{c} \underline{B})
C_{A}(\underline{B}, \underline{C}) = S(A|\underline{B} ⊢^{k} \underline{C})

All the categorical operations are defined in Fig. 11. Proving the equations of a CBPV adjunction is trivial, using Lemma 3.1 generalized to terms generated by S.

Next we have to show these two operations L and C to be inverse up to on-the-nose isomorphism. Given a model A = (C, D, O, …), we want to construct an on-the-nose isomorphism α_{A} from A to CLA = (C′, D′, O′). These two models have the same objects and operations on objects, and we set α_{A} to be identity on objects. The homsets of A′ are given by

C′(A, B) = C(1 × A, B)
O′_{A}\underline{B} = O_{1×A}\underline{B}
D′_{A}(\underline{B}, \underline{C}) = D′_{1×A}(\underline{B}, \underline{C})

and we set α_{A} to reindex by the isomorphism from 1 × A to A. Proving that this is structure-preserving is long and straightforward.

On the other hand, given a theory L = (τ, S, ≡), we want to construct an on-the-nose isomorphism β_{L} from L to LCL = (τ, S′, ≡′). The two theories have the same type structure, and we set β_{L} to be identity on objects. The signature S′ is given by

S′(A_{0}, …, A_{r−1} ⊢^{v} B) = S(A_{0} × ⋯ × A_{r−1} ⊢^{v} B)
S′(A_{0}, …, A_{r−1} ⊢^{c} \underline{B}) = S(A_{0} × ⋯ × A_{r−1} ⊢^{c} \underline{B})
S′(A_{0}, …, A_{r−1}|\underline{B} ⊢^{k} \underline{C}) = S(A_{0} × ⋯ × A_{r−1}|\underline{B} ⊢^{k} \underline{C})

and we set β_{L} to reindex by the obvious context morphism from A_{0} × ⋯ × A_{r−1} to A_{0}, …, A_{r−1}. Proving that this is structure preserving is straightforward.

It is obvious how to extend L and C to functors between Adj and Th, and it is then easily seen that α and β are natural.

9. Call-By-Value is Kleisli, Call-By-Name is co-Kleisli

Given a CBPV adjunction, we can form Kleisli and co-Kleisli adjunctions and obtain fully faithful comparison functors.

\xymatrix{ & self C \ar[r]^{F}_{⊥} \ar[dd]_{⊢} & D \ar[l]^{U} \ar[dd]_{⊣} \\ Kleisli &  &  & co-Kleisli \\  & C_{UF} \ar[uu] \ar@{^{(}->}[uur] & D_{F U} \ar[uu] \ar@{^{(}->}[uul]}

In general:

• A CBV term is translated into a CBPV computation of the form A_{0}, …, A_{n−1} ⊢^{c} M : F B. Hence it is interpreted in the Kleisli category. In fact we have a strong adjunction between C and C_{UF}, in the terminology of [LPT03] this is a strong κcategory.

• A CBN term is translated into a CBPV computation of the form U\underline{A}_{0}, …, U\underline{A}_{n−1} ⊢^{c} M : \underline{B}. Hence it is interpreted in the co-Kleisli category, in the fibre over 1.

For the cpo model, the Kleisli category (over 1) provides the partial maps model for CBV [Plo85], while the co-Kleisli category (over 1) is pointed cpos and continuous maps— the standard model for CBN. Similarly from the game model (with the appropriate constraints of bracketing, visibility and innocence), we recover the standard CBV and CBN models [AM98, HY97, HO00, Nic96].

Notice that the duality, in a continuation model, between the Kleisli and co-Kleisli categories [Sel01, SR98] is a consequence of the duality between C and D_{1}.

10. Stacks For Non-Algebraic Effects

Certain effects such as exception-handling are called non-algebraic in [PP01]. They present a problem for this work because they lead to additional stack terms that violate the laws we have imposed. As an example, for exception-handling we want the transition

Γ | try M catch e.N F A  K  \underline{C}
⇝ Γ | M  F A try [·] catch e.N :: K  \underline{C}

But consider the equation

K++L = [·] to x. ((return x) • ^{x}K) :: L

from Fig. 7. Put try [·] catch e.return 5 :: nil for K and nil for L. The two sides are clearly not equivalent: the LHS dismantled onto raise e returns 5, whereas the RHS dismantled onto raise e raises e. In terms of the algebra model for the − + E monad on Set, a stack such as this K ought to denote a non-homomorphism.

This is roughly similar to the exception/continuation example in [Lai02]. More work is certainly required to find an appropriate equational theory and categorical structure for non-algebraic effects.

11. Further Directions

Most important is describing the universal properties in terms of naturality rather than elements, by means of a Yoneda Lemma. The trickiest in this regard is the distributive coproduct. See [Lev04] for further development of this.

In this paper we have presented the examples of CBPV adjunctions without any motivation, but of course they need to be explained operationally, especially as regards the stack morphisms; again, more information can be found in [Lev04].

The notion of stack judgement is in no way special to CBPV. It can be adapted to CBV; instead of CBPV adjunction we obtain “strong κ-category”, presented in [LPT03] although not related there to the CK-machine. For CBN, the advantage is even greater. It appears that no categorical semantics for CBN has ever been given in the literature, because the weak coproducts denoted by sum types have a complicated structure. But stacks (provided only algebraic effects are allowed) resolve this problem: a family of CBN terms Γ, x : A_{i} ⊢ M : B, indexed by i ∈ I, corresponds to a stack Γ|∑_{i∈I}A_{i} ⊢^{k} K : B.

There are apparent connections between the models here and polarized models such as the game models in [CS, Lau02]. These need to be explored.

References

[AHM98] S. Abramsky, K. Honda, and G. McCusker. A fully abstract game semantics for general references. In Proc., 13th Ann. IEEE Symp. on Logic in Comp. Sci., 1998.

[AM98] S. Abramsky and G. McCusker. Call-by-value games. In M. Nielsen and W. Thomas, editors, Computer Science Logic: 11th International Workshop Proceedings, LNCS. Springer, 1998.

[CH00] Pierre-Louis Curien and Hugo Herbelin. The duality of computation. In Proc., ACM Sigplan International Conference on Functional Programming (ICFP-00), volume 35.9 of ACM Sigplan Notices, pages 233–243, N.Y., September 18–21 2000. ACM Press.

[CLW93] A. Carboni, S. Lack, and R. F. C. Walters. Introduction to extensive and distributive categories. Journal of Pure and Applied Algebra, 84:145–158, 1993.

[CM93] P. Cenciarelli and E. Moggi. A syntactic approach to modularity in denotational semantics. In CTCS 1993, 1993.

[Coc93] J. R. B. Cockett. Introduction to distributive categories. Mathematical Structures in Computer Science, 3(3):277–307, September 1993.

[CS] R. Cockett and R. Seely. Polarized category theory, modules and game semantics. Preprint.

[Dan92] O. Danvy. Back to direct style. In Proc. European Symposium on Programming, volume 582 of LNCS, 1992.

[FF86] M. Felleisen and D. Friedman. Control operators, the SECD-machine, and the λ-calculus. In M. Wirsing, editor, Formal Description of Prog. Concepts. North-Holland, 1986.

[Fil96] A. Filinski. Controlling Effects. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, 1996.

[FPD99] M. Fiore, G. D. Plotkin, and D.Turi. Abstract syntax and variable binding. In G. Longo, editor, Proceedings of the 14th Annual Symposium on Logic in Computer Science (LICS’99), pages 193–202, Trento, Italy, July 1999. IEEE Computer Society Press.

[Har99] R. Harmer. Games and full abstraction for nondeterministic languages. PhD thesis, Univ. of London, 1999.

[HO00] M. Hyland and L. Ong. On full abstraction for PCF: I, II, and III. Inf. and Comp., 163(2), 2000.

[HY97] K. Honda and N. Yoshida. Game theoretic analysis of call-by-value computation. In P. Degano, R. Gorrieri, and A. Marchetti-Spaccamela, editors, Automata, Languages and Programming, 24th International Colloquium, volume 1256 of LNCS, pages 225–236, Bologna, Italy, 1997. Springer.

[Jef99] A. Jeffrey. A fully abstract semantics for a higher-order functional language with nondeterministic computation. Theoretical Comp. Sci., 228, 1999.

[Kri85] J.-L. Krivine. Un interpréteur de λ-calcul. Unpublished, 1985.

[Lai97] J. Laird. Full abstraction for functional languages with control. In Proceedings, Twelfth Annual IEEE Symposium on Logic in Computer Science, pages 58–67, Warsaw, Poland, 1997. IEEE Computer Society Press.

[Lai98] J. Laird. A Semantic Analysis of Control. PhD thesis, University of Edinburgh, [Lai02] James Laird. Exceptions, continuations and macro-expressiveness. Lecture

Notes in Computer Science, 2305, 2002.

[Lau02] Olivier Laurent. Polarized games. In Logic in Computer Science, pages 265–274, Los Alamitos, CA, USA, July 22–25 2002. IEEE Computer Society.

[Law63] F. W. Lawvere. Functorial Semantics of Algebraic Theories. PhD thesis, Columbia University, 1963. Reprinted as Reprints in Theory and Applications of Categories, No. 5 (2004), pages 1–121.

[Lev] P. B. Levy. Call-by-push-value: Decomposing call-by-value and call-by-name. submitted.

[Lev96] P. B. Levy. λ-calculus and cartesian closed categories. Essay for Part III of the Mathematical Tripos, Cambridge University, manuscript, 1996.

[Lev99] P. B. Levy. Call-by-push-value: a subsuming paradigm (extended abstract). In J.-Y Girard, editor, Typed Lambda-Calculi and Applications, volume 1581 of LNCS, 1999.

[Lev01] P. B. Levy. Call-by-push-value. PhD thesis, Queen Mary, University of London, 2001.

[Lev02] P. B. Levy. Possible world semantics for general storage in call-by-value. In J. Bradfield, editor, Proc., 16th Annual Conference in Computer Science Logic, Edinburgh, 2002, volume 2471 of LNCS, pages 232–246. Springer, 2002.

[Lev03] P. B. Levy. Adjunction models for call-by-push-value with stacks. In R. Blute and P. Selinger, editors, Proc., 9th Conference on Category Theory and Computer Science, Ottawa, 2002, volume 69 of Electronic Notes in Theoretical Computer Science, 2003.

[Lev04] P. B. Levy. Call-By-Push-Value. Semantic Structures in Computation. Kluwer, 2004.

[LPT03] P. B. Levy, A. J. Power, and H. Thielecke. Modelling environments in callby-value programming languages. Information and Computation, 185:182–210, 2003.

[LRS93] Y. Lafont, B. Reus, and Th. Streicher. Continuation semantics or expressing implication by negation. Technical Report 9321, Ludwig-Maximilians-Universität, München, 1993.

[LS86] J. Lambek and P. Scott. Introduction to Higher Order Categorical Logic. Cambridge University Press, Cambridge, 1986.

[Mog91] E. Moggi. Notions of computation and monads. Inf. and Comp., 93, 1991.

[Mog90] E Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Dept. of Computer Science, Edinburgh Univ., 90.

[Nic96] H. Nickau. Hereditarily Sequential Functionals: A Game-Theoretic Approach to Sequentiality. Shaker-Verlag, 1996. Diss., Universität Gesamthochschule Siegen.

[Ole82] F. J. Oles. A Category-Theoretic Approach to the Semantics of Programming Languages. Ph. D. dissertation, Syracuse University, August 1982.

[Plo85] G. D. Plotkin. Lectures on predomains and partial functions. Course notes, Center for the Study of Language and Information, Stanford, 1985.

[PP01] Gordon Plotkin and John Power. Adequacy for algebraic effects. Lecture Notes in Computer Science, 2030, 2001.

[PS98] A. M. Pitts and I. D. B. Stark. Operational reasoning for functions with local state. In A. D. Gordon and A. M. Pitts, editors, Higher Order Operational Techniques in Semantics, Publications of the Newton Institute, pages 227–273. Cambridge University Press, 1998.

[Sel01] P. Selinger. Control categories and duality: On the categorical semantics of the λμ-calculus. Mathematical Structures in Computer Science, 11(2), 2001.

[SF93] A. Sabry and M. Felleisen. Reasoning about programs in continuation-passing style. Lisp and Symbolic Computation, 6(3/4), 1993.

[SR98] Th. Streicher and B. Reus. Classical logic, continuation semantics and abstract machines. Journal of Functional Programming, 8(6), 1998.

[Thi97] H. Thielecke. Continuation semantics and self-adjointness. In Proceedings MFPS XIII, Electronic Notes in Theoretical Computer Science. Elsevier, 1997.

School of Computer Science, University of Birmingham Birmingham B15 2TT, United Kingdom

Email: pbl@cs.bham.ac.uk

This article may be accessed via WWW at http://www.tac.mta.ca/tac/ or by anony-

mous ftp at ftp://ftp.tac.mta.ca/pub/tac/html/volumes/14/5/14-05.{dvi,ps}

THEORY AND APPLICATIONS OF CATEGORIES (ISSN 1201-561X) will disseminate articles that significantly advance the study of categorical algebra or methods, or that make significant new contributions to mathematical science using categorical methods. The scope of the journal includes: all areas of pure category theory, including higher dimensional categories; applications of category theory to algebra, geometry and topology and other areas of mathematics; applications of category theory to computer science, physics and other mathematical sciences; contributions to scientific knowledge that make use of categorical methods.

Articles appearing in the journal have been carefully and critically refereed under the responsibility of members of the Editorial Board. Only papers judged to be both significant and excellent are accepted for publication.

The method of distribution of the journal is via the Internet tools WWW/ftp. The journal is archived electronically and in printed paper format.

Subscription information. Individual subscribers receive (by e-mail) abstracts of articles as they are published. Full text of published articles is available in .dvi, Postscript and PDF. Details will be e-mailed to new subscribers. To subscribe, send e-mail to tac@mta.ca including a full name and postal address. For institutional subscription, send enquiries to the Managing Editor.

Information for authors. The typesetting language of the journal is TEX, and L^{A}TEX2e is the preferred flavour. TEX source of articles for publication should be submitted by e-mail directly to an appropriate Editor. They are listed below. Please obtain detailed information on submission format and style files from the journal’s WWW server at http://www.tac.mta.ca/tac/. You may also write to tac@mta.ca to receive details by e-mail.

Managing editor. Robert Rosebrugh, Mount Allison University: rrosebrugh@mta.ca

TEXnical editor. Michael Barr, McGill University: mbarr@barrs.org

Transmitting editors.

Richard Blute, Université d’ Ottawa: rblute@mathstat.uottawa.ca Lawrence Breen, Université de Paris 13: breen@math.univ-paris13.fr Ronald Brown, University of North Wales: r.brown@bangor.ac.uk Jean-Luc Brylinski, Pennsylvania State University: jlb@math.psu.edu Aurelio Carboni, Università dell Insubria: aurelio.carboni@uninsubria.it Valeria de Paiva, Xerox Palo Alto Research Center: paiva@parc.xerox.com

Ezra Getzler, Northwestern University: getzler(at)math(dot)northwestern(dot)edu

Martin Hyland, University of Cambridge: M.Hyland@dpmms.cam.ac.uk P. T. Johnstone, University of Cambridge: ptj@dpmms.cam.ac.uk G. Max Kelly, University of Sydney: maxk@maths.usyd.edu.au Anders Kock, University of Aarhus: kock@imf.au.dk Stephen Lack, University of Western Sydney: s.lack@uws.edu.au F. William Lawvere, State University of New York at Buffalo: wlawvere@acsu.buffalo.edu Jean-Louis Loday, Université de Strasbourg: loday@math.u-strasbg.fr Ieke Moerdijk, University of Utrecht: moerdijk@math.uu.nl Susan Niefield, Union College: niefiels@union.edu Robert Paré, Dalhousie University: pare@mathstat.dal.ca Jiri Rosicky, Masaryk University: rosicky@math.muni.cz Brooke Shipley, University of Illinois at Chicago: bshipley@math.uic.edu James Stasheff, University of North Carolina: jds@math.unc.edu Ross Street, Macquarie University: street@math.mq.edu.au Walter Tholen, York University: tholen@mathstat.yorku.ca Myles Tierney, Rutgers University: tierney@math.rutgers.edu Robert F. C. Walters, University of Insubria: robert.walters@uninsubria.it R. J. Wood, Dalhousie University: rjwood@mathstat.dal.ca