Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 4 (Sprague–Grundy): sg(G1⊎⋯⊎Gh)=sg(G1)⊕⋯⊕sg(Gh)\mathrm{sg}(G_1\uplus\cdots\uplus G_h)=\mathrm{sg}(G_1)\oplus\cdots\oplus\mathrm{sg}(G_h)sg(G1​⊎⋯⊎Gh​)=sg(G1​)⊕⋯⊕sg(Gh​)

Proved
ArcKayles192.PSPACE.lemma_4

by mikedeng1 · Nov 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

arc-kaylesnimp2o-batch-stoc27ap2o-gran-per-chapterp2o-plan-paperp2o-strengthenedp2o-v1sprague-grundy

Let h≥0h\ge 0h≥0 and let G1,…,GhG_1,\dots,G_hG1​,…,Gh​ be simple graphs on vertex types W1,…,WhW_1,\dots,W_hW1​,…,Wh​, with positions S1,…,ShS_1,\dots,S_hS1​,…,Sh​. Let G1⊎⋯⊎GhG_1\uplus\cdots\uplus G_hG1​⊎⋯⊎Gh​ be their disjoint union on ΣiWi\Sigma_iW_iΣi​Wi​, with position S1⊎⋯⊎ShS_1\uplus\cdots\uplus S_hS1​⊎⋯⊎Sh​. Then

sg(G1⊎⋯⊎Gh, S1⊎⋯⊎Sh)=sg(G1,S1)⊕⋯⊕sg(Gh,Sh),\mathrm{sg}(G_1\uplus\cdots\uplus G_h,\ S_1\uplus\cdots\uplus S_h)=\mathrm{sg}(G_1,S_1)\oplus\cdots\oplus\mathrm{sg}(G_h,S_h),sg(G1​⊎⋯⊎Gh​, S1​⊎⋯⊎Sh​)=sg(G1​,S1​)⊕⋯⊕sg(Gh​,Sh​),

where ⊕\oplus⊕ is bitwise exclusive or on N\mathbb NN and the empty xor is 000.

This is the Sprague–Grundy theorem for Arc Kayles, due to Sprague (1935) and Grundy (1939). Claims 7–10 use it to split GφG_\varphiGφ​ into components.

Differences from the source:

  • encoding: a position is a graph; isolated vertices are removed automatically (p.3) → a position is a finite set S of remaining vertices of an ambient simple graph G, the current graph being G[S]; isolated vertices stay in S; reason: an isolated vertex carries no move, so outcomes and values are unchanged; every finite graph H is the position (H, all vertices), and every position is the finite graph G[S]
  • generalization: a family G_1, …, G_h (h ≥ 1 implicit) → h ≥ 0; for h = 0 both sides are 0; reason: the case h ≥ 1 is the source's statement; h = 0 adds only the empty union
  • encoding: G_1 ⊎ ⋯ ⊎ G_h and a_1 ⊕ ⋯ ⊕ a_h → sigmaGraph on the sigma type Σ i : Fin h, W i; xor as List.foldr (· ^^^ ·) 0 over List.ofFn; reason: ⊕ is associative and commutative with unit 0, so the fold order is immaterial
Preamble
import Mathlib
import Definitions.Def_ArcKayles192_PSPACE_Game
Formal statement
namespace ArcKayles192.PSPACE

/-- **Lemma 4** (Sprague–Grundy, p.3). For every finite family of graphs `G₁, …, G_h` (here with
positions `S_i`), the value of the disjoint union is the bitwise xor of the values:
`sg(G₁ ⊎ ⋯ ⊎ G_h) = sg(G₁) ⊕ ⋯ ⊕ sg(G_h)`. The empty union (`h = 0`) has value `0`. -/
theorem lemma_4 (h : ℕ) {W : Fin h → Type*} [∀ i, DecidableEq (W i)]
    (G : ∀ i, SimpleGraph (W i)) (S : ∀ i, Finset (W i)) :
    sg (sigmaGraph G) (Finset.univ.sigma S) =
      (List.ofFn fun i => sg (G i) (S i)).foldr (· ^^^ ·) 0 := by sorry

end ArcKayles192.PSPACE
Source
Édouard Bonnet, Arc Kayles is PSPACE-complete, STOC 2027 submission #192 (October 2026), source.pdf SHA-256 f8b3a1c14347452b03dab2f19656aa6d2b17ba3956fefe2abc190b98ce44fc53, p.3, Lemma 4 (citing [14, 8])
Human review
  • Endorsed by Shuze Chen · Nov 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Nov 8, 2026

    Confirmed by the mission captain (proposal self-audit).

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