{
  "id": "7967",
  "ident": "NS.07967",
  "slug": "wikipedia-gracefullabeling",
  "title": "Graceful Tree Conjecture (Ringel–Kotzig conjecture)",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Every tree admits a graceful labeling.\n\nA graceful labeling of a tree $T$ with $m$ edges is an injective map $f : V \\to \\{0, \\dots, m\\}$\nsuch that the multiset of absolute differences $|f(u) - f(v)|$ over edges $\\{u,v\\}$ of $T$\nequals $\\{1, \\dots, m\\}$.",
  "subjects": [
    "math.CO",
    "msc:05"
  ],
  "tags": [],
  "collection": "wikipedia",
  "source_url": "https://en.wikipedia.org/wiki/Graceful_labeling",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "GracefulLabeling.graceful_tree_conjecture",
  "statement_lean": "theorem graceful_tree_conjecture {V : Type*} [Fintype V] [DecidableEq V]\n    (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) :\n    let m := T.edgeFinset.card\n    ∃ f : V → ℕ,\n      Function.Injective f ∧\n      (∀ v, f v ≤ m) ∧\n      T.edgeFinset.image (fun e =>\n        e.lift ⟨fun u v => Int.natAbs ((f u : ℤ) - (f v : ℤ)),\n                fun u v => by\n                  show ((f u : ℤ) - f v).natAbs = ((f v : ℤ) - f u).natAbs\n                  rw [← Int.natAbs_neg, neg_sub]⟩) = Finset.Icc 1 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# Graceful Tree Conjecture (Ringel–Kotzig conjecture)\n\n*Reference:* [Wikipedia/Graceful_labeling](https://en.wikipedia.org/wiki/Graceful_labeling)\n\nConjectured by Ringel (1963) and Kotzig; formalized by Rosa (1967).\n-/\n\n@[expose] public section\n\nnamespace GracefulLabeling\n\nopen SimpleGraph\n\n@[category test, AMS 5]\nlemma graceful_tree_one_vertex :\n    let T : SimpleGraph Unit := ⊥\n    let m := T.edgeFinset.card\n    ∃ f : Unit → ℕ,\n      Function.Injective f ∧\n      (∀ v, f v ≤ m) ∧\n      T.edgeFinset.image (fun e =>\n        e.lift ⟨fun u v => Int.natAbs ((f u : ℤ) - (f v : ℤ)),\n                fun u v => by\n                  show ((f u : ℤ) - f v).natAbs = ((f v : ℤ) - f u).natAbs\n                  rw [← Int.natAbs_neg, neg_sub]⟩) = Finset.Icc 1 m := by\n  intro T m\n  use fun _ => 0\n  refine ⟨fun _ _ _ => rfl, fun _ => Nat.zero_le _, ?_⟩\n  simp [m, T]\n\n@[category test, AMS 5]\nlemma graceful_tree_two_vertex :\n    let T : SimpleGraph (Fin 2) := ⊤\n    let m := T.edgeFinset.card\n    ∃ f : Fin 2 → ℕ,\n      Function.Injective f ∧\n      (∀ v, f v ≤ m) ∧\n      T.edgeFinset.image (fun e =>\n        e.lift ⟨fun u v => Int.natAbs ((f u : ℤ) - (f v : ℤ)),\n                fun u v => by\n                  show ((f u : ℤ) - f v).natAbs = ((f v : ℤ) - f u).natAbs\n                  rw [← Int.natAbs_neg, neg_sub]⟩) = Finset.Icc 1 m := by\n  intro T m\n  use Fin.val\n  refine ⟨Fin.val_injective, by decide, ?_⟩\n  revert m T\n  decide\n\n/--\nEvery tree admits a graceful labeling.\n\nA graceful labeling of a tree $T$ with $m$ edges is an injective map $f : V \\to \\{0, \\dots, m\\}$\nsuch that the multiset of absolute differences $|f(u) - f(v)|$ over edges $\\{u,v\\}$ of $T$\nequals $\\{1, \\dots, m\\}$.\n-/\n@[category research open, AMS 5]\ntheorem graceful_tree_conjecture {V : Type*} [Fintype V] [DecidableEq V]\n    (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) :\n    let m := T.edgeFinset.card\n    ∃ f : V → ℕ,\n      Function.Injective f ∧\n      (∀ v, f v ≤ m) ∧\n      T.edgeFinset.image (fun e =>\n        e.lift ⟨fun u v => Int.natAbs ((f u : ℤ) - (f v : ℤ)),\n                fun u v => by\n                  show ((f u : ℤ) - f v).natAbs = ((f v : ℤ) - f u).natAbs\n                  rw [← Int.natAbs_neg, neg_sub]⟩) = Finset.Icc 1 m := by\n  sorry\n\nend GracefulLabeling\n",
  "statement_hash": "d8c05f3bf9e23fd20e2e5a0caba0514e467b95551a270c752a8b69b245e1f896",
  "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."
}