measure_theory.measure.hausdorffMathlib.MeasureTheory.Measure.Hausdorff

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -1129,7 +1129,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
   · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
       by
       refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
-      rw [ENNReal.rpow_nat_cast]
+      rw [ENNReal.rpow_natCast]
       exact Real.volume_pi_le_diam_pow s
     rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
     exact measure.le_iff'.1 Hle _
@@ -1191,7 +1191,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
               is_bounded_default)
       filter_upwards [B] with _ hn
       apply Finset.sum_le_sum fun i _ => _
-      rw [ENNReal.rpow_nat_cast]
+      rw [ENNReal.rpow_natCast]
       exact pow_le_pow_left' (hn i) _
     _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
       simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
@@ -1204,7 +1204,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
       · apply
           tendsto.congr' _
             ((ennreal.continuous_of_real.tendsto _).comp
-              ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
+              ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_natCast_atTop_atTop))
         apply eventually_at_top.2 ⟨1, fun n hn => _⟩
         simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
           ENNReal.ofReal_natCast]
Diff
@@ -170,7 +170,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   rw [borel_eq_generateFrom_isClosed]
   refine' MeasurableSpace.generateFrom_le fun t ht => μ.is_caratheodory_iff_le.2 fun s => _
   set S : ℕ → Set X := fun n => {x ∈ s | (↑n)⁻¹ ≤ inf_edist x t}
-  have n0 : ∀ {n : ℕ}, (n⁻¹ : ℝ≥0∞) ≠ 0 := fun n => ENNReal.inv_ne_zero.2 (ENNReal.nat_ne_top _)
+  have n0 : ∀ {n : ℕ}, (n⁻¹ : ℝ≥0∞) ≠ 0 := fun n => ENNReal.inv_ne_zero.2 (ENNReal.natCast_ne_top _)
   have Ssep : ∀ n, IsMetricSeparated (S n) t := fun n =>
     ⟨n⁻¹, n0, fun x hx y hy => hx.2.trans <| inf_edist_le_edist_of_mem hy⟩
   have Ssep' : ∀ n, IsMetricSeparated (S n) (s ∩ t) := fun n =>
@@ -1149,7 +1149,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
     intro f
     apply diam_pi_le_of_le fun b => _
     simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
-      add_sub_add_left_eq_sub, add_sub_cancel_left, ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
+      add_sub_add_left_eq_sub, add_sub_cancel_left, ENNReal.ofReal_one, ENNReal.ofReal_natCast]
   have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
     by
     apply eventually_at_top.2 ⟨1, fun n hn => _⟩
@@ -1207,7 +1207,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
               ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
         apply eventually_at_top.2 ⟨1, fun n hn => _⟩
         simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
-          ENNReal.ofReal_coe_nat]
+          ENNReal.ofReal_natCast]
       · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 -/
Diff
@@ -1149,7 +1149,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
     intro f
     apply diam_pi_le_of_le fun b => _
     simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
-      add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
+      add_sub_add_left_eq_sub, add_sub_cancel_left, ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
   have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
     by
     apply eventually_at_top.2 ⟨1, fun n hn => _⟩
Diff
@@ -153,7 +153,7 @@ theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {
   classical
   induction' I using Finset.induction_on with i I hiI ihI hI
   · simp
-  simp only [Finset.mem_insert] at hI 
+  simp only [Finset.mem_insert] at hI
   rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
   exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
     IsMetricSeparated.finset_iUnion_right fun j hj =>
@@ -186,7 +186,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     by
     refine' subset.antisymm (Union_subset S_sub) _
     rintro x ⟨hxs, hxt⟩
-    rw [mem_iff_inf_edist_zero_of_closed ht] at hxt 
+    rw [mem_iff_inf_edist_zero_of_closed ht] at hxt
     rcases ENNReal.exists_inv_nat_lt hxt with ⟨n, hn⟩
     exact mem_Union.2 ⟨n, hxs, hn.le⟩
   /- Now we have `∀ n, μ (s ∩ t) + μ (S n) ≤ μ s` and we need to prove
@@ -368,7 +368,7 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
   refine'
     tendsto_nhds_unique_of_eventuallyEq (mk_metric'.tendsto_pre _ _)
       ((mk_metric'.tendsto_pre _ _).add (mk_metric'.tendsto_pre _ _)) _
-  rw [← pos_iff_ne_zero] at r0 
+  rw [← pos_iff_ne_zero] at r0
   filter_upwards [Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, r0⟩]
   rintro ε ⟨ε0, εr⟩
   refine' bounded_by_union_of_top_of_nonempty_inter _
@@ -610,7 +610,7 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
     congr 1 with n : 1
     simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
   · rw [iInf_eq_if, if_neg htr]
-    push_neg at htr ; rcases htr with ⟨n, hn⟩
+    push_neg at htr; rcases htr with ⟨n, hn⟩
     refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
     rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
     exact hn.not_le
@@ -992,7 +992,7 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
   refine' iSup₂_le fun ε ε0 => _
   refine' le_iSup₂_of_le (ε / K) (by simp [ε0.ne']) _
   refine' le_iInf₂ fun t hst => le_iInf fun htε => _
-  replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst; rw [preimage_Union] at hst 
+  replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst; rw [preimage_Union] at hst
   refine' iInf₂_le_of_le _ hst (iInf_le_of_le (fun n => _) _)
   · exact (hf.ediam_preimage_le _).trans (ENNReal.mul_le_of_le_div' <| htε n)
   · refine' ENNReal.tsum_le_tsum fun n => iSup_le_iff.2 fun hft => _
@@ -1155,7 +1155,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
     apply eventually_at_top.2 ⟨1, fun n hn => _⟩
     have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
     intro x hx
-    simp only [mem_Ioo, mem_univ_pi] at hx 
+    simp only [mem_Ioo, mem_univ_pi] at hx
     simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
     let f : γ n := fun i =>
       ⟨⌊(x i - a i) * n⌋₊, by
Diff
@@ -149,7 +149,15 @@ variable {μ : OuterMeasure X}
 /-- A metric outer measure is additive on a finite set of pairwise metric separated sets. -/
 theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {s : ι → Set X}
     (hI : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → IsMetricSeparated (s i) (s j)) :
-    μ (⋃ i ∈ I, s i) = ∑ i in I, μ (s i) := by classical
+    μ (⋃ i ∈ I, s i) = ∑ i in I, μ (s i) := by
+  classical
+  induction' I using Finset.induction_on with i I hiI ihI hI
+  · simp
+  simp only [Finset.mem_insert] at hI 
+  rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
+  exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
+    IsMetricSeparated.finset_iUnion_right fun j hj =>
+      hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
 #align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
 -/
 
@@ -374,7 +382,21 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
 /-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
 (we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mk_metric m₁ hm₁ ≤ c • mk_metric m₂ hm₂`. -/
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
-    (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by classical
+    (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by
+  classical
+  rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' zero_lt_one).1 hle with ⟨r, hr0, hr⟩
+  refine' fun s =>
+    le_of_tendsto_of_tendsto (mk_metric'.tendsto_pre _ s)
+      (ENNReal.Tendsto.const_mul (mk_metric'.tendsto_pre _ s) (Or.inr hc))
+      (mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, hr0⟩) fun r' hr' => _)
+  simp only [mem_set_of_eq, mk_metric'.pre, RingHom.id_apply]
+  rw [← smul_eq_mul, ← smul_apply, smul_bounded_by hc]
+  refine' le_bounded_by.2 (fun t => (bounded_by_le _).trans _) _
+  simp only [smul_eq_mul, Pi.smul_apply, extend, iInf_eq_if]
+  split_ifs with ht ht
+  · apply hr
+    exact ⟨zero_le _, ht.trans_lt hr'.2⟩
+  · simp [h0]
 #align measure_theory.outer_measure.mk_metric_mono_smul MeasureTheory.OuterMeasure.mkMetric_mono_smul
 -/
 
@@ -573,12 +595,31 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
       ⨆ (r : ℝ≥0∞) (hr : 0 < r),
         ⨅ (t : ℕ → Set X) (h : s ⊆ iUnion t) (h' : ∀ n, diam (t n) ≤ r),
           ∑' n, ⨆ h : (t n).Nonempty, m (diam (t n)) :=
-  by classical
+  by
+  classical
+  -- We mostly unfold the definitions but we need to switch the order of `∑'` and `⨅`
+  simp only [← outer_measure.coe_mk_metric, outer_measure.mk_metric, outer_measure.mk_metric',
+    outer_measure.supr_apply, outer_measure.mk_metric'.pre, outer_measure.bounded_by_apply, extend]
+  refine'
+    surjective_id.supr_congr (fun r => r) fun r =>
+      iSup_congr_Prop Iff.rfl fun hr =>
+        surjective_id.infi_congr _ fun t => iInf_congr_Prop Iff.rfl fun ht => _
+  dsimp
+  by_cases htr : ∀ n, diam (t n) ≤ r
+  · rw [iInf_eq_if, if_pos htr]
+    congr 1 with n : 1
+    simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
+  · rw [iInf_eq_if, if_neg htr]
+    push_neg at htr ; rcases htr with ⟨n, hn⟩
+    refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
+    rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
+    exact hn.not_le
+    rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
+    exact ⟨x, hx⟩
 #align measure_theory.measure.mk_metric_apply MeasureTheory.Measure.mkMetric_apply
 -/
 
 #print MeasureTheory.Measure.le_mkMetric /-
--- We mostly unfold the definitions but we need to switch the order of `∑'` and `⨅`
 theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
     (h : ∀ s : Set X, diam s ≤ ε → μ s ≤ m (diam s)) : μ ≤ mkMetric m :=
   by
@@ -1070,16 +1111,107 @@ instance {d : ℝ} [Group X] [IsometricSMul Xᵐᵒᵖ X] : IsMulRightInvariant
 /-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
 @[simp]
 theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
-    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by classical
+    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
+  classical
+  -- it suffices to check that the two measures coincide on products of rational intervals
+  refine'
+    (pi_eq_generateFrom (fun i => real.borel_eq_generate_from_Ioo_rat.symm)
+        (fun i => Real.isPiSystem_Ioo_rat) (fun i => Real.finiteSpanningSetsInIooRat _) _).symm
+  simp only [mem_Union, mem_singleton_iff]
+  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
+  intro s hs
+  choose a b H using hs
+  obtain rfl : s = fun i => Ioo (a i) (b i)
+  exact funext fun i => (H i).2
+  replace H := fun i => (H i).1
+  apply le_antisymm _
+  -- first check that `volume s ≤ μH s`
+  · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
+      by
+      refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
+      rw [ENNReal.rpow_nat_cast]
+      exact Real.volume_pi_le_diam_pow s
+    rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
+    exact measure.le_iff'.1 Hle _
+  /- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
+    `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
+    `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
+  have I : ∀ i, 0 ≤ (b i : ℝ) - a i := fun i => by
+    simpa only [sub_nonneg, Rat.cast_le] using (H i).le
+  let γ := fun n : ℕ => ∀ i : ι, Fin ⌈((b i : ℝ) - a i) * n⌉₊
+  let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
+    Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
+  have A : tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) at_top (𝓝 0) := by
+    simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
+  have B : ∀ᶠ n in at_top, ∀ i : γ n, diam (t n i) ≤ 1 / n :=
+    by
+    apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+    intro f
+    apply diam_pi_le_of_le fun b => _
+    simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
+      add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
+  have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
+    by
+    apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+    have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
+    intro x hx
+    simp only [mem_Ioo, mem_univ_pi] at hx 
+    simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
+    let f : γ n := fun i =>
+      ⟨⌊(x i - a i) * n⌋₊, by
+        apply Nat.floor_lt_ceil_of_lt_of_pos
+        · refine' (mul_lt_mul_right npos).2 _
+          simp only [(hx i).right, sub_lt_sub_iff_right]
+        · refine' mul_pos _ npos
+          simpa only [Rat.cast_lt, sub_pos] using H i⟩
+    refine' ⟨f, fun i => ⟨_, _⟩⟩
+    ·
+      calc
+        (a i : ℝ) + ⌊(x i - a i) * n⌋₊ / n ≤ (a i : ℝ) + (x i - a i) * n / n :=
+          by
+          refine' add_le_add le_rfl ((div_le_div_right npos).2 _)
+          exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
+        _ = x i := by field_simp [npos.ne']
+    ·
+      calc
+        x i = (a i : ℝ) + (x i - a i) * n / n := by field_simp [npos.ne']
+        _ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n :=
+          add_le_add le_rfl ((div_le_div_right npos).2 (Nat.lt_floor_add_one _).le)
+  calc
+    μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
+        liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ↑(Fintype.card ι)) at_top :=
+      hausdorff_measure_le_liminf_sum _ (Set.pi univ fun i => Ioo (a i : ℝ) (b i))
+        (fun n : ℕ => 1 / (n : ℝ≥0∞)) A t B C
+    _ ≤ liminf (fun n : ℕ => ∑ i : γ n, (1 / n) ^ Fintype.card ι) at_top :=
+      by
+      refine'
+        liminf_le_liminf _
+          (by
+            run_tac
+              is_bounded_default)
+      filter_upwards [B] with _ hn
+      apply Finset.sum_le_sum fun i _ => _
+      rw [ENNReal.rpow_nat_cast]
+      exact pow_le_pow_left' (hn i) _
+    _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
+      simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
+        nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
+    _ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) :=
+      by
+      simp only [Real.volume_Ioo]
+      apply tendsto.liminf_eq
+      refine' ENNReal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
+      · apply
+          tendsto.congr' _
+            ((ennreal.continuous_of_real.tendsto _).comp
+              ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
+        apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+        simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
+          ENNReal.ofReal_coe_nat]
+      · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 -/
 
--- it suffices to check that the two measures coincide on products of rational intervals
--- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
--- first check that `volume s ≤ μH s`
-/- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
-  `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
-  `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
 variable (ι X)
 
 #print MeasureTheory.hausdorffMeasure_measurePreserving_funUnique /-
Diff
@@ -149,15 +149,7 @@ variable {μ : OuterMeasure X}
 /-- A metric outer measure is additive on a finite set of pairwise metric separated sets. -/
 theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {s : ι → Set X}
     (hI : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → IsMetricSeparated (s i) (s j)) :
-    μ (⋃ i ∈ I, s i) = ∑ i in I, μ (s i) := by
-  classical
-  induction' I using Finset.induction_on with i I hiI ihI hI
-  · simp
-  simp only [Finset.mem_insert] at hI 
-  rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
-  exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
-    IsMetricSeparated.finset_iUnion_right fun j hj =>
-      hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
+    μ (⋃ i ∈ I, s i) = ∑ i in I, μ (s i) := by classical
 #align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
 -/
 
@@ -382,21 +374,7 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
 /-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
 (we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mk_metric m₁ hm₁ ≤ c • mk_metric m₂ hm₂`. -/
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
-    (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by
-  classical
-  rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' zero_lt_one).1 hle with ⟨r, hr0, hr⟩
-  refine' fun s =>
-    le_of_tendsto_of_tendsto (mk_metric'.tendsto_pre _ s)
-      (ENNReal.Tendsto.const_mul (mk_metric'.tendsto_pre _ s) (Or.inr hc))
-      (mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, hr0⟩) fun r' hr' => _)
-  simp only [mem_set_of_eq, mk_metric'.pre, RingHom.id_apply]
-  rw [← smul_eq_mul, ← smul_apply, smul_bounded_by hc]
-  refine' le_bounded_by.2 (fun t => (bounded_by_le _).trans _) _
-  simp only [smul_eq_mul, Pi.smul_apply, extend, iInf_eq_if]
-  split_ifs with ht ht
-  · apply hr
-    exact ⟨zero_le _, ht.trans_lt hr'.2⟩
-  · simp [h0]
+    (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by classical
 #align measure_theory.outer_measure.mk_metric_mono_smul MeasureTheory.OuterMeasure.mkMetric_mono_smul
 -/
 
@@ -595,31 +573,12 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
       ⨆ (r : ℝ≥0∞) (hr : 0 < r),
         ⨅ (t : ℕ → Set X) (h : s ⊆ iUnion t) (h' : ∀ n, diam (t n) ≤ r),
           ∑' n, ⨆ h : (t n).Nonempty, m (diam (t n)) :=
-  by
-  classical
-  -- We mostly unfold the definitions but we need to switch the order of `∑'` and `⨅`
-  simp only [← outer_measure.coe_mk_metric, outer_measure.mk_metric, outer_measure.mk_metric',
-    outer_measure.supr_apply, outer_measure.mk_metric'.pre, outer_measure.bounded_by_apply, extend]
-  refine'
-    surjective_id.supr_congr (fun r => r) fun r =>
-      iSup_congr_Prop Iff.rfl fun hr =>
-        surjective_id.infi_congr _ fun t => iInf_congr_Prop Iff.rfl fun ht => _
-  dsimp
-  by_cases htr : ∀ n, diam (t n) ≤ r
-  · rw [iInf_eq_if, if_pos htr]
-    congr 1 with n : 1
-    simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
-  · rw [iInf_eq_if, if_neg htr]
-    push_neg at htr ; rcases htr with ⟨n, hn⟩
-    refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
-    rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
-    exact hn.not_le
-    rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
-    exact ⟨x, hx⟩
+  by classical
 #align measure_theory.measure.mk_metric_apply MeasureTheory.Measure.mkMetric_apply
 -/
 
 #print MeasureTheory.Measure.le_mkMetric /-
+-- We mostly unfold the definitions but we need to switch the order of `∑'` and `⨅`
 theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
     (h : ∀ s : Set X, diam s ≤ ε → μ s ≤ m (diam s)) : μ ≤ mkMetric m :=
   by
@@ -1111,107 +1070,16 @@ instance {d : ℝ} [Group X] [IsometricSMul Xᵐᵒᵖ X] : IsMulRightInvariant
 /-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
 @[simp]
 theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
-    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
-  classical
-  -- it suffices to check that the two measures coincide on products of rational intervals
-  refine'
-    (pi_eq_generateFrom (fun i => real.borel_eq_generate_from_Ioo_rat.symm)
-        (fun i => Real.isPiSystem_Ioo_rat) (fun i => Real.finiteSpanningSetsInIooRat _) _).symm
-  simp only [mem_Union, mem_singleton_iff]
-  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
-  intro s hs
-  choose a b H using hs
-  obtain rfl : s = fun i => Ioo (a i) (b i)
-  exact funext fun i => (H i).2
-  replace H := fun i => (H i).1
-  apply le_antisymm _
-  -- first check that `volume s ≤ μH s`
-  · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
-      by
-      refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
-      rw [ENNReal.rpow_nat_cast]
-      exact Real.volume_pi_le_diam_pow s
-    rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
-    exact measure.le_iff'.1 Hle _
-  /- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
-    `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
-    `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
-  have I : ∀ i, 0 ≤ (b i : ℝ) - a i := fun i => by
-    simpa only [sub_nonneg, Rat.cast_le] using (H i).le
-  let γ := fun n : ℕ => ∀ i : ι, Fin ⌈((b i : ℝ) - a i) * n⌉₊
-  let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
-    Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
-  have A : tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) at_top (𝓝 0) := by
-    simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
-  have B : ∀ᶠ n in at_top, ∀ i : γ n, diam (t n i) ≤ 1 / n :=
-    by
-    apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-    intro f
-    apply diam_pi_le_of_le fun b => _
-    simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
-      add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
-  have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
-    by
-    apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-    have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
-    intro x hx
-    simp only [mem_Ioo, mem_univ_pi] at hx 
-    simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
-    let f : γ n := fun i =>
-      ⟨⌊(x i - a i) * n⌋₊, by
-        apply Nat.floor_lt_ceil_of_lt_of_pos
-        · refine' (mul_lt_mul_right npos).2 _
-          simp only [(hx i).right, sub_lt_sub_iff_right]
-        · refine' mul_pos _ npos
-          simpa only [Rat.cast_lt, sub_pos] using H i⟩
-    refine' ⟨f, fun i => ⟨_, _⟩⟩
-    ·
-      calc
-        (a i : ℝ) + ⌊(x i - a i) * n⌋₊ / n ≤ (a i : ℝ) + (x i - a i) * n / n :=
-          by
-          refine' add_le_add le_rfl ((div_le_div_right npos).2 _)
-          exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
-        _ = x i := by field_simp [npos.ne']
-    ·
-      calc
-        x i = (a i : ℝ) + (x i - a i) * n / n := by field_simp [npos.ne']
-        _ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n :=
-          add_le_add le_rfl ((div_le_div_right npos).2 (Nat.lt_floor_add_one _).le)
-  calc
-    μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
-        liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ↑(Fintype.card ι)) at_top :=
-      hausdorff_measure_le_liminf_sum _ (Set.pi univ fun i => Ioo (a i : ℝ) (b i))
-        (fun n : ℕ => 1 / (n : ℝ≥0∞)) A t B C
-    _ ≤ liminf (fun n : ℕ => ∑ i : γ n, (1 / n) ^ Fintype.card ι) at_top :=
-      by
-      refine'
-        liminf_le_liminf _
-          (by
-            run_tac
-              is_bounded_default)
-      filter_upwards [B] with _ hn
-      apply Finset.sum_le_sum fun i _ => _
-      rw [ENNReal.rpow_nat_cast]
-      exact pow_le_pow_left' (hn i) _
-    _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
-      simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
-        nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
-    _ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) :=
-      by
-      simp only [Real.volume_Ioo]
-      apply tendsto.liminf_eq
-      refine' ENNReal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
-      · apply
-          tendsto.congr' _
-            ((ennreal.continuous_of_real.tendsto _).comp
-              ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
-        apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-        simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
-          ENNReal.ofReal_coe_nat]
-      · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
+    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by classical
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 -/
 
+-- it suffices to check that the two measures coincide on products of rational intervals
+-- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
+-- first check that `volume s ≤ μH s`
+/- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
+  `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
+  `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
 variable (ι X)
 
 #print MeasureTheory.hausdorffMeasure_measurePreserving_funUnique /-
Diff
@@ -1192,7 +1192,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
       filter_upwards [B] with _ hn
       apply Finset.sum_le_sum fun i _ => _
       rw [ENNReal.rpow_nat_cast]
-      exact pow_le_pow_of_le_left' (hn i) _
+      exact pow_le_pow_left' (hn i) _
     _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
       simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
         nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
Diff
@@ -728,7 +728,7 @@ theorem hausdorffMeasure_le_liminf_sum {β : Type _} {ι : β → Type _} [hι :
 /-- If `d₁ < d₂`, then for any set `s` we have either `μH[d₂] s = 0`, or `μH[d₁] s = ∞`. -/
 theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Set X) :
     μH[d₂] s = 0 ∨ μH[d₁] s = ∞ := by
-  by_contra' H
+  by_contra! H
   suffices ∀ c : ℝ≥0, c ≠ 0 → μH[d₂] s ≤ c * μH[d₁] s
     by
     rcases ENNReal.exists_nnreal_pos_mul_lt H.2 H.1 with ⟨c, hc0, hc⟩
Diff
@@ -1215,9 +1215,8 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
 variable (ι X)
 
 #print MeasureTheory.hausdorffMeasure_measurePreserving_funUnique /-
-theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι]
-    [TopologicalSpace.SecondCountableTopology X] (d : ℝ) :
-    MeasurePreserving (MeasurableEquiv.funUnique ι X) μH[d] μH[d] :=
+theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι] [SecondCountableTopology X]
+    (d : ℝ) : MeasurePreserving (MeasurableEquiv.funUnique ι X) μH[d] μH[d] :=
   (IsometryEquiv.funUnique ι X).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_fun_unique MeasureTheory.hausdorffMeasure_measurePreserving_funUnique
 -/
@@ -1225,7 +1224,7 @@ theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι]
 #print MeasureTheory.hausdorffMeasure_measurePreserving_piFinTwo /-
 theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type _)
     [∀ i, MeasurableSpace (α i)] [∀ i, EMetricSpace (α i)] [∀ i, BorelSpace (α i)]
-    [∀ i, TopologicalSpace.SecondCountableTopology (α i)] (d : ℝ) :
+    [∀ i, SecondCountableTopology (α i)] (d : ℝ) :
     MeasurePreserving (MeasurableEquiv.piFinTwo α) μH[d] μH[d] :=
   (IsometryEquiv.piFinTwo α).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_pi_fin_two MeasureTheory.hausdorffMeasure_measurePreserving_piFinTwo
Diff
@@ -3,12 +3,12 @@ Copyright (c) 2021 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 -/
-import Mathbin.Analysis.Convex.Between
-import Mathbin.MeasureTheory.Constructions.BorelSpace.Basic
-import Mathbin.MeasureTheory.Measure.Haar.InnerProductSpace
-import Mathbin.MeasureTheory.Measure.Lebesgue.Basic
-import Mathbin.Topology.MetricSpace.Holder
-import Mathbin.Topology.MetricSpace.MetricSeparated
+import Analysis.Convex.Between
+import MeasureTheory.Constructions.BorelSpace.Basic
+import MeasureTheory.Measure.Haar.InnerProductSpace
+import MeasureTheory.Measure.Lebesgue.Basic
+import Topology.MetricSpace.Holder
+import Topology.MetricSpace.MetricSeparated
 
 #align_import measure_theory.measure.hausdorff from "leanprover-community/mathlib"@"087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197"
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
-
-! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit 087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Convex.Between
 import Mathbin.MeasureTheory.Constructions.BorelSpace.Basic
@@ -15,6 +10,8 @@ import Mathbin.MeasureTheory.Measure.Lebesgue.Basic
 import Mathbin.Topology.MetricSpace.Holder
 import Mathbin.Topology.MetricSpace.MetricSeparated
 
+#align_import measure_theory.measure.hausdorff from "leanprover-community/mathlib"@"087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197"
+
 /-!
 # Hausdorff measure and metric (outer) measures
 
Diff
@@ -148,6 +148,7 @@ namespace IsMetric
 
 variable {μ : OuterMeasure X}
 
+#print MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated /-
 /-- A metric outer measure is additive on a finite set of pairwise metric separated sets. -/
 theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {s : ι → Set X}
     (hI : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → IsMetricSeparated (s i) (s j)) :
@@ -161,6 +162,7 @@ theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {
     IsMetricSeparated.finset_iUnion_right fun j hj =>
       hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
 #align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
+-/
 
 #print MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory /-
 /-- Caratheodory theorem. If `m` is a metric outer measure, then every Borel measurable set `t` is
@@ -288,17 +290,23 @@ namespace MkMetric'
 
 variable {m : Set X → ℝ≥0∞} {r : ℝ≥0∞} {μ : OuterMeasure X} {s : Set X}
 
+#print MeasureTheory.OuterMeasure.mkMetric'.le_pre /-
 theorem le_pre : μ ≤ pre m r ↔ ∀ s : Set X, diam s ≤ r → μ s ≤ m s := by
   simp only [pre, le_bounded_by, extend, le_iInf_iff]
 #align measure_theory.outer_measure.mk_metric'.le_pre MeasureTheory.OuterMeasure.mkMetric'.le_pre
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric'.pre_le /-
 theorem pre_le (hs : diam s ≤ r) : pre m r s ≤ m s :=
   (boundedBy_le _).trans <| iInf_le _ hs
 #align measure_theory.outer_measure.mk_metric'.pre_le MeasureTheory.OuterMeasure.mkMetric'.pre_le
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric'.mono_pre /-
 theorem mono_pre (m : Set X → ℝ≥0∞) {r r' : ℝ≥0∞} (h : r ≤ r') : pre m r' ≤ pre m r :=
   le_pre.2 fun s hs => pre_le (hs.trans h)
 #align measure_theory.outer_measure.mk_metric'.mono_pre MeasureTheory.OuterMeasure.mkMetric'.mono_pre
+-/
 
 #print MeasureTheory.OuterMeasure.mkMetric'.mono_pre_nat /-
 theorem mono_pre_nat (m : Set X → ℝ≥0∞) : Monotone fun k : ℕ => pre m k⁻¹ := fun k l h =>
@@ -306,6 +314,7 @@ theorem mono_pre_nat (m : Set X → ℝ≥0∞) : Monotone fun k : ℕ => pre m
 #align measure_theory.outer_measure.mk_metric'.mono_pre_nat MeasureTheory.OuterMeasure.mkMetric'.mono_pre_nat
 -/
 
+#print MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre /-
 theorem tendsto_pre (m : Set X → ℝ≥0∞) (s : Set X) :
     Tendsto (fun r => pre m r s) (𝓝[>] 0) (𝓝 <| mkMetric' m s) :=
   by
@@ -313,7 +322,9 @@ theorem tendsto_pre (m : Set X → ℝ≥0∞) (s : Set X) :
   simp only [mk_metric', outer_measure.supr_apply, iSup_subtype']
   exact tendsto_atBot_iSup fun r r' hr => mono_pre _ hr _
 #align measure_theory.outer_measure.mk_metric'.tendsto_pre MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre_nat /-
 theorem tendsto_pre_nat (m : Set X → ℝ≥0∞) (s : Set X) :
     Tendsto (fun n : ℕ => pre m n⁻¹ s) atTop (𝓝 <| mkMetric' m s) :=
   by
@@ -321,6 +332,7 @@ theorem tendsto_pre_nat (m : Set X → ℝ≥0∞) (s : Set X) :
   refine' tendsto_principal.2 (eventually_of_forall fun n => _)
   simp
 #align measure_theory.outer_measure.mk_metric'.tendsto_pre_nat MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre_nat
+-/
 
 #print MeasureTheory.OuterMeasure.mkMetric'.eq_iSup_nat /-
 theorem eq_iSup_nat (m : Set X → ℝ≥0∞) : mkMetric' m = ⨆ n : ℕ, mkMetric'.pre m n⁻¹ :=
@@ -369,6 +381,7 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
 #align measure_theory.outer_measure.mk_metric'_is_metric MeasureTheory.OuterMeasure.mkMetric'_isMetric
 -/
 
+#print MeasureTheory.OuterMeasure.mkMetric_mono_smul /-
 /-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
 (we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mk_metric m₁ hm₁ ≤ c • mk_metric m₂ hm₂`. -/
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
@@ -388,6 +401,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
     exact ⟨zero_le _, ht.trans_lt hr'.2⟩
   · simp [h0]
 #align measure_theory.outer_measure.mk_metric_mono_smul MeasureTheory.OuterMeasure.mkMetric_mono_smul
+-/
 
 #print MeasureTheory.OuterMeasure.mkMetric_top /-
 @[simp]
@@ -400,13 +414,16 @@ theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : Ou
 #align measure_theory.outer_measure.mk_metric_top MeasureTheory.OuterMeasure.mkMetric_top
 -/
 
+#print MeasureTheory.OuterMeasure.mkMetric_mono /-
 /-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
     (mkMetric m₁ : OuterMeasure X) ≤ mkMetric m₂ := by
   convert mk_metric_mono_smul ENNReal.one_ne_top one_ne_zero _ <;> simp [*]
 #align measure_theory.outer_measure.mk_metric_mono MeasureTheory.OuterMeasure.mkMetric_mono
+-/
 
+#print MeasureTheory.OuterMeasure.isometry_comap_mkMetric /-
 theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
     (H : Monotone m ∨ Surjective f) : comap f (mkMetric m) = mkMetric m :=
   by
@@ -423,34 +440,45 @@ theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (h
     apply le_trans _ (h_mono (diam_mono hst))
     simp only [(diam_mono hst).trans ht, le_refl, ciInf_pos]
 #align measure_theory.outer_measure.isometry_comap_mk_metric MeasureTheory.OuterMeasure.isometry_comap_mkMetric
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric_smul /-
 theorem mkMetric_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0∞} (hc : c ≠ ∞) (hc' : c ≠ 0) :
     (mkMetric (c • m) : OuterMeasure X) = c • mkMetric m :=
   by
   simp only [mk_metric, mk_metric', mk_metric'.pre, induced_outer_measure, ENNReal.smul_iSup]
   simp_rw [smul_supr, smul_bounded_by hc, smul_extend _ hc', Pi.smul_apply]
 #align measure_theory.outer_measure.mk_metric_smul MeasureTheory.OuterMeasure.mkMetric_smul
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric_nnreal_smul /-
 theorem mkMetric_nnreal_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0} (hc : c ≠ 0) :
     (mkMetric (c • m) : OuterMeasure X) = c • mkMetric m := by
   rw [ENNReal.smul_def, ENNReal.smul_def,
     mk_metric_smul m ENNReal.coe_ne_top (ennreal.coe_ne_zero.mpr hc)]
 #align measure_theory.outer_measure.mk_metric_nnreal_smul MeasureTheory.OuterMeasure.mkMetric_nnreal_smul
+-/
 
+#print MeasureTheory.OuterMeasure.isometry_map_mkMetric /-
 theorem isometry_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
     (H : Monotone m ∨ Surjective f) : map f (mkMetric m) = restrict (range f) (mkMetric m) := by
   rw [← isometry_comap_mk_metric _ hf H, map_comap]
 #align measure_theory.outer_measure.isometry_map_mk_metric MeasureTheory.OuterMeasure.isometry_map_mkMetric
+-/
 
+#print MeasureTheory.OuterMeasure.isometryEquiv_comap_mkMetric /-
 theorem isometryEquiv_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (f : X ≃ᵢ Y) :
     comap f (mkMetric m) = mkMetric m :=
   isometry_comap_mkMetric _ f.Isometry (Or.inr f.Surjective)
 #align measure_theory.outer_measure.isometry_equiv_comap_mk_metric MeasureTheory.OuterMeasure.isometryEquiv_comap_mkMetric
+-/
 
+#print MeasureTheory.OuterMeasure.isometryEquiv_map_mkMetric /-
 theorem isometryEquiv_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (f : X ≃ᵢ Y) :
     map f (mkMetric m) = mkMetric m := by
   rw [← isometry_equiv_comap_mk_metric _ f, map_comap_of_surjective f.surjective]
 #align measure_theory.outer_measure.isometry_equiv_map_mk_metric MeasureTheory.OuterMeasure.isometryEquiv_map_mkMetric
+-/
 
 #print MeasureTheory.OuterMeasure.trim_mkMetric /-
 theorem trim_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ≥0∞) :
@@ -463,10 +491,12 @@ theorem trim_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ
 #align measure_theory.outer_measure.trim_mk_metric MeasureTheory.OuterMeasure.trim_mkMetric
 -/
 
+#print MeasureTheory.OuterMeasure.le_mkMetric /-
 theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : OuterMeasure X) (r : ℝ≥0∞) (h0 : 0 < r)
     (hr : ∀ s, diam s ≤ r → μ s ≤ m (diam s)) : μ ≤ mkMetric m :=
   le_iSup₂_of_le r h0 <| mkMetric'.le_pre.2 fun s hs => hr _ hs
 #align measure_theory.outer_measure.le_mk_metric MeasureTheory.OuterMeasure.le_mkMetric
+-/
 
 end OuterMeasure
 
@@ -531,6 +561,7 @@ namespace Measure
 
 variable [MeasurableSpace X] [BorelSpace X]
 
+#print MeasureTheory.Measure.mkMetric_mono_smul /-
 /-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
 (we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mk_metric m₁ hm₁ ≤ c • mk_metric m₂ hm₂`. -/
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
@@ -540,6 +571,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
   rw [← outer_measure.coe_mk_metric, coe_smul, ← outer_measure.coe_mk_metric]
   exact outer_measure.mk_metric_mono_smul hc h0 hle s
 #align measure_theory.measure.mk_metric_mono_smul MeasureTheory.Measure.mkMetric_mono_smul
+-/
 
 #print MeasureTheory.Measure.mkMetric_top /-
 @[simp]
@@ -550,13 +582,16 @@ theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : Me
 #align measure_theory.measure.mk_metric_top MeasureTheory.Measure.mkMetric_top
 -/
 
+#print MeasureTheory.Measure.mkMetric_mono /-
 /-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
     (mkMetric m₁ : Measure X) ≤ mkMetric m₂ := by
   convert mk_metric_mono_smul ENNReal.one_ne_top one_ne_zero _ <;> simp [*]
 #align measure_theory.measure.mk_metric_mono MeasureTheory.Measure.mkMetric_mono
+-/
 
+#print MeasureTheory.Measure.mkMetric_apply /-
 /-- A formula for `measure_theory.measure.mk_metric`. -/
 theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
     mkMetric m s =
@@ -585,14 +620,18 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
     rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
     exact ⟨x, hx⟩
 #align measure_theory.measure.mk_metric_apply MeasureTheory.Measure.mkMetric_apply
+-/
 
+#print MeasureTheory.Measure.le_mkMetric /-
 theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
     (h : ∀ s : Set X, diam s ≤ ε → μ s ≤ m (diam s)) : μ ≤ mkMetric m :=
   by
   rw [← to_outer_measure_le, mk_metric_to_outer_measure]
   exact outer_measure.le_mk_metric m μ.to_outer_measure ε h₀ h
 #align measure_theory.measure.le_mk_metric MeasureTheory.Measure.le_mkMetric
+-/
 
+#print MeasureTheory.Measure.mkMetric_le_liminf_tsum /-
 /-- To bound the Hausdorff measure (or, more generally, for a measure defined using
 `measure_theory.measure.mk_metric`) of a set, one may use coverings with maximum diameter tending to
 `0`, indexed by any sequence of countable types. -/
@@ -620,7 +659,9 @@ theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Count
       _ ≤ ∑' i : ι n, m (diam (t n i)) := (ENNReal.tsum_le_tsum fun b => iSup_le fun htb => le_rfl)
       _ ≤ c := hn.le
 #align measure_theory.measure.mk_metric_le_liminf_tsum MeasureTheory.Measure.mkMetric_le_liminf_tsum
+-/
 
+#print MeasureTheory.Measure.mkMetric_le_liminf_sum /-
 /-- To bound the Hausdorff measure (or, more generally, for a measure defined using
 `measure_theory.measure.mk_metric`) of a set, one may use coverings with maximum diameter tending to
 `0`, indexed by any sequence of finite types. -/
@@ -630,6 +671,7 @@ theorem mkMetric_le_liminf_sum {β : Type _} {ι : β → Type _} [hι : ∀ n,
     mkMetric m s ≤ liminf (fun n => ∑ i, m (diam (t n i))) l := by
   simpa only [tsum_fintype] using mk_metric_le_liminf_tsum s r hr t ht hst m
 #align measure_theory.measure.mk_metric_le_liminf_sum MeasureTheory.Measure.mkMetric_le_liminf_sum
+-/
 
 /-!
 ### Hausdorff measure and Hausdorff dimension
@@ -643,14 +685,16 @@ def hausdorffMeasure (d : ℝ) : Measure X :=
 #align measure_theory.measure.hausdorff_measure MeasureTheory.Measure.hausdorffMeasure
 -/
 
--- mathport name: hausdorff_measure
 scoped[MeasureTheory] notation "μH[" d "]" => MeasureTheory.Measure.hausdorffMeasure d
 
+#print MeasureTheory.Measure.le_hausdorffMeasure /-
 theorem le_hausdorffMeasure (d : ℝ) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
     (h : ∀ s : Set X, diam s ≤ ε → μ s ≤ diam s ^ d) : μ ≤ μH[d] :=
   le_mkMetric _ μ ε h₀ h
 #align measure_theory.measure.le_hausdorff_measure MeasureTheory.Measure.le_hausdorffMeasure
+-/
 
+#print MeasureTheory.Measure.hausdorffMeasure_apply /-
 /-- A formula for `μH[d] s`. -/
 theorem hausdorffMeasure_apply (d : ℝ) (s : Set X) :
     μH[d] s =
@@ -659,7 +703,9 @@ theorem hausdorffMeasure_apply (d : ℝ) (s : Set X) :
           ∑' n, ⨆ h : (t n).Nonempty, diam (t n) ^ d :=
   mkMetric_apply _ _
 #align measure_theory.measure.hausdorff_measure_apply MeasureTheory.Measure.hausdorffMeasure_apply
+-/
 
+#print MeasureTheory.Measure.hausdorffMeasure_le_liminf_tsum /-
 /-- To bound the Hausdorff measure of a set, one may use coverings with maximum diameter tending
 to `0`, indexed by any sequence of countable types. -/
 theorem hausdorffMeasure_le_liminf_tsum {β : Type _} {ι : β → Type _} [hι : ∀ n, Countable (ι n)]
@@ -668,7 +714,9 @@ theorem hausdorffMeasure_le_liminf_tsum {β : Type _} {ι : β → Type _} [hι
     (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) : μH[d] s ≤ liminf (fun n => ∑' i, diam (t n i) ^ d) l :=
   mkMetric_le_liminf_tsum s r hr t ht hst _
 #align measure_theory.measure.hausdorff_measure_le_liminf_tsum MeasureTheory.Measure.hausdorffMeasure_le_liminf_tsum
+-/
 
+#print MeasureTheory.Measure.hausdorffMeasure_le_liminf_sum /-
 /-- To bound the Hausdorff measure of a set, one may use coverings with maximum diameter tending
 to `0`, indexed by any sequence of finite types. -/
 theorem hausdorffMeasure_le_liminf_sum {β : Type _} {ι : β → Type _} [hι : ∀ n, Fintype (ι n)]
@@ -677,7 +725,9 @@ theorem hausdorffMeasure_le_liminf_sum {β : Type _} {ι : β → Type _} [hι :
     (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) : μH[d] s ≤ liminf (fun n => ∑ i, diam (t n i) ^ d) l :=
   mkMetric_le_liminf_sum s r hr t ht hst _
 #align measure_theory.measure.hausdorff_measure_le_liminf_sum MeasureTheory.Measure.hausdorffMeasure_le_liminf_sum
+-/
 
+#print MeasureTheory.Measure.hausdorffMeasure_zero_or_top /-
 /-- If `d₁ < d₂`, then for any set `s` we have either `μH[d₂] s = 0`, or `μH[d₁] s = ∞`. -/
 theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Set X) :
     μH[d₂] s = 0 ∨ μH[d₁] s = ∞ := by
@@ -710,7 +760,9 @@ theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Se
     rw [← ENNReal.rpow_mul, inv_mul_cancel (sub_pos.2 h).ne', ENNReal.rpow_one]
     exact le_rfl
 #align measure_theory.measure.hausdorff_measure_zero_or_top MeasureTheory.Measure.hausdorffMeasure_zero_or_top
+-/
 
+#print MeasureTheory.Measure.hausdorffMeasure_mono /-
 /-- Hausdorff measure `μH[d] s` is monotone in `d`. -/
 theorem hausdorffMeasure_mono {d₁ d₂ : ℝ} (h : d₁ ≤ d₂) (s : Set X) : μH[d₂] s ≤ μH[d₁] s :=
   by
@@ -719,9 +771,11 @@ theorem hausdorffMeasure_mono {d₁ d₂ : ℝ} (h : d₁ ≤ d₂) (s : Set X)
   · rw [hs]; exact zero_le _
   · rw [hs]; exact le_top
 #align measure_theory.measure.hausdorff_measure_mono MeasureTheory.Measure.hausdorffMeasure_mono
+-/
 
 variable (X)
 
+#print MeasureTheory.Measure.noAtoms_hausdorff /-
 theorem noAtoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d : Measure X) :=
   by
   refine' ⟨fun x => _⟩
@@ -731,6 +785,7 @@ theorem noAtoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d :
   · simp only [EMetric.diam_singleton, zero_le]
   · simp [hd]
 #align measure_theory.measure.no_atoms_hausdorff MeasureTheory.Measure.noAtoms_hausdorff
+-/
 
 variable {X}
 
@@ -764,6 +819,7 @@ theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 :=
 #align measure_theory.measure.hausdorff_measure_zero_singleton MeasureTheory.Measure.hausdorffMeasure_zero_singleton
 -/
 
+#print MeasureTheory.Measure.one_le_hausdorffMeasure_zero_of_nonempty /-
 theorem one_le_hausdorffMeasure_zero_of_nonempty {s : Set X} (h : s.Nonempty) : 1 ≤ μH[0] s :=
   by
   rcases h with ⟨x, hx⟩
@@ -771,7 +827,9 @@ theorem one_le_hausdorffMeasure_zero_of_nonempty {s : Set X} (h : s.Nonempty) :
     (1 : ℝ≥0∞) = μH[0] ({x} : Set X) := (hausdorff_measure_zero_singleton x).symm
     _ ≤ μH[0] s := measure_mono (singleton_subset_iff.2 hx)
 #align measure_theory.measure.one_le_hausdorff_measure_zero_of_nonempty MeasureTheory.Measure.one_le_hausdorffMeasure_zero_of_nonempty
+-/
 
+#print MeasureTheory.Measure.hausdorffMeasure_le_one_of_subsingleton /-
 theorem hausdorffMeasure_le_one_of_subsingleton {s : Set X} (hs : s.Subsingleton) {d : ℝ}
     (hd : 0 ≤ d) : μH[d] s ≤ 1 :=
   by
@@ -783,6 +841,7 @@ theorem hausdorffMeasure_le_one_of_subsingleton {s : Set X} (hs : s.Subsingleton
     · haveI := no_atoms_hausdorff X dpos
       simp only [zero_le, measure_singleton]
 #align measure_theory.measure.hausdorff_measure_le_one_of_subsingleton MeasureTheory.Measure.hausdorffMeasure_le_one_of_subsingleton
+-/
 
 end Measure
 
@@ -803,6 +862,7 @@ namespace HolderOnWith
 
 variable {C r : ℝ≥0} {f : X → Y} {s t : Set X}
 
+#print HolderOnWith.hausdorffMeasure_image_le /-
 /-- If `f : X → Y` is Hölder continuous on `s` with a positive exponent `r`, then
 `μH[d] (f '' s) ≤ C ^ d * μH[r * d] s`. -/
 theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : ℝ} (hd : 0 ≤ d) :
@@ -847,6 +907,7 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
       rw [ENNReal.rpow_mul, ← ENNReal.mul_rpow_of_nonneg _ _ hd]
       exact ENNReal.rpow_le_rpow (h.ediam_image_inter_le _) hd
 #align holder_on_with.hausdorff_measure_image_le HolderOnWith.hausdorffMeasure_image_le
+-/
 
 end HolderOnWith
 
@@ -854,12 +915,14 @@ namespace LipschitzOnWith
 
 variable {K : ℝ≥0} {f : X → Y} {s t : Set X}
 
+#print LipschitzOnWith.hausdorffMeasure_image_le /-
 /-- If `f : X → Y` is `K`-Lipschitz on `s`, then `μH[d] (f '' s) ≤ K ^ d * μH[d] s`. -/
 theorem hausdorffMeasure_image_le (h : LipschitzOnWith K f s) {d : ℝ} (hd : 0 ≤ d) :
     μH[d] (f '' s) ≤ K ^ d * μH[d] s := by
   simpa only [NNReal.coe_one, one_mul] using
     h.holder_on_with.hausdorff_measure_image_le zero_lt_one hd
 #align lipschitz_on_with.hausdorff_measure_image_le LipschitzOnWith.hausdorffMeasure_image_le
+-/
 
 end LipschitzOnWith
 
@@ -867,17 +930,20 @@ namespace LipschitzWith
 
 variable {K : ℝ≥0} {f : X → Y}
 
+#print LipschitzWith.hausdorffMeasure_image_le /-
 /-- If `f` is a `K`-Lipschitz map, then it increases the Hausdorff `d`-measures of sets at most
 by the factor of `K ^ d`.-/
 theorem hausdorffMeasure_image_le (h : LipschitzWith K f) {d : ℝ} (hd : 0 ≤ d) (s : Set X) :
     μH[d] (f '' s) ≤ K ^ d * μH[d] s :=
   (h.LipschitzOnWith s).hausdorffMeasure_image_le hd
 #align lipschitz_with.hausdorff_measure_image_le LipschitzWith.hausdorffMeasure_image_le
+-/
 
 end LipschitzWith
 
 open scoped Pointwise
 
+#print MeasureTheory.Measure.hausdorffMeasure_smul₀ /-
 theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type _} [NormedAddCommGroup E]
     [NormedField 𝕜] [NormedSpace 𝕜 E] [MeasurableSpace E] [BorelSpace E] {d : ℝ} (hd : 0 ≤ d)
     {r : 𝕜} (hr : r ≠ 0) (s : Set E) : μH[d] (r • s) = ‖r‖₊ ^ d • μH[d] s :=
@@ -893,6 +959,7 @@ theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type _} [Normed
   simpa only [ENNReal.smul_def, smul_eq_mul, ← ENNReal.coe_rpow_of_nonneg _ hd] using
     (@lipschitzWith_smul _ E _ _ _ _ r).hausdorffMeasure_image_le hd s
 #align measure_theory.measure.hausdorff_measure_smul₀ MeasureTheory.Measure.hausdorffMeasure_smul₀
+-/
 
 /-!
 ### Antilipschitz maps do not decrease Hausdorff measures and dimension
@@ -903,6 +970,7 @@ namespace AntilipschitzWith
 
 variable {f : X → Y} {K : ℝ≥0} {d : ℝ}
 
+#print AntilipschitzWith.hausdorffMeasure_preimage_le /-
 theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d) (s : Set Y) :
     μH[d] (f ⁻¹' s) ≤ K ^ d * μH[d] s :=
   by
@@ -935,13 +1003,16 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
     rw [← ENNReal.mul_rpow_of_nonneg _ _ hd]
     exact ENNReal.rpow_le_rpow (hf.ediam_preimage_le _) hd
 #align antilipschitz_with.hausdorff_measure_preimage_le AntilipschitzWith.hausdorffMeasure_preimage_le
+-/
 
+#print AntilipschitzWith.le_hausdorffMeasure_image /-
 theorem le_hausdorffMeasure_image (hf : AntilipschitzWith K f) (hd : 0 ≤ d) (s : Set X) :
     μH[d] s ≤ K ^ d * μH[d] (f '' s) :=
   calc
     μH[d] s ≤ μH[d] (f ⁻¹' (f '' s)) := measure_mono (subset_preimage_image _ _)
     _ ≤ K ^ d * μH[d] (f '' s) := hf.hausdorffMeasure_preimage_le hd (f '' s)
 #align antilipschitz_with.le_hausdorff_measure_image AntilipschitzWith.le_hausdorffMeasure_image
+-/
 
 end AntilipschitzWith
 
@@ -954,6 +1025,7 @@ namespace Isometry
 
 variable {f : X → Y} {d : ℝ}
 
+#print Isometry.hausdorffMeasure_image /-
 theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
     μH[d] (f '' s) = μH[d] s :=
   by
@@ -961,52 +1033,67 @@ theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f)
   rw [outer_measure.isometry_comap_mk_metric _ hf (hd.imp_left _)]
   exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
 #align isometry.hausdorff_measure_image Isometry.hausdorffMeasure_image
+-/
 
+#print Isometry.hausdorffMeasure_preimage /-
 theorem hausdorffMeasure_preimage (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set Y) :
     μH[d] (f ⁻¹' s) = μH[d] (s ∩ range f) := by
   rw [← hf.hausdorff_measure_image hd, image_preimage_eq_inter_range]
 #align isometry.hausdorff_measure_preimage Isometry.hausdorffMeasure_preimage
+-/
 
+#print Isometry.map_hausdorffMeasure /-
 theorem map_hausdorffMeasure (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) :
     Measure.map f μH[d] = μH[d].restrict (range f) :=
   by
   ext1 s hs
   rw [map_apply hf.continuous.measurable hs, restrict_apply hs, hf.hausdorff_measure_preimage hd]
 #align isometry.map_hausdorff_measure Isometry.map_hausdorffMeasure
+-/
 
 end Isometry
 
 namespace IsometryEquiv
 
+#print IsometryEquiv.hausdorffMeasure_image /-
 @[simp]
 theorem hausdorffMeasure_image (e : X ≃ᵢ Y) (d : ℝ) (s : Set X) : μH[d] (e '' s) = μH[d] s :=
   e.Isometry.hausdorffMeasure_image (Or.inr e.Surjective) s
 #align isometry_equiv.hausdorff_measure_image IsometryEquiv.hausdorffMeasure_image
+-/
 
+#print IsometryEquiv.hausdorffMeasure_preimage /-
 @[simp]
 theorem hausdorffMeasure_preimage (e : X ≃ᵢ Y) (d : ℝ) (s : Set Y) : μH[d] (e ⁻¹' s) = μH[d] s := by
   rw [← e.image_symm, e.symm.hausdorff_measure_image]
 #align isometry_equiv.hausdorff_measure_preimage IsometryEquiv.hausdorffMeasure_preimage
+-/
 
+#print IsometryEquiv.map_hausdorffMeasure /-
 @[simp]
 theorem map_hausdorffMeasure (e : X ≃ᵢ Y) (d : ℝ) : Measure.map e μH[d] = μH[d] := by
   rw [e.isometry.map_hausdorff_measure (Or.inr e.surjective), e.surjective.range_eq, restrict_univ]
 #align isometry_equiv.map_hausdorff_measure IsometryEquiv.map_hausdorffMeasure
+-/
 
+#print IsometryEquiv.measurePreserving_hausdorffMeasure /-
 theorem measurePreserving_hausdorffMeasure (e : X ≃ᵢ Y) (d : ℝ) : MeasurePreserving e μH[d] μH[d] :=
   ⟨e.Continuous.Measurable, map_hausdorffMeasure _ _⟩
 #align isometry_equiv.measure_preserving_hausdorff_measure IsometryEquiv.measurePreserving_hausdorffMeasure
+-/
 
 end IsometryEquiv
 
 namespace MeasureTheory
 
+#print MeasureTheory.hausdorffMeasure_smul /-
 @[to_additive]
 theorem hausdorffMeasure_smul {α : Type _} [SMul α X] [IsometricSMul α X] {d : ℝ} (c : α)
     (h : 0 ≤ d ∨ Surjective ((· • ·) c : X → X)) (s : Set X) : μH[d] (c • s) = μH[d] s :=
   (isometry_smul X c).hausdorffMeasure_image h _
 #align measure_theory.hausdorff_measure_smul MeasureTheory.hausdorffMeasure_smul
 #align measure_theory.hausdorff_measure_vadd MeasureTheory.hausdorffMeasure_vadd
+-/
 
 @[to_additive]
 instance {d : ℝ} [Group X] [IsometricSMul X X] : IsMulLeftInvariant (μH[d] : Measure X)
@@ -1130,18 +1217,22 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
 
 variable (ι X)
 
+#print MeasureTheory.hausdorffMeasure_measurePreserving_funUnique /-
 theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι]
     [TopologicalSpace.SecondCountableTopology X] (d : ℝ) :
     MeasurePreserving (MeasurableEquiv.funUnique ι X) μH[d] μH[d] :=
   (IsometryEquiv.funUnique ι X).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_fun_unique MeasureTheory.hausdorffMeasure_measurePreserving_funUnique
+-/
 
+#print MeasureTheory.hausdorffMeasure_measurePreserving_piFinTwo /-
 theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type _)
     [∀ i, MeasurableSpace (α i)] [∀ i, EMetricSpace (α i)] [∀ i, BorelSpace (α i)]
     [∀ i, TopologicalSpace.SecondCountableTopology (α i)] (d : ℝ) :
     MeasurePreserving (MeasurableEquiv.piFinTwo α) μH[d] μH[d] :=
   (IsometryEquiv.piFinTwo α).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_pi_fin_two MeasureTheory.hausdorffMeasure_measurePreserving_piFinTwo
+-/
 
 #print MeasureTheory.hausdorffMeasure_real /-
 /-- In the space `ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@@ -1201,8 +1292,7 @@ variable [NormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [Measura
 
 variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
 
-include E
-
+#print MeasureTheory.hausdorffMeasure_homothety_image /-
 /-- Scaling by `c` around `x` scales the measure by `‖c‖₊ ^ d`. -/
 theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
     (s : Set P) : μH[d] (AffineMap.homothety x c '' s) = ‖c‖₊ ^ d • μH[d] s :=
@@ -1215,7 +1305,9 @@ theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 
   rw [IsometryEquiv.hausdorffMeasure_image, Set.image_smul, measure.hausdorff_measure_smul₀ hd hc,
     IsometryEquiv.hausdorffMeasure_image]
 #align measure_theory.hausdorff_measure_homothety_image MeasureTheory.hausdorffMeasure_homothety_image
+-/
 
+#print MeasureTheory.hausdorffMeasure_homothety_preimage /-
 theorem hausdorffMeasure_homothety_preimage {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
     (s : Set P) : μH[d] (AffineMap.homothety x c ⁻¹' s) = ‖c‖₊⁻¹ ^ d • μH[d] s :=
   by
@@ -1224,6 +1316,7 @@ theorem hausdorffMeasure_homothety_preimage {d : ℝ} (hd : 0 ≤ d) (x : P) {c
     hausdorff_measure_homothety_image hd x (_ : 𝕜ˣ).IsUnit.NeZero, Units.val_inv_eq_inv_val,
     Units.val_mk0, nnnorm_inv]
 #align measure_theory.hausdorff_measure_homothety_preimage MeasureTheory.hausdorffMeasure_homothety_preimage
+-/
 
 /-! TODO: prove `measure.map (affine_map.homothety x c) μH[d] = ‖c‖₊⁻¹ ^ d • μH[d]`, which needs a
 more general version of `affine_map.homothety_continuous` -/
@@ -1237,8 +1330,6 @@ variable [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace P]
 
 variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
 
-include E
-
 #print MeasureTheory.hausdorffMeasure_lineMap_image /-
 /-- Mapping a set of reals along a line segment scales the measure by the length of a segment.
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit 3d5c4a7a5fb0d982f97ed953161264f1dbd90ead
+! leanprover-community/mathlib commit 087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -18,6 +18,9 @@ import Mathbin.Topology.MetricSpace.MetricSeparated
 /-!
 # Hausdorff measure and metric (outer) measures
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we define the `d`-dimensional Hausdorff measure on an (extended) metric space `X` and
 the Hausdorff dimension of a set in an (extended) metric space. Let `μ d δ` be the maximal outer
 measure such that `μ d δ s ≤ (emetric.diam s) ^ d` for every set of diameter less than `δ`. Then
Diff
@@ -133,11 +133,13 @@ measure has the Caratheodory property.
 -/
 
 
+#print MeasureTheory.OuterMeasure.IsMetric /-
 /-- We say that an outer measure `μ` in an (e)metric space is *metric* if `μ (s ∪ t) = μ s + μ t`
 for any two metric separated sets `s`, `t`. -/
 def IsMetric (μ : OuterMeasure X) : Prop :=
   ∀ s t : Set X, IsMetricSeparated s t → μ (s ∪ t) = μ s + μ t
 #align measure_theory.outer_measure.is_metric MeasureTheory.OuterMeasure.IsMetric
+-/
 
 namespace IsMetric
 
@@ -157,6 +159,7 @@ theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {
       hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
 #align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
 
+#print MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory /-
 /-- Caratheodory theorem. If `m` is a metric outer measure, then every Borel measurable set `t` is
 Caratheodory measurable: for any (not necessarily measurable) set `s` we have
 `μ (s ∩ t) + μ (s \ t) = μ s`. -/
@@ -231,11 +234,14 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   refine' (add_le_add le_rfl hyz.le).trans (Eq.trans_le _ hxz)
   rw [tsub_add_cancel_of_le A.le]
 #align measure_theory.outer_measure.is_metric.borel_le_caratheodory MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory
+-/
 
+#print MeasureTheory.OuterMeasure.IsMetric.le_caratheodory /-
 theorem le_caratheodory [MeasurableSpace X] [BorelSpace X] (hm : IsMetric μ) :
     ‹MeasurableSpace X› ≤ μ.caratheodory := by rw [@BorelSpace.measurable_eq X _ _];
   exact hm.borel_le_caratheodory
 #align measure_theory.outer_measure.is_metric.le_caratheodory MeasureTheory.OuterMeasure.IsMetric.le_caratheodory
+-/
 
 end IsMetric
 
@@ -248,26 +254,32 @@ measures. We also prove basic lemmas about `map`/`comap` of these measures.
 -/
 
 
+#print MeasureTheory.OuterMeasure.mkMetric'.pre /-
 /-- Auxiliary definition for `outer_measure.mk_metric'`: given a function on sets
 `m : set X → ℝ≥0∞`, returns the maximal outer measure `μ` such that `μ s ≤ m s`
 for any set `s` of diameter at most `r`.-/
-def MkMetric'.pre (m : Set X → ℝ≥0∞) (r : ℝ≥0∞) : OuterMeasure X :=
+def mkMetric'.pre (m : Set X → ℝ≥0∞) (r : ℝ≥0∞) : OuterMeasure X :=
   boundedBy <| extend fun s (hs : diam s ≤ r) => m s
-#align measure_theory.outer_measure.mk_metric'.pre MeasureTheory.OuterMeasure.MkMetric'.pre
+#align measure_theory.outer_measure.mk_metric'.pre MeasureTheory.OuterMeasure.mkMetric'.pre
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric' /-
 /-- Given a function `m : set X → ℝ≥0∞`, `mk_metric' m` is the supremum of `mk_metric'.pre m r`
 over `r > 0`. Equivalently, it is the limit of `mk_metric'.pre m r` as `r` tends to zero from
 the right. -/
 def mkMetric' (m : Set X → ℝ≥0∞) : OuterMeasure X :=
-  ⨆ r > 0, MkMetric'.pre m r
+  ⨆ r > 0, mkMetric'.pre m r
 #align measure_theory.outer_measure.mk_metric' MeasureTheory.OuterMeasure.mkMetric'
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric /-
 /-- Given a function `m : ℝ≥0∞ → ℝ≥0∞` and `r > 0`, let `μ r` be the maximal outer measure such that
 `μ s ≤ m (emetric.diam s)` whenever `emetric.diam s < r`. Then
 `mk_metric m = ⨆ r > 0, μ r`. -/
 def mkMetric (m : ℝ≥0∞ → ℝ≥0∞) : OuterMeasure X :=
   mkMetric' fun s => m (diam s)
 #align measure_theory.outer_measure.mk_metric MeasureTheory.OuterMeasure.mkMetric
+-/
 
 namespace MkMetric'
 
@@ -285,9 +297,11 @@ theorem mono_pre (m : Set X → ℝ≥0∞) {r r' : ℝ≥0∞} (h : r ≤ r') :
   le_pre.2 fun s hs => pre_le (hs.trans h)
 #align measure_theory.outer_measure.mk_metric'.mono_pre MeasureTheory.OuterMeasure.mkMetric'.mono_pre
 
+#print MeasureTheory.OuterMeasure.mkMetric'.mono_pre_nat /-
 theorem mono_pre_nat (m : Set X → ℝ≥0∞) : Monotone fun k : ℕ => pre m k⁻¹ := fun k l h =>
   le_pre.2 fun s hs => pre_le (hs.trans <| by simpa)
 #align measure_theory.outer_measure.mk_metric'.mono_pre_nat MeasureTheory.OuterMeasure.mkMetric'.mono_pre_nat
+-/
 
 theorem tendsto_pre (m : Set X → ℝ≥0∞) (s : Set X) :
     Tendsto (fun r => pre m r s) (𝓝[>] 0) (𝓝 <| mkMetric' m s) :=
@@ -305,7 +319,8 @@ theorem tendsto_pre_nat (m : Set X → ℝ≥0∞) (s : Set X) :
   simp
 #align measure_theory.outer_measure.mk_metric'.tendsto_pre_nat MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre_nat
 
-theorem eq_iSup_nat (m : Set X → ℝ≥0∞) : mkMetric' m = ⨆ n : ℕ, MkMetric'.pre m n⁻¹ :=
+#print MeasureTheory.OuterMeasure.mkMetric'.eq_iSup_nat /-
+theorem eq_iSup_nat (m : Set X → ℝ≥0∞) : mkMetric' m = ⨆ n : ℕ, mkMetric'.pre m n⁻¹ :=
   by
   ext1 s
   rw [iSup_apply]
@@ -313,7 +328,9 @@ theorem eq_iSup_nat (m : Set X → ℝ≥0∞) : mkMetric' m = ⨆ n : ℕ, MkMe
     tendsto_nhds_unique (mk_metric'.tendsto_pre_nat m s)
       (tendsto_atTop_iSup fun k l hkl => mk_metric'.mono_pre_nat m hkl s)
 #align measure_theory.outer_measure.mk_metric'.eq_supr_nat MeasureTheory.OuterMeasure.mkMetric'.eq_iSup_nat
+-/
 
+#print MeasureTheory.OuterMeasure.mkMetric'.trim_pre /-
 /-- `measure_theory.outer_measure.mk_metric'.pre m r` is a trimmed measure provided that
 `m (closure s) = m s` for any set `s`. -/
 theorem trim_pre [MeasurableSpace X] [OpensMeasurableSpace X] (m : Set X → ℝ≥0∞)
@@ -327,9 +344,11 @@ theorem trim_pre [MeasurableSpace X] [OpensMeasurableSpace X] (m : Set X → ℝ
         iInf_le_of_le measurableSet_closure ((pre_le _).trans_eq (hcl _))
   rwa [diam_closure]
 #align measure_theory.outer_measure.mk_metric'.trim_pre MeasureTheory.OuterMeasure.mkMetric'.trim_pre
+-/
 
 end MkMetric'
 
+#print MeasureTheory.OuterMeasure.mkMetric'_isMetric /-
 /-- An outer measure constructed using `outer_measure.mk_metric'` is a metric outer measure. -/
 theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :=
   by
@@ -345,6 +364,7 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
   have : ε < diam u := εr.trans_le ((hr x hxs y hyt).trans <| edist_le_diam_of_mem hxu hyu)
   exact iInf_eq_top.2 fun h => (this.not_le h).elim
 #align measure_theory.outer_measure.mk_metric'_is_metric MeasureTheory.OuterMeasure.mkMetric'_isMetric
+-/
 
 /-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
 (we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mk_metric m₁ hm₁ ≤ c • mk_metric m₂ hm₂`. -/
@@ -366,6 +386,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
   · simp [h0]
 #align measure_theory.outer_measure.mk_metric_mono_smul MeasureTheory.OuterMeasure.mkMetric_mono_smul
 
+#print MeasureTheory.OuterMeasure.mkMetric_top /-
 @[simp]
 theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : OuterMeasure X) = ⊤ :=
   by
@@ -374,6 +395,7 @@ theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : Ou
   intro b hb
   simpa using hb ⊤
 #align measure_theory.outer_measure.mk_metric_top MeasureTheory.OuterMeasure.mkMetric_top
+-/
 
 /-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
@@ -406,11 +428,11 @@ theorem mkMetric_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0∞} (hc : c 
   simp_rw [smul_supr, smul_bounded_by hc, smul_extend _ hc', Pi.smul_apply]
 #align measure_theory.outer_measure.mk_metric_smul MeasureTheory.OuterMeasure.mkMetric_smul
 
-theorem mkMetric_nNReal_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0} (hc : c ≠ 0) :
+theorem mkMetric_nnreal_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0} (hc : c ≠ 0) :
     (mkMetric (c • m) : OuterMeasure X) = c • mkMetric m := by
   rw [ENNReal.smul_def, ENNReal.smul_def,
     mk_metric_smul m ENNReal.coe_ne_top (ennreal.coe_ne_zero.mpr hc)]
-#align measure_theory.outer_measure.mk_metric_nnreal_smul MeasureTheory.OuterMeasure.mkMetric_nNReal_smul
+#align measure_theory.outer_measure.mk_metric_nnreal_smul MeasureTheory.OuterMeasure.mkMetric_nnreal_smul
 
 theorem isometry_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
     (H : Monotone m ∨ Surjective f) : map f (mkMetric m) = restrict (range f) (mkMetric m) := by
@@ -427,6 +449,7 @@ theorem isometryEquiv_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (f : X ≃ᵢ
   rw [← isometry_equiv_comap_mk_metric _ f, map_comap_of_surjective f.surjective]
 #align measure_theory.outer_measure.isometry_equiv_map_mk_metric MeasureTheory.OuterMeasure.isometryEquiv_map_mkMetric
 
+#print MeasureTheory.OuterMeasure.trim_mkMetric /-
 theorem trim_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ≥0∞) :
     (mkMetric m : OuterMeasure X).trim = mkMetric m :=
   by
@@ -435,6 +458,7 @@ theorem trim_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ
   refine' mk_metric'.trim_pre _ (fun s => _) _
   simp
 #align measure_theory.outer_measure.trim_mk_metric MeasureTheory.OuterMeasure.trim_mkMetric
+-/
 
 theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : OuterMeasure X) (r : ℝ≥0∞) (h0 : 0 < r)
     (hr : ∀ s, diam s ≤ r → μ s ≤ m (diam s)) : μ ≤ mkMetric m :=
@@ -457,38 +481,48 @@ namespace Measure
 
 variable [MeasurableSpace X] [BorelSpace X]
 
+#print MeasureTheory.Measure.mkMetric' /-
 /-- Given a function `m : set X → ℝ≥0∞`, `mk_metric' m` is the supremum of `μ r`
 over `r > 0`, where `μ r` is the maximal outer measure `μ` such that `μ s ≤ m s`
 for all `s`. While each `μ r` is an *outer* measure, the supremum is a measure. -/
 def mkMetric' (m : Set X → ℝ≥0∞) : Measure X :=
   (OuterMeasure.mkMetric' m).toMeasure (OuterMeasure.mkMetric'_isMetric _).le_caratheodory
 #align measure_theory.measure.mk_metric' MeasureTheory.Measure.mkMetric'
+-/
 
+#print MeasureTheory.Measure.mkMetric /-
 /-- Given a function `m : ℝ≥0∞ → ℝ≥0∞`, `mk_metric m` is the supremum of `μ r` over `r > 0`, where
 `μ r` is the maximal outer measure `μ` such that `μ s ≤ m s` for all sets `s` that contain at least
 two points. While each `mk_metric'.pre` is an *outer* measure, the supremum is a measure. -/
 def mkMetric (m : ℝ≥0∞ → ℝ≥0∞) : Measure X :=
   (OuterMeasure.mkMetric m).toMeasure (OuterMeasure.mkMetric'_isMetric _).le_caratheodory
 #align measure_theory.measure.mk_metric MeasureTheory.Measure.mkMetric
+-/
 
+#print MeasureTheory.Measure.mkMetric'_toOuterMeasure /-
 @[simp]
 theorem mkMetric'_toOuterMeasure (m : Set X → ℝ≥0∞) :
     (mkMetric' m).toOuterMeasure = (OuterMeasure.mkMetric' m).trim :=
   rfl
 #align measure_theory.measure.mk_metric'_to_outer_measure MeasureTheory.Measure.mkMetric'_toOuterMeasure
+-/
 
+#print MeasureTheory.Measure.mkMetric_toOuterMeasure /-
 @[simp]
 theorem mkMetric_toOuterMeasure (m : ℝ≥0∞ → ℝ≥0∞) :
     (mkMetric m : Measure X).toOuterMeasure = OuterMeasure.mkMetric m :=
   OuterMeasure.trim_mkMetric m
 #align measure_theory.measure.mk_metric_to_outer_measure MeasureTheory.Measure.mkMetric_toOuterMeasure
+-/
 
 end Measure
 
+#print MeasureTheory.OuterMeasure.coe_mkMetric /-
 theorem OuterMeasure.coe_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ≥0∞) :
     ⇑(OuterMeasure.mkMetric m : OuterMeasure X) = Measure.mkMetric m := by
   rw [← measure.mk_metric_to_outer_measure, coe_to_outer_measure]
 #align measure_theory.outer_measure.coe_mk_metric MeasureTheory.OuterMeasure.coe_mkMetric
+-/
 
 namespace Measure
 
@@ -504,12 +538,14 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
   exact outer_measure.mk_metric_mono_smul hc h0 hle s
 #align measure_theory.measure.mk_metric_mono_smul MeasureTheory.Measure.mkMetric_mono_smul
 
+#print MeasureTheory.Measure.mkMetric_top /-
 @[simp]
 theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : Measure X) = ⊤ :=
   by
   apply to_outer_measure_injective
   rw [mk_metric_to_outer_measure, outer_measure.mk_metric_top, to_outer_measure_top]
 #align measure_theory.measure.mk_metric_top MeasureTheory.Measure.mkMetric_top
+-/
 
 /-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
@@ -597,10 +633,12 @@ theorem mkMetric_le_liminf_sum {β : Type _} {ι : β → Type _} [hι : ∀ n,
 -/
 
 
+#print MeasureTheory.Measure.hausdorffMeasure /-
 /-- Hausdorff measure on an (e)metric space. -/
 def hausdorffMeasure (d : ℝ) : Measure X :=
   mkMetric fun r => r ^ d
 #align measure_theory.measure.hausdorff_measure MeasureTheory.Measure.hausdorffMeasure
+-/
 
 -- mathport name: hausdorff_measure
 scoped[MeasureTheory] notation "μH[" d "]" => MeasureTheory.Measure.hausdorffMeasure d
@@ -681,7 +719,7 @@ theorem hausdorffMeasure_mono {d₁ d₂ : ℝ} (h : d₁ ≤ d₂) (s : Set X)
 
 variable (X)
 
-theorem no_atoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d : Measure X) :=
+theorem noAtoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d : Measure X) :=
   by
   refine' ⟨fun x => _⟩
   rw [← nonpos_iff_eq_zero, hausdorff_measure_apply]
@@ -689,10 +727,11 @@ theorem no_atoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d
   · exact subset_Union (fun n => {x} : ℕ → Set X) 0
   · simp only [EMetric.diam_singleton, zero_le]
   · simp [hd]
-#align measure_theory.measure.no_atoms_hausdorff MeasureTheory.Measure.no_atoms_hausdorff
+#align measure_theory.measure.no_atoms_hausdorff MeasureTheory.Measure.noAtoms_hausdorff
 
 variable {X}
 
+#print MeasureTheory.Measure.hausdorffMeasure_zero_singleton /-
 @[simp]
 theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 :=
   by
@@ -720,6 +759,7 @@ theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 :=
       (1 : ℝ≥0∞) = ⨆ h : (t m).Nonempty, 1 := by simp only [A, ciSup_pos]
       _ ≤ ∑' n, ⨆ h : (t n).Nonempty, 1 := ENNReal.le_tsum _
 #align measure_theory.measure.hausdorff_measure_zero_singleton MeasureTheory.Measure.hausdorffMeasure_zero_singleton
+-/
 
 theorem one_le_hausdorffMeasure_zero_of_nonempty {s : Set X} (h : s.Nonempty) : 1 ≤ μH[0] s :=
   by
@@ -980,6 +1020,7 @@ instance {d : ℝ} [Group X] [IsometricSMul Xᵐᵒᵖ X] : IsMulRightInvariant
 
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic filter.is_bounded_default -/
+#print MeasureTheory.hausdorffMeasure_pi_real /-
 /-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
 @[simp]
 theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
@@ -1082,6 +1123,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
           ENNReal.ofReal_coe_nat]
       · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
+-/
 
 variable (ι X)
 
@@ -1098,6 +1140,7 @@ theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type _)
   (IsometryEquiv.piFinTwo α).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_pi_fin_two MeasureTheory.hausdorffMeasure_measurePreserving_piFinTwo
 
+#print MeasureTheory.hausdorffMeasure_real /-
 /-- In the space `ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
 @[simp]
 theorem hausdorffMeasure_real : (μH[1] : Measure ℝ) = volume := by
@@ -1105,7 +1148,9 @@ theorem hausdorffMeasure_real : (μH[1] : Measure ℝ) = volume := by
     (hausdorff_measure_measure_preserving_fun_unique Unit ℝ 1).map_eq, ← hausdorff_measure_pi_real,
     Fintype.card_unit, Nat.cast_one]
 #align measure_theory.hausdorff_measure_real MeasureTheory.hausdorffMeasure_real
+-/
 
+#print MeasureTheory.hausdorffMeasure_prod_real /-
 /-- In the space `ℝ × ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
 @[simp]
 theorem hausdorffMeasure_prod_real : (μH[2] : Measure (ℝ × ℝ)) = volume := by
@@ -1113,6 +1158,7 @@ theorem hausdorffMeasure_prod_real : (μH[2] : Measure (ℝ × ℝ)) = volume :=
     (hausdorff_measure_measure_preserving_pi_fin_two (fun i => ℝ) _).map_eq, ←
     hausdorff_measure_pi_real, Fintype.card_fin, Nat.cast_two]
 #align measure_theory.hausdorff_measure_prod_real MeasureTheory.hausdorffMeasure_prod_real
+-/
 
 /-! ### Geometric results in affine spaces -/
 
@@ -1121,6 +1167,7 @@ section Geometric
 
 variable {𝕜 E P : Type _}
 
+#print MeasureTheory.hausdorffMeasure_smul_right_image /-
 theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace ℝ E]
     [MeasurableSpace E] [BorelSpace E] (v : E) (s : Set ℝ) :
     μH[1] ((fun r => r • v) '' s) = ‖v‖₊ • μH[1] s :=
@@ -1143,6 +1190,7 @@ theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace 
   rw [Set.image_smul, measure.hausdorff_measure_smul₀ zero_le_one hn, nnnorm_norm, NNReal.rpow_one,
     iso_smul.hausdorff_measure_image (Or.inl <| zero_le_one' ℝ)]
 #align measure_theory.hausdorff_measure_smul_right_image MeasureTheory.hausdorffMeasure_smul_right_image
+-/
 
 section NormedFieldAffine
 
@@ -1188,6 +1236,7 @@ variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
 
 include E
 
+#print MeasureTheory.hausdorffMeasure_lineMap_image /-
 /-- Mapping a set of reals along a line segment scales the measure by the length of a segment.
 
 This is an auxiliary result used to prove `hausdorff_measure_affine_segment`. -/
@@ -1200,7 +1249,9 @@ theorem hausdorffMeasure_lineMap_image (x y : P) (s : Set ℝ) :
   rw [IsometryEquiv.hausdorffMeasure_image, hausdorff_measure_smul_right_image,
     nndist_eq_nnnorm_vsub' E]
 #align measure_theory.hausdorff_measure_line_map_image MeasureTheory.hausdorffMeasure_lineMap_image
+-/
 
+#print MeasureTheory.hausdorffMeasure_affineSegment /-
 /-- The measure of a segment is the distance between its endpoints. -/
 @[simp]
 theorem hausdorffMeasure_affineSegment (x y : P) : μH[1] (affineSegment ℝ x y) = edist x y :=
@@ -1209,15 +1260,18 @@ theorem hausdorffMeasure_affineSegment (x y : P) : μH[1] (affineSegment ℝ x y
     sub_zero, ENNReal.ofReal_one, ← Algebra.algebraMap_eq_smul_one]
   exact (edist_nndist _ _).symm
 #align measure_theory.hausdorff_measure_affine_segment MeasureTheory.hausdorffMeasure_affineSegment
+-/
 
 end RealAffine
 
+#print MeasureTheory.hausdorffMeasure_segment /-
 /-- The measure of a segment is the distance between its endpoints. -/
 @[simp]
 theorem hausdorffMeasure_segment {E : Type _} [NormedAddCommGroup E] [NormedSpace ℝ E]
     [MeasurableSpace E] [BorelSpace E] (x y : E) : μH[1] (segment ℝ x y) = edist x y := by
   rw [← affineSegment_eq_segment, hausdorff_measure_affine_segment]
 #align measure_theory.hausdorff_measure_segment MeasureTheory.hausdorffMeasure_segment
+-/
 
 end Geometric
 
Diff
@@ -207,7 +207,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     subsequence `S (2 * k + 1) \ S (2 * k)` and `S (2 * k + 2) \ S (2 * k)` are metric separated,
     so `m` is additive on each of those sequences. -/
   rw [← tsum_even_add_odd ENNReal.summable ENNReal.summable, ENNReal.add_ne_top]
-  suffices : ∀ a, (∑' k : ℕ, μ (S (2 * k + 1 + a) \ S (2 * k + a))) ≠ ∞
+  suffices : ∀ a, ∑' k : ℕ, μ (S (2 * k + 1 + a) \ S (2 * k + a)) ≠ ∞
   exact ⟨by simpa using this 0, by simpa using this 1⟩
   refine' fun r => ne_top_of_le_ne_top htop _
   rw [← Union_S, ENNReal.tsum_eq_iSup_nat, iSup_le_iff]
Diff
@@ -177,7 +177,6 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
       μ (s ∩ t) + μ (S n) = μ (s ∩ t ∪ S n) := Eq.symm <| hm _ _ <| (Ssep' n).symm
       _ ≤ μ (s ∩ t ∪ s \ t) := by mono*; exact le_rfl
       _ = μ s := by rw [inter_union_diff]
-      
   have Union_S : (⋃ n, S n) = s \ t :=
     by
     refine' subset.antisymm (Union_subset S_sub) _
@@ -197,7 +196,6 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := (add_le_add le_rfl this)
     _ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_iSup
     _ ≤ μ s := iSup_le hSs
-    
   /- It suffices to show that `∑' k, μ (S (k + 1) \ S k) ≠ ∞`. Indeed, if we have this,
     then for all `N` we have `μ (⋃ n, S n) ≤ μ (S N) + ∑' k, m (S (N + k + 1) \ S (N + k))`
     and the second term tends to zero, see `outer_measure.Union_nat_of_monotone_of_tsum_ne_top`
@@ -582,7 +580,6 @@ theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Count
         tsum_iUnion_decode₂ (fun t : Set X => ⨆ h : t.Nonempty, m (diam t)) (by simp) _
       _ ≤ ∑' i : ι n, m (diam (t n i)) := (ENNReal.tsum_le_tsum fun b => iSup_le fun htb => le_rfl)
       _ ≤ c := hn.le
-      
 #align measure_theory.measure.mk_metric_le_liminf_tsum MeasureTheory.Measure.mkMetric_le_liminf_tsum
 
 /-- To bound the Hausdorff measure (or, more generally, for a measure defined using
@@ -722,7 +719,6 @@ theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 :=
     calc
       (1 : ℝ≥0∞) = ⨆ h : (t m).Nonempty, 1 := by simp only [A, ciSup_pos]
       _ ≤ ∑' n, ⨆ h : (t n).Nonempty, 1 := ENNReal.le_tsum _
-      
 #align measure_theory.measure.hausdorff_measure_zero_singleton MeasureTheory.Measure.hausdorffMeasure_zero_singleton
 
 theorem one_le_hausdorffMeasure_zero_of_nonempty {s : Set X} (h : s.Nonempty) : 1 ≤ μH[0] s :=
@@ -731,7 +727,6 @@ theorem one_le_hausdorffMeasure_zero_of_nonempty {s : Set X} (h : s.Nonempty) :
   calc
     (1 : ℝ≥0∞) = μH[0] ({x} : Set X) := (hausdorff_measure_zero_singleton x).symm
     _ ≤ μH[0] s := measure_mono (singleton_subset_iff.2 hx)
-    
 #align measure_theory.measure.one_le_hausdorff_measure_zero_of_nonempty MeasureTheory.Measure.one_le_hausdorffMeasure_zero_of_nonempty
 
 theorem hausdorffMeasure_le_one_of_subsingleton {s : Set X} (hs : s.Subsingleton) {d : ℝ}
@@ -903,7 +898,6 @@ theorem le_hausdorffMeasure_image (hf : AntilipschitzWith K f) (hd : 0 ≤ d) (s
   calc
     μH[d] s ≤ μH[d] (f ⁻¹' (f '' s)) := measure_mono (subset_preimage_image _ _)
     _ ≤ K ^ d * μH[d] (f '' s) := hf.hausdorffMeasure_preimage_le hd (f '' s)
-    
 #align antilipschitz_with.le_hausdorff_measure_image AntilipschitzWith.le_hausdorffMeasure_image
 
 end AntilipschitzWith
@@ -1050,13 +1044,11 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
           refine' add_le_add le_rfl ((div_le_div_right npos).2 _)
           exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
         _ = x i := by field_simp [npos.ne']
-        
     ·
       calc
         x i = (a i : ℝ) + (x i - a i) * n / n := by field_simp [npos.ne']
         _ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n :=
           add_le_add le_rfl ((div_le_div_right npos).2 (Nat.lt_floor_add_one _).le)
-        
   calc
     μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
         liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ↑(Fintype.card ι)) at_top :=
@@ -1089,7 +1081,6 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
         simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
           ENNReal.ofReal_coe_nat]
       · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
-    
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 
 variable (ι X)
Diff
@@ -4,11 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
+! leanprover-community/mathlib commit 3d5c4a7a5fb0d982f97ed953161264f1dbd90ead
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
+import Mathbin.Analysis.Convex.Between
 import Mathbin.MeasureTheory.Constructions.BorelSpace.Basic
+import Mathbin.MeasureTheory.Measure.Haar.InnerProductSpace
 import Mathbin.MeasureTheory.Measure.Lebesgue.Basic
 import Mathbin.Topology.MetricSpace.Holder
 import Mathbin.Topology.MetricSpace.MetricSeparated
@@ -146,13 +148,13 @@ theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {
     (hI : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → IsMetricSeparated (s i) (s j)) :
     μ (⋃ i ∈ I, s i) = ∑ i in I, μ (s i) := by
   classical
-    induction' I using Finset.induction_on with i I hiI ihI hI
-    · simp
-    simp only [Finset.mem_insert] at hI 
-    rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
-    exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
-      IsMetricSeparated.finset_iUnion_right fun j hj =>
-        hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
+  induction' I using Finset.induction_on with i I hiI ihI hI
+  · simp
+  simp only [Finset.mem_insert] at hI 
+  rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
+  exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
+    IsMetricSeparated.finset_iUnion_right fun j hj =>
+      hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
 #align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
 
 /-- Caratheodory theorem. If `m` is a metric outer measure, then every Borel measurable set `t` is
@@ -162,7 +164,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   by
   rw [borel_eq_generateFrom_isClosed]
   refine' MeasurableSpace.generateFrom_le fun t ht => μ.is_caratheodory_iff_le.2 fun s => _
-  set S : ℕ → Set X := fun n => { x ∈ s | (↑n)⁻¹ ≤ inf_edist x t }
+  set S : ℕ → Set X := fun n => {x ∈ s | (↑n)⁻¹ ≤ inf_edist x t}
   have n0 : ∀ {n : ℕ}, (n⁻¹ : ℝ≥0∞) ≠ 0 := fun n => ENNReal.inv_ne_zero.2 (ENNReal.nat_ne_top _)
   have Ssep : ∀ n, IsMetricSeparated (S n) t := fun n =>
     ⟨n⁻¹, n0, fun x hx y hy => hx.2.trans <| inf_edist_le_edist_of_mem hy⟩
@@ -351,19 +353,19 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
     (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by
   classical
-    rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' zero_lt_one).1 hle with ⟨r, hr0, hr⟩
-    refine' fun s =>
-      le_of_tendsto_of_tendsto (mk_metric'.tendsto_pre _ s)
-        (ENNReal.Tendsto.const_mul (mk_metric'.tendsto_pre _ s) (Or.inr hc))
-        (mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, hr0⟩) fun r' hr' => _)
-    simp only [mem_set_of_eq, mk_metric'.pre, RingHom.id_apply]
-    rw [← smul_eq_mul, ← smul_apply, smul_bounded_by hc]
-    refine' le_bounded_by.2 (fun t => (bounded_by_le _).trans _) _
-    simp only [smul_eq_mul, Pi.smul_apply, extend, iInf_eq_if]
-    split_ifs with ht ht
-    · apply hr
-      exact ⟨zero_le _, ht.trans_lt hr'.2⟩
-    · simp [h0]
+  rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' zero_lt_one).1 hle with ⟨r, hr0, hr⟩
+  refine' fun s =>
+    le_of_tendsto_of_tendsto (mk_metric'.tendsto_pre _ s)
+      (ENNReal.Tendsto.const_mul (mk_metric'.tendsto_pre _ s) (Or.inr hc))
+      (mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, hr0⟩) fun r' hr' => _)
+  simp only [mem_set_of_eq, mk_metric'.pre, RingHom.id_apply]
+  rw [← smul_eq_mul, ← smul_apply, smul_bounded_by hc]
+  refine' le_bounded_by.2 (fun t => (bounded_by_le _).trans _) _
+  simp only [smul_eq_mul, Pi.smul_apply, extend, iInf_eq_if]
+  split_ifs with ht ht
+  · apply hr
+    exact ⟨zero_le _, ht.trans_lt hr'.2⟩
+  · simp [h0]
 #align measure_theory.outer_measure.mk_metric_mono_smul MeasureTheory.OuterMeasure.mkMetric_mono_smul
 
 @[simp]
@@ -399,6 +401,19 @@ theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (h
     simp only [(diam_mono hst).trans ht, le_refl, ciInf_pos]
 #align measure_theory.outer_measure.isometry_comap_mk_metric MeasureTheory.OuterMeasure.isometry_comap_mkMetric
 
+theorem mkMetric_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0∞} (hc : c ≠ ∞) (hc' : c ≠ 0) :
+    (mkMetric (c • m) : OuterMeasure X) = c • mkMetric m :=
+  by
+  simp only [mk_metric, mk_metric', mk_metric'.pre, induced_outer_measure, ENNReal.smul_iSup]
+  simp_rw [smul_supr, smul_bounded_by hc, smul_extend _ hc', Pi.smul_apply]
+#align measure_theory.outer_measure.mk_metric_smul MeasureTheory.OuterMeasure.mkMetric_smul
+
+theorem mkMetric_nNReal_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0} (hc : c ≠ 0) :
+    (mkMetric (c • m) : OuterMeasure X) = c • mkMetric m := by
+  rw [ENNReal.smul_def, ENNReal.smul_def,
+    mk_metric_smul m ENNReal.coe_ne_top (ennreal.coe_ne_zero.mpr hc)]
+#align measure_theory.outer_measure.mk_metric_nnreal_smul MeasureTheory.OuterMeasure.mkMetric_nNReal_smul
+
 theorem isometry_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
     (H : Monotone m ∨ Surjective f) : map f (mkMetric m) = restrict (range f) (mkMetric m) := by
   rw [← isometry_comap_mk_metric _ hf H, map_comap]
@@ -513,26 +528,25 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
           ∑' n, ⨆ h : (t n).Nonempty, m (diam (t n)) :=
   by
   classical
-    -- We mostly unfold the definitions but we need to switch the order of `∑'` and `⨅`
-    simp only [← outer_measure.coe_mk_metric, outer_measure.mk_metric, outer_measure.mk_metric',
-      outer_measure.supr_apply, outer_measure.mk_metric'.pre, outer_measure.bounded_by_apply,
-      extend]
-    refine'
-      surjective_id.supr_congr (fun r => r) fun r =>
-        iSup_congr_Prop Iff.rfl fun hr =>
-          surjective_id.infi_congr _ fun t => iInf_congr_Prop Iff.rfl fun ht => _
-    dsimp
-    by_cases htr : ∀ n, diam (t n) ≤ r
-    · rw [iInf_eq_if, if_pos htr]
-      congr 1 with n : 1
-      simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
-    · rw [iInf_eq_if, if_neg htr]
-      push_neg  at htr ; rcases htr with ⟨n, hn⟩
-      refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
-      rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
-      exact hn.not_le
-      rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
-      exact ⟨x, hx⟩
+  -- We mostly unfold the definitions but we need to switch the order of `∑'` and `⨅`
+  simp only [← outer_measure.coe_mk_metric, outer_measure.mk_metric, outer_measure.mk_metric',
+    outer_measure.supr_apply, outer_measure.mk_metric'.pre, outer_measure.bounded_by_apply, extend]
+  refine'
+    surjective_id.supr_congr (fun r => r) fun r =>
+      iSup_congr_Prop Iff.rfl fun hr =>
+        surjective_id.infi_congr _ fun t => iInf_congr_Prop Iff.rfl fun ht => _
+  dsimp
+  by_cases htr : ∀ n, diam (t n) ≤ r
+  · rw [iInf_eq_if, if_pos htr]
+    congr 1 with n : 1
+    simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
+  · rw [iInf_eq_if, if_neg htr]
+    push_neg at htr ; rcases htr with ⟨n, hn⟩
+    refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
+    rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
+    exact hn.not_le
+    rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
+    exact ⟨x, hx⟩
 #align measure_theory.measure.mk_metric_apply MeasureTheory.Measure.mkMetric_apply
 
 theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
@@ -824,6 +838,24 @@ theorem hausdorffMeasure_image_le (h : LipschitzWith K f) {d : ℝ} (hd : 0 ≤
 
 end LipschitzWith
 
+open scoped Pointwise
+
+theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type _} [NormedAddCommGroup E]
+    [NormedField 𝕜] [NormedSpace 𝕜 E] [MeasurableSpace E] [BorelSpace E] {d : ℝ} (hd : 0 ≤ d)
+    {r : 𝕜} (hr : r ≠ 0) (s : Set E) : μH[d] (r • s) = ‖r‖₊ ^ d • μH[d] s :=
+  by
+  suffices ∀ {r : 𝕜}, r ≠ 0 → ∀ s : Set E, μH[d] (r • s) ≤ ‖r‖₊ ^ d • μH[d] s
+    by
+    refine' le_antisymm (this hr s) _
+    rw [← ENNReal.le_inv_smul_iff, ← NNReal.inv_rpow, ← nnnorm_inv]
+    · refine' Eq.trans_le _ (this (inv_ne_zero hr) (r • s))
+      rw [inv_smul_smul₀ hr]
+    · simp [hr]
+  intro r hr s
+  simpa only [ENNReal.smul_def, smul_eq_mul, ← ENNReal.coe_rpow_of_nonneg _ hd] using
+    (@lipschitzWith_smul _ E _ _ _ _ r).hausdorffMeasure_image_le hd s
+#align measure_theory.measure.hausdorff_measure_smul₀ MeasureTheory.Measure.hausdorffMeasure_smul₀
+
 /-!
 ### Antilipschitz maps do not decrease Hausdorff measures and dimension
 -/
@@ -932,6 +964,22 @@ end IsometryEquiv
 
 namespace MeasureTheory
 
+@[to_additive]
+theorem hausdorffMeasure_smul {α : Type _} [SMul α X] [IsometricSMul α X] {d : ℝ} (c : α)
+    (h : 0 ≤ d ∨ Surjective ((· • ·) c : X → X)) (s : Set X) : μH[d] (c • s) = μH[d] s :=
+  (isometry_smul X c).hausdorffMeasure_image h _
+#align measure_theory.hausdorff_measure_smul MeasureTheory.hausdorffMeasure_smul
+#align measure_theory.hausdorff_measure_vadd MeasureTheory.hausdorffMeasure_vadd
+
+@[to_additive]
+instance {d : ℝ} [Group X] [IsometricSMul X X] : IsMulLeftInvariant (μH[d] : Measure X)
+    where map_mul_left_eq_self x := (IsometryEquiv.constSMul x).map_hausdorffMeasure _
+
+@[to_additive]
+instance {d : ℝ} [Group X] [IsometricSMul Xᵐᵒᵖ X] : IsMulRightInvariant (μH[d] : Measure X)
+    where map_mul_right_eq_self x :=
+    (IsometryEquiv.constSMul (MulOpposite.op x)).map_hausdorffMeasure _
+
 /-!
 ### Hausdorff measure and Lebesgue measure
 -/
@@ -943,105 +991,105 @@ namespace MeasureTheory
 theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
     (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
   classical
-    -- it suffices to check that the two measures coincide on products of rational intervals
-    refine'
-      (pi_eq_generateFrom (fun i => real.borel_eq_generate_from_Ioo_rat.symm)
-          (fun i => Real.isPiSystem_Ioo_rat) (fun i => Real.finiteSpanningSetsInIooRat _) _).symm
-    simp only [mem_Union, mem_singleton_iff]
-    -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
-    intro s hs
-    choose a b H using hs
-    obtain rfl : s = fun i => Ioo (a i) (b i)
-    exact funext fun i => (H i).2
-    replace H := fun i => (H i).1
-    apply le_antisymm _
-    -- first check that `volume s ≤ μH s`
-    · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
-        by
-        refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
-        rw [ENNReal.rpow_nat_cast]
-        exact Real.volume_pi_le_diam_pow s
-      rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
-      exact measure.le_iff'.1 Hle _
-    /- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
-      `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
-      `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
-    have I : ∀ i, 0 ≤ (b i : ℝ) - a i := fun i => by
-      simpa only [sub_nonneg, Rat.cast_le] using (H i).le
-    let γ := fun n : ℕ => ∀ i : ι, Fin ⌈((b i : ℝ) - a i) * n⌉₊
-    let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
-      Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
-    have A : tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) at_top (𝓝 0) := by
-      simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
-    have B : ∀ᶠ n in at_top, ∀ i : γ n, diam (t n i) ≤ 1 / n :=
+  -- it suffices to check that the two measures coincide on products of rational intervals
+  refine'
+    (pi_eq_generateFrom (fun i => real.borel_eq_generate_from_Ioo_rat.symm)
+        (fun i => Real.isPiSystem_Ioo_rat) (fun i => Real.finiteSpanningSetsInIooRat _) _).symm
+  simp only [mem_Union, mem_singleton_iff]
+  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
+  intro s hs
+  choose a b H using hs
+  obtain rfl : s = fun i => Ioo (a i) (b i)
+  exact funext fun i => (H i).2
+  replace H := fun i => (H i).1
+  apply le_antisymm _
+  -- first check that `volume s ≤ μH s`
+  · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
       by
-      apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-      intro f
-      apply diam_pi_le_of_le fun b => _
-      simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
-        add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
-    have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
+      refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
+      rw [ENNReal.rpow_nat_cast]
+      exact Real.volume_pi_le_diam_pow s
+    rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
+    exact measure.le_iff'.1 Hle _
+  /- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
+    `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
+    `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
+  have I : ∀ i, 0 ≤ (b i : ℝ) - a i := fun i => by
+    simpa only [sub_nonneg, Rat.cast_le] using (H i).le
+  let γ := fun n : ℕ => ∀ i : ι, Fin ⌈((b i : ℝ) - a i) * n⌉₊
+  let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
+    Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
+  have A : tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) at_top (𝓝 0) := by
+    simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
+  have B : ∀ᶠ n in at_top, ∀ i : γ n, diam (t n i) ≤ 1 / n :=
+    by
+    apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+    intro f
+    apply diam_pi_le_of_le fun b => _
+    simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
+      add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
+  have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
+    by
+    apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+    have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
+    intro x hx
+    simp only [mem_Ioo, mem_univ_pi] at hx 
+    simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
+    let f : γ n := fun i =>
+      ⟨⌊(x i - a i) * n⌋₊, by
+        apply Nat.floor_lt_ceil_of_lt_of_pos
+        · refine' (mul_lt_mul_right npos).2 _
+          simp only [(hx i).right, sub_lt_sub_iff_right]
+        · refine' mul_pos _ npos
+          simpa only [Rat.cast_lt, sub_pos] using H i⟩
+    refine' ⟨f, fun i => ⟨_, _⟩⟩
+    ·
+      calc
+        (a i : ℝ) + ⌊(x i - a i) * n⌋₊ / n ≤ (a i : ℝ) + (x i - a i) * n / n :=
+          by
+          refine' add_le_add le_rfl ((div_le_div_right npos).2 _)
+          exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
+        _ = x i := by field_simp [npos.ne']
+        
+    ·
+      calc
+        x i = (a i : ℝ) + (x i - a i) * n / n := by field_simp [npos.ne']
+        _ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n :=
+          add_le_add le_rfl ((div_le_div_right npos).2 (Nat.lt_floor_add_one _).le)
+        
+  calc
+    μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
+        liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ↑(Fintype.card ι)) at_top :=
+      hausdorff_measure_le_liminf_sum _ (Set.pi univ fun i => Ioo (a i : ℝ) (b i))
+        (fun n : ℕ => 1 / (n : ℝ≥0∞)) A t B C
+    _ ≤ liminf (fun n : ℕ => ∑ i : γ n, (1 / n) ^ Fintype.card ι) at_top :=
       by
-      apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-      have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
-      intro x hx
-      simp only [mem_Ioo, mem_univ_pi] at hx 
-      simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
-      let f : γ n := fun i =>
-        ⟨⌊(x i - a i) * n⌋₊, by
-          apply Nat.floor_lt_ceil_of_lt_of_pos
-          · refine' (mul_lt_mul_right npos).2 _
-            simp only [(hx i).right, sub_lt_sub_iff_right]
-          · refine' mul_pos _ npos
-            simpa only [Rat.cast_lt, sub_pos] using H i⟩
-      refine' ⟨f, fun i => ⟨_, _⟩⟩
-      ·
-        calc
-          (a i : ℝ) + ⌊(x i - a i) * n⌋₊ / n ≤ (a i : ℝ) + (x i - a i) * n / n :=
-            by
-            refine' add_le_add le_rfl ((div_le_div_right npos).2 _)
-            exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
-          _ = x i := by field_simp [npos.ne']
-          
-      ·
-        calc
-          x i = (a i : ℝ) + (x i - a i) * n / n := by field_simp [npos.ne']
-          _ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n :=
-            add_le_add le_rfl ((div_le_div_right npos).2 (Nat.lt_floor_add_one _).le)
-          
-    calc
-      μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
-          liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ↑(Fintype.card ι)) at_top :=
-        hausdorff_measure_le_liminf_sum _ (Set.pi univ fun i => Ioo (a i : ℝ) (b i))
-          (fun n : ℕ => 1 / (n : ℝ≥0∞)) A t B C
-      _ ≤ liminf (fun n : ℕ => ∑ i : γ n, (1 / n) ^ Fintype.card ι) at_top :=
-        by
-        refine'
-          liminf_le_liminf _
-            (by
-              run_tac
-                is_bounded_default)
-        filter_upwards [B]with _ hn
-        apply Finset.sum_le_sum fun i _ => _
-        rw [ENNReal.rpow_nat_cast]
-        exact pow_le_pow_of_le_left' (hn i) _
-      _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
-        simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
-          nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
-      _ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) :=
-        by
-        simp only [Real.volume_Ioo]
-        apply tendsto.liminf_eq
-        refine' ENNReal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
-        · apply
-            tendsto.congr' _
-              ((ennreal.continuous_of_real.tendsto _).comp
-                ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
-          apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-          simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
-            ENNReal.ofReal_coe_nat]
-        · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
-      
+      refine'
+        liminf_le_liminf _
+          (by
+            run_tac
+              is_bounded_default)
+      filter_upwards [B] with _ hn
+      apply Finset.sum_le_sum fun i _ => _
+      rw [ENNReal.rpow_nat_cast]
+      exact pow_le_pow_of_le_left' (hn i) _
+    _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
+      simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
+        nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
+    _ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) :=
+      by
+      simp only [Real.volume_Ioo]
+      apply tendsto.liminf_eq
+      refine' ENNReal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
+      · apply
+          tendsto.congr' _
+            ((ennreal.continuous_of_real.tendsto _).comp
+              ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
+        apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+        simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
+          ENNReal.ofReal_coe_nat]
+      · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
+    
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 
 variable (ι X)
@@ -1075,5 +1123,112 @@ theorem hausdorffMeasure_prod_real : (μH[2] : Measure (ℝ × ℝ)) = volume :=
     hausdorff_measure_pi_real, Fintype.card_fin, Nat.cast_two]
 #align measure_theory.hausdorff_measure_prod_real MeasureTheory.hausdorffMeasure_prod_real
 
+/-! ### Geometric results in affine spaces -/
+
+
+section Geometric
+
+variable {𝕜 E P : Type _}
+
+theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace ℝ E]
+    [MeasurableSpace E] [BorelSpace E] (v : E) (s : Set ℝ) :
+    μH[1] ((fun r => r • v) '' s) = ‖v‖₊ • μH[1] s :=
+  by
+  obtain rfl | hv := eq_or_ne v 0
+  · haveI := no_atoms_hausdorff E one_pos
+    obtain rfl | hs := s.eq_empty_or_nonempty
+    · simp
+    simp [hs]
+  have hn : ‖v‖ ≠ 0 := norm_ne_zero_iff.mpr hv
+  -- break line_map into pieces
+  suffices μH[1] ((· • ·) ‖v‖ '' (LinearMap.toSpanSingleton ℝ E (‖v‖⁻¹ • v) '' s)) = ‖v‖₊ • μH[1] s
+    by
+    simpa only [Set.image_image, smul_comm (norm _), inv_smul_smul₀ hn,
+      LinearMap.toSpanSingleton_apply] using this
+  have iso_smul : Isometry (LinearMap.toSpanSingleton ℝ E (‖v‖⁻¹ • v)) :=
+    by
+    refine' AddMonoidHomClass.isometry_of_norm _ fun x => (norm_smul _ _).trans _
+    rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel hn, mul_one, LinearMap.id_apply]
+  rw [Set.image_smul, measure.hausdorff_measure_smul₀ zero_le_one hn, nnnorm_norm, NNReal.rpow_one,
+    iso_smul.hausdorff_measure_image (Or.inl <| zero_le_one' ℝ)]
+#align measure_theory.hausdorff_measure_smul_right_image MeasureTheory.hausdorffMeasure_smul_right_image
+
+section NormedFieldAffine
+
+variable [NormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace P]
+
+variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
+
+include E
+
+/-- Scaling by `c` around `x` scales the measure by `‖c‖₊ ^ d`. -/
+theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
+    (s : Set P) : μH[d] (AffineMap.homothety x c '' s) = ‖c‖₊ ^ d • μH[d] s :=
+  by
+  suffices
+    μH[d] (IsometryEquiv.vaddConst x '' ((· • ·) c '' ((IsometryEquiv.vaddConst x).symm '' s))) =
+      ‖c‖₊ ^ d • μH[d] s
+    by simpa only [Set.image_image]
+  borelize E
+  rw [IsometryEquiv.hausdorffMeasure_image, Set.image_smul, measure.hausdorff_measure_smul₀ hd hc,
+    IsometryEquiv.hausdorffMeasure_image]
+#align measure_theory.hausdorff_measure_homothety_image MeasureTheory.hausdorffMeasure_homothety_image
+
+theorem hausdorffMeasure_homothety_preimage {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
+    (s : Set P) : μH[d] (AffineMap.homothety x c ⁻¹' s) = ‖c‖₊⁻¹ ^ d • μH[d] s :=
+  by
+  change μH[d] (AffineEquiv.homothetyUnitsMulHom x (Units.mk0 c hc) ⁻¹' s) = _
+  rw [← AffineEquiv.image_symm, AffineEquiv.coe_homothetyUnitsMulHom_apply_symm,
+    hausdorff_measure_homothety_image hd x (_ : 𝕜ˣ).IsUnit.NeZero, Units.val_inv_eq_inv_val,
+    Units.val_mk0, nnnorm_inv]
+#align measure_theory.hausdorff_measure_homothety_preimage MeasureTheory.hausdorffMeasure_homothety_preimage
+
+/-! TODO: prove `measure.map (affine_map.homothety x c) μH[d] = ‖c‖₊⁻¹ ^ d • μH[d]`, which needs a
+more general version of `affine_map.homothety_continuous` -/
+
+
+end NormedFieldAffine
+
+section RealAffine
+
+variable [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace P]
+
+variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
+
+include E
+
+/-- Mapping a set of reals along a line segment scales the measure by the length of a segment.
+
+This is an auxiliary result used to prove `hausdorff_measure_affine_segment`. -/
+theorem hausdorffMeasure_lineMap_image (x y : P) (s : Set ℝ) :
+    μH[1] (AffineMap.lineMap x y '' s) = nndist x y • μH[1] s :=
+  by
+  suffices μH[1] (IsometryEquiv.vaddConst x '' ((· • (y -ᵥ x)) '' s)) = nndist x y • μH[1] s by
+    simpa only [Set.image_image]
+  borelize E
+  rw [IsometryEquiv.hausdorffMeasure_image, hausdorff_measure_smul_right_image,
+    nndist_eq_nnnorm_vsub' E]
+#align measure_theory.hausdorff_measure_line_map_image MeasureTheory.hausdorffMeasure_lineMap_image
+
+/-- The measure of a segment is the distance between its endpoints. -/
+@[simp]
+theorem hausdorffMeasure_affineSegment (x y : P) : μH[1] (affineSegment ℝ x y) = edist x y :=
+  by
+  rw [affineSegment, hausdorff_measure_line_map_image, hausdorff_measure_real, Real.volume_Icc,
+    sub_zero, ENNReal.ofReal_one, ← Algebra.algebraMap_eq_smul_one]
+  exact (edist_nndist _ _).symm
+#align measure_theory.hausdorff_measure_affine_segment MeasureTheory.hausdorffMeasure_affineSegment
+
+end RealAffine
+
+/-- The measure of a segment is the distance between its endpoints. -/
+@[simp]
+theorem hausdorffMeasure_segment {E : Type _} [NormedAddCommGroup E] [NormedSpace ℝ E]
+    [MeasurableSpace E] [BorelSpace E] (x y : E) : μH[1] (segment ℝ x y) = edist x y := by
+  rw [← affineSegment_eq_segment, hausdorff_measure_affine_segment]
+#align measure_theory.hausdorff_measure_segment MeasureTheory.hausdorffMeasure_segment
+
+end Geometric
+
 end MeasureTheory
 
Diff
@@ -148,9 +148,9 @@ theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {
   classical
     induction' I using Finset.induction_on with i I hiI ihI hI
     · simp
-    simp only [Finset.mem_insert] at hI
+    simp only [Finset.mem_insert] at hI 
     rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
-    exacts[fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
+    exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
       IsMetricSeparated.finset_iUnion_right fun j hj =>
         hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
 #align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
@@ -180,7 +180,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     by
     refine' subset.antisymm (Union_subset S_sub) _
     rintro x ⟨hxs, hxt⟩
-    rw [mem_iff_inf_edist_zero_of_closed ht] at hxt
+    rw [mem_iff_inf_edist_zero_of_closed ht] at hxt 
     rcases ENNReal.exists_inv_nat_lt hxt with ⟨n, hn⟩
     exact mem_Union.2 ⟨n, hxs, hn.le⟩
   /- Now we have `∀ n, μ (s ∩ t) + μ (S n) ≤ μ s` and we need to prove
@@ -337,7 +337,7 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
   refine'
     tendsto_nhds_unique_of_eventuallyEq (mk_metric'.tendsto_pre _ _)
       ((mk_metric'.tendsto_pre _ _).add (mk_metric'.tendsto_pre _ _)) _
-  rw [← pos_iff_ne_zero] at r0
+  rw [← pos_iff_ne_zero] at r0 
   filter_upwards [Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, r0⟩]
   rintro ε ⟨ε0, εr⟩
   refine' bounded_by_union_of_top_of_nonempty_inter _
@@ -391,7 +391,7 @@ theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (h
   · congr with s : 1
     apply extend_congr
     · simp [hf.ediam_image]
-    · intros ; simp [hf.injective.subsingleton_image_iff, hf.ediam_image]
+    · intros; simp [hf.injective.subsingleton_image_iff, hf.ediam_image]
   · intro s t hst
     simp only [extend, le_iInf_iff]
     intro ht
@@ -527,7 +527,7 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
       congr 1 with n : 1
       simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
     · rw [iInf_eq_if, if_neg htr]
-      push_neg  at htr; rcases htr with ⟨n, hn⟩
+      push_neg  at htr ; rcases htr with ⟨n, hn⟩
       refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
       rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
       exact hn.not_le
@@ -857,7 +857,7 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
   refine' iSup₂_le fun ε ε0 => _
   refine' le_iSup₂_of_le (ε / K) (by simp [ε0.ne']) _
   refine' le_iInf₂ fun t hst => le_iInf fun htε => _
-  replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst; rw [preimage_Union] at hst
+  replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst; rw [preimage_Union] at hst 
   refine' iInf₂_le_of_le _ hst (iInf_le_of_le (fun n => _) _)
   · exact (hf.ediam_preimage_le _).trans (ENNReal.mul_le_of_le_div' <| htε n)
   · refine' ENNReal.tsum_le_tsum fun n => iSup_le_iff.2 fun hft => _
@@ -985,7 +985,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
       apply eventually_at_top.2 ⟨1, fun n hn => _⟩
       have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
       intro x hx
-      simp only [mem_Ioo, mem_univ_pi] at hx
+      simp only [mem_Ioo, mem_univ_pi] at hx 
       simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
       let f : γ n := fun i =>
         ⟨⌊(x i - a i) * n⌋₊, by
Diff
@@ -111,7 +111,7 @@ Hausdorff measure, measure, metric measure
 -/
 
 
-open NNReal ENNReal Topology BigOperators
+open scoped NNReal ENNReal Topology BigOperators
 
 open Emetric Set Function Filter Encodable FiniteDimensional TopologicalSpace
 
@@ -741,7 +741,7 @@ end MeasureTheory
 -/
 
 
-open MeasureTheory
+open scoped MeasureTheory
 
 open MeasureTheory MeasureTheory.Measure
 
Diff
@@ -173,9 +173,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   have hSs : ∀ n, μ (s ∩ t) + μ (S n) ≤ μ s := fun n =>
     calc
       μ (s ∩ t) + μ (S n) = μ (s ∩ t ∪ S n) := Eq.symm <| hm _ _ <| (Ssep' n).symm
-      _ ≤ μ (s ∩ t ∪ s \ t) := by
-        mono*
-        exact le_rfl
+      _ ≤ μ (s ∩ t ∪ s \ t) := by mono*; exact le_rfl
       _ = μ s := by rw [inter_union_diff]
       
   have Union_S : (⋃ n, S n) = s \ t :=
@@ -204,8 +202,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     for details. -/
   have : ∀ n, S n ⊆ S (n + 1) := fun n x hx =>
     ⟨hx.1, le_trans (ENNReal.inv_le_inv.2 <| Nat.cast_le.2 n.le_succ) hx.2⟩
-  refine' (μ.Union_nat_of_monotone_of_tsum_ne_top this _).le
-  clear this
+  refine' (μ.Union_nat_of_monotone_of_tsum_ne_top this _).le; clear this
   /- While the sets `S (k + 1) \ S k` are not pairwise metric separated, the sets in each
     subsequence `S (2 * k + 1) \ S (2 * k)` and `S (2 * k + 2) \ S (2 * k)` are metric separated,
     so `m` is additive on each of those sequences. -/
@@ -223,10 +220,8 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
       (fun h => (this i j h).mono (inter_subset_left _ _) fun x hx => ⟨hx.1.1, hx.2⟩) fun h =>
       (this j i h).symm.mono (fun x hx => ⟨hx.1.1, hx.2⟩) (inter_subset_left _ _)
   intro i j hj
-  have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ :=
-    by
-    rw [ENNReal.inv_lt_inv, Nat.cast_lt]
-    linarith
+  have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ := by
+    rw [ENNReal.inv_lt_inv, Nat.cast_lt]; linarith
   refine' ⟨(↑(2 * i + 1 + r))⁻¹ - (↑(2 * j + r))⁻¹, by simpa using A, fun x hx y hy => _⟩
   have : inf_edist y t < (↑(2 * j + r))⁻¹ := not_le.1 fun hle => hy.2 ⟨hy.1, hle⟩
   rcases inf_edist_lt_iff.mp this with ⟨z, hzt, hyz⟩
@@ -238,9 +233,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
 #align measure_theory.outer_measure.is_metric.borel_le_caratheodory MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory
 
 theorem le_caratheodory [MeasurableSpace X] [BorelSpace X] (hm : IsMetric μ) :
-    ‹MeasurableSpace X› ≤ μ.caratheodory :=
-  by
-  rw [@BorelSpace.measurable_eq X _ _]
+    ‹MeasurableSpace X› ≤ μ.caratheodory := by rw [@BorelSpace.measurable_eq X _ _];
   exact hm.borel_le_caratheodory
 #align measure_theory.outer_measure.is_metric.le_caratheodory MeasureTheory.OuterMeasure.IsMetric.le_caratheodory
 
@@ -398,8 +391,7 @@ theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (h
   · congr with s : 1
     apply extend_congr
     · simp [hf.ediam_image]
-    · intros
-      simp [hf.injective.subsingleton_image_iff, hf.ediam_image]
+    · intros ; simp [hf.injective.subsingleton_image_iff, hf.ediam_image]
   · intro s t hst
     simp only [extend, le_iInf_iff]
     intro ht
@@ -535,8 +527,7 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
       congr 1 with n : 1
       simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
     · rw [iInf_eq_if, if_neg htr]
-      push_neg  at htr
-      rcases htr with ⟨n, hn⟩
+      push_neg  at htr; rcases htr with ⟨n, hn⟩
       refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
       rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
       exact hn.not_le
@@ -673,10 +664,8 @@ theorem hausdorffMeasure_mono {d₁ d₂ : ℝ} (h : d₁ ≤ d₂) (s : Set X)
   by
   rcases h.eq_or_lt with (rfl | h); · exact le_rfl
   cases' hausdorff_measure_zero_or_top h s with hs hs
-  · rw [hs]
-    exact zero_le _
-  · rw [hs]
-    exact le_top
+  · rw [hs]; exact zero_le _
+  · rw [hs]; exact le_top
 #align measure_theory.measure.hausdorff_measure_mono MeasureTheory.Measure.hausdorffMeasure_mono
 
 variable (X)
@@ -868,8 +857,7 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
   refine' iSup₂_le fun ε ε0 => _
   refine' le_iSup₂_of_le (ε / K) (by simp [ε0.ne']) _
   refine' le_iInf₂ fun t hst => le_iInf fun htε => _
-  replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst
-  rw [preimage_Union] at hst
+  replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst; rw [preimage_Union] at hst
   refine' iInf₂_le_of_le _ hst (iInf_le_of_le (fun n => _) _)
   · exact (hf.ediam_preimage_le _).trans (ENNReal.mul_le_of_le_div' <| htε n)
   · refine' ENNReal.tsum_le_tsum fun n => iSup_le_iff.2 fun hft => _
Diff
@@ -4,12 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit b1859b6d4636fdbb78c5d5cefd24530653cfd3eb
+! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.MeasureTheory.Constructions.BorelSpace.Basic
-import Mathbin.MeasureTheory.Measure.Lebesgue
+import Mathbin.MeasureTheory.Measure.Lebesgue.Basic
 import Mathbin.Topology.MetricSpace.Holder
 import Mathbin.Topology.MetricSpace.MetricSeparated
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit 0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
+! leanprover-community/mathlib commit b1859b6d4636fdbb78c5d5cefd24530653cfd3eb
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -101,11 +101,6 @@ sources only allow coverings by balls and use `r ^ d` instead of `(diam s) ^ d`.
 construction lead to different Hausdorff measures, they lead to the same notion of the Hausdorff
 dimension.
 
-## TODO
-
-* prove that `1`-dimensional Hausdorff measure on `ℝ` equals `volume`;
-* prove a similar statement for `ℝ × ℝ`.
-
 ## References
 
 * [Herbert Federer, Geometric Measure Theory, Chapter 2.10][Federer1996]
@@ -750,122 +745,6 @@ theorem hausdorffMeasure_le_one_of_subsingleton {s : Set X} (hs : s.Subsingleton
 
 end Measure
 
-open MeasureTheory
-
-open Measure
-
-/-!
-### Hausdorff measure and Lebesgue measure
--/
-
-
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic filter.is_bounded_default -/
-/-- In the space `ι → ℝ`, Hausdorff measure coincides exactly with Lebesgue measure. -/
-@[simp]
-theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
-    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
-  classical
-    -- it suffices to check that the two measures coincide on products of rational intervals
-    refine'
-      (pi_eq_generateFrom (fun i => real.borel_eq_generate_from_Ioo_rat.symm)
-          (fun i => Real.isPiSystem_Ioo_rat) (fun i => Real.finiteSpanningSetsInIooRat _) _).symm
-    simp only [mem_Union, mem_singleton_iff]
-    -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
-    intro s hs
-    choose a b H using hs
-    obtain rfl : s = fun i => Ioo (a i) (b i)
-    exact funext fun i => (H i).2
-    replace H := fun i => (H i).1
-    apply le_antisymm _
-    -- first check that `volume s ≤ μH s`
-    · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
-        by
-        refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
-        rw [ENNReal.rpow_nat_cast]
-        exact Real.volume_pi_le_diam_pow s
-      rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
-      exact measure.le_iff'.1 Hle _
-    /- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
-      `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
-      `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
-    have I : ∀ i, 0 ≤ (b i : ℝ) - a i := fun i => by
-      simpa only [sub_nonneg, Rat.cast_le] using (H i).le
-    let γ := fun n : ℕ => ∀ i : ι, Fin ⌈((b i : ℝ) - a i) * n⌉₊
-    let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
-      Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
-    have A : tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) at_top (𝓝 0) := by
-      simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
-    have B : ∀ᶠ n in at_top, ∀ i : γ n, diam (t n i) ≤ 1 / n :=
-      by
-      apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-      intro f
-      apply diam_pi_le_of_le fun b => _
-      simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
-        add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
-    have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
-      by
-      apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-      have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
-      intro x hx
-      simp only [mem_Ioo, mem_univ_pi] at hx
-      simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
-      let f : γ n := fun i =>
-        ⟨⌊(x i - a i) * n⌋₊, by
-          apply Nat.floor_lt_ceil_of_lt_of_pos
-          · refine' (mul_lt_mul_right npos).2 _
-            simp only [(hx i).right, sub_lt_sub_iff_right]
-          · refine' mul_pos _ npos
-            simpa only [Rat.cast_lt, sub_pos] using H i⟩
-      refine' ⟨f, fun i => ⟨_, _⟩⟩
-      ·
-        calc
-          (a i : ℝ) + ⌊(x i - a i) * n⌋₊ / n ≤ (a i : ℝ) + (x i - a i) * n / n :=
-            by
-            refine' add_le_add le_rfl ((div_le_div_right npos).2 _)
-            exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
-          _ = x i := by field_simp [npos.ne']
-          
-      ·
-        calc
-          x i = (a i : ℝ) + (x i - a i) * n / n := by field_simp [npos.ne']
-          _ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n :=
-            add_le_add le_rfl ((div_le_div_right npos).2 (Nat.lt_floor_add_one _).le)
-          
-    calc
-      μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
-          liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ↑(Fintype.card ι)) at_top :=
-        hausdorff_measure_le_liminf_sum _ (Set.pi univ fun i => Ioo (a i : ℝ) (b i))
-          (fun n : ℕ => 1 / (n : ℝ≥0∞)) A t B C
-      _ ≤ liminf (fun n : ℕ => ∑ i : γ n, (1 / n) ^ Fintype.card ι) at_top :=
-        by
-        refine'
-          liminf_le_liminf _
-            (by
-              run_tac
-                is_bounded_default)
-        filter_upwards [B]with _ hn
-        apply Finset.sum_le_sum fun i _ => _
-        rw [ENNReal.rpow_nat_cast]
-        exact pow_le_pow_of_le_left' (hn i) _
-      _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
-        simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
-          nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
-      _ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) :=
-        by
-        simp only [Real.volume_Ioo]
-        apply tendsto.liminf_eq
-        refine' ENNReal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
-        · apply
-            tendsto.congr' _
-              ((ennreal.continuous_of_real.tendsto _).comp
-                ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
-          apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-          simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
-            ENNReal.ofReal_coe_nat]
-        · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
-      
-#align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
-
 end MeasureTheory
 
 /-!
@@ -1052,5 +931,161 @@ theorem hausdorffMeasure_preimage (e : X ≃ᵢ Y) (d : ℝ) (s : Set Y) : μH[d
   rw [← e.image_symm, e.symm.hausdorff_measure_image]
 #align isometry_equiv.hausdorff_measure_preimage IsometryEquiv.hausdorffMeasure_preimage
 
+@[simp]
+theorem map_hausdorffMeasure (e : X ≃ᵢ Y) (d : ℝ) : Measure.map e μH[d] = μH[d] := by
+  rw [e.isometry.map_hausdorff_measure (Or.inr e.surjective), e.surjective.range_eq, restrict_univ]
+#align isometry_equiv.map_hausdorff_measure IsometryEquiv.map_hausdorffMeasure
+
+theorem measurePreserving_hausdorffMeasure (e : X ≃ᵢ Y) (d : ℝ) : MeasurePreserving e μH[d] μH[d] :=
+  ⟨e.Continuous.Measurable, map_hausdorffMeasure _ _⟩
+#align isometry_equiv.measure_preserving_hausdorff_measure IsometryEquiv.measurePreserving_hausdorffMeasure
+
 end IsometryEquiv
 
+namespace MeasureTheory
+
+/-!
+### Hausdorff measure and Lebesgue measure
+-/
+
+
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic filter.is_bounded_default -/
+/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
+@[simp]
+theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
+    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
+  classical
+    -- it suffices to check that the two measures coincide on products of rational intervals
+    refine'
+      (pi_eq_generateFrom (fun i => real.borel_eq_generate_from_Ioo_rat.symm)
+          (fun i => Real.isPiSystem_Ioo_rat) (fun i => Real.finiteSpanningSetsInIooRat _) _).symm
+    simp only [mem_Union, mem_singleton_iff]
+    -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
+    intro s hs
+    choose a b H using hs
+    obtain rfl : s = fun i => Ioo (a i) (b i)
+    exact funext fun i => (H i).2
+    replace H := fun i => (H i).1
+    apply le_antisymm _
+    -- first check that `volume s ≤ μH s`
+    · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
+        by
+        refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
+        rw [ENNReal.rpow_nat_cast]
+        exact Real.volume_pi_le_diam_pow s
+      rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
+      exact measure.le_iff'.1 Hle _
+    /- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
+      `1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
+      `0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
+    have I : ∀ i, 0 ≤ (b i : ℝ) - a i := fun i => by
+      simpa only [sub_nonneg, Rat.cast_le] using (H i).le
+    let γ := fun n : ℕ => ∀ i : ι, Fin ⌈((b i : ℝ) - a i) * n⌉₊
+    let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
+      Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
+    have A : tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) at_top (𝓝 0) := by
+      simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
+    have B : ∀ᶠ n in at_top, ∀ i : γ n, diam (t n i) ≤ 1 / n :=
+      by
+      apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+      intro f
+      apply diam_pi_le_of_le fun b => _
+      simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
+        add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
+    have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
+      by
+      apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+      have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
+      intro x hx
+      simp only [mem_Ioo, mem_univ_pi] at hx
+      simp only [mem_Union, mem_Ioo, mem_univ_pi, coe_coe]
+      let f : γ n := fun i =>
+        ⟨⌊(x i - a i) * n⌋₊, by
+          apply Nat.floor_lt_ceil_of_lt_of_pos
+          · refine' (mul_lt_mul_right npos).2 _
+            simp only [(hx i).right, sub_lt_sub_iff_right]
+          · refine' mul_pos _ npos
+            simpa only [Rat.cast_lt, sub_pos] using H i⟩
+      refine' ⟨f, fun i => ⟨_, _⟩⟩
+      ·
+        calc
+          (a i : ℝ) + ⌊(x i - a i) * n⌋₊ / n ≤ (a i : ℝ) + (x i - a i) * n / n :=
+            by
+            refine' add_le_add le_rfl ((div_le_div_right npos).2 _)
+            exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
+          _ = x i := by field_simp [npos.ne']
+          
+      ·
+        calc
+          x i = (a i : ℝ) + (x i - a i) * n / n := by field_simp [npos.ne']
+          _ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n :=
+            add_le_add le_rfl ((div_le_div_right npos).2 (Nat.lt_floor_add_one _).le)
+          
+    calc
+      μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
+          liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ↑(Fintype.card ι)) at_top :=
+        hausdorff_measure_le_liminf_sum _ (Set.pi univ fun i => Ioo (a i : ℝ) (b i))
+          (fun n : ℕ => 1 / (n : ℝ≥0∞)) A t B C
+      _ ≤ liminf (fun n : ℕ => ∑ i : γ n, (1 / n) ^ Fintype.card ι) at_top :=
+        by
+        refine'
+          liminf_le_liminf _
+            (by
+              run_tac
+                is_bounded_default)
+        filter_upwards [B]with _ hn
+        apply Finset.sum_le_sum fun i _ => _
+        rw [ENNReal.rpow_nat_cast]
+        exact pow_le_pow_of_le_left' (hn i) _
+      _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
+        simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
+          nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
+      _ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) :=
+        by
+        simp only [Real.volume_Ioo]
+        apply tendsto.liminf_eq
+        refine' ENNReal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
+        · apply
+            tendsto.congr' _
+              ((ennreal.continuous_of_real.tendsto _).comp
+                ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
+          apply eventually_at_top.2 ⟨1, fun n hn => _⟩
+          simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
+            ENNReal.ofReal_coe_nat]
+        · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
+      
+#align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
+
+variable (ι X)
+
+theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι]
+    [TopologicalSpace.SecondCountableTopology X] (d : ℝ) :
+    MeasurePreserving (MeasurableEquiv.funUnique ι X) μH[d] μH[d] :=
+  (IsometryEquiv.funUnique ι X).measurePreserving_hausdorffMeasure _
+#align measure_theory.hausdorff_measure_measure_preserving_fun_unique MeasureTheory.hausdorffMeasure_measurePreserving_funUnique
+
+theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type _)
+    [∀ i, MeasurableSpace (α i)] [∀ i, EMetricSpace (α i)] [∀ i, BorelSpace (α i)]
+    [∀ i, TopologicalSpace.SecondCountableTopology (α i)] (d : ℝ) :
+    MeasurePreserving (MeasurableEquiv.piFinTwo α) μH[d] μH[d] :=
+  (IsometryEquiv.piFinTwo α).measurePreserving_hausdorffMeasure _
+#align measure_theory.hausdorff_measure_measure_preserving_pi_fin_two MeasureTheory.hausdorffMeasure_measurePreserving_piFinTwo
+
+/-- In the space `ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
+@[simp]
+theorem hausdorffMeasure_real : (μH[1] : Measure ℝ) = volume := by
+  rw [← (volume_preserving_fun_unique Unit ℝ).map_eq, ←
+    (hausdorff_measure_measure_preserving_fun_unique Unit ℝ 1).map_eq, ← hausdorff_measure_pi_real,
+    Fintype.card_unit, Nat.cast_one]
+#align measure_theory.hausdorff_measure_real MeasureTheory.hausdorffMeasure_real
+
+/-- In the space `ℝ × ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
+@[simp]
+theorem hausdorffMeasure_prod_real : (μH[2] : Measure (ℝ × ℝ)) = volume := by
+  rw [← (volume_preserving_pi_fin_two fun i => ℝ).map_eq, ←
+    (hausdorff_measure_measure_preserving_pi_fin_two (fun i => ℝ) _).map_eq, ←
+    hausdorff_measure_pi_real, Fintype.card_fin, Nat.cast_two]
+#align measure_theory.hausdorff_measure_prod_real MeasureTheory.hausdorffMeasure_prod_real
+
+end MeasureTheory
+
Diff
@@ -4,12 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit 343e80208d29d2d15f8050b929aa50fe4ce71b55
+! leanprover-community/mathlib commit 0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.Analysis.SpecialFunctions.Pow
-import Mathbin.MeasureTheory.Constructions.BorelSpace
+import Mathbin.MeasureTheory.Constructions.BorelSpace.Basic
 import Mathbin.MeasureTheory.Measure.Lebesgue
 import Mathbin.Topology.MetricSpace.Holder
 import Mathbin.Topology.MetricSpace.MetricSeparated
Diff
@@ -148,18 +148,18 @@ namespace IsMetric
 variable {μ : OuterMeasure X}
 
 /-- A metric outer measure is additive on a finite set of pairwise metric separated sets. -/
-theorem finset_unionᵢ_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {s : ι → Set X}
+theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {s : ι → Set X}
     (hI : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → IsMetricSeparated (s i) (s j)) :
     μ (⋃ i ∈ I, s i) = ∑ i in I, μ (s i) := by
   classical
     induction' I using Finset.induction_on with i I hiI ihI hI
     · simp
     simp only [Finset.mem_insert] at hI
-    rw [Finset.set_bunionᵢ_insert, hm, ihI, Finset.sum_insert hiI]
+    rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
     exacts[fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
-      IsMetricSeparated.finset_unionᵢ_right fun j hj =>
+      IsMetricSeparated.finset_iUnion_right fun j hj =>
         hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
-#align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_unionᵢ_of_pairwise_separated
+#align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
 
 /-- Caratheodory theorem. If `m` is a metric outer measure, then every Borel measurable set `t` is
 Caratheodory measurable: for any (not necessarily measurable) set `s` we have
@@ -201,8 +201,8 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   calc
     μ (s ∩ t) + μ (s \ t) = μ (s ∩ t) + μ (⋃ n, S n) := by rw [Union_S]
     _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := (add_le_add le_rfl this)
-    _ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_supᵢ
-    _ ≤ μ s := supᵢ_le hSs
+    _ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_iSup
+    _ ≤ μ s := iSup_le hSs
     
   /- It suffices to show that `∑' k, μ (S (k + 1) \ S k) ≠ ∞`. Indeed, if we have this,
     then for all `N` we have `μ (⋃ n, S n) ≤ μ (S N) + ∑' k, m (S (N + k + 1) \ S (N + k))`
@@ -219,7 +219,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   suffices : ∀ a, (∑' k : ℕ, μ (S (2 * k + 1 + a) \ S (2 * k + a))) ≠ ∞
   exact ⟨by simpa using this 0, by simpa using this 1⟩
   refine' fun r => ne_top_of_le_ne_top htop _
-  rw [← Union_S, ENNReal.tsum_eq_supᵢ_nat, supᵢ_le_iff]
+  rw [← Union_S, ENNReal.tsum_eq_iSup_nat, iSup_le_iff]
   intro n
   rw [← hm.finset_Union_of_pairwise_separated]
   · exact μ.mono (Union_subset fun i => Union_subset fun hi x hx => mem_Union.2 ⟨_, hx.1⟩)
@@ -287,11 +287,11 @@ namespace MkMetric'
 variable {m : Set X → ℝ≥0∞} {r : ℝ≥0∞} {μ : OuterMeasure X} {s : Set X}
 
 theorem le_pre : μ ≤ pre m r ↔ ∀ s : Set X, diam s ≤ r → μ s ≤ m s := by
-  simp only [pre, le_bounded_by, extend, le_infᵢ_iff]
+  simp only [pre, le_bounded_by, extend, le_iInf_iff]
 #align measure_theory.outer_measure.mk_metric'.le_pre MeasureTheory.OuterMeasure.mkMetric'.le_pre
 
 theorem pre_le (hs : diam s ≤ r) : pre m r s ≤ m s :=
-  (boundedBy_le _).trans <| infᵢ_le _ hs
+  (boundedBy_le _).trans <| iInf_le _ hs
 #align measure_theory.outer_measure.mk_metric'.pre_le MeasureTheory.OuterMeasure.mkMetric'.pre_le
 
 theorem mono_pre (m : Set X → ℝ≥0∞) {r r' : ℝ≥0∞} (h : r ≤ r') : pre m r' ≤ pre m r :=
@@ -306,8 +306,8 @@ theorem tendsto_pre (m : Set X → ℝ≥0∞) (s : Set X) :
     Tendsto (fun r => pre m r s) (𝓝[>] 0) (𝓝 <| mkMetric' m s) :=
   by
   rw [← map_coe_Ioi_atBot, tendsto_map'_iff]
-  simp only [mk_metric', outer_measure.supr_apply, supᵢ_subtype']
-  exact tendsto_atBot_supᵢ fun r r' hr => mono_pre _ hr _
+  simp only [mk_metric', outer_measure.supr_apply, iSup_subtype']
+  exact tendsto_atBot_iSup fun r r' hr => mono_pre _ hr _
 #align measure_theory.outer_measure.mk_metric'.tendsto_pre MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre
 
 theorem tendsto_pre_nat (m : Set X → ℝ≥0∞) (s : Set X) :
@@ -318,14 +318,14 @@ theorem tendsto_pre_nat (m : Set X → ℝ≥0∞) (s : Set X) :
   simp
 #align measure_theory.outer_measure.mk_metric'.tendsto_pre_nat MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre_nat
 
-theorem eq_supᵢ_nat (m : Set X → ℝ≥0∞) : mkMetric' m = ⨆ n : ℕ, MkMetric'.pre m n⁻¹ :=
+theorem eq_iSup_nat (m : Set X → ℝ≥0∞) : mkMetric' m = ⨆ n : ℕ, MkMetric'.pre m n⁻¹ :=
   by
   ext1 s
-  rw [supᵢ_apply]
+  rw [iSup_apply]
   refine'
     tendsto_nhds_unique (mk_metric'.tendsto_pre_nat m s)
-      (tendsto_atTop_supᵢ fun k l hkl => mk_metric'.mono_pre_nat m hkl s)
-#align measure_theory.outer_measure.mk_metric'.eq_supr_nat MeasureTheory.OuterMeasure.mkMetric'.eq_supᵢ_nat
+      (tendsto_atTop_iSup fun k l hkl => mk_metric'.mono_pre_nat m hkl s)
+#align measure_theory.outer_measure.mk_metric'.eq_supr_nat MeasureTheory.OuterMeasure.mkMetric'.eq_iSup_nat
 
 /-- `measure_theory.outer_measure.mk_metric'.pre m r` is a trimmed measure provided that
 `m (closure s) = m s` for any set `s`. -/
@@ -335,9 +335,9 @@ theorem trim_pre [MeasurableSpace X] [OpensMeasurableSpace X] (m : Set X → ℝ
   refine' le_antisymm (le_pre.2 fun s hs => _) (le_trim _)
   rw [trim_eq_infi]
   refine'
-    infᵢ_le_of_le (closure s) <|
-      infᵢ_le_of_le subset_closure <|
-        infᵢ_le_of_le measurableSet_closure ((pre_le _).trans_eq (hcl _))
+    iInf_le_of_le (closure s) <|
+      iInf_le_of_le subset_closure <|
+        iInf_le_of_le measurableSet_closure ((pre_le _).trans_eq (hcl _))
   rwa [diam_closure]
 #align measure_theory.outer_measure.mk_metric'.trim_pre MeasureTheory.OuterMeasure.mkMetric'.trim_pre
 
@@ -356,7 +356,7 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
   refine' bounded_by_union_of_top_of_nonempty_inter _
   rintro u ⟨x, hxs, hxu⟩ ⟨y, hyt, hyu⟩
   have : ε < diam u := εr.trans_le ((hr x hxs y hyt).trans <| edist_le_diam_of_mem hxu hyu)
-  exact infᵢ_eq_top.2 fun h => (this.not_le h).elim
+  exact iInf_eq_top.2 fun h => (this.not_le h).elim
 #align measure_theory.outer_measure.mk_metric'_is_metric MeasureTheory.OuterMeasure.mkMetric'_isMetric
 
 /-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
@@ -372,7 +372,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
     simp only [mem_set_of_eq, mk_metric'.pre, RingHom.id_apply]
     rw [← smul_eq_mul, ← smul_apply, smul_bounded_by hc]
     refine' le_bounded_by.2 (fun t => (bounded_by_le _).trans _) _
-    simp only [smul_eq_mul, Pi.smul_apply, extend, infᵢ_eq_if]
+    simp only [smul_eq_mul, Pi.smul_apply, extend, iInf_eq_if]
     split_ifs with ht ht
     · apply hr
       exact ⟨zero_le _, ht.trans_lt hr'.2⟩
@@ -383,7 +383,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
 theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : OuterMeasure X) = ⊤ :=
   by
   simp_rw [mk_metric, mk_metric', mk_metric'.pre, extend_top, bounded_by_top, eq_top_iff]
-  rw [le_supᵢ_iff]
+  rw [le_iSup_iff]
   intro b hb
   simpa using hb ⊤
 #align measure_theory.outer_measure.mk_metric_top MeasureTheory.OuterMeasure.mkMetric_top
@@ -407,10 +407,10 @@ theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (h
     · intros
       simp [hf.injective.subsingleton_image_iff, hf.ediam_image]
   · intro s t hst
-    simp only [extend, le_infᵢ_iff]
+    simp only [extend, le_iInf_iff]
     intro ht
     apply le_trans _ (h_mono (diam_mono hst))
-    simp only [(diam_mono hst).trans ht, le_refl, cinfᵢ_pos]
+    simp only [(diam_mono hst).trans ht, le_refl, ciInf_pos]
 #align measure_theory.outer_measure.isometry_comap_mk_metric MeasureTheory.OuterMeasure.isometry_comap_mkMetric
 
 theorem isometry_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
@@ -439,7 +439,7 @@ theorem trim_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ
 
 theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : OuterMeasure X) (r : ℝ≥0∞) (h0 : 0 < r)
     (hr : ∀ s, diam s ≤ r → μ s ≤ m (diam s)) : μ ≤ mkMetric m :=
-  le_supᵢ₂_of_le r h0 <| mkMetric'.le_pre.2 fun s hs => hr _ hs
+  le_iSup₂_of_le r h0 <| mkMetric'.le_pre.2 fun s hs => hr _ hs
 #align measure_theory.outer_measure.le_mk_metric MeasureTheory.OuterMeasure.le_mkMetric
 
 end OuterMeasure
@@ -523,7 +523,7 @@ theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ
 theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
     mkMetric m s =
       ⨆ (r : ℝ≥0∞) (hr : 0 < r),
-        ⨅ (t : ℕ → Set X) (h : s ⊆ unionᵢ t) (h' : ∀ n, diam (t n) ≤ r),
+        ⨅ (t : ℕ → Set X) (h : s ⊆ iUnion t) (h' : ∀ n, diam (t n) ≤ r),
           ∑' n, ⨆ h : (t n).Nonempty, m (diam (t n)) :=
   by
   classical
@@ -533,18 +533,18 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
       extend]
     refine'
       surjective_id.supr_congr (fun r => r) fun r =>
-        supᵢ_congr_Prop Iff.rfl fun hr =>
-          surjective_id.infi_congr _ fun t => infᵢ_congr_Prop Iff.rfl fun ht => _
+        iSup_congr_Prop Iff.rfl fun hr =>
+          surjective_id.infi_congr _ fun t => iInf_congr_Prop Iff.rfl fun ht => _
     dsimp
     by_cases htr : ∀ n, diam (t n) ≤ r
-    · rw [infᵢ_eq_if, if_pos htr]
+    · rw [iInf_eq_if, if_pos htr]
       congr 1 with n : 1
-      simp only [infᵢ_eq_if, htr n, id, if_true, supᵢ_and']
-    · rw [infᵢ_eq_if, if_neg htr]
+      simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
+    · rw [iInf_eq_if, if_neg htr]
       push_neg  at htr
       rcases htr with ⟨n, hn⟩
       refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
-      rw [supᵢ_eq_if, if_pos, infᵢ_eq_if, if_neg]
+      rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
       exact hn.not_le
       rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
       exact ⟨x, hx⟩
@@ -567,21 +567,21 @@ theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Count
   by
   haveI : ∀ n, Encodable (ι n) := fun n => Encodable.ofCountable _
   simp only [mk_metric_apply]
-  refine' supᵢ₂_le fun ε hε => _
+  refine' iSup₂_le fun ε hε => _
   refine' le_of_forall_le_of_dense fun c hc => _
   rcases((frequently_lt_of_liminf_lt (by infer_param) hc).and_eventually
         ((hr.eventually (gt_mem_nhds hε)).And (ht.and hst))).exists with
     ⟨n, hn, hrn, htn, hstn⟩
   set u : ℕ → Set X := fun j => ⋃ b ∈ decode₂ (ι n) j, t n b
-  refine' infᵢ₂_le_of_le u (by rwa [Union_decode₂]) _
-  refine' infᵢ_le_of_le (fun j => _) _
-  · rw [EMetric.diam_unionᵢ_mem_option]
-    exact supᵢ₂_le fun _ _ => (htn _).trans hrn.le
+  refine' iInf₂_le_of_le u (by rwa [Union_decode₂]) _
+  refine' iInf_le_of_le (fun j => _) _
+  · rw [EMetric.diam_iUnion_mem_option]
+    exact iSup₂_le fun _ _ => (htn _).trans hrn.le
   ·
     calc
       (∑' j : ℕ, ⨆ h : (u j).Nonempty, m (diam (u j))) = _ :=
-        tsum_unionᵢ_decode₂ (fun t : Set X => ⨆ h : t.Nonempty, m (diam t)) (by simp) _
-      _ ≤ ∑' i : ι n, m (diam (t n i)) := (ENNReal.tsum_le_tsum fun b => supᵢ_le fun htb => le_rfl)
+        tsum_iUnion_decode₂ (fun t : Set X => ⨆ h : t.Nonempty, m (diam t)) (by simp) _
+      _ ≤ ∑' i : ι n, m (diam (t n i)) := (ENNReal.tsum_le_tsum fun b => iSup_le fun htb => le_rfl)
       _ ≤ c := hn.le
       
 #align measure_theory.measure.mk_metric_le_liminf_tsum MeasureTheory.Measure.mkMetric_le_liminf_tsum
@@ -691,7 +691,7 @@ theorem no_atoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d
   by
   refine' ⟨fun x => _⟩
   rw [← nonpos_iff_eq_zero, hausdorff_measure_apply]
-  refine' supᵢ₂_le fun ε ε0 => infᵢ₂_le_of_le (fun n => {x}) _ <| infᵢ_le_of_le (fun n => _) _
+  refine' iSup₂_le fun ε ε0 => iInf₂_le_of_le (fun n => {x}) _ <| iInf_le_of_le (fun n => _) _
   · exact subset_Union (fun n => {x} : ℕ → Set X) 0
   · simp only [EMetric.diam_singleton, zero_le]
   · simp [hd]
@@ -716,14 +716,14 @@ theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 :=
           ∑' n, ⨆ h : (t n).Nonempty, diam (t n) ^ (0 : ℝ)
       by
       apply le_trans this _
-      convert le_supᵢ₂ (1 : ℝ≥0∞) zero_lt_one
+      convert le_iSup₂ (1 : ℝ≥0∞) zero_lt_one
       rfl
-    simp only [ENNReal.rpow_zero, le_infᵢ_iff]
+    simp only [ENNReal.rpow_zero, le_iInf_iff]
     intro t hst h't
     rcases mem_Union.1 (hst (mem_singleton x)) with ⟨m, hm⟩
     have A : (t m).Nonempty := ⟨x, hm⟩
     calc
-      (1 : ℝ≥0∞) = ⨆ h : (t m).Nonempty, 1 := by simp only [A, csupᵢ_pos]
+      (1 : ℝ≥0∞) = ⨆ h : (t m).Nonempty, 1 := by simp only [A, ciSup_pos]
       _ ≤ ∑' n, ⨆ h : (t n).Nonempty, 1 := ENNReal.le_tsum _
       
 #align measure_theory.measure.hausdorff_measure_zero_singleton MeasureTheory.Measure.hausdorffMeasure_zero_singleton
@@ -906,25 +906,25 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
   -- Now assume `C ≠ 0`
   · have hCd0 : (C : ℝ≥0∞) ^ d ≠ 0 := by simp [hC0.ne']
     have hCd : (C : ℝ≥0∞) ^ d ≠ ∞ := by simp [hd]
-    simp only [hausdorff_measure_apply, ENNReal.mul_supᵢ, ENNReal.mul_infᵢ_of_ne hCd0 hCd, ←
+    simp only [hausdorff_measure_apply, ENNReal.mul_iSup, ENNReal.mul_iInf_of_ne hCd0 hCd, ←
       ENNReal.tsum_mul_left]
-    refine' supᵢ_le fun R => supᵢ_le fun hR => _
+    refine' iSup_le fun R => iSup_le fun hR => _
     have : tendsto (fun d : ℝ≥0∞ => (C : ℝ≥0∞) * d ^ (r : ℝ)) (𝓝 0) (𝓝 0) :=
       ENNReal.tendsto_const_mul_rpow_nhds_zero_of_pos ENNReal.coe_ne_top hr
     rcases ennreal.nhds_zero_basis_Iic.eventually_iff.1 (this.eventually (gt_mem_nhds hR)) with
       ⟨δ, δ0, H⟩
     refine'
-      le_supᵢ₂_of_le δ δ0
-        (infᵢ₂_mono' fun t hst =>
+      le_iSup₂_of_le δ δ0
+        (iInf₂_mono' fun t hst =>
           ⟨fun n => f '' (t n ∩ s), _,
-            infᵢ_mono' fun htδ =>
+            iInf_mono' fun htδ =>
               ⟨fun n => (h.ediam_image_inter_le (t n)).trans (H (htδ n)).le, _⟩⟩)
     · rw [← image_Union, ← Union_inter]
       exact image_subset _ (subset_inter hst subset.rfl)
     · apply ENNReal.tsum_le_tsum fun n => _
-      simp only [supᵢ_le_iff, nonempty_image_iff]
+      simp only [iSup_le_iff, nonempty_image_iff]
       intro hft
-      simp only [nonempty.mono ((t n).inter_subset_left s) hft, csupᵢ_pos]
+      simp only [nonempty.mono ((t n).inter_subset_left s) hft, ciSup_pos]
       rw [ENNReal.rpow_mul, ← ENNReal.mul_rpow_of_nonneg _ _ hd]
       exact ENNReal.rpow_le_rpow (h.ediam_image_inter_le _) hd
 #align holder_on_with.hausdorff_measure_image_le HolderOnWith.hausdorffMeasure_image_le
@@ -985,17 +985,17 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
       simp only [zero_le, measure_singleton]
   have hKd0 : (K : ℝ≥0∞) ^ d ≠ 0 := by simp [h0]
   have hKd : (K : ℝ≥0∞) ^ d ≠ ∞ := by simp [hd]
-  simp only [hausdorff_measure_apply, ENNReal.mul_supᵢ, ENNReal.mul_infᵢ_of_ne hKd0 hKd, ←
+  simp only [hausdorff_measure_apply, ENNReal.mul_iSup, ENNReal.mul_iInf_of_ne hKd0 hKd, ←
     ENNReal.tsum_mul_left]
-  refine' supᵢ₂_le fun ε ε0 => _
-  refine' le_supᵢ₂_of_le (ε / K) (by simp [ε0.ne']) _
-  refine' le_infᵢ₂ fun t hst => le_infᵢ fun htε => _
+  refine' iSup₂_le fun ε ε0 => _
+  refine' le_iSup₂_of_le (ε / K) (by simp [ε0.ne']) _
+  refine' le_iInf₂ fun t hst => le_iInf fun htε => _
   replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst
   rw [preimage_Union] at hst
-  refine' infᵢ₂_le_of_le _ hst (infᵢ_le_of_le (fun n => _) _)
+  refine' iInf₂_le_of_le _ hst (iInf_le_of_le (fun n => _) _)
   · exact (hf.ediam_preimage_le _).trans (ENNReal.mul_le_of_le_div' <| htε n)
-  · refine' ENNReal.tsum_le_tsum fun n => supᵢ_le_iff.2 fun hft => _
-    simp only [nonempty_of_nonempty_preimage hft, csupᵢ_pos]
+  · refine' ENNReal.tsum_le_tsum fun n => iSup_le_iff.2 fun hft => _
+    simp only [nonempty_of_nonempty_preimage hft, ciSup_pos]
     rw [← ENNReal.mul_rpow_of_nonneg _ _ hd]
     exact ENNReal.rpow_le_rpow (hf.ediam_preimage_le _) hd
 #align antilipschitz_with.hausdorff_measure_preimage_le AntilipschitzWith.hausdorffMeasure_preimage_le
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit 57ac39bd365c2f80589a700f9fbb664d3a1a30c2
+! leanprover-community/mathlib commit 343e80208d29d2d15f8050b929aa50fe4ce71b55
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -379,6 +379,15 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
     · simp [h0]
 #align measure_theory.outer_measure.mk_metric_mono_smul MeasureTheory.OuterMeasure.mkMetric_mono_smul
 
+@[simp]
+theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : OuterMeasure X) = ⊤ :=
+  by
+  simp_rw [mk_metric, mk_metric', mk_metric'.pre, extend_top, bounded_by_top, eq_top_iff]
+  rw [le_supᵢ_iff]
+  intro b hb
+  simpa using hb ⊤
+#align measure_theory.outer_measure.mk_metric_top MeasureTheory.OuterMeasure.mkMetric_top
+
 /-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
@@ -496,6 +505,13 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
   exact outer_measure.mk_metric_mono_smul hc h0 hle s
 #align measure_theory.measure.mk_metric_mono_smul MeasureTheory.Measure.mkMetric_mono_smul
 
+@[simp]
+theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : Measure X) = ⊤ :=
+  by
+  apply to_outer_measure_injective
+  rw [mk_metric_to_outer_measure, outer_measure.mk_metric_top, to_outer_measure_top]
+#align measure_theory.measure.mk_metric_top MeasureTheory.Measure.mkMetric_top
+
 /-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
Diff
@@ -671,7 +671,7 @@ theorem hausdorffMeasure_mono {d₁ d₂ : ℝ} (h : d₁ ≤ d₂) (s : Set X)
 
 variable (X)
 
-theorem no_atoms_hausdorff {d : ℝ} (hd : 0 < d) : HasNoAtoms (hausdorffMeasure d : Measure X) :=
+theorem no_atoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d : Measure X) :=
   by
   refine' ⟨fun x => _⟩
   rw [← nonpos_iff_eq_zero, hausdorff_measure_apply]
Diff
@@ -671,7 +671,7 @@ theorem hausdorffMeasure_mono {d₁ d₂ : ℝ} (h : d₁ ≤ d₂) (s : Set X)
 
 variable (X)
 
-theorem noAtomsHausdorff {d : ℝ} (hd : 0 < d) : HasNoAtoms (hausdorffMeasure d : Measure X) :=
+theorem no_atoms_hausdorff {d : ℝ} (hd : 0 < d) : HasNoAtoms (hausdorffMeasure d : Measure X) :=
   by
   refine' ⟨fun x => _⟩
   rw [← nonpos_iff_eq_zero, hausdorff_measure_apply]
@@ -679,7 +679,7 @@ theorem noAtomsHausdorff {d : ℝ} (hd : 0 < d) : HasNoAtoms (hausdorffMeasure d
   · exact subset_Union (fun n => {x} : ℕ → Set X) 0
   · simp only [EMetric.diam_singleton, zero_le]
   · simp [hd]
-#align measure_theory.measure.no_atoms_hausdorff MeasureTheory.Measure.noAtomsHausdorff
+#align measure_theory.measure.no_atoms_hausdorff MeasureTheory.Measure.no_atoms_hausdorff
 
 variable {X}
 
Diff
@@ -876,13 +876,13 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
   -- We start with the trivial case `C = 0`
   rcases(zero_le C).eq_or_lt with (rfl | hC0)
   · rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩)
-    · simp only [measure_empty, nonpos_iff_eq_zero, mul_zero, image_empty]
+    · simp only [measure_empty, nonpos_iff_eq_zero, MulZeroClass.mul_zero, image_empty]
     have : f '' s = {f x} :=
       haveI : (f '' s).Subsingleton := by simpa [diam_eq_zero_iff] using h.ediam_image_le
       (subsingleton_iff_singleton (mem_image_of_mem f hx)).1 this
     rw [this]
     rcases eq_or_lt_of_le hd with (rfl | h'd)
-    · simp only [ENNReal.rpow_zero, one_mul, mul_zero]
+    · simp only [ENNReal.rpow_zero, one_mul, MulZeroClass.mul_zero]
       rw [hausdorff_measure_zero_singleton]
       exact one_le_hausdorff_measure_zero_of_nonempty ⟨x, hx⟩
     · haveI := no_atoms_hausdorff Y h'd
@@ -962,7 +962,7 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
       exact (subsingleton_iff_singleton hx).1 this
     rw [this]
     rcases eq_or_lt_of_le hd with (rfl | h'd)
-    · simp only [ENNReal.rpow_zero, one_mul, mul_zero]
+    · simp only [ENNReal.rpow_zero, one_mul, MulZeroClass.mul_zero]
       rw [hausdorff_measure_zero_singleton]
       exact one_le_hausdorff_measure_zero_of_nonempty ⟨f x, hx⟩
     · haveI := no_atoms_hausdorff X h'd
Diff
@@ -123,7 +123,7 @@ open Emetric Set Function Filter Encodable FiniteDimensional TopologicalSpace
 
 noncomputable section
 
-variable {ι X Y : Type _} [EmetricSpace X] [EmetricSpace Y]
+variable {ι X Y : Type _} [EMetricSpace X] [EMetricSpace Y]
 
 namespace MeasureTheory
 
@@ -559,7 +559,7 @@ theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Count
   set u : ℕ → Set X := fun j => ⋃ b ∈ decode₂ (ι n) j, t n b
   refine' infᵢ₂_le_of_le u (by rwa [Union_decode₂]) _
   refine' infᵢ_le_of_le (fun j => _) _
-  · rw [Emetric.diam_unionᵢ_mem_option]
+  · rw [EMetric.diam_unionᵢ_mem_option]
     exact supᵢ₂_le fun _ _ => (htn _).trans hrn.le
   ·
     calc
@@ -677,7 +677,7 @@ theorem noAtomsHausdorff {d : ℝ} (hd : 0 < d) : HasNoAtoms (hausdorffMeasure d
   rw [← nonpos_iff_eq_zero, hausdorff_measure_apply]
   refine' supᵢ₂_le fun ε ε0 => infᵢ₂_le_of_le (fun n => {x}) _ <| infᵢ_le_of_le (fun n => _) _
   · exact subset_Union (fun n => {x} : ℕ → Set X) 0
-  · simp only [Emetric.diam_singleton, zero_le]
+  · simp only [EMetric.diam_singleton, zero_le]
   · simp [hd]
 #align measure_theory.measure.no_atoms_hausdorff MeasureTheory.Measure.noAtomsHausdorff
 
Diff
@@ -200,7 +200,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   suffices : μ (⋃ n, S n) ≤ ⨆ n, μ (S n)
   calc
     μ (s ∩ t) + μ (s \ t) = μ (s ∩ t) + μ (⋃ n, S n) := by rw [Union_S]
-    _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := add_le_add le_rfl this
+    _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := (add_le_add le_rfl this)
     _ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_supᵢ
     _ ≤ μ s := supᵢ_le hSs
     
@@ -565,7 +565,7 @@ theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Count
     calc
       (∑' j : ℕ, ⨆ h : (u j).Nonempty, m (diam (u j))) = _ :=
         tsum_unionᵢ_decode₂ (fun t : Set X => ⨆ h : t.Nonempty, m (diam t)) (by simp) _
-      _ ≤ ∑' i : ι n, m (diam (t n i)) := ENNReal.tsum_le_tsum fun b => supᵢ_le fun htb => le_rfl
+      _ ≤ ∑' i : ι n, m (diam (t n i)) := (ENNReal.tsum_le_tsum fun b => supᵢ_le fun htb => le_rfl)
       _ ≤ c := hn.le
       
 #align measure_theory.measure.mk_metric_le_liminf_tsum MeasureTheory.Measure.mkMetric_le_liminf_tsum
@@ -744,7 +744,7 @@ open Measure
 -/
 
 
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic filter.is_bounded_default -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic filter.is_bounded_default -/
 /-- In the space `ι → ℝ`, Hausdorff measure coincides exactly with Lebesgue measure. -/
 @[simp]
 theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 57ac39bd365c2f80589a700f9fbb664d3a1a30c2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -195,7 +195,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     `μ (s ∩ t) + μ (⋃ n, S n) ≤ μ s`. We can't pass to the limit because
     `μ` is only an outer measure. -/
   by_cases htop : μ (s \ t) = ∞
-  · rw [htop, ENNReal.add_top, ← htop]
+  · rw [htop, add_top, ← htop]
     exact μ.mono (diff_subset _ _)
   suffices : μ (⋃ n, S n) ≤ ⨆ n, μ (S n)
   calc
@@ -209,7 +209,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     and the second term tends to zero, see `outer_measure.Union_nat_of_monotone_of_tsum_ne_top`
     for details. -/
   have : ∀ n, S n ⊆ S (n + 1) := fun n x hx =>
-    ⟨hx.1, le_trans (ENNReal.inv_le_inv.2 <| ENNReal.coe_nat_le_coe_nat.2 n.le_succ) hx.2⟩
+    ⟨hx.1, le_trans (ENNReal.inv_le_inv.2 <| Nat.cast_le.2 n.le_succ) hx.2⟩
   refine' (μ.Union_nat_of_monotone_of_tsum_ne_top this _).le
   clear this
   /- While the sets `S (k + 1) \ S k` are not pairwise metric separated, the sets in each
@@ -231,7 +231,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   intro i j hj
   have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ :=
     by
-    rw [ENNReal.inv_lt_inv, ENNReal.coe_nat_lt_coe_nat]
+    rw [ENNReal.inv_lt_inv, Nat.cast_lt]
     linarith
   refine' ⟨(↑(2 * i + 1 + r))⁻¹ - (↑(2 * j + r))⁻¹, by simpa using A, fun x hx y hy => _⟩
   have : inf_edist y t < (↑(2 * j + r))⁻¹ := not_le.1 fun hle => hy.2 ⟨hy.1, hle⟩
@@ -364,7 +364,7 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
     (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by
   classical
-    rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' ENNReal.zero_lt_one).1 hle with ⟨r, hr0, hr⟩
+    rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' zero_lt_one).1 hle with ⟨r, hr0, hr⟩
     refine' fun s =>
       le_of_tendsto_of_tendsto (mk_metric'.tendsto_pre _ s)
         (ENNReal.Tendsto.const_mul (mk_metric'.tendsto_pre _ s) (Or.inr hc))
@@ -383,7 +383,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
     (mkMetric m₁ : OuterMeasure X) ≤ mkMetric m₂ := by
-  convert mk_metric_mono_smul ENNReal.one_ne_top ennreal.zero_lt_one.ne' _ <;> simp [*]
+  convert mk_metric_mono_smul ENNReal.one_ne_top one_ne_zero _ <;> simp [*]
 #align measure_theory.outer_measure.mk_metric_mono MeasureTheory.OuterMeasure.mkMetric_mono
 
 theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
@@ -500,7 +500,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
     (mkMetric m₁ : Measure X) ≤ mkMetric m₂ := by
-  convert mk_metric_mono_smul ENNReal.one_ne_top ennreal.zero_lt_one.ne' _ <;> simp [*]
+  convert mk_metric_mono_smul ENNReal.one_ne_top one_ne_zero _ <;> simp [*]
 #align measure_theory.measure.mk_metric_mono MeasureTheory.Measure.mkMetric_mono
 
 /-- A formula for `measure_theory.measure.mk_metric`. -/
@@ -647,12 +647,10 @@ theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Se
     ENNReal.div_le_iff_le_mul (Or.inr ENNReal.coe_ne_top) (Or.inr <| mt ENNReal.coe_eq_zero.1 hc)]
   rcases eq_or_ne r 0 with (rfl | hr₀)
   · rcases lt_or_le 0 d₂ with (h₂ | h₂)
+    · simp only [h₂, ENNReal.zero_rpow_of_pos, zero_le, ENNReal.zero_div, ENNReal.coe_zero]
     ·
-      simp only [h₂, ENNReal.zero_rpow_of_pos, zero_le', ENNReal.coe_nonneg, ENNReal.zero_div,
+      simp only [h.trans_le h₂, ENNReal.div_top, zero_le, ENNReal.zero_rpow_of_neg,
         ENNReal.coe_zero]
-    ·
-      simp only [h.trans_le h₂, ENNReal.div_top, zero_le', ENNReal.coe_nonneg,
-        ENNReal.zero_rpow_of_neg, ENNReal.coe_zero]
   · have : (r : ℝ≥0∞) ≠ 0 := by simpa only [ENNReal.coe_eq_zero, Ne.def] using hr₀
     rw [← ENNReal.rpow_sub _ _ this ENNReal.coe_ne_top]
     refine' (ENNReal.rpow_lt_rpow hrc (sub_pos.2 h)).le.trans _
@@ -702,7 +700,7 @@ theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 :=
           ∑' n, ⨆ h : (t n).Nonempty, diam (t n) ^ (0 : ℝ)
       by
       apply le_trans this _
-      convert le_supᵢ₂ (1 : ℝ≥0∞) ENNReal.zero_lt_one
+      convert le_supᵢ₂ (1 : ℝ≥0∞) zero_lt_one
       rfl
     simp only [ENNReal.rpow_zero, le_infᵢ_iff]
     intro t hst h't
Diff
@@ -117,7 +117,7 @@ Hausdorff measure, measure, metric measure
 -/
 
 
-open NNReal Ennreal Topology BigOperators
+open NNReal ENNReal Topology BigOperators
 
 open Emetric Set Function Filter Encodable FiniteDimensional TopologicalSpace
 
@@ -169,7 +169,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   rw [borel_eq_generateFrom_isClosed]
   refine' MeasurableSpace.generateFrom_le fun t ht => μ.is_caratheodory_iff_le.2 fun s => _
   set S : ℕ → Set X := fun n => { x ∈ s | (↑n)⁻¹ ≤ inf_edist x t }
-  have n0 : ∀ {n : ℕ}, (n⁻¹ : ℝ≥0∞) ≠ 0 := fun n => Ennreal.inv_ne_zero.2 (Ennreal.nat_ne_top _)
+  have n0 : ∀ {n : ℕ}, (n⁻¹ : ℝ≥0∞) ≠ 0 := fun n => ENNReal.inv_ne_zero.2 (ENNReal.nat_ne_top _)
   have Ssep : ∀ n, IsMetricSeparated (S n) t := fun n =>
     ⟨n⁻¹, n0, fun x hx y hy => hx.2.trans <| inf_edist_le_edist_of_mem hy⟩
   have Ssep' : ∀ n, IsMetricSeparated (S n) (s ∩ t) := fun n =>
@@ -189,19 +189,19 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     refine' subset.antisymm (Union_subset S_sub) _
     rintro x ⟨hxs, hxt⟩
     rw [mem_iff_inf_edist_zero_of_closed ht] at hxt
-    rcases Ennreal.exists_inv_nat_lt hxt with ⟨n, hn⟩
+    rcases ENNReal.exists_inv_nat_lt hxt with ⟨n, hn⟩
     exact mem_Union.2 ⟨n, hxs, hn.le⟩
   /- Now we have `∀ n, μ (s ∩ t) + μ (S n) ≤ μ s` and we need to prove
     `μ (s ∩ t) + μ (⋃ n, S n) ≤ μ s`. We can't pass to the limit because
     `μ` is only an outer measure. -/
   by_cases htop : μ (s \ t) = ∞
-  · rw [htop, Ennreal.add_top, ← htop]
+  · rw [htop, ENNReal.add_top, ← htop]
     exact μ.mono (diff_subset _ _)
   suffices : μ (⋃ n, S n) ≤ ⨆ n, μ (S n)
   calc
     μ (s ∩ t) + μ (s \ t) = μ (s ∩ t) + μ (⋃ n, S n) := by rw [Union_S]
     _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := add_le_add le_rfl this
-    _ = ⨆ n, μ (s ∩ t) + μ (S n) := Ennreal.add_supᵢ
+    _ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_supᵢ
     _ ≤ μ s := supᵢ_le hSs
     
   /- It suffices to show that `∑' k, μ (S (k + 1) \ S k) ≠ ∞`. Indeed, if we have this,
@@ -209,17 +209,17 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     and the second term tends to zero, see `outer_measure.Union_nat_of_monotone_of_tsum_ne_top`
     for details. -/
   have : ∀ n, S n ⊆ S (n + 1) := fun n x hx =>
-    ⟨hx.1, le_trans (Ennreal.inv_le_inv.2 <| Ennreal.coe_nat_le_coe_nat.2 n.le_succ) hx.2⟩
+    ⟨hx.1, le_trans (ENNReal.inv_le_inv.2 <| ENNReal.coe_nat_le_coe_nat.2 n.le_succ) hx.2⟩
   refine' (μ.Union_nat_of_monotone_of_tsum_ne_top this _).le
   clear this
   /- While the sets `S (k + 1) \ S k` are not pairwise metric separated, the sets in each
     subsequence `S (2 * k + 1) \ S (2 * k)` and `S (2 * k + 2) \ S (2 * k)` are metric separated,
     so `m` is additive on each of those sequences. -/
-  rw [← tsum_even_add_odd Ennreal.summable Ennreal.summable, Ennreal.add_ne_top]
+  rw [← tsum_even_add_odd ENNReal.summable ENNReal.summable, ENNReal.add_ne_top]
   suffices : ∀ a, (∑' k : ℕ, μ (S (2 * k + 1 + a) \ S (2 * k + a))) ≠ ∞
   exact ⟨by simpa using this 0, by simpa using this 1⟩
   refine' fun r => ne_top_of_le_ne_top htop _
-  rw [← Union_S, Ennreal.tsum_eq_supᵢ_nat, supᵢ_le_iff]
+  rw [← Union_S, ENNReal.tsum_eq_supᵢ_nat, supᵢ_le_iff]
   intro n
   rw [← hm.finset_Union_of_pairwise_separated]
   · exact μ.mono (Union_subset fun i => Union_subset fun hi x hx => mem_Union.2 ⟨_, hx.1⟩)
@@ -231,13 +231,13 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   intro i j hj
   have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ :=
     by
-    rw [Ennreal.inv_lt_inv, Ennreal.coe_nat_lt_coe_nat]
+    rw [ENNReal.inv_lt_inv, ENNReal.coe_nat_lt_coe_nat]
     linarith
   refine' ⟨(↑(2 * i + 1 + r))⁻¹ - (↑(2 * j + r))⁻¹, by simpa using A, fun x hx y hy => _⟩
   have : inf_edist y t < (↑(2 * j + r))⁻¹ := not_le.1 fun hle => hy.2 ⟨hy.1, hle⟩
   rcases inf_edist_lt_iff.mp this with ⟨z, hzt, hyz⟩
   have hxz : (↑(2 * i + 1 + r))⁻¹ ≤ edist x z := le_inf_edist.1 hx.2 _ hzt
-  apply Ennreal.le_of_add_le_add_right hyz.ne_top
+  apply ENNReal.le_of_add_le_add_right hyz.ne_top
   refine' le_trans _ (edist_triangle _ _ _)
   refine' (add_le_add le_rfl hyz.le).trans (Eq.trans_le _ hxz)
   rw [tsub_add_cancel_of_le A.le]
@@ -313,7 +313,7 @@ theorem tendsto_pre (m : Set X → ℝ≥0∞) (s : Set X) :
 theorem tendsto_pre_nat (m : Set X → ℝ≥0∞) (s : Set X) :
     Tendsto (fun n : ℕ => pre m n⁻¹ s) atTop (𝓝 <| mkMetric' m s) :=
   by
-  refine' (tendsto_pre m s).comp (tendsto_inf.2 ⟨Ennreal.tendsto_inv_nat_nhds_zero, _⟩)
+  refine' (tendsto_pre m s).comp (tendsto_inf.2 ⟨ENNReal.tendsto_inv_nat_nhds_zero, _⟩)
   refine' tendsto_principal.2 (eventually_of_forall fun n => _)
   simp
 #align measure_theory.outer_measure.mk_metric'.tendsto_pre_nat MeasureTheory.OuterMeasure.mkMetric'.tendsto_pre_nat
@@ -364,10 +364,10 @@ theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric :
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
     (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by
   classical
-    rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' Ennreal.zero_lt_one).1 hle with ⟨r, hr0, hr⟩
+    rcases(mem_nhdsWithin_Ici_iff_exists_Ico_subset' ENNReal.zero_lt_one).1 hle with ⟨r, hr0, hr⟩
     refine' fun s =>
       le_of_tendsto_of_tendsto (mk_metric'.tendsto_pre _ s)
-        (Ennreal.Tendsto.const_mul (mk_metric'.tendsto_pre _ s) (Or.inr hc))
+        (ENNReal.Tendsto.const_mul (mk_metric'.tendsto_pre _ s) (Or.inr hc))
         (mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, hr0⟩) fun r' hr' => _)
     simp only [mem_set_of_eq, mk_metric'.pre, RingHom.id_apply]
     rw [← smul_eq_mul, ← smul_apply, smul_bounded_by hc]
@@ -383,7 +383,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
     (mkMetric m₁ : OuterMeasure X) ≤ mkMetric m₂ := by
-  convert mk_metric_mono_smul Ennreal.one_ne_top ennreal.zero_lt_one.ne' _ <;> simp [*]
+  convert mk_metric_mono_smul ENNReal.one_ne_top ennreal.zero_lt_one.ne' _ <;> simp [*]
 #align measure_theory.outer_measure.mk_metric_mono MeasureTheory.OuterMeasure.mkMetric_mono
 
 theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
@@ -500,7 +500,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0
 `mk_metric m₁ hm₁ ≤ mk_metric m₂ hm₂`-/
 theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
     (mkMetric m₁ : Measure X) ≤ mkMetric m₂ := by
-  convert mk_metric_mono_smul Ennreal.one_ne_top ennreal.zero_lt_one.ne' _ <;> simp [*]
+  convert mk_metric_mono_smul ENNReal.one_ne_top ennreal.zero_lt_one.ne' _ <;> simp [*]
 #align measure_theory.measure.mk_metric_mono MeasureTheory.Measure.mkMetric_mono
 
 /-- A formula for `measure_theory.measure.mk_metric`. -/
@@ -527,7 +527,7 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
     · rw [infᵢ_eq_if, if_neg htr]
       push_neg  at htr
       rcases htr with ⟨n, hn⟩
-      refine' Ennreal.tsum_eq_top_of_eq_top ⟨n, _⟩
+      refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
       rw [supᵢ_eq_if, if_pos, infᵢ_eq_if, if_neg]
       exact hn.not_le
       rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
@@ -565,7 +565,7 @@ theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Count
     calc
       (∑' j : ℕ, ⨆ h : (u j).Nonempty, m (diam (u j))) = _ :=
         tsum_unionᵢ_decode₂ (fun t : Set X => ⨆ h : t.Nonempty, m (diam t)) (by simp) _
-      _ ≤ ∑' i : ι n, m (diam (t n i)) := Ennreal.tsum_le_tsum fun b => supᵢ_le fun htb => le_rfl
+      _ ≤ ∑' i : ι n, m (diam (t n i)) := ENNReal.tsum_le_tsum fun b => supᵢ_le fun htb => le_rfl
       _ ≤ c := hn.le
       
 #align measure_theory.measure.mk_metric_le_liminf_tsum MeasureTheory.Measure.mkMetric_le_liminf_tsum
@@ -631,32 +631,32 @@ theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Se
   by_contra' H
   suffices ∀ c : ℝ≥0, c ≠ 0 → μH[d₂] s ≤ c * μH[d₁] s
     by
-    rcases Ennreal.exists_nNReal_pos_mul_lt H.2 H.1 with ⟨c, hc0, hc⟩
+    rcases ENNReal.exists_nnreal_pos_mul_lt H.2 H.1 with ⟨c, hc0, hc⟩
     exact hc.not_le (this c (pos_iff_ne_zero.1 hc0))
   intro c hc
-  refine' le_iff'.1 (mk_metric_mono_smul Ennreal.coe_ne_top (by exact_mod_cast hc) _) s
+  refine' le_iff'.1 (mk_metric_mono_smul ENNReal.coe_ne_top (by exact_mod_cast hc) _) s
   have : 0 < (c ^ (d₂ - d₁)⁻¹ : ℝ≥0∞) :=
     by
-    rw [Ennreal.coe_rpow_of_ne_zero hc, pos_iff_ne_zero, Ne.def, Ennreal.coe_eq_zero,
+    rw [ENNReal.coe_rpow_of_ne_zero hc, pos_iff_ne_zero, Ne.def, ENNReal.coe_eq_zero,
       NNReal.rpow_eq_zero_iff]
     exact mt And.left hc
   filter_upwards [Ico_mem_nhdsWithin_Ici ⟨le_rfl, this⟩]
   rintro r ⟨hr₀, hrc⟩
   lift r to ℝ≥0 using ne_top_of_lt hrc
   rw [Pi.smul_apply, smul_eq_mul, ←
-    Ennreal.div_le_iff_le_mul (Or.inr Ennreal.coe_ne_top) (Or.inr <| mt Ennreal.coe_eq_zero.1 hc)]
+    ENNReal.div_le_iff_le_mul (Or.inr ENNReal.coe_ne_top) (Or.inr <| mt ENNReal.coe_eq_zero.1 hc)]
   rcases eq_or_ne r 0 with (rfl | hr₀)
   · rcases lt_or_le 0 d₂ with (h₂ | h₂)
     ·
-      simp only [h₂, Ennreal.zero_rpow_of_pos, zero_le', Ennreal.coe_nonneg, Ennreal.zero_div,
-        Ennreal.coe_zero]
+      simp only [h₂, ENNReal.zero_rpow_of_pos, zero_le', ENNReal.coe_nonneg, ENNReal.zero_div,
+        ENNReal.coe_zero]
     ·
-      simp only [h.trans_le h₂, Ennreal.div_top, zero_le', Ennreal.coe_nonneg,
-        Ennreal.zero_rpow_of_neg, Ennreal.coe_zero]
-  · have : (r : ℝ≥0∞) ≠ 0 := by simpa only [Ennreal.coe_eq_zero, Ne.def] using hr₀
-    rw [← Ennreal.rpow_sub _ _ this Ennreal.coe_ne_top]
-    refine' (Ennreal.rpow_lt_rpow hrc (sub_pos.2 h)).le.trans _
-    rw [← Ennreal.rpow_mul, inv_mul_cancel (sub_pos.2 h).ne', Ennreal.rpow_one]
+      simp only [h.trans_le h₂, ENNReal.div_top, zero_le', ENNReal.coe_nonneg,
+        ENNReal.zero_rpow_of_neg, ENNReal.coe_zero]
+  · have : (r : ℝ≥0∞) ≠ 0 := by simpa only [ENNReal.coe_eq_zero, Ne.def] using hr₀
+    rw [← ENNReal.rpow_sub _ _ this ENNReal.coe_ne_top]
+    refine' (ENNReal.rpow_lt_rpow hrc (sub_pos.2 h)).le.trans _
+    rw [← ENNReal.rpow_mul, inv_mul_cancel (sub_pos.2 h).ne', ENNReal.rpow_one]
     exact le_rfl
 #align measure_theory.measure.hausdorff_measure_zero_or_top MeasureTheory.Measure.hausdorffMeasure_zero_or_top
 
@@ -702,15 +702,15 @@ theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 :=
           ∑' n, ⨆ h : (t n).Nonempty, diam (t n) ^ (0 : ℝ)
       by
       apply le_trans this _
-      convert le_supᵢ₂ (1 : ℝ≥0∞) Ennreal.zero_lt_one
+      convert le_supᵢ₂ (1 : ℝ≥0∞) ENNReal.zero_lt_one
       rfl
-    simp only [Ennreal.rpow_zero, le_infᵢ_iff]
+    simp only [ENNReal.rpow_zero, le_infᵢ_iff]
     intro t hst h't
     rcases mem_Union.1 (hst (mem_singleton x)) with ⟨m, hm⟩
     have A : (t m).Nonempty := ⟨x, hm⟩
     calc
       (1 : ℝ≥0∞) = ⨆ h : (t m).Nonempty, 1 := by simp only [A, csupᵢ_pos]
-      _ ≤ ∑' n, ⨆ h : (t n).Nonempty, 1 := Ennreal.le_tsum _
+      _ ≤ ∑' n, ⨆ h : (t n).Nonempty, 1 := ENNReal.le_tsum _
       
 #align measure_theory.measure.hausdorff_measure_zero_singleton MeasureTheory.Measure.hausdorffMeasure_zero_singleton
 
@@ -767,8 +767,8 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
     -- first check that `volume s ≤ μH s`
     · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) :=
         by
-        refine' le_hausdorff_measure _ _ ∞ Ennreal.coe_lt_top fun s _ => _
-        rw [Ennreal.rpow_nat_cast]
+        refine' le_hausdorff_measure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
+        rw [ENNReal.rpow_nat_cast]
         exact Real.volume_pi_le_diam_pow s
       rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
       exact measure.le_iff'.1 Hle _
@@ -781,14 +781,14 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
     let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
       Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
     have A : tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) at_top (𝓝 0) := by
-      simp only [one_div, Ennreal.tendsto_inv_nat_nhds_zero]
+      simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
     have B : ∀ᶠ n in at_top, ∀ i : γ n, diam (t n i) ≤ 1 / n :=
       by
       apply eventually_at_top.2 ⟨1, fun n hn => _⟩
       intro f
       apply diam_pi_le_of_le fun b => _
-      simp only [Real.ediam_Icc, add_div, Ennreal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
-        add_sub_add_left_eq_sub, add_sub_cancel', Ennreal.ofReal_one, Ennreal.ofReal_coe_nat]
+      simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), le_refl,
+        add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
     have C : ∀ᶠ n in at_top, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i :=
       by
       apply eventually_at_top.2 ⟨1, fun n hn => _⟩
@@ -832,7 +832,7 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
                 is_bounded_default)
         filter_upwards [B]with _ hn
         apply Finset.sum_le_sum fun i _ => _
-        rw [Ennreal.rpow_nat_cast]
+        rw [ENNReal.rpow_nat_cast]
         exact pow_le_pow_of_le_left' (hn i) _
       _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) at_top := by
         simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
@@ -841,15 +841,15 @@ theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
         by
         simp only [Real.volume_Ioo]
         apply tendsto.liminf_eq
-        refine' Ennreal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
+        refine' ENNReal.tendsto_finset_prod_of_ne_top _ (fun i hi => _) fun i hi => _
         · apply
             tendsto.congr' _
               ((ennreal.continuous_of_real.tendsto _).comp
                 ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
           apply eventually_at_top.2 ⟨1, fun n hn => _⟩
-          simp only [Ennreal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
-            Ennreal.ofReal_coe_nat]
-        · simp only [Ennreal.ofReal_ne_top, Ne.def, not_false_iff]
+          simp only [ENNReal.ofReal_div_of_pos (nat.cast_pos.mpr hn), comp_app,
+            ENNReal.ofReal_coe_nat]
+        · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
       
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 
@@ -884,7 +884,7 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
       (subsingleton_iff_singleton (mem_image_of_mem f hx)).1 this
     rw [this]
     rcases eq_or_lt_of_le hd with (rfl | h'd)
-    · simp only [Ennreal.rpow_zero, one_mul, mul_zero]
+    · simp only [ENNReal.rpow_zero, one_mul, mul_zero]
       rw [hausdorff_measure_zero_singleton]
       exact one_le_hausdorff_measure_zero_of_nonempty ⟨x, hx⟩
     · haveI := no_atoms_hausdorff Y h'd
@@ -892,11 +892,11 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
   -- Now assume `C ≠ 0`
   · have hCd0 : (C : ℝ≥0∞) ^ d ≠ 0 := by simp [hC0.ne']
     have hCd : (C : ℝ≥0∞) ^ d ≠ ∞ := by simp [hd]
-    simp only [hausdorff_measure_apply, Ennreal.mul_supᵢ, Ennreal.mul_infᵢ_of_ne hCd0 hCd, ←
-      Ennreal.tsum_mul_left]
+    simp only [hausdorff_measure_apply, ENNReal.mul_supᵢ, ENNReal.mul_infᵢ_of_ne hCd0 hCd, ←
+      ENNReal.tsum_mul_left]
     refine' supᵢ_le fun R => supᵢ_le fun hR => _
     have : tendsto (fun d : ℝ≥0∞ => (C : ℝ≥0∞) * d ^ (r : ℝ)) (𝓝 0) (𝓝 0) :=
-      Ennreal.tendsto_const_mul_rpow_nhds_zero_of_pos Ennreal.coe_ne_top hr
+      ENNReal.tendsto_const_mul_rpow_nhds_zero_of_pos ENNReal.coe_ne_top hr
     rcases ennreal.nhds_zero_basis_Iic.eventually_iff.1 (this.eventually (gt_mem_nhds hR)) with
       ⟨δ, δ0, H⟩
     refine'
@@ -907,12 +907,12 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
               ⟨fun n => (h.ediam_image_inter_le (t n)).trans (H (htδ n)).le, _⟩⟩)
     · rw [← image_Union, ← Union_inter]
       exact image_subset _ (subset_inter hst subset.rfl)
-    · apply Ennreal.tsum_le_tsum fun n => _
+    · apply ENNReal.tsum_le_tsum fun n => _
       simp only [supᵢ_le_iff, nonempty_image_iff]
       intro hft
       simp only [nonempty.mono ((t n).inter_subset_left s) hft, csupᵢ_pos]
-      rw [Ennreal.rpow_mul, ← Ennreal.mul_rpow_of_nonneg _ _ hd]
-      exact Ennreal.rpow_le_rpow (h.ediam_image_inter_le _) hd
+      rw [ENNReal.rpow_mul, ← ENNReal.mul_rpow_of_nonneg _ _ hd]
+      exact ENNReal.rpow_le_rpow (h.ediam_image_inter_le _) hd
 #align holder_on_with.hausdorff_measure_image_le HolderOnWith.hausdorffMeasure_image_le
 
 end HolderOnWith
@@ -964,26 +964,26 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
       exact (subsingleton_iff_singleton hx).1 this
     rw [this]
     rcases eq_or_lt_of_le hd with (rfl | h'd)
-    · simp only [Ennreal.rpow_zero, one_mul, mul_zero]
+    · simp only [ENNReal.rpow_zero, one_mul, mul_zero]
       rw [hausdorff_measure_zero_singleton]
       exact one_le_hausdorff_measure_zero_of_nonempty ⟨f x, hx⟩
     · haveI := no_atoms_hausdorff X h'd
       simp only [zero_le, measure_singleton]
   have hKd0 : (K : ℝ≥0∞) ^ d ≠ 0 := by simp [h0]
   have hKd : (K : ℝ≥0∞) ^ d ≠ ∞ := by simp [hd]
-  simp only [hausdorff_measure_apply, Ennreal.mul_supᵢ, Ennreal.mul_infᵢ_of_ne hKd0 hKd, ←
-    Ennreal.tsum_mul_left]
+  simp only [hausdorff_measure_apply, ENNReal.mul_supᵢ, ENNReal.mul_infᵢ_of_ne hKd0 hKd, ←
+    ENNReal.tsum_mul_left]
   refine' supᵢ₂_le fun ε ε0 => _
   refine' le_supᵢ₂_of_le (ε / K) (by simp [ε0.ne']) _
   refine' le_infᵢ₂ fun t hst => le_infᵢ fun htε => _
   replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst
   rw [preimage_Union] at hst
   refine' infᵢ₂_le_of_le _ hst (infᵢ_le_of_le (fun n => _) _)
-  · exact (hf.ediam_preimage_le _).trans (Ennreal.mul_le_of_le_div' <| htε n)
-  · refine' Ennreal.tsum_le_tsum fun n => supᵢ_le_iff.2 fun hft => _
+  · exact (hf.ediam_preimage_le _).trans (ENNReal.mul_le_of_le_div' <| htε n)
+  · refine' ENNReal.tsum_le_tsum fun n => supᵢ_le_iff.2 fun hft => _
     simp only [nonempty_of_nonempty_preimage hft, csupᵢ_pos]
-    rw [← Ennreal.mul_rpow_of_nonneg _ _ hd]
-    exact Ennreal.rpow_le_rpow (hf.ediam_preimage_le _) hd
+    rw [← ENNReal.mul_rpow_of_nonneg _ _ hd]
+    exact ENNReal.rpow_le_rpow (hf.ediam_preimage_le _) hd
 #align antilipschitz_with.hausdorff_measure_preimage_le AntilipschitzWith.hausdorffMeasure_preimage_le
 
 theorem le_hausdorffMeasure_image (hf : AntilipschitzWith K f) (hd : 0 ≤ d) (s : Set X) :
@@ -1010,7 +1010,7 @@ theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f)
   by
   simp only [hausdorff_measure, ← outer_measure.coe_mk_metric, ← outer_measure.comap_apply]
   rw [outer_measure.isometry_comap_mk_metric _ hf (hd.imp_left _)]
-  exact fun hd x y hxy => Ennreal.rpow_le_rpow hxy hd
+  exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
 #align isometry.hausdorff_measure_image Isometry.hausdorffMeasure_image
 
 theorem hausdorffMeasure_preimage (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set Y) :

Changes in mathlib4

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

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

Diff
@@ -519,7 +519,7 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
     push_neg at htr; rcases htr with ⟨n, hn⟩
     refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
     rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
-    exact hn.not_le
+    · exact hn.not_le
     rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
     exact ⟨x, hx⟩
 #align measure_theory.measure.mk_metric_apply MeasureTheory.Measure.mkMetric_apply
@@ -799,10 +799,10 @@ theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type*} [NormedA
   suffices ∀ {r : 𝕜}, r ≠ 0 → ∀ s : Set E, μH[d] (r • s) ≤ ‖r‖₊ ^ d • μH[d] s by
     refine' le_antisymm (this hr s) _
     rw [← le_inv_smul_iff_of_pos]
-    dsimp
-    rw [← NNReal.inv_rpow, ← nnnorm_inv]
-    · refine' Eq.trans_le _ (this (inv_ne_zero hr) (r • s))
-      rw [inv_smul_smul₀ hr]
+    · dsimp
+      rw [← NNReal.inv_rpow, ← nnnorm_inv]
+      · refine' Eq.trans_le _ (this (inv_ne_zero hr) (r • s))
+        rw [inv_smul_smul₀ hr]
     · simp [pos_iff_ne_zero, hr]
   intro r _ s
   simp only [NNReal.rpow_eq_pow, ENNReal.smul_def, ← ENNReal.coe_rpow_of_nonneg _ hd, smul_eq_mul]
chore: Rename nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)

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

Diff
@@ -955,7 +955,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
   -- first check that `volume s ≤ μH s`
   · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) := by
       refine' le_hausdorffMeasure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
-      rw [ENNReal.rpow_nat_cast]
+      rw [ENNReal.rpow_natCast]
       exact Real.volume_pi_le_diam_pow s
     rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
     exact Measure.le_iff'.1 Hle _
@@ -1007,7 +1007,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
       refine' liminf_le_liminf _ _
       · filter_upwards [B] with _ hn
         apply Finset.sum_le_sum fun i _ => _
-        simp only [ENNReal.rpow_nat_cast]
+        simp only [ENNReal.rpow_natCast]
         intros i _
         exact pow_le_pow_left' (hn i) _
       · isBoundedDefault
@@ -1021,7 +1021,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
       · apply
           Tendsto.congr' _
             ((ENNReal.continuous_ofReal.tendsto _).comp
-              ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_nat_cast_atTop_atTop))
+              ((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_natCast_atTop_atTop))
         apply eventually_atTop.2 ⟨1, fun n hn => _⟩
         intros n hn
         simp only [ENNReal.ofReal_div_of_pos (Nat.cast_pos.mpr hn), comp_apply,
chore: superfluous parentheses part 2 (#12131)

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

Diff
@@ -186,7 +186,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     exact μ.mono (diff_subset _ _)
   suffices μ (⋃ n, S n) ≤ ⨆ n, μ (S n) by calc
     μ (s ∩ t) + μ (s \ t) = μ (s ∩ t) + μ (⋃ n, S n) := by rw [iUnion_S]
-    _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := (add_le_add le_rfl this)
+    _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := add_le_add le_rfl this
     _ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_iSup
     _ ≤ μ s := iSup_le hSs
   /- It suffices to show that `∑' k, μ (S (k + 1) \ S k) ≠ ∞`. Indeed, if we have this,
@@ -552,7 +552,7 @@ theorem mkMetric_le_liminf_tsum {β : Type*} {ι : β → Type*} [∀ n, Countab
   · calc
       (∑' j : ℕ, ⨆ _ : (u j).Nonempty, m (diam (u j))) = _ :=
         tsum_iUnion_decode₂ (fun t : Set X => ⨆ _ : t.Nonempty, m (diam t)) (by simp) _
-      _ ≤ ∑' i : ι n, m (diam (t n i)) := (ENNReal.tsum_le_tsum fun b => iSup_le fun _ => le_rfl)
+      _ ≤ ∑' i : ι n, m (diam (t n i)) := ENNReal.tsum_le_tsum fun b => iSup_le fun _ => le_rfl
       _ ≤ c := hn.le
 #align measure_theory.measure.mk_metric_le_liminf_tsum MeasureTheory.Measure.mkMetric_le_liminf_tsum
 
chore: Rename coe_nat/coe_int/coe_rat to natCast/intCast/ratCast (#11499)

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

Reduce the diff of #11203

Diff
@@ -160,9 +160,9 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   rw [borel_eq_generateFrom_isClosed]
   refine' MeasurableSpace.generateFrom_le fun t ht => μ.isCaratheodory_iff_le.2 fun s => _
   set S : ℕ → Set X := fun n => {x ∈ s | (↑n)⁻¹ ≤ infEdist x t}
-  have n0 : ∀ {n : ℕ}, (n⁻¹ : ℝ≥0∞) ≠ 0 := fun {n} => ENNReal.inv_ne_zero.2 (ENNReal.nat_ne_top _)
-  have Ssep : ∀ n, IsMetricSeparated (S n) t := fun n =>
-    ⟨n⁻¹, n0, fun x hx y hy => hx.2.trans <| infEdist_le_edist_of_mem hy⟩
+  have Ssep (n) : IsMetricSeparated (S n) t :=
+    ⟨n⁻¹, ENNReal.inv_ne_zero.2 (ENNReal.natCast_ne_top _),
+      fun x hx y hy ↦ hx.2.trans <| infEdist_le_edist_of_mem hy⟩
   have Ssep' : ∀ n, IsMetricSeparated (S n) (s ∩ t) := fun n =>
     (Ssep n).mono Subset.rfl (inter_subset_right _ _)
   have S_sub : ∀ n, S n ⊆ s \ t := fun n =>
@@ -974,7 +974,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
     intro f
     refine' diam_pi_le_of_le fun b => _
     simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (Nat.cast_pos.mpr hn), le_refl,
-      add_sub_add_left_eq_sub, add_sub_cancel_left, ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
+      add_sub_add_left_eq_sub, add_sub_cancel_left, ENNReal.ofReal_one, ENNReal.ofReal_natCast]
   have C : ∀ᶠ n in atTop, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i := by
     refine' eventually_atTop.2 ⟨1, fun n hn => _⟩
     have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
@@ -1025,7 +1025,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
         apply eventually_atTop.2 ⟨1, fun n hn => _⟩
         intros n hn
         simp only [ENNReal.ofReal_div_of_pos (Nat.cast_pos.mpr hn), comp_apply,
-          ENNReal.ofReal_coe_nat]
+          ENNReal.ofReal_natCast]
       · simp only [ENNReal.ofReal_ne_top, Ne, not_false_iff]
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 
chore: remove mathport name: <expression> lines (#11928)

Quoting [@digama0](https://github.com/digama0):

These were actually never meant to go in the file, they are basically debugging information and only useful on significantly broken mathport files. You can safely remove all of them.

Diff
@@ -576,7 +576,6 @@ def hausdorffMeasure (d : ℝ) : Measure X :=
   mkMetric fun r => r ^ d
 #align measure_theory.measure.hausdorff_measure MeasureTheory.Measure.hausdorffMeasure
 
--- mathport name: hausdorff_measure
 scoped[MeasureTheory] notation "μH[" d "]" => MeasureTheory.Measure.hausdorffMeasure d
 
 theorem le_hausdorffMeasure (d : ℝ) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11813)
Diff
@@ -621,7 +621,7 @@ theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Se
   intro c hc
   refine' le_iff'.1 (mkMetric_mono_smul ENNReal.coe_ne_top (mod_cast hc) _) s
   have : 0 < ((c : ℝ≥0∞) ^ (d₂ - d₁)⁻¹) := by
-    rw [ENNReal.coe_rpow_of_ne_zero hc, pos_iff_ne_zero, Ne.def, ENNReal.coe_eq_zero,
+    rw [ENNReal.coe_rpow_of_ne_zero hc, pos_iff_ne_zero, Ne, ENNReal.coe_eq_zero,
       NNReal.rpow_eq_zero_iff]
     exact mt And.left hc
   filter_upwards [Ico_mem_nhdsWithin_Ici ⟨le_rfl, this⟩]
@@ -634,7 +634,7 @@ theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Se
     · simp only [h₂, ENNReal.zero_rpow_of_pos, zero_le, ENNReal.zero_div, ENNReal.coe_zero]
     · simp only [h.trans_le h₂, ENNReal.div_top, zero_le, ENNReal.zero_rpow_of_neg,
         ENNReal.coe_zero]
-  · have : (r : ℝ≥0∞) ≠ 0 := by simpa only [ENNReal.coe_eq_zero, Ne.def] using hr₀
+  · have : (r : ℝ≥0∞) ≠ 0 := by simpa only [ENNReal.coe_eq_zero, Ne] using hr₀
     rw [← ENNReal.rpow_sub _ _ this ENNReal.coe_ne_top]
     refine' (ENNReal.rpow_lt_rpow hrc (sub_pos.2 h)).le.trans _
     rw [← ENNReal.rpow_mul, inv_mul_cancel (sub_pos.2 h).ne', ENNReal.rpow_one]
@@ -1027,7 +1027,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
         intros n hn
         simp only [ENNReal.ofReal_div_of_pos (Nat.cast_pos.mpr hn), comp_apply,
           ENNReal.ofReal_coe_nat]
-      · simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
+      · simp only [ENNReal.ofReal_ne_top, Ne, not_false_iff]
 #align measure_theory.hausdorff_measure_pi_real MeasureTheory.hausdorffMeasure_pi_real
 
 variable (ι X)
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
@@ -975,7 +975,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
     intro f
     refine' diam_pi_le_of_le fun b => _
     simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (Nat.cast_pos.mpr hn), le_refl,
-      add_sub_add_left_eq_sub, add_sub_cancel', ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
+      add_sub_add_left_eq_sub, add_sub_cancel_left, ENNReal.ofReal_one, ENNReal.ofReal_coe_nat]
   have C : ∀ᶠ n in atTop, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i := by
     refine' eventually_atTop.2 ⟨1, fun n hn => _⟩
     have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


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

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

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

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -1101,7 +1101,6 @@ theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace 
 section NormedFieldAffine
 
 variable [NormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace P]
-
 variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
 
 /-- Scaling by `c` around `x` scales the measure by `‖c‖₊ ^ d`. -/
@@ -1133,7 +1132,6 @@ end NormedFieldAffine
 section RealAffine
 
 variable [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace P]
-
 variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
 
 /-- Mapping a set of reals along a line segment scales the measure by the length of a segment.
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
@@ -871,7 +871,7 @@ variable {f : X → Y} {d : ℝ}
 theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
     μH[d] (f '' s) = μH[d] s := by
   simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
-  -- porting note: this proof was slightly nicer before the port
+  -- Porting note: this proof was slightly nicer before the port
   simp only [mkMetric_toOuterMeasure]
   have : 0 ≤ d → Monotone fun r : ℝ≥0∞ ↦ r ^ d := by
     exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
@@ -1079,7 +1079,7 @@ theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace 
   -- break lineMap into pieces
   suffices
       μH[1] ((‖v‖ • ·) '' (LinearMap.toSpanSingleton ℝ E (‖v‖⁻¹ • v) '' s)) = ‖v‖₊ • μH[1] s by
-    -- porting note: proof was shorter, could need some golf
+    -- Porting note: proof was shorter, could need some golf
     simp only [hausdorffMeasure_real, nnreal_smul_coe_apply]
     convert this
     · simp only [image_smul, LinearMap.toSpanSingleton_apply, Set.image_image]
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
@@ -214,7 +214,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
       fun h => (this j i h).symm.mono (fun x hx => by exact ⟨hx.1.1, hx.2⟩) (inter_subset_left _ _)
   intro i j hj
   have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ := by
-    rw [ENNReal.inv_lt_inv, Nat.cast_lt]; linarith
+    rw [ENNReal.inv_lt_inv, Nat.cast_lt]; omega
   refine' ⟨(↑(2 * i + 1 + r))⁻¹ - (↑(2 * j + r))⁻¹, by simpa [tsub_eq_zero_iff_le] using A,
     fun x hx y hy => _⟩
   have : infEdist y t < (↑(2 * j + r))⁻¹ := not_le.1 fun hle => hy.2 ⟨hy.1, hle⟩
chore: more backporting of simp changes from #10995 (#11001)

Co-authored-by: Patrick Massot <patrickmassot@free.fr> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -667,9 +667,9 @@ theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 := by
   · let r : ℕ → ℝ≥0∞ := fun _ => 0
     let t : ℕ → Unit → Set X := fun _ _ => {x}
     have ht : ∀ᶠ n in atTop, ∀ i, diam (t n i) ≤ r n := by
-      simp only [imp_true_iff, eq_self_iff_true, diam_singleton, eventually_atTop,
+      simp only [t, r, imp_true_iff, eq_self_iff_true, diam_singleton, eventually_atTop,
         nonpos_iff_eq_zero, exists_const]
-    simpa [liminf_const] using hausdorffMeasure_le_liminf_sum 0 {x} r tendsto_const_nhds t ht
+    simpa [t, liminf_const] using hausdorffMeasure_le_liminf_sum 0 {x} r tendsto_const_nhds t ht
   · rw [hausdorffMeasure_apply]
     suffices
       (1 : ℝ≥0∞) ≤
@@ -981,7 +981,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
     have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
     intro x hx
     simp only [mem_Ioo, mem_univ_pi] at hx
-    simp only [mem_iUnion, mem_Ioo, mem_univ_pi]
+    simp only [t, mem_iUnion, mem_Ioo, mem_univ_pi]
     let f : γ n := fun i =>
       ⟨⌊(x i - a i) * n⌋₊, by
         apply Nat.floor_lt_ceil_of_lt_of_pos
@@ -1013,7 +1013,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
         exact pow_le_pow_left' (hn i) _
       · isBoundedDefault
     _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) atTop := by
-      simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
+      simp only [γ, Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
         nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
     _ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) := by
       simp only [Real.volume_Ioo]
refactor(MeasureTheory): redefine on measures (#10714)

Redefine on MeasureTheory.Measure so that μ ≤ ν ↔ ∀ s, μ s ≤ ν s by definition instead of ∀ s, MeasurableSet s → μ s ≤ ν s.

Reasons

  • this way it is defeq to on outer measures;
  • if we decide to introduce an order on all DFunLike types and migrate measures to FunLike, then this is unavoidable;
  • the reasoning for the old definition was "it's slightly easier to prove μ ≤ ν this way"; the counter-argument is "it's slightly harder to apply μ ≤ ν this way".

Other changes

  • golf some proofs broken by this change;
  • add @[gcongr] tags to some ENNReal lemmas;
  • fix the name ENNReal.coe_lt_coe_of_le -> ENNReal.ENNReal.coe_lt_coe_of_lt;
  • drop an unneeded MeasurableSet assumption in set_lintegral_pdf_le_map
Diff
@@ -478,8 +478,7 @@ variable [MeasurableSpace X] [BorelSpace X]
 /-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
 (we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mkMetric m₁ hm₁ ≤ c • mkMetric m₂ hm₂`. -/
 theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
-    (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : Measure X) ≤ c • mkMetric m₂ := by
-  intro s _
+    (hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : Measure X) ≤ c • mkMetric m₂ := fun s ↦ by
   rw [← OuterMeasure.coe_mkMetric, coe_smul, ← OuterMeasure.coe_mkMetric]
   exact OuterMeasure.mkMetric_mono_smul hc h0 hle s
 #align measure_theory.measure.mk_metric_mono_smul MeasureTheory.Measure.mkMetric_mono_smul
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
@@ -184,8 +184,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   by_cases htop : μ (s \ t) = ∞
   · rw [htop, add_top, ← htop]
     exact μ.mono (diff_subset _ _)
-  suffices : μ (⋃ n, S n) ≤ ⨆ n, μ (S n)
-  calc
+  suffices μ (⋃ n, S n) ≤ ⨆ n, μ (S n) by calc
     μ (s ∩ t) + μ (s \ t) = μ (s ∩ t) + μ (⋃ n, S n) := by rw [iUnion_S]
     _ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := (add_le_add le_rfl this)
     _ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_iSup
@@ -202,16 +201,15 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
     subsequence `S (2 * k + 1) \ S (2 * k)` and `S (2 * k + 2) \ S (2 * k)` are metric separated,
     so `m` is additive on each of those sequences. -/
   rw [← tsum_even_add_odd ENNReal.summable ENNReal.summable, ENNReal.add_ne_top]
-  suffices : ∀ a, (∑' k : ℕ, μ (S (2 * k + 1 + a) \ S (2 * k + a))) ≠ ∞
-  exact ⟨by simpa using this 0, by simpa using this 1⟩
+  suffices ∀ a, (∑' k : ℕ, μ (S (2 * k + 1 + a) \ S (2 * k + a))) ≠ ∞ from
+    ⟨by simpa using this 0, by simpa using this 1⟩
   refine' fun r => ne_top_of_le_ne_top htop _
   rw [← iUnion_S, ENNReal.tsum_eq_iSup_nat, iSup_le_iff]
   intro n
   rw [← hm.finset_iUnion_of_pairwise_separated]
   · exact μ.mono (iUnion_subset fun i => iUnion_subset fun _ x hx => mem_iUnion.2 ⟨_, hx.1⟩)
-  suffices : ∀ i j, i < j → IsMetricSeparated (S (2 * i + 1 + r)) (s \ S (2 * j + r))
-  exact fun i _ j _ hij =>
-    hij.lt_or_lt.elim
+  suffices ∀ i j, i < j → IsMetricSeparated (S (2 * i + 1 + r)) (s \ S (2 * j + r)) from
+    fun i _ j _ hij => hij.lt_or_lt.elim
       (fun h => (this i j h).mono (inter_subset_left _ _) fun x hx => by exact ⟨hx.1.1, hx.2⟩)
       fun h => (this j i h).symm.mono (fun x hx => by exact ⟨hx.1.1, hx.2⟩) (inter_subset_left _ _)
   intro i j hj
chore: remove @[simp] from tsub_eq_zero_iff_le (#10474)

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

Diff
@@ -217,7 +217,8 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
   intro i j hj
   have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ := by
     rw [ENNReal.inv_lt_inv, Nat.cast_lt]; linarith
-  refine' ⟨(↑(2 * i + 1 + r))⁻¹ - (↑(2 * j + r))⁻¹, by simpa using A, fun x hx y hy => _⟩
+  refine' ⟨(↑(2 * i + 1 + r))⁻¹ - (↑(2 * j + r))⁻¹, by simpa [tsub_eq_zero_iff_le] using A,
+    fun x hx y hy => _⟩
   have : infEdist y t < (↑(2 * j + r))⁻¹ := not_le.1 fun hle => hy.2 ⟨hy.1, hle⟩
   rcases infEdist_lt_iff.mp this with ⟨z, hzt, hyz⟩
   have hxz : (↑(2 * i + 1 + r))⁻¹ ≤ edist x z := le_infEdist.1 hx.2 _ hzt
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
@@ -5,7 +5,6 @@ Authors: Yury Kudryashov
 -/
 import Mathlib.Analysis.Convex.Between
 import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
-import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
 import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
 import Mathlib.Topology.MetricSpace.Holder
 import Mathlib.Topology.MetricSpace.MetricSeparated
chore(Data/Finset): drop some Nonempty arguments (#9377)
  • rename Finset.Nonempty.image_iff to Finset.image_nonempty, deprecate the old version;
  • rename Set.nonempty_image_iff to Set.image_nonempty, deprecate the old version;
  • drop unneeded Finset.Nonempty arguments here and there;
  • add versions of some lemmas that assume Nonempty s instead of Nonempty (s.image f) or Nonempty (s.map f).
Diff
@@ -761,7 +761,7 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
     · rw [← image_iUnion, ← iUnion_inter]
       exact image_subset _ (subset_inter hst Subset.rfl)
     · refine' ENNReal.tsum_le_tsum fun n => _
-      simp only [iSup_le_iff, nonempty_image_iff]
+      simp only [iSup_le_iff, image_nonempty]
       intro hft
       simp only [Nonempty.mono ((t n).inter_subset_left s) hft, ciSup_pos]
       rw [ENNReal.rpow_mul, ← ENNReal.mul_rpow_of_nonneg _ _ hd]
chore(Measure/Hausdorff): use · ^ · instead of NNReal.rpow (#9255)

Also reflow some newlines

Diff
@@ -736,7 +736,7 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
   · rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩)
     · simp only [measure_empty, nonpos_iff_eq_zero, mul_zero, image_empty]
     have : f '' s = {f x} :=
-      haveI : (f '' s).Subsingleton := by simpa [diam_eq_zero_iff] using h.ediam_image_le
+      have : (f '' s).Subsingleton := by simpa [diam_eq_zero_iff] using h.ediam_image_le
       (subsingleton_iff_singleton (mem_image_of_mem f hx)).1 this
     rw [this]
     rcases eq_or_lt_of_le hd with (rfl | h'd)
@@ -755,12 +755,9 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
       ENNReal.tendsto_const_mul_rpow_nhds_zero_of_pos ENNReal.coe_ne_top hr
     rcases ENNReal.nhds_zero_basis_Iic.eventually_iff.1 (this.eventually (gt_mem_nhds hR)) with
       ⟨δ, δ0, H⟩
-    refine'
-      le_iSup₂_of_le δ δ0
-        (iInf₂_mono' fun t hst =>
-          ⟨fun n => f '' (t n ∩ s), _,
-            iInf_mono' fun htδ =>
-              ⟨fun n => (h.ediam_image_inter_le (t n)).trans (H (htδ n)).le, _⟩⟩)
+    refine le_iSup₂_of_le δ δ0 <| iInf₂_mono' fun t hst ↦
+      ⟨fun n => f '' (t n ∩ s), ?_, iInf_mono' fun htδ ↦
+        ⟨fun n => (h.ediam_image_inter_le (t n)).trans (H (htδ n)).le, ?_⟩⟩
     · rw [← image_iUnion, ← iUnion_inter]
       exact image_subset _ (subset_inter hst Subset.rfl)
     · refine' ENNReal.tsum_le_tsum fun n => _
@@ -802,8 +799,8 @@ open scoped Pointwise
 
 theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type*} [NormedAddCommGroup E]
     [NormedField 𝕜] [NormedSpace 𝕜 E] [MeasurableSpace E] [BorelSpace E] {d : ℝ} (hd : 0 ≤ d)
-    {r : 𝕜} (hr : r ≠ 0) (s : Set E) : μH[d] (r • s) = NNReal.rpow ‖r‖₊ d • μH[d] s := by
-  suffices ∀ {r : 𝕜}, r ≠ 0 → ∀ s : Set E, μH[d] (r • s) ≤ NNReal.rpow ‖r‖₊ d • μH[d] s by
+    {r : 𝕜} (hr : r ≠ 0) (s : Set E) : μH[d] (r • s) = ‖r‖₊ ^ d • μH[d] s := by
+  suffices ∀ {r : 𝕜}, r ≠ 0 → ∀ s : Set E, μH[d] (r • s) ≤ ‖r‖₊ ^ d • μH[d] s by
     refine' le_antisymm (this hr s) _
     rw [← le_inv_smul_iff_of_pos]
     dsimp
@@ -820,7 +817,6 @@ theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type*} [NormedA
 ### Antilipschitz maps do not decrease Hausdorff measures and dimension
 -/
 
-
 namespace AntilipschitzWith
 
 variable {f : X → Y} {K : ℝ≥0} {d : ℝ}
@@ -951,15 +947,13 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
     (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
   classical
   -- it suffices to check that the two measures coincide on products of rational intervals
-  refine'
-    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
-        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
+  refine (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
+    (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) ?_).symm
   simp only [mem_iUnion, mem_singleton_iff]
   -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
   intro s hs
   choose a b H using hs
-  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
-  exact funext fun i => (H i).2
+  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i) := funext fun i => (H i).2
   replace H := fun i => (H i).1
   apply le_antisymm _
   -- first check that `volume s ≤ μH s`
@@ -1072,10 +1066,10 @@ theorem hausdorffMeasure_prod_real : (μH[2] : Measure (ℝ × ℝ)) = volume :=
 
 /-! ### Geometric results in affine spaces -/
 
-
 section Geometric
 
 variable {𝕜 E P : Type*}
+
 theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace ℝ E]
     [MeasurableSpace E] [BorelSpace E] (v : E) (s : Set ℝ) :
     μH[1] ((fun r => r • v) '' s) = ‖v‖₊ • μH[1] s := by
@@ -1104,8 +1098,7 @@ theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace 
     refine' AddMonoidHomClass.isometry_of_norm _ fun x => (norm_smul _ _).trans _
     rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel hn, mul_one, LinearMap.id_apply]
   rw [Set.image_smul, Measure.hausdorffMeasure_smul₀ zero_le_one hn, nnnorm_norm,
-      NNReal.rpow_eq_pow, NNReal.rpow_one,
-      iso_smul.hausdorffMeasure_image (Or.inl <| zero_le_one' ℝ)]
+      NNReal.rpow_one, iso_smul.hausdorffMeasure_image (Or.inl <| zero_le_one' ℝ)]
 #align measure_theory.hausdorff_measure_smul_right_image MeasureTheory.hausdorffMeasure_smul_right_image
 
 section NormedFieldAffine
@@ -1116,10 +1109,10 @@ variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
 
 /-- Scaling by `c` around `x` scales the measure by `‖c‖₊ ^ d`. -/
 theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
-    (s : Set P) : μH[d] (AffineMap.homothety x c '' s) = NNReal.rpow ‖c‖₊ d • μH[d] s := by
+    (s : Set P) : μH[d] (AffineMap.homothety x c '' s) = ‖c‖₊ ^ d • μH[d] s := by
   suffices
     μH[d] (IsometryEquiv.vaddConst x '' ((c • ·) '' ((IsometryEquiv.vaddConst x).symm '' s))) =
-      NNReal.rpow ‖c‖₊ d • μH[d] s by
+      ‖c‖₊ ^ d • μH[d] s by
     simpa only [Set.image_image]
   borelize E
   rw [IsometryEquiv.hausdorffMeasure_image, Set.image_smul, Measure.hausdorffMeasure_smul₀ hd hc,
@@ -1127,7 +1120,7 @@ theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 
 #align measure_theory.hausdorff_measure_homothety_image MeasureTheory.hausdorffMeasure_homothety_image
 
 theorem hausdorffMeasure_homothety_preimage {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
-    (s : Set P) : μH[d] (AffineMap.homothety x c ⁻¹' s) = NNReal.rpow ‖c‖₊⁻¹ d • μH[d] s := by
+    (s : Set P) : μH[d] (AffineMap.homothety x c ⁻¹' s) = ‖c‖₊⁻¹ ^ d • μH[d] s := by
   change μH[d] (AffineEquiv.homothetyUnitsMulHom x (Units.mk0 c hc) ⁻¹' s) = _
   rw [← AffineEquiv.image_symm, AffineEquiv.coe_homothetyUnitsMulHom_apply_symm,
     hausdorffMeasure_homothety_image hd x (_ : 𝕜ˣ).isUnit.ne_zero, Units.val_inv_eq_inv_val,
refactor: Deduplicate monotonicity of lemmas (#9179)

Remove the duplicates introduced in #8869 by sorting the lemmas in Algebra.Order.SMul into three files:

  • Algebra.Order.Module.Defs for the order isomorphism induced by scalar multiplication by a positivity element
  • Algebra.Order.Module.Pointwise for the order properties of scalar multiplication of sets. This file is new. I credit myself for https://github.com/leanprover-community/mathlib/pull/9078
  • Algebra.Order.Module.OrderedSMul: The material about OrderedSMul per se. Inherits the copyright header from Algebra.Order.SMul. This file should eventually be deleted.

I move each #align to the correct file. On top of that, I delete unused redundant OrderedSMul instances (they were useful in Lean 3, but not anymore) and eq_of_smul_eq_smul_of_pos_of_le/eq_of_smul_eq_smul_of_neg_of_le since those lemmas are weird and unused.

Diff
@@ -805,12 +805,12 @@ theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type*} [NormedA
     {r : 𝕜} (hr : r ≠ 0) (s : Set E) : μH[d] (r • s) = NNReal.rpow ‖r‖₊ d • μH[d] s := by
   suffices ∀ {r : 𝕜}, r ≠ 0 → ∀ s : Set E, μH[d] (r • s) ≤ NNReal.rpow ‖r‖₊ d • μH[d] s by
     refine' le_antisymm (this hr s) _
-    rw [← ENNReal.le_inv_smul_iff]
+    rw [← le_inv_smul_iff_of_pos]
     dsimp
     rw [← NNReal.inv_rpow, ← nnnorm_inv]
     · refine' Eq.trans_le _ (this (inv_ne_zero hr) (r • s))
       rw [inv_smul_smul₀ hr]
-    · simp [hr]
+    · simp [pos_iff_ne_zero, hr]
   intro r _ s
   simp only [NNReal.rpow_eq_pow, ENNReal.smul_def, ← ENNReal.coe_rpow_of_nonneg _ hd, smul_eq_mul]
   exact (lipschitzWith_smul (β := E) r).hausdorffMeasure_image_le hd s
chore: Rename pow monotonicity lemmas (#9095)

The names for lemmas about monotonicity of (a ^ ·) and (· ^ n) were a mess. This PR tidies up everything related by following the naming convention for (a * ·) and (· * b). Namely, (a ^ ·) is pow_right and (· ^ n) is pow_left in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.

Renames

Algebra.GroupPower.Order

  • pow_monopow_right_mono
  • pow_le_powpow_le_pow_right
  • pow_le_pow_of_le_leftpow_le_pow_left
  • pow_lt_pow_of_lt_leftpow_lt_pow_left
  • strictMonoOn_powpow_left_strictMonoOn
  • pow_strictMono_rightpow_right_strictMono
  • pow_lt_powpow_lt_pow_right
  • pow_lt_pow_iffpow_lt_pow_iff_right
  • pow_le_pow_iffpow_le_pow_iff_right
  • self_lt_powlt_self_pow
  • strictAnti_powpow_right_strictAnti
  • pow_lt_pow_iff_of_lt_onepow_lt_pow_iff_right_of_lt_one
  • pow_lt_pow_of_lt_onepow_lt_pow_right_of_lt_one
  • lt_of_pow_lt_powlt_of_pow_lt_pow_left
  • le_of_pow_le_powle_of_pow_le_pow_left
  • pow_lt_pow₀pow_lt_pow_right₀

Algebra.GroupPower.CovariantClass

  • pow_le_pow_of_le_left'pow_le_pow_left'
  • nsmul_le_nsmul_of_le_rightnsmul_le_nsmul_right
  • pow_lt_pow'pow_lt_pow_right'
  • nsmul_lt_nsmulnsmul_lt_nsmul_left
  • pow_strictMono_leftpow_right_strictMono'
  • nsmul_strictMono_rightnsmul_left_strictMono
  • StrictMono.pow_right'StrictMono.pow_const
  • StrictMono.nsmul_leftStrictMono.const_nsmul
  • pow_strictMono_right'pow_left_strictMono
  • nsmul_strictMono_leftnsmul_right_strictMono
  • Monotone.pow_rightMonotone.pow_const
  • Monotone.nsmul_leftMonotone.const_nsmul
  • lt_of_pow_lt_pow'lt_of_pow_lt_pow_left'
  • lt_of_nsmul_lt_nsmullt_of_nsmul_lt_nsmul_right
  • pow_le_pow'pow_le_pow_right'
  • nsmul_le_nsmulnsmul_le_nsmul_left
  • pow_le_pow_of_le_one'pow_le_pow_right_of_le_one'
  • nsmul_le_nsmul_of_nonposnsmul_le_nsmul_left_of_nonpos
  • le_of_pow_le_pow'le_of_pow_le_pow_left'
  • le_of_nsmul_le_nsmul'le_of_nsmul_le_nsmul_right'
  • pow_le_pow_iff'pow_le_pow_iff_right'
  • nsmul_le_nsmul_iffnsmul_le_nsmul_iff_left
  • pow_lt_pow_iff'pow_lt_pow_iff_right'
  • nsmul_lt_nsmul_iffnsmul_lt_nsmul_iff_left

Data.Nat.Pow

  • Nat.pow_lt_pow_of_lt_leftNat.pow_lt_pow_left
  • Nat.pow_le_iff_le_leftNat.pow_le_pow_iff_left
  • Nat.pow_lt_iff_lt_leftNat.pow_lt_pow_iff_left

Lemmas added

  • pow_le_pow_iff_left
  • pow_lt_pow_iff_left
  • pow_right_injective
  • pow_right_inj
  • Nat.pow_le_pow_left to have the correct name since Nat.pow_le_pow_of_le_left is in Std.
  • Nat.pow_le_pow_right to have the correct name since Nat.pow_le_pow_of_le_right is in Std.

Lemmas removed

  • self_le_pow was a duplicate of le_self_pow.
  • Nat.pow_lt_pow_of_lt_right is defeq to pow_lt_pow_right.
  • Nat.pow_right_strictMono is defeq to pow_right_strictMono.
  • Nat.pow_le_iff_le_right is defeq to pow_le_pow_iff_right.
  • Nat.pow_lt_iff_lt_right is defeq to pow_lt_pow_iff_right.

Other changes

  • A bunch of proofs have been golfed.
  • Some lemma assumptions have been turned from 0 < n or 1 ≤ n to n ≠ 0.
  • A few Nat lemmas have been protected.
  • One docstring has been fixed.
Diff
@@ -1019,7 +1019,7 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
         apply Finset.sum_le_sum fun i _ => _
         simp only [ENNReal.rpow_nat_cast]
         intros i _
-        exact pow_le_pow_of_le_left' (hn i) _
+        exact pow_le_pow_left' (hn i) _
       · isBoundedDefault
     _ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) atTop := by
       simp only [Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
chore: Replace (· op ·) a by (a op ·) (#8843)

I used the regex \(\(· (.) ·\) (.)\), replacing with ($2 $1 ·).

Diff
@@ -927,7 +927,7 @@ namespace MeasureTheory
 
 @[to_additive]
 theorem hausdorffMeasure_smul {α : Type*} [SMul α X] [IsometricSMul α X] {d : ℝ} (c : α)
-    (h : 0 ≤ d ∨ Surjective ((· • ·) c : X → X)) (s : Set X) : μH[d] (c • s) = μH[d] s :=
+    (h : 0 ≤ d ∨ Surjective (c • · : X → X)) (s : Set X) : μH[d] (c • s) = μH[d] s :=
   (isometry_smul X c).hausdorffMeasure_image h _
 #align measure_theory.hausdorff_measure_smul MeasureTheory.hausdorffMeasure_smul
 #align measure_theory.hausdorff_measure_vadd MeasureTheory.hausdorffMeasure_vadd
@@ -1087,7 +1087,7 @@ theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace 
   have hn : ‖v‖ ≠ 0 := norm_ne_zero_iff.mpr hv
   -- break lineMap into pieces
   suffices
-      μH[1] ((· • ·) ‖v‖ '' (LinearMap.toSpanSingleton ℝ E (‖v‖⁻¹ • v) '' s)) = ‖v‖₊ • μH[1] s by
+      μH[1] ((‖v‖ • ·) '' (LinearMap.toSpanSingleton ℝ E (‖v‖⁻¹ • v) '' s)) = ‖v‖₊ • μH[1] s by
     -- porting note: proof was shorter, could need some golf
     simp only [hausdorffMeasure_real, nnreal_smul_coe_apply]
     convert this
@@ -1118,7 +1118,7 @@ variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
 theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
     (s : Set P) : μH[d] (AffineMap.homothety x c '' s) = NNReal.rpow ‖c‖₊ d • μH[d] s := by
   suffices
-    μH[d] (IsometryEquiv.vaddConst x '' ((· • ·) c '' ((IsometryEquiv.vaddConst x).symm '' s))) =
+    μH[d] (IsometryEquiv.vaddConst x '' ((c • ·) '' ((IsometryEquiv.vaddConst x).symm '' s))) =
       NNReal.rpow ‖c‖₊ d • μH[d] s by
     simpa only [Set.image_image]
   borelize E
chore: rename by_contra' to by_contra! (#8797)

To fit with the "please try harder" convention of ! tactics.

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

Diff
@@ -617,7 +617,7 @@ theorem hausdorffMeasure_le_liminf_sum {β : Type*} {ι : β → Type*} [∀ n,
 /-- If `d₁ < d₂`, then for any set `s` we have either `μH[d₂] s = 0`, or `μH[d₁] s = ∞`. -/
 theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Set X) :
     μH[d₂] s = 0 ∨ μH[d₁] s = ∞ := by
-  by_contra' H
+  by_contra! H
   suffices ∀ c : ℝ≥0, c ≠ 0 → μH[d₂] s ≤ c * μH[d₁] s by
     rcases ENNReal.exists_nnreal_pos_mul_lt H.2 H.1 with ⟨c, hc0, hc⟩
     exact hc.not_le (this c (pos_iff_ne_zero.1 hc0))
chore: replace exact_mod_cast tactic with mod_cast elaborator where possible (#8404)

We still have the exact_mod_cast tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast are the ones that don't work using the term elaborator by itself.

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

Diff
@@ -622,7 +622,7 @@ theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Se
     rcases ENNReal.exists_nnreal_pos_mul_lt H.2 H.1 with ⟨c, hc0, hc⟩
     exact hc.not_le (this c (pos_iff_ne_zero.1 hc0))
   intro c hc
-  refine' le_iff'.1 (mkMetric_mono_smul ENNReal.coe_ne_top (by exact_mod_cast hc) _) s
+  refine' le_iff'.1 (mkMetric_mono_smul ENNReal.coe_ne_top (mod_cast hc) _) s
   have : 0 < ((c : ℝ≥0∞) ^ (d₂ - d₁)⁻¹) := by
     rw [ENNReal.coe_rpow_of_ne_zero hc, pos_iff_ne_zero, Ne.def, ENNReal.coe_eq_zero,
       NNReal.rpow_eq_zero_iff]
fix: remove remaining ^ fixes (#8463)
Diff
@@ -880,7 +880,7 @@ theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f)
   simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
   -- porting note: this proof was slightly nicer before the port
   simp only [mkMetric_toOuterMeasure]
-  have : 0 ≤ d → Monotone fun r ↦ @HPow.hPow ℝ≥0∞ ℝ ℝ≥0∞ instHPow r d := by
+  have : 0 ≤ d → Monotone fun r : ℝ≥0∞ ↦ r ^ d := by
     exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
   have := OuterMeasure.isometry_comap_mkMetric (fun (r : ℝ≥0∞) => r ^ d) hf (hd.imp_left this)
   congr
chore: move TopologicalSpace.SecondCountableTopology into the root namespace (#8186)

All the other properties of topological spaces like T0Space or RegularSpace are in the root namespace. Many files were opening TopologicalSpace just for the sake of shortening TopologicalSpace.SecondCountableTopology...

Diff
@@ -1042,14 +1042,14 @@ theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
 variable (ι X)
 
 theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι]
-    [TopologicalSpace.SecondCountableTopology X] (d : ℝ) :
+    [SecondCountableTopology X] (d : ℝ) :
     MeasurePreserving (MeasurableEquiv.funUnique ι X) μH[d] μH[d] :=
   (IsometryEquiv.funUnique ι X).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_fun_unique MeasureTheory.hausdorffMeasure_measurePreserving_funUnique
 
 theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type*)
     [∀ i, MeasurableSpace (α i)] [∀ i, EMetricSpace (α i)] [∀ i, BorelSpace (α i)]
-    [∀ i, TopologicalSpace.SecondCountableTopology (α i)] (d : ℝ) :
+    [∀ i, SecondCountableTopology (α i)] (d : ℝ) :
     MeasurePreserving (MeasurableEquiv.piFinTwo α) μH[d] μH[d] :=
   (IsometryEquiv.piFinTwo α).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_pi_fin_two MeasureTheory.hausdorffMeasure_measurePreserving_piFinTwo
chore: fix nonterminal simps (#7497)

Fixes the nonterminal simps identified by #7496

Diff
@@ -1093,7 +1093,7 @@ theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace 
     convert this
     · simp only [image_smul, LinearMap.toSpanSingleton_apply, Set.image_image]
       ext e
-      simp
+      simp only [mem_image]
       refine' ⟨fun ⟨x, h⟩ => ⟨x, _⟩, fun ⟨x, h⟩ => ⟨x, _⟩⟩
       · rw [smul_comm (norm _), smul_comm (norm _), inv_smul_smul₀ hn]
         exact h
chore: update/remove heart beat bumps (#6860)

We clean up heart beat bumps after #6474.

Diff
@@ -154,7 +154,6 @@ theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {
       hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
 #align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
 
-set_option maxHeartbeats 300000 in
 /-- Caratheodory theorem. If `m` is a metric outer measure, then every Borel measurable set `t` is
 Caratheodory measurable: for any (not necessarily measurable) set `s` we have
 `μ (s ∩ t) + μ (s \ t) = μ s`. -/
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

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

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

Diff
@@ -735,13 +735,13 @@ theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : 
   -- We start with the trivial case `C = 0`
   rcases (zero_le C).eq_or_lt with (rfl | hC0)
   · rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩)
-    · simp only [measure_empty, nonpos_iff_eq_zero, MulZeroClass.mul_zero, image_empty]
+    · simp only [measure_empty, nonpos_iff_eq_zero, mul_zero, image_empty]
     have : f '' s = {f x} :=
       haveI : (f '' s).Subsingleton := by simpa [diam_eq_zero_iff] using h.ediam_image_le
       (subsingleton_iff_singleton (mem_image_of_mem f hx)).1 this
     rw [this]
     rcases eq_or_lt_of_le hd with (rfl | h'd)
-    · simp only [ENNReal.rpow_zero, one_mul, MulZeroClass.mul_zero]
+    · simp only [ENNReal.rpow_zero, one_mul, mul_zero]
       rw [hausdorffMeasure_zero_singleton]
       exact one_le_hausdorffMeasure_zero_of_nonempty ⟨x, hx⟩
     · haveI := noAtoms_hausdorff Y h'd
@@ -837,7 +837,7 @@ theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d)
       exact (subsingleton_iff_singleton hx).1 this
     rw [this]
     rcases eq_or_lt_of_le hd with (rfl | h'd)
-    · simp only [ENNReal.rpow_zero, one_mul, MulZeroClass.mul_zero]
+    · simp only [ENNReal.rpow_zero, one_mul, mul_zero]
       rw [hausdorffMeasure_zero_singleton]
       exact one_le_hausdorffMeasure_zero_of_nonempty ⟨f x, hx⟩
     · haveI := noAtoms_hausdorff X h'd
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
@@ -116,7 +116,7 @@ open EMetric Set Function Filter Encodable FiniteDimensional TopologicalSpace
 
 noncomputable section
 
-variable {ι X Y : Type _} [EMetricSpace X] [EMetricSpace Y]
+variable {ι X Y : Type*} [EMetricSpace X] [EMetricSpace Y]
 
 namespace MeasureTheory
 
@@ -537,7 +537,7 @@ theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : Measure X) (ε : ℝ
 /-- To bound the Hausdorff measure (or, more generally, for a measure defined using
 `MeasureTheory.Measure.mkMetric`) of a set, one may use coverings with maximum diameter tending to
 `0`, indexed by any sequence of countable types. -/
-theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Countable (ι n)] (s : Set X)
+theorem mkMetric_le_liminf_tsum {β : Type*} {ι : β → Type*} [∀ n, Countable (ι n)] (s : Set X)
     {l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0)) (t : ∀ n : β, ι n → Set X)
     (ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n) (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) (m : ℝ≥0∞ → ℝ≥0∞) :
     mkMetric m s ≤ liminf (fun n => ∑' i, m (diam (t n i))) l := by
@@ -563,7 +563,7 @@ theorem mkMetric_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Count
 /-- To bound the Hausdorff measure (or, more generally, for a measure defined using
 `MeasureTheory.Measure.mkMetric`) of a set, one may use coverings with maximum diameter tending to
 `0`, indexed by any sequence of finite types. -/
-theorem mkMetric_le_liminf_sum {β : Type _} {ι : β → Type _} [hι : ∀ n, Fintype (ι n)] (s : Set X)
+theorem mkMetric_le_liminf_sum {β : Type*} {ι : β → Type*} [hι : ∀ n, Fintype (ι n)] (s : Set X)
     {l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0)) (t : ∀ n : β, ι n → Set X)
     (ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n) (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) (m : ℝ≥0∞ → ℝ≥0∞) :
     mkMetric m s ≤ liminf (fun n => ∑ i, m (diam (t n i))) l := by
@@ -599,7 +599,7 @@ theorem hausdorffMeasure_apply (d : ℝ) (s : Set X) :
 
 /-- To bound the Hausdorff measure of a set, one may use coverings with maximum diameter tending
 to `0`, indexed by any sequence of countable types. -/
-theorem hausdorffMeasure_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀ n, Countable (ι n)]
+theorem hausdorffMeasure_le_liminf_tsum {β : Type*} {ι : β → Type*} [∀ n, Countable (ι n)]
     (d : ℝ) (s : Set X) {l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0))
     (t : ∀ n : β, ι n → Set X) (ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n)
     (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) : μH[d] s ≤ liminf (fun n => ∑' i, diam (t n i) ^ d) l :=
@@ -608,7 +608,7 @@ theorem hausdorffMeasure_le_liminf_tsum {β : Type _} {ι : β → Type _} [∀
 
 /-- To bound the Hausdorff measure of a set, one may use coverings with maximum diameter tending
 to `0`, indexed by any sequence of finite types. -/
-theorem hausdorffMeasure_le_liminf_sum {β : Type _} {ι : β → Type _} [∀ n, Fintype (ι n)]
+theorem hausdorffMeasure_le_liminf_sum {β : Type*} {ι : β → Type*} [∀ n, Fintype (ι n)]
     (d : ℝ) (s : Set X) {l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0))
     (t : ∀ n : β, ι n → Set X) (ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n)
     (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) : μH[d] s ≤ liminf (fun n => ∑ i, diam (t n i) ^ d) l :=
@@ -801,7 +801,7 @@ end LipschitzWith
 
 open scoped Pointwise
 
-theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type _} [NormedAddCommGroup E]
+theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type*} [NormedAddCommGroup E]
     [NormedField 𝕜] [NormedSpace 𝕜 E] [MeasurableSpace E] [BorelSpace E] {d : ℝ} (hd : 0 ≤ d)
     {r : 𝕜} (hr : r ≠ 0) (s : Set E) : μH[d] (r • s) = NNReal.rpow ‖r‖₊ d • μH[d] s := by
   suffices ∀ {r : 𝕜}, r ≠ 0 → ∀ s : Set E, μH[d] (r • s) ≤ NNReal.rpow ‖r‖₊ d • μH[d] s by
@@ -927,7 +927,7 @@ end IsometryEquiv
 namespace MeasureTheory
 
 @[to_additive]
-theorem hausdorffMeasure_smul {α : Type _} [SMul α X] [IsometricSMul α X] {d : ℝ} (c : α)
+theorem hausdorffMeasure_smul {α : Type*} [SMul α X] [IsometricSMul α X] {d : ℝ} (c : α)
     (h : 0 ≤ d ∨ Surjective ((· • ·) c : X → X)) (s : Set X) : μH[d] (c • s) = μH[d] s :=
   (isometry_smul X c).hausdorffMeasure_image h _
 #align measure_theory.hausdorff_measure_smul MeasureTheory.hausdorffMeasure_smul
@@ -948,7 +948,7 @@ instance {d : ℝ} [Group X] [IsometricSMul Xᵐᵒᵖ X] : IsMulRightInvariant
 
 /-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
 @[simp]
-theorem hausdorffMeasure_pi_real {ι : Type _} [Fintype ι] :
+theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
     (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
   classical
   -- it suffices to check that the two measures coincide on products of rational intervals
@@ -1048,7 +1048,7 @@ theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι]
   (IsometryEquiv.funUnique ι X).measurePreserving_hausdorffMeasure _
 #align measure_theory.hausdorff_measure_measure_preserving_fun_unique MeasureTheory.hausdorffMeasure_measurePreserving_funUnique
 
-theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type _)
+theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type*)
     [∀ i, MeasurableSpace (α i)] [∀ i, EMetricSpace (α i)] [∀ i, BorelSpace (α i)]
     [∀ i, TopologicalSpace.SecondCountableTopology (α i)] (d : ℝ) :
     MeasurePreserving (MeasurableEquiv.piFinTwo α) μH[d] μH[d] :=
@@ -1076,7 +1076,7 @@ theorem hausdorffMeasure_prod_real : (μH[2] : Measure (ℝ × ℝ)) = volume :=
 
 section Geometric
 
-variable {𝕜 E P : Type _}
+variable {𝕜 E P : Type*}
 theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace ℝ E]
     [MeasurableSpace E] [BorelSpace E] (v : E) (s : Set ℝ) :
     μH[1] ((fun r => r • v) '' s) = ‖v‖₊ • μH[1] s := by
@@ -1171,7 +1171,7 @@ end RealAffine
 
 /-- The measure of a segment is the distance between its endpoints. -/
 @[simp]
-theorem hausdorffMeasure_segment {E : Type _} [NormedAddCommGroup E] [NormedSpace ℝ E]
+theorem hausdorffMeasure_segment {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
     [MeasurableSpace E] [BorelSpace E] (x y : E) : μH[1] (segment ℝ x y) = edist x y := by
   rw [← affineSegment_eq_segment, hausdorffMeasure_affineSegment]
 #align measure_theory.hausdorff_measure_segment MeasureTheory.hausdorffMeasure_segment
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) 2021 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
-
-! This file was ported from Lean 3 source module measure_theory.measure.hausdorff
-! leanprover-community/mathlib commit 3d5c4a7a5fb0d982f97ed953161264f1dbd90ead
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Convex.Between
 import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
@@ -15,6 +10,8 @@ import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
 import Mathlib.Topology.MetricSpace.Holder
 import Mathlib.Topology.MetricSpace.MetricSeparated
 
+#align_import measure_theory.measure.hausdorff from "leanprover-community/mathlib"@"3d5c4a7a5fb0d982f97ed953161264f1dbd90ead"
+
 /-!
 # Hausdorff measure and metric (outer) measures
 
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -523,7 +523,7 @@ theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
     congr 1 with n : 1
     simp only [iInf_eq_if, htr n, id, if_true, iSup_and']
   · rw [iInf_eq_if, if_neg htr]
-    push_neg at htr ; rcases htr with ⟨n, hn⟩
+    push_neg at htr; rcases htr with ⟨n, hn⟩
     refine' ENNReal.tsum_eq_top_of_eq_top ⟨n, _⟩
     rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
     exact hn.not_le
fix: precedences of ⨆⋃⋂⨅ (#5614)
Diff
@@ -177,7 +177,7 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory :
       μ (s ∩ t) + μ (S n) = μ (s ∩ t ∪ S n) := Eq.symm <| hm _ _ <| (Ssep' n).symm
       _ ≤ μ (s ∩ t ∪ s \ t) := μ.mono <| union_subset_union_right _ <| S_sub n
       _ = μ s := by rw [inter_union_diff]
-  have iUnion_S : (⋃ n, S n) = s \ t := by
+  have iUnion_S : ⋃ n, S n = s \ t := by
     refine' Subset.antisymm (iUnion_subset S_sub) _
     rintro x ⟨hxs, hxt⟩
     rw [mem_iff_infEdist_zero_of_closed ht] at hxt
chore: fix many typos (#4983)

These are all doc fixes

Diff
@@ -882,7 +882,7 @@ variable {f : X → Y} {d : ℝ}
 theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
     μH[d] (f '' s) = μH[d] s := by
   simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
-  -- porting note: this proof was slighlty nicer before the port
+  -- porting note: this proof was slightly nicer before the port
   simp only [mkMetric_toOuterMeasure]
   have : 0 ≤ d → Monotone fun r ↦ @HPow.hPow ℝ≥0∞ ℝ ℝ≥0∞ instHPow r d := by
     exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
feat: port MeasureTheory.Measure.Hausdorff (#4886)

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

Dependencies 12 + 972

973 files ported (98.8%)
438798 lines ported (98.7%)
Show graph

The unported dependencies are

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