Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 1 — if ρ₀ > 1 + 1/(2r−1), some r-tuple's agreement set Q has d^Q(s_l, s_{i1}) − d^Q(s_l, s) ≤ d_opt/(2r−1) for every l

Proved
ClosestString.PTAS.lemma_1

by mikedeng1 · Oct 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

closest-stringcombinatoricshamming-distancep2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-strengthenedp2o-v1

Let u1,…,unu_1,\dots,u_nu1​,…,un​ be strings of one length, ccc a string of that length (the center) and d≥0d\ge0d≥0 an integer with d(ui,c)≤dd(u_i,c)\le dd(ui​,c)≤d for every iii, and let r≥1r\ge1r≥1. Write ρ0d=max⁡i,jd(ui,uj)\rho_0d=\max_{i,j}d(u_i,u_j)ρ0​d=maxi,j​d(ui​,uj​) and, for indices i1,…,iri_1,\dots,i_ri1​,…,ir​ (repetitions allowed), Q=Qi1,…,irQ=Q_{i_1,\dots,i_r}Q=Qi1​,…,ir​​ for the positions where ui1,…,uiru_{i_1},\dots,u_{i_r}ui1​​,…,uir​​ agree. If

max⁡i,jd(ui,uj) > (1+12r−1)d,\max_{i,j}d(u_i,u_j)\ >\ \Big(1+\frac1{2r-1}\Big)d,i,jmax​d(ui​,uj​) > (1+2r−11​)d,

then there are indices 1≤i1,…,ir≤n1\le i_1,\dots,i_r\le n1≤i1​,…,ir​≤n such that for every 1≤l≤n1\le l\le n1≤l≤n

d(ul∣Q,ui1∣Q)−d(ul∣Q,c∣Q) ≤ 12r−1 d.d(u_l|_Q,u_{i_1}|_Q)-d(u_l|_Q,c|_Q)\ \le\ \frac1{2r-1}\,d.d(ul​∣Q​,ui1​​∣Q​)−d(ul​∣Q​,c∣Q​) ≤ 2r−11​d.

This is the key lemma of the paper: on the agreement set of a well-chosen rrr-tuple, the common letters are almost as good as the optimal center. Theorem 9 applies it with ui=tiu_i=t_iui​=ti​, the substrings closest to an optimal center (Fact 1, p. 10).

Differences from the source:

  • reading: Section 2 defines Q_{i1,…,ik} for "k distinct numbers" → index tuples idx : Fin k → Fin n with repetitions allowed; reason: Lemma 1's own statement does not require distinct indices and Figure 3 allows repeats; with distinct indices Claim 3 needs ρ_{r+1}, which does not exist when n < r + 1 (never excluded)
  • generalization: s is the optimal Closest String center and d_opt = max_i d(s_i, s) → any center c and any d with d(u_i, c) ≤ d for all i; reason: the proof uses only the radius bound; c = s, d = d_opt is the paper's case, and Theorem 9 applies the result with u = t (p. 9)
  • encoding: ratios ρ₀ = max d(s_i,s_j)/d_opt and ρ_k = min p/d_opt → hypothesis (1 + 1/(2r−1))·d < maxPairDist u and conclusion with d/(2r−1), in ℝ; reason: avoids dividing by d_opt, which may be 0; equivalent whenever d_opt > 0
  • reading: "for any constant r" → any integer r ≥ 1; reason: 1/(2r−1) needs r ≥ 1; for r = 1 the hypothesis cannot hold (ρ₀ ≤ 2 by the triangle inequality), as in the paper
  • encoding: positions 1..m, indices 1..n, s_{i1} → 0-based Fin m, Fin n; s_{i1} is u (idx 0); reason: relabelling; changes no instance
Preamble
import Mathlib
import Definitions.Def_ClosestString_PTAS_Basic
Formal statement
namespace ClosestString.PTAS

/-- **Lemma 1** (Li, Ma & Wang, arXiv:cs/0002012v1, p. 3), multiplied out by `d`, for any strings
`u_1, …, u_n` of one length `m'`, any center `c` with `d(u_i, c) ≤ d` for all `i`, any `r ≥ 1`, and
index tuples with repetitions allowed: if `max_{i,j} d(u_i, u_j) > (1 + 1/(2r−1)) d` (i.e.
`ρ₀ > 1 + 1/(2r−1)`), there is an `r`-tuple `idx` with
`d^Q(u_l, u_{idx 0}) − d^Q(u_l, c) ≤ d/(2r−1)` for every `l`, where `Q = Q_idx`. -/
theorem lemma_1 {A : Type*} [DecidableEq A] {n m' : ℕ} (u : Fin n → Fin m' → A) (c : Fin m' → A)
    (d : ℕ) (hd : ∀ i, hammingDist (u i) c ≤ d) (r : ℕ) (hr : 1 ≤ r)
    (hρ : (1 + 1 / (2 * (r : ℝ) - 1)) * d < maxPairDist u) :
    ∃ idx : Fin r → Fin n, ∀ l : Fin n,
      (distOn (agreeSet u idx) (u l) (u (idx ⟨0, by omega⟩)) : ℝ)
        - distOn (agreeSet u idx) (u l) c ≤ d / (2 * (r : ℝ) - 1) := by sorry

end ClosestString.PTAS
Source
Li, Ma & Wang, On the Closest String and Substring Problems, arXiv:cs/0002012v1, p. 3, Lemma 1 (proof pp. 3–4)
Human review
  • Endorsed by Shuze Chen · Oct 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 24, 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