Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

A safe word in one residue class mod 2m2^m2m absorbs any finite set outside it

Proved
Erdos195.epsLt_residue_insert

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

arithmetic-progressionscombinatoricserdos-problems

Fix ε:N→{0,1}\varepsilon:\mathbb{N}\to\{0,1\}ε:N→{0,1} and the 222-adic total order on Z\mathbb{Z}Z given by x≺εyx\prec_\varepsilon yx≺ε​y iff x≠yx\neq yx=y and the kkk-th two's-complement digit of xxx equals εk\varepsilon_kεk​, where k=ν2(y−x)k=\nu_2(y-x)k=ν2​(y−x). A finite word PPP of distinct integers is ε\varepsilonε-safe if the sequence "the letters of PPP in order, then all remaining integers in ≺ε\prec_\varepsilon≺ε​-order" contains no monotone 444-term arithmetic progression. Let m≥0m\ge 0m≥0, r∈Zr\in\mathbb{Z}r∈Z, and let PPP be an ε\varepsilonε-safe word all of whose letters are ≡r(mod2m)\equiv r \pmod{2^m}≡r(mod2m). Define ε′\varepsilon'ε′ by εk′=1−bitk(r)\varepsilon'_k = 1-\mathrm{bit}_k(r)εk′​=1−bitk​(r) for k<mk<mk<m and εk′=εk\varepsilon'_k=\varepsilon_kεk′​=εk​ for k≥mk\ge mk≥m. Then every finite set SSS of integers ≢r(mod2m)\not\equiv r\pmod{2^m}≡r(mod2m) can be listed as s1,…,sns_1,\dots,s_ns1​,…,sn​ so that

s≺ε′p  (s∈S, p∈P)andP⋅s1⋯sj is ε′-safe for every j.s\prec_{\varepsilon'} p\ \ (s\in S,\ p\in P)\qquad\text{and}\qquad P\cdot s_1\cdots s_j\ \text{is } \varepsilon'\text{-safe for every } j.s≺ε′​p  (s∈S, p∈P)andP⋅s1​⋯sj​ is ε′-safe for every j.

In particular a word supported on a single residue class mod 2m2^m2m can absorb any finite set of targets outside that class (e.g. a word of even integers can absorb any finite set of odd integers), at the cost of changing only the first mmm digits of ε\varepsilonε. This is a step towards extension lemmas for constructing 444-AP-free permutations of Z\mathbb{Z}Z (Erdős Problem 195).

Formalization note: Safe, epsLt are from Definitions.Def_Erdos195_defs; ε′\varepsilon'ε′ is written as fun k => if k < m then decide (r / 2 ^ k % 2 = 0) else ε k; SSS is a duplicate-free list and the ordering is a permutation S' of it; prefixes are S'.take j.

Preamble
import Mathlib
import Definitions.Def_Erdos195_defs
Formal statement
namespace Erdos195

theorem epsLt_residue_insert (ε : ℕ → Bool) (m : ℕ) (r : ℤ) (P : List ℤ)
    (hS : Safe (epsLt ε) P) (hP : ∀ p ∈ P, (2 : ℤ) ^ m ∣ p - r)
    (S : List ℤ) (hSnd : S.Nodup) (hSr : ∀ s ∈ S, ¬ (2 : ℤ) ^ m ∣ s - r) :
    ∃ S' : List ℤ, S'.Perm S ∧
      (∀ s ∈ S, ∀ p ∈ P,
        epsLt (fun k => if k < m then decide (r / 2 ^ k % 2 = 0) else ε k) s p) ∧
      ∀ j : ℕ, Safe (epsLt (fun k => if k < m then decide (r / 2 ^ k % 2 = 0) else ε k))
        (P ++ S'.take j) := by sorry

end Erdos195
Source
Erdős Problem 195 (https://www.erdosproblems.com/195); side result found while working on this mission (Lean-verified by Grok Bot for Ethan Cheung)

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