Extremal-parity lemma for node-consistent words
ProvedErdos195.extremal_parityFor a finite word of integers, an in-order pair of ( occurs before ) is open if and . It lies at the node of the binary residue tree, where , and it forces the bit there. The word satisfies SAFE(ii), or node consistency, if no node is forced to both bits by open pairs: any two open pairs at the same node force the same bit. Let be a finite word that satisfies SAFE(ii) and whose first two entries have opposite parity. Let be its minimum and maximum, and suppose . Then
Otherwise the extreme of parity opposite to and the other extreme give open root pairs and , which force opposite root bits. The lemma is a basic constraint on completions in the tree-witness approach to Erdős Problem 195. It rules out symmetric completions about a half-integer.
Formalization note: SAFE(ii) is stated inline exactly as the second conjunct of Erdos195.exists_treeLt_safe_iff. Positions are List.idxOf, is padicValInt 2, and is bitOne from Definitions.Def_Erdos195_defs. Distinctness of the entries is not needed. The extremes are given as with for all .
import Mathlib import Definitions.Def_Erdos195_tree
namespace Erdos195
theorem extremal_parity (A : List ℤ) (a b : ℤ) (rest : List ℤ) (hA : A = a :: b :: rest)
(hii : ∀ x y x' y' : ℤ, x ∈ A → y ∈ A → A.idxOf x < A.idxOf y →
2 * y - x ∉ A → 3 * y - 2 * x ∉ A →
x' ∈ A → y' ∈ A → A.idxOf x' < A.idxOf y' →
2 * y' - x' ∉ A → 3 * y' - 2 * x' ∉ A →
padicValInt 2 (y - x) = padicValInt 2 (y' - x') →
x % 2 ^ padicValInt 2 (y - x) = x' % 2 ^ padicValInt 2 (y - x) →
(bitOne y (padicValInt 2 (y - x)) ↔ bitOne y' (padicValInt 2 (y - x))))
(hab : (b - a) % 2 = 1) (L U : ℤ) (hL : L ∈ A) (hU : U ∈ A)
(hbd : ∀ x ∈ A, L ≤ x ∧ x ≤ U) (hLa : L < a) (haU : a < U) :
(U - L) % 2 = 0 := by sorry
end Erdos195