[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
⊢ AEStronglyMeasurable (ProbabilityTheory.truncation f A) μ
[PROOFSTEP]
apply AEStronglyMeasurable.comp_aemeasurable _ hf.aemeasurable
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
⊢ AEStronglyMeasurable (indicator (Set.Ioc (-A) A) id) (Measure.map f μ)
[PROOFSTEP]
exact (stronglyMeasurable_id.indicator measurableSet_Ioc).aestronglyMeasurable
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
⊢ |truncation f A x| ≤ |A|
[PROOFSTEP]
simp only [truncation, Set.indicator, Set.mem_Icc, id.def, Function.comp_apply]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
⊢ |if f x ∈ Set.Ioc (-A) A then f x else 0| ≤ |A|
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h : f x ∈ Set.Ioc (-A) A
⊢ |f x| ≤ |A|
[PROOFSTEP]
exact abs_le_abs h.2 (neg_le.2 h.1.le)
[GOAL]
case neg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h : ¬f x ∈ Set.Ioc (-A) A
⊢ |0| ≤ |A|
[PROOFSTEP]
simp [abs_nonneg]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
⊢ truncation f 0 = 0
[PROOFSTEP]
simp [truncation]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
⊢ (fun x => 0) ∘ f = 0
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
⊢ |truncation f A x| ≤ |f x|
[PROOFSTEP]
simp only [truncation, indicator, Set.mem_Icc, id.def, Function.comp_apply]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
⊢ |if f x ∈ Set.Ioc (-A) A then f x else 0| ≤ |f x|
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h✝ : f x ∈ Set.Ioc (-A) A
⊢ |f x| ≤ |f x|
[PROOFSTEP]
exact le_rfl
[GOAL]
case neg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h✝ : ¬f x ∈ Set.Ioc (-A) A
⊢ |0| ≤ |f x|
[PROOFSTEP]
simp [abs_nonneg]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h : |f x| < A
⊢ truncation f A x = f x
[PROOFSTEP]
simp only [truncation, indicator, Set.mem_Icc, id.def, Function.comp_apply, ite_eq_left_iff]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h : |f x| < A
⊢ ¬f x ∈ Set.Ioc (-A) A → 0 = f x
[PROOFSTEP]
intro H
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h : |f x| < A
H : ¬f x ∈ Set.Ioc (-A) A
⊢ 0 = f x
[PROOFSTEP]
apply H.elim
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
x : α
h : |f x| < A
H : ¬f x ∈ Set.Ioc (-A) A
⊢ f x ∈ Set.Ioc (-A) A
[PROOFSTEP]
simp [(abs_lt.1 h).1, (abs_lt.1 h).2.le]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
⊢ truncation f A = indicator (Set.Ioc 0 A) id ∘ f
[PROOFSTEP]
ext x
[GOAL]
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
⊢ truncation f A x = (indicator (Set.Ioc 0 A) id ∘ f) x
[PROOFSTEP]
rcases(h x).lt_or_eq with (hx | hx)
[GOAL]
case h.inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
⊢ truncation f A x = (indicator (Set.Ioc 0 A) id ∘ f) x
[PROOFSTEP]
simp only [truncation, indicator, hx, Set.mem_Ioc, id.def, Function.comp_apply, true_and_iff]
[GOAL]
case h.inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
[PROOFSTEP]
by_cases h'x : f x ≤ A
[GOAL]
case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
[PROOFSTEP]
have : -A < f x := by linarith [h x]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
⊢ -A < f x
[PROOFSTEP]
linarith [h x]
[GOAL]
case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
this : -A < f x
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
[PROOFSTEP]
simp only [this, true_and_iff]
[GOAL]
case neg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : ¬f x ≤ A
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
[PROOFSTEP]
simp only [h'x, and_false_iff]
[GOAL]
case h.inr
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 = f x
⊢ truncation f A x = (indicator (Set.Ioc 0 A) id ∘ f) x
[PROOFSTEP]
simp only [truncation, indicator, hx, id.def, Function.comp_apply, ite_self]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
inst✝ : IsFiniteMeasure μ
hf : AEStronglyMeasurable f μ
A : ℝ
⊢ Integrable (truncation f A)
[PROOFSTEP]
rw [← memℒp_one_iff_integrable]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
inst✝ : IsFiniteMeasure μ
hf : AEStronglyMeasurable f μ
A : ℝ
⊢ Memℒp (truncation f A) 1
[PROOFSTEP]
exact hf.memℒp_truncation
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
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 μ
[PROOFSTEP]
have M : MeasurableSet (Set.Ioc (-A) A) := measurableSet_Ioc
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
hA : 0 ≤ A
n : ℕ
hn : n ≠ 0
M : MeasurableSet (Set.Ioc (-A) A)
⊢ ∫ (x : α), truncation f A x ^ n ∂μ = ∫ (y : ℝ) in -A..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
change ∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = _
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
hA : 0 ≤ A
n : ℕ
hn : n ≠ 0
M : MeasurableSet (Set.Ioc (-A) A)
⊢ ∫ (x : α), (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = ∫ (y : ℝ) in -A..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le, ← integral_indicator M]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
hA : 0 ≤ A
n : ℕ
hn : n ≠ 0
M : MeasurableSet (Set.Ioc (-A) A)
⊢ ∫ (y : ℝ), indicator (Set.Ioc (-A) A) id y ^ n ∂Measure.map f μ =
    ∫ (x : ℝ), indicator (Set.Ioc (-A) A) (fun x => x ^ n) x ∂Measure.map f μ
[PROOFSTEP]
simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
hA : 0 ≤ A
n : ℕ
hn : n ≠ 0
M : MeasurableSet (Set.Ioc (-A) A)
⊢ -A ≤ A
[PROOFSTEP]
linarith
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
hA : 0 ≤ A
n : ℕ
hn : n ≠ 0
M : MeasurableSet (Set.Ioc (-A) A)
⊢ AEStronglyMeasurable (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (Measure.map f μ)
[PROOFSTEP]
exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
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 μ
[PROOFSTEP]
have M : MeasurableSet (Set.Ioc 0 A) := measurableSet_Ioc
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
⊢ ∫ (x : α), truncation f A x ^ n ∂μ = ∫ (y : ℝ) in 0 ..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
have M' : MeasurableSet (Set.Ioc A 0) := measurableSet_Ioc
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
⊢ ∫ (x : α), truncation f A x ^ n ∂μ = ∫ (y : ℝ) in 0 ..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
rw [truncation_eq_of_nonneg h'f]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
⊢ ∫ (x : α), (indicator (Set.Ioc 0 A) id ∘ fun x => f x) x ^ n ∂μ = ∫ (y : ℝ) in 0 ..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
change ∫ x, (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = _
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
⊢ ∫ (x : α), (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = ∫ (y : ℝ) in 0 ..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
rcases le_or_lt 0 A with (hA | hA)
[GOAL]
case inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : 0 ≤ A
⊢ ∫ (x : α), (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = ∫ (y : ℝ) in 0 ..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le hA, ← integral_indicator M]
[GOAL]
case inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : 0 ≤ A
⊢ ∫ (y : ℝ), indicator (Set.Ioc 0 A) id y ^ n ∂Measure.map f μ =
    ∫ (x : ℝ), indicator (Set.Ioc 0 A) (fun x => x ^ n) x ∂Measure.map f μ
[PROOFSTEP]
simp only [indicator, zero_pow' _ hn, id.def, ite_pow]
[GOAL]
case inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : 0 ≤ A
⊢ AEStronglyMeasurable (fun z => indicator (Set.Ioc 0 A) id z ^ n) (Measure.map f μ)
[PROOFSTEP]
exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
[GOAL]
case inr
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
⊢ ∫ (x : α), (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = ∫ (y : ℝ) in 0 ..A, y ^ n ∂Measure.map f μ
[PROOFSTEP]
rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_ge hA.le, ←
  integral_indicator M']
[GOAL]
case inr
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
⊢ ∫ (y : ℝ), indicator (Set.Ioc 0 A) id y ^ n ∂Measure.map f μ =
    -∫ (x : ℝ), indicator (Set.Ioc A 0) (fun x => x ^ n) x ∂Measure.map f μ
[PROOFSTEP]
simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow' _ hn, Set.indicator_empty, integral_zero, zero_eq_neg]
[GOAL]
case inr
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
⊢ ∫ (x : ℝ), indicator (Set.Ioc A 0) (fun x => x ^ n) x ∂Measure.map f μ = 0
[PROOFSTEP]
apply integral_eq_zero_of_ae
[GOAL]
case inr.hf
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
⊢ (fun a => indicator (Set.Ioc A 0) (fun x => x ^ n) a) =ᵐ[Measure.map f μ] 0
[PROOFSTEP]
have : ∀ᵐ x ∂Measure.map f μ, (0 : ℝ) ≤ x := (ae_map_iff hf.aemeasurable measurableSet_Ici).2 (eventually_of_forall h'f)
[GOAL]
case inr.hf
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
this : ∀ᵐ (x : ℝ) ∂Measure.map f μ, 0 ≤ x
⊢ (fun a => indicator (Set.Ioc A 0) (fun x => x ^ n) a) =ᵐ[Measure.map f μ] 0
[PROOFSTEP]
filter_upwards [this] with x hx
[GOAL]
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
this : ∀ᵐ (x : ℝ) ∂Measure.map f μ, 0 ≤ x
x : ℝ
hx : 0 ≤ x
⊢ indicator (Set.Ioc A 0) (fun x => x ^ n) x = OfNat.ofNat 0 x
[PROOFSTEP]
simp only [indicator, Set.mem_Ioc, Pi.zero_apply, ite_eq_right_iff, and_imp]
[GOAL]
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
this : ∀ᵐ (x : ℝ) ∂Measure.map f μ, 0 ≤ x
x : ℝ
hx : 0 ≤ x
⊢ A < x → x ≤ 0 → x ^ n = 0
[PROOFSTEP]
intro _ h''x
[GOAL]
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
this : ∀ᵐ (x : ℝ) ∂Measure.map f μ, 0 ≤ x
x : ℝ
hx : 0 ≤ x
a✝ : A < x
h''x : x ≤ 0
⊢ x ^ n = 0
[PROOFSTEP]
have : x = 0 := by linarith
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
this : ∀ᵐ (x : ℝ) ∂Measure.map f μ, 0 ≤ x
x : ℝ
hx : 0 ≤ x
a✝ : A < x
h''x : x ≤ 0
⊢ x = 0
[PROOFSTEP]
linarith
[GOAL]
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
this✝ : ∀ᵐ (x : ℝ) ∂Measure.map f μ, 0 ≤ x
x : ℝ
hx : 0 ≤ x
a✝ : A < x
h''x : x ≤ 0
this : x = 0
⊢ x ^ n = 0
[PROOFSTEP]
simp [this, zero_pow' _ hn]
[GOAL]
case inr
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
n : ℕ
hn : n ≠ 0
h'f : 0 ≤ f
M : MeasurableSet (Set.Ioc 0 A)
M' : MeasurableSet (Set.Ioc A 0)
hA : A < 0
⊢ AEStronglyMeasurable (fun z => indicator (Set.Ioc 0 A) id z ^ n) (Measure.map f μ)
[PROOFSTEP]
exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
hA : 0 ≤ A
⊢ ∫ (x : α), truncation f A x ∂μ = ∫ (y : ℝ) in -A..A, y ∂Measure.map f μ
[PROOFSTEP]
simpa using moment_truncation_eq_intervalIntegral hf hA one_ne_zero
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : AEStronglyMeasurable f μ
A : ℝ
h'f : 0 ≤ f
⊢ ∫ (x : α), truncation f A x ∂μ = ∫ (y : ℝ) in 0 ..A, y ∂Measure.map f μ
[PROOFSTEP]
simpa using moment_truncation_eq_intervalIntegral_of_nonneg hf one_ne_zero h'f
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : Integrable f
h'f : 0 ≤ f
A : ℝ
⊢ ∫ (x : α), truncation f A x ∂μ ≤ ∫ (x : α), f x ∂μ
[PROOFSTEP]
apply integral_mono_of_nonneg (eventually_of_forall fun x => ?_) hf (eventually_of_forall fun x => ?_)
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : Integrable f
h'f : 0 ≤ f
A : ℝ
x : α
⊢ OfNat.ofNat 0 x ≤ truncation f A x
[PROOFSTEP]
exact truncation_nonneg _ (h'f x)
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : α → ℝ
hf : Integrable f
h'f : 0 ≤ f
A : ℝ
x : α
⊢ truncation f A x ≤ f x
[PROOFSTEP]
calc
  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)
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
⊢ Tendsto (fun A => ∫ (x : α), truncation f A x ∂μ) atTop (𝓝 (∫ (x : α), f x ∂μ))
[PROOFSTEP]
refine' tendsto_integral_filter_of_dominated_convergence (fun x => abs (f x)) _ _ _ _
[GOAL]
case refine'_1
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
⊢ ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (fun x => truncation f n x) μ
[PROOFSTEP]
exact eventually_of_forall fun A => hf.aestronglyMeasurable.truncation
[GOAL]
case refine'_2
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
⊢ ∀ᶠ (n : ℝ) in atTop, ∀ᵐ (a : α) ∂μ, ‖truncation f n a‖ ≤ (fun x => |f x|) a
[PROOFSTEP]
apply eventually_of_forall fun A => ?_
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
A : ℝ
⊢ ∀ᵐ (a : α) ∂μ, ‖truncation f A a‖ ≤ (fun x => |f x|) a
[PROOFSTEP]
apply eventually_of_forall fun x => ?_
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
A : ℝ
x : α
⊢ ‖truncation f A x‖ ≤ (fun x => |f x|) x
[PROOFSTEP]
rw [Real.norm_eq_abs]
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
A : ℝ
x : α
⊢ |truncation f A x| ≤ (fun x => |f x|) x
[PROOFSTEP]
exact abs_truncation_le_abs_self _ _ _
[GOAL]
case refine'_3
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
⊢ Integrable fun x => |f x|
[PROOFSTEP]
apply hf.abs
[GOAL]
case refine'_4
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
⊢ ∀ᵐ (a : α) ∂μ, Tendsto (fun n => truncation f n a) atTop (𝓝 (f a))
[PROOFSTEP]
apply eventually_of_forall fun x => ?_
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
x : α
⊢ Tendsto (fun n => truncation f n x) atTop (𝓝 (f x))
[PROOFSTEP]
apply tendsto_const_nhds.congr' _
[GOAL]
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
x : α
⊢ (fun x_1 => f x) =ᶠ[atTop] fun n => truncation f n x
[PROOFSTEP]
filter_upwards [Ioi_mem_atTop (abs (f x))] with A hA
[GOAL]
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
hf : Integrable f
x : α
A : ℝ
hA : A ∈ Set.Ioi |f x|
⊢ f x = truncation f A x
[PROOFSTEP]
exact (truncation_eq_self hA).symm
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
let ρ : Measure ℝ := Measure.map X ℙ
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
haveI : IsProbabilityMeasure ρ := isProbabilityMeasure_map hint.aemeasurable
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
have A : ∑ j in range K, ∫ _ in j..N, (1 : ℝ) ∂ρ ≤ 𝔼[X] + 1 :=
  calc
    ∑ j in range K, ∫ _ in j..N, (1 : ℝ) ∂ρ = ∑ j in range K, ∑ i in Ico j N, ∫ _ in i..(i + 1 : ℕ), (1 : ℝ) ∂ρ :=
      by
      apply sum_congr rfl fun j hj => ?_
      rw [intervalIntegral.sum_integral_adjacent_intervals_Ico ((mem_range.1 hj).le.trans hKN)]
      intro k _
      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
    _ ≤ ∑ 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]
      refine' mul_le_mul_of_nonneg_right (min_le_left _ _) _
      apply intervalIntegral.integral_nonneg
      · simp only [le_add_iff_nonneg_right, zero_le_one]
      · simp only [zero_le_one, imp_true_iff]
    _ ≤ ∑ i in range N, ∫ x in i..(i + 1 : ℕ), x + 1 ∂ρ :=
      by
      apply sum_le_sum fun i _ => ?_
      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
      · exact continuous_const.integrableOn_Ioc
      · 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 [hx.1.le]
    _ = ∫ x in (0)..N, x + 1 ∂ρ :=
      by
      rw [intervalIntegral.sum_integral_adjacent_intervals fun k _ => ?_]
      · norm_cast
      · exact (continuous_id.add continuous_const).intervalIntegrable _ _
    _ = ∫ x in (0)..N, x ∂ρ + ∫ x in (0)..N, 1 ∂ρ :=
      by
      rw [intervalIntegral.integral_add]
      · exact continuous_id.intervalIntegrable _ _
      · exact continuous_const.intervalIntegrable _ _
    _ = 𝔼[truncation X N] + ∫ x in (0)..N, 1 ∂ρ := by
      rw [integral_truncation_eq_intervalIntegral_of_nonneg hint.1 hnonneg]
    _ ≤ 𝔼[X] + ∫ x in (0)..N, 1 ∂ρ := (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 _)]
      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
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ = ∑ j in range K, ∑ i in Ico j N, ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ
[PROOFSTEP]
apply sum_congr rfl fun j hj => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
j : ℕ
hj : j ∈ range K
⊢ ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ = ∑ i in Ico j N, ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ
[PROOFSTEP]
rw [intervalIntegral.sum_integral_adjacent_intervals_Ico ((mem_range.1 hj).le.trans hKN)]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
j : ℕ
hj : j ∈ range K
⊢ ∀ (k : ℕ), k ∈ Set.Ico j N → IntervalIntegrable (fun x => 1) ρ ↑k ↑(k + 1)
[PROOFSTEP]
intro k _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
j : ℕ
hj : j ∈ range K
k : ℕ
a✝ : k ∈ Set.Ico j N
⊢ IntervalIntegrable (fun x => 1) ρ ↑k ↑(k + 1)
[PROOFSTEP]
exact continuous_const.intervalIntegrable _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∑ j in range K, ∑ i in Ico j N, ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ =
    ∑ i in range N, ∑ j in range (min (i + 1) K), ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ
[PROOFSTEP]
simp_rw [sum_sigma']
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∑ x in Finset.sigma (range K) fun a => Ico a N, ∫ (x : ℝ) in ↑x.snd..↑(x.snd + 1), 1 ∂Measure.map X ℙ =
    ∑ x in Finset.sigma (range N) fun a => range (min (a + 1) K), ∫ (x : ℝ) in ↑x.fst..↑(x.fst + 1), 1 ∂Measure.map X ℙ
[PROOFSTEP]
refine'
  sum_bij' (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ (fun a _ => rfl)
    (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ _ _
[GOAL]
case refine'_1
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range K) fun a => Ico a N),
    (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range N) fun a => range (min (a + 1) K)
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_1.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => Ico a N
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
    Finset.sigma (range N) fun a => range (min (a + 1) K)
[PROOFSTEP]
simp only [mem_sigma, mem_range, mem_Ico] at hij
[GOAL]
case refine'_1.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i j : ℕ
hij✝ : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => Ico a N
hij : i < K ∧ i ≤ j ∧ j < N
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij✝ ∈
    Finset.sigma (range N) fun a => range (min (a + 1) K)
[PROOFSTEP]
simp only [hij, Nat.lt_succ_iff.2 hij.2.1, mem_sigma, mem_range, lt_min_iff, and_self_iff]
[GOAL]
case refine'_2
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range N) fun a => range (min (a + 1) K)),
    (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range K) fun a => Ico a N
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_2.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range N) fun a => range (min (a + 1) K)
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈ Finset.sigma (range K) fun a => Ico a N
[PROOFSTEP]
simp only [mem_sigma, mem_range, lt_min_iff] at hij
[GOAL]
case refine'_2.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i j : ℕ
hij✝ : { fst := i, snd := j } ∈ Finset.sigma (range N) fun a => range (min (a + 1) K)
hij : i < N ∧ j < i + 1 ∧ j < K
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij✝ ∈ Finset.sigma (range K) fun a => Ico a N
[PROOFSTEP]
simp only [hij, Nat.lt_succ_iff.1 hij.2.1, mem_sigma, mem_range, mem_Ico, and_self_iff]
[GOAL]
case refine'_3
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range K) fun a => Ico a N),
    (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) a ha)
        (_ : (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range N) fun a => range (min (a + 1) K)) =
      a
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_3.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => Ico a N
⊢ (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij)
      (_ :
        (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
          Finset.sigma (range N) fun a => range (min (a + 1) K)) =
    { fst := i, snd := j }
[PROOFSTEP]
rfl
[GOAL]
case refine'_4
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range N) fun a => range (min (a + 1) K)),
    (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) a ha)
        (_ : (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range K) fun a => Ico a N) =
      a
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_4.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range N) fun a => range (min (a + 1) K)
⊢ (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij)
      (_ :
        (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
          Finset.sigma (range K) fun a => Ico a N) =
    { fst := i, snd := j }
[PROOFSTEP]
rfl
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∑ i in range N, ∑ j in range (min (i + 1) K), ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ ≤
    ∑ i in range N, (↑i + 1) * ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ
[PROOFSTEP]
apply sum_le_sum fun i _ => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
⊢ ∑ j in range (min (i + 1) K), ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ ≤ (↑i + 1) * ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ
[PROOFSTEP]
simp only [Nat.cast_add, Nat.cast_one, sum_const, card_range, nsmul_eq_mul, Nat.cast_min]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
⊢ min (↑i + 1) ↑K * ∫ (x : ℝ) in ↑i..↑i + 1, 1 ∂Measure.map X ℙ ≤ (↑i + 1) * ∫ (x : ℝ) in ↑i..↑i + 1, 1 ∂Measure.map X ℙ
[PROOFSTEP]
refine' mul_le_mul_of_nonneg_right (min_le_left _ _) _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
⊢ 0 ≤ ∫ (x : ℝ) in ↑i..↑i + 1, 1 ∂Measure.map X ℙ
[PROOFSTEP]
apply intervalIntegral.integral_nonneg
[GOAL]
case hab
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
⊢ ↑i ≤ ↑i + 1
[PROOFSTEP]
simp only [le_add_iff_nonneg_right, zero_le_one]
[GOAL]
case hf
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
⊢ ∀ (u : ℝ), u ∈ Set.Icc (↑i) (↑i + 1) → 0 ≤ 1
[PROOFSTEP]
simp only [zero_le_one, imp_true_iff]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∑ i in range N, (↑i + 1) * ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ ≤ ∑ i in range N, ∫ (x : ℝ) in ↑i..↑(i + 1), x + 1 ∂ρ
[PROOFSTEP]
apply sum_le_sum fun i _ => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
⊢ (↑i + 1) * ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ ≤ ∫ (x : ℝ) in ↑i..↑(i + 1), x + 1 ∂ρ
[PROOFSTEP]
have I : (i : ℝ) ≤ (i + 1 : ℕ) := by simp only [Nat.cast_add, Nat.cast_one, le_add_iff_nonneg_right, zero_le_one]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
⊢ ↑i ≤ ↑(i + 1)
[PROOFSTEP]
simp only [Nat.cast_add, Nat.cast_one, le_add_iff_nonneg_right, zero_le_one]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
⊢ (↑i + 1) * ∫ (x : ℝ) in ↑i..↑(i + 1), 1 ∂ρ ≤ ∫ (x : ℝ) in ↑i..↑(i + 1), x + 1 ∂ρ
[PROOFSTEP]
simp_rw [intervalIntegral.integral_of_le I, ← integral_mul_left]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
⊢ ∫ (a : ℝ) in Set.Ioc ↑i ↑(i + 1), (↑i + 1) * 1 ∂Measure.map X ℙ ≤
    ∫ (x : ℝ) in Set.Ioc ↑i ↑(i + 1), x + 1 ∂Measure.map X ℙ
[PROOFSTEP]
apply set_integral_mono_on
[GOAL]
case hf
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
⊢ IntegrableOn (fun a => (↑i + 1) * 1) (Set.Ioc ↑i ↑(i + 1))
[PROOFSTEP]
exact continuous_const.integrableOn_Ioc
[GOAL]
case hg
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
⊢ IntegrableOn (fun a => a + 1) (Set.Ioc ↑i ↑(i + 1))
[PROOFSTEP]
exact (continuous_id.add continuous_const).integrableOn_Ioc
[GOAL]
case hs
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
⊢ MeasurableSet (Set.Ioc ↑i ↑(i + 1))
[PROOFSTEP]
exact measurableSet_Ioc
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
⊢ ∀ (x : ℝ), x ∈ Set.Ioc ↑i ↑(i + 1) → (↑i + 1) * 1 ≤ x + 1
[PROOFSTEP]
intro x hx
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑i ↑(i + 1)
⊢ (↑i + 1) * 1 ≤ x + 1
[PROOFSTEP]
simp only [Nat.cast_add, Nat.cast_one, Set.mem_Ioc] at hx
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
i : ℕ
x✝ : i ∈ range N
I : ↑i ≤ ↑(i + 1)
x : ℝ
hx : ↑i < x ∧ x ≤ ↑i + 1
⊢ (↑i + 1) * 1 ≤ x + 1
[PROOFSTEP]
simp [hx.1.le]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∑ i in range N, ∫ (x : ℝ) in ↑i..↑(i + 1), x + 1 ∂ρ = ∫ (x : ℝ) in 0 ..↑N, x + 1 ∂ρ
[PROOFSTEP]
rw [intervalIntegral.sum_integral_adjacent_intervals fun k _ => ?_]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∫ (x : ℝ) in ↑0 ..↑N, x + 1 ∂ρ = ∫ (x : ℝ) in 0 ..↑N, x + 1 ∂ρ
[PROOFSTEP]
norm_cast
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
k : ℕ
x✝ : k < N
⊢ IntervalIntegrable (fun x => x + 1) ρ ↑k ↑(k + 1)
[PROOFSTEP]
exact (continuous_id.add continuous_const).intervalIntegrable _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∫ (x : ℝ) in 0 ..↑N, x + 1 ∂ρ = ∫ (x : ℝ) in 0 ..↑N, x ∂ρ + ∫ (x : ℝ) in 0 ..↑N, 1 ∂ρ
[PROOFSTEP]
rw [intervalIntegral.integral_add]
[GOAL]
case hf
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ IntervalIntegrable (fun x => x) ρ 0 ↑N
[PROOFSTEP]
exact continuous_id.intervalIntegrable _ _
[GOAL]
case hg
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ IntervalIntegrable (fun x => 1) ρ 0 ↑N
[PROOFSTEP]
exact continuous_const.intervalIntegrable _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∫ (x : ℝ) in 0 ..↑N, x ∂ρ + ∫ (x : ℝ) in 0 ..↑N, 1 ∂ρ = (∫ (a : Ω), truncation X (↑N) a) + ∫ (x : ℝ) in 0 ..↑N, 1 ∂ρ
[PROOFSTEP]
rw [integral_truncation_eq_intervalIntegral_of_nonneg hint.1 hnonneg]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ (∫ (a : Ω), X a) + ∫ (x : ℝ) in 0 ..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
[PROOFSTEP]
refine' add_le_add le_rfl _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∫ (x : ℝ) in 0 ..↑N, 1 ∂ρ ≤ 1
[PROOFSTEP]
rw [intervalIntegral.integral_of_le (Nat.cast_nonneg _)]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ∫ (x : ℝ) in Set.Ioc 0 ↑N, 1 ∂ρ ≤ 1
[PROOFSTEP]
simp only [integral_const, Measure.restrict_apply', measurableSet_Ioc, Set.univ_inter, Algebra.id.smul_eq_mul, mul_one]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ENNReal.toReal (↑↑(Measure.map X ℙ) (Set.Ioc 0 ↑N)) ≤ 1
[PROOFSTEP]
rw [← ENNReal.one_toReal]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
⊢ ENNReal.toReal (↑↑(Measure.map X ℙ) (Set.Ioc 0 ↑N)) ≤ ENNReal.toReal 1
[PROOFSTEP]
exact ENNReal.toReal_mono ENNReal.one_ne_top prob_le_one
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
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 ρ _, Measure.map_apply_of_aemeasurable hint.aemeasurable measurableSet_Ioc]
  rfl
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
⊢ ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
[PROOFSTEP]
intro a b
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
a b : ℝ
⊢ ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
[PROOFSTEP]
rw [ofReal_set_integral_one ρ _, Measure.map_apply_of_aemeasurable hint.aemeasurable measurableSet_Ioc]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
a b : ℝ
⊢ ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ↑↑ℙ (X ⁻¹' Set.Ioc a b)
[PROOFSTEP]
rfl
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
B : ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
calc
  ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N} =
      ∑ j in range K, ENNReal.ofReal (∫ _ in Set.Ioc (j : ℝ) N, (1 : ℝ) ∂ρ) :=
    by simp_rw [B]
  _ = ENNReal.ofReal (∑ j in range K, ∫ _ 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, imp_true_iff]
  _ = ENNReal.ofReal (∑ j in range K, ∫ _ 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
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
B : ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N} = ∑ j in range K, ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc ↑j ↑N, 1 ∂ρ)
[PROOFSTEP]
simp_rw [B]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
B : ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
⊢ ∑ j in range K, ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc ↑j ↑N, 1 ∂ρ) =
    ENNReal.ofReal (∑ j in range K, ∫ (x : ℝ) in Set.Ioc ↑j ↑N, 1 ∂ρ)
[PROOFSTEP]
rw [ENNReal.ofReal_sum_of_nonneg]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
B : ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
⊢ ∀ (i : ℕ), i ∈ range K → 0 ≤ ∫ (x : ℝ) in Set.Ioc ↑i ↑N, 1 ∂ρ
[PROOFSTEP]
simp only [integral_const, Algebra.id.smul_eq_mul, mul_one, ENNReal.toReal_nonneg, imp_true_iff]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
B : ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
⊢ ENNReal.ofReal (∑ j in range K, ∫ (x : ℝ) in Set.Ioc ↑j ↑N, 1 ∂ρ) =
    ENNReal.ofReal (∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ)
[PROOFSTEP]
congr 1
[GOAL]
case e_r
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
B : ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
⊢ ∑ j in range K, ∫ (x : ℝ) in Set.Ioc ↑j ↑N, 1 ∂ρ = ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ
[PROOFSTEP]
refine' sum_congr rfl fun j hj => _
[GOAL]
case e_r
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K N : ℕ
hKN : K ≤ N
ρ : Measure ℝ := Measure.map X ℙ
this : IsProbabilityMeasure ρ
A : ∑ j in range K, ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ ≤ (∫ (a : Ω), X a) + 1
B : ∀ (a b : ℝ), ↑↑ℙ {ω | X ω ∈ Set.Ioc a b} = ENNReal.ofReal (∫ (x : ℝ) in Set.Ioc a b, 1 ∂ρ)
j : ℕ
hj : j ∈ range K
⊢ ∫ (x : ℝ) in Set.Ioc ↑j ↑N, 1 ∂ρ = ∫ (x : ℝ) in ↑j..↑N, 1 ∂ρ
[PROOFSTEP]
rw [intervalIntegral.integral_of_le (Nat.cast_le.2 ((mem_range.1 hj).le.trans hKN))]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
⊢ ∑' (j : ℕ), ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j} < ⊤
[PROOFSTEP]
suffices : ∀ K : ℕ, ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)} ≤ ENNReal.ofReal (𝔼[X] + 1)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
this : ∀ (K : ℕ), ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
⊢ ∑' (j : ℕ), ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j} < ⊤
case this
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
⊢ ∀ (K : ℕ), ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
exact
  (le_of_tendsto_of_tendsto (ENNReal.tendsto_nat_tsum _) tendsto_const_nhds (eventually_of_forall this)).trans_lt
    ENNReal.ofReal_lt_top
[GOAL]
case this
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
⊢ ∀ (K : ℕ), ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
intro K
[GOAL]
case this
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
have A :
  Tendsto (fun N : ℕ => ∑ j in range K, ℙ {ω | X ω ∈ Set.Ioc (j : ℝ) N}) atTop
    (𝓝 (∑ j in range K, ℙ {ω | X ω ∈ Set.Ioi (j : ℝ)})) :=
  by
  refine' tendsto_finset_sum _ fun i _ => _
  have : {ω | X ω ∈ Set.Ioi (i : ℝ)} = ⋃ N : ℕ, {ω | X ω ∈ Set.Ioc (i : ℝ) N} :=
    by
    apply Set.Subset.antisymm _ _
    · intro ω hω
      obtain ⟨N, hN⟩ : ∃ N : ℕ, X ω ≤ N := exists_nat_ge (X ω)
      exact Set.mem_iUnion.2 ⟨N, hω, hN⟩
    ·
      simp (config := { contextual := true }) only [Set.mem_Ioc, Set.mem_Ioi, Set.iUnion_subset_iff,
        Set.setOf_subset_setOf, imp_true_iff]
  rw [this]
  apply tendsto_measure_iUnion
  intro m n hmn x hx
  exact ⟨hx.1, hx.2.trans (Nat.cast_le.2 hmn)⟩
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
⊢ Tendsto (fun N => ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N}) atTop
    (𝓝 (∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j}))
[PROOFSTEP]
refine' tendsto_finset_sum _ fun i _ => _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
⊢ Tendsto (fun N => ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑i ↑N}) atTop (𝓝 (↑↑ℙ {ω | X ω ∈ Set.Ioi ↑i}))
[PROOFSTEP]
have : {ω | X ω ∈ Set.Ioi (i : ℝ)} = ⋃ N : ℕ, {ω | X ω ∈ Set.Ioc (i : ℝ) N} :=
  by
  apply Set.Subset.antisymm _ _
  · intro ω hω
    obtain ⟨N, hN⟩ : ∃ N : ℕ, X ω ≤ N := exists_nat_ge (X ω)
    exact Set.mem_iUnion.2 ⟨N, hω, hN⟩
  ·
    simp (config := { contextual := true }) only [Set.mem_Ioc, Set.mem_Ioi, Set.iUnion_subset_iff,
      Set.setOf_subset_setOf, imp_true_iff]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
⊢ {ω | X ω ∈ Set.Ioi ↑i} = ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
[PROOFSTEP]
apply Set.Subset.antisymm _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
⊢ {ω | X ω ∈ Set.Ioi ↑i} ⊆ ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
[PROOFSTEP]
intro ω hω
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
ω : Ω
hω : ω ∈ {ω | X ω ∈ Set.Ioi ↑i}
⊢ ω ∈ ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
[PROOFSTEP]
obtain ⟨N, hN⟩ : ∃ N : ℕ, X ω ≤ N := exists_nat_ge (X ω)
[GOAL]
case intro
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
ω : Ω
hω : ω ∈ {ω | X ω ∈ Set.Ioi ↑i}
N : ℕ
hN : X ω ≤ ↑N
⊢ ω ∈ ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
[PROOFSTEP]
exact Set.mem_iUnion.2 ⟨N, hω, hN⟩
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
⊢ ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N} ⊆ {ω | X ω ∈ Set.Ioi ↑i}
[PROOFSTEP]
simp (config := { contextual := true }) only [Set.mem_Ioc, Set.mem_Ioi, Set.iUnion_subset_iff, Set.setOf_subset_setOf,
  imp_true_iff]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
this : {ω | X ω ∈ Set.Ioi ↑i} = ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
⊢ Tendsto (fun N => ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑i ↑N}) atTop (𝓝 (↑↑ℙ {ω | X ω ∈ Set.Ioi ↑i}))
[PROOFSTEP]
rw [this]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
this : {ω | X ω ∈ Set.Ioi ↑i} = ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
⊢ Tendsto (fun N => ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑i ↑N}) atTop (𝓝 (↑↑ℙ (⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N})))
[PROOFSTEP]
apply tendsto_measure_iUnion
[GOAL]
case hm
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
this : {ω | X ω ∈ Set.Ioi ↑i} = ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
⊢ Monotone fun N => {ω | X ω ∈ Set.Ioc ↑i ↑N}
[PROOFSTEP]
intro m n hmn x hx
[GOAL]
case hm
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K i : ℕ
x✝ : i ∈ range K
this : {ω | X ω ∈ Set.Ioi ↑i} = ⋃ (N : ℕ), {ω | X ω ∈ Set.Ioc ↑i ↑N}
m n : ℕ
hmn : m ≤ n
x : Ω
hx : x ∈ (fun N => {ω | X ω ∈ Set.Ioc ↑i ↑N}) m
⊢ x ∈ (fun N => {ω | X ω ∈ Set.Ioc ↑i ↑N}) n
[PROOFSTEP]
exact ⟨hx.1, hx.2.trans (Nat.cast_le.2 hmn)⟩
[GOAL]
case this
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
A :
  Tendsto (fun N => ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N}) atTop
    (𝓝 (∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j}))
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
apply le_of_tendsto_of_tendsto A tendsto_const_nhds
[GOAL]
case this
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
A :
  Tendsto (fun N => ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N}) atTop
    (𝓝 (∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j}))
⊢ (fun N => ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N}) ≤ᶠ[atTop] fun x => ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
filter_upwards [Ici_mem_atTop K] with N hN
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
A :
  Tendsto (fun N => ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N}) atTop
    (𝓝 (∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioi ↑j}))
N : ℕ
hN : N ∈ Set.Ici K
⊢ ∑ j in range K, ↑↑ℙ {ω | X ω ∈ Set.Ioc ↑j ↑N} ≤ ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
[PROOFSTEP]
exact sum_prob_mem_Ioc_le hint hnonneg hN
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (a : Ω), (truncation X ↑j ^ 2) a ≤ 2 * ∫ (a : Ω), X a
[PROOFSTEP]
set Y := fun n : ℕ => truncation X n
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (a : Ω), (truncation X ↑j ^ 2) a ≤ 2 * ∫ (a : Ω), X a
[PROOFSTEP]
let ρ : Measure ℝ := Measure.map X ℙ
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (a : Ω), (truncation X ↑j ^ 2) a ≤ 2 * ∫ (a : Ω), X a
[PROOFSTEP]
have Y2 : ∀ n, 𝔼[Y n ^ 2] = ∫ x in (0)..n, x ^ 2 ∂ρ := by
  intro n
  change 𝔼[fun x => Y n x ^ 2] = _
  rw [moment_truncation_eq_intervalIntegral_of_nonneg hint.1 two_ne_zero hnonneg]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
⊢ ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
[PROOFSTEP]
intro n
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
n : ℕ
⊢ ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
[PROOFSTEP]
change 𝔼[fun x => Y n x ^ 2] = _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
n : ℕ
⊢ ∫ (a : Ω), (fun x => Y n x ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
[PROOFSTEP]
rw [moment_truncation_eq_intervalIntegral_of_nonneg hint.1 two_ne_zero hnonneg]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (a : Ω), (truncation X ↑j ^ 2) a ≤ 2 * ∫ (a : Ω), X a
[PROOFSTEP]
calc
  ∑ 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 ∂ρ :=
    by
    congr 1 with j
    congr 1
    rw [intervalIntegral.sum_integral_adjacent_intervals]
    · norm_cast
    intro k _
    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
  _ ≤ ∑ 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 _
    simp only [Nat.cast_add, Nat.cast_one, le_add_iff_nonneg_right, zero_le_one]
  _ ≤ ∑ k in range K, ∫ x in k..(k + 1 : ℕ), 2 * x ∂ρ :=
    by
    apply sum_le_sum fun k _ => ?_
    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 => _
    · apply Continuous.integrableOn_Ioc
      exact continuous_const.mul (continuous_pow 2)
    · apply Continuous.integrableOn_Ioc
      exact continuous_const.mul continuous_id'
    ·
      calc
        ↑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
              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)))
        _ = 2 * x := by rw [one_mul]
  _ = 2 * ∫ x in (0 : ℝ)..K, x ∂ρ :=
    by
    rw [intervalIntegral.sum_integral_adjacent_intervals fun k _ => ?_]
    swap; · exact (continuous_const.mul continuous_id').intervalIntegrable _ _
    rw [intervalIntegral.integral_const_mul]
    norm_cast
  _ ≤ 2 * 𝔼[X] :=
    mul_le_mul_of_nonneg_left
      (by
        rw [← integral_truncation_eq_intervalIntegral_of_nonneg hint.1 hnonneg]
        exact integral_truncation_le_integral_of_nonneg hint hnonneg)
      zero_le_two
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (a : Ω), (Y j ^ 2) a = ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (x : ℝ) in 0 ..↑j, x ^ 2 ∂ρ
[PROOFSTEP]
simp_rw [Y2]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (x : ℝ) in 0 ..↑j, x ^ 2 ∂ρ =
    ∑ j in range K, (↑j ^ 2)⁻¹ * ∑ k in range j, ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ
[PROOFSTEP]
congr 1 with j
[GOAL]
case e_f.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
j : ℕ
⊢ (↑j ^ 2)⁻¹ * ∫ (x : ℝ) in 0 ..↑j, x ^ 2 ∂ρ = (↑j ^ 2)⁻¹ * ∑ k in range j, ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ
[PROOFSTEP]
congr 1
[GOAL]
case e_f.h.e_a
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
j : ℕ
⊢ ∫ (x : ℝ) in 0 ..↑j, x ^ 2 ∂ρ = ∑ k in range j, ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ
[PROOFSTEP]
rw [intervalIntegral.sum_integral_adjacent_intervals]
[GOAL]
case e_f.h.e_a
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
j : ℕ
⊢ ∫ (x : ℝ) in 0 ..↑j, x ^ 2 ∂ρ = ∫ (x : ℝ) in ↑0 ..↑j, x ^ 2 ∂ρ
[PROOFSTEP]
norm_cast
[GOAL]
case e_f.h.e_a
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
j : ℕ
⊢ ∀ (k : ℕ), k < j → IntervalIntegrable (fun x => x ^ 2) ρ ↑k ↑(k + 1)
[PROOFSTEP]
intro k _
[GOAL]
case e_f.h.e_a
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
j k : ℕ
a✝ : k < j
⊢ IntervalIntegrable (fun x => x ^ 2) ρ ↑k ↑(k + 1)
[PROOFSTEP]
exact (continuous_id.pow _).intervalIntegrable _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * ∑ k in range j, ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ =
    ∑ k in range K, (∑ j in Ioo k K, (↑j ^ 2)⁻¹) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ
[PROOFSTEP]
simp_rw [mul_sum, sum_mul, sum_sigma']
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ x in Finset.sigma (range K) fun a => range a,
      (↑x.fst ^ 2)⁻¹ * ∫ (x : ℝ) in ↑x.snd..↑(x.snd + 1), x ^ 2 ∂Measure.map X ℙ =
    ∑ x in Finset.sigma (range K) fun a => Ioo a K,
      (↑x.snd ^ 2)⁻¹ * ∫ (x : ℝ) in ↑x.fst..↑(x.fst + 1), x ^ 2 ∂Measure.map X ℙ
[PROOFSTEP]
refine'
  sum_bij' (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ (fun a _ => rfl)
    (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ _ _
[GOAL]
case refine'_1
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range K) fun a => range a),
    (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range K) fun a => Ioo a K
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_1.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => range a
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈ Finset.sigma (range K) fun a => Ioo a K
[PROOFSTEP]
simp only [mem_sigma, mem_range, mem_filter] at hij
[GOAL]
case refine'_1.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
i j : ℕ
hij✝ : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => range a
hij : i < K ∧ j < i
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij✝ ∈ Finset.sigma (range K) fun a => Ioo a K
[PROOFSTEP]
simp [hij, mem_sigma, mem_range, and_self_iff, hij.2.trans hij.1]
[GOAL]
case refine'_2
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range K) fun a => Ioo a K),
    (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range K) fun a => range a
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_2.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => Ioo a K
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈ Finset.sigma (range K) fun a => range a
[PROOFSTEP]
simp only [mem_sigma, mem_range, mem_Ioo] at hij
[GOAL]
case refine'_2.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
i j : ℕ
hij✝ : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => Ioo a K
hij : i < K ∧ i < j ∧ j < K
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij✝ ∈ Finset.sigma (range K) fun a => range a
[PROOFSTEP]
simp only [hij, mem_sigma, mem_range, and_self_iff]
[GOAL]
case refine'_3
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range K) fun a => range a),
    (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) a ha)
        (_ : (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range K) fun a => Ioo a K) =
      a
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_3.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => range a
⊢ (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij)
      (_ :
        (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
          Finset.sigma (range K) fun a => Ioo a K) =
    { fst := i, snd := j }
[PROOFSTEP]
rfl
[GOAL]
case refine'_4
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range K) fun a => Ioo a K),
    (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) a ha)
        (_ : (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range K) fun a => range a) =
      a
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_4.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range K) fun a => Ioo a K
⊢ (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij)
      (_ :
        (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
          Finset.sigma (range K) fun a => range a) =
    { fst := i, snd := j }
[PROOFSTEP]
rfl
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ k in range K, (∑ j in Ioo k K, (↑j ^ 2)⁻¹) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ ≤
    ∑ k in range K, 2 / (↑k + 1) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ
[PROOFSTEP]
apply sum_le_sum fun k _ => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
⊢ (∑ j in Ioo k K, (↑j ^ 2)⁻¹) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ ≤
    2 / (↑k + 1) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ
[PROOFSTEP]
refine' mul_le_mul_of_nonneg_right (sum_Ioo_inv_sq_le _ _) _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
⊢ 0 ≤ ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ
[PROOFSTEP]
refine' intervalIntegral.integral_nonneg_of_forall _ fun u => sq_nonneg _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
⊢ ↑k ≤ ↑(k + 1)
[PROOFSTEP]
simp only [Nat.cast_add, Nat.cast_one, le_add_iff_nonneg_right, zero_le_one]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ k in range K, 2 / (↑k + 1) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ ≤
    ∑ k in range K, ∫ (x : ℝ) in ↑k..↑(k + 1), 2 * x ∂ρ
[PROOFSTEP]
apply sum_le_sum fun k _ => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
⊢ 2 / (↑k + 1) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ ≤ ∫ (x : ℝ) in ↑k..↑(k + 1), 2 * x ∂ρ
[PROOFSTEP]
have Ik : (k : ℝ) ≤ (k + 1 : ℕ) := by simp
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
⊢ ↑k ≤ ↑(k + 1)
[PROOFSTEP]
simp
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
⊢ 2 / (↑k + 1) * ∫ (x : ℝ) in ↑k..↑(k + 1), x ^ 2 ∂ρ ≤ ∫ (x : ℝ) in ↑k..↑(k + 1), 2 * x ∂ρ
[PROOFSTEP]
rw [← intervalIntegral.integral_const_mul, intervalIntegral.integral_of_le Ik, intervalIntegral.integral_of_le Ik]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
⊢ ∫ (x : ℝ) in Set.Ioc ↑k ↑(k + 1), 2 / (↑k + 1) * x ^ 2 ∂ρ ≤ ∫ (x : ℝ) in Set.Ioc ↑k ↑(k + 1), 2 * x ∂ρ
[PROOFSTEP]
refine' set_integral_mono_on _ _ measurableSet_Ioc fun x hx => _
[GOAL]
case refine'_1
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
⊢ IntegrableOn (fun x => 2 / (↑k + 1) * x ^ 2) (Set.Ioc ↑k ↑(k + 1))
[PROOFSTEP]
apply Continuous.integrableOn_Ioc
[GOAL]
case refine'_1.hf
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
⊢ Continuous fun x => 2 / (↑k + 1) * x ^ 2
[PROOFSTEP]
exact continuous_const.mul (continuous_pow 2)
[GOAL]
case refine'_2
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
⊢ IntegrableOn (fun x => 2 * x) (Set.Ioc ↑k ↑(k + 1))
[PROOFSTEP]
apply Continuous.integrableOn_Ioc
[GOAL]
case refine'_2.hf
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
⊢ Continuous fun x => 2 * x
[PROOFSTEP]
exact continuous_const.mul continuous_id'
[GOAL]
case refine'_3
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ 2 / (↑k + 1) * x ^ 2 ≤ 2 * x
[PROOFSTEP]
calc
  ↑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
        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)))
  _ = 2 * x := by rw [one_mul]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ 2 / (↑k + 1) * x ^ 2 = x / (↑k + 1) * (2 * x)
[PROOFSTEP]
ring
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ x / (↑k + 1) ≤ 1
[PROOFSTEP]
convert (div_le_one _).2 hx.2
[GOAL]
case h.e'_3.h.e'_6
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ ↑k + 1 = ↑(k + 1)
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ 0 < ↑(k + 1)
[PROOFSTEP]
norm_cast
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ 0 < ↑(k + 1)
[PROOFSTEP]
simp only [Nat.cast_add, Nat.cast_one]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ 0 < ↑k + 1
[PROOFSTEP]
linarith only [show (0 : ℝ) ≤ k from Nat.cast_nonneg k]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k ∈ range K
Ik : ↑k ≤ ↑(k + 1)
x : ℝ
hx : x ∈ Set.Ioc ↑k ↑(k + 1)
⊢ 1 * (2 * x) = 2 * x
[PROOFSTEP]
rw [one_mul]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∑ k in range K, ∫ (x : ℝ) in ↑k..↑(k + 1), 2 * x ∂ρ = 2 * ∫ (x : ℝ) in 0 ..↑K, x ∂ρ
[PROOFSTEP]
rw [intervalIntegral.sum_integral_adjacent_intervals fun k _ => ?_]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∫ (x : ℝ) in ↑0 ..↑K, 2 * x ∂ρ = 2 * ∫ (x : ℝ) in 0 ..↑K, x ∂ρ
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k < K
⊢ IntervalIntegrable (fun x => 2 * x) ρ ↑k ↑(k + 1)
[PROOFSTEP]
swap
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
k : ℕ
x✝ : k < K
⊢ IntervalIntegrable (fun x => 2 * x) ρ ↑k ↑(k + 1)
[PROOFSTEP]
exact (continuous_const.mul continuous_id').intervalIntegrable _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∫ (x : ℝ) in ↑0 ..↑K, 2 * x ∂ρ = 2 * ∫ (x : ℝ) in 0 ..↑K, x ∂ρ
[PROOFSTEP]
rw [intervalIntegral.integral_const_mul]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ 2 * ∫ (x : ℝ) in ↑0 ..↑K, x ∂ρ = 2 * ∫ (x : ℝ) in 0 ..↑K, x ∂ρ
[PROOFSTEP]
norm_cast
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∫ (x : ℝ) in 0 ..↑K, x ∂ρ ≤ ∫ (a : Ω), X a
[PROOFSTEP]
rw [← integral_truncation_eq_intervalIntegral_of_nonneg hint.1 hnonneg]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : Ω → ℝ
hint : Integrable X
hnonneg : 0 ≤ X
K : ℕ
Y : ℕ → Ω → ℝ := fun n => truncation X ↑n
ρ : Measure ℝ := Measure.map X ℙ
Y2 : ∀ (n : ℕ), ∫ (a : Ω), (Y n ^ 2) a = ∫ (x : ℝ) in 0 ..↑n, x ^ 2 ∂ρ
⊢ ∫ (x : Ω), truncation X (↑K) x ≤ ∫ (a : Ω), X a
[PROOFSTEP]
exact integral_truncation_le_integral_of_nonneg hint hnonneg
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
have c_pos : 0 < c := zero_lt_one.trans c_one
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
have hX : ∀ i, AEStronglyMeasurable (X i) ℙ := fun i => (hident i).symm.aestronglyMeasurable_snd hint.1
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
have A : ∀ i, StronglyMeasurable (indicator (Set.Ioc (-i : ℝ) i) id) := fun i =>
  stronglyMeasurable_id.indicator measurableSet_Ioc
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
set Y := fun n : ℕ => truncation (X n) n
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
set S := fun n => ∑ i in range n, Y i with hS
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
let u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
have u_mono : Monotone u := fun i j hij => Nat.floor_mono (pow_le_pow c_one.le hij)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
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)⁻¹ * 𝔼[truncation (X 0) j ^ 2] :=
      by
      apply sum_le_sum fun j _ => ?_
      refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (sq_nonneg _))
      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
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
⊢ ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
[PROOFSTEP]
intro K
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
K : ℕ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
[PROOFSTEP]
calc
  ∑ 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 _ => ?_
    refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (sq_nonneg _))
    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
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
K : ℕ
⊢ ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ ∑ j in range K, (↑j ^ 2)⁻¹ * ∫ (a : Ω), (truncation (X 0) ↑j ^ 2) a
[PROOFSTEP]
apply sum_le_sum fun j _ => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
K j : ℕ
x✝ : j ∈ range K
⊢ (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ (↑j ^ 2)⁻¹ * ∫ (a : Ω), (truncation (X 0) ↑j ^ 2) a
[PROOFSTEP]
refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (sq_nonneg _))
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
K j : ℕ
x✝ : j ∈ range K
⊢ variance (Y j) ℙ ≤ ∫ (a : Ω), (truncation (X 0) ↑j ^ 2) a
[PROOFSTEP]
rw [(hident j).truncation.variance_eq]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
K j : ℕ
x✝ : j ∈ range K
⊢ variance (truncation (X 0) ↑j) ℙ ≤ ∫ (a : Ω), (truncation (X 0) ↑j ^ 2) a
[PROOFSTEP]
exact variance_le_expectation_sq (hX 0).truncation
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
let C := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * 𝔼[X 0])
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
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)⁻¹ * ∑ j in range (u i), Var[Y j] :=
      by
      congr 1 with i
      congr 1
      rw [hS, IndepFun.variance_sum]
      · intro j _
        exact (hident j).aestronglyMeasurable_fst.memℒp_truncation
      · intro k _ l _ hkl
        exact (hindep hkl).comp (A k).measurable (A l).measurable
    _ = ∑ 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_pred_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
    _ ≤ ∑ 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, 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
      · 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, mul_assoc]
    _ ≤ c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * 𝔼[X 0]) :=
      by
      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)) _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
⊢ ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
[PROOFSTEP]
intro N
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
[PROOFSTEP]
calc
  ∑ 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
    congr 1
    rw [hS, IndepFun.variance_sum]
    · intro j _
      exact (hident j).aestronglyMeasurable_fst.memℒp_truncation
    · intro k _ l _ hkl
      exact (hindep hkl).comp (A k).measurable (A l).measurable
  _ = ∑ 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_pred_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
  _ ≤ ∑ 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, 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
    · 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, mul_assoc]
  _ ≤ c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * 𝔼[X 0]) :=
    by
    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)) _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ =
    ∑ i in range N, (↑(u i) ^ 2)⁻¹ * ∑ j in range (u i), variance (Y j) ℙ
[PROOFSTEP]
congr 1 with i
[GOAL]
case e_f.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i : ℕ
⊢ (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ = (↑(u i) ^ 2)⁻¹ * ∑ j in range (u i), variance (Y j) ℙ
[PROOFSTEP]
congr 1
[GOAL]
case e_f.h.e_a
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i : ℕ
⊢ variance (S (u i)) ℙ = ∑ j in range (u i), variance (Y j) ℙ
[PROOFSTEP]
rw [hS, IndepFun.variance_sum]
[GOAL]
case e_f.h.e_a.hs
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i : ℕ
⊢ ∀ (i_1 : ℕ), i_1 ∈ range (u i) → Memℒp (Y i_1) 2
[PROOFSTEP]
intro j _
[GOAL]
case e_f.h.e_a.hs
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
a✝ : j ∈ range (u i)
⊢ Memℒp (Y j) 2
[PROOFSTEP]
exact (hident j).aestronglyMeasurable_fst.memℒp_truncation
[GOAL]
case e_f.h.e_a.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i : ℕ
⊢ Set.Pairwise ↑(range (u i)) fun i j => IndepFun (Y i) (Y j)
[PROOFSTEP]
intro k _ l _ hkl
[GOAL]
case e_f.h.e_a.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i k : ℕ
a✝¹ : k ∈ ↑(range (u i))
l : ℕ
a✝ : l ∈ ↑(range (u i))
hkl : k ≠ l
⊢ IndepFun (Y k) (Y l)
[PROOFSTEP]
exact (hindep hkl).comp (A k).measurable (A l).measurable
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∑ i in range N, (↑(u i) ^ 2)⁻¹ * ∑ j in range (u i), variance (Y j) ℙ =
    ∑ j in range (u (N - 1)), (∑ i in filter (fun i => j < u i) (range N), (↑(u i) ^ 2)⁻¹) * variance (Y j) ℙ
[PROOFSTEP]
simp_rw [mul_sum, sum_mul, sum_sigma']
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∑ x in Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊,
      (↑⌊c ^ x.fst⌋₊ ^ 2)⁻¹ * variance (truncation (X x.snd) ↑x.snd) ℙ =
    ∑ x in Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N),
      (↑⌊c ^ x.snd⌋₊ ^ 2)⁻¹ * variance (truncation (X x.fst) ↑x.fst) ℙ
[PROOFSTEP]
refine'
  sum_bij' (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ (fun a _ => rfl)
    (fun (p : Σ _ : ℕ, ℕ) _ => (⟨p.2, p.1⟩ : Σ _ : ℕ, ℕ)) _ _ _
[GOAL]
case refine'_1
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊),
    (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈
      Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_1.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
    Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)
[PROOFSTEP]
simp only [mem_sigma, mem_range] at hij
[GOAL]
case refine'_1.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
hij✝ : { fst := i, snd := j } ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊
hij : i < N ∧ j < ⌊c ^ i⌋₊
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij✝ ∈
    Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)
[PROOFSTEP]
simp only [hij.1, hij.2, mem_sigma, mem_range, mem_filter, and_true_iff]
[GOAL]
case refine'_1.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
hij✝ : { fst := i, snd := j } ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊
hij : i < N ∧ j < ⌊c ^ i⌋₊
⊢ j < ⌊c ^ (N - 1)⌋₊
[PROOFSTEP]
exact hij.2.trans_le (u_mono (Nat.le_pred_of_lt hij.1))
[GOAL]
case refine'_2
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)),
    (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_2.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
    Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊
[PROOFSTEP]
simp only [mem_sigma, mem_range, mem_filter] at hij
[GOAL]
case refine'_2.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
hij✝ : { fst := i, snd := j } ∈ Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)
hij : i < ⌊c ^ (N - 1)⌋₊ ∧ j < N ∧ i < ⌊c ^ j⌋₊
⊢ (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij✝ ∈
    Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊
[PROOFSTEP]
simp only [hij.2.1, hij.2.2, mem_sigma, mem_range, and_self_iff]
[GOAL]
case refine'_3
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊),
    (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) a ha)
        (_ :
          (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈
            Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)) =
      a
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_3.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊
⊢ (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij)
      (_ :
        (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
          Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)) =
    { fst := i, snd := j }
[PROOFSTEP]
rfl
[GOAL]
case refine'_4
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∀ (a : (_ : ℕ) × ℕ) (ha : a ∈ Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)),
    (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) a ha)
        (_ : (fun p x => { fst := p.snd, snd := p.fst }) a ha ∈ Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊) =
      a
[PROOFSTEP]
rintro ⟨i, j⟩ hij
[GOAL]
case refine'_4.mk
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N i j : ℕ
hij : { fst := i, snd := j } ∈ Finset.sigma (range ⌊c ^ (N - 1)⌋₊) fun a => filter (fun i => a < ⌊c ^ i⌋₊) (range N)
⊢ (fun p x => { fst := p.snd, snd := p.fst }) ((fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij)
      (_ :
        (fun p x => { fst := p.snd, snd := p.fst }) { fst := i, snd := j } hij ∈
          Finset.sigma (range N) fun a => range ⌊c ^ a⌋₊) =
    { fst := i, snd := j }
[PROOFSTEP]
rfl
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∑ j in range (u (N - 1)), (∑ i in filter (fun i => j < u i) (range N), (↑(u i) ^ 2)⁻¹) * variance (Y j) ℙ ≤
    ∑ j in range (u (N - 1)), c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * variance (Y j) ℙ
[PROOFSTEP]
apply sum_le_sum fun j hj => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N j : ℕ
hj : j ∈ range (u (N - 1))
⊢ (∑ i in filter (fun i => j < u i) (range N), (↑(u i) ^ 2)⁻¹) * variance (Y j) ℙ ≤
    c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * variance (Y j) ℙ
[PROOFSTEP]
rcases@eq_zero_or_pos _ _ j with (rfl | hj)
[GOAL]
case inl
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
hj : 0 ∈ range (u (N - 1))
⊢ (∑ i in filter (fun i => 0 < u i) (range N), (↑(u i) ^ 2)⁻¹) * variance (Y 0) ℙ ≤
    c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑0 ^ 2 * variance (Y 0) ℙ
[PROOFSTEP]
simp only [Nat.cast_zero, zero_pow', Ne.def, bit0_eq_zero, Nat.one_ne_zero, not_false_iff, div_zero, zero_mul]
[GOAL]
case inl
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
hj : 0 ∈ range (u (N - 1))
⊢ (∑ x in filter (fun i => 0 < ⌊c ^ i⌋₊) (range N), (↑⌊c ^ x⌋₊ ^ 2)⁻¹) * variance (truncation (X 0) 0) ℙ ≤ 0
[PROOFSTEP]
simp only [Nat.cast_zero, truncation_zero, variance_zero, mul_zero, le_rfl]
[GOAL]
case inr
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N j : ℕ
hj✝ : j ∈ range (u (N - 1))
hj : 0 < j
⊢ (∑ i in filter (fun i => j < u i) (range N), (↑(u i) ^ 2)⁻¹) * variance (Y j) ℙ ≤
    c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * variance (Y j) ℙ
[PROOFSTEP]
apply mul_le_mul_of_nonneg_right _ (variance_nonneg _ _)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N j : ℕ
hj✝ : j ∈ range (u (N - 1))
hj : 0 < j
⊢ ∑ i in filter (fun i => j < u i) (range N), (↑(u i) ^ 2)⁻¹ ≤ c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2
[PROOFSTEP]
convert sum_div_nat_floor_pow_sq_le_div_sq N (Nat.cast_pos.2 hj) c_one using 2
[GOAL]
case h.e'_3.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N j : ℕ
hj✝ : j ∈ range (u (N - 1))
hj : 0 < j
⊢ filter (fun i => j < u i) (range N) = filter (fun x => ↑j < ↑⌊c ^ x⌋₊) (range N)
[PROOFSTEP]
simp only [Nat.cast_lt]
[GOAL]
case h.e'_3.a
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N j : ℕ
hj✝ : j ∈ range (u (N - 1))
hj : 0 < j
x✝ : ℕ
a✝ : x✝ ∈ filter (fun x => ↑j < ↑⌊c ^ x⌋₊) (range N)
⊢ (↑(u x✝) ^ 2)⁻¹ = 1 / ↑⌊c ^ x✝⌋₊ ^ 2
[PROOFSTEP]
simp only [one_div]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ ∑ j in range (u (N - 1)), c ^ 5 * (c - 1)⁻¹ ^ 3 / ↑j ^ 2 * variance (Y j) ℙ =
    c ^ 5 * (c - 1)⁻¹ ^ 3 * ∑ j in range (u (N - 1)), (↑j ^ 2)⁻¹ * variance (Y j) ℙ
[PROOFSTEP]
simp_rw [mul_sum, div_eq_mul_inv, mul_assoc]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ c ^ 5 * (c - 1)⁻¹ ^ 3 * ∑ j in range (u (N - 1)), (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤
    c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
[PROOFSTEP]
apply mul_le_mul_of_nonneg_left (I1 _)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ 0 ≤ c ^ 5 * (c - 1)⁻¹ ^ 3
[PROOFSTEP]
apply mul_nonneg (pow_nonneg c_pos.le _)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
N : ℕ
⊢ 0 ≤ (c - 1)⁻¹ ^ 3
[PROOFSTEP]
exact pow_nonneg (inv_nonneg.2 (sub_nonneg.2 c_one.le)) _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
have I3 : ∀ N, ∑ 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, ENNReal.ofReal (Var[S (u i)] / (u i * ε) ^ 2) :=
      by
      refine' sum_le_sum fun i _ => _
      apply meas_ge_le_variance_div_sq
      · exact memℒp_finset_sum' _ fun j _ => (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
        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) :=
      by
      rw [ENNReal.ofReal_sum_of_nonneg fun i _ => ?_]
      exact div_nonneg (variance_nonneg _ _) (sq_nonneg _)
    _ ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C) := by
      apply ENNReal.ofReal_le_ofReal
      conv_lhs =>
        enter [2, i]
        rw [div_eq_inv_mul, ← inv_pow, mul_inv, mul_comm _ ε⁻¹, mul_pow, mul_assoc]
      rw [← mul_sum]
      refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
      conv_lhs => enter [2, i]; rw [inv_pow]
      exact I2 N
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
⊢ ∀ (N : ℕ), ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
[PROOFSTEP]
intro N
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
[PROOFSTEP]
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) :=
    by
    refine' sum_le_sum fun i _ => _
    apply meas_ge_le_variance_div_sq
    · exact memℒp_finset_sum' _ fun j _ => (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
      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) :=
    by
    rw [ENNReal.ofReal_sum_of_nonneg fun i _ => ?_]
    exact div_nonneg (variance_nonneg _ _) (sq_nonneg _)
  _ ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C) := by
    apply ENNReal.ofReal_le_ofReal
    conv_lhs =>
      enter [2, i]
      rw [div_eq_inv_mul, ← inv_pow, mul_inv, mul_comm _ ε⁻¹, mul_pow, mul_assoc]
    rw [← mul_sum]
    refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
    conv_lhs => enter [2, i]; rw [inv_pow]
    exact I2 N
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤
    ∑ i in range N, ENNReal.ofReal (variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2)
[PROOFSTEP]
refine' sum_le_sum fun i _ => _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2)
[PROOFSTEP]
apply meas_ge_le_variance_div_sq
[GOAL]
case hX
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ Memℒp (fun ω => S (u i) ω) 2
[PROOFSTEP]
exact memℒp_finset_sum' _ fun j _ => (hident j).aestronglyMeasurable_fst.memℒp_truncation
[GOAL]
case hc
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ 0 < ↑(u i) * ε
[PROOFSTEP]
apply mul_pos (Nat.cast_pos.2 _) εpos
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ 0 < u i
[PROOFSTEP]
refine' zero_lt_one.trans_le _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ 1 ≤ u i
[PROOFSTEP]
apply Nat.le_floor
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ ↑1 ≤ c ^ i
[PROOFSTEP]
rw [Nat.cast_one]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ 1 ≤ c ^ i
[PROOFSTEP]
apply one_le_pow_of_one_le c_one.le
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ∑ i in range N, ENNReal.ofReal (variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2) =
    ENNReal.ofReal (∑ i in range N, variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2)
[PROOFSTEP]
rw [ENNReal.ofReal_sum_of_nonneg fun i _ => ?_]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
x✝ : i ∈ range N
⊢ 0 ≤ variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2
[PROOFSTEP]
exact div_nonneg (variance_nonneg _ _) (sq_nonneg _)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ENNReal.ofReal (∑ i in range N, variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2) ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
[PROOFSTEP]
apply ENNReal.ofReal_le_ofReal
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ∑ i in range N, variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2 ≤ ε⁻¹ ^ 2 * C
[PROOFSTEP]
conv_lhs =>
  enter [2, i]
  rw [div_eq_inv_mul, ← inv_pow, mul_inv, mul_comm _ ε⁻¹, mul_pow, mul_assoc]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
| ∑ i in range N, variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2
[PROOFSTEP]
  enter [2, i]
  rw [div_eq_inv_mul, ← inv_pow, mul_inv, mul_comm _ ε⁻¹, mul_pow, mul_assoc]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
| ∑ i in range N, variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2
[PROOFSTEP]
  enter [2, i]
  rw [div_eq_inv_mul, ← inv_pow, mul_inv, mul_comm _ ε⁻¹, mul_pow, mul_assoc]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
| ∑ i in range N, variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2
[PROOFSTEP]
enter [2, i]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
| variance (S (u i)) ℙ / (↑(u i) * ε) ^ 2
[PROOFSTEP]
rw [div_eq_inv_mul, ← inv_pow, mul_inv, mul_comm _ ε⁻¹, mul_pow, mul_assoc]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ∑ i in range N, ε⁻¹ ^ 2 * ((↑(u i))⁻¹ ^ 2 * variance (S (u i)) ℙ) ≤ ε⁻¹ ^ 2 * C
[PROOFSTEP]
rw [← mul_sum]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ε⁻¹ ^ 2 * ∑ x in range N, (↑(u x))⁻¹ ^ 2 * variance (S (u x)) ℙ ≤ ε⁻¹ ^ 2 * C
[PROOFSTEP]
refine' mul_le_mul_of_nonneg_left _ (sq_nonneg _)
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ∑ x in range N, (↑(u x))⁻¹ ^ 2 * variance (S (u x)) ℙ ≤ C
[PROOFSTEP]
conv_lhs => enter [2, i]; rw [inv_pow]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
| ∑ x in range N, (↑(u x))⁻¹ ^ 2 * variance (S (u x)) ℙ
[PROOFSTEP]
enter [2, i]; rw [inv_pow]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
| ∑ x in range N, (↑(u x))⁻¹ ^ 2 * variance (S (u x)) ℙ
[PROOFSTEP]
enter [2, i]; rw [inv_pow]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
| ∑ x in range N, (↑(u x))⁻¹ ^ 2 * variance (S (u x)) ℙ
[PROOFSTEP]
enter [2, i]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N i : ℕ
| (↑(u i))⁻¹ ^ 2 * variance (S (u i)) ℙ
[PROOFSTEP]
rw [inv_pow]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
N : ℕ
⊢ ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
[PROOFSTEP]
exact I2 N
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
I3 : ∀ (N : ℕ), ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
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
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
I3 : ∀ (N : ℕ), ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
I4 : ∑' (i : ℕ), ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} < ⊤
⊢ ∀ᵐ (ω : Ω),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) Y a| < ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
filter_upwards [ae_eventually_not_mem I4.ne] with ω hω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
I3 : ∀ (N : ℕ), ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
I4 : ∑' (i : ℕ), ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} < ⊤
ω : Ω
hω :
  ∀ᶠ (n : ℕ) in atTop,
    ¬↑⌊c ^ n⌋₊ * ε ≤
        |Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a|
⊢ ∀ᶠ (n : ℕ) in atTop,
    |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
          ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun n => truncation (X n) ↑n) a| <
      ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
simp_rw [not_le, mul_comm, sum_apply] at hω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
I3 : ∀ (N : ℕ), ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
I4 : ∑' (i : ℕ), ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} < ⊤
ω : Ω
hω :
  ∀ᶠ (n : ℕ) in atTop,
    |∑ c in range ⌊c ^ n⌋₊, truncation (X c) (↑c) ω - ∫ (a : Ω), ∑ c in range ⌊c ^ n⌋₊, truncation (X c) (↑c) a| <
      ε * ↑⌊c ^ n⌋₊
⊢ ∀ᶠ (n : ℕ) in atTop,
    |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
          ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun n => truncation (X n) ↑n) a| <
      ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
convert hω
[GOAL]
case h.e'_2.h.h.e'_3.h.e'_3.h.e'_6.h.e'_7.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ε : ℝ
εpos : 0 < ε
c_pos : 0 < c
hX : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
A : ∀ (i : ℝ), StronglyMeasurable (indicator (Set.Ioc (-i) i) id)
Y : ℕ → Ω → ℝ := fun n => truncation (X n) ↑n
S : ℕ → Ω → ℝ := fun n => ∑ i in range n, Y i
hS : S = fun n => ∑ i in range n, Y i
u : ℕ → ℕ := fun n => ⌊c ^ n⌋₊
u_mono : Monotone u
I1 : ∀ (K : ℕ), ∑ j in range K, (↑j ^ 2)⁻¹ * variance (Y j) ℙ ≤ 2 * ∫ (a : Ω), X 0 a
C : ℝ := c ^ 5 * (c - 1)⁻¹ ^ 3 * (2 * ∫ (a : Ω), X 0 a)
I2 : ∀ (N : ℕ), ∑ i in range N, (↑(u i) ^ 2)⁻¹ * variance (S (u i)) ℙ ≤ C
I3 : ∀ (N : ℕ), ∑ i in range N, ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} ≤ ENNReal.ofReal (ε⁻¹ ^ 2 * C)
I4 : ∑' (i : ℕ), ↑↑ℙ {ω | ↑(u i) * ε ≤ |S (u i) ω - ∫ (a : Ω), S (u i) a|} < ⊤
ω : Ω
hω :
  ∀ᶠ (n : ℕ) in atTop,
    |∑ c in range ⌊c ^ n⌋₊, truncation (X c) (↑c) ω - ∫ (a : Ω), ∑ c in range ⌊c ^ n⌋₊, truncation (X c) (↑c) a| <
      ε * ↑⌊c ^ n⌋₊
x✝¹ : ℕ
x✝ : Ω
⊢ Finset.sum (range ⌊c ^ x✝¹⌋₊) (fun n => truncation (X n) ↑n) x✝ = ∑ c in range ⌊c ^ x✝¹⌋₊, truncation (X c) (↑c) x✝
[PROOFSTEP]
simp only [sum_apply]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
⊢ ∀ᵐ (ω : Ω),
    (fun n =>
        ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
          ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
      fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
obtain ⟨v, -, v_pos, v_lim⟩ : ∃ v : ℕ → ℝ, StrictAnti v ∧ (∀ n : ℕ, 0 < v n) ∧ Tendsto v atTop (𝓝 0) :=
  exists_seq_strictAnti_tendsto (0 : ℝ)
[GOAL]
case intro.intro.intro
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
v : ℕ → ℝ
v_pos : ∀ (n : ℕ), 0 < v n
v_lim : Tendsto v atTop (𝓝 0)
⊢ ∀ᵐ (ω : Ω),
    (fun n =>
        ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
          ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
      fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
have := fun i => strong_law_aux1 X hint hindep hident hnonneg c_one (v_pos i)
[GOAL]
case intro.intro.intro
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
v : ℕ → ℝ
v_pos : ∀ (n : ℕ), 0 < v n
v_lim : Tendsto v atTop (𝓝 0)
this :
  ∀ (i : ℕ),
    ∀ᵐ (ω : Ω),
      ∀ᶠ (n : ℕ) in atTop,
        |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
              ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
          v i * ↑⌊c ^ n⌋₊
⊢ ∀ᵐ (ω : Ω),
    (fun n =>
        ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
          ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
      fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
filter_upwards [ae_all_iff.2 this] with ω hω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
v : ℕ → ℝ
v_pos : ∀ (n : ℕ), 0 < v n
v_lim : Tendsto v atTop (𝓝 0)
this :
  ∀ (i : ℕ),
    ∀ᵐ (ω : Ω),
      ∀ᶠ (n : ℕ) in atTop,
        |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
              ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
          v i * ↑⌊c ^ n⌋₊
ω : Ω
hω :
  ∀ (i : ℕ),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        v i * ↑⌊c ^ n⌋₊
⊢ (fun n =>
      ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
    fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
apply Asymptotics.isLittleO_iff.2 fun ε εpos => ?_
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
v : ℕ → ℝ
v_pos : ∀ (n : ℕ), 0 < v n
v_lim : Tendsto v atTop (𝓝 0)
this :
  ∀ (i : ℕ),
    ∀ᵐ (ω : Ω),
      ∀ᶠ (n : ℕ) in atTop,
        |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
              ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
          v i * ↑⌊c ^ n⌋₊
ω : Ω
hω :
  ∀ (i : ℕ),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        v i * ↑⌊c ^ n⌋₊
ε : ℝ
εpos : 0 < ε
⊢ ∀ᶠ (x : ℕ) in atTop,
    ‖∑ i in range ⌊c ^ x⌋₊, truncation (X i) (↑i) ω -
          ∫ (a : Ω), Finset.sum (range ⌊c ^ x⌋₊) (fun i => truncation (X i) ↑i) a‖ ≤
      ε * ‖↑⌊c ^ x⌋₊‖
[PROOFSTEP]
obtain ⟨i, hi⟩ : ∃ i, v i < ε := ((tendsto_order.1 v_lim).2 ε εpos).exists
[GOAL]
case intro
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
v : ℕ → ℝ
v_pos : ∀ (n : ℕ), 0 < v n
v_lim : Tendsto v atTop (𝓝 0)
this :
  ∀ (i : ℕ),
    ∀ᵐ (ω : Ω),
      ∀ᶠ (n : ℕ) in atTop,
        |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
              ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
          v i * ↑⌊c ^ n⌋₊
ω : Ω
hω :
  ∀ (i : ℕ),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        v i * ↑⌊c ^ n⌋₊
ε : ℝ
εpos : 0 < ε
i : ℕ
hi : v i < ε
⊢ ∀ᶠ (x : ℕ) in atTop,
    ‖∑ i in range ⌊c ^ x⌋₊, truncation (X i) (↑i) ω -
          ∫ (a : Ω), Finset.sum (range ⌊c ^ x⌋₊) (fun i => truncation (X i) ↑i) a‖ ≤
      ε * ‖↑⌊c ^ x⌋₊‖
[PROOFSTEP]
filter_upwards [hω i] with n hn
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
v : ℕ → ℝ
v_pos : ∀ (n : ℕ), 0 < v n
v_lim : Tendsto v atTop (𝓝 0)
this :
  ∀ (i : ℕ),
    ∀ᵐ (ω : Ω),
      ∀ᶠ (n : ℕ) in atTop,
        |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
              ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
          v i * ↑⌊c ^ n⌋₊
ω : Ω
hω :
  ∀ (i : ℕ),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        v i * ↑⌊c ^ n⌋₊
ε : ℝ
εpos : 0 < ε
i : ℕ
hi : v i < ε
n : ℕ
hn :
  |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
    v i * ↑⌊c ^ n⌋₊
⊢ ‖∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a‖ ≤
    ε * ‖↑⌊c ^ n⌋₊‖
[PROOFSTEP]
simp only [Real.norm_eq_abs, LatticeOrderedGroup.abs_abs, Nat.abs_cast]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
v : ℕ → ℝ
v_pos : ∀ (n : ℕ), 0 < v n
v_lim : Tendsto v atTop (𝓝 0)
this :
  ∀ (i : ℕ),
    ∀ᵐ (ω : Ω),
      ∀ᶠ (n : ℕ) in atTop,
        |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
              ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
          v i * ↑⌊c ^ n⌋₊
ω : Ω
hω :
  ∀ (i : ℕ),
    ∀ᶠ (n : ℕ) in atTop,
      |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
            ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
        v i * ↑⌊c ^ n⌋₊
ε : ℝ
εpos : 0 < ε
i : ℕ
hi : v i < ε
n : ℕ
hn :
  |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| <
    v i * ↑⌊c ^ n⌋₊
⊢ |∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a| ≤
    ε * ↑⌊c ^ n⌋₊
[PROOFSTEP]
exact hn.le.trans (mul_le_mul_of_nonneg_right hi.le (Nat.cast_nonneg _))
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
⊢ (fun n => (∫ (a : Ω), Finset.sum (range n) (fun i => truncation (X i) ↑i) a) - ↑n * ∫ (a : Ω), X 0 a) =o[atTop]
    Nat.cast
[PROOFSTEP]
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
  ext i
  exact (hident i).truncation.integral_eq
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
⊢ Tendsto (fun i => ∫ (a : Ω), truncation (X i) (↑i) a) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
convert (tendsto_integral_truncation hint).comp tendsto_nat_cast_atTop_atTop using 1
[GOAL]
case h.e'_3
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
⊢ (fun i => ∫ (a : Ω), truncation (X i) (↑i) a) = (fun A => ∫ (x : Ω), truncation (X 0) A x) ∘ Nat.cast
[PROOFSTEP]
ext i
[GOAL]
case h.e'_3.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
i : ℕ
⊢ ∫ (a : Ω), truncation (X i) (↑i) a = ((fun A => ∫ (x : Ω), truncation (X 0) A x) ∘ Nat.cast) i
[PROOFSTEP]
exact (hident i).truncation.integral_eq
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : Tendsto (fun i => ∫ (a : Ω), truncation (X i) (↑i) a) atTop (𝓝 (∫ (a : Ω), X 0 a))
⊢ (fun n => (∫ (a : Ω), Finset.sum (range n) (fun i => truncation (X i) ↑i) a) - ↑n * ∫ (a : Ω), X 0 a) =o[atTop]
    Nat.cast
[PROOFSTEP]
convert Asymptotics.isLittleO_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 A) using 1
[GOAL]
case h.e'_7
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : Tendsto (fun i => ∫ (a : Ω), truncation (X i) (↑i) a) atTop (𝓝 (∫ (a : Ω), X 0 a))
⊢ (fun n => (∫ (a : Ω), Finset.sum (range n) (fun i => truncation (X i) ↑i) a) - ↑n * ∫ (a : Ω), X 0 a) = fun n =>
    ∑ i in range n, ((∫ (a : Ω), truncation (X i) (↑i) a) - ∫ (a : Ω), X 0 a)
[PROOFSTEP]
ext1 n
[GOAL]
case h.e'_7.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : Tendsto (fun i => ∫ (a : Ω), truncation (X i) (↑i) a) atTop (𝓝 (∫ (a : Ω), X 0 a))
n : ℕ
⊢ (∫ (a : Ω), Finset.sum (range n) (fun i => truncation (X i) ↑i) a) - ↑n * ∫ (a : Ω), X 0 a =
    ∑ i in range n, ((∫ (a : Ω), truncation (X i) (↑i) a) - ∫ (a : Ω), X 0 a)
[PROOFSTEP]
simp only [sum_sub_distrib, sum_const, card_range, nsmul_eq_mul, sum_apply, sub_left_inj]
[GOAL]
case h.e'_7.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : Tendsto (fun i => ∫ (a : Ω), truncation (X i) (↑i) a) atTop (𝓝 (∫ (a : Ω), X 0 a))
n : ℕ
⊢ ∫ (a : Ω), ∑ c in range n, truncation (X c) (↑c) a = ∑ x in range n, ∫ (a : Ω), truncation (X x) (↑x) a
[PROOFSTEP]
rw [integral_finset_sum _ fun i _ => ?_]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : Tendsto (fun i => ∫ (a : Ω), truncation (X i) (↑i) a) atTop (𝓝 (∫ (a : Ω), X 0 a))
n i : ℕ
x✝ : i ∈ range n
⊢ Integrable fun a => truncation (X i) (↑i) a
[PROOFSTEP]
exact ((hident i).symm.integrable_snd hint).1.integrable_truncation
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
⊢ ∀ᵐ (ω : Ω),
    (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n =>
      ↑⌊c ^ n⌋₊
[PROOFSTEP]
filter_upwards [strong_law_aux2 X hint hindep hident hnonneg c_one] with ω hω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ω : Ω
hω :
  (fun n =>
      ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
    fun n => ↑⌊c ^ n⌋₊
⊢ (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
have A : Tendsto (fun n : ℕ => ⌊c ^ n⌋₊) atTop atTop :=
  tendsto_nat_floor_atTop.comp (tendsto_pow_atTop_atTop_of_one_lt c_one)
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ω : Ω
hω :
  (fun n =>
      ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
    fun n => ↑⌊c ^ n⌋₊
A : Tendsto (fun n => ⌊c ^ n⌋₊) atTop atTop
⊢ (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
convert hω.add ((strong_law_aux3 X hint hident).comp_tendsto A) using 1
[GOAL]
case h.e'_7
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ω : Ω
hω :
  (fun n =>
      ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
    fun n => ↑⌊c ^ n⌋₊
A : Tendsto (fun n => ⌊c ^ n⌋₊) atTop atTop
⊢ (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) = fun x =>
    (∑ i in range ⌊c ^ x⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ x⌋₊) (fun i => truncation (X i) ↑i) a) +
      ((fun n => (∫ (a : Ω), Finset.sum (range n) (fun i => truncation (X i) ↑i) a) - ↑n * ∫ (a : Ω), X 0 a) ∘ fun n =>
          ⌊c ^ n⌋₊)
        x
[PROOFSTEP]
ext1 n
[GOAL]
case h.e'_7.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
ω : Ω
hω :
  (fun n =>
      ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) =o[atTop]
    fun n => ↑⌊c ^ n⌋₊
A : Tendsto (fun n => ⌊c ^ n⌋₊) atTop atTop
n : ℕ
⊢ ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a =
    (∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω -
        ∫ (a : Ω), Finset.sum (range ⌊c ^ n⌋₊) (fun i => truncation (X i) ↑i) a) +
      ((fun n => (∫ (a : Ω), Finset.sum (range n) (fun i => truncation (X i) ↑i) a) - ↑n * ∫ (a : Ω), X 0 a) ∘ fun n =>
          ⌊c ^ n⌋₊)
        n
[PROOFSTEP]
simp
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
⊢ ∀ᵐ (ω : Ω), (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
[PROOFSTEP]
have A : (∑' j : ℕ, ℙ {ω | X j ω ∈ Set.Ioi (j : ℝ)}) < ∞ :=
  by
  convert tsum_prob_mem_Ioi_lt_top hint (hnonneg 0) using 2
  ext1 j
  exact (hident j).measure_mem_eq measurableSet_Ioi
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
⊢ ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
[PROOFSTEP]
convert tsum_prob_mem_Ioi_lt_top hint (hnonneg 0) using 2
[GOAL]
case h.e'_3.h.e'_5
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
⊢ (fun j => ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j}) = fun j => ↑↑ℙ {ω | X 0 ω ∈ Set.Ioi ↑j}
[PROOFSTEP]
ext1 j
[GOAL]
case h.e'_3.h.e'_5.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
j : ℕ
⊢ ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} = ↑↑ℙ {ω | X 0 ω ∈ Set.Ioi ↑j}
[PROOFSTEP]
exact (hident j).measure_mem_eq measurableSet_Ioi
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
⊢ ∀ᵐ (ω : Ω), (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
[PROOFSTEP]
have B : ∀ᵐ ω, Tendsto (fun n : ℕ => truncation (X n) n ω - X n ω) atTop (𝓝 0) :=
  by
  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]
  split_ifs with h
  · exact (sub_self _).symm
  · 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
    exact (hn h).elim
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
[PROOFSTEP]
filter_upwards [ae_eventually_not_mem A.ne] with ω hω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
⊢ Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
[PROOFSTEP]
apply tendsto_const_nhds.congr' _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
⊢ (fun x => 0) =ᶠ[atTop] fun n => truncation (X n) (↑n) ω - X n ω
[PROOFSTEP]
filter_upwards [hω, Ioi_mem_atTop 0] with n hn npos
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
⊢ 0 = truncation (X n) (↑n) ω - X n ω
[PROOFSTEP]
simp only [truncation, indicator, Set.mem_Ioc, id.def, Function.comp_apply]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
⊢ 0 = (if -↑n < X n ω ∧ X n ω ≤ ↑n then X n ω else 0) - X n ω
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
h : -↑n < X n ω ∧ X n ω ≤ ↑n
⊢ 0 = X n ω - X n ω
[PROOFSTEP]
exact (sub_self _).symm
[GOAL]
case neg
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
h : ¬(-↑n < X n ω ∧ X n ω ≤ ↑n)
⊢ 0 = 0 - X n ω
[PROOFSTEP]
have : -(n : ℝ) < X n ω := by
  apply lt_of_lt_of_le _ (hnonneg n ω)
  simpa only [Right.neg_neg_iff, Nat.cast_pos] using npos
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
h : ¬(-↑n < X n ω ∧ X n ω ≤ ↑n)
⊢ -↑n < X n ω
[PROOFSTEP]
apply lt_of_lt_of_le _ (hnonneg n ω)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
h : ¬(-↑n < X n ω ∧ X n ω ≤ ↑n)
⊢ -↑n < 0
[PROOFSTEP]
simpa only [Right.neg_neg_iff, Nat.cast_pos] using npos
[GOAL]
case neg
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
h : ¬(-↑n < X n ω ∧ X n ω ≤ ↑n)
this : -↑n < X n ω
⊢ 0 = 0 - X n ω
[PROOFSTEP]
simp only [this, true_and_iff, not_le] at h
[GOAL]
case neg
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
ω : Ω
hω : ∀ᶠ (n : ℕ) in atTop, ¬X n ω ∈ Set.Ioi ↑n
n : ℕ
hn : ¬X n ω ∈ Set.Ioi ↑n
npos : n ∈ Set.Ioi 0
this : -↑n < X n ω
h : ↑n < X n ω
⊢ 0 = 0 - X n ω
[PROOFSTEP]
exact (hn h).elim
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
B : ∀ᵐ (ω : Ω), Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
⊢ ∀ᵐ (ω : Ω), (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
[PROOFSTEP]
filter_upwards [B] with ω hω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
B : ∀ᵐ (ω : Ω), Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
ω : Ω
hω : Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
⊢ (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
[PROOFSTEP]
convert isLittleO_sum_range_of_tendsto_zero hω using 1
[GOAL]
case h.e'_7
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
B : ∀ᵐ (ω : Ω), Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
ω : Ω
hω : Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
⊢ (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) = fun n =>
    ∑ i in range n, (truncation (X i) (↑i) ω - X i ω)
[PROOFSTEP]
ext n
[GOAL]
case h.e'_7.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
A : ∑' (j : ℕ), ↑↑ℙ {ω | X j ω ∈ Set.Ioi ↑j} < ⊤
B : ∀ᵐ (ω : Ω), Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
ω : Ω
hω : Tendsto (fun n => truncation (X n) (↑n) ω - X n ω) atTop (𝓝 0)
n : ℕ
⊢ ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω = ∑ i in range n, (truncation (X i) (↑i) ω - X i ω)
[PROOFSTEP]
rw [sum_sub_distrib]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range ⌊c ^ n⌋₊, X i ω) / ↑⌊c ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
have H : ∀ n : ℕ, (0 : ℝ) < ⌊c ^ n⌋₊ := by
  intro n
  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]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
⊢ ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
[PROOFSTEP]
intro n
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
n : ℕ
⊢ 0 < ↑⌊c ^ n⌋₊
[PROOFSTEP]
refine' zero_lt_one.trans_le _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
n : ℕ
⊢ 1 ≤ ↑⌊c ^ n⌋₊
[PROOFSTEP]
simp only [Nat.one_le_cast, Nat.one_le_floor_iff, one_le_pow_of_one_le c_one.le n]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range ⌊c ^ n⌋₊, X i ω) / ↑⌊c ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
filter_upwards [strong_law_aux4 X hint hindep hident hnonneg c_one, strong_law_aux5 X hint hident hnonneg] with ω hω h'ω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
⊢ Tendsto (fun n => (∑ i in range ⌊c ^ n⌋₊, X i ω) / ↑⌊c ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
⊢ (fun n => (∑ i in range ⌊c ^ n⌋₊, X i ω) / ↑⌊c ^ n⌋₊ - ∫ (a : Ω), X 0 a) =o[atTop] fun _x => 1
[PROOFSTEP]
have L : (fun n : ℕ => ∑ i in range ⌊c ^ n⌋₊, X i ω - ⌊c ^ n⌋₊ * 𝔼[X 0]) =o[atTop] fun n => (⌊c ^ n⌋₊ : ℝ) :=
  by
  have A : Tendsto (fun n : ℕ => ⌊c ^ n⌋₊) atTop atTop :=
    tendsto_nat_floor_atTop.comp (tendsto_pow_atTop_atTop_of_one_lt c_one)
  convert hω.sub (h'ω.comp_tendsto A) using 1
  ext1 n
  simp only [Function.comp_apply, sub_sub_sub_cancel_left]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
⊢ (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
have A : Tendsto (fun n : ℕ => ⌊c ^ n⌋₊) atTop atTop :=
  tendsto_nat_floor_atTop.comp (tendsto_pow_atTop_atTop_of_one_lt c_one)
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
A : Tendsto (fun n => ⌊c ^ n⌋₊) atTop atTop
⊢ (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
[PROOFSTEP]
convert hω.sub (h'ω.comp_tendsto A) using 1
[GOAL]
case h.e'_7
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
A : Tendsto (fun n => ⌊c ^ n⌋₊) atTop atTop
⊢ (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) = fun x =>
    (∑ i in range ⌊c ^ x⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ x⌋₊ * ∫ (a : Ω), X 0 a) -
      ((fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) ∘ fun n => ⌊c ^ n⌋₊) x
[PROOFSTEP]
ext1 n
[GOAL]
case h.e'_7.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
A : Tendsto (fun n => ⌊c ^ n⌋₊) atTop atTop
n : ℕ
⊢ ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a =
    (∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) -
      ((fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) ∘ fun n => ⌊c ^ n⌋₊) n
[PROOFSTEP]
simp only [Function.comp_apply, sub_sub_sub_cancel_left]
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
L : (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
⊢ (fun n => (∑ i in range ⌊c ^ n⌋₊, X i ω) / ↑⌊c ^ n⌋₊ - ∫ (a : Ω), X 0 a) =o[atTop] fun _x => 1
[PROOFSTEP]
convert L.mul_isBigO (isBigO_refl (fun n : ℕ => (⌊c ^ n⌋₊ : ℝ)⁻¹) atTop) using 1
[GOAL]
case h.e'_7
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
L : (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
⊢ (fun n => (∑ i in range ⌊c ^ n⌋₊, X i ω) / ↑⌊c ^ n⌋₊ - ∫ (a : Ω), X 0 a) = fun x =>
    (∑ i in range ⌊c ^ x⌋₊, X i ω - ↑⌊c ^ x⌋₊ * ∫ (a : Ω), X 0 a) * (↑⌊c ^ x⌋₊)⁻¹
[PROOFSTEP]
ext1 n
[GOAL]
case h.e'_7.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
L : (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
n : ℕ
⊢ (∑ i in range ⌊c ^ n⌋₊, X i ω) / ↑⌊c ^ n⌋₊ - ∫ (a : Ω), X 0 a =
    (∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) * (↑⌊c ^ n⌋₊)⁻¹
[PROOFSTEP]
field_simp [(H n).ne']
[GOAL]
case h.e'_8
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
L : (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
⊢ (fun _x => 1) = fun x => ↑⌊c ^ x⌋₊ * (↑⌊c ^ x⌋₊)⁻¹
[PROOFSTEP]
ext1 n
[GOAL]
case h.e'_8.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℝ
c_one : 1 < c
H : ∀ (n : ℕ), 0 < ↑⌊c ^ n⌋₊
ω : Ω
hω :
  (fun n => ∑ i in range ⌊c ^ n⌋₊, truncation (X i) (↑i) ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
h'ω : (fun n => ∑ i in range n, truncation (X i) (↑i) ω - ∑ i in range n, X i ω) =o[atTop] fun n => ↑n
L : (fun n => ∑ i in range ⌊c ^ n⌋₊, X i ω - ↑⌊c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[atTop] fun n => ↑⌊c ^ n⌋₊
n : ℕ
⊢ 1 = ↑⌊c ^ n⌋₊ * (↑⌊c ^ n⌋₊)⁻¹
[PROOFSTEP]
field_simp [(H n).ne']
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
obtain ⟨c, -, cone, clim⟩ : ∃ c : ℕ → ℝ, StrictAnti c ∧ (∀ n : ℕ, 1 < c n) ∧ Tendsto c atTop (𝓝 1) :=
  exists_seq_strictAnti_tendsto (1 : ℝ)
[GOAL]
case intro.intro.intro
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℕ → ℝ
cone : ∀ (n : ℕ), 1 < c n
clim : Tendsto c atTop (𝓝 1)
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
have : ∀ k, ∀ᵐ ω, Tendsto (fun n : ℕ => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ⌊c k ^ n⌋₊) atTop (𝓝 𝔼[X 0]) := fun k =>
  strong_law_aux6 X hint hindep hident hnonneg (cone k)
[GOAL]
case intro.intro.intro
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℕ → ℝ
cone : ∀ (n : ℕ), 1 < c n
clim : Tendsto c atTop (𝓝 1)
this :
  ∀ (k : ℕ), ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ↑⌊c k ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
filter_upwards [ae_all_iff.2 this] with ω hω
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℕ → ℝ
cone : ∀ (n : ℕ), 1 < c n
clim : Tendsto c atTop (𝓝 1)
this :
  ∀ (k : ℕ), ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ↑⌊c k ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
ω : Ω
hω : ∀ (i : ℕ), Tendsto (fun n => (∑ i in range ⌊c i ^ n⌋₊, X i ω) / ↑⌊c i ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
⊢ Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
apply tendsto_div_of_monotone_of_tendsto_div_floor_pow _ _ _ c cone clim _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℕ → ℝ
cone : ∀ (n : ℕ), 1 < c n
clim : Tendsto c atTop (𝓝 1)
this :
  ∀ (k : ℕ), ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ↑⌊c k ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
ω : Ω
hω : ∀ (i : ℕ), Tendsto (fun n => (∑ i in range ⌊c i ^ n⌋₊, X i ω) / ↑⌊c i ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
⊢ Monotone fun n => ∑ i in range n, X i ω
[PROOFSTEP]
intro m n hmn
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℕ → ℝ
cone : ∀ (n : ℕ), 1 < c n
clim : Tendsto c atTop (𝓝 1)
this :
  ∀ (k : ℕ), ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ↑⌊c k ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
ω : Ω
hω : ∀ (i : ℕ), Tendsto (fun n => (∑ i in range ⌊c i ^ n⌋₊, X i ω) / ↑⌊c i ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
m n : ℕ
hmn : m ≤ n
⊢ (fun n => ∑ i in range n, X i ω) m ≤ (fun n => ∑ i in range n, X i ω) n
[PROOFSTEP]
exact sum_le_sum_of_subset_of_nonneg (range_mono hmn) fun i _ _ => hnonneg i ω
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 ω
c : ℕ → ℝ
cone : ∀ (n : ℕ), 1 < c n
clim : Tendsto c atTop (𝓝 1)
this :
  ∀ (k : ℕ), ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ↑⌊c k ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
ω : Ω
hω : ∀ (i : ℕ), Tendsto (fun n => (∑ i in range ⌊c i ^ n⌋₊, X i ω) / ↑⌊c i ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
⊢ ∀ (k : ℕ), Tendsto (fun n => (∑ i in range ⌊c k ^ n⌋₊, X i ω) / ↑⌊c k ^ n⌋₊) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
exact hω
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
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 (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
let pos : ℝ → ℝ := fun x => max x 0
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
let neg : ℝ → ℝ := fun x => max (-x) 0
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
have posm : Measurable pos := measurable_id'.max measurable_const
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
posm : Measurable pos
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
have negm : Measurable neg := measurable_id'.neg.max measurable_const
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
posm : Measurable pos
negm : Measurable neg
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
have A : ∀ᵐ ω, Tendsto (fun n : ℕ => (∑ i in range n, (pos ∘ X i) ω) / n) atTop (𝓝 𝔼[pos ∘ X 0]) :=
  strong_law_aux7 _ hint.pos_part (fun i j hij => (hindep hij).comp posm posm) (fun i => (hident i).comp posm)
    fun i ω => le_max_right _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
posm : Measurable pos
negm : Measurable neg
A : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (pos ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (pos ∘ X 0) a))
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
have B : ∀ᵐ ω, Tendsto (fun n : ℕ => (∑ i in range n, (neg ∘ X i) ω) / n) atTop (𝓝 𝔼[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 _ _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
posm : Measurable pos
negm : Measurable neg
A : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (pos ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (pos ∘ X 0) a))
B : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (neg ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (neg ∘ X 0) a))
⊢ ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
filter_upwards [A, B] with ω hωpos hωneg
[GOAL]
case h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
posm : Measurable pos
negm : Measurable neg
A : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (pos ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (pos ∘ X 0) a))
B : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (neg ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (neg ∘ X 0) a))
ω : Ω
hωpos :
  Tendsto (fun n => (∑ i in range n, ((fun x => max x 0) ∘ X i) ω) / ↑n) atTop
    (𝓝 (∫ (a : Ω), ((fun x => max x 0) ∘ X 0) a))
hωneg :
  Tendsto (fun n => (∑ i in range n, ((fun x => max (-x) 0) ∘ X i) ω) / ↑n) atTop
    (𝓝 (∫ (a : Ω), ((fun x => max (-x) 0) ∘ X 0) a))
⊢ Tendsto (fun n => (∑ i in range n, X i ω) / ↑n) atTop (𝓝 (∫ (a : Ω), X 0 a))
[PROOFSTEP]
convert hωpos.sub hωneg using 1
[GOAL]
case h.e'_3
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
posm : Measurable pos
negm : Measurable neg
A : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (pos ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (pos ∘ X 0) a))
B : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (neg ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (neg ∘ X 0) a))
ω : Ω
hωpos :
  Tendsto (fun n => (∑ i in range n, ((fun x => max x 0) ∘ X i) ω) / ↑n) atTop
    (𝓝 (∫ (a : Ω), ((fun x => max x 0) ∘ X 0) a))
hωneg :
  Tendsto (fun n => (∑ i in range n, ((fun x => max (-x) 0) ∘ X i) ω) / ↑n) atTop
    (𝓝 (∫ (a : Ω), ((fun x => max (-x) 0) ∘ X 0) a))
⊢ (fun n => (∑ i in range n, X i ω) / ↑n) = fun x =>
    (∑ i in range x, ((fun x => max x 0) ∘ X i) ω) / ↑x - (∑ i in range x, ((fun x => max (-x) 0) ∘ X i) ω) / ↑x
[PROOFSTEP]
simp only [← sub_div, ← sum_sub_distrib, max_zero_sub_max_neg_zero_eq_self, Function.comp_apply]
[GOAL]
case h.e'_5
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
X : ℕ → Ω → ℝ
hint : Integrable (X 0)
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
pos : ℝ → ℝ := fun x => max x 0
neg : ℝ → ℝ := fun x => max (-x) 0
posm : Measurable pos
negm : Measurable neg
A : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (pos ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (pos ∘ X 0) a))
B : ∀ᵐ (ω : Ω), Tendsto (fun n => (∑ i in range n, (neg ∘ X i) ω) / ↑n) atTop (𝓝 (∫ (a : Ω), (neg ∘ X 0) a))
ω : Ω
hωpos :
  Tendsto (fun n => (∑ i in range n, ((fun x => max x 0) ∘ X i) ω) / ↑n) atTop
    (𝓝 (∫ (a : Ω), ((fun x => max x 0) ∘ X 0) a))
hωneg :
  Tendsto (fun n => (∑ i in range n, ((fun x => max (-x) 0) ∘ X i) ω) / ↑n) atTop
    (𝓝 (∫ (a : Ω), ((fun x => max (-x) 0) ∘ X 0) a))
⊢ 𝓝 (∫ (a : Ω), X 0 a) = 𝓝 ((∫ (a : Ω), ((fun x => max x 0) ∘ X 0) a) - ∫ (a : Ω), ((fun x => max (-x) 0) ∘ X 0) a)
[PROOFSTEP]
simp only [← integral_sub hint.pos_part hint.neg_part, max_zero_sub_max_neg_zero_eq_self, Function.comp_apply]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
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 - ∫ (a : Ω), X 0 a) p ℙ) atTop (𝓝 0)
[PROOFSTEP]
have hmeas : ∀ i, AEStronglyMeasurable (X i) ℙ := fun i => (hident i).aestronglyMeasurable_iff.2 hℒp.1
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
⊢ Tendsto (fun n => snorm (fun ω => (∑ i in range n, X i ω) / ↑n - ∫ (a : Ω), X 0 a) p ℙ) atTop (𝓝 0)
[PROOFSTEP]
have hint : Integrable (X 0) ℙ := hℒp.integrable hp
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
⊢ Tendsto (fun n => snorm (fun ω => (∑ i in range n, X i ω) / ↑n - ∫ (a : Ω), X 0 a) p ℙ) atTop (𝓝 0)
[PROOFSTEP]
have havg : ∀ n, AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / n) ℙ :=
  by
  intro n
  simp_rw [div_eq_mul_inv]
  exact AEStronglyMeasurable.mul_const (aestronglyMeasurable_sum _ fun i _ => hmeas i) _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
⊢ ∀ (n : ℕ), AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / ↑n) ℙ
[PROOFSTEP]
intro n
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
n : ℕ
⊢ AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / ↑n) ℙ
[PROOFSTEP]
simp_rw [div_eq_mul_inv]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
n : ℕ
⊢ AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) * (↑n)⁻¹) ℙ
[PROOFSTEP]
exact AEStronglyMeasurable.mul_const (aestronglyMeasurable_sum _ fun i _ => hmeas i) _
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
havg : ∀ (n : ℕ), AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / ↑n) ℙ
⊢ Tendsto (fun n => snorm (fun ω => (∑ i in range n, X i ω) / ↑n - ∫ (a : Ω), X 0 a) p ℙ) atTop (𝓝 0)
[PROOFSTEP]
refine'
  tendsto_Lp_of_tendstoInMeasure _ hp hp' havg (memℒp_const _) _
    (tendstoInMeasure_of_tendsto_ae havg (strong_law_ae _ hint hindep hident))
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
havg : ∀ (n : ℕ), AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / ↑n) ℙ
⊢ UnifIntegrable (fun n ω => (∑ i in range n, X i ω) / ↑n) p ℙ
[PROOFSTEP]
rw [(_ : (fun n ω => (∑ i in range n, X i ω) / ↑n) = fun n => (∑ i in range n, X i) / ↑n)]
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
havg : ∀ (n : ℕ), AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / ↑n) ℙ
⊢ UnifIntegrable (fun n => (∑ i in range n, X i) / ↑n) p ℙ
[PROOFSTEP]
exact (uniformIntegrable_average hp <| Memℒp.uniformIntegrable_of_identDistrib hp hp' hℒp hident).2.1
[GOAL]
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
havg : ∀ (n : ℕ), AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / ↑n) ℙ
⊢ (fun n ω => (∑ i in range n, X i ω) / ↑n) = fun n => (∑ i in range n, X i) / ↑n
[PROOFSTEP]
ext n ω
[GOAL]
case h.h
Ω : Type u_1
inst✝¹ : MeasureSpace Ω
inst✝ : IsProbabilityMeasure ℙ
p : ℝ≥0∞
hp : 1 ≤ p
hp' : p ≠ ⊤
X : ℕ → Ω → ℝ
hℒp : Memℒp (X 0) p
hindep : Pairwise fun i j => IndepFun (X i) (X j)
hident : ∀ (i : ℕ), IdentDistrib (X i) (X 0)
hmeas : ∀ (i : ℕ), AEStronglyMeasurable (X i) ℙ
hint : Integrable (X 0)
havg : ∀ (n : ℕ), AEStronglyMeasurable (fun ω => (∑ i in range n, X i ω) / ↑n) ℙ
n : ℕ
ω : Ω
⊢ (∑ i in range n, X i ω) / ↑n = ((∑ i in range n, X i) / ↑n) ω
[PROOFSTEP]
simp only [Pi.coe_nat, Pi.div_apply, sum_apply]