File: Mathlib/Probability/Variance.lean

full_name: ProbabilityTheory.evariance
code: /-- The `ℝ≥0∞`-valued variance of a real-valued random variable defined as the Lebesgue integral of
`(X - 𝔼[X])^2`. -/
def evariance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ≥0∞ 
goal: {x : MeasurableSpace Ω} → (Ω → ℝ) → MeasureTheory.Measure Ω → ℝ≥0∞

full_name: ProbabilityTheory.variance
code: /-- The `ℝ`-valued variance of a real-valued random variable defined by applying `ENNReal.toReal`
to `evariance`. -/
def variance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ 
goal: {x : MeasurableSpace Ω} → (Ω → ℝ) → MeasureTheory.Measure Ω → ℝ

full_name: MeasureTheory.Memℒp.evariance_lt_top
code: theorem _root_.MeasureTheory.Memℒp.evariance_lt_top [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    evariance X μ < ∞ 
goal: ProbabilityTheory.evariance X μ < ⊤

full_name: ProbabilityTheory.evariance_eq_top
code: theorem evariance_eq_top [IsFiniteMeasure μ] (hXm : AEStronglyMeasurable X μ) (hX : ¬Memℒp X 2 μ) :
    evariance X μ = ∞ 
goal: ProbabilityTheory.evariance X μ = ⊤

full_name: ProbabilityTheory.evariance_lt_top_iff_memℒp
code: theorem evariance_lt_top_iff_memℒp [IsFiniteMeasure μ] (hX : AEStronglyMeasurable X μ) :
    evariance X μ < ∞ ↔ Memℒp X 2 μ 
goal: ProbabilityTheory.evariance X μ < ⊤ ↔ MeasureTheory.Memℒp X 2 μ

full_name: MeasureTheory.Memℒp.ofReal_variance_eq
code: theorem _root_.MeasureTheory.Memℒp.ofReal_variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    ENNReal.ofReal (variance X μ) = evariance X μ 
goal: ENNReal.ofReal (ProbabilityTheory.variance X μ) = ProbabilityTheory.evariance X μ

full_name: ProbabilityTheory.evariance_eq_lintegral_ofReal
code: theorem evariance_eq_lintegral_ofReal (X : Ω → ℝ) (μ : Measure Ω) :
    evariance X μ = ∫⁻ ω, ENNReal.ofReal ((X ω - μ[X]) ^ 2) ∂μ 
goal: ProbabilityTheory.evariance X μ = ∫⁻ (ω : Ω), ENNReal.ofReal ((X ω - ∫ (x : Ω), X x ∂μ) ^ 2) ∂μ

full_name: MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero
code: theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] 
goal: ProbabilityTheory.variance X μ = ∫ (x : Ω), (X ^ 2) x ∂μ

full_name: MeasureTheory.Memℒp.variance_eq
code: theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] 
goal: ProbabilityTheory.variance X μ = ∫ (x : Ω), ((X - fun x => ∫ (x : Ω), X x ∂μ) ^ 2) x ∂μ

full_name: ProbabilityTheory.evariance_zero
code: @[simp]
theorem evariance_zero : evariance 0 μ = 0 
goal: ProbabilityTheory.evariance 0 μ = 0

full_name: ProbabilityTheory.evariance_eq_zero_iff
code: theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] 
goal: ProbabilityTheory.evariance X μ = 0 ↔ X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ

full_name: ProbabilityTheory.evariance_mul
code: theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ 
goal: ProbabilityTheory.evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * ProbabilityTheory.evariance X μ

full_name: ProbabilityTheory._aux_Mathlib_Probability_Variance___unexpand_ProbabilityTheory_evariance_1
code: scoped notation "eVar[" X "]" => ProbabilityTheory.evariance X MeasureTheory.MeasureSpace.volume
goal: Lean.PrettyPrinter.Unexpander

full_name: ProbabilityTheory.«_aux_Mathlib_Probability_Variance___macroRules_ProbabilityTheory_termEVar[_]_1»
code: scoped notation "eVar[" X "]" => ProbabilityTheory.evariance X MeasureTheory.MeasureSpace.volume
goal: Lean.Macro

full_name: ProbabilityTheory.variance_zero
code: @[simp]
theorem variance_zero (μ : Measure Ω) : variance 0 μ = 0 
goal: ProbabilityTheory.variance 0 μ = 0

full_name: ProbabilityTheory.variance_nonneg
code: theorem variance_nonneg (X : Ω → ℝ) (μ : Measure Ω) : 0 ≤ variance X μ 
goal: 0 ≤ ProbabilityTheory.variance X μ

full_name: ProbabilityTheory.variance_mul
code: theorem variance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    variance (fun ω => c * X ω) μ = c ^ 2 * variance X μ 
goal: ProbabilityTheory.variance (fun ω => c * X ω) μ = c ^ 2 * ProbabilityTheory.variance X μ

full_name: ProbabilityTheory.variance_smul
code: theorem variance_smul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    variance (c • X) μ = c ^ 2 * variance X μ 
goal: ProbabilityTheory.variance (c • X) μ = c ^ 2 * ProbabilityTheory.variance X μ

full_name: ProbabilityTheory.variance_smul'
code: theorem variance_smul' {A : Type*} [CommSemiring A] [Algebra A ℝ] (c : A) (X : Ω → ℝ)
    (μ : Measure Ω) : variance (c • X) μ = c ^ 2 • variance X μ 
goal: ProbabilityTheory.variance (c • X) μ = c ^ 2 • ProbabilityTheory.variance X μ

full_name: ProbabilityTheory._aux_Mathlib_Probability_Variance___unexpand_ProbabilityTheory_variance_1
code: scoped notation "Var[" X "]" => ProbabilityTheory.variance X MeasureTheory.MeasureSpace.volume
goal: Lean.PrettyPrinter.Unexpander

full_name: ProbabilityTheory.«_aux_Mathlib_Probability_Variance___macroRules_ProbabilityTheory_termVar[_]_1»
code: scoped notation "Var[" X "]" => ProbabilityTheory.variance X MeasureTheory.MeasureSpace.volume
goal: Lean.Macro

full_name: ProbabilityTheory.variance_def'
code: theorem variance_def' [@IsProbabilityMeasure Ω _ ℙ] {X : Ω → ℝ} (hX : Memℒp X 2) :
    Var[X] = 𝔼[X ^ 2] - 𝔼[X] ^ 2 
goal: ProbabilityTheory.variance X ℙ = (∫ (a : Ω), (X ^ 2) a) - (∫ (a : Ω), X a) ^ 2

full_name: ProbabilityTheory.variance_le_expectation_sq
code: theorem variance_le_expectation_sq [@IsProbabilityMeasure Ω _ ℙ] {X : Ω → ℝ}
    (hm : AEStronglyMeasurable X ℙ) : Var[X] ≤ 𝔼[X ^ 2] 
goal: ProbabilityTheory.variance X ℙ ≤ ∫ (a : Ω), (X ^ 2) a

full_name: ProbabilityTheory.evariance_def'
code: theorem evariance_def' [@IsProbabilityMeasure Ω _ ℙ] {X : Ω → ℝ} (hX : AEStronglyMeasurable X ℙ) :
    eVar[X] = (∫⁻ ω, (‖X ω‖₊ ^ 2 :)) - ENNReal.ofReal (𝔼[X] ^ 2) 
goal: ProbabilityTheory.evariance X ℙ = (∫⁻ (ω : Ω), ↑(‖X ω‖₊ ^ 2)) - ENNReal.ofReal ((∫ (a : Ω), X a) ^ 2)

full_name: ProbabilityTheory.meas_ge_le_evariance_div_sq
code: /-- **Chebyshev's inequality** for `ℝ≥0∞`-valued variance. -/
theorem meas_ge_le_evariance_div_sq {X : Ω → ℝ} (hX : AEStronglyMeasurable X ℙ) {c : ℝ≥0}
    (hc : c ≠ 0) : ℙ {ω | ↑c ≤ |X ω - 𝔼[X]|} ≤ eVar[X] / c ^ 2 
goal: ℙ {ω | ↑c ≤ |X ω - ∫ (a : Ω), X a|} ≤ ProbabilityTheory.evariance X ℙ / ↑c ^ 2

full_name: ProbabilityTheory.meas_ge_le_variance_div_sq
code: /-- **Chebyshev's inequality**: one can control the deviation probability of a real random variable
from its expectation in terms of the variance. -/
theorem meas_ge_le_variance_div_sq [@IsFiniteMeasure Ω _ ℙ] {X : Ω → ℝ} (hX : Memℒp X 2) {c : ℝ}
    (hc : 0 < c) : ℙ {ω | c ≤ |X ω - 𝔼[X]|} ≤ ENNReal.ofReal (Var[X] / c ^ 2) 
goal: ℙ {ω | c ≤ |X ω - ∫ (a : Ω), X a|} ≤ ENNReal.ofReal (ProbabilityTheory.variance X ℙ / c ^ 2)

full_name: ProbabilityTheory.IndepFun.variance_add
code: /-- The variance of the sum of two independent random variables is the sum of the variances. -/
theorem IndepFun.variance_add [@IsProbabilityMeasure Ω _ ℙ] {X Y : Ω → ℝ} (hX : Memℒp X 2)
    (hY : Memℒp Y 2) (h : @IndepFun _ _ _ (_) _ _ X Y ℙ) : Var[X + Y] = Var[X] + Var[Y] 
goal: ProbabilityTheory.variance (X + Y) ℙ = ProbabilityTheory.variance X ℙ + ProbabilityTheory.variance Y ℙ

full_name: ProbabilityTheory.IndepFun.variance_sum
code: /-- The variance of a finite sum of pairwise independent random variables is the sum of the
variances. -/
theorem IndepFun.variance_sum [@IsProbabilityMeasure Ω _ ℙ] {ι : Type*} {X : ι → Ω → ℝ}
    {s : Finset ι} (hs : ∀ i ∈ s, @Memℒp _ _ _ (_) (X i) 2 ℙ)
    (h : Set.Pairwise ↑s fun i j => @IndepFun _ _ _ (_) _ _ (X i) (X j) ℙ) :
    Var[∑ i ∈ s, X i] = ∑ i ∈ s, Var[X i] 
goal: ProbabilityTheory.variance (∑ i ∈ s, X i) ℙ = ∑ i ∈ s, ProbabilityTheory.variance (X i) ℙ