Morphisms of open games

We define a notion of morphisms between open games, exploiting a surprising connection between lenses in computer science and compositional game theory. This extends the more intuitively obvious definition of globular morphisms as mappings between strategy profiles that preserve best responses, and hence in particular preserve Nash equilibria. We construct a symmetric monoidal double category in which the horizontal 1-cells are open games, vertical 1-morphisms are lenses, and 2-cells are morphisms of open games. States (morphisms out of the monoidal unit) in the vertical category give a flexible solution concept that includes both Nash and subgame perfect equilibria. Products in the vertical category give an external choice operator that is reminiscent of products in game semantics, and is useful in practical examples. We illustrate the above two features with a simple worked example from microeconomics, the market entry game.


I. INTRODUCTION
Open games provide a foundation to (economic) game theory that is strongly compositional. In general open games are fragments of games that can be composed either sequentially or in parallel. Key to this is the step of viewing open open games as the morphisms of a symmetric monoidal category. (This is an instance of the more general research programme of categorical open systems [5]. ) However, there are reasons that one might also wish to view open games as the objects of a category. Most obviously, we would like to characterise certain open games using universal properties, in order to reason about them in a more abstract way. In this paper we define a general notion of morphisms between open games, which we call contravariant lens morphisms. This heavily makes use of the factorisation of open games in terms of polymorphic lenses introduced in [9].
We prove that open games and contravariant lens morphisms form a symmetric monoidal pseudo double category [17], the expected structure of 2-cells between arbitrary morphisms in a symmetric monoidal category. Open games and globular morphisms (morphisms between open games of the same type) moreover form a symmetric monoidal bicategory, however we argue by example that the more general double-categorical structure is useful.
There are many possible inequivalent ways to define morphisms between open games, and we argue in favour of contravariant lens morphisms in particular by identifying two attractive properties. Firstly states of open games, that is morphisms out of the monoidal unit open game, provide a fully compositional solution concept that subsumes both Nash and subgame perfect equilibria in a flexible way. Secondly, categorical products of open games correspond to an external choice operator that is highly reminiscent of products in game semantics, and is useful in practical examples. This paper culminates in a worked example that illustrates both of these aspects, in which we describe the market entry game, a simple but important example of game theory as applied to microeconomics.
An alternative definition of morphisms between open games is given in [7], in order to characterise repeated games as final coalgebras of a functor prepending one additional stage. Contravariant lens morphisms are inferior for this purpose, but on the other hand, the two attractive properties of contravariant lens morphisms identified are not shared by the morphisms of [7]. This suggests that there is no single, canonical notion of morphisms between open games, but at least two with different useful properties. It is expected, however, that all 'reasonable' definitions of morphisms between open games will form a symmetric monoidal double category, and will agree on globular morphisms.

II. NORMAL-FORM AND EXTENSIVE-FORM GAMES
In this section we recall some basic definitions and results of game theory, which can be found in any standard textbook, such as [6]. Definition 1. An n-player normal form game consists of the following data: • A sequence of sets X 1 , . . . , X n of choices for each player • A payoff function k : giving a real-valued payoff for each player given choices by each player A (pure) strategy for player i in a normal form game is simply a choice σ i : X i , and a (pure) strategy profile σ : n i=1 X i is a choice of strategy for each player.
The adjective 'pure' means 'deterministic', in contrast with 'mixed' or probabilistic strategies. The equivalence of strategies and choices characterises a normal form game as both deterministic and simultaneous: in the probabilistic setting a strategy is a probability distribution over choices, and in a dynamic (sequential) game a strategy is a function from observations to choices.
Given a tuple x : n i=1 X i , we write x i : X i for the ith projection, x −i : X j for the modification of x with ith component x ′ i : X i . (This notation is slightly imprecise, but is both useful and standard in game theory.) Definition 2. Given a normal form game ((X i ) n i=1 , q), let Σ = n i=1 X i be its set of strategy profiles. We define the best response relation B ⊆ Σ × Σ by (σ, σ ′ ) ∈ B iff for all players 1 ≤ i ≤ n and all x i : X i , A pure strategy profile is called a (pure) Nash equilibrium if it is a fixpoint of the best response relation, that is, if (σ, σ) ∈ B.
Equivalently, σ is a Nash equilibrium iff for all players 1 ≤ i ≤ n and all unilateral deviations In words, a Nash equilibrium is a strategy profile in which no player can strictly increase their payoff by unilaterally deviating to another pure strategy. ('Unilateral' means that the strategy profiles of all other players remain fixed.) Definition 3. An n-player game extensive form game is a tree where • Each non-leaf node is labelled by a player, who makes the decision at that node • Each leaf node is labelled by an n-tuple of real payoffs • Each edge is labelled by an action, such that no two outgoing edges of a single node are labelled by the same action • The nodes of the tree are partitioned into information sets An information set is a nonempty subset of nodes such that • Any pair of nodes in the same information set are labelled by the same player • Any pair of nodes in the same information set have the same set of actions labelling their successors A game of perfect information is an extensive form game whose information sets are all singletons.
In section VII we will define a simpler subclass of games of perfect information called sequential games. Definition 4. A strategy for a player i in an extensive-form game is a map that takes each information set x owned by player i, to a choice of action among successors of nodes in x. A strategy profile is a tuple of strategies for each player.
A strategy profile induces a play, which is a path from the root node to a leaf node. Plays are in bijection with leaf nodes, and so each strategy profile determines a payoff for each player.
Definition 5. Each n-player extensive form game induces an n-player normal form game called its normalisation or strategic form as follows. The set of choices for player i in the normalisation is defined to be the set of strategies for that player in the original game. The payoffs k are determined by the play associated to the strategy profile. A Nash equilibrium of an extensive form game is a strategy profile that is a Nash equilibrium of its normalisation. Definition 6. A subgame of an extensive form game G is a subtree H with the property that if x is any node in H, then any node in G in the same information set as x is also in H. The subtree H inherits the structure of an extensive form game from G.
A subgame perfect equilibrium of an extensive form game is a strategy profile that restricts to a Nash equilibrium on every subgame.
(This definition implies that the root node of a subgame must be in a singleton information set.) We will see an example illustrating these definitions in section IX.
The remainder of this section considers a simplified special case of perfect information games, taken from [3], [4].
Definition 7. An n-player sequential game is an extensiveform game of perfect information in which at level i of the tree all choices are made by player i, and in which any two nodes at the same level have the same set of actions available.
The second condition implies that the tree of a sequential game is balanced. An n-player sequential game is equivalently defined by sets X 1 , . . . , X n of actions, and a payoff function k : Subgames are in bijection with partial plays x 1 , . . . , x i−1 for 1 ≤ i ≤ n. A strategy for player i is a function and a strategy profile is a tuple σ : be a sequence of sets for n ≥ 1.
With this notation, a strategy profile σ of a sequential game is a Nash equilibrium iff ,xi i for all players 1 ≤ i ≤ n and deviations x i : X i . It is a subgame-perfect equilibrium iff for all players 1 ≤ i ≤ n, all subgames x 1 , . . . , x i−1 and all deviations x i :

III. THE CATEGORY OF LENSES
In this section we recall and extend ideas from [9] on lenses.
We refer to such a pair (X, S) as a diset. We write Φ, Ψ, Θ to refer to disets. This is not really a formal notion, but it carries a connotation that X should be thought of 'covariantly' and S 'contravariantly'. (To say of a category C that its objects are disets is really to say that there is an identity-on-objects functor Set × Set op → C.) This definition of lens is called concrete lenses in [15], and is essentially polymorphic lenses in the absence of a polymorphic typesystem. The relationship between this and the more familiar monomorphic lenses is discussed in [9]. Proposition 1. There is a category Lens whose objects are disets and whose morphisms are lenses. The identity lens (X, S) → (X, S) consists of the identity function X → X and the right projection X × S → S. The composition of λ : (X, S) → (Y, R) and µ : Proof. Routine.
Proof. See appendix.
For each set X there is a left-multiplication comonad (X×) : Set → Set. The co-kleisli category of this comonad has objects sets and morphisms where the maps are given by f * (u)(x, r) = u(f (x), r). Thus we have a pseudofunctor co-kl(−×) : Set op → Cat.
is the opposite functor of that given above.
Proof. See appendix.
The simple fibration s(Set) → Set is a fibration that plays a central role in the categorical semantics of simple type theory [10, section 1.3]. The category s(Set) has as objects pairs of sets, and as morphisms (X, S) → (Y, R) pairs of functions X → Y and X × S → R. Proposition 4. V is the fibrewise opposite of the simple fibration s(Set) → Set.
Proof. The fibre of s(Set) over X is the kleisli category co-kl(X×) [10, exercise 1.3.4]. Proving this is essentially the same as the above proof.
Note that this functor is 'almost' faithful, but there are counterexamples involving the empty set. For example, take the unique function f : 0 → 1 and the two functions g 1 = g 2 : 1 → 2 = {L, R}. Then there is an equality of lenses (f, g 1 ) = (f, g 2 ) : (0, 2) → I. In [9] the category of nonempty sets is identified with a subcategory of the category of lenses based on nonempty sets.
Next, we define a symmetric monoidal structure of Lens.
Proof. Instead of proving the Mac Lane axioms directly, we show that this monoidal structure results from a simpler symmetric monoidal structure on the fibres V −1 (X), by the Grothendieck construction for symmetric monoidal categories [16, theorem 12.7]. co-kl(X) has finite products, given by cartesian products of sets. Consequently, cartesian products of sets give coproducts in co-kl(X×) op . The reindexing functors (f * ) op : co-kl(Y ×) op → co-kl(X×) op are identity-on-objects, and so preserve finite coproducts. This means in particular that the fibres V −1 (X) are symmetric monoidal and the reindexing functors are strong monoidal, and the base category Set is cartesian monoidal, and so the Grothendieck construction can be applied.

Proof. Routine.
Definition 11. The context functor C : Although we could see C as a profunctor Lens → Lens, this will not be a helpful point of view. Proof. Routine.
We summarise this by the slogan that in the category of lenses, states (morphisms from I) are points, and effects (morphisms to I) are continuations.
For convenience, we will immediately redefine V and K to be equal to these hom-functors, so that we can write their action on lenses in terms of lens composition.
Definition 12. Let Φ, Ψ be disets. An open game G : Φ −→ Ψ consists of the following data: We call a pair c = (h, k) : C(Φ, Ψ) a context for G, where h : V(Φ) is the history and k : K(Ψ) the continuation. We also write s(G) = Φ and t(G) = Ψ for the source and target of G.
The equivalence between this definition and the more concrete definition in [8, section 2.1.4] (over the category of sets) is easy to see. If Φ = (X, S) and Ψ = (Y, R) then the family of lenses G(σ) is the same as the play and coplay functions Σ(G) → (X → Y ), Σ(G) → (X × R → S). By the isomorphisms V(Φ) ∼ = X and K(Ψ) ∼ = Y → R, the best response relation can equivalently be written as a function X × (Y → R) → (Σ(G) → P(Σ(G))), where P is powerset.
We note that given a pair of games G, G ′ : Φ −→ Ψ of the same type, there is an obvious way to define morphisms between them.
It is expected that all reasonable definitions of general morphisms between open games will agree on the globular morphisms. However it is demonstrated by example, both in this paper and in [7], that the more general morphisms are necessary. The morphisms we define in this paper are very different to those in [7], but indeed agree on the globular morphisms.
The following definition is the key definition of this paper.
Definition 14. Let G : Φ −→ Ψ and G : Φ ′ −→ Ψ ′ be open games. A contravariant lens morphism α : G → G ′ consists of the following data: satisfying the following two axioms: • For all σ : Σ(G), the following diagram in Lens commutes: We call a pair (h, k) : C(Φ ′ , Ψ) a context for α. We represent a contravariant lens morphism α : G → G ′ as a square anticipating the double category structure.
Having done the work of representing open games in terms of lenses, this definition is almost automatic, but with one crucial twist: the lenses s(α) and t(α) go in the opposite direction to α. If they were covariant then the resulting definition would be similar to that of [7] and have many features in common, including the elegant representation of repeated games. However, we will demonstrate in this paper that the alternative definition has several attractive features. We give the definition the more specific name contravariant lens morphism to distinguish it from alternatives, but since this definition is the subject of this paper, we will simply refer to it as a morphism from now.

Proposition 9. Open games and morphisms form a category
Game v , with identities and composition lifted from Set and Lens.
The symbol Game v is mnemonic for vertical, hinting that this will be the vertical category of our double category. (Note that we follow the orientation convention of [17].) Then globular morphisms G → G ′ as previously defined are equivalent to morphisms α : Proof. Trivial.

Proposition 11.
• s : Game → Lens op is an opfibration whose opcartesian liftings are t-vertical and Σ-vertical • t : Game → Lens op is a fibration whose cartesian liftings are s-vertical and Σ-vertical • Σ : Game → Set is a fibration whose cartesian liftings are s-vertical and t-vertical Proof. See appendix.

Proposition 12.
There is a fibred forgetful functor from the fibration Σ : Game → Set to the family fibration Fam(Lens) → Set, that forgets best response.

V. THE DOUBLE CATEGORY OF OPEN GAMES
A double category [12] is defined as an internal category object in the category of large categories and functors. (Compare that a 2-category is defined as a category enriched over categories.) Equivalently, a 2-category contains four sorts of things: objects, horizontal 1-cells, vertical 1-morphisms, and 2-cells. Given a pair of horizontal 1-cells F : X −→ Y , G : W −→ Z, a 2-cell α : F → G consists of a pair of vertical 1-morphisms f : X → W , g : Y → X between the objects, and a square In this paper we are concerned with pseudo double categories, in which the vertical morphisms form a category, but the horizontal morphisms form a category only up to invertible 2-cells. Hence, there is a category of vertical morphisms and a bicategory of horizontal morphisms.
A standard example of a double category has as objects sets, horizontal 1-cells relations, vertical 1-cells functions and 2-cells inclusion. Another has as objects categories, horizontal 1-cells profunctors, vertical 1-cells functors and 2-cells natural transformations. We will show that there is a double category whose 1-cells are disets, horizontal 1-cells are open games, vertical 1-cells are reversed lenses, and 2-cells are contravariant lens morphisms.
In this paper we mostly follow the notation of [17], which gives an explicit definition of symmetric monoidal pseudo double categories.
In the previous section we noted that the definition of open games in this paper is equivalent to that of [8]. Under this equivalence, the composition H ⊙ G corresponds to the definition H • N G in [8, sections 2.2.3 and 2.2.4], in which the continuation k • H(τ ) of G in the previous definition is referred to as k τ • . This is a primitive form of sequential play, which will be illustrated in practice in the last section of this paper.
Proof. See appendix.
Proof. Each of these morphisms is over the corresponding structure morphism of the cartesian monoidal category Set.
Proposition 17. The above structures form a pseudo double category whose category of objects is Lens op and whose category of morphisms is Game v .
Proof. See appendix.
It follows immediately that open games and globular morphisms form a bicategory. The equivalence relation ∼ on games defined in [8, section 2.2.2] is precisely the relation of globular isomorphism, and the category Game(Set) is precisely the category of horizontal morphisms modulo globular isomorphism.
Then the following diagram commutes: Proof. See appendix.
Proposition 21. There are natural isomorphisms Proof. These are the same as the structure morphisms in the symmetric monoidal category Lens op × Set× Lens op , where Set is cartesian monoidal. It is routine to verify that these still natural isomorphisms in Game v .
Proposition 22. Game v is a symmetric monoidal category.
Note that we cannot immediately apply [17, theorem 5.1] to deduce that the horizontal bicategory is also symmetric monoidal, because the horizontal bicategory is not framed [16]. However, the hypotheses of this theorem appear to be stronger than necessary: all vertical isomorphisms, which includes the structure morphisms of the symmetric monoidal structure, have companions and conjoints. This will not impact us in practice, because we will work directly with the double category rather than the bicategory structure.
A common (and reasonable) complaint has been that little game-theoretic information can be obtained from the string diagram alone. For example, no information about the equilibria of a game can be understood from its string diagram. Thus, despite having a graphical language, in order to answer any nontrivial question about an open game given its diagram it is still necessary to explicitly calculate the denotation, which is tedious and error-prone, and makes compositionality much less useful in practice.
It is expected that a monoidal double category supports a 3-dimensional graphical calculus of surface diagrams. To completely formalise these claims appears to still require a large amount of foundational work, however.
Having obtained a higher-dimensional categorical language that is fully compositional and has the potential to be graphical, the next step is to formalise interesting game-theoretic concepts using this language. This is the subject of the remainder of this paper. The long-term aim towards which we are working is to be able to reason about game-theoretic concepts using nothing but surface diagrams.

VI. STATES OF OPEN GAMES
Definition 20. Let G : Φ −→ Ψ be an open game. A state of G is a pair (σ, k) where σ : Σ(G) and k : K(Ψ) with the property that for all h : V(Φ), (σ, σ) ∈ B G (h, k). We also say that σ is a state of G over k. We write S(G) for the set of states of G.
Informally, a state consists of a choice of continuation and a choice of strategy that is a Nash equilibrium for that continuation, for all histories. As we will see, this combines aspects of Nash and subgame perfect equilibria in a flexible way. The definition of states is a weakening of the definition of solution considered in [8, section 3.3], in which σ may depend on k, but not on h. The latter is more game-theoretically plausible (because many open games have interesting solutions in this sense), but is incompatible with ⊗ and hence not fully compositional. The definition of state is intended as a compromise between game-theoretic usefulness and compositionality.
Proposition 25. Let α : G → G ′ be a morphism of open games, and let σ be a state of G over k. Then Σ(α)(σ) is a state of G ′ over t(α) • k. Thus we have a function S(α) : Since α is a morphism, it follows that Proof. Routine.
Proof. States (σ, k) of G are in bijection with morphisms α : u(I) → G, as follows. There is a unique choice s(α) = k • G(σ) satisfying the first axiom. Since by definition ( * , * ) ∈ B u(I) (c) for all c : C(I, I), and all split contexts for α are of This is summarised in the diagram Noting that u(I) is the monoidal unit of Game v , states of open games are indeed states in the more general sense of monoidal categories. As its name suggests, the previous result is similar to the backward induction method of game theory, although in a far more general form. The intuition is that we first fix the strategy profile τ of H, and then players in G reason as though players in H play τ . Proposition 27. Let G : Φ −→ Ψ be a strategically trivial game. Then for every continuation k : K(Ψ), G has exactly one state over k. In particular, a strategically trivial effect G : Φ −→ I has a unique state.
Proof. The unique morphism is Note that the strategically trivial effects (X, S) −→ I are 'internal continuations', and are in bijection with functions X → S. These include the utility functions of game theory.
Definition 22. For all sets X and Y we define an open game D X,Y : (X, 1) −→ (Y, R) (where R is the set of real numbers, interpreted as utility) called a decision, as follows: Proposition 28. Let X, Y be sets and k : Y → R. Then there is a bijective correspondence between the set of maximising points of k In particular, if Y is finite then D X,Y has at least one state over every k.
for all x : X and y : Y , which is equivalent to the range of σ being arg max(k).
The following theorem and its proof are essentially restatements of [8,  Note that if α 1 is a state of D I,Y1 over k 1 and α 2 is a state of D I,Y2 over k 2 then α 1 ⊗ α 2 is a state of D I,Y1 ⊗ D I,Y2 over k 1 ⊗ k 2 . However, the continuation k 1 ⊗ k 2 corresponds to a function Y 1 × Y 2 → R 2 that is 'separable', in the sense that (k 1 ⊗ k 2 )(y 1 , y 2 ) = (k 1 (y 1 ), k 2 (y 2 )), and hence the ⊗-separable states can only be equilibria of these separable games. Such games are game-theoretically trivial in the sense that there is no strategic interaction between players, and so a game degenerates into a tuple of independent maximisation problems. Only the ⊗-inseparable states of tensor products of decisions correspond to nontrivial Nash equilibria.
Despite the abstractions introduced in this paper the proof of the previous theorem is notably 'manual', and so the reader might be left wondering what the purpose of the abstraction was. The point of this theorem is that it allows us to talk about Nash equilibria purely internally in a categorical structure, which can be combined with the other abstractions we have introduced in order to later reason about Nash equilibria in purely abstract terms.
In the last section we will see both of these points illustrated: a Nash equilibrium of a bimatrix game must be introduced 'atomically' since it cannot be composed from simpler components, but once it has been introduced, it can be further composed using purely categorical methods.

VII. BACKWARD INDUCTION
The previous theorem characterised Nash equilibria of normal form games in terms of states of open games. In this section we do the same to Nash and subgame perfect equilibria of extensive form games of perfect information.
Definition 23. Let n ≥ 1 and let X 1 , . . . , X n be a sequence of sets. We define an open game D ∆ X1,...,Xn : by the string diagram in figure 1, where the black node is the (strategically trivial) copying open game It is routine to check that D ∆ X1,...,Xn is concretely given as follows, up to globular isomorphism. The set of strategy profiles is Given σ : Σ D ∆ X1,...,Xn , the lens D ∆ X1,...,Xn (σ) has v D ∆ X 1 ,...,Xn (σ) : for all x n : X n . We now come to one of the key results of this paper: For an extensive form game, Nash equilibria correspond to states in general, and subgame perfect equilibria correspond to ⊙separable states. Using this, we can use the category-theoretic notion of ⊙-separability (which could moreover be visible in a surface diagram as a glued boundary) to define the gametheoretic notion of subgame perfection for general open games. We state and prove the theorem for the special case of finite sequential games (defined in section II) for simplicity, but we will see an example in section IX that is not in this special case. The previous proof can be equivalently written as a proof by backward induction, which is a proof by finite bar induction on the tree of subgames.
In standard game theory, the representation of a game is typically dissociated from its analysis. On any game of a given class (for example extensive-form games) one can define a variety of solution concepts (for example pure Nash equilibrium, mixed Nash equilibrium, subgame perfect equilibrium, correlated equilibrium, Bayesian Nash equilibrium). A curious fact about open games is that the representation of a model as an open game automatically 'builds in' a particular solution concept, namely pure Nash equilibrium. This is because the ⊙ and ⊗ operators make essential use of Nash-like reasoning, in which the players in each component act as though they know which strategies will be played in the other component.
In particular, it has proven to be difficult to characterise subgame perfect equilibria, despite the fact that the representation of open games appears to be dynamic (that is, has a temporal component; subgame perfect equilibrium is specifically intended for dynamic games). A failed attempt was made in [8] by modifying the operator ⊙, there called • SP , but it fails to form a symmetric monoidal category with ⊗, and hence does not support a string diagram language. (See the conclusion section of [8].

)
A direct solution is given in [7] by defining a 'subgame perfection operator' that modifies an open game's solution concept from Nash to subgame perfect equilibrium. From a practical perspective their solution is similar to the one in this paper, offering flexibility between Nash and subgame perfect equilibrium. Ours has the specific advantage that it separates the representation of a game from its analysis, as in standard game theory.

VIII. LIMITS AND COLIMITS OF LENSES
We will begin, for completeness of presentation, by considering limits of lenses. However, we will not use them in this paper.
Let V, K : Lens → Set × Set op be the universal morphism More generally, since (X×) : Set → Set preserves colimits, co-kl(X×) has all limits, and so the fibres V −1 (X) ∼ = co-kl(X×) op have all limits. Moreover, we can show that the reindexing functors f * : V −1 (Y ) → V −1 (X) preserve limits. We can then apply [10, exercise 9.2.4] to deduce that Lens has all limits and V preserves them.
As an application of this, since Lens has pullbacks we can define a category of symmetric lenses as spans in Lens. This contrasts with monomorphic lenses, in which pullbacks do not exist in general unless the put-get law is imposed [11]. This can be used to give a definition of symmetric lawless lenses. It may be possible to apply this to develop a more symmetrical theory of open games, where the horizontal category Game is generalised from teleological [9] to †-compact closed.
The simplest example of this is that any two objects over 0 in Lens are uniquely isomorphic, and every object over 0 is initial.
Next we come to colimits. For each set S, let F S : Lens → Set be the functor given on objects by Since (−, S) is a left adjoint, it preserves colimits. In particular, Lens has coproducts of the form The projections π j : i:I G i → G j are given by Proof. See appendix.
The product G 1 × G 2 is an external choice, in which the decision of whether G 1 or G 2 is played is determined by the history. This is strongly reminiscent of products in categories in game semantics [1] and additive conjunction in linear logic. In particular, it is typical of products in game semantics that strategies compose by cartesian product, and plays compose by disjoint union. This analogy suggests the following correspondence between game semantics and compositional game theory: The player of game semantics corresponds to the n ≥ 0 noncooperative players in an open game, and the opponent of game semantics corresponds to the context (h, k).

IX. EXAMPLE: MARKET ENTRY GAME
We illustrate the previous three sections by considering the market entry game, a standard example of game theory in microeconomics [14, example 9.B.3]. This game is played between two players: a prospective entrant E into a market, and an incumbent I in that market. In the first stage, E has the choice to either enter the market, or immediately quit. If E chooses to quit the game ends immediately. If E chooses to enter, in the second stage E and I simultaneously choose The extensive form representation is depicted in figure 2. The dotted line denotes that the two connected nodes share an information set, meaning that the firm I does not know which of the two nodes they are in; in this way, the right hand subtree represents a simultaneous game. (More precisely, the word 'simultaneous' means the choices are made independently, but the physical timing might or might not be simultaneous.) The feature of this game that is specifically awkward for approaches based on theoretical computer science is that the extensive-form tree is unbalanced. Other approaches use dependent types to allow types of choices to dependent on earlier values, but can still only allow more general 'dependent subgames' such as in the market entry game using encoding tricks such as dummy moves, and using large negative utilities to rule out certain plays. (Examples of game theory developed in a dependent type system include [13], [2].) An external choice operator solves the more general problem of dependent subgames in an elegant way.
We represent the market entry game as an open game as follows. The decision of the first player (corresponding to the root node in figure 2) is modelled as a utility-maximising decision D 1,1+1 : where the choice ι 1 ( * ) represents not entering the market, and ι 2 ( * ) represents entering the market. The left subgame is represented by By the coherence theorem for teleological categories [9] this diagram defines G up to (in general non-globular) isomorphism. Algebraically, in the terminology of this paper it is given by Concretely, G is given as follows: i.e. the utility for player E given strategy profile σ for the subgame where − : X → X gives the other choice, i.e. B G ( * , * ) is the best response function for the right simultaneous game The right subgame has a unique Nash equilibrium (A, A) in which both players accommodate. Hence G has a unique state α 2 with Σ(α)( * ) = (A, A), in which the lens s(α 2 ) : (1, R) → I has u s(α2) ( * , * ) = 3. This is the payoff U (A, A) 1 for player E in the Nash equilibrium.
Since the previous function has a single maximising point, namely ι 2 ( * ), by proposition 28 the decision D 1,1+1 has a unique state α over λ. This state has Σ(α)( * ) : 1 → will be our representation of the original market entry game. It is concretely given, up to globular isomorphism, as follows. The set of strategy profiles is consisting of a strategy for E in the first round, and a strategy for both players in the subgame in which E enters in the first round. This is the same as the set of pure strategy profiles of the original extensive-form game. (As in classical game theory, player E is required to choose a contingent strategy for the second round, even if the strategy in the first round is to quit.) H can be straightforwardly made into a scalar I −→ I by postcomposing with the (unique) strategically trivial game The best response relation B H ( * , k) is the same as the best response relation for the market entry game given by classical game theory. Concretely, the relation (σ, σ ′ ) ∈ B H ( * , k) holds iff the following three conditions hold: By the previous reasoning H has a unique ⊙-separable state, namely α = α L , α R ⊙ α 1 . This corresponds to the unique subgame perfect equilibrium of the market entry game, namely that the entrant enters the market (choice C or ι 2 ( * )), and then both players accommodate (choice A). H has two additional states that are not ⊙-separable, corresponding to the nonsubgame-perfect Nash equilibria of the market entry game (or, equivalently, to the two additional fixpoints of B H ( * , k)). One of these chooses the strategy profile (ι 1 ( * ), A, F ), the other, (ι 1 ( * ), F, F ).

Proof (proposition 2). It is trivial that V is a functor.
We define the following cleavage for V. Given a function f : X → Y we define f * (Y, R) = (X, R). The cartesian lifting f (Y, R) : (X, R) → (Y, R) is the lens defined by v f (Y,R) = f and u f (Y,R) (x, r) = r.
To show that f (Y, R) is indeed cartesian, let λ : (W, T ) → (Y, R) be a lens such that v λ = f • g for some function g : W → X. Define another lens µ : (W, T ) → (X, S) by v µ = g and u µ = u λ . Then f (Y, Proof (proposition 3). The fibre V −1 (X) by definition has as objects bisets (X, S) and as morphisms lenses λ : (X, S) → (X, R) with v λ = id X . On the other hand objects of co-kl(X×) op are sets, and morphisms are Therefore it can directly be seen that the functor V −1 (X) → co-kl(X×) op given by (X, S) → S and λ → u λ is an isomorphism. By definition, the reindexing functor f * : acts on objects by f * (Y, S) = (X, S), and takes a lens given by These can be directly seen to be equal under the isomorphism.
Proof (proposition 14). The first axiom can be checked by diagram pasting: For the second axiom, let (h, k) : C(Φ ′ , Θ) be a context for β ⊙ α and let σ, σ ′ : Σ G and τ, τ ′ : Σ H be strategy profiles. and Therefore and we are done.
Proof (proposition 15). This amounts to the following distributivity law: let Φ For the source component, and similarly for the target component. For the best response component, Proof (proposition 17). It remains to prove that the following two diagrams (Mac Lane triangle and pentagon) commute: Each composition path results in a globular morphism. Hence equality of the refinements follows from equality between the Σ components, which are obtained from the corresponding Mac Lane axioms for the cartesian monoidal category Set.
Proof (proposition 18). The first component holds because π 1 , π 2 are (isomorphic to) projections from a cartesian product of sets.
For the second we take The first axiom follows from bifunctorality of ⊗ on Lens: For the second axiom we calculate: The relevant equalities between contexts, which all follow from proposition 18, are summarised in figure 6.
Proof (theorem 1). Following [17], it remains to show that various diagrams commute. These are shown in figures 7, 8, 9 and 10. These are all trivial to prove, by checking the s, t and Σ components separately.