Kleitman's diameter theorem for the Hamming cube
Provedkleitman_diameterLet be a finite index set of size , and equip (equivalently, ) with the Hamming metric . Let be a natural number with , and let satisfy
i.e. is strictly larger than a Hamming ball of radius . Then contains two points at Hamming distance strictly greater than :
This is Kleitman's diameter theorem (1966): the diameter of a family exceeding the size of a radius- Hamming ball must exceed , twice the naive bound obtainable from a volume/pigeonhole argument alone (which only guarantees a point outside a ball of radius centred at a fixed element of , hence diameter ). The bound is sharp: a genuine Hamming ball of radius has diameter exactly and size exactly , so no weaker size hypothesis suffices. The theorem is a key ingredient of J. Spencer's entropy method for discrepancy (Six standard deviations suffice, 1985): a large enough 'fiber' of colourings sharing the same discretised row-sum pattern must contain two colourings that are far apart in Hamming distance, and their difference yields a good partial colouring.
Formalization Note. Stated over a general finite index type rather than specifically so that it applies directly to an arbitrary finite coordinate set (e.g. a subset of columns) without an explicit re-indexing equivalence.
import Mathlib open Finset
theorem kleitman_diameter {ι : Type*} [Fintype ι] [DecidableEq ι] (s : ℕ)
(hs : 2 * s < Fintype.card ι) (A : Finset (ι → Bool))
(hA : (∑ i ∈ Finset.range (s + 1), (Fintype.card ι).choose i) < A.card) :
∃ x ∈ A, ∃ y ∈ A, 2 * s < (Finset.univ.filter (fun j => x j ≠ y j)).card := by sorry