Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 5 — nearest and cheapest insertion can reach INSERT/OPTIMAL =2(1−1/n)= 2(1-1/n)=2(1−1/n)

Proved
TSPHeuristics.KOpt.theorem_5_insertion_ratio_two_mul_one_sub_inv

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

insertionp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1traveling-salesmanworst-case-example

For every n≥6n\ge 6n≥6 there is a traveling salesman graph (N,d)(N,d)(N,d) on nnn nodes with OPTIMAL>0\mathrm{OPTIMAL}>0OPTIMAL>0 on which both nearest insertion and cheapest insertion can produce a tour of length INSERT with

INSERTOPTIMAL=2(1−1n).(4.14)\frac{\mathrm{INSERT}}{\mathrm{OPTIMAL}}=2\left(1-\frac1n\right).\qquad(4.14)OPTIMALINSERT​=2(1−n1​).(4.14)

Together with the Corollary to Theorem 4 (INSERT ≤2(1−1/n)⋅\le 2(1-1/n)\cdot≤2(1−1/n)⋅OPTIMAL for both methods) this shows that the bound 2(1−1/n)2(1-1/n)2(1−1/n) is attained for every n≥6n\ge 6n≥6.

Formalization Note The ratio is multiplied out: cycleLength d (T n) = 2 * (1 - 1/n) * optimal d. The conjunct 0 < optimal d is the paper's standing assumption (1.1) (p. 564, which excludes the identically zero distance); without it the zero distance would make the statement trivial. "For either the nearest insertion or cheapest insertion methods" is read as both methods on one and the same graph, which is what the proof gives; each method comes with its own run (T1,…,TnT_1,\dots,T_nT1​,…,Tn​ and a0,…,an−1a_0,\dots,a_{n-1}a0​,…,an−1​), existentially quantified since ties may be resolved suitably.

Preamble
import Mathlib
import Definitions.Def_TSPHeuristics_Shared_Insertion
Formal statement
namespace TSPHeuristics.KOpt

theorem theorem_5_insertion_ratio_two_mul_one_sub_inv (n : ℕ) (hn : 6 ≤ n) :
    ∃ d : Fin n → Fin n → ℝ, TSPHeuristics.Shared.IsTSPDist d ∧ 0 < TSPHeuristics.Shared.optimal d ∧
      (∃ (T : ℕ → List (Fin n)) (a : ℕ → Fin n), TSPHeuristics.Shared.IsInsertionRun d T a ∧ TSPHeuristics.Shared.IsNearestRule d T a ∧
        TSPHeuristics.Shared.cycleLength d (T n) = 2 * (1 - 1 / (n : ℝ)) * TSPHeuristics.Shared.optimal d) ∧
      (∃ (T : ℕ → List (Fin n)) (a : ℕ → Fin n), TSPHeuristics.Shared.IsInsertionRun d T a ∧ TSPHeuristics.Shared.IsCheapestRule d T a ∧
        TSPHeuristics.Shared.cycleLength d (T n) = 2 * (1 - 1 / (n : ℝ)) * TSPHeuristics.Shared.optimal d) := by sorry

end TSPHeuristics.KOpt
Source
Rosenkrantz, Stearns, Lewis, An Analysis of Several Heuristics for the Traveling Salesman Problem, SIAM J. Comput. 6(3), 1977, p. 575, Theorem 5, (4.14)
Read-back

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

Hypothesis. n≥6n \ge 6n≥6.

Claim. There exists a real-valued function ddd on ordered pairs of nodes in {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1} such that all of the following hold:

  1. IsTSPDist(d)\mathrm{IsTSPDist}(d)IsTSPDist(d);
  2. 0<optimal(d)0 < \mathrm{optimal}(d)0<optimal(d);
  3. there exist a sequence of node lists T0,T1,…T_0, T_1, \dotsT0​,T1​,… and a sequence of nodes a0,a1,…a_0, a_1, \dotsa0​,a1​,… with IsInsertionRun(d,T,a)\mathrm{IsInsertionRun}(d,T,a)IsInsertionRun(d,T,a) and IsNearestRule(d,T,a)\mathrm{IsNearestRule}(d,T,a)IsNearestRule(d,T,a), and
cycleLengthd(Tn)=2(1−1n) optimal(d);\mathrm{cycleLength}_d(T_n) = 2\Bigl(1-\frac{1}{n}\Bigr)\,\mathrm{optimal}(d);cycleLengthd​(Tn​)=2(1−n1​)optimal(d);
  1. there exist (possibly different) sequences T′,a′T', a'T′,a′ with IsInsertionRun(d,T′,a′)\mathrm{IsInsertionRun}(d,T',a')IsInsertionRun(d,T′,a′) and IsCheapestRule(d,T′,a′)\mathrm{IsCheapestRule}(d,T',a')IsCheapestRule(d,T′,a′), and the same equality holds for Tn′T'_nTn′​.

Scope of the existentials.

  • The function ddd is only asserted to exist. It is not specified.
  • The nearest-rule run and the cheapest-rule run are separate existentials, so they need not be the same run.

Undisplayed definitions. IsTSPDist\mathrm{IsTSPDist}IsTSPDist, optimal\mathrm{optimal}optimal, cycleLength\mathrm{cycleLength}cycleLength, IsInsertionRun\mathrm{IsInsertionRun}IsInsertionRun, IsNearestRule\mathrm{IsNearestRule}IsNearestRule and IsCheapestRule\mathrm{IsCheapestRule}IsCheapestRule come from a shared module whose code is not included here. Their content cannot be stated from this code.

Degenerate cases. n≥6n \ge 6n≥6 rules out small nnn, so 1/n1/n1/n is an ordinary reciprocal and no division by zero occurs. The equality is exact. It says the lengths equal the ratio times the optimum; it is not stated as an upper or lower bound.

Human review
  • Endorsed by Shuze Chen · Sep 28, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 28, 2026

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

  • Endorsed by Community (Bot) · Oct 30, 2026

    Confirmed by the moderator at approval.

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