probability.martingale.borel_cantelliMathlib.Probability.Martingale.BorelCantelli

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -161,7 +161,7 @@ theorem Submartingale.stoppedValue_leastGE_snorm_le [IsFiniteMeasure μ] (hf : S
     snorm_one_le_of_le' ((hf.stopped_value_least_ge r).Integrable _) _
       (norm_stopped_value_least_ge_le hr hf0 hbdd i)
   rw [← integral_univ]
-  refine' le_trans _ ((hf.stopped_value_least_ge r).set_integral_le (zero_le _) MeasurableSet.univ)
+  refine' le_trans _ ((hf.stopped_value_least_ge r).setIntegral_le (zero_le _) MeasurableSet.univ)
   simp_rw [stopped_value, least_ge, hitting_of_le le_rfl, hf0, integral_zero']
 #align measure_theory.submartingale.stopped_value_least_ge_snorm_le MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le
 -/
Diff
@@ -92,7 +92,7 @@ theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : 
     · simp only [hitting, if_neg h]
   · rw [min_eq_right (not_le.1 hle).le, least_ge, least_ge, ←
       hitting_eq_hitting_of_exists (hπn ω) _]
-    rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle 
+    rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle
     exact
       let ⟨j, hj₁, hj₂⟩ := hle
       ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
@@ -147,7 +147,7 @@ theorem norm_stoppedValue_leastGE_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
   · obtain ⟨k, hk⟩ := Nat.exists_eq_succ_of_ne_zero HEq
     rw [hk, add_comm, ← sub_le_iff_le_add]
     have := not_mem_of_lt_hitting (hk.symm ▸ k.lt_succ_self : k < least_ge f r i ω) (zero_le _)
-    simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, not_or, not_le] at this 
+    simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, not_or, not_le] at this
     exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _))
 #align measure_theory.norm_stopped_value_least_ge_le MeasureTheory.norm_stoppedValue_leastGE_le
 -/
@@ -191,7 +191,7 @@ theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ]
       submartingale.exists_ae_tendsto_of_bdd (hf.stopped_value_least_ge i)
         (hf.stopped_value_least_ge_snorm_le' i.cast_nonneg hf0 hbdd)
   filter_upwards [ht] with ω hω hωb
-  rw [BddAbove] at hωb 
+  rw [BddAbove] at hωb
   obtain ⟨i, hi⟩ := exists_nat_gt hωb.some
   have hib : ∀ n, f n ω < i := by
     intro n
@@ -297,11 +297,11 @@ theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf :
       simp only [neg_neg, Pi.neg_apply]
   rw [hω₁, this, ← hω₂]
   constructor <;> rintro ⟨c, hc⟩ <;> refine' ⟨-c, fun ω hω => _⟩
-  · rw [mem_upperBounds] at hc 
+  · rw [mem_upperBounds] at hc
     refine' neg_le.2 (hc _ _)
     simpa only [Pi.neg_apply, Set.mem_range, neg_inj]
-  · rw [mem_lowerBounds] at hc 
-    simp_rw [Set.mem_range, Pi.neg_apply, neg_eq_iff_eq_neg] at hω 
+  · rw [mem_lowerBounds] at hc
+    simp_rw [Set.mem_range, Pi.neg_apply, neg_eq_iff_eq_neg] at hω
     refine' le_neg.1 (hc _ _)
     simpa only [Set.mem_range]
 #align measure_theory.martingale.bdd_above_range_iff_bdd_below_range MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range
@@ -367,7 +367,7 @@ theorem predictablePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω
       ∑ k in Finset.range n, μ[(s (k + 1)).indicator (1 : Ω → ℝ)|ℱ k] :=
   by
   have := martingale_part_process_ae_eq ℱ μ s n
-  simp_rw [martingale_part, process, Finset.sum_sub_distrib] at this 
+  simp_rw [martingale_part, process, Finset.sum_sub_distrib] at this
   exact sub_right_injective this
 #align measure_theory.borel_cantelli.predictable_part_process_ae_eq MeasureTheory.BorelCantelli.predictablePart_process_ae_eq
 -/
@@ -422,8 +422,8 @@ theorem tendsto_sum_indicator_atTop_iff [IsFiniteMeasure μ]
       simp only [predictable_part, Finset.sum_apply]
       refine' Finset.sum_mono_set_of_nonneg hω₃ (Finset.range_mono hnm)
     rintro ⟨b, hbdd⟩
-    rw [← tendsto_neg_at_bot_iff] at ht 
-    simp only [martingale_part, sub_eq_add_neg] at hω₁ 
+    rw [← tendsto_neg_at_bot_iff] at ht
+    simp only [martingale_part, sub_eq_add_neg] at hω₁
     exact
       hω₁
         (tendsto_at_top_add_right_of_le _ (-b) (tendsto_neg_at_bot_iff.1 ht) fun n =>
@@ -453,7 +453,7 @@ theorem tendsto_sum_indicator_atTop_iff' [IsFiniteMeasure μ] {s : ℕ → Set 
   · rw [process, process, ← sub_nonneg, Finset.sum_apply, Finset.sum_apply,
       Finset.sum_range_succ_sub_sum]
     exact Set.indicator_nonneg (fun _ _ => zero_le_one) _
-  simp_rw [process, predictable_part_process_ae_eq] at this 
+  simp_rw [process, predictable_part_process_ae_eq] at this
   simpa using this
 #align measure_theory.tendsto_sum_indicator_at_top_iff' MeasureTheory.tendsto_sum_indicator_atTop_iff'
 -/
Diff
@@ -81,7 +81,21 @@ theorem leastGE_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGE f
 
 #print MeasureTheory.leastGE_eq_min /-
 theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) :
-    leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by classical
+    leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by
+  classical
+  refine' le_antisymm (le_min (least_ge_le _) (least_ge_mono (hπn ω) r ω)) _
+  by_cases hle : π ω ≤ least_ge f r n ω
+  · rw [min_eq_left hle, least_ge]
+    by_cases h : ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r
+    · refine' hle.trans (Eq.le _)
+      rw [least_ge, ← hitting_eq_hitting_of_exists (hπn ω) h]
+    · simp only [hitting, if_neg h]
+  · rw [min_eq_right (not_le.1 hle).le, least_ge, least_ge, ←
+      hitting_eq_hitting_of_exists (hπn ω) _]
+    rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle 
+    exact
+      let ⟨j, hj₁, hj₂⟩ := hle
+      ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
 #align measure_theory.least_ge_eq_min MeasureTheory.leastGE_eq_min
 -/
 
Diff
@@ -81,21 +81,7 @@ theorem leastGE_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGE f
 
 #print MeasureTheory.leastGE_eq_min /-
 theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) :
-    leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by
-  classical
-  refine' le_antisymm (le_min (least_ge_le _) (least_ge_mono (hπn ω) r ω)) _
-  by_cases hle : π ω ≤ least_ge f r n ω
-  · rw [min_eq_left hle, least_ge]
-    by_cases h : ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r
-    · refine' hle.trans (Eq.le _)
-      rw [least_ge, ← hitting_eq_hitting_of_exists (hπn ω) h]
-    · simp only [hitting, if_neg h]
-  · rw [min_eq_right (not_le.1 hle).le, least_ge, least_ge, ←
-      hitting_eq_hitting_of_exists (hπn ω) _]
-    rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle 
-    exact
-      let ⟨j, hj₁, hj₂⟩ := hle
-      ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
+    leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by classical
 #align measure_theory.least_ge_eq_min MeasureTheory.leastGE_eq_min
 -/
 
Diff
@@ -240,7 +240,7 @@ theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Sub
         refine' ⟨b + |f 0 ω|, fun y hy => _⟩ <;>
       obtain ⟨n, rfl⟩ := hy
     · simp_rw [sub_eq_add_neg]
-      exact add_le_add (hb ⟨n, rfl⟩) (neg_le_abs_self _)
+      exact add_le_add (hb ⟨n, rfl⟩) (neg_le_abs _)
     · exact sub_le_iff_le_add.1 (le_trans (sub_le_sub_left (le_abs_self _) _) (hb ⟨n, rfl⟩))
   · simp only [hgdef]
     refine' ⟨fun h => _, fun h => _⟩ <;> obtain ⟨c, hc⟩ := h
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2022 Kexing Ying. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kexing Ying
 -/
-import Mathbin.Probability.Martingale.Convergence
-import Mathbin.Probability.Martingale.OptionalStopping
-import Mathbin.Probability.Martingale.Centering
+import Probability.Martingale.Convergence
+import Probability.Martingale.OptionalStopping
+import Probability.Martingale.Centering
 
 #align_import probability.martingale.borel_cantelli from "leanprover-community/mathlib"@"e8e130de9dba4ed6897183c3193c752ffadbcc77"
 
Diff
@@ -312,7 +312,7 @@ theorem Martingale.ae_not_tendsto_atTop_atTop [IsFiniteMeasure μ] (hf : Marting
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atTop := by
   filter_upwards [hf.bdd_above_range_iff_bdd_below_range hbdd] with ω hω htop using
-    unbounded_of_tendsto_at_top htop (hω.2 <| bddBelow_range_of_tendsto_atTop_atTop htop)
+    unbounded_of_tendsto_at_top htop (hω.2 <| bdd_below_range_of_tendsto_at_top_at_top htop)
 #align measure_theory.martingale.ae_not_tendsto_at_top_at_top MeasureTheory.Martingale.ae_not_tendsto_atTop_atTop
 -/
 
@@ -321,7 +321,7 @@ theorem Martingale.ae_not_tendsto_atTop_atBot [IsFiniteMeasure μ] (hf : Marting
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atBot := by
   filter_upwards [hf.bdd_above_range_iff_bdd_below_range hbdd] with ω hω htop using
-    unbounded_of_tendsto_at_bot htop (hω.1 <| bddAbove_range_of_tendsto_atTop_atBot htop)
+    unbounded_of_tendsto_at_bot htop (hω.1 <| bdd_above_range_of_tendsto_at_top_at_bot htop)
 #align measure_theory.martingale.ae_not_tendsto_at_top_at_bot MeasureTheory.Martingale.ae_not_tendsto_atTop_atBot
 -/
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2022 Kexing Ying. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kexing Ying
-
-! This file was ported from Lean 3 source module probability.martingale.borel_cantelli
-! leanprover-community/mathlib commit e8e130de9dba4ed6897183c3193c752ffadbcc77
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Probability.Martingale.Convergence
 import Mathbin.Probability.Martingale.OptionalStopping
 import Mathbin.Probability.Martingale.Centering
 
+#align_import probability.martingale.borel_cantelli from "leanprover-community/mathlib"@"e8e130de9dba4ed6897183c3193c752ffadbcc77"
+
 /-!
 
 # Generalized Borel-Cantelli lemma
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kexing Ying
 
 ! This file was ported from Lean 3 source module probability.martingale.borel_cantelli
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
+! leanprover-community/mathlib commit e8e130de9dba4ed6897183c3193c752ffadbcc77
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -16,6 +16,9 @@ import Mathbin.Probability.Martingale.Centering
 
 # Generalized Borel-Cantelli lemma
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file proves Lévy's generalized Borel-Cantelli lemma which is a generalization of the
 Borel-Cantelli lemmas. With this generalization, one can easily deduce the Borel-Cantelli lemmas
 by choosing appropriate filtrations. This file also contains the one sided martingale bound which
Diff
@@ -47,32 +47,41 @@ variable {Ω : Type _} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {ℱ : Filtra
 -/
 
 
+#print MeasureTheory.leastGE /-
 -- TODO: `least_ge` should be defined taking values in `with_top ℕ` once the `stopped_process`
 -- refactor is complete
 /-- `least_ge f r n` is the stopping time corresponding to the first time `f ≥ r`. -/
-noncomputable def leastGe (f : ℕ → Ω → ℝ) (r : ℝ) (n : ℕ) :=
+noncomputable def leastGE (f : ℕ → Ω → ℝ) (r : ℝ) (n : ℕ) :=
   hitting f (Set.Ici r) 0 n
-#align measure_theory.least_ge MeasureTheory.leastGe
+#align measure_theory.least_ge MeasureTheory.leastGE
+-/
 
-theorem Adapted.isStoppingTime_leastGe (r : ℝ) (n : ℕ) (hf : Adapted ℱ f) :
-    IsStoppingTime ℱ (leastGe f r n) :=
+#print MeasureTheory.Adapted.isStoppingTime_leastGE /-
+theorem Adapted.isStoppingTime_leastGE (r : ℝ) (n : ℕ) (hf : Adapted ℱ f) :
+    IsStoppingTime ℱ (leastGE f r n) :=
   hitting_isStoppingTime hf measurableSet_Ici
-#align measure_theory.adapted.is_stopping_time_least_ge MeasureTheory.Adapted.isStoppingTime_leastGe
+#align measure_theory.adapted.is_stopping_time_least_ge MeasureTheory.Adapted.isStoppingTime_leastGE
+-/
 
-theorem leastGe_le {i : ℕ} {r : ℝ} (ω : Ω) : leastGe f r i ω ≤ i :=
+#print MeasureTheory.leastGE_le /-
+theorem leastGE_le {i : ℕ} {r : ℝ} (ω : Ω) : leastGE f r i ω ≤ i :=
   hitting_le ω
-#align measure_theory.least_ge_le MeasureTheory.leastGe_le
+#align measure_theory.least_ge_le MeasureTheory.leastGE_le
+-/
 
+#print MeasureTheory.leastGE_mono /-
 -- The following four lemmas shows `least_ge` behaves like a stopped process. Ideally we should
 -- define `least_ge` as a stopping time and take its stopped process. However, we can't do that
 -- with our current definition since a stopping time takes only finite indicies. An upcomming
 -- refactor should hopefully make it possible to have stopping times taking infinity as a value
-theorem leastGe_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGe f r n ω ≤ leastGe f r m ω :=
+theorem leastGE_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGE f r n ω ≤ leastGE f r m ω :=
   hitting_mono hnm
-#align measure_theory.least_ge_mono MeasureTheory.leastGe_mono
+#align measure_theory.least_ge_mono MeasureTheory.leastGE_mono
+-/
 
-theorem leastGe_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) :
-    leastGe f r (π ω) ω = min (π ω) (leastGe f r n ω) := by
+#print MeasureTheory.leastGE_eq_min /-
+theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) :
+    leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by
   classical
   refine' le_antisymm (le_min (least_ge_le _) (least_ge_mono (hπn ω) r ω)) _
   by_cases hle : π ω ≤ least_ge f r n ω
@@ -87,17 +96,21 @@ theorem leastGe_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : 
     exact
       let ⟨j, hj₁, hj₂⟩ := hle
       ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
-#align measure_theory.least_ge_eq_min MeasureTheory.leastGe_eq_min
+#align measure_theory.least_ge_eq_min MeasureTheory.leastGE_eq_min
+-/
 
-theorem stoppedValue_stoppedValue_leastGe (f : ℕ → Ω → ℝ) (π : Ω → ℕ) (r : ℝ) {n : ℕ}
+#print MeasureTheory.stoppedValue_stoppedValue_leastGE /-
+theorem stoppedValue_stoppedValue_leastGE (f : ℕ → Ω → ℝ) (π : Ω → ℕ) (r : ℝ) {n : ℕ}
     (hπn : ∀ ω, π ω ≤ n) :
-    stoppedValue (fun i => stoppedValue f (leastGe f r i)) π =
-      stoppedValue (stoppedProcess f (leastGe f r n)) π :=
+    stoppedValue (fun i => stoppedValue f (leastGE f r i)) π =
+      stoppedValue (stoppedProcess f (leastGE f r n)) π :=
   by ext1 ω; simp_rw [stopped_process, stopped_value]; rw [least_ge_eq_min _ _ _ hπn]
-#align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGe
+#align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGE
+-/
 
-theorem Submartingale.stoppedValue_leastGe [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
-    Submartingale (fun i => stoppedValue f (leastGe f r i)) ℱ μ :=
+#print MeasureTheory.Submartingale.stoppedValue_leastGE /-
+theorem Submartingale.stoppedValue_leastGE [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
+    Submartingale (fun i => stoppedValue f (leastGE f r i)) ℱ μ :=
   by
   rw [submartingale_iff_expected_stopped_value_mono]
   · intro σ π hσ hπ hσ_le_π hπ_bdd
@@ -116,13 +129,15 @@ theorem Submartingale.stoppedValue_leastGe [IsFiniteMeasure μ] (hf : Submarting
     exact fun i =>
       integrable_stopped_value _ (hf.adapted.is_stopping_time_least_ge _ _) hf.integrable
         least_ge_le
-#align measure_theory.submartingale.stopped_value_least_ge MeasureTheory.Submartingale.stoppedValue_leastGe
+#align measure_theory.submartingale.stopped_value_least_ge MeasureTheory.Submartingale.stoppedValue_leastGE
+-/
 
 variable {r : ℝ} {R : ℝ≥0}
 
-theorem norm_stoppedValue_leastGe_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
+#print MeasureTheory.norm_stoppedValue_leastGE_le /-
+theorem norm_stoppedValue_leastGE_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
-    ∀ᵐ ω ∂μ, stoppedValue f (leastGe f r i) ω ≤ r + R :=
+    ∀ᵐ ω ∂μ, stoppedValue f (leastGE f r i) ω ≤ r + R :=
   by
   filter_upwards [hbdd] with ω hbddω
   change f (least_ge f r i ω) ω ≤ r + R
@@ -134,11 +149,13 @@ theorem norm_stoppedValue_leastGe_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
     have := not_mem_of_lt_hitting (hk.symm ▸ k.lt_succ_self : k < least_ge f r i ω) (zero_le _)
     simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, not_or, not_le] at this 
     exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _))
-#align measure_theory.norm_stopped_value_least_ge_le MeasureTheory.norm_stoppedValue_leastGe_le
+#align measure_theory.norm_stopped_value_least_ge_le MeasureTheory.norm_stoppedValue_leastGE_le
+-/
 
-theorem Submartingale.stoppedValue_leastGe_snorm_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+#print MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le /-
+theorem Submartingale.stoppedValue_leastGE_snorm_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
-    snorm (stoppedValue f (leastGe f r i)) 1 μ ≤ 2 * μ Set.univ * ENNReal.ofReal (r + R) :=
+    snorm (stoppedValue f (leastGE f r i)) 1 μ ≤ 2 * μ Set.univ * ENNReal.ofReal (r + R) :=
   by
   refine'
     snorm_one_le_of_le' ((hf.stopped_value_least_ge r).Integrable _) _
@@ -146,17 +163,21 @@ theorem Submartingale.stoppedValue_leastGe_snorm_le [IsFiniteMeasure μ] (hf : S
   rw [← integral_univ]
   refine' le_trans _ ((hf.stopped_value_least_ge r).set_integral_le (zero_le _) MeasurableSet.univ)
   simp_rw [stopped_value, least_ge, hitting_of_le le_rfl, hf0, integral_zero']
-#align measure_theory.submartingale.stopped_value_least_ge_snorm_le MeasureTheory.Submartingale.stoppedValue_leastGe_snorm_le
+#align measure_theory.submartingale.stopped_value_least_ge_snorm_le MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le
+-/
 
-theorem Submartingale.stoppedValue_leastGe_snorm_le' [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+#print MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le' /-
+theorem Submartingale.stoppedValue_leastGE_snorm_le' [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
-    snorm (stoppedValue f (leastGe f r i)) 1 μ ≤
+    snorm (stoppedValue f (leastGE f r i)) 1 μ ≤
       ENNReal.toNNReal (2 * μ Set.univ * ENNReal.ofReal (r + R)) :=
   by
   refine' (hf.stopped_value_least_ge_snorm_le hr hf0 hbdd i).trans _
   simp [ENNReal.coe_toNNReal (measure_ne_top μ _), ENNReal.coe_toNNReal]
-#align measure_theory.submartingale.stopped_value_least_ge_snorm_le' MeasureTheory.Submartingale.stoppedValue_leastGe_snorm_le'
+#align measure_theory.submartingale.stopped_value_least_ge_snorm_le' MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le'
+-/
 
+#print MeasureTheory.Submartingale.exists_tendsto_of_abs_bddAbove_aux /-
 /-- This lemma is superceded by `submartingale.bdd_above_iff_exists_tendsto`. -/
 theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ]
     (hf : Submartingale f ℱ μ) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
@@ -186,14 +207,18 @@ theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ]
     exact fun j _ => hib j
   simp only [← HEq, hω i]
 #align measure_theory.submartingale.exists_tendsto_of_abs_bdd_above_aux MeasureTheory.Submartingale.exists_tendsto_of_abs_bddAbove_aux
+-/
 
+#print MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto_aux /-
 theorem Submartingale.bddAbove_iff_exists_tendsto_aux [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) := by
   filter_upwards [hf.exists_tendsto_of_abs_bdd_above_aux hf0 hbdd] with ω hω using
     ⟨hω, fun ⟨c, hc⟩ => hc.bddAbove_range⟩
 #align measure_theory.submartingale.bdd_above_iff_exists_tendsto_aux MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto_aux
+-/
 
+#print MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto /-
 /-- One sided martingale bound: If `f` is a submartingale which has uniformly bounded differences,
 then for almost every `ω`, `f n ω` is bounded above (in `n`) if and only if it converges. -/
 theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
@@ -224,6 +249,7 @@ theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Sub
       have := hc.add_const (f 0 ω)
       simpa only [sub_add_cancel]
 #align measure_theory.submartingale.bdd_above_iff_exists_tendsto MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto
+-/
 
 /-!
 ### Lévy's generalization of the Borel-Cantelli lemma
@@ -248,6 +274,7 @@ almost everywhere, the result follows.
 -/
 
 
+#print MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range /-
 theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ BddBelow (Set.range fun n => f n ω) :=
@@ -278,39 +305,51 @@ theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf :
     refine' le_neg.1 (hc _ _)
     simpa only [Set.mem_range]
 #align measure_theory.martingale.bdd_above_range_iff_bdd_below_range MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range
+-/
 
+#print MeasureTheory.Martingale.ae_not_tendsto_atTop_atTop /-
 theorem Martingale.ae_not_tendsto_atTop_atTop [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atTop := by
   filter_upwards [hf.bdd_above_range_iff_bdd_below_range hbdd] with ω hω htop using
     unbounded_of_tendsto_at_top htop (hω.2 <| bddBelow_range_of_tendsto_atTop_atTop htop)
 #align measure_theory.martingale.ae_not_tendsto_at_top_at_top MeasureTheory.Martingale.ae_not_tendsto_atTop_atTop
+-/
 
+#print MeasureTheory.Martingale.ae_not_tendsto_atTop_atBot /-
 theorem Martingale.ae_not_tendsto_atTop_atBot [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atBot := by
   filter_upwards [hf.bdd_above_range_iff_bdd_below_range hbdd] with ω hω htop using
     unbounded_of_tendsto_at_bot htop (hω.1 <| bddAbove_range_of_tendsto_atTop_atBot htop)
 #align measure_theory.martingale.ae_not_tendsto_at_top_at_bot MeasureTheory.Martingale.ae_not_tendsto_atTop_atBot
+-/
 
 namespace BorelCantelli
 
+#print MeasureTheory.BorelCantelli.process /-
 /-- Auxiliary definition required to prove Lévy's generalization of the Borel-Cantelli lemmas for
 which we will take the martingale part. -/
 noncomputable def process (s : ℕ → Set Ω) (n : ℕ) : Ω → ℝ :=
   ∑ k in Finset.range n, (s (k + 1)).indicator 1
 #align measure_theory.borel_cantelli.process MeasureTheory.BorelCantelli.process
+-/
 
 variable {s : ℕ → Set Ω}
 
+#print MeasureTheory.BorelCantelli.process_zero /-
 theorem process_zero : process s 0 = 0 := by rw [process, Finset.range_zero, Finset.sum_empty]
 #align measure_theory.borel_cantelli.process_zero MeasureTheory.BorelCantelli.process_zero
+-/
 
+#print MeasureTheory.BorelCantelli.adapted_process /-
 theorem adapted_process (hs : ∀ n, measurable_set[ℱ n] (s n)) : Adapted ℱ (process s) := fun n =>
   Finset.stronglyMeasurable_sum' _ fun k hk =>
     stronglyMeasurable_one.indicator <| ℱ.mono (Finset.mem_range.1 hk) _ <| hs _
 #align measure_theory.borel_cantelli.adapted_process MeasureTheory.BorelCantelli.adapted_process
+-/
 
+#print MeasureTheory.BorelCantelli.martingalePart_process_ae_eq /-
 theorem martingalePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω) (s : ℕ → Set Ω) (n : ℕ) :
     martingalePart (process s) ℱ μ n =
       ∑ k in Finset.range n, ((s (k + 1)).indicator 1 - μ[(s (k + 1)).indicator 1|ℱ k]) :=
@@ -319,7 +358,9 @@ theorem martingalePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω)
   refine' Finset.sum_congr rfl fun k hk => _
   simp only [process, Finset.sum_range_succ_sub_sum]
 #align measure_theory.borel_cantelli.martingale_part_process_ae_eq MeasureTheory.BorelCantelli.martingalePart_process_ae_eq
+-/
 
+#print MeasureTheory.BorelCantelli.predictablePart_process_ae_eq /-
 theorem predictablePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω) (s : ℕ → Set Ω)
     (n : ℕ) :
     predictablePart (process s) ℱ μ n =
@@ -329,7 +370,9 @@ theorem predictablePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω
   simp_rw [martingale_part, process, Finset.sum_sub_distrib] at this 
   exact sub_right_injective this
 #align measure_theory.borel_cantelli.predictable_part_process_ae_eq MeasureTheory.BorelCantelli.predictablePart_process_ae_eq
+-/
 
+#print MeasureTheory.BorelCantelli.process_difference_le /-
 theorem process_difference_le (s : ℕ → Set Ω) (ω : Ω) (n : ℕ) :
     |process s (n + 1) ω - process s n ω| ≤ (1 : ℝ≥0) :=
   by
@@ -338,17 +381,21 @@ theorem process_difference_le (s : ℕ → Set Ω) (ω : Ω) (n : ℕ) :
   refine' Set.indicator_le' (fun _ _ => _) (fun _ _ => zero_le_one) _
   rw [Pi.one_apply, norm_one]
 #align measure_theory.borel_cantelli.process_difference_le MeasureTheory.BorelCantelli.process_difference_le
+-/
 
+#print MeasureTheory.BorelCantelli.integrable_process /-
 theorem integrable_process (μ : Measure Ω) [IsFiniteMeasure μ] (hs : ∀ n, measurable_set[ℱ n] (s n))
     (n : ℕ) : Integrable (process s n) μ :=
   integrable_finset_sum' _ fun k hk =>
     IntegrableOn.integrable_indicator (integrable_const 1) <| ℱ.le _ _ <| hs _
 #align measure_theory.borel_cantelli.integrable_process MeasureTheory.BorelCantelli.integrable_process
+-/
 
 end BorelCantelli
 
 open BorelCantelli
 
+#print MeasureTheory.tendsto_sum_indicator_atTop_iff /-
 /-- An a.e. monotone adapted process `f` with uniformly bounded differences converges to `+∞` if
 and only if its predictable part also converges to `+∞`. -/
 theorem tendsto_sum_indicator_atTop_iff [IsFiniteMeasure μ]
@@ -387,9 +434,11 @@ theorem tendsto_sum_indicator_atTop_iff [IsFiniteMeasure μ]
       hω₂
         ((tendsto_at_bot_add_left_of_ge _ b fun n => hbdd ⟨n, rfl⟩) <| tendsto_neg_at_bot_iff.2 ht)
 #align measure_theory.tendsto_sum_indicator_at_top_iff MeasureTheory.tendsto_sum_indicator_atTop_iff
+-/
 
 open BorelCantelli
 
+#print MeasureTheory.tendsto_sum_indicator_atTop_iff' /-
 theorem tendsto_sum_indicator_atTop_iff' [IsFiniteMeasure μ] {s : ℕ → Set Ω}
     (hs : ∀ n, measurable_set[ℱ n] (s n)) :
     ∀ᵐ ω ∂μ,
@@ -407,7 +456,9 @@ theorem tendsto_sum_indicator_atTop_iff' [IsFiniteMeasure μ] {s : ℕ → Set 
   simp_rw [process, predictable_part_process_ae_eq] at this 
   simpa using this
 #align measure_theory.tendsto_sum_indicator_at_top_iff' MeasureTheory.tendsto_sum_indicator_atTop_iff'
+-/
 
+#print MeasureTheory.ae_mem_limsup_atTop_iff /-
 /-- **Lévy's generalization of the Borel-Cantelli lemma**: given a sequence of sets `s` and a
 filtration `ℱ` such that for all `n`, `s n` is `ℱ n`-measurable, `at_top.limsup s` is almost
 everywhere equal to the set for which `∑ k, ℙ(s (k + 1) | ℱ k) = ∞`. -/
@@ -419,6 +470,7 @@ theorem ae_mem_limsup_atTop_iff (μ : Measure Ω) [IsFiniteMeasure μ] {s : ℕ
           atTop :=
   (limsup_eq_tendsto_sum_indicator_atTop ℝ s).symm ▸ tendsto_sum_indicator_atTop_iff' hs
 #align measure_theory.ae_mem_limsup_at_top_iff MeasureTheory.ae_mem_limsup_atTop_iff
+-/
 
 end MeasureTheory
 
Diff
@@ -313,7 +313,7 @@ theorem adapted_process (hs : ∀ n, measurable_set[ℱ n] (s n)) : Adapted ℱ
 
 theorem martingalePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω) (s : ℕ → Set Ω) (n : ℕ) :
     martingalePart (process s) ℱ μ n =
-      ∑ k in Finset.range n, (s (k + 1)).indicator 1 - μ[(s (k + 1)).indicator 1|ℱ k] :=
+      ∑ k in Finset.range n, ((s (k + 1)).indicator 1 - μ[(s (k + 1)).indicator 1|ℱ k]) :=
   by
   simp only [martingale_part_eq_sum, process_zero, zero_add]
   refine' Finset.sum_congr rfl fun k hk => _
Diff
@@ -74,19 +74,19 @@ theorem leastGe_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGe f
 theorem leastGe_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) :
     leastGe f r (π ω) ω = min (π ω) (leastGe f r n ω) := by
   classical
-    refine' le_antisymm (le_min (least_ge_le _) (least_ge_mono (hπn ω) r ω)) _
-    by_cases hle : π ω ≤ least_ge f r n ω
-    · rw [min_eq_left hle, least_ge]
-      by_cases h : ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r
-      · refine' hle.trans (Eq.le _)
-        rw [least_ge, ← hitting_eq_hitting_of_exists (hπn ω) h]
-      · simp only [hitting, if_neg h]
-    · rw [min_eq_right (not_le.1 hle).le, least_ge, least_ge, ←
-        hitting_eq_hitting_of_exists (hπn ω) _]
-      rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle 
-      exact
-        let ⟨j, hj₁, hj₂⟩ := hle
-        ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
+  refine' le_antisymm (le_min (least_ge_le _) (least_ge_mono (hπn ω) r ω)) _
+  by_cases hle : π ω ≤ least_ge f r n ω
+  · rw [min_eq_left hle, least_ge]
+    by_cases h : ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r
+    · refine' hle.trans (Eq.le _)
+      rw [least_ge, ← hitting_eq_hitting_of_exists (hπn ω) h]
+    · simp only [hitting, if_neg h]
+  · rw [min_eq_right (not_le.1 hle).le, least_ge, least_ge, ←
+      hitting_eq_hitting_of_exists (hπn ω) _]
+    rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle 
+    exact
+      let ⟨j, hj₁, hj₂⟩ := hle
+      ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
 #align measure_theory.least_ge_eq_min MeasureTheory.leastGe_eq_min
 
 theorem stoppedValue_stoppedValue_leastGe (f : ℕ → Ω → ℝ) (π : Ω → ℕ) (r : ℝ) {n : ℕ}
@@ -96,7 +96,7 @@ theorem stoppedValue_stoppedValue_leastGe (f : ℕ → Ω → ℝ) (π : Ω →
   by ext1 ω; simp_rw [stopped_process, stopped_value]; rw [least_ge_eq_min _ _ _ hπn]
 #align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGe
 
-theorem Submartingale.stoppedValue_leastGe [FiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
+theorem Submartingale.stoppedValue_leastGe [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
     Submartingale (fun i => stoppedValue f (leastGe f r i)) ℱ μ :=
   by
   rw [submartingale_iff_expected_stopped_value_mono]
@@ -124,7 +124,7 @@ theorem norm_stoppedValue_leastGe_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
     ∀ᵐ ω ∂μ, stoppedValue f (leastGe f r i) ω ≤ r + R :=
   by
-  filter_upwards [hbdd]with ω hbddω
+  filter_upwards [hbdd] with ω hbddω
   change f (least_ge f r i ω) ω ≤ r + R
   by_cases heq : least_ge f r i ω = 0
   · rw [HEq, hf0, Pi.zero_apply]
@@ -136,7 +136,7 @@ theorem norm_stoppedValue_leastGe_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
     exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _))
 #align measure_theory.norm_stopped_value_least_ge_le MeasureTheory.norm_stoppedValue_leastGe_le
 
-theorem Submartingale.stoppedValue_leastGe_snorm_le [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.stoppedValue_leastGe_snorm_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
     snorm (stoppedValue f (leastGe f r i)) 1 μ ≤ 2 * μ Set.univ * ENNReal.ofReal (r + R) :=
   by
@@ -148,7 +148,7 @@ theorem Submartingale.stoppedValue_leastGe_snorm_le [FiniteMeasure μ] (hf : Sub
   simp_rw [stopped_value, least_ge, hitting_of_le le_rfl, hf0, integral_zero']
 #align measure_theory.submartingale.stopped_value_least_ge_snorm_le MeasureTheory.Submartingale.stoppedValue_leastGe_snorm_le
 
-theorem Submartingale.stoppedValue_leastGe_snorm_le' [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.stoppedValue_leastGe_snorm_le' [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
     snorm (stoppedValue f (leastGe f r i)) 1 μ ≤
       ENNReal.toNNReal (2 * μ Set.univ * ENNReal.ofReal (r + R)) :=
@@ -158,7 +158,7 @@ theorem Submartingale.stoppedValue_leastGe_snorm_le' [FiniteMeasure μ] (hf : Su
 #align measure_theory.submartingale.stopped_value_least_ge_snorm_le' MeasureTheory.Submartingale.stoppedValue_leastGe_snorm_le'
 
 /-- This lemma is superceded by `submartingale.bdd_above_iff_exists_tendsto`. -/
-theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [FiniteMeasure μ]
+theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ]
     (hf : Submartingale f ℱ μ) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) → ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) :=
   by
@@ -169,7 +169,7 @@ theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [FiniteMeasure μ]
     exact fun i =>
       submartingale.exists_ae_tendsto_of_bdd (hf.stopped_value_least_ge i)
         (hf.stopped_value_least_ge_snorm_le' i.cast_nonneg hf0 hbdd)
-  filter_upwards [ht]with ω hω hωb
+  filter_upwards [ht] with ω hω hωb
   rw [BddAbove] at hωb 
   obtain ⟨i, hi⟩ := exists_nat_gt hωb.some
   have hib : ∀ n, f n ω < i := by
@@ -187,16 +187,16 @@ theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [FiniteMeasure μ]
   simp only [← HEq, hω i]
 #align measure_theory.submartingale.exists_tendsto_of_abs_bdd_above_aux MeasureTheory.Submartingale.exists_tendsto_of_abs_bddAbove_aux
 
-theorem Submartingale.bddAbove_iff_exists_tendsto_aux [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.bddAbove_iff_exists_tendsto_aux [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) := by
-  filter_upwards [hf.exists_tendsto_of_abs_bdd_above_aux hf0
-      hbdd]with ω hω using⟨hω, fun ⟨c, hc⟩ => hc.bddAbove_range⟩
+  filter_upwards [hf.exists_tendsto_of_abs_bdd_above_aux hf0 hbdd] with ω hω using
+    ⟨hω, fun ⟨c, hc⟩ => hc.bddAbove_range⟩
 #align measure_theory.submartingale.bdd_above_iff_exists_tendsto_aux MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto_aux
 
 /-- One sided martingale bound: If `f` is a submartingale which has uniformly bounded differences,
 then for almost every `ω`, `f n ω` is bounded above (in `n`) if and only if it converges. -/
-theorem Submartingale.bddAbove_iff_exists_tendsto [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) :=
   by
@@ -208,7 +208,7 @@ theorem Submartingale.bddAbove_iff_exists_tendsto [FiniteMeasure μ] (hf : Subma
     simp only [hgdef, sub_self, Pi.zero_apply]
   have hgbdd : ∀ᵐ ω ∂μ, ∀ i : ℕ, |g (i + 1) ω - g i ω| ≤ ↑R := by
     simpa only [sub_sub_sub_cancel_right]
-  filter_upwards [hg.bdd_above_iff_exists_tendsto_aux hg0 hgbdd]with ω hω
+  filter_upwards [hg.bdd_above_iff_exists_tendsto_aux hg0 hgbdd] with ω hω
   convert hω using 1 <;> rw [eq_iff_iff]
   · simp only [hgdef]
     refine' ⟨fun h => _, fun h => _⟩ <;> obtain ⟨b, hb⟩ := h <;>
@@ -248,18 +248,18 @@ almost everywhere, the result follows.
 -/
 
 
-theorem Martingale.bddAbove_range_iff_bddBelow_range [FiniteMeasure μ] (hf : Martingale f ℱ μ)
+theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ BddBelow (Set.range fun n => f n ω) :=
   by
   have hbdd' : ∀ᵐ ω ∂μ, ∀ i, |(-f) (i + 1) ω - (-f) i ω| ≤ R :=
     by
-    filter_upwards [hbdd]with ω hω i
+    filter_upwards [hbdd] with ω hω i
     erw [← abs_neg, neg_sub, sub_neg_eq_add, neg_add_eq_sub]
     exact hω i
   have hup := hf.submartingale.bdd_above_iff_exists_tendsto hbdd
   have hdown := hf.neg.submartingale.bdd_above_iff_exists_tendsto hbdd'
-  filter_upwards [hup, hdown]with ω hω₁ hω₂
+  filter_upwards [hup, hdown] with ω hω₁ hω₂
   have :
     (∃ c, tendsto (fun n => f n ω) at_top (𝓝 c)) ↔ ∃ c, tendsto (fun n => (-f) n ω) at_top (𝓝 c) :=
     by
@@ -279,20 +279,18 @@ theorem Martingale.bddAbove_range_iff_bddBelow_range [FiniteMeasure μ] (hf : Ma
     simpa only [Set.mem_range]
 #align measure_theory.martingale.bdd_above_range_iff_bdd_below_range MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range
 
-theorem Martingale.ae_not_tendsto_atTop_atTop [FiniteMeasure μ] (hf : Martingale f ℱ μ)
+theorem Martingale.ae_not_tendsto_atTop_atTop [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atTop := by
-  filter_upwards [hf.bdd_above_range_iff_bdd_below_range
-      hbdd]with ω hω htop using unbounded_of_tendsto_at_top htop
-      (hω.2 <| bddBelow_range_of_tendsto_atTop_atTop htop)
+  filter_upwards [hf.bdd_above_range_iff_bdd_below_range hbdd] with ω hω htop using
+    unbounded_of_tendsto_at_top htop (hω.2 <| bddBelow_range_of_tendsto_atTop_atTop htop)
 #align measure_theory.martingale.ae_not_tendsto_at_top_at_top MeasureTheory.Martingale.ae_not_tendsto_atTop_atTop
 
-theorem Martingale.ae_not_tendsto_atTop_atBot [FiniteMeasure μ] (hf : Martingale f ℱ μ)
+theorem Martingale.ae_not_tendsto_atTop_atBot [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atBot := by
-  filter_upwards [hf.bdd_above_range_iff_bdd_below_range
-      hbdd]with ω hω htop using unbounded_of_tendsto_at_bot htop
-      (hω.1 <| bddAbove_range_of_tendsto_atTop_atBot htop)
+  filter_upwards [hf.bdd_above_range_iff_bdd_below_range hbdd] with ω hω htop using
+    unbounded_of_tendsto_at_bot htop (hω.1 <| bddAbove_range_of_tendsto_atTop_atBot htop)
 #align measure_theory.martingale.ae_not_tendsto_at_top_at_bot MeasureTheory.Martingale.ae_not_tendsto_atTop_atBot
 
 namespace BorelCantelli
@@ -341,7 +339,7 @@ theorem process_difference_le (s : ℕ → Set Ω) (ω : Ω) (n : ℕ) :
   rw [Pi.one_apply, norm_one]
 #align measure_theory.borel_cantelli.process_difference_le MeasureTheory.BorelCantelli.process_difference_le
 
-theorem integrable_process (μ : Measure Ω) [FiniteMeasure μ] (hs : ∀ n, measurable_set[ℱ n] (s n))
+theorem integrable_process (μ : Measure Ω) [IsFiniteMeasure μ] (hs : ∀ n, measurable_set[ℱ n] (s n))
     (n : ℕ) : Integrable (process s n) μ :=
   integrable_finset_sum' _ fun k hk =>
     IntegrableOn.integrable_indicator (integrable_const 1) <| ℱ.le _ _ <| hs _
@@ -353,7 +351,7 @@ open BorelCantelli
 
 /-- An a.e. monotone adapted process `f` with uniformly bounded differences converges to `+∞` if
 and only if its predictable part also converges to `+∞`. -/
-theorem tendsto_sum_indicator_atTop_iff [FiniteMeasure μ]
+theorem tendsto_sum_indicator_atTop_iff [IsFiniteMeasure μ]
     (hfmono : ∀ᵐ ω ∂μ, ∀ n, f n ω ≤ f (n + 1) ω) (hf : Adapted ℱ f) (hint : ∀ n, Integrable (f n) μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ n, |f (n + 1) ω - f n ω| ≤ R) :
     ∀ᵐ ω ∂μ,
@@ -369,8 +367,8 @@ theorem tendsto_sum_indicator_atTop_iff [FiniteMeasure μ]
   have h₃ : ∀ᵐ ω ∂μ, ∀ n, 0 ≤ (μ[f (n + 1) - f n|ℱ n]) ω :=
     by
     refine' ae_all_iff.2 fun n => condexp_nonneg _
-    filter_upwards [ae_all_iff.1 hfmono n]with ω hω using sub_nonneg.2 hω
-  filter_upwards [h₁, h₂, h₃, hfmono]with ω hω₁ hω₂ hω₃ hω₄
+    filter_upwards [ae_all_iff.1 hfmono n] with ω hω using sub_nonneg.2 hω
+  filter_upwards [h₁, h₂, h₃, hfmono] with ω hω₁ hω₂ hω₃ hω₄
   constructor <;> intro ht
   · refine' tendsto_at_top_at_top_of_monotone' _ _
     · intro n m hnm
@@ -392,7 +390,7 @@ theorem tendsto_sum_indicator_atTop_iff [FiniteMeasure μ]
 
 open BorelCantelli
 
-theorem tendsto_sum_indicator_atTop_iff' [FiniteMeasure μ] {s : ℕ → Set Ω}
+theorem tendsto_sum_indicator_atTop_iff' [IsFiniteMeasure μ] {s : ℕ → Set Ω}
     (hs : ∀ n, measurable_set[ℱ n] (s n)) :
     ∀ᵐ ω ∂μ,
       Tendsto (fun n => ∑ k in Finset.range n, (s (k + 1)).indicator (1 : Ω → ℝ) ω) atTop atTop ↔
@@ -413,7 +411,7 @@ theorem tendsto_sum_indicator_atTop_iff' [FiniteMeasure μ] {s : ℕ → Set Ω}
 /-- **Lévy's generalization of the Borel-Cantelli lemma**: given a sequence of sets `s` and a
 filtration `ℱ` such that for all `n`, `s n` is `ℱ n`-measurable, `at_top.limsup s` is almost
 everywhere equal to the set for which `∑ k, ℙ(s (k + 1) | ℱ k) = ∞`. -/
-theorem ae_mem_limsup_atTop_iff (μ : Measure Ω) [FiniteMeasure μ] {s : ℕ → Set Ω}
+theorem ae_mem_limsup_atTop_iff (μ : Measure Ω) [IsFiniteMeasure μ] {s : ℕ → Set Ω}
     (hs : ∀ n, measurable_set[ℱ n] (s n)) :
     ∀ᵐ ω ∂μ,
       ω ∈ limsup s atTop ↔
Diff
@@ -83,7 +83,7 @@ theorem leastGe_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : 
       · simp only [hitting, if_neg h]
     · rw [min_eq_right (not_le.1 hle).le, least_ge, least_ge, ←
         hitting_eq_hitting_of_exists (hπn ω) _]
-      rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle
+      rw [not_le, least_ge, hitting_lt_iff _ (hπn ω)] at hle 
       exact
         let ⟨j, hj₁, hj₂⟩ := hle
         ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
@@ -132,7 +132,7 @@ theorem norm_stoppedValue_leastGe_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
   · obtain ⟨k, hk⟩ := Nat.exists_eq_succ_of_ne_zero HEq
     rw [hk, add_comm, ← sub_le_iff_le_add]
     have := not_mem_of_lt_hitting (hk.symm ▸ k.lt_succ_self : k < least_ge f r i ω) (zero_le _)
-    simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, not_or, not_le] at this
+    simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, not_or, not_le] at this 
     exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _))
 #align measure_theory.norm_stopped_value_least_ge_le MeasureTheory.norm_stoppedValue_leastGe_le
 
@@ -170,7 +170,7 @@ theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [FiniteMeasure μ]
       submartingale.exists_ae_tendsto_of_bdd (hf.stopped_value_least_ge i)
         (hf.stopped_value_least_ge_snorm_le' i.cast_nonneg hf0 hbdd)
   filter_upwards [ht]with ω hω hωb
-  rw [BddAbove] at hωb
+  rw [BddAbove] at hωb 
   obtain ⟨i, hi⟩ := exists_nat_gt hωb.some
   have hib : ∀ n, f n ω < i := by
     intro n
@@ -270,11 +270,11 @@ theorem Martingale.bddAbove_range_iff_bddBelow_range [FiniteMeasure μ] (hf : Ma
       simp only [neg_neg, Pi.neg_apply]
   rw [hω₁, this, ← hω₂]
   constructor <;> rintro ⟨c, hc⟩ <;> refine' ⟨-c, fun ω hω => _⟩
-  · rw [mem_upperBounds] at hc
+  · rw [mem_upperBounds] at hc 
     refine' neg_le.2 (hc _ _)
     simpa only [Pi.neg_apply, Set.mem_range, neg_inj]
-  · rw [mem_lowerBounds] at hc
-    simp_rw [Set.mem_range, Pi.neg_apply, neg_eq_iff_eq_neg] at hω
+  · rw [mem_lowerBounds] at hc 
+    simp_rw [Set.mem_range, Pi.neg_apply, neg_eq_iff_eq_neg] at hω 
     refine' le_neg.1 (hc _ _)
     simpa only [Set.mem_range]
 #align measure_theory.martingale.bdd_above_range_iff_bdd_below_range MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range
@@ -328,7 +328,7 @@ theorem predictablePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω
       ∑ k in Finset.range n, μ[(s (k + 1)).indicator (1 : Ω → ℝ)|ℱ k] :=
   by
   have := martingale_part_process_ae_eq ℱ μ s n
-  simp_rw [martingale_part, process, Finset.sum_sub_distrib] at this
+  simp_rw [martingale_part, process, Finset.sum_sub_distrib] at this 
   exact sub_right_injective this
 #align measure_theory.borel_cantelli.predictable_part_process_ae_eq MeasureTheory.BorelCantelli.predictablePart_process_ae_eq
 
@@ -377,8 +377,8 @@ theorem tendsto_sum_indicator_atTop_iff [FiniteMeasure μ]
       simp only [predictable_part, Finset.sum_apply]
       refine' Finset.sum_mono_set_of_nonneg hω₃ (Finset.range_mono hnm)
     rintro ⟨b, hbdd⟩
-    rw [← tendsto_neg_at_bot_iff] at ht
-    simp only [martingale_part, sub_eq_add_neg] at hω₁
+    rw [← tendsto_neg_at_bot_iff] at ht 
+    simp only [martingale_part, sub_eq_add_neg] at hω₁ 
     exact
       hω₁
         (tendsto_at_top_add_right_of_le _ (-b) (tendsto_neg_at_bot_iff.1 ht) fun n =>
@@ -406,7 +406,7 @@ theorem tendsto_sum_indicator_atTop_iff' [FiniteMeasure μ] {s : ℕ → Set Ω}
   · rw [process, process, ← sub_nonneg, Finset.sum_apply, Finset.sum_apply,
       Finset.sum_range_succ_sub_sum]
     exact Set.indicator_nonneg (fun _ _ => zero_le_one) _
-  simp_rw [process, predictable_part_process_ae_eq] at this
+  simp_rw [process, predictable_part_process_ae_eq] at this 
   simpa using this
 #align measure_theory.tendsto_sum_indicator_at_top_iff' MeasureTheory.tendsto_sum_indicator_atTop_iff'
 
Diff
@@ -35,7 +35,7 @@ is required to prove the generalized Borel-Cantelli.
 
 open Filter
 
-open NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
+open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
 
 namespace MeasureTheory
 
Diff
@@ -93,10 +93,7 @@ theorem stoppedValue_stoppedValue_leastGe (f : ℕ → Ω → ℝ) (π : Ω →
     (hπn : ∀ ω, π ω ≤ n) :
     stoppedValue (fun i => stoppedValue f (leastGe f r i)) π =
       stoppedValue (stoppedProcess f (leastGe f r n)) π :=
-  by
-  ext1 ω
-  simp_rw [stopped_process, stopped_value]
-  rw [least_ge_eq_min _ _ _ hπn]
+  by ext1 ω; simp_rw [stopped_process, stopped_value]; rw [least_ge_eq_min _ _ _ hπn]
 #align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGe
 
 theorem Submartingale.stoppedValue_leastGe [FiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
Diff
@@ -99,7 +99,7 @@ theorem stoppedValue_stoppedValue_leastGe (f : ℕ → Ω → ℝ) (π : Ω →
   rw [least_ge_eq_min _ _ _ hπn]
 #align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGe
 
-theorem Submartingale.stoppedValue_leastGe [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
+theorem Submartingale.stoppedValue_leastGe [FiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
     Submartingale (fun i => stoppedValue f (leastGe f r i)) ℱ μ :=
   by
   rw [submartingale_iff_expected_stopped_value_mono]
@@ -139,7 +139,7 @@ theorem norm_stoppedValue_leastGe_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
     exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _))
 #align measure_theory.norm_stopped_value_least_ge_le MeasureTheory.norm_stoppedValue_leastGe_le
 
-theorem Submartingale.stoppedValue_leastGe_snorm_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.stoppedValue_leastGe_snorm_le [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
     snorm (stoppedValue f (leastGe f r i)) 1 μ ≤ 2 * μ Set.univ * ENNReal.ofReal (r + R) :=
   by
@@ -151,7 +151,7 @@ theorem Submartingale.stoppedValue_leastGe_snorm_le [IsFiniteMeasure μ] (hf : S
   simp_rw [stopped_value, least_ge, hitting_of_le le_rfl, hf0, integral_zero']
 #align measure_theory.submartingale.stopped_value_least_ge_snorm_le MeasureTheory.Submartingale.stoppedValue_leastGe_snorm_le
 
-theorem Submartingale.stoppedValue_leastGe_snorm_le' [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.stoppedValue_leastGe_snorm_le' [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
     snorm (stoppedValue f (leastGe f r i)) 1 μ ≤
       ENNReal.toNNReal (2 * μ Set.univ * ENNReal.ofReal (r + R)) :=
@@ -161,7 +161,7 @@ theorem Submartingale.stoppedValue_leastGe_snorm_le' [IsFiniteMeasure μ] (hf :
 #align measure_theory.submartingale.stopped_value_least_ge_snorm_le' MeasureTheory.Submartingale.stoppedValue_leastGe_snorm_le'
 
 /-- This lemma is superceded by `submartingale.bdd_above_iff_exists_tendsto`. -/
-theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ]
+theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [FiniteMeasure μ]
     (hf : Submartingale f ℱ μ) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) → ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) :=
   by
@@ -190,7 +190,7 @@ theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ]
   simp only [← HEq, hω i]
 #align measure_theory.submartingale.exists_tendsto_of_abs_bdd_above_aux MeasureTheory.Submartingale.exists_tendsto_of_abs_bddAbove_aux
 
-theorem Submartingale.bddAbove_iff_exists_tendsto_aux [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.bddAbove_iff_exists_tendsto_aux [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) := by
   filter_upwards [hf.exists_tendsto_of_abs_bdd_above_aux hf0
@@ -199,7 +199,7 @@ theorem Submartingale.bddAbove_iff_exists_tendsto_aux [IsFiniteMeasure μ] (hf :
 
 /-- One sided martingale bound: If `f` is a submartingale which has uniformly bounded differences,
 then for almost every `ω`, `f n ω` is bounded above (in `n`) if and only if it converges. -/
-theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.bddAbove_iff_exists_tendsto [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) :=
   by
@@ -251,7 +251,7 @@ almost everywhere, the result follows.
 -/
 
 
-theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
+theorem Martingale.bddAbove_range_iff_bddBelow_range [FiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ BddBelow (Set.range fun n => f n ω) :=
   by
@@ -282,7 +282,7 @@ theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf :
     simpa only [Set.mem_range]
 #align measure_theory.martingale.bdd_above_range_iff_bdd_below_range MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range
 
-theorem Martingale.ae_not_tendsto_atTop_atTop [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
+theorem Martingale.ae_not_tendsto_atTop_atTop [FiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atTop := by
   filter_upwards [hf.bdd_above_range_iff_bdd_below_range
@@ -290,7 +290,7 @@ theorem Martingale.ae_not_tendsto_atTop_atTop [IsFiniteMeasure μ] (hf : Marting
       (hω.2 <| bddBelow_range_of_tendsto_atTop_atTop htop)
 #align measure_theory.martingale.ae_not_tendsto_at_top_at_top MeasureTheory.Martingale.ae_not_tendsto_atTop_atTop
 
-theorem Martingale.ae_not_tendsto_atTop_atBot [IsFiniteMeasure μ] (hf : Martingale f ℱ μ)
+theorem Martingale.ae_not_tendsto_atTop_atBot [FiniteMeasure μ] (hf : Martingale f ℱ μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) :
     ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atBot := by
   filter_upwards [hf.bdd_above_range_iff_bdd_below_range
@@ -344,7 +344,7 @@ theorem process_difference_le (s : ℕ → Set Ω) (ω : Ω) (n : ℕ) :
   rw [Pi.one_apply, norm_one]
 #align measure_theory.borel_cantelli.process_difference_le MeasureTheory.BorelCantelli.process_difference_le
 
-theorem integrable_process (μ : Measure Ω) [IsFiniteMeasure μ] (hs : ∀ n, measurable_set[ℱ n] (s n))
+theorem integrable_process (μ : Measure Ω) [FiniteMeasure μ] (hs : ∀ n, measurable_set[ℱ n] (s n))
     (n : ℕ) : Integrable (process s n) μ :=
   integrable_finset_sum' _ fun k hk =>
     IntegrableOn.integrable_indicator (integrable_const 1) <| ℱ.le _ _ <| hs _
@@ -356,7 +356,7 @@ open BorelCantelli
 
 /-- An a.e. monotone adapted process `f` with uniformly bounded differences converges to `+∞` if
 and only if its predictable part also converges to `+∞`. -/
-theorem tendsto_sum_indicator_atTop_iff [IsFiniteMeasure μ]
+theorem tendsto_sum_indicator_atTop_iff [FiniteMeasure μ]
     (hfmono : ∀ᵐ ω ∂μ, ∀ n, f n ω ≤ f (n + 1) ω) (hf : Adapted ℱ f) (hint : ∀ n, Integrable (f n) μ)
     (hbdd : ∀ᵐ ω ∂μ, ∀ n, |f (n + 1) ω - f n ω| ≤ R) :
     ∀ᵐ ω ∂μ,
@@ -395,7 +395,7 @@ theorem tendsto_sum_indicator_atTop_iff [IsFiniteMeasure μ]
 
 open BorelCantelli
 
-theorem tendsto_sum_indicator_atTop_iff' [IsFiniteMeasure μ] {s : ℕ → Set Ω}
+theorem tendsto_sum_indicator_atTop_iff' [FiniteMeasure μ] {s : ℕ → Set Ω}
     (hs : ∀ n, measurable_set[ℱ n] (s n)) :
     ∀ᵐ ω ∂μ,
       Tendsto (fun n => ∑ k in Finset.range n, (s (k + 1)).indicator (1 : Ω → ℝ) ω) atTop atTop ↔
@@ -416,7 +416,7 @@ theorem tendsto_sum_indicator_atTop_iff' [IsFiniteMeasure μ] {s : ℕ → Set 
 /-- **Lévy's generalization of the Borel-Cantelli lemma**: given a sequence of sets `s` and a
 filtration `ℱ` such that for all `n`, `s n` is `ℱ n`-measurable, `at_top.limsup s` is almost
 everywhere equal to the set for which `∑ k, ℙ(s (k + 1) | ℱ k) = ∞`. -/
-theorem ae_mem_limsup_atTop_iff (μ : Measure Ω) [IsFiniteMeasure μ] {s : ℕ → Set Ω}
+theorem ae_mem_limsup_atTop_iff (μ : Measure Ω) [FiniteMeasure μ] {s : ℕ → Set Ω}
     (hs : ∀ n, measurable_set[ℱ n] (s n)) :
     ∀ᵐ ω ∂μ,
       ω ∈ limsup s atTop ↔
Diff
@@ -99,7 +99,7 @@ theorem stoppedValue_stoppedValue_leastGe (f : ℕ → Ω → ℝ) (π : Ω →
   rw [least_ge_eq_min _ _ _ hπn]
 #align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGe
 
-theorem Submartingale.stoppedValueLeastGe [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
+theorem Submartingale.stoppedValue_leastGe [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
     Submartingale (fun i => stoppedValue f (leastGe f r i)) ℱ μ :=
   by
   rw [submartingale_iff_expected_stopped_value_mono]
@@ -119,7 +119,7 @@ theorem Submartingale.stoppedValueLeastGe [IsFiniteMeasure μ] (hf : Submartinga
     exact fun i =>
       integrable_stopped_value _ (hf.adapted.is_stopping_time_least_ge _ _) hf.integrable
         least_ge_le
-#align measure_theory.submartingale.stopped_value_least_ge MeasureTheory.Submartingale.stoppedValueLeastGe
+#align measure_theory.submartingale.stopped_value_least_ge MeasureTheory.Submartingale.stoppedValue_leastGe
 
 variable {r : ℝ} {R : ℝ≥0}
 
@@ -344,11 +344,11 @@ theorem process_difference_le (s : ℕ → Set Ω) (ω : Ω) (n : ℕ) :
   rw [Pi.one_apply, norm_one]
 #align measure_theory.borel_cantelli.process_difference_le MeasureTheory.BorelCantelli.process_difference_le
 
-theorem integrableProcess (μ : Measure Ω) [IsFiniteMeasure μ] (hs : ∀ n, measurable_set[ℱ n] (s n))
+theorem integrable_process (μ : Measure Ω) [IsFiniteMeasure μ] (hs : ∀ n, measurable_set[ℱ n] (s n))
     (n : ℕ) : Integrable (process s n) μ :=
-  integrableFinsetSum' _ fun k hk =>
-    IntegrableOn.integrableIndicator (integrableConst 1) <| ℱ.le _ _ <| hs _
-#align measure_theory.borel_cantelli.integrable_process MeasureTheory.BorelCantelli.integrableProcess
+  integrable_finset_sum' _ fun k hk =>
+    IntegrableOn.integrable_indicator (integrable_const 1) <| ℱ.le _ _ <| hs _
+#align measure_theory.borel_cantelli.integrable_process MeasureTheory.BorelCantelli.integrable_process
 
 end BorelCantelli
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kexing Ying
 
 ! This file was ported from Lean 3 source module probability.martingale.borel_cantelli
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -277,7 +277,7 @@ theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf :
     refine' neg_le.2 (hc _ _)
     simpa only [Pi.neg_apply, Set.mem_range, neg_inj]
   · rw [mem_lowerBounds] at hc
-    simp_rw [Set.mem_range, Pi.neg_apply, neg_eq_iff_neg_eq, eq_comm] at hω
+    simp_rw [Set.mem_range, Pi.neg_apply, neg_eq_iff_eq_neg] at hω
     refine' le_neg.1 (hc _ _)
     simpa only [Set.mem_range]
 #align measure_theory.martingale.bdd_above_range_iff_bdd_below_range MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range
Diff
@@ -35,7 +35,7 @@ is required to prove the generalized Borel-Cantelli.
 
 open Filter
 
-open NNReal Ennreal MeasureTheory ProbabilityTheory BigOperators Topology
+open NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
 
 namespace MeasureTheory
 
@@ -141,7 +141,7 @@ theorem norm_stoppedValue_leastGe_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
 
 theorem Submartingale.stoppedValue_leastGe_snorm_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
-    snorm (stoppedValue f (leastGe f r i)) 1 μ ≤ 2 * μ Set.univ * Ennreal.ofReal (r + R) :=
+    snorm (stoppedValue f (leastGe f r i)) 1 μ ≤ 2 * μ Set.univ * ENNReal.ofReal (r + R) :=
   by
   refine'
     snorm_one_le_of_le' ((hf.stopped_value_least_ge r).Integrable _) _
@@ -154,10 +154,10 @@ theorem Submartingale.stoppedValue_leastGe_snorm_le [IsFiniteMeasure μ] (hf : S
 theorem Submartingale.stoppedValue_leastGe_snorm_le' [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
     snorm (stoppedValue f (leastGe f r i)) 1 μ ≤
-      Ennreal.toNnreal (2 * μ Set.univ * Ennreal.ofReal (r + R)) :=
+      ENNReal.toNNReal (2 * μ Set.univ * ENNReal.ofReal (r + R)) :=
   by
   refine' (hf.stopped_value_least_ge_snorm_le hr hf0 hbdd i).trans _
-  simp [Ennreal.coe_toNnreal (measure_ne_top μ _), Ennreal.coe_toNnreal]
+  simp [ENNReal.coe_toNNReal (measure_ne_top μ _), ENNReal.coe_toNNReal]
 #align measure_theory.submartingale.stopped_value_least_ge_snorm_le' MeasureTheory.Submartingale.stoppedValue_leastGe_snorm_le'
 
 /-- This lemma is superceded by `submartingale.bdd_above_iff_exists_tendsto`. -/

Changes in mathlib4

mathlib3
mathlib4
chore: replace set_integral with setIntegral (#12215)

Done with a global search and replace, and then (to fix the #align lines), replace (#align \S*)setIntegral with $1set_integral.

Diff
@@ -138,7 +138,7 @@ theorem Submartingale.stoppedValue_leastGE_snorm_le [IsFiniteMeasure μ] (hf : S
   refine' snorm_one_le_of_le' ((hf.stoppedValue_leastGE r).integrable _) _
     (norm_stoppedValue_leastGE_le hr hf0 hbdd i)
   rw [← integral_univ]
-  refine' le_trans _ ((hf.stoppedValue_leastGE r).set_integral_le (zero_le _) MeasurableSet.univ)
+  refine' le_trans _ ((hf.stoppedValue_leastGE r).setIntegral_le (zero_le _) MeasurableSet.univ)
   simp_rw [stoppedValue, leastGE, hitting_of_le le_rfl, hf0, integral_zero', le_rfl]
 #align measure_theory.submartingale.stopped_value_least_ge_snorm_le MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le
 
chore: move Mathlib to v4.7.0-rc1 (#11162)

This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0 branch as we update to intermediate nightlies.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>

Diff
@@ -192,21 +192,21 @@ theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Sub
     hf.sub_martingale (martingale_const_fun _ _ (hf.adapted 0) (hf.integrable 0))
   have hg0 : g 0 = 0 := by
     ext ω
-    simp only [sub_self, Pi.zero_apply]
+    simp only [g, sub_self, Pi.zero_apply]
   have hgbdd : ∀ᵐ ω ∂μ, ∀ i : ℕ, |g (i + 1) ω - g i ω| ≤ ↑R := by
-    simpa only [sub_sub_sub_cancel_right]
+    simpa only [g, sub_sub_sub_cancel_right]
   filter_upwards [hg.bddAbove_iff_exists_tendsto_aux hg0 hgbdd] with ω hω
   convert hω using 1
   · refine' ⟨fun h => _, fun h => _⟩ <;> obtain ⟨b, hb⟩ := h <;>
     refine' ⟨b + |f 0 ω|, fun y hy => _⟩ <;> obtain ⟨n, rfl⟩ := hy
-    · simp_rw [sub_eq_add_neg]
+    · simp_rw [g, sub_eq_add_neg]
       exact add_le_add (hb ⟨n, rfl⟩) (neg_le_abs _)
     · exact sub_le_iff_le_add.1 (le_trans (sub_le_sub_left (le_abs_self _) _) (hb ⟨n, rfl⟩))
   · refine' ⟨fun h => _, fun h => _⟩ <;> obtain ⟨c, hc⟩ := h
     · exact ⟨c - f 0 ω, hc.sub_const _⟩
     · refine' ⟨c + f 0 ω, _⟩
       have := hc.add_const (f 0 ω)
-      simpa only [sub_add_cancel]
+      simpa only [g, sub_add_cancel]
 #align measure_theory.submartingale.bdd_above_iff_exists_tendsto MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto
 
 /-!
chore: remove terminal, terminal refines (#10762)

I replaced a few "terminal" refine/refine's with exact.

The strategy was very simple-minded: essentially any refine whose following line had smaller indentation got replaced by exact and then I cleaned up the mess.

This PR certainly leaves some further terminal refines, but maybe the current change is beneficial.

Diff
@@ -346,7 +346,7 @@ theorem tendsto_sum_indicator_atTop_iff [IsFiniteMeasure μ]
   · refine' tendsto_atTop_atTop_of_monotone' _ _
     · intro n m hnm
       simp only [predictablePart, Finset.sum_apply]
-      refine' Finset.sum_mono_set_of_nonneg hω₃ (Finset.range_mono hnm)
+      exact Finset.sum_mono_set_of_nonneg hω₃ (Finset.range_mono hnm)
     rintro ⟨b, hbdd⟩
     rw [← tendsto_neg_atBot_iff] at ht
     simp only [martingalePart, sub_eq_add_neg] at hω₁
refactor: Multiplicativise abs (#9553)

The current design for abs is flawed:

  • The Abs notation typeclass has exactly two instances: one for [Neg α] [Sup α], one for [Inv α] [Sup α]. This means that:
    • We can't write a meaningful hover for Abs.abs
    • Fields have two Abs instances!
  • We have the multiplicative definition but:
    • All the lemmas in Algebra.Order.Group.Abs are about the additive version.
    • The only lemmas about the multiplicative version are in Algebra.Order.Group.PosPart, and they get additivised to duplicates of the lemmas in Algebra.Order.Group.Abs!

This PR changes the notation typeclass with two new definitions (related through to_additive): mabs and abs. abs inherits the |a| notation and mabs gets |a|ₘ instead.

The first half of Algebra.Order.Group.Abs gets multiplicativised. A later PR will multiplicativise the second half, and another one will deduplicate the lemmas in Algebra.Order.Group.PosPart.

Part of #9411.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Diff
@@ -200,7 +200,7 @@ theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Sub
   · refine' ⟨fun h => _, fun h => _⟩ <;> obtain ⟨b, hb⟩ := h <;>
     refine' ⟨b + |f 0 ω|, fun y hy => _⟩ <;> obtain ⟨n, rfl⟩ := hy
     · simp_rw [sub_eq_add_neg]
-      exact add_le_add (hb ⟨n, rfl⟩) (neg_le_abs_self _)
+      exact add_le_add (hb ⟨n, rfl⟩) (neg_le_abs _)
     · exact sub_le_iff_le_add.1 (le_trans (sub_le_sub_left (le_abs_self _) _) (hb ⟨n, rfl⟩))
   · refine' ⟨fun h => _, fun h => _⟩ <;> obtain ⟨c, hc⟩ := h
     · exact ⟨c - f 0 ω, hc.sub_const _⟩
feat(Probability/BorelCantelli): clarify documentation (#8527)

Some of the students from my Lean seminar got quite confused trying to find the Borel-Cantelli lemmas in Mathlib, because there is a file Probability.Martingale.BorelCantelli but neither of the Borel-Cantelli lemmas are in it! This PR adds cross-links between the documentation strings for the various files concerned. (There are no changes to actual code.)

Diff
@@ -18,6 +18,10 @@ Borel-Cantelli lemmas. With this generalization, one can easily deduce the Borel
 by choosing appropriate filtrations. This file also contains the one sided martingale bound which
 is required to prove the generalized Borel-Cantelli.
 
+**Note**: the usual Borel-Cantelli lemmas are not in this file. See
+`MeasureTheory.measure_limsup_eq_zero` for the first (which does not depend on the results here),
+and `ProbabilityTheory.measure_limsup_eq_one` for the second (which does).
+
 ## Main results
 
 - `MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto`: the one sided martingale bound: given
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -89,7 +89,9 @@ theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : 
 theorem stoppedValue_stoppedValue_leastGE (f : ℕ → Ω → ℝ) (π : Ω → ℕ) (r : ℝ) {n : ℕ}
     (hπn : ∀ ω, π ω ≤ n) : stoppedValue (fun i => stoppedValue f (leastGE f r i)) π =
       stoppedValue (stoppedProcess f (leastGE f r n)) π := by
-  ext1 ω; simp_rw [stoppedProcess, stoppedValue]; rw [leastGE_eq_min _ _ _ hπn]
+  ext1 ω
+  simp (config := { unfoldPartialApp := true }) only [stoppedProcess, stoppedValue]
+  rw [leastGE_eq_min _ _ _ hπn]
 #align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGE
 
 theorem Submartingale.stoppedValue_leastGE [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) :
chore: remove unused simps (#6632)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -162,7 +162,6 @@ theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ]
   have heq : ∀ n, stoppedValue f (leastGE f i n) ω = f n ω := by
     intro n
     rw [leastGE]; unfold hitting; rw [stoppedValue]
-    simp only
     rw [if_neg]
     simp only [Set.mem_Icc, Set.mem_union, Set.mem_Ici]
     push_neg
@@ -191,7 +190,7 @@ theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Sub
   have hgbdd : ∀ᵐ ω ∂μ, ∀ i : ℕ, |g (i + 1) ω - g i ω| ≤ ↑R := by
     simpa only [sub_sub_sub_cancel_right]
   filter_upwards [hg.bddAbove_iff_exists_tendsto_aux hg0 hgbdd] with ω hω
-  convert hω using 1 <;> simp_rw [eq_iff_iff]
+  convert hω using 1
   · refine' ⟨fun h => _, fun h => _⟩ <;> obtain ⟨b, hb⟩ := h <;>
     refine' ⟨b + |f 0 ω|, fun y hy => _⟩ <;> obtain ⟨n, rfl⟩ := hy
     · simp_rw [sub_eq_add_neg]
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -36,7 +36,7 @@ open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
 
 namespace MeasureTheory
 
-variable {Ω : Type _} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {ℱ : Filtration ℕ m0} {f : ℕ → Ω → ℝ}
+variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {ℱ : Filtration ℕ m0} {f : ℕ → Ω → ℝ}
   {ω : Ω}
 
 /-!
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2022 Kexing Ying. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kexing Ying
-
-! This file was ported from Lean 3 source module probability.martingale.borel_cantelli
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Probability.Martingale.Convergence
 import Mathlib.Probability.Martingale.OptionalStopping
 import Mathlib.Probability.Martingale.Centering
 
+#align_import probability.martingale.borel_cantelli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
+
 /-!
 
 # Generalized Borel-Cantelli lemma
feat: port Probability.Martingale.BorelCantelli (#5285)

Dependencies 12 + 1021

1022 files ported (98.8%)
466258 lines ported (98.8%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file