NLA-lib Explorer

Concentration inequalities

Markov, Chebyshev, Bernstein, Hanson–Wright, and matrix Chernoff inequalities. The introductory exposition is incomplete; available library statements are listed below.

Mathematical guarantees

Theorem (Markov bound). For an integrable random variable X that is nonnegative almost surely, and t>0,

\Pr\{X\ge t\}\le\frac{\mathbb{E} X}{t}.

The checked result holds more generally for a measure and its integral. Integrability is an explicit hypothesis.

Lean statement and details
NLAlib.measureReal_ge_le_integral_div.{u_1} {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω}
  {f : Ω → ℝ} (hf0 : 0 ≤ᵐ[μ] f) (hf : Integrable f μ) {t : ℝ} (ht : 0 < t) :
  μ.real {ω | t ≤ f ω} ≤ (∫ (ω : Ω), f ω ∂μ) / t

Full source on GitHub

Copy link

Further results

Theorem (Bernstein's inequality).

for independent sub-exponential variables: if the X_i are independent and, for i \in s, X_i is sub-exponential with parameters (v_i, b_i) (HasSubexponentialMGF), then for t \ge 0 \mu\Bigl(\sum_{i \in s} X_i \ge t\Bigr) \le \exp\Bigl(-\min\Bigl(\frac{t^2}{2 \sum_{i \in s} v_i}, \frac{t}{2 \max_{i \in s} b_i}\Bigr)\Bigr), with the convention of measureReal_ge_le when a denominator is 0. [Wainwright2019, §2.1.3].

Lean statement and details
NLAlib.HasSubexponentialMGF.measureReal_sum_ge_le_of_iIndepFun.{u_1, u_2} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {ι : Type u_2} {X : ι → Ω → ℝ} (h_indep : iIndepFun X μ)
  {v b : ι → ℝ≥0} {s : Finset ι} (h : ∀ i ∈ s, HasSubexponentialMGF (X i) (v i) (b i) μ) {t : ℝ}
  (ht : 0 ≤ t) :
  μ.real {ω | t ≤ ∑ i ∈ s, X i ω} ≤
    rexp (-min (t ^ 2 / (2 * ↑(∑ i ∈ s, v i))) (t / (2 * ↑(s.sup b))))

Full source on GitHub

Copy link

Theorem (The bounded differences inequality).

a measurable function f of independent coordinates X_i whose value changes by at most c_i when the i-th coordinate alone changes, \lvert f(x') - f(x)\rvert \le c_i whenever x' differs from x only in coordinate i, is sub-Gaussian about its mean, f(X) - \mathbb{E} f(X), with proxy \frac{\sum_i c_i^2}{4}\,. [BoucheronLugosiMassart2013, Theorem 6.2]; [McDiarmid1989]. Coordinates in arbitrary measurable spaces; no integrability or probability hypothesis (f is bounded; iIndepFun gives a probability measure).

Lean statement and details
NLAlib.hasSubgaussianMGF_sub_integral_of_abs_update_sub_le.{u_1, u_2, u_3} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {ι : Type u_2} [Fintype ι] [DecidableEq ι]
  {S : ι → Type u_3} [(i : ι) → MeasurableSpace (S i)] {X : Ω → (i : ι) → S i}
  {f : ((i : ι) → S i) → ℝ} {c : ι → ℝ≥0} (hX : ∀ (i : ι), AEMeasurable (fun ω ↦ X ω i) μ)
  (hind : iIndepFun (fun i ω ↦ X ω i) μ) (hf : Measurable f)
  (hc : ∀ (i : ι) (x : (a : ι) → S a) (y : S i), |f (Function.update x i y) - f x| ≤ ↑(c i)) :
  HasSubgaussianMGF (fun ω ↦ f (X ω) - ∫ (ω' : Ω), f (X ω') ∂μ) ((∑ i, c i ^ 2) / 4) μ

Full source on GitHub

Copy link

Theorem (Chebyshev's inequality).

as a failure probability: for a finite measure \mu, X \in L^2 and t > 0, \mu\{t \le \lvert X - \mathbb{E} X\rvert\} \le \frac{\operatorname{Var} X}{t^2}\,, with \mathbb{E} X = \int X \, d\mu. [Vershynin2018, Corollary 1.2.5]; there for a probability measure, here any finite measure.

Lean statement and details
NLAlib.measureReal_ge_le_variance_div_sq.{u_1} {Ω : Type u_1} {mΩ : MeasurableSpace Ω}
  {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → ℝ} (hX : MemLp X 2 μ) {t : ℝ} (ht : 0 < t) :
  μ.real {ω | t ≤ |X ω - ∫ (ω' : Ω), X ω' ∂μ|} ≤ Var[X; μ] / t ^ 2

Full source on GitHub

Copy link

Theorem (Gaussian concentration of Lipschitz functions).

([BoucheronLugosiMassart2013, Theorem 5.6]): for \mathbf{g} with law stdGaussian E and f L-Lipschitz, f(\mathbf{g}) - \mathbb{E} f(\mathbf{g}) is sub-Gaussian with proxy L^2.

Lean statement and details
NLAlib.hasSubgaussianMGF_sub_integral_of_lipschitzWith_of_hasLaw_stdGaussian.{u_1, u_2}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {E : Type u_2} [NormedAddCommGroup E]
  [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] {g : Ω → E}
  {f : E → ℝ} {L : ℝ≥0} (hg : HasLaw g (stdGaussian E) μ) (hf : LipschitzWith L f) :
  HasSubgaussianMGF (fun ω ↦ f (g ω) - ∫ (ω' : Ω), f (g ω') ∂μ) (L ^ 2) μ

Full source on GitHub

Copy link

Theorem (The generalised matrix Laplace transform bound).

for \mathbf{Y} almost surely Hermitian, \psi \ge 0 nondecreasing on [0, \infty), t \ge 0 and \psi(t) > 0, \mu(\lambda_0(\mathbf{Y}) \ge t) \le \frac{\int \operatorname{tr} \psi(\mathbf{Y}) \, d\mu}{\psi(t)}\,. [Tropp2015, Proposition 7.4.1]; here for any measure \mu (the proof is Markov's inequality, mul_meas_ge_le_integral_of_nonneg, which needs no finiteness), over any RCLike field. No continuity of \psi is assumed: the spectrum of a Hermitian matrix is finite, so cfc ψ is never its junk value at a Hermitian argument. [Nonempty n] is needed: for empty n and t = 0 the event is everything and the right side 0. The integrability hypothesis hint excludes the junk value 0 of the integral.

General form: sizes are index types

Lean statement and details
NLAlib.measureReal_eigenvalue_zero_ge_le_integral_re_trace_cfc_div.{u_1, u_2, u_3} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {n : Type u_3} [Fintype n]
  [DecidableEq n] {Y : Ω → Matrix n n 𝕜} [Nonempty n] (hY : ∀ᵐ (ω : Ω) ∂μ, (Y ω).IsHermitian)
  {ψ : ℝ → ℝ} (hψ0 : ∀ (x : ℝ), 0 ≤ ψ x) (hψ : MonotoneOn ψ (Set.Ici 0))
  (hint : Integrable (fun ω ↦ RCLike.re (cfc ψ (Y ω)).trace) μ) {t : ℝ} (ht : 0 ≤ t)
  (hψt : 0 < ψ t) :
  μ.real {ω | t ≤ eigenvalue (Y ω) 0} ≤ (∫ (ω : Ω), RCLike.re (cfc ψ (Y ω)).trace ∂μ) / ψ t

Full source on GitHub

Copy link

Theorem (The Hanson–Wright inequality).

If the coordinates \mathbf{x}_i of a real random vector \mathbf{x} are independent and each satisfies the sub-Gaussian moment generating function bound with variance proxy c (HasSubgaussianMGF), then for every real square matrix \mathbf{A} and every t \ge 0, \mathbb{P}\bigl[\lvert \mathbf{x}^{\mathsf{T}}\mathbf{A}\mathbf{x} - \mathbb{E}\,\mathbf{x}^{\mathsf{T}}\mathbf{A}\mathbf{x} \rvert \ge t\bigr] \le 2 \exp\Bigl(-\frac{1}{196} \min\Bigl(\frac{t^2}{c^2 \|\mathbf{A}\|_{\mathsf{F}}^2}, \frac{t}{c \|\mathbf{A}\|_2}\Bigr)\Bigr); the explicit constant is hansonWrightConstant. [Vershynin2018, Theorem 6.2.1]; there with an unspecified absolute constant and the sub-Gaussian norm K of the coordinates, c playing the role of K^2.

Lean statement and details
NLAlib.measureReal_abs_quadForm_sub_integral_ge_le.{u_1, u_2} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {n : Type u_2} [Fintype n] {x : Ω → n → ℝ} {c : ℝ≥0}
  (hind : iIndepFun (fun i ω ↦ x ω i) μ) (h : ∀ (i : n), HasSubgaussianMGF (fun ω ↦ x ω i) c μ)
  (A : Matrix n n ℝ) {t : ℝ} (ht : 0 ≤ t) :
  μ.real {ω | t ≤ |quadForm A (x ω) - ∫ (ω' : Ω), quadForm A (x ω') ∂μ|} ≤
    2 *
      rexp
        (-(hansonWrightConstant * min (t ^ 2 / (↑c ^ 2 * frobNorm A ^ 2)) (t / (↑c * specNorm A))))

Full source on GitHub

Copy link

Theorem (Hoeffding's comparison).

a population sum sampled without replacement is dominated in convex order by the same sum sampled with replacement. For a population \mathbf{a} : n \to E in a real Banach space, \lvert k \rvert \le \lvert n \rvert, and f convex and continuous on a closed set s holding every with-replacement sum \sum_j \mathbf{a}_{J(j)}, \mathbb{E}_{\iota} f\Bigl(\sum_j \mathbf{a}_{\iota(j)}\Bigr) \le \mathbb{E}_{J} f\Bigl(\sum_j \mathbf{a}_{J(j)}\Bigr) \,, \iota : k \to n a uniform injection, J a vector of \lvert k \rvert i.i.d. uniform indices. [Hoeffding1963, Theorem 4] (there scalar, f continuous and convex); [GrossNesme2010, Section D] (there a finite set in a vector space and f convex on its convex hull, applied to matrices). Here any real Banach space and any f convex and continuous on a closed convex s; the hypothesis \lvert k \rvert \le \lvert n \rvert is needed since otherwise the left side is 0 and a convex f may be negative. The proof uses the pattern kernel and two permutation averages.

General form: sizes are index types

Lean statement and details
NLAlib.integral_uniformOn_injective_le_integral_pi.{u_3, u_4, u_5} {E : Type u_3}
  [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {s : Set E} {f : E → ℝ} {k : Type u_4}
  {n : Type u_5} [Fintype k] [Fintype n] [MeasurableSpace n] [MeasurableSingletonClass n]
  (hf : ConvexOn ℝ s f) (hfc : ContinuousOn f s) (hs : IsClosed s)
  (hk : Fintype.card k ≤ Fintype.card n) (A : n → E) (hA : ∀ (J : k → n), ∑ j, A (J j) ∈ s) :
  ∫ (ι : k → n), f (∑ j, A (ι j)) ∂uniformOn {ι | Function.Injective ι} ≤
    ∫ (J : k → n), f (∑ j, A (J j)) ∂Measure.pi fun x ↦ uniformOn Set.univ

Full source on GitHub

Copy link

Theorem (The Hsu–Kakade–Zhang tail).

for a real sub-Gaussian vector \mathbf{x} with proxy c \ne 0, a nonzero matrix \mathbf{A} over \Bbbk acting on \mathbf{x}, and t \ge 0, \mu\Bigl(\|\mathbf{A}\mathbf{x}\|^2 \ge c\,\bigl(\|\mathbf{A}\|_{\mathsf{F}}^2 + 2 \|\mathbf{A}^{\mathsf{H}}\mathbf{A}\|_{\mathsf{F}} \sqrt{t} + 2 \|\mathbf{A}\|_2^2\, t\bigr)\Bigr) \le e^{-t}\,. Hsu, Kakade and Zhang 2012, Theorem 2.1 (there \Bbbk = \mathbb{R}; the real case is this one through RCLike.ofReal_real_eq_id). There is no field factor because \mathbf{x} is real: the stacked real matrix \mathbf{A}_r = \begin{bmatrix} \operatorname{Re}\mathbf{A} \\ \operatorname{Im}\mathbf{A} \end{bmatrix} has the same Frobenius norm, spectral norm at most \|\mathbf{A}\|_2, \|\mathbf{A}_r^{\mathsf{T}}\mathbf{A}_r\|_{\mathsf{F}} \le \|\mathbf{A}^{\mathsf{H}}\mathbf{A}\|_{\mathsf{F}} (it is \operatorname{Re}(\mathbf{A}^{\mathsf{H}} \mathbf{A})), and the same image norm on real vectors. A complex \mathbf{x} would double \|\mathbf{A}\|_{\mathsf{F}}^2 (the realified operator is \begin{bmatrix} \operatorname{Re}\mathbf{A} & -\operatorname{Im}\mathbf{A} \\ \operatorname{Im}\mathbf{A} & \operatorname{Re}\mathbf{A} \end{bmatrix}). \mathbf{A} \ne \mathbf{0} and c \ne 0 are needed for the non-strict event, as in NLAlib.IsSubgaussianVector.measureReal_sum_mul_sq_ge_le. The case \mathbf{A} = \mathbf{I} is NLAlib.IsSubgaussianVector.measureReal_norm_sq_ge_le. The proof: the diagonal form at the eigenvalues \lambda_i of \mathbf{A}_r^{\mathsf{T}}\mathbf{A}_r = \operatorname{Re}(\mathbf{A}^{\mathsf{H}}\mathbf{A}) = \mathbf{V} \operatorname{diag}(\boldsymbol{\lambda}) \mathbf{V}^{\mathsf{T}} (the spectral theorem over \mathbb{R}; \mathbf{V}^{\mathsf{T}}\mathbf{x} has proxy c by NLAlib.IsSubgaussianVector.mulVec), whose sum is \|\mathbf{A}\|_{\mathsf{F}}^2, whose squares sum to at most \|\mathbf{A}^{\mathsf{H}}\mathbf{A}\|_{\mathsf{F}}^2, and which are at most \|\mathbf{A}\|_2^2.

Lean statement and details
NLAlib.IsSubgaussianVector.measureReal_norm_mulVec_sq_ge_le.{u_1, u_2, u_3, u_4} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {n : Type u_2} [Fintype n] {x : Ω → n → ℝ} {c : ℝ≥0}
  {m : Type u_3} [Fintype m] {𝕜 : Type u_4} [RCLike 𝕜] (h : IsSubgaussianVector x c μ) (hc : c ≠ 0)
  {A : Matrix m n 𝕜} (hA : A ≠ 0) {t : ℝ} (ht : 0 ≤ t) :
  μ.real
      {ω |
        ↑c * (frobNorm A ^ 2 + 2 * frobNorm (Aᴴ * A) * √t + 2 * specNorm A ^ 2 * t) ≤
          ‖WithLp.toLp 2 (A *ᵥ fun i ↦ ↑(x ω i))‖ ^ 2} ≤
    rexp (-t)

Full source on GitHub

Copy link

Theorem (Intrinsic-dimension matrix Bernstein for the mean).

, Hermitian summands: for finitely many independent, square-integrable, centred random n \times n matrices \mathbf{X}_k over \Bbbk with \mathbf{X}_k \preceq L\mathbf{I} almost surely, L > 0, and a proxy \sum_k \mathbb{E}\mathbf{X}_k^2 \preceq \mathbf{V}, with D = \operatorname{intdim}(\mathbf{V}), \mathbb{E}\, \lambda_0\Bigl(\sum_k \mathbf{X}_k\Bigr) \le 8 \Bigl(\sqrt{\|\mathbf{V}\|_2 \log(1 + D)} + L \log(1 + D)\Bigr); the constant is intrinsicBernsteinMeanConstant. [Tropp2015, Corollary 7.3.2]; here with any upper bound \mathbf{V} in Loewner order. Better than integral_eigenvalue_zero_sum_le_bernstein when \operatorname{intdim}(\mathbf{V}) is much smaller than \lvert n\rvert; its constant is worse.

Lean statement and details
NLAlib.integral_eigenvalue_zero_sum_le_bernstein_intrinsicDimension.{u_1, u_2, u_3, u_4}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {n : Type u_3}
  [Fintype n] [DecidableEq n] {ι : Type u_4} [Fintype ι] {L : ℝ} {X : ι → Ω → Matrix n n 𝕜}
  (hind : iIndepFun X μ) (hL : 0 < L) (hX2 : ∀ (k : ι), MemLp (X k) 2 μ)
  (hmean : ∀ (k : ι), ∫ (ω : Ω), X k ω ∂μ = 0) (hle : ∀ (k : ι), ∀ᵐ (ω : Ω) ∂μ, X k ω ≤ L • 1)
  {V : Matrix n n 𝕜} (hV : ∑ k, ∫ (ω : Ω), X k ω ^ 2 ∂μ ≤ V) :
  ∫ (ω : Ω), eigenvalue (∑ k, X k ω) 0 ∂μ ≤
    intrinsicBernsteinMeanConstant *
      (√(specNorm V * Real.log (1 + intrinsicDimension V)) +
        L * Real.log (1 + intrinsicDimension V))

Full source on GitHub

Copy link

Theorem (Intrinsic-dimension matrix Chernoff for the mean).

for finitely many independent, almost everywhere measurable random n \times n matrices \mathbf{X}_k over \Bbbk with \mathbf{0} \preceq \mathbf{X}_k \preceq L\mathbf{I} almost surely, L > 0, any matrix \mathbf{M} with \sum_k \mathbb{E}\mathbf{X}_k \preceq \mathbf{M} (possibly \mathbf{0}) and every \theta > 0, \mathbb{E}\, \lambda_0\Bigl(\sum_k \mathbf{X}_k\Bigr) \le \frac{e^\theta - 1}{\theta} \lambda_0(\mathbf{M}) + \frac{L}{\theta} \log\bigl(2 \operatorname{intdim}(\mathbf{M})\bigr)\,. [Tropp2015, Theorem 7.2.1]; here with any upper bound \mathbf{M} in Loewner order and a free \theta. No \mathbf{M} \ne \mathbf{0}: at \mathbf{M} = \mathbf{0} both sides are 0 (Real.log 0 = 0).

Lean statement and details
NLAlib.integral_eigenvalue_zero_sum_le_chernoff_intrinsicDimension.{u_1, u_2, u_3, u_4}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {n : Type u_3}
  [Fintype n] [DecidableEq n] {ι : Type u_4} [Fintype ι] {L : ℝ} {X : ι → Ω → Matrix n n 𝕜}
  (hind : iIndepFun X μ) (hXm : ∀ (k : ι), AEMeasurable (X k) μ) (hL : 0 < L)
  (hpsd : ∀ (k : ι), ∀ᵐ (ω : Ω) ∂μ, (X k ω).PosSemidef)
  (hle : ∀ (k : ι), ∀ᵐ (ω : Ω) ∂μ, X k ω ≤ L • 1) {M : Matrix n n 𝕜}
  (hM : ∑ k, ∫ (ω : Ω), X k ω ∂μ ≤ M) {θ : ℝ} (hθ : 0 < θ) :
  ∫ (ω : Ω), eigenvalue (∑ k, X k ω) 0 ∂μ ≤
    (rexp θ - 1) / θ * eigenvalue M 0 + L / θ * Real.log (2 * intrinsicDimension M)

Full source on GitHub

Copy link

Theorem (Matrix Bernstein without replacement).

, Hermitian population: for Hermitian \mathbf{X}_i, i \in n, with \sum_i \mathbf{X}_i = \mathbf{0} and \mathbf{X}_i \preceq L\mathbf{I}, L > 0, m nonempty, a uniformly random injection \iota : k \to n and t \ge 0, \mathbb{P}\Bigl[\lambda_0\Bigl(\sum_j \mathbf{X}_{\iota(j)}\Bigr) \ge t\Bigr] \le \lvert m\rvert \exp\Bigl(\frac{-t^2/2}{v + Lt/3}\Bigr), \qquad v = \frac{\lvert k\rvert}{\lvert n\rvert}\Bigl\|\sum_i \mathbf{X}_i^2\Bigr\|_2\,. The trace bound NLAlib.integral_re_trace_exp_sum_le_bernstein_of_hasLaw_uniformOn_injective in NLAlib.measureReal_eigenvalue_zero_ge_le_bernstein_of_integral_le. [Tropp2015, Theorem 6.6.1] (the i.i.d. form, the same bound); [GrossNesme2010, Section D] for the comparison.

General form: sizes are index types

Lean statement and details
NLAlib.measureReal_eigenvalue_zero_sum_ge_le_bernstein_of_hasLaw_uniformOn_injective.{u_1, u_2, u_3,
    u_4, u_5}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {k : Type u_3}
  {m : Type u_4} {n : Type u_5} [Fintype k] [Fintype m] [Fintype n] [DecidableEq m]
  [MeasurableSpace n] [MeasurableSingletonClass n] {ι : Ω → k → n} {L : ℝ} {X : n → Matrix m m 𝕜}
  [Nonempty m] (hι : HasLaw ι (uniformOn {f | Function.Injective f}) μ) (hL : 0 < L)
  (hX : ∀ (i : n), (X i).IsHermitian) (hsum : ∑ i, X i = 0) (hle : ∀ (i : n), X i ≤ L • 1) {t : ℝ}
  (ht : 0 ≤ t) :
  μ.real {ω | t ≤ eigenvalue (∑ j, X (ι ω j)) 0} ≤
    ↑(Fintype.card m) *
      rexp
        (-(t ^ 2 / 2) /
          (↑(Fintype.card k) / ↑(Fintype.card n) * specNorm (∑ i, X i ^ 2) + L * t / 3))

Full source on GitHub

Copy link

Theorem (Matrix Chernoff without replacement, lower tail).

, source form. For a population of m \times m matrices \mathbf{0} \preceq \mathbf{X}_i \preceq L\mathbf{I} over \Bbbk, i \in n, with L > 0, a uniformly random injection \iota : k \to n (its law under \mu is uniform on the injections), \mathbf{V} = (\lvert k \rvert / \lvert n \rvert) \sum_i \mathbf{X}_i, 0 \le \delta < 1 and the smallest eigenvalue, index j + 1 = \lvert m \rvert, \mathbb{P}\Bigl[\lambda_j\Bigl(\sum_{j'} \mathbf{X}_{\iota(j')}\Bigr) \le (1 - \delta) \lambda_j(\mathbf{V})\Bigr] \le \lvert m \rvert \Bigl(\frac{e^{-\delta}}{(1 - \delta)^{1-\delta}}\Bigr)^{\lambda_j(\mathbf{V}) / L} \,. [Tropp2011a, Theorem 2.1] (sampling without replacement); [Tropp2015, Theorem 5.1.1] (the i.i.d. form, the same bound).

General form: sizes are index types

Lean statement and details
NLAlib.measureReal_eigenvalue_sum_le_le_chernoff_of_hasLaw_uniformOn_injective.{u_1, u_2, u_3, u_4,
    u_5}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {k : Type u_3}
  {m : Type u_4} {n : Type u_5} [Fintype k] [Fintype m] [Fintype n] [DecidableEq m]
  [MeasurableSpace n] [MeasurableSingletonClass n] {ι : Ω → k → n} {X : n → Matrix m m 𝕜} {L δ : ℝ}
  (hι : HasLaw ι (uniformOn {f | Function.Injective f}) μ) (hL : 0 < L)
  (hpsd : ∀ (i : n), (X i).PosSemidef) (hle : ∀ (i : n), X i ≤ L • 1) {j : ℕ}
  (hj : j + 1 = Fintype.card m) (hδ0 : 0 ≤ δ) (hδ1 : δ < 1) :
  μ.real
      {ω |
        eigenvalue (∑ j', X (ι ω j')) j ≤
          (1 - δ) * eigenvalue ((↑(Fintype.card k) / ↑(Fintype.card n)) • ∑ i, X i) j} ≤
    ↑(Fintype.card m) *
      (rexp (-δ) / (1 - δ) ^ (1 - δ)) ^
        (eigenvalue ((↑(Fintype.card k) / ↑(Fintype.card n)) • ∑ i, X i) j / L)

Full source on GitHub

Copy link

Theorem (Freedman's inequality for matrix martingales).

For n nonempty, increments \mathbf{X}_j, \mathcal{F}_{j+1}-measurable, square-integrable, conditionally centred (\mathbb{E}[\mathbf{X}_j \mid \mathcal{F}_j] = \mathbf{0}) and with \mathbf{X}_j \preceq L\mathbf{I} almost surely, L > 0 and t \ge 0, \mathbb{P}\Bigl[\exists k,\ \lambda_0\Bigl(\sum_{j<k} \mathbf{X}_j\Bigr) \ge t \text{ and } \Bigl\|\sum_{j<k} \mathbb{E}[\mathbf{X}_j^2 \mid \mathcal{F}_j]\Bigr\|_2 \le v\Bigr] \le \lvert n\rvert \exp\Bigl(\frac{-t^2/2}{v + L t / 3}\Bigr)\,. [Tropp2011, Theorem 1.2]; stated there for Hermitian martingales over \mathbb{C} with the conditional variance as the predictable quadratic variation, here over any RCLike field, any finite index type, with square-integrable increments. The source's constant. No hypothesis on v: for v < 0 the event is empty.

General form: sizes are index types

Lean statement and details
NLAlib.measureReal_exists_eigenvalue_zero_sum_ge_le_freedman.{u_1, u_2, u_3} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ] {𝕜 : Type u_2} [RCLike 𝕜]
  {n : Type u_3} [Fintype n] [DecidableEq n] {ℱ : Filtration ℕ mΩ} [Nonempty n]
  {X : ℕ → Ω → Matrix n n 𝕜} (hX : ∀ (j : ℕ), StronglyMeasurable (X j))
  (hX2 : ∀ (j : ℕ), MemLp (X j) 2 μ) (hmean : ∀ (j : ℕ), μ[X j | ↑ℱ j] =ᵐ[μ] 0) {L : ℝ} (hL : 0 < L)
  (hle : ∀ (j : ℕ), ∀ᵐ (ω : Ω) ∂μ, X j ω ≤ L • 1) {t v : ℝ} (ht : 0 ≤ t) :
  μ.real
      {ω |
        ∃ k,
          t ≤ eigenvalue (∑ j ∈ Finset.range k, X j ω) 0 ∧
            specNorm (∑ j ∈ Finset.range k, μ[fun ω' ↦ X j ω' ^ 2 | ↑ℱ j] ω) ≤ v} ≤
    ↑(Fintype.card n) * rexp (-(t ^ 2 / 2) / (v + L * t / 3))

Full source on GitHub

Copy link

Theorem (McDiarmid's inequality).

for a measurable function f of independent coordinates with bounded differences c_i and t \ge 0, \mathbb{P}\bigl[t \le f(X) - \mathbb{E} f(X)\bigr] \le \exp\Bigl(-\frac{2t^2}{\sum_i c_i^2}\Bigr). [McDiarmid1989]; [BoucheronLugosiMassart2013, Theorem 6.2]. The source's constant. At \sum_i c_i^2 = 0 the bound is e^0 = 1 (Lean's x / 0 = 0), which is true.

Lean statement and details
NLAlib.measureReal_sub_integral_ge_le_mcdiarmid.{u_1, u_2, u_3} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {ι : Type u_2} [Fintype ι] [DecidableEq ι]
  {S : ι → Type u_3} [(i : ι) → MeasurableSpace (S i)] {X : Ω → (i : ι) → S i}
  {f : ((i : ι) → S i) → ℝ} {c : ι → ℝ≥0} (hX : ∀ (i : ι), AEMeasurable (fun ω ↦ X ω i) μ)
  (hind : iIndepFun (fun i ω ↦ X ω i) μ) (hf : Measurable f)
  (hc : ∀ (i : ι) (x : (a : ι) → S a) (y : S i), |f (Function.update x i y) - f x| ≤ ↑(c i)) {t : ℝ}
  (ht : 0 ≤ t) :
  μ.real {ω | t ≤ f (X ω) - ∫ (ω' : Ω), f (X ω') ∂μ} ≤ rexp (-2 * t ^ 2 / ∑ i, ↑(c i) ^ 2)

Full source on GitHub

Copy link

Theorem (Noncommutative Khintchine inequality).

, Gaussian series: for a standard Gaussian vector \mathbf{g} and Hermitian \mathbf{A}_i, for every p \in \mathbb{N}, \mathbb{E} \operatorname{tr} \Bigl(\sum_i g_i \mathbf{A}_i\Bigr)^{2p} \le (2p - 1)^p \operatorname{tr} \Bigl(\sum_i \mathbf{A}_i^2\Bigr)^p\,. [MackeyEtAl2014, Theorem 7.1]; [Tropp2015, chapter 4]; here over any RCLike field and any finite index types, every p (at p = 0 both sides are \lvert n\rvert). Buchholz's (2p - 1)!! is a sharper constant of another shape, not stated.

Lean statement and details
NLAlib.integral_re_trace_sum_smul_pow_le_of_hasLaw_gaussianVector.{u_1, u_2, u_3, u_4}
  {Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {𝕜 : Type u_2} [RCLike 𝕜] {n : Type u_3}
  [Fintype n] [DecidableEq n] {ι : Type u_4} [Fintype ι] {A : ι → Matrix n n 𝕜} {g : Ω → ι → ℝ}
  (hg : HasLaw g (gaussianVector ι) μ) (hA : ∀ (i : ι), (A i).IsHermitian) (p : ℕ) :
  ∫ (ω : Ω), RCLike.re ((∑ i, g ω i • A i) ^ (2 * p)).trace ∂μ ≤
    (2 * ↑p - 1) ^ p * RCLike.re ((∑ i, A i ^ 2) ^ p).trace

Full source on GitHub

Copy link

Theorem (The Paley–Zygmund inequality).

Under a probability measure, for a random variable Z \ge 0 almost surely with \mathbb{E} Z^2 < \infty and 0 \le \theta \le 1, (1 - \theta)^2 (\mathbb{E} Z)^2 \le \mathbb{E} Z^2 \cdot \mathbb{P}\bigl[Z > \theta\,\mathbb{E} Z\bigr]\,. Both hypotheses on \theta are needed: for \theta < 0 and a constant Z > 0 the left side exceeds \mathbb{E}Z^2, and for \theta > 1 the event is empty for a constant Z. [PaleyZygmund1932, Lemma 19] (locator to check: their companion note in vol. 28(3) cites Lemma 19, p. 192, of this paper); the product form avoids dividing by \mathbb{E} Z^2.

Lean statement and details
ProbabilityTheory.sq_mul_sq_integral_le_integral_sq_mul_measureReal_gt.{u_1} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ] {Z : Ω → ℝ} (hZ0 : 0 ≤ᵐ[μ] Z)
  (hZ : MemLp Z 2 μ) {θ : ℝ} (hθ0 : 0 ≤ θ) (hθ1 : θ ≤ 1) :
  (1 - θ) ^ 2 * (∫ (ω : Ω), Z ω ∂μ) ^ 2 ≤
    (∫ (ω : Ω), Z ω ^ 2 ∂μ) * μ.real {ω | θ * ∫ (ω' : Ω), Z ω' ∂μ < Z ω}

Full source on GitHub

Copy link

Theorem (The sub-exponential tail).

if X has variance proxy v and scale b, then for t \ge 0 \mu(X \ge t) \le \exp\Bigl(-\min\Bigl(\frac{t^2}{2v}, \frac{t}{2b}\Bigr)\Bigr)\,. [Wainwright2019, Proposition 2.9]. If b = 0 or v = 0, Lean's division by zero makes the exponent 0 and the bound 1; the regime forms are the usable statements then (for a sub-Gaussian variable, b = 0, use measureReal_ge_le_of_mul_le).

Lean statement and details
NLAlib.HasSubexponentialMGF.measureReal_ge_le.{u_1} {Ω : Type u_1} {mΩ : MeasurableSpace Ω}
  {μ : Measure Ω} {X : Ω → ℝ} {v b : ℝ≥0} (h : HasSubexponentialMGF X v b μ) {t : ℝ} (ht : 0 ≤ t) :
  μ.real {ω | t ≤ X ω} ≤ rexp (-min (t ^ 2 / (2 * ↑v)) (t / (2 * ↑b)))

Full source on GitHub

Copy link

Theorem (The maximal inequality).

the mean of the maximum of N sub-Gaussian variables with common proxy c is at most \sqrt{2 c \log N}, under a probability measure. No independence is assumed. [BoucheronLugosiMassart2013, Theorem 2.5].

General form: sizes are index types

Lean statement and details
ProbabilityTheory.HasSubgaussianMGF.integral_iSup_le.{u_1, u_2} {Ω : Type u_1}
  {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {c : ℝ≥0} [IsProbabilityMeasure μ] {ι : Type u_2}
  [Fintype ι] {X : ι → Ω → ℝ} (h : ∀ (i : ι), HasSubgaussianMGF (X i) c μ) :
  ∫ (ω : Ω), ⨆ i, X i ω ∂μ ≤ √(2 * ↑c * Real.log ↑(Fintype.card ι))

Full source on GitHub

Copy link

Theorem (Ville's maximal inequality).

a nonnegative supermartingale (f_k)_{k \ge 0} reaches the level c > 0 at some time with probability at most \frac{\mathbb{E}[f_0]}{c}\,; for a finite measure \mu, \mu\{\omega : \exists k,\ f_k(\omega) \ge c\} \le \frac{\int f_0 \, d\mu}{c}\,. Due to Ville (1939); the time-uniform form of Markov's inequality used for martingale tail bounds (the matrix Freedman inequality, NLAlib/Probability/MatrixConcentration/Freedman.lean).

Lean statement and details
MeasureTheory.Supermartingale.measureReal_exists_ge_le.{u_1} {Ω : Type u_1} {mΩ : MeasurableSpace Ω}
  {μ : Measure Ω} [IsFiniteMeasure μ] {ℱ : Filtration ℕ mΩ} {f : ℕ → Ω → ℝ}
  (hf : Supermartingale f ℱ μ) (hf0 : ∀ (k : ℕ), 0 ≤ᵐ[μ] f k) {c : ℝ} (hc : 0 < c) :
  μ.real {ω | ∃ k, c ≤ f k ω} ≤ (∫ (ω : Ω), f 0 ω ∂μ) / c

Full source on GitHub

Copy link

Formal definitions

Used by algorithms

Broader topics