Tree append criterion: when is tree-safe
ProvedErdos195.tree_append_iffA tree witness is a function on the nodes , , of the binary tree of residues. For distinct integers with , put iff (two's-complement digits). A finite word of integers is -safe if the sequence "the letters of in order, then all remaining integers in -order" contains no monotone -term arithmetic progression. Let be a word that is -safe for some tree witness, and . Then is -safe for some tree witness if and only if
So the only possible obstructions to appending directly are a missing fourth term, and a same-node conflict between a new open pair 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; is padicValInt 2.
import Mathlib import Definitions.Def_Erdos195_tree
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