probability.martingale.upcrossingMathlib.Probability.Martingale.Upcrossing

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Kexing Ying. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kexing Ying
 -/
-import Data.Set.Intervals.Monotone
+import Order.Interval.Set.Monotone
 import Probability.Process.HittingTime
 import Probability.Martingale.Basic
 
Diff
@@ -553,7 +553,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Subm
   have h₁ :
     (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossing_strat a b f N k) * (f (k + 1) - f k)] :=
     by
-    have := (hf.sum_sub_upcrossing_strat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ
+    have := (hf.sum_sub_upcrossing_strat_mul a b N).setIntegral_le (zero_le n) MeasurableSet.univ
     rw [integral_univ, integral_univ] at this
     refine' le_trans _ this
     simp only [Finset.range_zero, Finset.sum_empty, integral_zero']
@@ -1114,12 +1114,12 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       rw [(by simp :
           ∫⁻ ω, upcrossings_before a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossings_before a b f N ω : ℝ≥0) ∂μ),
         lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
-      · simp_rw [NNReal.coe_nat_cast]
+      · simp_rw [NNReal.coe_natCast]
         exact
           (ENNReal.ofReal_le_ofReal
                 (hf.mul_integral_upcrossings_before_le_integral_pos_part a b N)).trans
             (le_iSup _ N)
-      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossings_before hab]
+      · simp only [NNReal.coe_natCast, hf.adapted.integrable_upcrossings_before hab]
     ·
       exact fun n =>
         measurable_from_top.comp_ae_measurable
Diff
@@ -1087,9 +1087,9 @@ theorem upcrossings_lt_top_iff :
   constructor <;> rintro ⟨k, hk⟩
   · obtain ⟨m, hm⟩ := exists_nat_ge k
     refine' ⟨m, fun N => Nat.cast_le.1 ((hk N).trans _)⟩
-    rwa [← ENNReal.coe_nat, ENNReal.coe_le_coe]
+    rwa [← ENNReal.coe_natCast, ENNReal.coe_le_coe]
   · refine' ⟨k, fun N => _⟩
-    simp only [ENNReal.coe_nat, Nat.cast_le, hk N]
+    simp only [ENNReal.coe_natCast, Nat.cast_le, hk N]
 #align measure_theory.upcrossings_lt_top_iff MeasureTheory.upcrossings_lt_top_iff
 -/
 
Diff
@@ -359,7 +359,7 @@ theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTi
 theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) :
     ∃ n, upperCrossingTime a b f N n ω = N :=
   by
-  by_contra h; push_neg at h 
+  by_contra h; push_neg at h
   have : StrictMono fun n => upper_crossing_time a b f N n ω :=
     strictMono_nat_of_lt_succ fun n => upper_crossing_time_lt_succ hab (h _)
   obtain ⟨_, ⟨k, rfl⟩, hk⟩ :
@@ -399,10 +399,10 @@ theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω)
         (Set.Iic (Nat.find (exists_upper_crossing_time_eq f N ω hab)).pred) :=
       by
       refine' strictMonoOn_Iic_of_lt_succ fun m hm => upper_crossing_time_lt_succ hab _
-      rw [Nat.lt_pred_iff] at hm 
+      rw [Nat.lt_pred_iff] at hm
       convert Nat.find_min _ hm
     convert StrictMonoOn.Iic_id_le hmono N (Nat.le_pred_of_lt hN')
-  · rw [not_lt] at hN' 
+  · rw [not_lt] at hN'
     exact
       upper_crossing_time_stabilize hN' (Nat.find_spec (exists_upper_crossing_time_eq f N ω hab))
 #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq
@@ -489,7 +489,7 @@ theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 :=
       refine'
         le_trans upper_crossing_time_le_lower_crossing_time
           (lower_crossing_time_mono (Nat.succ_le_of_lt hij'))
-    · rw [gt_iff_lt] at hij' 
+    · rw [gt_iff_lt] at hij'
       rw [min_eq_right
           (upper_crossing_time_mono (Nat.succ_le_succ hij'.le) :
             upper_crossing_time a b f N _ ω ≤ upper_crossing_time a b f N _ ω),
@@ -554,7 +554,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Subm
     (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossing_strat a b f N k) * (f (k + 1) - f k)] :=
     by
     have := (hf.sum_sub_upcrossing_strat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ
-    rw [integral_univ, integral_univ] at this 
+    rw [integral_univ, integral_univ] at this
     refine' le_trans _ this
     simp only [Finset.range_zero, Finset.sum_empty, integral_zero']
   have h₂ :
@@ -571,7 +571,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Subm
         _
     convert (hf.sum_upcrossing_strat_mul a b N).Integrable n
     ext; simp
-  rw [h₂, sub_nonneg] at h₁ 
+  rw [h₂, sub_nonneg] at h₁
   refine' le_trans h₁ _
   simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _)]
 #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le
@@ -608,7 +608,7 @@ theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω;
 theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
     (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N :=
   haveI : upper_crossing_time a b f N (upcrossings_before a b f N ω) ω < N :=
-    (upper_crossing_time_lt_nonempty hN).cSup_mem
+    (upper_crossing_time_lt_nonempty hN).csSup_mem
       ((OrderBot.bddBelow _).finite_of_bddAbove (upper_crossing_time_lt_bdd_above hab))
   lt_of_le_of_lt (upper_crossing_time_mono hn) this
 #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore
@@ -647,7 +647,7 @@ theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
   · simp only [Nat.zero_eq, upper_crossing_time_zero, bot_eq_zero', eq_self_iff_true,
       lower_crossing_time_zero, true_and_iff, eq_comm]
     refine' hitting_eq_hitting_of_exists hNM _
-    simp only [lower_crossing_time, hitting_lt_iff] at h 
+    simp only [lower_crossing_time, hitting_lt_iff] at h
     obtain ⟨j, hj₁, hj₂⟩ := h
     exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
   · specialize
@@ -662,7 +662,7 @@ theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
     refine' ⟨this, _⟩
     simp only [lower_crossing_time, eq_comm, this]
     refine' hitting_eq_hitting_of_exists hNM _
-    rw [lower_crossing_time, hitting_lt_iff _ le_rfl] at h 
+    rw [lower_crossing_time, hitting_lt_iff _ le_rfl] at h
     swap; · infer_instance
     obtain ⟨j, hj₁, hj₂⟩ := h
     exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
@@ -681,7 +681,7 @@ theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
   refine' ⟨_, this⟩
   rw [upper_crossing_time_succ_eq, upper_crossing_time_succ_eq, eq_comm, this]
   refine' hitting_eq_hitting_of_exists hNM _
-  simp only [upper_crossing_time_succ_eq, hitting_lt_iff] at h 
+  simp only [upper_crossing_time_succ_eq, hitting_lt_iff] at h
   obtain ⟨j, hj₁, hj₂⟩ := h
   exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
 #align measure_theory.crossing_eq_crossing_of_upper_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_upperCrossingTime_lt
@@ -707,7 +707,7 @@ theorem upcrossingsBefore_mono (hab : a < b) : Monotone fun N ω => upcrossingsB
   · refine' csSup_le_csSup (upper_crossing_time_lt_bdd_above hab) hemp fun n hn => _
     rw [Set.mem_setOf_eq, upper_crossing_time_eq_upper_crossing_time_of_lt hNM hn]
     exact lt_of_lt_of_le hn hNM
-  · rw [Set.not_nonempty_iff_eq_empty] at hemp 
+  · rw [Set.not_nonempty_iff_eq_empty] at hemp
     simp [hemp, csSup_empty, bot_eq_zero', zero_le']
 #align measure_theory.upcrossings_before_mono MeasureTheory.upcrossingsBefore_mono
 -/
@@ -730,7 +730,7 @@ theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ
       rw [upper_crossing_time_eq_upper_crossing_time_of_lt (hN₁.trans (hN₂.trans <| Nat.le_succ _))
           this]
       exact this.le
-    · rw [not_lt, le_zero_iff] at hN 
+    · rw [not_lt, le_zero_iff] at hN
       rw [hN, upcrossings_before_zero, upper_crossing_time_zero]
       rfl
 #align measure_theory.upcrossings_before_lt_of_exists_upcrossing MeasureTheory.upcrossingsBefore_lt_of_exists_upcrossing
@@ -764,7 +764,7 @@ theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefor
   by
   have : N ≤ upper_crossing_time a b f N n ω :=
     by
-    rw [upcrossings_before] at hn 
+    rw [upcrossings_before] at hn
     rw [← not_lt]
     exact fun h => not_le.2 hn (le_csSup (upper_crossing_time_lt_bdd_above hab) h)
   simp [stopped_value, upper_crossing_time_stabilize' (Nat.le_succ n) this,
@@ -824,7 +824,7 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
         by
         refine'
           Finset.sum_le_sum fun i hi => le_sub_of_le_upcrossings_before (zero_lt_iff.2 hN) hab _
-        rwa [Finset.mem_range] at hi 
+        rwa [Finset.mem_range] at hi
       _ ≤
           ∑ k in Finset.range N,
             (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
@@ -842,7 +842,7 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
           · rw [sub_nonneg]
             exact le_trans (stopped_value_lower_crossing_time HEq) hf
         · rw [sub_eq_zero_of_upcrossings_before_lt hab]
-          rw [Finset.mem_range, not_lt] at hi 
+          rw [Finset.mem_range, not_lt] at hi
           exact lt_of_le_of_ne hi (Ne.symm hi')
   refine' le_trans _ h₂
   rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
@@ -878,7 +878,7 @@ theorem crossing_pos_eq (hab : a < b) :
     intro i ω
     refine' ⟨fun h => _, fun h => _⟩
     · rwa [← sub_le_sub_iff_right a, ← posPart_eq_of_posPart_pos (lt_of_lt_of_le hab' h)]
-    · rw [← sub_le_sub_iff_right a] at h 
+    · rw [← sub_le_sub_iff_right a] at h
       rwa [posPart_eq_self _ (le_trans hab'.le h)]
   have hf' : ∀ ω i, (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a :=
     by
@@ -890,9 +890,9 @@ theorem crossing_pos_eq (hab : a < b) :
     ext ω
     split_ifs with h₁ h₂ h₂
     · simp_rw [hf']
-    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂ 
+    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂
       exact False.elim (h₂ h₁)
-    · simp_rw [Set.mem_Iic, hf' _ _] at h₁ 
+    · simp_rw [Set.mem_Iic, hf' _ _] at h₁
       exact False.elim (h₁ h₂)
     · rfl
   · have :
@@ -903,9 +903,9 @@ theorem crossing_pos_eq (hab : a < b) :
       simp only [upper_crossing_time_succ_eq, ← ih.2, hitting, Set.mem_Ici, tsub_le_iff_right]
       split_ifs with h₁ h₂ h₂
       · simp_rw [← sub_le_iff_le_add, hf ω]
-      · simp_rw [Set.mem_Ici, ← hf _ _] at h₂ 
+      · simp_rw [Set.mem_Ici, ← hf _ _] at h₂
         exact False.elim (h₂ h₁)
-      · simp_rw [Set.mem_Ici, hf _ _] at h₁ 
+      · simp_rw [Set.mem_Ici, hf _ _] at h₁
         exact False.elim (h₁ h₂)
       · rfl
     refine' ⟨this, _⟩
@@ -913,9 +913,9 @@ theorem crossing_pos_eq (hab : a < b) :
     simp only [lower_crossing_time, this, hitting, Set.mem_Iic]
     split_ifs with h₁ h₂ h₂
     · simp_rw [hf' ω]
-    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂ 
+    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂
       exact False.elim (h₂ h₁)
-    · simp_rw [Set.mem_Iic, hf' _ _] at h₁ 
+    · simp_rw [Set.mem_Iic, hf' _ _] at h₁
       exact False.elim (h₁ h₂)
     · rfl
 #align measure_theory.crossing_pos_eq MeasureTheory.crossing_pos_eq
@@ -953,7 +953,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFin
   by
   by_cases hab : a < b
   · exact mul_integral_upcrossings_before_le_integral_pos_part_aux hf hab
-  · rw [not_lt, ← sub_nonpos] at hab 
+  · rw [not_lt, ← sub_nonpos] at hab
     exact
       le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
         (integral_nonneg fun ω => posPart_nonneg _)
@@ -1001,7 +1001,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
       {n : ℕ | upper_crossing_time a b f N n ω < N}.indicator 1 k = 1 :=
     by
     rintro k hk
-    rw [Finset.mem_Ico] at hk 
+    rw [Finset.mem_Ico] at hk
     rw [Set.indicator_of_mem]
     · rfl
     ·
@@ -1013,7 +1013,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
       {n : ℕ | upper_crossing_time a b f N n ω < N}.indicator 1 k = 0 :=
     by
     rintro k hk
-    rw [Finset.mem_Ico, Nat.succ_le_iff] at hk 
+    rw [Finset.mem_Ico, Nat.succ_le_iff] at hk
     rw [Set.indicator_of_not_mem]
     simp only [Set.mem_setOf_eq, not_lt]
     exact (upper_crossing_time_eq_of_upcrossings_before_lt hab hk.1).symm.le
@@ -1127,7 +1127,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
     · refine' eventually_of_forall fun ω N M hNM => _
       rw [Nat.cast_le]
       exact upcrossings_before_mono hab hNM ω
-  · rw [not_lt, ← sub_nonpos] at hab 
+  · rw [not_lt, ← sub_nonpos] at hab
     rw [ENNReal.ofReal_of_nonpos hab, MulZeroClass.zero_mul]
     exact zero_le _
 #align measure_theory.submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part
Diff
@@ -777,7 +777,75 @@ theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefor
 theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
     (b - a) * upcrossingsBefore a b f N ω ≤
       ∑ k in Finset.range N, upcrossingStrat a b f N k ω * (f (k + 1) - f k) ω :=
-  by classical
+  by
+  classical
+  by_cases hN : N = 0
+  · simp [hN]
+  simp_rw [upcrossing_strat, Finset.sum_mul, ← Set.indicator_mul_left, Pi.one_apply, Pi.sub_apply,
+    one_mul]
+  rw [Finset.sum_comm]
+  have h₁ :
+    ∀ k,
+      ∑ n in Finset.range N,
+          (Set.Ico (lower_crossing_time a b f N k ω)
+                (upper_crossing_time a b f N (k + 1) ω)).indicator
+            (fun m => f (m + 1) ω - f m ω) n =
+        stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+          stopped_value f (lower_crossing_time a b f N k) ω :=
+    by
+    intro k
+    rw [Finset.sum_indicator_eq_sum_filter,
+      (_ :
+        Finset.filter
+            (fun i =>
+              i ∈ Set.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω))
+            (Finset.range N) =
+          Finset.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω)),
+      Finset.sum_Ico_eq_add_neg _ lower_crossing_time_le_upper_crossing_time_succ,
+      Finset.sum_range_sub fun n => f n ω, Finset.sum_range_sub fun n => f n ω, neg_sub,
+      sub_add_sub_cancel]
+    · rfl
+    · ext i
+      simp only [Set.mem_Ico, Finset.mem_filter, Finset.mem_range, Finset.mem_Ico,
+        and_iff_right_iff_imp, and_imp]
+      exact fun _ h => lt_of_lt_of_le h upper_crossing_time_le
+  simp_rw [h₁]
+  have h₂ :
+    ∑ k in Finset.range (upcrossings_before a b f N ω), (b - a) ≤
+      ∑ k in Finset.range N,
+        (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+          stopped_value f (lower_crossing_time a b f N k) ω) :=
+    by
+    calc
+      ∑ k in Finset.range (upcrossings_before a b f N ω), (b - a) ≤
+          ∑ k in Finset.range (upcrossings_before a b f N ω),
+            (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+              stopped_value f (lower_crossing_time a b f N k) ω) :=
+        by
+        refine'
+          Finset.sum_le_sum fun i hi => le_sub_of_le_upcrossings_before (zero_lt_iff.2 hN) hab _
+        rwa [Finset.mem_range] at hi 
+      _ ≤
+          ∑ k in Finset.range N,
+            (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+              stopped_value f (lower_crossing_time a b f N k) ω) :=
+        by
+        refine'
+          Finset.sum_le_sum_of_subset_of_nonneg
+            (Finset.range_subset.2 (upcrossings_before_le f ω hab)) fun i _ hi => _
+        by_cases hi' : i = upcrossings_before a b f N ω
+        · subst hi'
+          simp only [stopped_value]
+          rw [upper_crossing_time_eq_of_upcrossings_before_lt hab (Nat.lt_succ_self _)]
+          by_cases heq : lower_crossing_time a b f N (upcrossings_before a b f N ω) ω = N
+          · rw [HEq, sub_self]
+          · rw [sub_nonneg]
+            exact le_trans (stopped_value_lower_crossing_time HEq) hf
+        · rw [sub_eq_zero_of_upcrossings_before_lt hab]
+          rw [Finset.mem_range, not_lt] at hi 
+          exact lt_of_le_of_ne hi (Ne.symm hi')
+  refine' le_trans _ h₂
+  rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
 #align measure_theory.mul_upcrossings_before_le MeasureTheory.mul_upcrossingsBefore_le
 -/
 
Diff
@@ -777,75 +777,7 @@ theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefor
 theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
     (b - a) * upcrossingsBefore a b f N ω ≤
       ∑ k in Finset.range N, upcrossingStrat a b f N k ω * (f (k + 1) - f k) ω :=
-  by
-  classical
-  by_cases hN : N = 0
-  · simp [hN]
-  simp_rw [upcrossing_strat, Finset.sum_mul, ← Set.indicator_mul_left, Pi.one_apply, Pi.sub_apply,
-    one_mul]
-  rw [Finset.sum_comm]
-  have h₁ :
-    ∀ k,
-      ∑ n in Finset.range N,
-          (Set.Ico (lower_crossing_time a b f N k ω)
-                (upper_crossing_time a b f N (k + 1) ω)).indicator
-            (fun m => f (m + 1) ω - f m ω) n =
-        stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-          stopped_value f (lower_crossing_time a b f N k) ω :=
-    by
-    intro k
-    rw [Finset.sum_indicator_eq_sum_filter,
-      (_ :
-        Finset.filter
-            (fun i =>
-              i ∈ Set.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω))
-            (Finset.range N) =
-          Finset.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω)),
-      Finset.sum_Ico_eq_add_neg _ lower_crossing_time_le_upper_crossing_time_succ,
-      Finset.sum_range_sub fun n => f n ω, Finset.sum_range_sub fun n => f n ω, neg_sub,
-      sub_add_sub_cancel]
-    · rfl
-    · ext i
-      simp only [Set.mem_Ico, Finset.mem_filter, Finset.mem_range, Finset.mem_Ico,
-        and_iff_right_iff_imp, and_imp]
-      exact fun _ h => lt_of_lt_of_le h upper_crossing_time_le
-  simp_rw [h₁]
-  have h₂ :
-    ∑ k in Finset.range (upcrossings_before a b f N ω), (b - a) ≤
-      ∑ k in Finset.range N,
-        (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-          stopped_value f (lower_crossing_time a b f N k) ω) :=
-    by
-    calc
-      ∑ k in Finset.range (upcrossings_before a b f N ω), (b - a) ≤
-          ∑ k in Finset.range (upcrossings_before a b f N ω),
-            (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-              stopped_value f (lower_crossing_time a b f N k) ω) :=
-        by
-        refine'
-          Finset.sum_le_sum fun i hi => le_sub_of_le_upcrossings_before (zero_lt_iff.2 hN) hab _
-        rwa [Finset.mem_range] at hi 
-      _ ≤
-          ∑ k in Finset.range N,
-            (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-              stopped_value f (lower_crossing_time a b f N k) ω) :=
-        by
-        refine'
-          Finset.sum_le_sum_of_subset_of_nonneg
-            (Finset.range_subset.2 (upcrossings_before_le f ω hab)) fun i _ hi => _
-        by_cases hi' : i = upcrossings_before a b f N ω
-        · subst hi'
-          simp only [stopped_value]
-          rw [upper_crossing_time_eq_of_upcrossings_before_lt hab (Nat.lt_succ_self _)]
-          by_cases heq : lower_crossing_time a b f N (upcrossings_before a b f N ω) ω = N
-          · rw [HEq, sub_self]
-          · rw [sub_nonneg]
-            exact le_trans (stopped_value_lower_crossing_time HEq) hf
-        · rw [sub_eq_zero_of_upcrossings_before_lt hab]
-          rw [Finset.mem_range, not_lt] at hi 
-          exact lt_of_le_of_ne hi (Ne.symm hi')
-  refine' le_trans _ h₂
-  rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
+  by classical
 #align measure_theory.mul_upcrossings_before_le MeasureTheory.mul_upcrossingsBefore_le
 -/
 
Diff
@@ -877,15 +877,13 @@ theorem crossing_pos_eq (hab : a < b) :
     by
     intro i ω
     refine' ⟨fun h => _, fun h => _⟩
-    ·
-      rwa [← sub_le_sub_iff_right a, ←
-        LatticeOrderedGroup.pos_eq_self_of_pos_pos (lt_of_lt_of_le hab' h)]
+    · rwa [← sub_le_sub_iff_right a, ← posPart_eq_of_posPart_pos (lt_of_lt_of_le hab' h)]
     · rw [← sub_le_sub_iff_right a] at h 
-      rwa [LatticeOrderedGroup.pos_of_nonneg _ (le_trans hab'.le h)]
+      rwa [posPart_eq_self _ (le_trans hab'.le h)]
   have hf' : ∀ ω i, (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a :=
     by
     intro ω i
-    rw [LatticeOrderedGroup.pos_nonpos_iff, sub_nonpos]
+    rw [posPart_nonpos, sub_nonpos]
   induction' n with k ih
   · refine' ⟨rfl, _⟩
     simp only [lower_crossing_time_zero, hitting, Set.mem_Icc, Set.mem_Iic]
@@ -938,8 +936,7 @@ theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure
   refine'
     le_trans (le_of_eq _)
       (integral_mul_upcrossings_before_le_integral (hf.sub_martingale (martingale_const _ _ _)).Pos
-        (fun ω => LatticeOrderedGroup.pos_nonneg _) (fun ω => LatticeOrderedGroup.pos_nonneg _)
-        (sub_pos.2 hab))
+        (fun ω => posPart_nonneg _) (fun ω => posPart_nonneg _) (sub_pos.2 hab))
   simp_rw [sub_zero, ← upcrossings_before_pos_eq hab]
   rfl
 #align measure_theory.mul_integral_upcrossings_before_le_integral_pos_part_aux MeasureTheory.mul_integral_upcrossingsBefore_le_integral_pos_part_aux
@@ -959,7 +956,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFin
   · rw [not_lt, ← sub_nonpos] at hab 
     exact
       le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
-        (integral_nonneg fun ω => LatticeOrderedGroup.pos_nonneg _)
+        (integral_nonneg fun ω => posPart_nonneg _)
 #align measure_theory.submartingale.mul_integral_upcrossings_before_le_integral_pos_part MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part
 -/
 
@@ -1110,7 +1107,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       intro N
       rw [of_real_integral_eq_lintegral_of_real]
       · exact (hf.sub_martingale (martingale_const _ _ _)).Pos.Integrable _
-      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
+      · exact eventually_of_forall fun ω => posPart_nonneg _
     rw [lintegral_supr']
     · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
       intro N
Diff
@@ -475,7 +475,7 @@ theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω :=
 #print MeasureTheory.upcrossingStrat_le_one /-
 theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 :=
   by
-  rw [upcrossing_strat, ← Set.indicator_finset_biUnion_apply]
+  rw [upcrossing_strat, ← Finset.indicator_biUnion_apply]
   · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _
   · intro i hi j hj hij
     rw [Set.Ico_disjoint_Ico]
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.Data.Set.Intervals.Monotone
-import Mathbin.Probability.Process.HittingTime
-import Mathbin.Probability.Martingale.Basic
+import Data.Set.Intervals.Monotone
+import Probability.Process.HittingTime
+import Probability.Martingale.Basic
 
 #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"e8e130de9dba4ed6897183c3193c752ffadbcc77"
 
Diff
@@ -879,13 +879,13 @@ theorem crossing_pos_eq (hab : a < b) :
     refine' ⟨fun h => _, fun h => _⟩
     ·
       rwa [← sub_le_sub_iff_right a, ←
-        LatticeOrderedCommGroup.pos_eq_self_of_pos_pos (lt_of_lt_of_le hab' h)]
+        LatticeOrderedGroup.pos_eq_self_of_pos_pos (lt_of_lt_of_le hab' h)]
     · rw [← sub_le_sub_iff_right a] at h 
-      rwa [LatticeOrderedCommGroup.pos_of_nonneg _ (le_trans hab'.le h)]
+      rwa [LatticeOrderedGroup.pos_of_nonneg _ (le_trans hab'.le h)]
   have hf' : ∀ ω i, (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a :=
     by
     intro ω i
-    rw [LatticeOrderedCommGroup.pos_nonpos_iff, sub_nonpos]
+    rw [LatticeOrderedGroup.pos_nonpos_iff, sub_nonpos]
   induction' n with k ih
   · refine' ⟨rfl, _⟩
     simp only [lower_crossing_time_zero, hitting, Set.mem_Icc, Set.mem_Iic]
@@ -938,8 +938,8 @@ theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure
   refine'
     le_trans (le_of_eq _)
       (integral_mul_upcrossings_before_le_integral (hf.sub_martingale (martingale_const _ _ _)).Pos
-        (fun ω => LatticeOrderedCommGroup.pos_nonneg _)
-        (fun ω => LatticeOrderedCommGroup.pos_nonneg _) (sub_pos.2 hab))
+        (fun ω => LatticeOrderedGroup.pos_nonneg _) (fun ω => LatticeOrderedGroup.pos_nonneg _)
+        (sub_pos.2 hab))
   simp_rw [sub_zero, ← upcrossings_before_pos_eq hab]
   rfl
 #align measure_theory.mul_integral_upcrossings_before_le_integral_pos_part_aux MeasureTheory.mul_integral_upcrossingsBefore_le_integral_pos_part_aux
@@ -959,7 +959,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFin
   · rw [not_lt, ← sub_nonpos] at hab 
     exact
       le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
-        (integral_nonneg fun ω => LatticeOrderedCommGroup.pos_nonneg _)
+        (integral_nonneg fun ω => LatticeOrderedGroup.pos_nonneg _)
 #align measure_theory.submartingale.mul_integral_upcrossings_before_le_integral_pos_part MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part
 -/
 
@@ -1110,7 +1110,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       intro N
       rw [of_real_integral_eq_lintegral_of_real]
       · exact (hf.sub_martingale (martingale_const _ _ _)).Pos.Integrable _
-      · exact eventually_of_forall fun ω => LatticeOrderedCommGroup.pos_nonneg _
+      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
     rw [lintegral_supr']
     · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
       intro N
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.upcrossing
-! 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.Data.Set.Intervals.Monotone
 import Mathbin.Probability.Process.HittingTime
 import Mathbin.Probability.Martingale.Basic
 
+#align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"e8e130de9dba4ed6897183c3193c752ffadbcc77"
+
 /-!
 
 # Doob's upcrossing estimate
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.upcrossing
-! leanprover-community/mathlib commit 2c1d8ca2812b64f88992a5294ea3dba144755cd1
+! 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.Basic
 
 # Doob's upcrossing estimate
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting $U_N(a, b)$ the
 number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing
 estimate (also known as Doob's inequality) states that
Diff
@@ -130,13 +130,16 @@ To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$.
 -/
 
 
+#print MeasureTheory.lowerCrossingTimeAux /-
 /-- `lower_crossing_time_aux a f c N` is the first time `f` reached below `a` after time `c` before
 time `N`. -/
 noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) :
     Ω → ι :=
   hitting f (Set.Iic a) c N
 #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux
+-/
 
+#print MeasureTheory.upperCrossingTime /-
 /-- `upper_crossing_time a b f N n` is the first time before time `N`, `f` reaches
 above `b` after `f` reached below `a` for the `n - 1`-th time. -/
 noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
@@ -145,12 +148,15 @@ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b
   | n + 1 => fun ω =>
     hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upper_crossing_time n ω) N ω) N ω
 #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime
+-/
 
+#print MeasureTheory.lowerCrossingTime /-
 /-- `lower_crossing_time a b f N n` is the first time before time `N`, `f` reaches
 below `a` after `f` reached above `b` for the `n`-th time. -/
 noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
     (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω
 #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime
+-/
 
 section
 
@@ -158,22 +164,29 @@ variable [Preorder ι] [OrderBot ι] [InfSet ι]
 
 variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω}
 
+#print MeasureTheory.upperCrossingTime_zero /-
 @[simp]
 theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ :=
   rfl
 #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero
+-/
 
+#print MeasureTheory.lowerCrossingTime_zero /-
 @[simp]
 theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N :=
   rfl
 #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero
+-/
 
+#print MeasureTheory.upperCrossingTime_succ /-
 theorem upperCrossingTime_succ :
     upperCrossingTime a b f N (n + 1) ω =
       hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω :=
   by rw [upper_crossing_time]
 #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ
+-/
 
+#print MeasureTheory.upperCrossingTime_succ_eq /-
 theorem upperCrossingTime_succ_eq (ω : Ω) :
     upperCrossingTime a b f N (n + 1) ω =
       hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω :=
@@ -181,6 +194,7 @@ theorem upperCrossingTime_succ_eq (ω : Ω) :
   simp only [upper_crossing_time_succ]
   rfl
 #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq
+-/
 
 end
 
@@ -190,34 +204,45 @@ variable [ConditionallyCompleteLinearOrderBot ι]
 
 variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω}
 
+#print MeasureTheory.upperCrossingTime_le /-
 theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N :=
   by
   cases n
   · simp only [upper_crossing_time_zero, Pi.bot_apply, bot_le]
   · simp only [upper_crossing_time_succ, hitting_le]
 #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le
+-/
 
+#print MeasureTheory.upperCrossingTime_zero' /-
 @[simp]
 theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ :=
   eq_bot_iff.2 upperCrossingTime_le
 #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero'
+-/
 
+#print MeasureTheory.lowerCrossingTime_le /-
 theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by
   simp only [lower_crossing_time, hitting_le ω]
 #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le
+-/
 
+#print MeasureTheory.upperCrossingTime_le_lowerCrossingTime /-
 theorem upperCrossingTime_le_lowerCrossingTime :
     upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by
   simp only [lower_crossing_time, le_hitting upper_crossing_time_le ω]
 #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime
+-/
 
+#print MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ /-
 theorem lowerCrossingTime_le_upperCrossingTime_succ :
     lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω :=
   by
   rw [upper_crossing_time_succ]
   exact le_hitting lower_crossing_time_le ω
 #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ
+-/
 
+#print MeasureTheory.lowerCrossingTime_mono /-
 theorem lowerCrossingTime_mono (hnm : n ≤ m) :
     lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω :=
   by
@@ -227,7 +252,9 @@ theorem lowerCrossingTime_mono (hnm : n ≤ m) :
       le_trans lower_crossing_time_le_upper_crossing_time_succ
         upper_crossing_time_le_lower_crossing_time
 #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono
+-/
 
+#print MeasureTheory.upperCrossingTime_mono /-
 theorem upperCrossingTime_mono (hnm : n ≤ m) :
     upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω :=
   by
@@ -237,11 +264,13 @@ theorem upperCrossingTime_mono (hnm : n ≤ m) :
       le_trans upper_crossing_time_le_lower_crossing_time
         lower_crossing_time_le_upper_crossing_time_succ
 #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono
+-/
 
 end ConditionallyCompleteLinearOrderBot
 
 variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω}
 
+#print MeasureTheory.stoppedValue_lowerCrossingTime /-
 theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) :
     stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a :=
   by
@@ -249,7 +278,9 @@ theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N
     (hitting_le_iff_of_lt _ (lt_of_le_of_ne lower_crossing_time_le h)).1 le_rfl
   exact stopped_value_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lower_crossing_time_le⟩, hj₂⟩
 #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime
+-/
 
+#print MeasureTheory.stoppedValue_upperCrossingTime /-
 theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) :
     b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω :=
   by
@@ -257,7 +288,9 @@ theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω
     (hitting_le_iff_of_lt _ (lt_of_le_of_ne upper_crossing_time_le h)).1 le_rfl
   exact stopped_value_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩
 #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime
+-/
 
+#print MeasureTheory.upperCrossingTime_lt_lowerCrossingTime /-
 theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b)
     (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) :
     upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω :=
@@ -269,7 +302,9 @@ theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b)
   rw [← h]
   exact stopped_value_upper_crossing_time (h.symm ▸ hn)
 #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime
+-/
 
+#print MeasureTheory.lowerCrossingTime_lt_upperCrossingTime /-
 theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b)
     (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) :
     lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω :=
@@ -281,33 +316,45 @@ theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b)
   rw [← h]
   exact stopped_value_lower_crossing_time (h.symm ▸ hn)
 #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime
+-/
 
+#print MeasureTheory.upperCrossingTime_lt_succ /-
 theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) :
     upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω :=
   lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime
     (lowerCrossingTime_lt_upperCrossingTime hab hn)
 #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ
+-/
 
+#print MeasureTheory.lowerCrossingTime_stabilize /-
 theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) :
     lowerCrossingTime a b f N m ω = N :=
   le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm))
 #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize
+-/
 
+#print MeasureTheory.upperCrossingTime_stabilize /-
 theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) :
     upperCrossingTime a b f N m ω = N :=
   le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm))
 #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize
+-/
 
+#print MeasureTheory.lowerCrossingTime_stabilize' /-
 theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) :
     lowerCrossingTime a b f N m ω = N :=
   lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn)
 #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize'
+-/
 
+#print MeasureTheory.upperCrossingTime_stabilize' /-
 theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) :
     upperCrossingTime a b f N m ω = N :=
   upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn)
 #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize'
+-/
 
+#print MeasureTheory.exists_upperCrossingTime_eq /-
 -- `upper_crossing_time_bound_eq` provides an explicit bound
 theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) :
     ∃ n, upperCrossingTime a b f N n ω = N :=
@@ -321,7 +368,9 @@ theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω)
       lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩
   exact not_le.2 hk upper_crossing_time_le
 #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq
+-/
 
+#print MeasureTheory.upperCrossingTime_lt_bddAbove /-
 theorem upperCrossingTime_lt_bddAbove (hab : a < b) :
     BddAbove {n | upperCrossingTime a b f N n ω < N} :=
   by
@@ -330,12 +379,16 @@ theorem upperCrossingTime_lt_bddAbove (hab : a < b) :
   by_contra hn'
   exact hn.ne (upper_crossing_time_stabilize (not_le.1 hn').le hk)
 #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove
+-/
 
+#print MeasureTheory.upperCrossingTime_lt_nonempty /-
 theorem upperCrossingTime_lt_nonempty (hN : 0 < N) :
     {n | upperCrossingTime a b f N n ω < N}.Nonempty :=
   ⟨0, hN⟩
 #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty
+-/
 
+#print MeasureTheory.upperCrossingTime_bound_eq /-
 theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) :
     upperCrossingTime a b f N N ω = N :=
   by
@@ -353,15 +406,19 @@ theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω)
     exact
       upper_crossing_time_stabilize hN' (Nat.find_spec (exists_upper_crossing_time_eq f N ω hab))
 #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq
+-/
 
+#print MeasureTheory.upperCrossingTime_eq_of_bound_le /-
 theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) :
     upperCrossingTime a b f N n ω = N :=
   le_antisymm upperCrossingTime_le
     (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn))
 #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le
+-/
 
 variable {ℱ : Filtration ℕ m0}
 
+#print MeasureTheory.Adapted.isStoppingTime_crossing /-
 theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) :
     IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧
       IsStoppingTime ℱ (lowerCrossingTime a b f N n) :=
@@ -383,17 +440,23 @@ theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) :
         is_stopping_time_hitting_is_stopping_time this (fun _ => upper_crossing_time_le)
           measurableSet_Iic hf _
 #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing
+-/
 
+#print MeasureTheory.Adapted.isStoppingTime_upperCrossingTime /-
 theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) :
     IsStoppingTime ℱ (upperCrossingTime a b f N n) :=
   hf.isStoppingTime_crossing.1
 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime
+-/
 
+#print MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-
 theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) :
     IsStoppingTime ℱ (lowerCrossingTime a b f N n) :=
   hf.isStoppingTime_crossing.2
 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime
+-/
 
+#print MeasureTheory.upcrossingStrat /-
 /-- `upcrossing_strat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper
 crossings and is 0 otherwise. `upcrossing_strat` is shifted by one index so that it is adapted
 rather than predictable. -/
@@ -401,11 +464,15 @@ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : 
   ∑ k in Finset.range N,
     (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n
 #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat
+-/
 
+#print MeasureTheory.upcrossingStrat_nonneg /-
 theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω :=
   Finset.sum_nonneg fun i hi => Set.indicator_nonneg (fun ω hω => zero_le_one) _
 #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg
+-/
 
+#print MeasureTheory.upcrossingStrat_le_one /-
 theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 :=
   by
   rw [upcrossing_strat, ← Set.indicator_finset_biUnion_apply]
@@ -433,7 +500,9 @@ theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 :=
         le_trans upper_crossing_time_le_lower_crossing_time
           (lower_crossing_time_mono (Nat.succ_le_of_lt hij'))
 #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one
+-/
 
+#print MeasureTheory.Adapted.upcrossingStrat_adapted /-
 theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) :=
   by
   intro n
@@ -449,7 +518,9 @@ theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcr
   simp_rw [← not_le]
   exact (hf.is_stopping_time_upper_crossing_time n).compl
 #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted
+-/
 
+#print MeasureTheory.Submartingale.sum_upcrossingStrat_mul /-
 theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (a b : ℝ) (N : ℕ) :
     Submartingale
@@ -457,7 +528,9 @@ theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submart
   hf.sum_mul_sub hf.Adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ =>
     upcrossingStrat_nonneg
 #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul
+-/
 
+#print MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul /-
 theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (a b : ℝ) (N : ℕ) :
     Submartingale
@@ -471,7 +544,9 @@ theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Sub
   · intro n ω
     simp [upcrossing_strat_le_one]
 #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul
+-/
 
+#print MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-
 theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) :
     μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] :=
   by
@@ -500,26 +575,36 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Subm
   refine' le_trans h₁ _
   simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _)]
 #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le
+-/
 
+#print MeasureTheory.upcrossingsBefore /-
 /-- The number of upcrossings (strictly) before time `N`. -/
 noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
     (N : ι) (ω : Ω) : ℕ :=
   sSup {n | upperCrossingTime a b f N n ω < N}
 #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore
+-/
 
+#print MeasureTheory.upcrossingsBefore_bot /-
 @[simp]
 theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ}
     {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossings_before]
 #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot
+-/
 
+#print MeasureTheory.upcrossingsBefore_zero /-
 theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossings_before]
 #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero
+-/
 
+#print MeasureTheory.upcrossingsBefore_zero' /-
 @[simp]
 theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω;
   exact upcrossings_before_zero
 #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero'
+-/
 
+#print MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore /-
 theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
     (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N :=
   haveI : upper_crossing_time a b f N (upcrossings_before a b f N ω) ω < N :=
@@ -527,14 +612,18 @@ theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
       ((OrderBot.bddBelow _).finite_of_bddAbove (upper_crossing_time_lt_bdd_above hab))
   lt_of_le_of_lt (upper_crossing_time_mono hn) this
 #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore
+-/
 
+#print MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt /-
 theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b)
     (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N :=
   by
   refine' le_antisymm upper_crossing_time_le (not_lt.1 _)
   convert not_mem_of_csSup_lt hn (upper_crossing_time_lt_bdd_above hab)
 #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt
+-/
 
+#print MeasureTheory.upcrossingsBefore_le /-
 theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) :
     upcrossingsBefore a b f N ω ≤ N := by
   by_cases hN : N = 0
@@ -544,7 +633,9 @@ theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) :
     by_contra hnN
     exact hn.ne (upper_crossing_time_eq_of_bound_le hab (not_le.1 hnN).le)
 #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le
+-/
 
+#print MeasureTheory.crossing_eq_crossing_of_lowerCrossingTime_lt /-
 theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
     (h : lowerCrossingTime a b f N n ω < N) :
     upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧
@@ -576,7 +667,9 @@ theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
     obtain ⟨j, hj₁, hj₂⟩ := h
     exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
 #align measure_theory.crossing_eq_crossing_of_lower_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_lowerCrossingTime_lt
+-/
 
+#print MeasureTheory.crossing_eq_crossing_of_upperCrossingTime_lt /-
 theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
     (h : upperCrossingTime a b f N (n + 1) ω < N) :
     upperCrossingTime a b f M (n + 1) ω = upperCrossingTime a b f N (n + 1) ω ∧
@@ -592,7 +685,9 @@ theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
   obtain ⟨j, hj₁, hj₂⟩ := h
   exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
 #align measure_theory.crossing_eq_crossing_of_upper_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_upperCrossingTime_lt
+-/
 
+#print MeasureTheory.upperCrossingTime_eq_upperCrossingTime_of_lt /-
 theorem upperCrossingTime_eq_upperCrossingTime_of_lt {M : ℕ} (hNM : N ≤ M)
     (h : upperCrossingTime a b f N n ω < N) :
     upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω :=
@@ -601,7 +696,9 @@ theorem upperCrossingTime_eq_upperCrossingTime_of_lt {M : ℕ} (hNM : N ≤ M)
   · simp
   · exact (crossing_eq_crossing_of_upper_crossing_time_lt hNM h).1
 #align measure_theory.upper_crossing_time_eq_upper_crossing_time_of_lt MeasureTheory.upperCrossingTime_eq_upperCrossingTime_of_lt
+-/
 
+#print MeasureTheory.upcrossingsBefore_mono /-
 theorem upcrossingsBefore_mono (hab : a < b) : Monotone fun N ω => upcrossingsBefore a b f N ω :=
   by
   intro N M hNM ω
@@ -613,7 +710,9 @@ theorem upcrossingsBefore_mono (hab : a < b) : Monotone fun N ω => upcrossingsB
   · rw [Set.not_nonempty_iff_eq_empty] at hemp 
     simp [hemp, csSup_empty, bot_eq_zero', zero_le']
 #align measure_theory.upcrossings_before_mono MeasureTheory.upcrossingsBefore_mono
+-/
 
+#print MeasureTheory.upcrossingsBefore_lt_of_exists_upcrossing /-
 theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ} (hN₁ : N ≤ N₁)
     (hN₁' : f N₁ ω < a) (hN₂ : N₁ ≤ N₂) (hN₂' : b < f N₂ ω) :
     upcrossingsBefore a b f N ω < upcrossingsBefore a b f (N₂ + 1) ω :=
@@ -635,13 +734,17 @@ theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ
       rw [hN, upcrossings_before_zero, upper_crossing_time_zero]
       rfl
 #align measure_theory.upcrossings_before_lt_of_exists_upcrossing MeasureTheory.upcrossingsBefore_lt_of_exists_upcrossing
+-/
 
+#print MeasureTheory.lowerCrossingTime_lt_of_lt_upcrossingsBefore /-
 theorem lowerCrossingTime_lt_of_lt_upcrossingsBefore (hN : 0 < N) (hab : a < b)
     (hn : n < upcrossingsBefore a b f N ω) : lowerCrossingTime a b f N n ω < N :=
   lt_of_le_of_lt lowerCrossingTime_le_upperCrossingTime_succ
     (upperCrossingTime_lt_of_le_upcrossingsBefore hN hab hn)
 #align measure_theory.lower_crossing_time_lt_of_lt_upcrossings_before MeasureTheory.lowerCrossingTime_lt_of_lt_upcrossingsBefore
+-/
 
+#print MeasureTheory.le_sub_of_le_upcrossingsBefore /-
 theorem le_sub_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
     (hn : n < upcrossingsBefore a b f N ω) :
     b - a ≤
@@ -651,7 +754,9 @@ theorem le_sub_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
     (stoppedValue_upperCrossingTime (upperCrossingTime_lt_of_le_upcrossingsBefore hN hab hn).Ne)
     (stoppedValue_lowerCrossingTime (lowerCrossingTime_lt_of_lt_upcrossingsBefore hN hab hn).Ne)
 #align measure_theory.le_sub_of_le_upcrossings_before MeasureTheory.le_sub_of_le_upcrossingsBefore
+-/
 
+#print MeasureTheory.sub_eq_zero_of_upcrossingsBefore_lt /-
 theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) :
     stoppedValue f (upperCrossingTime a b f N (n + 1)) ω -
         stoppedValue f (lowerCrossingTime a b f N n) ω =
@@ -666,7 +771,9 @@ theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefor
     lower_crossing_time_stabilize' le_rfl
       (le_trans this upper_crossing_time_le_lower_crossing_time)]
 #align measure_theory.sub_eq_zero_of_upcrossings_before_lt MeasureTheory.sub_eq_zero_of_upcrossingsBefore_lt
+-/
 
+#print MeasureTheory.mul_upcrossingsBefore_le /-
 theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
     (b - a) * upcrossingsBefore a b f N ω ≤
       ∑ k in Finset.range N, upcrossingStrat a b f N k ω * (f (k + 1) - f k) ω :=
@@ -740,7 +847,9 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
   refine' le_trans _ h₂
   rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
 #align measure_theory.mul_upcrossings_before_le MeasureTheory.mul_upcrossingsBefore_le
+-/
 
+#print MeasureTheory.integral_mul_upcrossingsBefore_le_integral /-
 theorem integral_mul_upcrossingsBefore_le_integral [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hfN : ∀ ω, a ≤ f N ω) (hfzero : 0 ≤ f 0) (hab : a < b) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[f N] :=
@@ -756,7 +865,9 @@ theorem integral_mul_upcrossingsBefore_le_integral [IsFiniteMeasure μ] (hf : Su
     _ ≤ μ[f N] - μ[f 0] := hf.sum_mul_upcrossingStrat_le
     _ ≤ μ[f N] := (sub_le_self_iff _).2 (integral_nonneg hfzero)
 #align measure_theory.integral_mul_upcrossings_before_le_integral MeasureTheory.integral_mul_upcrossingsBefore_le_integral
+-/
 
+#print MeasureTheory.crossing_pos_eq /-
 theorem crossing_pos_eq (hab : a < b) :
     upperCrossingTime 0 (b - a) (fun n ω => (f n ω - a)⁺) N n = upperCrossingTime a b f N n ∧
       lowerCrossingTime 0 (b - a) (fun n ω => (f n ω - a)⁺) N n = lowerCrossingTime a b f N n :=
@@ -810,12 +921,16 @@ theorem crossing_pos_eq (hab : a < b) :
       exact False.elim (h₁ h₂)
     · rfl
 #align measure_theory.crossing_pos_eq MeasureTheory.crossing_pos_eq
+-/
 
+#print MeasureTheory.upcrossingsBefore_pos_eq /-
 theorem upcrossingsBefore_pos_eq (hab : a < b) :
     upcrossingsBefore 0 (b - a) (fun n ω => (f n ω - a)⁺) N ω = upcrossingsBefore a b f N ω := by
   simp_rw [upcrossings_before, (crossing_pos_eq hab).1]
 #align measure_theory.upcrossings_before_pos_eq MeasureTheory.upcrossingsBefore_pos_eq
+-/
 
+#print MeasureTheory.mul_integral_upcrossingsBefore_le_integral_pos_part_aux /-
 theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure μ]
     (hf : Submartingale f ℱ μ) (hab : a < b) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] :=
@@ -828,7 +943,9 @@ theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure
   simp_rw [sub_zero, ← upcrossings_before_pos_eq hab]
   rfl
 #align measure_theory.mul_integral_upcrossings_before_le_integral_pos_part_aux MeasureTheory.mul_integral_upcrossingsBefore_le_integral_pos_part_aux
+-/
 
+#print MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part /-
 /-- **Doob's upcrossing estimate**: given a real valued discrete submartingale `f` and real
 values `a` and `b`, we have `(b - a) * 𝔼[upcrossings_before a b f N] ≤ 𝔼[(f N - a)⁺]` where
 `upcrossings_before a b f N` is the number of times the process `f` crossed from below `a` to above
@@ -844,6 +961,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFin
       le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
         (integral_nonneg fun ω => LatticeOrderedCommGroup.pos_nonneg _)
 #align measure_theory.submartingale.mul_integral_upcrossings_before_le_integral_pos_part MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part
+-/
 
 /-!
 
@@ -871,6 +989,7 @@ stopping time.
 -/
 
 
+#print MeasureTheory.upcrossingsBefore_eq_sum /-
 theorem upcrossingsBefore_eq_sum (hab : a < b) :
     upcrossingsBefore a b f N ω =
       ∑ i in Finset.Ico 1 (N + 1), {n | upperCrossingTime a b f N n ω < N}.indicator 1 i :=
@@ -905,7 +1024,9 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
     smul_eq_mul, mul_one, smul_eq_mul, MulZeroClass.mul_zero, Nat.card_Ico, Nat.add_succ_sub_one,
     add_zero, add_zero]
 #align measure_theory.upcrossings_before_eq_sum MeasureTheory.upcrossingsBefore_eq_sum
+-/
 
+#print MeasureTheory.Adapted.measurable_upcrossingsBefore /-
 theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b) :
     Measurable (upcrossingsBefore a b f N) :=
   by
@@ -921,7 +1042,9 @@ theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b)
       Measurable.indicator measurable_const <|
         ℱ.le N _ (hf.is_stopping_time_upper_crossing_time.measurable_set_lt_of_pred N)
 #align measure_theory.adapted.measurable_upcrossings_before MeasureTheory.Adapted.measurable_upcrossingsBefore
+-/
 
+#print MeasureTheory.Adapted.integrable_upcrossingsBefore /-
 theorem Adapted.integrable_upcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
     Integrable (fun ω => (upcrossingsBefore a b f N ω : ℝ)) μ :=
   haveI : ∀ᵐ ω ∂μ, ‖(upcrossings_before a b f N ω : ℝ)‖ ≤ N :=
@@ -933,19 +1056,25 @@ theorem Adapted.integrable_upcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted
       (measurable_from_top.comp (hf.measurable_upcrossings_before hab)),
     has_finite_integral_of_bounded this⟩
 #align measure_theory.adapted.integrable_upcrossings_before MeasureTheory.Adapted.integrable_upcrossingsBefore
+-/
 
+#print MeasureTheory.upcrossings /-
 /-- The number of upcrossings of a realization of a stochastic process (`upcrossing` takes value
 in `ℝ≥0∞` and so is allowed to be `∞`). -/
 noncomputable def upcrossings [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
     (ω : Ω) : ℝ≥0∞ :=
   ⨆ N, (upcrossingsBefore a b f N ω : ℝ≥0∞)
 #align measure_theory.upcrossings MeasureTheory.upcrossings
+-/
 
+#print MeasureTheory.Adapted.measurable_upcrossings /-
 theorem Adapted.measurable_upcrossings (hf : Adapted ℱ f) (hab : a < b) :
     Measurable (upcrossings a b f) :=
   measurable_iSup fun N => measurable_from_top.comp (hf.measurable_upcrossingsBefore hab)
 #align measure_theory.adapted.measurable_upcrossings MeasureTheory.Adapted.measurable_upcrossings
+-/
 
+#print MeasureTheory.upcrossings_lt_top_iff /-
 theorem upcrossings_lt_top_iff :
     upcrossings a b f ω < ∞ ↔ ∃ k, ∀ N, upcrossingsBefore a b f N ω ≤ k :=
   by
@@ -965,7 +1094,9 @@ theorem upcrossings_lt_top_iff :
   · refine' ⟨k, fun N => _⟩
     simp only [ENNReal.coe_nat, Nat.cast_le, hk N]
 #align measure_theory.upcrossings_lt_top_iff MeasureTheory.upcrossings_lt_top_iff
+-/
 
+#print MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part /-
 /-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
 theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
     (hf : Submartingale f ℱ μ) :
@@ -1003,6 +1134,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
     rw [ENNReal.ofReal_of_nonpos hab, MulZeroClass.zero_mul]
     exact zero_le _
 #align measure_theory.submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part
+-/
 
 end MeasureTheory
 
Diff
@@ -484,7 +484,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Subm
     simp only [Finset.range_zero, Finset.sum_empty, integral_zero']
   have h₂ :
     μ[∑ k in Finset.range n, (1 - upcrossing_strat a b f N k) * (f (k + 1) - f k)] =
-      μ[∑ k in Finset.range n, f (k + 1) - f k] -
+      μ[∑ k in Finset.range n, (f (k + 1) - f k)] -
         μ[∑ k in Finset.range n, upcrossing_strat a b f N k * (f (k + 1) - f k)] :=
     by
     simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply,
@@ -679,10 +679,10 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
   rw [Finset.sum_comm]
   have h₁ :
     ∀ k,
-      (∑ n in Finset.range N,
+      ∑ n in Finset.range N,
           (Set.Ico (lower_crossing_time a b f N k ω)
                 (upper_crossing_time a b f N (k + 1) ω)).indicator
-            (fun m => f (m + 1) ω - f m ω) n) =
+            (fun m => f (m + 1) ω - f m ω) n =
         stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
           stopped_value f (lower_crossing_time a b f N k) ω :=
     by
@@ -704,24 +704,24 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
       exact fun _ h => lt_of_lt_of_le h upper_crossing_time_le
   simp_rw [h₁]
   have h₂ :
-    (∑ k in Finset.range (upcrossings_before a b f N ω), b - a) ≤
+    ∑ k in Finset.range (upcrossings_before a b f N ω), (b - a) ≤
       ∑ k in Finset.range N,
-        stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-          stopped_value f (lower_crossing_time a b f N k) ω :=
+        (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+          stopped_value f (lower_crossing_time a b f N k) ω) :=
     by
     calc
-      (∑ k in Finset.range (upcrossings_before a b f N ω), b - a) ≤
+      ∑ k in Finset.range (upcrossings_before a b f N ω), (b - a) ≤
           ∑ k in Finset.range (upcrossings_before a b f N ω),
-            stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-              stopped_value f (lower_crossing_time a b f N k) ω :=
+            (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+              stopped_value f (lower_crossing_time a b f N k) ω) :=
         by
         refine'
           Finset.sum_le_sum fun i hi => le_sub_of_le_upcrossings_before (zero_lt_iff.2 hN) hab _
         rwa [Finset.mem_range] at hi 
       _ ≤
           ∑ k in Finset.range N,
-            stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-              stopped_value f (lower_crossing_time a b f N k) ω :=
+            (stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+              stopped_value f (lower_crossing_time a b f N k) ω) :=
         by
         refine'
           Finset.sum_le_sum_of_subset_of_nonneg
@@ -969,12 +969,12 @@ theorem upcrossings_lt_top_iff :
 /-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
 theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
     (hf : Submartingale f ℱ μ) :
-    (ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ) ≤
+    ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ ≤
       ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ :=
   by
   by_cases hab : a < b
   · simp_rw [upcrossings]
-    have : ∀ N, (∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ) = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) :=
+    have : ∀ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) :=
       by
       intro N
       rw [of_real_integral_eq_lintegral_of_real]
@@ -984,7 +984,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
     · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
       intro N
       rw [(by simp :
-          (∫⁻ ω, upcrossings_before a b f N ω ∂μ) = ∫⁻ ω, ↑(upcrossings_before a b f N ω : ℝ≥0) ∂μ),
+          ∫⁻ ω, upcrossings_before a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossings_before a b f N ω : ℝ≥0) ∂μ),
         lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
       · simp_rw [NNReal.coe_nat_cast]
         exact
Diff
@@ -737,7 +737,6 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
         · rw [sub_eq_zero_of_upcrossings_before_lt hab]
           rw [Finset.mem_range, not_lt] at hi 
           exact lt_of_le_of_ne hi (Ne.symm hi')
-      
   refine' le_trans _ h₂
   rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
 #align measure_theory.mul_upcrossings_before_le MeasureTheory.mul_upcrossingsBefore_le
@@ -756,7 +755,6 @@ theorem integral_mul_upcrossingsBefore_le_integral [IsFiniteMeasure μ] (hf : Su
         simpa using mul_upcrossings_before_le (hfN ω) hab
     _ ≤ μ[f N] - μ[f 0] := hf.sum_mul_upcrossingStrat_le
     _ ≤ μ[f N] := (sub_le_self_iff _).2 (integral_nonneg hfzero)
-    
 #align measure_theory.integral_mul_upcrossings_before_le_integral MeasureTheory.integral_mul_upcrossingsBefore_le_integral
 
 theorem crossing_pos_eq (hab : a < b) :
Diff
@@ -312,7 +312,7 @@ theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTi
 theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) :
     ∃ n, upperCrossingTime a b f N n ω = N :=
   by
-  by_contra h; push_neg  at h 
+  by_contra h; push_neg at h 
   have : StrictMono fun n => upper_crossing_time a b f N n ω :=
     strictMono_nat_of_lt_succ fun n => upper_crossing_time_lt_succ hab (h _)
   obtain ⟨_, ⟨k, rfl⟩, hk⟩ :
@@ -323,7 +323,7 @@ theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω)
 #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq
 
 theorem upperCrossingTime_lt_bddAbove (hab : a < b) :
-    BddAbove { n | upperCrossingTime a b f N n ω < N } :=
+    BddAbove {n | upperCrossingTime a b f N n ω < N} :=
   by
   obtain ⟨k, hk⟩ := exists_upper_crossing_time_eq f N ω hab
   refine' ⟨k, fun n (hn : upper_crossing_time a b f N n ω < N) => _⟩
@@ -332,7 +332,7 @@ theorem upperCrossingTime_lt_bddAbove (hab : a < b) :
 #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove
 
 theorem upperCrossingTime_lt_nonempty (hN : 0 < N) :
-    { n | upperCrossingTime a b f N n ω < N }.Nonempty :=
+    {n | upperCrossingTime a b f N n ω < N}.Nonempty :=
   ⟨0, hN⟩
 #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty
 
@@ -440,8 +440,8 @@ theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcr
   change
     strongly_measurable[ℱ n] fun ω =>
       ∑ k in Finset.range N,
-        ({ n | lower_crossing_time a b f N k ω ≤ n } ∩
-              { n | n < upper_crossing_time a b f N (k + 1) ω }).indicator
+        ({n | lower_crossing_time a b f N k ω ≤ n} ∩
+              {n | n < upper_crossing_time a b f N (k + 1) ω}).indicator
           1 n
   refine'
     Finset.stronglyMeasurable_sum _ fun i hi =>
@@ -450,15 +450,15 @@ theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcr
   exact (hf.is_stopping_time_upper_crossing_time n).compl
 #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted
 
-theorem Submartingale.sum_upcrossingStrat_mul [FiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ)
-    (N : ℕ) :
+theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+    (a b : ℝ) (N : ℕ) :
     Submartingale
       (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ :=
   hf.sum_mul_sub hf.Adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ =>
     upcrossingStrat_nonneg
 #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul
 
-theorem Submartingale.sum_sub_upcrossingStrat_mul [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (a b : ℝ) (N : ℕ) :
     Submartingale
       (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ
@@ -472,7 +472,7 @@ theorem Submartingale.sum_sub_upcrossingStrat_mul [FiniteMeasure μ] (hf : Subma
     simp [upcrossing_strat_le_one]
 #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul
 
-theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submartingale f ℱ μ) :
+theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) :
     μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] :=
   by
   have h₁ :
@@ -494,7 +494,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submar
         (integrable.sub (integrable_finset_sum _ fun i hi => hf.integrable _)
           (integrable_finset_sum _ fun i hi => hf.integrable _))
         _
-    convert(hf.sum_upcrossing_strat_mul a b N).Integrable n
+    convert (hf.sum_upcrossing_strat_mul a b N).Integrable n
     ext; simp
   rw [h₂, sub_nonneg] at h₁ 
   refine' le_trans h₁ _
@@ -504,7 +504,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submar
 /-- The number of upcrossings (strictly) before time `N`. -/
 noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
     (N : ι) (ω : Ω) : ℕ :=
-  sSup { n | upperCrossingTime a b f N n ω < N }
+  sSup {n | upperCrossingTime a b f N n ω < N}
 #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore
 
 @[simp]
@@ -606,7 +606,7 @@ theorem upcrossingsBefore_mono (hab : a < b) : Monotone fun N ω => upcrossingsB
   by
   intro N M hNM ω
   simp only [upcrossings_before]
-  by_cases hemp : { n : ℕ | upper_crossing_time a b f N n ω < N }.Nonempty
+  by_cases hemp : {n : ℕ | upper_crossing_time a b f N n ω < N}.Nonempty
   · refine' csSup_le_csSup (upper_crossing_time_lt_bdd_above hab) hemp fun n hn => _
     rw [Set.mem_setOf_eq, upper_crossing_time_eq_upper_crossing_time_of_lt hNM hn]
     exact lt_of_lt_of_le hn hNM
@@ -672,78 +672,77 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
       ∑ k in Finset.range N, upcrossingStrat a b f N k ω * (f (k + 1) - f k) ω :=
   by
   classical
-    by_cases hN : N = 0
-    · simp [hN]
-    simp_rw [upcrossing_strat, Finset.sum_mul, ← Set.indicator_mul_left, Pi.one_apply, Pi.sub_apply,
-      one_mul]
-    rw [Finset.sum_comm]
-    have h₁ :
-      ∀ k,
-        (∑ n in Finset.range N,
-            (Set.Ico (lower_crossing_time a b f N k ω)
-                  (upper_crossing_time a b f N (k + 1) ω)).indicator
-              (fun m => f (m + 1) ω - f m ω) n) =
-          stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-            stopped_value f (lower_crossing_time a b f N k) ω :=
-      by
-      intro k
-      rw [Finset.sum_indicator_eq_sum_filter,
-        (_ :
-          Finset.filter
-              (fun i =>
-                i ∈
-                  Set.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω))
-              (Finset.range N) =
-            Finset.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω)),
-        Finset.sum_Ico_eq_add_neg _ lower_crossing_time_le_upper_crossing_time_succ,
-        Finset.sum_range_sub fun n => f n ω, Finset.sum_range_sub fun n => f n ω, neg_sub,
-        sub_add_sub_cancel]
-      · rfl
-      · ext i
-        simp only [Set.mem_Ico, Finset.mem_filter, Finset.mem_range, Finset.mem_Ico,
-          and_iff_right_iff_imp, and_imp]
-        exact fun _ h => lt_of_lt_of_le h upper_crossing_time_le
-    simp_rw [h₁]
-    have h₂ :
+  by_cases hN : N = 0
+  · simp [hN]
+  simp_rw [upcrossing_strat, Finset.sum_mul, ← Set.indicator_mul_left, Pi.one_apply, Pi.sub_apply,
+    one_mul]
+  rw [Finset.sum_comm]
+  have h₁ :
+    ∀ k,
+      (∑ n in Finset.range N,
+          (Set.Ico (lower_crossing_time a b f N k ω)
+                (upper_crossing_time a b f N (k + 1) ω)).indicator
+            (fun m => f (m + 1) ω - f m ω) n) =
+        stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+          stopped_value f (lower_crossing_time a b f N k) ω :=
+    by
+    intro k
+    rw [Finset.sum_indicator_eq_sum_filter,
+      (_ :
+        Finset.filter
+            (fun i =>
+              i ∈ Set.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω))
+            (Finset.range N) =
+          Finset.Ico (lower_crossing_time a b f N k ω) (upper_crossing_time a b f N (k + 1) ω)),
+      Finset.sum_Ico_eq_add_neg _ lower_crossing_time_le_upper_crossing_time_succ,
+      Finset.sum_range_sub fun n => f n ω, Finset.sum_range_sub fun n => f n ω, neg_sub,
+      sub_add_sub_cancel]
+    · rfl
+    · ext i
+      simp only [Set.mem_Ico, Finset.mem_filter, Finset.mem_range, Finset.mem_Ico,
+        and_iff_right_iff_imp, and_imp]
+      exact fun _ h => lt_of_lt_of_le h upper_crossing_time_le
+  simp_rw [h₁]
+  have h₂ :
+    (∑ k in Finset.range (upcrossings_before a b f N ω), b - a) ≤
+      ∑ k in Finset.range N,
+        stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+          stopped_value f (lower_crossing_time a b f N k) ω :=
+    by
+    calc
       (∑ k in Finset.range (upcrossings_before a b f N ω), b - a) ≤
-        ∑ k in Finset.range N,
-          stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-            stopped_value f (lower_crossing_time a b f N k) ω :=
-      by
-      calc
-        (∑ k in Finset.range (upcrossings_before a b f N ω), b - a) ≤
-            ∑ k in Finset.range (upcrossings_before a b f N ω),
-              stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-                stopped_value f (lower_crossing_time a b f N k) ω :=
-          by
-          refine'
-            Finset.sum_le_sum fun i hi => le_sub_of_le_upcrossings_before (zero_lt_iff.2 hN) hab _
-          rwa [Finset.mem_range] at hi 
-        _ ≤
-            ∑ k in Finset.range N,
-              stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
-                stopped_value f (lower_crossing_time a b f N k) ω :=
-          by
-          refine'
-            Finset.sum_le_sum_of_subset_of_nonneg
-              (Finset.range_subset.2 (upcrossings_before_le f ω hab)) fun i _ hi => _
-          by_cases hi' : i = upcrossings_before a b f N ω
-          · subst hi'
-            simp only [stopped_value]
-            rw [upper_crossing_time_eq_of_upcrossings_before_lt hab (Nat.lt_succ_self _)]
-            by_cases heq : lower_crossing_time a b f N (upcrossings_before a b f N ω) ω = N
-            · rw [HEq, sub_self]
-            · rw [sub_nonneg]
-              exact le_trans (stopped_value_lower_crossing_time HEq) hf
-          · rw [sub_eq_zero_of_upcrossings_before_lt hab]
-            rw [Finset.mem_range, not_lt] at hi 
-            exact lt_of_le_of_ne hi (Ne.symm hi')
-        
-    refine' le_trans _ h₂
-    rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
+          ∑ k in Finset.range (upcrossings_before a b f N ω),
+            stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+              stopped_value f (lower_crossing_time a b f N k) ω :=
+        by
+        refine'
+          Finset.sum_le_sum fun i hi => le_sub_of_le_upcrossings_before (zero_lt_iff.2 hN) hab _
+        rwa [Finset.mem_range] at hi 
+      _ ≤
+          ∑ k in Finset.range N,
+            stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
+              stopped_value f (lower_crossing_time a b f N k) ω :=
+        by
+        refine'
+          Finset.sum_le_sum_of_subset_of_nonneg
+            (Finset.range_subset.2 (upcrossings_before_le f ω hab)) fun i _ hi => _
+        by_cases hi' : i = upcrossings_before a b f N ω
+        · subst hi'
+          simp only [stopped_value]
+          rw [upper_crossing_time_eq_of_upcrossings_before_lt hab (Nat.lt_succ_self _)]
+          by_cases heq : lower_crossing_time a b f N (upcrossings_before a b f N ω) ω = N
+          · rw [HEq, sub_self]
+          · rw [sub_nonneg]
+            exact le_trans (stopped_value_lower_crossing_time HEq) hf
+        · rw [sub_eq_zero_of_upcrossings_before_lt hab]
+          rw [Finset.mem_range, not_lt] at hi 
+          exact lt_of_le_of_ne hi (Ne.symm hi')
+      
+  refine' le_trans _ h₂
+  rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
 #align measure_theory.mul_upcrossings_before_le MeasureTheory.mul_upcrossingsBefore_le
 
-theorem integral_mul_upcrossingsBefore_le_integral [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem integral_mul_upcrossingsBefore_le_integral [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hfN : ∀ ω, a ≤ f N ω) (hfzero : 0 ≤ f 0) (hab : a < b) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[f N] :=
   calc
@@ -819,7 +818,7 @@ theorem upcrossingsBefore_pos_eq (hab : a < b) :
   simp_rw [upcrossings_before, (crossing_pos_eq hab).1]
 #align measure_theory.upcrossings_before_pos_eq MeasureTheory.upcrossingsBefore_pos_eq
 
-theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [FiniteMeasure μ]
+theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure μ]
     (hf : Submartingale f ℱ μ) (hab : a < b) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] :=
   by
@@ -836,7 +835,7 @@ theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [FiniteMeasure 
 values `a` and `b`, we have `(b - a) * 𝔼[upcrossings_before a b f N] ≤ 𝔼[(f N - a)⁺]` where
 `upcrossings_before a b f N` is the number of times the process `f` crossed from below `a` to above
 `b` before the time `N`. -/
-theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [FiniteMeasure μ]
+theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFiniteMeasure μ]
     (a b : ℝ) (hf : Submartingale f ℱ μ) (N : ℕ) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] :=
   by
@@ -876,7 +875,7 @@ stopping time.
 
 theorem upcrossingsBefore_eq_sum (hab : a < b) :
     upcrossingsBefore a b f N ω =
-      ∑ i in Finset.Ico 1 (N + 1), { n | upperCrossingTime a b f N n ω < N }.indicator 1 i :=
+      ∑ i in Finset.Ico 1 (N + 1), {n | upperCrossingTime a b f N n ω < N}.indicator 1 i :=
   by
   by_cases hN : N = 0
   · simp [hN]
@@ -885,7 +884,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
       (Nat.succ_le_succ (upcrossings_before_le f ω hab))]
   have h₁ :
     ∀ k ∈ Finset.Ico 1 (upcrossings_before a b f N ω + 1),
-      { n : ℕ | upper_crossing_time a b f N n ω < N }.indicator 1 k = 1 :=
+      {n : ℕ | upper_crossing_time a b f N n ω < N}.indicator 1 k = 1 :=
     by
     rintro k hk
     rw [Finset.mem_Ico] at hk 
@@ -897,7 +896,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
           (Nat.lt_succ_iff.1 hk.2)
   have h₂ :
     ∀ k ∈ Finset.Ico (upcrossings_before a b f N ω + 1) (N + 1),
-      { n : ℕ | upper_crossing_time a b f N n ω < N }.indicator 1 k = 0 :=
+      {n : ℕ | upper_crossing_time a b f N n ω < N}.indicator 1 k = 0 :=
     by
     rintro k hk
     rw [Finset.mem_Ico, Nat.succ_le_iff] at hk 
@@ -914,7 +913,7 @@ theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b)
   by
   have :
     upcrossings_before a b f N = fun ω =>
-      ∑ i in Finset.Ico 1 (N + 1), { n | upper_crossing_time a b f N n ω < N }.indicator 1 i :=
+      ∑ i in Finset.Ico 1 (N + 1), {n | upper_crossing_time a b f N n ω < N}.indicator 1 i :=
     by
     ext ω
     exact upcrossings_before_eq_sum hab
@@ -925,7 +924,7 @@ theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b)
         ℱ.le N _ (hf.is_stopping_time_upper_crossing_time.measurable_set_lt_of_pred N)
 #align measure_theory.adapted.measurable_upcrossings_before MeasureTheory.Adapted.measurable_upcrossingsBefore
 
-theorem Adapted.integrable_upcrossingsBefore [FiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
+theorem Adapted.integrable_upcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
     Integrable (fun ω => (upcrossingsBefore a b f N ω : ℝ)) μ :=
   haveI : ∀ᵐ ω ∂μ, ‖(upcrossings_before a b f N ω : ℝ)‖ ≤ N :=
     by
@@ -970,7 +969,7 @@ theorem upcrossings_lt_top_iff :
 #align measure_theory.upcrossings_lt_top_iff MeasureTheory.upcrossings_lt_top_iff
 
 /-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
-theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [FiniteMeasure μ] (a b : ℝ)
+theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
     (hf : Submartingale f ℱ μ) :
     (ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ) ≤
       ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ :=
Diff
@@ -312,11 +312,11 @@ theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTi
 theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) :
     ∃ n, upperCrossingTime a b f N n ω = N :=
   by
-  by_contra h; push_neg  at h
+  by_contra h; push_neg  at h 
   have : StrictMono fun n => upper_crossing_time a b f N n ω :=
     strictMono_nat_of_lt_succ fun n => upper_crossing_time_lt_succ hab (h _)
   obtain ⟨_, ⟨k, rfl⟩, hk⟩ :
-    ∃ (m : _)(hm : m ∈ Set.range fun n => upper_crossing_time a b f N n ω), N < m :=
+    ∃ (m : _) (hm : m ∈ Set.range fun n => upper_crossing_time a b f N n ω), N < m :=
     ⟨upper_crossing_time a b f N (N + 1) ω, ⟨N + 1, rfl⟩,
       lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩
   exact not_le.2 hk upper_crossing_time_le
@@ -346,10 +346,10 @@ theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω)
         (Set.Iic (Nat.find (exists_upper_crossing_time_eq f N ω hab)).pred) :=
       by
       refine' strictMonoOn_Iic_of_lt_succ fun m hm => upper_crossing_time_lt_succ hab _
-      rw [Nat.lt_pred_iff] at hm
+      rw [Nat.lt_pred_iff] at hm 
       convert Nat.find_min _ hm
     convert StrictMonoOn.Iic_id_le hmono N (Nat.le_pred_of_lt hN')
-  · rw [not_lt] at hN'
+  · rw [not_lt] at hN' 
     exact
       upper_crossing_time_stabilize hN' (Nat.find_spec (exists_upper_crossing_time_eq f N ω hab))
 #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq
@@ -422,7 +422,7 @@ theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 :=
       refine'
         le_trans upper_crossing_time_le_lower_crossing_time
           (lower_crossing_time_mono (Nat.succ_le_of_lt hij'))
-    · rw [gt_iff_lt] at hij'
+    · rw [gt_iff_lt] at hij' 
       rw [min_eq_right
           (upper_crossing_time_mono (Nat.succ_le_succ hij'.le) :
             upper_crossing_time a b f N _ ω ≤ upper_crossing_time a b f N _ ω),
@@ -479,7 +479,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submar
     (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossing_strat a b f N k) * (f (k + 1) - f k)] :=
     by
     have := (hf.sum_sub_upcrossing_strat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ
-    rw [integral_univ, integral_univ] at this
+    rw [integral_univ, integral_univ] at this 
     refine' le_trans _ this
     simp only [Finset.range_zero, Finset.sum_empty, integral_zero']
   have h₂ :
@@ -496,7 +496,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submar
         _
     convert(hf.sum_upcrossing_strat_mul a b N).Integrable n
     ext; simp
-  rw [h₂, sub_nonneg] at h₁
+  rw [h₂, sub_nonneg] at h₁ 
   refine' le_trans h₁ _
   simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _)]
 #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le
@@ -556,7 +556,7 @@ theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
   · simp only [Nat.zero_eq, upper_crossing_time_zero, bot_eq_zero', eq_self_iff_true,
       lower_crossing_time_zero, true_and_iff, eq_comm]
     refine' hitting_eq_hitting_of_exists hNM _
-    simp only [lower_crossing_time, hitting_lt_iff] at h
+    simp only [lower_crossing_time, hitting_lt_iff] at h 
     obtain ⟨j, hj₁, hj₂⟩ := h
     exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
   · specialize
@@ -564,14 +564,14 @@ theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
         (lt_of_le_of_lt (upper_crossing_time_mono (Nat.le_succ _)) h')
     have : upper_crossing_time a b f M k.succ ω = upper_crossing_time a b f N k.succ ω :=
       by
-      simp only [upper_crossing_time_succ_eq, hitting_lt_iff] at h'⊢
+      simp only [upper_crossing_time_succ_eq, hitting_lt_iff] at h' ⊢
       obtain ⟨j, hj₁, hj₂⟩ := h'
       rw [eq_comm, ih.2]
       exact hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
     refine' ⟨this, _⟩
     simp only [lower_crossing_time, eq_comm, this]
     refine' hitting_eq_hitting_of_exists hNM _
-    rw [lower_crossing_time, hitting_lt_iff _ le_rfl] at h
+    rw [lower_crossing_time, hitting_lt_iff _ le_rfl] at h 
     swap; · infer_instance
     obtain ⟨j, hj₁, hj₂⟩ := h
     exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
@@ -588,7 +588,7 @@ theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
   refine' ⟨_, this⟩
   rw [upper_crossing_time_succ_eq, upper_crossing_time_succ_eq, eq_comm, this]
   refine' hitting_eq_hitting_of_exists hNM _
-  simp only [upper_crossing_time_succ_eq, hitting_lt_iff] at h
+  simp only [upper_crossing_time_succ_eq, hitting_lt_iff] at h 
   obtain ⟨j, hj₁, hj₂⟩ := h
   exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
 #align measure_theory.crossing_eq_crossing_of_upper_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_upperCrossingTime_lt
@@ -610,7 +610,7 @@ theorem upcrossingsBefore_mono (hab : a < b) : Monotone fun N ω => upcrossingsB
   · refine' csSup_le_csSup (upper_crossing_time_lt_bdd_above hab) hemp fun n hn => _
     rw [Set.mem_setOf_eq, upper_crossing_time_eq_upper_crossing_time_of_lt hNM hn]
     exact lt_of_lt_of_le hn hNM
-  · rw [Set.not_nonempty_iff_eq_empty] at hemp
+  · rw [Set.not_nonempty_iff_eq_empty] at hemp 
     simp [hemp, csSup_empty, bot_eq_zero', zero_le']
 #align measure_theory.upcrossings_before_mono MeasureTheory.upcrossingsBefore_mono
 
@@ -631,7 +631,7 @@ theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ
       rw [upper_crossing_time_eq_upper_crossing_time_of_lt (hN₁.trans (hN₂.trans <| Nat.le_succ _))
           this]
       exact this.le
-    · rw [not_lt, le_zero_iff] at hN
+    · rw [not_lt, le_zero_iff] at hN 
       rw [hN, upcrossings_before_zero, upper_crossing_time_zero]
       rfl
 #align measure_theory.upcrossings_before_lt_of_exists_upcrossing MeasureTheory.upcrossingsBefore_lt_of_exists_upcrossing
@@ -659,7 +659,7 @@ theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefor
   by
   have : N ≤ upper_crossing_time a b f N n ω :=
     by
-    rw [upcrossings_before] at hn
+    rw [upcrossings_before] at hn 
     rw [← not_lt]
     exact fun h => not_le.2 hn (le_csSup (upper_crossing_time_lt_bdd_above hab) h)
   simp [stopped_value, upper_crossing_time_stabilize' (Nat.le_succ n) this,
@@ -718,7 +718,7 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
           by
           refine'
             Finset.sum_le_sum fun i hi => le_sub_of_le_upcrossings_before (zero_lt_iff.2 hN) hab _
-          rwa [Finset.mem_range] at hi
+          rwa [Finset.mem_range] at hi 
         _ ≤
             ∑ k in Finset.range N,
               stopped_value f (upper_crossing_time a b f N (k + 1)) ω -
@@ -736,7 +736,7 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
             · rw [sub_nonneg]
               exact le_trans (stopped_value_lower_crossing_time HEq) hf
           · rw [sub_eq_zero_of_upcrossings_before_lt hab]
-            rw [Finset.mem_range, not_lt] at hi
+            rw [Finset.mem_range, not_lt] at hi 
             exact lt_of_le_of_ne hi (Ne.symm hi')
         
     refine' le_trans _ h₂
@@ -772,7 +772,7 @@ theorem crossing_pos_eq (hab : a < b) :
     ·
       rwa [← sub_le_sub_iff_right a, ←
         LatticeOrderedCommGroup.pos_eq_self_of_pos_pos (lt_of_lt_of_le hab' h)]
-    · rw [← sub_le_sub_iff_right a] at h
+    · rw [← sub_le_sub_iff_right a] at h 
       rwa [LatticeOrderedCommGroup.pos_of_nonneg _ (le_trans hab'.le h)]
   have hf' : ∀ ω i, (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a :=
     by
@@ -784,9 +784,9 @@ theorem crossing_pos_eq (hab : a < b) :
     ext ω
     split_ifs with h₁ h₂ h₂
     · simp_rw [hf']
-    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂
+    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂ 
       exact False.elim (h₂ h₁)
-    · simp_rw [Set.mem_Iic, hf' _ _] at h₁
+    · simp_rw [Set.mem_Iic, hf' _ _] at h₁ 
       exact False.elim (h₁ h₂)
     · rfl
   · have :
@@ -797,9 +797,9 @@ theorem crossing_pos_eq (hab : a < b) :
       simp only [upper_crossing_time_succ_eq, ← ih.2, hitting, Set.mem_Ici, tsub_le_iff_right]
       split_ifs with h₁ h₂ h₂
       · simp_rw [← sub_le_iff_le_add, hf ω]
-      · simp_rw [Set.mem_Ici, ← hf _ _] at h₂
+      · simp_rw [Set.mem_Ici, ← hf _ _] at h₂ 
         exact False.elim (h₂ h₁)
-      · simp_rw [Set.mem_Ici, hf _ _] at h₁
+      · simp_rw [Set.mem_Ici, hf _ _] at h₁ 
         exact False.elim (h₁ h₂)
       · rfl
     refine' ⟨this, _⟩
@@ -807,9 +807,9 @@ theorem crossing_pos_eq (hab : a < b) :
     simp only [lower_crossing_time, this, hitting, Set.mem_Iic]
     split_ifs with h₁ h₂ h₂
     · simp_rw [hf' ω]
-    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂
+    · simp_rw [Set.mem_Iic, ← hf' _ _] at h₂ 
       exact False.elim (h₂ h₁)
-    · simp_rw [Set.mem_Iic, hf' _ _] at h₁
+    · simp_rw [Set.mem_Iic, hf' _ _] at h₁ 
       exact False.elim (h₁ h₂)
     · rfl
 #align measure_theory.crossing_pos_eq MeasureTheory.crossing_pos_eq
@@ -842,7 +842,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [Finit
   by
   by_cases hab : a < b
   · exact mul_integral_upcrossings_before_le_integral_pos_part_aux hf hab
-  · rw [not_lt, ← sub_nonpos] at hab
+  · rw [not_lt, ← sub_nonpos] at hab 
     exact
       le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
         (integral_nonneg fun ω => LatticeOrderedCommGroup.pos_nonneg _)
@@ -888,7 +888,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
       { n : ℕ | upper_crossing_time a b f N n ω < N }.indicator 1 k = 1 :=
     by
     rintro k hk
-    rw [Finset.mem_Ico] at hk
+    rw [Finset.mem_Ico] at hk 
     rw [Set.indicator_of_mem]
     · rfl
     ·
@@ -900,7 +900,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
       { n : ℕ | upper_crossing_time a b f N n ω < N }.indicator 1 k = 0 :=
     by
     rintro k hk
-    rw [Finset.mem_Ico, Nat.succ_le_iff] at hk
+    rw [Finset.mem_Ico, Nat.succ_le_iff] at hk 
     rw [Set.indicator_of_not_mem]
     simp only [Set.mem_setOf_eq, not_lt]
     exact (upper_crossing_time_eq_of_upcrossings_before_lt hab hk.1).symm.le
@@ -1002,7 +1002,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [FiniteMea
     · refine' eventually_of_forall fun ω N M hNM => _
       rw [Nat.cast_le]
       exact upcrossings_before_mono hab hNM ω
-  · rw [not_lt, ← sub_nonpos] at hab
+  · rw [not_lt, ← sub_nonpos] at hab 
     rw [ENNReal.ofReal_of_nonpos hab, MulZeroClass.zero_mul]
     exact zero_le _
 #align measure_theory.submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part
Diff
@@ -61,7 +61,7 @@ We mostly follow the proof from [Kallenberg, *Foundations of modern probability*
 
 open TopologicalSpace Filter
 
-open NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
+open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
 
 namespace MeasureTheory
 
Diff
@@ -495,8 +495,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submar
           (integrable_finset_sum _ fun i hi => hf.integrable _))
         _
     convert(hf.sum_upcrossing_strat_mul a b N).Integrable n
-    ext
-    simp
+    ext; simp
   rw [h₂, sub_nonneg] at h₁
   refine' le_trans h₁ _
   simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _)]
@@ -517,9 +516,7 @@ theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [up
 #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero
 
 @[simp]
-theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 :=
-  by
-  ext ω
+theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω;
   exact upcrossings_before_zero
 #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero'
 
@@ -575,8 +572,7 @@ theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
     simp only [lower_crossing_time, eq_comm, this]
     refine' hitting_eq_hitting_of_exists hNM _
     rw [lower_crossing_time, hitting_lt_iff _ le_rfl] at h
-    swap
-    · infer_instance
+    swap; · infer_instance
     obtain ⟨j, hj₁, hj₂⟩ := h
     exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
 #align measure_theory.crossing_eq_crossing_of_lower_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_lowerCrossingTime_lt
Diff
@@ -960,7 +960,7 @@ theorem upcrossings_lt_top_iff :
     by
     constructor
     · intro h
-      lift upcrossings a b f ω to ℝ≥0 using h.ne
+      lift upcrossings a b f ω to ℝ≥0 using h.ne with r hr
       exact ⟨r, le_rfl⟩
     · rintro ⟨k, hk⟩
       exact lt_of_le_of_lt hk ENNReal.coe_lt_top
Diff
@@ -936,7 +936,7 @@ theorem Adapted.integrable_upcrossingsBefore [FiniteMeasure μ] (hf : Adapted 
     refine' eventually_of_forall fun ω => _
     rw [Real.norm_eq_abs, Nat.abs_cast, Nat.cast_le]
     refine' upcrossings_before_le _ _ hab
-  ⟨Measurable.aeStronglyMeasurable
+  ⟨Measurable.aestronglyMeasurable
       (measurable_from_top.comp (hf.measurable_upcrossings_before hab)),
     has_finite_integral_of_bounded this⟩
 #align measure_theory.adapted.integrable_upcrossings_before MeasureTheory.Adapted.integrable_upcrossingsBefore
Diff
@@ -960,7 +960,7 @@ theorem upcrossings_lt_top_iff :
     by
     constructor
     · intro h
-      lift upcrossings a b f ω to ℝ≥0 using h.ne with r hr
+      lift upcrossings a b f ω to ℝ≥0 using h.ne
       exact ⟨r, le_rfl⟩
     · rintro ⟨k, hk⟩
       exact lt_of_le_of_lt hk ENNReal.coe_lt_top
Diff
@@ -408,7 +408,7 @@ theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω :=
 
 theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 :=
   by
-  rw [upcrossing_strat, ← Set.indicator_finset_bunionᵢ_apply]
+  rw [upcrossing_strat, ← Set.indicator_finset_biUnion_apply]
   · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _
   · intro i hi j hj hij
     rw [Set.Ico_disjoint_Ico]
@@ -505,7 +505,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submar
 /-- The number of upcrossings (strictly) before time `N`. -/
 noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
     (N : ι) (ω : Ω) : ℕ :=
-  supₛ { n | upperCrossingTime a b f N n ω < N }
+  sSup { n | upperCrossingTime a b f N n ω < N }
 #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore
 
 @[simp]
@@ -535,7 +535,7 @@ theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b)
     (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N :=
   by
   refine' le_antisymm upper_crossing_time_le (not_lt.1 _)
-  convert not_mem_of_csupₛ_lt hn (upper_crossing_time_lt_bdd_above hab)
+  convert not_mem_of_csSup_lt hn (upper_crossing_time_lt_bdd_above hab)
 #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt
 
 theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) :
@@ -543,7 +543,7 @@ theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) :
   by_cases hN : N = 0
   · subst hN
     rw [upcrossings_before_zero]
-  · refine' csupₛ_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < _) => _
+  · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < _) => _
     by_contra hnN
     exact hn.ne (upper_crossing_time_eq_of_bound_le hab (not_le.1 hnN).le)
 #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le
@@ -611,18 +611,18 @@ theorem upcrossingsBefore_mono (hab : a < b) : Monotone fun N ω => upcrossingsB
   intro N M hNM ω
   simp only [upcrossings_before]
   by_cases hemp : { n : ℕ | upper_crossing_time a b f N n ω < N }.Nonempty
-  · refine' csupₛ_le_csupₛ (upper_crossing_time_lt_bdd_above hab) hemp fun n hn => _
+  · refine' csSup_le_csSup (upper_crossing_time_lt_bdd_above hab) hemp fun n hn => _
     rw [Set.mem_setOf_eq, upper_crossing_time_eq_upper_crossing_time_of_lt hNM hn]
     exact lt_of_lt_of_le hn hNM
   · rw [Set.not_nonempty_iff_eq_empty] at hemp
-    simp [hemp, csupₛ_empty, bot_eq_zero', zero_le']
+    simp [hemp, csSup_empty, bot_eq_zero', zero_le']
 #align measure_theory.upcrossings_before_mono MeasureTheory.upcrossingsBefore_mono
 
 theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ} (hN₁ : N ≤ N₁)
     (hN₁' : f N₁ ω < a) (hN₂ : N₁ ≤ N₂) (hN₂' : b < f N₂ ω) :
     upcrossingsBefore a b f N ω < upcrossingsBefore a b f (N₂ + 1) ω :=
   by
-  refine' lt_of_lt_of_le (Nat.lt_succ_self _) (le_csupₛ (upper_crossing_time_lt_bdd_above hab) _)
+  refine' lt_of_lt_of_le (Nat.lt_succ_self _) (le_csSup (upper_crossing_time_lt_bdd_above hab) _)
   rw [Set.mem_setOf_eq, upper_crossing_time_succ_eq, hitting_lt_iff _ le_rfl]
   swap
   · infer_instance
@@ -631,7 +631,7 @@ theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ
     refine' ⟨N₁, ⟨le_trans _ hN₁, hN₂⟩, hN₁'.le⟩
     by_cases hN : 0 < N
     · have : upper_crossing_time a b f N (upcrossings_before a b f N ω) ω < N :=
-        Nat.supₛ_mem (upper_crossing_time_lt_nonempty hN) (upper_crossing_time_lt_bdd_above hab)
+        Nat.sSup_mem (upper_crossing_time_lt_nonempty hN) (upper_crossing_time_lt_bdd_above hab)
       rw [upper_crossing_time_eq_upper_crossing_time_of_lt (hN₁.trans (hN₂.trans <| Nat.le_succ _))
           this]
       exact this.le
@@ -665,7 +665,7 @@ theorem sub_eq_zero_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefor
     by
     rw [upcrossings_before] at hn
     rw [← not_lt]
-    exact fun h => not_le.2 hn (le_csupₛ (upper_crossing_time_lt_bdd_above hab) h)
+    exact fun h => not_le.2 hn (le_csSup (upper_crossing_time_lt_bdd_above hab) h)
   simp [stopped_value, upper_crossing_time_stabilize' (Nat.le_succ n) this,
     lower_crossing_time_stabilize' le_rfl
       (le_trans this upper_crossing_time_le_lower_crossing_time)]
@@ -950,7 +950,7 @@ noncomputable def upcrossings [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ
 
 theorem Adapted.measurable_upcrossings (hf : Adapted ℱ f) (hab : a < b) :
     Measurable (upcrossings a b f) :=
-  measurable_supᵢ fun N => measurable_from_top.comp (hf.measurable_upcrossingsBefore hab)
+  measurable_iSup fun N => measurable_from_top.comp (hf.measurable_upcrossingsBefore hab)
 #align measure_theory.adapted.measurable_upcrossings MeasureTheory.Adapted.measurable_upcrossings
 
 theorem upcrossings_lt_top_iff :
@@ -964,7 +964,7 @@ theorem upcrossings_lt_top_iff :
       exact ⟨r, le_rfl⟩
     · rintro ⟨k, hk⟩
       exact lt_of_le_of_lt hk ENNReal.coe_lt_top
-  simp_rw [this, upcrossings, supᵢ_le_iff]
+  simp_rw [this, upcrossings, iSup_le_iff]
   constructor <;> rintro ⟨k, hk⟩
   · obtain ⟨m, hm⟩ := exists_nat_ge k
     refine' ⟨m, fun N => Nat.cast_le.1 ((hk N).trans _)⟩
@@ -988,7 +988,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [FiniteMea
       · exact (hf.sub_martingale (martingale_const _ _ _)).Pos.Integrable _
       · exact eventually_of_forall fun ω => LatticeOrderedCommGroup.pos_nonneg _
     rw [lintegral_supr']
-    · simp_rw [this, ENNReal.mul_supᵢ, supᵢ_le_iff]
+    · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
       intro N
       rw [(by simp :
           (∫⁻ ω, upcrossings_before a b f N ω ∂μ) = ∫⁻ ω, ↑(upcrossings_before a b f N ω : ℝ≥0) ∂μ),
@@ -997,7 +997,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [FiniteMea
         exact
           (ENNReal.ofReal_le_ofReal
                 (hf.mul_integral_upcrossings_before_le_integral_pos_part a b N)).trans
-            (le_supᵢ _ N)
+            (le_iSup _ N)
       · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossings_before hab]
     ·
       exact fun n =>
Diff
@@ -450,15 +450,15 @@ theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcr
   exact (hf.is_stopping_time_upper_crossing_time n).compl
 #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted
 
-theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
-    (a b : ℝ) (N : ℕ) :
+theorem Submartingale.sum_upcrossingStrat_mul [FiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ)
+    (N : ℕ) :
     Submartingale
       (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ :=
   hf.sum_mul_sub hf.Adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ =>
     upcrossingStrat_nonneg
 #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul
 
-theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.sum_sub_upcrossingStrat_mul [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (a b : ℝ) (N : ℕ) :
     Submartingale
       (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ
@@ -472,7 +472,7 @@ theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Sub
     simp [upcrossing_strat_le_one]
 #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul
 
-theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) :
+theorem Submartingale.sum_mul_upcrossingStrat_le [FiniteMeasure μ] (hf : Submartingale f ℱ μ) :
     μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] :=
   by
   have h₁ :
@@ -747,7 +747,7 @@ theorem mul_upcrossingsBefore_le (hf : a ≤ f N ω) (hab : a < b) :
     rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul, mul_comm]
 #align measure_theory.mul_upcrossings_before_le MeasureTheory.mul_upcrossingsBefore_le
 
-theorem integral_mul_upcrossingsBefore_le_integral [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem integral_mul_upcrossingsBefore_le_integral [FiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (hfN : ∀ ω, a ≤ f N ω) (hfzero : 0 ≤ f 0) (hab : a < b) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[f N] :=
   calc
@@ -823,7 +823,7 @@ theorem upcrossingsBefore_pos_eq (hab : a < b) :
   simp_rw [upcrossings_before, (crossing_pos_eq hab).1]
 #align measure_theory.upcrossings_before_pos_eq MeasureTheory.upcrossingsBefore_pos_eq
 
-theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure μ]
+theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [FiniteMeasure μ]
     (hf : Submartingale f ℱ μ) (hab : a < b) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] :=
   by
@@ -840,7 +840,7 @@ theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure
 values `a` and `b`, we have `(b - a) * 𝔼[upcrossings_before a b f N] ≤ 𝔼[(f N - a)⁺]` where
 `upcrossings_before a b f N` is the number of times the process `f` crossed from below `a` to above
 `b` before the time `N`. -/
-theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFiniteMeasure μ]
+theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [FiniteMeasure μ]
     (a b : ℝ) (hf : Submartingale f ℱ μ) (N : ℕ) :
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] :=
   by
@@ -929,7 +929,7 @@ theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b)
         ℱ.le N _ (hf.is_stopping_time_upper_crossing_time.measurable_set_lt_of_pred N)
 #align measure_theory.adapted.measurable_upcrossings_before MeasureTheory.Adapted.measurable_upcrossingsBefore
 
-theorem Adapted.integrable_upcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
+theorem Adapted.integrable_upcrossingsBefore [FiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
     Integrable (fun ω => (upcrossingsBefore a b f N ω : ℝ)) μ :=
   haveI : ∀ᵐ ω ∂μ, ‖(upcrossings_before a b f N ω : ℝ)‖ ≤ N :=
     by
@@ -974,7 +974,7 @@ theorem upcrossings_lt_top_iff :
 #align measure_theory.upcrossings_lt_top_iff MeasureTheory.upcrossings_lt_top_iff
 
 /-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
-theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
+theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [FiniteMeasure μ] (a b : ℝ)
     (hf : Submartingale f ℱ μ) :
     (ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ) ≤
       ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ :=
Diff
@@ -450,15 +450,15 @@ theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcr
   exact (hf.is_stopping_time_upper_crossing_time n).compl
 #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted
 
-theorem Submartingale.sumUpcrossingStratMul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ)
-    (N : ℕ) :
+theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+    (a b : ℝ) (N : ℕ) :
     Submartingale
       (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ :=
-  hf.sumMulSub hf.Adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ =>
+  hf.sum_mul_sub hf.Adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ =>
     upcrossingStrat_nonneg
-#align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sumUpcrossingStratMul
+#align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul
 
-theorem Submartingale.sumSubUpcrossingStratMul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
+theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)
     (a b : ℝ) (N : ℕ) :
     Submartingale
       (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ
@@ -470,7 +470,7 @@ theorem Submartingale.sumSubUpcrossingStratMul [IsFiniteMeasure μ] (hf : Submar
   · exact fun n ω => sub_le_self _ upcrossing_strat_nonneg
   · intro n ω
     simp [upcrossing_strat_le_one]
-#align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sumSubUpcrossingStratMul
+#align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul
 
 theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) :
     μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] :=
@@ -929,7 +929,7 @@ theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b)
         ℱ.le N _ (hf.is_stopping_time_upper_crossing_time.measurable_set_lt_of_pred N)
 #align measure_theory.adapted.measurable_upcrossings_before MeasureTheory.Adapted.measurable_upcrossingsBefore
 
-theorem Adapted.integrableUpcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
+theorem Adapted.integrable_upcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
     Integrable (fun ω => (upcrossingsBefore a b f N ω : ℝ)) μ :=
   haveI : ∀ᵐ ω ∂μ, ‖(upcrossings_before a b f N ω : ℝ)‖ ≤ N :=
     by
@@ -939,7 +939,7 @@ theorem Adapted.integrableUpcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted 
   ⟨Measurable.aeStronglyMeasurable
       (measurable_from_top.comp (hf.measurable_upcrossings_before hab)),
     has_finite_integral_of_bounded this⟩
-#align measure_theory.adapted.integrable_upcrossings_before MeasureTheory.Adapted.integrableUpcrossingsBefore
+#align measure_theory.adapted.integrable_upcrossings_before MeasureTheory.Adapted.integrable_upcrossingsBefore
 
 /-- The number of upcrossings of a realization of a stochastic process (`upcrossing` takes value
 in `ℝ≥0∞` and so is allowed to be `∞`). -/
@@ -1002,7 +1002,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
     ·
       exact fun n =>
         measurable_from_top.comp_ae_measurable
-          (hf.adapted.measurable_upcrossings_before hab).AeMeasurable
+          (hf.adapted.measurable_upcrossings_before hab).AEMeasurable
     · refine' eventually_of_forall fun ω N M hNM => _
       rw [Nat.cast_le]
       exact upcrossings_before_mono hab hNM ω
Diff
@@ -4,10 +4,11 @@ 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.upcrossing
-! leanprover-community/mathlib commit 57ac39bd365c2f80589a700f9fbb664d3a1a30c2
+! leanprover-community/mathlib commit 2c1d8ca2812b64f88992a5294ea3dba144755cd1
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
+import Mathbin.Data.Set.Intervals.Monotone
 import Mathbin.Probability.Process.HittingTime
 import Mathbin.Probability.Martingale.Basic
 
Diff
@@ -493,7 +493,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Subm
         (integrable.sub (integrable_finset_sum _ fun i hi => hf.integrable _)
           (integrable_finset_sum _ fun i hi => hf.integrable _))
         _
-    convert (hf.sum_upcrossing_strat_mul a b N).Integrable n
+    convert(hf.sum_upcrossing_strat_mul a b N).Integrable n
     ext
     simp
   rw [h₂, sub_nonneg] at h₁
Diff
@@ -908,8 +908,8 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) :
     simp only [Set.mem_setOf_eq, not_lt]
     exact (upper_crossing_time_eq_of_upcrossings_before_lt hab hk.1).symm.le
   rw [Finset.sum_congr rfl h₁, Finset.sum_congr rfl h₂, Finset.sum_const, Finset.sum_const,
-    smul_eq_mul, mul_one, smul_eq_mul, mul_zero, Nat.card_Ico, Nat.add_succ_sub_one, add_zero,
-    add_zero]
+    smul_eq_mul, mul_one, smul_eq_mul, MulZeroClass.mul_zero, Nat.card_Ico, Nat.add_succ_sub_one,
+    add_zero, add_zero]
 #align measure_theory.upcrossings_before_eq_sum MeasureTheory.upcrossingsBefore_eq_sum
 
 theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b) :
@@ -1006,7 +1006,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       rw [Nat.cast_le]
       exact upcrossings_before_mono hab hNM ω
   · rw [not_lt, ← sub_nonpos] at hab
-    rw [ENNReal.ofReal_of_nonpos hab, zero_mul]
+    rw [ENNReal.ofReal_of_nonpos hab, MulZeroClass.zero_mul]
     exact zero_le _
 #align measure_theory.submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part
 
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.upcrossing
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 57ac39bd365c2f80589a700f9fbb664d3a1a30c2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -966,10 +966,10 @@ theorem upcrossings_lt_top_iff :
   simp_rw [this, upcrossings, supᵢ_le_iff]
   constructor <;> rintro ⟨k, hk⟩
   · obtain ⟨m, hm⟩ := exists_nat_ge k
-    refine' ⟨m, fun N => ENNReal.coe_nat_le_coe_nat.1 ((hk N).trans _)⟩
+    refine' ⟨m, fun N => Nat.cast_le.1 ((hk N).trans _)⟩
     rwa [← ENNReal.coe_nat, ENNReal.coe_le_coe]
   · refine' ⟨k, fun N => _⟩
-    simp only [ENNReal.coe_nat, ENNReal.coe_nat_le_coe_nat, hk N]
+    simp only [ENNReal.coe_nat, Nat.cast_le, hk N]
 #align measure_theory.upcrossings_lt_top_iff MeasureTheory.upcrossings_lt_top_iff
 
 /-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
@@ -1003,7 +1003,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
         measurable_from_top.comp_ae_measurable
           (hf.adapted.measurable_upcrossings_before hab).AeMeasurable
     · refine' eventually_of_forall fun ω N M hNM => _
-      rw [ENNReal.coe_nat_le_coe_nat]
+      rw [Nat.cast_le]
       exact upcrossings_before_mono hab hNM ω
   · rw [not_lt, ← sub_nonpos] at hab
     rw [ENNReal.ofReal_of_nonpos hab, zero_mul]
Diff
@@ -60,7 +60,7 @@ We mostly follow the proof from [Kallenberg, *Foundations of modern probability*
 
 open TopologicalSpace Filter
 
-open NNReal Ennreal MeasureTheory ProbabilityTheory BigOperators Topology
+open NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
 
 namespace MeasureTheory
 
@@ -962,39 +962,39 @@ theorem upcrossings_lt_top_iff :
       lift upcrossings a b f ω to ℝ≥0 using h.ne with r hr
       exact ⟨r, le_rfl⟩
     · rintro ⟨k, hk⟩
-      exact lt_of_le_of_lt hk Ennreal.coe_lt_top
+      exact lt_of_le_of_lt hk ENNReal.coe_lt_top
   simp_rw [this, upcrossings, supᵢ_le_iff]
   constructor <;> rintro ⟨k, hk⟩
   · obtain ⟨m, hm⟩ := exists_nat_ge k
-    refine' ⟨m, fun N => Ennreal.coe_nat_le_coe_nat.1 ((hk N).trans _)⟩
-    rwa [← Ennreal.coe_nat, Ennreal.coe_le_coe]
+    refine' ⟨m, fun N => ENNReal.coe_nat_le_coe_nat.1 ((hk N).trans _)⟩
+    rwa [← ENNReal.coe_nat, ENNReal.coe_le_coe]
   · refine' ⟨k, fun N => _⟩
-    simp only [Ennreal.coe_nat, Ennreal.coe_nat_le_coe_nat, hk N]
+    simp only [ENNReal.coe_nat, ENNReal.coe_nat_le_coe_nat, hk N]
 #align measure_theory.upcrossings_lt_top_iff MeasureTheory.upcrossings_lt_top_iff
 
 /-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
 theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
     (hf : Submartingale f ℱ μ) :
-    (Ennreal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ) ≤
-      ⨆ N, ∫⁻ ω, Ennreal.ofReal ((f N ω - a)⁺) ∂μ :=
+    (ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ) ≤
+      ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ :=
   by
   by_cases hab : a < b
   · simp_rw [upcrossings]
-    have : ∀ N, (∫⁻ ω, Ennreal.ofReal ((f N ω - a)⁺) ∂μ) = Ennreal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) :=
+    have : ∀ N, (∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ) = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) :=
       by
       intro N
       rw [of_real_integral_eq_lintegral_of_real]
       · exact (hf.sub_martingale (martingale_const _ _ _)).Pos.Integrable _
       · exact eventually_of_forall fun ω => LatticeOrderedCommGroup.pos_nonneg _
     rw [lintegral_supr']
-    · simp_rw [this, Ennreal.mul_supᵢ, supᵢ_le_iff]
+    · simp_rw [this, ENNReal.mul_supᵢ, supᵢ_le_iff]
       intro N
       rw [(by simp :
           (∫⁻ ω, upcrossings_before a b f N ω ∂μ) = ∫⁻ ω, ↑(upcrossings_before a b f N ω : ℝ≥0) ∂μ),
-        lintegral_coe_eq_integral, ← Ennreal.ofReal_mul (sub_pos.2 hab).le]
+        lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
       · simp_rw [NNReal.coe_nat_cast]
         exact
-          (Ennreal.ofReal_le_ofReal
+          (ENNReal.ofReal_le_ofReal
                 (hf.mul_integral_upcrossings_before_le_integral_pos_part a b N)).trans
             (le_supᵢ _ N)
       · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossings_before hab]
@@ -1003,10 +1003,10 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
         measurable_from_top.comp_ae_measurable
           (hf.adapted.measurable_upcrossings_before hab).AeMeasurable
     · refine' eventually_of_forall fun ω N M hNM => _
-      rw [Ennreal.coe_nat_le_coe_nat]
+      rw [ENNReal.coe_nat_le_coe_nat]
       exact upcrossings_before_mono hab hNM ω
   · rw [not_lt, ← sub_nonpos] at hab
-    rw [Ennreal.ofReal_of_nonpos hab, zero_mul]
+    rw [ENNReal.ofReal_of_nonpos hab, zero_mul]
     exact zero_le _
 #align measure_theory.submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part
 

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 2 (#12361)

A PR analogous to #12338: reformatting proofs following the multiple goals linter of #12339.

Diff
@@ -498,16 +498,18 @@ theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
       lowerCrossingTime_zero, true_and_iff, eq_comm]
     refine' hitting_eq_hitting_of_exists hNM _
     rw [lowerCrossingTime, hitting_lt_iff] at h
-    obtain ⟨j, hj₁, hj₂⟩ := h
-    exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
+    · obtain ⟨j, hj₁, hj₂⟩ := h
+      exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
+    · exact le_rfl
   · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h)
       (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h')
     have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by
       rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h'
-      simp only [upperCrossingTime_succ_eq]
-      obtain ⟨j, hj₁, hj₂⟩ := h'
-      rw [eq_comm, ih.2]
-      exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
+      · simp only [upperCrossingTime_succ_eq]
+        obtain ⟨j, hj₁, hj₂⟩ := h'
+        rw [eq_comm, ih.2]
+        exact hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
+      · exact le_rfl
     refine' ⟨this, _⟩
     simp only [lowerCrossingTime, eq_comm, this]
     refine' hitting_eq_hitting_of_exists hNM _
@@ -526,8 +528,9 @@ theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M)
   rw [upperCrossingTime_succ_eq, upperCrossingTime_succ_eq, eq_comm, this]
   refine' hitting_eq_hitting_of_exists hNM _
   rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h
-  obtain ⟨j, hj₁, hj₂⟩ := h
-  exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
+  · obtain ⟨j, hj₁, hj₂⟩ := h
+    exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
+  · exact le_rfl
 #align measure_theory.crossing_eq_crossing_of_upper_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_upperCrossingTime_lt
 
 theorem upperCrossingTime_eq_upperCrossingTime_of_lt {M : ℕ} (hNM : N ≤ M)
chore: Move intervals (#11765)

Move Set.Ixx, Finset.Ixx, Multiset.Ixx together under two different folders:

  • Order.Interval for their definition and basic properties
  • Algebra.Order.Interval for their algebraic properties

Move the definitions of Multiset.Ixx to what is now Order.Interval.Multiset. I believe we could just delete this file in a later PR as nothing uses it (and I already had doubts when defining Multiset.Ixx three years ago).

Move the algebraic results out of what is now Order.Interval.Finset.Basic to a new file Algebra.Order.Interval.Finset.Basic.

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Kexing Ying. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kexing Ying
 -/
-import Mathlib.Data.Set.Intervals.Monotone
+import Mathlib.Order.Interval.Set.Monotone
 import Mathlib.Probability.Process.HittingTime
 import Mathlib.Probability.Martingale.Basic
 
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
@@ -426,7 +426,7 @@ theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Subm
     μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by
   have h₁ : (0 : ℝ) ≤
       μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by
-    have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ
+    have := (hf.sum_sub_upcrossingStrat_mul a b N).setIntegral_le (zero_le n) MeasurableSet.univ
     rw [integral_univ, integral_univ] at this
     refine' le_trans _ this
     simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl]
chore: Rename nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)

Now that I am defining NNRat.cast, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast/intCast/ratCast over nat_cast/int_cast/rat_cast, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.

Diff
@@ -865,11 +865,11 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       rw [(by simp :
           ∫⁻ ω, upcrossingsBefore a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossingsBefore a b f N ω : ℝ≥0) ∂μ),
         lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
-      · simp_rw [NNReal.coe_nat_cast]
+      · simp_rw [NNReal.coe_natCast]
         exact (ENNReal.ofReal_le_ofReal
           (hf.mul_integral_upcrossingsBefore_le_integral_pos_part a b N)).trans
             (le_iSup (α := ℝ≥0∞) _ N)
-      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
+      · simp only [NNReal.coe_natCast, hf.adapted.integrable_upcrossingsBefore hab]
     · exact fun n => measurable_from_top.comp_aemeasurable
         (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
     · filter_upwards with ω N M hNM
chore: Rename coe_nat/coe_int/coe_rat to natCast/intCast/ratCast (#11499)

This is less exhaustive than its sibling #11486 because edge cases are harder to classify. No fundamental difficulty, just me being a bit fast and lazy.

Reduce the diff of #11203

Diff
@@ -843,9 +843,9 @@ theorem upcrossings_lt_top_iff :
   constructor <;> rintro ⟨k, hk⟩
   · obtain ⟨m, hm⟩ := exists_nat_ge k
     refine' ⟨m, fun N => Nat.cast_le.1 ((hk N).trans _)⟩
-    rwa [← ENNReal.coe_nat, ENNReal.coe_le_coe]
+    rwa [← ENNReal.coe_natCast, ENNReal.coe_le_coe]
   · refine' ⟨k, fun N => _⟩
-    simp only [ENNReal.coe_nat, Nat.cast_le, hk N]
+    simp only [ENNReal.coe_natCast, Nat.cast_le, hk N]
 #align measure_theory.upcrossings_lt_top_iff MeasureTheory.upcrossings_lt_top_iff
 
 /-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
chore: Reduce scope of LinearOrderedCommGroupWithZero (#11716)

Reconstitute the file Algebra.Order.Monoid.WithZero from three files:

  • Algebra.Order.Monoid.WithZero.Defs
  • Algebra.Order.Monoid.WithZero.Basic
  • Algebra.Order.WithZero

Avoid importing it in many files. Most uses were just to get le_zero_iff to work on Nat.

Before pre_11716

After post_11716

Diff
@@ -563,7 +563,7 @@ theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ
       rw [upperCrossingTime_eq_upperCrossingTime_of_lt (hN₁.trans (hN₂.trans <| Nat.le_succ _))
         this]
       exact this.le
-    · rw [not_lt, le_zero_iff] at hN
+    · rw [not_lt, Nat.le_zero] at hN
       rw [hN, upcrossingsBefore_zero, upperCrossingTime_zero]
       rfl
 #align measure_theory.upcrossings_before_lt_of_exists_upcrossing MeasureTheory.upcrossingsBefore_lt_of_exists_upcrossing
feat: Positivity extension for Bochner integral (#10661)

Inspired by #10538 add a positivity extension for Bochner integrals.

Diff
@@ -741,7 +741,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFin
   by_cases hab : a < b
   · exact mul_integral_upcrossingsBefore_le_integral_pos_part_aux hf hab
   · rw [not_lt, ← sub_nonpos] at hab
-    exact le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
+    exact le_trans (mul_nonpos_of_nonpos_of_nonneg hab (by positivity))
       (integral_nonneg fun ω => posPart_nonneg _)
 #align measure_theory.submartingale.mul_integral_upcrossings_before_le_integral_pos_part MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part
 
chore: work around simp issues in future nightlies (#11546)
Diff
@@ -679,7 +679,10 @@ theorem crossing_pos_eq (hab : a < b) :
   have hf' (ω i) : (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a := by rw [posPart_nonpos, sub_nonpos]
   induction' n with k ih
   · refine' ⟨rfl, _⟩
-    simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting,
+    -- Adaptation note: nightly-2024-03-16: simp was
+    -- simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting,
+    --   Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
+    simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting_def,
       Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
     ext ω
     split_ifs with h₁ h₂ h₂
chore: golf using filter_upwards (#11208)

This is presumably not exhaustive, but covers about a hundred instances.

Style opinions (e.g., why a particular change is great/not a good idea) are very welcome; I'm still forming my own.

Diff
@@ -659,7 +659,7 @@ theorem integral_mul_upcrossingsBefore_le_integral [IsFiniteMeasure μ] (hf : Su
       rw [← integral_mul_left]
       refine' integral_mono_of_nonneg _ ((hf.sum_upcrossingStrat_mul a b N).integrable N) _
       · exact eventually_of_forall fun ω => mul_nonneg (sub_nonneg.2 hab.le) (Nat.cast_nonneg _)
-      · refine' eventually_of_forall fun ω => _
+      · filter_upwards with ω
         simpa using mul_upcrossingsBefore_le (hfN ω) hab
     _ ≤ μ[f N] - μ[f 0] := hf.sum_mul_upcrossingStrat_le
     _ ≤ μ[f N] := (sub_le_self_iff _).2 (integral_nonneg hfzero)
@@ -808,7 +808,7 @@ theorem Adapted.measurable_upcrossingsBefore (hf : Adapted ℱ f) (hab : a < b)
 theorem Adapted.integrable_upcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted ℱ f) (hab : a < b) :
     Integrable (fun ω => (upcrossingsBefore a b f N ω : ℝ)) μ :=
   haveI : ∀ᵐ ω ∂μ, ‖(upcrossingsBefore a b f N ω : ℝ)‖ ≤ N := by
-    refine' eventually_of_forall fun ω => _
+    filter_upwards with ω
     rw [Real.norm_eq_abs, Nat.abs_cast, Nat.cast_le]
     exact upcrossingsBefore_le _ _ hab
   ⟨Measurable.aestronglyMeasurable (measurable_from_top.comp (hf.measurable_upcrossingsBefore hab)),
@@ -869,7 +869,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
     · exact fun n => measurable_from_top.comp_aemeasurable
         (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
-    · refine' eventually_of_forall fun ω N M hNM => _
+    · filter_upwards with ω N M hNM
       rw [Nat.cast_le]
       exact upcrossingsBefore_mono hab hNM ω
   · rw [not_lt, ← sub_nonpos] at hab
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -152,7 +152,6 @@ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b
 section
 
 variable [Preorder ι] [OrderBot ι] [InfSet ι]
-
 variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω}
 
 @[simp]
@@ -181,7 +180,6 @@ end
 section ConditionallyCompleteLinearOrderBot
 
 variable [ConditionallyCompleteLinearOrderBot ι]
-
 variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω}
 
 theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by
refactor(Order): rename cInf -> csInf and cSup -> csSup (#10985)

Does the following renames:

  • cSup_eq_max' -> csSup_eq_max'
  • cInf_eq_min' -> csInf_eq_min'
  • cSup_mem -> csSup_mem
  • cInf_mem -> csInf_mem
  • cSup_lt_iff -> csSup_lt_iff
  • lt_cInf_iff -> lt_csInf_iff
Diff
@@ -468,7 +468,7 @@ theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by
 theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b)
     (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N :=
   haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N :=
-    (upperCrossingTime_lt_nonempty hN).cSup_mem
+    (upperCrossingTime_lt_nonempty hN).csSup_mem
       ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab))
   lt_of_le_of_lt (upperCrossingTime_mono hn) this
 #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore
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
@@ -812,7 +812,7 @@ theorem Adapted.integrable_upcrossingsBefore [IsFiniteMeasure μ] (hf : Adapted
   haveI : ∀ᵐ ω ∂μ, ‖(upcrossingsBefore a b f N ω : ℝ)‖ ≤ N := by
     refine' eventually_of_forall fun ω => _
     rw [Real.norm_eq_abs, Nat.abs_cast, Nat.cast_le]
-    refine' upcrossingsBefore_le _ _ hab
+    exact upcrossingsBefore_le _ _ hab
   ⟨Measurable.aestronglyMeasurable (measurable_from_top.comp (hf.measurable_upcrossingsBefore hab)),
     hasFiniteIntegral_of_bounded this⟩
 #align measure_theory.adapted.integrable_upcrossings_before MeasureTheory.Adapted.integrable_upcrossingsBefore
refactor: Clean up posPart (#9740)

This changes the typeclass notation approach with plain functions.

Followup to #9553. Part of #9411

Diff
@@ -675,12 +675,10 @@ theorem crossing_pos_eq (hab : a < b) :
     intro i ω
     refine' ⟨fun h => _, fun h => _⟩
     · rwa [← sub_le_sub_iff_right a, ←
-        LatticeOrderedGroup.pos_eq_self_of_pos_pos (lt_of_lt_of_le hab' h)]
+        posPart_eq_of_posPart_pos (lt_of_lt_of_le hab' h)]
     · rw [← sub_le_sub_iff_right a] at h
-      rwa [LatticeOrderedGroup.pos_of_nonneg _ (le_trans hab'.le h)]
-  have hf' : ∀ ω i, (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a := by
-    intro ω i
-    rw [LatticeOrderedGroup.pos_nonpos_iff, sub_nonpos]
+      rwa [posPart_eq_self.2 (le_trans hab'.le h)]
+  have hf' (ω i) : (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a := by rw [posPart_nonpos, sub_nonpos]
   induction' n with k ih
   · refine' ⟨rfl, _⟩
     simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting,
@@ -726,8 +724,8 @@ theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] := by
   refine' le_trans (le_of_eq _)
     (integral_mul_upcrossingsBefore_le_integral (hf.sub_martingale (martingale_const _ _ _)).pos
-      (fun ω => LatticeOrderedGroup.pos_nonneg _)
-      (fun ω => LatticeOrderedGroup.pos_nonneg _) (sub_pos.2 hab))
+      (fun ω => posPart_nonneg _)
+      (fun ω => posPart_nonneg _) (sub_pos.2 hab))
   simp_rw [sub_zero, ← upcrossingsBefore_pos_eq hab]
   rfl
 #align measure_theory.mul_integral_upcrossings_before_le_integral_pos_part_aux MeasureTheory.mul_integral_upcrossingsBefore_le_integral_pos_part_aux
@@ -743,7 +741,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFin
   · exact mul_integral_upcrossingsBefore_le_integral_pos_part_aux hf hab
   · rw [not_lt, ← sub_nonpos] at hab
     exact le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
-      (integral_nonneg fun ω => LatticeOrderedGroup.pos_nonneg _)
+      (integral_nonneg fun ω => posPart_nonneg _)
 #align measure_theory.submartingale.mul_integral_upcrossings_before_le_integral_pos_part MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part
 
 /-!
@@ -859,7 +857,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       intro N
       rw [ofReal_integral_eq_lintegral_ofReal]
       · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
-      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
+      · exact eventually_of_forall fun ω => posPart_nonneg _
     rw [lintegral_iSup']
     · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
       intro N
chore: Sink Algebra.Support down the import tree (#8919)

Function.support is a very basic definition. Nevertheless, it is a pretty heavy import because it imports most objects a support lemma can be written about.

This PR reverses the dependencies between those objects and Function.support, so that the latter can become a much more lightweight import.

Only two import could not easily be reversed, namely the ones to Data.Set.Finite and Order.ConditionallyCompleteLattice.Basic, so I created two new files instead.

I credit:

Diff
@@ -375,24 +375,24 @@ theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω :=
 #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg
 
 theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by
-  rw [upcrossingStrat, ← Set.indicator_finset_biUnion_apply]
+  rw [upcrossingStrat, ← Finset.indicator_biUnion_apply]
   · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _
-  · intro i _ j _ hij
-    rw [Set.Ico_disjoint_Ico]
-    obtain hij' | hij' := lt_or_gt_of_ne hij
-    · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) :
-        upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω),
-        max_eq_right (lowerCrossingTime_mono hij'.le :
-          lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
-      refine' le_trans upperCrossingTime_le_lowerCrossingTime
-        (lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
-    · rw [gt_iff_lt] at hij'
-      rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) :
-        upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω),
-        max_eq_left (lowerCrossingTime_mono hij'.le :
-          lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
-      refine' le_trans upperCrossingTime_le_lowerCrossingTime
-        (lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
+  intro i _ j _ hij
+  simp only [Set.Ico_disjoint_Ico]
+  obtain hij' | hij' := lt_or_gt_of_ne hij
+  · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) :
+      upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω),
+      max_eq_right (lowerCrossingTime_mono hij'.le :
+        lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
+    refine' le_trans upperCrossingTime_le_lowerCrossingTime
+      (lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
+  · rw [gt_iff_lt] at hij'
+    rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) :
+      upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω),
+      max_eq_left (lowerCrossingTime_mono hij'.le :
+        lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
+    refine' le_trans upperCrossingTime_le_lowerCrossingTime
+      (lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
 #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one
 
 theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) :
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
@@ -683,7 +683,8 @@ theorem crossing_pos_eq (hab : a < b) :
     rw [LatticeOrderedGroup.pos_nonpos_iff, sub_nonpos]
   induction' n with k ih
   · refine' ⟨rfl, _⟩
-    simp only [lowerCrossingTime_zero, hitting, Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
+    simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting,
+      Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
     ext ω
     split_ifs with h₁ h₂ h₂
     · simp_rw [hf']
@@ -699,7 +700,7 @@ theorem crossing_pos_eq (hab : a < b) :
       split_ifs with h₁ h₂ h₂
       · simp_rw [← sub_le_iff_le_add, hf ω]
       · refine' False.elim (h₂ _)
-        simp_all only [Set.mem_Ici]
+        simp_all only [Set.mem_Ici, not_true_eq_false]
       · refine' False.elim (h₁ _)
         simp_all only [Set.mem_Ici]
       · rfl
@@ -709,7 +710,7 @@ theorem crossing_pos_eq (hab : a < b) :
     split_ifs with h₁ h₂ h₂
     · simp_rw [hf' ω]
     · refine' False.elim (h₂ _)
-      simp_all only [Set.mem_Iic]
+      simp_all only [Set.mem_Iic, not_true_eq_false]
     · refine' False.elim (h₁ _)
       simp_all only [Set.mem_Iic]
     · rfl
fix: patch for std4#195 (more succ/pred lemmas for Nat) (#6203)
Diff
@@ -321,7 +321,7 @@ theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω)
       refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _
       rw [Nat.lt_pred_iff] at hm
       convert Nat.find_min _ hm
-    convert StrictMonoOn.Iic_id_le hmono N (Nat.le_pred_of_lt hN')
+    convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN')
   · rw [not_lt] at hN'
     exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab))
 #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -793,7 +793,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) : upcrossingsBefore a b f N ω =
     simp only [Set.mem_setOf_eq, not_lt]
     exact (upperCrossingTime_eq_of_upcrossingsBefore_lt hab hk.1).symm.le
   rw [Finset.sum_congr rfl h₁, Finset.sum_congr rfl h₂, Finset.sum_const, Finset.sum_const,
-    smul_eq_mul, mul_one, smul_eq_mul, MulZeroClass.mul_zero, Nat.card_Ico, Nat.add_succ_sub_one,
+    smul_eq_mul, mul_one, smul_eq_mul, mul_zero, Nat.card_Ico, Nat.add_succ_sub_one,
     add_zero, add_zero]
 #align measure_theory.upcrossings_before_eq_sum MeasureTheory.upcrossingsBefore_eq_sum
 
@@ -876,7 +876,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       rw [Nat.cast_le]
       exact upcrossingsBefore_mono hab hNM ω
   · rw [not_lt, ← sub_nonpos] at hab
-    rw [ENNReal.ofReal_of_nonpos hab, MulZeroClass.zero_mul]
+    rw [ENNReal.ofReal_of_nonpos hab, zero_mul]
     exact zero_le _
 #align measure_theory.submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part
 
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
@@ -62,7 +62,7 @@ open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
 
 namespace MeasureTheory
 
-variable {Ω ι : Type _} {m0 : MeasurableSpace Ω} {μ : Measure Ω}
+variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω}
 
 /-!
 
refactor(Algebra/Order/LatticeGroup): Non-commutative Lattice Groups (#6452)

Generalise results in Algebra/Order/LatticeGroup to the case where the group is non-commutative

Co-authored-by: Christopher Hoskin <christopher.hoskin@overleaf.com>

Diff
@@ -675,12 +675,12 @@ theorem crossing_pos_eq (hab : a < b) :
     intro i ω
     refine' ⟨fun h => _, fun h => _⟩
     · rwa [← sub_le_sub_iff_right a, ←
-        LatticeOrderedCommGroup.pos_eq_self_of_pos_pos (lt_of_lt_of_le hab' h)]
+        LatticeOrderedGroup.pos_eq_self_of_pos_pos (lt_of_lt_of_le hab' h)]
     · rw [← sub_le_sub_iff_right a] at h
-      rwa [LatticeOrderedCommGroup.pos_of_nonneg _ (le_trans hab'.le h)]
+      rwa [LatticeOrderedGroup.pos_of_nonneg _ (le_trans hab'.le h)]
   have hf' : ∀ ω i, (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a := by
     intro ω i
-    rw [LatticeOrderedCommGroup.pos_nonpos_iff, sub_nonpos]
+    rw [LatticeOrderedGroup.pos_nonpos_iff, sub_nonpos]
   induction' n with k ih
   · refine' ⟨rfl, _⟩
     simp only [lowerCrossingTime_zero, hitting, Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
@@ -725,8 +725,8 @@ theorem mul_integral_upcrossingsBefore_le_integral_pos_part_aux [IsFiniteMeasure
     (b - a) * μ[upcrossingsBefore a b f N] ≤ μ[fun ω => (f N ω - a)⁺] := by
   refine' le_trans (le_of_eq _)
     (integral_mul_upcrossingsBefore_le_integral (hf.sub_martingale (martingale_const _ _ _)).pos
-      (fun ω => LatticeOrderedCommGroup.pos_nonneg _)
-      (fun ω => LatticeOrderedCommGroup.pos_nonneg _) (sub_pos.2 hab))
+      (fun ω => LatticeOrderedGroup.pos_nonneg _)
+      (fun ω => LatticeOrderedGroup.pos_nonneg _) (sub_pos.2 hab))
   simp_rw [sub_zero, ← upcrossingsBefore_pos_eq hab]
   rfl
 #align measure_theory.mul_integral_upcrossings_before_le_integral_pos_part_aux MeasureTheory.mul_integral_upcrossingsBefore_le_integral_pos_part_aux
@@ -742,7 +742,7 @@ theorem Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part [IsFin
   · exact mul_integral_upcrossingsBefore_le_integral_pos_part_aux hf hab
   · rw [not_lt, ← sub_nonpos] at hab
     exact le_trans (mul_nonpos_of_nonpos_of_nonneg hab (integral_nonneg fun ω => Nat.cast_nonneg _))
-      (integral_nonneg fun ω => LatticeOrderedCommGroup.pos_nonneg _)
+      (integral_nonneg fun ω => LatticeOrderedGroup.pos_nonneg _)
 #align measure_theory.submartingale.mul_integral_upcrossings_before_le_integral_pos_part MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part
 
 /-!
@@ -858,7 +858,7 @@ theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteM
       intro N
       rw [ofReal_integral_eq_lintegral_ofReal]
       · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
-      · exact eventually_of_forall fun ω => LatticeOrderedCommGroup.pos_nonneg _
+      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
     rw [lintegral_iSup']
     · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
       intro N
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.upcrossing
-! leanprover-community/mathlib commit 2c1d8ca2812b64f88992a5294ea3dba144755cd1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Set.Intervals.Monotone
 import Mathlib.Probability.Process.HittingTime
 import Mathlib.Probability.Martingale.Basic
 
+#align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
+
 /-!
 
 # Doob's upcrossing estimate
feat: port Probability.Martingale.Upcrossing (#5281)

Dependencies 12 + 1008

1009 files ported (98.8%)
460854 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