Cofree game
Project: Games as recursive coalgebras
Contents
The cofree game on a set $\Lambda$ is the value at $\Lambda$ of the right adjoint of the forgetful functor from Games to sets: a game morphism from a game to the cofree game is the same as a labeling of the positions of the game by elements of $\Lambda$. Its positions are the $\Lambda$-labeled hereditarily finite sets. Every limit of games is a subgame of a cofree game.
1. Definition§
Write $\mathcal{P}_{\mathrm{fin}}(X)$ for the set of finite subsets of a set $X$. The right adjoint exists for a general reason, and the cofree game is defined as its value. The explicit description then computes it.
Definition 1.1 (Forgetful functor)§
The forgetful functor $U:\mathbf{Games}\to\mathbf{Set}$ takes a game $(X,\theta)$ to its set $X$ of positions.
Definition 1.2 (Subgame)§
A subgame of a game $(X,\theta)$ is a subset $S\subseteq X$ with $\theta(x)\subseteq S$ for all $x\in S$. In words, a subgame is a set of positions that contains every option of its elements.
See Definition B.3.
Proposition 1.3 (Right adjoint)§★
$U$ has a right adjoint $R:\mathbf{Set}\to\mathbf{Games}$. See Corollary B.12.
Proof§
Games is locally finitely presentable, and $U$ preserves small colimits by Lemma B.2. Apply the adjoint functor theorem for locally presentable categories.
Definition 1.4 (Cofree game)§
The cofree games functor is the right adjoint $R$ of $U$. The cofree game on a set $\Lambda$ is $R(\Lambda)$, with counit $\epsilon_\Lambda:UR(\Lambda)\to\Lambda$. For a game $(X,\theta)$, each function $\sigma:X\to\Lambda$ is $\epsilon_\Lambda\circ\sigma^\flat$ for a unique game morphism $\sigma^\flat:X\to R(\Lambda)$, its transpose.
See §B.2.
Definition 1.5 (Labeled hereditarily finite sets)§
For a set $\Lambda$, a $\Lambda$-labeled hereditarily finite set is a pair $(S,\lambda)$ of a finite set $S$ of $\Lambda$-labeled hereditarily finite sets and a label $\lambda\in\Lambda$. Their set is
In words, a hereditarily finite set is written with finitely many braces, and a $\Lambda$-labeled one is written with finitely many braces that each carry a label.
See Definition B.13.
Proposition 1.6 (Explicit description)§☆
The cofree game $R(\Lambda)$ has positions $\mathbb{H}_\Lambda$ and structure map $\theta_\Lambda(S,\lambda)=S$; a move from $(S,\lambda)$ goes to an element of $S$. The counit $\epsilon_\Lambda$ sends $(S,\lambda)$ to its label $\lambda$.
Proof§
$\mathbb{H}_\Lambda$ is the colimit of the chain in the colimit description. See §B.2 and Proposition B.14.
Remark 1.7 (Transposes)§
For a game $(X,\theta)$ and a function $\sigma:X\to\Lambda$, the transpose is given recursively by
In words, $\sigma^\flat(x)$ records the label of $x$ and the transposes of its options. The formula says that the following square commutes.
See §B.2.
2. Examples§
The first two examples show the positions of a cofree game for one label and for three labels. The third example uses two labels to encode subsets, and leads to the subobject classifier.
Example 2.1 (One label)§
For a one-element set of labels, the cofree game is the terminal game of hereditarily finite sets. See §B.2.
Example 2.2 (Three labels)§
Write $\{\ldots\}_\lambda$ for $(\{\ldots\},\lambda)$. For $\Lambda=\{r,g,b\}$, a typical element of $\mathbb{H}_\Lambda$ is
The positions that are reached from this element in the cofree game are drawn below. Each position is marked with its label, and an arrow goes from a labeled set to one of its elements.
See §B.2; there the labels are drawn as colors.
Example 2.3 (Truth values)§
For $\Lambda=\{\top,\bot\}$, a subset $S\subseteq X$ of a game $(X,\theta)$ corresponds to the transpose $\chi_S:X\to R(\{\top,\bot\})$ of its characteristic function: the position $\chi_S(x)$ is labeled $\top$ exactly when $x\in S$. The truth-closed elements give the subobject classifier.
See §B.5.
3. Properties§
The cofree game is the terminal recursive coalgebra of the functor $\mathcal{P}_{\mathrm{fin}}(-)\times\Lambda$, and this gives its explicit description. The rest of the section contains the subobject classifier of games, which is a subgame of a cofree game, and the statement on limits.
Lemma 3.1 (Recursive labeled coalgebras)§☆
A $\mathcal{P}_{\mathrm{fin}}(-)\times\Lambda$-coalgebra $\langle\theta,\sigma\rangle:X\to\mathcal{P}_{\mathrm{fin}}(X)\times\Lambda$ is recursive if and only if $(X,\theta)$ is a game.
Proof§
This is checked directly.
Proposition 3.2 (Terminal recursive coalgebra)§☆
The coalgebra $\langle\theta_\Lambda,\epsilon_\Lambda\rangle$ on $UR(\Lambda)$ is the terminal recursive $\mathcal{P}_{\mathrm{fin}}(-)\times\Lambda$-coalgebra.
Proof§
For a recursive $\langle\theta,\sigma\rangle$, the transpose $\sigma^\flat$ is the unique coalgebra homomorphism into $\langle\theta_\Lambda,\epsilon_\Lambda\rangle$, which is recursive by the lemma. See §B.2.
Corollary 3.3 (Colimit description)§☆
The set $UR(\Lambda)$ of positions of the cofree game is the colimit of
Proof§
The terminal recursive coalgebra is the initial algebra (Proposition 3.7; Capretta–Uustalu–Vene, Proposition 2), given by Adámek's construction. See §B.2.
Definition 3.4 (Truth-closed element)§
An element $(T,\lambda)\in\mathbb{H}_{\{\top,\bot\}}$ is truth-closed if every element of $T$ is truth-closed, and is labeled $\top$ whenever $\lambda=\top$. In words, no brace labeled $\bot$ lies inside a brace labeled $\top$. For example, $\{\}_\top$ and $\{\}_\bot$ are truth-closed, and $\{\{\}_\bot\}_\top$ is not.
See Definition B.24.
Proposition 3.5 (Subobject classifier)§☆
The truth-closed elements form the subobject classifier $\Omega$ of Games, a subgame of $R(\{\top,\bot\})$. Explicitly, a subset $S$ of a game $X$ is a subgame if and only if every value of $\chi_S:X\to R(\{\top,\bot\})$ is truth-closed.
See Proposition B.26.
Proposition 3.6 (Limits)§☆
For a small diagram $F:J\to\mathbf{Games}$, the limit $\lim F$ is a subgame of $R(\lim UF)$, the cofree game on the limit of the underlying sets.
Proof§
Since $U$ is faithful, naturally in a game $X$,
By the Yoneda lemma, this is composition with a monomorphism $\lim F\to R(\lim UF)$. Monomorphisms of games are subgame inclusions by Proposition B.18. See §B.3.4.
Remark 3.7 (Computing limits)§
The functor $U$ does not preserve limits, and this description does not say which subgame is the limit. Even the products of the stars involve Stirling numbers of the second kind. See §B.3.4. FinGames uses the description for its finite limits.
Example 3.8 (Stars)§
For $n\geq1$, the star $\mathbb{S}_n$ is the game with a root whose options are $n$ positions without options. The star $\mathbb{S}_3$ is drawn below.
A game morphism $\mathbb{S}_n\to\mathbb{S}_k$ is a surjection from the $n$ options onto the $k$ options. So there are $k!\,S(n,k)$ of them, with $S(n,k)$ a Stirling number of the second kind. A game morphism to a product is a pair of game morphisms, and the product $\mathbb{S}_2\times\mathbb{S}_3$ reflects the identity
See §B.3.4 and Figure 16.
4. Related concepts§
- Games, whose forgetful functor is comonadic
- FinGames
- The terminal game
- Cofree coalgebra
- Hereditarily finite set
- locally presentable categories
5. References§
- [Hor25] Ryuya Hora, Games as recursive coalgebras: A categorical view on the Nim-sum, arXiv:2510.22886v3, §3.2 and Appendix B.2–B.5.
- [CUV06] Venanzio Capretta, Tarmo Uustalu and Varmo Vene, Recursive coalgebras from comonads, Information and Computation 204 (2006), no. 4, 437–468.