Documentation

Mathlib.Probability.Moments.SubGaussian

Sub-Gaussian random variables #

This presentation of sub-Gaussian random variables is inspired by section 2.5 of [vershynin2018high]. Let X be a random variable. Consider the following five properties, in which Kᵢ are positive reals,

Properties (i) to (iv) are equivalent, in the sense that there exists a constant C such that if X satisfies one of those properties with constant K, then it satisfies any other one with constant at most CK.

If 𝔼[X] = 0 then properties (i)-(iv) are equivalent to (v) in that same sense. Property (v) implies that X has expectation zero.

The name sub-Gaussian is used by various authors to refer to any one of (i)-(v). We will say that a random variable has sub-Gaussian moment generating function (mgf) with constant K₅ to mean that property (v) holds with that constant. The function exp (K₅ * t^2 / 2) which appears in property (v) is the mgf of a Gaussian with variance K₅. That property (v) is the most convenient one to work with if one wants to prove concentration inequalities using Chernoff's method.

TODO: implement definitions for (i)-(iv) when it makes sense. For example the maximal constant K₄ such that (iv) is true is an Orlicz norm. Prove relations between those properties.

Conditionally sub-Gaussian random variables and kernels #

A related notion to sub-Gaussian random variables is that of conditionally sub-Gaussian random variables. A random variable X is conditionally sub-Gaussian in the sense of (v) with respect to a sigma-algebra m and a measure μ if for all t : ℝ, exp (t * X) is μ-integrable and the conditional mgf of X conditioned on m is almost surely bounded by exp (c * t^2 / 2) for some constant c.

As in other parts of Mathlib's probability library (notably the independence and conditional independence definitions), we express both sub-Gaussian and conditionally sub-Gaussian properties as special cases of a notion of sub-Gaussianity with respect to a kernel and a measure.

Main definitions #

Implementation notes #

Definition of Kernel.HasSubgaussianMGF #

The definition of sub-Gaussian with respect to a kernel and a measure is the following:

structure Kernel.HasSubgaussianMGF (X : Ω → ℝ) (c : ℝ≥0)
    (κ : Kernel Ω' Ω) (ν : Measure Ω' := by volume_tac) : Prop where
  integrable_exp_mul : ∀ t, Integrable (fun ω ↦ exp (t * X ω)) (κ ∘ₘ ν)
  mgf_le : ∀ᵐ ω' ∂ν, ∀ t, mgf X (κ ω') t ≤ exp (c * t ^ 2 / 2)

An interesting point is that the integrability condition is not integrability of exp (t * X) with respect to κ ω' for ν-almost all ω', but integrability with respect to κ ∘ₘ ν. This is a stronger condition, as the weaker one did not allow to prove interesting results about the sum of two sub-Gaussian random variables.

For the conditional case, that integrability condition reduces to integrability of exp (t * X) with respect to μ.

Definition of HasCondSubgaussianMGF #

We define HasCondSubgaussianMGF as a special case of Kernel.HasSubgaussianMGF with the conditional expectation kernel for m, condExpKernel μ m, and the restriction of μ to m, μ.trim hm (where hm states that m is a sub-sigma-algebra). Note that condExpKernel μ m ∘ₘ μ.trim hm = μ. The definition is equivalent to the two conditions

For any t, we can write the mgf of X with respect to the conditional expectation kernel as a conditional expectation, (μ.trim hm)-almost surely: mgf X (condExpKernel μ m ·) t =ᵐ[μ.trim hm] μ[fun ω' ↦ exp (t * X ω') | m].

References #

Sub-Gaussian with respect to a kernel and a measure #

structure ProbabilityTheory.Kernel.HasSubgaussianMGF {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} (X : Ω) (c : NNReal) (κ : Kernel Ω' Ω) (ν : MeasureTheory.Measure Ω' := by volume_tac) :

A random variable X has a sub-Gaussian moment generating function with parameter c with respect to a kernel κ and a measure ν if for ν-almost all ω', for all t : ℝ, the moment generating function of X with respect to κ ω' is bounded by exp (c * t ^ 2 / 2). This implies in particular that X has expectation 0.

Instances For
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.aestronglyMeasurable {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) :
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.ae_integrable_exp_mul {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) (t : ) :
    ∀ᵐ (ω' : Ω') ν, MeasureTheory.Integrable (fun (y : Ω) => Real.exp (t * X y)) (κ ω')
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.ae_aestronglyMeasurable {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) :
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.ae_forall_integrable_exp_mul {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) :
    ∀ᵐ (ω' : Ω') ν, ∀ (t : ), MeasureTheory.Integrable (fun (ω : Ω) => Real.exp (t * X ω)) (κ ω')
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.memLp_exp_mul {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) (t : ) (p : NNReal) :
    MeasureTheory.MemLp (fun (ω : Ω) => Real.exp (t * X ω)) (↑p) (ν.bind κ)
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.cgf_le {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) :
    ∀ᵐ (ω' : Ω') ν, ∀ (t : ), cgf X (κ ω') t c * t ^ 2 / 2
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.isFiniteMeasure {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) :
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.measure_univ_le_one {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) :
    ∀ᵐ (ω' : Ω') ν, (κ ω') Set.univ 1
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.of_rat {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h_int : ∀ (t : ), MeasureTheory.Integrable (fun (ω : Ω) => Real.exp (t * X ω)) (ν.bind κ)) (h_mgf : ∀ (q : ), ∀ᵐ (ω' : Ω') ν, mgf X (κ ω') q Real.exp (c * q ^ 2 / 2)) :
    @[simp]
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.fun_zero {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} [MeasureTheory.IsFiniteMeasure ν] [IsZeroOrMarkovKernel κ] :
    HasSubgaussianMGF (fun (x : Ω) => 0) 0 κ ν
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.congr {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} {Y : Ω} (h : HasSubgaussianMGF X c κ ν) (h' : X =ᵐ[ν.bind κ] Y) :
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF_congr {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} {Y : Ω} (h : X =ᵐ[ν.bind κ] Y) :
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.measure_ge_le_exp_add {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) (ε : ) :
    ∀ᵐ (ω' : Ω') ν, ∀ (t : ), 0 t((κ ω') {ω : Ω | ε X ω}).toReal Real.exp (-t * ε + c * t ^ 2 / 2)
    theorem ProbabilityTheory.Kernel.HasSubgaussianMGF.measure_ge_le {Ω : Type u_1} {Ω' : Type u_2} { : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'} {ν : MeasureTheory.Measure Ω'} {κ : Kernel Ω' Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c κ ν) {ε : } ( : 0 ε) :
    ∀ᵐ (ω' : Ω') ν, ((κ ω') {ω : Ω | ε X ω}).toReal Real.exp (-ε ^ 2 / (2 * c))

    Chernoff bound on the right tail of a sub-Gaussian random variable.

    Conditionally sub-Gaussian moment generating function #

    def ProbabilityTheory.HasCondSubgaussianMGF {Ω : Type u_1} (m : MeasurableSpace Ω) { : MeasurableSpace Ω} (hm : m ) [StandardBorelSpace Ω] (X : Ω) (c : NNReal) (μ : MeasureTheory.Measure Ω := by volume_tac) [MeasureTheory.IsFiniteMeasure μ] :

    A random variable X has a conditionally sub-Gaussian moment generating function with parameter c with respect to a sigma-algebra m and a measure μ if for all t : ℝ, exp (t * X) is μ-integrable and the moment generating function of X conditioned on m is almost surely bounded by exp (c * t ^ 2 / 2) for all t : ℝ. This implies in particular that X has expectation 0.

    The actual definition uses Kernel.HasSubgaussianMGF: HasCondSubgaussianMGF is defined as sub-Gaussian with respect to the conditional expectation kernel for m and the restriction of μ to the sigma-algebra m.

    Equations
    Instances For
      theorem ProbabilityTheory.HasCondSubgaussianMGF.mgf_le {Ω : Type u_1} {m : MeasurableSpace Ω} {hm : m } [StandardBorelSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure μ] {X : Ω} {c : NNReal} (h : HasCondSubgaussianMGF m hm X c μ) :
      ∀ᵐ (ω' : Ω) μ.trim hm, ∀ (t : ), mgf X ((condExpKernel μ m) ω') t Real.exp (c * t ^ 2 / 2)
      theorem ProbabilityTheory.HasCondSubgaussianMGF.cgf_le {Ω : Type u_1} {m : MeasurableSpace Ω} {hm : m } [StandardBorelSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure μ] {X : Ω} {c : NNReal} (h : HasCondSubgaussianMGF m hm X c μ) :
      ∀ᵐ (ω' : Ω) μ.trim hm, ∀ (t : ), cgf X ((condExpKernel μ m) ω') t c * t ^ 2 / 2
      theorem ProbabilityTheory.HasCondSubgaussianMGF.ae_trim_condExp_le {Ω : Type u_1} {m : MeasurableSpace Ω} {hm : m } [StandardBorelSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure μ] {X : Ω} {c : NNReal} (h : HasCondSubgaussianMGF m hm X c μ) (t : ) :
      ∀ᵐ (ω' : Ω) μ.trim hm, μ[fun (ω : Ω) => Real.exp (t * X ω)|m] ω' Real.exp (c * t ^ 2 / 2)
      theorem ProbabilityTheory.HasCondSubgaussianMGF.ae_condExp_le {Ω : Type u_1} {m : MeasurableSpace Ω} {hm : m } [StandardBorelSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure μ] {X : Ω} {c : NNReal} (h : HasCondSubgaussianMGF m hm X c μ) (t : ) :
      ∀ᵐ (ω' : Ω) μ, μ[fun (ω : Ω) => Real.exp (t * X ω)|m] ω' Real.exp (c * t ^ 2 / 2)
      @[simp]
      theorem ProbabilityTheory.HasCondSubgaussianMGF.memLp_exp_mul {Ω : Type u_1} {m : MeasurableSpace Ω} {hm : m } [StandardBorelSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure μ] {X : Ω} {c : NNReal} (h : HasCondSubgaussianMGF m hm X c μ) (t : ) (p : NNReal) :
      MeasureTheory.MemLp (fun (ω : Ω) => Real.exp (t * X ω)) (↑p) μ
      theorem ProbabilityTheory.HasCondSubgaussianMGF.integrable_exp_mul {Ω : Type u_1} {m : MeasurableSpace Ω} {hm : m } [StandardBorelSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure μ] {X : Ω} {c : NNReal} (h : HasCondSubgaussianMGF m hm X c μ) (t : ) :
      MeasureTheory.Integrable (fun (ω : Ω) => Real.exp (t * X ω)) μ

      Sub-Gaussian moment generating function #

      structure ProbabilityTheory.HasSubgaussianMGF {Ω : Type u_1} { : MeasurableSpace Ω} (X : Ω) (c : NNReal) (μ : MeasureTheory.Measure Ω := by volume_tac) :

      A random variable X has a sub-Gaussian moment generating function with parameter c with respect to a measure μ if for all t : ℝ, exp (t * X) is μ-integrable and the moment generating function of X is bounded by exp (c * t ^ 2 / 2) for all t : ℝ. This implies in particular that X has expectation 0.

      This is equivalent to Kernel.HasSubgaussianMGF X c (Kernel.const Unit μ) (Measure.dirac ()), as proved in HasSubgaussianMGF_iff_kernel. Properties about sub-Gaussian moment generating functions should be proved first for Kernel.HasSubgaussianMGF when possible.

      Instances For
        theorem ProbabilityTheory.HasSubgaussianMGF.memLp_exp_mul {Ω : Type u_1} { : MeasurableSpace Ω} {μ : MeasureTheory.Measure Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c μ) (t : ) (p : NNReal) :
        MeasureTheory.MemLp (fun (ω : Ω) => Real.exp (t * X ω)) (↑p) μ
        theorem ProbabilityTheory.HasSubgaussianMGF.cgf_le {Ω : Type u_1} { : MeasurableSpace Ω} {μ : MeasureTheory.Measure Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c μ) (t : ) :
        cgf X μ t c * t ^ 2 / 2
        theorem ProbabilityTheory.HasSubgaussianMGF.measure_ge_le {Ω : Type u_1} { : MeasurableSpace Ω} {μ : MeasureTheory.Measure Ω} {X : Ω} {c : NNReal} (h : HasSubgaussianMGF X c μ) {ε : } ( : 0 ε) :
        (μ {ω : Ω | ε X ω}).toReal Real.exp (-ε ^ 2 / (2 * c))

        Chernoff bound on the right tail of a sub-Gaussian random variable.