Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Corollary to Theorem 6 — nearest and cheapest insertion can return a kkk-optimal tour with INSERT/OPTIMAL =2(1−1/n)= 2(1-1/n)=2(1−1/n) when 4k≤n4k\le n4k≤n

Proved
TSPHeuristics.KOpt.insertion_k_optimal_ratio_two_mul_one_sub_inv

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

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

Let n≥6n\ge 6n≥6 and let kkk be a natural number with 4k≤n4k\le n4k≤n. There is a traveling salesman graph (N,d)(N,d)(N,d) on nnn nodes with OPTIMAL>0\mathrm{OPTIMAL}>0OPTIMAL>0 such that

  1. some run of nearest insertion on (N,d)(N,d)(N,d) returns a tour TnT_nTn​ that is kkk-optimal and satisfies
INSERTOPTIMAL=2(1−1n),\frac{\mathrm{INSERT}}{\mathrm{OPTIMAL}}=2\left(1-\frac1n\right),OPTIMALINSERT​=2(1−n1​),
  1. some run of cheapest insertion on the same (N,d)(N,d)(N,d) returns a tour with the same two properties.

Thus even when nearest or cheapest insertion happens to return a tour that no kkk-change can improve, its length can be as large as the worst-case guarantee 2(1−1/n)⋅2(1-1/n)\cdot2(1−1/n)⋅OPTIMAL of these methods: local optimality certifies nothing better.

Formalization Note The ratio is multiplied out: cycleLength d (T n) = 2 * (1 - 1/n) * optimal d, with OPTIMAL the true minimum over all tours. The conjunct 0 < optimal d is the paper's standing assumption (1.1) (p. 564); without it the zero distance would satisfy everything trivially. The hypothesis n≥6n\ge 6n≥6 is added to the printed Corollary ("for any k and n such that 4·k ≦ n"): its proof is the example of Theorem 5, which the paper establishes only for n≥6n\ge 6n≥6, and for k=0k=0k=0, n=3n=3n=3 the printed statement is false (every tour on three nodes is optimal). kkk-optimality compares the returned tour with every tour at edge difference exactly kkk. Both methods are stated on the same graph, which is what the proof gives.

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

theorem insertion_k_optimal_ratio_two_mul_one_sub_inv (n k : ℕ) (hn : 6 ≤ n) (hk : 4 * k ≤ 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 ∧
        IsKOptimal d k (T n) ∧ 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 ∧
        IsKOptimal d k (T n) ∧ 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. 581, Corollary to Theorem 6 (with n ≥ 6 from Theorem 5, p. 575)
Read-back

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

For every pair of natural numbers nnn and kkk with

n≥6and4k≤n,n \ge 6 \qquad\text{and}\qquad 4k \le n,n≥6and4k≤n,

the statement says there is a real-valued function d(i,j)d(i,j)d(i,j) defined on ordered pairs of points i,j∈{0,1,…,n−1}i, j \in \{0, 1, \dots, n-1\}i,j∈{0,1,…,n−1} that has all of the following properties.

  1. ddd is a TSP distance. ddd satisfies the bundle's predicate IsTSPDist. The code of this predicate is not included in what I was given, so I cannot say which axioms it imposes. It might require symmetry, non-negative values, zero on the diagonal or the triangle inequality, but that is not visible here.
  2. The optimum is positive. OPT(d)>0\mathrm{OPT}(d) > 0OPT(d)>0, where OPT(d)\mathrm{OPT}(d)OPT(d) is the bundle's optimal d. Its definition is also not shown. It is presumably meant as the shortest tour length for ddd, but the code shown does not fix this. For example, it does not show whether the optimum is taken over tours that visit all nnn points, or whether it is an infimum that returns a default value.
  3. A nearest-insertion run ends at the stated length. There exist a sequence of lists of points T0,T1,T2,…T_0, T_1, T_2, \dotsT0​,T1​,T2​,… (one list for each natural number) and a sequence of points a0,a1,a2,…a_0, a_1, a_2, \dotsa0​,a1​,a2​,… such that all of the following hold:
    • (T,a)(T, a)(T,a) satisfies IsInsertionRun for ddd.
    • (T,a)(T, a)(T,a) satisfies IsNearestRule for ddd.
    • The list TnT_nTn​ (the entry at index nnn, where nnn is the number of points) satisfies IsKOptimal for ddd and the same kkk.
    • The cycle length of TnT_nTn​ under ddd (cycleLength) is exactly
lend(Tn)=2(1−1n)OPT(d).\mathrm{len}_d(T_n) = 2\left(1 - \frac{1}{n}\right)\mathrm{OPT}(d).lend​(Tn​)=2(1−n1​)OPT(d).
  1. A cheapest-insertion run ends at the same length. There also exist a sequence of lists T0′,T1′,…T'_0, T'_1, \dotsT0′​,T1′​,… and points a0′,a1′,…a'_0, a'_1, \dotsa0′​,a1′​,…, possibly different from those in item 3, such that all of the following hold:
    • (T′,a′)(T', a')(T′,a′) satisfies IsInsertionRun for ddd.
    • (T′,a′)(T', a')(T′,a′) satisfies IsCheapestRule for ddd.
    • Tn′T'_nTn′​ satisfies IsKOptimal for ddd and kkk.
    • lend(Tn′)=2(1−1n)OPT(d)\mathrm{len}_d(T'_n) = 2\left(1 - \frac{1}{n}\right)\mathrm{OPT}(d)lend​(Tn′​)=2(1−n1​)OPT(d).

The same distance function ddd has to serve both runs, but the two runs are chosen independently.

None of the predicates IsInsertionRun, IsNearestRule, IsCheapestRule, IsKOptimal or cycleLength is shown in the code I received, so I cannot unfold them. Whatever they actually require is exactly what this statement asserts. The following points in particular are open:

  • which entries of TTT and aaa IsInsertionRun constrains;
  • whether TnT_nTn​ is required to be a tour through all nnn points;
  • what "kkk-optimal" means precisely, and what it means for small kkk.

The statement only asserts that such a ddd and such runs exist for each allowed (n,k)(n, k)(n,k). It says nothing about every distance function or every run. It uses equality, not an inequality, and the constant is exactly 2(1−1/n)2(1 - 1/n)2(1−1/n).

Degenerate cases. Because n≥6n \ge 6n≥6, the set of points is never empty and never has just one element. The division 1/n1/n1/n is always a genuine real division by a nonzero number, and 2(1−1/n)2(1 - 1/n)2(1−1/n) lies in [5/3,2)[5/3, 2)[5/3,2). The case k=0k = 0k=0 is allowed for every n≥6n \ge 6n≥6, since 4⋅0≤n4 \cdot 0 \le n4⋅0≤n. In that case the requirement "TnT_nTn​ is 000-optimal" means whatever IsKOptimal says for k=0k = 0k=0, which may be trivially true. The largest allowed value is k=⌊n/4⌋k = \lfloor n/4 \rfloork=⌊n/4⌋, for example k=1k = 1k=1 when n=6n = 6n=6 or 777. The sequences TTT and aaa are defined at every natural-number index, including indices above nnn. Whether those entries are constrained, and whether TnT_nTn​ is the final tour, depends entirely on the unseen definition of IsInsertionRun. If optimal returns a default value on some inputs, for example 000 for an empty or unbounded set, the requirement OPT(d)>0\mathrm{OPT}(d) > 0OPT(d)>0 rules out a ddd where that default is 000 or negative.

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).

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