Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Escape chains terminate at every node, for every tree witness

Proved
Erdos195.escape_chain_terminates_tree

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

arithmetic-progressionscombinatoricserdos-problems

A tree witness θ:N×Z→{0,1}\theta:\mathbb N\times\mathbb Z\to\{0,1\}θ:N×Z→{0,1} defines a strict total order ≺θ\prec_\theta≺θ​ on Z\mathbb ZZ: for x≠yx\ne yx=y with k=ν2(y−x)k=\nu_2(y-x)k=ν2​(y−x), x≺θyx\prec_\theta yx≺θ​y iff the kkk-th binary digit of xxx is 111 exactly when θ(k,x mod 2k)=1\theta(k,x \bmod 2^k)=1θ(k,xmod2k)=1. A finite word TTT of integers is θ\thetaθ-safe if the sequence "letters of TTT in order, then all remaining integers in ≺θ\prec_\theta≺θ​-order" has no monotone 4-term arithmetic progression (positions are first occurrences); TTT is tree-safe if it is θ\thetaθ-safe for some θ\thetaθ. For an in-order pair (a,b)(a,b)(a,b) of TTT (aaa before bbb) call 2b−a2b-a2b−a its third term and 3b−2a3b-2a3b−2a its fourth term. An open path in TTT is a family of in-order pairs (ai,bi)(a_i,b_i)(ai​,bi​), 0≤i<m0\le i<m0≤i<m, m≥1m\ge1m≥1, with 3bi−2ai=2bi+1−ai+13b_i-2a_i=2b_{i+1}-a_{i+1}3bi​−2ai​=2bi+1​−ai+1​ for i<m−1i<m-1i<m−1 and no third term 2bi−ai2b_i-a_i2bi​−ai​ in TTT. Its sink fourth term w′=3bm−1−2am−1w'=3b_{m-1}-2a_{m-1}w′=3bm−1​−2am−1​ is a true-sink fourth term of TTT if w′∉Tw'\notin Tw′∈/T and every in-order pair (x,y)(x,y)(x,y) of TTT with 2y−x=w′2y-x=w'2y−x=w′ has 3y−2x∈T3y-2x\in T3y−2x∈T (condition C1 for appending w′w'w′).

Theorem. Let QQQ be θ\thetaθ-safe for some tree witness θ\thetaθ, and let o,wo,wo,w be letters of QQQ with ooo before www and o≺θwo\prec_\theta wo≺θ​w (a "wrong" in-order pair at the node of (o,w)(o,w)(o,w)). Put en=o+3n(w−o)e_n=o+3^n(w-o)en​=o+3n(w−o), so e0=we_0=we0​=w and en+1=3en−2oe_{n+1}=3e_n-2oen+1​=3en​−2o. Then there is n≥0n\ge0n≥0 such that e0,…,ene_0,\dots,e_ne0​,…,en​ all occur in QQQ, e0,…,en−1e_0,\dots,e_{n-1}e0​,…,en−1​ occur after ooo, and either

  1. (reflection) ene_nen​ occurs after ooo, and 2en−o2e_n-o2en​−o occurs in QQQ before ene_nen​; or
  2. (reversal) n>0n>0n>0 and ene_nen​ occurs before ooo.

Since ν2(en−o)=ν2(w−o)\nu_2(e_n-o)=\nu_2(w-o)ν2​(en​−o)=ν2​(w−o) and en≡w(mod2ν2(w−o)+1)e_n\equiv w \pmod{2^{\nu_2(w-o)+1}}en​≡w(mod2ν2​(w−o)+1), all pairs (o,en)(o,e_n)(o,en​) lie at the same node and are wrong for θ\thetaθ; the chain cannot go on forever because the ene_nen​ are distinct and QQQ is finite. This generalizes milestone #142 (the root-node case θ(0,0)=1\theta(0,0)=1θ(0,0)=1, ooo odd, www even) to arbitrary levels, nodes and witnesses.

Preamble
import Mathlib
import Definitions.Def_Erdos195_tree
Formal statement
namespace Erdos195

theorem escape_chain_terminates_tree (θ : ℕ → ℤ → Bool) (Q : List ℤ)
    (hS : Safe (treeLt θ) Q) (o w : ℤ) (ho : o ∈ Q) (hw : w ∈ Q)
    (hi : Q.idxOf o < Q.idxOf w) (hlt : treeLt θ o w) :
    ∃ n : ℕ, (∀ m ≤ n, o + 3 ^ m * (w - o) ∈ Q) ∧
      (∀ m < n, Q.idxOf o < Q.idxOf (o + 3 ^ m * (w - o))) ∧
      ((Q.idxOf o < Q.idxOf (o + 3 ^ n * (w - o)) ∧
          2 * (o + 3 ^ n * (w - o)) - o ∈ Q ∧
          Q.idxOf (2 * (o + 3 ^ n * (w - o)) - o) < Q.idxOf (o + 3 ^ n * (w - o))) ∨
        (0 < n ∧ Q.idxOf (o + 3 ^ n * (w - o)) < Q.idxOf o)) := by sorry

end Erdos195
Source
Erdős Problem 195 (https://www.erdosproblems.com/195); tree-witness framework; Lean-verified by Grok Bot for Ethan Cheung (Oct 24 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