Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational...

40
Segal condition meets computational effects Paul-Andr´ e Melli` es * February 25, 2010 Abstract Lawvere observed in his PhD thesis that every finitary monad T on the category of sets is described by an algebraic theory whose n-ary operations are precisely the elements of the free algebra Tn generated by n elements. This canonical presentation of the monad is fundamental, and offers a precious guide in the search for a concrete presentation by generators and relations. Hence, much work has been devoted to extend these ideas to situations of computational interest, like enriched categories, or algebraic structures admit- ting operations of infinite arity. In this paper, we clarify the conceptual nature of these extended Lawvere theories, by uncovering the change-of-arity mecha- nisms which underlie them. To that purpose, we start from the Segal condition recently formulated by Weber for a general notion of monad with arity. Our first contribution is to establish the Segal condition by a nice and conceptual argument based on a Beck-Chevalley property satisfied by the change-of-arity operations. Our second contribution is to define an abstract notion of Law- vere theory with arity, which extends to every category and every arity the traditional correspondence between Lawvere theories and finitary monads on Set. We also explain how this abstract approach to Lawvere theories clarifies the notion of enriched Lawvere A -theory recently introduced by Nishizawa and Power. Finally, we illustrate the concrete benefits of Lawvere’s ideas by describing how the elegant and intuitive presentation of the state monad for- mulated by Plotkin and Power is ultimately validated by a rewriting property on sequences of updates and lookups. Keywords: Computational effects, finitary monads, algebraic theories, simplicial nerve, Segal condition, monads with arity, theories with arity, algebraic presentations, state monad. * This work has been supported by the ANR Curry-Howard for Concurrency (CHOCO). Postal address: Laboratoire PPS, CNRS & Universit´ e Paris VII Denis Diderot, 2 place Jussieu, Case 7014, 75251 Paris Cedex 05, FRANCE. Email address: [email protected]

Transcript of Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational...

Page 1: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Segal condition meets computational effects

Paul-Andre Mellies ∗

February 25, 2010

Abstract

Lawvere observed in his PhD thesis that every finitary monad T on thecategory of sets is described by an algebraic theory whose n-ary operations areprecisely the elements of the free algebra Tn generated by n elements. Thiscanonical presentation of the monad is fundamental, and offers a preciousguide in the search for a concrete presentation by generators and relations.Hence, much work has been devoted to extend these ideas to situations ofcomputational interest, like enriched categories, or algebraic structures admit-ting operations of infinite arity. In this paper, we clarify the conceptual natureof these extended Lawvere theories, by uncovering the change-of-arity mecha-nisms which underlie them. To that purpose, we start from the Segal conditionrecently formulated by Weber for a general notion of monad with arity. Ourfirst contribution is to establish the Segal condition by a nice and conceptualargument based on a Beck-Chevalley property satisfied by the change-of-arityoperations. Our second contribution is to define an abstract notion of Law-vere theory with arity, which extends to every category and every arity thetraditional correspondence between Lawvere theories and finitary monads onSet. We also explain how this abstract approach to Lawvere theories clarifiesthe notion of enriched Lawvere A -theory recently introduced by Nishizawaand Power. Finally, we illustrate the concrete benefits of Lawvere’s ideas bydescribing how the elegant and intuitive presentation of the state monad for-mulated by Plotkin and Power is ultimately validated by a rewriting propertyon sequences of updates and lookups.

Keywords: Computational effects, finitary monads, algebraic theories, simplicialnerve, Segal condition, monads with arity, theories with arity, algebraicpresentations, state monad.

∗This work has been supported by the ANR Curry-Howard for Concurrency (CHOCO). Postaladdress: Laboratoire PPS, CNRS & Universite Paris VII Denis Diderot, 2 place Jussieu, Case7014, 75251 Paris Cedex 05, FRANCE. Email address: [email protected]

Page 2: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

1 Introduction

An ambition of our time. Mathematics is traditionally interested in numbersand spaces, and there is apparently a wide cultural and conceptual gap to fill inorder to understand the mathematical nature of programming languages. Theproject may even appear far too ambitious, and even bizarre: after all, what kindof connection should I really expect between the symplectic geometry of Poissonalgebras, for instance, and the behavior of my favorite programming language?

The miracle is that the cultural gap with mathematics very often disappearswhen one climbs in abstraction, this higher point of view revealing beautiful land-scapes where the conceptual tools of the two fields suddenly unify. One strik-ing illustration is provided by the notion of computational monad introduced byMoggi [17] in order to describe a functional call-by-value language with effects.The notion of monad in intrinsically mathematical, and offers at the same timea concise and elegant way to describe a wide class of effects: nondeterminism,states, exceptions, interactive input/output, and continuations, see [2]. Anotherbeautiful illustration is provided by the notion of sheaf on a Grothendieck topol-ogy (typically, the Schanuel topos) which offers a convenient setting to describeprogramming languages with local variables and fresh names [4].

It is quite fascinating to see that the most promising links between mathematicsand programming languages emerged at these somewhat himalayan heights. Onthe other hand, I am convinced that this abstraction is only the preliminary stageof a much deeper unity of the two fields, including the most concrete and com-binatorial aspects of mathematics and software engineering. My main ambitionin this paper is to illustrate this conceptual unity by revisiting the current stateof the art on computational effects presented by operations and equations, in thelight of a recent and unexpected connection with a fundamental tool of homotopytheory and higher dimensional algebra: the Grothendieck-Segal characterization ofthe simplicial nerve of a category.

The state monad, concretely. Given a computational monad capturing a par-ticular notion of effect, typically the state monad

T (X) = (S ×X)S

defined by a particular set S of states on the category of sets, one fundamentalquestion is to understand how to present the monad by generators and relations.This question was recently solved in an elegant and intuitive way by Plotkin andPower [19] in the case of the state monad, for a set S of states defined as

S = V L

where L is a finite set of locations, and V is a countable set of values. A globalstore on a set A is defined there as a pair of functions

lookup : AV −→ AL

update : A −→ AL×V

2

Page 3: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

satisfying a series of basic equalities formulated in [19]. The beautiful thing aboutthis notion of global store is that it provides a very concrete description of thealgebras of the state monad, based on intuitive properties of lookups and updatesin a store. However, the notion of global store defined in [19] is not algebraic inthe usual sense, since the lookup and update operations have outputs with arity Land V × L respectively. It is not very difficult however to reformulate it as analgebraic theory, by defining a global store as a family of unary operations

updateloc,val : A −→ A

indexed by locations loc ∈ L and values val ∈ V , together with a family of V -aryoperations

lookuploc : AV −→ A

indexed by locations loc ∈ L. These operations should satisfy a series of basicequations easily deduced from [19] and described in the Appendix.

The fact that there exists such an algebraic theory for the state monad can beforecast by purely conceptual means, at least when the set of values V is finite. Inthat case, the set of states S = V L is finite, and the state monad is thus finitary –in the technical sense that it preserves filtered colimits in the category of sets. Now,we know since the work by Lawvere [12] that every finitary monad is described byan algebraic theory whose n-ary operations are the elements of the free algebra Tngenerated by n elements. In the case of the state monad, a n-ary operation is thusgiven by a set-theoretic function

S −→ S × n. (1)

It is very instructive to look carefully at the natural description of the update andlookup operations as such maps in the Lawvere theory of the state monad:

updateloc,val : S −→ S

state 7→ state[loc := val]

lookuploc : S −→ S × Vstate 7→ (state, state(loc))

In their paper, Plotkin and Power [19] apply an advanced categorical argument(Beck theorem) in order to establish that the category of sets with global store isequivalent to the category of algebras of the state monad. We explain at the end ofthe paper (Section 7) how to deduce the property from a simple and purely combi-natorial argument based on the observation that the update and lookup operationspresent the Lawvere theory of the state monad by generators and relations. Thismeans more specifically that:

• the update and lookup operations generate all the operations (1) of the Law-vere theory,

3

Page 4: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

• the equations between the update and lookup operations formulated in theAppendix are sufficient to reflect the equality between the operations (1) inthe Lawvere theory.

These two fundamental facts will be established by applying basic rewriting tech-niques on the sequences of update and lookup operations.

Beyond finitary monads. The algebraic theory of global stores for a finiteset V of values may be easily extended to a countable set of values... this requir-ing however to consider an operation lookuploc with countable arity V for everylocation loc. One needs to extend accordingly the original notion of Lawvere the-ory, in order to incorporate operations with countable arity. Although this maybe done in a somewhat straightforward fashion, the question of arity is much moresubtle than it seems, especially in the enriched case investigated by Hyland andPower [7]. In fact, a purely conceptual and flexible notion of arity in algebraictheories is still missing, although it would be extremely useful in the daily practiceof specifying and combining monadic effects. The main purpose of this paper isthus to define a notion of algebraic theory with arity corresponding to the notionof monad with arity recently introduced by Weber [23] in his work on the Segalcondition, following a conceptual track in higher dimensional algebra opened byBerger [3] and Leinster [13]. We briefly explain this line of work here, starting fromthe Segal condition originally formulated by Grothendieck in order to characterizethe simplicial nerve of a category.

Simplicial sets. The category of simplices ∆ has the natural numbers [n] seenas totally ordered sets [n] = {0, . . . , n} as objects, and the monotone functionsbetween them as morphisms. There exists a fully faithful functor

i : ∆ −→ Cat (2)

which embeds the category ∆ into the category Cat of small categories and functors.The functor i transports every natural number n to the free category over thefiliform graph

0 −→ 1 −→ · · · −→ n

with n edges and n + 1 vertices. A simplicial set X is then defined as a presheafover the category ∆, that is, a family (Xn)n∈N of sets, equipped with a function

Xf : Xq −→ Xp

for every monotone function f : [p]→ [q]. The definition is motivated by geometricintuitions: indeed, every simplicial set X describes a topological space (called itsgeometric realization) obtained by introducing a n-dimensional simplex for everyelement of Xn and gluing them together according to the gluing data provided bythe face and degeneracy functions Xf .

4

Page 5: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Nerve of a category. Now, every functor

F : A −→ B

to a locally small category B induces a functor noted

B(F, 1) : B −→ A (3)

which transports an object B of the category B to the presheaf B(F,B) of thecategory A defined as

B(F,B) : A op −→ SetA 7→ B(FA,B).

The functor (2) induces in this way a functor

Cat(i, 1) : Cat −→ ∆

which transports every small category to a simplicial set, called its nerve. Thisnerve construction is extremely important, because it enables to see a category asa higher dimensional geometry, and to apply on it the marvelous tools of homotopytheory, see [16, 15] for details.

Segal condition. The Segal condition appears originally in a paper by Segal [21]where it is attributed to Grothendieck. The condition enables to characterize thesimplical sets isomorphic to the nerve of a small category, starting from the obser-vation that the diagram

[p]

##FFFFFFF

[0]

max;;wwwwwwww

min ##HHHHHHHH [p+ q]

[q]

;;xxxxxxx

defines a colimit diagram (that is, a pushout) in the category ∆, for every pairof natural numbers p and q, where max(0) = p and min(0) = 0. The geometricintuition is that the graph [p + q] is obtained by gluing together the graphs [p]and [q] on the terminal vertex p ∈ [p] and initial vertex 0 ∈ [q]. Now, the Segalcondition reads as follows:

Theorem. A simplicial set X is isomorphic to the nerve of a small category Cprecisely when the colimit diagram is transported to a limit diagram (that is, apullback)

XpXmax

~~||||||

X0 Xp+q

bbEEEEEE

||yyyyyy

Xq

Xmin

``BBBBBB

5

Page 6: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

in the category Set of sets and functions.

In other words, the nerve of a category is characterized by the property that a(p + q)-dimensional simplex is the same thing as a pair (x, y) consisting of a p-simplex x and a q-simplex y whose extremal edges Xmax(x) and Xmin(y) coincide.

Segal condition reformulated. Let ∆0 denote the subcategory of ∆ with thesame objects, and distance preserving functions f : [m]→ [n] as morphisms:

∀p ∈ [m], f(p+ 1) = f(p) + 1.

The category ∆0 is at the same time a full subcategory of the category Graph oforiented graphs, this defining a commutative diagram:

∆i // Cat

∆0i0 //

`

OO

Graph

Free

OO

(4)

where the functor Free transports an oriented graph to its free category. Now,it appears that a simplicial set X satisfies the Segal condition if and only if thereexists a graph G such that the functor

∆op0

`op// ∆op X // Set

is isomorphic to the functor

Graph(i0, G) : n 7→ Graph(i0n,G).

In this alternative formulation, the nerve X of a small category is characterized bythe fact that its restriction to the category ∆0 of filiform graphs describes (up tonatural isomorphism) the set Graph(i0n,G) of paths of length n of some graph G.Note that the Segal condition on X may be alternatively formulated as a sheafcondition for a particular Grothendieck topology on the category ∆0, defining thestructure of a Grothendieck topos on the category Graph, see the work by Berger [3]for details.

Linton condition. This alternative formulation of the Segal condition as a rep-resentability property (rather than as a preservation-of-limit property) providesthe basic pattern of the present work, a precious guideline which will be reappearonce and again in our investigation of the conceptual nature of algebraic theories.In order to understand the idea properly, it is wise to start from a striking analogywith the description by Linton [14] of the algebras of a monad T , dating back tothe late 1960s. Recall that the kleisli category AT of a monad T on a category Ahas the same objects as the category A , and its morphisms A→ A′ the morphisms

6

Page 7: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

A → TA′ of the category A . The kleisli category is equivalent to the category offree algebras of the monad T , this inducing a commutative diagram

ATi // T -Alg

Aid //

F

OO

A

Free

OO

(5)

where F is the expected identity-on-object functor, and i is the comparison functorwhich transports an object A into the free algebra (TA, µA). The functor i is dense,and thus induces a fully faithful functor

T -Alg(j, 1) : T -Alg −→ AT

which transports every algebra (A, h) to a presheaf over AT which deserves thename of nerve of the algebra (A, h). Now, Linton condition states that for everymonad T ,

Theorem [Linton] A presheaf ϕ on the kleisli category AT is isomorphic to thenerve of an algebra if and only if the presheaf

A op F op// A op

T

ϕ // Set

is representable in the category A , this meaning that ϕ is isomorphic to the presheaf yAassociated to an object A by the yoneda embedding:

yA = A (1, A) : A′ 7→ A (A′, A).

One should see Linton condition as an extremal Segal condition where the func-tor i0 in the commutative diagram (4) is replaced by the identity functor in thecommutative diagram (5). Typically, observe that (5) is instantiated as

FreeCati // Cat

Graph id //

F

OO

Graph

Free

OO

(6)

for the free category monad T on the category Graph.

Monads with arity. Once the connection with Linton condition established,the Segal condition reduces to understanding when the identity functor appearingin (5) may be replaced by a functor

i0 : Θ0 −→ A

7

Page 8: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

describing a notion of arity for the monad T . Although the connection with Lintoncondition does not appear in his work, this is precisely the question investigatedby Weber [23] with the notion of monad with arity. The point is that every arityfunctor i0 induces a commutative diagram

ΘTiT // T -Alg

Θ0i0 //

`

OO

A

Free

OO

where the category ΘT is characterized by the fact that the functor ` is the identityon objects (hence, the category ΘT has the same objects as the category Θ0) andthat the functor iT is fully faithful (hence, the category ΘT has the same morphismsas the category T -Alg, locally speaking). Weber formulates a series of sufficientconditions on the functor i0 and on the monad T , such that the induced nervefunctor

T -Alg(i0, 1) : T -Alg −→ ΘT

satisfies a Segal condition, which states that the category T -Alg is equivalent tothe full subcategory of presheaves of ΘT whose restriction along the functor ` isisomorphic to the restriction of a representable presheaf along the functor i0. Theresulting notion of monad with arity is extremely rich and flexible. Typically, afinitary monad on the category Set is the same thing as a monad with arity i0defined as the fully faithful functor

i0 : Nat −→ Set (7)

starting from the full subcategory of Set defined by the finite sets 〈n〉 = {0, . . . , n−1}. More generally, any accessible monad on a locally presentable category Adefines a monad with arity: there exists indeed a regular cardinal κ such that A isκ-presentable and T preserves κ-filtered colimits, and the arity i0 is then defined asthe inclusion functor of a skeleton of the full subcategory of κ-presentable objects,see [1] for details. Typically, a countable monad is the same thing as a monad witharity

i0 : Count −→ Set (8)

defined by extending the previous arity (7) with the countable set 〈ω〉 = {0, 1, 2, 3, · · ·}.

Lawvere theories with arity. One contribution of the present paper is thusto improve the original notion of monad with arity, by relaxing a cocompletenesshypothesis on the underlying category A , and to deduce the Segal condition fromthe Linton condition by a nice and conceptual argument, based on the discoveryof a Beck-Chevalley property of the change-of-arity operations. This analysis leadsto an abstract notion of Lawvere theory for every category A and every arity i0.This level of generality is achieved by replacing the usual preservation-of-limit

8

Page 9: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

property by a preservation-of-representability property, inspired by the abstractdefinition of monad with arity. We then establish a clean correspondence theorem,which states that the category Law(A , i0) of Lawvere theories is equivalent to thecategory Mnd(A , i0) of monads with arity i0.

Enriched Lawvere A -theories. The notion of enriched Lawvere theory intro-duced by Power [20] ten years ago is extremely important, in particular because itenables to incorporate recursion and partiality into the study of monadic effects,see [6]. One must admit however that the notion of enriched Lawvere theory istechnically involved, and one initial motivation of the present work was preciselyto clarify its conceptual foundations, starting from a 2-categorical approach. It isonly recently, in the course of writing that paper, that we discovered with greatexcitement and surprise the notion of enriched Lawvere A -category introduced byNishizawa and Power [18]. The fascinating point is that Nishizawa and Power in-troduce in their work the very same conceptual ingredients as in the abstract Segalcondition formulated by Weber [23] at about the same time. This extraordinaryconvergence between two independent lines of research is another sign of the deepunity of the field, and of the relevance of the conceptual approach developed in thepresent paper.

Outline of the paper. After this long but necessary introduction, we recall thechange-of-base operations on presheaves in § 2 together with the notion of monadwith arity in § 3. We then establish the Segal condition in § 4, starting from Lintonconditon and the observation of a Beck-Chevalley property on the change-of-baseoperations. We introduce an abstract notion of Lawvere theory with arity, andestablish a correspondence theorem with monads with arity in § 5. We show in § 6that our abstract definition of Lawvere theory coincides with the familiar notion ofLawvere theory in two important case studies. Finally, we illustrate the concretebenefits of Lawvere’s ideas on the state monad in § 7 and conclude in § 8.

2 Categorical preliminaries

2.1 The three operations

One main contribution of the paper is to deduce the Segal condition from basicproperties of the change-of-base operations. These operations are so natural andelementary that we choose to describe them as early as possible in the article. Thereader unaware of this categorical yoga inherited from Grothendieck should have aglimpse at the section, keeping in mind that we will very soon establish the Segalcondition and deduce an abstract notion of Lawvere theory in this language. Justlike rings are particular kinds of categories (with one object, enriched over the cat-egory of abelian groups) modules over a ring are particular kinds of presheaves. So,the idea is to extend to presheaves the classical operations on modules associated

9

Page 10: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

to a change-of-ring. Typically, every functor

F : A −→ B

induces a functorF ∗ : B −→ A

defined by transporting every presheaf ψ to the presheaf F ∗(ψ) obtained by pre-composition:

A op F op

−→ Bop ψ−→ Set.

Whenever the category A is small (that is, when its objects define a set, ratherthan a class) the functor F ∗ has a left adjoint

∃F : A −→ B.

as well as a right adjoint∀F : A −→ B

defined by transporting every presheaf ϕ to its left and right kan extension alongthe functor:

F op : A op −→ Bop.

The logical notation for the adjoint functors is justified by the description of quan-tification in a topos: the functors ∀F and ∃F would be typically noted F∗ and F! inGrothendieck’s language [16, 15]. One beauty of these change-of-base operations isthat they may be computed explicitly in the category of sets, as particular colimitscalled coends:

∃F (ϕ) : b 7→∫ a∈A

B(F (a), b)× ϕ(a)

and as particular limits called ends:

∀F (ϕ) : b 7→∫a∈A

Set(B(b, F (a)), ϕ(a)).

2.2 Yoneda structures

In order to establish the Segal condition for a large class of situations, we willbe careful to prove it in the axiomatic setting provided by the notion of yonedastructure in a 2-category K. This will ensure in particular that all our results holdin the 2-category of categories enriched over a complete and cocomplete symmetricmonoidal closed category V . The notion of yoneda structure in a 2-category K wasintroduced by Street and Walters [22] and recently investigated by Weber [24] in hiswork on 2-topos theory. Suppose that Set is the category of sets in a given universe,and that CAT is a 2-category of categories in some larger universe which containsthe former universe as an element. This ensures that Set is an object of CAT . Anobject A of CAT is then called admissible when its homsets A (A,A′) are all in

10

Page 11: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Set . More generally, an arrow F : A −→ B in CAT is called admissible when thehomsets B(FA,B) are all in Set . The notion of yoneda structure generalizes thatsituation by taking a 2-category K instead of CAT , equipped with a right ideal of1-cells, called admissible arrows. Hence, the composite arrow

AF−→ B

G−→ C

is admissible when the arrow G is admissible. An object A is called admissiblewhen the identity arrow idA : A → A is admissible. In a yoneda structure, everyadmissible object A induces an admissible arrow

yA : A −→ A

and further, every admissible arrow F : A → B induces a diagram

A

χF

2:

AF

//

y

FF����������������B

B(F,1)

XX1111111111111111

These data are moreover required to satisfy four axioms.

Axiom 1. For A and F accessible, the 2-cell χF exhibits B(F, 1) as a left ex-tension of yA along F .

Axiom 2. For A and F accessible, the 2-cell χF exhibits F as an absolute leftlifting of yA through B(F, 1).

Axiom 3(i). For A accessible, the identity 2-cell

A

id

2:

A y//

y

FF A

id

XX1111111111111111

exhibits the identity arrow as a left extension of yA along yA .

11

Page 12: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Axiom 3(ii). For A ,B, F,G accessible, the 2-cell

A BF ∗oo

χB(1,F )

CK

χG

3;

AF

//

y

FF��������������B

G//

y

FF C

C (G,1)

XX11111111111111

exhibits the arrow F ∗ ◦ C (G, 1) as a left extension of the arrow yA along thearrow G◦F . Here, B(1, F ) denotes the admissible arrow yB ◦F , while F ∗ denotesthe arrow the left kan extension B(B(1, F ), 1) of the arrow yA along the compositearrow yB ◦ F .

By definition, an admissible object A is called small when the object A isadmissible. In the subsequent part of the article, we pretend that we work in the2-category K of categories, functors and natural transformations. An accessibleobject is thus called a locally small category, and a small object is called a smallcategory. On the other hand, all our technical arguments work in a general 2-category K equipped with a yoneda structure.

2.3 Fully faithful functors

We start by reformulating the notions of fully faithful and dense functor in thelanguage of the three operations. Recall that a functor F : A → B is fully faithfulwhen the associated function

A (A,A′) −→ B(FA,FA′)

is a bijection for all objects A,A′ of the category A .

Lemma 1 When the category A is small, the functor F is fully faithful if andonly if the unit

η

��

A

id

""

∃F ,,

A

BF ∗

GG (9)

of the adjunction ∃F a F ∗ is reversible.

2.4 Dense functors

A functorF : A −→ B

12

Page 13: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

from a small category A to a locally small category B is dense when the functor

B(F, 1) : B −→ A

is fully faithful. This means in turn that the canonical natural transformation

B

χB(F,1)

2:

BB(F,1)

//

y

FF A

bA (B(F,1),1)

XX1111111111111111

which exhibits the functor A (B(F, 1), 1) as a left kan extension of the yonedaembedding y along B(F, 1) is reversible. Now, it appears (see Proposition 13 of[22]) that the functor ∀F may be simply defined as

∀F = A (B(F, 1), 1).

Note moreover thatB(F, 1) = F ∗ ◦ y.

This establishes that the functor F is dense precisely when the canonical naturaltransformation

B

χB(F,1)

2:

B y//

y

DDB F ∗

// A

∀F

ZZ66666666666666666

(10)

Now, recall that in any yoneda structure, the identity natural transformation

B

id

4<

B y//

y

FF�����������B

id

XX22222222222

13

Page 14: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

exihibits the identity functor as left kan extension of the yoneda embedding alongitself. Hence, the natural transformation (10) factors uniquely as

B

η4<

By // B F ∗

//

id

FF�����������

A

∀F

XX22222222222

this defining the unit η of the adjunction F ∗ a ∀F . From this, we conclude that

Lemma 2 A functor F is dense if and only if the unit

η

��

By // B

id

""

F ∗ ,,

B

A∀F

GG

of the adjunction F ∗ a ∀F precomposed the yoneda embedding y is reversible.

This characterization may be expanded as follows: it means that the right kanextension along F of the restriction along F of a representable presheaf of B is therepresentable presheaf itself.

3 Monads with arity

We recall below the notion of monad with arity introduced by Weber [23]. Ourdefinition is slightly more liberal than the original one because we do not requirehere that the underlying category A is cocomplete.

Monads with arity. A monad with arity consists of a monad (T, µ, η) on acategory A together with a fully faithful and dense functor

i0 : Θ0 −→ A (11)

where Θ0 is a small category, and such that:

1. the natural transformation

A

id

4<

Θ0 i0//

T◦i0

EE�����������A

T

YY33333333333(12)

exhibits the functor T as a left kan extension of the functor T ◦ i0 along thefunctor i0,

14

Page 15: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

2. the kan extension (12) is preserved by the functor

A (i0, 1) : A −→ Θ0.

Let us briefly discuss these two arity conditions on the monad. The first conditionis somewhat expected: it captures very neatly the idea that the monad T is entirelydefined by the functor T ◦ i0. This formulation is somewhat folklore: for instance,Kelly [8] characterizes in the way the finitary functors in a properly enriched setting.

The second arity condition is less expected, and it is certainly one main con-ceptual novelty of Weber’s definition: it means that every colimit computed in Ain order to reconstruct the monad T from the functor T ◦ i0 should be seen as acolimit in Set by every arity n in the category Θ0. This is typically the case whenthe category Θ0 is the full subcategory of finitely presentable objects in a locallyfinitely presentable (lfp) category A , because all the colimits considered in A arefiltered, and A (i0, 1) preserves them. In that case, the two arity conditions on themonad T reduce to the first one, this probably explaining why the second aritycondition never appeared in the literature.

An alternative formulation. One should also mention that the two arity con-ditions reduce to the fact that the functor A (i0, 1) ◦ T equipped with the identitytransformation on the functor A (i0, 1) ◦ T ◦ i0 defines a left kan extension of thatfunctor along the functor i0. The reason is that the functor A (i0, 1) is fully faithful,and thus reflects left kan extensions. Hence, the arity conditions may be equiva-lently formulated by requiring that the canonical function∫ p∈Θ0

A (i0n, T i0p)×A (i0p,A) −→ A (i0n, TA)

is a bijection, for every object n of the category Θ0 and every object A of the cat-egory A . This should be understood as a unique decomposition property (modulozig-zag) which states that every morphism

i0n −→ TA

in the category A decomposes as

i0ne−→ Ti0p

Tf−→ TA

for a pair of morphisms e : i0n → Ti0p and f : i0p → A. And that, moreover,every two such factorizations are equivalent modulo the zig-zag relation ∼ definedas the transitive, symmetric and reflexive closure of the binary relation

(e1, f1) ; (e2, f2)

15

Page 16: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

which relates two factorizations (e1, f1) and (e2, f2) when there exists a morphismu : p→ q of the arity category Θ0 making the diagram

Ti0p

T i0u

��

Tf1

""EEEEEEEEE

i0n

e1<<yyyyyyyy

e2 ""EEEEEEEE TA

Ti0q

Tf2

<<yyyyyyyyy

commute in the category A .

The state monad. It is instructive to understand from that point of view whythe state monad T is finitary when the set of states S is finite. Recall that thefinitary monads on the category Set are precisely the monad with arity i0 describedin (7). Hence, the state monad T is finitary because (a) every function

h : S × [n] −→ S ×A

factors asS × [n] e−→ S × [p]

S×f−→ S ×A

where the function f : [p] → A is defined as an injective enumeration of the finiteimage of h, and moreover (b) this factorization is unique modulo zig-zag. The Segalcondition establishes then that the state monad may be presented by operations offinite arity and equations between them, as done in the Appendix when S = V L.On the other hand, the state monad is not finitary anymore when the set S iscountable: it defines in that case a countable monad with arity i0 defined as (8).This elementary example illustrates the flexibility of the notion of monad witharity.

4 A conceptual proof of Segal condition

Our alternative proof of Segal condition starts with the definition of categorieswith arity, together with a notion of morphism between them. As we will see, oneadvantage of our argument (besides its conceptual simplicity) is that it does notrequire the hypothesis that the category A is cocomplete.

Categories with arity. A category with arity (A , i0) is defined as a fully faithfuland dense functor

i0 : Θ0 −→ A

whose domain Θ0 is a small category. A morphism between categories with arity

(F, `) : (A , i0) −→ (B, i1)

16

Page 17: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

is defined as a pair of functors (F, `) making the diagram

Θ1i1 // B

Θ0i0 //

`

OO

A

F

OO

(13)

commute, and satisfying moreover the Beck-Chevalley condition which states thatthe natural transformation

Θ1

`∗

��

∀i1 // B

F ∗

����

Θ0 ∀i0

// A

(14)

defined as the mate (in a 2-categorical sense, see [10]) of the identity

Θ1

`∗

��

B

F ∗

��

i∗1oo

idgo

Θ0 Ai∗0

oo

is reversible. It is not difficult to deduce from the functorial properties of matenessthat these morphisms compose, and thus define a category of categories with arity.

Segal condition. The Segal condition follows then quite immediately from twobasic properties of these morphisms between categories with arity, together withLinton condition. The first property captures the very essence of Segal condition:

Proposition A. For every morphism (F, `) between categories with arity

(F, `) : (A , i0) −→ (B, i1)

the adjunction i∗1 a ∀i1 induces an adjunction between

• the full subcategory M of presheaves of B whose restriction along F is rep-resentable in A ,

• the full subcategory N of presheaves of Θ1 whose restriction along ` is rep-resentable along i0.

17

Page 18: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Moreover, this adjunction defines an equivalence between M and N when thefunctor F is essentially surjective.

Here, a presheaf of Θ0 is called representable along the functor i0 when itis isomorphic to the restriction along i0 of a representable presheaf in A . Note thatthis is equivalent to being isomorphic to a presheaf A (i0, A) for some object A.Recall that a functor F is essentially surjective when there exists for everyobject B an object A such that FA is isomorphic to B. The second propositionestablishes the existence a morphism between categories with arity in every monadwith arity:

Proposition B. Every monad T with arity i0 induces a commutative diagram

ΘTiT // AT

Θ0i0 //

`

OO

A

F

OO

(15)

where the pair (F, `) defines a morphism

(F, `) : (A , i0) −→ (AT , iT )

of categories with arity.

The interested reader will find in the Appendix the proofs of the two Proposi-tions A. and B. Segal condition follows quite immediately from the two properties,together with the Linton condition:

Theorem [Segal condition]. The canonical inclusion functor

H : ΘTiT // AT

// T -Alg

induces an equivalence

T -AlgT -Alg(H,1) // ΘT

between the category T -Alg and the full subcategory of presheaves of ΘT whoserestriction along ` is representable along i0.

5 Lawvere theories with arity

At this point, we introduce a notion of Lawvere theory with arity, whose purposeis to characterize the monads with the same arity.

18

Page 19: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Lawvere theories with arity. A Lawvere theory L on a category with arityi0 : Θ0 −→ A is defined as an identity-on-object functor

L : Θ0 −→ ΘL

such that (?) the endofunctor

Θ0

∃L // ΘLL∗ // Θ0

transports every presheaf representable along i0 to a presheaf representable along i0.

Proposition C. Every monad T with arity i0 induces a Lawvere theory LT :Θ0 −→ ΘT with the same arity i0.

Note that, in that case, the functor L∗ ◦ ∃L transports the presheaf A (i0A, 1)defined by an object A of the category A to a presheaf isomorphic to A (i0TA, 1),and thus representable along i0.

Models of the theory. A model of the Lawvere theory L with arity i0 is thendefined as a presheaf ϕ over ΘL whose restriction

Θop0

Lop// Θop

0

ϕ // Set

along L is representable along i0. The category Mod(L) is then defined as the fullsubcategory of presheaves of ΘL whose objects are the models of the theory L.There exists a forgetful functor

U : Mod(L) −→ A

defined as the unique functor (up to natural isomorphism) making the diagram

Mod(L)

��

U // A

y

��ΘL

L∗ // Θ0

∀i0 // A

commute, up to natural isomorphism. The preservation-of-representability prop-erty (?) required by our definition of Lawvere theory ensures that the functor Uhas a left adjoint Free making the diagram

AFree //

y

��

Mod(L)

��

Ai∗0 // Θ0

∃L // ΘL

19

Page 20: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

commute, up to natural isomorphism. This adjunction Free a U induces a monad Ton the category A with the expected properties:

Proposition D. The monad T has arity i0 and induces a Lawvere theory LT :Θ0 → ΘT which coincides with the theory L : Θ0 → ΘL.

Note that, strictly speaking, the two categories ΘT and ΘL are isomorphic, ratherthan equal.

Change-of-theory. A morphism L1 → L2 between Lawvere theories L1 and L2

with the same arity i0, is defined as an identity-on-object functor

θ : ΘL1 −→ ΘL2

making the diagram below commute:

ΘL1

θ // ΘL2

Θ0

L1

aaCCCCCCCCCC L2

=={{{{{{{{{{

This notion of morphism between Lawvere theories defines a category Law(A , i0)of Lawvere theories on the category with arity (A , i0) whose definition is justifiedby the correspondence theorem below.

Theorem. The category Law(A , i0) is equivalent to the category Mnd(A , i0) ofmonads with arity i0.

6 Illustrations

Finitary monads. It is very instructive to understand why the notion of Lawveretheory with finitary arity i0 defined in (7) coincides with the traditional notion ofLawvere theory in the category Set. The intrinsic reason is that Nat is the freecategory with finite sums generated by the object 1, together with the fact thatthe functor i0 preserves these finite sums. From this follows that a presheaf

ϕ : Natop −→ Set

is representable along i0 precisely when it preserves finite products. Moreover, thepreservation-of-representability property (?) ensures that the Lawvere theory Ldefines a monad T whose kleisli category SetT restricted to the objects of Natcoincides with the category ΘL. This establishes that the category ΘL has finitesums, because the kleisli category SetT induced by the monad T has finite sumsinherited from Set, and the objects of Nat are closed under finite sums. Conversely,every Lawvere theory in the traditional sense satisfies condition (?) because theleft kan extension of a finite product preserving functor ϕ along the finite product

20

Page 21: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

preserving functor Lop is also finite product preserving, see [12]. Finally, it is nearlyimmediate to establish that a morphism θ between abstract Lawvere theories withfinitary arity i0 is the same thing as an identity-on-object functor θop : Θop

L1→ Θop

L2

preserving finite products, just as it is in the traditional situation described byLawvere [12].

Enriched Lawvere A -theories. The proofs of the Segal condition and of thecorrespondence theorem are sufficiently conceptual to apply to the enriched settingin exactly the same 2-categorical way: what one essentially needs is a good notionof yoneda structure in the sense of Street and Walters [22, 24] on the 2-category ofenriched categories, enriched functors and enriched natural transformations. This istypically the case when the symmetric monoidal closed category V of enrichment iscomplete and cocomplete, in the situation prescribed by Kelly’s book [9]. The maindifficulty however is to define a good notion of arity i0 on the enriched category Aof interest. This is precisely where the most technical aspects of enriched Lawveretheories are necessary. Typically, Kelly [8, 9] and Power [20] require that thecategory V is locally finitely presentable (lfp) as a symmetric monoidal closedcategory... this ensuring that V is lfp as a category enriched over itself. In theirclever shift to the notion of enriched Lawvere A -theory, Nishizawa and Power [18]require that A is a lfp V -category. This enables to define the arity

i0 : Af −→ A

as the inclusion functor from any skeleton Af of the full sub-V -category of A givenby its finitely presentable objects. The functor i0 is fully faithful and dense in theenriched sense, this enabling to apply our abstract correspondence theorem betweenthe categories Law(A , i0) and Mnd(A , i0) of monads and theories with arity i0.The difficulty remains to characterize the abstract notion of Lawvere theory witharity i0. The task is far from immediate. This is precisely what Nishizawa andPower achieve however, by identifying Lawvere theories as the identity-on-objectfunctors from Af preserving finite V -limits. As noticed by Lack and Power [11]this characterization follows from an enriched version of the Gabriel-Ulmer duality,which says that a representable object along i0 is the same thing as a V -limit-preserving enriched functor from Af to V . This issue is fundamental, and requirescare and attention, so we prefer to leave it for now by lack of space, and providethe full details in the long version of the paper.

7 Presentation of the state monad revisited

We establish here that the algebraic presentation of objects with global store de-scribed in the Appendix provides a presentation by generators and relations of theLawvere theory T of the state monad. From this result follows immediately theresult established by Plotkin and Power [19] stating that the category of objectswith store is equivalent to the category of algebras of the state monad. Let S

21

Page 22: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

denote the category with finite products generated by the operations updateloc,valand lookuploc for loc ∈ L and val ∈ V .

Soundness. The interpretation of updateloc,val and lookuploc described in theintroduction satisfies the equations of a global store. This establishes the existenceof an identity-on-object and product-preserving functor I from S to T. Thereremains to establish that the functor I is full, and faithful.

The functor I is full. We want to show that every function is generated by aseries of lookups and updates. This is not particularly difficult. The idea is thatevery function f : S −→ S × n factors as

Sg−→ S × V L h−→ S × n

where1. the function g is the diagonal S → S × S obtained by applying a lookup foreach location loc ∈ L, one after the other,

2. the function h transports (state1, state2) into f(state2). The domain S × V L

should be understood as the sum of S taken S = V L times. This enables to definethe function h as a family of constant functions

hstate2 = f(state2) : S −→ S × n

indexed by state2 ∈ V L, each constant function implemented as a series of updateswriting the value state(loc) into each location loc ∈ L, followed by an injection tothe p-th component of S × n:

Sstate−→ S

inp−→ S × n

where f(state2) = (state, p).

The functor I is faithful. This is the difficult and interesting part of the proof.Suppose given two terms u and v of the algebraic theory of global stores u, v : n→ 1defining the same function

f : S −→ S × n (16)

in the category T. We want to show that the terms u and v are equal modulo theseven equations of the theory of global stores. The idea is to apply the first equation(annihilation) as many times as there are locations in L, in order to factorize theidentity morphism in S as a sequence g of lookups, one for each location loc ∈ L,followed by a sequence f of updates writing in each location what has been justread:

1 h−→ V L g−→ 1.

22

Page 23: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Since u = g ◦ h ◦ u and v = g ◦ h ◦ v, it is sufficient to establish that h ◦ u = h ◦ v inorder to conclude. Since the category S is cartesian, this amounts to the equality

πstate ◦ h ◦ u = πstate ◦ h ◦ v

for every projection πstate : V L → 1. Now, observe that the functor I transportsthe two maps πstate ◦h◦u and πstate ◦h◦v to the same constant function (16) in T.Observe moreover that hstate = πstate ◦ h : 1→ 1 is simply defined as a sequence ofupdates, one for each location, writing one after the other the value state(loc) ineach location loc ∈ L. The last part of the proof is easily established by removingone after the other all the lookups appearing in hs ◦ u and hs ◦ v, by permutingthem before updates thanks to equation 7. and removing them thanks to equation4. The point is that every lookup in hs ◦ u and hs ◦ v reads a location previouslyupdated in the term. Once every lookup removed hs ◦ u and hs ◦ v, there simplyremains to remove the unnecessary updates by applying equation 6. to permutethem and equation 3. to erase them. One obtains in this way a normal formfor hs ◦u and hs ◦ v consisting of a sequence of an update for each location loc ∈ L,these normal coinciding modulo permutation of the updates by equation 6. Thiscompletes the proof that the functor I is faithful.

8 Conclusion and future works

We establish in this paper a general correspondence theorem between a flexiblenotion of monad with arity defined by Weber [23], and an abstract notion of Law-vere theory with arity. The proofs are conceptual, and clarify the change-of-aritymechanisms which underlie the notion of Lawvere theory. This work is part of awider project of combining monadic effects with linear continuations, starting fromthe seminal work of Hyland, Levy, Plotkin and Power [5] and integrating ideasfrom game semantics. Much progress has been made in the past decade in theart of combining monads [6, 5] this leading to the discovery of subtle issues aboutarities in enriched categories [7]. The present work is motivated by the ambitionto establish an appropriate 2-categorical framework to carry on this fruitful line ofresearch. We also believe that a conceptual understanding of these basic questionswill contribute to the emergence of a semantic account of computational effects ly-ing outside the scope of monadic effects, more specifically delimited continuations.

Acknowlegments. I am grateful to Dimitri Ara, Clemens Berger, Martin Hy-land, George Maltsiniotis and Mark Weber for pleasant and inspiring discussions.

References

[1] J. Adamek and J. Rosicky. Locally presentable and accessible categories, vol-ume 189 of London Mathematical Society Lecture Notes. Cambridge UniversityPress, 1994.

23

Page 24: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

[2] N. Benton, J. Hughes, and E. Moggi. Monads and effects. In APPSEMSummer School, volume 2395 of Lecture Notes In Computer Science, pages24–122. Springer, 2000.

[3] C. Berger. A cellular nerve for higher categories. Advances in Mathematics,169:118–175, 2002.

[4] M. Gabbay and A. M. Pitts. A new approach to abstract syntax involvingbinders. In Proc. LICS 99, pages 214–224. IEEE Press, 1992.

[5] J. M. E Hyland, P. B. Levy, G. Plotkin, and A. J. Power. Combining algebraiceffects with continuations. Theoretical Computer Science, 375, 2007.

[6] J. M. E. Hyland, G. Plotkin, and A. J. Power. Combining effects: sum andtensor. Theoretical Computer Science, 357(1):70–99, 2006.

[7] J. M. E. Hyland and A. J. Power. Discrete lawvere theories and computationaleffects. Theoretical Computer Science, 366:144–162, 2006.

[8] G. M. Kelly. Structures defined by finite limits in the enriched context 1.Cahiers de Topologie et Geometrie Differentielle, 3:3–42, 1980.

[9] Max Kelly. Basic Concepts of Enriched Category Theory, volume 64 of LectureNotes in Mathematics. Cambridge University Press, 1982.

[10] Max Kelly and Ross Street. Review of the elements of 2-categories. LectureNotes in Mathematics, 420:75–103, 1974.

[11] S. Lack and A. J. Power. Gabriel-ulmer duality and lawvere theories enrichedover a general base. Journal of Functional Programming, 2009.

[12] F. W. Lawvere. Functorial Semantics of Algebraic Theories and Some Alge-braic Problems in the context of Functorial Semantics of Algebraic Theories.PhD thesis, Columbia University, 1963.

[13] T. Leinster. Nerves of algebras. Available athttp://www.maths.gla.ac.uk/∼tl/vancouver.

[14] F Linton. Relative functorial semantics: adjointness results. 99, 1969.

[15] Georges Maltsiniotis. Structures d’asphericite, foncteurs lisses, et fibrations.Ann. Math. Blaise Pascal, 12:1–39, 2005.

[16] Georges Maltsinotis. La theorie de l’homotopie de Grothendieck, volume 301of Asterisque. SMF, 2005.

[17] Eugenio Moggi. Notions of computation and monads. Information And Com-putation, 93(1), 1991.

24

Page 25: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

[18] K. Nishizawa and A. J. Power. Lawvere theories enriched over a general base.Journal of Pure and Applied Algebra, 213:377–386, 2009.

[19] G. D. Plotkin and A. J. Power. Notions of computation determine monads.In Proc. FOSSACS 2002, volume 2303 of Lecture Notes in Computer Science.Springer Verlag, 2002.

[20] J. Power. Enriched lawvere theories. Theory and Applications of Categories,6(7):83–93, 1999.

[21] Graeme Segal. Classifying spaces and spectral sequences. Inst. Hautes EtudesSci. Publ. Math., 34:105–112, 1968.

[22] R. Street and R. F. C. Walters. Yoneda structures on 2-categories. Journal ofAlgebra, 50:350–379, 1978.

[23] Mark Weber. Familial 2-functors and parametric right adjoints. Theory andApplications of Categories, 18:665–732, 2007.

[24] Mark Weber. Yoneda structures from 2-toposes. Applied Categorical Struc-tures, 15:259–323, 2007.

25

Page 26: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Appendix I : an algebraic theory of global stores

We reformulate as a properly algebraic theory the presentation of the state monadrecently formulated by Plotkin and Power [19]. Each of our equations 1− 7 is thedirect transcription of an equation in their original presentation. The commutativediagrams look much simpler however, because the manipulation of locations (du-plication, etc.) is done externally, rather than internally. They also reflect moredirectly the equational formulation of the theory described in [19].

1. annihilation lookup - update: reading the value of a location loc and thenupdating the location loc with the obtained value is just like doing nothing. Thisproperty is captured by asking that the diagram below commutes:

AV

lookuploc

AAAAAAAAAAAAA

A

updateloc,V

>>}}}}}}}}}}}}} id // A

Here, the morphism updateloc,V : A −→ AV is defined as the unique morphismmaking the diagram below commute

AV

Aval

AAAAAAAAAAAAA

A

updateloc,V

>>}}}}}}}}}}}}} updateloc,val // A

for every value val ∈ V , where Aval : AV −→ A is the val-th projection of AV

over A. This property may be also written in an equational way:

lookuploc (val 7→ updateloc,val(x)) = x

2. interaction lookup - lookup: reading twice the same location loc is thesame as reading it once. This is captured by asking that the diagram

AV×VlookupV

loc //

Adiag

��

AV

lookuploc

��AV lookuploc

// A

commutes, or equivalently, by the equation:

26

Page 27: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

lookuploc (val′ 7→ lookuploc (val 7→ t[val, val′]))=

lookuploc (v 7→ t[val, val])

3. interaction update - update: storing a value val and then a value val′

at the same location loc is just like storing the value val′ in the location. Thisproperty is captured by asking that the diagram

A

updateloc,val

��?????????????

A

updateloc,val′

??������������� updateloc,val′ // A

commutes, or equivalently, by the equation:

updateloc,val (updateloc,val′ (x))=

updateloc,val′(x)

4. interaction update - lookup: when one stores a value val in a location locand then reads the location loc, one gets the value val. This is captured by askingthat the diagram

AVlookuploc //

Aval

��

A

updateloc,val

��A

updateloc,val

// A

commutes, or equivalently, by the equation:

updateloc,val (lookuploc (val′ 7→ t[val′]))=

updateloc,val (t[val])

5. commutation lookup - lookup: the order of reading two different loca-tions loc and loc′ does not matter. This is captured by asking that the diagram

AV×VAswap

//

lookuploc

����������AV×V

lookuploc′

��<<<<<<<<

AV

lookupVloc′ &&MMMMMMMMMMMMM AV

lookupVlocxxqqqqqqqqqqqqq

A

27

Page 28: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

commutes, or equivalently, by the equation:

lookuploc (v 7→ lookuploc′ (v′ 7→ t[v, v′]))=

lookuploc′ (v′ 7→ lookuploc (v 7→ t[v, v′]))

when loc 6= loc′

6. commutation update - update: the order of storing in two different loca-tions loc and loc′ does not matter. This is captured by asking that the diagram

Aupdateloc,val //

updateloc′,val′

��

A

updateloc′,val′

��A

updateloc,val

// A

commutes, or equivalently, by the equation:

updateloc,val updateloc′,val′ x=

updateloc′,val′ updateloc,val x

when loc 6= loc′

7. commutation update - lookup: the order of storing in a location loc andreading in a location loc′ does not matter. This is captured by asking that thediagram

AVlookuploc′ //

updateVloc,val

��

A

updateloc,val

��AV lookuploc′

// A

commutes, or equivalently, by the equation below:

updateloc,val lookuploc′ (val′ 7→ t[val′])=

lookuploc′ (val′ 7→ updateloc,val t[val′])

when loc 6= loc′

28

Page 29: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Appendix II : Proofs of Proposition A and B.

The proofs of the two propositions are not particularly difficult conceptually: theyare essentially based on a clear understanding of the meaning and properties ofthe three change-of-base operations on presheaves described in Section ??. Size isa real torment however: because the category A is not supposed to be small, wecannot make the simplifying hypothesis that the functor

F ∗ : AT −→ A

associated to the functor F to the kleisli category

F : A −→ AT

has a left adjoint∃F : A −→ AT .

In fact, we only know that F ∗ has a right adjoint

∀F : A −→ AT

defined as the inverse image functor

U∗ : A −→ AT

associated to the functor U right adjoint to F . This lack of a left adjoint ∃F makesthe proof much more complicated than it should be, or becomes when the leftadjoint ∃F happens to exist. There is a way to circumvent the difficulty however,provided by the notion of yoneda structure introduced by Street and Walters [22]and recently investigated by Weber [24]. We describe below the general proof, andlet the astute reader reconstruct the simpler argument in the situation when thefunctor F ∗ happens to have a left adjoint ∃F .

Proof of Proposition A.

Step 1. Suppose given a morphism

(F, `) : (A , i0) −→ (B, i1)

between categories with arity, defining the commutative diagram

Θ1i1 // B

Θ0i0 //

`

OO

A

F

OO

29

Page 30: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

This induces a commutative diagram

Θ1

`∗

��

B

F ∗

��

i∗1oo

idgo

Θ0 Ai∗0

oo

From this follows that the functor i∗1 transports every presheaf ψ of B whoserestriction along F is representable by an object A, to a presheaf i∗1ψ of Θ1 whoserestriction along ` is representable by the object i0A.

By definition, a morphism between categories with arity satisfies moreover aBeck-Chevalley property, stating that the induced natural transformation

Θ1

`∗

��

∀i1 // B

F ∗

����

Θ0 ∀i0

// A

is reversible. From this follows that the functor ∀i1 transports every presheaf ϕ ofΘ1 whose restriction along ` is representable by an object i0A, to a presheaf ∀i1ϕ ofB whose restriction along F is isomorphic to the presheaf ∀i0 ◦ i0 ◦ y(A). We thenapply the result of the previous step, which states that the presheaf ∀i0 ◦ i0 ◦ y(A)is isomorphic to the presheaf y(A), and conclude that the functor ∀i1 transportsevery presheaf ϕ of Θ1 whose restriction along ` is representable by an object i0A,to a presheaf ∀i1ϕ of B whose restriction along F is representable by A.

This establishes that the adjunction i∗1 a ∀i1 between the presheaf categoriesof A and Θ1 restricts to an adjunction between the full subcategory M of presheavesof B whose restriction along F is representable, and the full subcategory N ofpresheaves of Θ1 whose restriction along ` is representable along i0.

Observe moreover that the functor i1 is fully faithful. The fact that i1 is fullyfaithful may be equivalently formulated by saying that the counit

B i∗1

��ε

��Θ1

id

>>

∀i122

Θ1

of the adjunction i∗1 a ∀i1 is reversible. This is equivalent to asking that thefunctor ∀i1 is fully faithful, this establishing that the category N is a reflectivesubcategory of the category M .

30

Page 31: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Step 2. Suppose that the functor F is essentially surjective, this meaning thatfor every object B of the category B, there exists an object A of the category Asuch that FA is isomorphic to B. One way to establish that the adjunction i∗0 a ∀i0defines an equivalence between the two categories M and N , is to show that thenatural transformation

η

��

M // B

id

""

i∗1 ,,

B

Θ1∀i1

FF (17)

is reversible. Now the functor F ∗ is faithful because F is essentially surjective.Hence, in order to establish that (17) is reversible, it is sufficient to establish thatthe natural transformation

η

��

M // B

id

""

i∗1 ,,

BF ∗ // A

Θ1∀i1

GG

is reversible. The natural transformation may be decomposed in the following way:

η

��

A

id

""

i∗0

,,

A

Θ1

∀i0

FF

'M // B

F ∗

OO

i∗0 ,,

B

F ∗

OO

Θ0

`∗

OO

∀i0

FF

a diagram which may be completed as

η

��

Ay //

'

A

id

""

i∗0

,,

A

Θ1

∀i0

FF

'M //

G

OO

B

F ∗

OO

i∗0 ,,

B

F ∗

OO

Θ0

`∗

OO

∀i0

FF

31

Page 32: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

where the functor G is deduced from the definition of M as the category ofpresheaves ψ whose restriction along F is representable by an object defining Gψof the category A . The first step of the proof has established that this naturaltransformation is reversible, because the functor i0 is dense. This concludes theproof of Proposition A.

Proof of Proposition B.

Step 1. Every monad with arity (T, i0) induces a commutative diagram

ΘTiT // AT

Θ0i0 //

`

OO

A

F

OO

where the category ΘT is characterized by the fact that ` is an identity-on-objectfunctor and iT is a fully faithful functor. We will show at the last stage of the proof(step 4.) that the identity natural transformation

AT

id

3;

Θ0 i0//

F◦i0

DDA

F

YY44444444444

exhibits the functor F as a left kan extension of the functor F ◦ i0 along the func-tor i0. To that purpose, we establish below that the identity natural transformation

ΘT

AT

i∗T

OO

AT

y

OO

id

3;

Θ0 i0//

F◦i0

DDA

F

ZZ4444444444

(18)

exhibits the functorAT (iT , 1) ◦ F = i∗T ◦ y ◦ F

32

Page 33: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

as a left kan extension of the functor AT (iT , 1) ◦ F ◦ i0 along the functor i0. Theproof of that fact is not particularly difficult, but it is pretty long if one wants toproceed carefully. On the other hand, we will see that the proof is nearly finishedwhen the property is established.

Now, one basic property of a yoneda structure is that the natural transforma-tion χi0

Θ0

χi0

3;

Θ0 i0//

y

EE�����������A

A (i0,1)

YY33333333333

defines the functor A (i0, 1) as a left kan extension of the yoneda embedding y alongthe functor i0. The domain Θ0 of the functor F ◦ i0 is small, this ensuring thatthe induced functor (F ◦ i0)∗ has a left adjoint functor ∃(F◦i0). Since left adjointfunctors preserve kan extensions, the natural transformation

AT

Θ0

∃(F◦i0)

OO

χi0

3;

Θ0 i0//

y

EEA

A (i0,1)

YY33333333333

exhibits the functor ∃(F◦i0)◦A (i0, 1) as a left kan extension of the functor ∃(F◦i0)◦yalong the functor i0. Now, the functor ∃(F◦i0) itself is defined in a yoneda structureas a particular left kan extension: namely, there exists a natural transformation α

ATy // AT

α-5

A

F

OO

Θ0 y//

i0

OO

Θ0

∃(F◦i0)

OO

which exhibits the functor ∃(F◦i0) as a left kan extension of the functor y ◦ F ◦ i0along the functor i0. Moreover, the transformation α is reversible because theyoneda embedding y on the category Θ0 is fully faithful. Composing χi0 together

33

Page 34: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

with α, one obtains a natural transformation χ

AT

χ3;

Θ0 i0//

y◦F◦i0

EEA

∃(F◦i0)◦A (i0,1)

YY33333333333

which exhibits the functor∃(F◦i0) ◦A (i0, 1)

as a left kan extension of the functor y◦F ◦i0 along the functor i0. The universalityproperty of the left kan extension implies the existence of a natural transformation

β : ∃(F◦i0) ◦A (i0, 1) ⇒ y ◦ F

such that β composed with χ is equal to the identity natural transformation on thefunctor y ◦ F ◦ i0.

We want to show that the natural transformation β composed with i∗T is re-versible, and thus that the natural transformation (18) exhibits the functor i∗T ◦y◦Fas a left kan extension. Because the left adjoint functors (iT ◦ `)∗ preserve kan ex-tensions, the natural transformation

Θ0

AT

(iT ◦`)∗OO

χ3;

Θ0 i0//

y◦F◦i0

EEA

∃(F◦i0)◦A (i0,1)

YY33333333333

exhibits the functor(iT ◦ `)∗ ◦ ∃(F◦i0) ◦A (i0, 1)

as a left kan extension along the functor i0. Now, observe that the identity natural

34

Page 35: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

transformationΘ0

ΘT

`∗OO

AT

i∗T

OO

AT

y

OO

id

4<

Θ0 i0//

F◦i0

DD��������A

F

ZZ55555555

is nothing but the left kan extension appearing in the definition of the monad witharity (T, i0). Observe indeed that the functor

ATy // AT

i∗T // ΘT`∗ // Θ0

coincides with

ATy // AT

F ∗ // Ai∗0 // Θ0

and thus with

ATU // A

y // Ai∗0 // Θ0

where U is the “forgetful functor” which transports every object A of the kleislicategory AT to the object TA of the category A .

This establishes that the natural transformation β composed with the functor i∗Tfollowed by the functor `∗ is reversible. Now, the functor `∗ reflects isomorphismsbecause the functor ` is one-to-one on objects. We conclude that the naturaltransformation i∗T ◦ β

i∗T ◦ ∃(F◦i0) ◦A (i0, 1) ⇒ AT (iT , 1) ◦ F (19)

is reversible, this establishing that our previous diagram (18) exhibits the functorAT (iT , 1) ◦ F as a left kan extension along the functor i0.

Step 2. The equalityiT ◦ ` = F ◦ i0

induces an isomorphism∃iT ◦ ∃` = ∃F ◦ ∃i0 .

which may be then composed with (19). This induces a natural isomorphism

i∗T ◦ ∃iT ◦ ∃` ◦A (i0, 1) ⇒ AT (iT , 1) ◦ F.

35

Page 36: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Another way to express that the functor iT is fully faithful is to say that the unit

η

��

ΘT

id

##

∃iT ++

ΘT

ATi∗T

FF (20)

of the adjunction ∃iT a i∗T is reversible. Composing the two natural transformationsinduces a reversible natural transformation

∃` ◦A (i0, 1) ⇒ AT (iT , 1) ◦ F

Step 3. We have just established that the diagram

ATAT (iT ,1) // ΘT

AA (i0,1) //

F

OO

Θ0

∃`

OO

commutes up to a natural isomorphism. From this we deduce a natural isomor-phism

ΘT (∃` ◦A (i0, 1), 1) ∼= ΘT (AT (iT , 1) ◦ F, 1)

Now, the two diagrams

ΘT

dΘT (∃`◦A (i0,1),1) //

`∗

��@@@@@@@@@@@ A

Θ0

cΘ0(A (i0,1),1)

??�����������

ΘT

dΘT (AT (iT ,1)◦F,1) //

dΘT (AT (iT ,1),1) @@@@@@@@@@@ A

AT

F ∗

??�����������

commute up to isomorphism. We then apply the two equalities

∀i0 = Θ0(A (i0, 1), 1)∀iT = ΘT (AT (iT , 1), 1)

36

Page 37: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

to deduce a natural isomorphism

ΘT

`∗

��

∀iT // AT

F ∗

����

Θ0 ∀i0

// A

(21)

A careful check establishes then that the natural transformation (21) just con-structed coincides with the mate of the identity natural transformation

ΘT

`∗

��

AT

F ∗

��

i∗Too

idgo

Θ0 Ai∗0

oo

This establishes the Beck-Chevalley condition required by the definition of mor-phism between categories with arity.

Step 4. At this stage, there only remains to show that iT is dense in order toestablish the proposition. One follows essentially the same argument as in theproof of Proposition A in order to establish that fact. The main point to observeis that the restriction along F of a presheaf representable by an object A of thecategory AT is representable by the object TA of the category A . This concludesthe proof of Proposition B. Let us add one more fact however: density of iT meansthat the functor

AT (iT , 1) : AT −→ ΘT

is fully faithful. This implies our initial claim that the identity natural transfor-mation

AT

id

3;

Θ0 i0//

F◦i0

DDA

F

YY44444444444

exhibits the functor F as a left kan extension of the functor F ◦ i0 along thefunctor i0.

37

Page 38: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

Appendix III : Proofs of Proposition C and D.

Proof of Proposition C. We establish here that every monad T with arity i0induces a Lawvere theory ` : Θ0 → ΘT with the same arity i0.

Θ0

∃` //

(a)

ΘT`∗ // Θ0

A

i∗0

OO

AT

i∗T

OO

F ∗ //

(b)

A

i∗0

OO

A

y

OO

F// AT

y

OO

U// A

y

OO

Note that the existence of a reversible natural transformation (a) has beenestablished above, while the reversible transformation (b) is deduced from the ad-junction F a U . Note in particular that the diagram establishes the existence of areversible natural transformation

Θ0

∃` //

'

ΘT`∗ // Θ0

A

A (i0,1)

OO

T// A

A (i0,1)

OO

Proof of Proposition D. We establish below that every Lawvere theory

L : Θ0 −→ ΘL

with arity i0 induces a monad T with the same arity i0. The main difficulty is toestablish that the monad T induced by the adjunction Free a U has arity i0. Bydefinition, there exists a monad morphism

AT //

y

��'

A

y

��

Ai∗0 // Θ0

∃L // ΘLL∗ // Θ0

∀i0 // A

38

Page 39: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

By definition, the functor i0 is fully faithful. From this follows that the diagram

AT //

y

��'

A

y

��

A

i∗0

��

A

i∗0

��

Θ0

∃L // ΘLL∗ // Θ0

commutes up to reversible natural transformation. The functors L∗ and ∃L are leftadjoint functors. Hence, in order to establish that the identity natural transforma-tion

Θ0

ΘL

L∗OO

Θ0

∃L

OO

A

A (i0,1)

OO

id

4<

Θ0 i0//

i0

DD��������A

id

ZZ55555555

exhibits the functor L∗ ◦∃L ◦A (i0, 1) as a left kan extension of L∗ ◦∃L ◦A (i0, 1)◦ i0along the functor i0, it is sufficient to establish that the identity natural transfor-mation

Θ0

A

A (i0,1)

OO

id

4<

Θ0 i0//

i0

DD��������A

id

ZZ55555555

exhibits the functor A (i0, 1) as left kan extension of the functor i0 ◦A (i0, 1) alongthe functor i0. This follows from the fact that i0 is fully faithful, this implying thatthe canonical natural transformation

Θ0

χi0

4<

Θ0 i0//

y

DDA

A (i0,1)

YY44444444

39

Page 40: Segal condition meets computational e ectsmellies/papers/segal-journal.pdf · computational interest, like enriched categories, or algebraic structures admit-ting operations of in

is reversible. The fact that the previous diagram describes a left kan extensionfollows quite immediately. This establishes that the functor T induced by theLawvere arity L has the same arity i0.

There remains to show that the Lawvere theory induced by the monad T co-incides with L. We will show that ΘL is the full subcategory of Mod(L) given bythe objects of Θ0. First of all,

Θ0i0 // A

Free //

y

��

Mod(L)

��

Ai∗0 // Θ0

∃L // ΘL

We have already shown that i∗0 ◦ y ◦ i0 is isomorphic to y because the functor i0 isfully faithful. This implies that the functor above is equal to y ◦ L.

ΘL

ΘL

y

DDMod(L)

]]<<<<<<<<<<

Θ0i0 //

L

OO

A

Free

OO

commutes up to natural isomorphism. From this, we conclude that there exists afully faithful functor ΘL →Mod(L) such that

ΘL //Mod(L)

Θ0i0 //

L

OO

A

Free

OO

commutes strictly. This completes the proof of Proposition D.

40