Which letter may precede the shield: is tree-safe iff (mod 4) or
ProvedErdos195.shield_prefix_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 five-letter word is tree-safe if and only if
Here is the shield word (tree-safe, closing the root pair ). The result classifies which single letter may precede the shield. Obstructions: for even the root pair (forcing ) conflicts at the root with or ; for , , the pair conflicts with at level ; create an in-order -AP without its fourth term. The exceptions , close resp. .
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 shield_prefix_iff (x : ℤ) (h0 : x ≠ 0) (h1 : x ≠ 1) (h3 : x ≠ 3) (h6 : x ≠ 6) :
(∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) [x, 0, 1, 6, 3]) ↔
(x % 4 = 1 ∧ x ≠ 1) ∨ x = 7 ∨ x = 16 := by sorry
end Erdos195