Table of Contents
Fetching ...

Games as recursive coalgebras: A categorical view on the Nim-sum

Ryuya Hora

TL;DR

This work provides a categorical reinterpretation of impartial games by modeling them as recursive $\mathcal{P}_{\mathrm{fin}}$-coalgebras, unifying Grundy numbers, Conway addition, and nim-sum under a single coalgebraic framework. The category $\mathbf{Game}$ is shown to be equivalent to the category of recursive $\mathcal{P}_{\mathrm{fin}}$-coalgebras, with game values realized as hylo morphisms into $\mathcal{P}_{\mathrm{fin}}$-algebras; the terminal object $\mathbb{H}$ consists of hereditarily finite sets, tied to Adámek's fixed-point construction. A central contribution is the Bouton monoid, a universal, minimal monoid structure that decomposes a game into subgames and synthesizes game values under a chosen monoidal sum; this framework recovers the classical Nim-sum via the Conway addition and outcome, and yields concrete examples for selective and conjunctive sums. The paper also develops a robust set of categorical properties for $\mathbf{Game}$ (locally finitely presentable, comonadic over Set, with a subobject classifier) and lays out seven open questions, including differential structures, partisan extensions, and monoidal-classification problems. Overall, the work provides a principled, scalable foundation for generalizing nim-like rules and analyzing complex game decompositions using category-theoretic methods, with potential implications for broader combinatorial game theory and logic.

Abstract

In 1901, Bouton proved that a winning strategy of the game of Nim is given by the bitwise XOR, called the nim-sum. But, why does such a weird binary operation work? Led by this question, this paper introduces a categorical reinterpretation of combinatorial games and the nim-sum. The main categorical gadget used here is recursive coalgebras, which allow us to redefine games as ``graphs on which we can conduct recursive calculation'' in a concise and precise way. For game-theorists, we provide a systematic framework to decompose an impartial game into simpler games and synthesize the quantities on them, which generalizes the nim-sum rule for the Conway addition. To read the first half of this paper, the categorical preliminaries are limited to the definitions of categories and functors. For category theorists, this paper offers a nicely behaved category of games $\mathbf{Game}$, which is a locally finitely presentable symmetric monoidal closed category comonadic over $\mathbf{Set}$ admitting a subobject classifier! As this paper has several ways to be developed, we list seven open questions in the final section.

Games as recursive coalgebras: A categorical view on the Nim-sum

TL;DR

This work provides a categorical reinterpretation of impartial games by modeling them as recursive -coalgebras, unifying Grundy numbers, Conway addition, and nim-sum under a single coalgebraic framework. The category is shown to be equivalent to the category of recursive -coalgebras, with game values realized as hylo morphisms into -algebras; the terminal object consists of hereditarily finite sets, tied to Adámek's fixed-point construction. A central contribution is the Bouton monoid, a universal, minimal monoid structure that decomposes a game into subgames and synthesizes game values under a chosen monoidal sum; this framework recovers the classical Nim-sum via the Conway addition and outcome, and yields concrete examples for selective and conjunctive sums. The paper also develops a robust set of categorical properties for (locally finitely presentable, comonadic over Set, with a subobject classifier) and lays out seven open questions, including differential structures, partisan extensions, and monoidal-classification problems. Overall, the work provides a principled, scalable foundation for generalizing nim-like rules and analyzing complex game decompositions using category-theoretic methods, with potential implications for broader combinatorial game theory and logic.

Abstract

In 1901, Bouton proved that a winning strategy of the game of Nim is given by the bitwise XOR, called the nim-sum. But, why does such a weird binary operation work? Led by this question, this paper introduces a categorical reinterpretation of combinatorial games and the nim-sum. The main categorical gadget used here is recursive coalgebras, which allow us to redefine games as ``graphs on which we can conduct recursive calculation'' in a concise and precise way. For game-theorists, we provide a systematic framework to decompose an impartial game into simpler games and synthesize the quantities on them, which generalizes the nim-sum rule for the Conway addition. To read the first half of this paper, the categorical preliminaries are limited to the definitions of categories and functors. For category theorists, this paper offers a nicely behaved category of games , which is a locally finitely presentable symmetric monoidal closed category comonadic over admitting a subobject classifier! As this paper has several ways to be developed, we list seven open questions in the final section.
Paper Structure (44 sections, 39 theorems, 87 equations, 18 figures, 3 tables)

This paper contains 44 sections, 39 theorems, 87 equations, 18 figures, 3 tables.

Key Result

Theorem 2.9

A state $(a_1,\dots , a_n)$ of the $n$-heap nim $\mathrm{Nim}_{n}$ is $P$-state if and only if $a_1 \oplus \cdots \oplus a_n=0$.

Figures (18)

  • Figure 1: A play of $3$-heap Nim, where $A$ wins.
  • Figure 2: Nim-sum calculation: $3\oplus 5=6$ since $011\oplus 101=110$ in binary expression
  • Figure 3: An example of a finite game
  • Figure 4: An example of an infinite game
  • Figure 5: An example of non-game with infinite path
  • ...and 13 more figures

Theorems & Definitions (135)

  • Definition 1.1
  • Definition 2.1: (impartial) games
  • Definition 2.2: Outcome
  • Remark 2.3: How can we win with outcome?
  • Remark 2.4: Why do we assume the "finite options" condition?
  • Example 2.5: Winning strategy of the subtraction nim
  • Example 2.6: Binary exponent nim, or the terminal game
  • Example 2.7: "Effeuiller la marguerite"
  • Example 2.8: Nim
  • Theorem 2.9: Bouton's theorem bouton1901nim
  • ...and 125 more