Words without opposite-parity open pairs are almost single-parity
ProvedErdos195.no_odd_open_pair_classifyLet be a finite word of integers. An in-order pair of is a pair of letters with occurring before ; it is open if neither continuation nor is a letter of . Suppose every in-order pair of with odd is closed, i.e. or . Then either all letters of have the same parity, or, writing and ,
So a word without opposite-parity open pairs contains at most one letter of the minority parity (example: ). No safety assumption is needed. In the study of -safe words (Ho-style constructions of -AP-free permutations of , Erdős Problem 195), open pairs force digits of , and this shows that the lowest digit is forced in essentially every mixed-parity word.
Formalization note: "before" is comparison of List.idxOf; the conclusion is stated as a disjunction with explicit bounding all letters and 2 * x = A + B.
import Mathlib import Definitions.Def_Erdos195_defs
namespace Erdos195
theorem no_odd_open_pair_classify (Q : List ℤ)
(hno : ∀ a ∈ Q, ∀ b ∈ Q, Q.idxOf a < Q.idxOf b → (b - a) % 2 = 1 →
2 * b - a ∈ Q ∨ 3 * b - 2 * a ∈ Q) :
(∀ x ∈ Q, ∀ y ∈ Q, x % 2 = y % 2) ∨
∃ A B : ℤ, A ∈ Q ∧ B ∈ Q ∧ (∀ z ∈ Q, A ≤ z ∧ z ≤ B) ∧ A % 2 = B % 2 ∧
∀ x ∈ Q, x % 2 ≠ A % 2 → 2 * x = A + B ∧ Q.idxOf A < Q.idxOf x ∧ Q.idxOf B < Q.idxOf x := by sorry
end Erdos195