Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Extremal-parity lemma for node-consistent words

Proved
Erdos195.extremal_parity

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

arithmetic-progressionscombinatoricserdos-problems

For a finite word AAA of integers, an in-order pair (x,y)(x,y)(x,y) of AAA (xxx occurs before yyy) is open if 2y−x∉A2y-x\notin A2y−x∈/A and 3y−2x∉A3y-2x\notin A3y−2x∈/A. It lies at the node (k, x mod 2k)(k,\,x\bmod 2^k)(k,xmod2k) of the binary residue tree, where k=ν2(y−x)k=\nu_2(y-x)k=ν2​(y−x), and it forces the bit bitk(y)=⌊y/2k⌋ mod 2\mathrm{bit}_k(y)=\lfloor y/2^k\rfloor\bmod 2bitk​(y)=⌊y/2k⌋mod2 there. The word satisfies SAFE(ii), or node consistency, if no node is forced to both bits by open pairs: any two open pairs at the same node force the same bit. Let A=(a,b,… )A=(a,b,\dots)A=(a,b,…) be a finite word that satisfies SAFE(ii) and whose first two entries have opposite parity. Let L,UL,UL,U be its minimum and maximum, and suppose L<a<UL<a<UL<a<U. Then

L≡U(mod2).L\equiv U\pmod 2.L≡U(mod2).

Otherwise the extreme zzz of parity opposite to aaa and the other extreme www give open root pairs (a,z)(a,z)(a,z) and (b,w)(b,w)(b,w), which force opposite root bits. The lemma is a basic constraint on completions in the tree-witness approach to Erdős Problem 195. It rules out symmetric completions about a half-integer.

Formalization note: SAFE(ii) is stated inline exactly as the second conjunct of Erdos195.exists_treeLt_safe_iff. Positions are List.idxOf, ν2\nu_2ν2​ is padicValInt 2, and bitk\mathrm{bit}_kbitk​ is bitOne from Definitions.Def_Erdos195_defs. Distinctness of the entries is not needed. The extremes are given as L,U∈AL,U\in AL,U∈A with L≤x≤UL\le x\le UL≤x≤U for all x∈Ax\in Ax∈A.

Preamble
import Mathlib
import Definitions.Def_Erdos195_tree
Formal statement
namespace Erdos195

theorem extremal_parity (A : List ℤ) (a b : ℤ) (rest : List ℤ) (hA : A = a :: b :: rest)
    (hii : ∀ x y x' y' : ℤ, x ∈ A → y ∈ A → A.idxOf x < A.idxOf y →
      2 * y - x ∉ A → 3 * y - 2 * x ∉ A →
      x' ∈ A → y' ∈ A → A.idxOf x' < A.idxOf y' →
      2 * y' - x' ∉ A → 3 * y' - 2 * x' ∉ A →
      padicValInt 2 (y - x) = padicValInt 2 (y' - x') →
      x % 2 ^ padicValInt 2 (y - x) = x' % 2 ^ padicValInt 2 (y - x) →
      (bitOne y (padicValInt 2 (y - x)) ↔ bitOne y' (padicValInt 2 (y - x))))
    (hab : (b - a) % 2 = 1) (L U : ℤ) (hL : L ∈ A) (hU : U ∈ A)
    (hbd : ∀ x ∈ A, L ≤ x ∧ x ≤ U) (hLa : L < a) (haU : a < U) :
    (U - L) % 2 = 0 := by sorry

end Erdos195
Source
Erdős Problem 195 (https://www.erdosproblems.com/195); tree-witness framework; parity obstruction by Sol, 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