Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Six standard deviations suffice (Spencer's theorem) · variants.universal_bound

Source:Wikipedia lists of open problems
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

A universal discrepancy bound

There is a positive universal constant KK such that every family of nn subsets of the n points has a colouring with discrepancy at most KnK\sqrt{n} in every row. This qualitative form has the optimal order of growth, but it does not assert the constant 66 in Spencer's theorem.

Subjects:Combinatorics (math.CO)
MSC classes:05
Tags:formal_proof
Cite as:NS.08474 [math.CO] · NS.08474v1 for this version
Declaration:SixStandardDeviations.six_standard_deviations.variants.universal_bound
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:b7ef7e887818fa0811629b53f26c00f85d246f0bedecbe6b5e1d0fb1a59518c9
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/Wikipedia/SixStandardDeviations.lean

Formal statement

theorem six_standard_deviations.variants.universal_bound :
    ∃ K : ℝ, 0 < K ∧ ∀ (n : ℕ) (S : Fin n → Finset (Fin n)),
      ∃ χ : Fin n → ℝ, (∀ j, χ j = 1 ∨ χ j = -1) ∧
        ∀ i, |∑ j ∈ S i, χ j| ≤ K * Real.sqrt n
Show the full Challenge.lean (120 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Six standard deviations suffice (Spencer's theorem)

Spencer's theorem in discrepancy theory: for every $n$ and every family of $n$ subsets
$S_1, \dots, S_n$ of $\{1, \dots, n\}$, there is a colouring
$\chi : \{1, \dots, n\} \to \{-1, +1\}$ such that
$$\left|\sum_{j \in S_i} \chi(j)\right| \le 6\sqrt{n}$$
for every $i$.

A uniformly random colouring only achieves the bound $O(\sqrt{n \log n})$, so Spencer's
theorem ("six standard deviations suffice") is a genuine improvement over the basic
probabilistic method; its proof uses a partial-colouring argument based on the entropy
method, and the bound $\Theta(\sqrt{n})$ is tight up to the value of the constant.
Spencer's original argument is non-constructive; polynomial-time algorithms achieving
$O(\sqrt{n})$ were later found by Bansal (2010) and Lovett–Meka (2012).

The Komlós conjecture (the subject of a companion file in this directory) would
strengthen this theorem: applied to the incidence vectors of the sets, scaled by
$1/\sqrt{n}$, it would give a discrepancy bound $O(\sqrt{n})$ for any number of sets,
not just $n$ of them.

*References:*
- [Wikipedia](https://en.wikipedia.org/wiki/Discrepancy_of_hypergraphs#General_hypergraphs)
- [J. Spencer, *Six standard deviations suffice*,
  Trans. Amer. Math. Soc. **289** (1985), 679–706](https://doi.org/10.1090/S0002-9947-1985-0784009-0)
- [N. Bansal, *Constructive algorithms for discrepancy minimization*,
  FOCS 2010, 3–10](https://doi.org/10.1109/FOCS.2010.7)
- [S. Lovett and R. Meka, *Constructive discrepancy minimization by walking on the edges*,
  SIAM J. Comput. **44** (2015), 1573–1582](https://doi.org/10.1137/130929400)
-/

@[expose] public section

namespace SixStandardDeviations

/--
**Six standard deviations suffice** (Spencer, 1985)

For every $n$ and every family of $n$ subsets $S_1, \dots, S_n$ of $\{1, \dots, n\}$,
there is a colouring $\chi : \{1, \dots, n\} \to \{-1, +1\}$ such that
$\left|\sum_{j \in S_i} \chi(j)\right| \le 6\sqrt{n}$ for every $i$.
-/
@[category research solved, AMS 5]
theorem six_standard_deviations :
    ∀ (n : ℕ) (S : Fin n → Finset (Fin n)),
      ∃ χ : Fin n → ℝ, (∀ j, χ j = 1 ∨ χ j = -1) ∧
        ∀ i, |∑ j ∈ S i, χ j| ≤ 6 * Real.sqrt n := by
  sorry

set_option linter.style.formal_proof_palomar false in
/--
**The random colouring bound**

There is a constant $K > 0$ such that for every $n$ and every family of $n$ subsets
$S_1, \dots, S_n$ of $\{1, \dots, n\}$, there is a colouring
$\chi : \{1, \dots, n\} \to \{-1, +1\}$ with
$\left|\sum_{j \in S_i} \chi(j)\right| \le K \sqrt{n \log(n + 2)}$ for every $i$.
This follows from a Chernoff bound applied to a uniformly random colouring, and is
the benchmark that Spencer's theorem improves upon by removing the logarithmic
factor. (The shift $n + 2$ inside the logarithm is a harmless normalization keeping
it positive for $n \in \{0, 1\}$.)
-/
@[category research solved, AMS 5,
  formal_proof using lean4 at
    "https://github.com/Lemmy00/spencer-random-coloring-lean/blob/a691214a7263c1010fdd10560091e9f8cfce903a/SpencerRandomColoring/RandomBound.lean#L37"]
theorem six_standard_deviations.variants.random_bound :
    ∃ K : ℝ, 0 < K ∧ ∀ (n : ℕ) (S : Fin n → Finset (Fin n)),
      ∃ χ : Fin n → ℝ, (∀ j, χ j = 1 ∨ χ j = -1) ∧
        ∀ i, |∑ j ∈ S i, χ j| ≤ K * Real.sqrt (n * Real.log (n + 2)) := by
  sorry

set_option linter.style.formal_proof_palomar false in
/--
**A universal discrepancy bound**

There is a positive universal constant $K$ such that every family of $n$ subsets
of the `n` points has a colouring with discrepancy at most $K\sqrt{n}$ in every
row. This qualitative form has the optimal order of growth, but it does not assert
the constant $6$ in Spencer's theorem.
-/
@[category research solved, AMS 5,
  formal_proof using lean4 at
    "https://github.com/Lemmy00/spencer-universal-bound-lean/blob/e8d83c0a99f7c1be5a04aa155164bc477d2c6df3/Spencer/UniversalBound.lean#L15"]
theorem six_standard_deviations.variants.universal_bound :
    ∃ K : ℝ, 0 < K ∧ ∀ (n : ℕ) (S : Fin n → Finset (Fin n)),
      ∃ χ : Fin n → ℝ, (∀ j, χ j = 1 ∨ χ j = -1) ∧
        ∀ i, |∑ j ∈ S i, χ j| ≤ K * Real.sqrt n := by
  sorry

/--
Sanity check: with no points and no sets ($n = 0$), the empty colouring works and
the bound $6\sqrt{0} = 0$ holds vacuously.
-/
@[category test, AMS 5]
theorem six_standard_deviations.variants.zero_sets (S : Fin 0 → Finset (Fin 0)) :
    ∃ χ : Fin 0 → ℝ, (∀ j, χ j = 1 ∨ χ j = -1) ∧
      ∀ i, |∑ j ∈ S i, χ j| ≤ 6 * Real.sqrt 0 :=
  ⟨Fin.elim0, fun j => j.elim0, fun i => i.elim0⟩

end SixStandardDeviations

To prove it: keep every definition of Challenge.lean unchanged and prove SixStandardDeviations.six_standard_deviations.variants.universal_bound with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_universal_bound : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch wikipedia-sixstandarddeviations--six-standard-deviations-variants-universal-bound
nosorry submit wikipedia-sixstandarddeviations--six-standard-deviations-variants-universal-bound nosorry/wikipedia-sixstandarddeviations--six-standard-deviations-variants-universal-bound/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.