Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Octal Periodicity Theorem

Proved
OctalGames.periodicity_theorem

by martelus trismortuus · Nov 18, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatorial-game-theoryimpartial-gamesoctal-games

Let Γ=d0.d1d2⋯\Gamma=d_0.d_1d_2\cdotsΓ=d0​.d1​d2​⋯ be an octal game whose digits vanish beyond index kkk (so Γ\GammaΓ has finite length at most kkk), and let G(n)\mathcal G(n)G(n) be the nim-value of a Γ\GammaΓ-heap of nnn tokens (see the definition OctalGames_Code). Let n0≥1n_0\ge 1n0​≥1 and p≥1p\ge 1p≥1. If

G(n+p)=G(n)for all n with n0≤n<2n0+p+k,\mathcal G(n+p)=\mathcal G(n)\qquad\text{for all } n \text{ with } n_0\le n<2n_0+p+k,G(n+p)=G(n)for all n with n0​≤n<2n0​+p+k,

then G(n+p)=G(n)\mathcal G(n+p)=\mathcal G(n)G(n+p)=G(n) for all n≥n0n\ge n_0n≥n0​. That is, Γ\GammaΓ is periodic with period ppp and preperiod n0n_0n0​.

This is the Octal Periodicity Theorem. It reduces periodicity of a finite octal game to a finite computation: one computes G(0),…,G(2n0+2p+k−1)\mathcal G(0),\dots,\mathcal G(2n_0+2p+k-1)G(0),…,G(2n0​+2p+k−1) and checks the hypothesis. For example, Kayles (0.770.770.77) has period 121212 and preperiod 717171, which follows from the first 2⋅71+2⋅12+2=1682\cdot71+2\cdot12+2=1682⋅71+2⋅12+2=168 values. It is the standard tool behind every known solution of a periodic octal game, and a companion to the open question OctalGames.guy_question (is every finite octal game eventually periodic?).

Formalization Note Siegel states the theorem for the exact length kkk (the largest index with dk≠0d_k\neq0dk​=0). Here kkk is any index beyond which all digits vanish; the two forms are equivalent, since a larger kkk only enlarges the range that the hypothesis checks.

Preamble
import Mathlib
import Definitions.Def_OctalGames_Code
open OctalGames
Formal statement
theorem OctalGames.periodicity_theorem (c : Code) (k n₀ p : ℕ) (hk : ∀ i, k < i → c.digit i = 0) (hn₀ : 1 ≤ n₀) (hp : 1 ≤ p) (h : ∀ n, n₀ ≤ n → n < 2 * n₀ + p + k → grundy c (n + p) = grundy c n) : ∀ n, n₀ ≤ n → grundy c (n + p) = grundy c n := by sorry
Source
A. N. Siegel, Combinatorial Game Theory, Graduate Studies in Mathematics 146, AMS 2013, Section IV.2, p. 190, Theorem 2.7 (Octal Periodicity Theorem); worked examples p. 191 (Dawson's Kayles 2*53+2*34+2=176, Kayles 2*71+2*12+2=168). Originally Guy-Smith 1956.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me