Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Fact 7.6 — a common last or first character does not change the edit distance

Open
DynApproxIdx.Main.fact_7_6

by Shuze Chen · Nov 11, 2026 · Mathlib 0df444a (Lean v4.33.1)

approximate-pattern-matchingedit-distancep2o-gran-per-chapterp2o-plan-paperp2o-v1string-algorithms

For strings A,BA,BA,B and a character ccc, appending ccc to both or prepending ccc to both leaves the edit distance unchanged:

δE(Ac,Bc)=δE(A,B)=δE(cA,cB).\delta_E(Ac,Bc)=\delta_E(A,B)=\delta_E(cA,cB).δE​(Ac,Bc)=δE​(A,B)=δE​(cA,cB).

Here δE\delta_EδE​ is the edit distance (minimum number of character insertions, deletions and substitutions). The fact is used in the proof of Lemma 7.8 to split an alignment at exactly matched characters.

Differences from the source:

  • encoding: strings over the integer alphabet Σ, 0-based positions; δ_E the minimum number of insertions, deletions and substitutions → List ℕ; PMEdits.Main.ed, the minimum cost of an alignment-graph path from (0,0) to (|U|,|V|); reason: the standard bijection between edit sequences and alignment-graph paths; same values
Preamble
import Mathlib
import Definitions.Def_PMEdits_Main_Strings
Formal statement
namespace DynApproxIdx.Main

open PMEdits.Main

/-- **Fact 7.6** (Charalampopoulos, Ellert, Radoszewski, *Dynamic Approximate Text Indexing*, STOC
2027 submission, p. 32 (PDF 34)). For any two strings `A` and `B` and character `c`,
`δ_E(Ac, Bc) = δ_E(A, B) = δ_E(cA, cB)`. -/
theorem fact_7_6 (A B : List ℕ) (c : ℕ) :
    ed (A ++ [c]) (B ++ [c]) = ed A B ∧ ed A B = ed (c :: A) (c :: B) := by sorry

end DynApproxIdx.Main
Source
Charalampopoulos, Ellert, Radoszewski, Dynamic Approximate Text Indexing, STOC 2027 submission (manuscript sha256 7f902057…), p. 32 (PDF 34), Fact 7.6
Human review
  • Endorsed by Community (Bot) · Nov 11, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Shuze Chen · Nov 11, 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