Doctrines, modalities and comonads

Doctrines are categorical structures very apt to study logics of different nature within a unified environment: the 2-category Dtn of doctrines. Modal interior operators are characterised as particular adjoints in the 2-category Dtn. We show that they can be constructed from comonads in Dtn as well as from adjunctions in it, and the two constructions compare. Finally we show the amount of information lost in the passage from a comonad, or from an adjunction, to the modal interior operator. The basis for the present work is provided by some seminal work of John Power.


Introduction
The approach to logic proposed by F.W. Lawvere via hyperdoctrines has proved very fruitful as it provides an extremely suitable environment where to analyse both syntacic aspects of logic and semantic aspects as well as compare one with the other, see [19,20]. The suggestion is to see a logic as a functor P : C op → Pos from the opposite of a category to the category of posets and monotone functions where the category C collects the "types" of the logic and terms in context, a poset P (c) presents the "properties" of the type c with the order relation describing their "entailments". The reader is referred to Section 2 for the precise details, but may just keep in mind, for the present discussion, that the contravariant powerset functor P: Set op → Pos is an instance of a doctrine.
One of the main points of Lawvere's structural approach to logic is that all the logical operators are obtained from adjunctions. That view in itself is very powerful and contributes to unifying many different aspects in logic. In the present paper, we show that also a wide class of modal operators, namely, those satisfying axioms T and 4 as in Definition 2.1, is obtained from adjunctions.
Typically, modalities are unary logical operators, which are quite wellunderstood in the context of propositional logic. However, their meaning is less clear in a typed logical formalism. In this setting, there are various semantics which are interrelated, and we show that many of these are instances of the general situation of an adjunction between two homomorphisms of doctrines.
Since they are structured categories, doctrines get swiftly organised in a 2-category. And, as we learned also from the works of John Power, in a 2category one can develop a very productive theory of monads and comonads, extending the elementary case of the 2-category Cat of small categories, functors and natural transfomations.
Doctrines are a rather simple categorical framework for logic, but still capable to cover a large range of examples. We could have considered more general settings such as indexed preorders (equivalently, faithful fibrations) or even arbitrary fibrations, but we preferred to keep things at a very simple level as already there one finds many interesting examples. Yet, after this first step our plan is to extend results to general fibrations in future work.
We show that an adjunction in the 2-category of doctrines gives rise to a doctrine with a modal operator. An adjunction between doctrines is very much like an adjunction between categories: roughly, it consists of two doctrines P : C op → Pos and Q : D op → Pos and two homomorphisms of doctrines connecting them, which should be thought of as an interpretation of P in Q (the left adjoint) and an interpretation of Q in P (the right adjoint). Such a situation can be summarised by a modal logic which uses the logic Q to describe properties of types in C (the base category of P ) and the modal operator to recover (an image of) properties described by P . In a sense, we extend the logic P through the adjunction to a richer logic and use a modal operator to keep memory of the original logic. As we said, many standard approaches to the semantics of modal logic are instances of such construction.
Taking a slightly different perspective, we show that also a comonad in the 2-category of doctrines determines a doctrine with a modal operator, this time on the category of coalgebras for the comonad. Intuitively, we get a logic where types have a dynamics, given by the coalgebra structure, and the modal operator specifies when a property is invariant for such dynamics.
These two constructions are tightly related. Relying on results in [8], we show that every comonad in the 2-category of doctrines determines an adjunction, hence, also a modal operator. In fact, the construction starting from comonads is defined in this way. On the other hand, every adjunction determins a comonad, hence a modal operator. However, the two construction starting from an adjunction do not coincide, but we show they can be canonically compared by a homomorphism of doctrines preserving the modal operator.
We further our analysis measuring in a categorical form how the passage to a modal operator hides part of the structure that generated it.
In Section 2 we introduce interior operators on doctrines, which are the class of modal operators we are interested in. In Section 3 we recall basic notions about comonads and adjunctions in a general 2-category. In Section 4 we define the 2-categories of doctrines and doctrines with interior operators that are at the core of our analysis. In Section 5 we show how to construct an interior operator starting from an adjunction between doctrines, while in Section 6 we describe the analogous construction starting from a comonad on a doctrine. Finally, in Section 7 we compare the two constructions showing they are part of local adjunctions, in the sense of [7], between the 2-category of doctrines with modal operator and, respectively, the 2-category of adjunctions and that of comonads in the 2-category of doctrines. In Appendix A we sketch an example on how to use our construction to obtain models of the bang modality of linear logic.

Interior operators and doctrines
A simple semantic approach to propositional standard modal logic (satisfying axioms T and 4) would consider an interior operator on a poset (H, ≤), i.e. a monotone function j: H → H such that, for all x ∈ H, j(x) ≤ x and j(x) ≤ j(j(x)), see e.g. [12]. The intuition is that the elements of the poset are an interpretation of (some kind of) formulas, the order relation realizes the entailment between them, and the interior operator j: H → H acts as a modality on formulas.
From a similar semantic point of view, one could consider a many-sorted logic to be a doctrine P : C op → Pos, i.e. a (contra)variant functor from a category C to the category Pos of posets and monotone functions. Such a functor is often called an indexed poset in consonancy with the more general notion of indexed category. The intuition for a doctrine is that the objects of the category provide the interpretations of the sorts in the logic and the arrows interpret terms between sorts. For an object X in C , the poset P X gives the interpretations for the formulas expressing the properties of "arbitrary elements" of X-although no set-theoretic determination of X may have been provided, see [19,20], but also [17,22].
Conjoining these two semantic approaches it is quite natural to consider interior operators on a doctrine as an extension to many-sorted logic, of the propositional modal logic satisfying axioms T and 4, like the -modality, a.k.a. necessity modality, of S4 modal logic.
Definition 2.1. Let P : C op → Pos be a doctrine. An interior modal operator on P is a natural transformation : P . → P such that, for each object X in C , the following inequalities hold: Note that standard axioms of the S4 modal operator, see e.g. [4], require further structure. But here we consider the very simple structure of a poset on the fibres because we want to focus mainly on the comonadic structure of the modality.
In the following, an element α ∈ P X of the form α = X β for some β ∈ P X will be called -stable. An immediate consequence of Definition 2.1, obtained combining the two requirements on , is that X = X • X . Hence -stable elements are the fixed points of X , that is, those elements α ∈ P X such that X α = α. Example 2.3. Consider the category Opn of topological spaces and open continuous maps. Define P : Opn op → Pos as P (X, τ ) = P(X), the powerset of the set X, and P t = t −1 , the inverse image along the open continuous function t: (X, τ ) → (Y, σ) Let (X, τ ) be a topological space, then τ is the set of fixed points of the interior operator int τ : P(X) → P(X), which maps a subset A ⊆ X to its topological interior. Since int τ (A) ⊆ A and int τ (A) ⊆ int τ (int τ (A)), for each A ⊆ X, to get an an interior operator on P we need to prove that int τ is natural. Indeed, consider an open continuous map t: where W is the set of possible worlds and R ⊆ W × W is the accesibility relation. On the poset P(W ) ordered by set inclusion, consider the monotone function j R : P(W ) → P(W ) defined as When R is reflexive and transitive (i.e. a preorder on W ), for any w ∈ W , we have w ∈ R(w) = R(R(w)). Hence j R is an interior operator.
→ P(W ) (-) endows the doctrine P(W ) (-) : Set op → Pos with an an interior operator. Intuitively, given a "formula" α ∈ P(W ) D , for an element x of D, the set α(x) ⊆ W consists of those worlds where x satisfies α. Indeed, one can see the data consisting of the Kripke frame K and the set D as a constant domain skeleton as in Definition 1 in [9], where the fibres P(W ) D n enlist all possible interpretations for predicates as n varies.
(b) Another doctrine with an interior operator built from a Kripke frame K with a reflexive and transitive accessibility relation can be obtained via W -indexed families. Consider the category W -Fam whose objects are W -indexed families of sets, that is, pairs X = (X, (X w ) w∈W ), where X w ⊆ X, for all w ∈ W , and where Consider the subobject functor Sub W -Fam : W -Fam op → Pos mapping a W -indexed family to the poset Sub W -Fam (X) of its subfamilies, i.e. a family A such that A ⊆ X and A w ⊆ X w for each w ∈ W , ordered by pointwise inclusion. The action on arrows is defined pointwise by inverse image. For each W -indexed family X the function X : A v is clearly monotone; and it satisfies conditions (i) and (ii) in Definition 2.1 for the same reason as in the previous example. Moreover, it is natural in X since, for each function t: Y → X, we have for any w ∈ W . Though surprising, we shall see in Example 4.2 that this example is a universal completion of the previous one in (a).
Intuitively, given a W -indexed family D, for each w ∈ W , the subset D w consists of those elements of D which are present at the world w, and, given a "formula" α ∈ Sub W -Fam (D), for each world w ∈ W , the set α w consist of those elements x which are present and satisfy α at w. Indeed, one can see the data consisting of the Kripke frame K and the w-indexed family D as a varying domain skeleton as in Definition 7 in [9], with few additional requirements, where the fibres Sub W -Fam (D n ) enlist all possible interpretations for predicates as n varies.
(c) Yet another possibility is to consider a doctrine over the category of presheaves on the preorder K; we shall discuss this in Example 5.12, as a particular case of a more general construction.

Adjunctions and comonads in a 2-category
In this section we recall basic notions which can be introduced in an arbitrary 2-category with the purpose to use them in the particular case of the 2category of doctrines.
Given a (strict) 2-category K , we denote 0-cells as A, B, C, . . ., which we shall refer to also as objects of K ; a 1-cell, also referred to as 1-arrow, from A to B will be written as a: A → B while a 2-cell, or 2-arrow, from the 1-cell a to the 1-cell b will be written as α: a ⇒ b. Composition of 1-cells and horizontal composition of 2-cells is denoted as •, and often omitted-we shall use it mainly to emphasise the composition of functions and functors. The identity 1-cell on the object A is denoted by e A and the identity 2-cell on the 1-cell a is denoted by 1 a . A horizontal composition with a 2-identity cell 1 a will be written simply as αa. Vertical composition of 2-cells is denoted as ·. So, for instance, the defining property of vertical composition of natural transformations would be written as something like (ψ · φ) C = ψ C • φ C .
Many well-known concepts from standard category theory can be transferred to an arbitrary 2-category K ; a basic reference is [29].
Definition 3.1. Let K be a 2-category.
(i) An adjunction A in K consists of the following data: two objects C and D, two 1-arrows l: C → D and r: D → C, and two 2-arrows η: e C ⇒ rl and ǫ: lr ⇒ e D , such that the following triangles of 2-arrows commute (1) (ii) A comonad c in K consists of an object A, a 1-arrow c: A → A, and two 2-arrows ν: c ⇒ e A and µ: c ⇒ cc, such that the following diagrams of 2-arrows commute (iii) In line with [29,26], one says that K admits the Eilenberg-Moore construction for the comonad (A, c, µ, ν) if there is a universal representation of the following 2-problem: given an object B in K , objects and such that the diagrams of 2-arrows commute; an arrow γ: (x, ξ) → (y, ζ) is a 2-arrow γ: x ⇒ y such that the following diagram commutes Spelling out the data for an Eilenberg-Moore construction for the comonad c = (A, c, µ, ν), it requires that there is an object A c in K together with a

1-arrow and a 2-arrow as in
which satisfy the commutative diagrams in (4). Moreover, for any object B in K , every pair (x, ξ) as in (3) satisfying (4) can be obtained by precom- for a unique 1-arrow x ′ : B → A c , and similarly for arrows γ: (x, ξ) → (y, ζ) between pairs: In case the universality condition is verified for each comonad in K , it can be restated in terms of a 2-adjunction after introducing the appropriate 1 2-category Adj(K ) of adjunctions in K and the 2-category Cmd(K ) of comonads in K . Since we can safely refer the reader to [26] for a very clear presentation of the general setup, we limit ouselves to recapping the main diagram of 2-adjunctions: where the 2-functor Inc sends an object A in K to the identity comonad (A, e A , 1 e A , 1 e A ) on A, and the 2-functor EM sends a comonad c = (A, c, µ, ν) to its Eilenberg-Moore object A c ; while the 2-functor Cmd sends an adjunction A = (C, D, l, r, η, ǫ) to the associated comonad (D, lr, lηr, ǫ), and the 2-functor EMA sends a comonad c to the Eilenberg-Moore adjunction between A and A c .
Example 3.2. Although the terminology already suggests clearly the kind of generalization adopted, we hasten to point out that in the 2-category Cat of (small) categories, functors and natural transfomations, the definitions in (i) and (ii) instantiate exactly to the usual notions of (standard) adjunction between categories l ⊣ r-where η and ǫ are the unit and the counit of the adjunction-, and to comonads. Clearly, Cat admits the Eilenberg-Moore construction for every comonad.
In the next sections we shall characterize adjunctions and comonads in the 2-category Dtn of doctrines.

The 2-category of doctrines
The 2-category Dtn of doctrines consists of the following data: objects are doctrines, i.e. a functor P : C op → Pos from the opposite of a category C to the category Pos of posets and monotone functions-in the nomenclature of indexed categories, the category C is named the base of the doctrine, for X an object in C the poset P (X) is the fibre 1 There are many reasonable 2-categories whose objects are adjunctions in K . In this paper, the 2-category Adj(K ) we introduce is the one that gives rise to the 2-adjunction with Cmd(K ).
over X, and for t: X → Y an arrow in C , the monotone function P t: P Y → P X is called reindexing along t; 2 → Q F op is a natural transformation; Composition of 1-arrows (G, g): Composition of 2-arrows θ: There is an obvious forgetful 2-functor Dtn → Cat to the 2-category of categories, functors and natural transformations, which maps a doctrine (C , P ) to its base category C , and acts similarly on the arrows. Note that such a 2-functor is actually a 2-fibration, in the sense of [16], where cartesian 1-arrows are "chang of base", that is, arrows of the form (F, id), while vertical 1-arrows "fibred", that is, arrows of the form (Id , f ), which act only on the fibres. 3 We define also the 2-category -Dtn of doctrines endowed with an interior operator as follows: objects are pairs (P , ) where P is a doctrine and is an interior operator on P ; Compositions are inherited from those of the 2-category Dtn.
It is easy to verify that the requirement on the component f of a 1-arrow in -Dtn is equivalent to the condition that ′ i.e. f X maps -stable elements to -stable elements.  Also, for α ∈ P(W ) S , consider the W -indexed family given by (c S (α)) w := s ∈ S w ∈ α(s) .
One can show that the 1-arrow (C, c): P(W ) (-) → Sub W -Fam is the comprehension completion of the doctrine P(W ) (-) : Set op → Pos, and that the interior operator is the canonical extension of the other operator j R • -, see [23,30].
There is a forgetful 2-functor -Dtn → Dtn which deletes the interior operator. It has a right 2-adjoint, which sends a doctrine P : C op → Pos to (P , id) and is the identity both on 1-arrows and 2-arrows.
Indeed, for any object (P , ) in -Dtn the inequality X ≤ id P X holds; so for any 1-arrow (F, f ): P → Q in Dtn we have f X • X ≤ f X by monotonicity of f X .

Interior modalities from adjunctions
The main goal of this section is to connect interior operators as in Definition 2.1 and adjunctions in Dtn. First we characterise the general 2categorical notion of adjunction, as introduced in Section 3, for the particular case of the 2-category Dtn in terms of the functors and natural transformations involved.
Proof. If (P, Q, l, r, η, ǫ) is an adjunction in Dtn, applying the forgetful functor Dtn → Cat one gets immediately i where L and R are the first components of l and r respectively. The rest of the proof is plain bookkeeping.
As for any 2-category, one can consider the 2-category Adj(Dtn) of adjunctions in Dtn. The following proposition is just as straightforward as the previous one.

Proposition 5.2. The 2-category Adj(Dtn) of adjunctions in Dtn has objects which are adjunctions
To elucidate the conditions in Proposition 5.2 in terms of some diagrams, consider first that the forgetful 2-functor Dtn → Cat extends to a 2-functor Adj(Dtn) → Adj(Cat). Hence the condition that the triple (F, G, θ) is a homomorphism of adjunctions in Cat requires that the diagram of functors commutes as well as (either of) the diagrams of natural transformations as the two commutativity conditions are equivalent. For instance, if we assume the first commutes, postcomposing it with L B and precomposing it with R A , and using the naturality of θ and ǫ B and the triangular identities of adjunctions, we get the second as depicted in the following diagram The condition that the pair (α, β) is a 2-cell from the adjunction homomorphism (F, G, θ) to the adjunction homomorphism (F ′ , G ′ , θ ′ ) in Cat translates into commutativity of the following diagrams of natural transformations From now on, when referring to an adjunction in the 2-category Dtn, we shall take advantage of Proposition 5.1 and write it as an octuple (P , Q , L, λ, R, ρ, η, ǫ).
Example 5.4. Examples are many as any adjunction between categories with pullbacks gives rise to an adjunction between the doctrines of subobjects. In details, given a category with pullbacks C , one can define a functor Sub C : C op → Pos taking advantage of the fact that pulling back preserves monos. The functor maps an object to the poset of its subobjects and reindexing along f : X ′ → X is as follows: a subobject [A 1 α G G X], determined by the isomorphism class of the mono α, is taken to the subobject determined by the mono α ′ obtained as a pullback Let D be also a category with pullbacks, and consider an adjunction (C , D, L, R, η, ǫ) where L: C → D preserves pullbacks (as a right adjoint, the functor R: D → C preserves all existing limits). Between the doctrines Sub C : C op → Pos and Sub D : The naturality of λ and ρ follows since reindexing is given by pulling back, and L and R preserve pullbacks. To see that (Sub C , Sub D , L, λ, R, ρ, η, ǫ) is an adjunction in Dtn there remains to check that η: But this follows from naturality of η and ǫ together with the reindexing pullbacks We now put to use the characterisation in Proposition 5.1 to construct an interior operator starting from an adjunction of doctrines. We begin the process performing the construction for a very specific type of adjunctions: adjunctions between vertical 1-arrows.
Proposition 5.5. Let P : C op → Pos and Q : C op → Pos be doctrines, and suppose the octuple (P , Q , Id C , λ, Id C , ρ, id Id C , id Id C ) is an adjunction in Dtn. Then (i) for each object X in C , the following adjunction holds between the fibres Proof. By Proposition 5.1, the hypothesis ensures that id Id C : (Id C , id) ⇒ (Id C , ρλ) and id Id C : (Id C , λρ) ⇒ (Id C , id) are 2-arrows in Dtn. From this, the conclusion follows directly.
Example 5.6. Recall from [28] that a commutative quantale is a complete lattice endowed with further structure (V , , ≤, ⊗, 1) where (V , , ≤) is a complete lattice, (V , ⊗, 1) is a commutative monoid such that the operation ⊗ distributes over sups: for elements x and families (x i ) i∈I in V -note that this yields that ⊗ is monotone in its two arguments.
It is easy to check that 1 ∈ R V and R V is closed with respect to ⊗ and . Hence (R V , , ≤, ⊗, 1) is a commutative quantale. Let ι: R V → V be the inclusion function which clearly preserves sups. Its right adjoint r: Recall that the doctrine V (-) carries a much richer structure induced from that of the original quantale V : for any set X, (V X , , ≤ X , ⊗ X , 1 X ) is a commutative quantale with the pointwise structure and, for α, β ∈ V X , the operation α ⊸ → V (-) enjoys additional properties: for any set X and provides a model of first order intuitionistic linear logic, where ! is the linear exponential modality.
Examples 5.7. Let P : C op → Pos be a doctrine. The propositional connectives are defined in terms of adjunctions involving P and another doctrine defined from it where the adjoint functors between the base categories are the identity, see [19], see also [17,24]. So Proposition 5.5 provides interior operators associated with each connectives. Two interesting instances are the following: 1. Consider the doctrine P 2 : C op → Pos, defined by P 2 X = P X×P X and is an adjunction between P and P 2 . Hence, by Proposition 5.5, there is an interior operator on P 2 given by (α, β) → (α ∧ β, α ∧ β), for α, β ∈ P X.
2. Assume further that C has finite products and consider an object X in C . Consider the doctrine P X : C op → Pos, determined as P X (Y ) = P (Y ×X) and P X (f ) = P (f × id X ). There is a 1-arrow (Id C , p X ): P → P X where p X Y = P π 1 and π 1 : Y × X → Y is the first projection. A universal quantifier ∀ X on P over X is a right adjoint to (Id C , p X ) in Dtn, i.e. the octuple (P , P X , Id C , p X , Id C , ∀ X , id Id C , id Id C ) is an adjunction in Dtn. Hence, by Proposition 5.5, there is an interior operator on P X given as α → p X (∀ X α) for α ∈ P X (Y ) = P (Y × X).
We did not consider the other cases of connectives because the modality each of those induces is the identity as the next proposition explains in a more general context.
is an adjunction. Then, for each object X in C , the following hold: Proof. (i) is immediate since the adjunction λ X ⊣ ρ X involves posetal categories. (ii) and (iii) follow directly from (i).
The next step is an application of a remarkable result by [15] about fibred adjunctions as it allows to show that any adjunction in Dtn can be factored as the composition of two adjunctions where one is the identity adjunction on the base categories. For this, recall that Dtn has a vertical/cartesian factorisation system, that is, any 1-arrow (F, f ): P → Q from the doctrine P : C op → Pos to the doctrine Q : D op → Pos can be factored by "change of The factorization of the adjunction follows this decomposition for the left adjoint. Recall Lemma 3.2 from [15] in the case of doctrines. in Dtn as depicted in the diagram Proof. We apply Proposition 5.
is an adjunction in Dtn. Since (C , D, L, R, η, ǫ) is already an adjunction in Cat, it remains to check the natural transformations η: Id C . → RL and ǫ: LR . → Id D determine 2-arrows in Dtn as follows In other words, the inequalities hold for each object X in C and Y in D. They are in fact identities: the second is immediate, and the first follows from the triangular identity (1) for an adjunction by functoriality of Q.
Theorem 3.4 in [15] restricted to the case of doctrines is the following.  (7) as where the first one is (P , Q L op , Id C , λ, Id C , (P η op )(ρL op ), id, id).
Proof. We see the (P , Q L op , Id C , λ, Id C , (P η op )(ρL op ), id Id C , id Id C ) is an adjunction in Dtn as another application of Proposition 5.1. Obviously (C , C , Id C , Id C , id, id) is the identity adjunction in Cat. To check the natural transformation id Id C : Id C . → Id C determines 2-arrows in Dtn we must see that the inequalities hold for each object X in C . The first inequality holds since η: To see that the composition of the two adjunctions gives the original adjunction, note that the top and bottom compositions in (9) give the top and bottom 1-arrow in It is immediate to see that (L, id) · (Id C , λ) = (L, λ). For the other composition, the first components coincide trivially, and for the second components apply the commutativity of the following diagram of natural transformations where the square commutes by naturality of ρ, the right-hand triangle by functoriality of P , and the top triangle by one of the triangular identities for adjunctions (1). Finally one sees immediately the compositions of the 2-arrows give the 2-arrows of the original adjunction. Proof. It follows immediately applying Proposition 5.5 to the first adjunction in (9).
Example 5.12. Let C and D be category with pullbacks, and let (C , D, L, R, η, ǫ) be an adjunction where L: C → D preserves pullbacks. As in Example 5.4, there is an adjunction (Sub C , Sub D , L, λ, R, ρ, η, ǫ) on the doctrines of subobjects. By Corollary 5.11, there is an interior operator on the doctrine Sub D L op : C op → Pos, defined as X α = Lα ′ , where X ∈ C 0 and α ∈ Sub D (LX) and α ′ ∈ Sub C (X) is defined by the following pullback diagram The construction is reminiscent of that of a modal operator from a geometric morphism between elementary toposes, see the original paper [14], or Section 10.1 in [9], and also [27,3,2]. Indeed, a geometric morphism from the topos E to the topos F is an adjunction (E, F , L, R, η, ǫ) such that the left adjoint L preserves finite limits.
The paradigmatic example of a interior operator obtained from a geometric morphism is that offered by presheaves over a category C . Recall that the category of presheaves over C is the functor category [C op , Set ]. If we let C 0 be the discrete category of the objects of C and write i: Hence, L ⊣ R is a geometric morphism, thus it induces an interior operator on Finally, note that, if K = (W, R) is a Kripke frame with R reflexive and transitive, taking C = K op , the above geometric morphism provides another way to construct Kripke models categorically. In detail, a presheaf D over K op specifies, for each world w ∈ W , a set D(w), modelling individuals which exist at the world w, and, for each wRv, a function D wv : D w → D v , describing how individuals existing at the world w "evolve" in the world v. A "formula" α on D is a family of subsets, that is, for each world w ∈ W , α w ⊆ D w , and the modal operator identifies those formulas which are subpresheaves of D, namely, those α such that, for all w, v ∈ W , if wRv then α w ⊆ D −1 wv (α v ). We conclude this section showing that the construction in Corollary 5.11 extends to a 2-functor AM: Adj(Dtn) → -Dtn.

For an adjunction A in Dtn write
which is an interior operator by Corollary 5. Proof. We just have to check that the identities in (10) and (11) determine arrows in -Dtn, as the algebraic identities will then follow immediately.
ia a 1-arrow in -Dtn we are left to check that for every object X in the base category of Q (L A ) op , we have In the diagram of natural transformations the marked square commutes by naturality of f , the triangle by functoriality of P B , and all the other paths commutes (possibly up to inequality as shown) by Proposition 5.2.
Given now a 2-arrow (α, β): (F, f, G, g, θ) ⇒ (F ′ , f ′ , G ′ , g ′ , θ ′ ) in Adj(Dtn) to see that α: (F, gL A ) ⇒ (F ′ , g ′ L A ) is a 2-arrow in -Dtn, we have to show that, for every object X in the base category of Q (L A ) op , it is the case that g L A X ≤ Q ′ L B α X · g ′ L A X . By Proposition 5.2, the equality L B α = βL A holds and, since β: (G, g) ⇒ (G ′ , g ′ ) in Dtn, we obtain that g L A X ≤ Q ′ β L A X ·g ′ L A X , as needed.
Example 5.14. A particular example of interior operators is found in the categorical semantics of the linear exponential modality (a.k.a. bang modality) of propositional linear logic provided by linear-nonlinear adjunctions. A linear-nonlinear adjunction is a monoidal adjunction between a symmetric monoidal category and a cartesian category; the induced comonad on the symmetric monoidal category interprets the bang modality, see [6]. The categorical notion swiftly extends to doctrines where the construction in Corollary 5.11 provides a model of the bang modality in a higher order setting. The role of the cartesian category is played by a primary doctrine, see e.g. [11]), that is, a doctrine P : C op → Pos where C has finite products and, for each object X in C , the fiber P X carries an inf-semilattice structure preserved by reindexing. The role of the symmetric monoidal category is played by a (symmetric) monoidal doctrine, which one defines following the work on monoidal indexed categories of [25]. We give some of the details in Appendix A, but shall develop fully the particular instance of interior operators in a subsequent paper.

Interior modalities from comonads
As is well-known, there is a deep connection between comonads and adjunctions in a 2-category: every adjunction determines a comonad. Viceversa, when the 2-category admits the Eilenberg-Moore construction for comonads, a comonad generates an adjunction. This connection is particularly interesting when we consider a left exact comonad K on a topos E: the category of coalgebras E K is a topos and the Eilenberg-Moore adjunction between E K and E is a geometric morphism, see e.g. [21]. As we have seen in Example 5.12, geometric morphisms generate interior operators; hence, combining these two facts, we obtain that a left exact comonads on an elementary topos determines an interior operator.
Remark 6.2. More explicitly, condition (ii) in Proposition 6.1 requires that µ: P . → P K op and condition (iii) in Proposition 6.1 states that, for each object X in C , the following inequalities hold For abstract reasons, a comonad in Dtn always admits the Eilenberg-Moore construction, see [8]. Here we limit ourselves to present the direct computation of the Eilenberg-Moore object for a comonad K = (K, κ, µ, ν) on the doctrine P : C op → Pos. The Eilenbeerg-Moore object for K can be given on the doctrine P K : C K op → Pos defined as follows.
The category C K is the category of coalgebras for the comonad (K, µ, ν) on C , namely, objects are pairs (C, c) where C is an object in C and c: C → KC is an arrow in C such that the diagram commutes, and an arrow f : With the intention to produce the doctrine P K : C K op → Pos, for each coalgebra (C, c) let P K (C, c) be the suborder of P C on the subset α ∈ P C α ≤ P c(κ C (α)) .
So P f sends elements of P K (C ′ , c ′ ) to elements of P K (C, c): let P K f be the restriction of P f . It follows immediately that P K is a doctrine.
Remark 6.3. Note that the inequality P c(κ C (α)) ≤ α holds for every α ∈ P C, by properties of c and ν C . Hence the elements of P K (C, c) are the fixpoints of P c • κ C . Furthermore, as we shall see, P c • κ C is an idempotent on P C (it is a consequence of Proposition 6.6). Thus, as in Pos idempotents split, one gets P K (C, c) by splitting P c • κ C .
Next we introduce the forgetful 1-arrow (U K , ι K ): P K → P as follows: the functor U K : C K → C is the actual forgetful functor from the category of coalgebras; the natural transformation ι K : P K . → P (U K ) op is given by the inclusion of P K (C, c) into P C as (C, c) varies among the objects of C K . It is immediate to see the functor U K is faithful and, for each object (C, c) in C K , the map ι K (C,c) is injective. Finally the universal 2-arrow ς K : (U K , ι K ) ⇒ (K, κ)(U K , ι K ) as requested in (3) is given by the family ς K given by One sees immediately that ς K : U K . → KU K . It determines an appropriate 2-arrow in Dtn because for any α ∈ P K (C, c), by definition of P K (C, c) one has that α ≤ P c(κ C (α)) = P ς K (C,c) • κ U K op (C,c) (α) After introducing the dramatis personae, we are ready to prove the characterization of the Eilenberg-Moore construction for a comonad in Dtn. Theorem 6.4. Let P : C op → Pos be a doctrine and K a comonad on P .
Proof. We begin the proof analysing the data for the 2-problem in Defini- where the pair ((X, x), ξ) satisfies the two commutativity conditions in (4). These translate precisely in the commutative diagrams of natural transformations while the condition on the 2-arrow in (12) requires that the natural transformation ξ: X .
→ KX is such that, for every object D in D and β ∈ Q (D), we have In turn, the commutativity of the two diagrams (13) is equivalent to requiring that, for every object D in D, there is a structure of coalgebra (X(D), ξ D ) for the comonad (K, µ, ν) on the object X(D) in the category C , and that, for every arrow f : a homomorphism of coalgebras. At the same time, condition (14) is equivalent to requiring that the monotone function x D : Q (X(D)) → P (X(D)) factors through Hence the data for the 2-problem determine precisely a 1-arrow ((X, ξ), x): Q → P K ensuring uniqueness, and it is immediate to check that the required diagram commutes. Similarly, for an arrow γ: ((X, x), ξ) → ((Y, y), υ) of the 2-problem, that is, a 2-arrow γ: (X, x) ⇒ (Y, y) in Dtn, the commutative diagram (5) determines precisely a natural transformation γ: (X, ξ) . → (Y, υ); the inequality encoded in the 2-arrow γ: (X, x) ⇒ (Y, y) in Dtn is the same as that encoded in the 2-arrow γ: ((X, ξ), x) ⇒ ((Y, υ), y) in Dtn.
Corollary 6.5. Let P : C op → Pos be a doctrine and K = (K, κ, µ, ν) be a comonad on P . Then there is an adjunction A K = (P K , P , U K , ι K ,K, κ, η K , ν) between P K and P .
Proof. It follows from Theorem 6.4 and general results in [29]. But we make explicit each component of the adjunction as is obtained from the general case. Among the data determining the adjunction, only two may need to be described: the functorK: C → C K is the free coalgebra functor and gives, for an object X in C , the free coalgebraKX = (KX, µ X ). The natural transformation is the canonical embedding of a coalgebra into the free coalgebra η K : Id C K . →KU K defined as η K (X,c) = c. In fact, in the general 2-adjunction between comonads and adjunctions in a 2-category K when K admits the Eilenberg-Moore construction, as in diagram (6), we know that the Eilenberg-Moore construction gives the right 2-adjoint from the 2-category Cmd(K ) of comonads in K . So we briefly collect the data for the 2-category Cmd(Dtn) in order to apply that result in the present situation. The 2-category Cmd(Dtn) has objects which are pairs (P , K) where P is a doctrine and K is a comonad on P ; 1-arrows from (P , K) to (Q , J), with K = (K, κ, µ K , ν K ) and J = (J, ψ, µ J , ν J ), consist of a 1-arrow (F, f ): P → Q and a 2-arrow θ: (F K, (f K op )κ) ⇒ (JF, (ψF op )f ) in Dtn such that the following diagrams of functors and natural transformations commute: g), ζ), which are 1-arrows from (P , K) to (Q , J), with K = (K, κ, µ K , ν K ) and J = (J, ψ, µ J , ν J ), consist of a 2-arrow α: (F, f ) ⇒ (G, g) such that the following diagram of functors and natural transformations commutes The instance of diagram (6) which we have been addressing is the following Dtn Since by Corollary 5.11 every adjunction between doctrines induces an interior operator, via EMA one obtains an interior operator also from a comonad.
Proposition 6.6. Let P : C op → Pos be a doctrine and K = (K, κ, µ, ν) a comonad on P . Then, the natural transformation K : PU K . → PU K , defined, for each coalgebra (X, c) in C K , by K (X,c) = P c • κ X , is an interior operator on P U K op : C K → Pos.
Proof. By Corollary 6.5, (U K , ι K ,K, κ, η K , ν) is an adjunction between P K and P . By Corollary 5.11, K = ι K · (P K η K ) · (κU K ) is an interior operator on P U K op : C K op → Pos, but, for each coalgebra (X, c) in C K , η K (X,c) = c and U K (X, c) = X, P K c = P c by definition, and ι K is an inclusion. Example 6.7. An interesting case of Proposition 6.6 is that of toposes of presheaves as models of first order modal logic. We have already seen in Example 5.12 how one obtains an interior operator on the category of presheaves [C op , Set ] from the adjunction which is the geometric morphism where C 0 denotes the discrete category of the objects of C and i: C 0 → C is the inclusion functor. But the category of presheaves is exactly the category of coalgebras for the comonad determined by the adjunction (15), see [18]; so Proposition 6.6 applies, and the modal operator obtained on a presheaf model is obtained directly from the subobject doctrine on [C 0 op , Set ]] and the geometric morphism that determines the presheaves as coalgebras.
7 The global picture Proposition 5.13 produces a construction of an interior operator from adjunctions as a 2-functor AM: Adj(Dtn) → -Dtn. And Proposition 6.6 describes the action of the composition CM in the diagram The goal of this section is to complete the above diagram, by showing that AM is part of a local adjunction, see [7]. Hence so is CM. We start by comparing the 2-functor AM to the composite CM • Cmd, both constructing a doctrine with interior operator from an adjunction in Dtn. They do not coincide, but can be canonically compared by a 2-natural transformation. Recall that CM maps a comonad (P , K), for K = (K, κ, µ K ν K ), to the doctrine with an interior operator (P (U K ) op , K ) where K (X,c) = P c · κ. Since AM is a 2-functor, its action on the unit of the 2-adjunction Cmd ⊣ EMA produces a natural comparison AM(A) → CM(Cmd(A)) for A = (P , Q , L, λ, R, ρ, η, ǫ) an adjunction in Dtn.
Indeed, let K := Cmd(A) = (LR, (λR op )ρ, LηR, ǫ) be the induced comonad on Q . The component of the unit of the 2-adjunction on A is given by the 1-arrow (K, k, Id, id, id): A → EMA(K), where (K, k): P → Q K is the comparison 1-arrow given by the Eilenberg-Moore construction. The 1-arrow (K, k) is obtained by the universal property of Q K applied to the following diagram: Q Lη S a r r r r r r Q More explicitly, (K, k) is defined as follows: KX := (LX, Lη X ), for each object X in the base category of P , Kf := Lf , for each arrow in the base category of P , and k = λ. This is well-defined thanks to the following chain of inequalities: Proof. It is immediate since, for each object X, A Finally, let us note that this comparison 1-arrow is a component of a 2-natural transformation, obtained by postcomposition of the unit of the 2-adjunction Cmd ⊣ EMA with the 2-functor AM.
In order to show that AM is part of a local adjunction, We start by constructing a comonad from an object (P , ) in -Dtn. Proof. There is only to check that id: (Id C , ) ⇒ (Id C , id) and id: (Id C , ) ⇒ (Id C , · ) are well-defined 2-arrows. But, for each object X in C , X ≤ id P X and X ≤ X · X hold by Definition 2.1.
In other words, Proposition 7.2 shows that an interior operator on a doctrine P is exactly a vertical comonad on it.
We introduce the 2-functor MC: -Dtn → Cmd(Dtn) by letting, for (P , ) a doctrine with interior operator, MC((P , )) := (P , Id, , id, id), which is a comonad by Proposition 7. Proof. The proof is straightforward. The only interesting part is checking that it is well-defined on the 1-arrows. Indeed, for each object X in the base category C of the doctrine P , we have f X · P X ≤ Q F X · f X , by definition of 1-arrow in -Dtn. And this ensures that id: It is easy to see that the 2-functor MC is full and faithful. Hence the 2-category -Dtn is isomorphic to the 2-category of vertical comonads in Dtn. Now let MA: -Dtn → Adj(Dtn) be the composition -Dtn which sends an object (P , ) in -Dtn to the Eilenberg-Moore adjunction of the associated comonad MC(P , ) = (Id C , , id, id) where, from the general construction in (6), the Eilenberg-Moore object P : C op → Pos for the comonad induced by is P X = α ∈ P X α = X α .
Also P f = P f , and ι K : P . → P is the inclusion. Proof. The fact that ∆ is a well-defined lax 2-natural transformation is straightforward, since AM · MA = Id -Dtn . We check that ∇ A is a 1arrow from MA((Q L op , A )) to A. We have (L • Id C , λ · (P η op ) · (ρL op )) = (L • Id C , id · ι K ), since, for each object X in C and α ∈ Q L op X, we have λ X (P η X (ρ LX (α))) = A X α = α, by definition of Q L op . Then, we have to check that η: (Id C • Id C , (P η op ) · (ρL op ) · A ) ⇒ (RL, (ρL op ) · id) is a 2-arrow in Dtn, but this holds because η: Id C . → RL is a natural transformation and , for each object X in C , A Now, consider a 1-arrow φ = (F, f, G, g, θ): A → B in Adj(Dtn); hence, we have MA(AM(φ)) = (F, g(L A ) op , F, g(L A ) op , id), and we have to show that is a 2-arrow in Adj(Dtn). To this end, it is enough to prove that and id: ( are 2-arrows in Dtn, since the other conditions are trivially satisfied as the two components are identities. The second is a 2-arrow since, by definition of 1-arrow in Adj(Dtn), the equality GL A = L B F holds. To see that so is the first, consider the following inequalities for X an object in C :   Theorem 7.6. Let P : C op → Pos and Q : D op → Pos be doctrines and consider an adjunction (L, λ, R, ρ, η, ǫ) between them. Then, the following diagram (of adjunctions) Proof. The commutativity of the diagram follows immediately from the definition of and condition (i) in Proposition 5.8 and Theorem 5.10. The fact that, for each object X, the function λ X : P X → Q L op X is surjective and P η X ρ LX : Q L op X → P X is injective, follows from condition (ii) in Proposition 5.8, noting that X = λ X • P η X • ρ LX is the identity on Q L op X by definition.
Example 7.7 (Temporal Logics). Consider the standard powerset doctrine P: Set op → Pos, sending a set X to the powerset P(X) and a function t: X → Y to the inverse image function t * : P(Y ) → P(X), and a 1-arrow (F, f ): P → P. Suppose that F : Set → Set is an accessible functor, hence it admits a free comonad (cf. [13]) K F : Set → Set . We recall the construction in the following.
• Given a set A, let K F A = νX.A × F X be the (underlying set of the) final coalgebra for the functor the structure map of the final A × F -coalgebra, which is an iso by the Lambek Lemma.
• Given a function t: B → A, the function ζ B : commutes.
We can also define a natural transformation κ f : P . → P K F op as follows. Consider a set A and a subset α ∈ P(A). We define a function φ α : ), which is monotone by construction, hence, since P K F A is a complete lattice, by the Knaster-Tarski theorem, φ α has a greatest fixed point, given by Thus, by coinduction, we get νφ α ⊆ νφ β , as needed. In order to prove that κ f A is natural in A, we have to check that, for each function t: B → A and α ∈ P(A), it is the case that (K F t) * (νφ α ) = νφ t inf(α) . First, note that Hence, by coinduction, we get (K F t) * (νφ α ) ⊆ νφ t * (α) . To prove the other inclusion, we just have to prove that denotes the direct image of β ∈ P K F B along K F t. To this end, we note that To check that K F = (K F , κ F , µ F , ν F ) is a comonad on P, it is enough to show the following two inequalities: Thus by coinduction we obtain (2). Applying the construction in Proposition 6.6, we obtain a comonadic modal operator K F on the indexed poset Q : (Set K F ) op → Pos, mapping a coalgebra (A, c) for the comonad K F to P(A) and a coalgebra morphism t: (B, d) → (A, c) to the inverse image function t * : P(A) → P(B). Explicitly, given a coalgebra (A, c) and an element α ∈ P(A), This setting has a temporal interpretation: given the 1-arrow (F, f ), the functor F represents the "branching type", namely, the branching structure of time, and f lifts formulas to branches. The functor K F models the whole time structure, that is, the present and all possible futures, generated by the branching type F , and κ F lifts a formula to time structures, basically, universally quantifying over time, according to f , roughly saying that the formula holds in all possible future branches. Given a coalgebra (A, c) for the comonad K F , for each x ∈ A, c(x) represents the whole evolution of x along time, hence, for each α ∈ P(A), we have x ∈ K F (A,c) α if all future evolutions of x belongs to α. Therefore, roughly, K F is a generic kind of "always" modality, typical of temporal logics. In the following we consider two explicit instances of this situation.
Example 7.8 (Linear time). Consider (F, f ) = (Id, id), that is, each instant has exactly one possible future. The free comonad is the stream comonad StrA = νX.A × X = A ω , mapping a set A to the set A ω of sequences of elements in A indexed over natural numbers. Given a sequence a ∈ A ω , we write s i to denote the i-th element of s, and s[i..] to denote the sequence r ∈ A ω such that r j = s j+i for all j ∈ N. Then, the counit maps s to s 0 (the first element, namely the present) and the comultiplication maps s to the sequence (s[i..]) i∈N , namely the sequence of all suffixes of s.
Let α ∈ P(A), we have κ F A (α) = {s ∈ A ω | s i ∈ α for all i ∈ N}, namely, the set of sequences where all elements belongs to/satisfies α. Therefore, if (A, c) is a coalgebra for Str, Str (A,c) α = {x ∈ A | c(x) i ∈ α for all i ∈ N}, that is, it is the set of all elements x ∈ A such that all its future instances (including the present one) belongs to α.
Therefore, Str (A,c) provides a model for the "globally" (G) modality of Linear Temporal Logic (LTL) [5] and, moreover, the modality on the free coalgebra (StrA, µ Str A ) implements exactly the standard semantics of such a modality on infinite sequences.  (x 1 , . . . , x n )) ∈ F X | x i ∈ α for all i ∈ 1..n} and f ∃ A (α) = {(n, (x 1 , . . . , x n )) ∈ F X | x i ∈ α for some i ∈ 1..n}. The free comonad is Tr, mapping a set A to the set of finitely branching and ordered trees labelled by A. Formally, such a tree is a partial function t: N ⋆ ⇀ A with a non-empty and prefix-closed domain such that, if (k 1 , . . . , k n ) ∈ domt and k ≤ k n , then (k 1 , . . . , k) ∈ domt (cf. [10,1]). The counit maps a tree t to the label of its root, that is t(ε), where ε is the empty sequence, and the comultiplication maps a tree t to µ F A (t) such that domµ T A (t) = domt and µ F A (t)(u) is the subtree of t rooted at u ∈ domt. The behaviour of the natural transformation κ F of course depends on f , for instance, for f = f ∀ , it maps α ∈ P(A) to the set of trees where all nodes have label in α, while for f = f ∃ , it maps α ∈ P(A) to the set of trees containing an infinite path starting from the root where all nodes have label in α.
Then, given a coalgebra (A, c) for the comonad Tr and α ∈ P(A), we have x ∈ Tr (A,c) α if all nodes in c(x) have label in α, when f = f ∀ , and if there is an infinite path in c(x) where all nodes have label in α, when f = f ∃ . Therefore, Tr (A,c) provides a model for the modalities "invariantly" (AG) and "potentially always" (EG) of Computation Tree Logic (CTL) [5], depending on the choice of f .
[30] Streicher, T. 1991. Semantics of type theory. Progress in Theoretical Computer Science. Birkhäuser Boston, Inc., Boston, MA. Correctness, completeness and independence results, With a foreword by Martin Wirsing.

A Interior operators from linear-nonlinear adjunctions
A well-known approach to provide categorical semantics to the linear exponential modality !-read as "bang"-of propositional linear logic is by means of linear-nonlinear adjunctions as in [6]. A linear-nonlinear adjuction is a monoidal adjunction beween a symmetric monoidal category and a cartesian category; the induced comonad on the symmetric monoidal category interprets the bang modality. This notion is easily extended to doctrines where the construction in Corollary 5.11 provides a model of the bang modality in a higher order setting.
In the present context, the role of the cartesian category is played by a primary doctrine, that is, a doctrine P : C op → Pos where C has finite products and, for each object X in C , the fiber P X carries an inf-semilattice structure preserved by reindexing, see e.g. [11]. The symmetric monoidal category turns into a (symmetric) monoidal doctrine, which we define below, following the definition of monoidal indexed categories in [25]. We shall employ the 2-cartesian structure of the 2-category Dtn. So, in the following, given indexed posets P : C op → Pos and Q : D op → Pos, we denote by P × Q: (C × D) op → Pos the product doctrine mapping a pair of objects (X, Y ) to the product (in Pos) P X × Q Y and acting similarly on arrows. Furthermore, we denote by 1 the terminal doctrine whose base is the terminal category and mapping its unique object to the singleton poset. We shall write α P 1 ,P 2 ,P 3 : P 1 × (P 2 × P 3 ) → (P 1 × P 2 ) × P 3 , λ P : 1 × P → P , ρ P : 1 × P → P , and σ P 1 ,P 2 : P 1 × P 2 → P 2 × P 1 for the usual 1-iso for associativity, left and right identity, and symmetry. A (symmetric) monoidal doctrine consists of such that (D, ⊗, I, a, l, r, s) is a symmetric monoidal category. As the 2arrows a, l, r and s are invertible, the inequalities they induce on the fibres are actually equalities, namely, the following diagrams commute Note that a primary doctrine P : C op → Pos is a monoidal doctrine with (×, ⊓): P × P → P and (1, ⊤ 1 ): 1 → P , where 1 is the terminal object and ⊤ 1 is the top element in P 1, × is the binary product in the category and ⊓ is defined, for all objects X, Y in C , by ⊓ X,Y = ∧ X×Y • (P π 1 × P π 2 ), where π 1 : X × Y → X and π 2 : X × Y → Y are the projections. Now, consider a primary doctrine P and a monoidal doctrine Q . An adjunction (P , Q , L, λ, R, ρ, η, ǫ) is said to be monoidal if L and R are lax monoidal functors and η and ǫ are monoidal natural trasformations, that is, we have the following additional structure: Lv G G LRI ǫ I I and the following inequalities on the fibres: From general results about monoidal adjunctions between categories, we know that u and φ are (natural) isos. Hence the inequalities on the lefthand side are equalities, that is, those diagrams commute.
Consider now the doctrine Q L op : C op → Pos. By Corollary 5.11, there is an interior operator !: Q L op .
However, in this richer context, Q L op has a richer structure. First of all C has finite products, hence, for each object X in C , there are arrows ζ: X → 1 and ∆ X : X → X × X natural in X. Then, we can define a monoid structure on Q L op X as the two composite arrows It follows that (Q L op X, * X , e X ) is a commutative monoid and that such structure is preserved by reindexing. This structure interprets the multiplicative conjunction of linear logic and its unit. To ensure that ! correctly interprets the "bang" modality of linear logic, four properties, in addition to those of interior operators, are required to hold: for each object X in C and α, β ∈ Q (LX), (1) ! X α ≤ e X (2) ! X α ≤ ! X α * X ! X α (3) e X ≤ ! X e X (4) ! X α * X ! X β ≤ ! X (α * X β).