Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proof of Theorem 7 — |P| ≤ r·d_opt: an r-tuple disagrees on at most r·d_opt positions

Proved
ClosestString.PTAS.card_diff_le

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 and d≥0d\ge0d≥0 with d(ui,c)≤dd(u_i,c)\le dd(ui​,c)≤d for every iii. For any indices i1,…,iri_1,\dots,i_ri1​,…,ir​ (repetitions allowed) let P={1,…,m}∖Qi1,…,irP=\{1,\dots,m\}\setminus Q_{i_1,\dots,i_r}P={1,…,m}∖Qi1​,…,ir​​ be the positions where ui1,…,uiru_{i_1},\dots,u_{i_r}ui1​​,…,uir​​ do not all agree. Then

∣P∣ ≤ r d.|P|\ \le\ r\,d.∣P∣ ≤ rd.

At every position of PPP at least one of the rrr strings differs from the center. The bound is used in the proof of Theorem 9 (p. 11) to turn the additive error ε∣P∣\varepsilon|P|ε∣P∣ into εr dopt\varepsilon r\,d_{\mathrm{opt}}εrdopt​.

Differences from the source:

  • generalization: s an optimal center, d_opt its radius, an r-element subset of the strings → any center c, any radius bound d, any r-tuple of indices (repetitions allowed), any r ≥ 0; reason: the argument uses only d(u_i, c) ≤ d; the paper's subsets and Theorem 9's tuples (with u = t) are special cases
  • 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

/-- **`|P| ≤ r × d_opt`** (proof of Theorem 7, Li, Ma & Wang, arXiv:cs/0002012v1, p. 7; used again
in the proof of Theorem 9, p. 11): for any strings `u_1, …, u_n` of one length, any center `c` with
`d(u_i, c) ≤ d` for all `i`, and any `r`-tuple of indices `idx`, the positions where
`u_{idx 0}, …, u_{idx (r-1)}` do not all agree number at most `r · d`. -/
theorem card_diff_le {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 : ℕ) (idx : Fin r → Fin n) :
    (agreeSet u idx)ᶜ.card ≤ r * d := by sorry

end ClosestString.PTAS
Source
Li, Ma & Wang, On the Closest String and Substring Problems, arXiv:cs/0002012v1, p. 7, proof of Theorem 7 (restated as "|P| ≤ r d_opt" in the proof of Theorem 9, p. 11)
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