Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Property b): nearest neighbor from the start node can produce PiP_iPi​

Proved
TSPHeuristics.NNLower.gbar_nearest_neighbor_path

by mikedeng1 · Sep 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

nearest-neighborp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1traveling-salesman

For every i≥1i\ge1i≥1, the nearest neighbor algorithm on Gˉi\bar G_iGˉi​, started at the start node of GiG_iGi​, can, with a suitable resolution of ties, visit the nodes in the order of the path PiP_iPi​ and then return from the middle node (the last node of PiP_iPi​) to the start node. That is, the tour τ\tauτ with τ(k)=\tau(k)=τ(k)= the kkk-th node of PiP_iPi​ (k=0,…,2i+1−2k=0,\dots,2^{i+1}-2k=0,…,2i+1−2) exists and is a nearest-neighbor tour of Gˉi\bar G_iGˉi​.

This is property b) of p. 568: it identifies one run of the algorithm whose tour is long.

Formalization Note "The kkk-th node of PiP_iPi​" is (pathP i).getD k 0; the statement asserts that some permutation lists PiP_iPi​ (so PiP_iPi​ visits every node once) and that it satisfies IsNearestNeighborTour, which allows ties to be broken arbitrarily.

Preamble
import Mathlib
import Definitions.Def_TSPHeuristics_NNLower_TSPModel
import Definitions.Def_TSPHeuristics_NNLower_LowerBoundFamily
Formal statement
namespace TSPHeuristics.NNLower

/-- Property b), p. 568: for `i ≥ 1`, the nearest neighbor method started at the start node of
`Ḡ_i` can (with suitable resolution of ties) produce the path `P_i` followed by the edge returning
from the middle node to the start node: the tour that visits the nodes in the order of `P_i` is a
nearest-neighbor tour of `Ḡ_i`. -/
theorem gbar_nearest_neighbor_path (i : ℕ) (hi : 1 ≤ i) :
    ∃ τ : Equiv.Perm (Fin (numNodes i)),
      (∀ k : Fin (numNodes i), (τ k : ℕ) = (pathP i).getD k 0) ∧
      IsNearestNeighborTour (gbar i) τ := by sorry

end TSPHeuristics.NNLower
Source
Rosenkrantz, Stearns, Lewis, An Analysis of Several Heuristics for the Traveling Salesman Problem, SIAM J. Comput. 6(3), 1977, https://doi.org/10.1137/0206041, p. 568, property b)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting.

  • ni=2i+1−1n_i = 2^{i+1} - 1ni​=2i+1−1 is the number of nodes.
  • PiP_iPi​ is the recursively defined list of nodes: P1=[0,2,1]P_1 = [0,2,1]P1​=[0,2,1], and Pj+1P_{j+1}Pj+1​ is PjP_jPj​, then PjP_jPj​ shifted by nj+1n_j + 1nj​+1, then the node njn_jnj​.
  • Gˉi(a,b)\bar G_i(a,b)Gˉi​(a,b) is the shortest-path distance in the edge list GiG_iGi​, for a,b<nia,b < n_ia,b<ni​.

Claim. For every natural number i≥1i \ge 1i≥1, there exists a permutation τ\tauτ of {0,…,ni−1}\{0,\dots,n_i-1\}{0,…,ni​−1} with two properties.

  1. Order matches PiP_iPi​: for every k<nik < n_ik<ni​, τ(k)\tau(k)τ(k) equals the kkk-th entry of PiP_iPi​, counting from 000. If PiP_iPi​ had no kkk-th entry, the value 000 would be used instead. PiP_iPi​ has exactly nin_ini​ entries, so this default is never used.
  2. Nearest-neighbour property: for every kkk with k+1<nik+1 < n_ik+1<ni​ and every node j∉{τ(0),…,τ(k)}j \notin \{\tau(0),\dots,\tau(k)\}j∈/{τ(0),…,τ(k)},
Gˉi(τ(k),τ(k+1))≤Gˉi(τ(k),j).\bar G_i\bigl(\tau(k), \tau(k+1)\bigr) \le \bar G_i\bigl(\tau(k), j\bigr).Gˉi​(τ(k),τ(k+1))≤Gˉi​(τ(k),j).

Degenerate cases.

  • The case i=0i = 0i=0 is excluded.
  • Because τ\tauτ must be a permutation, the claim includes the assertion that the entries of PiP_iPi​ are pairwise distinct and cover all nin_ini​ nodes.
  • Nothing is asserted about the closing step from τ(ni−1)\tau(n_i - 1)τ(ni​−1) back to τ(0)\tau(0)τ(0).
  • Ties are allowed: the chosen next node need only be no farther than every unvisited node.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 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