topology.metric_space.emetric_paracompactMathlib.Topology.EMetricSpace.Paracompact

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury G. Kudryashov
 -/
 import SetTheory.Ordinal.Basic
-import Topology.MetricSpace.EmetricSpace
-import Topology.Paracompact
+import Topology.EMetricSpace.Basic
+import Topology.Compactness.Paracompact
 
 #align_import topology.metric_space.emetric_paracompact from "leanprover-community/mathlib"@"f47581155c818e6361af4e4fda60d27d020c226b"
 
@@ -47,7 +47,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
   have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
     pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
   have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := by intro n;
-    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
+    simp [pow_succ', ← mul_assoc, ENNReal.mul_inv_cancel]
   -- Consider an open covering `S : set (set α)`
   refine' ⟨fun ι s ho hcov => _⟩
   simp only [Union_eq_univ_iff] at hcov
Diff
@@ -50,7 +50,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
   -- Consider an open covering `S : set (set α)`
   refine' ⟨fun ι s ho hcov => _⟩
-  simp only [Union_eq_univ_iff] at hcov 
+  simp only [Union_eq_univ_iff] at hcov
   -- choose a well founded order on `S`
   letI : LinearOrder ι := linearOrderOfSTO WellOrderingRel
   have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
Diff
@@ -38,38 +38,145 @@ namespace Emetric
 -- See note [lower instance priority]
 /-- A `pseudo_emetric_space` is always a paracompact space. Formalization is based
 on [MR0236876]. -/
-instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by classical
+instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
+  classical
+  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
+    the comments and `2⁻¹ ^ k` in the code. -/
+  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
+    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
+  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
+    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
+  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := by intro n;
+    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
+  -- Consider an open covering `S : set (set α)`
+  refine' ⟨fun ι s ho hcov => _⟩
+  simp only [Union_eq_univ_iff] at hcov 
+  -- choose a well founded order on `S`
+  letI : LinearOrder ι := linearOrderOfSTO WellOrderingRel
+  have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
+  -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
+  set ind : α → ι := fun x => wf.min {i : ι | x ∈ s i} (hcov x)
+  have mem_ind : ∀ x, x ∈ s (ind x) := fun x => wf.min_mem _ (hcov x)
+  have nmem_of_lt_ind : ∀ {x i}, i < ind x → x ∉ s i := fun x i hlt hxi =>
+    wf.not_lt_min _ (hcov x) hxi hlt
+  /- The refinement `D : ℕ → ι → set α` is defined recursively. For each `n` and `i`, `D n i`
+    is the union of balls `ball x (1 / 2 ^ n)` over all points `x` such that
+  
+    * `ind x = i`;
+    * `x` does not belong to any `D m j`, `m < n`;
+    * `ball x (3 / 2 ^ n) ⊆ s i`;
+  
+    We define this sequence using `nat.strong_rec_on'`, then restate it as `Dn` and `memD`.
+    -/
+  set D : ℕ → ι → Set α := fun n =>
+    Nat.strongRecOn' n fun n D' i =>
+      ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
+        ∀ m < n, ∀ (j : ι), x ∉ D' m ‹_› j), ball x (2⁻¹ ^ n)
+  have Dn :
+    ∀ n i,
+      D n i =
+        ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
+          ∀ m < n, ∀ (j : ι), x ∉ D m j), ball x (2⁻¹ ^ n) :=
+    fun n s => by simp only [D]; rw [Nat.strongRecOn'_beta]
+  have memD :
+    ∀ {n i y},
+      y ∈ D n i ↔
+        ∃ (x : _) (hi : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
+          ∀ m < n, ∀ (j : ι), x ∉ D m j), edist y x < 2⁻¹ ^ n :=
+    by intro n i y; rw [Dn n i]; simp only [mem_Union, mem_ball]
+  -- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
+  -- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
+  have Dcov : ∀ x, ∃ n i, x ∈ D n i := by
+    intro x
+    obtain ⟨n, hn⟩ : ∃ n : ℕ, ball x (3 * 2⁻¹ ^ n) ⊆ s (ind x) :=
+      by
+      -- This proof takes 5 lines because we can't import `specific_limits` here
+      rcases is_open_iff.1 (ho <| ind x) x (mem_ind x) with ⟨ε, ε0, hε⟩
+      have : 0 < ε / 3 := ENNReal.div_pos_iff.2 ⟨ε0.lt.ne', ENNReal.coe_ne_top⟩
+      rcases ENNReal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
+      refine' ⟨n, subset.trans (ball_subset_ball _) hε⟩
+      simpa only [div_eq_mul_inv, mul_comm] using (ENNReal.mul_lt_of_lt_div hn).le
+    by_contra! h
+    apply h n (ind x)
+    exact memD.2 ⟨x, rfl, hn, fun _ _ _ => h _ _, mem_ball_self (pow_pos _)⟩
+  -- Each `D n i` is a union of open balls, hence it is an open set
+  have Dopen : ∀ n i, IsOpen (D n i) := by
+    intro n i
+    rw [Dn]
+    iterate 4 refine' isOpen_iUnion fun _ => _
+    exact is_open_ball
+  -- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
+  have HDS : ∀ n i, D n i ⊆ s i := by
+    intro n s x
+    rw [memD]
+    rintro ⟨y, rfl, hsub, -, hyx⟩
+    refine' hsub (lt_of_lt_of_le hyx _)
+    calc
+      2⁻¹ ^ n = 1 * 2⁻¹ ^ n := (one_mul _).symm
+      _ ≤ 3 * 2⁻¹ ^ n := mul_le_mul_right' _ _
+    -- TODO: use `norm_num`
+    have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := Nat.cast_le.2 (by norm_num1)
+    exact_mod_cast this
+  -- Let us show the rest of the properties. Since the definition expects a family indexed
+  -- by a single parameter, we use `ℕ × ι` as the domain.
+  refine' ⟨ℕ × ι, fun ni => D ni.1 ni.2, fun _ => Dopen _ _, _, _, fun ni => ⟨ni.2, HDS _ _⟩⟩
+  -- The sets `D n i` cover the whole space as we proved earlier
+  · refine' Union_eq_univ_iff.2 fun x => _
+    rcases Dcov x with ⟨n, i, h⟩
+    exact ⟨⟨n, i⟩, h⟩
+  · /- Let us prove that the covering `D n i` is locally finite. Take a point `x` and choose
+        `n`, `i` so that `x ∈ D n i`. Since `D n i` is an open set, we can choose `k` so that
+        `B = ball x (1 / 2 ^ (n + k + 1)) ⊆ D n i`. -/
+    intro x
+    rcases Dcov x with ⟨n, i, hn⟩
+    have : D n i ∈ 𝓝 x := IsOpen.mem_nhds (Dopen _ _) hn
+    rcases(nhds_basis_uniformity uniformity_basis_edist_inv_two_pow).mem_iff.1 this with
+      ⟨k, -, hsub : ball x (2⁻¹ ^ k) ⊆ D n i⟩
+    set B := ball x (2⁻¹ ^ (n + k + 1))
+    refine' ⟨B, ball_mem_nhds _ (pow_pos _), _⟩
+    -- The sets `D m i`, `m > n + k`, are disjoint with `B`
+    have Hgt : ∀ m ≥ n + k + 1, ∀ (i : ι), Disjoint (D m i) B :=
+      by
+      rintro m hm i
+      rw [disjoint_iff_inf_le]
+      rintro y ⟨hym, hyx⟩
+      rcases memD.1 hym with ⟨z, rfl, hzi, H, hz⟩
+      have : z ∉ ball x (2⁻¹ ^ k) := fun hz => H n (by linarith) i (hsub hz); apply this
+      calc
+        edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
+        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
+        _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
+          (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
+        _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
+    -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
+    have Hle : ∀ m ≤ n + k, Set.Subsingleton {j | (D m j ∩ B).Nonempty} :=
+      by
+      rintro m hm j₁ ⟨y, hyD, hyB⟩ j₂ ⟨z, hzD, hzB⟩
+      by_contra! h' : j₁ ≠ j₂
+      wlog h : j₁ < j₂ generalizing j₁ j₂ y z
+      · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
+      rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
+      rcases memD.1 hzD with ⟨z', rfl, -, -, hdistz⟩
+      suffices : edist z' y' < 3 * 2⁻¹ ^ m; exact nmem_of_lt_ind h (hsuby this)
+      calc
+        edist z' y' ≤ edist z' x + edist x y' := edist_triangle _ _ _
+        _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
+          (add_le_add (edist_triangle_left _ _ _) (edist_triangle_left _ _ _))
+        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) + (2⁻¹ ^ (n + k + 1) + 2⁻¹ ^ m) := by
+          apply_rules [ENNReal.add_lt_add]
+        _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
+        _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
+          (mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl))
+        _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
+    -- Finally, we glue `Hgt` and `Hle`
+    have : (⋃ (m ≤ n + k) (i ∈ {i : ι | (D m i ∩ B).Nonempty}), {(m, i)}).Finite :=
+      (finite_le_nat _).biUnion' fun i hi =>
+        (Hle i hi).Finite.biUnion' fun _ _ => finite_singleton _
+    refine' this.subset fun I hI => _; simp only [mem_Union]
+    refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
+    exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
 
 #print EMetric.t4Space /-
-/- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
-  the comments and `2⁻¹ ^ k` in the code. -/
--- Consider an open covering `S : set (set α)`
--- choose a well founded order on `S`
--- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
-/- The refinement `D : ℕ → ι → set α` is defined recursively. For each `n` and `i`, `D n i`
-  is the union of balls `ball x (1 / 2 ^ n)` over all points `x` such that
-
-  * `ind x = i`;
-  * `x` does not belong to any `D m j`, `m < n`;
-  * `ball x (3 / 2 ^ n) ⊆ s i`;
-
-  We define this sequence using `nat.strong_rec_on'`, then restate it as `Dn` and `memD`.
-  -/
--- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
--- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
--- This proof takes 5 lines because we can't import `specific_limits` here
--- Each `D n i` is a union of open balls, hence it is an open set
--- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
--- TODO: use `norm_num`
--- Let us show the rest of the properties. Since the definition expects a family indexed
--- by a single parameter, we use `ℕ × ι` as the domain.
--- The sets `D n i` cover the whole space as we proved earlier
-/- Let us prove that the covering `D n i` is locally finite. Take a point `x` and choose
-    `n`, `i` so that `x ∈ D n i`. Since `D n i` is an open set, we can choose `k` so that
-    `B = ball x (1 / 2 ^ (n + k + 1)) ⊆ D n i`. -/
--- The sets `D m i`, `m > n + k`, are disjoint with `B`
--- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
--- Finally, we glue `Hgt` and `Hle`
 -- see Note [lower instance priority]
 instance (priority := 100) t4Space [EMetricSpace α] : NormalSpace α :=
   T4Space.of_paracompactSpace_t2Space
Diff
@@ -38,145 +38,38 @@ namespace Emetric
 -- See note [lower instance priority]
 /-- A `pseudo_emetric_space` is always a paracompact space. Formalization is based
 on [MR0236876]. -/
-instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
-  classical
-  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
-    the comments and `2⁻¹ ^ k` in the code. -/
-  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
-    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
-  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
-    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
-  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := by intro n;
-    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
-  -- Consider an open covering `S : set (set α)`
-  refine' ⟨fun ι s ho hcov => _⟩
-  simp only [Union_eq_univ_iff] at hcov 
-  -- choose a well founded order on `S`
-  letI : LinearOrder ι := linearOrderOfSTO WellOrderingRel
-  have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
-  -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
-  set ind : α → ι := fun x => wf.min {i : ι | x ∈ s i} (hcov x)
-  have mem_ind : ∀ x, x ∈ s (ind x) := fun x => wf.min_mem _ (hcov x)
-  have nmem_of_lt_ind : ∀ {x i}, i < ind x → x ∉ s i := fun x i hlt hxi =>
-    wf.not_lt_min _ (hcov x) hxi hlt
-  /- The refinement `D : ℕ → ι → set α` is defined recursively. For each `n` and `i`, `D n i`
-    is the union of balls `ball x (1 / 2 ^ n)` over all points `x` such that
-  
-    * `ind x = i`;
-    * `x` does not belong to any `D m j`, `m < n`;
-    * `ball x (3 / 2 ^ n) ⊆ s i`;
-  
-    We define this sequence using `nat.strong_rec_on'`, then restate it as `Dn` and `memD`.
-    -/
-  set D : ℕ → ι → Set α := fun n =>
-    Nat.strongRecOn' n fun n D' i =>
-      ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
-        ∀ m < n, ∀ (j : ι), x ∉ D' m ‹_› j), ball x (2⁻¹ ^ n)
-  have Dn :
-    ∀ n i,
-      D n i =
-        ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
-          ∀ m < n, ∀ (j : ι), x ∉ D m j), ball x (2⁻¹ ^ n) :=
-    fun n s => by simp only [D]; rw [Nat.strongRecOn'_beta]
-  have memD :
-    ∀ {n i y},
-      y ∈ D n i ↔
-        ∃ (x : _) (hi : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
-          ∀ m < n, ∀ (j : ι), x ∉ D m j), edist y x < 2⁻¹ ^ n :=
-    by intro n i y; rw [Dn n i]; simp only [mem_Union, mem_ball]
-  -- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
-  -- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
-  have Dcov : ∀ x, ∃ n i, x ∈ D n i := by
-    intro x
-    obtain ⟨n, hn⟩ : ∃ n : ℕ, ball x (3 * 2⁻¹ ^ n) ⊆ s (ind x) :=
-      by
-      -- This proof takes 5 lines because we can't import `specific_limits` here
-      rcases is_open_iff.1 (ho <| ind x) x (mem_ind x) with ⟨ε, ε0, hε⟩
-      have : 0 < ε / 3 := ENNReal.div_pos_iff.2 ⟨ε0.lt.ne', ENNReal.coe_ne_top⟩
-      rcases ENNReal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
-      refine' ⟨n, subset.trans (ball_subset_ball _) hε⟩
-      simpa only [div_eq_mul_inv, mul_comm] using (ENNReal.mul_lt_of_lt_div hn).le
-    by_contra! h
-    apply h n (ind x)
-    exact memD.2 ⟨x, rfl, hn, fun _ _ _ => h _ _, mem_ball_self (pow_pos _)⟩
-  -- Each `D n i` is a union of open balls, hence it is an open set
-  have Dopen : ∀ n i, IsOpen (D n i) := by
-    intro n i
-    rw [Dn]
-    iterate 4 refine' isOpen_iUnion fun _ => _
-    exact is_open_ball
-  -- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
-  have HDS : ∀ n i, D n i ⊆ s i := by
-    intro n s x
-    rw [memD]
-    rintro ⟨y, rfl, hsub, -, hyx⟩
-    refine' hsub (lt_of_lt_of_le hyx _)
-    calc
-      2⁻¹ ^ n = 1 * 2⁻¹ ^ n := (one_mul _).symm
-      _ ≤ 3 * 2⁻¹ ^ n := mul_le_mul_right' _ _
-    -- TODO: use `norm_num`
-    have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := Nat.cast_le.2 (by norm_num1)
-    exact_mod_cast this
-  -- Let us show the rest of the properties. Since the definition expects a family indexed
-  -- by a single parameter, we use `ℕ × ι` as the domain.
-  refine' ⟨ℕ × ι, fun ni => D ni.1 ni.2, fun _ => Dopen _ _, _, _, fun ni => ⟨ni.2, HDS _ _⟩⟩
-  -- The sets `D n i` cover the whole space as we proved earlier
-  · refine' Union_eq_univ_iff.2 fun x => _
-    rcases Dcov x with ⟨n, i, h⟩
-    exact ⟨⟨n, i⟩, h⟩
-  · /- Let us prove that the covering `D n i` is locally finite. Take a point `x` and choose
-        `n`, `i` so that `x ∈ D n i`. Since `D n i` is an open set, we can choose `k` so that
-        `B = ball x (1 / 2 ^ (n + k + 1)) ⊆ D n i`. -/
-    intro x
-    rcases Dcov x with ⟨n, i, hn⟩
-    have : D n i ∈ 𝓝 x := IsOpen.mem_nhds (Dopen _ _) hn
-    rcases(nhds_basis_uniformity uniformity_basis_edist_inv_two_pow).mem_iff.1 this with
-      ⟨k, -, hsub : ball x (2⁻¹ ^ k) ⊆ D n i⟩
-    set B := ball x (2⁻¹ ^ (n + k + 1))
-    refine' ⟨B, ball_mem_nhds _ (pow_pos _), _⟩
-    -- The sets `D m i`, `m > n + k`, are disjoint with `B`
-    have Hgt : ∀ m ≥ n + k + 1, ∀ (i : ι), Disjoint (D m i) B :=
-      by
-      rintro m hm i
-      rw [disjoint_iff_inf_le]
-      rintro y ⟨hym, hyx⟩
-      rcases memD.1 hym with ⟨z, rfl, hzi, H, hz⟩
-      have : z ∉ ball x (2⁻¹ ^ k) := fun hz => H n (by linarith) i (hsub hz); apply this
-      calc
-        edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
-        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
-        _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
-          (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
-        _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
-    -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
-    have Hle : ∀ m ≤ n + k, Set.Subsingleton {j | (D m j ∩ B).Nonempty} :=
-      by
-      rintro m hm j₁ ⟨y, hyD, hyB⟩ j₂ ⟨z, hzD, hzB⟩
-      by_contra! h' : j₁ ≠ j₂
-      wlog h : j₁ < j₂ generalizing j₁ j₂ y z
-      · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
-      rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
-      rcases memD.1 hzD with ⟨z', rfl, -, -, hdistz⟩
-      suffices : edist z' y' < 3 * 2⁻¹ ^ m; exact nmem_of_lt_ind h (hsuby this)
-      calc
-        edist z' y' ≤ edist z' x + edist x y' := edist_triangle _ _ _
-        _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
-          (add_le_add (edist_triangle_left _ _ _) (edist_triangle_left _ _ _))
-        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) + (2⁻¹ ^ (n + k + 1) + 2⁻¹ ^ m) := by
-          apply_rules [ENNReal.add_lt_add]
-        _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
-        _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
-          (mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl))
-        _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
-    -- Finally, we glue `Hgt` and `Hle`
-    have : (⋃ (m ≤ n + k) (i ∈ {i : ι | (D m i ∩ B).Nonempty}), {(m, i)}).Finite :=
-      (finite_le_nat _).biUnion' fun i hi =>
-        (Hle i hi).Finite.biUnion' fun _ _ => finite_singleton _
-    refine' this.subset fun I hI => _; simp only [mem_Union]
-    refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
-    exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
+instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by classical
 
 #print EMetric.t4Space /-
+/- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
+  the comments and `2⁻¹ ^ k` in the code. -/
+-- Consider an open covering `S : set (set α)`
+-- choose a well founded order on `S`
+-- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
+/- The refinement `D : ℕ → ι → set α` is defined recursively. For each `n` and `i`, `D n i`
+  is the union of balls `ball x (1 / 2 ^ n)` over all points `x` such that
+
+  * `ind x = i`;
+  * `x` does not belong to any `D m j`, `m < n`;
+  * `ball x (3 / 2 ^ n) ⊆ s i`;
+
+  We define this sequence using `nat.strong_rec_on'`, then restate it as `Dn` and `memD`.
+  -/
+-- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
+-- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
+-- This proof takes 5 lines because we can't import `specific_limits` here
+-- Each `D n i` is a union of open balls, hence it is an open set
+-- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
+-- TODO: use `norm_num`
+-- Let us show the rest of the properties. Since the definition expects a family indexed
+-- by a single parameter, we use `ℕ × ι` as the domain.
+-- The sets `D n i` cover the whole space as we proved earlier
+/- Let us prove that the covering `D n i` is locally finite. Take a point `x` and choose
+    `n`, `i` so that `x ∈ D n i`. Since `D n i` is an open set, we can choose `k` so that
+    `B = ball x (1 / 2 ^ (n + k + 1)) ⊆ D n i`. -/
+-- The sets `D m i`, `m > n + k`, are disjoint with `B`
+-- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
+-- Finally, we glue `Hgt` and `Hle`
 -- see Note [lower instance priority]
 instance (priority := 100) t4Space [EMetricSpace α] : NormalSpace α :=
   T4Space.of_paracompactSpace_t2Space
Diff
@@ -45,7 +45,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
   have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
     ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
   have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
-    pow_le_pow_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
+    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
   have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := by intro n;
     simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
   -- Consider an open covering `S : set (set α)`
Diff
@@ -96,7 +96,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
       rcases ENNReal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
       refine' ⟨n, subset.trans (ball_subset_ball _) hε⟩
       simpa only [div_eq_mul_inv, mul_comm] using (ENNReal.mul_lt_of_lt_div hn).le
-    by_contra' h
+    by_contra! h
     apply h n (ind x)
     exact memD.2 ⟨x, rfl, hn, fun _ _ _ => h _ _, mem_ball_self (pow_pos _)⟩
   -- Each `D n i` is a union of open balls, hence it is an open set
@@ -152,7 +152,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     have Hle : ∀ m ≤ n + k, Set.Subsingleton {j | (D m j ∩ B).Nonempty} :=
       by
       rintro m hm j₁ ⟨y, hyD, hyB⟩ j₂ ⟨z, hzD, hzB⟩
-      by_contra' h' : j₁ ≠ j₂
+      by_contra! h' : j₁ ≠ j₂
       wlog h : j₁ < j₂ generalizing j₁ j₂ y z
       · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
       rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
Diff
@@ -3,9 +3,9 @@ Copyright (c) 202 Yury G. Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury G. Kudryashov
 -/
-import Mathbin.SetTheory.Ordinal.Basic
-import Mathbin.Topology.MetricSpace.EmetricSpace
-import Mathbin.Topology.Paracompact
+import SetTheory.Ordinal.Basic
+import Topology.MetricSpace.EmetricSpace
+import Topology.Paracompact
 
 #align_import topology.metric_space.emetric_paracompact from "leanprover-community/mathlib"@"f47581155c818e6361af4e4fda60d27d020c226b"
 
Diff
@@ -176,11 +176,11 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
     exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
 
-#print EMetric.instNormalSpace /-
+#print EMetric.t4Space /-
 -- see Note [lower instance priority]
-instance (priority := 100) instNormalSpace [EMetricSpace α] : NormalSpace α :=
-  normal_of_paracompact_t2
-#align emetric.normal_of_emetric EMetric.instNormalSpace
+instance (priority := 100) t4Space [EMetricSpace α] : NormalSpace α :=
+  T4Space.of_paracompactSpace_t2Space
+#align emetric.normal_of_emetric EMetric.t4Space
 -/
 
 end Emetric
Diff
@@ -176,11 +176,11 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
     exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
 
-#print EMetric.normal_of_emetric /-
+#print EMetric.instNormalSpace /-
 -- see Note [lower instance priority]
-instance (priority := 100) normal_of_emetric [EMetricSpace α] : NormalSpace α :=
+instance (priority := 100) instNormalSpace [EMetricSpace α] : NormalSpace α :=
   normal_of_paracompact_t2
-#align emetric.normal_of_emetric EMetric.normal_of_emetric
+#align emetric.normal_of_emetric EMetric.instNormalSpace
 -/
 
 end Emetric
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 202 Yury G. Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury G. Kudryashov
-
-! This file was ported from Lean 3 source module topology.metric_space.emetric_paracompact
-! leanprover-community/mathlib commit f47581155c818e6361af4e4fda60d27d020c226b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.SetTheory.Ordinal.Basic
 import Mathbin.Topology.MetricSpace.EmetricSpace
 import Mathbin.Topology.Paracompact
 
+#align_import topology.metric_space.emetric_paracompact from "leanprover-community/mathlib"@"f47581155c818e6361af4e4fda60d27d020c226b"
+
 /-!
 # (Extended) metric spaces are paracompact
 
Diff
@@ -117,7 +117,6 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     calc
       2⁻¹ ^ n = 1 * 2⁻¹ ^ n := (one_mul _).symm
       _ ≤ 3 * 2⁻¹ ^ n := mul_le_mul_right' _ _
-      
     -- TODO: use `norm_num`
     have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := Nat.cast_le.2 (by norm_num1)
     exact_mod_cast this
@@ -152,7 +151,6 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
           (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
         _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
-        
     -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
     have Hle : ∀ m ≤ n + k, Set.Subsingleton {j | (D m j ∩ B).Nonempty} :=
       by
@@ -173,7 +171,6 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
           (mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl))
         _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
-        
     -- Finally, we glue `Hgt` and `Hle`
     have : (⋃ (m ≤ n + k) (i ∈ {i : ι | (D m i ∩ B).Nonempty}), {(m, i)}).Finite :=
       (finite_le_nat _).biUnion' fun i hi =>
Diff
@@ -43,144 +43,144 @@ namespace Emetric
 on [MR0236876]. -/
 instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
   classical
-    /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
-      the comments and `2⁻¹ ^ k` in the code. -/
-    have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
-      ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
-    have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
-      pow_le_pow_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
-    have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := by intro n;
-      simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
-    -- Consider an open covering `S : set (set α)`
-    refine' ⟨fun ι s ho hcov => _⟩
-    simp only [Union_eq_univ_iff] at hcov 
-    -- choose a well founded order on `S`
-    letI : LinearOrder ι := linearOrderOfSTO WellOrderingRel
-    have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
-    -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
-    set ind : α → ι := fun x => wf.min { i : ι | x ∈ s i } (hcov x)
-    have mem_ind : ∀ x, x ∈ s (ind x) := fun x => wf.min_mem _ (hcov x)
-    have nmem_of_lt_ind : ∀ {x i}, i < ind x → x ∉ s i := fun x i hlt hxi =>
-      wf.not_lt_min _ (hcov x) hxi hlt
-    /- The refinement `D : ℕ → ι → set α` is defined recursively. For each `n` and `i`, `D n i`
-      is the union of balls `ball x (1 / 2 ^ n)` over all points `x` such that
-    
-      * `ind x = i`;
-      * `x` does not belong to any `D m j`, `m < n`;
-      * `ball x (3 / 2 ^ n) ⊆ s i`;
-    
-      We define this sequence using `nat.strong_rec_on'`, then restate it as `Dn` and `memD`.
-      -/
-    set D : ℕ → ι → Set α := fun n =>
-      Nat.strongRecOn' n fun n D' i =>
+  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
+    the comments and `2⁻¹ ^ k` in the code. -/
+  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
+    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
+  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
+    pow_le_pow_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
+  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := by intro n;
+    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
+  -- Consider an open covering `S : set (set α)`
+  refine' ⟨fun ι s ho hcov => _⟩
+  simp only [Union_eq_univ_iff] at hcov 
+  -- choose a well founded order on `S`
+  letI : LinearOrder ι := linearOrderOfSTO WellOrderingRel
+  have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
+  -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
+  set ind : α → ι := fun x => wf.min {i : ι | x ∈ s i} (hcov x)
+  have mem_ind : ∀ x, x ∈ s (ind x) := fun x => wf.min_mem _ (hcov x)
+  have nmem_of_lt_ind : ∀ {x i}, i < ind x → x ∉ s i := fun x i hlt hxi =>
+    wf.not_lt_min _ (hcov x) hxi hlt
+  /- The refinement `D : ℕ → ι → set α` is defined recursively. For each `n` and `i`, `D n i`
+    is the union of balls `ball x (1 / 2 ^ n)` over all points `x` such that
+  
+    * `ind x = i`;
+    * `x` does not belong to any `D m j`, `m < n`;
+    * `ball x (3 / 2 ^ n) ⊆ s i`;
+  
+    We define this sequence using `nat.strong_rec_on'`, then restate it as `Dn` and `memD`.
+    -/
+  set D : ℕ → ι → Set α := fun n =>
+    Nat.strongRecOn' n fun n D' i =>
+      ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
+        ∀ m < n, ∀ (j : ι), x ∉ D' m ‹_› j), ball x (2⁻¹ ^ n)
+  have Dn :
+    ∀ n i,
+      D n i =
         ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
-          ∀ m < n, ∀ (j : ι), x ∉ D' m ‹_› j), ball x (2⁻¹ ^ n)
-    have Dn :
-      ∀ n i,
-        D n i =
-          ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
-            ∀ m < n, ∀ (j : ι), x ∉ D m j), ball x (2⁻¹ ^ n) :=
-      fun n s => by simp only [D]; rw [Nat.strongRecOn'_beta]
-    have memD :
-      ∀ {n i y},
-        y ∈ D n i ↔
-          ∃ (x : _) (hi : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
-            ∀ m < n, ∀ (j : ι), x ∉ D m j), edist y x < 2⁻¹ ^ n :=
-      by intro n i y; rw [Dn n i]; simp only [mem_Union, mem_ball]
-    -- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
-    -- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
-    have Dcov : ∀ x, ∃ n i, x ∈ D n i := by
-      intro x
-      obtain ⟨n, hn⟩ : ∃ n : ℕ, ball x (3 * 2⁻¹ ^ n) ⊆ s (ind x) :=
-        by
-        -- This proof takes 5 lines because we can't import `specific_limits` here
-        rcases is_open_iff.1 (ho <| ind x) x (mem_ind x) with ⟨ε, ε0, hε⟩
-        have : 0 < ε / 3 := ENNReal.div_pos_iff.2 ⟨ε0.lt.ne', ENNReal.coe_ne_top⟩
-        rcases ENNReal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
-        refine' ⟨n, subset.trans (ball_subset_ball _) hε⟩
-        simpa only [div_eq_mul_inv, mul_comm] using (ENNReal.mul_lt_of_lt_div hn).le
-      by_contra' h
-      apply h n (ind x)
-      exact memD.2 ⟨x, rfl, hn, fun _ _ _ => h _ _, mem_ball_self (pow_pos _)⟩
-    -- Each `D n i` is a union of open balls, hence it is an open set
-    have Dopen : ∀ n i, IsOpen (D n i) := by
-      intro n i
-      rw [Dn]
-      iterate 4 refine' isOpen_iUnion fun _ => _
-      exact is_open_ball
-    -- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
-    have HDS : ∀ n i, D n i ⊆ s i := by
-      intro n s x
-      rw [memD]
-      rintro ⟨y, rfl, hsub, -, hyx⟩
-      refine' hsub (lt_of_lt_of_le hyx _)
+          ∀ m < n, ∀ (j : ι), x ∉ D m j), ball x (2⁻¹ ^ n) :=
+    fun n s => by simp only [D]; rw [Nat.strongRecOn'_beta]
+  have memD :
+    ∀ {n i y},
+      y ∈ D n i ↔
+        ∃ (x : _) (hi : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
+          ∀ m < n, ∀ (j : ι), x ∉ D m j), edist y x < 2⁻¹ ^ n :=
+    by intro n i y; rw [Dn n i]; simp only [mem_Union, mem_ball]
+  -- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
+  -- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
+  have Dcov : ∀ x, ∃ n i, x ∈ D n i := by
+    intro x
+    obtain ⟨n, hn⟩ : ∃ n : ℕ, ball x (3 * 2⁻¹ ^ n) ⊆ s (ind x) :=
+      by
+      -- This proof takes 5 lines because we can't import `specific_limits` here
+      rcases is_open_iff.1 (ho <| ind x) x (mem_ind x) with ⟨ε, ε0, hε⟩
+      have : 0 < ε / 3 := ENNReal.div_pos_iff.2 ⟨ε0.lt.ne', ENNReal.coe_ne_top⟩
+      rcases ENNReal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
+      refine' ⟨n, subset.trans (ball_subset_ball _) hε⟩
+      simpa only [div_eq_mul_inv, mul_comm] using (ENNReal.mul_lt_of_lt_div hn).le
+    by_contra' h
+    apply h n (ind x)
+    exact memD.2 ⟨x, rfl, hn, fun _ _ _ => h _ _, mem_ball_self (pow_pos _)⟩
+  -- Each `D n i` is a union of open balls, hence it is an open set
+  have Dopen : ∀ n i, IsOpen (D n i) := by
+    intro n i
+    rw [Dn]
+    iterate 4 refine' isOpen_iUnion fun _ => _
+    exact is_open_ball
+  -- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
+  have HDS : ∀ n i, D n i ⊆ s i := by
+    intro n s x
+    rw [memD]
+    rintro ⟨y, rfl, hsub, -, hyx⟩
+    refine' hsub (lt_of_lt_of_le hyx _)
+    calc
+      2⁻¹ ^ n = 1 * 2⁻¹ ^ n := (one_mul _).symm
+      _ ≤ 3 * 2⁻¹ ^ n := mul_le_mul_right' _ _
+      
+    -- TODO: use `norm_num`
+    have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := Nat.cast_le.2 (by norm_num1)
+    exact_mod_cast this
+  -- Let us show the rest of the properties. Since the definition expects a family indexed
+  -- by a single parameter, we use `ℕ × ι` as the domain.
+  refine' ⟨ℕ × ι, fun ni => D ni.1 ni.2, fun _ => Dopen _ _, _, _, fun ni => ⟨ni.2, HDS _ _⟩⟩
+  -- The sets `D n i` cover the whole space as we proved earlier
+  · refine' Union_eq_univ_iff.2 fun x => _
+    rcases Dcov x with ⟨n, i, h⟩
+    exact ⟨⟨n, i⟩, h⟩
+  · /- Let us prove that the covering `D n i` is locally finite. Take a point `x` and choose
+        `n`, `i` so that `x ∈ D n i`. Since `D n i` is an open set, we can choose `k` so that
+        `B = ball x (1 / 2 ^ (n + k + 1)) ⊆ D n i`. -/
+    intro x
+    rcases Dcov x with ⟨n, i, hn⟩
+    have : D n i ∈ 𝓝 x := IsOpen.mem_nhds (Dopen _ _) hn
+    rcases(nhds_basis_uniformity uniformity_basis_edist_inv_two_pow).mem_iff.1 this with
+      ⟨k, -, hsub : ball x (2⁻¹ ^ k) ⊆ D n i⟩
+    set B := ball x (2⁻¹ ^ (n + k + 1))
+    refine' ⟨B, ball_mem_nhds _ (pow_pos _), _⟩
+    -- The sets `D m i`, `m > n + k`, are disjoint with `B`
+    have Hgt : ∀ m ≥ n + k + 1, ∀ (i : ι), Disjoint (D m i) B :=
+      by
+      rintro m hm i
+      rw [disjoint_iff_inf_le]
+      rintro y ⟨hym, hyx⟩
+      rcases memD.1 hym with ⟨z, rfl, hzi, H, hz⟩
+      have : z ∉ ball x (2⁻¹ ^ k) := fun hz => H n (by linarith) i (hsub hz); apply this
       calc
-        2⁻¹ ^ n = 1 * 2⁻¹ ^ n := (one_mul _).symm
-        _ ≤ 3 * 2⁻¹ ^ n := mul_le_mul_right' _ _
+        edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
+        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
+        _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
+          (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
+        _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
         
-      -- TODO: use `norm_num`
-      have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := Nat.cast_le.2 (by norm_num1)
-      exact_mod_cast this
-    -- Let us show the rest of the properties. Since the definition expects a family indexed
-    -- by a single parameter, we use `ℕ × ι` as the domain.
-    refine' ⟨ℕ × ι, fun ni => D ni.1 ni.2, fun _ => Dopen _ _, _, _, fun ni => ⟨ni.2, HDS _ _⟩⟩
-    -- The sets `D n i` cover the whole space as we proved earlier
-    · refine' Union_eq_univ_iff.2 fun x => _
-      rcases Dcov x with ⟨n, i, h⟩
-      exact ⟨⟨n, i⟩, h⟩
-    · /- Let us prove that the covering `D n i` is locally finite. Take a point `x` and choose
-          `n`, `i` so that `x ∈ D n i`. Since `D n i` is an open set, we can choose `k` so that
-          `B = ball x (1 / 2 ^ (n + k + 1)) ⊆ D n i`. -/
-      intro x
-      rcases Dcov x with ⟨n, i, hn⟩
-      have : D n i ∈ 𝓝 x := IsOpen.mem_nhds (Dopen _ _) hn
-      rcases(nhds_basis_uniformity uniformity_basis_edist_inv_two_pow).mem_iff.1 this with
-        ⟨k, -, hsub : ball x (2⁻¹ ^ k) ⊆ D n i⟩
-      set B := ball x (2⁻¹ ^ (n + k + 1))
-      refine' ⟨B, ball_mem_nhds _ (pow_pos _), _⟩
-      -- The sets `D m i`, `m > n + k`, are disjoint with `B`
-      have Hgt : ∀ m ≥ n + k + 1, ∀ (i : ι), Disjoint (D m i) B :=
-        by
-        rintro m hm i
-        rw [disjoint_iff_inf_le]
-        rintro y ⟨hym, hyx⟩
-        rcases memD.1 hym with ⟨z, rfl, hzi, H, hz⟩
-        have : z ∉ ball x (2⁻¹ ^ k) := fun hz => H n (by linarith) i (hsub hz); apply this
-        calc
-          edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
-          _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
-          _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
-            (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
-          _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
-          
-      -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
-      have Hle : ∀ m ≤ n + k, Set.Subsingleton { j | (D m j ∩ B).Nonempty } :=
-        by
-        rintro m hm j₁ ⟨y, hyD, hyB⟩ j₂ ⟨z, hzD, hzB⟩
-        by_contra' h' : j₁ ≠ j₂
-        wlog h : j₁ < j₂ generalizing j₁ j₂ y z
-        · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
-        rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
-        rcases memD.1 hzD with ⟨z', rfl, -, -, hdistz⟩
-        suffices : edist z' y' < 3 * 2⁻¹ ^ m; exact nmem_of_lt_ind h (hsuby this)
-        calc
-          edist z' y' ≤ edist z' x + edist x y' := edist_triangle _ _ _
-          _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
-            (add_le_add (edist_triangle_left _ _ _) (edist_triangle_left _ _ _))
-          _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) + (2⁻¹ ^ (n + k + 1) + 2⁻¹ ^ m) := by
-            apply_rules [ENNReal.add_lt_add]
-          _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
-          _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
-            (mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl))
-          _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
-          
-      -- Finally, we glue `Hgt` and `Hle`
-      have : (⋃ (m ≤ n + k) (i ∈ { i : ι | (D m i ∩ B).Nonempty }), {(m, i)}).Finite :=
-        (finite_le_nat _).biUnion' fun i hi =>
-          (Hle i hi).Finite.biUnion' fun _ _ => finite_singleton _
-      refine' this.subset fun I hI => _; simp only [mem_Union]
-      refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
-      exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
+    -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
+    have Hle : ∀ m ≤ n + k, Set.Subsingleton {j | (D m j ∩ B).Nonempty} :=
+      by
+      rintro m hm j₁ ⟨y, hyD, hyB⟩ j₂ ⟨z, hzD, hzB⟩
+      by_contra' h' : j₁ ≠ j₂
+      wlog h : j₁ < j₂ generalizing j₁ j₂ y z
+      · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
+      rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
+      rcases memD.1 hzD with ⟨z', rfl, -, -, hdistz⟩
+      suffices : edist z' y' < 3 * 2⁻¹ ^ m; exact nmem_of_lt_ind h (hsuby this)
+      calc
+        edist z' y' ≤ edist z' x + edist x y' := edist_triangle _ _ _
+        _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
+          (add_le_add (edist_triangle_left _ _ _) (edist_triangle_left _ _ _))
+        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) + (2⁻¹ ^ (n + k + 1) + 2⁻¹ ^ m) := by
+          apply_rules [ENNReal.add_lt_add]
+        _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
+        _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
+          (mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl))
+        _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
+        
+    -- Finally, we glue `Hgt` and `Hle`
+    have : (⋃ (m ≤ n + k) (i ∈ {i : ι | (D m i ∩ B).Nonempty}), {(m, i)}).Finite :=
+      (finite_le_nat _).biUnion' fun i hi =>
+        (Hle i hi).Finite.biUnion' fun _ _ => finite_singleton _
+    refine' this.subset fun I hI => _; simp only [mem_Union]
+    refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
+    exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
 
 #print EMetric.normal_of_emetric /-
 -- see Note [lower instance priority]
Diff
@@ -53,7 +53,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
       simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
     -- Consider an open covering `S : set (set α)`
     refine' ⟨fun ι s ho hcov => _⟩
-    simp only [Union_eq_univ_iff] at hcov
+    simp only [Union_eq_univ_iff] at hcov 
     -- choose a well founded order on `S`
     letI : LinearOrder ι := linearOrderOfSTO WellOrderingRel
     have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
@@ -84,7 +84,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     have memD :
       ∀ {n i y},
         y ∈ D n i ↔
-          ∃ (x : _)(hi : ind x = i)(hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i)(hlt :
+          ∃ (x : _) (hi : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
             ∀ m < n, ∀ (j : ι), x ∉ D m j), edist y x < 2⁻¹ ^ n :=
       by intro n i y; rw [Dn n i]; simp only [mem_Union, mem_ball]
     -- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
Diff
@@ -32,7 +32,7 @@ metric space, paracompact space, normal space
 
 variable {α : Type _}
 
-open ENNReal Topology
+open scoped ENNReal Topology
 
 open Set
 
Diff
@@ -49,9 +49,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
       ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
     have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
       pow_le_pow_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
-    have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n :=
-      by
-      intro n
+    have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := by intro n;
       simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
     -- Consider an open covering `S : set (set α)`
     refine' ⟨fun ι s ho hcov => _⟩
@@ -82,18 +80,13 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         D n i =
           ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
             ∀ m < n, ∀ (j : ι), x ∉ D m j), ball x (2⁻¹ ^ n) :=
-      fun n s => by
-      simp only [D]
-      rw [Nat.strongRecOn'_beta]
+      fun n s => by simp only [D]; rw [Nat.strongRecOn'_beta]
     have memD :
       ∀ {n i y},
         y ∈ D n i ↔
           ∃ (x : _)(hi : ind x = i)(hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i)(hlt :
             ∀ m < n, ∀ (j : ι), x ∉ D m j), edist y x < 2⁻¹ ^ n :=
-      by
-      intro n i y
-      rw [Dn n i]
-      simp only [mem_Union, mem_ball]
+      by intro n i y; rw [Dn n i]; simp only [mem_Union, mem_ball]
     -- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
     -- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
     have Dcov : ∀ x, ∃ n i, x ∈ D n i := by
@@ -152,8 +145,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         rw [disjoint_iff_inf_le]
         rintro y ⟨hym, hyx⟩
         rcases memD.1 hym with ⟨z, rfl, hzi, H, hz⟩
-        have : z ∉ ball x (2⁻¹ ^ k) := fun hz => H n (by linarith) i (hsub hz)
-        apply this
+        have : z ∉ ball x (2⁻¹ ^ k) := fun hz => H n (by linarith) i (hsub hz); apply this
         calc
           edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
           _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
@@ -170,8 +162,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
         rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
         rcases memD.1 hzD with ⟨z', rfl, -, -, hdistz⟩
-        suffices : edist z' y' < 3 * 2⁻¹ ^ m
-        exact nmem_of_lt_ind h (hsuby this)
+        suffices : edist z' y' < 3 * 2⁻¹ ^ m; exact nmem_of_lt_ind h (hsuby this)
         calc
           edist z' y' ≤ edist z' x + edist x y' := edist_triangle _ _ _
           _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
@@ -187,8 +178,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
       have : (⋃ (m ≤ n + k) (i ∈ { i : ι | (D m i ∩ B).Nonempty }), {(m, i)}).Finite :=
         (finite_le_nat _).biUnion' fun i hi =>
           (Hle i hi).Finite.biUnion' fun _ _ => finite_singleton _
-      refine' this.subset fun I hI => _
-      simp only [mem_Union]
+      refine' this.subset fun I hI => _; simp only [mem_Union]
       refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
       exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
 
Diff
@@ -113,7 +113,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     have Dopen : ∀ n i, IsOpen (D n i) := by
       intro n i
       rw [Dn]
-      iterate 4 refine' isOpen_unionᵢ fun _ => _
+      iterate 4 refine' isOpen_iUnion fun _ => _
       exact is_open_ball
     -- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
     have HDS : ∀ n i, D n i ⊆ s i := by
@@ -185,8 +185,8 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
           
       -- Finally, we glue `Hgt` and `Hle`
       have : (⋃ (m ≤ n + k) (i ∈ { i : ι | (D m i ∩ B).Nonempty }), {(m, i)}).Finite :=
-        (finite_le_nat _).bunionᵢ' fun i hi =>
-          (Hle i hi).Finite.bunionᵢ' fun _ _ => finite_singleton _
+        (finite_le_nat _).biUnion' fun i hi =>
+          (Hle i hi).Finite.biUnion' fun _ _ => finite_singleton _
       refine' this.subset fun I hI => _
       simp only [mem_Union]
       refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury G. Kudryashov
 
 ! This file was ported from Lean 3 source module topology.metric_space.emetric_paracompact
-! leanprover-community/mathlib commit 57ac39bd365c2f80589a700f9fbb664d3a1a30c2
+! leanprover-community/mathlib commit f47581155c818e6361af4e4fda60d27d020c226b
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.Topology.Paracompact
 /-!
 # (Extended) metric spaces are paracompact
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we provide two instances:
 
 * `emetric.paracompact_space`: a `pseudo_emetric_space` is paracompact; formalization is based
Diff
@@ -189,10 +189,12 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
       refine' ⟨I.1, _, I.2, hI, prod.mk.eta.symm⟩
       exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
 
+#print EMetric.normal_of_emetric /-
 -- see Note [lower instance priority]
 instance (priority := 100) normal_of_emetric [EMetricSpace α] : NormalSpace α :=
   normal_of_paracompact_t2
-#align emetric.normal_of_emetric Emetric.normal_of_emetric
+#align emetric.normal_of_emetric EMetric.normal_of_emetric
+-/
 
 end Emetric
 
Diff
@@ -38,7 +38,7 @@ namespace Emetric
 -- See note [lower instance priority]
 /-- A `pseudo_emetric_space` is always a paracompact space. Formalization is based
 on [MR0236876]. -/
-instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
+instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
   classical
     /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
       the comments and `2⁻¹ ^ k` in the code. -/
@@ -190,7 +190,7 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
       exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.some_spec
 
 -- see Note [lower instance priority]
-instance (priority := 100) normal_of_emetric [EmetricSpace α] : NormalSpace α :=
+instance (priority := 100) normal_of_emetric [EMetricSpace α] : NormalSpace α :=
   normal_of_paracompact_t2
 #align emetric.normal_of_emetric Emetric.normal_of_emetric
 
Diff
@@ -153,9 +153,9 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
         apply this
         calc
           edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
-          _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := ENNReal.add_lt_add hz hyx
+          _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
           _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
-            add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith)
+            (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
           _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
           
       -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
@@ -172,12 +172,12 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
         calc
           edist z' y' ≤ edist z' x + edist x y' := edist_triangle _ _ _
           _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
-            add_le_add (edist_triangle_left _ _ _) (edist_triangle_left _ _ _)
+            (add_le_add (edist_triangle_left _ _ _) (edist_triangle_left _ _ _))
           _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) + (2⁻¹ ^ (n + k + 1) + 2⁻¹ ^ m) := by
             apply_rules [ENNReal.add_lt_add]
           _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
           _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
-            mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl)
+            (mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl))
           _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
           
       -- Finally, we glue `Hgt` and `Hle`
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury G. Kudryashov
 
 ! This file was ported from Lean 3 source module topology.metric_space.emetric_paracompact
-! leanprover-community/mathlib commit 92ca63f0fb391a9ca5f22d2409a6080e786d99f7
+! leanprover-community/mathlib commit 57ac39bd365c2f80589a700f9fbb664d3a1a30c2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -45,7 +45,7 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
     have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
       ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
     have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
-      ENNReal.pow_le_pow_of_le_one (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
+      pow_le_pow_of_le_one' (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
     have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n :=
       by
       intro n
@@ -120,10 +120,10 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
       refine' hsub (lt_of_lt_of_le hyx _)
       calc
         2⁻¹ ^ n = 1 * 2⁻¹ ^ n := (one_mul _).symm
-        _ ≤ 3 * 2⁻¹ ^ n := ENNReal.mul_le_mul _ le_rfl
+        _ ≤ 3 * 2⁻¹ ^ n := mul_le_mul_right' _ _
         
       -- TODO: use `norm_num`
-      have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := ENNReal.coe_nat_le_coe_nat.2 (by norm_num1)
+      have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := Nat.cast_le.2 (by norm_num1)
       exact_mod_cast this
     -- Let us show the rest of the properties. Since the definition expects a family indexed
     -- by a single parameter, we use `ℕ × ι` as the domain.
@@ -177,7 +177,7 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
             apply_rules [ENNReal.add_lt_add]
           _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
           _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
-            ENNReal.mul_le_mul le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl)
+            mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl)
           _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
           
       -- Finally, we glue `Hgt` and `Hle`
Diff
@@ -29,7 +29,7 @@ metric space, paracompact space, normal space
 
 variable {α : Type _}
 
-open Ennreal Topology
+open ENNReal Topology
 
 open Set
 
@@ -43,13 +43,13 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
     /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
       the comments and `2⁻¹ ^ k` in the code. -/
     have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
-      Ennreal.pow_pos (Ennreal.inv_pos.2 Ennreal.two_ne_top) _
+      ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
     have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := fun m n h =>
-      Ennreal.pow_le_pow_of_le_one (Ennreal.inv_le_one.2 ennreal.one_lt_two.le) h
+      ENNReal.pow_le_pow_of_le_one (ENNReal.inv_le_one.2 ennreal.one_lt_two.le) h
     have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n :=
       by
       intro n
-      simp [pow_succ, ← mul_assoc, Ennreal.mul_inv_cancel]
+      simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
     -- Consider an open covering `S : set (set α)`
     refine' ⟨fun ι s ho hcov => _⟩
     simp only [Union_eq_univ_iff] at hcov
@@ -99,10 +99,10 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
         by
         -- This proof takes 5 lines because we can't import `specific_limits` here
         rcases is_open_iff.1 (ho <| ind x) x (mem_ind x) with ⟨ε, ε0, hε⟩
-        have : 0 < ε / 3 := Ennreal.div_pos_iff.2 ⟨ε0.lt.ne', Ennreal.coe_ne_top⟩
-        rcases Ennreal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
+        have : 0 < ε / 3 := ENNReal.div_pos_iff.2 ⟨ε0.lt.ne', ENNReal.coe_ne_top⟩
+        rcases ENNReal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
         refine' ⟨n, subset.trans (ball_subset_ball _) hε⟩
-        simpa only [div_eq_mul_inv, mul_comm] using (Ennreal.mul_lt_of_lt_div hn).le
+        simpa only [div_eq_mul_inv, mul_comm] using (ENNReal.mul_lt_of_lt_div hn).le
       by_contra' h
       apply h n (ind x)
       exact memD.2 ⟨x, rfl, hn, fun _ _ _ => h _ _, mem_ball_self (pow_pos _)⟩
@@ -120,10 +120,10 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
       refine' hsub (lt_of_lt_of_le hyx _)
       calc
         2⁻¹ ^ n = 1 * 2⁻¹ ^ n := (one_mul _).symm
-        _ ≤ 3 * 2⁻¹ ^ n := Ennreal.mul_le_mul _ le_rfl
+        _ ≤ 3 * 2⁻¹ ^ n := ENNReal.mul_le_mul _ le_rfl
         
       -- TODO: use `norm_num`
-      have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := Ennreal.coe_nat_le_coe_nat.2 (by norm_num1)
+      have : ((1 : ℕ) : ℝ≥0∞) ≤ (3 : ℕ) := ENNReal.coe_nat_le_coe_nat.2 (by norm_num1)
       exact_mod_cast this
     -- Let us show the rest of the properties. Since the definition expects a family indexed
     -- by a single parameter, we use `ℕ × ι` as the domain.
@@ -153,7 +153,7 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
         apply this
         calc
           edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
-          _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := Ennreal.add_lt_add hz hyx
+          _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := ENNReal.add_lt_add hz hyx
           _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
             add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith)
           _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
@@ -174,10 +174,10 @@ instance (priority := 100) [PseudoEmetricSpace α] : ParacompactSpace α := by
           _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
             add_le_add (edist_triangle_left _ _ _) (edist_triangle_left _ _ _)
           _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) + (2⁻¹ ^ (n + k + 1) + 2⁻¹ ^ m) := by
-            apply_rules [Ennreal.add_lt_add]
+            apply_rules [ENNReal.add_lt_add]
           _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
           _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
-            Ennreal.mul_le_mul le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl)
+            ENNReal.mul_le_mul le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl)
           _ = 3 * 2⁻¹ ^ m := by rw [mul_add, h2pow, bit1, add_mul, one_mul]
           
       -- Finally, we glue `Hgt` and `Hle`

Changes in mathlib4

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

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

Diff
@@ -131,7 +131,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
       apply this
       calc
         edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
-        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
+        _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := ENNReal.add_lt_add hz hyx
         _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
           (add_le_add (hpow_le <| by omega) (hpow_le <| by omega))
         _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -45,7 +45,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
   have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
     pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
   have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
-    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
+    simp [pow_succ', ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
   -- Consider an open covering `S : Set (Set α)`
   refine' ⟨fun ι s ho hcov => _⟩
   simp only [iUnion_eq_univ_iff] at hcov
chore: classify todo porting notes (#11216)

Classifies by adding issue number #11215 to porting notes claiming "TODO".

Diff
@@ -50,7 +50,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
   refine' ⟨fun ι s ho hcov => _⟩
   simp only [iUnion_eq_univ_iff] at hcov
   -- choose a well founded order on `S`
-  -- Porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
+  -- Porting note (#11215): TODO: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
   let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
   have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
   -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -50,7 +50,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
   refine' ⟨fun ι s ho hcov => _⟩
   simp only [iUnion_eq_univ_iff] at hcov
   -- choose a well founded order on `S`
-  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
+  -- Porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
   let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
   have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
   -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
@@ -165,7 +165,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
     exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.choose_spec
 #align emetric.paracompact_space EMetric.instParacompactSpace
 
--- porting note: no longer an instance because `inferInstance` can find it
+-- Porting note: no longer an instance because `inferInstance` can find it
 theorem t4Space [EMetricSpace α] : T4Space α := inferInstance
 #align emetric.normal_of_emetric EMetric.t4Space
 
refactor: optimize proofs with omega (#11093)

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

Diff
@@ -127,13 +127,13 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
       rw [disjoint_iff_inf_le]
       rintro y ⟨hym, hyx⟩
       rcases memD.1 hym with ⟨z, rfl, _hzi, H, hz⟩
-      have : z ∉ ball x (2⁻¹ ^ k) := fun hz' => H n (by linarith) i (hsub hz')
+      have : z ∉ ball x (2⁻¹ ^ k) := fun hz' => H n (by omega) i (hsub hz')
       apply this
       calc
         edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
         _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
         _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
-          (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
+          (add_le_add (hpow_le <| by omega) (hpow_le <| by omega))
         _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
     -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
     have Hle : ∀ m ≤ n + k, Set.Subsingleton { j | (D m j ∩ B).Nonempty } := by
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
@@ -143,8 +143,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
       · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
       rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
       rcases memD.1 hzD with ⟨z', rfl, -, -, hdistz⟩
-      suffices : edist z' y' < 3 * 2⁻¹ ^ m
-      exact nmem_of_lt_ind h (hsuby this)
+      suffices edist z' y' < 3 * 2⁻¹ ^ m from nmem_of_lt_ind h (hsuby this)
       calc
         edist z' y' ≤ edist z' x + edist x y' := edist_triangle _ _ _
         _ ≤ edist z z' + edist z x + (edist y x + edist y y') :=
chore: Rename pow monotonicity lemmas (#9095)

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

Renames

Algebra.GroupPower.Order

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

Algebra.GroupPower.CovariantClass

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

Data.Nat.Pow

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

Lemmas added

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

Lemmas removed

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

Other changes

  • A bunch of proofs have been golfed.
  • Some lemma assumptions have been turned from 0 < n or 1 ≤ n to n ≠ 0.
  • A few Nat lemmas have been protected.
  • One docstring has been fixed.
Diff
@@ -43,7 +43,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
   have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
     ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
   have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
-    pow_le_pow_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
+    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
   have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
     simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
   -- Consider an open covering `S : Set (Set α)`
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
@@ -91,7 +91,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
       rcases ENNReal.exists_inv_two_pow_lt this.ne' with ⟨n, hn⟩
       refine' ⟨n, Subset.trans (ball_subset_ball _) hε⟩
       simpa only [div_eq_mul_inv, mul_comm] using (ENNReal.mul_lt_of_lt_div hn).le
-    by_contra' h
+    by_contra! h
     apply h n (ind x)
     exact memD.2 ⟨x, rfl, hn, fun _ _ _ => h _ _, mem_ball_self (pow_pos _)⟩
   -- Each `D n i` is a union of open balls, hence it is an open set
@@ -138,7 +138,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
     -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
     have Hle : ∀ m ≤ n + k, Set.Subsingleton { j | (D m j ∩ B).Nonempty } := by
       rintro m hm j₁ ⟨y, hyD, hyB⟩ j₂ ⟨z, hzD, hzB⟩
-      by_contra' h' : j₁ ≠ j₂
+      by_contra! h' : j₁ ≠ j₂
       wlog h : j₁ < j₂ generalizing j₁ j₂ y z
       · exact this z hzD hzB y hyD hyB h'.symm (h'.lt_or_lt.resolve_left h)
       rcases memD.1 hyD with ⟨y', rfl, hsuby, -, hdisty⟩
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
@@ -45,7 +45,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
   have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
     pow_le_pow_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
   have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
-    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
+    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
   -- Consider an open covering `S : Set (Set α)`
   refine' ⟨fun ι s ho hcov => _⟩
   simp only [iUnion_eq_univ_iff] at hcov
chore: missing spaces after rcases, convert and congrm (#7725)

Replace rcases( with rcases (. Same thing for convert( and congrm(. No other change.

Diff
@@ -118,7 +118,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
   · intro x
     rcases Dcov x with ⟨n, i, hn⟩
     have : D n i ∈ 𝓝 x := IsOpen.mem_nhds (Dopen _ _) hn
-    rcases(nhds_basis_uniformity uniformity_basis_edist_inv_two_pow).mem_iff.1 this with
+    rcases (nhds_basis_uniformity uniformity_basis_edist_inv_two_pow).mem_iff.1 this with
       ⟨k, -, hsub : ball x (2⁻¹ ^ k) ⊆ D n i⟩
     set B := ball x (2⁻¹ ^ (n + k + 1))
     refine' ⟨B, ball_mem_nhds _ (pow_pos _), _⟩
chore(Topology/SubsetProperties): Refactor SubsetProperties.lean (#7628)

Split up the 2000-line Topology/SubsetProperties.lean into several smaller files. Not only is it too huge, but the name is very unhelpful, since actually about 90% of the file is about compactness; I've moved this material into various files inside a new subdirectory Topology/Compactness/.

Diff
@@ -6,7 +6,7 @@ Authors: Yury G. Kudryashov
 import Mathlib.SetTheory.Ordinal.Basic
 import Mathlib.Tactic.GCongr
 import Mathlib.Topology.EMetricSpace.Basic
-import Mathlib.Topology.Paracompact
+import Mathlib.Topology.Compactness.Paracompact
 
 #align_import topology.metric_space.emetric_paracompact from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2"
 
refactor: split NormalSpace into NormalSpace and T4Space (#7072)
  • Rename NormalSpace to T4Space.
  • Add NormalSpace, a version without the T1Space assumption.
  • Adjust some theorems.
  • Supersedes thus closes #6892.
  • Add some instance cycles, see #2030
Diff
@@ -35,8 +35,8 @@ open ENNReal Topology Set
 namespace EMetric
 
 -- See note [lower instance priority]
-/-- A `PseudoEMetricSpace` is always a paracompact space. Formalization is based
-on [MR0236876]. -/
+/-- A `PseudoEMetricSpace` is always a paracompact space.
+Formalization is based on [MR0236876]. -/
 instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
   /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
     the comments and `2⁻¹ ^ k` in the code. -/
@@ -166,9 +166,8 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco
     exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.choose_spec
 #align emetric.paracompact_space EMetric.instParacompactSpace
 
--- see Note [lower instance priority]
-instance (priority := 100) instNormalSpace [EMetricSpace α] : NormalSpace α :=
-  normal_of_paracompact_t2
-#align emetric.normal_of_emetric EMetric.instNormalSpace
+-- porting note: no longer an instance because `inferInstance` can find it
+theorem t4Space [EMetricSpace α] : T4Space α := inferInstance
+#align emetric.normal_of_emetric EMetric.t4Space
 
 end EMetric
chore: fix docstrings, names and aligns about paracompacity of emetric spaces (#7064)
Diff
@@ -15,9 +15,9 @@ import Mathlib.Topology.Paracompact
 
 In this file we provide two instances:
 
-* `EMetric.ParacompactSpace`: a `PseudoEMetricSpace` is paracompact; formalization is based
+* `EMetric.instParacompactSpace`: a `PseudoEMetricSpace` is paracompact; formalization is based
   on [MR0236876];
-* `EMetric.normal_of_metric`: an `EMetricSpace` is a normal topological space.
+* `EMetric.instNormalSpace`: an `EMetricSpace` is a normal topological space.
 
 ## TODO
 
@@ -37,7 +37,7 @@ namespace EMetric
 -- See note [lower instance priority]
 /-- A `PseudoEMetricSpace` is always a paracompact space. Formalization is based
 on [MR0236876]. -/
-instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
+instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
   /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
     the comments and `2⁻¹ ^ k` in the code. -/
   have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
@@ -164,10 +164,11 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     simp only [mem_iUnion]
     refine' ⟨I.1, _, I.2, hI, rfl⟩
     exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.choose_spec
+#align emetric.paracompact_space EMetric.instParacompactSpace
 
 -- see Note [lower instance priority]
-instance (priority := 100) normal_of_emetric [EMetricSpace α] : NormalSpace α :=
+instance (priority := 100) instNormalSpace [EMetricSpace α] : NormalSpace α :=
   normal_of_paracompact_t2
-#align emetric.normal_of_emetric EMetric.normal_of_emetric
+#align emetric.normal_of_emetric EMetric.instNormalSpace
 
 end EMetric
chore: cleanup Mathlib.Init.Data.Prod (#6972)

Removing from Mathlib.Init.Data.Prod from the early parts of the import hierarchy.

While at it, remove unnecessary uses of Prod.mk.eta across the library.

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

Diff
@@ -162,7 +162,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         (Hle i hi).finite.biUnion' fun _ _ => finite_singleton _
     refine' this.subset fun I hI => _
     simp only [mem_iUnion]
-    refine' ⟨I.1, _, I.2, hI, Prod.mk.eta.symm⟩
+    refine' ⟨I.1, _, I.2, hI, rfl⟩
     exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.choose_spec
 
 -- see Note [lower instance priority]
chore: move 2 files to a new folder (#6853)

Later I'm going to split files like Lipschitz into 2: one in EMetricSpace/ and one in MetricSpace/.

Diff
@@ -5,7 +5,7 @@ Authors: Yury G. Kudryashov
 -/
 import Mathlib.SetTheory.Ordinal.Basic
 import Mathlib.Tactic.GCongr
-import Mathlib.Topology.MetricSpace.EMetricSpace
+import Mathlib.Topology.EMetricSpace.Basic
 import Mathlib.Topology.Paracompact
 
 #align_import topology.metric_space.emetric_paracompact from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2"
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
@@ -28,7 +28,7 @@ Generalize to `PseudoMetrizableSpace`s.
 metric space, paracompact space, normal space
 -/
 
-variable {α : Type _}
+variable {α : Type*}
 
 open ENNReal Topology Set
 
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,17 +2,14 @@
 Copyright (c) 202 Yury G. Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury G. Kudryashov
-
-! This file was ported from Lean 3 source module topology.metric_space.emetric_paracompact
-! leanprover-community/mathlib commit 57ac39bd365c2f80589a700f9fbb664d3a1a30c2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.SetTheory.Ordinal.Basic
 import Mathlib.Tactic.GCongr
 import Mathlib.Topology.MetricSpace.EMetricSpace
 import Mathlib.Topology.Paracompact
 
+#align_import topology.metric_space.emetric_paracompact from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2"
+
 /-!
 # (Extended) metric spaces are paracompact
 
chore: fix backtick in docs (#5077)

I wrote a script to find lines that contain an odd number of backticks

Diff
@@ -53,7 +53,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
   refine' ⟨fun ι s ho hcov => _⟩
   simp only [iUnion_eq_univ_iff] at hcov
   -- choose a well founded order on `S`
-  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι
+  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
   let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
   have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
   -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
feat: golf using gcongr throughout the library (#4702)

100 sample uses of the new tactic gcongr, added in #3965.

Diff
@@ -9,6 +9,7 @@ Authors: Yury G. Kudryashov
 ! if you have ported upstream changes.
 -/
 import Mathlib.SetTheory.Ordinal.Basic
+import Mathlib.Tactic.GCongr
 import Mathlib.Topology.MetricSpace.EMetricSpace
 import Mathlib.Topology.Paracompact
 
@@ -154,8 +155,8 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) + (2⁻¹ ^ (n + k + 1) + 2⁻¹ ^ m) := by
           apply_rules [ENNReal.add_lt_add]
         _ = 2 * (2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1)) := by simp only [two_mul, add_comm]
-        _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) :=
-          (mul_le_mul' le_rfl <| add_le_add le_rfl <| hpow_le (add_le_add hm le_rfl))
+        _ ≤ 2 * (2⁻¹ ^ m + 2⁻¹ ^ (m + 1)) := by
+          gcongr 2 * (_ + ?_); exact hpow_le (add_le_add hm le_rfl)
         _ = 3 * 2⁻¹ ^ m := by
           rw [mul_add, h2pow, ← two_add_one_eq_three, add_mul, one_mul]
     -- Finally, we glue `Hgt` and `Hle`
feat: add Mathlib.Tactic.Common, and import (#4056)

This makes a mathlib4 version of mathlib3's tactic.basic, now called Mathlib.Tactic.Common, which imports all tactics which do not have significant theory requirements, and then is imported all across the base of the hierarchy.

This ensures that all common tactics are available nearly everywhere in the library, rather than having to be imported one-by-one as you need them.

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

Diff
@@ -9,7 +9,6 @@ Authors: Yury G. Kudryashov
 ! if you have ported upstream changes.
 -/
 import Mathlib.SetTheory.Ordinal.Basic
-import Mathlib.Tactic.WLOG
 import Mathlib.Topology.MetricSpace.EMetricSpace
 import Mathlib.Topology.Paracompact
 
chore: Rename to sSup/iSup (#3938)

As discussed on Zulip

Renames

  • supₛsSup
  • infₛsInf
  • supᵢiSup
  • infᵢiInf
  • bsupₛbsSup
  • binfₛbsInf
  • bsupᵢbiSup
  • binfᵢbiInf
  • csupₛcsSup
  • cinfₛcsInf
  • csupᵢciSup
  • cinfᵢciInf
  • unionₛsUnion
  • interₛsInter
  • unionᵢiUnion
  • interᵢiInter
  • bunionₛbsUnion
  • binterₛbsInter
  • bunionᵢbiUnion
  • binterᵢbiInter

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -51,7 +51,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
     simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel]
   -- Consider an open covering `S : Set (Set α)`
   refine' ⟨fun ι s ho hcov => _⟩
-  simp only [unionᵢ_eq_univ_iff] at hcov
+  simp only [iUnion_eq_univ_iff] at hcov
   -- choose a well founded order on `S`
   -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι
   let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
@@ -83,7 +83,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
         (∀ m < n, ∀ (j : ι), x ∉ D m j) ∧ edist y x < 2⁻¹ ^ n := by
     intro n i y
     rw [Dn n i]
-    simp only [mem_unionᵢ, mem_ball, exists_prop]
+    simp only [mem_iUnion, mem_ball, exists_prop]
   -- The sets `D n i` cover the whole space. Indeed, for each `x` we can choose `n` such that
   -- `ball x (3 / 2 ^ n) ⊆ s (ind x)`, then either `x ∈ D n i`, or `x ∈ D m i` for some `m < n`.
   have Dcov : ∀ x, ∃ n i, x ∈ D n i := fun x => by
@@ -100,7 +100,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
   -- Each `D n i` is a union of open balls, hence it is an open set
   have Dopen : ∀ n i, IsOpen (D n i) := fun n i => by
     rw [Dn]
-    iterate 4 refine' isOpen_unionᵢ fun _ => _
+    iterate 4 refine' isOpen_iUnion fun _ => _
     exact isOpen_ball
   -- the covering `D n i` is a refinement of the original covering: `D n i ⊆ s i`
   have HDS : ∀ n i, D n i ⊆ s i := fun n i x => by
@@ -112,7 +112,7 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
   -- by a single parameter, we use `ℕ × ι` as the domain.
   refine' ⟨ℕ × ι, fun ni => D ni.1 ni.2, fun _ => Dopen _ _, _, _, fun ni => ⟨ni.2, HDS _ _⟩⟩
   -- The sets `D n i` cover the whole space as we proved earlier
-  · refine' unionᵢ_eq_univ_iff.2 fun x => _
+  · refine' iUnion_eq_univ_iff.2 fun x => _
     rcases Dcov x with ⟨n, i, h⟩
     exact ⟨⟨n, i⟩, h⟩
   /- Let us prove that the covering `D n i` is locally finite. Take a point `x` and choose
@@ -161,10 +161,10 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
           rw [mul_add, h2pow, ← two_add_one_eq_three, add_mul, one_mul]
     -- Finally, we glue `Hgt` and `Hle`
     have : (⋃ (m ≤ n + k) (i ∈ { i : ι | (D m i ∩ B).Nonempty }), {(m, i)}).Finite :=
-      (finite_le_nat _).bunionᵢ' fun i hi =>
-        (Hle i hi).finite.bunionᵢ' fun _ _ => finite_singleton _
+      (finite_le_nat _).biUnion' fun i hi =>
+        (Hle i hi).finite.biUnion' fun _ _ => finite_singleton _
     refine' this.subset fun I hI => _
-    simp only [mem_unionᵢ]
+    simp only [mem_iUnion]
     refine' ⟨I.1, _, I.2, hI, Prod.mk.eta.symm⟩
     exact not_lt.1 fun hlt => (Hgt I.1 hlt I.2).le_bot hI.choose_spec
 
chore: remove clear (#3537)

Those used to be necessary because of a linarith bug, which was fixed in #2611

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

Diff
@@ -130,15 +130,13 @@ instance (priority := 100) [PseudoEMetricSpace α] : ParacompactSpace α := by
       rw [disjoint_iff_inf_le]
       rintro y ⟨hym, hyx⟩
       rcases memD.1 hym with ⟨z, rfl, _hzi, H, hz⟩
-      -- porting note: `clear` needed due to `linarith` bug
-      have : z ∉ ball x (2⁻¹ ^ k) := fun hz' => H n (by clear hz hD; linarith) i (hsub hz')
+      have : z ∉ ball x (2⁻¹ ^ k) := fun hz' => H n (by linarith) i (hsub hz')
       apply this
       calc
         edist z x ≤ edist y z + edist y x := edist_triangle_left _ _ _
         _ < 2⁻¹ ^ m + 2⁻¹ ^ (n + k + 1) := (ENNReal.add_lt_add hz hyx)
         _ ≤ 2⁻¹ ^ (k + 1) + 2⁻¹ ^ (k + 1) :=
-          -- porting note: `clear` needed due to `linarith` bug
-          (add_le_add (hpow_le <| by clear hz hD; linarith) (hpow_le <| by clear hz hD; linarith))
+          (add_le_add (hpow_le <| by linarith) (hpow_le <| by linarith))
         _ = 2⁻¹ ^ k := by rw [← two_mul, h2pow]
     -- For each `m ≤ n + k` there is at most one `j` such that `D m j ∩ B` is nonempty.
     have Hle : ∀ m ≤ n + k, Set.Subsingleton { j | (D m j ∩ B).Nonempty } := by
feat: port Topology.MetricSpace.EMetricParacompact (#2599)

Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Dependencies 10 + 455

456 files ported (97.9%)
195606 lines ported (97.4%)
Show graph

The unported dependencies are

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