Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Parity decomposition of ε\varepsilonε-safety

Proved
Erdos195.epsLt_safe_parity_decomp

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 QQQ of integers is ε\varepsilonε-safe if the sequence "the letters of QQQ in order, then all remaining integers in ≺ε\prec_\varepsilon≺ε​-order" contains no monotone 444-term arithmetic progression. Let ηk=εk+1\eta_k=\varepsilon_{k+1}ηk​=εk+1​, and for p∈{0,1}p\in\{0,1\}p∈{0,1} let RpR_pRp​ be the word obtained from QQQ by keeping the letters x≡p(mod2)x\equiv p\pmod 2x≡p(mod2), in order, and replacing each by (x−p)/2(x-p)/2(x−p)/2. Then QQQ is ε\varepsilonε-safe if and only if all of the following hold:

(1) R0 and R1 are η-safe;(2) Q contains no in-order 4-AP a,a+r,a+2r,a+3r with r odd;(3) if r is odd and a,a+r,a+2r occur in this order in Q, then a+3r∈Q;(4) if a precedes b in Q, b−a odd, 2b−a∉Q, 3b−2a∉Q, then b≡ε0(mod2).\begin{aligned}&(1)\ R_0\text{ and }R_1\text{ are }\eta\text{-safe};\\ &(2)\ Q\text{ contains no in-order }4\text{-AP }a,a+r,a+2r,a+3r\text{ with }r\text{ odd};\\ &(3)\ \text{if }r\text{ is odd and }a,a+r,a+2r\text{ occur in this order in }Q,\text{ then }a+3r\in Q;\\ &(4)\ \text{if }a\text{ precedes }b\text{ in }Q,\ b-a\text{ odd},\ 2b-a\notin Q,\ 3b-2a\notin Q,\text{ then }b\equiv\varepsilon_0\pmod 2.\end{aligned}​(1) R0​ and R1​ are η-safe;(2) Q contains no in-order 4-AP a,a+r,a+2r,a+3r with r odd;(3) if r is odd and a,a+r,a+2r occur in this order in Q, then a+3r∈Q;(4) if a precedes b in Q, b−a odd, 2b−a∈/Q, 3b−2a∈/Q, then b≡ε0​(mod2).​

So safety splits into the two parity classes (a problem of the same kind one binary digit lower) plus cross-parity conditions that involve only ε0\varepsilon_0ε0​. This reduces extension and merging questions for Ho-style constructions of 444-AP-free permutations of Z\mathbb{Z}Z (Erdős Problem 195) to the rescaled parity classes.

Formalization note: Safe, epsLt are from Definitions.Def_Erdos195_defs; R0R_0R0​ is (Q.filter (fun x => decide (x % 2 = 0))).map (fun x => x / 2), R1R_1R1​ is the analogue with (x - 1) / 2; "precedes" is comparison of List.idxOf; condition (4) is stated as b % 2 = 1 ↔ ε 0 = true.

Preamble
import Mathlib
import Definitions.Def_Erdos195_defs
Formal statement
namespace Erdos195

theorem epsLt_safe_parity_decomp (ε : ℕ → Bool) (Q : List ℤ) :
    Safe (epsLt ε) Q ↔
      Safe (epsLt (fun k => ε (k + 1))) ((Q.filter (fun x => decide (x % 2 = 0))).map (fun x => x / 2)) ∧
      Safe (epsLt (fun k => ε (k + 1)))
        ((Q.filter (fun x => decide (x % 2 = 1))).map (fun x => (x - 1) / 2)) ∧
      (∀ a r : ℤ, r % 2 = 1 → a ∈ Q → a + r ∈ Q → a + 2 * r ∈ Q → a + 3 * r ∈ Q →
        Q.idxOf a < Q.idxOf (a + r) → Q.idxOf (a + r) < Q.idxOf (a + 2 * r) →
        ¬ Q.idxOf (a + 2 * r) < Q.idxOf (a + 3 * r)) ∧
      (∀ a r : ℤ, r % 2 = 1 → a ∈ Q → a + r ∈ Q → a + 2 * r ∈ Q →
        Q.idxOf a < Q.idxOf (a + r) → Q.idxOf (a + r) < Q.idxOf (a + 2 * r) → a + 3 * r ∈ Q) ∧
      (∀ a ∈ Q, ∀ b ∈ Q, Q.idxOf a < Q.idxOf b → (b - a) % 2 = 1 →
        2 * b - a ∉ Q → 3 * b - 2 * a ∉ Q → (b % 2 = 1 ↔ ε 0 = true)) := 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