Mathematics / Original Research / Graph Theory
Every Tree with at Most Five Leaves Is Graceful: A Machine-Checked Proof in Lean 4
Proves the five-leaf case of the Graceful Tree Conjecture for every order, arm length and branch topology, with a Lean 4 proof checked in a local build. The general conjecture remains open.
- Author
- Ali Uyar
- Scope
- Machine-checked in Lean 4
- Status
- Standalone result
- Original theorem
- Every nonempty finite tree with at most five leaves is graceful (Lean: GracefulTrees.Solution.five_leaf_trees : Target_FiveLeafTrees).
Machine-checked in Lean 4 ✓
Abstract
The Graceful Tree Conjecture (usually attributed to Ringel and Kotzig; graceful labelings are Rosa's 1967 β-valuations) asserts that every finite tree T with q edges admits a vertex bijection into {0, 1, ..., q} whose induced edge differences equal {1, ..., q}. Huang, Kotzig, and Rosa proved in 1982 that every tree with at most four leaves is graceful, and Panpa, Imnang, and Wasuanankul proved in 2025 that every spider with at most five legs is graceful. We are not aware of a refereed proof for general five-leaf trees. An October 2026 preprint by Jiang et al. (arXiv:2610.02945) lists an AI-proposed argument for all trees with at most seven leaves that, according to its authors, has not been checked by a person or formalized in Lean.
We prove in pure-stdlib Lean 4.34.0 that every finite tree with at most five leaves is graceful, with no restriction on order, arm lengths, or branch topology. A branch-degree classification reduces all five-leaf trees to five-legged spiders, degree-(4,3) double-hub trees, and degree-(3,3,3) triple-hub trees. The core is a constructive characterization of the internal-zero three-arm spider problem: S(a, b, m+c) admits a graceful labeling placing 0 at distance m along the third arm if and only if (a, b, m, c) ≠ (1, 1, 1, 2). It is established by ten constructive families, a 180-formula modulo-4 case cover verified with omega, and 22 kernel-checked finite residuals, and then combined with spine extraction and α-amalgamation across all triple-hub trees. The Lean development also reproves the four-leaf and five-legged-spider theorems (formalizations of known results). Later additions include a Lean proof that trees of diameter at most four are graceful (a known theorem of Zhao, 1989) and some lobster and transfer families, for which no novelty is claimed.
Context
Leaf count is one of the standard structural restrictions under which the Graceful Tree Conjecture has been studied. The four-leaf case dates from 1982, five-legged spiders from 2025, and we know of no refereed proof for general five-leaf trees. The obstacle is triple-hub trees, which require placing label 0 at arbitrary internal spine vertices. The exact internal-zero three-arm spider theorem handles this, and machine-checking the full case cover rules out gaps in the case analysis.
Credits
Four-leaf theorem: Huang, Kotzig, and Rosa (1982). Five-legged spiders: A. Panpa, S. Imnang, and T. Wasuanankul (2025, doi:10.1155/jama/5826777). Diameter-four theorem: S.-L. Zhao (1989). Subdivision theorem: Burzio and Ferrarese (1998). The Lean proofs of these known results are formalizations. No third-party Lean code was adapted. The Lean development and scripts were produced with AI coding agents operated by the author; the agent and model were not recorded.
Cite
@misc{uyar2026_graceful_five_leaf_trees,
author = {Uyar, Ali},
title = {Every Tree with at Most Five Leaves Is Graceful: A Machine-Checked Proof in Lean 4},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.24765082},
url = {https://doi.org/10.5281/zenodo.24765082},
note = {Machine-checked in Lean 4. Code: https://github.com/aliuyar1234/verified-combinatorics/tree/main/08-graceful-trees}
}