{
  "id": "7268",
  "ident": "NS.07268",
  "slug": "papers-claudescycles",
  "title": "Claude's Cycles",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "For odd `m > 1`, the cube digraph on `(ZMod m)³` has a Hamiltonian arc decomposition\ninto three directed cycles [Knu26].",
  "subjects": [
    "math.CO",
    "msc:05"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "papers",
  "source_url": "https://www-cs-faculty.stanford.edu/~knuth/papers/claude-cycles.pdf",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "ClaudesCycles.cube_hamiltonian_arc_decomposition",
  "statement_lean": "theorem cube_hamiltonian_arc_decomposition {m : ℕ} [NeZero m] (hm : Odd m) (hm' : 1 < m) :\n    HasHamiltonianArcDecomposition m",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Claude's Cycles\n\n*Reference:* [Claude's Cycles](https://www-cs-faculty.stanford.edu/~knuth/papers/claude-cycles.pdf)\nby *Donald E. Knuth* (2026)\n\nFix `m ≥ 2`. Consider the directed graph with vertex set `(ZMod m)³`, where from each vertex\n`(i, j, k)` there are directed arcs to `(i+1, j, k)`, `(i, j+1, k)`, and `(i, j, k+1)`\n(arithmetic mod `m`). The goal is to partition all `3m³` directed arcs into three\nedge-disjoint directed Hamiltonian cycles (each of length `m³`).\n\nKnuth describes an explicit construction, found by Claude (Anthropic), that achieves this\ndecomposition for all odd `m ≥ 3`. The case `m = 2` is known to be impossible [Aub82].\nThe even case `m > 2` is also settled. Knuth's paper says so in its final section, added in the\n14 April 2026 revision: \"Breaking news: The problem for even values of m is no longer in doubt!\"\nHo Boon Suan's algorithm [Ho26] is proved correct for even `m ≥ 8` in [GPT26], and\nAquino-Michaels [AM26] gives a decomposition for the even case that is simpler. The statement\nbelow starts at `m = 4`, which is below the range [GPT26] covers, so it also rests on the\nexplicit solutions in [Kn26], whose header gives even `m ≥ 4`.\n\n## References\n\n- [Knu26] D. E. Knuth, \"Claude's Cycles\" (2026).\n- [Aub82] J. Aubert, B. Schneider, \"Graphes orientés indécomposables en circuits hamiltoniens\",\n  J. Combin. Theory Ser. B 32 (1982), 347–349.\n- [Ho26] Ho Boon Suan, closed-form construction for even `m`,\n  <https://cs.stanford.edu/~knuth/even_closed_form.c>\n- [GPT26] A proof that [Ho26] yields three `m³`-cycles for every even `m ≥ 8`, 14 pages,\n  <https://cs.stanford.edu/~knuth/even_closed_form_proof_final.pdf>\n- [AM26] K. Aquino-Michaels, \"Completing Claude's cycles: Multi-agent structured exploration on\n  an open combinatorial problem\", <https://github.com/no-way-labs/residue>\n- [Kn26] Explicit even solutions for even `m ≥ 4`, recorded with [Knu26],\n  <https://cs.stanford.edu/~knuth/even_solution.py>\n- [KM26] K. Morrison, a Lean formalisation of the odd case,\n  <https://github.com/kim-em/KnuthClaudeLean>\n-/\n\n@[expose] public section\n\nnamespace ClaudesCycles\n\n/-- The vertex type: vectors in `(ZMod m)³`. -/\nabbrev Vertex (m : ℕ) := Fin 3 → ZMod m\n\n/-- Bump coordinate `b` of vertex `v`: add 1 to the `b`-th component. -/\ndef bumpAt {m : ℕ} [NeZero m] (b : Fin 3) (v : Vertex m) : Vertex m :=\n  Function.update v b (v b + 1)\n\n/-- Adjacency in the cube digraph: `u` is adjacent to `v` if `v` is obtained from `u` by\nbumping one coordinate. -/\ndef cubeAdj {m : ℕ} [NeZero m] (u v : Vertex m) : Prop :=\n  ∃ b : Fin 3, bumpAt b u = v\n\n/-- A permutation `σ` on vertices is a directed Hamiltonian cycle of a digraph with adjacency\n`adj` if every arc `(v, σ v)` is an edge, `σ` is a single cycle, and `σ` moves every vertex. -/\ndef IsDirectedHamiltonianCycle {V : Type*} [Fintype V] [DecidableEq V]\n    (adj : V → V → Prop) (σ : Equiv.Perm V) : Prop :=\n  (∀ v, adj v (σ v)) ∧ σ.IsCycle ∧ σ.support = Finset.univ\n\n@[category API, AMS 5]\ntheorem bumpAt_apply_self {m : ℕ} [NeZero m] (b : Fin 3) (v : Vertex m) :\n    bumpAt b v b = v b + 1 := by\n  simp [bumpAt]\n\n@[category API, AMS 5]\ntheorem bumpAt_apply_of_ne {m : ℕ} [NeZero m] {b b' : Fin 3} (h : b ≠ b') (v : Vertex m) :\n    bumpAt b v b' = v b' := by\n  simp [bumpAt, Function.update_of_ne (Ne.symm h)]\n\n/-- The three arcs leaving a vertex are distinct, which is what makes the `∃!` in\n`HasHamiltonianArcDecomposition` a condition about arcs rather than about heads that might\ncoincide. It needs `1 < m`. -/\n@[category test, AMS 5]\ntheorem bumpAt_injective {m : ℕ} [NeZero m] (hm : 1 < m) (v : Vertex m) :\n    Function.Injective fun b => bumpAt b v := by\n  have : Fact (1 < m) := ⟨hm⟩\n  intro b b' h\n  by_contra hne\n  have hb : bumpAt b v b = bumpAt b' v b := congrFun h b\n  rw [bumpAt_apply_self, bumpAt_apply_of_ne (Ne.symm hne)] at hb\n  simp at hb\n\n/-- The arcs of the cube digraph on `(ZMod m)³` can be decomposed into three directed\nHamiltonian cycles: there exist three permutations, each forming a directed Hamiltonian\ncycle, such that every arc `(v, bumpAt b v)` belongs to exactly one cycle. -/\ndef HasHamiltonianArcDecomposition (m : ℕ) [NeZero m] : Prop :=\n  ∃ σ : Fin 3 → Equiv.Perm (Vertex m),\n    (∀ c, IsDirectedHamiltonianCycle (cubeAdj (m := m)) (σ c)) ∧\n    (∀ v : Vertex m, ∀ b : Fin 3, ∃! c : Fin 3, σ c v = bumpAt b v)\n\n/-- The hypothesis `1 < m` on `cube_hamiltonian_arc_decomposition` is load-bearing. At `m = 1`\nthe vertex type has one element, so the only permutation of it is the identity, which is not a\ncycle. Note that `Odd 1` holds, so without `1 < m` the odd statement would be false. -/\n@[category test, AMS 5]\ntheorem not_hasHamiltonianArcDecomposition_one : ¬ HasHamiltonianArcDecomposition 1 := by\n  rintro ⟨σ, hcyc, -⟩\n  exact (hcyc 0).2.1.ne_one (Subsingleton.elim _ _)\n\nset_option linter.style.formal_proof_palomar false in\n/-- For odd `m > 1`, the cube digraph on `(ZMod m)³` has a Hamiltonian arc decomposition\ninto three directed cycles [Knu26]. -/\n@[category research solved, AMS 5, formal_proof using lean4 at \"https://github.com/kim-em/KnuthClaudeLean/blob/bdda6025fb7954f614ed9a7ac7382455fd064940/Solution.lean#L5\"]\ntheorem cube_hamiltonian_arc_decomposition {m : ℕ} [NeZero m] (hm : Odd m) (hm' : 1 < m) :\n    HasHamiltonianArcDecomposition m := by\n  sorry\n\n/-- The case `m = 2` is impossible: the cube digraph on `(ZMod 2)³` does not have a\nHamiltonian arc decomposition [Aub82]. -/\n@[category research solved, AMS 5]\ntheorem cube_hamiltonian_arc_decomposition_impossible_m2 :\n    ¬ HasHamiltonianArcDecomposition 2 := by\n  sorry\n\n/-- For even `m > 2`, the cube digraph on `(ZMod m)³` has a Hamiltonian arc decomposition.\nKnuth records this as settled in the final section of [Knu26], by [Ho26] with the proof in\n[GPT26] for even `m ≥ 8`, and by [AM26] for the even case generally. -/\n@[category research solved, question, AMS 5]\ntheorem cube_hamiltonian_arc_decomposition_even :\n    ∀ᵉ (m : ℕ) (_ : NeZero m) (_ : Even m) (_ : 2 < m),\n      HasHamiltonianArcDecomposition m := by\n  sorry\n\nend ClaudesCycles\n",
  "statement_hash": "f7fdd72ef4a415423f1fb7fd3130a3bdb1e5ae1b78031bfc0fa92cfc85f9569e",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}