Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Eq. (3.12) — COST(T_i, a_i) ≤ OPTIMAL

Proved
TSPHeuristics.Insertion.insCost_le_optimal

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

insertionp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1traveling-salesman

Let (N,d)(N,d)(N,d) be a traveling salesman graph with nnn nodes, and let T1,…,TnT_1,\dots,T_nT1​,…,Tn​ and a0,…,an−1a_0,\dots,a_{n-1}a0​,…,an−1​ be the subtours and nodes of an insertion method run. For every 1≤i<n1\le i<n1≤i<n,

COST(Ti,ai) ≤ OPTIMAL.(3.12)\mathrm{COST}(T_i,a_i)\ \le\ \mathrm{OPTIMAL}.\tag{3.12}COST(Ti​,ai​) ≤ OPTIMAL.(3.12)

With lai=12COST(Ti,ai)l_{a_i}=\tfrac12\mathrm{COST}(T_i,a_i)lai​​=21​COST(Ti​,ai​) this is condition b) of Lemma 1.

Formalization Note Subtours are lists of nodes; the closed length of a list [x0,…,xm−1][x_0,\dots,x_{m-1}][x0​,…,xm−1​] is d(x0,x1)+⋯+d(xm−2,xm−1)+d(xm−1,x0)d(x_0,x_1)+\dots+d(x_{m-2},x_{m-1})+d(x_{m-1},x_0)d(x0​,x1​)+⋯+d(xm−2​,xm−1​)+d(xm−1​,x0​). The paper's 1-based subtour index is kept: T1=[a0]T_1=[a_0]T1​=[a0​], and TnT_nTn​ is the final tour. Every choice of the inserted nodes and every minimizing insertion position is allowed. d(i,i)=0d(i,i)=0d(i,i)=0 is assumed as a normalization (not in the paper; it never enters a length).

Preamble
import Mathlib
import Definitions.Def_TSPHeuristics_Shared_TSPModel
import Definitions.Def_TSPHeuristics_Insertion_InsertionMethod
Formal statement
namespace TSPHeuristics.Insertion

/-- (3.12), p. 572: in an insertion method run, every insertion cost is at most OPTIMAL:
`COST(T_i, a_i) ≤ OPTIMAL` for `1 ≤ i < n`. -/
theorem insCost_le_optimal {n : ℕ} (d : Fin n → Fin n → ℝ) (hd : TSPHeuristics.Shared.IsTSPDist d)
    (T : ℕ → List (Fin n)) (a : ℕ → Fin n) (hrun : IsInsertionRun d T a) :
    ∀ i : ℕ, 1 ≤ i → i < n → insCost d (T i) (a i) ≤ TSPHeuristics.Shared.optimal d := by sorry

end TSPHeuristics.Insertion
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. 572, proof of Theorem 3, eqs. (3.12)–(3.13)
Read-back

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

Let nnn be any natural number, with nodes {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1}. Let ddd be a real-valued function on pairs of nodes satisfying the imported predicate IsTSPDist(d)\mathrm{IsTSPDist}(d)IsTSPDist(d), whose definition is not shown. Write OPTd\mathrm{OPT}_dOPTd​ for the imported quantity optimal(d)\mathrm{optimal}(d)optimal(d), also not shown. Let (Ti)i∈N(T_i)_{i\in\mathbb N}(Ti​)i∈N​ be lists of nodes and (ai)i∈N(a_i)_{i\in\mathbb N}(ai​)i∈N​ nodes forming an insertion run:

  • T1=(a0)T_1=(a_0)T1​=(a0​);
  • for each 1≤i<n1\le i<n1≤i<n: ai∉Tia_i\notin T_iai​∈/Ti​, and Ti+1T_{i+1}Ti+1​ is TiT_iTi​ with aia_iai​ inserted at a position minimising cycleLengthd\mathrm{cycleLength}_dcycleLengthd​ of the result among all ∣Ti∣+1|T_i|+1∣Ti​∣+1 positions.

cycleLength\mathrm{cycleLength}cycleLength is an imported tour-length function whose definition is not shown. Let insCostd(T,k)=min⁡0≤p≤∣T∣(cycleLengthd(T⊕pk)−cycleLengthd(T))\mathrm{insCost}_d(T,k)=\min_{0\le p\le|T|}\bigl(\mathrm{cycleLength}_d(T\oplus_pk)-\mathrm{cycleLength}_d(T)\bigr)insCostd​(T,k)=min0≤p≤∣T∣​(cycleLengthd​(T⊕p​k)−cycleLengthd​(T)), where T⊕pkT\oplus_pkT⊕p​k inserts kkk before 0-based index ppp.

The theorem asserts that for every natural number iii with 1≤i<n1\le i<n1≤i<n,

insCostd(Ti,ai)≤OPTd.\mathrm{insCost}_d(T_i,a_i)\le \mathrm{OPT}_d .insCostd​(Ti​,ai​)≤OPTd​.

Degenerate cases:

  • n≤1n\le1n≤1: no iii satisfies 1≤i<n1\le i<n1≤i<n, so the statement is vacuous. For n=0n=0n=0, no run exists anyway.
  • i=1i=1i=1: the claim concerns inserting a1a_1a1​ into the one-element list (a0)(a_0)(a0​). It depends on the unshown conventions of cycleLength\mathrm{cycleLength}cycleLength and optimal\mathrm{optimal}optimal.
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