Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Localization: a safe extension inside one residue class lifts to the whole tree-safe word

Proved
Erdos195.localization

by Ethan Cheung Wang · Oct 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

arithmetic-progressionscombinatoricserdos-problems

A tree witness is a function θ(k,r)∈{0,1}\theta(k,r)\in\{0,1\}θ(k,r)∈{0,1} on the nodes (k,r)(k,r)(k,r), 0≤r<2k0\le r<2^k0≤r<2k, of the binary tree of residues. For distinct integers x,yx,yx,y with k=ν2(y−x)k=\nu_2(y-x)k=ν2​(y−x), put x≺θyx\prec_\theta yx≺θ​y iff bitk(x)=θ(k, x mod 2k)\mathrm{bit}_k(x)=\theta(k,\,x\bmod 2^k)bitk​(x)=θ(k,xmod2k). A finite word QQQ of integers is θ\thetaθ-safe if the sequence "the letters of QQQ in order, then all remaining integers in ≺θ\prec_\theta≺θ​-order" contains no monotone 444-term arithmetic progression; QQQ is SAFE if it is θ\thetaθ-safe for some θ\thetaθ. For letters xxx before zzz in QQQ, the pair (x,z)(x,z)(x,z) is OPEN if neither 2z−x2z-x2z−x nor 3z−2x3z-2x3z−2x occurs in QQQ; it sits at the node (h, x mod 2h)(h,\,x\bmod 2^h)(h,xmod2h), h=ν2(z−x)h=\nu_2(z-x)h=ν2​(z−x), and forces the digit bith(z)\mathrm{bit}_h(z)bith​(z) there.

Theorem (localization). Let QQQ be SAFE, fix a residue class C=ρ+2kZC=\rho+2^k\mathbb ZC=ρ+2kZ, and let DDD be a finite word of letters of CCC none of which occurs in QQQ. Let QCQ_CQC​ be the subsequence of QQQ consisting of its letters in CCC. Assume

  1. the local word QC⋅DQ_C\cdot DQC​⋅D is SAFE, and
  2. (ancestor compatibility) every OPEN pair (x,z)(x,z)(x,z) of QQQ sitting at an ancestor node (h,ρ mod 2h)(h,\rho\bmod 2^h)(h,ρmod2h) with h<kh<kh<k forces bith(z)=bith(ρ)\mathrm{bit}_h(z)=\mathrm{bit}_h(\rho)bith​(z)=bith​(ρ).

Then

Q⋅D is SAFE.Q\cdot D \text{ is SAFE.}Q⋅D is SAFE.

So a finite safe extension built locally inside one residue class transfers to the whole word, and no new conflict appears at a node shallower than kkk. Combined with local absorption recipes (one or two local letters, or a one-grandchild block), it gives target-last absorption inside arbitrary larger safe words.

Formalization note: treeLt θ is from Definitions.Def_Erdos195_tree, and Safe is from Definitions.Def_Erdos195_defs. QCQ_CQC​ is Q.filter (fun x => decide (x % 2 ^ k = ρ % 2 ^ k)), and positions are List.idxOf.

Preamble
import Mathlib
import Definitions.Def_Erdos195_tree
Formal statement
namespace Erdos195

theorem localization (Q D : List ℤ) (k : ℕ) (ρ : ℤ)
    (hQ : ∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) Q)
    (hD : ∀ d ∈ D, d % 2 ^ k = ρ % 2 ^ k) (hDQ : ∀ d ∈ D, d ∉ Q)
    (hloc : ∃ θ : ℕ → ℤ → Bool,
      Safe (treeLt θ) (Q.filter (fun x => decide (x % 2 ^ k = ρ % 2 ^ k)) ++ D))
    (hC : ∀ x z : ℤ, x ∈ Q → z ∈ Q → Q.idxOf x < Q.idxOf z → 2 * z - x ∉ Q → 3 * z - 2 * x ∉ Q →
      padicValInt 2 (z - x) < k → x % 2 ^ padicValInt 2 (z - x) = ρ % 2 ^ padicValInt 2 (z - x) →
      (bitOne z (padicValInt 2 (z - x)) ↔ bitOne ρ (padicValInt 2 (z - x)))) :
    ∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) (Q ++ D) := by sorry

end Erdos195
Source
Erdős Problem 195 (https://www.erdosproblems.com/195); tree-witness framework; lemma and argument by GPT 6 Astra, Lean-verified by Grok Bot for Ethan Cheung (Oct 23 2026)

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me