Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Tree append criterion: when P⋅tP\cdot tP⋅t is tree-safe

Proved
Erdos195.tree_append_iff

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. Let PPP be a word that is θ\thetaθ-safe for some tree witness, and t∉Pt\notin Pt∈/P. Then P⋅tP\cdot tP⋅t is θ′\theta'θ′-safe for some tree witness θ′\theta'θ′ if and only if

(1) a before b in P, t=2b−a ⇒ 3b−2a∈P;\text{(1) } a \text{ before } b \text{ in } P,\ t=2b-a\ \Rightarrow\ 3b-2a\in P;(1) a before b in P, t=2b−a ⇒ 3b−2a∈P; (2) for every x∈P with 2t−x,3t−2x∉P and every open pair (a,b) of P (2b−a,3b−2a∉P) with t∉{2b−a,3b−2a}, ν2(b−a)=ν2(t−x)=k, a≡x (mod 2k): bitk(b)=bitk(t).\text{(2) for every } x\in P \text{ with } 2t-x,3t-2x\notin P \text{ and every open pair } (a,b) \text{ of } P \text{ (}2b-a,3b-2a\notin P\text{) with } t\notin\{2b-a,3b-2a\},\ \nu_2(b-a)=\nu_2(t-x)=k,\ a\equiv x\ (\mathrm{mod}\ 2^k):\ \mathrm{bit}_k(b)=\mathrm{bit}_k(t).(2) for every x∈P with 2t−x,3t−2x∈/P and every open pair (a,b) of P (2b−a,3b−2a∈/P) with t∈/{2b−a,3b−2a}, ν2​(b−a)=ν2​(t−x)=k, a≡x (mod 2k): bitk​(b)=bitk​(t).

So the only possible obstructions to appending ttt directly are a missing fourth term, and a same-node conflict between a new open pair (x,t)(x,t)(x,t) and a surviving old open pair.

Formalization note: treeLt θ is from Definitions.Def_Erdos195_tree; Safe, bitOne, No3AP, Star, HasMonotoneAP are from Definitions.Def_Erdos195_defs. Positions in a word are List.idxOf; ν2\nu_2ν2​ is padicValInt 2.

Preamble
import Mathlib
import Definitions.Def_Erdos195_tree
Formal statement
namespace Erdos195

theorem tree_append_iff (P : List ℤ) (t : ℤ) (hP : ∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) P)
    (ht : t ∉ P) :
    (∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) (P ++ [t])) ↔
      (∀ a b : ℤ, a ∈ P → b ∈ P → P.idxOf a < P.idxOf b → t = 2 * b - a → 3 * b - 2 * a ∈ P) ∧
      (∀ x a b : ℤ, x ∈ P → 2 * t - x ∉ P → 3 * t - 2 * x ∉ P →
          a ∈ P → b ∈ P → P.idxOf a < P.idxOf b → 2 * b - a ∉ P → 3 * b - 2 * a ∉ P →
          t ≠ 2 * b - a → t ≠ 3 * b - 2 * a →
          padicValInt 2 (b - a) = padicValInt 2 (t - x) →
          a % 2 ^ padicValInt 2 (b - a) = x % 2 ^ padicValInt 2 (b - a) →
          (bitOne b (padicValInt 2 (b - a)) ↔ bitOne t (padicValInt 2 (b - a)))) := by sorry

end Erdos195
Source
Erdős Problem 195 (https://www.erdosproblems.com/195); tree-witness framework and statement from GPT 6 Astra (Oct 23 2026 answers), 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