Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Shield lemma: (u,w,6w−5u,3w−2u)(u,w,6w-5u,3w-2u)(u,w,6w−5u,3w−2u) is tree-safe and releases the node N(u,w)N(u,w)N(u,w)

Proved
Erdos195.shield_safe

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) (two's-complement digits). 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; it is tree-safe if it is θ\thetaθ-safe for some θ\thetaθ. An in-order pair (a,b)(a,b)(a,b) of QQQ (aaa occurs before bbb) is open if 2b−a∉Q2b-a\notin Q2b−a∈/Q and 3b−2a∉Q3b-2a\notin Q3b−2a∈/Q; an open pair lies at the node N(a,b)=(k, a mod 2k)N(a,b)=(k,\,a\bmod 2^k)N(a,b)=(k,amod2k), k=ν2(b−a)k=\nu_2(b-a)k=ν2​(b−a), and θ\thetaθ-safety requires θ(N(a,b))=bitk(b)\theta(N(a,b))=\mathrm{bit}_k(b)θ(N(a,b))=bitk​(b) there. For all integers u≠wu\neq wu=w, the four-letter word

S(u,w)=(u, w, 6w−5u, 3w−2u)S(u,w)=(u,\ w,\ 6w-5u,\ 3w-2u)S(u,w)=(u, w, 6w−5u, 3w−2u)

is tree-safe, it closes the pair (u,w)(u,w)(u,w) (its fourth term 3w−2u3w-2u3w−2u is present), and every open in-order pair (a,b)(a,b)(a,b) of S(u,w)S(u,w)S(u,w) lying at the node N(u,w)N(u,w)N(u,w) forces the bit opposite to bitk(w)\mathrm{bit}_k(w)bitk​(w), k=ν2(w−u)k=\nu_2(w-u)k=ν2​(w−u). (Concretely, the open pairs are (u,6w−5u)(u,6w-5u)(u,6w−5u), (w,6w−5u)(w,6w-5u)(w,6w−5u), (w,3w−2u)(w,3w-2u)(w,3w−2u), at levels k+1k+1k+1, kkk, k+1k+1k+1; for (u,w)=(0,1)(u,w)=(0,1)(u,w)=(0,1) this is the word (0,1,6,3)(0,1,6,3)(0,1,6,3).) Thus a 'shield' releases the value forced at N(u,w)N(u,w)N(u,w) by the pair (u,w)(u,w)(u,w): unlike the bare fourth-term completion, it flips the requirement at that node. This is a release lemma for two-letter prefixes in the tree-witness approach to Erdős Problem 195.

Formalization note: treeLt θ is from Definitions.Def_Erdos195_tree; Safe, bitOne are from Definitions.Def_Erdos195_defs. Positions in a word are List.idxOf; P ++ [c] appends c.

Preamble
import Mathlib
import Definitions.Def_Erdos195_tree
Formal statement
namespace Erdos195

theorem shield_safe (u w : ℤ) (huw : u ≠ w) :
    (∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) [u, w, 6 * w - 5 * u, 3 * w - 2 * u]) ∧
    3 * w - 2 * u ∈ [u, w, 6 * w - 5 * u, 3 * w - 2 * u] ∧
    (∀ a b : ℤ, a ∈ [u, w, 6 * w - 5 * u, 3 * w - 2 * u] → b ∈ [u, w, 6 * w - 5 * u, 3 * w - 2 * u] →
      [u, w, 6 * w - 5 * u, 3 * w - 2 * u].idxOf a < [u, w, 6 * w - 5 * u, 3 * w - 2 * u].idxOf b →
      2 * b - a ∉ [u, w, 6 * w - 5 * u, 3 * w - 2 * u] →
      3 * b - 2 * a ∉ [u, w, 6 * w - 5 * u, 3 * w - 2 * u] →
      padicValInt 2 (b - a) = padicValInt 2 (w - u) →
      a % 2 ^ padicValInt 2 (w - u) = u % 2 ^ padicValInt 2 (w - u) →
      (bitOne b (padicValInt 2 (w - u)) ↔ ¬ bitOne w (padicValInt 2 (w - u)))) := by sorry

end Erdos195
Source
Erdős Problem 195 (https://www.erdosproblems.com/195); statements from GPT 6 Astra (Oct 23 2026 'tree11' answer, checked and sharpened), 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