\documentclass{amsart} \usepackage[left=2cm, right=2cm]{geometry} \usepackage[utf8]{inputenc} \usepackage{amsfonts, amsthm, amssymb, mathtools,etoolbox,stmaryrd} \usepackage{blindtext} \usepackage[colorlinks=true, urlcolor=blue, linkcolor=blue, citecolor=blue]{hyperref} \usepackage{tikz,tikz-cd} \usepackage{array} \usepackage{framed} \usepackage{xcolor} \usepackage{graphicx} \usepackage{autobreak} \usepackage[maxnames=10, sorting = nyt]{biblatex} \renewbibmacro{in:}{} \addbibresource{GamesAsWellFoundedCoalgebras.bib} \tikzset{pullback/.style={minimum size=1.2ex,path picture={ \draw[opacity=1,black,-,#1] (-0.5ex,-0.5ex) -- (0.5ex,-0.5ex) -- (0.5ex,0.5ex);% }}} \theoremstyle{plain} \newtheorem{theorem}{Theorem}[section] \newtheorem{proposition}[theorem]{Proposition} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{corollary}[theorem]{Corollary} \newtheorem*{corollary*}{Corollary} \newtheorem{question}[theorem]{Question} \theoremstyle{definition} \newtheorem{example}[theorem]{Example} \newtheorem{definition}[theorem]{Definition} \newtheorem{remark}[theorem]{Remark} \newtheorem{notation}[theorem]{Notation} \newcommand{\dq}[1]{``#1"} \newcommand{\memo}[1]{\textcolor{red}{memo: #1}} \newcommand{\N}{\mathbb{N}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\X}{\mathbb{X}} \newcommand{\Y}{\mathbb{Y}} \newcommand{\W}{\mathbb{W}} \newcommand{\gS}{\mathbb{S}} \newcommand{\C}{\mathcal{C}} \newcommand{\D}{\mathcal{D}} \newcommand{\E}{\mathcal{E}} \newcommand{\F}{\mathcal{F}} \newcommand{\A}{\mathbb{A}} \newcommand{\I}{\mathbb{I}} \newcommand{\id}[1]{\mathrm{id}_{#1}} \newcommand{\Pf}{\mathcal{P}_{\mathrm{fin}}} \newcommand{\Set}{\mathrm{Set}} \newcommand{\Gs}{\mathbf{Games}} \newcommand{\nsum}{\oplus} \newcommand{\Alg}[1]{\mathrm{Alg}_{#1}} \newcommand{\Coalg}[1]{\mathrm{Coalg}_{#1}} \newcommand{\PfAlg}{\Alg{\Pf}} \newcommand{\PfCoalg}{\Coalg{\Pf}} \newcommand{\mex}[1]{\mathrm{mex}(#1)} \newcommand{\m}{\mathrm{mex}} \newcommand{\G}[2]{\mathcal{G}_{#1}(#2)} \newcommand{\rel}{\to} \newcommand{\red}{\mathrm{red}} \newcommand{\cp}{\ast} \newcommand{\acc}{\rightsquigarrow} \newcommand{\str}{\theta} \newcommand{\Image}{\mathrm{Im}} \newcommand{\HF}{\mathbb{HF}} \newcommand{\Nim}[1]{\mathrm{Nim}_{#1}} \newcommand{\Her}{\mathbb{H}} \newcommand{\epi}{twoheadrightarrow} \newcommand{\mono}{rightarrowtail} \newcommand{\ADJ}[4] { \begin{tikzcd}[ampersand replacement = \&, column sep = small] {#1} \ar[rr, shift right=1.3ex, "{#2}"'] \&\perp\& {#3} \ar[ll, shift right=1.3ex,"{#4}"'] \end{tikzcd} } \DeclarePairedDelimiter{\gen}{\langle}{\rangle} \DeclareMathOperator{\ob}{\mathrm{ob}} \title{Games as well-founded coalgebras} \author{Ryuya Hora} \thanks{Graduate School of Mathematical Sciences, University of Tokyo. \url{hora@ms.u-tokyo}} \date{\today} \subjclass[2020]{MSC} \keywords{combinatorial games, coalgebra of an endofunctor, Well-founded coalgebra, locally presentable category} \begin{document} \maketitle \tableofcontents Throughout this paper, $\N$ denotes the set of all non-negative integers $\N = \{0,1,2, \dots\}$. %\newpage \section{Games as graphs} In this section, we recall \dq{classical} game-theoretic notions and phenomena, which will be reinterpreted and generalized later. \memo{See \cite{siegel2013combinatorial} for details.} \subsection{Elementary definition of Games} There are so many different definitions of impartial games. \memo{add bib} In this paper, we adopt a graph-theoretic one. Informally speaking, a vertex is a state of the game, and an edge is a possible move. \begin{definition}[(impartial) games]\label{DefinitionGames} A \emph{game} $\X$ is a pair $\X = (X, \rel)$ of a (possibly infinite) set $X$ and a relation ${\rel}\subset X \times X$ that satisfies two finiteness conditions: \begin{enumerate} \item (finite options) For any $x \in X$, the number of options $\# \{x' \in X \mid x\rel x'\}$ is finite. \item (finite time) There is no infinite path. $x_0 \rel x_1 \rel x_2 \rel \dots$ \end{enumerate} \end{definition} To win a given game, we need to know \dq{$N$-states} (Next-player-winning states) and \dq{$P$-states} (Previous-player-winning states), defined as follows. The following definition is not circuler, due to the \dq{finite time} condition. % its winning states and losing states. \begin{definition}[Outcome]\label{DefinitionOutcome} For a game $\X=(X, \rel)$ and its state $x\in X$, the outcome of $x$ is \[ \begin{cases} N& \text{(if there exists $x\rel x'$ whose outcome is $P$.)}\\ P& \text{(otherwise)} \end{cases} \] \end{definition} We end this subsection by giving several famous examples of combinatorial games. \begin{example}[Nim]\label{ExampleNim} Let $\Nim{n}$ denote a nim game with $n$-heaps. In our formulation, it is $(\N^{n}, \rel)$, where $(a_1, \dots a_n)\rel (b_1, \dots b_n)$ if and only if there exists $1\leq i \leq n$ such that $a_i > b_i$ and for any $j \neq i$, $a_j = b_j$. \end{example} \begin{example}[Subtraction Game]\label{ExampleSubtractionGame} \memo{Write!} \end{example} \begin{example}[Wythoff]\label{ExampleWythoff} \memo{Write!} \end{example} The next example is not well-known (at least in the following form), but will turn out to be theoretically important and is worth being called \emph{the universal game}. \begin{example}[The universal game: Binary exponent nim]\label{ExampleTheUniversalGameInTermsOfNumbers} % The underlying set of the universal game is g % \end{example} % \begin{remark}[The universal game of natural numbers] % Since the terminal object is defined by universality, it is unique up to canonical isomorphism. Another description of the terminal object is given by \emph{Ackerman's interpretation} of hereditarily finite sets. \memo{ref} The underlying set of the binary exponent nim is $\N$, and the relation $n \rel m$ is defined by \[n \rel m \iff 2^m \text{ appears in the binary expansion of }n.\] For example, when $n=10000$, since \[ n=10000=2^{13}+2^{10}+2^{9}+2^{8}+2^{4}, \] there are $5$ possible moves, namely $10000\rel4,8,9,10,13$. The state $n=10000$ is $N$-state, because the next player can move to $8$, then the other player has no choice other than moving to $3$, and the last move $3\to 0$ terminates the game. Later, we will observe that this game is universal, in the following senses: \begin{itemize} \item This game is the terminal object of the category of games. % $\Gs$. \item This is the universal \dq{recursively defined data} of games \item Every state of every game is canonically \dq{equivalent} to the unique state (i.e., natural number) of this game. \end{itemize} \memo{write the game!} \memo{"almost all states are N-state"} \memo{Is it related to the product-exp description of games?} \end{example} \begin{example}[The universal game: Hereditarily finite sets]\label{ExampleHereditarilyFiniteSets} \end{example} \subsection{Game addition and Grundy number} \begin{definition}[mex] For a finite set of natural numbers $S\subset \N$, $\mex{S}$ is the minimum natural number that does not belong to the subset $S$. In other words, mex of $S$ is the minimum element of the complement of $S$: \[\mex{S} = \min S^{\mathrm{c}}.\] \end{definition} \begin{definition}[Grundy number] For a game $\X = (X, \rel)$ and a state $x\in X$, \emph{Grundy number} $\G{\X}{x}$ is recursively defined as \[\G{\X}{x}=\mex{\{\G{\X}{x'}\mid x \rel x'\}}.\] \end{definition} This recursive definition does work because of the finiteness conditions in the definition of games. The importance of Grundy number is due to the following proposition. \begin{proposition} The P-player (Previous player) wins the game $\X$ with the initial state $x\in X$ if and only if $\G{\X}{x} = 0$. \end{proposition} \begin{proof} \memo{add bib} \end{proof} % Moreover, Grundy number is compatible with the \emph{addition of games}. Next, we introduce the notion of the sum game. It is conventionally called sum and denoted by $\X + \Y$, but in this paper, we prefer the tensor symbol $\X\otimes \Y$. \begin{definition}[Addition of games] For two games $\X = (X,\rel_{\X}), \Y = (Y,\rel_{\Y})$, their \emph{sum} $\X \otimes \Y$ is a game $(X\times Y, \rel_{\X \otimes \Y})$, where $(x,y) \rel_{\X \otimes \Y} (x',y')$ if and only if $(x \rel_{\X} x' \land y=y')$ or $(x=x' \land y \rel_{\Y}y')$. \end{definition} \memo{This is called \dq{box product} in graph theory. \cite{kapulkin2023closed}} \begin{example} The $n$-heaps nim game is the sum of $n$-copies of ($1$-heap) nim games.\[\Nim{n} = \Nim{1} \otimes \dots \otimes \Nim{1}\] \end{example} There is a well-known way to calculate the Grundy number of a state of a sum game: nim-sum. \begin{definition}[Nim-sum] \emph{Nim-sum} is the abelian group structure on $\N$, induced by the bijection $\N \to \bigoplus_{k=0}^{\infty} \Z/2\Z$ given by the binary expansion . In other words, nim-sum is the digit-wise exclusive disjunction (xor) of the binary expansion. \end{definition} For example, $7\nsum 5 = (111)_{2} \nsum (101)_{2} = (010)_{2} = 2$. The following famous proposition is not due to me. For a proof, see \memo{add bib} \begin{proposition} For two games $\X = (X,\rel_{\X}), \Y = (Y,\rel_{\Y})$ and states $x\in X, y\in Y$, the Grundy number of $(x,y)$ is given by Nim-sum: \[\G{\X\otimes\Y}{(x,y)}= \G{\X}{x}\nsum\G{\Y}{y}.\] \end{proposition} Combining two propositions above, we can deduce a winning states of a sum game. \begin{example}[Analysis of nim]\label{ExampleAnalysisOfNim} For example, we can deduce a winning strategy of $n$-heap nim $\Nim{n}$, which is a sum of $n$-copy of $\Nim{1}$. \memo{Write} \end{example} \begin{remark}[Relationship with calculus]\label{RemarkCalculus} The crucial observation to prove the above proposition is the next equality: % \begin{lemma}[recursive definition of Nim-sum] % For any two finite sets $S,T\subset \N$ of natural numbers, the following equation holds: % % \[\mex{S}\nsum \mex{T} = \mex{\{s\nsum \mex{T}\mid s\in S\}\cup \{\mex{S}\nsum t\mid t\in T\}}.\] \[\mex{S}\nsum \mex{T} = \mex{S\nsum \mex{T} \cup \mex{S}\nsum T},\] % \end{lemma} where $S\nsum \mex{T}$ is an abbreviation of $\{s\nsum \mex{T}\mid s\in S\}$. This equation is informative enough to redefine the notion of nim-sum recursively. This equation looks like a calculation of integral. Let $\int : C^{\infty}(\mathbb{R}) \to C^{\infty}(\mathbb{R})$ be a function that sends \[f(x) \mapsto \int_{0}^{x}f(t) dt.\] Then, we have \[\textstyle \int f \cdot \int g = \int (f \cdot\int g + \int f \cdot g),\] which is just the integral version of the Leibniz rule! It is also called (a special case of) \emph{Rota-Baxter equation}. There might be a relationship with other categorical treatments of differential structures \cite{castillo2009rota} \cite{cockett2019integral} \cite{laird2013constructing} \cite{loregian2021differential}. \end{remark} % \memo{This equality is reminiscent of the derivative. In fact, Let $\partial_{0}:C^{\infty}(\mathbb{R}) \to C^{\infty}(\mathbb{R})$ be a function that sends $f$ to the constant function $f'(0)$. Then, a similar equation % \[2\cdot \partial_{0} f \cdot \partial_{0} g = \partial_{0} (f \cdot\partial_{0} g + \partial_{0} f \cdot g).\] % It is possible to define such an axiomatic notion of derivative on a semiring, but I'm not sure if it's useful or not. The definition of sum-game is quite similar to Leibniz's rule, so it should be some relation to the differential. Until now, I don't know what it is. One possibility is % the notion of \emph{differential $2$-rig} \cite{loregian2021differential}.} % \memo{I've noticed that it's more like integral rather than derivative. Let $\int : C^{\infty}(\mathbb{R}) \to C^{\infty}(\mathbb{R})$ be a function that sends % \[f(x) \mapsto \int_{0}^{x}f(t) dt.\] % Then, we have % \[\textstyle \int f \cdot \int g = \int (f \cdot\int g + \int f \cdot g),\] % which is just the integral version of the Leibniz rule! (and might be related to Rota-Baxter algebra?\cite{castillo2009rota} \cite{cockett2019integral}) % } % \memo{Some \dq{Differential Structure} is studied in \cite{laird2013constructing}.} \section{Category of games}\label{SectionCategoryOfGames} \subsection{Category of games}\label{SubSectionCategoryOfGames} In this subsection, we will define the category of games, which will be rephrased in category-theoretic terminology in the latter part of this paper. A naive idea of \emph{game morphisms} might be functions that preserve the transition relation. In other words, a game morphism from $\X$ to $\Y$ might be guessed to be a function $X \to Y$ such that, if $x\rel_{\X} x'$ then $f(x) \rel_{\Y} f(x')$. However, for several reasons, we will not adopt that naive definition. One intuitive reason is that they preserves only \dq{graph-theoretic data} and do not preserve \dq{game-theoretic data}. For example, such a function might send an ending state of a game to a non-ending state of another game. \memo{Write a sketch} Modifying such a problematic point, we define the notion of game morphism as follows: \begin{definition}[Game morphism]\label{DefinitionGameMorphism} A \emph{game morphism} from a game $\X = (X, \rel_{\X})$ to $\Y = (Y, \rel_{\Y})$ is a function $f\colon X \to Y$ such that \begin{enumerate} \item if $x\rel_{\X} x'$ then $f(x) \rel_{\Y} f(x')$. \label{ConditionGraphpreserving} \item if $f(x) \rel_{\Y} y$, then there exists $x' \in \X$ such that $x\rel_{\X}x'$ and $f(x')= y$. \label{conditionLocallySurjective} \end{enumerate} \end{definition} \memo{It is better to prove the paraphrase of the definition, using "preservation of recursive game value". But it might be tricky...?} Later, we will see that this notion of game morphisms coincides with the notion of coalgebra homomorphisms \memo{ref}, and that game morphisms preserve all \dq{recursively defined data} of games, including ending states, outcomes, Grundy numbers, and birthdays. \begin{notation}\label{NotationCategoryOfGames} The category of games and game morphisms is denoted by $\Gs$, and the canonical forgetful functor is denoted by $U \colon \Gs \to \Set$. \end{notation} Before proceeding to the following contents, we will prove a basic lemma. \begin{lemma}\label{LemmaForgetfulFaithfulConservative} The forgetful functor $U \colon \Gs \to \Set$ is faithful and conservative. \end{lemma} \begin{proof} This is an immediate corollary of the coalgebraic description of games. Direct proof is also easy. \end{proof} \subsection{The universal game: hereditarily finite sets} \memo{ask refs} With the category-theoretic terminology, we can conduct universal costructions of games! The first, and possibly the most important construction is, the terminal object of $\Gs$. In this subsection, we will give an explicit description of the terminal game, using a set-theoretic notion \emph{hereditarily finite sets}. This is the starting point of the folllowing whole contents. Although we will give proofs in this subsection, the contents in this subsection will be immediate corollaries of the following contents, and they will be reinterpreted, generalized, and utilized later. \memo{ref} Considering the terminal games answers a question: when can we say that two different states of a game behaves in the same way? In a given game, some two different states might behave in the exactly same way. For example, \memo{Draw a picture}. % In this subsection, we show that the set of all hereditarily finite sets is the initial algebra and the terminal game, at the same time. First, we define hereditarily finite sets, by recursion. \begin{definition}[Hereditarily finite sets] A \emph{hereditarily finite set} is recursively defined as a finite set of hereditarily finite sets. % A set $A$ is \emph{hereditarily finite} if all elements of $A$ are hereditarily finite. \memo{Rigorously speaking, a hereditarily finite set is a set that is ensured to be hereditarily finite by this recursive definition.} $\Her$ denotes the set of all hereditarily finite sets. \end{definition} This recursive definition might look confusing. We give several examples of hereditarily finite sets. \begin{example}\label{LabelExampleHereditarilyFiniteSets} The empty set $\emptyset$ is trivially hereditarily finite since it has no element. Therefore, $\{\emptyset\}$ is also hereditarily finite. By induction, every (set-theoretically encoded) natural number is hereditarily finite. In other words, \[\N = \{0=\emptyset,\ 1= \{\emptyset\},\ 2= \{\emptyset,\{\emptyset\}\},\ 3=\{\emptyset, \{\emptyset\}, \{\emptyset,\{\emptyset\}\}\}, \dots\} \subset \Her.\] Of course, $\Her$ is not covered by $\N$. For example, $\{\{\emptyset\}\}$ is a hereditarily finite set that is not a natural number. \end{example} \begin{definition}[Universal game]\label{DefinitionUniversalGame} The universal game $\Her$ is a game whose underlying set is the set of all hereditrily finite set $\Her$ and whose relation $\rel$ is defined by \[A \rel B \iff B \in A.\] \end{definition} \begin{proposition}\label{PropositionUniversalIsTerminal} The universal game $\Her$ is the terminal object of $\Gs$. \end{proposition} \begin{remark}[Two definitions of combinatorial games]\label{RemarkTwoDefinitionsOfCombinatorialGames} \end{remark} \subsection{Subgames} In this subsection, we will define the notion of subgames and prove some basic properties. \begin{definition}[Subgame]\label{DefinitionSubgames} A subgame of a game $\X = (X, \rel)$ is a subset $S \subset X$ such that if $x\in S$ and $x\rel x'$ then $x' \in S$. \end{definition} Just to avoid the following argument becoming wordy, we introduce an accessibility relation in an obvious way: \begin{definition}[Accessibility relation]\label{DefinitionAccessibility} For a game $\X=(X, \rel)$, an element $x\in X$ is \emph{accessible} from $x'$ if there exists a non-negative integer $n \in \N$ and a sequence of elements $x_0, \dots x_n$ that satisfy \begin{itemize} \item $x_0=x'$, \item $x_i \rel x_{i+1}$ for $0\leq i < n$, and \item $x_n=x$. \end{itemize} This accessibility relation is denoted by $x' \acc x$. \end{definition} \begin{remark}[Subgames are downward closed subset] % If one regards a game as a poset (by the reflective and transitive closure of $\rel$), This accessibility relation is just the reflective and transitive closure of $\rel$, and defines a preorder on the underlying set $X$. Furthermore, due to the \dq{finite time} condition in Definition \ref{DefinitionGames}, it is a partial order. The notion of subgames coincides with the notion of downward closed subsets of the poset. \end{remark} \begin{lemma}[Generation and Cogeneration of subgames]\label{GenerationanadCogenerationOfSubgames} For a game $\X=(X, \rel)$ and a subset $S\subset X$, \begin{itemize} \item there exists the minimum subgame of $\X$ that contains $S$. \item there exists the maximum subgame of $\X$ that is contained by $S$. \end{itemize} \end{lemma} \begin{proof} This is an immediate corollary of the general adjoint functor theorem applied to the complete lattice inclusion from the lattice of subgames into the lattice of subsets. Explicitly, the former subgame is constructed as \[\{x\in X\mid \exists s \in S, \ s\acc x\},\] and the latter is \[\{x\in X\mid \forall y \in X,\ (x\acc y \implies y \in S)\}\] \end{proof} \begin{definition}\label{SubgameGeneration} For a game $\X=(X, \rel)$ and a subset $S\subset X$, the minimum subgame of $\X$ that contains $S$ is called the subgame generated by $S$, and denoted by $\gen{S}$. \end{definition} \begin{lemma}\label{LemmaFinitelygeneratedSubgameisFinite} A subgame generated by a finite subset is finite. \end{lemma} \begin{lemma}[Image is a subgame]\label{LemmaImageisSubgame} For a game morphism $f\colon \X \to \Y$, its image $\Image{f}$ is a subgame of $\Y$. \end{lemma} \begin{proof} This is due to the second condition (\ref{conditionLocallySurjective}) of Definition \ref{DefinitionGameMorphism}. \end{proof} \begin{proposition}[Surjection-Subgame factorization]\label{PropositionSurjSubgameFactorization} A game morphism is uniquely factored into a composition of a surjective morphism followed by a subgame inclusion. \end{proposition} We obtain the following factorization system, which will turn out to be the epi-mono factorization (see \memo{ref}) \begin{proposition}[Subgames $=$ Subobjects]\label{PropositionSubgameAndSubobjectAndMono} For a game morphism $f\colon \X \to \Y$, the following conditions are equivalent: \begin{enumerate} \item $f$ is monic in $\Gs$. \label{ConditionMonic} \item $f$ is injective. \label{ConditionInjective} \item $f$ is (canonically isomorphic to) a subgame inclusion.\label{ConditionSubobject} \end{enumerate} \end{proposition} \begin{proof} The implications $\ref{ConditionSubobject} \implies \ref{ConditionInjective}$ and $\ref{ConditionInjective} \implies \ref{ConditionMonic}$ are easy to prove. We prove the converses. First, we prove $\ref{ConditionMonic}\implies \ref{ConditionInjective}$. Suppose $f$ is monic. We prove that $\# f^{-1}(y) \leq 1$ by induction on the well-founded order structure $(Y,\acc)$. Assuming that, for any $y' \acc y$ and $y\neq y'$, $\# f^{-1}(y') \leq 1$ holds, we prove $\# f^{-1}(y) \leq 1$. If $\# f^{-1}(y) =0$, then the proof is completed. So we can assume $\# f^{-1}(y) \geq 1$. In that case, $\# f^{-1}(y') =1$ for any $y'\neq y$ that is accessible from $y$. Let us define $S\subset X$ as \[ S \coloneqq \{x\in X\mid f(x)\neq y \text{ and } y \acc f(x)\}. \] It is not hard to prove that $S$ is a subgame of $\X$. We define a new game $\W$, % whose underlying set is $S \coprod \{\ast_0, \ast_1\}$. The relation $\ast_i \rel_{\W} s$ for $i=0,1$ and $s\in S$ is defined by % \[ % \ast_i \rel_{\W} s \iff y\rel_{\Y} f(s) % \] % and no other relation is added. whose underlying set is $S \coprod \{\ast\}$. The relation $\ast \rel_{\W} s$ for $s\in S$ is defined by \[ \ast \rel_{\W} s \iff y\rel_{\Y} f(s) \] and no other relation is added. \memo{This is a game, since $S$ is finite.}Then, for any $x\in f^{-1}(y)$, the function $g_{x} \colon \W \to \X$ defined by \[ g_{x}(w) = \begin{cases} s &(w=s\in S)\\ x & (w= \ast) \end{cases} \] is a game morphism. It is because, for any $x'\in \X$, \begin{align*} x \rel_{\X} x' &\iff y= f(x) \rel_{\Y} f(x')\\ &\iff x'\in S \text{ and }y \rel_{\Y} f(x')\\ &\iff x'\in S \text{ and }\ast \rel_{\W} x', \end{align*} where the first equivalence is due to the induction hypothesis. For any (possibly non-distinct) $x_0, x_1 \in f^{-1}(y)$, we have a diagram \[ \begin{tikzcd} \W\ar[r,"g_{x_0}", shift left]\ar[r,"g_{x_1}"',shift right]&\X\ar[r,"f"]&\Y, \end{tikzcd} \] with the same composite. Since we assumed that $f$ is monic, we obtain $g_{x_0} = g_{x_1}$ and $x_0 = x_1$. Next, we prove $\ref{ConditionInjective}\implies \ref{ConditionSubobject}$. Suppose $f$ is injective. Then $f$ is factored as \[ \X \to \Image{f} \to \Y, \] where $\Image{f} \to \Y$ is a subgame inclusion (Proposition \ref{PropositionSurjSubgameFactorization}). Since $\X \to \Image{f}$ is a bijective game morphism, it is an isomorphism (Lemma \ref{LemmaForgetfulFaithfulConservative}). \end{proof} %\newpage \section{Games as coalgebras} \subsection{Games are well-founded coalgebras} \begin{definition}[finite powerset functor]\label{DefinitionPf} The finite powerset functor $\Pf:\Set \to \Set$ is the subfunctor of the covariant powerset functor $\mathcal{P}:\Set \to \Set$ such that $\Pf(X) = \{S \subset X\mid \# S < \infty\}$. \end{definition} Now, we automatically obtain two categories: $\PfAlg, \PfCoalg$. Notice that our formulation of games is a special case of $\Pf$-coalgebra. In fact, for a game $\X = (X,\rel)$, we can define a structure map $\str:X \to \Pf(X)$ as $ x \mapsto \str (x) =\{x'\in X\mid x\rel x'\}$. The definition of games ensures the finiteness of $ \str(x)$. \begin{example}[Nim as a coalgebra]\label{ExampleNimCoalgebra} Let $\nu:\N \to \Pf(\N)$ denote the $\Pf$-coalgebra structure map of the nim game $\Nim{1}=(\N, >)$. This function $\nu$ is given by \[\nu:\N \to \Pf(\N): n \mapsto \{0,1, \dots, n-1\}.\] In other words, this is von Neumann's set-theoretic definition of natural numbers! \memo{Such an appearance of a set-theoretic phenomenon is kind of necessary. Because both the initial algebra and the terminal game are the set-theoretic object $\Her$, the set of all hereditarily finite sets, and Nim (with this structure map) is the sub-coalgebra of the terminal game $\Her$. See next subsection.} \end{example} \begin{proposition}\label{PropositionEquivalenceWithWellFoundednessandRecursiveness} For a $\Pf$-coalgebra $\X$, the following conditions are equivalent: \begin{itemize} \item $\X$ is a game. \item $\X$ is well-founded. (Appendix \ref{AppendixCoalgebraicMethod}) \item $\X$ is recursive. (Appendix \ref{AppendixCoalgebraicMethod}) \end{itemize} \end{proposition} \begin{proof} \cite{adamek2020well} \end{proof} \begin{theorem}[Games are well-founded coalgebras]\label{TheoremGamesAreWellFoundedCoalgebras} The category of games $\Gs$ is isomorphic to the category of well-founded $\Pf$-coalgebras ($=$ the category of recursive $\Pf$-coalgebras.) \end{theorem} % \begin{definition}[Category of Games] % The category of games $\Gs$ is the full subcategory of $\PfCoalg$ that consists of all games. % \end{definition} \subsection{Classical values of games are hylomorphisms} \memo{I'll rewrite this in terms of recursive coalgebra, later.} % By Theorem \ref{TheoremTwoUniversalities}, now we have a categorical machinery! Notice that, by definition, $\Pf(\Her)$ is set-theoretically equal to $\Her$. Therefore, $\Her$ admits the canonical $\Pf$-algebra structure \[\id{\Her}:\Her \to \Pf(\Her)\] and $\Pf$-coalgebra structure \[\id{\Her}:\Pf(\Her) \to \Her.\] \begin{proposition} $\Her$ is a game. \end{proposition} \begin{theorem}[Two characterizations of $\Her$]\label{TheoremTwoUniversalities} $\Her$ has the following two universalities. \begin{enumerate} \item $\Her$ is the initial $\Pf$-algebra. \item $\Her$ is the terminal game. \end{enumerate} \end{theorem} \begin{proof} For the first universality, it's immediately followed by the adamek's construction of the initial algebra (\memo{cite}). In fact, $\Pf$ preserves the following colimit: \[ \begin{tikzcd} \emptyset \ar[r]& \Pf(\emptyset) \ar[r]& \Pf(\Pf(\emptyset)) \ar[r]&\Pf(\Pf(\Pf(\emptyset))) \ar[r]&\dots \Her. \end{tikzcd} \] \memo{For (2), I will write later. It's proven just by induction.} \end{proof} \begin{remark}[Categorical Background: Taylor's theory of well-founded coalgebras] \end{remark} \begin{remark}[The terminal $\Pf$-coalgebra] \memo{finite branching (but not necessarily finite time) rooted trees} \end{remark} For a game $\X = (X,\str)$ and a $\Pf$-algebra $\A = (A,\alpha)$, we have the canonical function $!_{\A} \circ !_{\X}:X \to A$ given by \[ \begin{tikzcd} X\ar[r,"!_{\X}"]\ar[d,"\str"]&\Her \ar[r,"!_{\A}"]\ar[d,<->,"\id{\Her}"]& A\\ \Pf(X)\ar[r,"\Pf(!_{\X})"]& \Pf(\Her) \ar[r,"\Pf(!_{\A})"]& \Pf(A) .\ar[u,"\alpha"'] \end{tikzcd} \] The morphism $!_{\X} :\X \to \Her$ is the unique morphism to the terminal game $\Her$, and the morphism $!_{\A} :\Her \to \A$ is the unique morphism from the initial algebra $\Her$. \begin{center} \includegraphics[scale=0.15]{images/Picture_Coalg.jpeg} \end{center} Then, to obtain a nice value on a game state, now it's enough to define a nice $\Pf$-algebra! \memo{It's quite natural to consider a multiplayer game, probability game, 2-turns/1-turn game, and other variants of games. And might be able to be dealt with by some appropriate algebras. Furthermore, we can consider other data of graphs, like entropy....? I know there is a notion of the temperature of a game. Is it an example of this framework?} \memo{By considering coalgebra-> algebra map (from now, we call it ca map) (or, profunctor Alg -> Coalg), we may able to discard $\Her$ and discuss everything so far...(?) The canonical map may be the unique ca map, and a game (or well-foundedness) may be equivalent to the condition that for any algebra, there uniquely exists a ca map to it.} So far, we have observed that once we fix a $\Pf$-algebra $\A=(A,\alpha)$, then we obtain a canonical function $X\to A$ from an arbitrary game $\X=(X,\str)$. In this subsection, we show how the notion of the Grundy number is derived from this framework. Because we need a function from the set of game states $X$ to $\N$, we define $\Pf$-algebra structure on $\N$. But what is that? Is there any \dq{canonical} way to define a $\Pf$-algebra structure $\Pf(\N)\to \N$? We already know that there is a natural $\Pf$-coalgebra structure $\nu:\N \to \Pf(\N)$ (see \ref{ExampleNimCoalgebra}). This is canonical in some senses. \begin{itemize} \item It is the sub-game of the terminal game $\Her$. \item It is $\Nim{1}$. \item Under the conventional set-theoretic formulation of natural numbers, it is just the inclusion of the subset (von Neumann's definition). \end{itemize} Now, we need a natural function $\N\to \Pf(\N)$, and we need an opposite direction function in a canonical way. Then we category theorists think that \dq{ok, then consider its adjoint!} \[ \begin{tikzcd} \N \ar[r, shift left= 5pt,"\nu" name=A]&\Pf(\N)\ar[l, shift left= 5pt, "?"name=B]\ar[phantom, from= A, to=B, "\dashv" rotate=-90] \end{tikzcd} \] And the adjoint turns out to be mex! Here, we consider the usual orders, namely, the usual order $\leq$ on $\N$ and the inclusion relation on $\Pf(\N)$. \memo{there is also a left adjoint. And it also gives an interesting value of a game state, called \emph{birthday} of a game} \begin{proposition}[Origin of mex] The right adjoint of $\nu$ is $\m$. \[ \begin{tikzcd} \N \ar[r, shift left= 5pt,"\nu" name=A]&\Pf(\N)\ar[l, shift left= 5pt, "\m"name=B]\ar[phantom, from= A, to=B, "\dashv" rotate=-90] \end{tikzcd} \] \end{proposition} \begin{proof} Take any $n\in \N$ and $S\in \Pf(\N)$. Then, we have \begin{align*} n\leq \mex{S} &\iff n\leq \min {S^{\mathrm{c}}}\\ &\iff \nu (n)^{\mathrm{c}} \supset S^{\mathrm{c}}\\ &\iff \nu (n) \subset S. \end{align*} \end{proof} In this sense, $(\N, \m)$ is one canonical choice of $\Pf$-algerba structure on $\N$. Then we have the canonical function from $\Her$ to $\N$. \begin{definition}\label{DefinitionMu} $\mu:\Her \to \N$ denotes the unique $\Pf$-algebra morphism from the initial algebra $(\Her, \id{\Her})$ to $(\N, \m)$. \end{definition} \begin{theorem}[Origin of Grundy number] % For a game $\X = (X, \str)$, the value of $x \in X$ by the canonical function coincides with the Grundy number $\G{\X}{x}$. For a game $\X$, the composite function $\mu \circ !_{\X}$ coincide with $\mathcal{G}_{\X}$ \[ \begin{tikzcd} X\ar[r,"!_{\X}"]\ar[rr,bend right,"\mathcal{G}_{\X}"']&\Her\ar[r,"\mu"]&\N \end{tikzcd} \] \end{theorem} % \memo{A morphism from a coalgebra to an algebra is called a \emph{coalgebra-algebra morphism}. Furthermore, such a unique coalgebra-algebra morphism is called \emph{a hylo morphism} in computer science. Games are characterized in terms of coalgebra-algebra morphisms. See Appendix \ref{AppendixGameAsWellFounded}.} \begin{example}[Grundy number vs Birthday] Let $\mathrm{xem}$ be the left adjoint of $\nu$. (This is the dual of $\m$!) \[ \begin{tikzcd} \N \ar[r, shift left= 5pt,"\nu" name=A]&\Pf(\N)\ar[l, shift left= 5pt, "\mathrm{xem}"name=B]\ar[phantom, from= A, to=B, "\dashv" rotate=90] \end{tikzcd} \] Then, the induced value of a game state is what's called \emph{the birthday of a game}. \end{example} \begin{example}[Remoteness] \end{example} \begin{example}[Outcome vs Existence of possible move] For some poset $\mathbb{P}$, we can conduct the same procedure for another , i.e. we consider \[ \begin{tikzcd} \nu:\mathbb{P} \ar[r, "" name=A]\ar[r,""'name=D]&\Pf(\mathbb{P}),\ar[l, shift left= 10pt, ""name=B]\ar[phantom, from= A, to=B, "\dashv" rotate=-90] \ar[l, shift right= 10pt, ""'name=C]\ar[phantom, from= C, to=D, "\dashv" rotate=-90] \end{tikzcd} \] where $\nu(p) = \{q\in \mathbb{P}\mid q