analysis.bounded_variationMathlib.Analysis.BoundedVariation

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
 import Analysis.Calculus.Deriv.Add
-import Analysis.Calculus.Fderiv.Equiv
-import Analysis.Calculus.Fderiv.Prod
+import Analysis.Calculus.FDeriv.Equiv
+import Analysis.Calculus.FDeriv.Prod
 import Analysis.Calculus.Monotone
 import Data.Set.Function
 import Algebra.Group.Basic
@@ -236,7 +236,7 @@ theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y 
 #align evariation_on.edist_le eVariationOn.edist_le
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (x y «expr ∈ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (x y «expr ∈ » s) -/
 #print eVariationOn.eq_zero_iff /-
 theorem eq_zero_iff (f : α → E) {s : Set α} :
     eVariationOn f s = 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 :=
@@ -1002,7 +1002,7 @@ theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : LocallyBoundedVa
       apply eVariationOn.edist_le f
       exacts [⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
     _ = variationOnFromTo f s a c - variationOnFromTo f s a b := by
-      rw [← add hf as bs cs, add_sub_cancel']
+      rw [← add hf as bs cs, add_sub_cancel_left]
 #align variation_on_from_to.sub_self_monotone_on variationOnFromTo.sub_self_monotoneOn
 -/
 
Diff
@@ -150,7 +150,7 @@ theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ
       simp [A, B]
   convert sum_le f n hv vs using 1
   apply Finset.sum_congr rfl fun i hi => _
-  simp only [Finset.mem_range] at hi 
+  simp only [Finset.mem_range] at hi
   have : i + 1 ≤ n := by linarith
   simp only [v]
   simp [this, hi.le]
@@ -168,11 +168,11 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
   have hv : MonotoneOn v (Iic (n - m)) :=
     by
     intro a ha b hb hab
-    simp only [le_tsub_iff_left hmn.le, mem_Iic] at ha hb 
+    simp only [le_tsub_iff_left hmn.le, mem_Iic] at ha hb
     exact hu ⟨le_add_right le_rfl, ha⟩ ⟨le_add_right le_rfl, hb⟩ (add_le_add le_rfl hab)
   have vs : ∀ i ∈ Iic (n - m), v i ∈ s := by
     intro i hi
-    simp only [le_tsub_iff_left hmn.le, mem_Iic] at hi 
+    simp only [le_tsub_iff_left hmn.le, mem_Iic] at hi
     exact us _ ⟨le_add_right le_rfl, hi⟩
   calc
     ∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) =
@@ -315,7 +315,7 @@ theorem lowerSemicontinuous_uniformOn (s : Set α) :
   intro f
   apply @lower_continuous_aux _ _ _ _ (UniformOnFun α E {s}) id (𝓝 f) f s _
   have := @tendsto_id _ (𝓝 f)
-  rw [UniformOnFun.tendsto_iff_tendstoUniformlyOn] at this 
+  rw [UniformOnFun.tendsto_iff_tendstoUniformlyOn] at this
   simp_rw [← tendstoUniformlyOn_singleton_iff_tendsto]
   exact fun x xs => (this s rfl).mono (singleton_subset_iff.mpr xs)
 #align evariation_on.lower_semicontinuous_uniform_on eVariationOn.lowerSemicontinuous_uniformOn
@@ -385,7 +385,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
             ∑ i in Finset.range n, edist (f (v (i + 1))) (f (v i)) :=
           by
           apply Finset.sum_congr rfl fun i hi => _
-          simp only [Finset.mem_range] at hi 
+          simp only [Finset.mem_range] at hi
           have : i + 1 ≤ n := Nat.succ_le_of_lt hi
           dsimp only [v]
           simp only [hi.le, this, if_true]
@@ -411,7 +411,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       have B : ¬i + 1 < N := by rw [← hi]; exact fun h => h.Ne rfl
       rw [if_pos A, if_neg B, if_pos hi]
       have T := Nat.find_min exists_N A
-      push_neg at T 
+      push_neg at T
       exact T (A.le.trans hN.1)
     · have A : ¬i < N := (nat.lt_succ_iff.mp hi).not_lt
       have B : ¬i + 1 < N := hi.not_lt
@@ -462,7 +462,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         by
         congr 1; congr 1
         · apply Finset.sum_congr rfl fun i hi => _
-          simp only [Finset.mem_Ico, zero_le', true_and_iff] at hi 
+          simp only [Finset.mem_Ico, zero_le', true_and_iff] at hi
           dsimp only [w]
           have A : i + 1 < N := Nat.lt_pred_iff.1 hi
           have B : i < N := Nat.lt_of_succ_lt A
@@ -471,19 +471,19 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
           have : Finset.Ico (N - 1) N = {N - 1} := by rw [← Nat.Ico_succ_singleton, A]
           simp only [this, A, Finset.sum_singleton]
         · apply Finset.sum_congr rfl fun i hi => _
-          simp only [Finset.mem_Ico] at hi 
+          simp only [Finset.mem_Ico] at hi
           dsimp only [w]
           have A : ¬1 + i + 1 < N := fun h =>
             by
-            rw [add_assoc, add_comm] at h 
+            rw [add_assoc, add_comm] at h
             exact hi.left.not_lt (i.lt_succ_self.trans (i.succ.lt_succ_self.trans h))
           have B : ¬1 + i + 1 = N := fun h =>
             by
-            rw [← h, add_assoc, add_comm] at hi 
+            rw [← h, add_assoc, add_comm] at hi
             exact Nat.not_succ_le_self i (i.succ.le_succ.trans hi.left)
-          have C : ¬1 + i < N := fun h => by rw [add_comm] at h ;
+          have C : ¬1 + i < N := fun h => by rw [add_comm] at h;
             exact hi.left.not_lt (i.lt_succ_self.trans h)
-          have D : ¬1 + i = N := fun h => by rw [← h, add_comm, Nat.succ_le_iff] at hi ;
+          have D : ¬1 + i = N := fun h => by rw [← h, add_comm, Nat.succ_le_iff] at hi;
             exact hi.left.ne rfl
           rw [if_neg A, if_neg B, if_neg C, if_neg D]
           congr 3 <;> · rw [add_comm, Nat.sub_one]; apply Nat.pred_succ
@@ -563,11 +563,11 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
       dsimp only [w]
       congr 1
       · apply Finset.sum_congr rfl fun i hi => _
-        simp only [Finset.mem_range] at hi 
+        simp only [Finset.mem_range] at hi
         have : i + 1 ≤ n := Nat.succ_le_of_lt hi
         simp [hi.le, this]
       · apply Finset.sum_congr rfl fun i hi => _
-        simp only [Finset.mem_range] at hi 
+        simp only [Finset.mem_range] at hi
         have B : ¬n + 1 + i ≤ n := by linarith
         have A : ¬n + 1 + i + 1 ≤ n := fun h => B ((n + 1 + i).le_succ.trans h)
         have C : n + 1 + i - n = i + 1 :=
@@ -595,7 +595,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
         · exact lt_of_lt_of_le hi (n.le_succ.trans (n.succ.le_add_right m))
         · exact hi.2
       · apply Finset.disjoint_left.2 fun i hi h'i => _
-        simp only [Finset.mem_Ico, Finset.mem_range] at hi h'i 
+        simp only [Finset.mem_Ico, Finset.mem_range] at hi h'i
         exact hi.not_lt (Nat.lt_of_succ_le h'i.left)
     _ ≤ eVariationOn f (s ∪ t) := sum_le f _ hw wst
 #align evariation_on.add_le_union eVariationOn.add_le_union
@@ -791,7 +791,7 @@ theorem MonotoneOn.eVariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneO
         ∑ i in Finset.range n, ENNReal.ofReal (f (u (i + 1)) - f (u i)) :=
       by
       apply Finset.sum_congr rfl fun i hi => _
-      simp only [Finset.mem_range] at hi 
+      simp only [Finset.mem_range] at hi
       rw [edist_dist, Real.dist_eq, abs_of_nonneg]
       exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
     _ = ENNReal.ofReal (∑ i in Finset.range n, (f (u (i + 1)) - f (u i))) :=
@@ -1179,7 +1179,7 @@ theorem ae_differentiableAt {f : ℝ → V} (h : LocallyBoundedVariationOn f uni
     ∀ᵐ x, DifferentiableAt ℝ f x :=
   by
   filter_upwards [h.ae_differentiable_within_at_of_mem] with x hx
-  rw [differentiableWithinAt_univ] at hx 
+  rw [differentiableWithinAt_univ] at hx
   exact hx (mem_univ _)
 #align has_locally_bounded_variation_on.ae_differentiable_at LocallyBoundedVariationOn.ae_differentiableAt
 -/
Diff
@@ -605,7 +605,48 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
 /-- If a set `s` is to the left of a set `t`, and both contain the boundary point `x`, then
 the variation of `f` along `s ∪ t` is the sum of the variations. -/
 theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht : IsLeast t x) :
-    eVariationOn f (s ∪ t) = eVariationOn f s + eVariationOn f t := by classical
+    eVariationOn f (s ∪ t) = eVariationOn f s + eVariationOn f t := by
+  classical
+  apply le_antisymm _ (eVariationOn.add_le_union f fun a ha b hb => le_trans (hs.2 ha) (ht.2 hb))
+  apply iSup_le _
+  rintro ⟨n, ⟨u, hu, ust⟩⟩
+  obtain ⟨v, m, hv, vst, xv, huv⟩ :
+    ∃ (v : ℕ → α) (m : ℕ),
+      Monotone v ∧
+        (∀ i, v i ∈ s ∪ t) ∧
+          x ∈ v '' Iio m ∧
+            ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤
+              ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j))
+  exact eVariationOn.add_point f (mem_union_left t hs.1) u hu ust n
+  obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x
+  exact xv
+  calc
+    ∑ j in Finset.range n, edist (f (u (j + 1))) (f (u j)) ≤
+        ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
+      huv
+    _ =
+        ∑ j in Finset.Ico 0 N, edist (f (v (j + 1))) (f (v j)) +
+          ∑ j in Finset.Ico N m, edist (f (v (j + 1))) (f (v j)) :=
+      by rw [Finset.range_eq_Ico, Finset.sum_Ico_consecutive _ (zero_le _) hN.le]
+    _ ≤ eVariationOn f s + eVariationOn f t :=
+      by
+      refine' add_le_add _ _
+      · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
+        rcases vst i with (h | h); · exact h
+        have : v i = x := by
+          apply le_antisymm
+          · rw [← Nx]; exact hv hi.2
+          · exact ht.2 h
+        rw [this]
+        exact hs.1
+      · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
+        rcases vst i with (h | h); swap; · exact h
+        have : v i = x := by
+          apply le_antisymm
+          · exact hs.2 h
+          · rw [← Nx]; exact hv hi.1
+        rw [this]
+        exact ht.1
 #align evariation_on.union eVariationOn.union
 -/
 
Diff
@@ -605,48 +605,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
 /-- If a set `s` is to the left of a set `t`, and both contain the boundary point `x`, then
 the variation of `f` along `s ∪ t` is the sum of the variations. -/
 theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht : IsLeast t x) :
-    eVariationOn f (s ∪ t) = eVariationOn f s + eVariationOn f t := by
-  classical
-  apply le_antisymm _ (eVariationOn.add_le_union f fun a ha b hb => le_trans (hs.2 ha) (ht.2 hb))
-  apply iSup_le _
-  rintro ⟨n, ⟨u, hu, ust⟩⟩
-  obtain ⟨v, m, hv, vst, xv, huv⟩ :
-    ∃ (v : ℕ → α) (m : ℕ),
-      Monotone v ∧
-        (∀ i, v i ∈ s ∪ t) ∧
-          x ∈ v '' Iio m ∧
-            ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤
-              ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j))
-  exact eVariationOn.add_point f (mem_union_left t hs.1) u hu ust n
-  obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x
-  exact xv
-  calc
-    ∑ j in Finset.range n, edist (f (u (j + 1))) (f (u j)) ≤
-        ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
-      huv
-    _ =
-        ∑ j in Finset.Ico 0 N, edist (f (v (j + 1))) (f (v j)) +
-          ∑ j in Finset.Ico N m, edist (f (v (j + 1))) (f (v j)) :=
-      by rw [Finset.range_eq_Ico, Finset.sum_Ico_consecutive _ (zero_le _) hN.le]
-    _ ≤ eVariationOn f s + eVariationOn f t :=
-      by
-      refine' add_le_add _ _
-      · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
-        rcases vst i with (h | h); · exact h
-        have : v i = x := by
-          apply le_antisymm
-          · rw [← Nx]; exact hv hi.2
-          · exact ht.2 h
-        rw [this]
-        exact hs.1
-      · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
-        rcases vst i with (h | h); swap; · exact h
-        have : v i = x := by
-          apply le_antisymm
-          · exact hs.2 h
-          · rw [← Nx]; exact hv hi.1
-        rw [this]
-        exact ht.1
+    eVariationOn f (s ∪ t) = eVariationOn f s + eVariationOn f t := by classical
 #align evariation_on.union eVariationOn.union
 -/
 
Diff
@@ -1153,7 +1153,7 @@ theorem ae_differentiableWithinAt_of_mem {f : ℝ → V} {s : Set ℝ}
   suffices H : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (A ∘ f) s x
   · filter_upwards [H] with x hx xs
     have : f = (A.symm ∘ A) ∘ f := by
-      simp only [ContinuousLinearEquiv.symm_comp_self, Function.comp.left_id]
+      simp only [ContinuousLinearEquiv.symm_comp_self, Function.id_comp]
     rw [this]
     exact A.symm.differentiable_at.comp_differentiable_within_at x (hx xs)
   apply ae_differentiable_within_at_of_mem_pi
Diff
@@ -1186,31 +1186,31 @@ theorem ae_differentiableAt {f : ℝ → V} (h : LocallyBoundedVariationOn f uni
 
 end LocallyBoundedVariationOn
 
-#print LipschitzOnWith.ae_differentiableWithinAt_of_mem /-
+#print LipschitzOnWith.ae_differentiableWithinAt_of_mem_real /-
 /-- A real function into a finite dimensional real vector space which is Lipschitz on a set
 is differentiable almost everywhere in this set . -/
-theorem LipschitzOnWith.ae_differentiableWithinAt_of_mem {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
+theorem LipschitzOnWith.ae_differentiableWithinAt_of_mem_real {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
     (h : LipschitzOnWith C f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
   h.LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem
-#align lipschitz_on_with.ae_differentiable_within_at_of_mem LipschitzOnWith.ae_differentiableWithinAt_of_mem
+#align lipschitz_on_with.ae_differentiable_within_at_of_mem LipschitzOnWith.ae_differentiableWithinAt_of_mem_real
 -/
 
-#print LipschitzOnWith.ae_differentiableWithinAt /-
+#print LipschitzOnWith.ae_differentiableWithinAt_real /-
 /-- A real function into a finite dimensional real vector space which is Lipschitz on a set
 is differentiable almost everywhere in this set. -/
-theorem LipschitzOnWith.ae_differentiableWithinAt {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
+theorem LipschitzOnWith.ae_differentiableWithinAt_real {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
     (h : LipschitzOnWith C f s) (hs : MeasurableSet s) :
     ∀ᵐ x ∂volume.restrict s, DifferentiableWithinAt ℝ f s x :=
   h.LocallyBoundedVariationOn.ae_differentiableWithinAt hs
-#align lipschitz_on_with.ae_differentiable_within_at LipschitzOnWith.ae_differentiableWithinAt
+#align lipschitz_on_with.ae_differentiable_within_at LipschitzOnWith.ae_differentiableWithinAt_real
 -/
 
-#print LipschitzWith.ae_differentiableAt /-
+#print LipschitzWith.ae_differentiableAt_real /-
 /-- A real Lipschitz function into a finite dimensional real vector space is differentiable
 almost everywhere. -/
-theorem LipschitzWith.ae_differentiableAt {C : ℝ≥0} {f : ℝ → V} (h : LipschitzWith C f) :
+theorem LipschitzWith.ae_differentiableAt_real {C : ℝ≥0} {f : ℝ → V} (h : LipschitzWith C f) :
     ∀ᵐ x, DifferentiableAt ℝ f x :=
   (h.LocallyBoundedVariationOn univ).ae_differentiableAt
-#align lipschitz_with.ae_differentiable_at LipschitzWith.ae_differentiableAt
+#align lipschitz_with.ae_differentiable_at LipschitzWith.ae_differentiableAt_real
 -/
 
Diff
@@ -3,13 +3,13 @@ Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathbin.Analysis.Calculus.Deriv.Add
-import Mathbin.Analysis.Calculus.Fderiv.Equiv
-import Mathbin.Analysis.Calculus.Fderiv.Prod
-import Mathbin.Analysis.Calculus.Monotone
-import Mathbin.Data.Set.Function
-import Mathbin.Algebra.Group.Basic
-import Mathbin.Tactic.Wlog
+import Analysis.Calculus.Deriv.Add
+import Analysis.Calculus.Fderiv.Equiv
+import Analysis.Calculus.Fderiv.Prod
+import Analysis.Calculus.Monotone
+import Data.Set.Function
+import Algebra.Group.Basic
+import Tactic.Wlog
 
 #align_import analysis.bounded_variation from "leanprover-community/mathlib"@"e8e130de9dba4ed6897183c3193c752ffadbcc77"
 
@@ -236,7 +236,7 @@ theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y 
 #align evariation_on.edist_le eVariationOn.edist_le
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x y «expr ∈ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (x y «expr ∈ » s) -/
 #print eVariationOn.eq_zero_iff /-
 theorem eq_zero_iff (f : α → E) {s : Set α} :
     eVariationOn f s = 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 :=
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.bounded_variation
-! 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.Analysis.Calculus.Deriv.Add
 import Mathbin.Analysis.Calculus.Fderiv.Equiv
@@ -16,6 +11,8 @@ import Mathbin.Data.Set.Function
 import Mathbin.Algebra.Group.Basic
 import Mathbin.Tactic.Wlog
 
+#align_import analysis.bounded_variation from "leanprover-community/mathlib"@"e8e130de9dba4ed6897183c3193c752ffadbcc77"
+
 /-!
 # Functions of bounded variation
 
@@ -239,7 +236,7 @@ theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y 
 #align evariation_on.edist_le eVariationOn.edist_le
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (x y «expr ∈ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x y «expr ∈ » s) -/
 #print eVariationOn.eq_zero_iff /-
 theorem eq_zero_iff (f : α → E) {s : Set α} :
     eVariationOn f s = 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 :=
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module analysis.bounded_variation
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
+! leanprover-community/mathlib commit e8e130de9dba4ed6897183c3193c752ffadbcc77
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -19,6 +19,9 @@ import Mathbin.Tactic.Wlog
 /-!
 # Functions of bounded variation
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We study functions of bounded variation. In particular, we show that a bounded variation function
 is a difference of monotone functions, and differentiable almost everywhere. This implies that
 Lipschitz functions from the real line into finite-dimensional vector space are also differentiable
Diff
@@ -61,59 +61,74 @@ variable {α β : Type _} [LinearOrder α] [LinearOrder β] {E F : Type _} [Pseu
   [PseudoEMetricSpace F] {V : Type _} [NormedAddCommGroup V] [NormedSpace ℝ V]
   [FiniteDimensional ℝ V]
 
+#print eVariationOn /-
 /-- The (extended real valued) variation of a function `f` on a set `s` inside a linear order is
 the supremum of the sum of `edist (f (u (i+1))) (f (u i))` over all finite increasing
 sequences `u` in `s`. -/
-noncomputable def evariationOn (f : α → E) (s : Set α) : ℝ≥0∞ :=
+noncomputable def eVariationOn (f : α → E) (s : Set α) : ℝ≥0∞ :=
   ⨆ p : ℕ × { u : ℕ → α // Monotone u ∧ ∀ i, u i ∈ s },
     ∑ i in Finset.range p.1, edist (f ((p.2 : ℕ → α) (i + 1))) (f ((p.2 : ℕ → α) i))
-#align evariation_on evariationOn
+#align evariation_on eVariationOn
+-/
 
+#print BoundedVariationOn /-
 /-- A function has bounded variation on a set `s` if its total variation there is finite. -/
-def HasBoundedVariationOn (f : α → E) (s : Set α) :=
-  evariationOn f s ≠ ∞
-#align has_bounded_variation_on HasBoundedVariationOn
+def BoundedVariationOn (f : α → E) (s : Set α) :=
+  eVariationOn f s ≠ ∞
+#align has_bounded_variation_on BoundedVariationOn
+-/
 
+#print LocallyBoundedVariationOn /-
 /-- A function has locally bounded variation on a set `s` if, given any interval `[a, b]` with
 endpoints in `s`, then the function has finite variation on `s ∩ [a, b]`. -/
-def HasLocallyBoundedVariationOn (f : α → E) (s : Set α) :=
-  ∀ a b, a ∈ s → b ∈ s → HasBoundedVariationOn f (s ∩ Icc a b)
-#align has_locally_bounded_variation_on HasLocallyBoundedVariationOn
+def LocallyBoundedVariationOn (f : α → E) (s : Set α) :=
+  ∀ a b, a ∈ s → b ∈ s → BoundedVariationOn f (s ∩ Icc a b)
+#align has_locally_bounded_variation_on LocallyBoundedVariationOn
+-/
 
 /-! ## Basic computations of variation -/
 
 
-namespace evariationOn
+namespace eVariationOn
 
+#print eVariationOn.nonempty_monotone_mem /-
 theorem nonempty_monotone_mem {s : Set α} (hs : s.Nonempty) :
     Nonempty { u // Monotone u ∧ ∀ i : ℕ, u i ∈ s } :=
   by
   obtain ⟨x, hx⟩ := hs
   exact ⟨⟨fun i => x, fun i j hij => le_rfl, fun i => hx⟩⟩
-#align evariation_on.nonempty_monotone_mem evariationOn.nonempty_monotone_mem
+#align evariation_on.nonempty_monotone_mem eVariationOn.nonempty_monotone_mem
+-/
 
+#print eVariationOn.eq_of_edist_zero_on /-
 theorem eq_of_edist_zero_on {f f' : α → E} {s : Set α} (h : ∀ ⦃x⦄, x ∈ s → edist (f x) (f' x) = 0) :
-    evariationOn f s = evariationOn f' s :=
+    eVariationOn f s = eVariationOn f' s :=
   by
-  dsimp only [evariationOn]
+  dsimp only [eVariationOn]
   congr 1 with p : 1
   congr 1 with i : 1
   rw [edist_congr_right (h <| p.snd.prop.2 (i + 1)), edist_congr_left (h <| p.snd.prop.2 i)]
-#align evariation_on.eq_of_edist_zero_on evariationOn.eq_of_edist_zero_on
+#align evariation_on.eq_of_edist_zero_on eVariationOn.eq_of_edist_zero_on
+-/
 
+#print eVariationOn.eq_of_eqOn /-
 theorem eq_of_eqOn {f f' : α → E} {s : Set α} (h : EqOn f f' s) :
-    evariationOn f s = evariationOn f' s :=
+    eVariationOn f s = eVariationOn f' s :=
   eq_of_edist_zero_on fun x xs => by rw [h xs, edist_self]
-#align evariation_on.eq_of_eq_on evariationOn.eq_of_eqOn
+#align evariation_on.eq_of_eq_on eVariationOn.eq_of_eqOn
+-/
 
+#print eVariationOn.sum_le /-
 theorem sum_le (f : α → E) {s : Set α} (n : ℕ) {u : ℕ → α} (hu : Monotone u) (us : ∀ i, u i ∈ s) :
-    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤ evariationOn f s :=
+    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤ eVariationOn f s :=
   le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl
-#align evariation_on.sum_le evariationOn.sum_le
+#align evariation_on.sum_le eVariationOn.sum_le
+-/
 
+#print eVariationOn.sum_le_of_monotoneOn_Iic /-
 theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ → α}
     (hu : MonotoneOn u (Iic n)) (us : ∀ i ≤ n, u i ∈ s) :
-    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤ evariationOn f s :=
+    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤ eVariationOn f s :=
   by
   let v i := if i ≤ n then u i else u n
   have vs : ∀ i, v i ∈ s := by
@@ -139,11 +154,13 @@ theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ
   have : i + 1 ≤ n := by linarith
   simp only [v]
   simp [this, hi.le]
-#align evariation_on.sum_le_of_monotone_on_Iic evariationOn.sum_le_of_monotoneOn_Iic
+#align evariation_on.sum_le_of_monotone_on_Iic eVariationOn.sum_le_of_monotoneOn_Iic
+-/
 
+#print eVariationOn.sum_le_of_monotoneOn_Icc /-
 theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : ℕ → α}
     (hu : MonotoneOn u (Icc m n)) (us : ∀ i ∈ Icc m n, u i ∈ s) :
-    ∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) ≤ evariationOn f s :=
+    ∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) ≤ eVariationOn f s :=
   by
   rcases le_or_lt n m with (hnm | hmn)
   · simp only [Finset.Ico_eq_empty_of_le hnm, Finset.sum_empty, zero_le']
@@ -169,28 +186,36 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
       by
       apply Finset.sum_congr rfl fun i hi => _
       simp only [v, add_assoc]
-    _ ≤ evariationOn f s := sum_le_of_monotone_on_Iic f hv vs
-#align evariation_on.sum_le_of_monotone_on_Icc evariationOn.sum_le_of_monotoneOn_Icc
+    _ ≤ eVariationOn f s := sum_le_of_monotone_on_Iic f hv vs
+#align evariation_on.sum_le_of_monotone_on_Icc eVariationOn.sum_le_of_monotoneOn_Icc
+-/
 
-theorem mono (f : α → E) {s t : Set α} (hst : t ⊆ s) : evariationOn f t ≤ evariationOn f s :=
+#print eVariationOn.mono /-
+theorem mono (f : α → E) {s t : Set α} (hst : t ⊆ s) : eVariationOn f t ≤ eVariationOn f s :=
   by
   apply iSup_le _
   rintro ⟨n, ⟨u, hu, ut⟩⟩
   exact sum_le f n hu fun i => hst (ut i)
-#align evariation_on.mono evariationOn.mono
+#align evariation_on.mono eVariationOn.mono
+-/
 
-theorem HasBoundedVariationOn.mono {f : α → E} {s : Set α} (h : HasBoundedVariationOn f s)
-    {t : Set α} (ht : t ⊆ s) : HasBoundedVariationOn f t :=
-  (lt_of_le_of_lt (evariationOn.mono f ht) (lt_top_iff_ne_top.2 h)).Ne
-#align has_bounded_variation_on.mono HasBoundedVariationOn.mono
+#print BoundedVariationOn.mono /-
+theorem BoundedVariationOn.mono {f : α → E} {s : Set α} (h : BoundedVariationOn f s) {t : Set α}
+    (ht : t ⊆ s) : BoundedVariationOn f t :=
+  (lt_of_le_of_lt (eVariationOn.mono f ht) (lt_top_iff_ne_top.2 h)).Ne
+#align has_bounded_variation_on.mono BoundedVariationOn.mono
+-/
 
-theorem HasBoundedVariationOn.hasLocallyBoundedVariationOn {f : α → E} {s : Set α}
-    (h : HasBoundedVariationOn f s) : HasLocallyBoundedVariationOn f s := fun x y hx hy =>
+#print BoundedVariationOn.locallyBoundedVariationOn /-
+theorem BoundedVariationOn.locallyBoundedVariationOn {f : α → E} {s : Set α}
+    (h : BoundedVariationOn f s) : LocallyBoundedVariationOn f s := fun x y hx hy =>
   h.mono (inter_subset_left _ _)
-#align has_bounded_variation_on.has_locally_bounded_variation_on HasBoundedVariationOn.hasLocallyBoundedVariationOn
+#align has_bounded_variation_on.has_locally_bounded_variation_on BoundedVariationOn.locallyBoundedVariationOn
+-/
 
+#print eVariationOn.edist_le /-
 theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y ∈ s) :
-    edist (f x) (f y) ≤ evariationOn f s :=
+    edist (f x) (f y) ≤ eVariationOn f s :=
   by
   wlog hxy : x ≤ y
   · rw [edist_comm]
@@ -208,39 +233,47 @@ theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y 
     exacts [hx, hy]
   convert sum_le f 1 hu us
   simp [u, edist_comm]
-#align evariation_on.edist_le evariationOn.edist_le
+#align evariation_on.edist_le eVariationOn.edist_le
+-/
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (x y «expr ∈ » s) -/
+#print eVariationOn.eq_zero_iff /-
 theorem eq_zero_iff (f : α → E) {s : Set α} :
-    evariationOn f s = 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 :=
+    eVariationOn f s = 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 :=
   by
   constructor
   · rintro h x xs y ys
     rw [← le_zero_iff, ← h]
     exact edist_le f xs ys
   · rintro h
-    dsimp only [evariationOn]
+    dsimp only [eVariationOn]
     rw [ENNReal.iSup_eq_zero]
     rintro ⟨n, u, um, us⟩
     exact Finset.sum_eq_zero fun i hi => h _ (us i.succ) _ (us i)
-#align evariation_on.eq_zero_iff evariationOn.eq_zero_iff
+#align evariation_on.eq_zero_iff eVariationOn.eq_zero_iff
+-/
 
-theorem constant_on {f : α → E} {s : Set α} (hf : (f '' s).Subsingleton) : evariationOn f s = 0 :=
+#print eVariationOn.constant_on /-
+theorem constant_on {f : α → E} {s : Set α} (hf : (f '' s).Subsingleton) : eVariationOn f s = 0 :=
   by
   rw [eq_zero_iff]
   rintro x xs y ys
   rw [hf ⟨x, xs, rfl⟩ ⟨y, ys, rfl⟩, edist_self]
-#align evariation_on.constant_on evariationOn.constant_on
+#align evariation_on.constant_on eVariationOn.constant_on
+-/
 
+#print eVariationOn.subsingleton /-
 @[simp]
 protected theorem subsingleton (f : α → E) {s : Set α} (hs : s.Subsingleton) :
-    evariationOn f s = 0 :=
+    eVariationOn f s = 0 :=
   constant_on (hs.image f)
-#align evariation_on.subsingleton evariationOn.subsingleton
+#align evariation_on.subsingleton eVariationOn.subsingleton
+-/
 
-theorem lower_continuous_aux {ι : Type _} {F : ι → α → E} {p : Filter ι} {f : α → E} {s : Set α}
-    (Ffs : ∀ x ∈ s, Tendsto (fun i => F i x) p (𝓝 (f x))) {v : ℝ≥0∞} (hv : v < evariationOn f s) :
-    ∀ᶠ n : ι in p, v < evariationOn (F n) s :=
+#print eVariationOn.lowerSemicontinuous_aux /-
+theorem lowerSemicontinuous_aux {ι : Type _} {F : ι → α → E} {p : Filter ι} {f : α → E} {s : Set α}
+    (Ffs : ∀ x ∈ s, Tendsto (fun i => F i x) p (𝓝 (f x))) {v : ℝ≥0∞} (hv : v < eVariationOn f s) :
+    ∀ᶠ n : ι in p, v < eVariationOn (F n) s :=
   by
   obtain ⟨⟨n, ⟨u, um, us⟩⟩, hlt⟩ :
     ∃ p : ℕ × { u : ℕ → α // Monotone u ∧ ∀ i, u i ∈ s },
@@ -254,26 +287,30 @@ theorem lower_continuous_aux {ι : Type _} {F : ι → α → E} {p : Filter ι}
     exact fun i hi => tendsto.edist (Ffs (u i.succ) (us i.succ)) (Ffs (u i) (us i))
   exact
     (eventually_gt_of_tendsto_gt hlt this).mono fun i h => lt_of_lt_of_le h (sum_le (F i) n um us)
-#align evariation_on.lower_continuous_aux evariationOn.lower_continuous_aux
+#align evariation_on.lower_continuous_aux eVariationOn.lowerSemicontinuous_aux
+-/
 
+#print eVariationOn.lowerSemicontinuous /-
 /-- The map `λ f, evariation_on f s` is lower semicontinuous for pointwise convergence *on `s`*.
 Pointwise convergence on `s` is encoded here as uniform convergence on the family consisting of the
 singletons of elements of `s`.
 -/
 @[protected]
 theorem lowerSemicontinuous (s : Set α) :
-    LowerSemicontinuous fun f : α →ᵤ[s.image singleton] E => evariationOn f s :=
+    LowerSemicontinuous fun f : α →ᵤ[s.image singleton] E => eVariationOn f s :=
   by
   intro f
   apply @lower_continuous_aux _ _ _ _ (UniformOnFun α E (s.image singleton)) id (𝓝 f) f s _
   simpa only [UniformOnFun.tendsto_iff_tendstoUniformlyOn, mem_image, forall_exists_index, and_imp,
     forall_apply_eq_imp_iff₂, tendstoUniformlyOn_singleton_iff_tendsto] using @tendsto_id _ (𝓝 f)
-#align evariation_on.lower_semicontinuous evariationOn.lowerSemicontinuous
+#align evariation_on.lower_semicontinuous eVariationOn.lowerSemicontinuous
+-/
 
+#print eVariationOn.lowerSemicontinuous_uniformOn /-
 /-- The map `λ f, evariation_on f s` is lower semicontinuous for uniform convergence on `s`.
 -/
-theorem lowerSemicontinuous_uniform_on (s : Set α) :
-    LowerSemicontinuous fun f : α →ᵤ[{s}] E => evariationOn f s :=
+theorem lowerSemicontinuous_uniformOn (s : Set α) :
+    LowerSemicontinuous fun f : α →ᵤ[{s}] E => eVariationOn f s :=
   by
   intro f
   apply @lower_continuous_aux _ _ _ _ (UniformOnFun α E {s}) id (𝓝 f) f s _
@@ -281,24 +318,30 @@ theorem lowerSemicontinuous_uniform_on (s : Set α) :
   rw [UniformOnFun.tendsto_iff_tendstoUniformlyOn] at this 
   simp_rw [← tendstoUniformlyOn_singleton_iff_tendsto]
   exact fun x xs => (this s rfl).mono (singleton_subset_iff.mpr xs)
-#align evariation_on.lower_semicontinuous_uniform_on evariationOn.lowerSemicontinuous_uniform_on
+#align evariation_on.lower_semicontinuous_uniform_on eVariationOn.lowerSemicontinuous_uniformOn
+-/
 
-theorem HasBoundedVariationOn.dist_le {E : Type _} [PseudoMetricSpace E] {f : α → E} {s : Set α}
-    (h : HasBoundedVariationOn f s) {x y : α} (hx : x ∈ s) (hy : y ∈ s) :
-    dist (f x) (f y) ≤ (evariationOn f s).toReal :=
+#print BoundedVariationOn.dist_le /-
+theorem BoundedVariationOn.dist_le {E : Type _} [PseudoMetricSpace E] {f : α → E} {s : Set α}
+    (h : BoundedVariationOn f s) {x y : α} (hx : x ∈ s) (hy : y ∈ s) :
+    dist (f x) (f y) ≤ (eVariationOn f s).toReal :=
   by
   rw [← ENNReal.ofReal_le_ofReal_iff ENNReal.toReal_nonneg, ENNReal.ofReal_toReal h, ← edist_dist]
   exact edist_le f hx hy
-#align has_bounded_variation_on.dist_le HasBoundedVariationOn.dist_le
+#align has_bounded_variation_on.dist_le BoundedVariationOn.dist_le
+-/
 
-theorem HasBoundedVariationOn.sub_le {f : α → ℝ} {s : Set α} (h : HasBoundedVariationOn f s)
-    {x y : α} (hx : x ∈ s) (hy : y ∈ s) : f x - f y ≤ (evariationOn f s).toReal :=
+#print BoundedVariationOn.sub_le /-
+theorem BoundedVariationOn.sub_le {f : α → ℝ} {s : Set α} (h : BoundedVariationOn f s) {x y : α}
+    (hx : x ∈ s) (hy : y ∈ s) : f x - f y ≤ (eVariationOn f s).toReal :=
   by
   apply (le_abs_self _).trans
   rw [← Real.dist_eq]
   exact h.dist_le hx hy
-#align has_bounded_variation_on.sub_le HasBoundedVariationOn.sub_le
+#align has_bounded_variation_on.sub_le BoundedVariationOn.sub_le
+-/
 
+#print eVariationOn.add_point /-
 /-- Consider a monotone function `u` parameterizing some points of a set `s`. Given `x ∈ s`, then
 one can find another monotone function `v` parameterizing the same points as `u`, with `x` added.
 In particular, the variation of a function along `u` is bounded by its variation along `v`. -/
@@ -475,12 +518,14 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         · exact Nat.succ_le_succ hN.left
         · exact zero_le _
         · exact N.pred_le.trans N.le_succ
-#align evariation_on.add_point evariationOn.add_point
+#align evariation_on.add_point eVariationOn.add_point
+-/
 
+#print eVariationOn.add_le_union /-
 /-- The variation of a function on the union of two sets `s` and `t`, with `s` to the left of `t`,
 bounds the sum of the variations along `s` and `t`. -/
 theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t, x ≤ y) :
-    evariationOn f s + evariationOn f t ≤ evariationOn f (s ∪ t) :=
+    eVariationOn f s + eVariationOn f t ≤ eVariationOn f (s ∪ t) :=
   by
   by_cases hs : s = ∅
   · simp [hs]
@@ -552,15 +597,17 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
       · apply Finset.disjoint_left.2 fun i hi h'i => _
         simp only [Finset.mem_Ico, Finset.mem_range] at hi h'i 
         exact hi.not_lt (Nat.lt_of_succ_le h'i.left)
-    _ ≤ evariationOn f (s ∪ t) := sum_le f _ hw wst
-#align evariation_on.add_le_union evariationOn.add_le_union
+    _ ≤ eVariationOn f (s ∪ t) := sum_le f _ hw wst
+#align evariation_on.add_le_union eVariationOn.add_le_union
+-/
 
+#print eVariationOn.union /-
 /-- If a set `s` is to the left of a set `t`, and both contain the boundary point `x`, then
 the variation of `f` along `s ∪ t` is the sum of the variations. -/
 theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht : IsLeast t x) :
-    evariationOn f (s ∪ t) = evariationOn f s + evariationOn f t := by
+    eVariationOn f (s ∪ t) = eVariationOn f s + eVariationOn f t := by
   classical
-  apply le_antisymm _ (evariationOn.add_le_union f fun a ha b hb => le_trans (hs.2 ha) (ht.2 hb))
+  apply le_antisymm _ (eVariationOn.add_le_union f fun a ha b hb => le_trans (hs.2 ha) (ht.2 hb))
   apply iSup_le _
   rintro ⟨n, ⟨u, hu, ust⟩⟩
   obtain ⟨v, m, hv, vst, xv, huv⟩ :
@@ -570,7 +617,7 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
           x ∈ v '' Iio m ∧
             ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤
               ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j))
-  exact evariationOn.add_point f (mem_union_left t hs.1) u hu ust n
+  exact eVariationOn.add_point f (mem_union_left t hs.1) u hu ust n
   obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x
   exact xv
   calc
@@ -581,7 +628,7 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
         ∑ j in Finset.Ico 0 N, edist (f (v (j + 1))) (f (v j)) +
           ∑ j in Finset.Ico N m, edist (f (v (j + 1))) (f (v j)) :=
       by rw [Finset.range_eq_Ico, Finset.sum_Ico_consecutive _ (zero_le _) hN.le]
-    _ ≤ evariationOn f s + evariationOn f t :=
+    _ ≤ eVariationOn f s + eVariationOn f t :=
       by
       refine' add_le_add _ _
       · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
@@ -600,26 +647,32 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
           · rw [← Nx]; exact hv hi.1
         rw [this]
         exact ht.1
-#align evariation_on.union evariationOn.union
+#align evariation_on.union eVariationOn.union
+-/
 
+#print eVariationOn.Icc_add_Icc /-
 theorem Icc_add_Icc (f : α → E) {s : Set α} {a b c : α} (hab : a ≤ b) (hbc : b ≤ c) (hb : b ∈ s) :
-    evariationOn f (s ∩ Icc a b) + evariationOn f (s ∩ Icc b c) = evariationOn f (s ∩ Icc a c) :=
+    eVariationOn f (s ∩ Icc a b) + eVariationOn f (s ∩ Icc b c) = eVariationOn f (s ∩ Icc a c) :=
   by
   have A : IsGreatest (s ∩ Icc a b) b :=
     ⟨⟨hb, hab, le_rfl⟩, (inter_subset_right _ _).trans Icc_subset_Iic_self⟩
   have B : IsLeast (s ∩ Icc b c) b :=
     ⟨⟨hb, le_rfl, hbc⟩, (inter_subset_right _ _).trans Icc_subset_Ici_self⟩
-  rw [← evariationOn.union f A B, ← inter_union_distrib_left, Icc_union_Icc_eq_Icc hab hbc]
-#align evariation_on.Icc_add_Icc evariationOn.Icc_add_Icc
+  rw [← eVariationOn.union f A B, ← inter_union_distrib_left, Icc_union_Icc_eq_Icc hab hbc]
+#align evariation_on.Icc_add_Icc eVariationOn.Icc_add_Icc
+-/
 
+#print eVariationOn.comp_le_of_monotoneOn /-
 theorem comp_le_of_monotoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t)
-    (φst : MapsTo φ t s) : evariationOn (f ∘ φ) t ≤ evariationOn f s :=
+    (φst : MapsTo φ t s) : eVariationOn (f ∘ φ) t ≤ eVariationOn f s :=
   iSup_le fun ⟨n, u, hu, ut⟩ =>
     le_iSup_of_le ⟨n, φ ∘ u, fun x y xy => hφ (ut x) (ut y) (hu xy), fun i => φst (ut i)⟩ le_rfl
-#align evariation_on.comp_le_of_monotone_on evariationOn.comp_le_of_monotoneOn
+#align evariation_on.comp_le_of_monotone_on eVariationOn.comp_le_of_monotoneOn
+-/
 
+#print eVariationOn.comp_le_of_antitoneOn /-
 theorem comp_le_of_antitoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β → α) (hφ : AntitoneOn φ t)
-    (φst : MapsTo φ t s) : evariationOn (f ∘ φ) t ≤ evariationOn f s :=
+    (φst : MapsTo φ t s) : eVariationOn (f ∘ φ) t ≤ eVariationOn f s :=
   by
   refine' iSup_le _
   rintro ⟨n, u, hu, ut⟩
@@ -633,25 +686,29 @@ theorem comp_le_of_antitoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β
   dsimp only [Subtype.coe_mk]
   rw [edist_comm, Nat.sub_sub, add_comm, Nat.sub_succ, Nat.add_one, Nat.succ_pred_eq_of_pos]
   simpa only [tsub_pos_iff_lt, Finset.mem_range] using hx
-#align evariation_on.comp_le_of_antitone_on evariationOn.comp_le_of_antitoneOn
+#align evariation_on.comp_le_of_antitone_on eVariationOn.comp_le_of_antitoneOn
+-/
 
+#print eVariationOn.comp_eq_of_monotoneOn /-
 theorem comp_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t) :
-    evariationOn (f ∘ φ) t = evariationOn f (φ '' t) :=
+    eVariationOn (f ∘ φ) t = eVariationOn f (φ '' t) :=
   by
   apply le_antisymm (comp_le_of_monotone_on f φ hφ (maps_to_image φ t))
   cases isEmpty_or_nonempty β
   · convert zero_le _
     exact
-      evariationOn.subsingleton f ((subsingleton_of_subsingleton.image _).anti (surj_on_image φ t))
+      eVariationOn.subsingleton f ((subsingleton_of_subsingleton.image _).anti (surj_on_image φ t))
   let ψ := φ.inv_fun_on t
   have ψφs : eq_on (φ ∘ ψ) id (φ '' t) := (surj_on_image φ t).rightInvOn_invFunOn
   have ψts : maps_to ψ (φ '' t) t := (surj_on_image φ t).mapsTo_invFunOn
   have hψ : MonotoneOn ψ (φ '' t) := Function.monotoneOn_of_rightInvOn_of_mapsTo hφ ψφs ψts
-  change evariationOn (f ∘ id) (φ '' t) ≤ evariationOn (f ∘ φ) t
+  change eVariationOn (f ∘ id) (φ '' t) ≤ eVariationOn (f ∘ φ) t
   rw [← eq_of_eq_on (ψφs.comp_left : eq_on (f ∘ φ ∘ ψ) (f ∘ id) (φ '' t))]
   exact comp_le_of_monotone_on _ ψ hψ ψts
-#align evariation_on.comp_eq_of_monotone_on evariationOn.comp_eq_of_monotoneOn
+#align evariation_on.comp_eq_of_monotone_on eVariationOn.comp_eq_of_monotoneOn
+-/
 
+#print Set.subsingleton_Icc_of_ge /-
 -- porting note: move to file `data.set.intervals.basic` once the port is over,
 -- and use it in theorem `polynomial_functions_closure_eq_top`
 -- in the file `topology/continuous_function/weierstrass.lean`
@@ -662,10 +719,12 @@ theorem Set.subsingleton_Icc_of_ge {α : Type _} [PartialOrder α] {a b : α} (h
   cases le_antisymm (db.trans h) ad
   rfl
 #align set.subsingleton_Icc_of_ge Set.subsingleton_Icc_of_ge
+-/
 
+#print eVariationOn.comp_inter_Icc_eq_of_monotoneOn /-
 theorem comp_inter_Icc_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t)
     {x y : β} (hx : x ∈ t) (hy : y ∈ t) :
-    evariationOn (f ∘ φ) (t ∩ Icc x y) = evariationOn f (φ '' t ∩ Icc (φ x) (φ y)) :=
+    eVariationOn (f ∘ φ) (t ∩ Icc x y) = eVariationOn f (φ '' t ∩ Icc (φ x) (φ y)) :=
   by
   rcases le_total x y with (h | h)
   · convert comp_eq_of_monotone_on f φ (hφ.mono (Set.inter_subset_left t (Icc x y)))
@@ -680,44 +739,50 @@ theorem comp_inter_Icc_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β →
         exact ⟨x, ⟨hx, ⟨le_rfl, h⟩⟩, rfl⟩
     · rintro _ ⟨u, ⟨⟨hu, xu, uy⟩, rfl⟩⟩
       refine' ⟨⟨u, hu, rfl⟩, ⟨hφ hx hu xu, hφ hu hy uy⟩⟩
-  · rw [evariationOn.subsingleton, evariationOn.subsingleton]
+  · rw [eVariationOn.subsingleton, eVariationOn.subsingleton]
     exacts [(Set.subsingleton_Icc_of_ge (hφ hy hx h)).anti (Set.inter_subset_right _ _),
       (Set.subsingleton_Icc_of_ge h).anti (Set.inter_subset_right _ _)]
-#align evariation_on.comp_inter_Icc_eq_of_monotone_on evariationOn.comp_inter_Icc_eq_of_monotoneOn
+#align evariation_on.comp_inter_Icc_eq_of_monotone_on eVariationOn.comp_inter_Icc_eq_of_monotoneOn
+-/
 
+#print eVariationOn.comp_eq_of_antitoneOn /-
 theorem comp_eq_of_antitoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ : AntitoneOn φ t) :
-    evariationOn (f ∘ φ) t = evariationOn f (φ '' t) :=
+    eVariationOn (f ∘ φ) t = eVariationOn f (φ '' t) :=
   by
   apply le_antisymm (comp_le_of_antitone_on f φ hφ (maps_to_image φ t))
   cases isEmpty_or_nonempty β
   · convert zero_le _
     exact
-      evariationOn.subsingleton f ((subsingleton_of_subsingleton.image _).anti (surj_on_image φ t))
+      eVariationOn.subsingleton f ((subsingleton_of_subsingleton.image _).anti (surj_on_image φ t))
   let ψ := φ.inv_fun_on t
   have ψφs : eq_on (φ ∘ ψ) id (φ '' t) := (surj_on_image φ t).rightInvOn_invFunOn
   have ψts := (surj_on_image φ t).mapsTo_invFunOn
   have hψ : AntitoneOn ψ (φ '' t) := Function.antitoneOn_of_rightInvOn_of_mapsTo hφ ψφs ψts
-  change evariationOn (f ∘ id) (φ '' t) ≤ evariationOn (f ∘ φ) t
+  change eVariationOn (f ∘ id) (φ '' t) ≤ eVariationOn (f ∘ φ) t
   rw [← eq_of_eq_on (ψφs.comp_left : eq_on (f ∘ φ ∘ ψ) (f ∘ id) (φ '' t))]
   exact comp_le_of_antitone_on _ ψ hψ ψts
-#align evariation_on.comp_eq_of_antitone_on evariationOn.comp_eq_of_antitoneOn
+#align evariation_on.comp_eq_of_antitone_on eVariationOn.comp_eq_of_antitoneOn
+-/
 
 open OrderDual
 
+#print eVariationOn.comp_ofDual /-
 theorem comp_ofDual (f : α → E) (s : Set α) :
-    evariationOn (f ∘ ofDual) (ofDual ⁻¹' s) = evariationOn f s :=
+    eVariationOn (f ∘ ofDual) (ofDual ⁻¹' s) = eVariationOn f s :=
   by
   convert comp_eq_of_antitone_on f of_dual fun _ _ _ _ => id
   simp only [Equiv.image_preimage]
-#align evariation_on.comp_of_dual evariationOn.comp_ofDual
+#align evariation_on.comp_of_dual eVariationOn.comp_ofDual
+-/
 
-end evariationOn
+end eVariationOn
 
 /-! ## Monotone functions and bounded variation -/
 
 
-theorem MonotoneOn.evariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) {a b : α}
-    (as : a ∈ s) (bs : b ∈ s) : evariationOn f (s ∩ Icc a b) ≤ ENNReal.ofReal (f b - f a) :=
+#print MonotoneOn.eVariationOn_le /-
+theorem MonotoneOn.eVariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) {a b : α}
+    (as : a ∈ s) (bs : b ∈ s) : eVariationOn f (s ∩ Icc a b) ≤ ENNReal.ofReal (f b - f a) :=
   by
   apply iSup_le _
   rintro ⟨n, ⟨u, hu, us⟩⟩
@@ -739,37 +804,47 @@ theorem MonotoneOn.evariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneO
       by
       apply ENNReal.ofReal_le_ofReal
       exact sub_le_sub (hf (us n).1 bs (us n).2.2) (hf as (us 0).1 (us 0).2.1)
-#align monotone_on.evariation_on_le MonotoneOn.evariationOn_le
+#align monotone_on.evariation_on_le MonotoneOn.eVariationOn_le
+-/
 
-theorem MonotoneOn.hasLocallyBoundedVariationOn {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) :
-    HasLocallyBoundedVariationOn f s := fun a b as bs =>
-  ((hf.evariationOn_le as bs).trans_lt ENNReal.ofReal_lt_top).Ne
-#align monotone_on.has_locally_bounded_variation_on MonotoneOn.hasLocallyBoundedVariationOn
+#print MonotoneOn.locallyBoundedVariationOn /-
+theorem MonotoneOn.locallyBoundedVariationOn {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) :
+    LocallyBoundedVariationOn f s := fun a b as bs =>
+  ((hf.eVariationOn_le as bs).trans_lt ENNReal.ofReal_lt_top).Ne
+#align monotone_on.has_locally_bounded_variation_on MonotoneOn.locallyBoundedVariationOn
+-/
 
+#print variationOnFromTo /-
 /-- The **signed** variation of `f` on the interval `Icc a b` intersected with the set `s`,
 squashed to a real (therefore only really meaningful if the variation is finite)
 -/
 noncomputable def variationOnFromTo (f : α → E) (s : Set α) (a b : α) : ℝ :=
-  if a ≤ b then (evariationOn f (s ∩ Icc a b)).toReal else -(evariationOn f (s ∩ Icc b a)).toReal
+  if a ≤ b then (eVariationOn f (s ∩ Icc a b)).toReal else -(eVariationOn f (s ∩ Icc b a)).toReal
 #align variation_on_from_to variationOnFromTo
+-/
 
 namespace variationOnFromTo
 
 variable (f : α → E) (s : Set α)
 
+#print variationOnFromTo.self /-
 @[protected]
 theorem self (a : α) : variationOnFromTo f s a a = 0 :=
   by
   dsimp only [variationOnFromTo]
-  rw [if_pos le_rfl, Icc_self, evariationOn.subsingleton, ENNReal.zero_toReal]
+  rw [if_pos le_rfl, Icc_self, eVariationOn.subsingleton, ENNReal.zero_toReal]
   exact fun x hx y hy => hx.2.trans hy.2.symm
 #align variation_on_from_to.self variationOnFromTo.self
+-/
 
+#print variationOnFromTo.nonneg_of_le /-
 @[protected]
 theorem nonneg_of_le {a b : α} (h : a ≤ b) : 0 ≤ variationOnFromTo f s a b := by
   simp only [variationOnFromTo, if_pos h, ENNReal.toReal_nonneg]
 #align variation_on_from_to.nonneg_of_le variationOnFromTo.nonneg_of_le
+-/
 
+#print variationOnFromTo.eq_neg_swap /-
 @[protected]
 theorem eq_neg_swap (a b : α) : variationOnFromTo f s a b = -variationOnFromTo f s b a :=
   by
@@ -778,28 +853,36 @@ theorem eq_neg_swap (a b : α) : variationOnFromTo f s a b = -variationOnFromTo
   · simp only [self, neg_zero]
   · simp only [variationOnFromTo, if_pos ba.le, if_neg ba.not_le, neg_neg]
 #align variation_on_from_to.eq_neg_swap variationOnFromTo.eq_neg_swap
+-/
 
+#print variationOnFromTo.nonpos_of_ge /-
 @[protected]
 theorem nonpos_of_ge {a b : α} (h : b ≤ a) : variationOnFromTo f s a b ≤ 0 :=
   by
   rw [eq_neg_swap]
   exact neg_nonpos_of_nonneg (nonneg_of_le f s h)
 #align variation_on_from_to.nonpos_of_ge variationOnFromTo.nonpos_of_ge
+-/
 
+#print variationOnFromTo.eq_of_le /-
 @[protected]
 theorem eq_of_le {a b : α} (h : a ≤ b) :
-    variationOnFromTo f s a b = (evariationOn f (s ∩ Icc a b)).toReal :=
+    variationOnFromTo f s a b = (eVariationOn f (s ∩ Icc a b)).toReal :=
   if_pos h
 #align variation_on_from_to.eq_of_le variationOnFromTo.eq_of_le
+-/
 
+#print variationOnFromTo.eq_of_ge /-
 @[protected]
 theorem eq_of_ge {a b : α} (h : b ≤ a) :
-    variationOnFromTo f s a b = -(evariationOn f (s ∩ Icc b a)).toReal := by
+    variationOnFromTo f s a b = -(eVariationOn f (s ∩ Icc b a)).toReal := by
   rw [eq_neg_swap, neg_inj, eq_of_le f s h]
 #align variation_on_from_to.eq_of_ge variationOnFromTo.eq_of_ge
+-/
 
+#print variationOnFromTo.add /-
 @[protected]
-theorem add {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s) {a b c : α} (ha : a ∈ s)
+theorem add {f : α → E} {s : Set α} (hf : LocallyBoundedVariationOn f s) {a b c : α} (ha : a ∈ s)
     (hb : b ∈ s) (hc : c ∈ s) :
     variationOnFromTo f s a b + variationOnFromTo f s b c = variationOnFromTo f s a c :=
   by
@@ -809,52 +892,62 @@ theorem add {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s)
     simp only [eq_neg_swap f s y x, Subtype.coe_mk, add_right_neg, forall_true_left]
   · rintro x y z xy yz xs ys zs
     rw [eq_of_le f s xy, eq_of_le f s yz, eq_of_le f s (xy.trans yz), ←
-      ENNReal.toReal_add (hf x y xs ys) (hf y z ys zs), evariationOn.Icc_add_Icc f xy yz ys]
+      ENNReal.toReal_add (hf x y xs ys) (hf y z ys zs), eVariationOn.Icc_add_Icc f xy yz ys]
 #align variation_on_from_to.add variationOnFromTo.add
+-/
 
+#print variationOnFromTo.edist_zero_of_eq_zero /-
 @[protected]
-theorem edist_zero_of_eq_zero {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s)
-    {a b : α} (ha : a ∈ s) (hb : b ∈ s) (h : variationOnFromTo f s a b = 0) :
-    edist (f a) (f b) = 0 := by
+theorem edist_zero_of_eq_zero {f : α → E} {s : Set α} (hf : LocallyBoundedVariationOn f s) {a b : α}
+    (ha : a ∈ s) (hb : b ∈ s) (h : variationOnFromTo f s a b = 0) : edist (f a) (f b) = 0 :=
+  by
   wlog h' : a ≤ b
   · rw [edist_comm]
     apply this hf hb ha _ (le_of_not_le h')
     rw [eq_neg_swap, h, neg_zero]
   · apply le_antisymm _ (zero_le _)
     rw [← ENNReal.ofReal_zero, ← h, eq_of_le f s h', ENNReal.ofReal_toReal (hf a b ha hb)]
-    apply evariationOn.edist_le
+    apply eVariationOn.edist_le
     exacts [⟨ha, ⟨le_rfl, h'⟩⟩, ⟨hb, ⟨h', le_rfl⟩⟩]
 #align variation_on_from_to.edist_zero_of_eq_zero variationOnFromTo.edist_zero_of_eq_zero
+-/
 
+#print variationOnFromTo.eq_left_iff /-
 @[protected]
-theorem eq_left_iff {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s) {a b c : α}
+theorem eq_left_iff {f : α → E} {s : Set α} (hf : LocallyBoundedVariationOn f s) {a b c : α}
     (ha : a ∈ s) (hb : b ∈ s) (hc : c ∈ s) :
     variationOnFromTo f s a b = variationOnFromTo f s a c ↔ variationOnFromTo f s b c = 0 := by
   simp only [← add hf ha hb hc, self_eq_add_right]
 #align variation_on_from_to.eq_left_iff variationOnFromTo.eq_left_iff
+-/
 
+#print variationOnFromTo.eq_zero_iff_of_le /-
 @[protected]
-theorem eq_zero_iff_of_le {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s) {a b : α}
+theorem eq_zero_iff_of_le {f : α → E} {s : Set α} (hf : LocallyBoundedVariationOn f s) {a b : α}
     (ha : a ∈ s) (hb : b ∈ s) (ab : a ≤ b) :
     variationOnFromTo f s a b = 0 ↔
       ∀ ⦃x⦄ (hx : x ∈ s ∩ Icc a b) ⦃y⦄ (hy : y ∈ s ∩ Icc a b), edist (f x) (f y) = 0 :=
   by
   rw [eq_of_le _ _ ab, ENNReal.toReal_eq_zero_iff, or_iff_left (hf a b ha hb),
-    evariationOn.eq_zero_iff]
+    eVariationOn.eq_zero_iff]
 #align variation_on_from_to.eq_zero_iff_of_le variationOnFromTo.eq_zero_iff_of_le
+-/
 
+#print variationOnFromTo.eq_zero_iff_of_ge /-
 @[protected]
-theorem eq_zero_iff_of_ge {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s) {a b : α}
+theorem eq_zero_iff_of_ge {f : α → E} {s : Set α} (hf : LocallyBoundedVariationOn f s) {a b : α}
     (ha : a ∈ s) (hb : b ∈ s) (ba : b ≤ a) :
     variationOnFromTo f s a b = 0 ↔
       ∀ ⦃x⦄ (hx : x ∈ s ∩ Icc b a) ⦃y⦄ (hy : y ∈ s ∩ Icc b a), edist (f x) (f y) = 0 :=
   by
   rw [eq_of_ge _ _ ba, neg_eq_zero, ENNReal.toReal_eq_zero_iff, or_iff_left (hf b a hb ha),
-    evariationOn.eq_zero_iff]
+    eVariationOn.eq_zero_iff]
 #align variation_on_from_to.eq_zero_iff_of_ge variationOnFromTo.eq_zero_iff_of_ge
+-/
 
+#print variationOnFromTo.eq_zero_iff /-
 @[protected]
-theorem eq_zero_iff {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s) {a b : α}
+theorem eq_zero_iff {f : α → E} {s : Set α} (hf : LocallyBoundedVariationOn f s) {a b : α}
     (ha : a ∈ s) (hb : b ∈ s) :
     variationOnFromTo f s a b = 0 ↔
       ∀ ⦃x⦄ (hx : x ∈ s ∩ uIcc a b) ⦃y⦄ (hy : y ∈ s ∩ uIcc a b), edist (f x) (f y) = 0 :=
@@ -865,20 +958,24 @@ theorem eq_zero_iff {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariation
   · rw [uIcc_of_ge ba]
     exact eq_zero_iff_of_ge hf ha hb ba
 #align variation_on_from_to.eq_zero_iff variationOnFromTo.eq_zero_iff
+-/
 
 variable {f} {s}
 
+#print variationOnFromTo.monotoneOn /-
 @[protected]
-theorem monotoneOn (hf : HasLocallyBoundedVariationOn f s) {a : α} (as : a ∈ s) :
+theorem monotoneOn (hf : LocallyBoundedVariationOn f s) {a : α} (as : a ∈ s) :
     MonotoneOn (variationOnFromTo f s a) s :=
   by
   rintro b bs c cs bc
   rw [← add hf as bs cs]
   exact le_add_of_nonneg_right (nonneg_of_le f s bc)
 #align variation_on_from_to.monotone_on variationOnFromTo.monotoneOn
+-/
 
+#print variationOnFromTo.antitoneOn /-
 @[protected]
-theorem antitoneOn (hf : HasLocallyBoundedVariationOn f s) {b : α} (bs : b ∈ s) :
+theorem antitoneOn (hf : LocallyBoundedVariationOn f s) {b : α} (bs : b ∈ s) :
     AntitoneOn (fun a => variationOnFromTo f s a b) s :=
   by
   rintro a as c cs ac
@@ -886,9 +983,11 @@ theorem antitoneOn (hf : HasLocallyBoundedVariationOn f s) {b : α} (bs : b ∈
   rw [← add hf as cs bs]
   exact le_add_of_nonneg_left (nonneg_of_le f s ac)
 #align variation_on_from_to.antitone_on variationOnFromTo.antitoneOn
+-/
 
+#print variationOnFromTo.sub_self_monotoneOn /-
 @[protected]
-theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : HasLocallyBoundedVariationOn f s) {a : α}
+theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : LocallyBoundedVariationOn f s) {a : α}
     (as : a ∈ s) : MonotoneOn (variationOnFromTo f s a - f) s :=
   by
   rintro b bs c cs bc
@@ -900,12 +999,14 @@ theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : HasLocallyBounde
       by
       rw [eq_of_le f s bc, dist_edist]
       apply ENNReal.toReal_mono (hf b c bs cs)
-      apply evariationOn.edist_le f
+      apply eVariationOn.edist_le f
       exacts [⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
     _ = variationOnFromTo f s a c - variationOnFromTo f s a b := by
       rw [← add hf as bs cs, add_sub_cancel']
 #align variation_on_from_to.sub_self_monotone_on variationOnFromTo.sub_self_monotoneOn
+-/
 
+#print variationOnFromTo.comp_eq_of_monotoneOn /-
 @[protected]
 theorem comp_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t) {x y : β}
     (hx : x ∈ t) (hy : y ∈ t) :
@@ -914,18 +1015,20 @@ theorem comp_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ
   rcases le_total x y with (h | h)
   ·
     rw [eq_of_le _ _ h, eq_of_le _ _ (hφ hx hy h),
-      evariationOn.comp_inter_Icc_eq_of_monotoneOn f φ hφ hx hy]
+      eVariationOn.comp_inter_Icc_eq_of_monotoneOn f φ hφ hx hy]
   ·
     rw [eq_of_ge _ _ h, eq_of_ge _ _ (hφ hy hx h),
-      evariationOn.comp_inter_Icc_eq_of_monotoneOn f φ hφ hy hx]
+      eVariationOn.comp_inter_Icc_eq_of_monotoneOn f φ hφ hy hx]
 #align variation_on_from_to.comp_eq_of_monotone_on variationOnFromTo.comp_eq_of_monotoneOn
+-/
 
 end variationOnFromTo
 
+#print LocallyBoundedVariationOn.exists_monotoneOn_sub_monotoneOn /-
 /-- If a real valued function has bounded variation on a set, then it is a difference of monotone
 functions there. -/
-theorem HasLocallyBoundedVariationOn.exists_monotoneOn_sub_monotoneOn {f : α → ℝ} {s : Set α}
-    (h : HasLocallyBoundedVariationOn f s) :
+theorem LocallyBoundedVariationOn.exists_monotoneOn_sub_monotoneOn {f : α → ℝ} {s : Set α}
+    (h : LocallyBoundedVariationOn f s) :
     ∃ p q : α → ℝ, MonotoneOn p s ∧ MonotoneOn q s ∧ f = p - q :=
   by
   rcases eq_empty_or_nonempty s with (rfl | ⟨c, cs⟩)
@@ -936,14 +1039,16 @@ theorem HasLocallyBoundedVariationOn.exists_monotoneOn_sub_monotoneOn {f : α 
     exact
       ⟨_, _, variationOnFromTo.monotoneOn h cs, variationOnFromTo.sub_self_monotoneOn h cs,
         (sub_sub_cancel _ _).symm⟩
-#align has_locally_bounded_variation_on.exists_monotone_on_sub_monotone_on HasLocallyBoundedVariationOn.exists_monotoneOn_sub_monotoneOn
+#align has_locally_bounded_variation_on.exists_monotone_on_sub_monotone_on LocallyBoundedVariationOn.exists_monotoneOn_sub_monotoneOn
+-/
 
 /-! ## Lipschitz functions and bounded variation -/
 
 
-theorem LipschitzOnWith.comp_evariationOn_le {f : E → F} {C : ℝ≥0} {t : Set E}
+#print LipschitzOnWith.comp_eVariationOn_le /-
+theorem LipschitzOnWith.comp_eVariationOn_le {f : E → F} {C : ℝ≥0} {t : Set E}
     (h : LipschitzOnWith C f t) {g : α → E} {s : Set α} (hg : MapsTo g s t) :
-    evariationOn (f ∘ g) s ≤ C * evariationOn g s :=
+    eVariationOn (f ∘ g) s ≤ C * eVariationOn g s :=
   by
   apply iSup_le _
   rintro ⟨n, ⟨u, hu, us⟩⟩
@@ -952,53 +1057,65 @@ theorem LipschitzOnWith.comp_evariationOn_le {f : E → F} {C : ℝ≥0} {t : Se
         ∑ i in Finset.range n, C * edist (g (u (i + 1))) (g (u i)) :=
       Finset.sum_le_sum fun i hi => h (hg (us _)) (hg (us _))
     _ = C * ∑ i in Finset.range n, edist (g (u (i + 1))) (g (u i)) := by rw [Finset.mul_sum]
-    _ ≤ C * evariationOn g s := mul_le_mul_left' (evariationOn.sum_le _ _ hu us) _
-#align lipschitz_on_with.comp_evariation_on_le LipschitzOnWith.comp_evariationOn_le
+    _ ≤ C * eVariationOn g s := mul_le_mul_left' (eVariationOn.sum_le _ _ hu us) _
+#align lipschitz_on_with.comp_evariation_on_le LipschitzOnWith.comp_eVariationOn_le
+-/
 
-theorem LipschitzOnWith.comp_hasBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
+#print LipschitzOnWith.comp_boundedVariationOn /-
+theorem LipschitzOnWith.comp_boundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
     (hf : LipschitzOnWith C f t) {g : α → E} {s : Set α} (hg : MapsTo g s t)
-    (h : HasBoundedVariationOn g s) : HasBoundedVariationOn (f ∘ g) s :=
-  ne_top_of_le_ne_top (ENNReal.mul_ne_top ENNReal.coe_ne_top h) (hf.comp_evariationOn_le hg)
-#align lipschitz_on_with.comp_has_bounded_variation_on LipschitzOnWith.comp_hasBoundedVariationOn
+    (h : BoundedVariationOn g s) : BoundedVariationOn (f ∘ g) s :=
+  ne_top_of_le_ne_top (ENNReal.mul_ne_top ENNReal.coe_ne_top h) (hf.comp_eVariationOn_le hg)
+#align lipschitz_on_with.comp_has_bounded_variation_on LipschitzOnWith.comp_boundedVariationOn
+-/
 
-theorem LipschitzOnWith.comp_hasLocallyBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
+#print LipschitzOnWith.comp_locallyBoundedVariationOn /-
+theorem LipschitzOnWith.comp_locallyBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
     (hf : LipschitzOnWith C f t) {g : α → E} {s : Set α} (hg : MapsTo g s t)
-    (h : HasLocallyBoundedVariationOn g s) : HasLocallyBoundedVariationOn (f ∘ g) s :=
-  fun x y xs ys =>
-  hf.comp_hasBoundedVariationOn (hg.mono_left (inter_subset_left _ _)) (h x y xs ys)
-#align lipschitz_on_with.comp_has_locally_bounded_variation_on LipschitzOnWith.comp_hasLocallyBoundedVariationOn
-
-theorem LipschitzWith.comp_hasBoundedVariationOn {f : E → F} {C : ℝ≥0} (hf : LipschitzWith C f)
-    {g : α → E} {s : Set α} (h : HasBoundedVariationOn g s) : HasBoundedVariationOn (f ∘ g) s :=
-  (hf.LipschitzOnWith univ).comp_hasBoundedVariationOn (mapsTo_univ _ _) h
-#align lipschitz_with.comp_has_bounded_variation_on LipschitzWith.comp_hasBoundedVariationOn
-
-theorem LipschitzWith.comp_hasLocallyBoundedVariationOn {f : E → F} {C : ℝ≥0}
-    (hf : LipschitzWith C f) {g : α → E} {s : Set α} (h : HasLocallyBoundedVariationOn g s) :
-    HasLocallyBoundedVariationOn (f ∘ g) s :=
-  (hf.LipschitzOnWith univ).comp_hasLocallyBoundedVariationOn (mapsTo_univ _ _) h
-#align lipschitz_with.comp_has_locally_bounded_variation_on LipschitzWith.comp_hasLocallyBoundedVariationOn
-
-theorem LipschitzOnWith.hasLocallyBoundedVariationOn {f : ℝ → E} {C : ℝ≥0} {s : Set ℝ}
-    (hf : LipschitzOnWith C f s) : HasLocallyBoundedVariationOn f s :=
-  hf.comp_hasLocallyBoundedVariationOn (mapsTo_id _)
-    (@monotoneOn_id ℝ _ s).HasLocallyBoundedVariationOn
-#align lipschitz_on_with.has_locally_bounded_variation_on LipschitzOnWith.hasLocallyBoundedVariationOn
-
-theorem LipschitzWith.hasLocallyBoundedVariationOn {f : ℝ → E} {C : ℝ≥0} (hf : LipschitzWith C f)
-    (s : Set ℝ) : HasLocallyBoundedVariationOn f s :=
-  (hf.LipschitzOnWith s).HasLocallyBoundedVariationOn
-#align lipschitz_with.has_locally_bounded_variation_on LipschitzWith.hasLocallyBoundedVariationOn
+    (h : LocallyBoundedVariationOn g s) : LocallyBoundedVariationOn (f ∘ g) s := fun x y xs ys =>
+  hf.comp_boundedVariationOn (hg.mono_left (inter_subset_left _ _)) (h x y xs ys)
+#align lipschitz_on_with.comp_has_locally_bounded_variation_on LipschitzOnWith.comp_locallyBoundedVariationOn
+-/
+
+#print LipschitzWith.comp_boundedVariationOn /-
+theorem LipschitzWith.comp_boundedVariationOn {f : E → F} {C : ℝ≥0} (hf : LipschitzWith C f)
+    {g : α → E} {s : Set α} (h : BoundedVariationOn g s) : BoundedVariationOn (f ∘ g) s :=
+  (hf.LipschitzOnWith univ).comp_boundedVariationOn (mapsTo_univ _ _) h
+#align lipschitz_with.comp_has_bounded_variation_on LipschitzWith.comp_boundedVariationOn
+-/
+
+#print LipschitzWith.comp_locallyBoundedVariationOn /-
+theorem LipschitzWith.comp_locallyBoundedVariationOn {f : E → F} {C : ℝ≥0} (hf : LipschitzWith C f)
+    {g : α → E} {s : Set α} (h : LocallyBoundedVariationOn g s) :
+    LocallyBoundedVariationOn (f ∘ g) s :=
+  (hf.LipschitzOnWith univ).comp_locallyBoundedVariationOn (mapsTo_univ _ _) h
+#align lipschitz_with.comp_has_locally_bounded_variation_on LipschitzWith.comp_locallyBoundedVariationOn
+-/
+
+#print LipschitzOnWith.locallyBoundedVariationOn /-
+theorem LipschitzOnWith.locallyBoundedVariationOn {f : ℝ → E} {C : ℝ≥0} {s : Set ℝ}
+    (hf : LipschitzOnWith C f s) : LocallyBoundedVariationOn f s :=
+  hf.comp_locallyBoundedVariationOn (mapsTo_id _) (@monotoneOn_id ℝ _ s).LocallyBoundedVariationOn
+#align lipschitz_on_with.has_locally_bounded_variation_on LipschitzOnWith.locallyBoundedVariationOn
+-/
+
+#print LipschitzWith.locallyBoundedVariationOn /-
+theorem LipschitzWith.locallyBoundedVariationOn {f : ℝ → E} {C : ℝ≥0} (hf : LipschitzWith C f)
+    (s : Set ℝ) : LocallyBoundedVariationOn f s :=
+  (hf.LipschitzOnWith s).LocallyBoundedVariationOn
+#align lipschitz_with.has_locally_bounded_variation_on LipschitzWith.locallyBoundedVariationOn
+-/
 
 /-! ## Almost everywhere differentiability of functions with locally bounded variation -/
 
 
-namespace HasLocallyBoundedVariationOn
+namespace LocallyBoundedVariationOn
 
+#print LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_real /-
 /-- A bounded variation function into `ℝ` is differentiable almost everywhere. Superseded by
 `ae_differentiable_within_at_of_mem`. -/
 theorem ae_differentiableWithinAt_of_mem_real {f : ℝ → ℝ} {s : Set ℝ}
-    (h : HasLocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
+    (h : LocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
   by
   obtain ⟨p, q, hp, hq, fpq⟩ : ∃ p q, MonotoneOn p s ∧ MonotoneOn q s ∧ f = p - q
   exact h.exists_monotone_on_sub_monotone_on
@@ -1006,27 +1123,31 @@ theorem ae_differentiableWithinAt_of_mem_real {f : ℝ → ℝ} {s : Set ℝ}
     x hxp hxq xs
   have fpq : ∀ x, f x = p x - q x := by simp [fpq]
   refine' ((hxp xs).sub (hxq xs)).congr (fun y hy => fpq y) (fpq x)
-#align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem_real HasLocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_real
+#align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem_real LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_real
+-/
 
+#print LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_pi /-
 /-- A bounded variation function into a finite dimensional product vector space is differentiable
 almost everywhere. Superseded by `ae_differentiable_within_at_of_mem`. -/
 theorem ae_differentiableWithinAt_of_mem_pi {ι : Type _} [Fintype ι] {f : ℝ → ι → ℝ} {s : Set ℝ}
-    (h : HasLocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
+    (h : LocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
   by
   have A : ∀ i : ι, LipschitzWith 1 fun x : ι → ℝ => x i := fun i => LipschitzWith.eval i
   have : ∀ i : ι, ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (fun x : ℝ => f x i) s x :=
     by
     intro i
     apply ae_differentiable_within_at_of_mem_real
-    exact LipschitzWith.comp_hasLocallyBoundedVariationOn (A i) h
+    exact LipschitzWith.comp_locallyBoundedVariationOn (A i) h
   filter_upwards [ae_all_iff.2 this] with x hx xs
   exact differentiableWithinAt_pi.2 fun i => hx i xs
-#align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem_pi HasLocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_pi
+#align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem_pi LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_pi
+-/
 
+#print LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem /-
 /-- A real function into a finite dimensional real vector space with bounded variation on a set
 is differentiable almost everywhere in this set. -/
 theorem ae_differentiableWithinAt_of_mem {f : ℝ → V} {s : Set ℝ}
-    (h : HasLocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
+    (h : LocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
   by
   let A := (Basis.ofVectorSpace ℝ V).equivFun.toContinuousLinearEquiv
   suffices H : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (A ∘ f) s x
@@ -1037,48 +1158,59 @@ theorem ae_differentiableWithinAt_of_mem {f : ℝ → V} {s : Set ℝ}
     exact A.symm.differentiable_at.comp_differentiable_within_at x (hx xs)
   apply ae_differentiable_within_at_of_mem_pi
   exact A.lipschitz.comp_has_locally_bounded_variation_on h
-#align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem HasLocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem
+#align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem
+-/
 
+#print LocallyBoundedVariationOn.ae_differentiableWithinAt /-
 /-- A real function into a finite dimensional real vector space with bounded variation on a set
 is differentiable almost everywhere in this set. -/
-theorem ae_differentiableWithinAt {f : ℝ → V} {s : Set ℝ} (h : HasLocallyBoundedVariationOn f s)
+theorem ae_differentiableWithinAt {f : ℝ → V} {s : Set ℝ} (h : LocallyBoundedVariationOn f s)
     (hs : MeasurableSet s) : ∀ᵐ x ∂volume.restrict s, DifferentiableWithinAt ℝ f s x :=
   by
   rw [ae_restrict_iff' hs]
   exact h.ae_differentiable_within_at_of_mem
-#align has_locally_bounded_variation_on.ae_differentiable_within_at HasLocallyBoundedVariationOn.ae_differentiableWithinAt
+#align has_locally_bounded_variation_on.ae_differentiable_within_at LocallyBoundedVariationOn.ae_differentiableWithinAt
+-/
 
+#print LocallyBoundedVariationOn.ae_differentiableAt /-
 /-- A real function into a finite dimensional real vector space with bounded variation
 is differentiable almost everywhere. -/
-theorem ae_differentiableAt {f : ℝ → V} (h : HasLocallyBoundedVariationOn f univ) :
+theorem ae_differentiableAt {f : ℝ → V} (h : LocallyBoundedVariationOn f univ) :
     ∀ᵐ x, DifferentiableAt ℝ f x :=
   by
   filter_upwards [h.ae_differentiable_within_at_of_mem] with x hx
   rw [differentiableWithinAt_univ] at hx 
   exact hx (mem_univ _)
-#align has_locally_bounded_variation_on.ae_differentiable_at HasLocallyBoundedVariationOn.ae_differentiableAt
+#align has_locally_bounded_variation_on.ae_differentiable_at LocallyBoundedVariationOn.ae_differentiableAt
+-/
 
-end HasLocallyBoundedVariationOn
+end LocallyBoundedVariationOn
 
+#print LipschitzOnWith.ae_differentiableWithinAt_of_mem /-
 /-- A real function into a finite dimensional real vector space which is Lipschitz on a set
 is differentiable almost everywhere in this set . -/
 theorem LipschitzOnWith.ae_differentiableWithinAt_of_mem {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
     (h : LipschitzOnWith C f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
-  h.HasLocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem
+  h.LocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem
 #align lipschitz_on_with.ae_differentiable_within_at_of_mem LipschitzOnWith.ae_differentiableWithinAt_of_mem
+-/
 
+#print LipschitzOnWith.ae_differentiableWithinAt /-
 /-- A real function into a finite dimensional real vector space which is Lipschitz on a set
 is differentiable almost everywhere in this set. -/
 theorem LipschitzOnWith.ae_differentiableWithinAt {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
     (h : LipschitzOnWith C f s) (hs : MeasurableSet s) :
     ∀ᵐ x ∂volume.restrict s, DifferentiableWithinAt ℝ f s x :=
-  h.HasLocallyBoundedVariationOn.ae_differentiableWithinAt hs
+  h.LocallyBoundedVariationOn.ae_differentiableWithinAt hs
 #align lipschitz_on_with.ae_differentiable_within_at LipschitzOnWith.ae_differentiableWithinAt
+-/
 
+#print LipschitzWith.ae_differentiableAt /-
 /-- A real Lipschitz function into a finite dimensional real vector space is differentiable
 almost everywhere. -/
 theorem LipschitzWith.ae_differentiableAt {C : ℝ≥0} {f : ℝ → V} (h : LipschitzWith C f) :
     ∀ᵐ x, DifferentiableAt ℝ f x :=
-  (h.HasLocallyBoundedVariationOn univ).ae_differentiableAt
+  (h.LocallyBoundedVariationOn univ).ae_differentiableAt
 #align lipschitz_with.ae_differentiable_at LipschitzWith.ae_differentiableAt
+-/
 
Diff
@@ -107,13 +107,13 @@ theorem eq_of_eqOn {f f' : α → E} {s : Set α} (h : EqOn f f' s) :
 #align evariation_on.eq_of_eq_on evariationOn.eq_of_eqOn
 
 theorem sum_le (f : α → E) {s : Set α} (n : ℕ) {u : ℕ → α} (hu : Monotone u) (us : ∀ i, u i ∈ s) :
-    (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤ evariationOn f s :=
+    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤ evariationOn f s :=
   le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl
 #align evariation_on.sum_le evariationOn.sum_le
 
 theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ → α}
     (hu : MonotoneOn u (Iic n)) (us : ∀ i ≤ n, u i ∈ s) :
-    (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤ evariationOn f s :=
+    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤ evariationOn f s :=
   by
   let v i := if i ≤ n then u i else u n
   have vs : ∀ i, v i ∈ s := by
@@ -143,7 +143,7 @@ theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ
 
 theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : ℕ → α}
     (hu : MonotoneOn u (Icc m n)) (us : ∀ i ∈ Icc m n, u i ∈ s) :
-    (∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) ≤ evariationOn f s :=
+    ∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) ≤ evariationOn f s :=
   by
   rcases le_or_lt n m with (hnm | hmn)
   · simp only [Finset.Ico_eq_empty_of_le hnm, Finset.sum_empty, zero_le']
@@ -158,7 +158,7 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
     simp only [le_tsub_iff_left hmn.le, mem_Iic] at hi 
     exact us _ ⟨le_add_right le_rfl, hi⟩
   calc
-    (∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) =
+    ∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i)) =
         ∑ i in Finset.range (n - m), edist (f (u (m + i + 1))) (f (u (m + i))) :=
       by
       rw [Finset.range_eq_Ico]
@@ -308,7 +308,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       Monotone v ∧
         (∀ i, v i ∈ s) ∧
           x ∈ v '' Iio m ∧
-            (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤
+            ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤
               ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
   by
   rcases le_or_lt (u n) x with (h | h)
@@ -338,7 +338,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       simp only [this, ite_eq_right_iff, IsEmpty.forall_iff]
     ·
       calc
-        (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
+        ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) =
             ∑ i in Finset.range n, edist (f (v (i + 1))) (f (v i)) :=
           by
           apply Finset.sum_congr rfl fun i hi => _
@@ -383,7 +383,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
   rcases eq_or_lt_of_le (zero_le N) with (Npos | Npos)
   ·
     calc
-      (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
+      ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) =
           ∑ i in Finset.range n, edist (f (w (1 + i + 1))) (f (w (1 + i))) :=
         by
         apply Finset.sum_congr rfl fun i hi => _
@@ -402,9 +402,9 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         exact Finset.Ico_subset_Ico zero_le_one le_rfl
   ·
     calc
-      (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
-          ((∑ i in Finset.Ico 0 (N - 1), edist (f (u (i + 1))) (f (u i))) +
-              ∑ i in Finset.Ico (N - 1) N, edist (f (u (i + 1))) (f (u i))) +
+      ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) =
+          ∑ i in Finset.Ico 0 (N - 1), edist (f (u (i + 1))) (f (u i)) +
+              ∑ i in Finset.Ico (N - 1) N, edist (f (u (i + 1))) (f (u i)) +
             ∑ i in Finset.Ico N n, edist (f (u (i + 1))) (f (u i)) :=
         by
         rw [Finset.sum_Ico_consecutive, Finset.sum_Ico_consecutive, Finset.range_eq_Ico]
@@ -413,7 +413,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         · exact zero_le _
         · exact Nat.pred_le _
       _ =
-          (∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
+          ∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i)) +
               edist (f (u N)) (f (u (N - 1))) +
             ∑ i in Finset.Ico N n, edist (f (w (1 + i + 1))) (f (w (1 + i))) :=
         by
@@ -445,7 +445,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
           rw [if_neg A, if_neg B, if_neg C, if_neg D]
           congr 3 <;> · rw [add_comm, Nat.sub_one]; apply Nat.pred_succ
       _ =
-          (∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
+          ∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i)) +
               edist (f (w (N + 1))) (f (w (N - 1))) +
             ∑ i in Finset.Ico (N + 1) (n + 1), edist (f (w (i + 1))) (f (w i)) :=
         by
@@ -457,8 +457,8 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
             B, if_true]
         · exact Finset.sum_Ico_add (fun i => edist (f (w (i + 1))) (f (w i))) N n 1
       _ ≤
-          ((∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
-              ∑ i in Finset.Ico (N - 1) (N + 1), edist (f (w (i + 1))) (f (w i))) +
+          ∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i)) +
+              ∑ i in Finset.Ico (N - 1) (N + 1), edist (f (w (i + 1))) (f (w i)) +
             ∑ i in Finset.Ico (N + 1) (n + 1), edist (f (w (i + 1))) (f (w i)) :=
         by
         refine' add_le_add (add_le_add le_rfl _) le_rfl
@@ -510,9 +510,9 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
     · exfalso; exact h_1 (hij.trans h_2)
     · apply hv (tsub_le_tsub hij le_rfl)
   calc
-    ((∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) +
-          ∑ i : ℕ in Finset.range m, edist (f (v (i + 1))) (f (v i))) =
-        (∑ i in Finset.range n, edist (f (w (i + 1))) (f (w i))) +
+    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) +
+          ∑ i : ℕ in Finset.range m, edist (f (v (i + 1))) (f (v i)) =
+        ∑ i in Finset.range n, edist (f (w (i + 1))) (f (w i)) +
           ∑ i : ℕ in Finset.range m, edist (f (w (n + 1 + i + 1))) (f (w (n + 1 + i))) :=
       by
       dsimp only [w]
@@ -532,7 +532,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
           · exact n.le_succ.trans (n.succ.le_add_right i)
         simp only [A, B, C, Nat.succ_sub_succ_eq_sub, if_false, add_tsub_cancel_left]
     _ =
-        (∑ i in Finset.range n, edist (f (w (i + 1))) (f (w i))) +
+        ∑ i in Finset.range n, edist (f (w (i + 1))) (f (w i)) +
           ∑ i : ℕ in Finset.Ico (n + 1) (n + 1 + m), edist (f (w (i + 1))) (f (w i)) :=
       by
       congr 1
@@ -568,17 +568,17 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
       Monotone v ∧
         (∀ i, v i ∈ s ∪ t) ∧
           x ∈ v '' Iio m ∧
-            (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤
+            ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) ≤
               ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j))
   exact evariationOn.add_point f (mem_union_left t hs.1) u hu ust n
   obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x
   exact xv
   calc
-    (∑ j in Finset.range n, edist (f (u (j + 1))) (f (u j))) ≤
+    ∑ j in Finset.range n, edist (f (u (j + 1))) (f (u j)) ≤
         ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
       huv
     _ =
-        (∑ j in Finset.Ico 0 N, edist (f (v (j + 1))) (f (v j))) +
+        ∑ j in Finset.Ico 0 N, edist (f (v (j + 1))) (f (v j)) +
           ∑ j in Finset.Ico N m, edist (f (v (j + 1))) (f (v j)) :=
       by rw [Finset.range_eq_Ico, Finset.sum_Ico_consecutive _ (zero_le _) hN.le]
     _ ≤ evariationOn f s + evariationOn f t :=
@@ -722,14 +722,14 @@ theorem MonotoneOn.evariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneO
   apply iSup_le _
   rintro ⟨n, ⟨u, hu, us⟩⟩
   calc
-    (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
+    ∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i)) =
         ∑ i in Finset.range n, ENNReal.ofReal (f (u (i + 1)) - f (u i)) :=
       by
       apply Finset.sum_congr rfl fun i hi => _
       simp only [Finset.mem_range] at hi 
       rw [edist_dist, Real.dist_eq, abs_of_nonneg]
       exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
-    _ = ENNReal.ofReal (∑ i in Finset.range n, f (u (i + 1)) - f (u i)) :=
+    _ = ENNReal.ofReal (∑ i in Finset.range n, (f (u (i + 1)) - f (u i))) :=
       by
       rw [ENNReal.ofReal_sum_of_nonneg]
       intro i hi
@@ -948,7 +948,7 @@ theorem LipschitzOnWith.comp_evariationOn_le {f : E → F} {C : ℝ≥0} {t : Se
   apply iSup_le _
   rintro ⟨n, ⟨u, hu, us⟩⟩
   calc
-    (∑ i in Finset.range n, edist (f (g (u (i + 1)))) (f (g (u i)))) ≤
+    ∑ i in Finset.range n, edist (f (g (u (i + 1)))) (f (g (u i))) ≤
         ∑ i in Finset.range n, C * edist (g (u (i + 1))) (g (u i)) :=
       Finset.sum_le_sum fun i hi => h (hg (us _)) (hg (us _))
     _ = C * ∑ i in Finset.range n, edist (g (u (i + 1))) (g (u i)) := by rw [Finset.mul_sum]
Diff
@@ -170,7 +170,6 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
       apply Finset.sum_congr rfl fun i hi => _
       simp only [v, add_assoc]
     _ ≤ evariationOn f s := sum_le_of_monotone_on_Iic f hv vs
-    
 #align evariation_on.sum_le_of_monotone_on_Icc evariationOn.sum_le_of_monotoneOn_Icc
 
 theorem mono (f : α → E) {s t : Set α} (hst : t ⊆ s) : evariationOn f t ≤ evariationOn f s :=
@@ -349,7 +348,6 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
           simp only [hi.le, this, if_true]
         _ ≤ ∑ j in Finset.range (n + 2), edist (f (v (j + 1))) (f (v j)) :=
           Finset.sum_le_sum_of_subset (Finset.range_mono (Nat.le_add_right n 2))
-        
   have exists_N : ∃ N, N ≤ n ∧ x < u N := ⟨n, le_rfl, h⟩
   let N := Nat.find exists_N
   have hN : N ≤ n ∧ x < u N := Nat.find_spec exists_N
@@ -402,7 +400,6 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         apply Finset.sum_le_sum_of_subset _
         rw [Finset.range_eq_Ico]
         exact Finset.Ico_subset_Ico zero_le_one le_rfl
-      
   ·
     calc
       (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
@@ -478,7 +475,6 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         · exact Nat.succ_le_succ hN.left
         · exact zero_le _
         · exact N.pred_le.trans N.le_succ
-      
 #align evariation_on.add_point evariationOn.add_point
 
 /-- The variation of a function on the union of two sets `s` and `t`, with `s` to the left of `t`,
@@ -557,7 +553,6 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
         simp only [Finset.mem_Ico, Finset.mem_range] at hi h'i 
         exact hi.not_lt (Nat.lt_of_succ_le h'i.left)
     _ ≤ evariationOn f (s ∪ t) := sum_le f _ hw wst
-    
 #align evariation_on.add_le_union evariationOn.add_le_union
 
 /-- If a set `s` is to the left of a set `t`, and both contain the boundary point `x`, then
@@ -605,7 +600,6 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
           · rw [← Nx]; exact hv hi.1
         rw [this]
         exact ht.1
-    
 #align evariation_on.union evariationOn.union
 
 theorem Icc_add_Icc (f : α → E) {s : Set α} {a b c : α} (hab : a ≤ b) (hbc : b ≤ c) (hb : b ∈ s) :
@@ -745,7 +739,6 @@ theorem MonotoneOn.evariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneO
       by
       apply ENNReal.ofReal_le_ofReal
       exact sub_le_sub (hf (us n).1 bs (us n).2.2) (hf as (us 0).1 (us 0).2.1)
-    
 #align monotone_on.evariation_on_le MonotoneOn.evariationOn_le
 
 theorem MonotoneOn.hasLocallyBoundedVariationOn {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) :
@@ -911,7 +904,6 @@ theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : HasLocallyBounde
       exacts [⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
     _ = variationOnFromTo f s a c - variationOnFromTo f s a b := by
       rw [← add hf as bs cs, add_sub_cancel']
-    
 #align variation_on_from_to.sub_self_monotone_on variationOnFromTo.sub_self_monotoneOn
 
 @[protected]
@@ -961,7 +953,6 @@ theorem LipschitzOnWith.comp_evariationOn_le {f : E → F} {C : ℝ≥0} {t : Se
       Finset.sum_le_sum fun i hi => h (hg (us _)) (hg (us _))
     _ = C * ∑ i in Finset.range n, edist (g (u (i + 1))) (g (u i)) := by rw [Finset.mul_sum]
     _ ≤ C * evariationOn g s := mul_le_mul_left' (evariationOn.sum_le _ _ hu us) _
-    
 #align lipschitz_on_with.comp_evariation_on_le LipschitzOnWith.comp_evariationOn_le
 
 theorem LipschitzOnWith.comp_hasBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
Diff
@@ -211,7 +211,7 @@ theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y 
   simp [u, edist_comm]
 #align evariation_on.edist_le evariationOn.edist_le
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x y «expr ∈ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (x y «expr ∈ » s) -/
 theorem eq_zero_iff (f : α → E) {s : Set α} :
     evariationOn f s = 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 :=
   by
Diff
@@ -162,7 +162,7 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
         ∑ i in Finset.range (n - m), edist (f (u (m + i + 1))) (f (u (m + i))) :=
       by
       rw [Finset.range_eq_Ico]
-      convert(Finset.sum_Ico_add (fun i => edist (f (u (i + 1))) (f (u i))) 0 (n - m) m).symm
+      convert (Finset.sum_Ico_add (fun i => edist (f (u (i + 1))) (f (u i))) 0 (n - m) m).symm
       · rw [zero_add]
       · rw [tsub_add_cancel_of_le hmn.le]
     _ = ∑ i in Finset.range (n - m), edist (f (v (i + 1))) (f (v i)) :=
@@ -370,7 +370,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       have B : ¬i + 1 < N := by rw [← hi]; exact fun h => h.Ne rfl
       rw [if_pos A, if_neg B, if_pos hi]
       have T := Nat.find_min exists_N A
-      push_neg  at T 
+      push_neg at T 
       exact T (A.le.trans hN.1)
     · have A : ¬i < N := (nat.lt_succ_iff.mp hi).not_lt
       have B : ¬i + 1 < N := hi.not_lt
@@ -565,47 +565,47 @@ the variation of `f` along `s ∪ t` is the sum of the variations. -/
 theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht : IsLeast t x) :
     evariationOn f (s ∪ t) = evariationOn f s + evariationOn f t := by
   classical
-    apply le_antisymm _ (evariationOn.add_le_union f fun a ha b hb => le_trans (hs.2 ha) (ht.2 hb))
-    apply iSup_le _
-    rintro ⟨n, ⟨u, hu, ust⟩⟩
-    obtain ⟨v, m, hv, vst, xv, huv⟩ :
-      ∃ (v : ℕ → α) (m : ℕ),
-        Monotone v ∧
-          (∀ i, v i ∈ s ∪ t) ∧
-            x ∈ v '' Iio m ∧
-              (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤
-                ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j))
-    exact evariationOn.add_point f (mem_union_left t hs.1) u hu ust n
-    obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x
-    exact xv
-    calc
-      (∑ j in Finset.range n, edist (f (u (j + 1))) (f (u j))) ≤
-          ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
-        huv
-      _ =
-          (∑ j in Finset.Ico 0 N, edist (f (v (j + 1))) (f (v j))) +
-            ∑ j in Finset.Ico N m, edist (f (v (j + 1))) (f (v j)) :=
-        by rw [Finset.range_eq_Ico, Finset.sum_Ico_consecutive _ (zero_le _) hN.le]
-      _ ≤ evariationOn f s + evariationOn f t :=
-        by
-        refine' add_le_add _ _
-        · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
-          rcases vst i with (h | h); · exact h
-          have : v i = x := by
-            apply le_antisymm
-            · rw [← Nx]; exact hv hi.2
-            · exact ht.2 h
-          rw [this]
-          exact hs.1
-        · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
-          rcases vst i with (h | h); swap; · exact h
-          have : v i = x := by
-            apply le_antisymm
-            · exact hs.2 h
-            · rw [← Nx]; exact hv hi.1
-          rw [this]
-          exact ht.1
-      
+  apply le_antisymm _ (evariationOn.add_le_union f fun a ha b hb => le_trans (hs.2 ha) (ht.2 hb))
+  apply iSup_le _
+  rintro ⟨n, ⟨u, hu, ust⟩⟩
+  obtain ⟨v, m, hv, vst, xv, huv⟩ :
+    ∃ (v : ℕ → α) (m : ℕ),
+      Monotone v ∧
+        (∀ i, v i ∈ s ∪ t) ∧
+          x ∈ v '' Iio m ∧
+            (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤
+              ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j))
+  exact evariationOn.add_point f (mem_union_left t hs.1) u hu ust n
+  obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x
+  exact xv
+  calc
+    (∑ j in Finset.range n, edist (f (u (j + 1))) (f (u j))) ≤
+        ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
+      huv
+    _ =
+        (∑ j in Finset.Ico 0 N, edist (f (v (j + 1))) (f (v j))) +
+          ∑ j in Finset.Ico N m, edist (f (v (j + 1))) (f (v j)) :=
+      by rw [Finset.range_eq_Ico, Finset.sum_Ico_consecutive _ (zero_le _) hN.le]
+    _ ≤ evariationOn f s + evariationOn f t :=
+      by
+      refine' add_le_add _ _
+      · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
+        rcases vst i with (h | h); · exact h
+        have : v i = x := by
+          apply le_antisymm
+          · rw [← Nx]; exact hv hi.2
+          · exact ht.2 h
+        rw [this]
+        exact hs.1
+      · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
+        rcases vst i with (h | h); swap; · exact h
+        have : v i = x := by
+          apply le_antisymm
+          · exact hs.2 h
+          · rw [← Nx]; exact hv hi.1
+        rw [this]
+        exact ht.1
+    
 #align evariation_on.union evariationOn.union
 
 theorem Icc_add_Icc (f : α → E) {s : Set α} {a b c : α} (hab : a ≤ b) (hbc : b ≤ c) (hb : b ∈ s) :
@@ -1011,8 +1011,8 @@ theorem ae_differentiableWithinAt_of_mem_real {f : ℝ → ℝ} {s : Set ℝ}
   by
   obtain ⟨p, q, hp, hq, fpq⟩ : ∃ p q, MonotoneOn p s ∧ MonotoneOn q s ∧ f = p - q
   exact h.exists_monotone_on_sub_monotone_on
-  filter_upwards [hp.ae_differentiable_within_at_of_mem,
-    hq.ae_differentiable_within_at_of_mem]with x hxp hxq xs
+  filter_upwards [hp.ae_differentiable_within_at_of_mem, hq.ae_differentiable_within_at_of_mem] with
+    x hxp hxq xs
   have fpq : ∀ x, f x = p x - q x := by simp [fpq]
   refine' ((hxp xs).sub (hxq xs)).congr (fun y hy => fpq y) (fpq x)
 #align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem_real HasLocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_real
@@ -1028,7 +1028,7 @@ theorem ae_differentiableWithinAt_of_mem_pi {ι : Type _} [Fintype ι] {f : ℝ
     intro i
     apply ae_differentiable_within_at_of_mem_real
     exact LipschitzWith.comp_hasLocallyBoundedVariationOn (A i) h
-  filter_upwards [ae_all_iff.2 this]with x hx xs
+  filter_upwards [ae_all_iff.2 this] with x hx xs
   exact differentiableWithinAt_pi.2 fun i => hx i xs
 #align has_locally_bounded_variation_on.ae_differentiable_within_at_of_mem_pi HasLocallyBoundedVariationOn.ae_differentiableWithinAt_of_mem_pi
 
@@ -1039,7 +1039,7 @@ theorem ae_differentiableWithinAt_of_mem {f : ℝ → V} {s : Set ℝ}
   by
   let A := (Basis.ofVectorSpace ℝ V).equivFun.toContinuousLinearEquiv
   suffices H : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (A ∘ f) s x
-  · filter_upwards [H]with x hx xs
+  · filter_upwards [H] with x hx xs
     have : f = (A.symm ∘ A) ∘ f := by
       simp only [ContinuousLinearEquiv.symm_comp_self, Function.comp.left_id]
     rw [this]
@@ -1062,7 +1062,7 @@ is differentiable almost everywhere. -/
 theorem ae_differentiableAt {f : ℝ → V} (h : HasLocallyBoundedVariationOn f univ) :
     ∀ᵐ x, DifferentiableAt ℝ f x :=
   by
-  filter_upwards [h.ae_differentiable_within_at_of_mem]with x hx
+  filter_upwards [h.ae_differentiable_within_at_of_mem] with x hx
   rw [differentiableWithinAt_univ] at hx 
   exact hx (mem_univ _)
 #align has_locally_bounded_variation_on.ae_differentiable_at HasLocallyBoundedVariationOn.ae_differentiableAt
Diff
@@ -135,7 +135,7 @@ theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ
       simp [A, B]
   convert sum_le f n hv vs using 1
   apply Finset.sum_congr rfl fun i hi => _
-  simp only [Finset.mem_range] at hi
+  simp only [Finset.mem_range] at hi 
   have : i + 1 ≤ n := by linarith
   simp only [v]
   simp [this, hi.le]
@@ -151,11 +151,11 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
   have hv : MonotoneOn v (Iic (n - m)) :=
     by
     intro a ha b hb hab
-    simp only [le_tsub_iff_left hmn.le, mem_Iic] at ha hb
+    simp only [le_tsub_iff_left hmn.le, mem_Iic] at ha hb 
     exact hu ⟨le_add_right le_rfl, ha⟩ ⟨le_add_right le_rfl, hb⟩ (add_le_add le_rfl hab)
   have vs : ∀ i ∈ Iic (n - m), v i ∈ s := by
     intro i hi
-    simp only [le_tsub_iff_left hmn.le, mem_Iic] at hi
+    simp only [le_tsub_iff_left hmn.le, mem_Iic] at hi 
     exact us _ ⟨le_add_right le_rfl, hi⟩
   calc
     (∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) =
@@ -201,12 +201,12 @@ theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y 
     intro m n hmn
     dsimp only [u]
     split_ifs
-    exacts[le_rfl, hxy, by linarith [pos_iff_ne_zero.2 h], le_rfl]
+    exacts [le_rfl, hxy, by linarith [pos_iff_ne_zero.2 h], le_rfl]
   have us : ∀ i, u i ∈ s := by
     intro i
     dsimp only [u]
     split_ifs
-    exacts[hx, hy]
+    exacts [hx, hy]
   convert sum_le f 1 hu us
   simp [u, edist_comm]
 #align evariation_on.edist_le evariationOn.edist_le
@@ -279,7 +279,7 @@ theorem lowerSemicontinuous_uniform_on (s : Set α) :
   intro f
   apply @lower_continuous_aux _ _ _ _ (UniformOnFun α E {s}) id (𝓝 f) f s _
   have := @tendsto_id _ (𝓝 f)
-  rw [UniformOnFun.tendsto_iff_tendstoUniformlyOn] at this
+  rw [UniformOnFun.tendsto_iff_tendstoUniformlyOn] at this 
   simp_rw [← tendstoUniformlyOn_singleton_iff_tendsto]
   exact fun x xs => (this s rfl).mono (singleton_subset_iff.mpr xs)
 #align evariation_on.lower_semicontinuous_uniform_on evariationOn.lowerSemicontinuous_uniform_on
@@ -305,7 +305,7 @@ one can find another monotone function `v` parameterizing the same points as `u`
 In particular, the variation of a function along `u` is bounded by its variation along `v`. -/
 theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ → α) (hu : Monotone u)
     (us : ∀ i, u i ∈ s) (n : ℕ) :
-    ∃ (v : ℕ → α)(m : ℕ),
+    ∃ (v : ℕ → α) (m : ℕ),
       Monotone v ∧
         (∀ i, v i ∈ s) ∧
           x ∈ v '' Iio m ∧
@@ -343,7 +343,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
             ∑ i in Finset.range n, edist (f (v (i + 1))) (f (v i)) :=
           by
           apply Finset.sum_congr rfl fun i hi => _
-          simp only [Finset.mem_range] at hi
+          simp only [Finset.mem_range] at hi 
           have : i + 1 ≤ n := Nat.succ_le_of_lt hi
           dsimp only [v]
           simp only [hi.le, this, if_true]
@@ -358,7 +358,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
     dsimp only [w]
     intro i
     split_ifs
-    exacts[us _, hx, us _]
+    exacts [us _, hx, us _]
   have hw : Monotone w := by
     apply monotone_nat_of_le_succ fun i => _
     dsimp only [w]
@@ -370,7 +370,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       have B : ¬i + 1 < N := by rw [← hi]; exact fun h => h.Ne rfl
       rw [if_pos A, if_neg B, if_pos hi]
       have T := Nat.find_min exists_N A
-      push_neg  at T
+      push_neg  at T 
       exact T (A.le.trans hN.1)
     · have A : ¬i < N := (nat.lt_succ_iff.mp hi).not_lt
       have B : ¬i + 1 < N := hi.not_lt
@@ -422,7 +422,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         by
         congr 1; congr 1
         · apply Finset.sum_congr rfl fun i hi => _
-          simp only [Finset.mem_Ico, zero_le', true_and_iff] at hi
+          simp only [Finset.mem_Ico, zero_le', true_and_iff] at hi 
           dsimp only [w]
           have A : i + 1 < N := Nat.lt_pred_iff.1 hi
           have B : i < N := Nat.lt_of_succ_lt A
@@ -431,19 +431,19 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
           have : Finset.Ico (N - 1) N = {N - 1} := by rw [← Nat.Ico_succ_singleton, A]
           simp only [this, A, Finset.sum_singleton]
         · apply Finset.sum_congr rfl fun i hi => _
-          simp only [Finset.mem_Ico] at hi
+          simp only [Finset.mem_Ico] at hi 
           dsimp only [w]
           have A : ¬1 + i + 1 < N := fun h =>
             by
-            rw [add_assoc, add_comm] at h
+            rw [add_assoc, add_comm] at h 
             exact hi.left.not_lt (i.lt_succ_self.trans (i.succ.lt_succ_self.trans h))
           have B : ¬1 + i + 1 = N := fun h =>
             by
-            rw [← h, add_assoc, add_comm] at hi
+            rw [← h, add_assoc, add_comm] at hi 
             exact Nat.not_succ_le_self i (i.succ.le_succ.trans hi.left)
-          have C : ¬1 + i < N := fun h => by rw [add_comm] at h;
+          have C : ¬1 + i < N := fun h => by rw [add_comm] at h ;
             exact hi.left.not_lt (i.lt_succ_self.trans h)
-          have D : ¬1 + i = N := fun h => by rw [← h, add_comm, Nat.succ_le_iff] at hi;
+          have D : ¬1 + i = N := fun h => by rw [← h, add_comm, Nat.succ_le_iff] at hi ;
             exact hi.left.ne rfl
           rw [if_neg A, if_neg B, if_neg C, if_neg D]
           congr 3 <;> · rw [add_comm, Nat.sub_one]; apply Nat.pred_succ
@@ -522,11 +522,11 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
       dsimp only [w]
       congr 1
       · apply Finset.sum_congr rfl fun i hi => _
-        simp only [Finset.mem_range] at hi
+        simp only [Finset.mem_range] at hi 
         have : i + 1 ≤ n := Nat.succ_le_of_lt hi
         simp [hi.le, this]
       · apply Finset.sum_congr rfl fun i hi => _
-        simp only [Finset.mem_range] at hi
+        simp only [Finset.mem_range] at hi 
         have B : ¬n + 1 + i ≤ n := by linarith
         have A : ¬n + 1 + i + 1 ≤ n := fun h => B ((n + 1 + i).le_succ.trans h)
         have C : n + 1 + i - n = i + 1 :=
@@ -549,12 +549,12 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
       rw [← Finset.sum_union]
       · apply Finset.sum_le_sum_of_subset _
         rintro i hi
-        simp only [Finset.mem_union, Finset.mem_range, Finset.mem_Ico] at hi⊢
+        simp only [Finset.mem_union, Finset.mem_range, Finset.mem_Ico] at hi ⊢
         cases hi
         · exact lt_of_lt_of_le hi (n.le_succ.trans (n.succ.le_add_right m))
         · exact hi.2
       · apply Finset.disjoint_left.2 fun i hi h'i => _
-        simp only [Finset.mem_Ico, Finset.mem_range] at hi h'i
+        simp only [Finset.mem_Ico, Finset.mem_range] at hi h'i 
         exact hi.not_lt (Nat.lt_of_succ_le h'i.left)
     _ ≤ evariationOn f (s ∪ t) := sum_le f _ hw wst
     
@@ -569,7 +569,7 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
     apply iSup_le _
     rintro ⟨n, ⟨u, hu, ust⟩⟩
     obtain ⟨v, m, hv, vst, xv, huv⟩ :
-      ∃ (v : ℕ → α)(m : ℕ),
+      ∃ (v : ℕ → α) (m : ℕ),
         Monotone v ∧
           (∀ i, v i ∈ s ∪ t) ∧
             x ∈ v '' Iio m ∧
@@ -687,7 +687,7 @@ theorem comp_inter_Icc_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β →
     · rintro _ ⟨u, ⟨⟨hu, xu, uy⟩, rfl⟩⟩
       refine' ⟨⟨u, hu, rfl⟩, ⟨hφ hx hu xu, hφ hu hy uy⟩⟩
   · rw [evariationOn.subsingleton, evariationOn.subsingleton]
-    exacts[(Set.subsingleton_Icc_of_ge (hφ hy hx h)).anti (Set.inter_subset_right _ _),
+    exacts [(Set.subsingleton_Icc_of_ge (hφ hy hx h)).anti (Set.inter_subset_right _ _),
       (Set.subsingleton_Icc_of_ge h).anti (Set.inter_subset_right _ _)]
 #align evariation_on.comp_inter_Icc_eq_of_monotone_on evariationOn.comp_inter_Icc_eq_of_monotoneOn
 
@@ -732,7 +732,7 @@ theorem MonotoneOn.evariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneO
         ∑ i in Finset.range n, ENNReal.ofReal (f (u (i + 1)) - f (u i)) :=
       by
       apply Finset.sum_congr rfl fun i hi => _
-      simp only [Finset.mem_range] at hi
+      simp only [Finset.mem_range] at hi 
       rw [edist_dist, Real.dist_eq, abs_of_nonneg]
       exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
     _ = ENNReal.ofReal (∑ i in Finset.range n, f (u (i + 1)) - f (u i)) :=
@@ -830,7 +830,7 @@ theorem edist_zero_of_eq_zero {f : α → E} {s : Set α} (hf : HasLocallyBounde
   · apply le_antisymm _ (zero_le _)
     rw [← ENNReal.ofReal_zero, ← h, eq_of_le f s h', ENNReal.ofReal_toReal (hf a b ha hb)]
     apply evariationOn.edist_le
-    exacts[⟨ha, ⟨le_rfl, h'⟩⟩, ⟨hb, ⟨h', le_rfl⟩⟩]
+    exacts [⟨ha, ⟨le_rfl, h'⟩⟩, ⟨hb, ⟨h', le_rfl⟩⟩]
 #align variation_on_from_to.edist_zero_of_eq_zero variationOnFromTo.edist_zero_of_eq_zero
 
 @[protected]
@@ -908,7 +908,7 @@ theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : HasLocallyBounde
       rw [eq_of_le f s bc, dist_edist]
       apply ENNReal.toReal_mono (hf b c bs cs)
       apply evariationOn.edist_le f
-      exacts[⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
+      exacts [⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
     _ = variationOnFromTo f s a c - variationOnFromTo f s a b := by
       rw [← add hf as bs cs, add_sub_cancel']
     
@@ -1063,7 +1063,7 @@ theorem ae_differentiableAt {f : ℝ → V} (h : HasLocallyBoundedVariationOn f
     ∀ᵐ x, DifferentiableAt ℝ f x :=
   by
   filter_upwards [h.ae_differentiable_within_at_of_mem]with x hx
-  rw [differentiableWithinAt_univ] at hx
+  rw [differentiableWithinAt_univ] at hx 
   exact hx (mem_univ _)
 #align has_locally_bounded_variation_on.ae_differentiable_at HasLocallyBoundedVariationOn.ae_differentiableAt
 
Diff
@@ -53,7 +53,7 @@ that the sets one uses are nonempty and bounded above as these are only conditio
 -/
 
 
-open BigOperators NNReal ENNReal Topology UniformConvergence
+open scoped BigOperators NNReal ENNReal Topology UniformConvergence
 
 open Set MeasureTheory Filter
 
Diff
@@ -334,8 +334,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         have B : ¬i + 1 ≤ n := fun h => A (i.le_succ.trans h)
         simp only [A, B, if_false]
     refine' ⟨v, n + 2, hv, vs, (mem_image _ _ _).2 ⟨n + 1, _, _⟩, _⟩
-    · rw [mem_Iio]
-      exact Nat.lt_succ_self (n + 1)
+    · rw [mem_Iio]; exact Nat.lt_succ_self (n + 1)
     · have : ¬n + 1 ≤ n := Nat.not_succ_le_self n
       simp only [this, ite_eq_right_iff, IsEmpty.forall_iff]
     ·
@@ -368,9 +367,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       simp only [hi, this, if_true]
       exact hu (Nat.le_succ _)
     · have A : i < N := hi ▸ i.lt_succ_self
-      have B : ¬i + 1 < N := by
-        rw [← hi]
-        exact fun h => h.Ne rfl
+      have B : ¬i + 1 < N := by rw [← hi]; exact fun h => h.Ne rfl
       rw [if_pos A, if_neg B, if_pos hi]
       have T := Nat.find_min exists_N A
       push_neg  at T
@@ -384,8 +381,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       · exact hN.2.le.trans (hu (le_of_not_lt A))
       · exact hu (Nat.pred_le _)
   refine' ⟨w, n + 1, hw, ws, (mem_image _ _ _).2 ⟨N, hN.1.trans_lt (Nat.lt_succ_self n), _⟩, _⟩
-  · dsimp only [w]
-    rw [if_neg (lt_irrefl N), if_pos rfl]
+  · dsimp only [w]; rw [if_neg (lt_irrefl N), if_pos rfl]
   rcases eq_or_lt_of_le (zero_le N) with (Npos | Npos)
   ·
     calc
@@ -445,17 +441,12 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
             by
             rw [← h, add_assoc, add_comm] at hi
             exact Nat.not_succ_le_self i (i.succ.le_succ.trans hi.left)
-          have C : ¬1 + i < N := fun h => by
-            rw [add_comm] at h
+          have C : ¬1 + i < N := fun h => by rw [add_comm] at h;
             exact hi.left.not_lt (i.lt_succ_self.trans h)
-          have D : ¬1 + i = N := fun h =>
-            by
-            rw [← h, add_comm, Nat.succ_le_iff] at hi
+          have D : ¬1 + i = N := fun h => by rw [← h, add_comm, Nat.succ_le_iff] at hi;
             exact hi.left.ne rfl
           rw [if_neg A, if_neg B, if_neg C, if_neg D]
-          congr 3 <;>
-            · rw [add_comm, Nat.sub_one]
-              apply Nat.pred_succ
+          congr 3 <;> · rw [add_comm, Nat.sub_one]; apply Nat.pred_succ
       _ =
           (∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
               edist (f (w (N + 1))) (f (w (N - 1))) +
@@ -520,8 +511,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
     split_ifs
     · exact hu hij
     · apply h _ (us _) _ (vt _)
-    · exfalso
-      exact h_1 (hij.trans h_2)
+    · exfalso; exact h_1 (hij.trans h_2)
     · apply hv (tsub_le_tsub hij le_rfl)
   calc
     ((∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) +
@@ -600,24 +590,19 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
         by
         refine' add_le_add _ _
         · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
-          rcases vst i with (h | h)
-          · exact h
+          rcases vst i with (h | h); · exact h
           have : v i = x := by
             apply le_antisymm
-            · rw [← Nx]
-              exact hv hi.2
+            · rw [← Nx]; exact hv hi.2
             · exact ht.2 h
           rw [this]
           exact hs.1
         · apply sum_le_of_monotone_on_Icc _ (hv.monotone_on _) fun i hi => _
-          rcases vst i with (h | h)
-          swap
-          · exact h
+          rcases vst i with (h | h); swap; · exact h
           have : v i = x := by
             apply le_antisymm
             · exact hs.2 h
-            · rw [← Nx]
-              exact hv hi.1
+            · rw [← Nx]; exact hv hi.1
           rw [this]
           exact ht.1
       
Diff
@@ -4,14 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module analysis.bounded_variation
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
+! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
+import Mathbin.Analysis.Calculus.Deriv.Add
+import Mathbin.Analysis.Calculus.Fderiv.Equiv
+import Mathbin.Analysis.Calculus.Fderiv.Prod
 import Mathbin.Analysis.Calculus.Monotone
 import Mathbin.Data.Set.Function
 import Mathbin.Algebra.Group.Basic
-import Mathbin.Tactic.SwapVar
 import Mathbin.Tactic.Wlog
 
 /-!
Diff
@@ -106,7 +106,7 @@ theorem eq_of_eqOn {f f' : α → E} {s : Set α} (h : EqOn f f' s) :
 
 theorem sum_le (f : α → E) {s : Set α} (n : ℕ) {u : ℕ → α} (hu : Monotone u) (us : ∀ i, u i ∈ s) :
     (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤ evariationOn f s :=
-  le_supᵢ_of_le ⟨n, u, hu, us⟩ le_rfl
+  le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl
 #align evariation_on.sum_le evariationOn.sum_le
 
 theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ → α}
@@ -173,7 +173,7 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
 
 theorem mono (f : α → E) {s t : Set α} (hst : t ⊆ s) : evariationOn f t ≤ evariationOn f s :=
   by
-  apply supᵢ_le _
+  apply iSup_le _
   rintro ⟨n, ⟨u, hu, ut⟩⟩
   exact sum_le f n hu fun i => hst (ut i)
 #align evariation_on.mono evariationOn.mono
@@ -219,7 +219,7 @@ theorem eq_zero_iff (f : α → E) {s : Set α} :
     exact edist_le f xs ys
   · rintro h
     dsimp only [evariationOn]
-    rw [ENNReal.supᵢ_eq_zero]
+    rw [ENNReal.iSup_eq_zero]
     rintro ⟨n, u, um, us⟩
     exact Finset.sum_eq_zero fun i hi => h _ (us i.succ) _ (us i)
 #align evariation_on.eq_zero_iff evariationOn.eq_zero_iff
@@ -501,7 +501,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
   · simp [ht]
   have : Nonempty { u // Monotone u ∧ ∀ i : ℕ, u i ∈ t } :=
     nonempty_monotone_mem (nonempty_iff_ne_empty.2 ht)
-  refine' ENNReal.supᵢ_add_supᵢ_le _
+  refine' ENNReal.iSup_add_iSup_le _
   /- We start from two sequences `u` and `v` along `s` and `t` respectively, and we build a new
     sequence `w` along `s ∪ t` by juxtaposing them. Its variation is larger than the sum of the
     variations. -/
@@ -574,7 +574,7 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
     evariationOn f (s ∪ t) = evariationOn f s + evariationOn f t := by
   classical
     apply le_antisymm _ (evariationOn.add_le_union f fun a ha b hb => le_trans (hs.2 ha) (ht.2 hb))
-    apply supᵢ_le _
+    apply iSup_le _
     rintro ⟨n, ⟨u, hu, ust⟩⟩
     obtain ⟨v, m, hv, vst, xv, huv⟩ :
       ∃ (v : ℕ → α)(m : ℕ),
@@ -633,19 +633,19 @@ theorem Icc_add_Icc (f : α → E) {s : Set α} {a b c : α} (hab : a ≤ b) (hb
 
 theorem comp_le_of_monotoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t)
     (φst : MapsTo φ t s) : evariationOn (f ∘ φ) t ≤ evariationOn f s :=
-  supᵢ_le fun ⟨n, u, hu, ut⟩ =>
-    le_supᵢ_of_le ⟨n, φ ∘ u, fun x y xy => hφ (ut x) (ut y) (hu xy), fun i => φst (ut i)⟩ le_rfl
+  iSup_le fun ⟨n, u, hu, ut⟩ =>
+    le_iSup_of_le ⟨n, φ ∘ u, fun x y xy => hφ (ut x) (ut y) (hu xy), fun i => φst (ut i)⟩ le_rfl
 #align evariation_on.comp_le_of_monotone_on evariationOn.comp_le_of_monotoneOn
 
 theorem comp_le_of_antitoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β → α) (hφ : AntitoneOn φ t)
     (φst : MapsTo φ t s) : evariationOn (f ∘ φ) t ≤ evariationOn f s :=
   by
-  refine' supᵢ_le _
+  refine' iSup_le _
   rintro ⟨n, u, hu, ut⟩
   rw [← Finset.sum_range_reflect]
   refine'
     (Finset.sum_congr rfl fun x hx => _).trans_le
-      (le_supᵢ_of_le
+      (le_iSup_of_le
         ⟨n, fun i => φ (u <| n - i), fun x y xy => hφ (ut _) (ut _) (hu <| n.sub_le_sub_left xy),
           fun i => φst (ut _)⟩
         le_rfl)
@@ -738,7 +738,7 @@ end evariationOn
 theorem MonotoneOn.evariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) {a b : α}
     (as : a ∈ s) (bs : b ∈ s) : evariationOn f (s ∩ Icc a b) ≤ ENNReal.ofReal (f b - f a) :=
   by
-  apply supᵢ_le _
+  apply iSup_le _
   rintro ⟨n, ⟨u, hu, us⟩⟩
   calc
     (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
@@ -966,7 +966,7 @@ theorem LipschitzOnWith.comp_evariationOn_le {f : E → F} {C : ℝ≥0} {t : Se
     (h : LipschitzOnWith C f t) {g : α → E} {s : Set α} (hg : MapsTo g s t) :
     evariationOn (f ∘ g) s ≤ C * evariationOn g s :=
   by
-  apply supᵢ_le _
+  apply iSup_le _
   rintro ⟨n, ⟨u, hu, us⟩⟩
   calc
     (∑ i in Finset.range n, edist (f (g (u (i + 1)))) (f (g (u i)))) ≤
Diff
@@ -4,11 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module analysis.bounded_variation
-! leanprover-community/mathlib commit afdb4fa3b32d41106a4a09b371ce549ad7958abd
+! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.MeasureTheory.Measure.Lebesgue
 import Mathbin.Analysis.Calculus.Monotone
 import Mathbin.Data.Set.Function
 import Mathbin.Algebra.Group.Basic
Diff
@@ -161,7 +161,7 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
         ∑ i in Finset.range (n - m), edist (f (u (m + i + 1))) (f (u (m + i))) :=
       by
       rw [Finset.range_eq_Ico]
-      convert (Finset.sum_Ico_add (fun i => edist (f (u (i + 1))) (f (u i))) 0 (n - m) m).symm
+      convert(Finset.sum_Ico_add (fun i => edist (f (u (i + 1))) (f (u i))) 0 (n - m) m).symm
       · rw [zero_add]
       · rw [tsub_add_cancel_of_le hmn.le]
     _ = ∑ i in Finset.range (n - m), edist (f (v (i + 1))) (f (v i)) :=
Diff
@@ -56,8 +56,8 @@ open BigOperators NNReal ENNReal Topology UniformConvergence
 
 open Set MeasureTheory Filter
 
-variable {α β : Type _} [LinearOrder α] [LinearOrder β] {E F : Type _} [PseudoEmetricSpace E]
-  [PseudoEmetricSpace F] {V : Type _} [NormedAddCommGroup V] [NormedSpace ℝ V]
+variable {α β : Type _} [LinearOrder α] [LinearOrder β] {E F : Type _} [PseudoEMetricSpace E]
+  [PseudoEMetricSpace F] {V : Type _} [NormedAddCommGroup V] [NormedSpace ℝ V]
   [FiniteDimensional ℝ V]
 
 /-- The (extended real valued) variation of a function `f` on a set `s` inside a linear order is
Diff
@@ -210,7 +210,7 @@ theorem edist_le (f : α → E) {s : Set α} {x y : α} (hx : x ∈ s) (hy : y 
   simp [u, edist_comm]
 #align evariation_on.edist_le evariationOn.edist_le
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:628:2: warning: expanding binder collection (x y «expr ∈ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x y «expr ∈ » s) -/
 theorem eq_zero_iff (f : α → E) {s : Set α} :
     evariationOn f s = 0 ↔ ∀ (x) (_ : x ∈ s) (y) (_ : y ∈ s), edist (f x) (f y) = 0 :=
   by
Diff
@@ -52,7 +52,7 @@ that the sets one uses are nonempty and bounded above as these are only conditio
 -/
 
 
-open BigOperators NNReal Ennreal Topology UniformConvergence
+open BigOperators NNReal ENNReal Topology UniformConvergence
 
 open Set MeasureTheory Filter
 
@@ -220,7 +220,7 @@ theorem eq_zero_iff (f : α → E) {s : Set α} :
     exact edist_le f xs ys
   · rintro h
     dsimp only [evariationOn]
-    rw [Ennreal.supᵢ_eq_zero]
+    rw [ENNReal.supᵢ_eq_zero]
     rintro ⟨n, u, um, us⟩
     exact Finset.sum_eq_zero fun i hi => h _ (us i.succ) _ (us i)
 #align evariation_on.eq_zero_iff evariationOn.eq_zero_iff
@@ -287,7 +287,7 @@ theorem HasBoundedVariationOn.dist_le {E : Type _} [PseudoMetricSpace E] {f : α
     (h : HasBoundedVariationOn f s) {x y : α} (hx : x ∈ s) (hy : y ∈ s) :
     dist (f x) (f y) ≤ (evariationOn f s).toReal :=
   by
-  rw [← Ennreal.ofReal_le_ofReal_iff Ennreal.toReal_nonneg, Ennreal.ofReal_toReal h, ← edist_dist]
+  rw [← ENNReal.ofReal_le_ofReal_iff ENNReal.toReal_nonneg, ENNReal.ofReal_toReal h, ← edist_dist]
   exact edist_le f hx hy
 #align has_bounded_variation_on.dist_le HasBoundedVariationOn.dist_le
 
@@ -502,7 +502,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
   · simp [ht]
   have : Nonempty { u // Monotone u ∧ ∀ i : ℕ, u i ∈ t } :=
     nonempty_monotone_mem (nonempty_iff_ne_empty.2 ht)
-  refine' Ennreal.supᵢ_add_supᵢ_le _
+  refine' ENNReal.supᵢ_add_supᵢ_le _
   /- We start from two sequences `u` and `v` along `s` and `t` respectively, and we build a new
     sequence `w` along `s ∪ t` by juxtaposing them. Its variation is larger than the sum of the
     variations. -/
@@ -737,34 +737,34 @@ end evariationOn
 
 
 theorem MonotoneOn.evariationOn_le {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) {a b : α}
-    (as : a ∈ s) (bs : b ∈ s) : evariationOn f (s ∩ Icc a b) ≤ Ennreal.ofReal (f b - f a) :=
+    (as : a ∈ s) (bs : b ∈ s) : evariationOn f (s ∩ Icc a b) ≤ ENNReal.ofReal (f b - f a) :=
   by
   apply supᵢ_le _
   rintro ⟨n, ⟨u, hu, us⟩⟩
   calc
     (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
-        ∑ i in Finset.range n, Ennreal.ofReal (f (u (i + 1)) - f (u i)) :=
+        ∑ i in Finset.range n, ENNReal.ofReal (f (u (i + 1)) - f (u i)) :=
       by
       apply Finset.sum_congr rfl fun i hi => _
       simp only [Finset.mem_range] at hi
       rw [edist_dist, Real.dist_eq, abs_of_nonneg]
       exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
-    _ = Ennreal.ofReal (∑ i in Finset.range n, f (u (i + 1)) - f (u i)) :=
+    _ = ENNReal.ofReal (∑ i in Finset.range n, f (u (i + 1)) - f (u i)) :=
       by
-      rw [Ennreal.ofReal_sum_of_nonneg]
+      rw [ENNReal.ofReal_sum_of_nonneg]
       intro i hi
       exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
-    _ = Ennreal.ofReal (f (u n) - f (u 0)) := by rw [Finset.sum_range_sub fun i => f (u i)]
-    _ ≤ Ennreal.ofReal (f b - f a) :=
+    _ = ENNReal.ofReal (f (u n) - f (u 0)) := by rw [Finset.sum_range_sub fun i => f (u i)]
+    _ ≤ ENNReal.ofReal (f b - f a) :=
       by
-      apply Ennreal.ofReal_le_ofReal
+      apply ENNReal.ofReal_le_ofReal
       exact sub_le_sub (hf (us n).1 bs (us n).2.2) (hf as (us 0).1 (us 0).2.1)
     
 #align monotone_on.evariation_on_le MonotoneOn.evariationOn_le
 
 theorem MonotoneOn.hasLocallyBoundedVariationOn {f : α → ℝ} {s : Set α} (hf : MonotoneOn f s) :
     HasLocallyBoundedVariationOn f s := fun a b as bs =>
-  ((hf.evariationOn_le as bs).trans_lt Ennreal.ofReal_lt_top).Ne
+  ((hf.evariationOn_le as bs).trans_lt ENNReal.ofReal_lt_top).Ne
 #align monotone_on.has_locally_bounded_variation_on MonotoneOn.hasLocallyBoundedVariationOn
 
 /-- The **signed** variation of `f` on the interval `Icc a b` intersected with the set `s`,
@@ -782,13 +782,13 @@ variable (f : α → E) (s : Set α)
 theorem self (a : α) : variationOnFromTo f s a a = 0 :=
   by
   dsimp only [variationOnFromTo]
-  rw [if_pos le_rfl, Icc_self, evariationOn.subsingleton, Ennreal.zero_toReal]
+  rw [if_pos le_rfl, Icc_self, evariationOn.subsingleton, ENNReal.zero_toReal]
   exact fun x hx y hy => hx.2.trans hy.2.symm
 #align variation_on_from_to.self variationOnFromTo.self
 
 @[protected]
 theorem nonneg_of_le {a b : α} (h : a ≤ b) : 0 ≤ variationOnFromTo f s a b := by
-  simp only [variationOnFromTo, if_pos h, Ennreal.toReal_nonneg]
+  simp only [variationOnFromTo, if_pos h, ENNReal.toReal_nonneg]
 #align variation_on_from_to.nonneg_of_le variationOnFromTo.nonneg_of_le
 
 @[protected]
@@ -830,7 +830,7 @@ theorem add {f : α → E} {s : Set α} (hf : HasLocallyBoundedVariationOn f s)
     simp only [eq_neg_swap f s y x, Subtype.coe_mk, add_right_neg, forall_true_left]
   · rintro x y z xy yz xs ys zs
     rw [eq_of_le f s xy, eq_of_le f s yz, eq_of_le f s (xy.trans yz), ←
-      Ennreal.toReal_add (hf x y xs ys) (hf y z ys zs), evariationOn.Icc_add_Icc f xy yz ys]
+      ENNReal.toReal_add (hf x y xs ys) (hf y z ys zs), evariationOn.Icc_add_Icc f xy yz ys]
 #align variation_on_from_to.add variationOnFromTo.add
 
 @[protected]
@@ -842,7 +842,7 @@ theorem edist_zero_of_eq_zero {f : α → E} {s : Set α} (hf : HasLocallyBounde
     apply this hf hb ha _ (le_of_not_le h')
     rw [eq_neg_swap, h, neg_zero]
   · apply le_antisymm _ (zero_le _)
-    rw [← Ennreal.ofReal_zero, ← h, eq_of_le f s h', Ennreal.ofReal_toReal (hf a b ha hb)]
+    rw [← ENNReal.ofReal_zero, ← h, eq_of_le f s h', ENNReal.ofReal_toReal (hf a b ha hb)]
     apply evariationOn.edist_le
     exacts[⟨ha, ⟨le_rfl, h'⟩⟩, ⟨hb, ⟨h', le_rfl⟩⟩]
 #align variation_on_from_to.edist_zero_of_eq_zero variationOnFromTo.edist_zero_of_eq_zero
@@ -860,7 +860,7 @@ theorem eq_zero_iff_of_le {f : α → E} {s : Set α} (hf : HasLocallyBoundedVar
     variationOnFromTo f s a b = 0 ↔
       ∀ ⦃x⦄ (hx : x ∈ s ∩ Icc a b) ⦃y⦄ (hy : y ∈ s ∩ Icc a b), edist (f x) (f y) = 0 :=
   by
-  rw [eq_of_le _ _ ab, Ennreal.toReal_eq_zero_iff, or_iff_left (hf a b ha hb),
+  rw [eq_of_le _ _ ab, ENNReal.toReal_eq_zero_iff, or_iff_left (hf a b ha hb),
     evariationOn.eq_zero_iff]
 #align variation_on_from_to.eq_zero_iff_of_le variationOnFromTo.eq_zero_iff_of_le
 
@@ -870,7 +870,7 @@ theorem eq_zero_iff_of_ge {f : α → E} {s : Set α} (hf : HasLocallyBoundedVar
     variationOnFromTo f s a b = 0 ↔
       ∀ ⦃x⦄ (hx : x ∈ s ∩ Icc b a) ⦃y⦄ (hy : y ∈ s ∩ Icc b a), edist (f x) (f y) = 0 :=
   by
-  rw [eq_of_ge _ _ ba, neg_eq_zero, Ennreal.toReal_eq_zero_iff, or_iff_left (hf b a hb ha),
+  rw [eq_of_ge _ _ ba, neg_eq_zero, ENNReal.toReal_eq_zero_iff, or_iff_left (hf b a hb ha),
     evariationOn.eq_zero_iff]
 #align variation_on_from_to.eq_zero_iff_of_ge variationOnFromTo.eq_zero_iff_of_ge
 
@@ -920,7 +920,7 @@ theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : HasLocallyBounde
     _ ≤ variationOnFromTo f s b c :=
       by
       rw [eq_of_le f s bc, dist_edist]
-      apply Ennreal.toReal_mono (hf b c bs cs)
+      apply ENNReal.toReal_mono (hf b c bs cs)
       apply evariationOn.edist_le f
       exacts[⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
     _ = variationOnFromTo f s a c - variationOnFromTo f s a b := by
@@ -981,7 +981,7 @@ theorem LipschitzOnWith.comp_evariationOn_le {f : E → F} {C : ℝ≥0} {t : Se
 theorem LipschitzOnWith.comp_hasBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
     (hf : LipschitzOnWith C f t) {g : α → E} {s : Set α} (hg : MapsTo g s t)
     (h : HasBoundedVariationOn g s) : HasBoundedVariationOn (f ∘ g) s :=
-  ne_top_of_le_ne_top (Ennreal.mul_ne_top Ennreal.coe_ne_top h) (hf.comp_evariationOn_le hg)
+  ne_top_of_le_ne_top (ENNReal.mul_ne_top ENNReal.coe_ne_top h) (hf.comp_evariationOn_le hg)
 #align lipschitz_on_with.comp_has_bounded_variation_on LipschitzOnWith.comp_hasBoundedVariationOn
 
 theorem LipschitzOnWith.comp_hasLocallyBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module analysis.bounded_variation
-! leanprover-community/mathlib commit 92ca63f0fb391a9ca5f22d2409a6080e786d99f7
+! leanprover-community/mathlib commit afdb4fa3b32d41106a4a09b371ce549ad7958abd
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -981,11 +981,7 @@ theorem LipschitzOnWith.comp_evariationOn_le {f : E → F} {C : ℝ≥0} {t : Se
 theorem LipschitzOnWith.comp_hasBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}
     (hf : LipschitzOnWith C f t) {g : α → E} {s : Set α} (hg : MapsTo g s t)
     (h : HasBoundedVariationOn g s) : HasBoundedVariationOn (f ∘ g) s :=
-  by
-  dsimp [HasBoundedVariationOn] at h
-  apply ne_of_lt
-  apply (hf.comp_evariation_on_le hg).trans_lt
-  simp [lt_top_iff_ne_top, h]
+  ne_top_of_le_ne_top (Ennreal.mul_ne_top Ennreal.coe_ne_top h) (hf.comp_evariationOn_le hg)
 #align lipschitz_on_with.comp_has_bounded_variation_on LipschitzOnWith.comp_hasBoundedVariationOn
 
 theorem LipschitzOnWith.comp_hasLocallyBoundedVariationOn {f : E → F} {C : ℝ≥0} {t : Set E}

Changes in mathlib4

mathlib3
mathlib4
chore: adaptations to lean 4.8.0 (#12549)
Diff
@@ -526,11 +526,10 @@ theorem comp_le_of_antitoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β
     ⟨n, fun i => φ (u <| n - i), fun x y xy => hφ (ut _) (ut _) (hu <| Nat.sub_le_sub_left xy n),
       fun i => φst (ut _)⟩
     le_rfl
-  rw [edist_comm, Nat.sub_sub, add_comm, Nat.sub_succ, Nat.add_one, Nat.succ_eq_add_one]
-  simp only [Function.comp_apply, Nat.pred_eq_sub_one, Nat.sub_add_eq]
-  congr
-  simp only [Finset.mem_range] at hx
-  omega
+  rw [Finset.mem_range] at hx
+  dsimp only [Subtype.coe_mk, Function.comp_apply]
+  rw [edist_comm]
+  congr 4 <;> omega
 #align evariation_on.comp_le_of_antitone_on eVariationOn.comp_le_of_antitoneOn
 
 theorem comp_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t) :
chore: adapt to multiple goal linter 2 (#12361)

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

Diff
@@ -337,16 +337,17 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       _ = (∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
               edist (f (u N)) (f (u (N - 1))) +
             ∑ i in Finset.Ico N n, edist (f (w (1 + i + 1))) (f (w (1 + i))) := by
-        congr 1; congr 1
-        · apply Finset.sum_congr rfl fun i hi => ?_
-          simp only [Finset.mem_Ico, zero_le', true_and_iff] at hi
-          dsimp only [w]
-          have A : i + 1 < N := Nat.lt_pred_iff.1 hi
-          have B : i < N := Nat.lt_of_succ_lt A
-          rw [if_pos A, if_pos B]
-        · have A : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos
-          have : Finset.Ico (N - 1) N = {N - 1} := by rw [← Nat.Ico_succ_singleton, A]
-          simp only [this, A, Finset.sum_singleton]
+        congr 1
+        · congr 1
+          · apply Finset.sum_congr rfl fun i hi => ?_
+            simp only [Finset.mem_Ico, zero_le', true_and_iff] at hi
+            dsimp only [w]
+            have A : i + 1 < N := Nat.lt_pred_iff.1 hi
+            have B : i < N := Nat.lt_of_succ_lt A
+            rw [if_pos A, if_pos B]
+          · have A : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos
+            have : Finset.Ico (N - 1) N = {N - 1} := by rw [← Nat.Ico_succ_singleton, A]
+            simp only [this, A, Finset.sum_singleton]
         · apply Finset.sum_congr rfl fun i hi => ?_
           rw [Finset.mem_Ico] at hi
           dsimp only [w]
@@ -359,12 +360,13 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       _ = (∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
               edist (f (w (N + 1))) (f (w (N - 1))) +
             ∑ i in Finset.Ico (N + 1) (n + 1), edist (f (w (i + 1))) (f (w i)) := by
-        congr 1; congr 1
-        · dsimp only [w]
-          have A : ¬N + 1 < N := Nat.not_succ_lt_self
-          have B : N - 1 < N := Nat.pred_lt Npos.ne'
-          simp only [A, not_and, not_lt, Nat.succ_ne_self, Nat.add_succ_sub_one, add_zero, if_false,
-            B, if_true]
+        congr 1
+        · congr 1
+          · dsimp only [w]
+            have A : ¬N + 1 < N := Nat.not_succ_lt_self
+            have B : N - 1 < N := Nat.pred_lt Npos.ne'
+            simp only [A, not_and, not_lt, Nat.succ_ne_self, Nat.add_succ_sub_one, add_zero,
+              if_false, B, if_true]
         · exact Finset.sum_Ico_add (fun i => edist (f (w (i + 1))) (f (w i))) N n 1
       _ ≤ ((∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
               ∑ i in Finset.Ico (N - 1) (N + 1), edist (f (w (i + 1))) (f (w i))) +
style: replace '.-/' by '. -/' (#11938)

Purely automatic replacement. If this is in any way controversial; I'm happy to just close this PR.

Diff
@@ -926,7 +926,7 @@ theorem LipschitzOnWith.ae_differentiableWithinAt_real {C : ℝ≥0} {f : ℝ 
 
 /-- A real Lipschitz function into a finite dimensional real vector space is differentiable
 almost everywhere. For the general Rademacher theorem assuming
-that the source space is finite dimensional, see `LipschitzWith.ae_differentiableAt`.-/
+that the source space is finite dimensional, see `LipschitzWith.ae_differentiableAt`. -/
 theorem LipschitzWith.ae_differentiableAt_real {C : ℝ≥0} {f : ℝ → V} (h : LipschitzWith C f) :
     ∀ᵐ x, DifferentiableAt ℝ f x :=
   (h.locallyBoundedVariationOn univ).ae_differentiableAt
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
@@ -258,7 +258,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       · have : i + 1 ≤ n := Nat.succ_le_of_lt hi
         simp only [hi.le, this, if_true]
         exact hu (Nat.le_succ i)
-      · simp only [le_refl, if_true, add_le_iff_nonpos_right, le_zero_iff, Nat.one_ne_zero,
+      · simp only [le_refl, if_true, add_le_iff_nonpos_right, Nat.le_zero, Nat.one_ne_zero,
           if_false, h]
       · have A : ¬i ≤ n := hi.not_le
         have B : ¬i + 1 ≤ n := fun h => A (i.le_succ.trans h)
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -759,7 +759,7 @@ protected theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : Locall
       apply eVariationOn.edist_le f
       exacts [⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
     _ = variationOnFromTo f s a c - variationOnFromTo f s a b := by
-      rw [← variationOnFromTo.add hf as bs cs, add_sub_cancel']
+      rw [← variationOnFromTo.add hf as bs cs, add_sub_cancel_left]
 
 #align variation_on_from_to.sub_self_monotone_on variationOnFromTo.sub_self_monotoneOn
 
chore: golf using omega (#11318)

Backported from #11314.

Diff
@@ -350,18 +350,10 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         · apply Finset.sum_congr rfl fun i hi => ?_
           rw [Finset.mem_Ico] at hi
           dsimp only [w]
-          have A : ¬1 + i + 1 < N := fun h => by
-            rw [add_assoc, add_comm] at h
-            exact hi.left.not_lt (i.lt_succ_self.trans (i.succ.lt_succ_self.trans h))
-          have B : ¬1 + i + 1 = N := fun h => by
-            rw [← h, add_assoc, add_comm] at hi
-            exact Nat.not_succ_le_self i (i.succ.le_succ.trans hi.left)
-          have C : ¬1 + i < N := fun h => by
-            rw [add_comm] at h
-            exact hi.left.not_lt (i.lt_succ_self.trans h)
-          have D : ¬1 + i = N := fun h => by
-            rw [← h, add_comm, Nat.succ_le_iff] at hi
-            exact hi.left.ne rfl
+          have A : ¬1 + i + 1 < N := by omega
+          have B : ¬1 + i + 1 = N := by omega
+          have C : ¬1 + i < N := by omega
+          have D : ¬1 + i = N := by omega
           rw [if_neg A, if_neg B, if_neg C, if_neg D]
           congr 3 <;> · rw [add_comm, Nat.sub_one]; apply Nat.pred_succ
       _ = (∑ i in Finset.Ico 0 (N - 1), edist (f (w (i + 1))) (f (w i))) +
@@ -532,10 +524,11 @@ theorem comp_le_of_antitoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β
     ⟨n, fun i => φ (u <| n - i), fun x y xy => hφ (ut _) (ut _) (hu <| Nat.sub_le_sub_left xy n),
       fun i => φst (ut _)⟩
     le_rfl
-  dsimp only [Subtype.coe_mk]
-  rw [edist_comm, Nat.sub_sub, add_comm, Nat.sub_succ, Nat.add_one, Nat.succ_pred_eq_of_pos]
-  simp only [Function.comp_apply]
-  simpa only [tsub_pos_iff_lt, Finset.mem_range] using hx
+  rw [edist_comm, Nat.sub_sub, add_comm, Nat.sub_succ, Nat.add_one, Nat.succ_eq_add_one]
+  simp only [Function.comp_apply, Nat.pred_eq_sub_one, Nat.sub_add_eq]
+  congr
+  simp only [Finset.mem_range] at hx
+  omega
 #align evariation_on.comp_le_of_antitone_on eVariationOn.comp_le_of_antitoneOn
 
 theorem comp_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t) :
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -54,7 +54,7 @@ open scoped BigOperators NNReal ENNReal Topology UniformConvergence
 
 open Set MeasureTheory Filter
 
--- porting note: sectioned variables because a `wlog` was broken due to extra variables in context
+-- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context
 variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E]
 
 /-- The (extended real valued) variation of a function `f` on a set `s` inside a linear order is
refactor: optimize proofs with omega (#11093)

I ran tryAtEachStep on all files under Mathlib to find all locations where omega succeeds. For each that was a linarith without an only, I tried replacing it with omega, and I verified that elaboration time got smaller. (In almost all cases, there was a noticeable speedup.) I also replaced some slow aesops along the way.

Diff
@@ -436,7 +436,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
         simp [hi.le, this]
       · refine Finset.sum_congr rfl fun i hi => ?_
         simp only [Finset.mem_range] at hi
-        have B : ¬n + 1 + i ≤ n := by linarith
+        have B : ¬n + 1 + i ≤ n := by omega
         have A : ¬n + 1 + i + 1 ≤ n := fun h => B ((n + 1 + i).le_succ.trans h)
         have C : n + 1 + i - n = i + 1 := by
           rw [tsub_eq_iff_eq_add_of_le]
chore: remove stream-of-conciousness syntax for obtain (#11045)

This covers many instances, but is not exhaustive.

Independently of whether that syntax should be avoided (similar to #10534), I think all these changes are small improvements.

Diff
@@ -474,10 +474,9 @@ theorem union (f : α → E) {s t : Set α} {x : α} (hs : IsGreatest s x) (ht :
   obtain ⟨v, m, hv, vst, xv, huv⟩ : ∃ (v : ℕ → α) (m : ℕ),
     Monotone v ∧ (∀ i, v i ∈ s ∪ t) ∧ x ∈ v '' Iio m ∧
       (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤
-        ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j))
-  exact eVariationOn.add_point f (mem_union_left t hs.1) u hu ust n
-  obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x
-  exact xv
+        ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
+    eVariationOn.add_point f (mem_union_left t hs.1) u hu ust n
+  obtain ⟨N, hN, Nx⟩ : ∃ N, N < m ∧ v N = x := xv
   calc
     (∑ j in Finset.range n, edist (f (u (j + 1))) (f (u j))) ≤
         ∑ j in Finset.range m, edist (f (v (j + 1))) (f (v j)) :=
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -116,7 +116,7 @@ theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : 
         = ∑ i in Finset.Ico m n, edist (f (v (i + 1))) (f (v i)) :=
       Finset.sum_congr rfl fun i hi ↦ by
         rw [Finset.mem_Ico] at hi
-        simp only [projIcc_of_mem hmn ⟨hi.1, hi.2.le⟩,
+        simp only [v, π, projIcc_of_mem hmn ⟨hi.1, hi.2.le⟩,
           projIcc_of_mem hmn ⟨hi.1.trans i.le_succ, hi.2⟩]
     _ ≤ ∑ i in Finset.range n, edist (f (v (i + 1))) (f (v i)) :=
       Finset.sum_mono_set _ (Nat.Iio_eq_range ▸ Finset.Ico_subset_Iio_self)
@@ -247,13 +247,13 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
   rcases le_or_lt (u n) x with (h | h)
   · let v i := if i ≤ n then u i else x
     have vs : ∀ i, v i ∈ s := fun i ↦ by
-      simp only
+      simp only [v]
       split_ifs
       · exact us i
       · exact hx
     have hv : Monotone v := by
       refine monotone_nat_of_le_succ fun i => ?_
-      simp only
+      simp only [v]
       rcases lt_trichotomy i n with (hi | rfl | hi)
       · have : i + 1 ≤ n := Nat.succ_le_of_lt hi
         simp only [hi.le, this, if_true]
@@ -266,14 +266,14 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
     refine' ⟨v, n + 2, hv, vs, (mem_image _ _ _).2 ⟨n + 1, _, _⟩, _⟩
     · rw [mem_Iio]; exact Nat.lt_succ_self (n + 1)
     · have : ¬n + 1 ≤ n := Nat.not_succ_le_self n
-      simp only [this, ite_eq_right_iff, IsEmpty.forall_iff]
+      simp only [v, this, ite_eq_right_iff, IsEmpty.forall_iff]
     · calc
         (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
             ∑ i in Finset.range n, edist (f (v (i + 1))) (f (v i)) := by
           apply Finset.sum_congr rfl fun i hi => ?_
           simp only [Finset.mem_range] at hi
           have : i + 1 ≤ n := Nat.succ_le_of_lt hi
-          simp only [hi.le, this, if_true]
+          simp only [v, hi.le, this, if_true]
         _ ≤ ∑ j in Finset.range (n + 2), edist (f (v (j + 1))) (f (v j)) :=
           Finset.sum_le_sum_of_subset (Finset.range_mono (Nat.le_add_right n 2))
   have exists_N : ∃ N, N ≤ n ∧ x < u N := ⟨n, le_rfl, h⟩
@@ -281,13 +281,13 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
   have hN : N ≤ n ∧ x < u N := Nat.find_spec exists_N
   let w : ℕ → α := fun i => if i < N then u i else if i = N then x else u (i - 1)
   have ws : ∀ i, w i ∈ s := by
-    dsimp only
+    dsimp only [w]
     intro i
     split_ifs
     exacts [us _, hx, us _]
   have hw : Monotone w := by
     apply monotone_nat_of_le_succ fun i => ?_
-    dsimp only
+    dsimp only [w]
     rcases lt_trichotomy (i + 1) N with (hi | hi | hi)
     · have : i < N := Nat.lt_of_le_of_lt (Nat.le_succ i) hi
       simp only [hi, this, if_true]
@@ -307,13 +307,13 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
       · exact hN.2.le.trans (hu (le_of_not_lt A))
       · exact hu (Nat.pred_le _)
   refine' ⟨w, n + 1, hw, ws, (mem_image _ _ _).2 ⟨N, hN.1.trans_lt (Nat.lt_succ_self n), _⟩, _⟩
-  · dsimp only; rw [if_neg (lt_irrefl N), if_pos rfl]
+  · dsimp only [w]; rw [if_neg (lt_irrefl N), if_pos rfl]
   rcases eq_or_lt_of_le (zero_le N) with (Npos | Npos)
   · calc
       (∑ i in Finset.range n, edist (f (u (i + 1))) (f (u i))) =
           ∑ i in Finset.range n, edist (f (w (1 + i + 1))) (f (w (1 + i))) := by
         apply Finset.sum_congr rfl fun i _hi => ?_
-        dsimp only
+        dsimp only [w]
         simp only [← Npos, Nat.not_lt_zero, Nat.add_succ_sub_one, add_zero, if_false,
           add_eq_zero_iff, Nat.one_ne_zero, false_and_iff, Nat.succ_add_sub_one, zero_add]
         rw [add_comm 1 i]
@@ -340,7 +340,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
         congr 1; congr 1
         · apply Finset.sum_congr rfl fun i hi => ?_
           simp only [Finset.mem_Ico, zero_le', true_and_iff] at hi
-          dsimp only
+          dsimp only [w]
           have A : i + 1 < N := Nat.lt_pred_iff.1 hi
           have B : i < N := Nat.lt_of_succ_lt A
           rw [if_pos A, if_pos B]
@@ -349,7 +349,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
           simp only [this, A, Finset.sum_singleton]
         · apply Finset.sum_congr rfl fun i hi => ?_
           rw [Finset.mem_Ico] at hi
-          dsimp only
+          dsimp only [w]
           have A : ¬1 + i + 1 < N := fun h => by
             rw [add_assoc, add_comm] at h
             exact hi.left.not_lt (i.lt_succ_self.trans (i.succ.lt_succ_self.trans h))
@@ -368,7 +368,7 @@ theorem add_point (f : α → E) {s : Set α} {x : α} (hx : x ∈ s) (u : ℕ 
               edist (f (w (N + 1))) (f (w (N - 1))) +
             ∑ i in Finset.Ico (N + 1) (n + 1), edist (f (w (i + 1))) (f (w i)) := by
         congr 1; congr 1
-        · dsimp only
+        · dsimp only [w]
           have A : ¬N + 1 < N := Nat.not_succ_lt_self
           have B : N - 1 < N := Nat.pred_lt Npos.ne'
           simp only [A, not_and, not_lt, Nat.succ_ne_self, Nat.add_succ_sub_one, add_zero, if_false,
@@ -413,11 +413,11 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
   have wst : ∀ i, w i ∈ s ∪ t := by
     intro i
     by_cases hi : i ≤ n
-    · simp [hi, us]
-    · simp [hi, vt]
+    · simp [w, hi, us]
+    · simp [w, hi, vt]
   have hw : Monotone w := by
     intro i j hij
-    dsimp only
+    dsimp only [w]
     split_ifs with h_1 h_2 h_2
     · exact hu hij
     · apply h _ (us _) _ (vt _)
@@ -428,7 +428,7 @@ theorem add_le_union (f : α → E) {s t : Set α} (h : ∀ x ∈ s, ∀ y ∈ t
           ∑ i : ℕ in Finset.range m, edist (f (v (i + 1))) (f (v i))) =
         (∑ i in Finset.range n, edist (f (w (i + 1))) (f (w i))) +
           ∑ i : ℕ in Finset.range m, edist (f (w (n + 1 + i + 1))) (f (w (n + 1 + i))) := by
-      dsimp only
+      dsimp only [w]
       congr 1
       · refine Finset.sum_congr rfl fun i hi => ?_
         simp only [Finset.mem_range] at hi
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
@@ -570,7 +570,7 @@ theorem comp_inter_Icc_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β →
       · rw [← le_antisymm vφx (hφ us hx ux)]
         exact ⟨x, ⟨hx, ⟨le_rfl, h⟩⟩, rfl⟩
     · rintro _ ⟨u, ⟨⟨hu, xu, uy⟩, rfl⟩⟩
-      refine' ⟨⟨u, hu, rfl⟩, ⟨hφ hx hu xu, hφ hu hy uy⟩⟩
+      exact ⟨⟨u, hu, rfl⟩, ⟨hφ hx hu xu, hφ hu hy uy⟩⟩
   · rw [eVariationOn.subsingleton, eVariationOn.subsingleton]
     exacts [(Set.subsingleton_Icc_of_ge (hφ hy hx h)).anti (Set.inter_subset_right _ _),
       (Set.subsingleton_Icc_of_ge h).anti (Set.inter_subset_right _ _)]
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -885,8 +885,8 @@ is differentiable almost everywhere in this set. -/
 theorem ae_differentiableWithinAt_of_mem {f : ℝ → V} {s : Set ℝ}
     (h : LocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x := by
   let A := (Basis.ofVectorSpace ℝ V).equivFun.toContinuousLinearEquiv
-  suffices H : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (A ∘ f) s x
-  · filter_upwards [H] with x hx xs
+  suffices H : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (A ∘ f) s x by
+    filter_upwards [H] with x hx xs
     have : f = (A.symm ∘ A) ∘ f := by
       simp only [ContinuousLinearEquiv.symm_comp_self, Function.id_comp]
     rw [this]
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathlib.Analysis.Calculus.Deriv.Add
+import Mathlib.Analysis.Calculus.FDeriv.Add
 import Mathlib.Analysis.Calculus.FDeriv.Equiv
 import Mathlib.Analysis.Calculus.FDeriv.Prod
 import Mathlib.Analysis.Calculus.Monotone
chore(Function): rename some lemmas (#9738)
  • Merge Function.left_id and Function.comp.left_id into Function.id_comp.
  • Merge Function.right_id and Function.comp.right_id into Function.comp_id.
  • Merge Function.comp_const_right and Function.comp_const into Function.comp_const, use explicit arguments.
  • Move Function.const_comp to Mathlib.Init.Function, use explicit arguments.
Diff
@@ -888,7 +888,7 @@ theorem ae_differentiableWithinAt_of_mem {f : ℝ → V} {s : Set ℝ}
   suffices H : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (A ∘ f) s x
   · filter_upwards [H] with x hx xs
     have : f = (A.symm ∘ A) ∘ f := by
-      simp only [ContinuousLinearEquiv.symm_comp_self, Function.comp.left_id]
+      simp only [ContinuousLinearEquiv.symm_comp_self, Function.id_comp]
     rw [this]
     exact A.symm.differentiableAt.comp_differentiableWithinAt x (hx xs)
   apply ae_differentiableWithinAt_of_mem_pi
chore: remove uses of cases' (#9171)

I literally went through and regex'd some uses of cases', replacing them with rcases; this is meant to be a low effort PR as I hope that tools can do this in the future.

rcases is an easier replacement than cases, though with better tools we could in future do a second pass converting simple rcases added here (and existing ones) to cases.

Diff
@@ -107,7 +107,7 @@ theorem sum_le (f : α → E) {s : Set α} (n : ℕ) {u : ℕ → α} (hu : Mono
 theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : ℕ → α}
     (hu : MonotoneOn u (Icc m n)) (us : ∀ i ∈ Icc m n, u i ∈ s) :
     (∑ i in Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) ≤ eVariationOn f s := by
-  cases' le_total n m with hnm hmn
+  rcases le_total n m with hnm | hmn
   · simp [Finset.Ico_eq_empty_of_le hnm]
   let π := projIcc m n hmn
   let v i := u (π i)
fix: patch for std4#203 (more sub lemmas for Nat) (#6216)
Diff
@@ -530,7 +530,7 @@ theorem comp_le_of_antitoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β
   rintro ⟨n, u, hu, ut⟩
   rw [← Finset.sum_range_reflect]
   refine' (Finset.sum_congr rfl fun x hx => _).trans_le <| le_iSup_of_le
-    ⟨n, fun i => φ (u <| n - i), fun x y xy => hφ (ut _) (ut _) (hu <| Nat.sub_le_sub_left n xy),
+    ⟨n, fun i => φ (u <| n - i), fun x y xy => hφ (ut _) (ut _) (hu <| Nat.sub_le_sub_left xy n),
       fun i => φst (ut _)⟩
     le_rfl
   dsimp only [Subtype.coe_mk]
chore: avoid subst by rfl (#8145)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -861,9 +861,8 @@ namespace LocallyBoundedVariationOn
 `ae_differentiableWithinAt_of_mem`. -/
 theorem ae_differentiableWithinAt_of_mem_real {f : ℝ → ℝ} {s : Set ℝ}
     (h : LocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x := by
-  obtain ⟨p, q, hp, hq, fpq⟩ : ∃ p q, MonotoneOn p s ∧ MonotoneOn q s ∧ f = p - q :=
+  obtain ⟨p, q, hp, hq, rfl⟩ : ∃ p q, MonotoneOn p s ∧ MonotoneOn q s ∧ f = p - q :=
     h.exists_monotoneOn_sub_monotoneOn
-  subst f -- porting note: TODO: `rfl` instead of `fpq` doesn't work
   filter_upwards [hp.ae_differentiableWithinAt_of_mem, hq.ae_differentiableWithinAt_of_mem] with
     x hxp hxq xs
   exact (hxp xs).sub (hxq xs)
feat: Rademacher theorem (#7003)

We prove Rademacher theorem, stating that a Lipschitz function between finite-dimensional real vector spaces is differentiable almost everywhere.

Diff
@@ -916,23 +916,27 @@ theorem ae_differentiableAt {f : ℝ → V} (h : LocallyBoundedVariationOn f uni
 end LocallyBoundedVariationOn
 
 /-- A real function into a finite dimensional real vector space which is Lipschitz on a set
-is differentiable almost everywhere in this set . -/
-theorem LipschitzOnWith.ae_differentiableWithinAt_of_mem {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
+is differentiable almost everywhere in this set. For the general Rademacher theorem assuming
+that the source space is finite dimensional, see `LipschitzOnWith.ae_differentiableWithinAt_of_mem`.
+-/
+theorem LipschitzOnWith.ae_differentiableWithinAt_of_mem_real {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
     (h : LipschitzOnWith C f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x :=
   h.locallyBoundedVariationOn.ae_differentiableWithinAt_of_mem
-#align lipschitz_on_with.ae_differentiable_within_at_of_mem LipschitzOnWith.ae_differentiableWithinAt_of_mem
+#align lipschitz_on_with.ae_differentiable_within_at_of_mem LipschitzOnWith.ae_differentiableWithinAt_of_mem_real
 
 /-- A real function into a finite dimensional real vector space which is Lipschitz on a set
-is differentiable almost everywhere in this set. -/
-theorem LipschitzOnWith.ae_differentiableWithinAt {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
+is differentiable almost everywhere in this set. For the general Rademacher theorem assuming
+that the source space is finite dimensional, see `LipschitzOnWith.ae_differentiableWithinAt`. -/
+theorem LipschitzOnWith.ae_differentiableWithinAt_real {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
     (h : LipschitzOnWith C f s) (hs : MeasurableSet s) :
     ∀ᵐ x ∂volume.restrict s, DifferentiableWithinAt ℝ f s x :=
   h.locallyBoundedVariationOn.ae_differentiableWithinAt hs
-#align lipschitz_on_with.ae_differentiable_within_at LipschitzOnWith.ae_differentiableWithinAt
+#align lipschitz_on_with.ae_differentiable_within_at LipschitzOnWith.ae_differentiableWithinAt_real
 
 /-- A real Lipschitz function into a finite dimensional real vector space is differentiable
-almost everywhere. -/
-theorem LipschitzWith.ae_differentiableAt {C : ℝ≥0} {f : ℝ → V} (h : LipschitzWith C f) :
+almost everywhere. For the general Rademacher theorem assuming
+that the source space is finite dimensional, see `LipschitzWith.ae_differentiableAt`.-/
+theorem LipschitzWith.ae_differentiableAt_real {C : ℝ≥0} {f : ℝ → V} (h : LipschitzWith C f) :
     ∀ᵐ x, DifferentiableAt ℝ f x :=
   (h.locallyBoundedVariationOn univ).ae_differentiableAt
-#align lipschitz_with.ae_differentiable_at LipschitzWith.ae_differentiableAt
+#align lipschitz_with.ae_differentiable_at LipschitzWith.ae_differentiableAt_real
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
@@ -55,7 +55,7 @@ open scoped BigOperators NNReal ENNReal Topology UniformConvergence
 open Set MeasureTheory Filter
 
 -- porting note: sectioned variables because a `wlog` was broken due to extra variables in context
-variable {α : Type _} [LinearOrder α] {E : Type _} [PseudoEMetricSpace E]
+variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E]
 
 /-- The (extended real valued) variation of a function `f` on a set `s` inside a linear order is
 the supremum of the sum of `edist (f (u (i+1))) (f (u i))` over all finite increasing
@@ -187,7 +187,7 @@ protected theorem subsingleton (f : α → E) {s : Set α} (hs : s.Subsingleton)
   constant_on (hs.image f)
 #align evariation_on.subsingleton eVariationOn.subsingleton
 
-theorem lowerSemicontinuous_aux {ι : Type _} {F : ι → α → E} {p : Filter ι} {f : α → E} {s : Set α}
+theorem lowerSemicontinuous_aux {ι : Type*} {F : ι → α → E} {p : Filter ι} {f : α → E} {s : Set α}
     (Ffs : ∀ x ∈ s, Tendsto (fun i => F i x) p (𝓝 (f x))) {v : ℝ≥0∞} (hv : v < eVariationOn f s) :
     ∀ᶠ n : ι in p, v < eVariationOn (F n) s := by
   obtain ⟨⟨n, ⟨u, um, us⟩⟩, hlt⟩ :
@@ -222,7 +222,7 @@ theorem lowerSemicontinuous_uniformOn (s : Set α) :
   exact fun x xs => (this s rfl).mono (singleton_subset_iff.mpr xs)
 #align evariation_on.lower_semicontinuous_uniform_on eVariationOn.lowerSemicontinuous_uniformOn
 
-theorem _root_.BoundedVariationOn.dist_le {E : Type _} [PseudoMetricSpace E] {f : α → E}
+theorem _root_.BoundedVariationOn.dist_le {E : Type*} [PseudoMetricSpace E] {f : α → E}
     {s : Set α} (h : BoundedVariationOn f s) {x y : α} (hx : x ∈ s) (hy : y ∈ s) :
     dist (f x) (f y) ≤ (eVariationOn f s).toReal := by
   rw [← ENNReal.ofReal_le_ofReal_iff ENNReal.toReal_nonneg, ENNReal.ofReal_toReal h, ← edist_dist]
@@ -516,7 +516,7 @@ theorem Icc_add_Icc (f : α → E) {s : Set α} {a b c : α} (hab : a ≤ b) (hb
 
 section Monotone
 
-variable {β : Type _} [LinearOrder β]
+variable {β : Type*} [LinearOrder β]
 
 theorem comp_le_of_monotoneOn (f : α → E) {s : Set α} {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t)
     (φst : MapsTo φ t s) : eVariationOn (f ∘ φ) t ≤ eVariationOn f s :=
@@ -771,7 +771,7 @@ protected theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : Locall
 
 #align variation_on_from_to.sub_self_monotone_on variationOnFromTo.sub_self_monotoneOn
 
-protected theorem comp_eq_of_monotoneOn {β : Type _} [LinearOrder β] (f : α → E) {t : Set β}
+protected theorem comp_eq_of_monotoneOn {β : Type*} [LinearOrder β] (f : α → E) {t : Set β}
     (φ : β → α) (hφ : MonotoneOn φ t) {x y : β} (hx : x ∈ t) (hy : y ∈ t) :
     variationOnFromTo (f ∘ φ) t x y = variationOnFromTo f (φ '' t) (φ x) (φ y) := by
   rcases le_total x y with (h | h)
@@ -799,7 +799,7 @@ theorem LocallyBoundedVariationOn.exists_monotoneOn_sub_monotoneOn {f : α → 
 
 section LipschitzOnWith
 
-variable {F : Type _} [PseudoEMetricSpace F]
+variable {F : Type*} [PseudoEMetricSpace F]
 
 theorem LipschitzOnWith.comp_eVariationOn_le {f : E → F} {C : ℝ≥0} {t : Set E}
     (h : LipschitzOnWith C f t) {g : α → E} {s : Set α} (hg : MapsTo g s t) :
@@ -853,7 +853,7 @@ end LipschitzOnWith
 
 /-! ## Almost everywhere differentiability of functions with locally bounded variation -/
 
-variable {V : Type _} [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V]
+variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V]
 
 namespace LocallyBoundedVariationOn
 
@@ -871,7 +871,7 @@ theorem ae_differentiableWithinAt_of_mem_real {f : ℝ → ℝ} {s : Set ℝ}
 
 /-- A bounded variation function into a finite dimensional product vector space is differentiable
 almost everywhere. Superseded by `ae_differentiableWithinAt_of_mem`. -/
-theorem ae_differentiableWithinAt_of_mem_pi {ι : Type _} [Fintype ι] {f : ℝ → ι → ℝ} {s : Set ℝ}
+theorem ae_differentiableWithinAt_of_mem_pi {ι : Type*} [Fintype ι] {f : ℝ → ι → ℝ} {s : Set ℝ}
     (h : LocallyBoundedVariationOn f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x := by
   have A : ∀ i : ι, LipschitzWith 1 fun x : ι → ℝ => x i := fun i => LipschitzWith.eval i
   have : ∀ i : ι, ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ (fun x : ℝ => f x i) s x := fun i ↦ by
feat: basic set lemmas (#6010)
Diff
@@ -555,17 +555,6 @@ theorem comp_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ
   exact comp_le_of_monotoneOn _ ψ hψ ψts
 #align evariation_on.comp_eq_of_monotone_on eVariationOn.comp_eq_of_monotoneOn
 
--- porting note: move to file `data.set.intervals.basic` once the port is over,
--- and use it in theorem `polynomialFunctions_closure_eq_top`
--- in the file `topology/continuous_function/weierstrass.lean`
-theorem _root_.Set.subsingleton_Icc_of_ge {α : Type _} [PartialOrder α] {a b : α} (h : b ≤ a) :
-    Set.Subsingleton (Icc a b) := by
-  rintro c ⟨ac, cb⟩ d ⟨ad, db⟩
-  cases le_antisymm (cb.trans h) ac
-  cases le_antisymm (db.trans h) ad
-  rfl
-#align set.subsingleton_Icc_of_ge Set.subsingleton_Icc_of_ge
-
 theorem comp_inter_Icc_eq_of_monotoneOn (f : α → E) {t : Set β} (φ : β → α) (hφ : MonotoneOn φ t)
     {x y : β} (hx : x ∈ t) (hy : y ∈ t) :
     eVariationOn (f ∘ φ) (t ∩ Icc x y) = eVariationOn f (φ '' t ∩ Icc (φ x) (φ y)) := by
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,11 +2,6 @@
 Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.bounded_variation
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Calculus.Deriv.Add
 import Mathlib.Analysis.Calculus.FDeriv.Equiv
@@ -16,6 +11,8 @@ import Mathlib.Data.Set.Function
 import Mathlib.Algebra.Group.Basic
 import Mathlib.Tactic.WLOG
 
+#align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
+
 /-!
 # Functions of bounded variation
 
feat: port Analysis.BoundedVariation (#4824)

This PR also corrects a mis-forward-port of leanprover-community/mathlib#18080

Co-authored-by: Jireh Loreaux <loreaujy@gmail.com>

Dependencies 12 + 1033

1034 files ported (98.9%)
471606 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