l3lab/ntp-mathlib huggingface dataset:
theorem evariance_eq_lintegral_ofReal (X : Ω → ℝ) (μ : Measure Ω) :
    evariance X μ = ∫⁻ ω, ENNReal.ofReal ((X ω - μ[X]) ^ 2) ∂μ := by
  rw [evariance]
  congr
  ext1 ω
  rw [pow_two, ← ENNReal.coe_mul, ← nnnorm_mul, ← pow_two]
  congr
  

Proof state:
case e_f.h.e_a
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ‖(X ω - ∫ (x : Ω), X x ∂μ) ^ 2‖₊ = Real.toNNReal ((X ω - ∫ (x : Ω), X x ∂μ) ^ 2)

Next tactic:
exact (Real.toNNReal_eq_nnnorm_of_nonneg <| sq_nonneg _).symm
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ variance X μ = ∫ (x : Ω), (X ^ 2) x ∂μ

Next tactic:
rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal]
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ ∫ (x : Ω), (X x - ∫ (x : Ω), X x ∂μ) ^ 2 ∂μ = ∫ (x : Ω), (X ^ 2) x ∂μ

Next tactic:
simp_rw [hXint, sub_zero]
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ 0 ≤ ∫ (x : Ω), (X x - ∫ (x : Ω), X x ∂μ) ^ 2 ∂μ

Next tactic:
simp_rw [hXint, sub_zero]
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    

Proof state:
case hfi
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ Integrable fun ω => (X ω - ∫ (x : Ω), X x ∂μ) ^ 2

Next tactic:
simp_rw [hXint, sub_zero]
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    

Proof state:
case f_nn
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ 0 ≤ᵐ[μ] fun ω => (X ω - ∫ (x : Ω), X x ∂μ) ^ 2

Next tactic:
simp_rw [hXint, sub_zero]
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    simp_rw [hXint, sub_zero]
  · 

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ ∫ (x : Ω), X x ^ 2 ∂μ = ∫ (x : Ω), (X ^ 2) x ∂μ

Next tactic:
rfl
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    simp_rw [hXint, sub_zero]
  · rfl
  · 

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ 0 ≤ ∫ (x : Ω), X x ^ 2 ∂μ

Next tactic:
exact integral_nonneg fun ω => pow_two_nonneg _
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    simp_rw [hXint, sub_zero]
  · rfl
  · exact integral_nonneg fun ω => pow_two_nonneg _
  · 

Proof state:
case hfi
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ Integrable fun ω => X ω ^ 2

Next tactic:
convert hX.integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    simp_rw [hXint, sub_zero]
  · rfl
  · exact integral_nonneg fun ω => pow_two_nonneg _
  · convert hX.integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω
    

Proof state:
case h.e'_5.h
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
ω : Ω
⊢ X ω ^ 2 = ‖X ω‖ ^ ENNReal.toReal 2

Next tactic:
simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal,
      Real.rpow_two, sq_abs, abs_pow]
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ)
    (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
      ENNReal.toReal_ofReal] <;>
    simp_rw [hXint, sub_zero]
  · rfl
  · exact integral_nonneg fun ω => pow_two_nonneg _
  · convert hX.integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω
    simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal,
      Real.rpow_two, sq_abs, abs_pow]
  · 

Proof state:
case f_nn
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : Memℒp X 2
hXint : ∫ (x : Ω), X x ∂μ = 0
⊢ 0 ≤ᵐ[μ] fun ω => X ω ^ 2

Next tactic:
exact ae_of_all _ fun ω => pow_two_nonneg _
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hX : Memℒp X 2
⊢ variance X μ = ∫ (x : Ω), ((X - fun x => ∫ (x : Ω), X x ∂μ) ^ 2) x ∂μ

Next tactic:
rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
    ENNReal.toReal_ofReal]
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
    ENNReal.toReal_ofReal]
  · 

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hX : Memℒp X 2
⊢ ∫ (x : Ω), (X x - ∫ (x : Ω), X x ∂μ) ^ 2 ∂μ = ∫ (x : Ω), ((X - fun x => ∫ (x : Ω), X x ∂μ) ^ 2) x ∂μ

Next tactic:
rfl
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
    ENNReal.toReal_ofReal]
  · rfl
  · 

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hX : Memℒp X 2
⊢ 0 ≤ ∫ (x : Ω), (X x - ∫ (x : Ω), X x ∂μ) ^ 2 ∂μ

Next tactic:
exact integral_nonneg fun ω => pow_two_nonneg _
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
    ENNReal.toReal_ofReal]
  · rfl
  · exact integral_nonneg fun ω => pow_two_nonneg _
  · -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem,
    -- and `convert` cannot disambiguate based on typeclass inference failure.
    

Proof state:
case hfi
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hX : Memℒp X 2
⊢ Integrable fun ω => (X ω - ∫ (x : Ω), X x ∂μ) ^ 2

Next tactic:
convert (hX.sub <| memℒp_const (μ [X])).integrable_norm_rpow two_ne_zero ENNReal.two_ne_top
      with ω
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
    ENNReal.toReal_ofReal]
  · rfl
  · exact integral_nonneg fun ω => pow_two_nonneg _
  · -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem,
    -- and `convert` cannot disambiguate based on typeclass inference failure.
    convert (hX.sub <| memℒp_const (μ [X])).integrable_norm_rpow two_ne_zero ENNReal.two_ne_top
      with ω
    

Proof state:
case h.e'_5.h
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hX : Memℒp X 2
ω : Ω
⊢ (X ω - ∫ (x : Ω), X x ∂μ) ^ 2 = ‖(X - fun x => ∫ (x : Ω), X x ∂μ) ω‖ ^ ENNReal.toReal 2

Next tactic:
simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal,
      Real.rpow_two, sq_abs, abs_pow]
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) :
    variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
  rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal,
    ENNReal.toReal_ofReal]
  · rfl
  · exact integral_nonneg fun ω => pow_two_nonneg _
  · -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem,
    -- and `convert` cannot disambiguate based on typeclass inference failure.
    convert (hX.sub <| memℒp_const (μ [X])).integrable_norm_rpow two_ne_zero ENNReal.two_ne_top
      with ω
    simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal,
      Real.rpow_two, sq_abs, abs_pow]
  · 

Proof state:
case f_nn
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hX : Memℒp X 2
⊢ 0 ≤ᵐ[μ] fun ω => (X ω - ∫ (x : Ω), X x ∂μ) ^ 2

Next tactic:
exact ae_of_all _ fun ω => pow_two_nonneg _
@[simp]
theorem evariance_zero : evariance 0 μ = 0 := by 

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
⊢ evariance 0 μ = 0

Next tactic:
simp [evariance]
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : AEMeasurable X
⊢ evariance X μ = 0 ↔ X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ

Next tactic:
rw [evariance, lintegral_eq_zero_iff']
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : AEMeasurable X
⊢ (fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2) =ᵐ[μ] 0 ↔ X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ

Next tactic:
constructor
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> 

Proof state:
case mp
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : AEMeasurable X
⊢ (fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2) =ᵐ[μ] 0 → X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ

Next tactic:
intro hX
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> 

Proof state:
case mpr
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : AEMeasurable X
⊢ (X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ) → (fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2) =ᵐ[μ] 0

Next tactic:
intro hX
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> intro hX <;> 

Proof state:
case mp
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX✝ : AEMeasurable X
hX : (fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2) =ᵐ[μ] 0
⊢ X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ

Next tactic:
filter_upwards [hX] with ω hω
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> intro hX <;> 

Proof state:
case mpr
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX✝ : AEMeasurable X
hX : X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ
⊢ (fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2) =ᵐ[μ] 0

Next tactic:
filter_upwards [hX] with ω hω
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> intro hX <;> filter_upwards [hX] with ω hω
  · 

Proof state:
case h
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX✝ : AEMeasurable X
hX : (fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2) =ᵐ[μ] 0
ω : Ω
hω : ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2 = OfNat.ofNat 0 ω
⊢ X ω = ∫ (x : Ω), X x ∂μ

Next tactic:
simp only [Pi.zero_apply, pow_eq_zero_iff, Nat.succ_pos', ENNReal.coe_eq_zero, nnnorm_eq_zero,
      sub_eq_zero] at hω
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> intro hX <;> filter_upwards [hX] with ω hω
  · simp only [Pi.zero_apply, pow_eq_zero_iff, Nat.succ_pos', ENNReal.coe_eq_zero, nnnorm_eq_zero,
      sub_eq_zero] at hω
    

Proof state:
case h
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX✝ : AEMeasurable X
hX : (fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2) =ᵐ[μ] 0
ω : Ω
hω : X ω = ∫ (x : Ω), X x ∂μ
⊢ X ω = ∫ (x : Ω), X x ∂μ

Next tactic:
exact hω
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> intro hX <;> filter_upwards [hX] with ω hω
  · simp only [Pi.zero_apply, pow_eq_zero_iff, Nat.succ_pos', ENNReal.coe_eq_zero, nnnorm_eq_zero,
      sub_eq_zero] at hω
    exact hω
  · 

Proof state:
case h
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX✝ : AEMeasurable X
hX : X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ
ω : Ω
hω : X ω = ∫ (x : Ω), X x ∂μ
⊢ ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2 = OfNat.ofNat 0 ω

Next tactic:
rw [hω]
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> intro hX <;> filter_upwards [hX] with ω hω
  · simp only [Pi.zero_apply, pow_eq_zero_iff, Nat.succ_pos', ENNReal.coe_eq_zero, nnnorm_eq_zero,
      sub_eq_zero] at hω
    exact hω
  · rw [hω]
    

Proof state:
case h
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX✝ : AEMeasurable X
hX : X =ᵐ[μ] fun x => ∫ (x : Ω), X x ∂μ
ω : Ω
hω : X ω = ∫ (x : Ω), X x ∂μ
⊢ ↑‖∫ (x : Ω), X x ∂μ - ∫ (x : Ω), X x ∂μ‖₊ ^ 2 = OfNat.ofNat 0 ω

Next tactic:
simp
theorem evariance_eq_zero_iff (hX : AEMeasurable X μ) :
    evariance X μ = 0 ↔ X =ᵐ[μ] fun _ => μ[X] := by
  rw [evariance, lintegral_eq_zero_iff']
  constructor <;> intro hX <;> filter_upwards [hX] with ω hω
  · simp only [Pi.zero_apply, pow_eq_zero_iff, Nat.succ_pos', ENNReal.coe_eq_zero, nnnorm_eq_zero,
      sub_eq_zero] at hω
    exact hω
  · rw [hω]
    simp
  · 

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ : Measure Ω
hX : AEMeasurable X
⊢ AEMeasurable fun ω => ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2

Next tactic:
measurability
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
⊢ evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ

Next tactic:
rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
⊢ ∫⁻ (ω : Ω), ↑‖c * X ω - ∫ (x : Ω), c * X x ∂μ‖₊ ^ 2 ∂μ =
    ∫⁻ (a : Ω), ENNReal.ofReal (c ^ 2) * ↑‖X a - ∫ (x : Ω), X x ∂μ‖₊ ^ 2 ∂μ

Next tactic:
congr
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  

Proof state:
case e_f
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
⊢ (fun ω => ↑‖c * X ω - ∫ (x : Ω), c * X x ∂μ‖₊ ^ 2) = fun a => ENNReal.ofReal (c ^ 2) * ↑‖X a - ∫ (x : Ω), X x ∂μ‖₊ ^ 2

Next tactic:
ext1 ω
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  

Proof state:
case e_f.h
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ↑‖c * X ω - ∫ (x : Ω), c * X x ∂μ‖₊ ^ 2 = ENNReal.ofReal (c ^ 2) * ↑‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2

Next tactic:
rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
  

Proof state:
case e_f.h
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ↑(‖c * X ω - ∫ (x : Ω), c * X x ∂μ‖₊ ^ 2) = ↑(Real.toNNReal (c ^ 2) * ‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2)

Next tactic:
congr
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
  congr
  

Proof state:
case e_f.h.e_a
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ‖c * X ω - ∫ (x : Ω), c * X x ∂μ‖₊ ^ 2 = Real.toNNReal (c ^ 2) * ‖X ω - ∫ (x : Ω), X x ∂μ‖₊ ^ 2

Next tactic:
rw [← sq_abs, ← Real.rpow_two, Real.toNNReal_rpow_of_nonneg (abs_nonneg _), NNReal.rpow_two,
    ← mul_pow, Real.toNNReal_mul_nnnorm _ (abs_nonneg _)]
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
  congr
  rw [← sq_abs, ← Real.rpow_two, Real.toNNReal_rpow_of_nonneg (abs_nonneg _), NNReal.rpow_two,
    ← mul_pow, Real.toNNReal_mul_nnnorm _ (abs_nonneg _)]
  

Proof state:
case e_f.h.e_a
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ‖c * X ω - ∫ (x : Ω), c * X x ∂μ‖₊ ^ 2 = ‖|c| * (X ω - ∫ (x : Ω), X x ∂μ)‖₊ ^ 2

Next tactic:
conv_rhs => rw [← nnnorm_norm, norm_mul, norm_abs_eq_norm, ← norm_mul, nnnorm_norm, mul_sub]
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
  congr
  rw [← sq_abs, ← Real.rpow_two, Real.toNNReal_rpow_of_nonneg (abs_nonneg _), NNReal.rpow_two,
    ← mul_pow, Real.toNNReal_mul_nnnorm _ (abs_nonneg _)]
  conv_rhs => 

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
| ‖|c| * (X ω - ∫ (x : Ω), X x ∂μ)‖₊ ^ 2

Next tactic:
rw [← nnnorm_norm, norm_mul, norm_abs_eq_norm, ← norm_mul, nnnorm_norm, mul_sub]
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
  congr
  rw [← sq_abs, ← Real.rpow_two, Real.toNNReal_rpow_of_nonneg (abs_nonneg _), NNReal.rpow_two,
    ← mul_pow, Real.toNNReal_mul_nnnorm _ (abs_nonneg _)]
  conv_rhs => rw [← nnnorm_norm, norm_mul, norm_abs_eq_norm, ← norm_mul, nnnorm_norm, mul_sub]
  

Proof state:
case e_f.h.e_a
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ‖c * X ω - ∫ (x : Ω), c * X x ∂μ‖₊ ^ 2 = ‖c * X ω - c * ∫ (x : Ω), X x ∂μ‖₊ ^ 2

Next tactic:
congr
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
  congr
  rw [← sq_abs, ← Real.rpow_two, Real.toNNReal_rpow_of_nonneg (abs_nonneg _), NNReal.rpow_two,
    ← mul_pow, Real.toNNReal_mul_nnnorm _ (abs_nonneg _)]
  conv_rhs => rw [← nnnorm_norm, norm_mul, norm_abs_eq_norm, ← norm_mul, nnnorm_norm, mul_sub]
  congr
  

Proof state:
case e_f.h.e_a.e_a.e_a.e_a
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ∫ (x : Ω), c * X x ∂μ = c * ∫ (x : Ω), X x ∂μ

Next tactic:
rw [mul_comm]
theorem evariance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    evariance (fun ω => c * X ω) μ = ENNReal.ofReal (c ^ 2) * evariance X μ := by
  rw [evariance, evariance, ← lintegral_const_mul' _ _ ENNReal.ofReal_lt_top.ne]
  congr
  ext1 ω
  rw [ENNReal.ofReal, ← ENNReal.coe_pow, ← ENNReal.coe_pow, ← ENNReal.coe_mul]
  congr
  rw [← sq_abs, ← Real.rpow_two, Real.toNNReal_rpow_of_nonneg (abs_nonneg _), NNReal.rpow_two,
    ← mul_pow, Real.toNNReal_mul_nnnorm _ (abs_nonneg _)]
  conv_rhs => rw [← nnnorm_norm, norm_mul, norm_abs_eq_norm, ← norm_mul, nnnorm_norm, mul_sub]
  congr
  rw [mul_comm]
  

Proof state:
case e_f.h.e_a.e_a.e_a.e_a
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
ω : Ω
⊢ ∫ (x : Ω), c * X x ∂μ = (∫ (x : Ω), X x ∂μ) * c

Next tactic:
simp_rw [← smul_eq_mul, ← integral_smul_const, smul_eq_mul, mul_comm]
@[simp]
theorem variance_zero (μ : Measure Ω) : variance 0 μ = 0 := by
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X : Ω → ℝ
μ✝ μ : Measure Ω
⊢ variance 0 μ = 0

Next tactic:
simp only [variance, evariance_zero, ENNReal.zero_toReal]
theorem variance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    variance (fun ω => c * X ω) μ = c ^ 2 * variance X μ := by
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
⊢ variance (fun ω => c * X ω) μ = c ^ 2 * variance X μ

Next tactic:
rw [variance, evariance_mul, ENNReal.toReal_mul, ENNReal.toReal_ofReal (sq_nonneg _)]
theorem variance_mul (c : ℝ) (X : Ω → ℝ) (μ : Measure Ω) :
    variance (fun ω => c * X ω) μ = c ^ 2 * variance X μ := by
  rw [variance, evariance_mul, ENNReal.toReal_mul, ENNReal.toReal_ofReal (sq_nonneg _)]
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
c : ℝ
X : Ω → ℝ
μ : Measure Ω
⊢ c ^ 2 * ENNReal.toReal (evariance (fun ω => X ω) μ) = c ^ 2 * variance X μ

Next tactic:
rfl
theorem variance_smul' {A : Type*} [CommSemiring A] [Algebra A ℝ] (c : A) (X : Ω → ℝ)
    (μ : Measure Ω) : variance (c • X) μ = c ^ 2 • variance X μ := by
  

Proof state:
Ω : Type u_1
m : MeasurableSpace Ω
X✝ : Ω → ℝ
μ✝ : Measure Ω
A : Type u_2
inst✝¹ : CommSemiring A
inst✝ : Algebra A ℝ
c : A
X : Ω → ℝ
μ : Measure Ω
⊢ variance (c • X) μ = c ^ 2 • variance X μ

Next tactic:
convert variance_smul (algebraMap A ℝ c) X μ using 1