The Erdős–Szekeres monotone subsequence theorem #
A sequence f : Fin n → β in a linear order with r * s < n has a monotone (non-decreasing)
subsequence of r + 1 terms or a strictly decreasing subsequence of s + 1 terms
([ES35], p. 467, Theorem, and its f(i, k) form on p. 468; there equal values may
count as increasing or decreasing). For injective sequences the first alternative is strictly
increasing.
The proof is the standard reduction to Mirsky's theorem: order the positions by
i ≤ j ∧ f i ≤ f j. Its chains are monotone subsequences and its antichains are strictly
decreasing subsequences. If every chain has at most r elements, Mirsky's theorem
(exists_antichain_coloring_iff) covers the n > r * s positions by r antichains, and the
pigeonhole principle puts more than s of them in one antichain.
Subsequences are Finset (Fin n)s of positions. Mathlib's archive has the injective case as
Theorems100.erdos_szekeres, which cannot be imported.
Main results #
exists_monotoneOn_or_strictAntiOn_of_mul_lt: the theorem for arbitrary sequences.exists_strictMonoOn_or_strictAntiOn_of_mul_lt: the theorem for injective sequences.
References #
Erdős–Szekeres ([ES35], pp. 467–468): a sequence of more than r * s terms
in a linear order has a monotone subsequence of r + 1 terms or a strictly decreasing subsequence
of s + 1 terms.
Erdős–Szekeres for injective sequences ([ES35], pp. 467–468): more than
r * s distinct terms have a strictly increasing subsequence of r + 1 terms or a strictly
decreasing subsequence of s + 1 terms.