probability.strong_law
⟷
Mathlib.Probability.StrongLaw
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -650,7 +650,7 @@ theorem strong_law_aux3 :
by
have A : tendsto (fun i => 𝔼[truncation (X i) i]) at_top (𝓝 𝔼[X 0]) :=
by
- convert (tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop
+ convert (tendsto_integral_truncation hint).comp tendsto_natCast_atTop_atTop
ext i
exact (hident i).truncation.integral_eq
convert Asymptotics.isLittleO_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 A)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -828,7 +828,7 @@ theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ
(uniform_integrable_average hp <|
mem_ℒp.uniform_integrable_of_ident_distrib hp hp' hℒp hident).2.1
· ext n ω
- simp only [Pi.coe_nat, Pi.div_apply, sum_apply]
+ simp only [Pi.natCast_def, Pi.div_apply, sum_apply]
#align probability_theory.strong_law_Lp ProbabilityTheory.strong_law_Lp
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -289,10 +289,10 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
sum_bij' (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ (fun a ha => rfl)
(fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ _ _
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_Ico] at hij
+ simp only [mem_sigma, mem_range, mem_Ico] at hij
simp only [hij, Nat.lt_succ_iff.2 hij.2.1, mem_sigma, mem_range, lt_min_iff, and_self_iff]
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, lt_min_iff] at hij
+ simp only [mem_sigma, mem_range, lt_min_iff] at hij
simp only [hij, Nat.lt_succ_iff.1 hij.2.1, mem_sigma, mem_range, mem_Ico, and_self_iff]
· rintro ⟨i, j⟩ hij; rfl
· rintro ⟨i, j⟩ hij; rfl
@@ -315,7 +315,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
· exact (continuous_id.add continuous_const).integrableOn_Ioc
· exact measurableSet_Ioc
· intro x hx
- simp only [Nat.cast_add, Nat.cast_one, Set.mem_Ioc] at hx
+ simp only [Nat.cast_add, Nat.cast_one, Set.mem_Ioc] at hx
simp [hx.1.le]
_ = ∫ x in 0 ..N, x + 1 ∂ρ :=
by
@@ -426,10 +426,10 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
sum_bij' (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ (fun a ha => rfl)
(fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ _ _
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_filter] at hij
+ simp only [mem_sigma, mem_range, mem_filter] at hij
simp [hij, mem_sigma, mem_range, and_self_iff, hij.2.trans hij.1]
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_Ioo] at hij
+ simp only [mem_sigma, mem_range, mem_Ioo] at hij
simp only [hij, mem_sigma, mem_range, and_self_iff]
· rintro ⟨i, j⟩ hij; rfl
· rintro ⟨i, j⟩ hij; rfl
@@ -552,11 +552,11 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
sum_bij' (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ (fun a ha => rfl)
(fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ _ _
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range] at hij
+ simp only [mem_sigma, mem_range] at hij
simp only [hij.1, hij.2, mem_sigma, mem_range, mem_filter, and_true_iff]
exact hij.2.trans_le (u_mono (Nat.le_pred_of_lt hij.1))
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_filter] at hij
+ simp only [mem_sigma, mem_range, mem_filter] at hij
simp only [hij.2.1, hij.2.2, mem_sigma, mem_range, and_self_iff]
· rintro ⟨i, j⟩ hij; rfl
· rintro ⟨i, j⟩ hij; rfl
@@ -613,7 +613,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
(le_of_tendsto_of_tendsto' (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
ENNReal.ofReal_lt_top
filter_upwards [ae_eventually_not_mem I4.ne] with ω hω
- simp_rw [not_le, mul_comm, S, sum_apply] at hω
+ simp_rw [not_le, mul_comm, S, sum_apply] at hω
exact hω
#align probability_theory.strong_law_aux1 ProbabilityTheory.strong_law_aux1
-/
@@ -705,7 +705,7 @@ theorem strong_law_aux5 :
· have : -(n : ℝ) < X n ω := by
apply lt_of_lt_of_le _ (hnonneg n ω)
simpa only [Right.neg_neg_iff, Nat.cast_pos] using npos
- simp only [this, true_and_iff, not_le] at h
+ simp only [this, true_and_iff, not_le] at h
exact (hn h).elim
filter_upwards [B] with ω hω
convert is_o_sum_range_of_tendsto_zero hω
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -167,7 +167,7 @@ theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {
have M : MeasurableSet (Set.Ioc (-A) A) := measurableSet_Ioc
change ∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = _
rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_le, ← integral_indicator M]
- · simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
+ · simp only [indicator, zero_pow _ hn, id.def, ite_pow]
· linarith
· exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral ProbabilityTheory.moment_truncation_eq_intervalIntegral
@@ -184,11 +184,11 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
change ∫ x, (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = _
rcases le_or_lt 0 A with (hA | hA)
· rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_le hA, ← integral_indicator M]
- · simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
+ · simp only [indicator, zero_pow _ hn, id.def, ite_pow]
· exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
· rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_ge hA.le, ←
integral_indicator M']
- · simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow' _ hn, Set.indicator_empty, integral_zero,
+ · simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow _ hn, Set.indicator_empty, integral_zero,
zero_eq_neg]
apply integral_eq_zero_of_ae
have : ∀ᵐ x ∂measure.map f μ, (0 : ℝ) ≤ x :=
@@ -197,7 +197,7 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
simp only [indicator, Set.mem_Ioc, Pi.zero_apply, ite_eq_right_iff, and_imp]
intro h'x h''x
have : x = 0 := by linarith
- simp [this, zero_pow' _ hn]
+ simp [this, zero_pow _ hn]
· exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.moment_truncation_eq_intervalIntegral_of_nonneg
-/
@@ -564,7 +564,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
by
apply sum_le_sum fun j hj => _
rcases@eq_zero_or_pos _ _ j with (rfl | hj)
- · simp only [Y, Nat.cast_zero, zero_pow', Ne.def, bit0_eq_zero, Nat.one_ne_zero,
+ · simp only [Y, Nat.cast_zero, zero_pow, Ne.def, bit0_eq_zero, Nat.one_ne_zero,
not_false_iff, div_zero, MulZeroClass.zero_mul]
simp only [Nat.cast_zero, truncation_zero, variance_zero, MulZeroClass.mul_zero]
apply mul_le_mul_of_nonneg_right _ (variance_nonneg _ _)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -637,7 +637,7 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
apply Asymptotics.isLittleO_iff.2 fun ε εpos => _
obtain ⟨i, hi⟩ : ∃ i, v i < ε := ((tendsto_order.1 v_lim).2 ε εpos).exists
filter_upwards [hω i] with n hn
- simp only [Real.norm_eq_abs, LatticeOrderedGroup.abs_abs, Nat.abs_cast]
+ simp only [Real.norm_eq_abs, abs_abs, Nat.abs_cast]
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
#align probability_theory.strong_law_aux2 ProbabilityTheory.strong_law_aux2
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -515,7 +515,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
set Y := fun n : ℕ => truncation (X n) n with hY
set S := fun n => ∑ i in range n, Y i with hS
let u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
- have u_mono : Monotone u := fun i j hij => Nat.floor_mono (pow_le_pow c_one.le hij)
+ have u_mono : Monotone u := fun i j hij => Nat.floor_mono (pow_le_pow_right c_one.le hij)
have I1 : ∀ K, ∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * Var[Y j] ≤ 2 * 𝔼[X 0] :=
by
intro K
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -769,12 +769,12 @@ theorem strong_law_aux7 :
end StrongLawNonneg
-#print ProbabilityTheory.strong_law_ae /-
+#print ProbabilityTheory.strong_law_ae_real /-
/-- *Strong law of large numbers*, almost sure version: if `X n` is a sequence of independent
identically distributed integrable real-valued random variables, then `∑ i in range n, X i / n`
converges almost surely to `𝔼[X 0]`. We give here the strong version, due to Etemadi, that only
requires pairwise independence. -/
-theorem strong_law_ae (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
+theorem strong_law_ae_real (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
(hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
∀ᵐ ω, Tendsto (fun n : ℕ => (∑ i in range n, X i ω) / n) atTop (𝓝 𝔼[X 0]) :=
by
@@ -794,7 +794,7 @@ theorem strong_law_ae (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
convert hωpos.sub hωneg
· simp only [← sub_div, ← sum_sub_distrib, max_zero_sub_max_neg_zero_eq_self]
· simp only [← integral_sub hint.pos_part hint.neg_part, max_zero_sub_max_neg_zero_eq_self]
-#align probability_theory.strong_law_ae ProbabilityTheory.strong_law_ae
+#align probability_theory.strong_law_ae ProbabilityTheory.strong_law_ae_real
-/
end StrongLawAe
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,11 +3,11 @@ Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
-import Mathbin.Probability.IdentDistrib
-import Mathbin.MeasureTheory.Integral.IntervalIntegral
-import Mathbin.Analysis.SpecificLimits.FloorPow
-import Mathbin.Analysis.PSeries
-import Mathbin.Analysis.Asymptotics.SpecificAsymptotics
+import Probability.IdentDistrib
+import MeasureTheory.Integral.IntervalIntegral
+import Analysis.SpecificLimits.FloorPow
+import Analysis.PSeries
+import Analysis.Asymptotics.SpecificAsymptotics
#align_import probability.strong_law from "leanprover-community/mathlib"@"1b089e3bdc3ce6b39cd472543474a0a137128c6c"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -637,7 +637,7 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
apply Asymptotics.isLittleO_iff.2 fun ε εpos => _
obtain ⟨i, hi⟩ : ∃ i, v i < ε := ((tendsto_order.1 v_lim).2 ε εpos).exists
filter_upwards [hω i] with n hn
- simp only [Real.norm_eq_abs, LatticeOrderedCommGroup.abs_abs, Nat.abs_cast]
+ simp only [Real.norm_eq_abs, LatticeOrderedGroup.abs_abs, Nat.abs_cast]
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
#align probability_theory.strong_law_aux2 ProbabilityTheory.strong_law_aux2
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module probability.strong_law
-! leanprover-community/mathlib commit 1b089e3bdc3ce6b39cd472543474a0a137128c6c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Probability.IdentDistrib
import Mathbin.MeasureTheory.Integral.IntervalIntegral
@@ -14,6 +9,8 @@ import Mathbin.Analysis.SpecificLimits.FloorPow
import Mathbin.Analysis.PSeries
import Mathbin.Analysis.Asymptotics.SpecificAsymptotics
+#align_import probability.strong_law from "leanprover-community/mathlib"@"1b089e3bdc3ce6b39cd472543474a0a137128c6c"
+
/-!
# The strong law of large numbers
mathlib commit https://github.com/leanprover-community/mathlib/commit/9240e8be927a0955b9a82c6c85ef499ee3a626b8
@@ -152,7 +152,7 @@ theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) :
#print MeasureTheory.AEStronglyMeasurable.memℒp_truncation /-
theorem MeasureTheory.AEStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
- Memℒp.of_bound hf.truncation (|A|) (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
+ Memℒp.of_bound hf.truncation |A| (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/d30d31261cdb4d2f5e612eabc3c4bf45556350d5
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
! This file was ported from Lean 3 source module probability.strong_law
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 1b089e3bdc3ce6b39cd472543474a0a137128c6c
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -17,6 +17,9 @@ import Mathbin.Analysis.Asymptotics.SpecificAsymptotics
/-!
# The strong law of large numbers
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
We prove the strong law of large numbers, in `probability_theory.strong_law_ae`:
If `X n` is a sequence of independent identically distributed integrable real-valued random
variables, then `∑ i in range n, X i / n` converges almost surely to `𝔼[X 0]`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/f2ad3645af9effcdb587637dc28a6074edc813f9
@@ -71,20 +71,25 @@ section Truncation
variable {α : Type _}
+#print ProbabilityTheory.truncation /-
/-- Truncating a real-valued function to the interval `(-A, A]`. -/
def truncation (f : α → ℝ) (A : ℝ) :=
indicator (Set.Ioc (-A) A) id ∘ f
#align probability_theory.truncation ProbabilityTheory.truncation
+-/
variable {m : MeasurableSpace α} {μ : Measure α} {f : α → ℝ}
+#print MeasureTheory.AEStronglyMeasurable.truncation /-
theorem MeasureTheory.AEStronglyMeasurable.truncation (hf : AEStronglyMeasurable f μ) {A : ℝ} :
AEStronglyMeasurable (truncation f A) μ :=
by
apply ae_strongly_measurable.comp_ae_measurable _ hf.ae_measurable
exact (strongly_measurable_id.indicator measurableSet_Ioc).AEStronglyMeasurable
#align measure_theory.ae_strongly_measurable.truncation MeasureTheory.AEStronglyMeasurable.truncation
+-/
+#print ProbabilityTheory.abs_truncation_le_bound /-
theorem abs_truncation_le_bound (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |A| :=
by
simp only [truncation, Set.indicator, Set.mem_Icc, id.def, Function.comp_apply]
@@ -92,11 +97,15 @@ theorem abs_truncation_le_bound (f : α → ℝ) (A : ℝ) (x : α) : |truncatio
· exact abs_le_abs h.2 (neg_le.2 h.1.le)
· simp [abs_nonneg]
#align probability_theory.abs_truncation_le_bound ProbabilityTheory.abs_truncation_le_bound
+-/
+#print ProbabilityTheory.truncation_zero /-
@[simp]
theorem truncation_zero (f : α → ℝ) : truncation f 0 = 0 := by simp [truncation]
#align probability_theory.truncation_zero ProbabilityTheory.truncation_zero
+-/
+#print ProbabilityTheory.abs_truncation_le_abs_self /-
theorem abs_truncation_le_abs_self (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |f x| :=
by
simp only [truncation, indicator, Set.mem_Icc, id.def, Function.comp_apply]
@@ -104,7 +113,9 @@ theorem abs_truncation_le_abs_self (f : α → ℝ) (A : ℝ) (x : α) : |trunca
· exact le_rfl
· simp [abs_nonneg]
#align probability_theory.abs_truncation_le_abs_self ProbabilityTheory.abs_truncation_le_abs_self
+-/
+#print ProbabilityTheory.truncation_eq_self /-
theorem truncation_eq_self {f : α → ℝ} {A : ℝ} {x : α} (h : |f x| < A) : truncation f A x = f x :=
by
simp only [truncation, indicator, Set.mem_Icc, id.def, Function.comp_apply, ite_eq_left_iff]
@@ -112,7 +123,9 @@ theorem truncation_eq_self {f : α → ℝ} {A : ℝ} {x : α} (h : |f x| < A) :
apply H.elim
simp [(abs_lt.1 h).1, (abs_lt.1 h).2.le]
#align probability_theory.truncation_eq_self ProbabilityTheory.truncation_eq_self
+-/
+#print ProbabilityTheory.truncation_eq_of_nonneg /-
theorem truncation_eq_of_nonneg {f : α → ℝ} {A : ℝ} (h : ∀ x, 0 ≤ f x) :
truncation f A = indicator (Set.Ioc 0 A) id ∘ f :=
by
@@ -125,21 +138,29 @@ theorem truncation_eq_of_nonneg {f : α → ℝ} {A : ℝ} (h : ∀ x, 0 ≤ f x
· simp only [h'x, and_false_iff]
· simp only [truncation, indicator, hx, id.def, Function.comp_apply, if_t_t]
#align probability_theory.truncation_eq_of_nonneg ProbabilityTheory.truncation_eq_of_nonneg
+-/
+#print ProbabilityTheory.truncation_nonneg /-
theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) : 0 ≤ truncation f A x :=
Set.indicator_apply_nonneg fun _ => h
#align probability_theory.truncation_nonneg ProbabilityTheory.truncation_nonneg
+-/
+#print MeasureTheory.AEStronglyMeasurable.memℒp_truncation /-
theorem MeasureTheory.AEStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
Memℒp.of_bound hf.truncation (|A|) (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation
+-/
+#print MeasureTheory.AEStronglyMeasurable.integrable_truncation /-
theorem MeasureTheory.AEStronglyMeasurable.integrable_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ := by
rw [← mem_ℒp_one_iff_integrable]; exact hf.mem_ℒp_truncation
#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AEStronglyMeasurable.integrable_truncation
+-/
+#print ProbabilityTheory.moment_truncation_eq_intervalIntegral /-
theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A)
{n : ℕ} (hn : n ≠ 0) : ∫ x, truncation f A x ^ n ∂μ = ∫ y in -A..A, y ^ n ∂Measure.map f μ :=
by
@@ -150,7 +171,9 @@ theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {
· linarith
· exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral ProbabilityTheory.moment_truncation_eq_intervalIntegral
+-/
+#print ProbabilityTheory.moment_truncation_eq_intervalIntegral_of_nonneg /-
theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ}
{n : ℕ} (hn : n ≠ 0) (h'f : 0 ≤ f) :
∫ x, truncation f A x ^ n ∂μ = ∫ y in 0 ..A, y ^ n ∂Measure.map f μ :=
@@ -177,17 +200,23 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
simp [this, zero_pow' _ hn]
· exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.moment_truncation_eq_intervalIntegral_of_nonneg
+-/
+#print ProbabilityTheory.integral_truncation_eq_intervalIntegral /-
theorem integral_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ}
(hA : 0 ≤ A) : ∫ x, truncation f A x ∂μ = ∫ y in -A..A, y ∂Measure.map f μ := by
simpa using moment_truncation_eq_interval_integral hf hA one_ne_zero
#align probability_theory.integral_truncation_eq_interval_integral ProbabilityTheory.integral_truncation_eq_intervalIntegral
+-/
+#print ProbabilityTheory.integral_truncation_eq_intervalIntegral_of_nonneg /-
theorem integral_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ}
(h'f : 0 ≤ f) : ∫ x, truncation f A x ∂μ = ∫ y in 0 ..A, y ∂Measure.map f μ := by
simpa using moment_truncation_eq_interval_integral_of_nonneg hf one_ne_zero h'f
#align probability_theory.integral_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.integral_truncation_eq_intervalIntegral_of_nonneg
+-/
+#print ProbabilityTheory.integral_truncation_le_integral_of_nonneg /-
theorem integral_truncation_le_integral_of_nonneg (hf : Integrable f μ) (h'f : 0 ≤ f) {A : ℝ} :
∫ x, truncation f A x ∂μ ≤ ∫ x, f x ∂μ :=
by
@@ -200,7 +229,9 @@ theorem integral_truncation_le_integral_of_nonneg (hf : Integrable f μ) (h'f :
_ ≤ |f x| := (abs_truncation_le_abs_self _ _ _)
_ = f x := abs_of_nonneg (h'f x)
#align probability_theory.integral_truncation_le_integral_of_nonneg ProbabilityTheory.integral_truncation_le_integral_of_nonneg
+-/
+#print ProbabilityTheory.tendsto_integral_truncation /-
/-- If a function is integrable, then the integral of its truncated versions converges to the
integral of the whole function. -/
theorem tendsto_integral_truncation {f : α → ℝ} (hf : Integrable f μ) :
@@ -218,12 +249,15 @@ theorem tendsto_integral_truncation {f : α → ℝ} (hf : Integrable f μ) :
filter_upwards [Ioi_mem_at_top (abs (f x))] with A hA
exact (truncation_eq_self hA).symm
#align probability_theory.tendsto_integral_truncation ProbabilityTheory.tendsto_integral_truncation
+-/
+#print ProbabilityTheory.IdentDistrib.truncation /-
theorem IdentDistrib.truncation {β : Type _} [MeasurableSpace β] {ν : Measure β} {f : α → ℝ}
{g : β → ℝ} (h : IdentDistrib f g μ ν) {A : ℝ} :
IdentDistrib (truncation f A) (truncation g A) μ ν :=
h.comp (measurable_id.indicator measurableSet_Ioc)
#align probability_theory.ident_distrib.truncation ProbabilityTheory.IdentDistrib.truncation
+-/
end Truncation
@@ -233,6 +267,7 @@ variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω
section MomentEstimates
+#print ProbabilityTheory.sum_prob_mem_Ioc_le /-
theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) {K : ℕ} {N : ℕ}
(hKN : K ≤ N) : ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N} ≤ ENNReal.ofReal (𝔼[X] + 1) :=
by
@@ -325,7 +360,9 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
rw [intervalIntegral.integral_of_le (Nat.cast_le.2 ((mem_range.1 hj).le.trans hKN))]
_ ≤ ENNReal.ofReal (𝔼[X] + 1) := ENNReal.ofReal_le_ofReal A
#align probability_theory.sum_prob_mem_Ioc_le ProbabilityTheory.sum_prob_mem_Ioc_le
+-/
+#print ProbabilityTheory.tsum_prob_mem_Ioi_lt_top /-
theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) :
∑' j : ℕ, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)} < ∞ :=
by
@@ -357,7 +394,9 @@ theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg
filter_upwards [Ici_mem_at_top K] with N hN
exact sum_prob_mem_Ioc_le hint hnonneg hN
#align probability_theory.tsum_prob_mem_Ioi_lt_top ProbabilityTheory.tsum_prob_mem_Ioi_lt_top
+-/
+#print ProbabilityTheory.sum_variance_truncation_le /-
theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) (K : ℕ) :
∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * 𝔼[truncation X j ^ 2] ≤ 2 * 𝔼[X] :=
by
@@ -435,6 +474,7 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
exact integral_truncation_le_integral_of_nonneg hint hnonneg)
zero_le_two
#align probability_theory.sum_variance_truncation_le ProbabilityTheory.sum_variance_truncation_le
+-/
end MomentEstimates
@@ -446,6 +486,7 @@ variable (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
(hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0))
(hnonneg : ∀ i ω, 0 ≤ X i ω)
+#print ProbabilityTheory.strong_law_aux1 /-
/- The truncation of `Xᵢ` up to `i` satisfies the strong law of large numbers (with respect to
the truncated expectation) along the sequence `c^n`, for any `c > 1`, up to a given `ε > 0`.
This follows from a variance control. -/
@@ -468,7 +509,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
have c_pos : 0 < c := zero_lt_one.trans c_one
let ρ : Measure ℝ := measure.map (X 0) ℙ
have hX : ∀ i, ae_strongly_measurable (X i) ℙ := fun i =>
- (hident i).symm.aEStronglyMeasurable_snd hint.1
+ (hident i).symm.aestronglyMeasurable_snd hint.1
have A : ∀ i, strongly_measurable (indicator (Set.Ioc (-i : ℝ) i) id) := fun i =>
strongly_measurable_id.indicator measurableSet_Ioc
set Y := fun n : ℕ => truncation (X n) n with hY
@@ -499,7 +540,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
congr 1
rw [hS, indep_fun.variance_sum]
· intro j hj
- exact (hident j).aEStronglyMeasurable_fst.memℒp_truncation
+ exact (hident j).aestronglyMeasurable_fst.memℒp_truncation
· intro k hk l hl hkl
exact (hindep hkl).comp (A k).Measurable (A l).Measurable
_ =
@@ -551,7 +592,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
apply meas_ge_le_variance_div_sq
·
exact
- mem_ℒp_finset_sum' _ fun j hj => (hident j).aEStronglyMeasurable_fst.memℒp_truncation
+ mem_ℒp_finset_sum' _ fun j hj => (hident j).aestronglyMeasurable_fst.memℒp_truncation
· apply mul_pos (Nat.cast_pos.2 _) εpos
refine' zero_lt_one.trans_le _
apply Nat.le_floor
@@ -575,7 +616,9 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
simp_rw [not_le, mul_comm, S, sum_apply] at hω
exact hω
#align probability_theory.strong_law_aux1 ProbabilityTheory.strong_law_aux1
+-/
+#print ProbabilityTheory.strong_law_aux2 /-
/- The truncation of `Xᵢ` up to `i` satisfies the strong law of large numbers
(with respect to the truncated expectation) along the sequence
`c^n`, for any `c > 1`. This follows from `strong_law_aux1` by varying `ε`. -/
@@ -597,7 +640,9 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
simp only [Real.norm_eq_abs, LatticeOrderedCommGroup.abs_abs, Nat.abs_cast]
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
#align probability_theory.strong_law_aux2 ProbabilityTheory.strong_law_aux2
+-/
+#print ProbabilityTheory.strong_law_aux3 /-
/-- The expectation of the truncated version of `Xᵢ` behaves asymptotically like the whole
expectation. This follows from convergence and Cesaro averaging. -/
theorem strong_law_aux3 :
@@ -614,7 +659,9 @@ theorem strong_law_aux3 :
rw [integral_finset_sum _ fun i hi => _]
exact ((hident i).symm.integrable_snd hint).1.integrable_truncation
#align probability_theory.strong_law_aux3 ProbabilityTheory.strong_law_aux3
+-/
+#print ProbabilityTheory.strong_law_aux4 /-
/- The truncation of `Xᵢ` up to `i` satisfies the strong law of large numbers
(with respect to the original expectation) along the sequence
`c^n`, for any `c > 1`. This follows from the version from the truncated expectation, and the
@@ -631,7 +678,9 @@ theorem strong_law_aux4 {c : ℝ} (c_one : 1 < c) :
ext1 n
simp
#align probability_theory.strong_law_aux4 ProbabilityTheory.strong_law_aux4
+-/
+#print ProbabilityTheory.strong_law_aux5 /-
/-- The truncated and non-truncated versions of `Xᵢ` have the same asymptotic behavior, as they
almost surely coincide at all but finitely many steps. This follows from a probability computation
and Borel-Cantelli. -/
@@ -663,7 +712,9 @@ theorem strong_law_aux5 :
ext n
rw [sum_sub_distrib]
#align probability_theory.strong_law_aux5 ProbabilityTheory.strong_law_aux5
+-/
+#print ProbabilityTheory.strong_law_aux6 /-
/- `Xᵢ` satisfies the strong law of large numbers along the sequence
`c^n`, for any `c > 1`. This follows from the version for the truncated `Xᵢ`, and the fact that
`Xᵢ` and its truncated version have the same asymptotic behavior. -/
@@ -690,7 +741,9 @@ theorem strong_law_aux6 {c : ℝ} (c_one : 1 < c) :
· ext1 n
field_simp [(H n).ne']
#align probability_theory.strong_law_aux6 ProbabilityTheory.strong_law_aux6
+-/
+#print ProbabilityTheory.strong_law_aux7 /-
/-- `Xᵢ` satisfies the strong law of large numbers along all integers. This follows from the
corresponding fact along the sequences `c^n`, and the fact that any integer can be sandwiched
between `c^n` and `c^(n+1)` with comparably small error if `c` is close enough to `1`
@@ -712,9 +765,11 @@ theorem strong_law_aux7 :
exact sum_le_sum_of_subset_of_nonneg (range_mono hmn) fun i hi h'i => hnonneg i ω
· exact hω
#align probability_theory.strong_law_aux7 ProbabilityTheory.strong_law_aux7
+-/
end StrongLawNonneg
+#print ProbabilityTheory.strong_law_ae /-
/-- *Strong law of large numbers*, almost sure version: if `X n` is a sequence of independent
identically distributed integrable real-valued random variables, then `∑ i in range n, X i / n`
converges almost surely to `𝔼[X 0]`. We give here the strong version, due to Etemadi, that only
@@ -740,6 +795,7 @@ theorem strong_law_ae (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
· simp only [← sub_div, ← sum_sub_distrib, max_zero_sub_max_neg_zero_eq_self]
· simp only [← integral_sub hint.pos_part hint.neg_part, max_zero_sub_max_neg_zero_eq_self]
#align probability_theory.strong_law_ae ProbabilityTheory.strong_law_ae
+-/
end StrongLawAe
@@ -747,6 +803,7 @@ section StrongLawLp
variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
+#print ProbabilityTheory.strong_law_Lp /-
/-- *Strong law of large numbers*, Lᵖ version: if `X n` is a sequence of independent
identically distributed real-valued random variables in Lᵖ, then `∑ i in range n, X i / n`
converges in Lᵖ to `𝔼[X 0]`. -/
@@ -755,7 +812,7 @@ theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ
Tendsto (fun n => snorm (fun ω => (∑ i in range n, X i ω) / n - 𝔼[X 0]) p ℙ) atTop (𝓝 0) :=
by
have hmeas : ∀ i, ae_strongly_measurable (X i) ℙ := fun i =>
- (hident i).aEStronglyMeasurable_iff.2 hℒp.1
+ (hident i).aestronglyMeasurable_iff.2 hℒp.1
have hint : integrable (X 0) ℙ := hℒp.integrable hp
have havg : ∀ n, ae_strongly_measurable (fun ω => (∑ i in range n, X i ω) / n) ℙ :=
by
@@ -773,6 +830,7 @@ theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ
· ext n ω
simp only [Pi.coe_nat, Pi.div_apply, sum_apply]
#align probability_theory.strong_law_Lp ProbabilityTheory.strong_law_Lp
+-/
end StrongLawLp
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -770,7 +770,7 @@ theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ
exact
(uniform_integrable_average hp <|
mem_ℒp.uniform_integrable_of_ident_distrib hp hp' hℒp hident).2.1
- · ext (n ω)
+ · ext n ω
simp only [Pi.coe_nat, Pi.div_apply, sum_apply]
#align probability_theory.strong_law_Lp ProbabilityTheory.strong_law_Lp
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -446,8 +446,6 @@ variable (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
(hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0))
(hnonneg : ∀ i ω, 0 ≤ X i ω)
-include X hint hindep hident hnonneg
-
/- The truncation of `Xᵢ` up to `i` satisfies the strong law of large numbers (with respect to
the truncated expectation) along the sequence `c^n`, for any `c > 1`, up to a given `ε > 0`.
This follows from a variance control. -/
@@ -600,8 +598,6 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
#align probability_theory.strong_law_aux2 ProbabilityTheory.strong_law_aux2
-omit hindep hnonneg
-
/-- The expectation of the truncated version of `Xᵢ` behaves asymptotically like the whole
expectation. This follows from convergence and Cesaro averaging. -/
theorem strong_law_aux3 :
@@ -619,8 +615,6 @@ theorem strong_law_aux3 :
exact ((hident i).symm.integrable_snd hint).1.integrable_truncation
#align probability_theory.strong_law_aux3 ProbabilityTheory.strong_law_aux3
-include hindep hnonneg
-
/- The truncation of `Xᵢ` up to `i` satisfies the strong law of large numbers
(with respect to the original expectation) along the sequence
`c^n`, for any `c > 1`. This follows from the version from the truncated expectation, and the
@@ -638,8 +632,6 @@ theorem strong_law_aux4 {c : ℝ} (c_one : 1 < c) :
simp
#align probability_theory.strong_law_aux4 ProbabilityTheory.strong_law_aux4
-omit hindep
-
/-- The truncated and non-truncated versions of `Xᵢ` have the same asymptotic behavior, as they
almost surely coincide at all but finitely many steps. This follows from a probability computation
and Borel-Cantelli. -/
@@ -672,8 +664,6 @@ theorem strong_law_aux5 :
rw [sum_sub_distrib]
#align probability_theory.strong_law_aux5 ProbabilityTheory.strong_law_aux5
-include hindep
-
/- `Xᵢ` satisfies the strong law of large numbers along the sequence
`c^n`, for any `c > 1`. This follows from the version for the truncated `Xᵢ`, and the fact that
`Xᵢ` and its truncated version have the same asymptotic behavior. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -141,10 +141,10 @@ theorem MeasureTheory.AEStronglyMeasurable.integrable_truncation [IsFiniteMeasur
#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AEStronglyMeasurable.integrable_truncation
theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A)
- {n : ℕ} (hn : n ≠ 0) : (∫ x, truncation f A x ^ n ∂μ) = ∫ y in -A..A, y ^ n ∂Measure.map f μ :=
+ {n : ℕ} (hn : n ≠ 0) : ∫ x, truncation f A x ^ n ∂μ = ∫ y in -A..A, y ^ n ∂Measure.map f μ :=
by
have M : MeasurableSet (Set.Ioc (-A) A) := measurableSet_Ioc
- change (∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ) = _
+ change ∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = _
rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_le, ← integral_indicator M]
· simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
· linarith
@@ -153,12 +153,12 @@ theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {
theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ}
{n : ℕ} (hn : n ≠ 0) (h'f : 0 ≤ f) :
- (∫ x, truncation f A x ^ n ∂μ) = ∫ y in 0 ..A, y ^ n ∂Measure.map f μ :=
+ ∫ x, truncation f A x ^ n ∂μ = ∫ y in 0 ..A, y ^ n ∂Measure.map f μ :=
by
have M : MeasurableSet (Set.Ioc 0 A) := measurableSet_Ioc
have M' : MeasurableSet (Set.Ioc A 0) := measurableSet_Ioc
rw [truncation_eq_of_nonneg h'f]
- change (∫ x, (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ) = _
+ change ∫ x, (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = _
rcases le_or_lt 0 A with (hA | hA)
· rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_le hA, ← integral_indicator M]
· simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
@@ -179,17 +179,17 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
#align probability_theory.moment_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.moment_truncation_eq_intervalIntegral_of_nonneg
theorem integral_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ}
- (hA : 0 ≤ A) : (∫ x, truncation f A x ∂μ) = ∫ y in -A..A, y ∂Measure.map f μ := by
+ (hA : 0 ≤ A) : ∫ x, truncation f A x ∂μ = ∫ y in -A..A, y ∂Measure.map f μ := by
simpa using moment_truncation_eq_interval_integral hf hA one_ne_zero
#align probability_theory.integral_truncation_eq_interval_integral ProbabilityTheory.integral_truncation_eq_intervalIntegral
theorem integral_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ}
- (h'f : 0 ≤ f) : (∫ x, truncation f A x ∂μ) = ∫ y in 0 ..A, y ∂Measure.map f μ := by
+ (h'f : 0 ≤ f) : ∫ x, truncation f A x ∂μ = ∫ y in 0 ..A, y ∂Measure.map f μ := by
simpa using moment_truncation_eq_interval_integral_of_nonneg hf one_ne_zero h'f
#align probability_theory.integral_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.integral_truncation_eq_intervalIntegral_of_nonneg
theorem integral_truncation_le_integral_of_nonneg (hf : Integrable f μ) (h'f : 0 ≤ f) {A : ℝ} :
- (∫ x, truncation f A x ∂μ) ≤ ∫ x, f x ∂μ :=
+ ∫ x, truncation f A x ∂μ ≤ ∫ x, f x ∂μ :=
by
apply
integral_mono_of_nonneg (eventually_of_forall fun x => _) hf (eventually_of_forall fun x => _)
@@ -234,13 +234,13 @@ variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω
section MomentEstimates
theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) {K : ℕ} {N : ℕ}
- (hKN : K ≤ N) : (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N}) ≤ ENNReal.ofReal (𝔼[X] + 1) :=
+ (hKN : K ≤ N) : ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N} ≤ ENNReal.ofReal (𝔼[X] + 1) :=
by
let ρ : Measure ℝ := measure.map X ℙ
haveI : is_probability_measure ρ := is_probability_measure_map hint.ae_measurable
- have A : (∑ j in range K, ∫ x in j..N, (1 : ℝ) ∂ρ) ≤ 𝔼[X] + 1 :=
+ have A : ∑ j in range K, ∫ x in j..N, (1 : ℝ) ∂ρ ≤ 𝔼[X] + 1 :=
calc
- (∑ j in range K, ∫ x in j..N, (1 : ℝ) ∂ρ) =
+ ∑ j in range K, ∫ x in j..N, (1 : ℝ) ∂ρ =
∑ j in range K, ∑ i in Ico j N, ∫ x in i..(i + 1 : ℕ), (1 : ℝ) ∂ρ :=
by
apply sum_congr rfl fun j hj => _
@@ -287,7 +287,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
rw [intervalIntegral.sum_integral_adjacent_intervals fun k hk => _]
· norm_cast
· exact (continuous_id.add continuous_const).IntervalIntegrable _ _
- _ = (∫ x in 0 ..N, x ∂ρ) + ∫ x in 0 ..N, 1 ∂ρ :=
+ _ = ∫ x in 0 ..N, x ∂ρ + ∫ x in 0 ..N, 1 ∂ρ :=
by
rw [intervalIntegral.integral_add]
· exact continuous_id.interval_integrable _ _
@@ -310,7 +310,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
measure.map_apply_of_ae_measurable hint.ae_measurable measurableSet_Ioc]
rfl
calc
- (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N}) =
+ ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N} =
∑ j in range K, ENNReal.ofReal (∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
by simp_rw [B]
_ = ENNReal.ofReal (∑ j in range K, ∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
@@ -327,9 +327,9 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
#align probability_theory.sum_prob_mem_Ioc_le ProbabilityTheory.sum_prob_mem_Ioc_le
theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) :
- (∑' j : ℕ, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)}) < ∞ :=
+ ∑' j : ℕ, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)} < ∞ :=
by
- suffices : ∀ K : ℕ, (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)}) ≤ ENNReal.ofReal (𝔼[X] + 1)
+ suffices : ∀ K : ℕ, ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)} ≤ ENNReal.ofReal (𝔼[X] + 1)
exact
(le_of_tendsto_of_tendsto (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds
(eventually_of_forall this)).trans_lt
@@ -359,7 +359,7 @@ theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg
#align probability_theory.tsum_prob_mem_Ioi_lt_top ProbabilityTheory.tsum_prob_mem_Ioi_lt_top
theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) (K : ℕ) :
- (∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * 𝔼[truncation X j ^ 2]) ≤ 2 * 𝔼[X] :=
+ ∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * 𝔼[truncation X j ^ 2] ≤ 2 * 𝔼[X] :=
by
set Y := fun n : ℕ => truncation X n
let ρ : Measure ℝ := measure.map X ℙ
@@ -369,7 +369,7 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
change 𝔼[fun x => Y n x ^ 2] = _
rw [moment_truncation_eq_interval_integral_of_nonneg hint.1 two_ne_zero hnonneg]
calc
- (∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * 𝔼[Y j ^ 2]) =
+ ∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * 𝔼[Y j ^ 2] =
∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * ∫ x in 0 ..j, x ^ 2 ∂ρ :=
by simp_rw [Y2]
_ = ∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * ∑ k in range j, ∫ x in k..(k + 1 : ℕ), x ^ 2 ∂ρ :=
@@ -454,7 +454,7 @@ This follows from a variance control. -/
theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
∀ᵐ ω,
∀ᶠ n : ℕ in atTop,
- |(∑ i in range ⌊c ^ n⌋₊, truncation (X i) i ω) -
+ |∑ i in range ⌊c ^ n⌋₊, truncation (X i) i ω -
𝔼[∑ i in range ⌊c ^ n⌋₊, truncation (X i) i]| <
ε * ⌊c ^ n⌋₊ :=
by
@@ -477,11 +477,11 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
set S := fun n => ∑ i in range n, Y i with hS
let u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
have u_mono : Monotone u := fun i j hij => Nat.floor_mono (pow_le_pow c_one.le hij)
- have I1 : ∀ K, (∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * Var[Y j]) ≤ 2 * 𝔼[X 0] :=
+ have I1 : ∀ K, ∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * Var[Y j] ≤ 2 * 𝔼[X 0] :=
by
intro K
calc
- (∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * Var[Y j]) ≤
+ ∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * Var[Y j] ≤
∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * 𝔼[truncation (X 0) j ^ 2] :=
by
apply sum_le_sum fun j hj => _
@@ -490,11 +490,11 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
exact variance_le_expectation_sq (hX 0).truncation
_ ≤ 2 * 𝔼[X 0] := sum_variance_truncation_le hint (hnonneg 0) K
let C := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * 𝔼[X 0])
- have I2 : ∀ N, (∑ i in range N, ((u i : ℝ) ^ 2)⁻¹ * Var[S (u i)]) ≤ C :=
+ have I2 : ∀ N, ∑ i in range N, ((u i : ℝ) ^ 2)⁻¹ * Var[S (u i)] ≤ C :=
by
intro N
calc
- (∑ i in range N, ((u i : ℝ) ^ 2)⁻¹ * Var[S (u i)]) =
+ ∑ i in range N, ((u i : ℝ) ^ 2)⁻¹ * Var[S (u i)] =
∑ i in range N, ((u i : ℝ) ^ 2)⁻¹ * ∑ j in range (u i), Var[Y j] :=
by
congr 1 with i
@@ -541,12 +541,12 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
exact pow_nonneg (inv_nonneg.2 (sub_nonneg.2 c_one.le)) _
have I3 :
∀ N,
- (∑ i in range N, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) ≤
+ ∑ i in range N, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|} ≤
ENNReal.ofReal (ε⁻¹ ^ 2 * C) :=
by
intro N
calc
- (∑ i in range N, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) ≤
+ ∑ i in range N, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|} ≤
∑ i in range N, ENNReal.ofReal (Var[S (u i)] / (u i * ε) ^ 2) :=
by
refine' sum_le_sum fun i hi => _
@@ -570,7 +570,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
simp_rw [inv_pow]
exact I2 N
- have I4 : (∑' i, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) < ∞ :=
+ have I4 : ∑' i, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|} < ∞ :=
(le_of_tendsto_of_tendsto' (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
ENNReal.ofReal_lt_top
filter_upwards [ae_eventually_not_mem I4.ne] with ω hω
@@ -584,7 +584,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
∀ᵐ ω,
(fun n : ℕ =>
- (∑ i in range ⌊c ^ n⌋₊, truncation (X i) i ω) -
+ ∑ i in range ⌊c ^ n⌋₊, truncation (X i) i ω -
𝔼[∑ i in range ⌊c ^ n⌋₊, truncation (X i) i]) =o[atTop]
fun n : ℕ => (⌊c ^ n⌋₊ : ℝ) :=
by
@@ -627,7 +627,7 @@ include hindep hnonneg
fact that the truncated and the original expectations have the same asymptotic behavior. -/
theorem strong_law_aux4 {c : ℝ} (c_one : 1 < c) :
∀ᵐ ω,
- (fun n : ℕ => (∑ i in range ⌊c ^ n⌋₊, truncation (X i) i ω) - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[atTop]
+ (fun n : ℕ => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) i ω - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[atTop]
fun n : ℕ => (⌊c ^ n⌋₊ : ℝ) :=
by
filter_upwards [strong_law_aux2 X hint hindep hident hnonneg c_one] with ω hω
@@ -645,10 +645,10 @@ almost surely coincide at all but finitely many steps. This follows from a proba
and Borel-Cantelli. -/
theorem strong_law_aux5 :
∀ᵐ ω,
- (fun n : ℕ => (∑ i in range n, truncation (X i) i ω) - ∑ i in range n, X i ω) =o[atTop]
+ (fun n : ℕ => ∑ i in range n, truncation (X i) i ω - ∑ i in range n, X i ω) =o[atTop]
fun n : ℕ => (n : ℝ) :=
by
- have A : (∑' j : ℕ, ℙ {ω | X j ω ∈ Set.Ioi (j : ℝ)}) < ∞ :=
+ have A : ∑' j : ℕ, ℙ {ω | X j ω ∈ Set.Ioi (j : ℝ)} < ∞ :=
by
convert tsum_prob_mem_Ioi_lt_top hint (hnonneg 0)
ext1 j
@@ -688,7 +688,7 @@ theorem strong_law_aux6 {c : ℝ} (c_one : 1 < c) :
strong_law_aux5 X hint hident hnonneg] with ω hω h'ω
rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ]
have L :
- (fun n : ℕ => (∑ i in range ⌊c ^ n⌋₊, X i ω) - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[at_top] fun n =>
+ (fun n : ℕ => ∑ i in range ⌊c ^ n⌋₊, X i ω - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[at_top] fun n =>
(⌊c ^ n⌋₊ : ℝ) :=
by
have A : tendsto (fun n : ℕ => ⌊c ^ n⌋₊) at_top at_top :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -199,7 +199,6 @@ theorem integral_truncation_le_integral_of_nonneg (hf : Integrable f μ) (h'f :
truncation f A x ≤ |truncation f A x| := le_abs_self _
_ ≤ |f x| := (abs_truncation_le_abs_self _ _ _)
_ = f x := abs_of_nonneg (h'f x)
-
#align probability_theory.integral_truncation_le_integral_of_nonneg ProbabilityTheory.integral_truncation_le_integral_of_nonneg
/-- If a function is integrable, then the integral of its truncated versions converges to the
@@ -304,7 +303,6 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
Algebra.id.smul_eq_mul, mul_one]
rw [← ENNReal.one_toReal]
exact ENNReal.toReal_mono ENNReal.one_ne_top prob_le_one
-
have B : ∀ a b, ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ x in Set.Ioc a b, (1 : ℝ) ∂ρ) :=
by
intro a b
@@ -326,7 +324,6 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
refine' sum_congr rfl fun j hj => _
rw [intervalIntegral.integral_of_le (Nat.cast_le.2 ((mem_range.1 hj).le.trans hKN))]
_ ≤ ENNReal.ofReal (𝔼[X] + 1) := ENNReal.ofReal_le_ofReal A
-
#align probability_theory.sum_prob_mem_Ioc_le ProbabilityTheory.sum_prob_mem_Ioc_le
theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) :
@@ -425,7 +422,6 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
linarith only [show (0 : ℝ) ≤ k from Nat.cast_nonneg k])
(mul_nonneg zero_le_two ((Nat.cast_nonneg k).trans hx.1.le)))
_ = 2 * x := by rw [one_mul]
-
_ = 2 * ∫ x in (0 : ℝ)..K, x ∂ρ :=
by
rw [intervalIntegral.sum_integral_adjacent_intervals fun k hk => _]
@@ -438,7 +434,6 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
rw [← integral_truncation_eq_interval_integral_of_nonneg hint.1 hnonneg]
exact integral_truncation_le_integral_of_nonneg hint hnonneg)
zero_le_two
-
#align probability_theory.sum_variance_truncation_le ProbabilityTheory.sum_variance_truncation_le
end MomentEstimates
@@ -494,7 +489,6 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
rw [(hident j).truncation.variance_eq]
exact variance_le_expectation_sq (hX 0).truncation
_ ≤ 2 * 𝔼[X 0] := sum_variance_truncation_le hint (hnonneg 0) K
-
let C := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * 𝔼[X 0])
have I2 : ∀ N, (∑ i in range N, ((u i : ℝ) ^ 2)⁻¹ * Var[S (u i)]) ≤ C :=
by
@@ -545,7 +539,6 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
apply mul_le_mul_of_nonneg_left (I1 _)
apply mul_nonneg (pow_nonneg c_pos.le _)
exact pow_nonneg (inv_nonneg.2 (sub_nonneg.2 c_one.le)) _
-
have I3 :
∀ N,
(∑ i in range N, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) ≤
@@ -577,7 +570,6 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
simp_rw [inv_pow]
exact I2 N
-
have I4 : (∑' i, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) < ∞ :=
(le_of_tendsto_of_tendsto' (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
ENNReal.ofReal_lt_top
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -130,12 +130,12 @@ theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) :
Set.indicator_apply_nonneg fun _ => h
#align probability_theory.truncation_nonneg ProbabilityTheory.truncation_nonneg
-theorem MeasureTheory.AEStronglyMeasurable.memℒp_truncation [FiniteMeasure μ]
+theorem MeasureTheory.AEStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
Memℒp.of_bound hf.truncation (|A|) (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation
-theorem MeasureTheory.AEStronglyMeasurable.integrable_truncation [FiniteMeasure μ]
+theorem MeasureTheory.AEStronglyMeasurable.integrable_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ := by
rw [← mem_ℒp_one_iff_integrable]; exact hf.mem_ℒp_truncation
#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AEStronglyMeasurable.integrable_truncation
@@ -170,7 +170,7 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
apply integral_eq_zero_of_ae
have : ∀ᵐ x ∂measure.map f μ, (0 : ℝ) ≤ x :=
(ae_map_iff hf.ae_measurable measurableSet_Ici).2 (eventually_of_forall h'f)
- filter_upwards [this]with x hx
+ filter_upwards [this] with x hx
simp only [indicator, Set.mem_Ioc, Pi.zero_apply, ite_eq_right_iff, and_imp]
intro h'x h''x
have : x = 0 := by linarith
@@ -216,7 +216,7 @@ theorem tendsto_integral_truncation {f : α → ℝ} (hf : Integrable f μ) :
· apply hf.abs
· apply eventually_of_forall fun x => _
apply tendsto_const_nhds.congr' _
- filter_upwards [Ioi_mem_at_top (abs (f x))]with A hA
+ filter_upwards [Ioi_mem_at_top (abs (f x))] with A hA
exact (truncation_eq_self hA).symm
#align probability_theory.tendsto_integral_truncation ProbabilityTheory.tendsto_integral_truncation
@@ -230,13 +230,12 @@ end Truncation
section StrongLawAe
-variable {Ω : Type _} [MeasureSpace Ω] [ProbabilityMeasure (ℙ : Measure Ω)]
+variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
section MomentEstimates
theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) {K : ℕ} {N : ℕ}
- (hKN : K ≤ N) :
- (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioc (j : ℝ) N }) ≤ ENNReal.ofReal (𝔼[X] + 1) :=
+ (hKN : K ≤ N) : (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N}) ≤ ENNReal.ofReal (𝔼[X] + 1) :=
by
let ρ : Measure ℝ := measure.map X ℙ
haveI : is_probability_measure ρ := is_probability_measure_map hint.ae_measurable
@@ -306,14 +305,14 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
rw [← ENNReal.one_toReal]
exact ENNReal.toReal_mono ENNReal.one_ne_top prob_le_one
- have B : ∀ a b, ℙ { ω | X ω ∈ Set.Ioc a b } = ENNReal.ofReal (∫ x in Set.Ioc a b, (1 : ℝ) ∂ρ) :=
+ have B : ∀ a b, ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ x in Set.Ioc a b, (1 : ℝ) ∂ρ) :=
by
intro a b
rw [of_real_set_integral_one ρ _,
measure.map_apply_of_ae_measurable hint.ae_measurable measurableSet_Ioc]
rfl
calc
- (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioc (j : ℝ) N }) =
+ (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N}) =
∑ j in range K, ENNReal.ofReal (∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
by simp_rw [B]
_ = ENNReal.ofReal (∑ j in range K, ∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
@@ -331,20 +330,20 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
#align probability_theory.sum_prob_mem_Ioc_le ProbabilityTheory.sum_prob_mem_Ioc_le
theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) :
- (∑' j : ℕ, ℙ { ω | X ω ∈ Set.Ioi (j : ℝ) }) < ∞ :=
+ (∑' j : ℕ, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)}) < ∞ :=
by
- suffices : ∀ K : ℕ, (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioi (j : ℝ) }) ≤ ENNReal.ofReal (𝔼[X] + 1)
+ suffices : ∀ K : ℕ, (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)}) ≤ ENNReal.ofReal (𝔼[X] + 1)
exact
(le_of_tendsto_of_tendsto (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds
(eventually_of_forall this)).trans_lt
ENNReal.ofReal_lt_top
intro K
have A :
- tendsto (fun N : ℕ => ∑ j in range K, ℙ { ω | X ω ∈ Set.Ioc (j : ℝ) N }) at_top
- (𝓝 (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioi (j : ℝ) })) :=
+ tendsto (fun N : ℕ => ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N}) at_top
+ (𝓝 (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)})) :=
by
refine' tendsto_finset_sum _ fun i hi => _
- have : { ω | X ω ∈ Set.Ioi (i : ℝ) } = ⋃ N : ℕ, { ω | X ω ∈ Set.Ioc (i : ℝ) N } :=
+ have : {ω | X ω ∈ Set.Ioi (i : ℝ)} = ⋃ N : ℕ, {ω | X ω ∈ Set.Ioc (i : ℝ) N} :=
by
apply Set.Subset.antisymm _ _
· intro ω hω
@@ -358,7 +357,7 @@ theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg
intro m n hmn x hx
exact ⟨hx.1, hx.2.trans (Nat.cast_le.2 hmn)⟩
apply le_of_tendsto_of_tendsto A tendsto_const_nhds
- filter_upwards [Ici_mem_at_top K]with N hN
+ filter_upwards [Ici_mem_at_top K] with N hN
exact sum_prob_mem_Ioc_le hint hnonneg hN
#align probability_theory.tsum_prob_mem_Ioi_lt_top ProbabilityTheory.tsum_prob_mem_Ioi_lt_top
@@ -449,7 +448,7 @@ section StrongLawNonneg
/- This paragraph proves the strong law of large numbers (almost sure version, assuming only
pairwise independence) for nonnegative random variables, following Etemadi's proof. -/
variable (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
- (hindep : Pairwise fun i j => IndepFunCat (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0))
+ (hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0))
(hnonneg : ∀ i ω, 0 ≤ X i ω)
include X hint hindep hident hnonneg
@@ -549,12 +548,12 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
have I3 :
∀ N,
- (∑ i in range N, ℙ { ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]| }) ≤
+ (∑ i in range N, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) ≤
ENNReal.ofReal (ε⁻¹ ^ 2 * C) :=
by
intro N
calc
- (∑ i in range N, ℙ { ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]| }) ≤
+ (∑ i in range N, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) ≤
∑ i in range N, ENNReal.ofReal (Var[S (u i)] / (u i * ε) ^ 2) :=
by
refine' sum_le_sum fun i hi => _
@@ -579,10 +578,10 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
simp_rw [inv_pow]
exact I2 N
- have I4 : (∑' i, ℙ { ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]| }) < ∞ :=
+ have I4 : (∑' i, ℙ {ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]|}) < ∞ :=
(le_of_tendsto_of_tendsto' (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
ENNReal.ofReal_lt_top
- filter_upwards [ae_eventually_not_mem I4.ne]with ω hω
+ filter_upwards [ae_eventually_not_mem I4.ne] with ω hω
simp_rw [not_le, mul_comm, S, sum_apply] at hω
exact hω
#align probability_theory.strong_law_aux1 ProbabilityTheory.strong_law_aux1
@@ -601,10 +600,10 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
∃ v : ℕ → ℝ, StrictAnti v ∧ (∀ n : ℕ, 0 < v n) ∧ tendsto v at_top (𝓝 0) :=
exists_seq_strictAnti_tendsto (0 : ℝ)
have := fun i => strong_law_aux1 X hint hindep hident hnonneg c_one (v_pos i)
- filter_upwards [ae_all_iff.2 this]with ω hω
+ filter_upwards [ae_all_iff.2 this] with ω hω
apply Asymptotics.isLittleO_iff.2 fun ε εpos => _
obtain ⟨i, hi⟩ : ∃ i, v i < ε := ((tendsto_order.1 v_lim).2 ε εpos).exists
- filter_upwards [hω i]with n hn
+ filter_upwards [hω i] with n hn
simp only [Real.norm_eq_abs, LatticeOrderedCommGroup.abs_abs, Nat.abs_cast]
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
#align probability_theory.strong_law_aux2 ProbabilityTheory.strong_law_aux2
@@ -618,7 +617,7 @@ theorem strong_law_aux3 :
by
have A : tendsto (fun i => 𝔼[truncation (X i) i]) at_top (𝓝 𝔼[X 0]) :=
by
- convert(tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop
+ convert (tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop
ext i
exact (hident i).truncation.integral_eq
convert Asymptotics.isLittleO_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 A)
@@ -639,7 +638,7 @@ theorem strong_law_aux4 {c : ℝ} (c_one : 1 < c) :
(fun n : ℕ => (∑ i in range ⌊c ^ n⌋₊, truncation (X i) i ω) - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[atTop]
fun n : ℕ => (⌊c ^ n⌋₊ : ℝ) :=
by
- filter_upwards [strong_law_aux2 X hint hindep hident hnonneg c_one]with ω hω
+ filter_upwards [strong_law_aux2 X hint hindep hident hnonneg c_one] with ω hω
have A : tendsto (fun n : ℕ => ⌊c ^ n⌋₊) at_top at_top :=
tendsto_nat_floor_at_top.comp (tendsto_pow_atTop_atTop_of_one_lt c_one)
convert hω.add ((strong_law_aux3 X hint hident).comp_tendsto A)
@@ -657,16 +656,16 @@ theorem strong_law_aux5 :
(fun n : ℕ => (∑ i in range n, truncation (X i) i ω) - ∑ i in range n, X i ω) =o[atTop]
fun n : ℕ => (n : ℝ) :=
by
- have A : (∑' j : ℕ, ℙ { ω | X j ω ∈ Set.Ioi (j : ℝ) }) < ∞ :=
+ have A : (∑' j : ℕ, ℙ {ω | X j ω ∈ Set.Ioi (j : ℝ)}) < ∞ :=
by
convert tsum_prob_mem_Ioi_lt_top hint (hnonneg 0)
ext1 j
exact (hident j).measure_mem_eq measurableSet_Ioi
have B : ∀ᵐ ω, tendsto (fun n : ℕ => truncation (X n) n ω - X n ω) at_top (𝓝 0) :=
by
- filter_upwards [ae_eventually_not_mem A.ne]with ω hω
+ filter_upwards [ae_eventually_not_mem A.ne] with ω hω
apply tendsto_const_nhds.congr' _
- filter_upwards [hω, Ioi_mem_at_top 0]with n hn npos
+ filter_upwards [hω, Ioi_mem_at_top 0] with n hn npos
simp only [truncation, indicator, Set.mem_Ioc, id.def, Function.comp_apply]
split_ifs
· exact (sub_self _).symm
@@ -675,7 +674,7 @@ theorem strong_law_aux5 :
simpa only [Right.neg_neg_iff, Nat.cast_pos] using npos
simp only [this, true_and_iff, not_le] at h
exact (hn h).elim
- filter_upwards [B]with ω hω
+ filter_upwards [B] with ω hω
convert is_o_sum_range_of_tendsto_zero hω
ext n
rw [sum_sub_distrib]
@@ -694,7 +693,7 @@ theorem strong_law_aux6 {c : ℝ} (c_one : 1 < c) :
refine' zero_lt_one.trans_le _
simp only [Nat.one_le_cast, Nat.one_le_floor_iff, one_le_pow_of_one_le c_one.le n]
filter_upwards [strong_law_aux4 X hint hindep hident hnonneg c_one,
- strong_law_aux5 X hint hident hnonneg]with ω hω h'ω
+ strong_law_aux5 X hint hident hnonneg] with ω hω h'ω
rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ]
have L :
(fun n : ℕ => (∑ i in range ⌊c ^ n⌋₊, X i ω) - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[at_top] fun n =>
@@ -725,7 +724,7 @@ theorem strong_law_aux7 :
∀ᵐ ω,
tendsto (fun n : ℕ => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ⌊c k ^ n⌋₊) at_top (𝓝 𝔼[X 0]) :=
fun k => strong_law_aux6 X hint hindep hident hnonneg (cone k)
- filter_upwards [ae_all_iff.2 this]with ω hω
+ filter_upwards [ae_all_iff.2 this] with ω hω
apply tendsto_div_of_monotone_of_tendsto_div_floor_pow _ _ _ c cone clim _
· intro m n hmn
exact sum_le_sum_of_subset_of_nonneg (range_mono hmn) fun i hi h'i => hnonneg i ω
@@ -739,8 +738,7 @@ identically distributed integrable real-valued random variables, then `∑ i in
converges almost surely to `𝔼[X 0]`. We give here the strong version, due to Etemadi, that only
requires pairwise independence. -/
theorem strong_law_ae (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
- (hindep : Pairwise fun i j => IndepFunCat (X i) (X j))
- (hident : ∀ i, IdentDistrib (X i) (X 0)) :
+ (hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
∀ᵐ ω, Tendsto (fun n : ℕ => (∑ i in range n, X i ω) / n) atTop (𝓝 𝔼[X 0]) :=
by
let pos : ℝ → ℝ := fun x => max x 0
@@ -755,7 +753,7 @@ theorem strong_law_ae (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
∀ᵐ ω, tendsto (fun n : ℕ => (∑ i in range n, (neg ∘ X i) ω) / n) at_top (𝓝 𝔼[neg ∘ X 0]) :=
strong_law_aux7 _ hint.neg_part (fun i j hij => (hindep hij).comp negm negm)
(fun i => (hident i).comp negm) fun i ω => le_max_right _ _
- filter_upwards [A, B]with ω hωpos hωneg
+ filter_upwards [A, B] with ω hωpos hωneg
convert hωpos.sub hωneg
· simp only [← sub_div, ← sum_sub_distrib, max_zero_sub_max_neg_zero_eq_self]
· simp only [← integral_sub hint.pos_part hint.neg_part, max_zero_sub_max_neg_zero_eq_self]
@@ -765,14 +763,13 @@ end StrongLawAe
section StrongLawLp
-variable {Ω : Type _} [MeasureSpace Ω] [ProbabilityMeasure (ℙ : Measure Ω)]
+variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
/-- *Strong law of large numbers*, Lᵖ version: if `X n` is a sequence of independent
identically distributed real-valued random variables in Lᵖ, then `∑ i in range n, X i / n`
converges in Lᵖ to `𝔼[X 0]`. -/
theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ → Ω → ℝ) (hℒp : Memℒp (X 0) p)
- (hindep : Pairwise fun i j => IndepFunCat (X i) (X j))
- (hident : ∀ i, IdentDistrib (X i) (X 0)) :
+ (hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
Tendsto (fun n => snorm (fun ω => (∑ i in range n, X i ω) / n - 𝔼[X 0]) p ℙ) atTop (𝓝 0) :=
by
have hmeas : ∀ i, ae_strongly_measurable (X i) ℙ := fun i =>
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -253,13 +253,13 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
by
simp_rw [sum_sigma']
refine'
- sum_bij' (fun (p : Σi : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σi : ℕ, ℕ)) _ (fun a ha => rfl)
- (fun (p : Σi : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σi : ℕ, ℕ)) _ _ _
+ sum_bij' (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ (fun a ha => rfl)
+ (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ _ _
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_Ico] at hij
+ simp only [mem_sigma, mem_range, mem_Ico] at hij
simp only [hij, Nat.lt_succ_iff.2 hij.2.1, mem_sigma, mem_range, lt_min_iff, and_self_iff]
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, lt_min_iff] at hij
+ simp only [mem_sigma, mem_range, lt_min_iff] at hij
simp only [hij, Nat.lt_succ_iff.1 hij.2.1, mem_sigma, mem_range, mem_Ico, and_self_iff]
· rintro ⟨i, j⟩ hij; rfl
· rintro ⟨i, j⟩ hij; rfl
@@ -282,7 +282,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
· exact (continuous_id.add continuous_const).integrableOn_Ioc
· exact measurableSet_Ioc
· intro x hx
- simp only [Nat.cast_add, Nat.cast_one, Set.mem_Ioc] at hx
+ simp only [Nat.cast_add, Nat.cast_one, Set.mem_Ioc] at hx
simp [hx.1.le]
_ = ∫ x in 0 ..N, x + 1 ∂ρ :=
by
@@ -388,13 +388,13 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
by
simp_rw [mul_sum, sum_mul, sum_sigma']
refine'
- sum_bij' (fun (p : Σi : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σi : ℕ, ℕ)) _ (fun a ha => rfl)
- (fun (p : Σi : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σi : ℕ, ℕ)) _ _ _
+ sum_bij' (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ (fun a ha => rfl)
+ (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ _ _
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_filter] at hij
+ simp only [mem_sigma, mem_range, mem_filter] at hij
simp [hij, mem_sigma, mem_range, and_self_iff, hij.2.trans hij.1]
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_Ioo] at hij
+ simp only [mem_sigma, mem_range, mem_Ioo] at hij
simp only [hij, mem_sigma, mem_range, and_self_iff]
· rintro ⟨i, j⟩ hij; rfl
· rintro ⟨i, j⟩ hij; rfl
@@ -517,14 +517,14 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
by
simp_rw [mul_sum, sum_mul, sum_sigma']
refine'
- sum_bij' (fun (p : Σi : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σi : ℕ, ℕ)) _ (fun a ha => rfl)
- (fun (p : Σi : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σi : ℕ, ℕ)) _ _ _
+ sum_bij' (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ (fun a ha => rfl)
+ (fun (p : Σ i : ℕ, ℕ) hp => (⟨p.2, p.1⟩ : Σ i : ℕ, ℕ)) _ _ _
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range] at hij
+ simp only [mem_sigma, mem_range] at hij
simp only [hij.1, hij.2, mem_sigma, mem_range, mem_filter, and_true_iff]
exact hij.2.trans_le (u_mono (Nat.le_pred_of_lt hij.1))
· rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_filter] at hij
+ simp only [mem_sigma, mem_range, mem_filter] at hij
simp only [hij.2.1, hij.2.2, mem_sigma, mem_range, and_self_iff]
· rintro ⟨i, j⟩ hij; rfl
· rintro ⟨i, j⟩ hij; rfl
@@ -583,7 +583,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
(le_of_tendsto_of_tendsto' (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
ENNReal.ofReal_lt_top
filter_upwards [ae_eventually_not_mem I4.ne]with ω hω
- simp_rw [not_le, mul_comm, S, sum_apply] at hω
+ simp_rw [not_le, mul_comm, S, sum_apply] at hω
exact hω
#align probability_theory.strong_law_aux1 ProbabilityTheory.strong_law_aux1
@@ -673,7 +673,7 @@ theorem strong_law_aux5 :
· have : -(n : ℝ) < X n ω := by
apply lt_of_lt_of_le _ (hnonneg n ω)
simpa only [Right.neg_neg_iff, Nat.cast_pos] using npos
- simp only [this, true_and_iff, not_le] at h
+ simp only [this, true_and_iff, not_le] at h
exact (hn h).elim
filter_upwards [B]with ω hω
convert is_o_sum_range_of_tendsto_zero hω
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -60,7 +60,7 @@ open MeasureTheory Filter Finset Asymptotics
open Set (indicator)
-open Topology BigOperators MeasureTheory ProbabilityTheory ENNReal NNReal
+open scoped Topology BigOperators MeasureTheory ProbabilityTheory ENNReal NNReal
namespace ProbabilityTheory
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -136,10 +136,8 @@ theorem MeasureTheory.AEStronglyMeasurable.memℒp_truncation [FiniteMeasure μ]
#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation
theorem MeasureTheory.AEStronglyMeasurable.integrable_truncation [FiniteMeasure μ]
- (hf : AEStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ :=
- by
- rw [← mem_ℒp_one_iff_integrable]
- exact hf.mem_ℒp_truncation
+ (hf : AEStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ := by
+ rw [← mem_ℒp_one_iff_integrable]; exact hf.mem_ℒp_truncation
#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AEStronglyMeasurable.integrable_truncation
theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A)
@@ -263,10 +261,8 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
· rintro ⟨i, j⟩ hij
simp only [mem_sigma, mem_range, lt_min_iff] at hij
simp only [hij, Nat.lt_succ_iff.1 hij.2.1, mem_sigma, mem_range, mem_Ico, and_self_iff]
- · rintro ⟨i, j⟩ hij
- rfl
- · rintro ⟨i, j⟩ hij
- rfl
+ · rintro ⟨i, j⟩ hij; rfl
+ · rintro ⟨i, j⟩ hij; rfl
_ ≤ ∑ i in range N, (i + 1) * ∫ x in i..(i + 1 : ℕ), (1 : ℝ) ∂ρ :=
by
apply sum_le_sum fun i hi => _
@@ -400,10 +396,8 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
· rintro ⟨i, j⟩ hij
simp only [mem_sigma, mem_range, mem_Ioo] at hij
simp only [hij, mem_sigma, mem_range, and_self_iff]
- · rintro ⟨i, j⟩ hij
- rfl
- · rintro ⟨i, j⟩ hij
- rfl
+ · rintro ⟨i, j⟩ hij; rfl
+ · rintro ⟨i, j⟩ hij; rfl
_ ≤ ∑ k in range K, 2 / (k + 1) * ∫ x in k..(k + 1 : ℕ), x ^ 2 ∂ρ :=
by
apply sum_le_sum fun k hk => _
@@ -532,10 +526,8 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
· rintro ⟨i, j⟩ hij
simp only [mem_sigma, mem_range, mem_filter] at hij
simp only [hij.2.1, hij.2.2, mem_sigma, mem_range, and_self_iff]
- · rintro ⟨i, j⟩ hij
- rfl
- · rintro ⟨i, j⟩ hij
- rfl
+ · rintro ⟨i, j⟩ hij; rfl
+ · rintro ⟨i, j⟩ hij; rfl
_ ≤ ∑ j in range (u (N - 1)), c ^ 5 * (c - 1)⁻¹ ^ 3 / j ^ 2 * Var[Y j] :=
by
apply sum_le_sum fun j hj => _
@@ -547,10 +539,8 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
convert sum_div_nat_floor_pow_sq_le_div_sq N (Nat.cast_pos.2 hj) c_one
· simp only [Nat.cast_lt]
· simp only [one_div]
- _ = c ^ 5 * (c - 1)⁻¹ ^ 3 * ∑ j in range (u (N - 1)), ((j : ℝ) ^ 2)⁻¹ * Var[Y j] :=
- by
- simp_rw [mul_sum, div_eq_mul_inv]
- ring_nf
+ _ = c ^ 5 * (c - 1)⁻¹ ^ 3 * ∑ j in range (u (N - 1)), ((j : ℝ) ^ 2)⁻¹ * Var[Y j] := by
+ simp_rw [mul_sum, div_eq_mul_inv]; ring_nf
_ ≤ c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * 𝔼[X 0]) :=
by
apply mul_le_mul_of_nonneg_left (I1 _)
mathlib commit https://github.com/leanprover-community/mathlib/commit/75e7fca56381d056096ce5d05e938f63a6567828
@@ -78,12 +78,12 @@ def truncation (f : α → ℝ) (A : ℝ) :=
variable {m : MeasurableSpace α} {μ : Measure α} {f : α → ℝ}
-theorem MeasureTheory.AeStronglyMeasurable.truncation (hf : AeStronglyMeasurable f μ) {A : ℝ} :
- AeStronglyMeasurable (truncation f A) μ :=
+theorem MeasureTheory.AEStronglyMeasurable.truncation (hf : AEStronglyMeasurable f μ) {A : ℝ} :
+ AEStronglyMeasurable (truncation f A) μ :=
by
apply ae_strongly_measurable.comp_ae_measurable _ hf.ae_measurable
- exact (strongly_measurable_id.indicator measurableSet_Ioc).AeStronglyMeasurable
-#align measure_theory.ae_strongly_measurable.truncation MeasureTheory.AeStronglyMeasurable.truncation
+ exact (strongly_measurable_id.indicator measurableSet_Ioc).AEStronglyMeasurable
+#align measure_theory.ae_strongly_measurable.truncation MeasureTheory.AEStronglyMeasurable.truncation
theorem abs_truncation_le_bound (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |A| :=
by
@@ -130,19 +130,19 @@ theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) :
Set.indicator_apply_nonneg fun _ => h
#align probability_theory.truncation_nonneg ProbabilityTheory.truncation_nonneg
-theorem MeasureTheory.AeStronglyMeasurable.memℒp_truncation [FiniteMeasure μ]
- (hf : AeStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
+theorem MeasureTheory.AEStronglyMeasurable.memℒp_truncation [FiniteMeasure μ]
+ (hf : AEStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
Memℒp.of_bound hf.truncation (|A|) (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
-#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AeStronglyMeasurable.memℒp_truncation
+#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation
-theorem MeasureTheory.AeStronglyMeasurable.integrable_truncation [FiniteMeasure μ]
- (hf : AeStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ :=
+theorem MeasureTheory.AEStronglyMeasurable.integrable_truncation [FiniteMeasure μ]
+ (hf : AEStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ :=
by
rw [← mem_ℒp_one_iff_integrable]
exact hf.mem_ℒp_truncation
-#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AeStronglyMeasurable.integrable_truncation
+#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AEStronglyMeasurable.integrable_truncation
-theorem moment_truncation_eq_intervalIntegral (hf : AeStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A)
+theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A)
{n : ℕ} (hn : n ≠ 0) : (∫ x, truncation f A x ^ n ∂μ) = ∫ y in -A..A, y ^ n ∂Measure.map f μ :=
by
have M : MeasurableSet (Set.Ioc (-A) A) := measurableSet_Ioc
@@ -150,10 +150,10 @@ theorem moment_truncation_eq_intervalIntegral (hf : AeStronglyMeasurable f μ) {
rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_le, ← integral_indicator M]
· simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
· linarith
- · exact ((measurable_id.indicator M).pow_const n).AeStronglyMeasurable
+ · exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral ProbabilityTheory.moment_truncation_eq_intervalIntegral
-theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AeStronglyMeasurable f μ) {A : ℝ}
+theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ}
{n : ℕ} (hn : n ≠ 0) (h'f : 0 ≤ f) :
(∫ x, truncation f A x ^ n ∂μ) = ∫ y in 0 ..A, y ^ n ∂Measure.map f μ :=
by
@@ -164,7 +164,7 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AeStronglyMeasurab
rcases le_or_lt 0 A with (hA | hA)
· rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_le hA, ← integral_indicator M]
· simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
- · exact ((measurable_id.indicator M).pow_const n).AeStronglyMeasurable
+ · exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
· rw [← integral_map hf.ae_measurable, intervalIntegral.integral_of_ge hA.le, ←
integral_indicator M']
· simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow' _ hn, Set.indicator_empty, integral_zero,
@@ -177,15 +177,15 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AeStronglyMeasurab
intro h'x h''x
have : x = 0 := by linarith
simp [this, zero_pow' _ hn]
- · exact ((measurable_id.indicator M).pow_const n).AeStronglyMeasurable
+ · exact ((measurable_id.indicator M).pow_const n).AEStronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.moment_truncation_eq_intervalIntegral_of_nonneg
-theorem integral_truncation_eq_intervalIntegral (hf : AeStronglyMeasurable f μ) {A : ℝ}
+theorem integral_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ}
(hA : 0 ≤ A) : (∫ x, truncation f A x ∂μ) = ∫ y in -A..A, y ∂Measure.map f μ := by
simpa using moment_truncation_eq_interval_integral hf hA one_ne_zero
#align probability_theory.integral_truncation_eq_interval_integral ProbabilityTheory.integral_truncation_eq_intervalIntegral
-theorem integral_truncation_eq_intervalIntegral_of_nonneg (hf : AeStronglyMeasurable f μ) {A : ℝ}
+theorem integral_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ}
(h'f : 0 ≤ f) : (∫ x, truncation f A x ∂μ) = ∫ y in 0 ..A, y ∂Measure.map f μ := by
simpa using moment_truncation_eq_interval_integral_of_nonneg hf one_ne_zero h'f
#align probability_theory.integral_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.integral_truncation_eq_intervalIntegral_of_nonneg
@@ -482,7 +482,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
have c_pos : 0 < c := zero_lt_one.trans c_one
let ρ : Measure ℝ := measure.map (X 0) ℙ
have hX : ∀ i, ae_strongly_measurable (X i) ℙ := fun i =>
- (hident i).symm.aeStronglyMeasurable_snd hint.1
+ (hident i).symm.aEStronglyMeasurable_snd hint.1
have A : ∀ i, strongly_measurable (indicator (Set.Ioc (-i : ℝ) i) id) := fun i =>
strongly_measurable_id.indicator measurableSet_Ioc
set Y := fun n : ℕ => truncation (X n) n with hY
@@ -514,7 +514,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
congr 1
rw [hS, indep_fun.variance_sum]
· intro j hj
- exact (hident j).aeStronglyMeasurable_fst.memℒp_truncation
+ exact (hident j).aEStronglyMeasurable_fst.memℒp_truncation
· intro k hk l hl hkl
exact (hindep hkl).comp (A k).Measurable (A l).Measurable
_ =
@@ -571,7 +571,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
apply meas_ge_le_variance_div_sq
·
exact
- mem_ℒp_finset_sum' _ fun j hj => (hident j).aeStronglyMeasurable_fst.memℒp_truncation
+ mem_ℒp_finset_sum' _ fun j hj => (hident j).aEStronglyMeasurable_fst.memℒp_truncation
· apply mul_pos (Nat.cast_pos.2 _) εpos
refine' zero_lt_one.trans_le _
apply Nat.le_floor
@@ -786,7 +786,7 @@ theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ
Tendsto (fun n => snorm (fun ω => (∑ i in range n, X i ω) / n - 𝔼[X 0]) p ℙ) atTop (𝓝 0) :=
by
have hmeas : ∀ i, ae_strongly_measurable (X i) ℙ := fun i =>
- (hident i).aeStronglyMeasurable_iff.2 hℒp.1
+ (hident i).aEStronglyMeasurable_iff.2 hℒp.1
have hint : integrable (X 0) ℙ := hℒp.integrable hp
have havg : ∀ n, ae_strongly_measurable (fun ω => (∑ i in range n, X i ω) / n) ℙ :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/e3fb84046afd187b710170887195d50bada934ee
@@ -353,10 +353,10 @@ theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg
apply Set.Subset.antisymm _ _
· intro ω hω
obtain ⟨N, hN⟩ : ∃ N : ℕ, X ω ≤ N := exists_nat_ge (X ω)
- exact Set.mem_unionᵢ.2 ⟨N, hω, hN⟩
+ exact Set.mem_iUnion.2 ⟨N, hω, hN⟩
·
simp (config := { contextual := true }) only [Set.mem_Ioc, Set.mem_Ioi,
- Set.unionᵢ_subset_iff, Set.setOf_subset_setOf, imp_true_iff]
+ Set.iUnion_subset_iff, Set.setOf_subset_setOf, imp_true_iff]
rw [this]
apply tendsto_measure_Union
intro m n hmn x hx
mathlib commit https://github.com/leanprover-community/mathlib/commit/d4437c68c8d350fc9d4e95e1e174409db35e30d7
@@ -130,12 +130,12 @@ theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) :
Set.indicator_apply_nonneg fun _ => h
#align probability_theory.truncation_nonneg ProbabilityTheory.truncation_nonneg
-theorem MeasureTheory.AeStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ]
+theorem MeasureTheory.AeStronglyMeasurable.memℒp_truncation [FiniteMeasure μ]
(hf : AeStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
Memℒp.of_bound hf.truncation (|A|) (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AeStronglyMeasurable.memℒp_truncation
-theorem MeasureTheory.AeStronglyMeasurable.integrable_truncation [IsFiniteMeasure μ]
+theorem MeasureTheory.AeStronglyMeasurable.integrable_truncation [FiniteMeasure μ]
(hf : AeStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ :=
by
rw [← mem_ℒp_one_iff_integrable]
@@ -232,7 +232,7 @@ end Truncation
section StrongLawAe
-variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
+variable {Ω : Type _} [MeasureSpace Ω] [ProbabilityMeasure (ℙ : Measure Ω)]
section MomentEstimates
@@ -775,7 +775,7 @@ end StrongLawAe
section StrongLawLp
-variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
+variable {Ω : Type _} [MeasureSpace Ω] [ProbabilityMeasure (ℙ : Measure Ω)]
/-- *Strong law of large numbers*, Lᵖ version: if `X n` is a sequence of independent
identically distributed real-valued random variables in Lᵖ, then `∑ i in range n, X i / n`
mathlib commit https://github.com/leanprover-community/mathlib/commit/92c69b77c5a7dc0f7eeddb552508633305157caa
@@ -130,17 +130,17 @@ theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) :
Set.indicator_apply_nonneg fun _ => h
#align probability_theory.truncation_nonneg ProbabilityTheory.truncation_nonneg
-theorem MeasureTheory.AeStronglyMeasurable.memℒpTruncation [IsFiniteMeasure μ]
+theorem MeasureTheory.AeStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ]
(hf : AeStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
- Memℒp.ofBound hf.truncation (|A|) (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
-#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AeStronglyMeasurable.memℒpTruncation
+ Memℒp.of_bound hf.truncation (|A|) (eventually_of_forall fun x => abs_truncation_le_bound _ _ _)
+#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AeStronglyMeasurable.memℒp_truncation
-theorem MeasureTheory.AeStronglyMeasurable.integrableTruncation [IsFiniteMeasure μ]
+theorem MeasureTheory.AeStronglyMeasurable.integrable_truncation [IsFiniteMeasure μ]
(hf : AeStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ :=
by
rw [← mem_ℒp_one_iff_integrable]
exact hf.mem_ℒp_truncation
-#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AeStronglyMeasurable.integrableTruncation
+#align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AeStronglyMeasurable.integrable_truncation
theorem moment_truncation_eq_intervalIntegral (hf : AeStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A)
{n : ℕ} (hn : n ≠ 0) : (∫ x, truncation f A x ^ n ∂μ) = ∫ y in -A..A, y ^ n ∂Measure.map f μ :=
@@ -283,7 +283,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
simp_rw [intervalIntegral.integral_of_le I, ← integral_mul_left]
apply set_integral_mono_on
· exact continuous_const.integrable_on_Ioc
- · exact (continuous_id.add continuous_const).integrableOnIoc
+ · exact (continuous_id.add continuous_const).integrableOn_Ioc
· exact measurableSet_Ioc
· intro x hx
simp only [Nat.cast_add, Nat.cast_one, Set.mem_Ioc] at hx
@@ -417,9 +417,9 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
rw [← intervalIntegral.integral_const_mul, intervalIntegral.integral_of_le Ik,
intervalIntegral.integral_of_le Ik]
refine' set_integral_mono_on _ _ measurableSet_Ioc fun x hx => _
- · apply Continuous.integrableOnIoc
+ · apply Continuous.integrableOn_Ioc
exact continuous_const.mul (continuous_pow 2)
- · apply Continuous.integrableOnIoc
+ · apply Continuous.integrableOn_Ioc
exact continuous_const.mul continuous_id'
·
calc
@@ -482,7 +482,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
have c_pos : 0 < c := zero_lt_one.trans c_one
let ρ : Measure ℝ := measure.map (X 0) ℙ
have hX : ∀ i, ae_strongly_measurable (X i) ℙ := fun i =>
- (hident i).symm.aeStronglyMeasurableSnd hint.1
+ (hident i).symm.aeStronglyMeasurable_snd hint.1
have A : ∀ i, strongly_measurable (indicator (Set.Ioc (-i : ℝ) i) id) := fun i =>
strongly_measurable_id.indicator measurableSet_Ioc
set Y := fun n : ℕ => truncation (X n) n with hY
@@ -514,7 +514,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
congr 1
rw [hS, indep_fun.variance_sum]
· intro j hj
- exact (hident j).aeStronglyMeasurableFst.memℒpTruncation
+ exact (hident j).aeStronglyMeasurable_fst.memℒp_truncation
· intro k hk l hl hkl
exact (hindep hkl).comp (A k).Measurable (A l).Measurable
_ =
@@ -569,7 +569,9 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
by
refine' sum_le_sum fun i hi => _
apply meas_ge_le_variance_div_sq
- · exact mem_ℒp_finset_sum' _ fun j hj => (hident j).aeStronglyMeasurableFst.memℒpTruncation
+ ·
+ exact
+ mem_ℒp_finset_sum' _ fun j hj => (hident j).aeStronglyMeasurable_fst.memℒp_truncation
· apply mul_pos (Nat.cast_pos.2 _) εpos
refine' zero_lt_one.trans_le _
apply Nat.le_floor
@@ -633,7 +635,7 @@ theorem strong_law_aux3 :
ext1 n
simp only [sum_sub_distrib, sum_const, card_range, nsmul_eq_mul, sum_apply, sub_left_inj]
rw [integral_finset_sum _ fun i hi => _]
- exact ((hident i).symm.integrableSnd hint).1.integrableTruncation
+ exact ((hident i).symm.integrable_snd hint).1.integrable_truncation
#align probability_theory.strong_law_aux3 ProbabilityTheory.strong_law_aux3
include hindep hnonneg
mathlib commit https://github.com/leanprover-community/mathlib/commit/039ef89bef6e58b32b62898dd48e9d1a4312bb65
@@ -610,7 +610,7 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
exists_seq_strictAnti_tendsto (0 : ℝ)
have := fun i => strong_law_aux1 X hint hindep hident hnonneg c_one (v_pos i)
filter_upwards [ae_all_iff.2 this]with ω hω
- apply Asymptotics.isOCat_iff.2 fun ε εpos => _
+ apply Asymptotics.isLittleO_iff.2 fun ε εpos => _
obtain ⟨i, hi⟩ : ∃ i, v i < ε := ((tendsto_order.1 v_lim).2 ε εpos).exists
filter_upwards [hω i]with n hn
simp only [Real.norm_eq_abs, LatticeOrderedCommGroup.abs_abs, Nat.abs_cast]
@@ -629,7 +629,7 @@ theorem strong_law_aux3 :
convert(tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop
ext i
exact (hident i).truncation.integral_eq
- convert Asymptotics.isOCat_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 A)
+ convert Asymptotics.isLittleO_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 A)
ext1 n
simp only [sum_sub_distrib, sum_const, card_range, nsmul_eq_mul, sum_apply, sub_left_inj]
rw [integral_finset_sum _ fun i hi => _]
@@ -703,7 +703,7 @@ theorem strong_law_aux6 {c : ℝ} (c_one : 1 < c) :
simp only [Nat.one_le_cast, Nat.one_le_floor_iff, one_le_pow_of_one_le c_one.le n]
filter_upwards [strong_law_aux4 X hint hindep hident hnonneg c_one,
strong_law_aux5 X hint hident hnonneg]with ω hω h'ω
- rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isOCat_one_iff ℝ]
+ rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ]
have L :
(fun n : ℕ => (∑ i in range ⌊c ^ n⌋₊, X i ω) - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[at_top] fun n =>
(⌊c ^ n⌋₊ : ℝ) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce7e9d53d4bbc38065db3b595cd5bd73c323bc1d
@@ -626,7 +626,7 @@ theorem strong_law_aux3 :
by
have A : tendsto (fun i => 𝔼[truncation (X i) i]) at_top (𝓝 𝔼[X 0]) :=
by
- convert (tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop
+ convert(tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop
ext i
exact (hident i).truncation.integral_eq
convert Asymptotics.isOCat_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 A)
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -541,8 +541,8 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
apply sum_le_sum fun j hj => _
rcases@eq_zero_or_pos _ _ j with (rfl | hj)
· simp only [Y, Nat.cast_zero, zero_pow', Ne.def, bit0_eq_zero, Nat.one_ne_zero,
- not_false_iff, div_zero, zero_mul]
- simp only [Nat.cast_zero, truncation_zero, variance_zero, mul_zero]
+ not_false_iff, div_zero, MulZeroClass.zero_mul]
+ simp only [Nat.cast_zero, truncation_zero, variance_zero, MulZeroClass.mul_zero]
apply mul_le_mul_of_nonneg_right _ (variance_nonneg _ _)
convert sum_div_nat_floor_pow_sq_le_div_sq N (Nat.cast_pos.2 hj) c_one
· simp only [Nat.cast_lt]
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -199,7 +199,7 @@ theorem integral_truncation_le_integral_of_nonneg (hf : Integrable f μ) (h'f :
·
calc
truncation f A x ≤ |truncation f A x| := le_abs_self _
- _ ≤ |f x| := abs_truncation_le_abs_self _ _ _
+ _ ≤ |f x| := (abs_truncation_le_abs_self _ _ _)
_ = f x := abs_of_nonneg (h'f x)
#align probability_theory.integral_truncation_le_integral_of_nonneg ProbabilityTheory.integral_truncation_le_integral_of_nonneg
@@ -301,7 +301,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
_ = 𝔼[truncation X N] + ∫ x in 0 ..N, 1 ∂ρ := by
rw [integral_truncation_eq_interval_integral_of_nonneg hint.1 hnonneg]
_ ≤ 𝔼[X] + ∫ x in 0 ..N, 1 ∂ρ :=
- add_le_add_right (integral_truncation_le_integral_of_nonneg hint hnonneg) _
+ (add_le_add_right (integral_truncation_le_integral_of_nonneg hint hnonneg) _)
_ ≤ 𝔼[X] + 1 := by
refine' add_le_add le_rfl _
rw [intervalIntegral.integral_of_le (Nat.cast_nonneg _)]
@@ -425,12 +425,12 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
calc
2 / (↑k + 1) * x ^ 2 = x / (k + 1) * (2 * x) := by ring
_ ≤ 1 * (2 * x) :=
- mul_le_mul_of_nonneg_right
+ (mul_le_mul_of_nonneg_right
(by
apply_mod_cast (div_le_one _).2 hx.2
simp only [Nat.cast_add, Nat.cast_one]
linarith only [show (0 : ℝ) ≤ k from Nat.cast_nonneg k])
- (mul_nonneg zero_le_two ((Nat.cast_nonneg k).trans hx.1.le))
+ (mul_nonneg zero_le_two ((Nat.cast_nonneg k).trans hx.1.le)))
_ = 2 * x := by rw [one_mul]
_ = 2 * ∫ x in (0 : ℝ)..K, x ∂ρ :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/eb0cb4511aaef0da2462207b67358a0e1fe1e2ee
@@ -60,7 +60,7 @@ open MeasureTheory Filter Finset Asymptotics
open Set (indicator)
-open Topology BigOperators MeasureTheory ProbabilityTheory Ennreal NNReal
+open Topology BigOperators MeasureTheory ProbabilityTheory ENNReal NNReal
namespace ProbabilityTheory
@@ -238,7 +238,7 @@ section MomentEstimates
theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) {K : ℕ} {N : ℕ}
(hKN : K ≤ N) :
- (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioc (j : ℝ) N }) ≤ Ennreal.ofReal (𝔼[X] + 1) :=
+ (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioc (j : ℝ) N }) ≤ ENNReal.ofReal (𝔼[X] + 1) :=
by
let ρ : Measure ℝ := measure.map X ℙ
haveI : is_probability_measure ρ := is_probability_measure_map hint.ae_measurable
@@ -307,10 +307,10 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
rw [intervalIntegral.integral_of_le (Nat.cast_nonneg _)]
simp only [integral_const, measure.restrict_apply', measurableSet_Ioc, Set.univ_inter,
Algebra.id.smul_eq_mul, mul_one]
- rw [← Ennreal.one_toReal]
- exact Ennreal.toReal_mono Ennreal.one_ne_top prob_le_one
+ rw [← ENNReal.one_toReal]
+ exact ENNReal.toReal_mono ENNReal.one_ne_top prob_le_one
- have B : ∀ a b, ℙ { ω | X ω ∈ Set.Ioc a b } = Ennreal.ofReal (∫ x in Set.Ioc a b, (1 : ℝ) ∂ρ) :=
+ have B : ∀ a b, ℙ { ω | X ω ∈ Set.Ioc a b } = ENNReal.ofReal (∫ x in Set.Ioc a b, (1 : ℝ) ∂ρ) :=
by
intro a b
rw [of_real_set_integral_one ρ _,
@@ -318,30 +318,30 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
rfl
calc
(∑ j in range K, ℙ { ω | X ω ∈ Set.Ioc (j : ℝ) N }) =
- ∑ j in range K, Ennreal.ofReal (∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
+ ∑ j in range K, ENNReal.ofReal (∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
by simp_rw [B]
- _ = Ennreal.ofReal (∑ j in range K, ∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
+ _ = ENNReal.ofReal (∑ j in range K, ∫ x in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
by
- rw [Ennreal.ofReal_sum_of_nonneg]
- simp only [integral_const, Algebra.id.smul_eq_mul, mul_one, Ennreal.toReal_nonneg,
+ rw [ENNReal.ofReal_sum_of_nonneg]
+ simp only [integral_const, Algebra.id.smul_eq_mul, mul_one, ENNReal.toReal_nonneg,
imp_true_iff]
- _ = Ennreal.ofReal (∑ j in range K, ∫ x in (j : ℝ)..N, (1 : ℝ) ∂ρ) :=
+ _ = ENNReal.ofReal (∑ j in range K, ∫ x in (j : ℝ)..N, (1 : ℝ) ∂ρ) :=
by
congr 1
refine' sum_congr rfl fun j hj => _
rw [intervalIntegral.integral_of_le (Nat.cast_le.2 ((mem_range.1 hj).le.trans hKN))]
- _ ≤ Ennreal.ofReal (𝔼[X] + 1) := Ennreal.ofReal_le_ofReal A
+ _ ≤ ENNReal.ofReal (𝔼[X] + 1) := ENNReal.ofReal_le_ofReal A
#align probability_theory.sum_prob_mem_Ioc_le ProbabilityTheory.sum_prob_mem_Ioc_le
theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) :
(∑' j : ℕ, ℙ { ω | X ω ∈ Set.Ioi (j : ℝ) }) < ∞ :=
by
- suffices : ∀ K : ℕ, (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioi (j : ℝ) }) ≤ Ennreal.ofReal (𝔼[X] + 1)
+ suffices : ∀ K : ℕ, (∑ j in range K, ℙ { ω | X ω ∈ Set.Ioi (j : ℝ) }) ≤ ENNReal.ofReal (𝔼[X] + 1)
exact
- (le_of_tendsto_of_tendsto (Ennreal.tendsto_nat_tsum _) tendsto_const_nhds
+ (le_of_tendsto_of_tendsto (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds
(eventually_of_forall this)).trans_lt
- Ennreal.ofReal_lt_top
+ ENNReal.ofReal_lt_top
intro K
have A :
tendsto (fun N : ℕ => ∑ j in range K, ℙ { ω | X ω ∈ Set.Ioc (j : ℝ) N }) at_top
@@ -560,12 +560,12 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
have I3 :
∀ N,
(∑ i in range N, ℙ { ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]| }) ≤
- Ennreal.ofReal (ε⁻¹ ^ 2 * C) :=
+ ENNReal.ofReal (ε⁻¹ ^ 2 * C) :=
by
intro N
calc
(∑ i in range N, ℙ { ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]| }) ≤
- ∑ i in range N, Ennreal.ofReal (Var[S (u i)] / (u i * ε) ^ 2) :=
+ ∑ i in range N, ENNReal.ofReal (Var[S (u i)] / (u i * ε) ^ 2) :=
by
refine' sum_le_sum fun i hi => _
apply meas_ge_le_variance_div_sq
@@ -575,21 +575,21 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
apply Nat.le_floor
rw [Nat.cast_one]
apply one_le_pow_of_one_le c_one.le
- _ = Ennreal.ofReal (∑ i in range N, Var[S (u i)] / (u i * ε) ^ 2) :=
+ _ = ENNReal.ofReal (∑ i in range N, Var[S (u i)] / (u i * ε) ^ 2) :=
by
- rw [Ennreal.ofReal_sum_of_nonneg fun i hi => _]
+ rw [ENNReal.ofReal_sum_of_nonneg fun i hi => _]
exact div_nonneg (variance_nonneg _ _) (sq_nonneg _)
- _ ≤ Ennreal.ofReal (ε⁻¹ ^ 2 * C) :=
+ _ ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C) :=
by
- apply Ennreal.ofReal_le_ofReal
+ apply ENNReal.ofReal_le_ofReal
simp_rw [div_eq_inv_mul, ← inv_pow, mul_inv, mul_comm _ ε⁻¹, mul_pow, mul_assoc, ← mul_sum]
refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
simp_rw [inv_pow]
exact I2 N
have I4 : (∑' i, ℙ { ω | (u i * ε : ℝ) ≤ |S (u i) ω - 𝔼[S (u i)]| }) < ∞ :=
- (le_of_tendsto_of_tendsto' (Ennreal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
- Ennreal.ofReal_lt_top
+ (le_of_tendsto_of_tendsto' (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
+ ENNReal.ofReal_lt_top
filter_upwards [ae_eventually_not_mem I4.ne]with ω hω
simp_rw [not_le, mul_comm, S, sum_apply] at hω
exact hω
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -367,7 +367,8 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
↑2 / (↑k + ↑1) * x ^ 2 = x / (k + 1) * (2 * x) := by ring
_ ≤ 1 * (2 * x) :=
(mul_le_mul_of_nonneg_right (by
- convert (div_le_one _).2 hx.2; norm_cast
+ convert (div_le_one _).2 hx.2
+ · norm_cast
simp only [Nat.cast_add, Nat.cast_one]
linarith only [show (0 : ℝ) ≤ k from Nat.cast_nonneg k])
(mul_nonneg zero_le_two ((Nat.cast_nonneg k).trans hx.1.le)))
set_integral
with setIntegral
(#12215)
Done with a global search and replace, and then (to fix the #align
lines), replace (#align \S*)setIntegral
with $1set_integral
.
@@ -256,7 +256,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
have I : (i : ℝ) ≤ (i + 1 : ℕ) := by
simp only [Nat.cast_add, Nat.cast_one, le_add_iff_nonneg_right, zero_le_one]
simp_rw [intervalIntegral.integral_of_le I, ← integral_mul_left]
- apply set_integral_mono_on
+ apply setIntegral_mono_on
· exact continuous_const.integrableOn_Ioc
· exact (continuous_id.add continuous_const).integrableOn_Ioc
· exact measurableSet_Ioc
@@ -284,7 +284,7 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
exact ENNReal.toReal_mono ENNReal.one_ne_top prob_le_one
have B : ∀ a b, ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ _ in Set.Ioc a b, (1 : ℝ) ∂ρ) := by
intro a b
- rw [ofReal_set_integral_one ρ _,
+ rw [ofReal_setIntegral_one ρ _,
Measure.map_apply_of_aemeasurable hint.aemeasurable measurableSet_Ioc]
rfl
calc
@@ -358,7 +358,7 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
have Ik : (k : ℝ) ≤ (k + 1 : ℕ) := by simp
rw [← intervalIntegral.integral_const_mul, intervalIntegral.integral_of_le Ik,
intervalIntegral.integral_of_le Ik]
- refine' set_integral_mono_on _ _ measurableSet_Ioc fun x hx => _
+ refine' setIntegral_mono_on _ _ measurableSet_Ioc fun x hx => _
· apply Continuous.integrableOn_Ioc
exact continuous_const.mul (continuous_pow 2)
· apply Continuous.integrableOn_Ioc
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -521,7 +521,7 @@ expectation. This follows from convergence and Cesàro averaging. -/
theorem strong_law_aux3 :
(fun n => 𝔼[∑ i in range n, truncation (X i) i] - n * 𝔼[X 0]) =o[atTop] ((↑) : ℕ → ℝ) := by
have A : Tendsto (fun i => 𝔼[truncation (X i) i]) atTop (𝓝 𝔼[X 0]) := by
- convert (tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop using 1
+ convert (tendsto_integral_truncation hint).comp tendsto_natCast_atTop_atTop using 1
ext i
exact (hident i).truncation.integral_eq
convert Asymptotics.isLittleO_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 A) using 1
These are changes from #11997, the latest adaptation PR for nightly-2024-04-07, which can be made directly on master.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>
@@ -86,7 +86,7 @@ theorem _root_.MeasureTheory.AEStronglyMeasurable.truncation (hf : AEStronglyMea
#align measure_theory.ae_strongly_measurable.truncation MeasureTheory.AEStronglyMeasurable.truncation
theorem abs_truncation_le_bound (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |A| := by
- simp only [truncation, Set.indicator, Set.mem_Icc, id.def, Function.comp_apply]
+ simp only [truncation, Set.indicator, Set.mem_Icc, id, Function.comp_apply]
split_ifs with h
· exact abs_le_abs h.2 (neg_le.2 h.1.le)
· simp [abs_nonneg]
@@ -97,7 +97,7 @@ theorem truncation_zero (f : α → ℝ) : truncation f 0 = 0 := by simp [trunca
#align probability_theory.truncation_zero ProbabilityTheory.truncation_zero
theorem abs_truncation_le_abs_self (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |f x| := by
- simp only [truncation, indicator, Set.mem_Icc, id.def, Function.comp_apply]
+ simp only [truncation, indicator, Set.mem_Icc, id, Function.comp_apply]
split_ifs
· exact le_rfl
· simp [abs_nonneg]
@@ -105,7 +105,7 @@ theorem abs_truncation_le_abs_self (f : α → ℝ) (A : ℝ) (x : α) : |trunca
theorem truncation_eq_self {f : α → ℝ} {A : ℝ} {x : α} (h : |f x| < A) :
truncation f A x = f x := by
- simp only [truncation, indicator, Set.mem_Icc, id.def, Function.comp_apply, ite_eq_left_iff]
+ simp only [truncation, indicator, Set.mem_Icc, id, Function.comp_apply, ite_eq_left_iff]
intro H
apply H.elim
simp [(abs_lt.1 h).1, (abs_lt.1 h).2.le]
@@ -115,12 +115,12 @@ theorem truncation_eq_of_nonneg {f : α → ℝ} {A : ℝ} (h : ∀ x, 0 ≤ f x
truncation f A = indicator (Set.Ioc 0 A) id ∘ f := by
ext x
rcases (h x).lt_or_eq with (hx | hx)
- · simp only [truncation, indicator, hx, Set.mem_Ioc, id.def, Function.comp_apply, true_and_iff]
+ · simp only [truncation, indicator, hx, Set.mem_Ioc, id, Function.comp_apply, true_and_iff]
by_cases h'x : f x ≤ A
· have : -A < f x := by linarith [h x]
simp only [this, true_and_iff]
· simp only [h'x, and_false_iff]
- · simp only [truncation, indicator, hx, id.def, Function.comp_apply, ite_self]
+ · simp only [truncation, indicator, hx, id, Function.comp_apply, ite_self]
#align probability_theory.truncation_eq_of_nonneg ProbabilityTheory.truncation_eq_of_nonneg
theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) : 0 ≤ truncation f A x :=
@@ -143,7 +143,7 @@ theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {
change ∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = _
rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le,
← integral_indicator M]
- · simp only [indicator, zero_pow hn, id.def, ite_pow]
+ · simp only [indicator, zero_pow hn, id, ite_pow]
· linarith
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral ProbabilityTheory.moment_truncation_eq_intervalIntegral
@@ -158,7 +158,7 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
rcases le_or_lt 0 A with (hA | hA)
· rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le hA,
← integral_indicator M]
- · simp only [indicator, zero_pow hn, id.def, ite_pow]
+ · simp only [indicator, zero_pow hn, id, ite_pow]
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
· rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_ge hA.le,
← integral_indicator M']
@@ -450,7 +450,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
_ ≤ ∑ j in range (u (N - 1)), c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * Var[Y j] := by
apply sum_le_sum fun j hj => ?_
rcases @eq_zero_or_pos _ _ j with (rfl | hj)
- · simp only [Nat.cast_zero, zero_pow, Ne.def, bit0_eq_zero, Nat.one_ne_zero,
+ · simp only [Nat.cast_zero, zero_pow, Ne, bit0_eq_zero, Nat.one_ne_zero,
not_false_iff, div_zero, zero_mul]
simp only [Y, Nat.cast_zero, truncation_zero, variance_zero, mul_zero, le_rfl]
apply mul_le_mul_of_nonneg_right _ (variance_nonneg _ _)
@@ -560,7 +560,7 @@ theorem strong_law_aux5 :
filter_upwards [ae_eventually_not_mem A.ne] with ω hω
apply tendsto_const_nhds.congr' _
filter_upwards [hω, Ioi_mem_atTop 0] with n hn npos
- simp only [truncation, indicator, Set.mem_Ioc, id.def, Function.comp_apply]
+ simp only [truncation, indicator, Set.mem_Ioc, id, Function.comp_apply]
split_ifs with h
· exact (sub_self _).symm
· have : -(n : ℝ) < X n ω := by
@@ -192,7 +192,7 @@ theorem integral_truncation_le_integral_of_nonneg (hf : Integrable f μ) (h'f :
· exact truncation_nonneg _ (h'f x)
· calc
truncation f A x ≤ |truncation f A x| := le_abs_self _
- _ ≤ |f x| := (abs_truncation_le_abs_self _ _ _)
+ _ ≤ |f x| := abs_truncation_le_abs_self _ _ _
_ = f x := abs_of_nonneg (h'f x)
#align probability_theory.integral_truncation_le_integral_of_nonneg ProbabilityTheory.integral_truncation_le_integral_of_nonneg
All of these changes appear to be oversights to me.
@@ -384,15 +384,15 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
end MomentEstimates
+/-! Proof of the strong law of large numbers (almost sure version, assuming only
+pairwise independence) for nonnegative random variables, following Etemadi's proof. -/
section StrongLawNonneg
-/- This paragraph proves the strong law of large numbers (almost sure version, assuming only
-pairwise independence) for nonnegative random variables, following Etemadi's proof. -/
variable (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
(hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0))
(hnonneg : ∀ i ω, 0 ≤ X i ω)
-/- The truncation of `Xᵢ` up to `i` satisfies the strong law of large numbers (with respect to
+/-- The truncation of `Xᵢ` up to `i` satisfies the strong law of large numbers (with respect to
the truncated expectation) along the sequence `c^n`, for any `c > 1`, up to a given `ε > 0`.
This follows from a variance control. -/
theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) : ∀ᵐ ω, ∀ᶠ n : ℕ in atTop,
IsROrC
to RCLike
(#10819)
IsROrC
contains data, which goes against the expectation that classes prefixed with Is
are prop-valued. People have been complaining about this on and off, so this PR renames IsROrC
to RCLike
.
@@ -780,7 +780,7 @@ lemma strong_law_ae_of_measurable
norm_add₃_le _ _ _
_ ≤ (∑ i in Finset.range n, ‖X i ω - Y k i ω‖) / n + δ + δ := by
gcongr
- simp only [Function.comp_apply, norm_smul, norm_inv, IsROrC.norm_natCast,
+ simp only [Function.comp_apply, norm_smul, norm_inv, RCLike.norm_natCast,
div_eq_inv_mul, inv_pos, Nat.cast_pos, inv_lt_zero]
gcongr
exact norm_sum_le _ _
filter_upwards
(#11208)
This is presumably not exhaustive, but covers about a hundred instances.
Style opinions (e.g., why a particular change is great/not a good idea) are very welcome; I'm still forming my own.
@@ -201,13 +201,13 @@ integral of the whole function. -/
theorem tendsto_integral_truncation {f : α → ℝ} (hf : Integrable f μ) :
Tendsto (fun A => ∫ x, truncation f A x ∂μ) atTop (𝓝 (∫ x, f x ∂μ)) := by
refine' tendsto_integral_filter_of_dominated_convergence (fun x => abs (f x)) _ _ _ _
- · exact eventually_of_forall fun A => hf.aestronglyMeasurable.truncation
- · apply eventually_of_forall fun A => ?_
- apply eventually_of_forall fun x => ?_
+ · exact eventually_of_forall fun A ↦ hf.aestronglyMeasurable.truncation
+ · filter_upwards with A
+ filter_upwards with x
rw [Real.norm_eq_abs]
exact abs_truncation_le_abs_self _ _ _
- · apply hf.abs
- · apply eventually_of_forall fun x => ?_
+ · exact hf.abs
+ · filter_upwards with x
apply tendsto_const_nhds.congr' _
filter_upwards [Ioi_mem_atTop (abs (f x))] with A hA
exact (truncation_eq_self hA).symm
Suggested by @loefflerd. Only code motion (and cosmetic adaptions, such as minimising import and open statements).
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
import Mathlib.Probability.IdentDistrib
-import Mathlib.MeasureTheory.Integral.IntervalIntegral
+import Mathlib.MeasureTheory.Integral.DominatedConvergence
import Mathlib.Analysis.SpecificLimits.FloorPow
import Mathlib.Analysis.PSeries
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
@@ -452,7 +452,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
rcases @eq_zero_or_pos _ _ j with (rfl | hj)
· simp only [Nat.cast_zero, zero_pow, Ne.def, bit0_eq_zero, Nat.one_ne_zero,
not_false_iff, div_zero, zero_mul]
- simp only [Nat.cast_zero, truncation_zero, variance_zero, mul_zero, le_rfl]
+ simp only [Y, Nat.cast_zero, truncation_zero, variance_zero, mul_zero, le_rfl]
apply mul_le_mul_of_nonneg_right _ (variance_nonneg _ _)
convert sum_div_nat_floor_pow_sq_le_div_sq N (Nat.cast_pos.2 hj) c_one using 2
· simp only [Nat.cast_lt]
@@ -494,7 +494,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
(le_of_tendsto_of_tendsto' (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds I3).trans_lt
ENNReal.ofReal_lt_top
filter_upwards [ae_eventually_not_mem I4.ne] with ω hω
- simp_rw [not_le, mul_comm, sum_apply] at hω
+ simp_rw [S, not_le, mul_comm, sum_apply] at hω
convert hω; simp only [sum_apply]
#align probability_theory.strong_law_aux1 ProbabilityTheory.strong_law_aux1
@@ -638,7 +638,8 @@ theorem strong_law_ae_real (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
(fun i => (hident i).comp negm) fun i ω => le_max_right _ _
filter_upwards [A, B] with ω hωpos hωneg
convert hωpos.sub hωneg using 1
- · simp only [← sub_div, ← sum_sub_distrib, max_zero_sub_max_neg_zero_eq_self, Function.comp_apply]
+ · simp only [pos, neg, ← sub_div, ← sum_sub_distrib, max_zero_sub_max_neg_zero_eq_self,
+ Function.comp_apply]
· simp only [← integral_sub hint.pos_part hint.neg_part, max_zero_sub_max_neg_zero_eq_self,
Function.comp_apply]
#align probability_theory.strong_law_ae ProbabilityTheory.strong_law_ae_real
@@ -689,7 +690,7 @@ lemma strong_law_ae_simpleFunc_comp (X : ℕ → Ω → E) (h' : Measurable (X 0
simp
simp only [I, integral_smul_const]
convert Tendsto.smul_const hω c using 1
- simp [← sum_smul, smul_smul]
+ simp [Y, ← sum_smul, smul_smul]
· rintro φ ψ - hφ hψ
filter_upwards [hφ, hψ] with ω hωφ hωψ
convert hωφ.add hωψ using 1
@@ -714,7 +715,7 @@ lemma strong_law_ae_of_measurable
to the one-dimensional law of large numbers: it converges ae to `𝔼[‖X 0 - φ (X 0)‖]`, which
is arbitrarily small for well chosen `φ`. -/
let s : Set E := Set.range (X 0) ∪ {0}
- have zero_s : 0 ∈ s := by simp
+ have zero_s : 0 ∈ s := by simp [s]
have : SeparableSpace s := h'.separableSpace_range_union_singleton
have : Nonempty s := ⟨0, zero_s⟩
-- sequence of approximating simple functions.
have
, replace
and suffices
(#10640)
No changes to tactic file, it's just boring fixes throughout the library.
This follows on from #6964.
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -303,9 +303,9 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) :
(∑' j : ℕ, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)}) < ∞ := by
- suffices : ∀ K : ℕ, ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)} ≤ ENNReal.ofReal (𝔼[X] + 1)
- exact (le_of_tendsto_of_tendsto (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds
- (eventually_of_forall this)).trans_lt ENNReal.ofReal_lt_top
+ suffices ∀ K : ℕ, ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)} ≤ ENNReal.ofReal (𝔼[X] + 1) from
+ (le_of_tendsto_of_tendsto (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds
+ (eventually_of_forall this)).trans_lt ENNReal.ofReal_lt_top
intro K
have A : Tendsto (fun N : ℕ => ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N}) atTop
(𝓝 (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)})) := by
A variable
declaration made (μ)
an explicit argument, even though it could be deduced from other arguments in almost all cases. The declaration was removed and the change propagated to other files.
@@ -836,7 +836,7 @@ theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ
AEStronglyMeasurable (fun ω => (n : ℝ) ⁻¹ • (∑ i in range n, X i ω)) ℙ := by
intro n
exact AEStronglyMeasurable.const_smul (aestronglyMeasurable_sum _ fun i _ => hmeas i) _
- refine' tendsto_Lp_of_tendstoInMeasure _ hp hp' havg (memℒp_const _) _
+ refine' tendsto_Lp_of_tendstoInMeasure hp hp' havg (memℒp_const _) _
(tendstoInMeasure_of_tendsto_ae havg (strong_law_ae _ hint hindep hident))
rw [(_ : (fun (n : ℕ) ω => (n : ℝ)⁻¹ • (∑ i in range n, X i ω))
= fun (n : ℕ) => (n : ℝ)⁻¹ • (∑ i in range n, X i))]
Function.const
to the Function
namespace (#10220)
They were in the Pi
namespace instead.
@@ -673,7 +673,7 @@ lemma strong_law_ae_simpleFunc_comp (X : ℕ → Ω → E) (h' : Measurable (X 0
let Y : ℕ → Ω → ℝ := fun n ↦ F ∘ (X n)
have : ∀ᵐ (ω : Ω), Tendsto (fun (n : ℕ) ↦ (n : ℝ)⁻¹ • ∑ i in Finset.range n, Y i ω)
atTop (𝓝 𝔼[Y 0]) := by
- simp only [Pi.const_one, smul_eq_mul, ← div_eq_inv_mul]
+ simp only [Function.const_one, smul_eq_mul, ← div_eq_inv_mul]
apply strong_law_ae_real
· exact SimpleFunc.integrable_of_isFiniteMeasure
((SimpleFunc.piecewise s hs (SimpleFunc.const _ (1 : ℝ))
f ^ n
(#9617)
This involves moving lemmas from Algebra.GroupPower.Ring
to Algebra.GroupWithZero.Basic
and changing some 0 < n
assumptions to n ≠ 0
.
From LeanAPAP
@@ -143,7 +143,7 @@ theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {
change ∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = _
rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le,
← integral_indicator M]
- · simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
+ · simp only [indicator, zero_pow hn, id.def, ite_pow]
· linarith
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral ProbabilityTheory.moment_truncation_eq_intervalIntegral
@@ -158,11 +158,11 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
rcases le_or_lt 0 A with (hA | hA)
· rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le hA,
← integral_indicator M]
- · simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
+ · simp only [indicator, zero_pow hn, id.def, ite_pow]
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
· rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_ge hA.le,
← integral_indicator M']
- · simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow' _ hn, Set.indicator_empty, integral_zero,
+ · simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow hn, Set.indicator_empty, integral_zero,
zero_eq_neg]
apply integral_eq_zero_of_ae
have : ∀ᵐ x ∂Measure.map f μ, (0 : ℝ) ≤ x :=
@@ -171,7 +171,7 @@ theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurab
simp only [indicator, Set.mem_Ioc, Pi.zero_apply, ite_eq_right_iff, and_imp]
intro _ h''x
have : x = 0 := by linarith
- simp [this, zero_pow' _ hn]
+ simp [this, zero_pow hn]
· exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
#align probability_theory.moment_truncation_eq_interval_integral_of_nonneg ProbabilityTheory.moment_truncation_eq_intervalIntegral_of_nonneg
@@ -450,7 +450,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
_ ≤ ∑ j in range (u (N - 1)), c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * Var[Y j] := by
apply sum_le_sum fun j hj => ?_
rcases @eq_zero_or_pos _ _ j with (rfl | hj)
- · simp only [Nat.cast_zero, zero_pow', Ne.def, bit0_eq_zero, Nat.one_ne_zero,
+ · simp only [Nat.cast_zero, zero_pow, Ne.def, bit0_eq_zero, Nat.one_ne_zero,
not_false_iff, div_zero, zero_mul]
simp only [Nat.cast_zero, truncation_zero, variance_zero, mul_zero, le_rfl]
apply mul_le_mul_of_nonneg_right _ (variance_nonneg _ _)
abs
(#9553)
The current design for abs
is flawed:
Abs
notation typeclass has exactly two instances: one for [Neg α] [Sup α]
, one for [Inv α] [Sup α]
. This means that:
Abs.abs
Abs
instances!Algebra.Order.Group.Abs
are about the additive version.Algebra.Order.Group.PosPart
, and they get additivised to duplicates of the lemmas in Algebra.Order.Group.Abs
!This PR changes the notation typeclass with two new definitions (related through to_additive
): mabs
and abs
. abs
inherits the |a|
notation and mabs
gets |a|ₘ
instead.
The first half of Algebra.Order.Group.Abs
gets multiplicativised. A later PR will multiplicativise the second half, and another one will deduplicate the lemmas in Algebra.Order.Group.PosPart
.
Part of #9411.
Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>
@@ -512,7 +512,7 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
apply Asymptotics.isLittleO_iff.2 fun ε εpos => ?_
obtain ⟨i, hi⟩ : ∃ i, v i < ε := ((tendsto_order.1 v_lim).2 ε εpos).exists
filter_upwards [hω i] with n hn
- simp only [Real.norm_eq_abs, LatticeOrderedGroup.abs_abs, Nat.abs_cast]
+ simp only [Real.norm_eq_abs, abs_abs, Nat.abs_cast]
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
#align probability_theory.strong_law_aux2 ProbabilityTheory.strong_law_aux2
$
with <|
(#9319)
See Zulip thread for the discussion.
@@ -445,7 +445,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
refine' sum_nbij' (fun p ↦ ⟨p.2, p.1⟩) (fun p ↦ ⟨p.2, p.1⟩) _ _ _ _ _
· simp only [mem_sigma, mem_range, filter_congr_decidable, mem_filter, and_imp,
Sigma.forall]
- exact fun a b haN hb ↦ ⟨hb.trans_le $ u_mono $ Nat.le_pred_of_lt haN, haN, hb⟩
+ exact fun a b haN hb ↦ ⟨hb.trans_le <| u_mono <| Nat.le_pred_of_lt haN, haN, hb⟩
all_goals aesop
_ ≤ ∑ j in range (u (N - 1)), c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * Var[Y j] := by
apply sum_le_sum fun j hj => ?_
Lemmas around this were a mess, throth in terms of names, statement and location. This PR standardises everything to be in Algebra.BigOperators.Basic
and changes the lemmas to take in InjOn
and SurjOn
assumptions where possible (and where impossible make sure the hypotheses are taken in the correct order) and moves the equality of functions hypothesis last.
Also add a few lemmas that help fix downstream uses by golfing.
From LeanAPAP and LeanCamCombi
@@ -242,16 +242,8 @@ theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0
exact continuous_const.intervalIntegrable _ _
_ = ∑ i in range N, ∑ j in range (min (i + 1) K), ∫ _ in i..(i + 1 : ℕ), (1 : ℝ) ∂ρ := by
simp_rw [sum_sigma']
- refine' sum_bij' (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ (fun a _ => rfl)
- (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ _ _
- · rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_Ico] at hij
- simp only [hij, Nat.lt_succ_iff.2 hij.2.1, mem_sigma, mem_range, lt_min_iff, and_self_iff]
- · rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, lt_min_iff] at hij
- simp only [hij, Nat.lt_succ_iff.1 hij.2.1, mem_sigma, mem_range, mem_Ico, and_self_iff]
- · rintro ⟨i, j⟩ hij; rfl
- · rintro ⟨i, j⟩ hij; rfl
+ refine' sum_nbij' (fun p ↦ ⟨p.2, p.1⟩) (fun p ↦ ⟨p.2, p.1⟩) _ _ _ _ _ <;>
+ aesop (add simp Nat.lt_succ_iff)
_ ≤ ∑ i in range N, (i + 1) * ∫ _ in i..(i + 1 : ℕ), (1 : ℝ) ∂ρ := by
apply sum_le_sum fun i _ => ?_
simp only [Nat.cast_add, Nat.cast_one, sum_const, card_range, nsmul_eq_mul, Nat.cast_min]
@@ -354,16 +346,8 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
exact (continuous_id.pow _).intervalIntegrable _ _
_ = ∑ k in range K, (∑ j in Ioo k K, ((j : ℝ) ^ 2)⁻¹) * ∫ x in k..(k + 1 : ℕ), x ^ 2 ∂ρ := by
simp_rw [mul_sum, sum_mul, sum_sigma']
- refine' sum_bij' (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ (fun a _ => rfl)
- (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ _ _
- · rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_filter] at hij
- simp [hij, mem_sigma, mem_range, and_self_iff, hij.2.trans hij.1]
- · rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_Ioo] at hij
- simp only [hij, mem_sigma, mem_range, and_self_iff]
- · rintro ⟨i, j⟩ hij; rfl
- · rintro ⟨i, j⟩ hij; rfl
+ refine' sum_nbij' (fun p ↦ ⟨p.2, p.1⟩) (fun p ↦ ⟨p.2, p.1⟩) _ _ _ _ _ <;>
+ aesop (add unsafe lt_trans)
_ ≤ ∑ k in range K, 2 / (k + 1 : ℝ) * ∫ x in k..(k + 1 : ℕ), x ^ 2 ∂ρ := by
apply sum_le_sum fun k _ => ?_
refine' mul_le_mul_of_nonneg_right (sum_Ioo_inv_sq_le _ _) _
@@ -458,17 +442,11 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
_ = ∑ j in range (u (N - 1)),
(∑ i in (range N).filter fun i => j < u i, ((u i : ℝ) ^ 2)⁻¹) * Var[Y j] := by
simp_rw [mul_sum, sum_mul, sum_sigma']
- refine' sum_bij' (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ (fun a _ => rfl)
- (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ _ _
- · rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range] at hij
- simp only [hij.1, hij.2, mem_sigma, mem_range, mem_filter, and_true_iff]
- exact hij.2.trans_le (u_mono (Nat.le_sub_one_of_lt hij.1))
- · rintro ⟨i, j⟩ hij
- simp only [mem_sigma, mem_range, mem_filter] at hij
- simp only [hij.2.1, hij.2.2, mem_sigma, mem_range, and_self_iff]
- · rintro ⟨i, j⟩ hij; rfl
- · rintro ⟨i, j⟩ hij; rfl
+ refine' sum_nbij' (fun p ↦ ⟨p.2, p.1⟩) (fun p ↦ ⟨p.2, p.1⟩) _ _ _ _ _
+ · simp only [mem_sigma, mem_range, filter_congr_decidable, mem_filter, and_imp,
+ Sigma.forall]
+ exact fun a b haN hb ↦ ⟨hb.trans_le $ u_mono $ Nat.le_pred_of_lt haN, haN, hb⟩
+ all_goals aesop
_ ≤ ∑ j in range (u (N - 1)), c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * Var[Y j] := by
apply sum_le_sum fun j hj => ?_
rcases @eq_zero_or_pos _ _ j with (rfl | hj)
The names for lemmas about monotonicity of (a ^ ·)
and (· ^ n)
were a mess. This PR tidies up everything related by following the naming convention for (a * ·)
and (· * b)
. Namely, (a ^ ·)
is pow_right
and (· ^ n)
is pow_left
in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Order
pow_mono
→ pow_right_mono
pow_le_pow
→ pow_le_pow_right
pow_le_pow_of_le_left
→ pow_le_pow_left
pow_lt_pow_of_lt_left
→ pow_lt_pow_left
strictMonoOn_pow
→ pow_left_strictMonoOn
pow_strictMono_right
→ pow_right_strictMono
pow_lt_pow
→ pow_lt_pow_right
pow_lt_pow_iff
→ pow_lt_pow_iff_right
pow_le_pow_iff
→ pow_le_pow_iff_right
self_lt_pow
→ lt_self_pow
strictAnti_pow
→ pow_right_strictAnti
pow_lt_pow_iff_of_lt_one
→ pow_lt_pow_iff_right_of_lt_one
pow_lt_pow_of_lt_one
→ pow_lt_pow_right_of_lt_one
lt_of_pow_lt_pow
→ lt_of_pow_lt_pow_left
le_of_pow_le_pow
→ le_of_pow_le_pow_left
pow_lt_pow₀
→ pow_lt_pow_right₀
Algebra.GroupPower.CovariantClass
pow_le_pow_of_le_left'
→ pow_le_pow_left'
nsmul_le_nsmul_of_le_right
→ nsmul_le_nsmul_right
pow_lt_pow'
→ pow_lt_pow_right'
nsmul_lt_nsmul
→ nsmul_lt_nsmul_left
pow_strictMono_left
→ pow_right_strictMono'
nsmul_strictMono_right
→ nsmul_left_strictMono
StrictMono.pow_right'
→ StrictMono.pow_const
StrictMono.nsmul_left
→ StrictMono.const_nsmul
pow_strictMono_right'
→ pow_left_strictMono
nsmul_strictMono_left
→ nsmul_right_strictMono
Monotone.pow_right
→ Monotone.pow_const
Monotone.nsmul_left
→ Monotone.const_nsmul
lt_of_pow_lt_pow'
→ lt_of_pow_lt_pow_left'
lt_of_nsmul_lt_nsmul
→ lt_of_nsmul_lt_nsmul_right
pow_le_pow'
→ pow_le_pow_right'
nsmul_le_nsmul
→ nsmul_le_nsmul_left
pow_le_pow_of_le_one'
→ pow_le_pow_right_of_le_one'
nsmul_le_nsmul_of_nonpos
→ nsmul_le_nsmul_left_of_nonpos
le_of_pow_le_pow'
→ le_of_pow_le_pow_left'
le_of_nsmul_le_nsmul'
→ le_of_nsmul_le_nsmul_right'
pow_le_pow_iff'
→ pow_le_pow_iff_right'
nsmul_le_nsmul_iff
→ nsmul_le_nsmul_iff_left
pow_lt_pow_iff'
→ pow_lt_pow_iff_right'
nsmul_lt_nsmul_iff
→ nsmul_lt_nsmul_iff_left
Data.Nat.Pow
Nat.pow_lt_pow_of_lt_left
→ Nat.pow_lt_pow_left
Nat.pow_le_iff_le_left
→ Nat.pow_le_pow_iff_left
Nat.pow_lt_iff_lt_left
→ Nat.pow_lt_pow_iff_left
pow_le_pow_iff_left
pow_lt_pow_iff_left
pow_right_injective
pow_right_inj
Nat.pow_le_pow_left
to have the correct name since Nat.pow_le_pow_of_le_left
is in Std.Nat.pow_le_pow_right
to have the correct name since Nat.pow_le_pow_of_le_right
is in Std.self_le_pow
was a duplicate of le_self_pow
.Nat.pow_lt_pow_of_lt_right
is defeq to pow_lt_pow_right
.Nat.pow_right_strictMono
is defeq to pow_right_strictMono
.Nat.pow_le_iff_le_right
is defeq to pow_le_pow_iff_right
.Nat.pow_lt_iff_lt_right
is defeq to pow_lt_pow_iff_right
.0 < n
or 1 ≤ n
to n ≠ 0
.Nat
lemmas have been protected
.@@ -431,7 +431,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
set Y := fun n : ℕ => truncation (X n) n
set S := fun n => ∑ i in range n, Y i with hS
let u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
- have u_mono : Monotone u := fun i j hij => Nat.floor_mono (pow_le_pow c_one.le hij)
+ have u_mono : Monotone u := fun i j hij => Nat.floor_mono (pow_le_pow_right c_one.le hij)
have I1 : ∀ K, ∑ j in range K, ((j : ℝ) ^ 2)⁻¹ * Var[Y j] ≤ 2 * 𝔼[X 0] := by
intro K
calc
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -57,8 +57,6 @@ random variables. Let `Yₙ` be the truncation of `Xₙ` up to `n`. We claim tha
noncomputable section
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
open MeasureTheory Filter Finset Asymptotics
open Set (indicator)
@@ -366,7 +364,7 @@ theorem sum_variance_truncation_le {X : Ω → ℝ} (hint : Integrable X) (hnonn
simp only [hij, mem_sigma, mem_range, and_self_iff]
· rintro ⟨i, j⟩ hij; rfl
· rintro ⟨i, j⟩ hij; rfl
- _ ≤ ∑ k in range K, ↑2 / (k + ↑1) * ∫ x in k..(k + 1 : ℕ), x ^ 2 ∂ρ := by
+ _ ≤ ∑ k in range K, 2 / (k + 1 : ℝ) * ∫ x in k..(k + 1 : ℕ), x ^ 2 ∂ρ := by
apply sum_le_sum fun k _ => ?_
refine' mul_le_mul_of_nonneg_right (sum_Ioo_inv_sq_le _ _) _
refine' intervalIntegral.integral_nonneg_of_forall _ fun u => sq_nonneg _
@@ -465,7 +465,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
· rintro ⟨i, j⟩ hij
simp only [mem_sigma, mem_range] at hij
simp only [hij.1, hij.2, mem_sigma, mem_range, mem_filter, and_true_iff]
- exact hij.2.trans_le (u_mono (Nat.le_pred_of_lt hij.1))
+ exact hij.2.trans_le (u_mono (Nat.le_sub_one_of_lt hij.1))
· rintro ⟨i, j⟩ hij
simp only [mem_sigma, mem_range, mem_filter] at hij
simp only [hij.2.1, hij.2.2, mem_sigma, mem_range, and_self_iff]
We already have the strong law of large numbers for real-valued integrable random variables. We generalize it to general vector-valued integrable random variables. This does not require any second-countability assumptions as integrable functions can by definition be approximated by simple functions, for which the result is deduced from the one-dimensional one.
Along the way, we extend a few lemmas in the library from the real case to the vector case, and remove unneeded second-countability assumptions.
@@ -15,7 +15,7 @@ import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
# The strong law of large numbers
We prove the strong law of large numbers, in `ProbabilityTheory.strong_law_ae`:
-If `X n` is a sequence of independent identically distributed integrable real-valued random
+If `X n` is a sequence of independent identically distributed integrable random
variables, then `∑ i in range n, X i / n` converges almost surely to `𝔼[X 0]`.
We give here the strong version, due to Etemadi, that only requires pairwise independence.
@@ -25,6 +25,10 @@ This file also contains the Lᵖ version of the strong law of large numbers prov
## Implementation
+The main point is to prove the result for real-valued random variables, as the general case
+of Banach-space valued random variables follows from this case and approximation by simple
+functions. The real version is given in `ProbabilityTheory.strong_law_ae_real`.
+
We follow the proof by Etemadi
[Etemadi, *An elementary proof of the strong law of large numbers*][etemadi_strong_law],
which goes as follows.
@@ -219,14 +223,15 @@ theorem IdentDistrib.truncation {β : Type*} [MeasurableSpace β] {ν : Measure
end Truncation
-section StrongLawAe
+section StrongLawAeReal
variable {Ω : Type*} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
section MomentEstimates
theorem sum_prob_mem_Ioc_le {X : Ω → ℝ} (hint : Integrable X) (hnonneg : 0 ≤ X) {K : ℕ} {N : ℕ}
- (hKN : K ≤ N): ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N} ≤ ENNReal.ofReal (𝔼[X] + 1) := by
+ (hKN : K ≤ N) :
+ ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N} ≤ ENNReal.ofReal (𝔼[X] + 1) := by
let ρ : Measure ℝ := Measure.map X ℙ
haveI : IsProbabilityMeasure ρ := isProbabilityMeasure_map hint.aemeasurable
have A : ∑ j in range K, ∫ _ in j..N, (1 : ℝ) ∂ρ ≤ 𝔼[X] + 1 :=
@@ -640,8 +645,9 @@ end StrongLawNonneg
/-- **Strong law of large numbers**, almost sure version: if `X n` is a sequence of independent
identically distributed integrable real-valued random variables, then `∑ i in range n, X i / n`
converges almost surely to `𝔼[X 0]`. We give here the strong version, due to Etemadi, that only
-requires pairwise independence. -/
-theorem strong_law_ae (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
+requires pairwise independence. Superseded by `strong_law_ae`, which works for random variables
+taking values in any Banach space. -/
+theorem strong_law_ae_real (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
(hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
∀ᵐ ω, Tendsto (fun n : ℕ => (∑ i in range n, X i ω) / n) atTop (𝓝 𝔼[X 0]) := by
let pos : ℝ → ℝ := fun x => max x 0
@@ -659,34 +665,210 @@ theorem strong_law_ae (X : ℕ → Ω → ℝ) (hint : Integrable (X 0))
· simp only [← sub_div, ← sum_sub_distrib, max_zero_sub_max_neg_zero_eq_self, Function.comp_apply]
· simp only [← integral_sub hint.pos_part hint.neg_part, max_zero_sub_max_neg_zero_eq_self,
Function.comp_apply]
-#align probability_theory.strong_law_ae ProbabilityTheory.strong_law_ae
+#align probability_theory.strong_law_ae ProbabilityTheory.strong_law_ae_real
+
+end StrongLawAeReal
-end StrongLawAe
+section StrongLawVectorSpace
+
+variable {Ω : Type*} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
+ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
+ [MeasurableSpace E] [BorelSpace E]
+
+open Set TopologicalSpace
+
+/-- Preliminary lemma for the strong law of large numbers for vector-valued random variables:
+the composition of the random variables with a simple function satisfies the strong law of large
+numbers. -/
+lemma strong_law_ae_simpleFunc_comp (X : ℕ → Ω → E) (h' : Measurable (X 0))
+ (hindep : Pairwise (fun i j ↦ IndepFun (X i) (X j))) (hident : ∀ i, IdentDistrib (X i) (X 0))
+ (φ : SimpleFunc E E) : ∀ᵐ ω,
+ Tendsto (fun n : ℕ ↦ (n : ℝ) ⁻¹ • (∑ i in range n, φ (X i ω))) atTop (𝓝 𝔼[φ ∘ (X 0)]) := by
+ -- this follows from the one-dimensional version when `φ` takes a single value, and is then
+ -- extended to the general case by linearity.
+ classical
+ refine SimpleFunc.induction (P := fun ψ ↦ ∀ᵐ ω,
+ Tendsto (fun n : ℕ ↦ (n : ℝ) ⁻¹ • (∑ i in range n, ψ (X i ω))) atTop (𝓝 𝔼[ψ ∘ (X 0)])) ?_ ?_ φ
+ · intro c s hs
+ simp only [SimpleFunc.const_zero, SimpleFunc.coe_piecewise, SimpleFunc.coe_const,
+ SimpleFunc.coe_zero, piecewise_eq_indicator, Function.comp_apply]
+ let F : E → ℝ := indicator s 1
+ have F_meas : Measurable F := (measurable_indicator_const_iff 1).2 hs
+ let Y : ℕ → Ω → ℝ := fun n ↦ F ∘ (X n)
+ have : ∀ᵐ (ω : Ω), Tendsto (fun (n : ℕ) ↦ (n : ℝ)⁻¹ • ∑ i in Finset.range n, Y i ω)
+ atTop (𝓝 𝔼[Y 0]) := by
+ simp only [Pi.const_one, smul_eq_mul, ← div_eq_inv_mul]
+ apply strong_law_ae_real
+ · exact SimpleFunc.integrable_of_isFiniteMeasure
+ ((SimpleFunc.piecewise s hs (SimpleFunc.const _ (1 : ℝ))
+ (SimpleFunc.const _ (0 : ℝ))).comp (X 0) h')
+ · exact fun i j hij ↦ IndepFun.comp (hindep hij) F_meas F_meas
+ · exact fun i ↦ (hident i).comp F_meas
+ filter_upwards [this] with ω hω
+ have I : indicator s (Function.const E c) = (fun x ↦ (indicator s (1 : E → ℝ) x) • c) := by
+ ext
+ rw [← indicator_smul_const_apply]
+ congr! 1
+ ext
+ simp
+ simp only [I, integral_smul_const]
+ convert Tendsto.smul_const hω c using 1
+ simp [← sum_smul, smul_smul]
+ · rintro φ ψ - hφ hψ
+ filter_upwards [hφ, hψ] with ω hωφ hωψ
+ convert hωφ.add hωψ using 1
+ · simp [sum_add_distrib]
+ · congr 1
+ rw [← integral_add]
+ · rfl
+ · exact (φ.comp (X 0) h').integrable_of_isFiniteMeasure
+ · exact (ψ.comp (X 0) h').integrable_of_isFiniteMeasure
+
+/-- Preliminary lemma for the strong law of large numbers for vector-valued random variables,
+assuming measurability in addition to integrability. This is weakened to ae measurability in
+the full version `ProbabilityTheory.strong_law_ae`. -/
+lemma strong_law_ae_of_measurable
+ (X : ℕ → Ω → E) (hint : Integrable (X 0)) (h' : StronglyMeasurable (X 0))
+ (hindep : Pairwise (fun i j ↦ IndepFun (X i) (X j))) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
+ ∀ᵐ ω, Tendsto (fun n : ℕ ↦ (n : ℝ) ⁻¹ • (∑ i in range n, X i ω)) atTop (𝓝 𝔼[X 0]) := by
+ /- Choose a simple function `φ` such that `φ (X 0)` approximates well enough `X 0` -- this is
+ possible as `X 0` is strongly measurable. Then `φ (X n)` approximates well `X n`.
+ Then the strong law for `φ (X n)` implies the strong law for `X n`, up to a small
+ error controlled by `n⁻¹ ∑_{i=0}^{n-1} ‖X i - φ (X i)‖`. This one is also controlled thanks
+ to the one-dimensional law of large numbers: it converges ae to `𝔼[‖X 0 - φ (X 0)‖]`, which
+ is arbitrarily small for well chosen `φ`. -/
+ let s : Set E := Set.range (X 0) ∪ {0}
+ have zero_s : 0 ∈ s := by simp
+ have : SeparableSpace s := h'.separableSpace_range_union_singleton
+ have : Nonempty s := ⟨0, zero_s⟩
+ -- sequence of approximating simple functions.
+ let φ : ℕ → SimpleFunc E E :=
+ SimpleFunc.nearestPt (fun k => Nat.casesOn k 0 ((↑) ∘ denseSeq s) : ℕ → E)
+ let Y : ℕ → ℕ → Ω → E := fun k i ↦ (φ k) ∘ (X i)
+ -- strong law for `φ (X n)`
+ have A : ∀ᵐ ω, ∀ k,
+ Tendsto (fun n : ℕ ↦ (n : ℝ) ⁻¹ • (∑ i in range n, Y k i ω)) atTop (𝓝 𝔼[Y k 0]) :=
+ ae_all_iff.2 (fun k ↦ strong_law_ae_simpleFunc_comp X h'.measurable hindep hident (φ k))
+ -- strong law for the error `‖X i - φ (X i)‖`
+ have B : ∀ᵐ ω, ∀ k, Tendsto (fun n : ℕ ↦ (∑ i in range n, ‖(X i - Y k i) ω‖) / n)
+ atTop (𝓝 𝔼[(fun ω ↦ ‖(X 0 - Y k 0) ω‖)]) := by
+ apply ae_all_iff.2 (fun k ↦ ?_)
+ let G : ℕ → E → ℝ := fun k x ↦ ‖x - φ k x‖
+ have G_meas : ∀ k, Measurable (G k) :=
+ fun k ↦ (measurable_id.sub_stronglyMeasurable (φ k).stronglyMeasurable).norm
+ have I : ∀ k i, (fun ω ↦ ‖(X i - Y k i) ω‖) = (G k) ∘ (X i) := fun k i ↦ rfl
+ apply strong_law_ae_real (fun i ω ↦ ‖(X i - Y k i) ω‖)
+ · exact (hint.sub ((φ k).comp (X 0) h'.measurable).integrable_of_isFiniteMeasure).norm
+ · simp_rw [I]
+ intro i j hij
+ exact (hindep hij).comp (G_meas k) (G_meas k)
+ · intro i
+ simp_rw [I]
+ apply (hident i).comp (G_meas k)
+ -- check that, when both convergences above hold, then the strong law is satisfied
+ filter_upwards [A, B] with ω hω h'ω
+ rw [tendsto_iff_norm_sub_tendsto_zero, tendsto_order]
+ refine ⟨fun c hc ↦ eventually_of_forall (fun n ↦ hc.trans_le (norm_nonneg _)), ?_⟩
+ -- start with some positive `ε` (the desired precision), and fix `δ` with `3 δ < ε`.
+ intro ε (εpos : 0 < ε)
+ obtain ⟨δ, δpos, hδ⟩ : ∃ δ, 0 < δ ∧ δ + δ + δ < ε := ⟨ε/4, by positivity, by linarith⟩
+ -- choose `k` large enough so that `φₖ (X 0)` approximates well enough `X 0`, up to the
+ -- precision `δ`.
+ obtain ⟨k, hk⟩ : ∃ k, ∫ ω, ‖(X 0 - Y k 0) ω‖ < δ := by
+ simp_rw [Pi.sub_apply, norm_sub_rev (X 0 _)]
+ exact ((tendsto_order.1 (tendsto_integral_norm_approxOn_sub h'.measurable hint)).2 δ
+ δpos).exists
+ have : ‖𝔼[Y k 0] - 𝔼[X 0]‖ < δ := by
+ rw [norm_sub_rev, ← integral_sub hint]
+ · exact (norm_integral_le_integral_norm _).trans_lt hk
+ · exact ((φ k).comp (X 0) h'.measurable).integrable_of_isFiniteMeasure
+ -- consider `n` large enough for which the above convergences have taken place within `δ`.
+ have I : ∀ᶠ n in atTop, (∑ i in range n, ‖(X i - Y k i) ω‖) / n < δ :=
+ (tendsto_order.1 (h'ω k)).2 δ hk
+ have J : ∀ᶠ (n : ℕ) in atTop, ‖(n : ℝ) ⁻¹ • (∑ i in range n, Y k i ω) - 𝔼[Y k 0]‖ < δ := by
+ specialize hω k
+ rw [tendsto_iff_norm_sub_tendsto_zero] at hω
+ exact (tendsto_order.1 hω).2 δ δpos
+ filter_upwards [I, J] with n hn h'n
+ -- at such an `n`, the strong law is realized up to `ε`.
+ calc
+ ‖(n : ℝ)⁻¹ • ∑ i in Finset.range n, X i ω - 𝔼[X 0]‖
+ = ‖(n : ℝ)⁻¹ • ∑ i in Finset.range n, (X i ω - Y k i ω) +
+ ((n : ℝ)⁻¹ • ∑ i in Finset.range n, Y k i ω - 𝔼[Y k 0]) + (𝔼[Y k 0] - 𝔼[X 0])‖ := by
+ congr
+ simp only [Function.comp_apply, sum_sub_distrib, smul_sub]
+ abel
+ _ ≤ ‖(n : ℝ)⁻¹ • ∑ i in Finset.range n, (X i ω - Y k i ω)‖ +
+ ‖(n : ℝ)⁻¹ • ∑ i in Finset.range n, Y k i ω - 𝔼[Y k 0]‖ + ‖𝔼[Y k 0] - 𝔼[X 0]‖ :=
+ norm_add₃_le _ _ _
+ _ ≤ (∑ i in Finset.range n, ‖X i ω - Y k i ω‖) / n + δ + δ := by
+ gcongr
+ simp only [Function.comp_apply, norm_smul, norm_inv, IsROrC.norm_natCast,
+ div_eq_inv_mul, inv_pos, Nat.cast_pos, inv_lt_zero]
+ gcongr
+ exact norm_sum_le _ _
+ _ ≤ δ + δ + δ := by
+ gcongr
+ exact hn.le
+ _ < ε := hδ
+
+/-- **Strong law of large numbers**, almost sure version: if `X n` is a sequence of independent
+identically distributed integrable random variables taking values in a Banach space,
+then `n⁻¹ • ∑ i in range n, X i` converges almost surely to `𝔼[X 0]`. We give here the strong
+version, due to Etemadi, that only requires pairwise independence. -/
+theorem strong_law_ae
+ (X : ℕ → Ω → E) (hint : Integrable (X 0))
+ (hindep : Pairwise (fun i j ↦ IndepFun (X i) (X j))) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
+ ∀ᵐ ω, Tendsto (fun n : ℕ ↦ (n : ℝ) ⁻¹ • (∑ i in range n, X i ω)) atTop (𝓝 𝔼[X 0]) := by
+ -- we reduce to the case of strongly measurable random variables, by using `Y i` which is strongly
+ -- measurable and ae equal to `X i`.
+ have A : ∀ i, Integrable (X i) := fun i ↦ (hident i).integrable_iff.2 hint
+ let Y : ℕ → Ω → E := fun i ↦ (A i).1.mk (X i)
+ have B : ∀ᵐ ω, ∀ n, X n ω = Y n ω :=
+ ae_all_iff.2 (fun i ↦ AEStronglyMeasurable.ae_eq_mk (A i).1)
+ have Yint: Integrable (Y 0) := Integrable.congr hint (AEStronglyMeasurable.ae_eq_mk (A 0).1)
+ have C : ∀ᵐ ω, Tendsto (fun n : ℕ ↦ (n : ℝ) ⁻¹ • (∑ i in range n, Y i ω)) atTop (𝓝 𝔼[Y 0]) := by
+ apply strong_law_ae_of_measurable Y Yint ((A 0).1.stronglyMeasurable_mk)
+ (fun i j hij ↦ IndepFun.ae_eq (hindep hij) (A i).1.ae_eq_mk (A j).1.ae_eq_mk)
+ (fun i ↦ ((A i).1.identDistrib_mk.symm.trans (hident i)).trans (A 0).1.identDistrib_mk)
+ filter_upwards [B, C] with ω h₁ h₂
+ have : 𝔼[X 0] = 𝔼[Y 0] := integral_congr_ae (AEStronglyMeasurable.ae_eq_mk (A 0).1)
+ rw [this]
+ apply Tendsto.congr (fun n ↦ ?_) h₂
+ congr with i
+ exact (h₁ i).symm
+
+end StrongLawVectorSpace
section StrongLawLp
variable {Ω : Type*} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
+ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
+ [MeasurableSpace E] [BorelSpace E]
/-- **Strong law of large numbers**, Lᵖ version: if `X n` is a sequence of independent
-identically distributed real-valued random variables in Lᵖ, then `∑ i in range n, X i / n`
-converges in Lᵖ to `𝔼[X 0]`. -/
-theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ → Ω → ℝ) (hℒp : Memℒp (X 0) p)
+identically distributed random variables in Lᵖ, then `n⁻¹ • ∑ i in range n, X i`
+converges in `Lᵖ` to `𝔼[X 0]`. -/
+theorem strong_law_Lp {p : ℝ≥0∞} (hp : 1 ≤ p) (hp' : p ≠ ∞) (X : ℕ → Ω → E) (hℒp : Memℒp (X 0) p)
(hindep : Pairwise fun i j => IndepFun (X i) (X j)) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
- Tendsto (fun n => snorm (fun ω => (∑ i in range n, X i ω) / n - 𝔼[X 0]) p ℙ) atTop (𝓝 0) := by
+ Tendsto (fun (n : ℕ) => snorm (fun ω => (n : ℝ) ⁻¹ • (∑ i in range n, X i ω) - 𝔼[X 0]) p ℙ)
+ atTop (𝓝 0) := by
have hmeas : ∀ i, AEStronglyMeasurable (X i) ℙ := fun i =>
(hident i).aestronglyMeasurable_iff.2 hℒp.1
have hint : Integrable (X 0) ℙ := hℒp.integrable hp
- have havg : ∀ n, AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / n) ℙ := by
+ have havg : ∀ (n : ℕ),
+ AEStronglyMeasurable (fun ω => (n : ℝ) ⁻¹ • (∑ i in range n, X i ω)) ℙ := by
intro n
- simp_rw [div_eq_mul_inv]
- exact AEStronglyMeasurable.mul_const (aestronglyMeasurable_sum _ fun i _ => hmeas i) _
+ exact AEStronglyMeasurable.const_smul (aestronglyMeasurable_sum _ fun i _ => hmeas i) _
refine' tendsto_Lp_of_tendstoInMeasure _ hp hp' havg (memℒp_const _) _
(tendstoInMeasure_of_tendsto_ae havg (strong_law_ae _ hint hindep hident))
- rw [(_ : (fun n ω => (∑ i in range n, X i ω) / ↑n) = fun n => (∑ i in range n, X i) / ↑n)]
- · exact (uniformIntegrable_average hp <|
- Memℒp.uniformIntegrable_of_identDistrib hp hp' hℒp hident).2.1
+ rw [(_ : (fun (n : ℕ) ω => (n : ℝ)⁻¹ • (∑ i in range n, X i ω))
+ = fun (n : ℕ) => (n : ℝ)⁻¹ • (∑ i in range n, X i))]
+ · apply UniformIntegrable.unifIntegrable
+ apply uniformIntegrable_average hp
+ exact Memℒp.uniformIntegrable_of_identDistrib hp hp' hℒp hident
· ext n ω
- simp only [Pi.coe_nat, Pi.div_apply, sum_apply]
+ simp only [Pi.smul_apply, sum_apply]
set_option linter.uppercaseLean3 false in
#align probability_theory.strong_law_Lp ProbabilityTheory.strong_law_Lp
MulZeroClass.
in mul_zero
/zero_mul
(#6682)
Search&replace MulZeroClass.mul_zero
-> mul_zero
, MulZeroClass.zero_mul
-> zero_mul
.
These were introduced by Mathport, as the full name of mul_zero
is actually MulZeroClass.mul_zero
(it's exported with the short name).
@@ -470,7 +470,7 @@ theorem strong_law_aux1 {c : ℝ} (c_one : 1 < c) {ε : ℝ} (εpos : 0 < ε) :
apply sum_le_sum fun j hj => ?_
rcases @eq_zero_or_pos _ _ j with (rfl | hj)
· simp only [Nat.cast_zero, zero_pow', Ne.def, bit0_eq_zero, Nat.one_ne_zero,
- not_false_iff, div_zero, MulZeroClass.zero_mul]
+ not_false_iff, div_zero, zero_mul]
simp only [Nat.cast_zero, truncation_zero, variance_zero, mul_zero, le_rfl]
apply mul_le_mul_of_nonneg_right _ (variance_nonneg _ _)
convert sum_div_nat_floor_pow_sq_le_div_sq N (Nat.cast_pos.2 hj) c_one using 2
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -68,7 +68,7 @@ namespace ProbabilityTheory
section Truncation
-variable {α : Type _}
+variable {α : Type*}
/-- Truncating a real-valued function to the interval `(-A, A]`. -/
def truncation (f : α → ℝ) (A : ℝ) :=
@@ -211,7 +211,7 @@ theorem tendsto_integral_truncation {f : α → ℝ} (hf : Integrable f μ) :
exact (truncation_eq_self hA).symm
#align probability_theory.tendsto_integral_truncation ProbabilityTheory.tendsto_integral_truncation
-theorem IdentDistrib.truncation {β : Type _} [MeasurableSpace β] {ν : Measure β} {f : α → ℝ}
+theorem IdentDistrib.truncation {β : Type*} [MeasurableSpace β] {ν : Measure β} {f : α → ℝ}
{g : β → ℝ} (h : IdentDistrib f g μ ν) {A : ℝ} :
IdentDistrib (truncation f A) (truncation g A) μ ν :=
h.comp (measurable_id.indicator measurableSet_Ioc)
@@ -221,7 +221,7 @@ end Truncation
section StrongLawAe
-variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
+variable {Ω : Type*} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
section MomentEstimates
@@ -665,7 +665,7 @@ end StrongLawAe
section StrongLawLp
-variable {Ω : Type _} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
+variable {Ω : Type*} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
/-- **Strong law of large numbers**, Lᵖ version: if `X n` is a sequence of independent
identically distributed real-valued random variables in Lᵖ, then `∑ i in range n, X i / n`
@@ -531,7 +531,7 @@ theorem strong_law_aux2 {c : ℝ} (c_one : 1 < c) :
apply Asymptotics.isLittleO_iff.2 fun ε εpos => ?_
obtain ⟨i, hi⟩ : ∃ i, v i < ε := ((tendsto_order.1 v_lim).2 ε εpos).exists
filter_upwards [hω i] with n hn
- simp only [Real.norm_eq_abs, LatticeOrderedCommGroup.abs_abs, Nat.abs_cast]
+ simp only [Real.norm_eq_abs, LatticeOrderedGroup.abs_abs, Nat.abs_cast]
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
#align probability_theory.strong_law_aux2 ProbabilityTheory.strong_law_aux2
@@ -53,7 +53,7 @@ random variables. Let `Yₙ` be the truncation of `Xₙ` up to `n`. We claim tha
noncomputable section
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
open MeasureTheory Filter Finset Asymptotics
@@ -2,11 +2,6 @@
Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module probability.strong_law
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Probability.IdentDistrib
import Mathlib.MeasureTheory.Integral.IntervalIntegral
@@ -14,6 +9,8 @@ import Mathlib.Analysis.SpecificLimits.FloorPow
import Mathlib.Analysis.PSeries
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
+#align_import probability.strong_law from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
+
/-!
# The strong law of large numbers
@@ -130,7 +130,7 @@ theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) :
theorem _root_.MeasureTheory.AEStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ]
(hf : AEStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ :=
- Memℒp.of_bound hf.truncation (|A|) (eventually_of_forall fun _ => abs_truncation_le_bound _ _ _)
+ Memℒp.of_bound hf.truncation |A| (eventually_of_forall fun _ => abs_truncation_le_bound _ _ _)
#align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation
theorem _root_.MeasureTheory.AEStronglyMeasurable.integrable_truncation [IsFiniteMeasure μ]
The unported dependencies are
algebra.order.module
init.core
linear_algebra.free_module.finite.rank
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
linear_algebra.free_module.rank
algebra.order.monoid.cancel.basic
init.data.list.default
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file