measure_theory.covering.besicovitch_vector_spaceMathlib.MeasureTheory.Covering.BesicovitchVectorSpace

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -532,7 +532,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
         by
         nth_rw 1 [← one_smul ℝ (a.c j)]
         rw [add_left_inj, hd, ← sub_smul, norm_smul, Real.norm_eq_abs, abs_of_nonneg, sub_mul,
-          one_mul, div_mul_cancel _ (zero_le_two.trans_lt hj).ne']
+          one_mul, div_mul_cancel₀ _ (zero_le_two.trans_lt hj).ne']
         rwa [sub_nonneg, div_le_iff (zero_lt_two.trans hj), one_mul]
   have J : a.r j - ‖a.c j - a.c i‖ ≤ s / 2 * δ :=
     calc
Diff
@@ -76,7 +76,7 @@ def centerAndRescale : SatelliteConfig E N τ
       · rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
           abs_of_nonneg (inv_nonneg.2 (a.rpos _).le)]
         refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-        rw [dist_eq_norm] at H 
+        rw [dist_eq_norm] at H
         convert H.1 using 2
         abel
       · rw [← mul_assoc, mul_comm τ, mul_assoc]
@@ -87,7 +87,7 @@ def centerAndRescale : SatelliteConfig E N τ
       · rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
           abs_of_nonneg (inv_nonneg.2 (a.rpos _).le)]
         refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-        rw [dist_eq_norm] at H 
+        rw [dist_eq_norm] at H
         convert H.1 using 2
         abel
       · rw [← mul_assoc, mul_comm τ, mul_assoc]
@@ -99,7 +99,7 @@ def centerAndRescale : SatelliteConfig E N τ
     · rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
         abs_of_nonneg (inv_nonneg.2 (a.rpos _).le)]
       refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-      rw [dist_eq_norm] at H 
+      rw [dist_eq_norm] at H
       convert H.1 using 2
       abel
     · rw [← mul_assoc, mul_comm τ, mul_assoc]
@@ -110,7 +110,7 @@ def centerAndRescale : SatelliteConfig E N τ
     rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
       abs_of_nonneg (inv_nonneg.2 (a.rpos _).le), ← mul_add]
     refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-    rw [dist_eq_norm] at H 
+    rw [dist_eq_norm] at H
     convert H using 2
     abel
 #align besicovitch.satellite_config.center_and_rescale Besicovitch.SatelliteConfig.centerAndRescale
@@ -253,7 +253,7 @@ theorem exists_goodδ :
         have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
         rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
         exact ⟨f, f.injective, hf⟩
-      simp only [range_subset_iff, Finset.mem_coe] at hfs 
+      simp only [range_subset_iff, Finset.mem_coe] at hfs
       refine' ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
     ·
       exact
@@ -279,13 +279,13 @@ theorem exists_goodδ :
         ∃ φ : ℕ → ℕ, StrictMono φ ∧ tendsto ((F ∘ u) ∘ φ) at_top (𝓝 f) :=
       IsCompact.tendsto_subseq (is_compact_closed_ball _ _) A
     refine' ⟨f, fun i => _, fun i j hij => _⟩
-    · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem 
+    · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem
       exact fmem i
     · have A : tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) at_top (𝓝 ‖f i - f j‖) :=
         ((hf.apply i).sub (hf.apply j)).norm
       have B : tendsto (fun n => 1 - u (φ n)) at_top (𝓝 (1 - 0)) :=
         tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_at_top)
-      rw [sub_zero] at B 
+      rw [sub_zero] at B
       exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 i j hij
   rcases this with ⟨f, hf, h'f⟩
   -- the range of `f` contradicts the definition of `multiplicity E`.
@@ -293,7 +293,7 @@ theorem exists_goodδ :
     intro i j hij
     by_contra
     have : 1 ≤ ‖f i - f j‖ := h'f i j h
-    simp only [hij, norm_zero, sub_self] at this 
+    simp only [hij, norm_zero, sub_self] at this
     exact lt_irrefl _ (this.trans_lt zero_lt_one)
   let s := Finset.image f Finset.univ
   have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
@@ -305,10 +305,10 @@ theorem exists_goodδ :
     simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
       Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
     intro i j hij
-    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h'f i j this
   have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
-  rw [s_card, hN] at this 
+  rw [s_card, hN] at this
   exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
 #align besicovitch.exists_good_δ Besicovitch.exists_goodδ
 -/
@@ -359,7 +359,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
     intro i j hij
     by_contra
     have : 1 - good_δ E ≤ ‖f i - f j‖ := h' i j h
-    simp only [hij, norm_zero, sub_self] at this 
+    simp only [hij, norm_zero, sub_self] at this
     linarith [good_δ_lt_one E]
   let s := Finset.image f Finset.univ
   have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
@@ -371,10 +371,10 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
     simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
       Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
     intro i j hij
-    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h' i j this
   have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
-  rwa [s_card] at this 
+  rwa [s_card] at this
 #align besicovitch.le_multiplicity_of_δ_of_fin Besicovitch.le_multiplicity_of_δ_of_fin
 -/
 
@@ -516,8 +516,8 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     have : i < last N := by
       apply lt_top_iff_ne_top.2
       intro iN
-      change i = last N at iN 
-      rw [iN, lastc, norm_zero] at hi 
+      change i = last N at iN
+      rw [iN, lastc, norm_zero] at hi
       exact lt_irrefl _ (zero_le_two.trans_lt hi)
     convert (a.hlast i this).1
     rw [dist_eq_norm, lastc, sub_zero]
@@ -543,7 +543,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
           calc
             a.r j - ‖a.c j - a.c i‖ ≤ 0 := sub_nonpos.2 H.1
             _ ≤ s * (τ - 1) := mul_nonneg spos.le (sub_nonneg.2 hτ)
-        · rw [norm_sub_rev] at H 
+        · rw [norm_sub_rev] at H
           calc
             a.r j - ‖a.c j - a.c i‖ ≤ τ * a.r i - a.r i := sub_le_sub H.2 H.1
             _ = a.r i * (τ - 1) := by ring
Diff
@@ -233,19 +233,87 @@ theorem exists_goodδ :
           ∀ s : Finset E,
             (∀ c ∈ s, ‖c‖ ≤ 2) →
               (∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - δ ≤ ‖c - d‖) → s.card ≤ multiplicity E :=
-  by classical
+  by
+  classical
+  /- This follows from a compactness argument: otherwise, one could extract a converging
+    subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
+    `N = multiplicity E + 1`. To formalize this, we work with functions `fin N → E`.
+     -/
+  by_contra! h
+  set N := multiplicity E + 1 with hN
+  have :
+    ∀ δ : ℝ,
+      0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 - δ ≤ ‖f i - f j‖ :=
+    by
+    intro δ hδ
+    rcases lt_or_le δ 1 with (hδ' | hδ')
+    · rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
+      obtain ⟨f, f_inj, hfs⟩ : ∃ f : Fin N → E, Function.Injective f ∧ range f ⊆ ↑s :=
+        by
+        have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
+        rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
+        exact ⟨f, f.injective, hf⟩
+      simp only [range_subset_iff, Finset.mem_coe] at hfs 
+      refine' ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
+    ·
+      exact
+        ⟨fun i => 0, fun i => by simp, fun i j hij => by
+          simpa only [norm_zero, sub_nonpos, sub_self]⟩
+  -- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
+  -- in the image are separated by `1 - δ`.
+  choose! F hF using this
+  -- Choose a converging subsequence when `δ → 0`.
+  have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 ≤ ‖f i - f j‖ :=
+    by
+    obtain ⟨u, u_mono, zero_lt_u, hu⟩ :
+      ∃ u : ℕ → ℝ,
+        (∀ m n : ℕ, m < n → u n < u m) ∧ (∀ n : ℕ, 0 < u n) ∧ Filter.Tendsto u Filter.atTop (𝓝 0) :=
+      exists_seq_strictAnti_tendsto (0 : ℝ)
+    have A : ∀ n, F (u n) ∈ closed_ball (0 : Fin N → E) 2 :=
+      by
+      intro n
+      simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right,
+        (hF (u n) (zero_lt_u n)).left, forall_const]
+    obtain ⟨f, fmem, φ, φ_mono, hf⟩ :
+      ∃ f ∈ closed_ball (0 : Fin N → E) 2,
+        ∃ φ : ℕ → ℕ, StrictMono φ ∧ tendsto ((F ∘ u) ∘ φ) at_top (𝓝 f) :=
+      IsCompact.tendsto_subseq (is_compact_closed_ball _ _) A
+    refine' ⟨f, fun i => _, fun i j hij => _⟩
+    · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem 
+      exact fmem i
+    · have A : tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) at_top (𝓝 ‖f i - f j‖) :=
+        ((hf.apply i).sub (hf.apply j)).norm
+      have B : tendsto (fun n => 1 - u (φ n)) at_top (𝓝 (1 - 0)) :=
+        tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_at_top)
+      rw [sub_zero] at B 
+      exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 i j hij
+  rcases this with ⟨f, hf, h'f⟩
+  -- the range of `f` contradicts the definition of `multiplicity E`.
+  have finj : Function.Injective f := by
+    intro i j hij
+    by_contra
+    have : 1 ≤ ‖f i - f j‖ := h'f i j h
+    simp only [hij, norm_zero, sub_self] at this 
+    exact lt_irrefl _ (this.trans_lt zero_lt_one)
+  let s := Finset.image f Finset.univ
+  have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
+  have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
+    simp only [hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
+      Finset.mem_image]
+  have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ :=
+    by
+    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
+    intro i j hij
+    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    exact h'f i j this
+  have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
+  rw [s_card, hN] at this 
+  exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
 #align besicovitch.exists_good_δ Besicovitch.exists_goodδ
 -/
 
 #print Besicovitch.goodδ /-
-/- This follows from a compactness argument: otherwise, one could extract a converging
-  subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
-  `N = multiplicity E + 1`. To formalize this, we work with functions `fin N → E`.
-   -/
--- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
--- in the image are separated by `1 - δ`.
--- Choose a converging subsequence when `δ → 0`.
--- the range of `f` contradicts the definition of `multiplicity E`.
 /-- A small positive number such that any `1 - δ`-separated set in the ball of radius `2` has
 cardinality at most `besicovitch.multiplicity E`. -/
 def goodδ : ℝ :=
@@ -285,7 +353,28 @@ theorem card_le_multiplicity_of_δ {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤
 
 #print Besicovitch.le_multiplicity_of_δ_of_fin /-
 theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖f i‖ ≤ 2)
-    (h' : ∀ i j, i ≠ j → 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by classical
+    (h' : ∀ i j, i ≠ j → 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by
+  classical
+  have finj : Function.Injective f := by
+    intro i j hij
+    by_contra
+    have : 1 - good_δ E ≤ ‖f i - f j‖ := h' i j h
+    simp only [hij, norm_zero, sub_self] at this 
+    linarith [good_δ_lt_one E]
+  let s := Finset.image f Finset.univ
+  have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
+  have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
+    simp only [h, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
+      Finset.mem_image, imp_true_iff]
+  have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - good_δ E ≤ ‖c - d‖ :=
+    by
+    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
+    intro i j hij
+    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    exact h' i j this
+  have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
+  rwa [s_card] at this 
 #align besicovitch.le_multiplicity_of_δ_of_fin Besicovitch.le_multiplicity_of_δ_of_fin
 -/
 
Diff
@@ -233,87 +233,19 @@ theorem exists_goodδ :
           ∀ s : Finset E,
             (∀ c ∈ s, ‖c‖ ≤ 2) →
               (∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - δ ≤ ‖c - d‖) → s.card ≤ multiplicity E :=
-  by
-  classical
-  /- This follows from a compactness argument: otherwise, one could extract a converging
-    subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
-    `N = multiplicity E + 1`. To formalize this, we work with functions `fin N → E`.
-     -/
-  by_contra! h
-  set N := multiplicity E + 1 with hN
-  have :
-    ∀ δ : ℝ,
-      0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 - δ ≤ ‖f i - f j‖ :=
-    by
-    intro δ hδ
-    rcases lt_or_le δ 1 with (hδ' | hδ')
-    · rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
-      obtain ⟨f, f_inj, hfs⟩ : ∃ f : Fin N → E, Function.Injective f ∧ range f ⊆ ↑s :=
-        by
-        have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
-        rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
-        exact ⟨f, f.injective, hf⟩
-      simp only [range_subset_iff, Finset.mem_coe] at hfs 
-      refine' ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
-    ·
-      exact
-        ⟨fun i => 0, fun i => by simp, fun i j hij => by
-          simpa only [norm_zero, sub_nonpos, sub_self]⟩
-  -- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
-  -- in the image are separated by `1 - δ`.
-  choose! F hF using this
-  -- Choose a converging subsequence when `δ → 0`.
-  have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 ≤ ‖f i - f j‖ :=
-    by
-    obtain ⟨u, u_mono, zero_lt_u, hu⟩ :
-      ∃ u : ℕ → ℝ,
-        (∀ m n : ℕ, m < n → u n < u m) ∧ (∀ n : ℕ, 0 < u n) ∧ Filter.Tendsto u Filter.atTop (𝓝 0) :=
-      exists_seq_strictAnti_tendsto (0 : ℝ)
-    have A : ∀ n, F (u n) ∈ closed_ball (0 : Fin N → E) 2 :=
-      by
-      intro n
-      simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right,
-        (hF (u n) (zero_lt_u n)).left, forall_const]
-    obtain ⟨f, fmem, φ, φ_mono, hf⟩ :
-      ∃ f ∈ closed_ball (0 : Fin N → E) 2,
-        ∃ φ : ℕ → ℕ, StrictMono φ ∧ tendsto ((F ∘ u) ∘ φ) at_top (𝓝 f) :=
-      IsCompact.tendsto_subseq (is_compact_closed_ball _ _) A
-    refine' ⟨f, fun i => _, fun i j hij => _⟩
-    · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem 
-      exact fmem i
-    · have A : tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) at_top (𝓝 ‖f i - f j‖) :=
-        ((hf.apply i).sub (hf.apply j)).norm
-      have B : tendsto (fun n => 1 - u (φ n)) at_top (𝓝 (1 - 0)) :=
-        tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_at_top)
-      rw [sub_zero] at B 
-      exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 i j hij
-  rcases this with ⟨f, hf, h'f⟩
-  -- the range of `f` contradicts the definition of `multiplicity E`.
-  have finj : Function.Injective f := by
-    intro i j hij
-    by_contra
-    have : 1 ≤ ‖f i - f j‖ := h'f i j h
-    simp only [hij, norm_zero, sub_self] at this 
-    exact lt_irrefl _ (this.trans_lt zero_lt_one)
-  let s := Finset.image f Finset.univ
-  have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
-  have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
-      Finset.mem_image]
-  have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ :=
-    by
-    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
-    intro i j hij
-    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
-    exact h'f i j this
-  have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
-  rw [s_card, hN] at this 
-  exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
+  by classical
 #align besicovitch.exists_good_δ Besicovitch.exists_goodδ
 -/
 
 #print Besicovitch.goodδ /-
+/- This follows from a compactness argument: otherwise, one could extract a converging
+  subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
+  `N = multiplicity E + 1`. To formalize this, we work with functions `fin N → E`.
+   -/
+-- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
+-- in the image are separated by `1 - δ`.
+-- Choose a converging subsequence when `δ → 0`.
+-- the range of `f` contradicts the definition of `multiplicity E`.
 /-- A small positive number such that any `1 - δ`-separated set in the ball of radius `2` has
 cardinality at most `besicovitch.multiplicity E`. -/
 def goodδ : ℝ :=
@@ -353,28 +285,7 @@ theorem card_le_multiplicity_of_δ {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤
 
 #print Besicovitch.le_multiplicity_of_δ_of_fin /-
 theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖f i‖ ≤ 2)
-    (h' : ∀ i j, i ≠ j → 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by
-  classical
-  have finj : Function.Injective f := by
-    intro i j hij
-    by_contra
-    have : 1 - good_δ E ≤ ‖f i - f j‖ := h' i j h
-    simp only [hij, norm_zero, sub_self] at this 
-    linarith [good_δ_lt_one E]
-  let s := Finset.image f Finset.univ
-  have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
-  have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [h, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
-      Finset.mem_image, imp_true_iff]
-  have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - good_δ E ≤ ‖c - d‖ :=
-    by
-    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
-    intro i j hij
-    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
-    exact h' i j this
-  have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
-  rwa [s_card] at this 
+    (h' : ∀ i j, i ≠ j → 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by classical
 #align besicovitch.le_multiplicity_of_δ_of_fin Besicovitch.le_multiplicity_of_δ_of_fin
 -/
 
Diff
@@ -239,7 +239,7 @@ theorem exists_goodδ :
     subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
     `N = multiplicity E + 1`. To formalize this, we work with functions `fin N → E`.
      -/
-  by_contra' h
+  by_contra! h
   set N := multiplicity E + 1 with hN
   have :
     ∀ δ : ℝ,
Diff
@@ -298,12 +298,12 @@ theorem exists_goodδ :
   let s := Finset.image f Finset.univ
   have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
   have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [hf, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
+    simp only [hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
       Finset.mem_image]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ :=
     by
-    simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
+    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
     exact h'f i j this
@@ -364,12 +364,12 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
   let s := Finset.image f Finset.univ
   have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
   have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [h, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
+    simp only [h, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
       Finset.mem_image, imp_true_iff]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - good_δ E ≤ ‖c - d‖ :=
     by
-    simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
+    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
     exact h' i j this
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2021 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathbin.MeasureTheory.Measure.Lebesgue.EqHaar
-import Mathbin.MeasureTheory.Covering.Besicovitch
+import MeasureTheory.Measure.Lebesgue.EqHaar
+import MeasureTheory.Covering.Besicovitch
 
 #align_import measure_theory.covering.besicovitch_vector_space from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2021 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module measure_theory.covering.besicovitch_vector_space
-! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.MeasureTheory.Measure.Lebesgue.EqHaar
 import Mathbin.MeasureTheory.Covering.Besicovitch
 
+#align_import measure_theory.covering.besicovitch_vector_space from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
+
 /-!
 # Satellite configurations for Besicovitch covering lemma in vector spaces
 
Diff
@@ -119,14 +119,18 @@ def centerAndRescale : SatelliteConfig E N τ
 #align besicovitch.satellite_config.center_and_rescale Besicovitch.SatelliteConfig.centerAndRescale
 -/
 
+#print Besicovitch.SatelliteConfig.centerAndRescale_center /-
 theorem centerAndRescale_center : a.centerAndRescale.c (last N) = 0 := by
   simp [satellite_config.center_and_rescale]
 #align besicovitch.satellite_config.center_and_rescale_center Besicovitch.SatelliteConfig.centerAndRescale_center
+-/
 
+#print Besicovitch.SatelliteConfig.centerAndRescale_radius /-
 theorem centerAndRescale_radius {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) :
     a.centerAndRescale.R (last N) = 1 := by
   simp [satellite_config.center_and_rescale, inv_mul_cancel (a.rpos _).ne']
 #align besicovitch.satellite_config.center_and_rescale_radius Besicovitch.SatelliteConfig.centerAndRescale_radius
+-/
 
 end SatelliteConfig
 
@@ -145,6 +149,7 @@ section
 
 variable [NormedSpace ℝ E] [FiniteDimensional ℝ E]
 
+#print Besicovitch.card_le_of_separated /-
 /-- Any `1`-separated set in the ball of radius `2` has cardinality at most `5 ^ dim`. This is
 useful to show that the supremum in the definition of `besicovitch.multiplicity E` is
 well behaved. -/
@@ -194,6 +199,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
       ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
   exact_mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
+-/
 
 #print Besicovitch.multiplicity_le /-
 theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E :=
@@ -205,6 +211,7 @@ theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E :=
 #align besicovitch.multiplicity_le Besicovitch.multiplicity_le
 -/
 
+#print Besicovitch.card_le_multiplicity /-
 theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ multiplicity E :=
   by
@@ -215,9 +222,11 @@ theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
   · simp only [mem_set_of_eq, Ne.def]
     exact ⟨s, rfl, hs, h's⟩
 #align besicovitch.card_le_multiplicity Besicovitch.card_le_multiplicity
+-/
 
 variable (E)
 
+#print Besicovitch.exists_goodδ /-
 /-- If `δ` is small enough, a `(1-δ)`-separated set in the ball of radius `2` also has cardinality
 at most `multiplicity E`. -/
 theorem exists_goodδ :
@@ -305,6 +314,7 @@ theorem exists_goodδ :
   rw [s_card, hN] at this 
   exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
 #align besicovitch.exists_good_δ Besicovitch.exists_goodδ
+-/
 
 #print Besicovitch.goodδ /-
 /-- A small positive number such that any `1 - δ`-separated set in the ball of radius `2` has
@@ -314,9 +324,11 @@ def goodδ : ℝ :=
 #align besicovitch.good_δ Besicovitch.goodδ
 -/
 
+#print Besicovitch.goodδ_lt_one /-
 theorem goodδ_lt_one : goodδ E < 1 :=
   (exists_goodδ E).choose_spec.2.1
 #align besicovitch.good_δ_lt_one Besicovitch.goodδ_lt_one
+-/
 
 #print Besicovitch.goodτ /-
 /-- A number `τ > 1`, but chosen close enough to `1` so that the construction in the Besicovitch
@@ -327,17 +339,22 @@ def goodτ : ℝ :=
 #align besicovitch.good_τ Besicovitch.goodτ
 -/
 
+#print Besicovitch.one_lt_goodτ /-
 theorem one_lt_goodτ : 1 < goodτ E := by dsimp [good_τ, good_δ];
   linarith [(exists_good_δ E).choose_spec.1]
 #align besicovitch.one_lt_good_τ Besicovitch.one_lt_goodτ
+-/
 
 variable {E}
 
+#print Besicovitch.card_le_multiplicity_of_δ /-
 theorem card_le_multiplicity_of_δ {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - goodδ E ≤ ‖c - d‖) : s.card ≤ multiplicity E :=
   (Classical.choose_spec (exists_goodδ E)).2.2 s hs h's
 #align besicovitch.card_le_multiplicity_of_δ Besicovitch.card_le_multiplicity_of_δ
+-/
 
+#print Besicovitch.le_multiplicity_of_δ_of_fin /-
 theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖f i‖ ≤ 2)
     (h' : ∀ i j, i ≠ j → 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by
   classical
@@ -362,6 +379,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
   have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
   rwa [s_card] at this 
 #align besicovitch.le_multiplicity_of_δ_of_fin Besicovitch.le_multiplicity_of_δ_of_fin
+-/
 
 end
 
@@ -384,6 +402,7 @@ where both of them are `> 2`.
 -/
 
 
+#print Besicovitch.SatelliteConfig.exists_normalized_aux1 /-
 theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     (lastr : a.R (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4) (hδ2 : δ ≤ 1)
     (i j : Fin N.succ) (inej : i ≠ j) : 1 - δ ≤ ‖a.c i - a.c j‖ :=
@@ -415,9 +434,11 @@ theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     apply le_trans _ H.1
     exact hτ' j
 #align besicovitch.satellite_config.exists_normalized_aux1 Besicovitch.SatelliteConfig.exists_normalized_aux1
+-/
 
 variable [NormedSpace ℝ E]
 
+#print Besicovitch.SatelliteConfig.exists_normalized_aux2 /-
 theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     (lastc : a.c (last N) = 0) (lastr : a.R (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4)
     (hδ2 : δ ≤ 1) (i j : Fin N.succ) (inej : i ≠ j) (hi : ‖a.c i‖ ≤ 2) (hj : 2 < ‖a.c j‖) :
@@ -477,7 +498,9 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
         linarith only [hcrj]
   linarith only [this]
 #align besicovitch.satellite_config.exists_normalized_aux2 Besicovitch.SatelliteConfig.exists_normalized_aux2
+-/
 
+#print Besicovitch.SatelliteConfig.exists_normalized_aux3 /-
 theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     (lastc : a.c (last N) = 0) (lastr : a.R (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4)
     (i j : Fin N.succ) (inej : i ≠ j) (hi : 2 < ‖a.c i‖) (hij : ‖a.c i‖ ≤ ‖a.c j‖) :
@@ -542,7 +565,9 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       congr 3
       field_simp [spos.ne']
 #align besicovitch.satellite_config.exists_normalized_aux3 Besicovitch.SatelliteConfig.exists_normalized_aux3
+-/
 
+#print Besicovitch.SatelliteConfig.exists_normalized /-
 theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (lastc : a.c (last N) = 0)
     (lastr : a.R (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4) (hδ2 : δ ≤ 1) :
     ∃ c' : Fin N.succ → E, (∀ n, ‖c' n‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 - δ ≤ ‖c' i - c' j‖ :=
@@ -572,6 +597,7 @@ theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (las
       simp_rw [c', H'i, if_false, H'j, if_false]
       exact exists_normalized_aux3 a lastc lastr hτ δ hδ1 i j inej Hi hij
 #align besicovitch.satellite_config.exists_normalized Besicovitch.SatelliteConfig.exists_normalized
+-/
 
 end SatelliteConfig
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module measure_theory.covering.besicovitch_vector_space
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
+! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.MeasureTheory.Covering.Besicovitch
 /-!
 # Satellite configurations for Besicovitch covering lemma in vector spaces
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 The Besicovitch covering theorem ensures that, in a nice metric space, there exists a number `N`
 such that, from any family of balls with bounded radii, one can extract `N` families, each made of
 disjoint balls, covering together all the centers of the initial family.
Diff
@@ -171,7 +171,6 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     calc
       δ + dist x 0 ≤ δ + 2 := by rw [dist_zero_right]; exact add_le_add le_rfl (hs x hx)
       _ = 5 / 2 := by norm_num [δ]
-      
   have I :
     (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) ≤
       ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) :=
@@ -185,7 +184,6 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
       _ ≤ μ (ball (0 : E) ρ) := (measure_mono A_subset)
       _ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
         simp only [μ.add_haar_ball_of_pos _ ρpos]
-      
   have J : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) :=
     (ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
   have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
@@ -400,7 +398,6 @@ theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       (1 - δ / 4) * τ ≤ (1 - δ / 4) * (1 + δ / 4) := mul_le_mul_of_nonneg_left hδ1 D
       _ = 1 - δ ^ 2 / 16 := by ring
       _ ≤ 1 := by linarith only [sq_nonneg δ]
-      
   have J : 1 - δ ≤ 1 - δ / 4 := by linarith only [δnonneg]
   have K : 1 - δ / 4 ≤ τ⁻¹ := by rw [inv_eq_one_div, le_div_iff τpos]; exact I
   suffices L : τ⁻¹ ≤ ‖a.c i - a.c j‖; · linarith only [J, K, L]
@@ -444,7 +441,6 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       (1 - δ / 4) * τ ≤ (1 - δ / 4) * (1 + δ / 4) := mul_le_mul_of_nonneg_left hδ1 D
       _ = 1 - δ ^ 2 / 16 := by ring
       _ ≤ 1 := by linarith only [sq_nonneg δ]
-      
   have A : a.r j - δ ≤ ‖a.c i - a.c j‖ :=
     by
     rcases ah j i inej.symm with (H | H); · rw [norm_sub_rev]; linarith [H.1]
@@ -454,7 +450,6 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
         _ ≤ τ * 2 := (mul_le_mul_of_nonneg_left I τpos.le)
         _ ≤ 5 / 4 * 2 := (mul_le_mul_of_nonneg_right (by linarith only [hδ1, hδ2]) zero_le_two)
         _ ≤ 4 := by norm_num
-        
     calc
       a.r j - δ ≤ a.r j - a.r j / 4 * δ :=
         by
@@ -465,7 +460,6 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       _ ≤ (1 - δ / 4) * (τ * a.r i) := (mul_le_mul_of_nonneg_left H.2 D)
       _ ≤ 1 * a.r i := by rw [← mul_assoc]; apply mul_le_mul_of_nonneg_right J (a.rpos _).le
       _ ≤ ‖a.c i - a.c j‖ := by rw [one_mul]; exact H.1
-      
   set d := (2 / ‖a.c j‖) • a.c j with hd
   have : a.r j - δ ≤ ‖a.c i - d‖ + (a.r j - 1) :=
     calc
@@ -478,7 +472,6 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
           abs_of_nonneg A, sub_mul]
         field_simp [(zero_le_two.trans_lt hj).ne']
         linarith only [hcrj]
-      
   linarith only [this]
 #align besicovitch.satellite_config.exists_normalized_aux2 Besicovitch.SatelliteConfig.exists_normalized_aux2
 
@@ -518,7 +511,6 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
         rw [add_left_inj, hd, ← sub_smul, norm_smul, Real.norm_eq_abs, abs_of_nonneg, sub_mul,
           one_mul, div_mul_cancel _ (zero_le_two.trans_lt hj).ne']
         rwa [sub_nonneg, div_le_iff (zero_lt_two.trans hj), one_mul]
-      
   have J : a.r j - ‖a.c j - a.c i‖ ≤ s / 2 * δ :=
     calc
       a.r j - ‖a.c j - a.c i‖ ≤ s * (τ - 1) :=
@@ -528,16 +520,13 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
           calc
             a.r j - ‖a.c j - a.c i‖ ≤ 0 := sub_nonpos.2 H.1
             _ ≤ s * (τ - 1) := mul_nonneg spos.le (sub_nonneg.2 hτ)
-            
         · rw [norm_sub_rev] at H 
           calc
             a.r j - ‖a.c j - a.c i‖ ≤ τ * a.r i - a.r i := sub_le_sub H.2 H.1
             _ = a.r i * (τ - 1) := by ring
             _ ≤ s * (τ - 1) := mul_le_mul_of_nonneg_right A (sub_nonneg.2 hτ)
-            
       _ ≤ s * (δ / 2) := (mul_le_mul_of_nonneg_left (by linarith only [δnonneg, hδ1]) spos.le)
       _ = s / 2 * δ := by ring
-      
   have invs_nonneg : 0 ≤ 2 / s := div_nonneg zero_le_two (zero_le_two.trans hi.le)
   calc
     1 - δ = 2 / s * (s / 2 - s / 2 * δ) := by field_simp [spos.ne']; ring
@@ -549,7 +538,6 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       rw [← Real.norm_eq_abs, ← norm_smul, smul_sub, hd, smul_smul]
       congr 3
       field_simp [spos.ne']
-    
 #align besicovitch.satellite_config.exists_normalized_aux3 Besicovitch.SatelliteConfig.exists_normalized_aux3
 
 theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (lastc : a.c (last N) = 0)
Diff
@@ -61,6 +61,7 @@ namespace SatelliteConfig
 
 variable [NormedSpace ℝ E] {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
 
+#print Besicovitch.SatelliteConfig.centerAndRescale /-
 /-- Rescaling a satellite configuration in a vector space, to put the basepoint at `0` and the base
 radius at `1`. -/
 def centerAndRescale : SatelliteConfig E N τ
@@ -113,6 +114,7 @@ def centerAndRescale : SatelliteConfig E N τ
     convert H using 2
     abel
 #align besicovitch.satellite_config.center_and_rescale Besicovitch.SatelliteConfig.centerAndRescale
+-/
 
 theorem centerAndRescale_center : a.centerAndRescale.c (last N) = 0 := by
   simp [satellite_config.center_and_rescale]
@@ -128,11 +130,13 @@ end SatelliteConfig
 /-! ### Disjoint balls of radius close to `1` in the radius `2` ball. -/
 
 
+#print Besicovitch.multiplicity /-
 /-- The maximum cardinality of a `1`-separated set in the ball of radius `2`. This is also the
 optimal number of families in the Besicovitch covering theorem. -/
 def multiplicity (E : Type _) [NormedAddCommGroup E] :=
   sSup {N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖}
 #align besicovitch.multiplicity Besicovitch.multiplicity
+-/
 
 section
 
@@ -190,6 +194,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
   exact_mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
 
+#print Besicovitch.multiplicity_le /-
 theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E :=
   by
   apply csSup_le
@@ -197,6 +202,7 @@ theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E :=
   · rintro _ ⟨s, ⟨rfl, h⟩⟩
     exact Besicovitch.card_le_of_separated s h.1 h.2
 #align besicovitch.multiplicity_le Besicovitch.multiplicity_le
+-/
 
 theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ multiplicity E :=
@@ -213,7 +219,7 @@ variable (E)
 
 /-- If `δ` is small enough, a `(1-δ)`-separated set in the ball of radius `2` also has cardinality
 at most `multiplicity E`. -/
-theorem exists_good_δ :
+theorem exists_goodδ :
     ∃ δ : ℝ,
       0 < δ ∧
         δ < 1 ∧
@@ -297,24 +303,28 @@ theorem exists_good_δ :
   have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
   rw [s_card, hN] at this 
   exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
-#align besicovitch.exists_good_δ Besicovitch.exists_good_δ
+#align besicovitch.exists_good_δ Besicovitch.exists_goodδ
 
+#print Besicovitch.goodδ /-
 /-- A small positive number such that any `1 - δ`-separated set in the ball of radius `2` has
 cardinality at most `besicovitch.multiplicity E`. -/
 def goodδ : ℝ :=
-  (exists_good_δ E).some
+  (exists_goodδ E).some
 #align besicovitch.good_δ Besicovitch.goodδ
+-/
 
 theorem goodδ_lt_one : goodδ E < 1 :=
-  (exists_good_δ E).choose_spec.2.1
+  (exists_goodδ E).choose_spec.2.1
 #align besicovitch.good_δ_lt_one Besicovitch.goodδ_lt_one
 
+#print Besicovitch.goodτ /-
 /-- A number `τ > 1`, but chosen close enough to `1` so that the construction in the Besicovitch
 covering theorem using this parameter `τ` will give the smallest possible number of covering
 families. -/
 def goodτ : ℝ :=
   1 + goodδ E / 4
 #align besicovitch.good_τ Besicovitch.goodτ
+-/
 
 theorem one_lt_goodτ : 1 < goodτ E := by dsimp [good_τ, good_δ];
   linarith [(exists_good_δ E).choose_spec.1]
@@ -324,7 +334,7 @@ variable {E}
 
 theorem card_le_multiplicity_of_δ {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - goodδ E ≤ ‖c - d‖) : s.card ≤ multiplicity E :=
-  (Classical.choose_spec (exists_good_δ E)).2.2 s hs h's
+  (Classical.choose_spec (exists_goodδ E)).2.2 s hs h's
 #align besicovitch.card_le_multiplicity_of_δ Besicovitch.card_le_multiplicity_of_δ
 
 theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖f i‖ ≤ 2)
@@ -576,6 +586,7 @@ end SatelliteConfig
 
 variable (E) [NormedSpace ℝ E] [FiniteDimensional ℝ E]
 
+#print Besicovitch.isEmpty_satelliteConfig_multiplicity /-
 /-- In a normed vector space `E`, there can be no satellite configuration with `multiplicity E + 1`
 points and the parameter `good_τ E`. This will ensure that in the inductive construction to get
 the Besicovitch covering families, there will never be more than `multiplicity E` nonempty
@@ -591,6 +602,7 @@ theorem isEmpty_satelliteConfig_multiplicity :
     exact
       lt_irrefl _ ((Nat.lt_succ_self _).trans_le (le_multiplicity_of_δ_of_fin c' c'_le_two hc'))⟩
 #align besicovitch.is_empty_satellite_config_multiplicity Besicovitch.isEmpty_satelliteConfig_multiplicity
+-/
 
 instance (priority := 100) : HasBesicovitchCovering E :=
   ⟨⟨multiplicity E, goodτ E, one_lt_goodτ E, isEmpty_satelliteConfig_multiplicity E⟩⟩
Diff
@@ -131,8 +131,7 @@ end SatelliteConfig
 /-- The maximum cardinality of a `1`-separated set in the ball of radius `2`. This is also the
 optimal number of families in the Besicovitch covering theorem. -/
 def multiplicity (E : Type _) [NormedAddCommGroup E] :=
-  sSup
-    { N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ }
+  sSup {N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖}
 #align besicovitch.multiplicity Besicovitch.multiplicity
 
 section
@@ -223,83 +222,81 @@ theorem exists_good_δ :
               (∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - δ ≤ ‖c - d‖) → s.card ≤ multiplicity E :=
   by
   classical
-    /- This follows from a compactness argument: otherwise, one could extract a converging
-      subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
-      `N = multiplicity E + 1`. To formalize this, we work with functions `fin N → E`.
-       -/
-    by_contra' h
-    set N := multiplicity E + 1 with hN
-    have :
-      ∀ δ : ℝ,
-        0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 - δ ≤ ‖f i - f j‖ :=
-      by
-      intro δ hδ
-      rcases lt_or_le δ 1 with (hδ' | hδ')
-      · rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
-        obtain ⟨f, f_inj, hfs⟩ : ∃ f : Fin N → E, Function.Injective f ∧ range f ⊆ ↑s :=
-          by
-          have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
-          rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
-          exact ⟨f, f.injective, hf⟩
-        simp only [range_subset_iff, Finset.mem_coe] at hfs 
-        refine' ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
-      ·
-        exact
-          ⟨fun i => 0, fun i => by simp, fun i j hij => by
-            simpa only [norm_zero, sub_nonpos, sub_self]⟩
-    -- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
-    -- in the image are separated by `1 - δ`.
-    choose! F hF using this
-    -- Choose a converging subsequence when `δ → 0`.
-    have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 ≤ ‖f i - f j‖ :=
-      by
-      obtain ⟨u, u_mono, zero_lt_u, hu⟩ :
-        ∃ u : ℕ → ℝ,
-          (∀ m n : ℕ, m < n → u n < u m) ∧
-            (∀ n : ℕ, 0 < u n) ∧ Filter.Tendsto u Filter.atTop (𝓝 0) :=
-        exists_seq_strictAnti_tendsto (0 : ℝ)
-      have A : ∀ n, F (u n) ∈ closed_ball (0 : Fin N → E) 2 :=
+  /- This follows from a compactness argument: otherwise, one could extract a converging
+    subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
+    `N = multiplicity E + 1`. To formalize this, we work with functions `fin N → E`.
+     -/
+  by_contra' h
+  set N := multiplicity E + 1 with hN
+  have :
+    ∀ δ : ℝ,
+      0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 - δ ≤ ‖f i - f j‖ :=
+    by
+    intro δ hδ
+    rcases lt_or_le δ 1 with (hδ' | hδ')
+    · rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
+      obtain ⟨f, f_inj, hfs⟩ : ∃ f : Fin N → E, Function.Injective f ∧ range f ⊆ ↑s :=
         by
-        intro n
-        simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right,
-          (hF (u n) (zero_lt_u n)).left, forall_const]
-      obtain ⟨f, fmem, φ, φ_mono, hf⟩ :
-        ∃ f ∈ closed_ball (0 : Fin N → E) 2,
-          ∃ φ : ℕ → ℕ, StrictMono φ ∧ tendsto ((F ∘ u) ∘ φ) at_top (𝓝 f) :=
-        IsCompact.tendsto_subseq (is_compact_closed_ball _ _) A
-      refine' ⟨f, fun i => _, fun i j hij => _⟩
-      · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem 
-        exact fmem i
-      · have A : tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) at_top (𝓝 ‖f i - f j‖) :=
-          ((hf.apply i).sub (hf.apply j)).norm
-        have B : tendsto (fun n => 1 - u (φ n)) at_top (𝓝 (1 - 0)) :=
-          tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_at_top)
-        rw [sub_zero] at B 
-        exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 i j hij
-    rcases this with ⟨f, hf, h'f⟩
-    -- the range of `f` contradicts the definition of `multiplicity E`.
-    have finj : Function.Injective f := by
-      intro i j hij
-      by_contra
-      have : 1 ≤ ‖f i - f j‖ := h'f i j h
-      simp only [hij, norm_zero, sub_self] at this 
-      exact lt_irrefl _ (this.trans_lt zero_lt_one)
-    let s := Finset.image f Finset.univ
-    have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj];
-      exact Finset.card_fin N
-    have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-      simp only [hf, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
-        Finset.mem_image]
-    have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ :=
+        have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
+        rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
+        exact ⟨f, f.injective, hf⟩
+      simp only [range_subset_iff, Finset.mem_coe] at hfs 
+      refine' ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
+    ·
+      exact
+        ⟨fun i => 0, fun i => by simp, fun i j hij => by
+          simpa only [norm_zero, sub_nonpos, sub_self]⟩
+  -- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
+  -- in the image are separated by `1 - δ`.
+  choose! F hF using this
+  -- Choose a converging subsequence when `δ → 0`.
+  have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 ≤ ‖f i - f j‖ :=
+    by
+    obtain ⟨u, u_mono, zero_lt_u, hu⟩ :
+      ∃ u : ℕ → ℝ,
+        (∀ m n : ℕ, m < n → u n < u m) ∧ (∀ n : ℕ, 0 < u n) ∧ Filter.Tendsto u Filter.atTop (𝓝 0) :=
+      exists_seq_strictAnti_tendsto (0 : ℝ)
+    have A : ∀ n, F (u n) ∈ closed_ball (0 : Fin N → E) 2 :=
       by
-      simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ,
-        Finset.mem_image, Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
-      intro i j hij
-      have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
-      exact h'f i j this
-    have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
-    rw [s_card, hN] at this 
-    exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
+      intro n
+      simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right,
+        (hF (u n) (zero_lt_u n)).left, forall_const]
+    obtain ⟨f, fmem, φ, φ_mono, hf⟩ :
+      ∃ f ∈ closed_ball (0 : Fin N → E) 2,
+        ∃ φ : ℕ → ℕ, StrictMono φ ∧ tendsto ((F ∘ u) ∘ φ) at_top (𝓝 f) :=
+      IsCompact.tendsto_subseq (is_compact_closed_ball _ _) A
+    refine' ⟨f, fun i => _, fun i j hij => _⟩
+    · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem 
+      exact fmem i
+    · have A : tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) at_top (𝓝 ‖f i - f j‖) :=
+        ((hf.apply i).sub (hf.apply j)).norm
+      have B : tendsto (fun n => 1 - u (φ n)) at_top (𝓝 (1 - 0)) :=
+        tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_at_top)
+      rw [sub_zero] at B 
+      exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 i j hij
+  rcases this with ⟨f, hf, h'f⟩
+  -- the range of `f` contradicts the definition of `multiplicity E`.
+  have finj : Function.Injective f := by
+    intro i j hij
+    by_contra
+    have : 1 ≤ ‖f i - f j‖ := h'f i j h
+    simp only [hij, norm_zero, sub_self] at this 
+    exact lt_irrefl _ (this.trans_lt zero_lt_one)
+  let s := Finset.image f Finset.univ
+  have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
+  have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
+    simp only [hf, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
+      Finset.mem_image]
+  have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ :=
+    by
+    simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
+    intro i j hij
+    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    exact h'f i j this
+  have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
+  rw [s_card, hN] at this 
+  exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
 #align besicovitch.exists_good_δ Besicovitch.exists_good_δ
 
 /-- A small positive number such that any `1 - δ`-separated set in the ball of radius `2` has
@@ -333,27 +330,26 @@ theorem card_le_multiplicity_of_δ {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤
 theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖f i‖ ≤ 2)
     (h' : ∀ i j, i ≠ j → 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by
   classical
-    have finj : Function.Injective f := by
-      intro i j hij
-      by_contra
-      have : 1 - good_δ E ≤ ‖f i - f j‖ := h' i j h
-      simp only [hij, norm_zero, sub_self] at this 
-      linarith [good_δ_lt_one E]
-    let s := Finset.image f Finset.univ
-    have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj];
-      exact Finset.card_fin n
-    have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-      simp only [h, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
-        Finset.mem_image, imp_true_iff]
-    have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - good_δ E ≤ ‖c - d‖ :=
-      by
-      simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ,
-        Finset.mem_image, Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
-      intro i j hij
-      have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
-      exact h' i j this
-    have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
-    rwa [s_card] at this 
+  have finj : Function.Injective f := by
+    intro i j hij
+    by_contra
+    have : 1 - good_δ E ≤ ‖f i - f j‖ := h' i j h
+    simp only [hij, norm_zero, sub_self] at this 
+    linarith [good_δ_lt_one E]
+  let s := Finset.image f Finset.univ
+  have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
+  have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
+    simp only [h, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
+      Finset.mem_image, imp_true_iff]
+  have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - good_δ E ≤ ‖c - d‖ :=
+    by
+    simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
+    intro i j hij
+    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    exact h' i j this
+  have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
+  rwa [s_card] at this 
 #align besicovitch.le_multiplicity_of_δ_of_fin Besicovitch.le_multiplicity_of_δ_of_fin
 
 end
@@ -497,7 +493,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       change i = last N at iN 
       rw [iN, lastc, norm_zero] at hi 
       exact lt_irrefl _ (zero_le_two.trans_lt hi)
-    convert(a.hlast i this).1
+    convert (a.hlast i this).1
     rw [dist_eq_norm, lastc, sub_zero]
   have hj : 2 < ‖a.c j‖ := hi.trans_le hij
   set s := ‖a.c i‖ with hs
Diff
@@ -75,7 +75,7 @@ def centerAndRescale : SatelliteConfig E N τ
       · rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
           abs_of_nonneg (inv_nonneg.2 (a.rpos _).le)]
         refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-        rw [dist_eq_norm] at H
+        rw [dist_eq_norm] at H 
         convert H.1 using 2
         abel
       · rw [← mul_assoc, mul_comm τ, mul_assoc]
@@ -86,7 +86,7 @@ def centerAndRescale : SatelliteConfig E N τ
       · rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
           abs_of_nonneg (inv_nonneg.2 (a.rpos _).le)]
         refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-        rw [dist_eq_norm] at H
+        rw [dist_eq_norm] at H 
         convert H.1 using 2
         abel
       · rw [← mul_assoc, mul_comm τ, mul_assoc]
@@ -98,7 +98,7 @@ def centerAndRescale : SatelliteConfig E N τ
     · rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
         abs_of_nonneg (inv_nonneg.2 (a.rpos _).le)]
       refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-      rw [dist_eq_norm] at H
+      rw [dist_eq_norm] at H 
       convert H.1 using 2
       abel
     · rw [← mul_assoc, mul_comm τ, mul_assoc]
@@ -109,7 +109,7 @@ def centerAndRescale : SatelliteConfig E N τ
     rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
       abs_of_nonneg (inv_nonneg.2 (a.rpos _).le), ← mul_add]
     refine' mul_le_mul_of_nonneg_left _ (inv_nonneg.2 (a.rpos _).le)
-    rw [dist_eq_norm] at H
+    rw [dist_eq_norm] at H 
     convert H using 2
     abel
 #align besicovitch.satellite_config.center_and_rescale Besicovitch.SatelliteConfig.centerAndRescale
@@ -241,12 +241,12 @@ theorem exists_good_δ :
           have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
           rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
           exact ⟨f, f.injective, hf⟩
-        simp only [range_subset_iff, Finset.mem_coe] at hfs
+        simp only [range_subset_iff, Finset.mem_coe] at hfs 
         refine' ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
       ·
         exact
           ⟨fun i => 0, fun i => by simp, fun i j hij => by
-            simpa only [norm_zero, sub_nonpos, sub_self] ⟩
+            simpa only [norm_zero, sub_nonpos, sub_self]⟩
     -- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
     -- in the image are separated by `1 - δ`.
     choose! F hF using this
@@ -268,13 +268,13 @@ theorem exists_good_δ :
           ∃ φ : ℕ → ℕ, StrictMono φ ∧ tendsto ((F ∘ u) ∘ φ) at_top (𝓝 f) :=
         IsCompact.tendsto_subseq (is_compact_closed_ball _ _) A
       refine' ⟨f, fun i => _, fun i j hij => _⟩
-      · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem
+      · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closed_ball, dist_zero_right] at fmem 
         exact fmem i
       · have A : tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) at_top (𝓝 ‖f i - f j‖) :=
           ((hf.apply i).sub (hf.apply j)).norm
         have B : tendsto (fun n => 1 - u (φ n)) at_top (𝓝 (1 - 0)) :=
           tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_at_top)
-        rw [sub_zero] at B
+        rw [sub_zero] at B 
         exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 i j hij
     rcases this with ⟨f, hf, h'f⟩
     -- the range of `f` contradicts the definition of `multiplicity E`.
@@ -282,7 +282,7 @@ theorem exists_good_δ :
       intro i j hij
       by_contra
       have : 1 ≤ ‖f i - f j‖ := h'f i j h
-      simp only [hij, norm_zero, sub_self] at this
+      simp only [hij, norm_zero, sub_self] at this 
       exact lt_irrefl _ (this.trans_lt zero_lt_one)
     let s := Finset.image f Finset.univ
     have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj];
@@ -295,10 +295,10 @@ theorem exists_good_δ :
       simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ,
         Finset.mem_image, Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
       intro i j hij
-      have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
+      have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
       exact h'f i j this
     have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
-    rw [s_card, hN] at this
+    rw [s_card, hN] at this 
     exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
 #align besicovitch.exists_good_δ Besicovitch.exists_good_δ
 
@@ -337,7 +337,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
       intro i j hij
       by_contra
       have : 1 - good_δ E ≤ ‖f i - f j‖ := h' i j h
-      simp only [hij, norm_zero, sub_self] at this
+      simp only [hij, norm_zero, sub_self] at this 
       linarith [good_δ_lt_one E]
     let s := Finset.image f Finset.univ
     have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj];
@@ -350,10 +350,10 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
       simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ,
         Finset.mem_image, Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
       intro i j hij
-      have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
+      have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
       exact h' i j this
     have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
-    rwa [s_card] at this
+    rwa [s_card] at this 
 #align besicovitch.le_multiplicity_of_δ_of_fin Besicovitch.le_multiplicity_of_δ_of_fin
 
 end
@@ -494,8 +494,8 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     have : i < last N := by
       apply lt_top_iff_ne_top.2
       intro iN
-      change i = last N at iN
-      rw [iN, lastc, norm_zero] at hi
+      change i = last N at iN 
+      rw [iN, lastc, norm_zero] at hi 
       exact lt_irrefl _ (zero_le_two.trans_lt hi)
     convert(a.hlast i this).1
     rw [dist_eq_norm, lastc, sub_zero]
@@ -523,7 +523,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
             a.r j - ‖a.c j - a.c i‖ ≤ 0 := sub_nonpos.2 H.1
             _ ≤ s * (τ - 1) := mul_nonneg spos.le (sub_nonneg.2 hτ)
             
-        · rw [norm_sub_rev] at H
+        · rw [norm_sub_rev] at H 
           calc
             a.r j - ‖a.c j - a.c i‖ ≤ τ * a.r i - a.r i := sub_le_sub H.2 H.1
             _ = a.r i * (τ - 1) := by ring
@@ -534,7 +534,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       
   have invs_nonneg : 0 ≤ 2 / s := div_nonneg zero_le_two (zero_le_two.trans hi.le)
   calc
-    1 - δ = 2 / s * (s / 2 - s / 2 * δ) := by field_simp [spos.ne'] ; ring
+    1 - δ = 2 / s * (s / 2 - s / 2 * δ) := by field_simp [spos.ne']; ring
     _ ≤ 2 / s * ‖d - a.c i‖ :=
       (mul_le_mul_of_nonneg_left (by linarith only [hcrj, I, J, hi]) invs_nonneg)
     _ = ‖(2 / s) • a.c i - (2 / ‖a.c j‖) • a.c j‖ :=
Diff
@@ -49,7 +49,7 @@ universe u
 
 open Metric Set FiniteDimensional MeasureTheory Filter Fin
 
-open ENNReal Topology
+open scoped ENNReal Topology
 
 noncomputable section
 
Diff
@@ -166,9 +166,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     refine' Union₂_subset fun x hx => _
     apply ball_subset_ball'
     calc
-      δ + dist x 0 ≤ δ + 2 := by
-        rw [dist_zero_right]
-        exact add_le_add le_rfl (hs x hx)
+      δ + dist x 0 ≤ δ + 2 := by rw [dist_zero_right]; exact add_le_add le_rfl (hs x hx)
       _ = 5 / 2 := by norm_num [δ]
       
   have I :
@@ -240,10 +238,7 @@ theorem exists_good_δ :
       · rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
         obtain ⟨f, f_inj, hfs⟩ : ∃ f : Fin N → E, Function.Injective f ∧ range f ⊆ ↑s :=
           by
-          have : Fintype.card (Fin N) ≤ s.card :=
-            by
-            simp only [Fintype.card_fin]
-            exact s_card
+          have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
           rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
           exact ⟨f, f.injective, hf⟩
         simp only [range_subset_iff, Finset.mem_coe] at hfs
@@ -290,9 +285,7 @@ theorem exists_good_δ :
       simp only [hij, norm_zero, sub_self] at this
       exact lt_irrefl _ (this.trans_lt zero_lt_one)
     let s := Finset.image f Finset.univ
-    have s_card : s.card = N :=
-      by
-      rw [Finset.card_image_of_injective _ finj]
+    have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj];
       exact Finset.card_fin N
     have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
       simp only [hf, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
@@ -302,9 +295,7 @@ theorem exists_good_δ :
       simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ,
         Finset.mem_image, Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
       intro i j hij
-      have : i ≠ j := fun h => by
-        rw [h] at hij
-        exact hij rfl
+      have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
       exact h'f i j this
     have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
     rw [s_card, hN] at this
@@ -328,8 +319,7 @@ def goodτ : ℝ :=
   1 + goodδ E / 4
 #align besicovitch.good_τ Besicovitch.goodτ
 
-theorem one_lt_goodτ : 1 < goodτ E := by
-  dsimp [good_τ, good_δ]
+theorem one_lt_goodτ : 1 < goodτ E := by dsimp [good_τ, good_δ];
   linarith [(exists_good_δ E).choose_spec.1]
 #align besicovitch.one_lt_good_τ Besicovitch.one_lt_goodτ
 
@@ -350,9 +340,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
       simp only [hij, norm_zero, sub_self] at this
       linarith [good_δ_lt_one E]
     let s := Finset.image f Finset.univ
-    have s_card : s.card = n :=
-      by
-      rw [Finset.card_image_of_injective _ finj]
+    have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj];
       exact Finset.card_fin n
     have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
       simp only [h, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
@@ -362,9 +350,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
       simp only [s, forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ,
         Finset.mem_image, Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left]
       intro i j hij
-      have : i ≠ j := fun h => by
-        rw [h] at hij
-        exact hij rfl
+      have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
       exact h' i j this
     have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
     rwa [s_card] at this
@@ -410,11 +396,8 @@ theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       _ ≤ 1 := by linarith only [sq_nonneg δ]
       
   have J : 1 - δ ≤ 1 - δ / 4 := by linarith only [δnonneg]
-  have K : 1 - δ / 4 ≤ τ⁻¹ := by
-    rw [inv_eq_one_div, le_div_iff τpos]
-    exact I
-  suffices L : τ⁻¹ ≤ ‖a.c i - a.c j‖
-  · linarith only [J, K, L]
+  have K : 1 - δ / 4 ≤ τ⁻¹ := by rw [inv_eq_one_div, le_div_iff τpos]; exact I
+  suffices L : τ⁻¹ ≤ ‖a.c i - a.c j‖; · linarith only [J, K, L]
   have hτ' : ∀ k, τ⁻¹ ≤ a.r k := by
     intro k
     rw [inv_eq_one_div, div_le_iff τpos, ← lastr, mul_comm]
@@ -458,9 +441,7 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       
   have A : a.r j - δ ≤ ‖a.c i - a.c j‖ :=
     by
-    rcases ah j i inej.symm with (H | H)
-    · rw [norm_sub_rev]
-      linarith [H.1]
+    rcases ah j i inej.symm with (H | H); · rw [norm_sub_rev]; linarith [H.1]
     have C : a.r j ≤ 4 :=
       calc
         a.r j ≤ τ * a.r i := H.2
@@ -476,12 +457,8 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
         linarith only [C]
       _ = (1 - δ / 4) * a.r j := by ring
       _ ≤ (1 - δ / 4) * (τ * a.r i) := (mul_le_mul_of_nonneg_left H.2 D)
-      _ ≤ 1 * a.r i := by
-        rw [← mul_assoc]
-        apply mul_le_mul_of_nonneg_right J (a.rpos _).le
-      _ ≤ ‖a.c i - a.c j‖ := by
-        rw [one_mul]
-        exact H.1
+      _ ≤ 1 * a.r i := by rw [← mul_assoc]; apply mul_le_mul_of_nonneg_right J (a.rpos _).le
+      _ ≤ ‖a.c i - a.c j‖ := by rw [one_mul]; exact H.1
       
   set d := (2 / ‖a.c j‖) • a.c j with hd
   have : a.r j - δ ≤ ‖a.c i - d‖ + (a.r j - 1) :=
@@ -557,10 +534,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       
   have invs_nonneg : 0 ≤ 2 / s := div_nonneg zero_le_two (zero_le_two.trans hi.le)
   calc
-    1 - δ = 2 / s * (s / 2 - s / 2 * δ) :=
-      by
-      field_simp [spos.ne']
-      ring
+    1 - δ = 2 / s * (s / 2 - s / 2 * δ) := by field_simp [spos.ne'] ; ring
     _ ≤ 2 / s * ‖d - a.c i‖ :=
       (mul_le_mul_of_nonneg_left (by linarith only [hcrj, I, J, hi]) invs_nonneg)
     _ = ‖(2 / s) • a.c i - (2 / ‖a.c j‖) • a.c j‖ :=
@@ -580,14 +554,12 @@ theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (las
   have norm_c'_le : ∀ i, ‖c' i‖ ≤ 2 := by
     intro i
     simp only [c']
-    split_ifs
-    · exact h
+    split_ifs; · exact h
     by_cases hi : ‖a.c i‖ = 0 <;> field_simp [norm_smul, hi]
   refine' ⟨c', fun n => norm_c'_le n, fun i j inej => _⟩
   -- up to exchanging `i` and `j`, one can assume `∥c i∥ ≤ ∥c j∥`.
   wlog hij : ‖a.c i‖ ≤ ‖a.c j‖ generalizing i j
-  · rw [norm_sub_rev]
-    exact this j i inej.symm (le_of_not_le hij)
+  · rw [norm_sub_rev]; exact this j i inej.symm (le_of_not_le hij)
   rcases le_or_lt ‖a.c j‖ 2 with (Hj | Hj)
   -- case `∥c j∥ ≤ 2` (and therefore also `∥c i∥ ≤ 2`)
   · simp_rw [c', Hj, hij.trans Hj, if_true]
Diff
@@ -4,11 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module measure_theory.covering.besicovitch_vector_space
-! leanprover-community/mathlib commit 92ca63f0fb391a9ca5f22d2409a6080e786d99f7
+! 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.Measure.HaarLebesgue
+import Mathbin.MeasureTheory.Measure.Lebesgue.EqHaar
 import Mathbin.MeasureTheory.Covering.Besicovitch
 
 /-!
Diff
@@ -131,7 +131,7 @@ end SatelliteConfig
 /-- The maximum cardinality of a `1`-separated set in the ball of radius `2`. This is also the
 optimal number of families in the Besicovitch covering theorem. -/
 def multiplicity (E : Type _) [NormedAddCommGroup E] :=
-  supₛ
+  sSup
     { N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ }
 #align besicovitch.multiplicity Besicovitch.multiplicity
 
@@ -195,7 +195,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
 
 theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E :=
   by
-  apply csupₛ_le
+  apply csSup_le
   · refine' ⟨0, ⟨∅, by simp⟩⟩
   · rintro _ ⟨s, ⟨rfl, h⟩⟩
     exact Besicovitch.card_le_of_separated s h.1 h.2
@@ -204,7 +204,7 @@ theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E :=
 theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ multiplicity E :=
   by
-  apply le_csupₛ
+  apply le_csSup
   · refine' ⟨5 ^ finrank ℝ E, _⟩
     rintro _ ⟨s, ⟨rfl, h⟩⟩
     exact Besicovitch.card_le_of_separated s h.1 h.2
Diff
@@ -520,7 +520,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       change i = last N at iN
       rw [iN, lastc, norm_zero] at hi
       exact lt_irrefl _ (zero_le_two.trans_lt hi)
-    convert (a.hlast i this).1
+    convert(a.hlast i this).1
     rw [dist_eq_norm, lastc, sub_zero]
   have hj : 2 < ‖a.c j‖ := hi.trans_le hij
   set s := ‖a.c i‖ with hs
Diff
@@ -181,7 +181,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
         have I : 0 < δ := by norm_num [δ]
         simp only [μ.add_haar_ball_of_pos _ I, one_div, one_pow, Finset.sum_const, nsmul_eq_mul,
           div_pow, mul_assoc]
-      _ ≤ μ (ball (0 : E) ρ) := measure_mono A_subset
+      _ ≤ μ (ball (0 : E) ρ) := (measure_mono A_subset)
       _ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
         simp only [μ.add_haar_ball_of_pos _ ρpos]
       
@@ -464,8 +464,8 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     have C : a.r j ≤ 4 :=
       calc
         a.r j ≤ τ * a.r i := H.2
-        _ ≤ τ * 2 := mul_le_mul_of_nonneg_left I τpos.le
-        _ ≤ 5 / 4 * 2 := mul_le_mul_of_nonneg_right (by linarith only [hδ1, hδ2]) zero_le_two
+        _ ≤ τ * 2 := (mul_le_mul_of_nonneg_left I τpos.le)
+        _ ≤ 5 / 4 * 2 := (mul_le_mul_of_nonneg_right (by linarith only [hδ1, hδ2]) zero_le_two)
         _ ≤ 4 := by norm_num
         
     calc
@@ -475,7 +475,7 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
         refine' mul_le_of_le_one_left δnonneg _
         linarith only [C]
       _ = (1 - δ / 4) * a.r j := by ring
-      _ ≤ (1 - δ / 4) * (τ * a.r i) := mul_le_mul_of_nonneg_left H.2 D
+      _ ≤ (1 - δ / 4) * (τ * a.r i) := (mul_le_mul_of_nonneg_left H.2 D)
       _ ≤ 1 * a.r i := by
         rw [← mul_assoc]
         apply mul_le_mul_of_nonneg_right J (a.rpos _).le
@@ -552,7 +552,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
             _ = a.r i * (τ - 1) := by ring
             _ ≤ s * (τ - 1) := mul_le_mul_of_nonneg_right A (sub_nonneg.2 hτ)
             
-      _ ≤ s * (δ / 2) := mul_le_mul_of_nonneg_left (by linarith only [δnonneg, hδ1]) spos.le
+      _ ≤ s * (δ / 2) := (mul_le_mul_of_nonneg_left (by linarith only [δnonneg, hδ1]) spos.le)
       _ = s / 2 * δ := by ring
       
   have invs_nonneg : 0 ≤ 2 / s := div_nonneg zero_le_two (zero_le_two.trans hi.le)
@@ -562,7 +562,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       field_simp [spos.ne']
       ring
     _ ≤ 2 / s * ‖d - a.c i‖ :=
-      mul_le_mul_of_nonneg_left (by linarith only [hcrj, I, J, hi]) invs_nonneg
+      (mul_le_mul_of_nonneg_left (by linarith only [hcrj, I, J, hi]) invs_nonneg)
     _ = ‖(2 / s) • a.c i - (2 / ‖a.c j‖) • a.c j‖ :=
       by
       conv_lhs => rw [norm_sub_rev, ← abs_of_nonneg invs_nonneg]
Diff
@@ -49,7 +49,7 @@ universe u
 
 open Metric Set FiniteDimensional MeasureTheory Filter Fin
 
-open Ennreal Topology
+open ENNReal Topology
 
 noncomputable section
 
@@ -172,24 +172,24 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
       _ = 5 / 2 := by norm_num [δ]
       
   have I :
-    (s.card : ℝ≥0∞) * Ennreal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) ≤
-      Ennreal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) :=
+    (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) ≤
+      ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) :=
     calc
-      (s.card : ℝ≥0∞) * Ennreal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) = μ A :=
+      (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) = μ A :=
         by
         rw [hA, measure_bUnion_finset D fun c hc => measurableSet_ball]
         have I : 0 < δ := by norm_num [δ]
         simp only [μ.add_haar_ball_of_pos _ I, one_div, one_pow, Finset.sum_const, nsmul_eq_mul,
           div_pow, mul_assoc]
       _ ≤ μ (ball (0 : E) ρ) := measure_mono A_subset
-      _ = Ennreal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
+      _ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
         simp only [μ.add_haar_ball_of_pos _ ρpos]
       
-  have J : (s.card : ℝ≥0∞) * Ennreal.ofReal (δ ^ finrank ℝ E) ≤ Ennreal.ofReal (ρ ^ finrank ℝ E) :=
-    (Ennreal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
+  have J : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) :=
+    (ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
   have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
-    simpa [Ennreal.toReal_mul, div_eq_mul_inv] using
-      Ennreal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
+    simpa [ENNReal.toReal_mul, div_eq_mul_inv] using
+      ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
   exact_mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
 

Changes in mathlib4

mathlib3
mathlib4
chore: superfluous parentheses part 2 (#12131)

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

Diff
@@ -169,7 +169,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
         have I : 0 < δ := by norm_num
         simp only [div_pow, μ.addHaar_ball_of_pos _ I]
         simp only [one_div, one_pow, Finset.sum_const, nsmul_eq_mul, mul_assoc]
-      _ ≤ μ (ball (0 : E) ρ) := (measure_mono A_subset)
+      _ ≤ μ (ball (0 : E) ρ) := measure_mono A_subset
       _ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
         simp only [μ.addHaar_ball_of_pos _ ρpos]
   have J : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) :=
@@ -414,7 +414,7 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     have C : a.r j ≤ 4 :=
       calc
         a.r j ≤ τ * a.r i := H.2
-        _ ≤ τ * 2 := (mul_le_mul_of_nonneg_left I τpos.le)
+        _ ≤ τ * 2 := mul_le_mul_of_nonneg_left I τpos.le
         _ ≤ 5 / 4 * 2 := (mul_le_mul_of_nonneg_right (by linarith only [hδ1, hδ2]) zero_le_two)
         _ ≤ 4 := by norm_num
     calc
@@ -423,7 +423,7 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
         refine' mul_le_of_le_one_left δnonneg _
         linarith only [C]
       _ = (1 - δ / 4) * a.r j := by ring
-      _ ≤ (1 - δ / 4) * (τ * a.r i) := (mul_le_mul_of_nonneg_left H.2 D)
+      _ ≤ (1 - δ / 4) * (τ * a.r i) := mul_le_mul_of_nonneg_left H.2 D
       _ ≤ 1 * a.r i := by rw [← mul_assoc]; apply mul_le_mul_of_nonneg_right J (a.rpos _).le
       _ ≤ ‖a.c i - a.c j‖ := by rw [one_mul]; exact H.1
   set d := (2 / ‖a.c j‖) • a.c j with hd
feat: add Tendsto.fst, Tendsto.snd, Tendsto.apply and nhds versions (#11812)
  • Add Tendsto.fst, Tendsto.snd and Tendsto.apply (these are about product of filters)
  • Move the current Tendsto.apply to Tendsto.apply_nhds, and add Tendsto.fst_nhds and Tendsto.snd_nhds (these are about neighborhoods in a product space)
Diff
@@ -247,7 +247,7 @@ theorem exists_goodδ :
     · simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closedBall, dist_zero_right] at fmem
       exact fmem i
     · have A : Tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) atTop (𝓝 ‖f i - f j‖) :=
-        ((hf.apply i).sub (hf.apply j)).norm
+        ((hf.apply_nhds i).sub (hf.apply_nhds j)).norm
       have B : Tendsto (fun n => 1 - u (φ n)) atTop (𝓝 (1 - 0)) :=
         tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_atTop)
       rw [sub_zero] at B
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11801)
Diff
@@ -193,7 +193,7 @@ theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
   · refine' ⟨5 ^ finrank ℝ E, _⟩
     rintro _ ⟨s, ⟨rfl, h⟩⟩
     exact Besicovitch.card_le_of_separated s h.1 h.2
-  · simp only [mem_setOf_eq, Ne.def]
+  · simp only [mem_setOf_eq, Ne]
     exact ⟨s, rfl, hs, h's⟩
 #align besicovitch.card_le_multiplicity Besicovitch.card_le_multiplicity
 
@@ -267,7 +267,7 @@ theorem exists_goodδ :
       Finset.mem_image, true_and]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ := by
     simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
+      Ne, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h'f this
@@ -320,7 +320,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
       Finset.mem_image, imp_true_iff, true_and]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - goodδ E ≤ ‖c - d‖ := by
     simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
+      Ne, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h' this
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
@@ -470,7 +470,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       _ = ‖a.c j‖ - ‖a.c i‖ + ‖d - a.c i‖ := by
         nth_rw 1 [← one_smul ℝ (a.c j)]
         rw [add_left_inj, hd, ← sub_smul, norm_smul, Real.norm_eq_abs, abs_of_nonneg, sub_mul,
-          one_mul, div_mul_cancel _ (zero_le_two.trans_lt hj).ne']
+          one_mul, div_mul_cancel₀ _ (zero_le_two.trans_lt hj).ne']
         rwa [sub_nonneg, div_le_iff (zero_lt_two.trans hj), one_mul]
   have J : a.r j - ‖a.c j - a.c i‖ ≤ s / 2 * δ :=
     calc
chore: move Mathlib to v4.7.0-rc1 (#11162)

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

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

Diff
@@ -176,7 +176,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
   have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
     have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
-    simpa [div_eq_mul_inv, mul_pow] using this
+    simpa [ρ, δ, div_eq_mul_inv, mul_pow] using this
   exact mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
 
@@ -263,10 +263,10 @@ theorem exists_goodδ :
   let s := Finset.image f Finset.univ
   have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
   have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
+    simp only [s, hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
       Finset.mem_image, true_and]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ := by
-    simp only [forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
       Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
@@ -316,10 +316,10 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
   let s := Finset.image f Finset.univ
   have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
   have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [h, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
+    simp only [s, h, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
       Finset.mem_image, imp_true_iff, true_and]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - goodδ E ≤ ‖c - d‖ := by
-    simp only [forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+    simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
       Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
@@ -381,6 +381,10 @@ theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
 
 variable [NormedSpace ℝ E]
 
+-- Adaptation note: after v4.7.0-rc1, there is a performance problem in `field_simp`.
+-- (Part of the code was ignoring the `maxDischargeDepth` setting: now that we have to increase it,
+-- other paths becomes slow.)
+set_option maxHeartbeats 400000 in
 theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     (lastc : a.c (last N) = 0) (lastr : a.r (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4)
     (hδ2 : δ ≤ 1) (i j : Fin N.succ) (inej : i ≠ j) (hi : ‖a.c i‖ ≤ 2) (hj : 2 < ‖a.c j‖) :
@@ -500,7 +504,7 @@ theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (las
   let c' : Fin N.succ → E := fun i => if ‖a.c i‖ ≤ 2 then a.c i else (2 / ‖a.c i‖) • a.c i
   have norm_c'_le : ∀ i, ‖c' i‖ ≤ 2 := by
     intro i
-    simp only
+    simp only [c']
     split_ifs with h; · exact h
     by_cases hi : ‖a.c i‖ = 0 <;> field_simp [norm_smul, hi]
   refine' ⟨c', fun n => norm_c'_le n, fun i j inej => _⟩
@@ -509,17 +513,17 @@ theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (las
   · rw [norm_sub_rev]; exact this j i inej.symm (le_of_not_le hij)
   rcases le_or_lt ‖a.c j‖ 2 with (Hj | Hj)
   -- case `‖c j‖ ≤ 2` (and therefore also `‖c i‖ ≤ 2`)
-  · simp_rw [Hj, hij.trans Hj, if_true]
+  · simp_rw [c', Hj, hij.trans Hj, if_true]
     exact exists_normalized_aux1 a lastr hτ δ hδ1 hδ2 i j inej
   -- case `2 < ‖c j‖`
   · have H'j : ‖a.c j‖ ≤ 2 ↔ False := by simpa only [not_le, iff_false_iff] using Hj
     rcases le_or_lt ‖a.c i‖ 2 with (Hi | Hi)
     · -- case `‖c i‖ ≤ 2`
-      simp_rw [Hi, if_true, H'j, if_false]
+      simp_rw [c', Hi, if_true, H'j, if_false]
       exact exists_normalized_aux2 a lastc lastr hτ δ hδ1 hδ2 i j inej Hi Hj
     · -- case `2 < ‖c i‖`
       have H'i : ‖a.c i‖ ≤ 2 ↔ False := by simpa only [not_le, iff_false_iff] using Hi
-      simp_rw [H'i, if_false, H'j, if_false]
+      simp_rw [c', H'i, if_false, H'j, if_false]
       exact exists_normalized_aux3 a lastc lastr hτ δ hδ1 i j inej Hi hij
 #align besicovitch.satellite_config.exists_normalized Besicovitch.SatelliteConfig.exists_normalized
 
chore: add lemmas for nat literals corresponding to lemmas for nat casts (#8006)

I loogled for every occurrence of "cast", Nat and "natCast" and where the casted nat was n, and made sure there were corresponding @[simp] lemmas for 0, 1, and OfNat.ofNat n. This is necessary in general for simp confluence. Example:

import Mathlib

variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo]

example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
  simp only [Nat.cast_le] -- this `@[simp]` lemma can apply

example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by
  simp only [Nat.cast_ofNat] -- and so can this one

example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
  simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue.

As far as I know, the only file this PR leaves with ofNat gaps is PartENat.lean. #8002 is addressing that file in parallel.

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

Diff
@@ -176,9 +176,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
   have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
     have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
-    simp? [ENNReal.toReal_mul] at this says
-      simp only [one_div, inv_pow, ENNReal.toReal_mul, ENNReal.toReal_nat, div_pow] at this
-    simpa [div_eq_mul_inv, zero_le_two] using this
+    simpa [div_eq_mul_inv, mul_pow] using this
   exact mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
 
@@ -226,7 +224,7 @@ theorem exists_goodδ :
       simp only [range_subset_iff, Finset.mem_coe] at hfs
       exact ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
     · exact
-        ⟨fun _ => 0, fun i => by simp; norm_num, fun i j _ => by
+        ⟨fun _ => 0, by simp, fun i j _ => by
           simpa only [norm_zero, sub_nonpos, sub_self]⟩
   -- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
   -- in the image are separated by `1 - δ`.
@@ -504,7 +502,7 @@ theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (las
     intro i
     simp only
     split_ifs with h; · exact h
-    by_cases hi : ‖a.c i‖ = 0 <;> field_simp [norm_smul, hi]; norm_num
+    by_cases hi : ‖a.c i‖ = 0 <;> field_simp [norm_smul, hi]
   refine' ⟨c', fun n => norm_c'_le n, fun i j inej => _⟩
   -- up to exchanging `i` and `j`, one can assume `‖c i‖ ≤ ‖c j‖`.
   wlog hij : ‖a.c i‖ ≤ ‖a.c j‖ generalizing i j
chore: remove terminal, terminal refines (#10762)

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

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

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

Diff
@@ -224,7 +224,7 @@ theorem exists_goodδ :
         rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
         exact ⟨f, f.injective, hf⟩
       simp only [range_subset_iff, Finset.mem_coe] at hfs
-      refine' ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
+      exact ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
     · exact
         ⟨fun _ => 0, fun i => by simp; norm_num, fun i j _ => by
           simpa only [norm_zero, sub_nonpos, sub_self]⟩
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
@@ -368,7 +368,7 @@ theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       _ ≤ 1 := by linarith only [sq_nonneg δ]
   have J : 1 - δ ≤ 1 - δ / 4 := by linarith only [δnonneg]
   have K : 1 - δ / 4 ≤ τ⁻¹ := by rw [inv_eq_one_div, le_div_iff τpos]; exact I
-  suffices L : τ⁻¹ ≤ ‖a.c i - a.c j‖; · linarith only [J, K, L]
+  suffices L : τ⁻¹ ≤ ‖a.c i - a.c j‖ by linarith only [J, K, L]
   have hτ' : ∀ k, τ⁻¹ ≤ a.r k := by
     intro k
     rw [inv_eq_one_div, div_le_iff τpos, ← lastr, mul_comm]
refactor: Use Pairwise wherever possible (#9236)

Performed with a regex search for ∀ (.) (.), \1 ≠ \2 →, and a few variants to catch implicit binders and explicit types.

I have deliberately avoided trying to make the analogous Set.Pairwise transformation (or any Pairwise (foo on bar) transformations) in this PR, to keep the diff small.

Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>

Diff
@@ -65,7 +65,7 @@ def centerAndRescale : SatelliteConfig E N τ where
   r i := (a.r (last N))⁻¹ * a.r i
   rpos i := mul_pos (inv_pos.2 (a.rpos _)) (a.rpos _)
   h i j hij := by
-    rcases a.h i j hij with (H | H)
+    rcases a.h hij with (H | H)
     · left
       constructor
       · rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs,
@@ -215,7 +215,7 @@ theorem exists_goodδ :
   set N := multiplicity E + 1 with hN
   have :
     ∀ δ : ℝ, 0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧
-      ∀ i j, i ≠ j → 1 - δ ≤ ‖f i - f j‖ := by
+      Pairwise fun i j => 1 - δ ≤ ‖f i - f j‖ := by
     intro δ hδ
     rcases lt_or_le δ 1 with (hδ' | hδ')
     · rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
@@ -232,7 +232,7 @@ theorem exists_goodδ :
   -- in the image are separated by `1 - δ`.
   choose! F hF using this
   -- Choose a converging subsequence when `δ → 0`.
-  have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 ≤ ‖f i - f j‖ := by
+  have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ Pairwise fun i j => 1 ≤ ‖f i - f j‖ := by
     obtain ⟨u, _, zero_lt_u, hu⟩ :
       ∃ u : ℕ → ℝ,
         (∀ m n : ℕ, m < n → u n < u m) ∧ (∀ n : ℕ, 0 < u n) ∧ Filter.Tendsto u Filter.atTop (𝓝 0) :=
@@ -253,13 +253,13 @@ theorem exists_goodδ :
       have B : Tendsto (fun n => 1 - u (φ n)) atTop (𝓝 (1 - 0)) :=
         tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_atTop)
       rw [sub_zero] at B
-      exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 i j hij
+      exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 hij
   rcases this with ⟨f, hf, h'f⟩
   -- the range of `f` contradicts the definition of `multiplicity E`.
   have finj : Function.Injective f := by
     intro i j hij
     by_contra h
-    have : 1 ≤ ‖f i - f j‖ := h'f i j h
+    have : 1 ≤ ‖f i - f j‖ := h'f h
     simp only [hij, norm_zero, sub_self] at this
     exact lt_irrefl _ (this.trans_lt zero_lt_one)
   let s := Finset.image f Finset.univ
@@ -272,7 +272,7 @@ theorem exists_goodδ :
       Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
-    exact h'f i j this
+    exact h'f this
   have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
   rw [s_card, hN] at this
   exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
@@ -307,12 +307,12 @@ theorem card_le_multiplicity_of_δ {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤
 #align besicovitch.card_le_multiplicity_of_δ Besicovitch.card_le_multiplicity_of_δ
 
 theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖f i‖ ≤ 2)
-    (h' : ∀ i j, i ≠ j → 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by
+    (h' : Pairwise fun i j => 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by
   classical
   have finj : Function.Injective f := by
     intro i j hij
     by_contra h
-    have : 1 - goodδ E ≤ ‖f i - f j‖ := h' i j h
+    have : 1 - goodδ E ≤ ‖f i - f j‖ := h' h
     simp only [hij, norm_zero, sub_self] at this
     linarith [goodδ_lt_one E]
   let s := Finset.image f Finset.univ
@@ -325,7 +325,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
       Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
-    exact h' i j this
+    exact h' this
   have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
   rwa [s_card] at this
 #align besicovitch.le_multiplicity_of_δ_of_fin Besicovitch.le_multiplicity_of_δ_of_fin
@@ -355,7 +355,7 @@ theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     (lastr : a.r (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4) (hδ2 : δ ≤ 1)
     (i j : Fin N.succ) (inej : i ≠ j) : 1 - δ ≤ ‖a.c i - a.c j‖ := by
   have ah :
-      ∀ i j, i ≠ j → a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
+      Pairwise fun i j => a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
         a.r j ≤ ‖a.c j - a.c i‖ ∧ a.r i ≤ τ * a.r j := by
     simpa only [dist_eq_norm] using a.h
   have δnonneg : 0 ≤ δ := by linarith only [hτ, hδ1]
@@ -373,7 +373,7 @@ theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     intro k
     rw [inv_eq_one_div, div_le_iff τpos, ← lastr, mul_comm]
     exact a.hlast' k hτ
-  rcases ah i j inej with (H | H)
+  rcases ah inej with (H | H)
   · apply le_trans _ H.1
     exact hτ' i
   · rw [norm_sub_rev]
@@ -388,7 +388,7 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     (hδ2 : δ ≤ 1) (i j : Fin N.succ) (inej : i ≠ j) (hi : ‖a.c i‖ ≤ 2) (hj : 2 < ‖a.c j‖) :
     1 - δ ≤ ‖a.c i - (2 / ‖a.c j‖) • a.c j‖ := by
   have ah :
-      ∀ i j, i ≠ j → a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
+      Pairwise fun i j => a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
         a.r j ≤ ‖a.c j - a.c i‖ ∧ a.r i ≤ τ * a.r j := by
     simpa only [dist_eq_norm] using a.h
   have δnonneg : 0 ≤ δ := by linarith only [hτ, hδ1]
@@ -408,7 +408,7 @@ theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
       _ = (1 : ℝ) - δ ^ 2 / 16 := by ring
       _ ≤ 1 := by linarith only [sq_nonneg δ]
   have A : a.r j - δ ≤ ‖a.c i - a.c j‖ := by
-    rcases ah j i inej.symm with (H | H); · rw [norm_sub_rev]; linarith [H.1]
+    rcases ah inej.symm with (H | H); · rw [norm_sub_rev]; linarith [H.1]
     have C : a.r j ≤ 4 :=
       calc
         a.r j ≤ τ * a.r i := H.2
@@ -444,7 +444,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
     (i j : Fin N.succ) (inej : i ≠ j) (hi : 2 < ‖a.c i‖) (hij : ‖a.c i‖ ≤ ‖a.c j‖) :
     1 - δ ≤ ‖(2 / ‖a.c i‖) • a.c i - (2 / ‖a.c j‖) • a.c j‖ := by
   have ah :
-      ∀ i j, i ≠ j → a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
+      Pairwise fun i j => a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
         a.r j ≤ ‖a.c j - a.c i‖ ∧ a.r i ≤ τ * a.r j := by
     simpa only [dist_eq_norm] using a.h
   have δnonneg : 0 ≤ δ := by linarith only [hτ, hδ1]
@@ -473,7 +473,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
   have J : a.r j - ‖a.c j - a.c i‖ ≤ s / 2 * δ :=
     calc
       a.r j - ‖a.c j - a.c i‖ ≤ s * (τ - 1) := by
-        rcases ah j i inej.symm with (H | H)
+        rcases ah inej.symm with (H | H)
         · calc
             a.r j - ‖a.c j - a.c i‖ ≤ 0 := sub_nonpos.2 H.1
             _ ≤ s * (τ - 1) := mul_nonneg spos.le (sub_nonneg.2 hτ)
@@ -498,7 +498,7 @@ theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
 
 theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (lastc : a.c (last N) = 0)
     (lastr : a.r (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4) (hδ2 : δ ≤ 1) :
-    ∃ c' : Fin N.succ → E, (∀ n, ‖c' n‖ ≤ 2) ∧ ∀ i j, i ≠ j → 1 - δ ≤ ‖c' i - c' j‖ := by
+    ∃ c' : Fin N.succ → E, (∀ n, ‖c' n‖ ≤ 2) ∧ Pairwise fun i j => 1 - δ ≤ ‖c' i - c' j‖ := by
   let c' : Fin N.succ → E := fun i => if ‖a.c i‖ ≤ 2 then a.c i else (2 / ‖a.c i‖) • a.c i
   have norm_c'_le : ∀ i, ‖c' i‖ ≤ 2 := by
     intro i
chore: move to v4.5.0-rc1, and merge changes from bump/v4.5.0 branch. (#9188)

This PR:

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

Diff
@@ -177,8 +177,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
   have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
     have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
     simp? [ENNReal.toReal_mul] at this says
-      simp only [one_div, inv_pow, ENNReal.toReal_mul, ENNReal.toReal_nat, inv_nonneg, ge_iff_le,
-        div_pow] at this
+      simp only [one_div, inv_pow, ENNReal.toReal_mul, ENNReal.toReal_nat, div_pow] at this
     simpa [div_eq_mul_inv, zero_le_two] using this
   exact mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
chore: Remove nonterminal simp at (#7795)

Removes nonterminal uses of simp at. Replaces most of these with instances of simp? ... says.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -176,7 +176,9 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     (ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
   have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
     have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
-    simp [ENNReal.toReal_mul] at this
+    simp? [ENNReal.toReal_mul] at this says
+      simp only [one_div, inv_pow, ENNReal.toReal_mul, ENNReal.toReal_nat, inv_nonneg, ge_iff_le,
+        div_pow] at this
     simpa [div_eq_mul_inv, zero_le_two] using this
   exact mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
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
@@ -210,7 +210,7 @@ theorem exists_goodδ :
     subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
     `N = multiplicity E + 1`. To formalize this, we work with functions `Fin N → E`.
      -/
-  by_contra' h
+  by_contra! h
   set N := multiplicity E + 1 with hN
   have :
     ∀ δ : ℝ, 0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧
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
@@ -178,7 +178,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
     simp [ENNReal.toReal_mul] at this
     simpa [div_eq_mul_inv, zero_le_two] using this
-  exact_mod_cast K
+  exact mod_cast K
 #align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
 
 theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E := by
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

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

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

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

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

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

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

leanprover/lean4#2722

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

leanprover/lean4#2783

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

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

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

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

Diff
@@ -44,8 +44,6 @@ In particular, this number is bounded by `5 ^ dim` by a straightforward measure
 
 universe u
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 open Metric Set FiniteDimensional MeasureTheory Filter Fin
 
 open scoped ENNReal Topology
chore: swap primes on forall_apply_eq_imp_iff (#7705)

Two pairs of the form foo and foo', where foo' is the simp lemma (and hence used in many simp onlys) and foo is not used at all.

Swap the primes, so that when it is time (now!) to upstream the lemma we actually use, it doesn't need to have a prime...

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

Diff
@@ -266,11 +266,11 @@ theorem exists_goodδ :
   let s := Finset.image f Finset.univ
   have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
   have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [hf, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
+    simp only [hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
       Finset.mem_image, true_and]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ := by
-    simp only [forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left, true_and]
+    simp only [forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h'f i j this
@@ -319,11 +319,11 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
   let s := Finset.image f Finset.univ
   have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
   have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
-    simp only [h, forall_apply_eq_imp_iff', forall_const, forall_exists_index, Finset.mem_univ,
+    simp only [h, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
       Finset.mem_image, imp_true_iff, true_and]
   have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - goodδ E ≤ ‖c - d‖ := by
-    simp only [forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
-      Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left, true_and]
+    simp only [forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
+      Ne.def, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
     intro i j hij
     have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h' i j this
feat: fix norm num with arguments (#6600)

norm_num was passing the wrong syntax node to elabSimpArgs when elaborating, which essentially had the effect of ignoring all arguments it was passed, i.e. norm_num [add_comm] would not try to commute addition in the simp step. The fix itself is very simple (though not obvious to debug!), probably using TSyntax more would help avoid such issues in future.

Due to this bug many norm_num [blah] became rw [blah]; norm_num or similar, sometimes with porting notes, sometimes not, we fix these porting notes and other regressions during the port also.

Interestingly cancel_denoms uses norm_num [<- mul_assoc] internally, so cancel_denoms also got stronger with this change.

Diff
@@ -148,7 +148,7 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
   let μ : Measure E := Measure.addHaar
   let δ : ℝ := (1 : ℝ) / 2
   let ρ : ℝ := (5 : ℝ) / 2
-  have ρpos : 0 < ρ := by norm_num [ρ]
+  have ρpos : 0 < ρ := by norm_num
   set A := ⋃ c ∈ s, ball (c : E) δ with hA
   have D : Set.Pairwise (s : Set E) (Disjoint on fun c => ball (c : E) δ) := by
     rintro c hc d hd hcd
@@ -161,14 +161,14 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
     apply ball_subset_ball'
     calc
       δ + dist x 0 ≤ δ + 2 := by rw [dist_zero_right]; exact add_le_add le_rfl (hs x hx)
-      _ = 5 / 2 := by norm_num [δ]
+      _ = 5 / 2 := by norm_num
   have I :
     (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) ≤
       ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) :=
     calc
       (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) = μ A := by
         rw [hA, measure_biUnion_finset D fun c _ => measurableSet_ball]
-        have I : 0 < δ := by norm_num [δ]
+        have I : 0 < δ := by norm_num
         simp only [div_pow, μ.addHaar_ball_of_pos _ I]
         simp only [one_div, one_pow, Finset.sum_const, nsmul_eq_mul, mul_assoc]
       _ ≤ μ (ball (0 : E) ρ) := (measure_mono A_subset)
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
@@ -54,7 +54,7 @@ noncomputable section
 
 namespace Besicovitch
 
-variable {E : Type _} [NormedAddCommGroup E]
+variable {E : Type*} [NormedAddCommGroup E]
 
 namespace SatelliteConfig
 
@@ -128,7 +128,7 @@ end SatelliteConfig
 
 /-- The maximum cardinality of a `1`-separated set in the ball of radius `2`. This is also the
 optimal number of families in the Besicovitch covering theorem. -/
-def multiplicity (E : Type _) [NormedAddCommGroup E] :=
+def multiplicity (E : Type*) [NormedAddCommGroup E] :=
   sSup {N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖}
 #align besicovitch.multiplicity Besicovitch.multiplicity
 
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -44,7 +44,7 @@ In particular, this number is bounded by `5 ^ dim` by a straightforward measure
 
 universe u
 
-local macro_rules | `($x ^ $y)   => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 open Metric Set FiniteDimensional MeasureTheory Filter Fin
 
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,15 +2,12 @@
 Copyright (c) 2021 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module measure_theory.covering.besicovitch_vector_space
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
 import Mathlib.MeasureTheory.Covering.Besicovitch
 
+#align_import measure_theory.covering.besicovitch_vector_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
+
 /-!
 # Satellite configurations for Besicovitch covering lemma in vector spaces
 
chore(MeasureTheory): rename add_haar to addHaar (#5811)

This is supposed to mean "an additive Haar measure", not adding something to Haar, so it should be one word and not two.

Diff
@@ -172,11 +172,11 @@ theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
       (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) = μ A := by
         rw [hA, measure_biUnion_finset D fun c _ => measurableSet_ball]
         have I : 0 < δ := by norm_num [δ]
-        simp only [div_pow, μ.add_haar_ball_of_pos _ I]
+        simp only [div_pow, μ.addHaar_ball_of_pos _ I]
         simp only [one_div, one_pow, Finset.sum_const, nsmul_eq_mul, mul_assoc]
       _ ≤ μ (ball (0 : E) ρ) := (measure_mono A_subset)
       _ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
-        simp only [μ.add_haar_ball_of_pos _ ρpos]
+        simp only [μ.addHaar_ball_of_pos _ ρpos]
   have J : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) :=
     (ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
   have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
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
@@ -275,7 +275,7 @@ theorem exists_goodδ :
     simp only [forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
       Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left, true_and]
     intro i j hij
-    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h'f i j this
   have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
   rw [s_card, hN] at this
@@ -328,7 +328,7 @@ theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖
     simp only [forall_apply_eq_imp_iff', forall_exists_index, Finset.mem_univ, Finset.mem_image,
       Ne.def, exists_true_left, forall_apply_eq_imp_iff', forall_true_left, true_and]
     intro i j hij
-    have : i ≠ j := fun h => by rw [h] at hij ; exact hij rfl
+    have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
     exact h' i j this
   have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
   rwa [s_card] at this
chore: tidy various files (#5268)
Diff
@@ -510,11 +510,11 @@ theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (las
     split_ifs with h; · exact h
     by_cases hi : ‖a.c i‖ = 0 <;> field_simp [norm_smul, hi]; norm_num
   refine' ⟨c', fun n => norm_c'_le n, fun i j inej => _⟩
-  -- up to exchanging `i` and `j`, one can assume `∥c i∥ ≤ ∥c j∥`.
+  -- up to exchanging `i` and `j`, one can assume `‖c i‖ ≤ ‖c j‖`.
   wlog hij : ‖a.c i‖ ≤ ‖a.c j‖ generalizing i j
   · rw [norm_sub_rev]; exact this j i inej.symm (le_of_not_le hij)
   rcases le_or_lt ‖a.c j‖ 2 with (Hj | Hj)
-  -- case `∥c j∥ ≤ 2` (and therefore also `∥c i∥ ≤ 2`)
+  -- case `‖c j‖ ≤ 2` (and therefore also `‖c i‖ ≤ 2`)
   · simp_rw [Hj, hij.trans Hj, if_true]
     exact exists_normalized_aux1 a lastr hτ δ hδ1 hδ2 i j inej
   -- case `2 < ‖c j‖`
chore: fix many typos (#4967)

These are all doc fixes

Diff
@@ -342,7 +342,7 @@ namespace SatelliteConfig
 ### Relating satellite configurations to separated points in the ball of radius `2`.
 
 We prove that the number of points in a satellite configuration is bounded by the maximal number
-of `1`-separated points in the ball of radius `2`. For this, start from a satellite congifuration
+of `1`-separated points in the ball of radius `2`. For this, start from a satellite configuration
 `c`. Without loss of generality, one can assume that the last ball is centered at `0` and of
 radius `1`. Define `c' i = c i` if `‖c i‖ ≤ 2`, and `c' i = (2/‖c i‖) • c i` if `‖c i‖ > 2`.
 It turns out that these points are `1 - δ`-separated, where `δ` is arbitrarily small if `τ` is
feat: port MeasureTheory.Covering.BesicovitchVectorSpace (#4832)

Dependencies 12 + 1019

1020 files ported (98.8%)
466835 lines ported (98.8%)
Show graph

The unported dependencies are

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