Tree-safe for some iff AP closure and no same-node conflict
ProvedErdos195.exists_treeLt_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. With open pairs as before ( before in , ), is -safe for some tree witness if and only if (1) every in-order 3-AP of has placed before , and (2) no two open pairs force opposite values at the same node:
Compared with -orders, conflicts only matter at the same tree node, not merely the same level.
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 exists_treeLt_safe_iff (Q : List ℤ) :
(∃ θ : ℕ → ℤ → Bool, Safe (treeLt θ) Q) ↔
(∀ a b : ℤ, a ∈ Q → b ∈ Q → 2 * b - a ∈ Q → Q.idxOf a < Q.idxOf b →
Q.idxOf b < Q.idxOf (2 * b - a) →
3 * b - 2 * a ∈ Q ∧ Q.idxOf (3 * b - 2 * a) < Q.idxOf (2 * b - a)) ∧
(∀ a b a' b' : ℤ, a ∈ Q → b ∈ Q → Q.idxOf a < Q.idxOf b →
2 * b - a ∉ Q → 3 * b - 2 * a ∉ Q →
a' ∈ Q → b' ∈ Q → Q.idxOf a' < Q.idxOf b' →
2 * b' - a' ∉ Q → 3 * b' - 2 * a' ∉ Q →
padicValInt 2 (b - a) = padicValInt 2 (b' - a') →
a % 2 ^ padicValInt 2 (b - a) = a' % 2 ^ padicValInt 2 (b - a) →
(bitOne b (padicValInt 2 (b - a)) ↔ bitOne b' (padicValInt 2 (b - a)))) := by sorry
end Erdos195