topology.metric_space.baireMathlib.Topology.Baire.Lemmas

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)

(last sync)

refactor(topology): fix definition of residual (#18962)

The current definition of residual in mathlib is incorrect for non-Baire spaces. This fixes it.

Co-authored-by: Felix-Weilacher <112423742+Felix-Weilacher@users.noreply.github.com>

Diff
@@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
 import analysis.specific_limits.basic
-import order.filter.countable_Inter
 import topology.G_delta
 import topology.sets.compacts
 
@@ -22,8 +21,7 @@ intersection of dense Gδ sets is a dense Gδ set. We prove Baire theorem, givin
 formulations that can be handy. We also prove the important consequence that, if the space is
 covered by a countable union of closed sets, then the union of their interiors is dense.
 
-We also define the filter `residual α` generated by dense `Gδ` sets and prove that this filter
-has the countable intersection property.
+We also prove that in Baire spaces, the `residual` sets are exactly those containing a dense Gδ set.
 -/
 
 noncomputable theory
@@ -222,25 +220,37 @@ begin
   { rwa forall_range_iff }
 end
 
+/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
+lemma mem_residual {s : set α} :
+  s ∈ residual α ↔ ∃ t ⊆ s, is_Gδ t ∧ dense t :=
+begin
+  split,
+  { rw mem_residual_iff,
+    rintros ⟨S, hSo, hSd, Sct, Ss⟩,
+    refine ⟨_, Ss, ⟨_, λ t ht, hSo _ ht, Sct, rfl⟩, _⟩,
+    exact dense_sInter_of_open hSo Sct hSd, },
+  rintros ⟨t, ts, ho, hd⟩,
+  exact mem_of_superset (residual_of_dense_Gδ ho hd) ts,
+end
+
+/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
+lemma eventually_residual {p : α → Prop} :
+  (∀ᶠ x in residual α, p x) ↔ ∃ (t : set α), is_Gδ t ∧ dense t ∧ ∀ (x : α), x ∈ t → p x :=
+begin
+  -- this can probably be improved...
+  convert @mem_residual _ _ _ p,
+  simp_rw [exists_prop, and_comm ((_ : set α) ⊆ p), and_assoc],
+  refl,
+end
+
+lemma dense_of_mem_residual {s : set α} (hs : s ∈ residual α) : dense s :=
+let ⟨t, hts, _, hd⟩ := mem_residual.1 hs in hd.mono hts
+
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/
 theorem dense_sInter_of_Gδ {S : set (set α)} (ho : ∀s∈S, is_Gδ s) (hS : S.countable)
   (hd : ∀s∈S, dense s) : dense (⋂₀S) :=
-begin
-  -- the result follows from the result for a countable intersection of dense open sets,
-  -- by rewriting each set as a countable intersection of open sets, which are of course dense.
-  choose T hTo hTc hsT using ho,
-  have : ⋂₀ S = ⋂₀ (⋃ s ∈ S, T s ‹_›), -- := (sInter_bUnion (λs hs, (hT s hs).2.2)).symm,
-    by simp only [sInter_Union, (hsT _ _).symm, ← sInter_eq_bInter],
-  rw this,
-  refine dense_sInter_of_open _ (hS.bUnion hTc) _;
-    simp only [mem_Union]; rintro t ⟨s, hs, tTs⟩,
-  show is_open t, from hTo s hs t tTs,
-  show dense t,
-  { intro x,
-    have := hd s hs x,
-    rw hsT s hs at this,
-    exact closure_mono (sInter_subset_of_mem tTs) this }
-end
+dense_of_mem_residual ((countable_sInter_mem hS).mpr
+  (λ s hs, residual_of_dense_Gδ (ho _ hs) (hd _ hs)))
 
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is an encodable type. -/
@@ -270,39 +280,6 @@ begin
   apply dense_Inter_of_Gδ; simp [bool.forall_bool, *]
 end
 
-/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
-lemma eventually_residual {p : α → Prop} :
-  (∀ᶠ x in residual α, p x) ↔ ∃ (t : set α), is_Gδ t ∧ dense t ∧ ∀ x ∈ t, p x :=
-calc (∀ᶠ x in residual α, p x) ↔
-  ∀ᶠ x in ⨅ (t : set α) (ht : is_Gδ t ∧ dense t), 𝓟 t, p x :
-    by simp only [residual, infi_and]
-... ↔ ∃ (t : set α) (ht : is_Gδ t ∧ dense t), ∀ᶠ x in 𝓟 t, p x : mem_binfi_of_directed
-    (λ t₁ h₁ t₂ h₂, ⟨t₁ ∩ t₂, ⟨h₁.1.inter h₂.1, dense.inter_of_Gδ h₁.1 h₂.1 h₁.2 h₂.2⟩, by simp⟩)
-    ⟨univ, is_Gδ_univ, dense_univ⟩
-... ↔ _ : by simp [and_assoc]
-
-/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
-lemma mem_residual {s : set α} :
-  s ∈ residual α ↔ ∃ t ⊆ s, is_Gδ t ∧ dense t :=
-(@eventually_residual α _ _ (λ x, x ∈ s)).trans $ exists_congr $
-λ t, by rw [exists_prop, and_comm (t ⊆ s), subset_def, and_assoc]
-
-lemma dense_of_mem_residual {s : set α} (hs : s ∈ residual α) :
-  dense s :=
-let ⟨t, hts, _, hd⟩ := mem_residual.1 hs in hd.mono hts
-
-instance : countable_Inter_filter (residual α) :=
-⟨begin
-  intros S hSc hS,
-  simp only [mem_residual] at *,
-  choose T hTs hT using hS,
-  refine ⟨⋂ s ∈ S, T s ‹_›, _, _, _⟩,
-  { rw [sInter_eq_bInter],
-    exact Inter₂_mono hTs },
-  { exact is_Gδ_bInter hSc (λ s hs, (hT s hs).1) },
-  { exact dense_bInter_of_Gδ (λ s hs, (hT s hs).1) hSc (λ s hs, (hT s hs).2) }
-end⟩
-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃`. -/
 lemma is_Gδ.dense_Union_interior_of_closed [encodable ι] {s : set α} (hs : is_Gδ s)
@@ -315,7 +292,7 @@ begin
   { refine dense_Inter_of_open hgo (λ i x, _),
     rw [closure_compl, interior_frontier (hc _)],
     exact id },
-  refine (hd.inter_of_Gδ hs (is_Gδ_Inter $ λ i, (hgo i).is_Gδ) hgd).mono _,
+  refine (hd.inter_of_Gδ hs (is_Gδ_Inter_of_open $ λ i, hgo i) hgd).mono _,
   rintro x ⟨hxs, hxg⟩,
   rw [mem_Inter] at hxg,
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩,

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -270,7 +270,7 @@ theorem eventually_residual {p : α → Prop} :
   by
   -- this can probably be improved...
   convert @mem_residual _ _ _ p
-  simp_rw [exists_prop, and_comm' ((_ : Set α) ⊆ p), and_assoc']
+  simp_rw [exists_prop, and_comm ((_ : Set α) ⊆ p), and_assoc]
   rfl
 #align eventually_residual eventually_residual
 -/
Diff
@@ -248,7 +248,7 @@ theorem dense_iInter_of_isOpen [Encodable β] {f : β → Set α} (ho : ∀ s, I
 #align dense_Inter_of_open dense_iInter_of_isOpen
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (t «expr ⊆ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (t «expr ⊆ » s) -/
 #print mem_residual /-
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
 theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t :=
Diff
@@ -71,7 +71,7 @@ instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [Pseud
     intro n x δ δpos
     have : x ∈ closure (f n) := hd n x
     rcases EMetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩
-    rw [edist_comm] at xy 
+    rw [edist_comm] at xy
     obtain ⟨r, rpos, hr⟩ : ∃ r > 0, closed_ball y r ⊆ f n :=
       nhds_basis_closed_eball.mem_iff.1 (isOpen_iff_mem_nhds.1 (ho n) y ys)
     refine' ⟨y, min (min (δ / 2) r) (B (n + 1)), _, _, fun z hz => ⟨_, _⟩⟩
@@ -338,7 +338,7 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs :
     exact id
   refine' (hd.inter_of_Gδ hs (IsGδ.iInter_of_isOpen fun i => hgo i) hgd).mono _
   rintro x ⟨hxs, hxg⟩
-  rw [mem_Inter] at hxg 
+  rw [mem_Inter] at hxg
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩
   exact mem_Union.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
 #align is_Gδ.dense_Union_interior_of_closed IsGδ.dense_iUnion_interior_of_closed
Diff
@@ -189,7 +189,7 @@ instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace [Topologica
   /- Prove that `⋂ n : ℕ, K n` is not empty, as an intersection of a decreasing sequence
     of nonempty compact subsets.-/
   have hK_nonempty : (⋂ n, K n : Set α).Nonempty :=
-    IsCompact.nonempty_iInter_of_sequence_nonempty_compact_closed _
+    IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed _
       (fun n => (hK_decreasing n).trans (inter_subset_right _ _)) (fun n => (K n).Nonempty)
       (K 0).IsCompact fun n => (K n).IsCompact.IsClosed
   exact hK_nonempty.mono hK_subset
Diff
@@ -336,7 +336,7 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs :
     refine' dense_iInter_of_isOpen hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_isOpen fun i => hgo i) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (IsGδ.iInter_of_isOpen fun i => hgo i) hgd).mono _
   rintro x ⟨hxs, hxg⟩
   rw [mem_Inter] at hxg 
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩
@@ -372,7 +372,7 @@ theorem IsGδ.dense_sUnion_interior_of_closed {T : Set (Set α)} {s : Set α} (h
 are dense. Formulated here with an index set which is a countable set in any type. -/
 theorem dense_biUnion_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
     (hS : S.Countable) (hU : (⋃ s ∈ S, f s) = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
-  isGδ_univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
+  IsGδ.univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
 #align dense_bUnion_interior_of_closed dense_biUnion_interior_of_closed
 -/
 
@@ -381,7 +381,7 @@ theorem dense_biUnion_interior_of_closed {S : Set β} {f : β → Set α} (hc :
 are dense. Formulated here with `⋃₀`. -/
 theorem dense_sUnion_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, IsClosed s)
     (hS : S.Countable) (hU : ⋃₀ S = univ) : Dense (⋃ s ∈ S, interior s) :=
-  isGδ_univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge
+  IsGδ.univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge
 #align dense_sUnion_interior_of_closed dense_sUnion_interior_of_closed
 -/
 
@@ -390,7 +390,7 @@ theorem dense_sUnion_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, Is
 are dense. Formulated here with an index set which is an encodable type. -/
 theorem dense_iUnion_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
     (hU : (⋃ s, f s) = univ) : Dense (⋃ s, interior (f s)) :=
-  isGδ_univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
+  IsGδ.univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
 #align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 -/
 
Diff
@@ -198,17 +198,17 @@ instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace [Topologica
 
 variable [TopologicalSpace α] [BaireSpace α]
 
-#print dense_iInter_of_open_nat /-
+#print dense_iInter_of_isOpen_nat /-
 /-- Definition of a Baire space. -/
-theorem dense_iInter_of_open_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) :
-    Dense (⋂ n, f n) :=
+theorem dense_iInter_of_isOpen_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n))
+    (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) :=
   BaireSpace.baire_property f ho hd
-#align dense_Inter_of_open_nat dense_iInter_of_open_nat
+#align dense_Inter_of_open_nat dense_iInter_of_isOpen_nat
 -/
 
-#print dense_sInter_of_open /-
+#print dense_sInter_of_isOpen /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/
-theorem dense_sInter_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
+theorem dense_sInter_of_isOpen {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
   by
   cases' S.eq_empty_or_nonempty with h h
@@ -216,36 +216,36 @@ theorem dense_sInter_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS
   · rcases hS.exists_eq_range h with ⟨f, hf⟩
     have F : ∀ n, f n ∈ S := fun n => by rw [hf] <;> exact mem_range_self _
     rw [hf, sInter_range]
-    exact dense_iInter_of_open_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
-#align dense_sInter_of_open dense_sInter_of_open
+    exact dense_iInter_of_isOpen_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
+#align dense_sInter_of_open dense_sInter_of_isOpen
 -/
 
-#print dense_biInter_of_open /-
+#print dense_biInter_of_isOpen /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_biInter_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
+theorem dense_biInter_of_isOpen {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) :=
   by
   rw [← sInter_image]
-  apply dense_sInter_of_open
+  apply dense_sInter_of_isOpen
   · rwa [ball_image_iff]
   · exact hS.image _
   · rwa [ball_image_iff]
-#align dense_bInter_of_open dense_biInter_of_open
+#align dense_bInter_of_open dense_biInter_of_isOpen
 -/
 
-#print dense_iInter_of_open /-
+#print dense_iInter_of_isOpen /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is an encodable type. -/
-theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
+theorem dense_iInter_of_isOpen [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
     (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) :=
   by
   rw [← sInter_range]
-  apply dense_sInter_of_open
+  apply dense_sInter_of_isOpen
   · rwa [forall_range_iff]
   · exact countable_range _
   · rwa [forall_range_iff]
-#align dense_Inter_of_open dense_iInter_of_open
+#align dense_Inter_of_open dense_iInter_of_isOpen
 -/
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (t «expr ⊆ » s) -/
@@ -257,7 +257,7 @@ theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆
   · rw [mem_residual_iff]
     rintro ⟨S, hSo, hSd, Sct, Ss⟩
     refine' ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, _⟩
-    exact dense_sInter_of_open hSo Sct hSd
+    exact dense_sInter_of_isOpen hSo Sct hSd
   rintro ⟨t, ts, ho, hd⟩
   exact mem_of_superset (residual_of_dense_Gδ ho hd) ts
 #align mem_residual mem_residual
@@ -333,10 +333,10 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs :
   have hgo : ∀ i, IsOpen (g i) := fun i => is_closed_frontier.is_open_compl
   have hgd : Dense (⋂ i, g i) :=
     by
-    refine' dense_iInter_of_open hgo fun i x => _
+    refine' dense_iInter_of_isOpen hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_open fun i => hgo i) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_isOpen fun i => hgo i) hgd).mono _
   rintro x ⟨hxs, hxg⟩
   rw [mem_Inter] at hxg 
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathbin.Analysis.SpecificLimits.Basic
-import Mathbin.Topology.GDelta
-import Mathbin.Topology.Sets.Compacts
+import Analysis.SpecificLimits.Basic
+import Topology.GDelta
+import Topology.Sets.Compacts
 
 #align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a"
 
@@ -248,7 +248,7 @@ theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsO
 #align dense_Inter_of_open dense_iInter_of_open
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (t «expr ⊆ » s) -/
 #print mem_residual /-
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
 theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t :=
Diff
@@ -49,11 +49,11 @@ class BaireSpace (α : Type _) [TopologicalSpace α] : Prop where
 #align baire_space BaireSpace
 -/
 
-#print baire_category_theorem_emetric_complete /-
+#print BaireSpace.of_pseudoEMetricSpace_completeSpace /-
 /-- Baire theorems asserts that various topological spaces have the Baire property.
 Two versions of these theorems are given.
 The first states that complete pseudo_emetric spaces are Baire. -/
-instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetricSpace α]
+instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace α]
     [CompleteSpace α] : BaireSpace α :=
   by
   refine' ⟨fun f ho hd => _⟩
@@ -152,13 +152,13 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
       subset.trans (incl n) (inter_subset_right _ _)
     exact this (yball (n + 1))
   show edist y x ≤ ε; exact le_trans (yball 0) (min_le_left _ _)
-#align baire_category_theorem_emetric_complete baire_category_theorem_emetric_complete
+#align baire_category_theorem_emetric_complete BaireSpace.of_pseudoEMetricSpace_completeSpace
 -/
 
-#print baire_category_theorem_locally_compact /-
+#print BaireSpace.of_t2Space_locallyCompactSpace /-
 /-- The second theorem states that locally compact spaces are Baire. -/
-instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSpace α] [T2Space α]
-    [LocallyCompactSpace α] : BaireSpace α :=
+instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace [TopologicalSpace α]
+    [T2Space α] [LocallyCompactSpace α] : BaireSpace α :=
   by
   constructor
   intro f ho hd
@@ -193,7 +193,7 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
       (fun n => (hK_decreasing n).trans (inter_subset_right _ _)) (fun n => (K n).Nonempty)
       (K 0).IsCompact fun n => (K n).IsCompact.IsClosed
   exact hK_nonempty.mono hK_subset
-#align baire_category_theorem_locally_compact baire_category_theorem_locally_compact
+#align baire_category_theorem_locally_compact BaireSpace.of_t2Space_locallyCompactSpace
 -/
 
 variable [TopologicalSpace α] [BaireSpace α]
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module topology.metric_space.baire
-! leanprover-community/mathlib commit b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.SpecificLimits.Basic
 import Mathbin.Topology.GDelta
 import Mathbin.Topology.Sets.Compacts
 
+#align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a"
+
 /-!
 # Baire theorem
 
@@ -251,7 +248,7 @@ theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsO
 #align dense_Inter_of_open dense_iInter_of_open
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (t «expr ⊆ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
 #print mem_residual /-
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
 theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t :=
Diff
@@ -317,12 +317,14 @@ theorem dense_biInter_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s
 #align dense_bInter_of_Gδ dense_biInter_of_Gδ
 -/
 
+#print Dense.inter_of_Gδ /-
 /-- Baire theorem: the intersection of two dense Gδ sets is dense. -/
 theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
     (htc : Dense t) : Dense (s ∩ t) := by
   rw [inter_eq_Inter]
   apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *]
 #align dense.inter_of_Gδ Dense.inter_of_Gδ
+-/
 
 #print IsGδ.dense_iUnion_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
@@ -395,12 +397,14 @@ theorem dense_iUnion_interior_of_closed [Encodable β] {f : β → Set α} (hc :
 #align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 -/
 
+#print nonempty_interior_of_iUnion_of_closed /-
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
 covers the space, then one of the sets has nonempty interior. -/
 theorem nonempty_interior_of_iUnion_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
     (hc : ∀ s, IsClosed (f s)) (hU : (⋃ s, f s) = univ) : ∃ s, (interior <| f s).Nonempty := by
   simpa using (dense_iUnion_interior_of_closed hc hU).Nonempty
 #align nonempty_interior_of_Union_of_closed nonempty_interior_of_iUnion_of_closed
+-/
 
 end BaireTheorem
 
Diff
@@ -88,14 +88,12 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
         _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := (add_le_add hz (le_of_lt xy))
         _ ≤ δ / 2 + δ / 2 := (add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl)
         _ = δ := ENNReal.add_halves δ
-        
     show z ∈ f n;
     exact
       hr
         (calc
           edist z y ≤ min (min (δ / 2) r) (B (n + 1)) := hz
-          _ ≤ r := le_trans (min_le_left _ _) (min_le_right _ _)
-          )
+          _ ≤ r := le_trans (min_le_left _ _) (min_le_right _ _))
   choose! center radius Hpos HB Hball using this
   refine' fun x => (mem_closure_iff_nhds_basis nhds_basis_closed_eball).2 fun ε εpos => _
   /- `ε` is positive. We have to find a point in the ball of radius `ε` around `x` belonging to all
@@ -130,7 +128,6 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
         closed_ball (c (n + 1)) (r (n + 1)) ⊆ closed_ball (c n) (r n) :=
           subset.trans (incl n) (inter_subset_left _ _)
         _ ⊆ closed_ball (c n) (B n) := closed_ball_subset_closed_ball (rB n)
-        
     exact I A
   have : CauchySeq c := cauchySeq_of_edist_le_geometric_two _ one_ne_top cdist
   -- as the sequence `c n` is Cauchy in a complete space, it converges to a limit `y`.
Diff
@@ -254,7 +254,7 @@ theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsO
 #align dense_Inter_of_open dense_iInter_of_open
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (t «expr ⊆ » s) -/
 #print mem_residual /-
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
 theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t :=
Diff
@@ -275,7 +275,7 @@ theorem eventually_residual {p : α → Prop} :
     (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x : α, x ∈ t → p x :=
   by
   -- this can probably be improved...
-  convert@mem_residual _ _ _ p
+  convert @mem_residual _ _ _ p
   simp_rw [exists_prop, and_comm' ((_ : Set α) ⊆ p), and_assoc']
   rfl
 #align eventually_residual eventually_residual
Diff
@@ -74,7 +74,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
     intro n x δ δpos
     have : x ∈ closure (f n) := hd n x
     rcases EMetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩
-    rw [edist_comm] at xy
+    rw [edist_comm] at xy 
     obtain ⟨r, rpos, hr⟩ : ∃ r > 0, closed_ball y r ⊆ f n :=
       nhds_basis_closed_eball.mem_iff.1 (isOpen_iff_mem_nhds.1 (ho n) y ys)
     refine' ⟨y, min (min (δ / 2) r) (B (n + 1)), _, _, fun z hz => ⟨_, _⟩⟩
@@ -190,7 +190,7 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
   have hK_subset : (⋂ n, K n : Set α) ⊆ U ∩ ⋂ n, f n :=
     by
     intro x hx
-    simp only [mem_inter_iff, mem_Inter] at hx⊢
+    simp only [mem_inter_iff, mem_Inter] at hx ⊢
     exact ⟨hK₀ <| hx 0, fun n => (hK_decreasing n (hx (n + 1))).1⟩
   /- Prove that `⋂ n : ℕ, K n` is not empty, as an intersection of a decreasing sequence
     of nonempty compact subsets.-/
@@ -257,7 +257,7 @@ theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsO
 /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
 #print mem_residual /-
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
-theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _)(_ : t ⊆ s), IsGδ t ∧ Dense t :=
+theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t :=
   by
   constructor
   · rw [mem_residual_iff]
@@ -342,7 +342,7 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs :
     exact id
   refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_open fun i => hgo i) hgd).mono _
   rintro x ⟨hxs, hxg⟩
-  rw [mem_Inter] at hxg
+  rw [mem_Inter] at hxg 
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩
   exact mem_Union.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
 #align is_Gδ.dense_Union_interior_of_closed IsGδ.dense_iUnion_interior_of_closed
Diff
@@ -32,7 +32,7 @@ We also prove that in Baire spaces, the `residual` sets are exactly those contai
 
 noncomputable section
 
-open Classical Topology Filter ENNReal
+open scoped Classical Topology Filter ENNReal
 
 open Filter Encodable Set TopologicalSpace
 
Diff
@@ -320,12 +320,6 @@ theorem dense_biInter_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s
 #align dense_bInter_of_Gδ dense_biInter_of_Gδ
 -/
 
-/- warning: dense.inter_of_Gδ -> Dense.inter_of_Gδ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] {s : Set.{u1} α} {t : Set.{u1} α}, (IsGδ.{u1} α _inst_1 s) -> (IsGδ.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 s) -> (Dense.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) s t))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] {s : Set.{u1} α} {t : Set.{u1} α}, (IsGδ.{u1} α _inst_1 s) -> (IsGδ.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 s) -> (Dense.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) s t))
-Case conversion may be inaccurate. Consider using '#align dense.inter_of_Gδ Dense.inter_of_Gδₓ'. -/
 /-- Baire theorem: the intersection of two dense Gδ sets is dense. -/
 theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
     (htc : Dense t) : Dense (s ∩ t) := by
@@ -404,12 +398,6 @@ theorem dense_iUnion_interior_of_closed [Encodable β] {f : β → Set α} (hc :
 #align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 -/
 
-/- warning: nonempty_interior_of_Union_of_closed -> nonempty_interior_of_iUnion_of_closed is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] [_inst_3 : Nonempty.{succ u1} α] [_inst_4 : Encodable.{u2} β] {f : β -> (Set.{u1} α)}, (forall (s : β), IsClosed.{u1} α _inst_1 (f s)) -> (Eq.{succ u1} (Set.{u1} α) (Set.iUnion.{u1, succ u2} α β (fun (s : β) => f s)) (Set.univ.{u1} α)) -> (Exists.{succ u2} β (fun (s : β) => Set.Nonempty.{u1} α (interior.{u1} α _inst_1 (f s))))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : TopologicalSpace.{u2} α] [_inst_2 : BaireSpace.{u2} α _inst_1] [_inst_3 : Nonempty.{succ u2} α] [_inst_4 : Encodable.{u1} β] {f : β -> (Set.{u2} α)}, (forall (s : β), IsClosed.{u2} α _inst_1 (f s)) -> (Eq.{succ u2} (Set.{u2} α) (Set.iUnion.{u2, succ u1} α β (fun (s : β) => f s)) (Set.univ.{u2} α)) -> (Exists.{succ u1} β (fun (s : β) => Set.Nonempty.{u2} α (interior.{u2} α _inst_1 (f s))))
-Case conversion may be inaccurate. Consider using '#align nonempty_interior_of_Union_of_closed nonempty_interior_of_iUnion_of_closedₓ'. -/
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
 covers the space, then one of the sets has nonempty interior. -/
 theorem nonempty_interior_of_iUnion_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
Diff
@@ -80,9 +80,8 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
     refine' ⟨y, min (min (δ / 2) r) (B (n + 1)), _, _, fun z hz => ⟨_, _⟩⟩
     show 0 < min (min (δ / 2) r) (B (n + 1))
     exact lt_min (lt_min (ENNReal.half_pos δpos) rpos) (Bpos (n + 1))
-    show min (min (δ / 2) r) (B (n + 1)) ≤ B (n + 1)
-    exact min_le_right _ _
-    show z ∈ closed_ball x δ
+    show min (min (δ / 2) r) (B (n + 1)) ≤ B (n + 1); exact min_le_right _ _
+    show z ∈ closed_ball x δ;
     exact
       calc
         edist z x ≤ edist z y + edist y x := edist_triangle _ _ _
@@ -90,7 +89,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
         _ ≤ δ / 2 + δ / 2 := (add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl)
         _ = δ := ENNReal.add_halves δ
         
-    show z ∈ f n
+    show z ∈ f n;
     exact
       hr
         (calc
@@ -158,8 +157,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
     have : closed_ball (c (n + 1)) (r (n + 1)) ⊆ f n :=
       subset.trans (incl n) (inter_subset_right _ _)
     exact this (yball (n + 1))
-  show edist y x ≤ ε
-  exact le_trans (yball 0) (min_le_left _ _)
+  show edist y x ≤ ε; exact le_trans (yball 0) (min_le_left _ _)
 #align baire_category_theorem_emetric_complete baire_category_theorem_emetric_complete
 -/
 
Diff
@@ -4,12 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module topology.metric_space.baire
-! leanprover-community/mathlib commit ce38d86c0b2d427ce208c3cee3159cb421d2b3c4
+! leanprover-community/mathlib commit b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.SpecificLimits.Basic
-import Mathbin.Order.Filter.CountableInter
 import Mathbin.Topology.GDelta
 import Mathbin.Topology.Sets.Compacts
 
@@ -27,8 +26,7 @@ intersection of dense Gδ sets is a dense Gδ set. We prove Baire theorem, givin
 formulations that can be handy. We also prove the important consequence that, if the space is
 covered by a countable union of closed sets, then the union of their interiors is dense.
 
-We also define the filter `residual α` generated by dense `Gδ` sets and prove that this filter
-has the countable intersection property.
+We also prove that in Baire spaces, the `residual` sets are exactly those containing a dense Gδ set.
 -/
 
 
@@ -258,27 +256,46 @@ theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsO
 #align dense_Inter_of_open dense_iInter_of_open
 -/
 
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
+#print mem_residual /-
+/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
+theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _)(_ : t ⊆ s), IsGδ t ∧ Dense t :=
+  by
+  constructor
+  · rw [mem_residual_iff]
+    rintro ⟨S, hSo, hSd, Sct, Ss⟩
+    refine' ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, _⟩
+    exact dense_sInter_of_open hSo Sct hSd
+  rintro ⟨t, ts, ho, hd⟩
+  exact mem_of_superset (residual_of_dense_Gδ ho hd) ts
+#align mem_residual mem_residual
+-/
+
+#print eventually_residual /-
+/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
+theorem eventually_residual {p : α → Prop} :
+    (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x : α, x ∈ t → p x :=
+  by
+  -- this can probably be improved...
+  convert@mem_residual _ _ _ p
+  simp_rw [exists_prop, and_comm' ((_ : Set α) ⊆ p), and_assoc']
+  rfl
+#align eventually_residual eventually_residual
+-/
+
+#print dense_of_mem_residual /-
+theorem dense_of_mem_residual {s : Set α} (hs : s ∈ residual α) : Dense s :=
+  let ⟨t, hts, _, hd⟩ := mem_residual.1 hs
+  hd.mono hts
+#align dense_of_mem_residual dense_of_mem_residual
+-/
+
 #print dense_sInter_of_Gδ /-
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/
 theorem dense_sInter_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
-  by
-  -- the result follows from the result for a countable intersection of dense open sets,
-  -- by rewriting each set as a countable intersection of open sets, which are of course dense.
-  choose T hTo hTc hsT using ho
-  have : ⋂₀ S = ⋂₀ ⋃ s ∈ S, T s ‹_› :=
-    by-- := (sInter_bUnion (λs hs, (hT s hs).2.2)).symm,
-    simp only [sInter_Union, (hsT _ _).symm, ← sInter_eq_bInter]
-  rw [this]
-  refine' dense_sInter_of_open _ (hS.bUnion hTc) _ <;> simp only [mem_Union] <;>
-    rintro t ⟨s, hs, tTs⟩
-  show IsOpen t
-  exact hTo s hs t tTs
-  show Dense t
-  · intro x
-    have := hd s hs x
-    rw [hsT s hs] at this
-    exact closure_mono (sInter_subset_of_mem tTs) this
+  dense_of_mem_residual
+    ((countable_sInter_mem hS).mpr fun s hs => residual_of_dense_Gδ (ho _ hs) (hd _ hs))
 #align dense_sInter_of_Gδ dense_sInter_of_Gδ
 -/
 
@@ -318,50 +335,6 @@ theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : D
   apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *]
 #align dense.inter_of_Gδ Dense.inter_of_Gδ
 
-#print eventually_residual /-
-/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
-theorem eventually_residual {p : α → Prop} :
-    (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x :=
-  calc
-    (∀ᶠ x in residual α, p x) ↔ ∀ᶠ x in ⨅ (t : Set α) (ht : IsGδ t ∧ Dense t), 𝓟 t, p x := by
-      simp only [residual, iInf_and]
-    _ ↔ ∃ (t : Set α)(ht : IsGδ t ∧ Dense t), ∀ᶠ x in 𝓟 t, p x :=
-      (mem_biInf_of_directed
-        (fun t₁ h₁ t₂ h₂ =>
-          ⟨t₁ ∩ t₂, ⟨h₁.1.inter h₂.1, Dense.inter_of_Gδ h₁.1 h₂.1 h₁.2 h₂.2⟩, by simp⟩)
-        ⟨univ, isGδ_univ, dense_univ⟩)
-    _ ↔ _ := by simp [and_assoc']
-    
-#align eventually_residual eventually_residual
--/
-
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
-#print mem_residual /-
-/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
-theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _)(_ : t ⊆ s), IsGδ t ∧ Dense t :=
-  (@eventually_residual α _ _ fun x => x ∈ s).trans <|
-    exists_congr fun t => by rw [exists_prop, and_comm' (t ⊆ s), subset_def, and_assoc']
-#align mem_residual mem_residual
--/
-
-#print dense_of_mem_residual /-
-theorem dense_of_mem_residual {s : Set α} (hs : s ∈ residual α) : Dense s :=
-  let ⟨t, hts, _, hd⟩ := mem_residual.1 hs
-  hd.mono hts
-#align dense_of_mem_residual dense_of_mem_residual
--/
-
-instance : CountableInterFilter (residual α) :=
-  ⟨by
-    intro S hSc hS
-    simp only [mem_residual] at *
-    choose T hTs hT using hS
-    refine' ⟨⋂ s ∈ S, T s ‹_›, _, _, _⟩
-    · rw [sInter_eq_bInter]
-      exact Inter₂_mono hTs
-    · exact isGδ_biInter hSc fun s hs => (hT s hs).1
-    · exact dense_biInter_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
-
 #print IsGδ.dense_iUnion_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃`. -/
@@ -375,7 +348,7 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs :
     refine' dense_iInter_of_open hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_iInter fun i => (hgo i).IsGδ) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_open fun i => hgo i) hgd).mono _
   rintro x ⟨hxs, hxg⟩
   rw [mem_Inter] at hxg
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩
Diff
@@ -141,7 +141,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
   -- this point `y` will be the desired point. We will check that it belongs to all
   -- `f n` and to `ball x ε`.
   use y
-  simp only [exists_prop, Set.mem_interᵢ]
+  simp only [exists_prop, Set.mem_iInter]
   have I : ∀ n, ∀ m ≥ n, closed_ball (c m) (r m) ⊆ closed_ball (c n) (r n) :=
     by
     intro n
@@ -199,7 +199,7 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
   /- Prove that `⋂ n : ℕ, K n` is not empty, as an intersection of a decreasing sequence
     of nonempty compact subsets.-/
   have hK_nonempty : (⋂ n, K n : Set α).Nonempty :=
-    IsCompact.nonempty_interᵢ_of_sequence_nonempty_compact_closed _
+    IsCompact.nonempty_iInter_of_sequence_nonempty_compact_closed _
       (fun n => (hK_decreasing n).trans (inter_subset_right _ _)) (fun n => (K n).Nonempty)
       (K 0).IsCompact fun n => (K n).IsCompact.IsClosed
   exact hK_nonempty.mono hK_subset
@@ -208,17 +208,17 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
 
 variable [TopologicalSpace α] [BaireSpace α]
 
-#print dense_interᵢ_of_open_nat /-
+#print dense_iInter_of_open_nat /-
 /-- Definition of a Baire space. -/
-theorem dense_interᵢ_of_open_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) :
+theorem dense_iInter_of_open_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) :
     Dense (⋂ n, f n) :=
   BaireSpace.baire_property f ho hd
-#align dense_Inter_of_open_nat dense_interᵢ_of_open_nat
+#align dense_Inter_of_open_nat dense_iInter_of_open_nat
 -/
 
-#print dense_interₛ_of_open /-
+#print dense_sInter_of_open /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/
-theorem dense_interₛ_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
+theorem dense_sInter_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
   by
   cases' S.eq_empty_or_nonempty with h h
@@ -226,41 +226,41 @@ theorem dense_interₛ_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (
   · rcases hS.exists_eq_range h with ⟨f, hf⟩
     have F : ∀ n, f n ∈ S := fun n => by rw [hf] <;> exact mem_range_self _
     rw [hf, sInter_range]
-    exact dense_interᵢ_of_open_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
-#align dense_sInter_of_open dense_interₛ_of_open
+    exact dense_iInter_of_open_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
+#align dense_sInter_of_open dense_sInter_of_open
 -/
 
-#print dense_binterᵢ_of_open /-
+#print dense_biInter_of_open /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_binterᵢ_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
+theorem dense_biInter_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) :=
   by
   rw [← sInter_image]
-  apply dense_interₛ_of_open
+  apply dense_sInter_of_open
   · rwa [ball_image_iff]
   · exact hS.image _
   · rwa [ball_image_iff]
-#align dense_bInter_of_open dense_binterᵢ_of_open
+#align dense_bInter_of_open dense_biInter_of_open
 -/
 
-#print dense_interᵢ_of_open /-
+#print dense_iInter_of_open /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is an encodable type. -/
-theorem dense_interᵢ_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
+theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
     (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) :=
   by
   rw [← sInter_range]
-  apply dense_interₛ_of_open
+  apply dense_sInter_of_open
   · rwa [forall_range_iff]
   · exact countable_range _
   · rwa [forall_range_iff]
-#align dense_Inter_of_open dense_interᵢ_of_open
+#align dense_Inter_of_open dense_iInter_of_open
 -/
 
-#print dense_interₛ_of_Gδ /-
+#print dense_sInter_of_Gδ /-
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/
-theorem dense_interₛ_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
+theorem dense_sInter_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
   by
   -- the result follows from the result for a countable intersection of dense open sets,
@@ -270,7 +270,7 @@ theorem dense_interₛ_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS
     by-- := (sInter_bUnion (λs hs, (hT s hs).2.2)).symm,
     simp only [sInter_Union, (hsT _ _).symm, ← sInter_eq_bInter]
   rw [this]
-  refine' dense_interₛ_of_open _ (hS.bUnion hTc) _ <;> simp only [mem_Union] <;>
+  refine' dense_sInter_of_open _ (hS.bUnion hTc) _ <;> simp only [mem_Union] <;>
     rintro t ⟨s, hs, tTs⟩
   show IsOpen t
   exact hTo s hs t tTs
@@ -279,30 +279,30 @@ theorem dense_interₛ_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS
     have := hd s hs x
     rw [hsT s hs] at this
     exact closure_mono (sInter_subset_of_mem tTs) this
-#align dense_sInter_of_Gδ dense_interₛ_of_Gδ
+#align dense_sInter_of_Gδ dense_sInter_of_Gδ
 -/
 
-#print dense_interᵢ_of_Gδ /-
+#print dense_iInter_of_Gδ /-
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is an encodable type. -/
-theorem dense_interᵢ_of_Gδ [Encodable β] {f : β → Set α} (ho : ∀ s, IsGδ (f s))
+theorem dense_iInter_of_Gδ [Encodable β] {f : β → Set α} (ho : ∀ s, IsGδ (f s))
     (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) :=
   by
   rw [← sInter_range]
-  exact dense_interₛ_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
-#align dense_Inter_of_Gδ dense_interᵢ_of_Gδ
+  exact dense_sInter_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
+#align dense_Inter_of_Gδ dense_iInter_of_Gδ
 -/
 
-#print dense_binterᵢ_of_Gδ /-
+#print dense_biInter_of_Gδ /-
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_binterᵢ_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s ∈ S, IsGδ (f s ‹_›))
+theorem dense_biInter_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s ∈ S, IsGδ (f s ‹_›))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s ‹_›)) : Dense (⋂ s ∈ S, f s ‹_›) :=
   by
   rw [bInter_eq_Inter]
   haveI := hS.to_encodable
-  exact dense_interᵢ_of_Gδ (fun s => ho s s.2) fun s => hd s s.2
-#align dense_bInter_of_Gδ dense_binterᵢ_of_Gδ
+  exact dense_iInter_of_Gδ (fun s => ho s s.2) fun s => hd s s.2
+#align dense_bInter_of_Gδ dense_biInter_of_Gδ
 -/
 
 /- warning: dense.inter_of_Gδ -> Dense.inter_of_Gδ is a dubious translation:
@@ -315,7 +315,7 @@ Case conversion may be inaccurate. Consider using '#align dense.inter_of_Gδ Den
 theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
     (htc : Dense t) : Dense (s ∩ t) := by
   rw [inter_eq_Inter]
-  apply dense_interᵢ_of_Gδ <;> simp [Bool.forall_bool, *]
+  apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *]
 #align dense.inter_of_Gδ Dense.inter_of_Gδ
 
 #print eventually_residual /-
@@ -324,9 +324,9 @@ theorem eventually_residual {p : α → Prop} :
     (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x :=
   calc
     (∀ᶠ x in residual α, p x) ↔ ∀ᶠ x in ⨅ (t : Set α) (ht : IsGδ t ∧ Dense t), 𝓟 t, p x := by
-      simp only [residual, infᵢ_and]
+      simp only [residual, iInf_and]
     _ ↔ ∃ (t : Set α)(ht : IsGδ t ∧ Dense t), ∀ᶠ x in 𝓟 t, p x :=
-      (mem_binfᵢ_of_directed
+      (mem_biInf_of_directed
         (fun t₁ h₁ t₂ h₂ =>
           ⟨t₁ ∩ t₂, ⟨h₁.1.inter h₂.1, Dense.inter_of_Gδ h₁.1 h₂.1 h₁.2 h₂.2⟩, by simp⟩)
         ⟨univ, isGδ_univ, dense_univ⟩)
@@ -359,92 +359,92 @@ instance : CountableInterFilter (residual α) :=
     refine' ⟨⋂ s ∈ S, T s ‹_›, _, _, _⟩
     · rw [sInter_eq_bInter]
       exact Inter₂_mono hTs
-    · exact isGδ_binterᵢ hSc fun s hs => (hT s hs).1
-    · exact dense_binterᵢ_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
+    · exact isGδ_biInter hSc fun s hs => (hT s hs).1
+    · exact dense_biInter_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
 
-#print IsGδ.dense_unionᵢ_interior_of_closed /-
+#print IsGδ.dense_iUnion_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃`. -/
-theorem IsGδ.dense_unionᵢ_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
+theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
     {f : ι → Set α} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) : Dense (⋃ i, interior (f i)) :=
   by
   let g i := frontier (f i)ᶜ
   have hgo : ∀ i, IsOpen (g i) := fun i => is_closed_frontier.is_open_compl
   have hgd : Dense (⋂ i, g i) :=
     by
-    refine' dense_interᵢ_of_open hgo fun i x => _
+    refine' dense_iInter_of_open hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_interᵢ fun i => (hgo i).IsGδ) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (isGδ_iInter fun i => (hgo i).IsGδ) hgd).mono _
   rintro x ⟨hxs, hxg⟩
   rw [mem_Inter] at hxg
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩
   exact mem_Union.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
-#align is_Gδ.dense_Union_interior_of_closed IsGδ.dense_unionᵢ_interior_of_closed
+#align is_Gδ.dense_Union_interior_of_closed IsGδ.dense_iUnion_interior_of_closed
 -/
 
-#print IsGδ.dense_bunionᵢ_interior_of_closed /-
+#print IsGδ.dense_biUnion_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with a union over a countable set in any type. -/
-theorem IsGδ.dense_bunionᵢ_interior_of_closed {t : Set ι} {s : Set α} (hs : IsGδ s) (hd : Dense s)
+theorem IsGδ.dense_biUnion_interior_of_closed {t : Set ι} {s : Set α} (hs : IsGδ s) (hd : Dense s)
     (ht : t.Countable) {f : ι → Set α} (hc : ∀ i ∈ t, IsClosed (f i)) (hU : s ⊆ ⋃ i ∈ t, f i) :
     Dense (⋃ i ∈ t, interior (f i)) :=
   by
   haveI := ht.to_encodable
   simp only [bUnion_eq_Union, SetCoe.forall'] at *
   exact hs.dense_Union_interior_of_closed hd hc hU
-#align is_Gδ.dense_bUnion_interior_of_closed IsGδ.dense_bunionᵢ_interior_of_closed
+#align is_Gδ.dense_bUnion_interior_of_closed IsGδ.dense_biUnion_interior_of_closed
 -/
 
-#print IsGδ.dense_unionₛ_interior_of_closed /-
+#print IsGδ.dense_sUnion_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃₀`. -/
-theorem IsGδ.dense_unionₛ_interior_of_closed {T : Set (Set α)} {s : Set α} (hs : IsGδ s)
+theorem IsGδ.dense_sUnion_interior_of_closed {T : Set (Set α)} {s : Set α} (hs : IsGδ s)
     (hd : Dense s) (hc : T.Countable) (hc' : ∀ t ∈ T, IsClosed t) (hU : s ⊆ ⋃₀ T) :
     Dense (⋃ t ∈ T, interior t) :=
-  hs.dense_bunionᵢ_interior_of_closed hd hc hc' <| by rwa [← sUnion_eq_bUnion]
-#align is_Gδ.dense_sUnion_interior_of_closed IsGδ.dense_unionₛ_interior_of_closed
+  hs.dense_biUnion_interior_of_closed hd hc hc' <| by rwa [← sUnion_eq_bUnion]
+#align is_Gδ.dense_sUnion_interior_of_closed IsGδ.dense_sUnion_interior_of_closed
 -/
 
-#print dense_bunionᵢ_interior_of_closed /-
+#print dense_biUnion_interior_of_closed /-
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is a countable set in any type. -/
-theorem dense_bunionᵢ_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
+theorem dense_biUnion_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
     (hS : S.Countable) (hU : (⋃ s ∈ S, f s) = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
-  isGδ_univ.dense_bunionᵢ_interior_of_closed dense_univ hS hc hU.ge
-#align dense_bUnion_interior_of_closed dense_bunionᵢ_interior_of_closed
+  isGδ_univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
+#align dense_bUnion_interior_of_closed dense_biUnion_interior_of_closed
 -/
 
-#print dense_unionₛ_interior_of_closed /-
+#print dense_sUnion_interior_of_closed /-
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with `⋃₀`. -/
-theorem dense_unionₛ_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, IsClosed s)
+theorem dense_sUnion_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, IsClosed s)
     (hS : S.Countable) (hU : ⋃₀ S = univ) : Dense (⋃ s ∈ S, interior s) :=
-  isGδ_univ.dense_unionₛ_interior_of_closed dense_univ hS hc hU.ge
-#align dense_sUnion_interior_of_closed dense_unionₛ_interior_of_closed
+  isGδ_univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge
+#align dense_sUnion_interior_of_closed dense_sUnion_interior_of_closed
 -/
 
-#print dense_unionᵢ_interior_of_closed /-
+#print dense_iUnion_interior_of_closed /-
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is an encodable type. -/
-theorem dense_unionᵢ_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
+theorem dense_iUnion_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
     (hU : (⋃ s, f s) = univ) : Dense (⋃ s, interior (f s)) :=
-  isGδ_univ.dense_unionᵢ_interior_of_closed dense_univ hc hU.ge
-#align dense_Union_interior_of_closed dense_unionᵢ_interior_of_closed
+  isGδ_univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
+#align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 -/
 
-/- warning: nonempty_interior_of_Union_of_closed -> nonempty_interior_of_unionᵢ_of_closed is a dubious translation:
+/- warning: nonempty_interior_of_Union_of_closed -> nonempty_interior_of_iUnion_of_closed is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] [_inst_3 : Nonempty.{succ u1} α] [_inst_4 : Encodable.{u2} β] {f : β -> (Set.{u1} α)}, (forall (s : β), IsClosed.{u1} α _inst_1 (f s)) -> (Eq.{succ u1} (Set.{u1} α) (Set.unionᵢ.{u1, succ u2} α β (fun (s : β) => f s)) (Set.univ.{u1} α)) -> (Exists.{succ u2} β (fun (s : β) => Set.Nonempty.{u1} α (interior.{u1} α _inst_1 (f s))))
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] [_inst_3 : Nonempty.{succ u1} α] [_inst_4 : Encodable.{u2} β] {f : β -> (Set.{u1} α)}, (forall (s : β), IsClosed.{u1} α _inst_1 (f s)) -> (Eq.{succ u1} (Set.{u1} α) (Set.iUnion.{u1, succ u2} α β (fun (s : β) => f s)) (Set.univ.{u1} α)) -> (Exists.{succ u2} β (fun (s : β) => Set.Nonempty.{u1} α (interior.{u1} α _inst_1 (f s))))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : TopologicalSpace.{u2} α] [_inst_2 : BaireSpace.{u2} α _inst_1] [_inst_3 : Nonempty.{succ u2} α] [_inst_4 : Encodable.{u1} β] {f : β -> (Set.{u2} α)}, (forall (s : β), IsClosed.{u2} α _inst_1 (f s)) -> (Eq.{succ u2} (Set.{u2} α) (Set.unionᵢ.{u2, succ u1} α β (fun (s : β) => f s)) (Set.univ.{u2} α)) -> (Exists.{succ u1} β (fun (s : β) => Set.Nonempty.{u2} α (interior.{u2} α _inst_1 (f s))))
-Case conversion may be inaccurate. Consider using '#align nonempty_interior_of_Union_of_closed nonempty_interior_of_unionᵢ_of_closedₓ'. -/
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : TopologicalSpace.{u2} α] [_inst_2 : BaireSpace.{u2} α _inst_1] [_inst_3 : Nonempty.{succ u2} α] [_inst_4 : Encodable.{u1} β] {f : β -> (Set.{u2} α)}, (forall (s : β), IsClosed.{u2} α _inst_1 (f s)) -> (Eq.{succ u2} (Set.{u2} α) (Set.iUnion.{u2, succ u1} α β (fun (s : β) => f s)) (Set.univ.{u2} α)) -> (Exists.{succ u1} β (fun (s : β) => Set.Nonempty.{u2} α (interior.{u2} α _inst_1 (f s))))
+Case conversion may be inaccurate. Consider using '#align nonempty_interior_of_Union_of_closed nonempty_interior_of_iUnion_of_closedₓ'. -/
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
 covers the space, then one of the sets has nonempty interior. -/
-theorem nonempty_interior_of_unionᵢ_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
+theorem nonempty_interior_of_iUnion_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
     (hc : ∀ s, IsClosed (f s)) (hU : (⋃ s, f s) = univ) : ∃ s, (interior <| f s).Nonempty := by
-  simpa using (dense_unionᵢ_interior_of_closed hc hU).Nonempty
-#align nonempty_interior_of_Union_of_closed nonempty_interior_of_unionᵢ_of_closed
+  simpa using (dense_iUnion_interior_of_closed hc hU).Nonempty
+#align nonempty_interior_of_Union_of_closed nonempty_interior_of_iUnion_of_closed
 
 end BaireTheorem
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module topology.metric_space.baire
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit ce38d86c0b2d427ce208c3cee3159cb421d2b3c4
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -16,6 +16,9 @@ import Mathbin.Topology.Sets.Compacts
 /-!
 # Baire theorem
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In a complete metric space, a countable intersection of dense open subsets is dense.
 
 The good concept underlying the theorem is that of a Gδ set, i.e., a countable intersection
Diff
@@ -41,6 +41,7 @@ section BaireTheorem
 
 open Emetric ENNReal
 
+#print BaireSpace /-
 /-- The property `baire_space α` means that the topological space `α` has the Baire property:
 any countable intersection of open dense subsets is dense.
 Formulated here when the source space is ℕ (and subsumed below by `dense_Inter_of_open` working
@@ -48,7 +49,9 @@ with any encodable source space).-/
 class BaireSpace (α : Type _) [TopologicalSpace α] : Prop where
   baire_property : ∀ f : ℕ → Set α, (∀ n, IsOpen (f n)) → (∀ n, Dense (f n)) → Dense (⋂ n, f n)
 #align baire_space BaireSpace
+-/
 
+#print baire_category_theorem_emetric_complete /-
 /-- Baire theorems asserts that various topological spaces have the Baire property.
 Two versions of these theorems are given.
 The first states that complete pseudo_emetric spaces are Baire. -/
@@ -157,7 +160,9 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
   show edist y x ≤ ε
   exact le_trans (yball 0) (min_le_left _ _)
 #align baire_category_theorem_emetric_complete baire_category_theorem_emetric_complete
+-/
 
+#print baire_category_theorem_locally_compact /-
 /-- The second theorem states that locally compact spaces are Baire. -/
 instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSpace α] [T2Space α]
     [LocallyCompactSpace α] : BaireSpace α :=
@@ -196,15 +201,19 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
       (K 0).IsCompact fun n => (K n).IsCompact.IsClosed
   exact hK_nonempty.mono hK_subset
 #align baire_category_theorem_locally_compact baire_category_theorem_locally_compact
+-/
 
 variable [TopologicalSpace α] [BaireSpace α]
 
+#print dense_interᵢ_of_open_nat /-
 /-- Definition of a Baire space. -/
 theorem dense_interᵢ_of_open_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) :
     Dense (⋂ n, f n) :=
   BaireSpace.baire_property f ho hd
 #align dense_Inter_of_open_nat dense_interᵢ_of_open_nat
+-/
 
+#print dense_interₛ_of_open /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/
 theorem dense_interₛ_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
@@ -216,10 +225,12 @@ theorem dense_interₛ_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (
     rw [hf, sInter_range]
     exact dense_interᵢ_of_open_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
 #align dense_sInter_of_open dense_interₛ_of_open
+-/
 
+#print dense_binterᵢ_of_open /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_bInter_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
+theorem dense_binterᵢ_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) :=
   by
   rw [← sInter_image]
@@ -227,8 +238,10 @@ theorem dense_bInter_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S,
   · rwa [ball_image_iff]
   · exact hS.image _
   · rwa [ball_image_iff]
-#align dense_bInter_of_open dense_bInter_of_open
+#align dense_bInter_of_open dense_binterᵢ_of_open
+-/
 
+#print dense_interᵢ_of_open /-
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is an encodable type. -/
 theorem dense_interᵢ_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
@@ -240,7 +253,9 @@ theorem dense_interᵢ_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, I
   · exact countable_range _
   · rwa [forall_range_iff]
 #align dense_Inter_of_open dense_interᵢ_of_open
+-/
 
+#print dense_interₛ_of_Gδ /-
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/
 theorem dense_interₛ_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
@@ -262,7 +277,9 @@ theorem dense_interₛ_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS
     rw [hsT s hs] at this
     exact closure_mono (sInter_subset_of_mem tTs) this
 #align dense_sInter_of_Gδ dense_interₛ_of_Gδ
+-/
 
+#print dense_interᵢ_of_Gδ /-
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is an encodable type. -/
 theorem dense_interᵢ_of_Gδ [Encodable β] {f : β → Set α} (ho : ∀ s, IsGδ (f s))
@@ -271,17 +288,26 @@ theorem dense_interᵢ_of_Gδ [Encodable β] {f : β → Set α} (ho : ∀ s, Is
   rw [← sInter_range]
   exact dense_interₛ_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
 #align dense_Inter_of_Gδ dense_interᵢ_of_Gδ
+-/
 
+#print dense_binterᵢ_of_Gδ /-
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_bInter_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s ∈ S, IsGδ (f s ‹_›))
+theorem dense_binterᵢ_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s ∈ S, IsGδ (f s ‹_›))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s ‹_›)) : Dense (⋂ s ∈ S, f s ‹_›) :=
   by
   rw [bInter_eq_Inter]
   haveI := hS.to_encodable
   exact dense_interᵢ_of_Gδ (fun s => ho s s.2) fun s => hd s s.2
-#align dense_bInter_of_Gδ dense_bInter_of_Gδ
+#align dense_bInter_of_Gδ dense_binterᵢ_of_Gδ
+-/
 
+/- warning: dense.inter_of_Gδ -> Dense.inter_of_Gδ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] {s : Set.{u1} α} {t : Set.{u1} α}, (IsGδ.{u1} α _inst_1 s) -> (IsGδ.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 s) -> (Dense.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) s t))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] {s : Set.{u1} α} {t : Set.{u1} α}, (IsGδ.{u1} α _inst_1 s) -> (IsGδ.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 s) -> (Dense.{u1} α _inst_1 t) -> (Dense.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) s t))
+Case conversion may be inaccurate. Consider using '#align dense.inter_of_Gδ Dense.inter_of_Gδₓ'. -/
 /-- Baire theorem: the intersection of two dense Gδ sets is dense. -/
 theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
     (htc : Dense t) : Dense (s ∩ t) := by
@@ -289,6 +315,7 @@ theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : D
   apply dense_interᵢ_of_Gδ <;> simp [Bool.forall_bool, *]
 #align dense.inter_of_Gδ Dense.inter_of_Gδ
 
+#print eventually_residual /-
 /-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
 theorem eventually_residual {p : α → Prop} :
     (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x :=
@@ -303,18 +330,23 @@ theorem eventually_residual {p : α → Prop} :
     _ ↔ _ := by simp [and_assoc']
     
 #align eventually_residual eventually_residual
+-/
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
+#print mem_residual /-
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
 theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _)(_ : t ⊆ s), IsGδ t ∧ Dense t :=
   (@eventually_residual α _ _ fun x => x ∈ s).trans <|
     exists_congr fun t => by rw [exists_prop, and_comm' (t ⊆ s), subset_def, and_assoc']
 #align mem_residual mem_residual
+-/
 
+#print dense_of_mem_residual /-
 theorem dense_of_mem_residual {s : Set α} (hs : s ∈ residual α) : Dense s :=
   let ⟨t, hts, _, hd⟩ := mem_residual.1 hs
   hd.mono hts
 #align dense_of_mem_residual dense_of_mem_residual
+-/
 
 instance : CountableInterFilter (residual α) :=
   ⟨by
@@ -325,8 +357,9 @@ instance : CountableInterFilter (residual α) :=
     · rw [sInter_eq_bInter]
       exact Inter₂_mono hTs
     · exact isGδ_binterᵢ hSc fun s hs => (hT s hs).1
-    · exact dense_bInter_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
+    · exact dense_binterᵢ_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
 
+#print IsGδ.dense_unionᵢ_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃`. -/
 theorem IsGδ.dense_unionᵢ_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
@@ -345,47 +378,64 @@ theorem IsGδ.dense_unionᵢ_interior_of_closed [Encodable ι] {s : Set α} (hs
   rcases mem_Union.1 (hU hxs) with ⟨i, hi⟩
   exact mem_Union.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
 #align is_Gδ.dense_Union_interior_of_closed IsGδ.dense_unionᵢ_interior_of_closed
+-/
 
+#print IsGδ.dense_bunionᵢ_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with a union over a countable set in any type. -/
-theorem IsGδ.dense_bUnion_interior_of_closed {t : Set ι} {s : Set α} (hs : IsGδ s) (hd : Dense s)
+theorem IsGδ.dense_bunionᵢ_interior_of_closed {t : Set ι} {s : Set α} (hs : IsGδ s) (hd : Dense s)
     (ht : t.Countable) {f : ι → Set α} (hc : ∀ i ∈ t, IsClosed (f i)) (hU : s ⊆ ⋃ i ∈ t, f i) :
     Dense (⋃ i ∈ t, interior (f i)) :=
   by
   haveI := ht.to_encodable
   simp only [bUnion_eq_Union, SetCoe.forall'] at *
   exact hs.dense_Union_interior_of_closed hd hc hU
-#align is_Gδ.dense_bUnion_interior_of_closed IsGδ.dense_bUnion_interior_of_closed
+#align is_Gδ.dense_bUnion_interior_of_closed IsGδ.dense_bunionᵢ_interior_of_closed
+-/
 
+#print IsGδ.dense_unionₛ_interior_of_closed /-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃₀`. -/
 theorem IsGδ.dense_unionₛ_interior_of_closed {T : Set (Set α)} {s : Set α} (hs : IsGδ s)
     (hd : Dense s) (hc : T.Countable) (hc' : ∀ t ∈ T, IsClosed t) (hU : s ⊆ ⋃₀ T) :
     Dense (⋃ t ∈ T, interior t) :=
-  hs.dense_bUnion_interior_of_closed hd hc hc' <| by rwa [← sUnion_eq_bUnion]
+  hs.dense_bunionᵢ_interior_of_closed hd hc hc' <| by rwa [← sUnion_eq_bUnion]
 #align is_Gδ.dense_sUnion_interior_of_closed IsGδ.dense_unionₛ_interior_of_closed
+-/
 
+#print dense_bunionᵢ_interior_of_closed /-
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is a countable set in any type. -/
-theorem dense_bUnion_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
+theorem dense_bunionᵢ_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
     (hS : S.Countable) (hU : (⋃ s ∈ S, f s) = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
-  isGδ_univ.dense_bUnion_interior_of_closed dense_univ hS hc hU.ge
-#align dense_bUnion_interior_of_closed dense_bUnion_interior_of_closed
+  isGδ_univ.dense_bunionᵢ_interior_of_closed dense_univ hS hc hU.ge
+#align dense_bUnion_interior_of_closed dense_bunionᵢ_interior_of_closed
+-/
 
+#print dense_unionₛ_interior_of_closed /-
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with `⋃₀`. -/
 theorem dense_unionₛ_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, IsClosed s)
     (hS : S.Countable) (hU : ⋃₀ S = univ) : Dense (⋃ s ∈ S, interior s) :=
   isGδ_univ.dense_unionₛ_interior_of_closed dense_univ hS hc hU.ge
 #align dense_sUnion_interior_of_closed dense_unionₛ_interior_of_closed
+-/
 
+#print dense_unionᵢ_interior_of_closed /-
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is an encodable type. -/
 theorem dense_unionᵢ_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
     (hU : (⋃ s, f s) = univ) : Dense (⋃ s, interior (f s)) :=
   isGδ_univ.dense_unionᵢ_interior_of_closed dense_univ hc hU.ge
 #align dense_Union_interior_of_closed dense_unionᵢ_interior_of_closed
+-/
 
+/- warning: nonempty_interior_of_Union_of_closed -> nonempty_interior_of_unionᵢ_of_closed is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : BaireSpace.{u1} α _inst_1] [_inst_3 : Nonempty.{succ u1} α] [_inst_4 : Encodable.{u2} β] {f : β -> (Set.{u1} α)}, (forall (s : β), IsClosed.{u1} α _inst_1 (f s)) -> (Eq.{succ u1} (Set.{u1} α) (Set.unionᵢ.{u1, succ u2} α β (fun (s : β) => f s)) (Set.univ.{u1} α)) -> (Exists.{succ u2} β (fun (s : β) => Set.Nonempty.{u1} α (interior.{u1} α _inst_1 (f s))))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : TopologicalSpace.{u2} α] [_inst_2 : BaireSpace.{u2} α _inst_1] [_inst_3 : Nonempty.{succ u2} α] [_inst_4 : Encodable.{u1} β] {f : β -> (Set.{u2} α)}, (forall (s : β), IsClosed.{u2} α _inst_1 (f s)) -> (Eq.{succ u2} (Set.{u2} α) (Set.unionᵢ.{u2, succ u1} α β (fun (s : β) => f s)) (Set.univ.{u2} α)) -> (Exists.{succ u1} β (fun (s : β) => Set.Nonempty.{u2} α (interior.{u2} α _inst_1 (f s))))
+Case conversion may be inaccurate. Consider using '#align nonempty_interior_of_Union_of_closed nonempty_interior_of_unionᵢ_of_closedₓ'. -/
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
 covers the space, then one of the sets has nonempty interior. -/
 theorem nonempty_interior_of_unionᵢ_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
Diff
@@ -52,7 +52,7 @@ class BaireSpace (α : Type _) [TopologicalSpace α] : Prop where
 /-- Baire theorems asserts that various topological spaces have the Baire property.
 Two versions of these theorems are given.
 The first states that complete pseudo_emetric spaces are Baire. -/
-instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEmetricSpace α]
+instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetricSpace α]
     [CompleteSpace α] : BaireSpace α :=
   by
   refine' ⟨fun f ho hd => _⟩
@@ -69,7 +69,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEmetri
     by
     intro n x δ δpos
     have : x ∈ closure (f n) := hd n x
-    rcases Emetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩
+    rcases EMetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩
     rw [edist_comm] at xy
     obtain ⟨r, rpos, hr⟩ : ∃ r > 0, closed_ball y r ⊆ f n :=
       nhds_basis_closed_eball.mem_iff.1 (isOpen_iff_mem_nhds.1 (ho n) y ys)
Diff
@@ -82,8 +82,8 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEmetri
     exact
       calc
         edist z x ≤ edist z y + edist y x := edist_triangle _ _ _
-        _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := add_le_add hz (le_of_lt xy)
-        _ ≤ δ / 2 + δ / 2 := add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl
+        _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := (add_le_add hz (le_of_lt xy))
+        _ ≤ δ / 2 + δ / 2 := (add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl)
         _ = δ := ENNReal.add_halves δ
         
     show z ∈ f n
@@ -296,15 +296,15 @@ theorem eventually_residual {p : α → Prop} :
     (∀ᶠ x in residual α, p x) ↔ ∀ᶠ x in ⨅ (t : Set α) (ht : IsGδ t ∧ Dense t), 𝓟 t, p x := by
       simp only [residual, infᵢ_and]
     _ ↔ ∃ (t : Set α)(ht : IsGδ t ∧ Dense t), ∀ᶠ x in 𝓟 t, p x :=
-      mem_binfᵢ_of_directed
+      (mem_binfᵢ_of_directed
         (fun t₁ h₁ t₂ h₂ =>
           ⟨t₁ ∩ t₂, ⟨h₁.1.inter h₂.1, Dense.inter_of_Gδ h₁.1 h₂.1 h₁.2 h₂.2⟩, by simp⟩)
-        ⟨univ, isGδ_univ, dense_univ⟩
+        ⟨univ, isGδ_univ, dense_univ⟩)
     _ ↔ _ := by simp [and_assoc']
     
 #align eventually_residual eventually_residual
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:628:2: warning: expanding binder collection (t «expr ⊆ » s) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (t «expr ⊆ » s) -/
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
 theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _)(_ : t ⊆ s), IsGδ t ∧ Dense t :=
   (@eventually_residual α _ _ fun x => x ∈ s).trans <|
Diff
@@ -31,7 +31,7 @@ has the countable intersection property.
 
 noncomputable section
 
-open Classical Topology Filter Ennreal
+open Classical Topology Filter ENNReal
 
 open Filter Encodable Set TopologicalSpace
 
@@ -39,7 +39,7 @@ variable {α : Type _} {β : Type _} {γ : Type _} {ι : Type _}
 
 section BaireTheorem
 
-open Emetric Ennreal
+open Emetric ENNReal
 
 /-- The property `baire_space α` means that the topological space `α` has the Baire property:
 any countable intersection of open dense subsets is dense.
@@ -59,7 +59,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEmetri
   let B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n
   have Bpos : ∀ n, 0 < B n := by
     intro n
-    simp only [B, one_div, one_mul, Ennreal.inv_pos]
+    simp only [B, one_div, one_mul, ENNReal.inv_pos]
     exact pow_ne_top two_ne_top
   /- Translate the density assumption into two functions `center` and `radius` associating
     to any n, x, δ, δpos a center and a positive radius such that
@@ -69,13 +69,13 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEmetri
     by
     intro n x δ δpos
     have : x ∈ closure (f n) := hd n x
-    rcases Emetric.mem_closure_iff.1 this (δ / 2) (Ennreal.half_pos δpos) with ⟨y, ys, xy⟩
+    rcases Emetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩
     rw [edist_comm] at xy
     obtain ⟨r, rpos, hr⟩ : ∃ r > 0, closed_ball y r ⊆ f n :=
       nhds_basis_closed_eball.mem_iff.1 (isOpen_iff_mem_nhds.1 (ho n) y ys)
     refine' ⟨y, min (min (δ / 2) r) (B (n + 1)), _, _, fun z hz => ⟨_, _⟩⟩
     show 0 < min (min (δ / 2) r) (B (n + 1))
-    exact lt_min (lt_min (Ennreal.half_pos δpos) rpos) (Bpos (n + 1))
+    exact lt_min (lt_min (ENNReal.half_pos δpos) rpos) (Bpos (n + 1))
     show min (min (δ / 2) r) (B (n + 1)) ≤ B (n + 1)
     exact min_le_right _ _
     show z ∈ closed_ball x δ
@@ -84,7 +84,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEmetri
         edist z x ≤ edist z y + edist y x := edist_triangle _ _ _
         _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := add_le_add hz (le_of_lt xy)
         _ ≤ δ / 2 + δ / 2 := add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl
-        _ = δ := Ennreal.add_halves δ
+        _ = δ := ENNReal.add_halves δ
         
     show z ∈ f n
     exact

Changes in mathlib4

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

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

Diff
@@ -51,7 +51,7 @@ instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace : Bair
     exact
       calc
         edist z x ≤ edist z y + edist y x := edist_triangle _ _ _
-        _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := (add_le_add hz (le_of_lt xy))
+        _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := add_le_add hz (le_of_lt xy)
         _ ≤ δ / 2 + δ / 2 := (add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl)
         _ = δ := ENNReal.add_halves δ
     show z ∈ f n
chore: tidy various files (#11490)
Diff
@@ -71,15 +71,15 @@ instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace : Bair
   let r : ℕ → ℝ≥0∞ := fun n => (F n).2
   have rpos : ∀ n, 0 < r n := by
     intro n
-    induction' n with n hn
-    exact lt_min εpos (Bpos 0)
-    exact Hpos n (c n) (r n) hn.ne'
+    induction n with
+    | zero => exact lt_min εpos (Bpos 0)
+    | succ n hn => exact Hpos n (c n) (r n) hn.ne'
   have r0 : ∀ n, r n ≠ 0 := fun n => (rpos n).ne'
   have rB : ∀ n, r n ≤ B n := by
     intro n
-    induction' n with n _
-    exact min_le_right _ _
-    exact HB n (c n) (r n) (r0 n)
+    cases n with
+    | zero => exact min_le_right _ _
+    | succ n => exact HB n (c n) (r n) (r0 n)
   have incl : ∀ n, closedBall (c (n + 1)) (r (n + 1)) ⊆ closedBall (c n) (r n) ∩ f n :=
     fun n => Hball n (c n) (r n) (r0 n)
   have cdist : ∀ n, edist (c n) (c (n + 1)) ≤ B n := by
@@ -118,4 +118,3 @@ instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace : Bair
   show edist y x ≤ ε
   exact le_trans (yball 0) (min_le_left _ _)
 #align baire_category_theorem_emetric_complete BaireSpace.of_pseudoEMetricSpace_completeSpace
-
chore: Remove ball and bex from lemma names (#10816)

ball for "bounded forall" and bex for "bounded exists" are from experience very confusing abbreviations. This PR renames them to forall_mem and exists_mem in the few Set lemma names that mention them.

Also deprecate ball_image_of_ball, mem_image_elim, mem_image_elim_on since those lemmas are duplicates of the renamed lemmas (apart from argument order and implicitness, which I am also fixing by making the binder in the RHS of forall_mem_image semi-implicit), have obscure names and are completely unused.

Diff
@@ -52,7 +52,7 @@ theorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (h
   rcases S.eq_empty_or_nonempty with h | h
   · simp [h]
   · rcases hS.exists_eq_range h with ⟨f, rfl⟩
-    exact dense_iInter_of_isOpen_nat (forall_range_iff.1 ho) (forall_range_iff.1 hd)
+    exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd)
 #align dense_sInter_of_open dense_sInter_of_isOpen
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
@@ -60,14 +60,14 @@ an index set which is a countable set in any type. -/
 theorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by
   rw [← sInter_image]
-  refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [ball_image_iff]
+  refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image]
 #align dense_bInter_of_open dense_biInter_of_isOpen
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is a countable type. -/
 theorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i))
     (hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) :=
-  dense_sInter_of_isOpen (forall_range_iff.2 ho) (countable_range _) (forall_range_iff.2 hd)
+  dense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd)
 #align dense_Inter_of_open dense_iInter_of_isOpen
 
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
@@ -105,7 +105,7 @@ set_option linter.uppercaseLean3 false in
 an index set which is a countable type. -/
 theorem dense_iInter_of_Gδ [Countable ι] {f : ι → Set X} (ho : ∀ s, IsGδ (f s))
     (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) :=
-  dense_sInter_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
+  dense_sInter_of_Gδ (forall_mem_range.2 ‹_›) (countable_range _) (forall_mem_range.2 ‹_›)
 set_option linter.uppercaseLean3 false in
 #align dense_Inter_of_Gδ dense_iInter_of_Gδ
 
chore: split MetricSpace/Baire (#10648)
  • move definition to Topology/Defs/Basic;
  • move lemmas to Topology/Baire/Lemmas;
  • move instances to Topology/Baire/CompleteMetrizable and Topology/Baire/LocallyCompactRegular;
  • assume [UniformSpace X] [IsCountablyGenerated (𝓤 X)] instead of [PseudoMetricSpace X] in the 1st theorem.

This way Lemmas file does not depend on analysis.

chore: split MetricSpace/Baire (#10648)
  • move definition to Topology/Defs/Basic;
  • move lemmas to Topology/Baire/Lemmas;
  • move instances to Topology/Baire/CompleteMetrizable and Topology/Baire/LocallyCompactRegular;
  • assume [UniformSpace X] [IsCountablyGenerated (𝓤 X)] instead of [PseudoMetricSpace X] in the 1st theorem.

This way Lemmas file does not depend on analysis.

Diff
@@ -3,22 +3,26 @@ Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathlib.Analysis.SpecificLimits.Basic
-import Mathlib.Order.Filter.CountableInter
 import Mathlib.Topology.GDelta
-import Mathlib.Topology.Sets.Compacts
 
 #align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a"
 
 /-!
-# Baire theorem
+# Baire spaces
 
-In a complete metric space, a countable intersection of dense open subsets is dense.
+A topological space is called a *Baire space*
+if a countable intersection of dense open subsets is dense.
+Baire theorems say that all completely metrizable spaces
+and all locally compact regular spaces are Baire spaces.
+We prove the theorems in `Mathlib/Topology/Baire/CompleteMetrizable`
+and `Mathlib/Topology/Baire/LocallyCompactRegular`.
 
-The good concept underlying the theorem is that of a Gδ set, i.e., a countable intersection
+In this file we prove various corollaries of Baire theorems.
+
+The good concept underlying the theorems is that of a Gδ set, i.e., a countable intersection
 of open sets. Then Baire theorem can also be formulated as the fact that a countable
-intersection of dense Gδ sets is a dense Gδ set. We prove Baire theorem, giving several different
-formulations that can be handy. We also prove the important consequence that, if the space is
+intersection of dense Gδ sets is a dense Gδ set. We deduce this version from Baire property.
+We also prove the important consequence that, if the space is
 covered by a countable union of closed sets, then the union of their interiors is dense.
 
 We also prove that in Baire spaces, the `residual` sets are exactly those containing a dense Gδ set.
@@ -27,160 +31,13 @@ We also prove that in Baire spaces, the `residual` sets are exactly those contai
 
 noncomputable section
 
-open scoped Classical Topology Filter ENNReal
-
+open scoped Topology
 open Filter Set TopologicalSpace
 
 variable {X α : Type*} {ι : Sort*}
 
 section BaireTheorem
 
-open EMetric ENNReal
-
-/-- The property `BaireSpace α` means that the topological space `α` has the Baire property:
-any countable intersection of open dense subsets is dense.
-Formulated here when the source space is ℕ (and subsumed below by `dense_iInter_of_isOpen` working
-with any encodable source space). -/
-class BaireSpace (X : Type*) [TopologicalSpace X] : Prop where
-  baire_property : ∀ f : ℕ → Set X, (∀ n, IsOpen (f n)) → (∀ n, Dense (f n)) → Dense (⋂ n, f n)
-#align baire_space BaireSpace
-
-/-- Baire theorems asserts that various topological spaces have the Baire property.
-Two versions of these theorems are given.
-The first states that complete `PseudoEMetricSpace`s are Baire. -/
-instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace X]
-    [CompleteSpace X] : BaireSpace X := by
-  refine' ⟨fun f ho hd => _⟩
-  let B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n
-  have Bpos : ∀ n, 0 < B n := fun n ↦
-    ENNReal.div_pos one_ne_zero <| ENNReal.pow_ne_top ENNReal.coe_ne_top
-  /- Translate the density assumption into two functions `center` and `radius` associating
-    to any n, x, δ, δpos a center and a positive radius such that
-    `closedBall center radius` is included both in `f n` and in `closedBall x δ`.
-    We can also require `radius ≤ (1/2)^(n+1)`, to ensure we get a Cauchy sequence later. -/
-  have : ∀ n x δ, δ ≠ 0 → ∃ y r, 0 < r ∧ r ≤ B (n + 1) ∧ closedBall y r ⊆ closedBall x δ ∩ f n := by
-    intro n x δ δpos
-    have : x ∈ closure (f n) := hd n x
-    rcases EMetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩
-    rw [edist_comm] at xy
-    obtain ⟨r, rpos, hr⟩ : ∃ r > 0, closedBall y r ⊆ f n :=
-      nhds_basis_closed_eball.mem_iff.1 (isOpen_iff_mem_nhds.1 (ho n) y ys)
-    refine' ⟨y, min (min (δ / 2) r) (B (n + 1)), _, _, fun z hz => ⟨_, _⟩⟩
-    show 0 < min (min (δ / 2) r) (B (n + 1))
-    exact lt_min (lt_min (ENNReal.half_pos δpos) rpos) (Bpos (n + 1))
-    show min (min (δ / 2) r) (B (n + 1)) ≤ B (n + 1)
-    exact min_le_right _ _
-    show z ∈ closedBall x δ
-    exact
-      calc
-        edist z x ≤ edist z y + edist y x := edist_triangle _ _ _
-        _ ≤ min (min (δ / 2) r) (B (n + 1)) + δ / 2 := (add_le_add hz (le_of_lt xy))
-        _ ≤ δ / 2 + δ / 2 := (add_le_add (le_trans (min_le_left _ _) (min_le_left _ _)) le_rfl)
-        _ = δ := ENNReal.add_halves δ
-    show z ∈ f n
-    exact hr (calc
-      edist z y ≤ min (min (δ / 2) r) (B (n + 1)) := hz
-      _ ≤ r := le_trans (min_le_left _ _) (min_le_right _ _))
-  choose! center radius Hpos HB Hball using this
-  refine' fun x => (mem_closure_iff_nhds_basis nhds_basis_closed_eball).2 fun ε εpos => _
-  /- `ε` is positive. We have to find a point in the ball of radius `ε` around `x` belonging to all
-    `f n`. For this, we construct inductively a sequence `F n = (c n, r n)` such that the closed
-    ball `closedBall (c n) (r n)` is included in the previous ball and in `f n`, and such that
-    `r n` is small enough to ensure that `c n` is a Cauchy sequence. Then `c n` converges to a
-    limit which belongs to all the `f n`. -/
-  let F : ℕ → X × ℝ≥0∞ := fun n =>
-    Nat.recOn n (Prod.mk x (min ε (B 0))) fun n p => Prod.mk (center n p.1 p.2) (radius n p.1 p.2)
-  let c : ℕ → X := fun n => (F n).1
-  let r : ℕ → ℝ≥0∞ := fun n => (F n).2
-  have rpos : ∀ n, 0 < r n := by
-    intro n
-    induction' n with n hn
-    exact lt_min εpos (Bpos 0)
-    exact Hpos n (c n) (r n) hn.ne'
-  have r0 : ∀ n, r n ≠ 0 := fun n => (rpos n).ne'
-  have rB : ∀ n, r n ≤ B n := by
-    intro n
-    induction' n with n _
-    exact min_le_right _ _
-    exact HB n (c n) (r n) (r0 n)
-  have incl : ∀ n, closedBall (c (n + 1)) (r (n + 1)) ⊆ closedBall (c n) (r n) ∩ f n :=
-    fun n => Hball n (c n) (r n) (r0 n)
-  have cdist : ∀ n, edist (c n) (c (n + 1)) ≤ B n := by
-    intro n
-    rw [edist_comm]
-    have A : c (n + 1) ∈ closedBall (c (n + 1)) (r (n + 1)) := mem_closedBall_self
-    have I :=
-      calc
-        closedBall (c (n + 1)) (r (n + 1)) ⊆ closedBall (c n) (r n) :=
-          Subset.trans (incl n) (inter_subset_left _ _)
-        _ ⊆ closedBall (c n) (B n) := closedBall_subset_closedBall (rB n)
-    exact I A
-  have : CauchySeq c := cauchySeq_of_edist_le_geometric_two _ one_ne_top cdist
-  -- as the sequence `c n` is Cauchy in a complete space, it converges to a limit `y`.
-  rcases cauchySeq_tendsto_of_complete this with ⟨y, ylim⟩
-  -- this point `y` will be the desired point. We will check that it belongs to all
-  -- `f n` and to `ball x ε`.
-  use y
-  simp only [exists_prop, Set.mem_iInter]
-  have I : ∀ n, ∀ m ≥ n, closedBall (c m) (r m) ⊆ closedBall (c n) (r n) := by
-    intro n
-    refine' Nat.le_induction _ fun m _ h => _
-    · exact Subset.refl _
-    · exact Subset.trans (incl m) (Subset.trans (inter_subset_left _ _) h)
-  have yball : ∀ n, y ∈ closedBall (c n) (r n) := by
-    intro n
-    refine' isClosed_ball.mem_of_tendsto ylim _
-    refine' (Filter.eventually_ge_atTop n).mono fun m hm => _
-    exact I n m hm mem_closedBall_self
-  constructor
-  show ∀ n, y ∈ f n
-  · intro n
-    have : closedBall (c (n + 1)) (r (n + 1)) ⊆ f n :=
-      Subset.trans (incl n) (inter_subset_right _ _)
-    exact this (yball (n + 1))
-  show edist y x ≤ ε
-  exact le_trans (yball 0) (min_le_left _ _)
-#align baire_category_theorem_emetric_complete BaireSpace.of_pseudoEMetricSpace_completeSpace
-
-/-- The second theorem states that locally compact R₁ spaces are Baire. -/
-instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace
-    [TopologicalSpace X] [R1Space X] [LocallyCompactSpace X] : BaireSpace X := by
-  constructor
-  intro f ho hd
-  /- To prove that an intersection of open dense subsets is dense, prove that its intersection
-    with any open neighbourhood `U` is dense. Define recursively a decreasing sequence `K` of
-    compact neighbourhoods: start with some compact neighbourhood inside `U`, then at each step,
-    take its interior, intersect with `f n`, then choose a compact neighbourhood inside the
-    intersection. -/
-  rw [dense_iff_inter_open]
-  intro U U_open U_nonempty
-  -- Choose an antitone sequence of positive compacts such that `closure (K 0) ⊆ U`
-  -- and `closure (K (n + 1)) ⊆ f n` for all `n`
-  obtain ⟨K, hK_anti, hKf, hKU⟩ : ∃ K : ℕ → PositiveCompacts X,
-      (∀ n, K (n + 1) ≤ K n) ∧ (∀ n, closure ↑(K (n + 1)) ⊆ f n) ∧ closure ↑(K 0) ⊆ U := by
-    rcases U_open.exists_positiveCompacts_closure_subset U_nonempty with ⟨K₀, hK₀⟩
-    have : ∀ (n) (K : PositiveCompacts X),
-        ∃ K' : PositiveCompacts X, closure ↑K' ⊆ f n ∩ interior K := by
-      refine fun n K ↦ ((ho n).inter isOpen_interior).exists_positiveCompacts_closure_subset ?_
-      rw [inter_comm]
-      exact (hd n).inter_open_nonempty _ isOpen_interior K.interior_nonempty
-    choose K_next hK_next using this
-    refine ⟨Nat.rec K₀ K_next, fun n ↦ ?_, fun n ↦ (hK_next n _).trans (inter_subset_left _ _), hK₀⟩
-    exact subset_closure.trans <| (hK_next _ _).trans <|
-      (inter_subset_right _ _).trans interior_subset
-  -- Prove that ̀`⋂ n : ℕ, closure (K n)` is inside `U ∩ ⋂ n : ℕ, f n`.
-  have hK_subset : (⋂ n, closure (K n) : Set X) ⊆ U ∩ ⋂ n, f n := fun x hx ↦ by
-    simp only [mem_iInter, mem_inter_iff] at hx ⊢
-    exact ⟨hKU <| hx 0, fun n ↦ hKf n <| hx (n + 1)⟩
-  /- Prove that `⋂ n : ℕ, closure (K n)` is not empty, as an intersection of a decreasing sequence
-    of nonempty compact closed subsets. -/
-  have hK_nonempty : (⋂ n, closure (K n) : Set X).Nonempty :=
-    IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed _
-      (fun n => closure_mono <| hK_anti n) (fun n => (K n).nonempty.closure)
-      (K 0).isCompact.closure fun n => isClosed_closure
-  exact hK_nonempty.mono hK_subset
-#align baire_category_theorem_locally_compact BaireSpace.of_t2Space_locallyCompactSpace
-
 variable [TopologicalSpace X] [BaireSpace X]
 
 /-- Definition of a Baire space. -/
chore: split MetricSpace/Baire (#10648)
  • move definition to Topology/Defs/Basic;
  • move lemmas to Topology/Baire/Lemmas;
  • move instances to Topology/Baire/CompleteMetrizable and Topology/Baire/LocallyCompactRegular;
  • assume [UniformSpace X] [IsCountablyGenerated (𝓤 X)] instead of [PseudoMetricSpace X] in the 1st theorem.

This way Lemmas file does not depend on analysis.

feat(Mathlib.Topology.Compactness.Compact): add sInter version of Cantor's intersection theorem (#10956)

The iInter version of Cantor's intersection theorem is already present: IsCompact.nonempty_iInter_of_directed_nonempty_compact_closed. The proof of the added sInter version takes advantage of the iInter version.

Much of the addition due to conversation with Sebastien Gouezel on Zulip.

Open in Gitpod

Diff
@@ -175,7 +175,7 @@ instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace
   /- Prove that `⋂ n : ℕ, closure (K n)` is not empty, as an intersection of a decreasing sequence
     of nonempty compact closed subsets. -/
   have hK_nonempty : (⋂ n, closure (K n) : Set X).Nonempty :=
-    IsCompact.nonempty_iInter_of_sequence_nonempty_compact_closed _
+    IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed _
       (fun n => closure_mono <| hK_anti n) (fun n => (K n).nonempty.closure)
       (K 0).isCompact.closure fun n => isClosed_closure
   exact hK_nonempty.mono hK_subset
chore(Topology/GDelta): use new-style dot notation (#10583)

Rename many isGδ_some lemmas to IsGδ.some. Also resolve a TODO.

Diff
@@ -281,7 +281,7 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Countable ι] {s : Set X} (hs : I
     refine' dense_iInter_of_isOpen hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_isOpen fun i => (hgo i)) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (.iInter_of_isOpen fun i => (hgo i)) hgd).mono _
   rintro x ⟨hxs, hxg⟩
   rw [mem_iInter] at hxg
   rcases mem_iUnion.1 (hU hxs) with ⟨i, hi⟩
@@ -313,21 +313,21 @@ set_option linter.uppercaseLean3 false in
 are dense. Formulated here with an index set which is a countable set in any type. -/
 theorem dense_biUnion_interior_of_closed {S : Set α} {f : α → Set X} (hc : ∀ s ∈ S, IsClosed (f s))
     (hS : S.Countable) (hU : ⋃ s ∈ S, f s = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
-  isGδ_univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
+  IsGδ.univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
 #align dense_bUnion_interior_of_closed dense_biUnion_interior_of_closed
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with `⋃₀`. -/
 theorem dense_sUnion_interior_of_closed {S : Set (Set X)} (hc : ∀ s ∈ S, IsClosed s)
     (hS : S.Countable) (hU : ⋃₀ S = univ) : Dense (⋃ s ∈ S, interior s) :=
-  isGδ_univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge
+  IsGδ.univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge
 #align dense_sUnion_interior_of_closed dense_sUnion_interior_of_closed
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is a countable type. -/
 theorem dense_iUnion_interior_of_closed [Countable ι] {f : ι → Set X} (hc : ∀ i, IsClosed (f i))
     (hU : ⋃ i, f i = univ) : Dense (⋃ i, interior (f i)) :=
-  isGδ_univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
+  IsGδ.univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
 #align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
chore(MetricSpace/Baire): fix Encodable/Countable (#10249)
  • Assume {ι : Sort*} [Countable ι] instead of {ι : Type*} [Encodable ι].
  • Generalize 2nd Baire theorem from T₂ spaces to R₁ spaces.
  • Rename type variables.
Diff
@@ -27,11 +27,11 @@ We also prove that in Baire spaces, the `residual` sets are exactly those contai
 
 noncomputable section
 
-open Classical Topology Filter ENNReal
+open scoped Classical Topology Filter ENNReal
 
-open Filter Encodable Set TopologicalSpace
+open Filter Set TopologicalSpace
 
-variable {α : Type*} {β : Type*} {γ : Type*} {ι : Type*}
+variable {X α : Type*} {ι : Sort*}
 
 section BaireTheorem
 
@@ -41,21 +41,19 @@ open EMetric ENNReal
 any countable intersection of open dense subsets is dense.
 Formulated here when the source space is ℕ (and subsumed below by `dense_iInter_of_isOpen` working
 with any encodable source space). -/
-class BaireSpace (α : Type*) [TopologicalSpace α] : Prop where
-  baire_property : ∀ f : ℕ → Set α, (∀ n, IsOpen (f n)) → (∀ n, Dense (f n)) → Dense (⋂ n, f n)
+class BaireSpace (X : Type*) [TopologicalSpace X] : Prop where
+  baire_property : ∀ f : ℕ → Set X, (∀ n, IsOpen (f n)) → (∀ n, Dense (f n)) → Dense (⋂ n, f n)
 #align baire_space BaireSpace
 
 /-- Baire theorems asserts that various topological spaces have the Baire property.
 Two versions of these theorems are given.
 The first states that complete `PseudoEMetricSpace`s are Baire. -/
-instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace α]
-    [CompleteSpace α] : BaireSpace α := by
+instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace X]
+    [CompleteSpace X] : BaireSpace X := by
   refine' ⟨fun f ho hd => _⟩
   let B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n
-  have Bpos : ∀ n, 0 < B n := by
-    intro n
-    simp only [one_div, one_mul, ENNReal.inv_pos]
-    exact pow_ne_top two_ne_top
+  have Bpos : ∀ n, 0 < B n := fun n ↦
+    ENNReal.div_pos one_ne_zero <| ENNReal.pow_ne_top ENNReal.coe_ne_top
   /- Translate the density assumption into two functions `center` and `radius` associating
     to any n, x, δ, δpos a center and a positive radius such that
     `closedBall center radius` is included both in `f n` and in `closedBall x δ`.
@@ -90,9 +88,9 @@ instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [Pseud
     ball `closedBall (c n) (r n)` is included in the previous ball and in `f n`, and such that
     `r n` is small enough to ensure that `c n` is a Cauchy sequence. Then `c n` converges to a
     limit which belongs to all the `f n`. -/
-  let F : ℕ → α × ℝ≥0∞ := fun n =>
+  let F : ℕ → X × ℝ≥0∞ := fun n =>
     Nat.recOn n (Prod.mk x (min ε (B 0))) fun n p => Prod.mk (center n p.1 p.2) (radius n p.1 p.2)
-  let c : ℕ → α := fun n => (F n).1
+  let c : ℕ → X := fun n => (F n).1
   let r : ℕ → ℝ≥0∞ := fun n => (F n).2
   have rpos : ∀ n, 0 < r n := by
     intro n
@@ -144,9 +142,9 @@ instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [Pseud
   exact le_trans (yball 0) (min_le_left _ _)
 #align baire_category_theorem_emetric_complete BaireSpace.of_pseudoEMetricSpace_completeSpace
 
-/-- The second theorem states that locally compact spaces are Baire. -/
+/-- The second theorem states that locally compact R₁ spaces are Baire. -/
 instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace
-    [TopologicalSpace α] [T2Space α] [LocallyCompactSpace α] : BaireSpace α := by
+    [TopologicalSpace X] [R1Space X] [LocallyCompactSpace X] : BaireSpace X := by
   constructor
   intro f ho hd
   /- To prove that an intersection of open dense subsets is dense, prove that its intersection
@@ -154,78 +152,69 @@ instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace
     compact neighbourhoods: start with some compact neighbourhood inside `U`, then at each step,
     take its interior, intersect with `f n`, then choose a compact neighbourhood inside the
     intersection. -/
-  apply dense_iff_inter_open.2
+  rw [dense_iff_inter_open]
   intro U U_open U_nonempty
-  rcases exists_positiveCompacts_subset U_open U_nonempty with ⟨K₀, hK₀⟩
-  have : ∀ (n) (K : PositiveCompacts α), ∃ K' : PositiveCompacts α, ↑K' ⊆ f n ∩ interior K := by
-    refine' fun n K => exists_positiveCompacts_subset ((ho n).inter isOpen_interior) _
-    rw [inter_comm]
-    exact (hd n).inter_open_nonempty _ isOpen_interior K.interior_nonempty
-  choose K_next hK_next using this
-  let K : ℕ → PositiveCompacts α := fun n => Nat.recOn n K₀ K_next
-  -- This is a decreasing sequence of positive compacts contained in suitable open sets `f n`.
-  have hK_decreasing : ∀ n : ℕ, ((K (n + 1)).carrier) ⊆ (f n ∩ (K n).carrier) :=
-    fun n => (hK_next n (K n)).trans <| inter_subset_inter_right _ interior_subset
-  -- Prove that ̀`⋂ n : ℕ, K n` is inside `U ∩ ⋂ n : ℕ, f n`.
-  have hK_subset : (⋂ n, (K n).carrier : Set α) ⊆ U ∩ ⋂ n, f n := by
-    intro x hx
-    simp only [mem_iInter] at hx
-    simp only [mem_inter_iff, mem_inter] at hx ⊢
-    refine' ⟨hK₀ <| hx 0, _⟩
-    simp only [mem_iInter]
-    exact fun n => (hK_decreasing n (hx (n + 1))).1
-  /- Prove that `⋂ n : ℕ, K n` is not empty, as an intersection of a decreasing sequence
-    of nonempty compact subsets. -/
-  have hK_nonempty : (⋂ n, (K n).carrier : Set α).Nonempty :=
+  -- Choose an antitone sequence of positive compacts such that `closure (K 0) ⊆ U`
+  -- and `closure (K (n + 1)) ⊆ f n` for all `n`
+  obtain ⟨K, hK_anti, hKf, hKU⟩ : ∃ K : ℕ → PositiveCompacts X,
+      (∀ n, K (n + 1) ≤ K n) ∧ (∀ n, closure ↑(K (n + 1)) ⊆ f n) ∧ closure ↑(K 0) ⊆ U := by
+    rcases U_open.exists_positiveCompacts_closure_subset U_nonempty with ⟨K₀, hK₀⟩
+    have : ∀ (n) (K : PositiveCompacts X),
+        ∃ K' : PositiveCompacts X, closure ↑K' ⊆ f n ∩ interior K := by
+      refine fun n K ↦ ((ho n).inter isOpen_interior).exists_positiveCompacts_closure_subset ?_
+      rw [inter_comm]
+      exact (hd n).inter_open_nonempty _ isOpen_interior K.interior_nonempty
+    choose K_next hK_next using this
+    refine ⟨Nat.rec K₀ K_next, fun n ↦ ?_, fun n ↦ (hK_next n _).trans (inter_subset_left _ _), hK₀⟩
+    exact subset_closure.trans <| (hK_next _ _).trans <|
+      (inter_subset_right _ _).trans interior_subset
+  -- Prove that ̀`⋂ n : ℕ, closure (K n)` is inside `U ∩ ⋂ n : ℕ, f n`.
+  have hK_subset : (⋂ n, closure (K n) : Set X) ⊆ U ∩ ⋂ n, f n := fun x hx ↦ by
+    simp only [mem_iInter, mem_inter_iff] at hx ⊢
+    exact ⟨hKU <| hx 0, fun n ↦ hKf n <| hx (n + 1)⟩
+  /- Prove that `⋂ n : ℕ, closure (K n)` is not empty, as an intersection of a decreasing sequence
+    of nonempty compact closed subsets. -/
+  have hK_nonempty : (⋂ n, closure (K n) : Set X).Nonempty :=
     IsCompact.nonempty_iInter_of_sequence_nonempty_compact_closed _
-      (fun n => (hK_decreasing n).trans (inter_subset_right _ _)) (fun n => (K n).nonempty)
-      (K 0).isCompact fun n => (K n).isCompact.isClosed
+      (fun n => closure_mono <| hK_anti n) (fun n => (K n).nonempty.closure)
+      (K 0).isCompact.closure fun n => isClosed_closure
   exact hK_nonempty.mono hK_subset
 #align baire_category_theorem_locally_compact BaireSpace.of_t2Space_locallyCompactSpace
 
-variable [TopologicalSpace α] [BaireSpace α]
+variable [TopologicalSpace X] [BaireSpace X]
 
 /-- Definition of a Baire space. -/
-theorem dense_iInter_of_isOpen_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n))
+theorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n))
     (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) :=
   BaireSpace.baire_property f ho hd
 #align dense_Inter_of_open_nat dense_iInter_of_isOpen_nat
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/
-theorem dense_sInter_of_isOpen {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
+theorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by
   rcases S.eq_empty_or_nonempty with h | h
   · simp [h]
-  · rcases hS.exists_eq_range h with ⟨f, hf⟩
-    have F : ∀ n, f n ∈ S := fun n => by rw [hf]; exact mem_range_self _
-    rw [hf, sInter_range]
-    exact dense_iInter_of_isOpen_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
+  · rcases hS.exists_eq_range h with ⟨f, rfl⟩
+    exact dense_iInter_of_isOpen_nat (forall_range_iff.1 ho) (forall_range_iff.1 hd)
 #align dense_sInter_of_open dense_sInter_of_isOpen
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_biInter_of_isOpen {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
+theorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by
   rw [← sInter_image]
-  apply dense_sInter_of_isOpen
-  · rwa [ball_image_iff]
-  · exact hS.image _
-  · rwa [ball_image_iff]
+  refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [ball_image_iff]
 #align dense_bInter_of_open dense_biInter_of_isOpen
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
-an index set which is an encodable type. -/
-theorem dense_iInter_of_isOpen [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
-    (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) := by
-  rw [← sInter_range]
-  apply dense_sInter_of_isOpen
-  · rwa [forall_range_iff]
-  · exact countable_range _
-  · rwa [forall_range_iff]
+an index set which is a countable type. -/
+theorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i))
+    (hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) :=
+  dense_sInter_of_isOpen (forall_range_iff.2 ho) (countable_range _) (forall_range_iff.2 hd)
 #align dense_Inter_of_open dense_iInter_of_isOpen
 
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
-theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by
+theorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by
   constructor
   · rw [mem_residual_iff]
     rintro ⟨S, hSo, hSd, Sct, Ss⟩
@@ -236,47 +225,45 @@ theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ t ⊆ s, IsGδ t 
 #align mem_residual mem_residual
 
 /-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
-theorem eventually_residual {p : α → Prop} :
-    (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x : α, x ∈ t → p x := by
+theorem eventually_residual {p : X → Prop} :
+    (∀ᶠ x in residual X, p x) ↔ ∃ t : Set X, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x := by
   simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]
   tauto
 #align eventually_residual eventually_residual
 
-theorem dense_of_mem_residual {s : Set α} (hs : s ∈ residual α) : Dense s :=
+theorem dense_of_mem_residual {s : Set X} (hs : s ∈ residual X) : Dense s :=
   let ⟨_, hts, _, hd⟩ := mem_residual.1 hs
   hd.mono hts
 #align dense_of_mem_residual dense_of_mem_residual
 
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/
-theorem dense_sInter_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
+theorem dense_sInter_of_Gδ {S : Set (Set X)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
-dense_of_mem_residual ((countable_sInter_mem hS).mpr
-  (fun _ hs => residual_of_dense_Gδ (ho _ hs) (hd _ hs)))
+  dense_of_mem_residual ((countable_sInter_mem hS).mpr
+    (fun _ hs => residual_of_dense_Gδ (ho _ hs) (hd _ hs)))
 set_option linter.uppercaseLean3 false in
 #align dense_sInter_of_Gδ dense_sInter_of_Gδ
 
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
-an index set which is an encodable type. -/
-theorem dense_iInter_of_Gδ [Encodable β] {f : β → Set α} (ho : ∀ s, IsGδ (f s))
-    (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) := by
-  rw [← sInter_range]
-  exact dense_sInter_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
+an index set which is a countable type. -/
+theorem dense_iInter_of_Gδ [Countable ι] {f : ι → Set X} (ho : ∀ s, IsGδ (f s))
+    (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) :=
+  dense_sInter_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
 set_option linter.uppercaseLean3 false in
 #align dense_Inter_of_Gδ dense_iInter_of_Gδ
 
--- Porting note: In `ho` and `hd`, changed `∀ s ∈ S` to `∀ s (H : s ∈ S)`
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_biInter_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s (H : s ∈ S), IsGδ (f s H))
+theorem dense_biInter_of_Gδ {S : Set α} {f : ∀ x ∈ S, Set X} (ho : ∀ s (H : s ∈ S), IsGδ (f s H))
     (hS : S.Countable) (hd : ∀ s (H : s ∈ S), Dense (f s H)) : Dense (⋂ s ∈ S, f s ‹_›) := by
   rw [biInter_eq_iInter]
-  haveI := hS.toEncodable
+  haveI := hS.to_subtype
   exact dense_iInter_of_Gδ (fun s => ho s s.2) fun s => hd s s.2
 set_option linter.uppercaseLean3 false in
 #align dense_bInter_of_Gδ dense_biInter_of_Gδ
 
 /-- Baire theorem: the intersection of two dense Gδ sets is dense. -/
-theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
+theorem Dense.inter_of_Gδ {s t : Set X} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
     (htc : Dense t) : Dense (s ∩ t) := by
   rw [inter_eq_iInter]
   apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *]
@@ -285,8 +272,8 @@ set_option linter.uppercaseLean3 false in
 
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃`. -/
-theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
-    {f : ι → Set α} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) :
+theorem IsGδ.dense_iUnion_interior_of_closed [Countable ι] {s : Set X} (hs : IsGδ s) (hd : Dense s)
+    {f : ι → Set X} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) :
     Dense (⋃ i, interior (f i)) := by
   let g i := (frontier (f i))ᶜ
   have hgo : ∀ i, IsOpen (g i) := fun i => isClosed_frontier.isOpen_compl
@@ -304,10 +291,10 @@ set_option linter.uppercaseLean3 false in
 
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with a union over a countable set in any type. -/
-theorem IsGδ.dense_biUnion_interior_of_closed {t : Set ι} {s : Set α} (hs : IsGδ s) (hd : Dense s)
-    (ht : t.Countable) {f : ι → Set α} (hc : ∀ i ∈ t, IsClosed (f i)) (hU : s ⊆ ⋃ i ∈ t, f i) :
+theorem IsGδ.dense_biUnion_interior_of_closed {t : Set α} {s : Set X} (hs : IsGδ s) (hd : Dense s)
+    (ht : t.Countable) {f : α → Set X} (hc : ∀ i ∈ t, IsClosed (f i)) (hU : s ⊆ ⋃ i ∈ t, f i) :
     Dense (⋃ i ∈ t, interior (f i)) := by
-  haveI := ht.toEncodable
+  haveI := ht.to_subtype
   simp only [biUnion_eq_iUnion, SetCoe.forall'] at *
   exact hs.dense_iUnion_interior_of_closed hd hc hU
 set_option linter.uppercaseLean3 false in
@@ -315,7 +302,7 @@ set_option linter.uppercaseLean3 false in
 
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃₀`. -/
-theorem IsGδ.dense_sUnion_interior_of_closed {T : Set (Set α)} {s : Set α} (hs : IsGδ s)
+theorem IsGδ.dense_sUnion_interior_of_closed {T : Set (Set X)} {s : Set X} (hs : IsGδ s)
     (hd : Dense s) (hc : T.Countable) (hc' : ∀ t ∈ T, IsClosed t) (hU : s ⊆ ⋃₀ T) :
     Dense (⋃ t ∈ T, interior t) :=
   hs.dense_biUnion_interior_of_closed hd hc hc' <| by rwa [← sUnion_eq_biUnion]
@@ -324,29 +311,29 @@ set_option linter.uppercaseLean3 false in
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is a countable set in any type. -/
-theorem dense_biUnion_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
+theorem dense_biUnion_interior_of_closed {S : Set α} {f : α → Set X} (hc : ∀ s ∈ S, IsClosed (f s))
     (hS : S.Countable) (hU : ⋃ s ∈ S, f s = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
   isGδ_univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
 #align dense_bUnion_interior_of_closed dense_biUnion_interior_of_closed
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with `⋃₀`. -/
-theorem dense_sUnion_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, IsClosed s)
+theorem dense_sUnion_interior_of_closed {S : Set (Set X)} (hc : ∀ s ∈ S, IsClosed s)
     (hS : S.Countable) (hU : ⋃₀ S = univ) : Dense (⋃ s ∈ S, interior s) :=
   isGδ_univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge
 #align dense_sUnion_interior_of_closed dense_sUnion_interior_of_closed
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
-are dense. Formulated here with an index set which is an encodable type. -/
-theorem dense_iUnion_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
-    (hU : ⋃ s, f s = univ) : Dense (⋃ s, interior (f s)) :=
+are dense. Formulated here with an index set which is a countable type. -/
+theorem dense_iUnion_interior_of_closed [Countable ι] {f : ι → Set X} (hc : ∀ i, IsClosed (f i))
+    (hU : ⋃ i, f i = univ) : Dense (⋃ i, interior (f i)) :=
   isGδ_univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
 #align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
 covers the space, then one of the sets has nonempty interior. -/
-theorem nonempty_interior_of_iUnion_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
-    (hc : ∀ s, IsClosed (f s)) (hU : ⋃ s, f s = univ) : ∃ s, (interior <| f s).Nonempty := by
+theorem nonempty_interior_of_iUnion_of_closed [Nonempty X] [Countable ι] {f : ι → Set X}
+    (hc : ∀ i, IsClosed (f i)) (hU : ⋃ i, f i = univ) : ∃ i, (interior <| f i).Nonempty := by
   simpa using (dense_iUnion_interior_of_closed hc hU).nonempty
 #align nonempty_interior_of_Union_of_closed nonempty_interior_of_iUnion_of_closed
 
chore: reduce imports (#9830)

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

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

Diff
@@ -7,7 +7,6 @@ import Mathlib.Analysis.SpecificLimits.Basic
 import Mathlib.Order.Filter.CountableInter
 import Mathlib.Topology.GDelta
 import Mathlib.Topology.Sets.Compacts
-import Mathlib.Order.Filter.CountableInter
 
 #align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a"
 
chore(*): use ∃ x ∈ s, p x instead of ∃ x (_ : x ∈ s), p x (#9326)

This is a follow-up to #9215. It changes the following theorems and definitions:

  • IsOpen.exists_subset_affineIndependent_span_eq_top
  • IsConformalMap
  • SimpleGraph.induce_connected_of_patches
  • Submonoid.exists_list_of_mem_closure
  • AddSubmonoid.exists_list_of_mem_closure
  • AffineSubspace.mem_affineSpan_insert_iff
  • AffineBasis.exists_affine_subbasis
  • exists_affineIndependent
  • LinearMap.mem_submoduleImage
  • Basis.basis_singleton_iff
  • atom_iff_nonzero_span
  • finrank_eq_one_iff'
  • Submodule.basis_of_pid_aux
  • exists_linearIndependent_extension
  • exists_linearIndependent
  • countable_cover_nhdsWithin_of_sigma_compact
  • mem_residual

Also deprecate ENNReal.exists_ne_top'.

Diff
@@ -226,7 +226,7 @@ theorem dense_iInter_of_isOpen [Encodable β] {f : β → Set α} (ho : ∀ s, I
 #align dense_Inter_of_open dense_iInter_of_isOpen
 
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
-theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t := by
+theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by
   constructor
   · rw [mem_residual_iff]
     rintro ⟨S, hSo, hSd, Sct, Ss⟩
@@ -239,10 +239,8 @@ theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆
 /-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
 theorem eventually_residual {p : α → Prop} :
     (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x : α, x ∈ t → p x := by
-  -- this can probably be improved...
-  convert@mem_residual _ _ _ p
-  simp_rw [exists_prop, @and_comm ((_ : Set α) ⊆ p), and_assoc]
-  rfl
+  simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq]
+  tauto
 #align eventually_residual eventually_residual
 
 theorem dense_of_mem_residual {s : Set α} (hs : s ∈ residual α) : Dense s :=
chore: remove uses of cases' (#9171)

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

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

Diff
@@ -195,7 +195,7 @@ theorem dense_iInter_of_isOpen_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/
 theorem dense_sInter_of_isOpen {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by
-  cases' S.eq_empty_or_nonempty with h h
+  rcases S.eq_empty_or_nonempty with h | h
   · simp [h]
   · rcases hS.exists_eq_range h with ⟨f, hf⟩
     have F : ∀ n, f n ∈ S := fun n => by rw [hf]; exact mem_range_self _
chore: rename lemmas containing "of_open" to match the naming convention (#8229)

Mostly, this means replacing "of_open" by "of_isOpen". A few lemmas names were misleading and are corrected differently. Zulip discussion.

Diff
@@ -40,7 +40,7 @@ open EMetric ENNReal
 
 /-- The property `BaireSpace α` means that the topological space `α` has the Baire property:
 any countable intersection of open dense subsets is dense.
-Formulated here when the source space is ℕ (and subsumed below by `dense_iInter_of_open` working
+Formulated here when the source space is ℕ (and subsumed below by `dense_iInter_of_isOpen` working
 with any encodable source space). -/
 class BaireSpace (α : Type*) [TopologicalSpace α] : Prop where
   baire_property : ∀ f : ℕ → Set α, (∀ n, IsOpen (f n)) → (∀ n, Dense (f n)) → Dense (⋂ n, f n)
@@ -187,43 +187,43 @@ instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace
 variable [TopologicalSpace α] [BaireSpace α]
 
 /-- Definition of a Baire space. -/
-theorem dense_iInter_of_open_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) :
-    Dense (⋂ n, f n) :=
+theorem dense_iInter_of_isOpen_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n))
+    (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) :=
   BaireSpace.baire_property f ho hd
-#align dense_Inter_of_open_nat dense_iInter_of_open_nat
+#align dense_Inter_of_open_nat dense_iInter_of_isOpen_nat
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/
-theorem dense_sInter_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
+theorem dense_sInter_of_isOpen {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by
   cases' S.eq_empty_or_nonempty with h h
   · simp [h]
   · rcases hS.exists_eq_range h with ⟨f, hf⟩
     have F : ∀ n, f n ∈ S := fun n => by rw [hf]; exact mem_range_self _
     rw [hf, sInter_range]
-    exact dense_iInter_of_open_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
-#align dense_sInter_of_open dense_sInter_of_open
+    exact dense_iInter_of_isOpen_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
+#align dense_sInter_of_open dense_sInter_of_isOpen
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_biInter_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
+theorem dense_biInter_of_isOpen {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by
   rw [← sInter_image]
-  apply dense_sInter_of_open
+  apply dense_sInter_of_isOpen
   · rwa [ball_image_iff]
   · exact hS.image _
   · rwa [ball_image_iff]
-#align dense_bInter_of_open dense_biInter_of_open
+#align dense_bInter_of_open dense_biInter_of_isOpen
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is an encodable type. -/
-theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
+theorem dense_iInter_of_isOpen [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
     (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) := by
   rw [← sInter_range]
-  apply dense_sInter_of_open
+  apply dense_sInter_of_isOpen
   · rwa [forall_range_iff]
   · exact countable_range _
   · rwa [forall_range_iff]
-#align dense_Inter_of_open dense_iInter_of_open
+#align dense_Inter_of_open dense_iInter_of_isOpen
 
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
 theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t := by
@@ -231,7 +231,7 @@ theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆
   · rw [mem_residual_iff]
     rintro ⟨S, hSo, hSd, Sct, Ss⟩
     refine' ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, _⟩
-    exact dense_sInter_of_open hSo Sct hSd
+    exact dense_sInter_of_isOpen hSo Sct hSd
   rintro ⟨t, ts, ho, hd⟩
   exact mem_of_superset (residual_of_dense_Gδ ho hd) ts
 #align mem_residual mem_residual
@@ -294,10 +294,10 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs :
   let g i := (frontier (f i))ᶜ
   have hgo : ∀ i, IsOpen (g i) := fun i => isClosed_frontier.isOpen_compl
   have hgd : Dense (⋂ i, g i) := by
-    refine' dense_iInter_of_open hgo fun i x => _
+    refine' dense_iInter_of_isOpen hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_open fun i => (hgo i)) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_isOpen fun i => (hgo i)) hgd).mono _
   rintro x ⟨hxs, hxg⟩
   rw [mem_iInter] at hxg
   rcases mem_iUnion.1 (hU hxs) with ⟨i, hi⟩
feat: define weakly locally compact spaces (#6770)
Diff
@@ -48,8 +48,8 @@ class BaireSpace (α : Type*) [TopologicalSpace α] : Prop where
 
 /-- Baire theorems asserts that various topological spaces have the Baire property.
 Two versions of these theorems are given.
-The first states that complete pseudo_emetric spaces are Baire. -/
-instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetricSpace α]
+The first states that complete `PseudoEMetricSpace`s are Baire. -/
+instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace α]
     [CompleteSpace α] : BaireSpace α := by
   refine' ⟨fun f ho hd => _⟩
   let B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n
@@ -143,11 +143,11 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
     exact this (yball (n + 1))
   show edist y x ≤ ε
   exact le_trans (yball 0) (min_le_left _ _)
-#align baire_category_theorem_emetric_complete baire_category_theorem_emetric_complete
+#align baire_category_theorem_emetric_complete BaireSpace.of_pseudoEMetricSpace_completeSpace
 
 /-- The second theorem states that locally compact spaces are Baire. -/
-instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSpace α] [T2Space α]
-    [LocallyCompactSpace α] : BaireSpace α := by
+instance (priority := 100) BaireSpace.of_t2Space_locallyCompactSpace
+    [TopologicalSpace α] [T2Space α] [LocallyCompactSpace α] : BaireSpace α := by
   constructor
   intro f ho hd
   /- To prove that an intersection of open dense subsets is dense, prove that its intersection
@@ -182,7 +182,7 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
       (fun n => (hK_decreasing n).trans (inter_subset_right _ _)) (fun n => (K n).nonempty)
       (K 0).isCompact fun n => (K n).isCompact.isClosed
   exact hK_nonempty.mono hK_subset
-#align baire_category_theorem_locally_compact baire_category_theorem_locally_compact
+#align baire_category_theorem_locally_compact BaireSpace.of_t2Space_locallyCompactSpace
 
 variable [TopologicalSpace α] [BaireSpace α]
 
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
@@ -32,7 +32,7 @@ open Classical Topology Filter ENNReal
 
 open Filter Encodable Set TopologicalSpace
 
-variable {α : Type _} {β : Type _} {γ : Type _} {ι : Type _}
+variable {α : Type*} {β : Type*} {γ : Type*} {ι : Type*}
 
 section BaireTheorem
 
@@ -42,7 +42,7 @@ open EMetric ENNReal
 any countable intersection of open dense subsets is dense.
 Formulated here when the source space is ℕ (and subsumed below by `dense_iInter_of_open` working
 with any encodable source space). -/
-class BaireSpace (α : Type _) [TopologicalSpace α] : Prop where
+class BaireSpace (α : Type*) [TopologicalSpace α] : Prop where
   baire_property : ∀ f : ℕ → Set α, (∀ n, IsOpen (f n)) → (∀ n, Dense (f n)) → Dense (⋂ n, f n)
 #align baire_space BaireSpace
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

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

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module topology.metric_space.baire
-! leanprover-community/mathlib commit b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.SpecificLimits.Basic
 import Mathlib.Order.Filter.CountableInter
@@ -14,6 +9,8 @@ import Mathlib.Topology.GDelta
 import Mathlib.Topology.Sets.Compacts
 import Mathlib.Order.Filter.CountableInter
 
+#align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a"
+
 /-!
 # Baire theorem
 
fix: precedences of ⨆⋃⋂⨅ (#5614)
Diff
@@ -331,7 +331,7 @@ set_option linter.uppercaseLean3 false in
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is a countable set in any type. -/
 theorem dense_biUnion_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
-    (hS : S.Countable) (hU : (⋃ s ∈ S, f s) = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
+    (hS : S.Countable) (hU : ⋃ s ∈ S, f s = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
   isGδ_univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
 #align dense_bUnion_interior_of_closed dense_biUnion_interior_of_closed
 
@@ -345,14 +345,14 @@ theorem dense_sUnion_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, Is
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is an encodable type. -/
 theorem dense_iUnion_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
-    (hU : (⋃ s, f s) = univ) : Dense (⋃ s, interior (f s)) :=
+    (hU : ⋃ s, f s = univ) : Dense (⋃ s, interior (f s)) :=
   isGδ_univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
 #align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
 covers the space, then one of the sets has nonempty interior. -/
 theorem nonempty_interior_of_iUnion_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
-    (hc : ∀ s, IsClosed (f s)) (hU : (⋃ s, f s) = univ) : ∃ s, (interior <| f s).Nonempty := by
+    (hc : ∀ s, IsClosed (f s)) (hU : ⋃ s, f s = univ) : ∃ s, (interior <| f s).Nonempty := by
   simpa using (dense_iUnion_interior_of_closed hc hU).nonempty
 #align nonempty_interior_of_Union_of_closed nonempty_interior_of_iUnion_of_closed
 
fix: change compl precedence (#5586)

Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Diff
@@ -294,7 +294,7 @@ is dense. Formulated here with `⋃`. -/
 theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
     {f : ι → Set α} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) :
     Dense (⋃ i, interior (f i)) := by
-  let g i := frontier (f i)ᶜ
+  let g i := (frontier (f i))ᶜ
   have hgo : ∀ i, IsOpen (g i) := fun i => isClosed_frontier.isOpen_compl
   have hgd : Dense (⋂ i, g i) := by
     refine' dense_iInter_of_open hgo fun i x => _
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -174,7 +174,7 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
   have hK_subset : (⋂ n, (K n).carrier : Set α) ⊆ U ∩ ⋂ n, f n := by
     intro x hx
     simp only [mem_iInter] at hx
-    simp only [mem_inter_iff, mem_inter] at hx⊢
+    simp only [mem_inter_iff, mem_inter] at hx ⊢
     refine' ⟨hK₀ <| hx 0, _⟩
     simp only [mem_iInter]
     exact fun n => (hK_decreasing n (hx (n + 1))).1
chore: formatting issues (#4947)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -229,7 +229,7 @@ theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsO
 #align dense_Inter_of_open dense_iInter_of_open
 
 /-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
-theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _)(_ : t ⊆ s), IsGδ t ∧ Dense t := by
+theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t := by
   constructor
   · rw [mem_residual_iff]
     rintro ⟨S, hSo, hSd, Sct, Ss⟩
chore: forward-port leanprover-community/mathlib#18962 (#4209)

Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module topology.metric_space.baire
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -12,6 +12,7 @@ import Mathlib.Analysis.SpecificLimits.Basic
 import Mathlib.Order.Filter.CountableInter
 import Mathlib.Topology.GDelta
 import Mathlib.Topology.Sets.Compacts
+import Mathlib.Order.Filter.CountableInter
 
 /-!
 # Baire theorem
@@ -24,8 +25,7 @@ intersection of dense Gδ sets is a dense Gδ set. We prove Baire theorem, givin
 formulations that can be handy. We also prove the important consequence that, if the space is
 covered by a countable union of closed sets, then the union of their interiors is dense.
 
-We also define the filter `residual α` generated by dense `Gδ` sets and prove that this filter
-has the countable intersection property.
+We also prove that in Baire spaces, the `residual` sets are exactly those containing a dense Gδ set.
 -/
 
 
@@ -228,25 +228,36 @@ theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsO
   · rwa [forall_range_iff]
 #align dense_Inter_of_open dense_iInter_of_open
 
+/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
+theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _)(_ : t ⊆ s), IsGδ t ∧ Dense t := by
+  constructor
+  · rw [mem_residual_iff]
+    rintro ⟨S, hSo, hSd, Sct, Ss⟩
+    refine' ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, _⟩
+    exact dense_sInter_of_open hSo Sct hSd
+  rintro ⟨t, ts, ho, hd⟩
+  exact mem_of_superset (residual_of_dense_Gδ ho hd) ts
+#align mem_residual mem_residual
+
+/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
+theorem eventually_residual {p : α → Prop} :
+    (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x : α, x ∈ t → p x := by
+  -- this can probably be improved...
+  convert@mem_residual _ _ _ p
+  simp_rw [exists_prop, @and_comm ((_ : Set α) ⊆ p), and_assoc]
+  rfl
+#align eventually_residual eventually_residual
+
+theorem dense_of_mem_residual {s : Set α} (hs : s ∈ residual α) : Dense s :=
+  let ⟨_, hts, _, hd⟩ := mem_residual.1 hs
+  hd.mono hts
+#align dense_of_mem_residual dense_of_mem_residual
+
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/
 theorem dense_sInter_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
-    (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by
-  -- the result follows from the result for a countable intersection of dense open sets,
-  -- by rewriting each set as a countable intersection of open sets, which are of course dense.
-  choose T hTo hTc hsT using ho
-  -- porting note: the commented out term was there before
-  have : ⋂₀ S = ⋂₀ ⋃ s ∈ S, T s ‹_› := by --(sInter_iUnion (fun s hs => (hT s hs).2.2)).symm
-    simp [sInter_iUnion, (hsT _ _).symm, ← sInter_eq_biInter]
-  rw [this]
-  refine' dense_sInter_of_open _ (hS.biUnion hTc) _ <;> simp only [mem_iUnion] <;>
-    rintro t ⟨s, hs, tTs⟩
-  show IsOpen t
-  exact hTo s hs t tTs
-  show Dense t
-  · intro x
-    have := hd s hs x
-    rw [hsT s hs] at this
-    exact closure_mono (sInter_subset_of_mem tTs) this
+    (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) :=
+dense_of_mem_residual ((countable_sInter_mem hS).mpr
+  (fun _ hs => residual_of_dense_Gδ (ho _ hs) (hd _ hs)))
 set_option linter.uppercaseLean3 false in
 #align dense_sInter_of_Gδ dense_sInter_of_Gδ
 
@@ -278,42 +289,6 @@ theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : D
 set_option linter.uppercaseLean3 false in
 #align dense.inter_of_Gδ Dense.inter_of_Gδ
 
-/-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/
-theorem eventually_residual {p : α → Prop} :
-    (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x :=
-  calc
-    (∀ᶠ x in residual α, p x) ↔ ∀ᶠ x in ⨅ (t : Set α) (_ht : IsGδ t ∧ Dense t), 𝓟 t, p x := by
-      simp only [residual, iInf_and]
-    _ ↔ ∃ (t : Set α) (_ : IsGδ t ∧ Dense t), ∀ᶠ x in 𝓟 t, p x := by
-      simp only [exists_prop]
-      apply mem_biInf_of_directed
-      · intro t₁ h₁ t₂ h₂
-        exact ⟨t₁ ∩ t₂, ⟨h₁.1.inter h₂.1, Dense.inter_of_Gδ h₁.1 h₂.1 h₁.2 h₂.2⟩, by simp⟩
-      · exact ⟨univ, isGδ_univ, dense_univ⟩
-    _ ↔ _ := by simp [and_assoc]
-#align eventually_residual eventually_residual
-
-/-- A set is residual (comeagre) if and only if it includes a dense `Gδ` set. -/
-theorem mem_residual {s : Set α} : s ∈ residual α ↔ ∃ (t : _) (_ : t ⊆ s), IsGδ t ∧ Dense t :=
-  (eventually_residual (p := fun x => x ∈ s)).trans <|
-    exists_congr fun t => by rw [exists_prop, and_comm (a := t ⊆ s), subset_def, and_assoc]
-#align mem_residual mem_residual
-
-theorem dense_of_mem_residual {s : Set α} (hs : s ∈ residual α) : Dense s :=
-  let ⟨_, hts, _, hd⟩ := mem_residual.1 hs
-  hd.mono hts
-#align dense_of_mem_residual dense_of_mem_residual
-
-instance : CountableInterFilter (residual α) := ⟨by
-  intro S hSc hS
-  simp only [mem_residual] at *
-  choose T hTs hT using hS
-  refine' ⟨⋂ s ∈ S, T s ‹_›, _, _, _⟩
-  · rw [sInter_eq_biInter]
-    exact iInter₂_mono hTs
-  · exact isGδ_biInter hSc fun s hs => (hT s hs).1
-  · exact dense_biInter_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
-
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃`. -/
 theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
@@ -325,7 +300,7 @@ theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs :
     refine' dense_iInter_of_open hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_iInter fun i => (hgo i).isGδ) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (isGδ_iInter_of_open fun i => (hgo i)) hgd).mono _
   rintro x ⟨hxs, hxg⟩
   rw [mem_iInter] at hxg
   rcases mem_iUnion.1 (hU hxs) with ⟨i, hi⟩
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
@@ -43,7 +43,7 @@ open EMetric ENNReal
 
 /-- The property `BaireSpace α` means that the topological space `α` has the Baire property:
 any countable intersection of open dense subsets is dense.
-Formulated here when the source space is ℕ (and subsumed below by `dense_interᵢ_of_open` working
+Formulated here when the source space is ℕ (and subsumed below by `dense_iInter_of_open` working
 with any encodable source space). -/
 class BaireSpace (α : Type _) [TopologicalSpace α] : Prop where
   baire_property : ∀ f : ℕ → Set α, (∀ n, IsOpen (f n)) → (∀ n, Dense (f n)) → Dense (⋂ n, f n)
@@ -127,7 +127,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
   -- this point `y` will be the desired point. We will check that it belongs to all
   -- `f n` and to `ball x ε`.
   use y
-  simp only [exists_prop, Set.mem_interᵢ]
+  simp only [exists_prop, Set.mem_iInter]
   have I : ∀ n, ∀ m ≥ n, closedBall (c m) (r m) ⊆ closedBall (c n) (r n) := by
     intro n
     refine' Nat.le_induction _ fun m _ h => _
@@ -173,15 +173,15 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
   -- Prove that ̀`⋂ n : ℕ, K n` is inside `U ∩ ⋂ n : ℕ, f n`.
   have hK_subset : (⋂ n, (K n).carrier : Set α) ⊆ U ∩ ⋂ n, f n := by
     intro x hx
-    simp only [mem_interᵢ] at hx
+    simp only [mem_iInter] at hx
     simp only [mem_inter_iff, mem_inter] at hx⊢
     refine' ⟨hK₀ <| hx 0, _⟩
-    simp only [mem_interᵢ]
+    simp only [mem_iInter]
     exact fun n => (hK_decreasing n (hx (n + 1))).1
   /- Prove that `⋂ n : ℕ, K n` is not empty, as an intersection of a decreasing sequence
     of nonempty compact subsets. -/
   have hK_nonempty : (⋂ n, (K n).carrier : Set α).Nonempty :=
-    IsCompact.nonempty_interᵢ_of_sequence_nonempty_compact_closed _
+    IsCompact.nonempty_iInter_of_sequence_nonempty_compact_closed _
       (fun n => (hK_decreasing n).trans (inter_subset_right _ _)) (fun n => (K n).nonempty)
       (K 0).isCompact fun n => (K n).isCompact.isClosed
   exact hK_nonempty.mono hK_subset
@@ -190,55 +190,55 @@ instance (priority := 100) baire_category_theorem_locally_compact [TopologicalSp
 variable [TopologicalSpace α] [BaireSpace α]
 
 /-- Definition of a Baire space. -/
-theorem dense_interᵢ_of_open_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) :
+theorem dense_iInter_of_open_nat {f : ℕ → Set α} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) :
     Dense (⋂ n, f n) :=
   BaireSpace.baire_property f ho hd
-#align dense_Inter_of_open_nat dense_interᵢ_of_open_nat
+#align dense_Inter_of_open_nat dense_iInter_of_open_nat
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with ⋂₀. -/
-theorem dense_interₛ_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
+theorem dense_sInter_of_open {S : Set (Set α)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by
   cases' S.eq_empty_or_nonempty with h h
   · simp [h]
   · rcases hS.exists_eq_range h with ⟨f, hf⟩
     have F : ∀ n, f n ∈ S := fun n => by rw [hf]; exact mem_range_self _
-    rw [hf, interₛ_range]
-    exact dense_interᵢ_of_open_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
-#align dense_sInter_of_open dense_interₛ_of_open
+    rw [hf, sInter_range]
+    exact dense_iInter_of_open_nat (fun n => ho _ (F n)) fun n => hd _ (F n)
+#align dense_sInter_of_open dense_sInter_of_open
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_binterᵢ_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
+theorem dense_biInter_of_open {S : Set β} {f : β → Set α} (ho : ∀ s ∈ S, IsOpen (f s))
     (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by
-  rw [← interₛ_image]
-  apply dense_interₛ_of_open
+  rw [← sInter_image]
+  apply dense_sInter_of_open
   · rwa [ball_image_iff]
   · exact hS.image _
   · rwa [ball_image_iff]
-#align dense_bInter_of_open dense_binterᵢ_of_open
+#align dense_bInter_of_open dense_biInter_of_open
 
 /-- Baire theorem: a countable intersection of dense open sets is dense. Formulated here with
 an index set which is an encodable type. -/
-theorem dense_interᵢ_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
+theorem dense_iInter_of_open [Encodable β] {f : β → Set α} (ho : ∀ s, IsOpen (f s))
     (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) := by
-  rw [← interₛ_range]
-  apply dense_interₛ_of_open
+  rw [← sInter_range]
+  apply dense_sInter_of_open
   · rwa [forall_range_iff]
   · exact countable_range _
   · rwa [forall_range_iff]
-#align dense_Inter_of_open dense_interᵢ_of_open
+#align dense_Inter_of_open dense_iInter_of_open
 
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with ⋂₀. -/
-theorem dense_interₛ_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
+theorem dense_sInter_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS : S.Countable)
     (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by
   -- the result follows from the result for a countable intersection of dense open sets,
   -- by rewriting each set as a countable intersection of open sets, which are of course dense.
   choose T hTo hTc hsT using ho
   -- porting note: the commented out term was there before
-  have : ⋂₀ S = ⋂₀ ⋃ s ∈ S, T s ‹_› := by --(interₛ_unionᵢ (fun s hs => (hT s hs).2.2)).symm
-    simp [interₛ_unionᵢ, (hsT _ _).symm, ← interₛ_eq_binterᵢ]
+  have : ⋂₀ S = ⋂₀ ⋃ s ∈ S, T s ‹_› := by --(sInter_iUnion (fun s hs => (hT s hs).2.2)).symm
+    simp [sInter_iUnion, (hsT _ _).symm, ← sInter_eq_biInter]
   rw [this]
-  refine' dense_interₛ_of_open _ (hS.bunionᵢ hTc) _ <;> simp only [mem_unionᵢ] <;>
+  refine' dense_sInter_of_open _ (hS.biUnion hTc) _ <;> simp only [mem_iUnion] <;>
     rintro t ⟨s, hs, tTs⟩
   show IsOpen t
   exact hTo s hs t tTs
@@ -246,35 +246,35 @@ theorem dense_interₛ_of_Gδ {S : Set (Set α)} (ho : ∀ s ∈ S, IsGδ s) (hS
   · intro x
     have := hd s hs x
     rw [hsT s hs] at this
-    exact closure_mono (interₛ_subset_of_mem tTs) this
+    exact closure_mono (sInter_subset_of_mem tTs) this
 set_option linter.uppercaseLean3 false in
-#align dense_sInter_of_Gδ dense_interₛ_of_Gδ
+#align dense_sInter_of_Gδ dense_sInter_of_Gδ
 
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is an encodable type. -/
-theorem dense_interᵢ_of_Gδ [Encodable β] {f : β → Set α} (ho : ∀ s, IsGδ (f s))
+theorem dense_iInter_of_Gδ [Encodable β] {f : β → Set α} (ho : ∀ s, IsGδ (f s))
     (hd : ∀ s, Dense (f s)) : Dense (⋂ s, f s) := by
-  rw [← interₛ_range]
-  exact dense_interₛ_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
+  rw [← sInter_range]
+  exact dense_sInter_of_Gδ (forall_range_iff.2 ‹_›) (countable_range _) (forall_range_iff.2 ‹_›)
 set_option linter.uppercaseLean3 false in
-#align dense_Inter_of_Gδ dense_interᵢ_of_Gδ
+#align dense_Inter_of_Gδ dense_iInter_of_Gδ
 
 -- Porting note: In `ho` and `hd`, changed `∀ s ∈ S` to `∀ s (H : s ∈ S)`
 /-- Baire theorem: a countable intersection of dense Gδ sets is dense. Formulated here with
 an index set which is a countable set in any type. -/
-theorem dense_binterᵢ_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s (H : s ∈ S), IsGδ (f s H))
+theorem dense_biInter_of_Gδ {S : Set β} {f : ∀ x ∈ S, Set α} (ho : ∀ s (H : s ∈ S), IsGδ (f s H))
     (hS : S.Countable) (hd : ∀ s (H : s ∈ S), Dense (f s H)) : Dense (⋂ s ∈ S, f s ‹_›) := by
-  rw [binterᵢ_eq_interᵢ]
+  rw [biInter_eq_iInter]
   haveI := hS.toEncodable
-  exact dense_interᵢ_of_Gδ (fun s => ho s s.2) fun s => hd s s.2
+  exact dense_iInter_of_Gδ (fun s => ho s s.2) fun s => hd s s.2
 set_option linter.uppercaseLean3 false in
-#align dense_bInter_of_Gδ dense_binterᵢ_of_Gδ
+#align dense_bInter_of_Gδ dense_biInter_of_Gδ
 
 /-- Baire theorem: the intersection of two dense Gδ sets is dense. -/
 theorem Dense.inter_of_Gδ {s t : Set α} (hs : IsGδ s) (ht : IsGδ t) (hsc : Dense s)
     (htc : Dense t) : Dense (s ∩ t) := by
-  rw [inter_eq_interᵢ]
-  apply dense_interᵢ_of_Gδ <;> simp [Bool.forall_bool, *]
+  rw [inter_eq_iInter]
+  apply dense_iInter_of_Gδ <;> simp [Bool.forall_bool, *]
 set_option linter.uppercaseLean3 false in
 #align dense.inter_of_Gδ Dense.inter_of_Gδ
 
@@ -283,10 +283,10 @@ theorem eventually_residual {p : α → Prop} :
     (∀ᶠ x in residual α, p x) ↔ ∃ t : Set α, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x :=
   calc
     (∀ᶠ x in residual α, p x) ↔ ∀ᶠ x in ⨅ (t : Set α) (_ht : IsGδ t ∧ Dense t), 𝓟 t, p x := by
-      simp only [residual, infᵢ_and]
+      simp only [residual, iInf_and]
     _ ↔ ∃ (t : Set α) (_ : IsGδ t ∧ Dense t), ∀ᶠ x in 𝓟 t, p x := by
       simp only [exists_prop]
-      apply mem_binfᵢ_of_directed
+      apply mem_biInf_of_directed
       · intro t₁ h₁ t₂ h₂
         exact ⟨t₁ ∩ t₂, ⟨h₁.1.inter h₂.1, Dense.inter_of_Gδ h₁.1 h₂.1 h₁.2 h₂.2⟩, by simp⟩
       · exact ⟨univ, isGδ_univ, dense_univ⟩
@@ -309,76 +309,76 @@ instance : CountableInterFilter (residual α) := ⟨by
   simp only [mem_residual] at *
   choose T hTs hT using hS
   refine' ⟨⋂ s ∈ S, T s ‹_›, _, _, _⟩
-  · rw [interₛ_eq_binterᵢ]
-    exact interᵢ₂_mono hTs
-  · exact isGδ_binterᵢ hSc fun s hs => (hT s hs).1
-  · exact dense_binterᵢ_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
+  · rw [sInter_eq_biInter]
+    exact iInter₂_mono hTs
+  · exact isGδ_biInter hSc fun s hs => (hT s hs).1
+  · exact dense_biInter_of_Gδ (fun s hs => (hT s hs).1) hSc fun s hs => (hT s hs).2⟩
 
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃`. -/
-theorem IsGδ.dense_unionᵢ_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
+theorem IsGδ.dense_iUnion_interior_of_closed [Encodable ι] {s : Set α} (hs : IsGδ s) (hd : Dense s)
     {f : ι → Set α} (hc : ∀ i, IsClosed (f i)) (hU : s ⊆ ⋃ i, f i) :
     Dense (⋃ i, interior (f i)) := by
   let g i := frontier (f i)ᶜ
   have hgo : ∀ i, IsOpen (g i) := fun i => isClosed_frontier.isOpen_compl
   have hgd : Dense (⋂ i, g i) := by
-    refine' dense_interᵢ_of_open hgo fun i x => _
+    refine' dense_iInter_of_open hgo fun i x => _
     rw [closure_compl, interior_frontier (hc _)]
     exact id
-  refine' (hd.inter_of_Gδ hs (isGδ_interᵢ fun i => (hgo i).isGδ) hgd).mono _
+  refine' (hd.inter_of_Gδ hs (isGδ_iInter fun i => (hgo i).isGδ) hgd).mono _
   rintro x ⟨hxs, hxg⟩
-  rw [mem_interᵢ] at hxg
-  rcases mem_unionᵢ.1 (hU hxs) with ⟨i, hi⟩
-  exact mem_unionᵢ.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
+  rw [mem_iInter] at hxg
+  rcases mem_iUnion.1 (hU hxs) with ⟨i, hi⟩
+  exact mem_iUnion.2 ⟨i, self_diff_frontier (f i) ▸ ⟨hi, hxg _⟩⟩
 set_option linter.uppercaseLean3 false in
-#align is_Gδ.dense_Union_interior_of_closed IsGδ.dense_unionᵢ_interior_of_closed
+#align is_Gδ.dense_Union_interior_of_closed IsGδ.dense_iUnion_interior_of_closed
 
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with a union over a countable set in any type. -/
-theorem IsGδ.dense_bunionᵢ_interior_of_closed {t : Set ι} {s : Set α} (hs : IsGδ s) (hd : Dense s)
+theorem IsGδ.dense_biUnion_interior_of_closed {t : Set ι} {s : Set α} (hs : IsGδ s) (hd : Dense s)
     (ht : t.Countable) {f : ι → Set α} (hc : ∀ i ∈ t, IsClosed (f i)) (hU : s ⊆ ⋃ i ∈ t, f i) :
     Dense (⋃ i ∈ t, interior (f i)) := by
   haveI := ht.toEncodable
-  simp only [bunionᵢ_eq_unionᵢ, SetCoe.forall'] at *
-  exact hs.dense_unionᵢ_interior_of_closed hd hc hU
+  simp only [biUnion_eq_iUnion, SetCoe.forall'] at *
+  exact hs.dense_iUnion_interior_of_closed hd hc hU
 set_option linter.uppercaseLean3 false in
-#align is_Gδ.dense_bUnion_interior_of_closed IsGδ.dense_bunionᵢ_interior_of_closed
+#align is_Gδ.dense_bUnion_interior_of_closed IsGδ.dense_biUnion_interior_of_closed
 
 /-- If a countable family of closed sets cover a dense `Gδ` set, then the union of their interiors
 is dense. Formulated here with `⋃₀`. -/
-theorem IsGδ.dense_unionₛ_interior_of_closed {T : Set (Set α)} {s : Set α} (hs : IsGδ s)
+theorem IsGδ.dense_sUnion_interior_of_closed {T : Set (Set α)} {s : Set α} (hs : IsGδ s)
     (hd : Dense s) (hc : T.Countable) (hc' : ∀ t ∈ T, IsClosed t) (hU : s ⊆ ⋃₀ T) :
     Dense (⋃ t ∈ T, interior t) :=
-  hs.dense_bunionᵢ_interior_of_closed hd hc hc' <| by rwa [← unionₛ_eq_bunionᵢ]
+  hs.dense_biUnion_interior_of_closed hd hc hc' <| by rwa [← sUnion_eq_biUnion]
 set_option linter.uppercaseLean3 false in
-#align is_Gδ.dense_sUnion_interior_of_closed IsGδ.dense_unionₛ_interior_of_closed
+#align is_Gδ.dense_sUnion_interior_of_closed IsGδ.dense_sUnion_interior_of_closed
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is a countable set in any type. -/
-theorem dense_bunionᵢ_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
+theorem dense_biUnion_interior_of_closed {S : Set β} {f : β → Set α} (hc : ∀ s ∈ S, IsClosed (f s))
     (hS : S.Countable) (hU : (⋃ s ∈ S, f s) = univ) : Dense (⋃ s ∈ S, interior (f s)) :=
-  isGδ_univ.dense_bunionᵢ_interior_of_closed dense_univ hS hc hU.ge
-#align dense_bUnion_interior_of_closed dense_bunionᵢ_interior_of_closed
+  isGδ_univ.dense_biUnion_interior_of_closed dense_univ hS hc hU.ge
+#align dense_bUnion_interior_of_closed dense_biUnion_interior_of_closed
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with `⋃₀`. -/
-theorem dense_unionₛ_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, IsClosed s)
+theorem dense_sUnion_interior_of_closed {S : Set (Set α)} (hc : ∀ s ∈ S, IsClosed s)
     (hS : S.Countable) (hU : ⋃₀ S = univ) : Dense (⋃ s ∈ S, interior s) :=
-  isGδ_univ.dense_unionₛ_interior_of_closed dense_univ hS hc hU.ge
-#align dense_sUnion_interior_of_closed dense_unionₛ_interior_of_closed
+  isGδ_univ.dense_sUnion_interior_of_closed dense_univ hS hc hU.ge
+#align dense_sUnion_interior_of_closed dense_sUnion_interior_of_closed
 
 /-- Baire theorem: if countably many closed sets cover the whole space, then their interiors
 are dense. Formulated here with an index set which is an encodable type. -/
-theorem dense_unionᵢ_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
+theorem dense_iUnion_interior_of_closed [Encodable β] {f : β → Set α} (hc : ∀ s, IsClosed (f s))
     (hU : (⋃ s, f s) = univ) : Dense (⋃ s, interior (f s)) :=
-  isGδ_univ.dense_unionᵢ_interior_of_closed dense_univ hc hU.ge
-#align dense_Union_interior_of_closed dense_unionᵢ_interior_of_closed
+  isGδ_univ.dense_iUnion_interior_of_closed dense_univ hc hU.ge
+#align dense_Union_interior_of_closed dense_iUnion_interior_of_closed
 
 /-- One of the most useful consequences of Baire theorem: if a countable union of closed sets
 covers the space, then one of the sets has nonempty interior. -/
-theorem nonempty_interior_of_unionᵢ_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
+theorem nonempty_interior_of_iUnion_of_closed [Nonempty α] [Encodable β] {f : β → Set α}
     (hc : ∀ s, IsClosed (f s)) (hU : (⋃ s, f s) = univ) : ∃ s, (interior <| f s).Nonempty := by
-  simpa using (dense_unionᵢ_interior_of_closed hc hU).nonempty
-#align nonempty_interior_of_Union_of_closed nonempty_interior_of_unionᵢ_of_closed
+  simpa using (dense_iUnion_interior_of_closed hc hU).nonempty
+#align nonempty_interior_of_Union_of_closed nonempty_interior_of_iUnion_of_closed
 
 end BaireTheorem
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -64,8 +64,7 @@ instance (priority := 100) baire_category_theorem_emetric_complete [PseudoEMetri
     to any n, x, δ, δpos a center and a positive radius such that
     `closedBall center radius` is included both in `f n` and in `closedBall x δ`.
     We can also require `radius ≤ (1/2)^(n+1)`, to ensure we get a Cauchy sequence later. -/
-  have : ∀ n x δ, δ ≠ 0 → ∃ y r, 0 < r ∧ r ≤ B (n + 1) ∧ closedBall y r ⊆ closedBall x δ ∩ f n :=
-    by
+  have : ∀ n x δ, δ ≠ 0 → ∃ y r, 0 < r ∧ r ≤ B (n + 1) ∧ closedBall y r ⊆ closedBall x δ ∩ f n := by
     intro n x δ δpos
     have : x ∈ closure (f n) := hd n x
     rcases EMetric.mem_closure_iff.1 this (δ / 2) (ENNReal.half_pos δpos) with ⟨y, ys, xy⟩
feat: port Topology.MetricSpace.Baire (#3315)

Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: int-y1 <jason_yuen2007@hotmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Dependencies 10 + 603

604 files ported (98.4%)
263307 lines ported (98.0%)
Show graph

The unported dependencies are

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