is tree-safe iff is odd
ProvedErdos195.zero_one_x_safe_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; it is tree-safe if it is -safe for some . An in-order pair of ( occurs before ) is open if and ; an open pair lies at the node , , and -safety requires there. Let be an integer with . Then the three-letter word is tree-safe if and only if
For even the open root pair conflicts with (or, for , is an in-order -AP with no fourth term); for odd every open pair at the root starts at .
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.
import Mathlib import Definitions.Def_Erdos195_tree
namespace Erdos195
theorem zero_one_x_safe_iff (x : ℤ) (h0 : x ≠ 0) (h1 : x ≠ 1) :
(∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) [0, 1, x]) ↔ x % 2 = 1 := by sorry
end Erdos195