Compositional Game Theory, Compositionally
Robert Atkey, Bruno Gavranovi?, Neil Ghani, Clemens Kupke, Jérémy Ledent, Fredrik Nordvall Forsberg
DDavid I. Spivak and Jamie Vicary (Eds.):Applied Category Theory 2020 (ACT2020)EPTCS 333, 2021, pp. 198–214, doi:10.4204/EPTCS.333.14 This work is dedicated to the public domain.
Compositional Game Theory, Compositionally
Robert Atkey Bruno Gavranovi´c Neil GhaniClemens Kupke Jérémy Ledent Fredrik Nordvall Forsberg
The MSP Group, University of StrathclydeGlasgow, Écosse Libre
We present a new compositional approach to compositional game theory (CGT) based upon Arrows, aconcept originally from functional programming, closely related to Tambara modules, and operatorsto build new Arrows from old. We model equilibria as a module over an Arrow and define an operatorto build a new Arrow from such a module over an existing Arrow. We also model strategies as gradedArrows and define an operator which builds a new Arrow by taking the colimit of a graded Arrow. Afinal operator builds a graded Arrow from a graded bimodule. We use this compositional approachto CGT to show how known and previously unknown variants of open games can be proven to formsymmetric monoidal categories.
A new strain of game theory —
Compositional Game Theory (CGT) — was introduced recently [9]. Atits core, CGT involves a completely new representation of games — open games — with operators forconstructing larger and more complex games from smaller, simpler (and hence easier to reason about)ones. Despite recent substantial interest and further development [13, 10, 7, 6, 4, 11, 14], open gamesremain complex structures, e.g. the simplest form of an open game is an 8-tuple consisting of 4 ports, aset of strategies, play and coplay functions and an equilibrium predicate. More advanced versions [4]require sophisticated structures such as coends. This causes problems: (i) complex definitions lead tocomplex and even error prone proofs; (ii) proofs are programs and overly complex proofs turn into overlycomplex programs; (iii) even worse, this complexity deters experimentation and innovation, for instancethe authors of [10] were deterred from trying alternative definitions as the work became prohibitive; and(iv) worse still, this complexity suggests we do not fully understand the mathematical structure of opengames.Category theorists have an answer to such complexity: trade complex definitions in a simple categoryfor simpler definitions in a more complex category. This simplified open games by factoring their definitionvia the category of lenses, and this more abstract perspective led directly to the discovery of BayesianOpen Games [4] where one naturally swaps out lenses in favour of optics when one starts with a monoidalcategory. Swapping out a subcomponent for another is a hallmark of compositionality, but, because thedefinition of open games is not compositional, one has to redevelop all the structure of open games builtover optics from scratch. The same thing happens with open games with mixed strategies [10] where asmall change — here to the type of the equilibrium predicate — leads to the need to redevelop the fulltheory of these open games. The same story is true if we want to (i) replace equilibria with best-response;or (ii) add type dependency; or (iii) allow the covariant play function and contravariant co-play functionto live in different categories; or (iv) build open games over monadic effects; or (v) consider a host ofother variations of open games. Every single time we must show from scratch that a given variant of opengame forms a monoidal category — a highly non-trivial task. . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg
Definition 1 (Profunctor) . Given two categories C and D , a profunctor F from C to D , denoted by F : C −(cid:55)→ D , is a functor F : C op × D → Set . Example 2.
Let C be a category. Then Hom C : C op × C → Set is a profunctor.Profunctors, strong profunctors and monoids therein form our bedrock and much of this paper is atoolbox for building new examples of arrows from old. The bicategory
Prof has categories as objects,profunctors as morphisms, and natural transformations as 2-cells. Composition of profunctors is given bythe the following coend formula, for F : C −(cid:55)→ D and G : D −(cid:55)→ E . ( G • F )( X , Z ) : = (cid:90) Y : D F ( X , Y ) × G ( Y , Z ) The identity profunctor on C is Hom C . We now fix a monoidal category C and focus on the cate-gory Prof ( C ) of profunctors from C to C and natural transformations between them. Definition 3 (Strength) . A (right) strength for a profunctor F : Prof ( C ) is a family of morphismsst X , Y , Z : F ( X , Y ) → F ( X ⊗ Z , Y ⊗ Z ) (natural in X , Y , and dinatural in Z ) making the following twodiagrams commute. We often write st Z or just st when the subscripts can be inferred from context.00 Compositional Game Theory, Compositionally F ( X , Y ) F ( X ⊗ ( Z ⊗ Z (cid:48) ) , Y ⊗ ( Z ⊗ Z (cid:48) )) F ( X ⊗ Z , Y ⊗ Z ) F (( X ⊗ Z ) ⊗ Z (cid:48) , ( Y ⊗ Z ) ⊗ Z (cid:48) ) st Z st Z ⊗ Z (cid:48) F ( α − , α ) st Z (cid:48) and F ( X , Y ) F ( X ⊗ I , Y ⊗ I ) st I F ( ρ , ρ − ) Such a pair ( F , st ) is called a strong profunctor . Note that several strengths may exist for the sameprofunctor. When several strengths for different profunctors (say F and G ) are involved, we distinguishthem using superscripts, st F and st G . A strong natural transformation from ( F , st F ) to ( G , st G ) is a naturaltransformation τ : F → G that commutes with the strengths: F ( X , Y ) F ( X ⊗ Z , Y ⊗ Z ) G ( X , Y ) G ( X ⊗ Z , Y ⊗ Z ) st F τ X , Y τ X ⊗ Z , Y ⊗ Z st G The category
StrProf ( C ) of strong profunctors and strong natural transformations is monoidal, wherethe tensor product is the composition operator • , and the unit is the functor Hom C . This allows us to talkabout monoids inside StrProf ( C ) . Definition 4 (Arrow) . An arrow is a monoid in ( StrProf ( C ) , • , Hom C ) , i.e. a strong profunctor ( A , st ) together with strong natural transformations pure : Hom C → A and >>> : A • A → A , satisfying the expectedmonoid laws.If we unpack Definition 4 (and use the universal property of coends), an arrow on C can be describedmore concretely by the following data:• A family of sets A : | C | × | C | → Set ;• A family of functions pure XY : Hom C ( X , Y ) → A ( X , Y ) ;• A family of functions >>> XY Z : A ( X , Y ) × A ( Y , Z ) → A ( X , Z ) , called arrow composition ;• A family of functions st XY Z : A ( X , Y ) → A ( X ⊗ Z , Y ⊗ Z ) ;subject to a number of arrow equations expressing functoriality, naturality, and so on (see e.g. Atkey [2]).We often use this presentation in the rest of the paper. We sometimes omit the subscripts to reduce notationwhen they can be inferred; and sometimes add a superscript, e.g. >>> A , to specify which arrow they belongto. There is a notion of a left strength F ( X , Y ) → F ( Z ⊗ X , Z ⊗ Y ) , analogous to Definition 3, that satisfiessimilar properties. When the category C is symmetric monoidal, left and right strengths are interdefinable: Lemma 5.
Let C be symmetric monoidal. A right strength st for a profunctor F : Prof ( C ) , induces aleft strength st (cid:48) : F ( X , Y ) → F ( Z ⊗ X , Z ⊗ Y ) as st (cid:48) XY Z = F ( σ ZX , σ Y Z ) ◦ st. The left strength satisfies the(di)-naturality conditions and analogues of the diagrams in Definition 3. In general, arrows give rise to premonoidal categories [2]. The reason we do not get a monoidalcategory is that there are two ways to define a map A ( X , Y ) × A ( X (cid:48) , Y (cid:48) ) → A ( X ⊗ X (cid:48) , Y ⊗ Y (cid:48) ) , and theyneed not coincide. Since we are interested in (symmetric) monoidal categories, we need to restrict to commutative arrows . See also Rivas and Jaskelioff [24] for a similar definition in the case when C is cartesian. This definition is also the same asPastro and Street’s definition of the additional structure required for a profunctor to be a Tambara module [22]. There is a similar situation with strong monads , whose Kleisli category is in general only premonoidal. To get a monoidalcategory, we need the stronger notion of commutative monad (a.k.a. monoidal monad ). See Example 9. . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg
Definition 6.
Let C be symmetric monoidal. An arrow ( A , pure , >>>, st ) is commutative if the followingdiagram mixing left strength, right strength, and composition commutes: A ( X , Y ) × A ( X (cid:48) , Y (cid:48) ) A ( X ⊗ X (cid:48) , Y ⊗ X (cid:48) ) × A ( Y ⊗ X (cid:48) , Y ⊗ Y (cid:48) ) A ( X ⊗ X (cid:48) , Y ⊗ Y (cid:48) ) A ( X (cid:48) , Y (cid:48) ) × A ( X , Y ) A ( X ⊗ X (cid:48) , X ⊗ Y (cid:48) ) × A ( X ⊗ Y (cid:48) , Y ⊗ Y (cid:48) ) ∼ = st X (cid:48) × st (cid:48) Y >>> st (cid:48) X × st Y (cid:48) >>> The following is a mild extension of results in the literature [16, 24].
Proposition 7.
Let C be symmetric monoidal. Every commutative arrow A : Prof ( C ) gives rise to asymmetric monoidal category whose objects are the objects of C , and whose morphisms from X to Y arethe elements of A ( X , Y ) . Moreover, there is a strict monoidal functor J : C → A where we abuse notationand write A for both the arrow and the monoidal category it induces.
Example 8.
For any symmetric monoidal category C , the functor Hom C : C op × C → Set is an arrow,whose associated monoidal category is C itself. Example 9.
Let T : C → C be a strong monad on C . The Kleisli arrow of T is defined by A T ( X , Y ) : = Hom C ( X , TY ) . If T is commutative, then the arrow A T is also commutative. Its associated monoidalcategory is the Kleisli category C T . Dually, if T : C → C is a strong comonad on C , its co-Kleisli arrow is defined by A T ( X , Y ) : = Hom C ( T X , Y ) .We use this last example to show lenses form an arrow in the next section. This example alsodemonstrates the interest in arrows from the functional programming community, as arrows provide asingle framework within which computations with both effects and coeffects can live. To summarise:arrows provide a presentation of monoidal categories where the monoidal structure is induced by strength,and generalise both monadic and comonadic computation. We can use constructions on functors andinternal monoids to build new arrows from old; this flexibility underpins their use in this paper. Rather than hit the reader with the full profunctor framework we have developed, we show first how acompositional treatment of open games is possible, which abstracts away from any specific notion of lensas the primitive building block for open games. As this is expository material we only sketch proofs, andwork with
Set -based open games.
Open games were originally presented as follows [12]:
Definition 10 (Open Game) . Let X , Y , R and S be sets. A pure open game G = ( J G , P G , C G , E G ) : ( X , S ) → ( Y , R ) consists of:• A set J G , called the set of strategies of G,• A function P G : J G × X → Y , called the play function of G,• A function C G : J G × X × R → S , called the coutility function of G, and02 Compositional Game Theory, Compositionally • A predicate E G : X × ( Y → R ) → P ( J G ) , called the equilibrium function of G (where P is thepowerset functor).An important conceptual step was the lens-ification of open games [9]. The functor W : Set × Set op → Set × Set op defined by W ( X , S ) = ( X , X → S ) is a comonad. The category of lenses Lens is the co-Kleisli category of W : concretely, its objects are pairs of sets, and the morphisms from ( X , S ) to ( Y , R ) are pairs of functions ( f , g ) with f : X → Y and g : X × R → S . Noting that X ∼ = Lens ( , )( X , S ) and ( Y → R ) ∼ = Lens ( Y , R )( , ) , we have: Theorem 11.
Let I = ( , ) and A and B be objects of Set × Set op . An open game G : A → B is given by:(i) a set J G of strategies; (ii) a function p G : J G → Lens ( A , B ) ; and (iii) a predicate E G : J G × Lens ( I , A ) × Lens ( B , I ) → Bool . Apart from internalising the notion of open games into structure internal to the category of lenses, andcombining the treatment of play and coplay into a single morphism, this more abstract formulation givescleaner proofs of the following fundamental theorem:
Theorem 12.
There is a symmetric monoidal category Op whose objects are pairs of sets, and whosemorphisms are open games, with games with isomorphic strategy sets identified . This structure reflectsthe sequential and parallel composition of open games. Rather than proving that open games and similar structures form a monoidal category in one fell swoop,i.e. non-compositionally, we adopt a more compositional, step by step approach. As mentioned in theintroduction we do this by using profunctors and arrows. The first step is easy: by Example 9, the comonad W ( X , S ) = ( X , X → S ) gives rise to an arrow on Set × Set op , that we also denote by Lens , like its inducedsymmetric monoidal category. Note that the strength of W is defined with respect to the monoidal structureof Set × Set op (not its cartesian structure), which sends ( X , Y ) and ( X (cid:48) , Y (cid:48) ) to ( X × X (cid:48) , Y × Y (cid:48) ) . The unitof this monoidal structure is I = ( , ) . Proposition 13.
The profunctor
Lens : Prof ( Set × Set op ) is a commutative arrow. This establishes the well-known fact that the category of lenses is symmetric monoidal. Further,the unit of this arrow is the core of the lifting of functions through open games. The next part of ourcompositional construction requires that an arrow that satisfies a property called projection at points — aproperty that the key case of
Lens has. Condition (1) below essentially expresses that the projection map p is an internal natural transformation. In particular, it implies naturality of p in both parameters. Definition 14 (Projection at points) . Let A : Prof ( Set × Set op ) be an arrow. Then A has projection atpoints if there is a family of maps p X , X (cid:48) : A ( I , X ⊗ X (cid:48) ) → A ( I , X ) such that p Y , X (cid:48) ( j >>> st X (cid:48) ( a )) = p X , X (cid:48) ( j ) >>> a and p X , Y (cid:48) ( j >>> st (cid:48) X ( a (cid:48) )) = p X , X (cid:48) ( j ) (1)for all j ∈ A ( I , X ⊗ X (cid:48) ) , a ∈ A ( X , Y ) and a (cid:48) ∈ A ( X (cid:48) , Y (cid:48) ) . Using symmetry, this means that there alsois a projection p X , X (cid:48) : A ( I , X ⊗ X (cid:48) ) → A ( I , X (cid:48) ) given by p X , X (cid:48) : = p X , X (cid:48) ◦ A ( id , σ ) that satisfies similarconditions. Hedges [12] presents open games with best response functions rather than equilibrium functions, but we prefer thepresentation using equilibria for simplicity. We will show how to also define open games with best response functionscompositionally in Section 6. An alternative to this quotient would be to work with bicategories instead. . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg A (such as Lens ) with projection at points, which we think of as representing someprimitive building block, we now want to attach to it an equilibrium predicate — the key feature of opengames. The type of this equilibrium predicate is Equib ( A )( X , Y ) : = A ( I , X ) × A ( Y , I ) → Bool . Note thatEquib ( A ) itself is not an arrow: it has a structure that we call an A-bimodule in Section 4.1. However, bybundling together A and Equib ( A ) , we do get an arrow: Proposition 15.
Let A : Prof ( Set × Set op ) be a commutative arrow with projection at points. Then theprofunctor A × Equib ( A ) : Prof ( Set × Set op ) defined by ( A × Equib ( A ))( X , Y ) = A ( X , Y ) × ( A ( I , X ) × A ( Y , I ) → Bool ) is a commutative arrow.Proof. The unit of A × Equib ( A ) is built from the unit of A and an equilibrium predicate which alwaysreturns true. The composition >>> X , Y , Z : ( A × Equib ( A ))( X , Y ) × ( A × Equib ( A ))( Y , Z ) → ( A × Equib ( A ))( X , Z ) is obtained as follows. We are given four arguments s : A ( X , Y ) , t : A ( Y , Z ) , f : A ( I , X ) × A ( Y , I ) → Bool ,and g : A ( I , Y ) × A ( Z , I ) → Bool , and we define ( s , f ) >>> ( t , g ) : = (cid:0) s >>> A t , λ x λ z . f ( x , t >>> A z ) ∧ g ( x >>> A s , z ) (cid:1) where >>> A is the multiplication of A .To define the strength st X , Y , Z : ( A × Equib ( A ))( X , Y ) → ( A × Equib ( A ))( X ⊗ Z , Y ⊗ Z ) , we are givenan element s : A ( X , Y ) and a predicate f : A ( I , X ) × A ( Y , I ) → Bool . We putst Z ( s , f ) : = (cid:16) st AZ ( s ) , λ x λ y . f (cid:16) p ( x ) , st (cid:48) AY ( p ( x )) >>> A y (cid:17)(cid:17) where st A denotes the strength of A , st (cid:48) A left strength and p and p are the projections at points. We omitthe proof of commutativity of the arrow.Those familiar with the intricacies of the monoidal and sequential composition of open games willnotice their essence above. What is really surprising is that this can be carried out for any set-based arrowsatisfying projection at points and not just for lenses. This generality was not expected. Finally, we turn toindexing by sets of strategies. Again, we work solely with arrows and introduce an arrow constructor todeal with strategies. The simplest, used here, is a variant of the fundamental families construction fromcategorical logic [19, Def. 1.2.1] where we refer to a function J → X as a J -indexed collection of X ’s. Proposition 16.
Let A : Prof ( Set × Set op ) be a commutative arrow. Then the profunctor Fam ( A ) : Prof ( Set × Set op ) defined by Fam ( A )( X , Y ) = colimit J : Set iso ( J → A ( X , Y )) is a commutative arrow.Proof. The unit of
Fam ( A ) is the singleton family built from the unit of A . The composition of Fam ( A ) sends ( J , F : J → A ( X , Y )) and ( K , G : K → A ( Y , Z )) to ( J × K , ( j , k ) (cid:55)→ F ( j ) >>> A G ( k )) (see also Han-cock’s tensor on containers [18, Def. 2.3]). Finally, strength for Fam ( A ) takes a family and post-composesit with the strength of A .04 Compositional Game Theory, Compositionally
Note that in the definition of
Fam ( A ) , taking the colimit over the category Set iso of sets and bijectivefunctions is crucial. Indeed, it ensures that families indexed by isomorphic strategy sets are identified. Thisquotient is important to prove the associativity of arrow composition; the same issue comes up in the usualtreatment of open games [9]. Combining Propositions 13, 15, 16 and 7, we get a symmetric monoidalcategory Op = Fam ( Lens × Equib ( Lens )) and an embedding Set × Set op → Op , in a compositionalmanner. We now upgrade the expository illustration of the previous section. The simplest observation is that thereis nothing special about the category
Set — any monoidal category can be used. We then generalisethe ( − × Equib ( − )) construction using a general notion of bimodule for an arrow in Section 4.1. Wedecompose Fam ( A ) using a notion of graded arrow in Section 4.2. In Sections 5 and 6 we will use thework in this section to reconstruct open games on optics [4] and other known and new variations of opengames, respectively. The cumbersome proof of Proposition 15 can be further decomposed. Notice that the arrow ( A × Equib ( A ))( X , Y ) = A ( X , Y ) × ( A ( I , X ) × A ( Y , I ) → Bool ) is obtained by combining the arrow A with the predicate type Equib ( A )( X , Y ) : = A ( I , X ) × A ( Y , I ) → Bool .As it turns out, Equib ( A ) has a nice structure that we call an A -bimodule . We will use this technology toprove Proposition 33, which generalizes Proposition 15.We also take the opportunity to notice that there is nothing special about the Booleans in the definitionof concrete open games, and replace them with an arbitrary monoid with suggestively named operations ( M , ∧ , tt ) — Hedges’ software implementation [15] uses this insight to collect more in-depth diagnosticswhen checking equilibria. Definition 17 (Bimodule) . Let A : C −(cid:55)→ C be an arrow. An A-bimodule is a profunctor B : C −(cid:55)→ C equipped with natural transformations (cid:96) : A • B → B and r : B • A → B , such that:1. (cid:96) is a left-action, i.e., the two diagrams below commute; A • ( A • B ) ( A • A ) • BA • B B A • B α A • (cid:96) >>> • B (cid:96) (cid:96) Hom C • B BA • B λ pure • B (cid:96) r is a right-action (similar diagrams);3. (cid:96) commutes with r , i.e., A • ( B • A ) ( A • B ) • AA • B B B • A α A • r (cid:96) • A (cid:96) r Note that our notion of an A -bimodule is equivalent to a profunctor for the (pre)monoidal category induced by A (Proposi-tion 7), matching the alternative name “bimodule” for profunctors. . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg B is a strong profunctor, (cid:96) and r are also required to be strong natural transformations. Definition 18.
Let A be an arrow and B : StrProf ( C ) an A -bimodule. We say that B is commutative whenthe following diagram (akin to the one of Definition 6) commutes. A ( X , Y ) × B ( X (cid:48) , Y (cid:48) ) A ( X ⊗ X (cid:48) , Y ⊗ X (cid:48) ) × B ( Y ⊗ X (cid:48) , Y ⊗ Y (cid:48) ) B ( X ⊗ X (cid:48) , Y ⊗ Y (cid:48) ) B ( X (cid:48) , Y (cid:48) ) × A ( X , Y ) B ( X ⊗ X (cid:48) , X ⊗ Y (cid:48) ) × A ( X ⊗ Y (cid:48) , Y ⊗ Y (cid:48) ) ∼ = st X (cid:48) × st (cid:48) Y (cid:96) st (cid:48) X × st Y (cid:48) r Recall that profunctors inherit the cartesian structure of
Set . Given F , G : C −(cid:55)→ D , their product isdefined by ( F × G )( c , d ) : = F ( c , d ) × G ( c , d ) ; and the terminal profunctor 1 : C −(cid:55)→ D is the constantfunctor that picks out a singleton set. It is easy to check that this is also a cartesian structure on StrProf ( C ) .Finally, note that • distributes over × , in the sense that there is a strong natural transformation of type F • ( G × H ) → ( F • G ) × ( F • H ) , and similarly with F on the right. Definition 19 (Bimodule with monoid) . When B additionally has a monoid structure ( B , m , e ) w.r.t. thecartesian product ( × , ) in StrProf ( C ) , we also require that (cid:96) and r preserve the monoid structure of B : A • ( B × B ) ( A • B ) × ( A • B ) A • B B B × B distributivity A • m (cid:96) • (cid:96)(cid:96) m A • A • B B id • e ! (cid:96) e Theorem 20.
Assume A : C −(cid:55)→ C is an arrow, and B : StrProf ( C ) is a monoid w.r.t. cartesian product ( × , ) and an A-bimodule, then A × B is an arrow. Moreover, if both A and B are commutative (as anarrow, as a monoid and as a bimodule), then so is A × B.Proof.
Since A and B are strong profunctors, then so is A × B . Moreover, our hypothesis gives us thefollowing strong natural transformations: pure A : Hom C → A (cid:96) : A • B → B e : 1 → B >>> A : A • A → A r : B • A → B m : B × B → B Then we define pure A × B : = pure A × e , and >>> A × B is given by ( A × B ) • ( A × B ) ( A • A ) × ( A • B ) × ( B • A ) × ( B • B ) A × B × B A × B distributivity >>> A × (cid:96) × r × ! id × m One can then check that the arrow laws are satisfied.In virtue of Theorem 20, the proof of Proposition 15 now amounts to showing that Equib ( A ) is acommutative A -bimodule with a ( × , ) -monoid structure. In fact, we can further decompose this proof byintroducing the following notion of context . A similar notion of context appears in Hedges [14], where itis axiomatized at the level of the monoidal category induced by the arrow A .06 Compositional Game Theory, Compositionally
Definition 21 (Context) . Let A : C −(cid:55)→ C be an arrow. A profunctor B : C −(cid:55)→ C is called a context when it is a commutative A -bimodule equipped with a costrength cst XY Z : B ( X ⊗ Z , Y ⊗ Z ) → B ( X , Y ) ,satisfying some coherence diagrams similar to the ones for strength (full details in Appendix A).The notion of costrength is a weakening of the notion of a trace for a symmetric monoidal categoryto arbitrary profunctors — in particular if the profunctor B is the Hom-functor of a traced monoidalcategory, then B has a canonical costrength. The meat of Proposition 15 lies in the next lemma. Noticethat the position of X and Y is reversed; hence the pre-composition with flip : C op × C → C × C op inTheorem 23. Another example of context, which does not require projection at points, will be given laterin Definition 31. Lemma 22.
If A has projection at points, then
Ctxt A ( X , Y ) = A ( I , Y ) × A ( X , I ) is a context.Proof. The left action is given by the family (cid:96)
XY Z : A ( X , Y ) × Ctxt A ( Y , Z ) → Ctxt A ( X , Z ) , defined by: (cid:96) XY Z : = ( s , z , y ) (cid:55)→ ( z , s >>> A y ) : A ( X , Y ) × A ( I , Z ) × A ( Y , I ) −→ A ( I , Z ) × A ( X , I ) The right action is similar. To define the costrength, we use the strength of A and the projections p , p :cst XY Z : = ( y , x ) (cid:55)→ ( p ( y ) , st (cid:48) AX ( p ( y )) >>> A x ) : A ( I , Y ⊗ Z ) × A ( X ⊗ Z , I ) −→ A ( I , Y ) × A ( X , I ) Theorem 23.
Let A be a commutative arrow, B : C −(cid:55)→ C be a context for A, and ( M , ∧ , tt ) be acommutative monoid (in Set ). Then M B ◦ flip is a commutative A-bimodule and ( × , ) -monoid.Proof. The left and right actions are given by the families of functions (cid:96)
XY Z : A ( X , Y ) × M B ( Z , Y ) −→ M B ( Z , X ) r XY Z : M B ( Y , X ) × A ( Y , Z ) −→ M B ( Z , X ) ( a , h ) (cid:55)−→ λ b . h ( r B b a ) ( h , a ) (cid:55)−→ λ b . h ( (cid:96) B a b ) The ( × , ) -monoid structure is inherited from the one of M : e XY : 1 −→ M B ( Y , X ) m XY : M B ( Y , X ) × M B ( Y , X ) −→ M B ( Y , X ) ∗ (cid:55)−→ λ b . tt ( h , h (cid:48) ) (cid:55)−→ λ b . h b ∧ h (cid:48) b Finally, the strength st : M B ( Y , X ) −→ M B ( Y ⊗ Z , X ⊗ Z ) is obtained by pre-composing with cst B . All thebimodule axioms of M B ◦ flip can then be easily derived from those of B . The
Fam ( A ) construction is really a two step construction: it takes an arrow A and parameterises byelements of sets J , then the parameter sets are hidden using a colimit. The intermediate step in this processis not an arrow because its composition composes morphisms with different parameter sets. However, it isa graded arrow, which we define by adapting the definition of graded monads [20]. Graded monads havebeen used to model programming languages with variable sets of possible side effects. The multiplicationof a graded monad is a natural transformation T p T q ⇒ T pq , where the p , q are from a symmetric monoidalcategory ( P , i , · ) of grades. Graded monads are lax monoidal functors P → Endo ( C ) . Swappingendofunctors for strong profunctors yields: Definition 24. A P - graded arrow is a lax monoidal functor A : P → StrProf ( C ) . . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg A p ( X , Y ) × A q ( Y , Z ) → A pq ( X , Z ) and unit Hom C ( X , Y ) → A i ( X , Y ) that use the monoidal structure of P .Strength A p ( X , Y ) → A p ( X ⊗ Z , Y ⊗ Z ) is provided for every grade p , but when we use strength to defineparallel composition we will use the monoidal structure of grades. To make sure that parallel compositionmakes sense, graded arrows must be commutative. Note that the symmetry of P ’s monoidal structure isrequired for this definition to make sense. Definition 25 (Commutative Graded Arrow) . A P -graded arrow A is commutative if the two functions A p ( X , Y ) × A q ( X (cid:48) , Y (cid:48) ) → A pq ( X ⊗ X (cid:48) , Y ⊗ Y (cid:48) ) defined using left and right strength are equal.When a graded arrow is commutative we obtain a canonical parallel composition of morphisms thatcommutes with sequential composition. Note that the composition of parameters is the same as in thesequential case, forced by an Eckmann-Hilton style argument.We now use graded arrows to reconstuct Fam ( A ) . The first step is this proposition, which followsbecause the graded arrow is constructed pointwise. Proposition 26.
Let ( P , i , · ) be a symmetric monoidal subcategory of ( Set , , × ) , and let A : StrProf ( C ) be an arrow. Then ( − → A ) p ( X , Y ) = p → A ( X , Y ) is a P op -graded arrow. If A is commutative, then sois − → A. The second step in the
Fam ( A ) construction is the following result, which shows that there is a generalway of “summing out” the grading of a graded arrow to recover an (ungraded) arrow. Proposition 27.
For every graded arrow A : P → StrProf ( C ) , ( colim A )( X , Y ) = colim p A p ( X , Y ) isan arrow. If A is commutative, then so is colim A.Proof. colim A is certainly a profunctor, so it remains to construct the monoid operations. The unit isdefined by the composite Hom C ( X , Y ) pure i → A i ( X , Y ) ι → colim p A p ( X , Y ) , where ι is the injection into thecolimit. Composition is defined using colimits commuting with products in Set : ( colim p F p ( X , Y )) × ( colim q F q ( Y , Z )) ∼ = colim p , q ( F p ( X , Y ) × F q ( Y , Z )) colim >>> p , q −→ colim p , q F pq ( X , Z ) → colim r F r ( X , Z ) . Strengthis defined as colim p F p ( X , Y ) colimst −→ colim p F p ( X ⊗ Z , Y ⊗ Z ) . Each of the axioms follows from the corre-sponding axiom for the graded arrow A .Thus we have decomposed the Fam ( A ) construction into colim ( − → A ) , using the intermediateconcept of graded arrow. We will also use this technology in Proposition 30 to prove that optics form anarrow, as well as in Section 6 to introduce other indexing operators besides Fam . For variations such asbest-response games and probabilistic games, we need to introduce a graded version of bimodules:
Definition 28 (Graded bimodule) . Let A : P → StrProf ( C ) be a graded arrow. A graded A-bimodule is afunctor B : P → Prof ( C ) equipped with natural transformations (cid:96) pq : A p • B q → B pq and r pq : B p • A q → B pq natural in p and q , satisfying the bimodule axioms:1. (cid:96) is a left action,2. r is a right action,3. (cid:96) commutes with r .When B : P → StrProf ( C ) , we moreover require (cid:96) pq and r pq to be strong natural transformations. Asin Section 4.1, we can define the notion of a commutative graded bimodule; and when each B p has a ( × , ) -monoid structure, we require that (cid:96) and r should preserve it.The following theorem is the graded generalisation of Theorem 20.08 Compositional Game Theory, Compositionally
Theorem 29.
Assume A : P → StrProf ( C ) is a commutative graded arrow, and B : P → StrProf ( C ) is a commutative graded A-bimodule, such that B p is a commutative ( × , ) -monoid for every p. ThenA × B : P → StrProf ( C ) is a commutative graded arrow.Proof. The proof is very similar to the proof of Theorem 20.
In this section, we use graded arrows and bimodules compositionally define open games starting from amonoidal category, so as to treat open games containing computational effects via the Kleisli category.We fundamentally achieve the same result as [4], but we do so in a compositonal manner. Lenses onlydefine a monoidal category when the underlying category is cartesian. In a monoidal category we workwith optics [22, 5, 23, 3] instead:
Proposition 30.
Let C be symmetric monoidal, and A : Prof ( C ) a commutative arrow. Then the profunc-tor Optic A : Prof ( C × C op ) defined by Optic A (( X , S ) , ( Y , R )) = (cid:90) P ∈ C A ( X , P ⊗ Y ) × A ( P ⊗ R , S ) is also a commutative arrow.Proof. By Proposition 27, and using that coends can be reduced to colimits using the twisted arrowcategory Tw ( C op ) op (with objects arrows f : P (cid:48) → P in C ) [21, Remark 1.2.3], it is enough to show thatthe assignment Optic Tw A : Tw ( C op ) op → StrProf ( C × C op ) given by Optic Tw A ( P f ←− P (cid:48) , ( X , S ) , ( Y , R )) = A ( X , P (cid:48) ⊗ Y ) × A ( P ⊗ R , S ) is a commutative graded arrow, which follows from A being a commutative arrow and C being symmetricmonoidal.This compositional proof has factored out the coend calculations involved into a separate statementabout graded arrows. We expect many other monoidal categories defined in similar ways, e.g. combs [25],can be proved monoidal using graded arrows to similarly avoid coend manipulation. Next, we follow Bolt,Hedges and Zahn [4, §3.4] in generalising the type of the equilibrium function as needed when workingin a monoidal setting. Definition 31.
Let A : Prof ( C ) be an arrow, and M a monoid. We define the context and equilibrium type profunctors Ctxt C A , Equib C M ( A ) : Prof ( C ) by Ctxt C A ( X , Y ) = Optic A (( I , I ) , ( Y , X )) Equib C M ( A )( X , Y ) = Ctxt C A ( Y , X ) → M We now prove the optics analogue of Lemma 22:
Lemma 32.
Let A : Prof ( C ) be a commutative arrow. Then Ctxt C A is a context, i.e. a commutativeA-bimodule coherently equipped with a costrength.Proof. The left costrength is given by the Θ -indexed family of maps ( cst (cid:48) Z ) Θ = ι Θ ⊗ Z . The actionsare defined using composition and the strength of A , e.g. for the left action A ( X , Y ) × Ctxt C A ( Y , Z ) → Ctxt C A ( X , Z ) : . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg A ( X , Y ) × Ctxt C A ( Y , Z ) ∼ = (cid:82) P A ( I , P ⊗ Z ) × A ( X , Y ) × A ( P ⊗ Y , I ) (cid:82) P A ( I , P ⊗ Z ) × A ( P ⊗ X , P ⊗ Y ) × A ( P ⊗ Y , I ) Ctxt C A ( X , Z ) (cid:82) P ( id × st (cid:48) P × id ) (cid:82) P ( id × >>> ) One can then check that all the required laws of a bimodule with costrength are satisfied.Applying Theorem 20 together with Theorem 23, we thus immediately get the optics analogue ofProposition 15, but this time we do not need the assumption of projection at points:
Proposition 33.
Let A : Prof ( C ) be a commutative arrow and M a monoid. The profunctor A × Equib C M ( A ) : Prof ( C ) defined by ( A × Equib C M ( A ))( X , Y ) : = A ( X , Y ) × Equib C M ( A )( X , Y ) is a commutative arrow. To parameterise by strategies, we use graded arrows from Section 4.2. By Proposition 26 andProposition 27, when A is an arrow, Fam ( A ) = colim ( − → A ) is an arrow. Composing the steps, we getthe following theorem. By using the abstract framework in the previous section, the proofs are muchshorter. Theorem 34.
Let C be a symmetric monoidal category and M a monoid. There is a symmetric monoidalcategory Op C = Fam ( Optic
Hom C × Equib C M ( Optic
Hom C )) of open games in C , and an embedding C × C op → Op C . We demonstrate the power of our framework by showing how a host of variations of open games can beeasily proven to form monoidal categories.
Example 35 (Fibred Open games) . Lets say we want to add a little bit of type dependency so coutilitycan depend on state and utility on the moved played. Type dependency is modelled fibrationally [19], e.g.via the families fibration, which is split. Given a (split) fibration p : E → B , define the monoidal categoryof fibrational lenses Lens p to have the same objects as E , and with morphisms from E to E (cid:48) given by pairs ( f , g ) , where f : pE → pE (cid:48) is a morphism in B and g : f ∗ E (cid:48) → E is a morphism in E . If p is a symmetricmonoidal fibration [26] then Lens p is a commutative arrow. Defining Fam and ( − × Equib C M ( − )) asin Section 5, we hence get an arrow Fam ( Lens p × Equib C M ( Lens p )) of fibrational open games. Thissubsumes the use of container morphisms [1] as dependently typed open games. The point of this exampleis not that this is necessarily the right way to do dependent games — clearly a lot more dependency ispossible — but rather to show how new variants of open games can easily be shown monoidal in ourcompositional framework. Example 36 (Best Response) . Using graded bimodules (Definition 28) and Theorem 29, we can recover best response games [12, §2.1.5]. In these games, the equilibrium predicate is a relation on strategies incontext, expressed as a graded bimodule w.r.t. the graded arrow A J : = J → A , for a given arrow A .BestResp J ( X , Y ) = Ctxt C A ( Y , X ) → J × J → Bool10
Compositional Game Theory, Compositionally
The left action, of type A J ( X , Y ) × BestResp J (cid:48) ( Y , Z ) → BestResp J × J (cid:48) ( X , Z ) , can be defined as follows.Given a context c ∈ Ctxt C A ( Z , X ) and a strategy j ∈ J , we can use the right action of the context (which isan A -bimodule) to get a context c (cid:48) ∈ Ctxt C A ( Z , Y ) . Thus, given four parameters ( j , j (cid:48) , j , j (cid:48) ) , we use j tocreate a new context and feed it to BestResp J (cid:48) ( Y , Z ) together with ( j (cid:48) , j (cid:48) ) to obtain a boolean. Note that j is discarded, which is also what happens when we define the sequential composition of best responsegames. Best response games are then defined as colim J (cid:0) ( J → Lens ( X , Y )) × BestResp J ( X , Y ) (cid:1) , whichautomatically gives a symmetric monoidal category by Theorem 29 and Proposition 7. Example 37 (Probabilistic games) . Surprisingly, Probabilistic Open Games [11] can be recovered usinga construction similar to the one of Example 36. The main difference is that the graded bimodule is nowindexed by D ( J ) , where D is the finite distribution monad. However, for it to work properly, we need tomake some assumptions on C and A .For base category, we take C = Set × ( D - Alg ) op , where D - Alg is the category of algebras forthe monad D . There is a forgetful functor U : Set × ( D - Alg ) op → Set × Set op to the “usual” basecategory Set × Set op , obtained by sending an algebra to its carrier set. Over this category, the profunctor Lens ( U − , U − ) = Lens ◦ ( U op × U ) can easily be seen to be a commutative arrow (because Lens is), andthus by Proposition 26, A J ( X , Y ) = J → Lens ( U ( X ) , U ( Y ) is a Set iso -graded arrow. With these choicesof C and A , the graded A -bimodule for probabilistic equilibria selection is:ProbEquib J ( X , Y ) = Ctxt C Lens ( U ( Y ) , U ( X )) → D ( J ) → BoolTo match Definition 12 in [11], the left and right actions are defined quite differently: while the leftaction relies on the so-called
Kleisli predicate lifting D [11, Def. 11], the right action uses the D -algebrastructure to compute the expectation of the payoff.Finally, we define Op Prob = colim J (cid:0) A J ( X , Y ) × ProbEquib J ( X , Y ) (cid:1) , which again automatically yieldsa symmetric monoidal category by our results. This links nicely to the definition of the equilibriumfor sequential composition of probabilistic open games [11, Def. 12]: the definition in loc.cit. uses aconjunction whose conjuncts correspond to the left and right bimodule actions, respectively. This matchesthe arrow composition of Op Prob given by Theorem 29 (cf. proof of Theorem 20).So far all examples have had sets of strategies. Its not surprising this does not have to be the case andthere are other options. Our framework means this can be handled compositionally.
Example 38 (Strategies need not be Sets) . Consider the parametrisation functor
Para : Prof ( C ) → Prof ( C ) defined by ( Para A )( X , Y ) = colim J : C iso A ( J ⊗ X , Y ) [7, 8]. By our theorem on colimits of gradedarrows, Para maps commutative arrows to commutative arrows and hence could replace
Fam . Moregenerally, given F : B × C → C , we define ( Para F A )( X , Y ) = colim J : B iso A ( F ( J , X ) , Y ) . Again Para F maps commutative arrows to commutative arrows, and can hence be used to construct open games Para F ( Lens × Equib C M ( Lens )) with strategies living in a different category than the play/coplay function. Example 39 (Learners) . If we take the category of lenses, omit the equilibria (or, equivalently, takeequilibria valued in the trivial monoid), and use the
Para construction above, we get Fong, Spivak andTuyéras’ monoidal category of learners [7]. That is, defining
Learn = Para ( Lens ) makes learners aninstance of our framework. Example 40 (Effectful coplay and utility functions) . Let C be a symmetric monoidal category. InSection 5, we used optics to define an arrow on C × C op , but the coend machinery used in its def-inition is quite heavy, e.g. one might worry about the existence of the coends. An alternative con-struction (folklore according to [27, §2.2]), instead defines an arrow on Comon ( C ) × C op , where Comon ( C ) is the category of commutative comonoids in C . The underlying profunctor is defined . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg Lens C (( X , S ) , ( Y , R )) = Hom
Comon ( C ) ( X , Y ) × Hom C ( X ⊗ R , S ) , i.e. the same as for ordinary lenses,except that the play functions must respect the comonoid structure. In particular, If C is a Kleisli categoryfor a commutative monad on a cartesian category, then every object has a natural comonoid structure.Further, in this case Lens C has projections at points, and so we can use Lemma 22 and Theorems 20and 23 to equip it with a notion of equilibrium function Lens C × E ( Lens C ) . In the resulting notion ofgames Fam ( Lens C × E ( Lens C )) , comonoid homomorphisms are intuitively ‘pure’ maps, so this notion ofgame allows ‘effectful‘ coplay and utility functions, while the play function and the state in the equlibriumpredicate remain pure. We have developed a new framework for open games. Conceptually, our framework is not just anaxiomatisation of open games, but a compositional framework allowing us to vary and reorder componentswithout having to redevelop the whole theory of the resulting open games. This is achieved using standardmathematical structures: arrows, bimodules and gradings. These structures allow us to define new arrowsfrom old which is the hallmark of compositionality. Collectively, we demonstrate the utility of thisframework by showing how a number of existing and new variants of open games can be shown to formmonoidal categories with relative ease. This is important as the monoidal structure reflects the paralleland sequential composition of open games.As is becoming clear, there is a huge variety of open games each with their pros and cons and each ofwhich makes sense to use in some circumstances. We must now work to determine which of the categoriesof Open Games we have constructed are useful for Compositional Game Theory. To do this, we will needto gain experience in modelling game theoretic concepts in our categories, and to observe how modifyingthe constructions using the building blocks we have developed here affects the game theoretic models. Wewill be aided in this investigation by studying embeddings between the various categories of Open Games.We have built tools to prove that categories are symmetric monoidal. However, there are otheroperators on games beyond parallel and sequential composition, e.g. an operator for repeated games isneeded. A start is given by [10], but we want to integrate such operators into our general compositionalframework.All our profunctors have been of the form C op × C → Set but we could replace
Set by some othercocomplete monoidal category with (we conjecture) minimal disruption. This would give us an enrichedtheory of open games which will be important for the investigation of topological games, with notions oflimit games.Finally, it will be interesting to see if this framework has ramifications for software for open games byproviding all the benefits compositionality does. That is, rather than implementing a specific notion ofopen games and expecting users to use that notion, our compositional framework would allow users tobuild their own notion of open games suitable for their own needs (mixing both predefined componentssuch as for example
Fam or Para with their own specific definitions). The fact that we have usedcanonical categorical structures such as profunctors, modules and gradings means the road to a Haskellimplementation should be a pleasant road to engage with. We hope to make it so as a matter of priority.
Acknowledgements.
The authors would like to thank Exequiel Rivas and Jules Hedges for helpfuldiscussions and comments.12
Compositional Game Theory, Compositionally
References [1] Michael Gordon Abbott, Thorsten Altenkirch & Neil Ghani (2003):
Categories of Containers . In Andrew D.Gordon, editor:
Foundations of Software Science and Computational Structures (FOSSACS 2003) , LectureNotes in Computer Science
What is a Categorical Model of Arrows?
Electron. Notes Theor. Comput. Sci.
What You Needa Know about Yoneda: Profunctor Optics andthe Yoneda Lemma (Functional Pearl) . Proc. ACM Program. Lang.
Bayesian open games . arXiv:1910.03656.[5] Bryce Clarke, Derek Elkins, Jeremy Gibbons, Fosco Loregiàn, Bartosz Milewski, Emily Pillmore & MarioRomán (2020):
Profunctor optics, a categorical update . arXiv:2001.07488.[6] David Dalrymple (2019):
Dioptics: a Common Generalization of Open Games and Gradient-Based Learners .In:
Fifth Symposium on Compositional Structures (SYCO 5) .[7] Brendan Fong, David I. Spivak & Rémy Tuyéras (2019):
Backprop as Functor: A compositional perspective onsupervised learning . In:
Logic in Computer Science (LICS 2019) , pp. 1–13, doi:10.1109/LICS.2019.8785665.[8] Bruno Gavranovi´c (2019):
Compositional Deep Learning . Master’s thesis, University of Zagreb. Available atarXiv:1907.08292.[9] Neil Ghani, Jules Hedges, Viktor Winschel & Philipp Zahn (2018):
Compositional Game Theory .In Anuj Dawar & Erich Grädel, editors:
Logic in Computer Science (LICS 2018) , pp. 472–481,doi:10.1145/3209108.3209165.[10] Neil Ghani, Clemens Kupke, Alasdair Lambert & Fredrik Nordvall Forsberg (2018):
A compositional treatmentof iterated open games . Theor. Comput. Sci.
Compositional GameTheory with Mixed Strategies: Probabilistic Open Games Using a Distributive Law . In:
Applied CategoryTheory (ACT 2019) .[12] Jules Hedges (2016):
Towards compositional game theory . Ph.D. thesis, Queen Mary University of London.[13] Jules Hedges (2018):
Morphisms of Open Games . In Sam Staton, editor:
Mathematical Foundations ofProgramming Semantics (MFPS 2018) , Electronic Notes in Theoretical Computer Science
The game semantics of game theory . arXiv:1904.11287.[15] Jules Hedges (2020):
Open games in Haskell . Repository at https://github.com/jules-hedges/open-games-hs .[16] Chris Heunen & Bart Jacobs (2006):
Arrows, like Monads, are Monoids . In:
Mathematical Foundations ofProgramming Semantics (MFPS 2006) , Electronic Notes in Theoretical Computer Science
Generalising monads to arrows . Science of Computer Programming
A linear category of polynomial diagrams . Mathematical Structures in ComputerScience
Categorical Logic and Type Theory . Studies in Logic and the Foundations of Mathematics
Parametric effect monads and semantics of effect systems . In:
Proceedings ofthe 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages , pp. 633–645,doi:10.1145/2578855.2535846.[21] Fosco Loregian (2019):
Coend calculus . arXiv:1501.02503. . Atkey, B. Gavranovi´c, N. Ghani, C. Kupke, J. Ledent & F. Nordvall Forsberg [22] Craig Pastro & Ross Street (2008):
Doubles for monoidal categories . Theory and Applications of Categories
Categories of Optics . arXiv:1809.00738.[24] Exequiel Rivas & Mauro Jaskelioff (2017):
Notions of computation as monoids . J. Funct. Program.
27, p. e21,doi:10.1017/S0956796817000132.[25] Mario Román (2020):
Comb Diagrams for Discrete-Time Feedback . arXiv:2003.06214.[26] Michael Shulman (2008):
Framed bicategories and monoidal fibrations . Theory and applications of categories
Generalized Lens Categories via functors Cop → Cat . arXiv:1908.02202. Compositional Game Theory, Compositionally
A Definition of a bimodule with costrength
For the sake of completeness, we spell in full details the definition of a costrength, and of a bimoduleequipped with a costrength (used to define the notion of context, Definition 21).
Definition 41 (Costrength) . A (right) costrength for a profunctor F : C −(cid:55)→ C is a family of morphismscst X , Y , Z : F ( X ⊗ Z , Y ⊗ Z ) → F ( X , Y ) (natural in X , Y and dinatural in Z ) making two diagrams commute: F (( X ⊗ Z ) ⊗ Z (cid:48) , ( Y ⊗ Z ) ⊗ Z (cid:48) ) F ( X ⊗ Z , Y ⊗ Z ) F ( X ⊗ ( Z ⊗ Z (cid:48) ) , Y ⊗ ( Z ⊗ Z (cid:48) )) F ( X , Y ) cst Z (cid:48) F ( α − , α ) cst Z cst Z ⊗ Z (cid:48) and F ( X ⊗ I , Y ⊗ I ) F ( X , Y ) cst I F ( ρ − , ρ ) Given a profunctor F : C −(cid:55)→ C with a right costrength, assuming C is symmetric, we can define the leftcostrength cst (cid:48) X , Y , Z : F ( Z ⊗ X , Z ⊗ Y ) → F ( X , Y ) by cst (cid:48) : = cst ◦ F ( σ , σ ) .When an A -bimodule has a strength, the two actions (cid:96) and r are required to be strong naturaltransformations. When it has a costrength, we require similar conditions: Definition 42 (Bimodule with costrength) . Let A : C −(cid:55)→ C be an arrow. When an A -bimodule B : C −(cid:55)→ C is equipped with a costrength, we also require the two commutative diagrams below, relating the strengthof A , costrength of B and the left and right actions (cid:96) and r : A ( X ⊗ W , Y ⊗ W ) × B ( Y ⊗ W , Z ⊗ W ) B ( X ⊗ W , Z ⊗ W ) A ( X , Y ) × B ( Y ⊗ W , Z ⊗ W ) A ( X , Y ) × B ( Y , Z ) B ( X , Z ) (cid:96) cst W st W × idid × cst W (cid:96) and B ( X ⊗ W , Y ⊗ W ) × A ( Y ⊗ W , Z ⊗ W ) B ( X ⊗ W , Z ⊗ W ) B ( X ⊗ W , Y ⊗ W ) × A ( Y , Z ) B ( X , Y ) × A ( Y , Z ) B ( X , Z ) r cst W id × st W cst W × id r Finally, we also have a counterpart of the commutativity condition, mixing strength and costrength.
Definition 43 (Commutative bimodule with costrength) . An A -bimodule B with a costrength is commuta-tive when the following diagram commutes: A ( X , Y ) × B ( Y ⊗ X (cid:48) , X ⊗ Y (cid:48) ) B ( Y ⊗ X (cid:48) , X ⊗ Y (cid:48) ) × A ( X , Y ) A ( X ⊗ X (cid:48) , Y ⊗ X (cid:48) ) × B ( Y ⊗ X (cid:48) , X ⊗ Y (cid:48) ) B ( Y ⊗ X (cid:48) , X ⊗ Y (cid:48) ) × A ( X ⊗ Y (cid:48) , Y ⊗ Y (cid:48) ) B ( X ⊗ X (cid:48) , X ⊗ Y (cid:48) ) B ( Y ⊗ X (cid:48) , Y ⊗ Y (cid:48) ) B ( X (cid:48) , Y (cid:48) ) ∼ = st X (cid:48) × id id × st Y (cid:48) (cid:96) r cst (cid:48) X cst (cid:48)(cid:48)