topology.perfectMathlib.Topology.MetricSpace.Perfect

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

doc(measure_theory): Fix some names and docstrings (#18910)

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

Diff
@@ -19,8 +19,6 @@ including a version of the Cantor-Bendixson Theorem.
 
 * `perfect C`: A set `C` is perfect, meaning it is closed and every point of it
   is an accumulation point of itself.
-* `set.scheme β α`: A `β`-scheme on `α`, a collection of subsets of `α` indexed by `list β`.
-  Used to construct maps `(β → ℕ) → α` as limiting objects.
 
 ## Main Statements
 
@@ -30,7 +28,7 @@ including a version of the Cantor-Bendixson Theorem.
 * `exists_countable_union_perfect_of_is_closed`: One version of the **Cantor-Bendixson Theorem**:
   A closed set in a second countable space can be written as the union of a countable set and a
   perfect set.
-* `exists_nat_bool_injection_of_perfect_nonempty`: A perfect nonempty set in a complete metric space
+* `perfect.exists_nat_bool_injection`: A perfect nonempty set in a complete metric space
   admits an embedding from the Cantor space.
 
 ## Implementation Notes

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(measure_theory/constructions): add the Borel isomorphism theorem. (#18864)

Add a file measure_theory/constructions/borel_isomorphism.lean with several versions of the Borel isomorphism theorem. Also add fairly small supporting lemmas in several other files. Most notable here is the addition of a type class for measurable_spaces whose sigma-algebras are generated by some countable set, and a theorem that such spaces admit measurable injections to the Cantor space.

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

Diff
@@ -3,8 +3,7 @@ Copyright (c) 2022 Felix Weilacher. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 -/
-import topology.separation
-import topology.bases
+import topology.metric_space.polish
 import topology.metric_space.cantor_scheme
 
 /-!
@@ -223,7 +222,7 @@ end
 end kernel
 end basic
 
-section cantor_inj
+section cantor_inj_metric
 
 open function
 open_locale ennreal
@@ -324,4 +323,16 @@ begin
   simpa only [← subtype.val_inj] using hdisj'.map_injective hxy,
 end
 
-end cantor_inj
+end cantor_inj_metric
+
+/-- Any closed uncountable subset of a Polish space admits a continuous injection
+from the Cantor space `ℕ → bool`.-/
+theorem is_closed.exists_nat_bool_injection_of_not_countable {α : Type*}
+  [topological_space α] [polish_space α] {C : set α} (hC : is_closed C) (hunc : ¬ C.countable) :
+  ∃ f : (ℕ → bool) → α, (range f) ⊆ C ∧ continuous f ∧ function.injective f :=
+begin
+  letI := upgrade_polish_space α,
+  obtain ⟨D, hD, Dnonempty, hDC⟩ := exists_perfect_nonempty_of_is_closed_of_not_countable hC hunc,
+  obtain ⟨f, hfD, hf⟩ := hD.exists_nat_bool_injection Dnonempty,
+  exact ⟨f, hfD.trans hDC, hf⟩,
+end

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(topology/perfect): Schemes, embedding of the Cantor space (#18248)

Add to topology.perfect the following theorem: In a complete metric space, any nonempty perfect set admits a continuous embedding of the Cantor space.

The proof uses an object which in descriptive set theory is sometimes called a "scheme". Some attempt was made to include in topology.metric_space.cantor_scheme a general theory of these schemes, since they should be useful down the line in other results as well.

We also define pi_nat.res in topology.metric_space.pi_nat.

Diff
@@ -5,6 +5,7 @@ Authors: Felix Weilacher
 -/
 import topology.separation
 import topology.bases
+import topology.metric_space.cantor_scheme
 
 /-!
 # Perfect Sets
@@ -19,6 +20,8 @@ including a version of the Cantor-Bendixson Theorem.
 
 * `perfect C`: A set `C` is perfect, meaning it is closed and every point of it
   is an accumulation point of itself.
+* `set.scheme β α`: A `β`-scheme on `α`, a collection of subsets of `α` indexed by `list β`.
+  Used to construct maps `(β → ℕ) → α` as limiting objects.
 
 ## Main Statements
 
@@ -28,6 +31,8 @@ including a version of the Cantor-Bendixson Theorem.
 * `exists_countable_union_perfect_of_is_closed`: One version of the **Cantor-Bendixson Theorem**:
   A closed set in a second countable space can be written as the union of a countable set and a
   perfect set.
+* `exists_nat_bool_injection_of_perfect_nonempty`: A perfect nonempty set in a complete metric space
+  admits an embedding from the Cantor space.
 
 ## Implementation Notes
 
@@ -39,17 +44,19 @@ see `preperfect_iff_perfect_closure`.
 
 ## References
 
-* [kechris1995] (Chapter 6)
+* [kechris1995] (Chapters 6-7)
 
 ## Tags
 
-accumulation point, perfect set, Cantor-Bendixson.
+accumulation point, perfect set, cantor-bendixson.
 
 -/
 
 open_locale topology filter
 open topological_space filter set
 
+section basic
+
 variables {α : Type*} [topological_space α] {C : set α}
 
 /-- If `x` is an accumulation point of a set `C` and `U` is a neighborhood of `x`,
@@ -214,3 +221,107 @@ begin
 end
 
 end kernel
+end basic
+
+section cantor_inj
+
+open function
+open_locale ennreal
+variables {α : Type*} [metric_space α] {C : set α} (hC : perfect C) {ε : ℝ≥0∞}
+include hC
+
+private lemma perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C) :
+  let D := closure (emetric.ball x (ε / 2) ∩ C) in
+  perfect D ∧ D.nonempty ∧ D ⊆ C ∧ emetric.diam D ≤ ε :=
+begin
+  have : x ∈ (emetric.ball x (ε / 2)),
+  { apply emetric.mem_ball_self,
+    rw ennreal.div_pos_iff,
+    exact ⟨ne_of_gt ε_pos, by norm_num⟩, },
+  have := hC.closure_nhds_inter x xC this emetric.is_open_ball,
+  refine ⟨this.1, this.2, _, _⟩,
+  { rw is_closed.closure_subset_iff hC.closed,
+    apply inter_subset_right, },
+  rw emetric.diam_closure,
+  apply le_trans (emetric.diam_mono (inter_subset_left _ _)),
+  convert emetric.diam_ball,
+  rw [mul_comm, ennreal.div_mul_cancel]; norm_num,
+end
+
+variable (hnonempty : C.nonempty)
+include hnonempty
+
+/-- A refinement of `perfect.splitting` for metric spaces, where we also control
+the diameter of the new perfect sets. -/
+lemma perfect.small_diam_splitting (ε_pos : 0 < ε) : ∃ C₀ C₁ : set α,
+  (perfect C₀ ∧ C₀.nonempty ∧ C₀ ⊆ C ∧ emetric.diam C₀ ≤ ε) ∧
+  (perfect C₁ ∧ C₁.nonempty ∧ C₁ ⊆ C ∧ emetric.diam C₁ ≤ ε) ∧ disjoint C₀ C₁ :=
+begin
+  rcases hC.splitting hnonempty with ⟨D₀, D₁, ⟨perf0, non0, sub0⟩, ⟨perf1, non1, sub1⟩, hdisj⟩,
+  cases non0 with x₀ hx₀,
+  cases non1 with x₁ hx₁,
+  rcases perf0.small_diam_aux ε_pos hx₀ with ⟨perf0', non0', sub0', diam0⟩,
+  rcases perf1.small_diam_aux ε_pos hx₁ with ⟨perf1', non1', sub1', diam1⟩,
+  refine ⟨closure (emetric.ball x₀ (ε / 2) ∩ D₀), closure (emetric.ball x₁ (ε / 2) ∩ D₁),
+    ⟨perf0', non0', sub0'.trans sub0, diam0⟩, ⟨perf1', non1', sub1'.trans sub1, diam1⟩, _⟩,
+  apply disjoint.mono _ _ hdisj; assumption,
+end
+
+open cantor_scheme
+
+/-- Any nonempty perfect set in a complete metric space admits a continuous injection
+from the cantor space, `ℕ → bool`. -/
+theorem perfect.exists_nat_bool_injection [complete_space α] :
+  ∃ f : (ℕ → bool) → α, (range f) ⊆ C ∧ continuous f ∧ injective f :=
+begin
+  obtain ⟨u, -, upos', hu⟩ := exists_seq_strict_anti_tendsto' (zero_lt_one' ℝ≥0∞),
+  have upos := λ n, (upos' n).1,
+  let P := subtype (λ E : set α, perfect E ∧ E.nonempty),
+  choose C0 C1 h0 h1 hdisj using λ {C : set α} (hC : perfect C) (hnonempty : C.nonempty)
+    {ε : ℝ≥0∞} (hε : 0 < ε), hC.small_diam_splitting hnonempty hε,
+  let DP : list bool → P := λ l,
+  begin
+    induction l with a l ih, { exact ⟨C, ⟨hC, hnonempty⟩⟩ },
+    cases a,
+    { use C0 ih.property.1 ih.property.2 (upos l.length.succ),
+      exact ⟨(h0 _ _ _).1, (h0 _ _ _).2.1⟩, },
+    use C1 ih.property.1 ih.property.2 (upos l.length.succ),
+    exact ⟨(h1 _ _ _).1, (h1 _ _ _).2.1⟩,
+  end,
+  let D : list bool → set α := λ l, (DP l).val,
+  have hanti : closure_antitone D,
+  { refine antitone.closure_antitone _ (λ l, (DP l).property.1.closed),
+    intros l a,
+    cases a,
+    { exact (h0 _ _ _).2.2.1, },
+    exact (h1 _ _ _).2.2.1, },
+  have hdiam : vanishing_diam D,
+  { intro x,
+    apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu,
+    { simp },
+    rw eventually_at_top,
+    refine ⟨1, λ m (hm : 1 ≤ m), _⟩,
+    rw nat.one_le_iff_ne_zero at hm,
+    rcases nat.exists_eq_succ_of_ne_zero hm with ⟨n, rfl⟩,
+    dsimp,
+    cases (x n),
+    { convert (h0 _ _ _).2.2.2,
+      rw pi_nat.res_length },
+    convert (h1 _ _ _).2.2.2,
+    rw pi_nat.res_length, },
+  have hdisj' : cantor_scheme.disjoint D,
+  { rintros l (a | a) (b | b) hab; try { contradiction },
+    { exact hdisj _ _ _, },
+    exact (hdisj _ _ _).symm, },
+  have hdom : ∀ {x : ℕ → bool}, x ∈ (induced_map D).1 := λ x,
+    by simp [hanti.map_of_vanishing_diam hdiam (λ l, (DP l).property.2)],
+  refine ⟨λ x, (induced_map D).2 ⟨x, hdom⟩, _, _, _⟩,
+  { rintros y ⟨x, rfl⟩,
+    exact map_mem ⟨_, hdom⟩ 0, },
+  { continuity,
+    exact hdiam.map_continuous, },
+  intros x y hxy,
+  simpa only [← subtype.val_inj] using hdisj'.map_injective hxy,
+end
+
+end cantor_inj

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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
@@ -136,7 +136,7 @@ theorem preperfect_iff_perfect_closure [T1Space α] : Preperfect C ↔ Perfect (
   have : ∀ y, y ≠ x ∧ y ∈ closure C → ∃ᶠ z in 𝓝 y, z ≠ x ∧ z ∈ C :=
     by
     rintro y ⟨hyx, yC⟩
-    simp only [← mem_compl_singleton_iff, @and_comm' _ (_ ∈ C), ← frequently_nhdsWithin_iff,
+    simp only [← mem_compl_singleton_iff, @and_comm _ (_ ∈ C), ← frequently_nhdsWithin_iff,
       hyx.nhds_within_compl_singleton, ← mem_closure_iff_frequently]
     exact yC
   rw [← frequently_frequently_nhds]
@@ -172,7 +172,7 @@ theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty
     exact ⟨x, xC.2, hxy⟩
   obtain ⟨U, xU, Uop, V, yV, Vop, hUV⟩ := exists_open_nhds_disjoint_closure hxy
   use closure (U ∩ C), closure (V ∩ C)
-  constructor <;> rw [← and_assoc']
+  constructor <;> rw [← and_assoc]
   · refine' ⟨hC.closure_nhds_inter x xC xU Uop, _⟩
     rw [hC.closed.closure_subset_iff]
     exact inter_subset_right _ _
Diff
@@ -120,7 +120,7 @@ theorem Preperfect.perfect_closure (hC : Preperfect C) : Perfect (closure C) :=
   · exact hC _ h
   have : {x}ᶜ ∩ C = C := by simp [h]
   rw [AccPt, nhdsWithin, inf_assoc, inf_principal, this]
-  rw [closure_eq_cluster_pts] at hx 
+  rw [closure_eq_cluster_pts] at hx
   exact hx
 #align preperfect.perfect_closure Preperfect.perfect_closure
 -/
@@ -167,7 +167,7 @@ theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty
   obtain ⟨x, xC, hxy⟩ : ∃ x ∈ C, x ≠ y :=
     by
     have := hC.acc _ yC
-    rw [accPt_iff_nhds] at this 
+    rw [accPt_iff_nhds] at this
     rcases this univ univ_mem with ⟨x, xC, hxy⟩
     exact ⟨x, xC.2, hxy⟩
   obtain ⟨U, xU, Uop, V, yV, Vop, hUV⟩ := exists_open_nhds_disjoint_closure hxy
@@ -223,7 +223,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
       apply xD.2
       exact mem_bUnion this xU
     by_contra h
-    push_neg at h 
+    push_neg at h
     exact absurd (countable.mono h (Set.countable_singleton _)) this
   · rw [inter_comm, inter_union_diff]
 #align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosed
@@ -239,8 +239,8 @@ theorem exists_perfect_nonempty_of_isClosed_of_not_countable [SecondCountableTop
   constructor
   · rw [nonempty_iff_ne_empty]
     by_contra
-    rw [h, union_empty] at VD 
-    rw [VD] at hunc 
+    rw [h, union_empty] at VD
+    rw [VD] at hunc
     contradiction
   rw [VD]
   exact subset_union_right _ _
@@ -334,7 +334,7 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
     · simp
     rw [eventually_at_top]
     refine' ⟨1, fun m (hm : 1 ≤ m) => _⟩
-    rw [Nat.one_le_iff_ne_zero] at hm 
+    rw [Nat.one_le_iff_ne_zero] at hm
     rcases Nat.exists_eq_succ_of_ne_zero hm with ⟨n, rfl⟩
     dsimp
     cases x n
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2022 Felix Weilacher. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 -/
-import Mathbin.Topology.MetricSpace.Polish
-import Mathbin.Topology.MetricSpace.CantorScheme
+import Topology.MetricSpace.Polish
+import Topology.MetricSpace.CantorScheme
 
 #align_import topology.perfect from "leanprover-community/mathlib"@"3905fa80e62c0898131285baab35559fbc4e5cda"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Felix Weilacher. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
-
-! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 3905fa80e62c0898131285baab35559fbc4e5cda
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Topology.MetricSpace.Polish
 import Mathbin.Topology.MetricSpace.CantorScheme
 
+#align_import topology.perfect from "leanprover-community/mathlib"@"3905fa80e62c0898131285baab35559fbc4e5cda"
+
 /-!
 # Perfect Sets
 
Diff
@@ -63,6 +63,7 @@ section Basic
 
 variable {α : Type _} [TopologicalSpace α] {C : Set α}
 
+#print AccPt.nhds_inter /-
 /-- If `x` is an accumulation point of a set `C` and `U` is a neighborhood of `x`,
 then `x` is an accumulation point of `U ∩ C`. -/
 theorem AccPt.nhds_inter {x : α} {U : Set α} (h_acc : AccPt x (𝓟 C)) (hU : U ∈ 𝓝 x) :
@@ -74,6 +75,7 @@ theorem AccPt.nhds_inter {x : α} {U : Set α} (h_acc : AccPt x (𝓟 C)) (hU :
   rw [AccPt, ← inf_principal, ← inf_assoc, inf_of_le_left this]
   exact h_acc
 #align acc_pt.nhds_inter AccPt.nhds_inter
+-/
 
 #print Preperfect /-
 /-- A set `C` is preperfect if all of its points are accumulation points of itself.
@@ -94,10 +96,13 @@ structure Perfect (C : Set α) : Prop where
 #align perfect Perfect
 -/
 
+#print preperfect_iff_nhds /-
 theorem preperfect_iff_nhds : Preperfect C ↔ ∀ x ∈ C, ∀ U ∈ 𝓝 x, ∃ y ∈ U ∩ C, y ≠ x := by
   simp only [Preperfect, accPt_iff_nhds]
 #align preperfect_iff_nhds preperfect_iff_nhds
+-/
 
+#print Preperfect.open_inter /-
 /-- The intersection of a preperfect set and an open set is preperfect-/
 theorem Preperfect.open_inter {U : Set α} (hC : Preperfect C) (hU : IsOpen U) :
     Preperfect (U ∩ C) := by
@@ -105,6 +110,7 @@ theorem Preperfect.open_inter {U : Set α} (hC : Preperfect C) (hU : IsOpen U) :
   apply (hC _ xC).nhds_inter
   exact hU.mem_nhds xU
 #align preperfect.open_inter Preperfect.open_inter
+-/
 
 #print Preperfect.perfect_closure /-
 /-- The closure of a preperfect set is perfect.
@@ -141,6 +147,7 @@ theorem preperfect_iff_perfect_closure [T1Space α] : Preperfect C ↔ Perfect (
 #align preperfect_iff_perfect_closure preperfect_iff_perfect_closure
 -/
 
+#print Perfect.closure_nhds_inter /-
 theorem Perfect.closure_nhds_inter {U : Set α} (hC : Perfect C) (x : α) (xC : x ∈ C) (xU : x ∈ U)
     (Uop : IsOpen U) : Perfect (closure (U ∩ C)) ∧ (closure (U ∩ C)).Nonempty :=
   by
@@ -150,7 +157,9 @@ theorem Perfect.closure_nhds_inter {U : Set α} (hC : Perfect C) (x : α) (xC :
   apply nonempty.closure
   exact ⟨x, ⟨xU, xC⟩⟩
 #align perfect.closure_nhds_inter Perfect.closure_nhds_inter
+-/
 
+#print Perfect.splitting /-
 /-- Given a perfect nonempty set in a T2.5 space, we can find two disjoint perfect subsets
 This is the main inductive step in the proof of the Cantor-Bendixson Theorem-/
 theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty) :
@@ -176,9 +185,11 @@ theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty
     exact inter_subset_right _ _
   apply Disjoint.mono _ _ hUV <;> apply closure_mono <;> exact inter_subset_left _ _
 #align perfect.splitting Perfect.splitting
+-/
 
 section Kernel
 
+#print exists_countable_union_perfect_of_isClosed /-
 /-- The **Cantor-Bendixson Theorem**: Any closed subset of a second countable space
 can be written as the union of a countable set and a perfect set.-/
 theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
@@ -219,6 +230,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
     exact absurd (countable.mono h (Set.countable_singleton _)) this
   · rw [inter_comm, inter_union_diff]
 #align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosed
+-/
 
 #print exists_perfect_nonempty_of_isClosed_of_not_countable /-
 /-- Any uncountable closed set in a second countable space contains a nonempty perfect subset.-/
@@ -250,8 +262,6 @@ open scoped ENNReal
 
 variable {α : Type _} [MetricSpace α] {C : Set α} (hC : Perfect C) {ε : ℝ≥0∞}
 
-include hC
-
 private theorem perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C) :
     let D := closure (EMetric.ball x (ε / 2) ∩ C)
     Perfect D ∧ D.Nonempty ∧ D ⊆ C ∧ EMetric.diam D ≤ ε :=
@@ -272,8 +282,7 @@ private theorem perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C)
 
 variable (hnonempty : C.Nonempty)
 
-include hnonempty
-
+#print Perfect.small_diam_splitting /-
 /-- A refinement of `perfect.splitting` for metric spaces, where we also control
 the diameter of the new perfect sets. -/
 theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
@@ -291,9 +300,11 @@ theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
       ⟨perf0', non0', sub0'.trans sub0, diam0⟩, ⟨perf1', non1', sub1'.trans sub1, diam1⟩, _⟩
   apply Disjoint.mono _ _ hdisj <;> assumption
 #align perfect.small_diam_splitting Perfect.small_diam_splitting
+-/
 
 open CantorScheme
 
+#print Perfect.exists_nat_bool_injection /-
 /-- Any nonempty perfect set in a complete metric space admits a continuous injection
 from the cantor space, `ℕ → bool`. -/
 theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
@@ -349,9 +360,11 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
   intro x y hxy
   simpa only [← Subtype.val_inj] using hdisj'.map_injective hxy
 #align perfect.exists_nat_bool_injection Perfect.exists_nat_bool_injection
+-/
 
 end CantorInjMetric
 
+#print IsClosed.exists_nat_bool_injection_of_not_countable /-
 /-- Any closed uncountable subset of a Polish space admits a continuous injection
 from the Cantor space `ℕ → bool`.-/
 theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type _} [TopologicalSpace α]
@@ -363,4 +376,5 @@ theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type _} [Topol
   obtain ⟨f, hfD, hf⟩ := hD.exists_nat_bool_injection Dnonempty
   exact ⟨f, hfD.trans hDC, hf⟩
 #align is_closed.exists_nat_bool_injection_of_not_countable IsClosed.exists_nat_bool_injection_of_not_countable
+-/
 
Diff
@@ -185,7 +185,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
     (hclosed : IsClosed C) : ∃ V D : Set α, V.Countable ∧ Perfect D ∧ C = V ∪ D :=
   by
   obtain ⟨b, bct, bnontrivial, bbasis⟩ := TopologicalSpace.exists_countable_basis α
-  let v := { U ∈ b | (U ∩ C).Countable }
+  let v := {U ∈ b | (U ∩ C).Countable}
   let V := ⋃ U ∈ v, U
   let D := C \ V
   have Vct : (V ∩ C).Countable :=
@@ -215,7 +215,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
       apply xD.2
       exact mem_bUnion this xU
     by_contra h
-    push_neg  at h 
+    push_neg at h 
     exact absurd (countable.mono h (Set.countable_singleton _)) this
   · rw [inter_comm, inter_union_diff]
 #align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosed
@@ -330,9 +330,9 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
     rcases Nat.exists_eq_succ_of_ne_zero hm with ⟨n, rfl⟩
     dsimp
     cases x n
-    · convert(h0 _ _ _).2.2.2
+    · convert (h0 _ _ _).2.2.2
       rw [PiNat.res_length]
-    convert(h1 _ _ _).2.2.2
+    convert (h1 _ _ _).2.2.2
     rw [PiNat.res_length]
   have hdisj' : CantorScheme.Disjoint D :=
     by
Diff
@@ -117,7 +117,7 @@ theorem Preperfect.perfect_closure (hC : Preperfect C) : Perfect (closure C) :=
   · exact hC _ h
   have : {x}ᶜ ∩ C = C := by simp [h]
   rw [AccPt, nhdsWithin, inf_assoc, inf_principal, this]
-  rw [closure_eq_cluster_pts] at hx
+  rw [closure_eq_cluster_pts] at hx 
   exact hx
 #align preperfect.perfect_closure Preperfect.perfect_closure
 -/
@@ -161,7 +161,7 @@ theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty
   obtain ⟨x, xC, hxy⟩ : ∃ x ∈ C, x ≠ y :=
     by
     have := hC.acc _ yC
-    rw [accPt_iff_nhds] at this
+    rw [accPt_iff_nhds] at this 
     rcases this univ univ_mem with ⟨x, xC, hxy⟩
     exact ⟨x, xC.2, hxy⟩
   obtain ⟨U, xU, Uop, V, yV, Vop, hUV⟩ := exists_open_nhds_disjoint_closure hxy
@@ -215,7 +215,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
       apply xD.2
       exact mem_bUnion this xU
     by_contra h
-    push_neg  at h
+    push_neg  at h 
     exact absurd (countable.mono h (Set.countable_singleton _)) this
   · rw [inter_comm, inter_union_diff]
 #align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosed
@@ -230,8 +230,8 @@ theorem exists_perfect_nonempty_of_isClosed_of_not_countable [SecondCountableTop
   constructor
   · rw [nonempty_iff_ne_empty]
     by_contra
-    rw [h, union_empty] at VD
-    rw [VD] at hunc
+    rw [h, union_empty] at VD 
+    rw [VD] at hunc 
     contradiction
   rw [VD]
   exact subset_union_right _ _
@@ -326,7 +326,7 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
     · simp
     rw [eventually_at_top]
     refine' ⟨1, fun m (hm : 1 ≤ m) => _⟩
-    rw [Nat.one_le_iff_ne_zero] at hm
+    rw [Nat.one_le_iff_ne_zero] at hm 
     rcases Nat.exists_eq_succ_of_ne_zero hm with ⟨n, rfl⟩
     dsimp
     cases x n
Diff
@@ -339,9 +339,9 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
     rintro l (a | a) (b | b) hab <;> try contradiction
     · exact hdisj _ _ _
     exact (hdisj _ _ _).symm
-  have hdom : ∀ {x : ℕ → Bool}, x ∈ ([anonymous] D).1 := fun x => by
+  have hdom : ∀ {x : ℕ → Bool}, x ∈ (induced_map D).1 := fun x => by
     simp [hanti.map_of_vanishing_diam hdiam fun l => (DP l).property.2]
-  refine' ⟨fun x => ([anonymous] D).2 ⟨x, hdom⟩, _, _, _⟩
+  refine' ⟨fun x => (induced_map D).2 ⟨x, hdom⟩, _, _, _⟩
   · rintro y ⟨x, rfl⟩
     exact map_mem ⟨_, hdom⟩ 0
   · continuity
Diff
@@ -55,7 +55,7 @@ accumulation point, perfect set, cantor-bendixson.
 -/
 
 
-open Topology Filter
+open scoped Topology Filter
 
 open TopologicalSpace Filter Set
 
@@ -246,7 +246,7 @@ section CantorInjMetric
 
 open Function
 
-open ENNReal
+open scoped ENNReal
 
 variable {α : Type _} [MetricSpace α] {C : Set α} (hC : Perfect C) {ε : ℝ≥0∞}
 
Diff
@@ -63,12 +63,6 @@ section Basic
 
 variable {α : Type _} [TopologicalSpace α] {C : Set α}
 
-/- warning: acc_pt.nhds_inter -> AccPt.nhds_inter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} {x : α} {U : Set.{u1} α}, (AccPt.{u1} α _inst_1 x (Filter.principal.{u1} α C)) -> (Membership.Mem.{u1, u1} (Set.{u1} α) (Filter.{u1} α) (Filter.hasMem.{u1} α) U (nhds.{u1} α _inst_1 x)) -> (AccPt.{u1} α _inst_1 x (Filter.principal.{u1} α (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) U C)))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} {x : α} {U : Set.{u1} α}, (AccPt.{u1} α _inst_1 x (Filter.principal.{u1} α C)) -> (Membership.mem.{u1, u1} (Set.{u1} α) (Filter.{u1} α) (instMembershipSetFilter.{u1} α) U (nhds.{u1} α _inst_1 x)) -> (AccPt.{u1} α _inst_1 x (Filter.principal.{u1} α (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) U C)))
-Case conversion may be inaccurate. Consider using '#align acc_pt.nhds_inter AccPt.nhds_interₓ'. -/
 /-- If `x` is an accumulation point of a set `C` and `U` is a neighborhood of `x`,
 then `x` is an accumulation point of `U ∩ C`. -/
 theorem AccPt.nhds_inter {x : α} {U : Set α} (h_acc : AccPt x (𝓟 C)) (hU : U ∈ 𝓝 x) :
@@ -100,22 +94,10 @@ structure Perfect (C : Set α) : Prop where
 #align perfect Perfect
 -/
 
-/- warning: preperfect_iff_nhds -> preperfect_iff_nhds is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α}, Iff (Preperfect.{u1} α _inst_1 C) (forall (x : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x C) -> (forall (U : Set.{u1} α), (Membership.Mem.{u1, u1} (Set.{u1} α) (Filter.{u1} α) (Filter.hasMem.{u1} α) U (nhds.{u1} α _inst_1 x)) -> (Exists.{succ u1} α (fun (y : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) y (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) U C)) (fun (H : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) y (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) U C)) => Ne.{succ u1} α y x)))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α}, Iff (Preperfect.{u1} α _inst_1 C) (forall (x : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x C) -> (forall (U : Set.{u1} α), (Membership.mem.{u1, u1} (Set.{u1} α) (Filter.{u1} α) (instMembershipSetFilter.{u1} α) U (nhds.{u1} α _inst_1 x)) -> (Exists.{succ u1} α (fun (y : α) => And (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) y (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) U C)) (Ne.{succ u1} α y x)))))
-Case conversion may be inaccurate. Consider using '#align preperfect_iff_nhds preperfect_iff_nhdsₓ'. -/
 theorem preperfect_iff_nhds : Preperfect C ↔ ∀ x ∈ C, ∀ U ∈ 𝓝 x, ∃ y ∈ U ∩ C, y ≠ x := by
   simp only [Preperfect, accPt_iff_nhds]
 #align preperfect_iff_nhds preperfect_iff_nhds
 
-/- warning: preperfect.open_inter -> Preperfect.open_inter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} {U : Set.{u1} α}, (Preperfect.{u1} α _inst_1 C) -> (IsOpen.{u1} α _inst_1 U) -> (Preperfect.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) U C))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} {U : Set.{u1} α}, (Preperfect.{u1} α _inst_1 C) -> (IsOpen.{u1} α _inst_1 U) -> (Preperfect.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) U C))
-Case conversion may be inaccurate. Consider using '#align preperfect.open_inter Preperfect.open_interₓ'. -/
 /-- The intersection of a preperfect set and an open set is preperfect-/
 theorem Preperfect.open_inter {U : Set α} (hC : Preperfect C) (hU : IsOpen U) :
     Preperfect (U ∩ C) := by
@@ -159,12 +141,6 @@ theorem preperfect_iff_perfect_closure [T1Space α] : Preperfect C ↔ Perfect (
 #align preperfect_iff_perfect_closure preperfect_iff_perfect_closure
 -/
 
-/- warning: perfect.closure_nhds_inter -> Perfect.closure_nhds_inter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} {U : Set.{u1} α}, (Perfect.{u1} α _inst_1 C) -> (forall (x : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x C) -> (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x U) -> (IsOpen.{u1} α _inst_1 U) -> (And (Perfect.{u1} α _inst_1 (closure.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) U C))) (Set.Nonempty.{u1} α (closure.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) U C)))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} {U : Set.{u1} α}, (Perfect.{u1} α _inst_1 C) -> (forall (x : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x C) -> (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x U) -> (IsOpen.{u1} α _inst_1 U) -> (And (Perfect.{u1} α _inst_1 (closure.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) U C))) (Set.Nonempty.{u1} α (closure.{u1} α _inst_1 (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) U C)))))
-Case conversion may be inaccurate. Consider using '#align perfect.closure_nhds_inter Perfect.closure_nhds_interₓ'. -/
 theorem Perfect.closure_nhds_inter {U : Set α} (hC : Perfect C) (x : α) (xC : x ∈ C) (xU : x ∈ U)
     (Uop : IsOpen U) : Perfect (closure (U ∩ C)) ∧ (closure (U ∩ C)).Nonempty :=
   by
@@ -175,12 +151,6 @@ theorem Perfect.closure_nhds_inter {U : Set α} (hC : Perfect C) (x : α) (xC :
   exact ⟨x, ⟨xU, xC⟩⟩
 #align perfect.closure_nhds_inter Perfect.closure_nhds_inter
 
-/- warning: perfect.splitting -> Perfect.splitting is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} [_inst_2 : T25Space.{u1} α _inst_1], (Perfect.{u1} α _inst_1 C) -> (Set.Nonempty.{u1} α C) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α _inst_1 C₀) (And (Set.Nonempty.{u1} α C₀) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₀ C))) (And (And (Perfect.{u1} α _inst_1 C₁) (And (Set.Nonempty.{u1} α C₁) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₁ C))) (Disjoint.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.completeBooleanAlgebra.{u1} α)))))) (GeneralizedBooleanAlgebra.toOrderBot.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))) C₀ C₁)))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} [_inst_2 : T25Space.{u1} α _inst_1], (Perfect.{u1} α _inst_1 C) -> (Set.Nonempty.{u1} α C) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α _inst_1 C₀) (And (Set.Nonempty.{u1} α C₀) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₀ C))) (And (And (Perfect.{u1} α _inst_1 C₁) (And (Set.Nonempty.{u1} α C₁) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₁ C))) (Disjoint.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) (BoundedOrder.toOrderBot.{u1} (Set.{u1} α) (Preorder.toLE.{u1} (Set.{u1} α) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))))) (CompleteLattice.toBoundedOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) C₀ C₁)))))
-Case conversion may be inaccurate. Consider using '#align perfect.splitting Perfect.splittingₓ'. -/
 /-- Given a perfect nonempty set in a T2.5 space, we can find two disjoint perfect subsets
 This is the main inductive step in the proof of the Cantor-Bendixson Theorem-/
 theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty) :
@@ -209,12 +179,6 @@ theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty
 
 section Kernel
 
-/- warning: exists_countable_union_perfect_of_is_closed -> exists_countable_union_perfect_of_isClosed is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} [_inst_2 : TopologicalSpace.SecondCountableTopology.{u1} α _inst_1], (IsClosed.{u1} α _inst_1 C) -> (Exists.{succ u1} (Set.{u1} α) (fun (V : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (D : Set.{u1} α) => And (Set.Countable.{u1} α V) (And (Perfect.{u1} α _inst_1 D) (Eq.{succ u1} (Set.{u1} α) C (Union.union.{u1} (Set.{u1} α) (Set.hasUnion.{u1} α) V D))))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} [_inst_2 : TopologicalSpace.SecondCountableTopology.{u1} α _inst_1], (IsClosed.{u1} α _inst_1 C) -> (Exists.{succ u1} (Set.{u1} α) (fun (V : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (D : Set.{u1} α) => And (Set.Countable.{u1} α V) (And (Perfect.{u1} α _inst_1 D) (Eq.{succ u1} (Set.{u1} α) C (Union.union.{u1} (Set.{u1} α) (Set.instUnionSet.{u1} α) V D))))))
-Case conversion may be inaccurate. Consider using '#align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosedₓ'. -/
 /-- The **Cantor-Bendixson Theorem**: Any closed subset of a second countable space
 can be written as the union of a countable set and a perfect set.-/
 theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
@@ -310,12 +274,6 @@ variable (hnonempty : C.Nonempty)
 
 include hnonempty
 
-/- warning: perfect.small_diam_splitting -> Perfect.small_diam_splitting is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (forall {ε : ENNReal}, (Set.Nonempty.{u1} α C) -> (LT.lt.{0} ENNReal (Preorder.toHasLt.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) ε) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₀) (And (Set.Nonempty.{u1} α C₀) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₀ C) (LE.le.{0} ENNReal (Preorder.toHasLe.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₀) ε)))) (And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₁) (And (Set.Nonempty.{u1} α C₁) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₁ C) (LE.le.{0} ENNReal (Preorder.toHasLe.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₁) ε)))) (Disjoint.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.completeBooleanAlgebra.{u1} α)))))) (GeneralizedBooleanAlgebra.toOrderBot.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))) C₀ C₁))))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (forall {ε : ENNReal}, (Set.Nonempty.{u1} α C) -> (LT.lt.{0} ENNReal (Preorder.toLT.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)) ε) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₀) (And (Set.Nonempty.{u1} α C₀) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₀ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (EMetric.diam.{u1} α (EMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toEMetricSpace.{u1} α _inst_1)) C₀) ε)))) (And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₁) (And (Set.Nonempty.{u1} α C₁) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₁ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (EMetric.diam.{u1} α (EMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toEMetricSpace.{u1} α _inst_1)) C₁) ε)))) (Disjoint.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) (BoundedOrder.toOrderBot.{u1} (Set.{u1} α) (Preorder.toLE.{u1} (Set.{u1} α) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))))) (CompleteLattice.toBoundedOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) C₀ C₁))))))
-Case conversion may be inaccurate. Consider using '#align perfect.small_diam_splitting Perfect.small_diam_splittingₓ'. -/
 /-- A refinement of `perfect.splitting` for metric spaces, where we also control
 the diameter of the new perfect sets. -/
 theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
@@ -336,12 +294,6 @@ theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
 
 open CantorScheme
 
-/- warning: perfect.exists_nat_bool_injection -> Perfect.exists_nat_bool_injection is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (Set.Nonempty.{u1} α C) -> (forall [_inst_2 : CompleteSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))], Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => Bool.topologicalSpace)) (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (Set.Nonempty.{u1} α C) -> (forall [_inst_2 : CompleteSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))], Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => instTopologicalSpaceBool)) (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
-Case conversion may be inaccurate. Consider using '#align perfect.exists_nat_bool_injection Perfect.exists_nat_bool_injectionₓ'. -/
 /-- Any nonempty perfect set in a complete metric space admits a continuous injection
 from the cantor space, `ℕ → bool`. -/
 theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
@@ -400,12 +352,6 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
 
 end CantorInjMetric
 
-/- warning: is_closed.exists_nat_bool_injection_of_not_countable -> IsClosed.exists_nat_bool_injection_of_not_countable is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : PolishSpace.{u1} α _inst_1] {C : Set.{u1} α}, (IsClosed.{u1} α _inst_1 C) -> (Not (Set.Countable.{u1} α C)) -> (Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => Bool.topologicalSpace)) _inst_1 f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : PolishSpace.{u1} α _inst_1] {C : Set.{u1} α}, (IsClosed.{u1} α _inst_1 C) -> (Not (Set.Countable.{u1} α C)) -> (Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => instTopologicalSpaceBool)) _inst_1 f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
-Case conversion may be inaccurate. Consider using '#align is_closed.exists_nat_bool_injection_of_not_countable IsClosed.exists_nat_bool_injection_of_not_countableₓ'. -/
 /-- Any closed uncountable subset of a Polish space admits a continuous injection
 from the Cantor space `ℕ → bool`.-/
 theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type _} [TopologicalSpace α]
Diff
@@ -144,8 +144,7 @@ theorem Preperfect.perfect_closure (hC : Preperfect C) : Perfect (closure C) :=
 /-- In a T1 space, being preperfect is equivalent to having perfect closure.-/
 theorem preperfect_iff_perfect_closure [T1Space α] : Preperfect C ↔ Perfect (closure C) :=
   by
-  constructor <;> intro h
-  · exact h.perfect_closure
+  constructor <;> intro h; · exact h.perfect_closure
   intro x xC
   have H : AccPt x (𝓟 (closure C)) := h.acc _ (subset_closure xC)
   rw [accPt_iff_frequently] at *
Diff
@@ -306,7 +306,6 @@ private theorem perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C)
   apply le_trans (EMetric.diam_mono (inter_subset_left _ _))
   convert EMetric.diam_ball
   rw [mul_comm, ENNReal.div_mul_cancel] <;> norm_num
-#align perfect.small_diam_aux perfect.small_diam_aux
 
 variable (hnonempty : C.Nonempty)
 
Diff
@@ -314,7 +314,7 @@ include hnonempty
 
 /- warning: perfect.small_diam_splitting -> Perfect.small_diam_splitting is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (forall {ε : ENNReal}, (Set.Nonempty.{u1} α C) -> (LT.lt.{0} ENNReal (Preorder.toLT.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) ε) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₀) (And (Set.Nonempty.{u1} α C₀) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₀ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₀) ε)))) (And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₁) (And (Set.Nonempty.{u1} α C₁) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₁ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₁) ε)))) (Disjoint.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.completeBooleanAlgebra.{u1} α)))))) (GeneralizedBooleanAlgebra.toOrderBot.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))) C₀ C₁))))))
+  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (forall {ε : ENNReal}, (Set.Nonempty.{u1} α C) -> (LT.lt.{0} ENNReal (Preorder.toHasLt.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) ε) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₀) (And (Set.Nonempty.{u1} α C₀) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₀ C) (LE.le.{0} ENNReal (Preorder.toHasLe.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₀) ε)))) (And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₁) (And (Set.Nonempty.{u1} α C₁) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₁ C) (LE.le.{0} ENNReal (Preorder.toHasLe.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₁) ε)))) (Disjoint.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.completeBooleanAlgebra.{u1} α)))))) (GeneralizedBooleanAlgebra.toOrderBot.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))) C₀ C₁))))))
 but is expected to have type
   forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (forall {ε : ENNReal}, (Set.Nonempty.{u1} α C) -> (LT.lt.{0} ENNReal (Preorder.toLT.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)) ε) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₀) (And (Set.Nonempty.{u1} α C₀) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₀ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (EMetric.diam.{u1} α (EMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toEMetricSpace.{u1} α _inst_1)) C₀) ε)))) (And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₁) (And (Set.Nonempty.{u1} α C₁) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₁ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (EMetric.diam.{u1} α (EMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toEMetricSpace.{u1} α _inst_1)) C₁) ε)))) (Disjoint.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) (BoundedOrder.toOrderBot.{u1} (Set.{u1} α) (Preorder.toLE.{u1} (Set.{u1} α) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))))) (CompleteLattice.toBoundedOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) C₀ C₁))))))
 Case conversion may be inaccurate. Consider using '#align perfect.small_diam_splitting Perfect.small_diam_splittingₓ'. -/
Diff
@@ -232,7 +232,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
     · exact countable.mono (inter_subset_left _ _) bct
     · exact inter_subset_right _ _
   refine' ⟨V ∩ C, D, Vct, ⟨_, _⟩, _⟩
-  · refine' hclosed.sdiff (isOpen_bunionᵢ fun U => _)
+  · refine' hclosed.sdiff (isOpen_biUnion fun U => _)
     exact fun ⟨Ub, _⟩ => is_topological_basis.is_open bbasis Ub
   · rw [preperfect_iff_nhds]
     intro x xD E xE
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 
 ! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 9b2b58d6b14b895b2f375108e765cb47de71aebd
+! leanprover-community/mathlib commit 3905fa80e62c0898131285baab35559fbc4e5cda
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -24,8 +24,6 @@ including a version of the Cantor-Bendixson Theorem.
 
 * `perfect C`: A set `C` is perfect, meaning it is closed and every point of it
   is an accumulation point of itself.
-* `set.scheme β α`: A `β`-scheme on `α`, a collection of subsets of `α` indexed by `list β`.
-  Used to construct maps `(β → ℕ) → α` as limiting objects.
 
 ## Main Statements
 
@@ -35,7 +33,7 @@ including a version of the Cantor-Bendixson Theorem.
 * `exists_countable_union_perfect_of_is_closed`: One version of the **Cantor-Bendixson Theorem**:
   A closed set in a second countable space can be written as the union of a countable set and a
   perfect set.
-* `exists_nat_bool_injection_of_perfect_nonempty`: A perfect nonempty set in a complete metric space
+* `perfect.exists_nat_bool_injection`: A perfect nonempty set in a complete metric space
   admits an embedding from the Cantor space.
 
 ## Implementation Notes
Diff
@@ -404,6 +404,12 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
 
 end CantorInjMetric
 
+/- warning: is_closed.exists_nat_bool_injection_of_not_countable -> IsClosed.exists_nat_bool_injection_of_not_countable is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : PolishSpace.{u1} α _inst_1] {C : Set.{u1} α}, (IsClosed.{u1} α _inst_1 C) -> (Not (Set.Countable.{u1} α C)) -> (Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => Bool.topologicalSpace)) _inst_1 f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : PolishSpace.{u1} α _inst_1] {C : Set.{u1} α}, (IsClosed.{u1} α _inst_1 C) -> (Not (Set.Countable.{u1} α C)) -> (Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => instTopologicalSpaceBool)) _inst_1 f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
+Case conversion may be inaccurate. Consider using '#align is_closed.exists_nat_bool_injection_of_not_countable IsClosed.exists_nat_bool_injection_of_not_countableₓ'. -/
 /-- Any closed uncountable subset of a Polish space admits a continuous injection
 from the Cantor space `ℕ → bool`.-/
 theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type _} [TopologicalSpace α]
Diff
@@ -4,12 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 
 ! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 49b7f94aab3a3bdca1f9f34c5d818afb253b3993
+! leanprover-community/mathlib commit 9b2b58d6b14b895b2f375108e765cb47de71aebd
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.Topology.Separation
-import Mathbin.Topology.Bases
+import Mathbin.Topology.MetricSpace.Polish
 import Mathbin.Topology.MetricSpace.CantorScheme
 
 /-!
@@ -282,7 +281,7 @@ end Kernel
 
 end Basic
 
-section CantorInj
+section CantorInjMetric
 
 open Function
 
@@ -403,5 +402,17 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
   simpa only [← Subtype.val_inj] using hdisj'.map_injective hxy
 #align perfect.exists_nat_bool_injection Perfect.exists_nat_bool_injection
 
-end CantorInj
+end CantorInjMetric
+
+/-- Any closed uncountable subset of a Polish space admits a continuous injection
+from the Cantor space `ℕ → bool`.-/
+theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type _} [TopologicalSpace α]
+    [PolishSpace α] {C : Set α} (hC : IsClosed C) (hunc : ¬C.Countable) :
+    ∃ f : (ℕ → Bool) → α, range f ⊆ C ∧ Continuous f ∧ Function.Injective f :=
+  by
+  letI := upgradePolishSpace α
+  obtain ⟨D, hD, Dnonempty, hDC⟩ := exists_perfect_nonempty_of_isClosed_of_not_countable hC hunc
+  obtain ⟨f, hfD, hf⟩ := hD.exists_nat_bool_injection Dnonempty
+  exact ⟨f, hfD.trans hDC, hf⟩
+#align is_closed.exists_nat_bool_injection_of_not_countable IsClosed.exists_nat_bool_injection_of_not_countable
 
Diff
@@ -183,7 +183,7 @@ theorem Perfect.closure_nhds_inter {U : Set α} (hC : Perfect C) (x : α) (xC :
 lean 3 declaration is
   forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} [_inst_2 : T25Space.{u1} α _inst_1], (Perfect.{u1} α _inst_1 C) -> (Set.Nonempty.{u1} α C) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α _inst_1 C₀) (And (Set.Nonempty.{u1} α C₀) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₀ C))) (And (And (Perfect.{u1} α _inst_1 C₁) (And (Set.Nonempty.{u1} α C₁) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₁ C))) (Disjoint.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.completeBooleanAlgebra.{u1} α)))))) (GeneralizedBooleanAlgebra.toOrderBot.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))) C₀ C₁)))))
 but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} [_inst_2 : T25Space.{u1} α _inst_1], (Perfect.{u1} α _inst_1 C) -> (Set.Nonempty.{u1} α C) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α _inst_1 C₀) (And (Set.Nonempty.{u1} α C₀) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₀ C))) (And (And (Perfect.{u1} α _inst_1 C₁) (And (Set.Nonempty.{u1} α C₁) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₁ C))) (Disjoint.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) (BoundedOrder.toOrderBot.{u1} (Set.{u1} α) (Preorder.toLE.{u1} (Set.{u1} α) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))))) (CompleteLattice.toBoundedOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) C₀ C₁)))))
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] {C : Set.{u1} α} [_inst_2 : T25Space.{u1} α _inst_1], (Perfect.{u1} α _inst_1 C) -> (Set.Nonempty.{u1} α C) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α _inst_1 C₀) (And (Set.Nonempty.{u1} α C₀) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₀ C))) (And (And (Perfect.{u1} α _inst_1 C₁) (And (Set.Nonempty.{u1} α C₁) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₁ C))) (Disjoint.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) (BoundedOrder.toOrderBot.{u1} (Set.{u1} α) (Preorder.toLE.{u1} (Set.{u1} α) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))))) (CompleteLattice.toBoundedOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) C₀ C₁)))))
 Case conversion may be inaccurate. Consider using '#align perfect.splitting Perfect.splittingₓ'. -/
 /-- Given a perfect nonempty set in a T2.5 space, we can find two disjoint perfect subsets
 This is the main inductive step in the proof of the Cantor-Bendixson Theorem-/
@@ -315,6 +315,12 @@ variable (hnonempty : C.Nonempty)
 
 include hnonempty
 
+/- warning: perfect.small_diam_splitting -> Perfect.small_diam_splitting is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (forall {ε : ENNReal}, (Set.Nonempty.{u1} α C) -> (LT.lt.{0} ENNReal (Preorder.toLT.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) ε) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₀) (And (Set.Nonempty.{u1} α C₀) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₀ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₀) ε)))) (And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₁) (And (Set.Nonempty.{u1} α C₁) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) C₁ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (CompleteSemilatticeInf.toPartialOrder.{0} ENNReal (CompleteLattice.toCompleteSemilatticeInf.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.completeLinearOrder))))) (EMetric.diam.{u1} α (PseudoMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1)) C₁) ε)))) (Disjoint.{u1} (Set.{u1} α) (CompleteSemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.toCompleteSemilatticeInf.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.completeBooleanAlgebra.{u1} α)))))) (GeneralizedBooleanAlgebra.toOrderBot.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))) C₀ C₁))))))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (forall {ε : ENNReal}, (Set.Nonempty.{u1} α C) -> (LT.lt.{0} ENNReal (Preorder.toLT.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)) ε) -> (Exists.{succ u1} (Set.{u1} α) (fun (C₀ : Set.{u1} α) => Exists.{succ u1} (Set.{u1} α) (fun (C₁ : Set.{u1} α) => And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₀) (And (Set.Nonempty.{u1} α C₀) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₀ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (EMetric.diam.{u1} α (EMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toEMetricSpace.{u1} α _inst_1)) C₀) ε)))) (And (And (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C₁) (And (Set.Nonempty.{u1} α C₁) (And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) C₁ C) (LE.le.{0} ENNReal (Preorder.toLE.{0} ENNReal (PartialOrder.toPreorder.{0} ENNReal (OmegaCompletePartialOrder.toPartialOrder.{0} ENNReal (CompleteLattice.instOmegaCompletePartialOrder.{0} ENNReal (CompleteLinearOrder.toCompleteLattice.{0} ENNReal ENNReal.instCompleteLinearOrderENNReal))))) (EMetric.diam.{u1} α (EMetricSpace.toPseudoEMetricSpace.{u1} α (MetricSpace.toEMetricSpace.{u1} α _inst_1)) C₁) ε)))) (Disjoint.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) (BoundedOrder.toOrderBot.{u1} (Set.{u1} α) (Preorder.toLE.{u1} (Set.{u1} α) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (OmegaCompletePartialOrder.toPartialOrder.{u1} (Set.{u1} α) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))))) (CompleteLattice.toBoundedOrder.{u1} (Set.{u1} α) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} α) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} α) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} α) (Set.instCompleteBooleanAlgebraSet.{u1} α)))))) C₀ C₁))))))
+Case conversion may be inaccurate. Consider using '#align perfect.small_diam_splitting Perfect.small_diam_splittingₓ'. -/
 /-- A refinement of `perfect.splitting` for metric spaces, where we also control
 the diameter of the new perfect sets. -/
 theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
@@ -335,6 +341,12 @@ theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
 
 open CantorScheme
 
+/- warning: perfect.exists_nat_bool_injection -> Perfect.exists_nat_bool_injection is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (Set.Nonempty.{u1} α C) -> (forall [_inst_2 : CompleteSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))], Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => Bool.topologicalSpace)) (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : MetricSpace.{u1} α] {C : Set.{u1} α}, (Perfect.{u1} α (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) C) -> (Set.Nonempty.{u1} α C) -> (forall [_inst_2 : CompleteSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))], Exists.{succ u1} ((Nat -> Bool) -> α) (fun (f : (Nat -> Bool) -> α) => And (HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) (Set.range.{u1, 1} α (Nat -> Bool) f) C) (And (Continuous.{0, u1} (Nat -> Bool) α (Pi.topologicalSpace.{0, 0} Nat (fun (ᾰ : Nat) => Bool) (fun (a : Nat) => instTopologicalSpaceBool)) (UniformSpace.toTopologicalSpace.{u1} α (PseudoMetricSpace.toUniformSpace.{u1} α (MetricSpace.toPseudoMetricSpace.{u1} α _inst_1))) f) (Function.Injective.{1, succ u1} (Nat -> Bool) α f))))
+Case conversion may be inaccurate. Consider using '#align perfect.exists_nat_bool_injection Perfect.exists_nat_bool_injectionₓ'. -/
 /-- Any nonempty perfect set in a complete metric space admits a continuous injection
 from the cantor space, `ℕ → bool`. -/
 theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
Diff
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 
 ! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 50832daea47b195a48b5b33b1c8b2162c48c3afc
+! leanprover-community/mathlib commit 49b7f94aab3a3bdca1f9f34c5d818afb253b3993
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Topology.Separation
 import Mathbin.Topology.Bases
+import Mathbin.Topology.MetricSpace.CantorScheme
 
 /-!
 # Perfect Sets
@@ -24,6 +25,8 @@ including a version of the Cantor-Bendixson Theorem.
 
 * `perfect C`: A set `C` is perfect, meaning it is closed and every point of it
   is an accumulation point of itself.
+* `set.scheme β α`: A `β`-scheme on `α`, a collection of subsets of `α` indexed by `list β`.
+  Used to construct maps `(β → ℕ) → α` as limiting objects.
 
 ## Main Statements
 
@@ -33,6 +36,8 @@ including a version of the Cantor-Bendixson Theorem.
 * `exists_countable_union_perfect_of_is_closed`: One version of the **Cantor-Bendixson Theorem**:
   A closed set in a second countable space can be written as the union of a countable set and a
   perfect set.
+* `exists_nat_bool_injection_of_perfect_nonempty`: A perfect nonempty set in a complete metric space
+  admits an embedding from the Cantor space.
 
 ## Implementation Notes
 
@@ -44,11 +49,11 @@ see `preperfect_iff_perfect_closure`.
 
 ## References
 
-* [kechris1995] (Chapter 6)
+* [kechris1995] (Chapters 6-7)
 
 ## Tags
 
-accumulation point, perfect set, Cantor-Bendixson.
+accumulation point, perfect set, cantor-bendixson.
 
 -/
 
@@ -57,6 +62,8 @@ open Topology Filter
 
 open TopologicalSpace Filter Set
 
+section Basic
+
 variable {α : Type _} [TopologicalSpace α] {C : Set α}
 
 /- warning: acc_pt.nhds_inter -> AccPt.nhds_inter is a dubious translation:
@@ -273,3 +280,116 @@ theorem exists_perfect_nonempty_of_isClosed_of_not_countable [SecondCountableTop
 
 end Kernel
 
+end Basic
+
+section CantorInj
+
+open Function
+
+open ENNReal
+
+variable {α : Type _} [MetricSpace α] {C : Set α} (hC : Perfect C) {ε : ℝ≥0∞}
+
+include hC
+
+private theorem perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C) :
+    let D := closure (EMetric.ball x (ε / 2) ∩ C)
+    Perfect D ∧ D.Nonempty ∧ D ⊆ C ∧ EMetric.diam D ≤ ε :=
+  by
+  have : x ∈ EMetric.ball x (ε / 2) :=
+    by
+    apply EMetric.mem_ball_self
+    rw [ENNReal.div_pos_iff]
+    exact ⟨ne_of_gt ε_pos, by norm_num⟩
+  have := hC.closure_nhds_inter x xC this EMetric.isOpen_ball
+  refine' ⟨this.1, this.2, _, _⟩
+  · rw [IsClosed.closure_subset_iff hC.closed]
+    apply inter_subset_right
+  rw [EMetric.diam_closure]
+  apply le_trans (EMetric.diam_mono (inter_subset_left _ _))
+  convert EMetric.diam_ball
+  rw [mul_comm, ENNReal.div_mul_cancel] <;> norm_num
+#align perfect.small_diam_aux perfect.small_diam_aux
+
+variable (hnonempty : C.Nonempty)
+
+include hnonempty
+
+/-- A refinement of `perfect.splitting` for metric spaces, where we also control
+the diameter of the new perfect sets. -/
+theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
+    ∃ C₀ C₁ : Set α,
+      (Perfect C₀ ∧ C₀.Nonempty ∧ C₀ ⊆ C ∧ EMetric.diam C₀ ≤ ε) ∧
+        (Perfect C₁ ∧ C₁.Nonempty ∧ C₁ ⊆ C ∧ EMetric.diam C₁ ≤ ε) ∧ Disjoint C₀ C₁ :=
+  by
+  rcases hC.splitting hnonempty with ⟨D₀, D₁, ⟨perf0, non0, sub0⟩, ⟨perf1, non1, sub1⟩, hdisj⟩
+  cases' non0 with x₀ hx₀
+  cases' non1 with x₁ hx₁
+  rcases perf0.small_diam_aux ε_pos hx₀ with ⟨perf0', non0', sub0', diam0⟩
+  rcases perf1.small_diam_aux ε_pos hx₁ with ⟨perf1', non1', sub1', diam1⟩
+  refine'
+    ⟨closure (EMetric.ball x₀ (ε / 2) ∩ D₀), closure (EMetric.ball x₁ (ε / 2) ∩ D₁),
+      ⟨perf0', non0', sub0'.trans sub0, diam0⟩, ⟨perf1', non1', sub1'.trans sub1, diam1⟩, _⟩
+  apply Disjoint.mono _ _ hdisj <;> assumption
+#align perfect.small_diam_splitting Perfect.small_diam_splitting
+
+open CantorScheme
+
+/-- Any nonempty perfect set in a complete metric space admits a continuous injection
+from the cantor space, `ℕ → bool`. -/
+theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
+    ∃ f : (ℕ → Bool) → α, range f ⊆ C ∧ Continuous f ∧ Injective f :=
+  by
+  obtain ⟨u, -, upos', hu⟩ := exists_seq_strictAnti_tendsto' (zero_lt_one' ℝ≥0∞)
+  have upos := fun n => (upos' n).1
+  let P := Subtype fun E : Set α => Perfect E ∧ E.Nonempty
+  choose C0 C1 h0 h1 hdisj using
+    fun {C : Set α} (hC : Perfect C) (hnonempty : C.Nonempty) {ε : ℝ≥0∞} (hε : 0 < ε) =>
+    hC.small_diam_splitting hnonempty hε
+  let DP : List Bool → P := fun l => by
+    induction' l with a l ih; · exact ⟨C, ⟨hC, hnonempty⟩⟩
+    cases a
+    · use C0 ih.property.1 ih.property.2 (upos l.length.succ)
+      exact ⟨(h0 _ _ _).1, (h0 _ _ _).2.1⟩
+    use C1 ih.property.1 ih.property.2 (upos l.length.succ)
+    exact ⟨(h1 _ _ _).1, (h1 _ _ _).2.1⟩
+  let D : List Bool → Set α := fun l => (DP l).val
+  have hanti : closure_antitone D :=
+    by
+    refine' antitone.closure_antitone _ fun l => (DP l).property.1.closed
+    intro l a
+    cases a
+    · exact (h0 _ _ _).2.2.1
+    exact (h1 _ _ _).2.2.1
+  have hdiam : vanishing_diam D := by
+    intro x
+    apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu
+    · simp
+    rw [eventually_at_top]
+    refine' ⟨1, fun m (hm : 1 ≤ m) => _⟩
+    rw [Nat.one_le_iff_ne_zero] at hm
+    rcases Nat.exists_eq_succ_of_ne_zero hm with ⟨n, rfl⟩
+    dsimp
+    cases x n
+    · convert(h0 _ _ _).2.2.2
+      rw [PiNat.res_length]
+    convert(h1 _ _ _).2.2.2
+    rw [PiNat.res_length]
+  have hdisj' : CantorScheme.Disjoint D :=
+    by
+    rintro l (a | a) (b | b) hab <;> try contradiction
+    · exact hdisj _ _ _
+    exact (hdisj _ _ _).symm
+  have hdom : ∀ {x : ℕ → Bool}, x ∈ ([anonymous] D).1 := fun x => by
+    simp [hanti.map_of_vanishing_diam hdiam fun l => (DP l).property.2]
+  refine' ⟨fun x => ([anonymous] D).2 ⟨x, hdom⟩, _, _, _⟩
+  · rintro y ⟨x, rfl⟩
+    exact map_mem ⟨_, hdom⟩ 0
+  · continuity
+    exact hdiam.map_continuous
+  intro x y hxy
+  simpa only [← Subtype.val_inj] using hdisj'.map_injective hxy
+#align perfect.exists_nat_bool_injection Perfect.exists_nat_bool_injection
+
+end CantorInj
+

Changes in mathlib4

mathlib3
mathlib4
style: replace '.-/' by '. -/' (#11938)

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

Diff
@@ -132,7 +132,7 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
 end CantorInjMetric
 
 /-- Any closed uncountable subset of a Polish space admits a continuous injection
-from the Cantor space `ℕ → Bool`.-/
+from the Cantor space `ℕ → Bool`. -/
 theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type*} [TopologicalSpace α]
     [PolishSpace α] {C : Set α} (hC : IsClosed C) (hunc : ¬C.Countable) :
     ∃ f : (ℕ → Bool) → α, range f ⊆ C ∧ Continuous f ∧ Function.Injective f := by
refactor(Topology): split Topology.Perfect into two modules (#10272)

Splits Topology.Perfect into two modules: Topology.Perfect, where the existing definition of Perfect and Preperfect are kept, and Topology.MetricSpace.Perfect, in which the theorems specific to metric spaces are moved.

chore: rename by_contra' to by_contra! (#8797)

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

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

Diff
@@ -191,7 +191,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
       have : U ∈ v := ⟨hUb, hU_cnt⟩
       apply xD.2
       exact mem_biUnion this xU
-    by_contra' h
+    by_contra! h
     exact absurd (Countable.mono h (Set.countable_singleton _)) this
   · rw [inter_comm, inter_union_diff]
 #align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosed
chore: missing spaces after rcases, convert and congrm (#7725)

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

Diff
@@ -291,9 +291,9 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
     rcases Nat.exists_eq_succ_of_ne_zero hm with ⟨n, rfl⟩
     dsimp
     cases x n
-    · convert(h0 _ _ _).2.2.2
+    · convert (h0 _ _ _).2.2.2
       rw [PiNat.res_length]
-    convert(h1 _ _ _).2.2.2
+    convert (h1 _ _ _).2.2.2
     rw [PiNat.res_length]
   have hdisj' : CantorScheme.Disjoint D := by
     rintro l (a | a) (b | b) hab <;> try contradiction
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -55,7 +55,7 @@ open TopologicalSpace Filter Set
 
 section Basic
 
-variable {α : Type _} [TopologicalSpace α] {C : Set α}
+variable {α : Type*} [TopologicalSpace α] {C : Set α}
 
 /-- If `x` is an accumulation point of a set `C` and `U` is a neighborhood of `x`,
 then `x` is an accumulation point of `U ∩ C`. -/
@@ -219,7 +219,7 @@ section CantorInjMetric
 
 open Function ENNReal
 
-variable {α : Type _} [MetricSpace α] {C : Set α} (hC : Perfect C) {ε : ℝ≥0∞}
+variable {α : Type*} [MetricSpace α] {C : Set α} (hC : Perfect C) {ε : ℝ≥0∞}
 
 private theorem Perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C) :
     let D := closure (EMetric.ball x (ε / 2) ∩ C)
@@ -315,7 +315,7 @@ end CantorInjMetric
 
 /-- Any closed uncountable subset of a Polish space admits a continuous injection
 from the Cantor space `ℕ → Bool`.-/
-theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type _} [TopologicalSpace α]
+theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type*} [TopologicalSpace α]
     [PolishSpace α] {C : Set α} (hC : IsClosed C) (hunc : ¬C.Countable) :
     ∃ f : (ℕ → Bool) → α, range f ⊆ C ∧ Continuous f ∧ Function.Injective f := by
   letI := upgradePolishSpace α
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

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

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Felix Weilacher. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
-
-! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 3905fa80e62c0898131285baab35559fbc4e5cda
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Topology.MetricSpace.Polish
 import Mathlib.Topology.MetricSpace.CantorScheme
 
+#align_import topology.perfect from "leanprover-community/mathlib"@"3905fa80e62c0898131285baab35559fbc4e5cda"
+
 /-!
 # Perfect Sets
 
chore: tidy various files (#5449)
Diff
@@ -194,10 +194,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
       have : U ∈ v := ⟨hUb, hU_cnt⟩
       apply xD.2
       exact mem_biUnion this xU
-    by_contra h
-    -- Porting note: `push_neg` somehow didn't work. Add a `rw` to make `push_neg` work.
-    rw [not_exists] at h
-    push_neg at h
+    by_contra' h
     exact absurd (Countable.mono h (Set.countable_singleton _)) this
   · rw [inter_comm, inter_union_diff]
 #align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosed
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
@@ -171,12 +171,12 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
   let V := ⋃ U ∈ v, U
   let D := C \ V
   have Vct : (V ∩ C).Countable := by
-    simp only [unionᵢ_inter, mem_sep_iff]
-    apply Countable.bunionᵢ
+    simp only [iUnion_inter, mem_sep_iff]
+    apply Countable.biUnion
     · exact Countable.mono (inter_subset_left _ _) bct
     · exact inter_subset_right _ _
   refine' ⟨V ∩ C, D, Vct, ⟨_, _⟩, _⟩
-  · refine' hclosed.sdiff (isOpen_bunionᵢ fun _ ↦ _)
+  · refine' hclosed.sdiff (isOpen_biUnion fun _ ↦ _)
     exact fun ⟨Ub, _⟩ ↦ IsTopologicalBasis.isOpen bbasis Ub
   · rw [preperfect_iff_nhds]
     intro x xD E xE
@@ -193,7 +193,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
         exact Countable.union h Vct
       have : U ∈ v := ⟨hUb, hU_cnt⟩
       apply xD.2
-      exact mem_bunionᵢ this xU
+      exact mem_biUnion this xU
     by_contra h
     -- Porting note: `push_neg` somehow didn't work. Add a `rw` to make `push_neg` work.
     rw [not_exists] at h
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 
 ! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 9b2b58d6b14b895b2f375108e765cb47de71aebd
+! leanprover-community/mathlib commit 3905fa80e62c0898131285baab35559fbc4e5cda
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -21,8 +21,6 @@ including a version of the Cantor-Bendixson Theorem.
 
 * `Perfect C`: A set `C` is perfect, meaning it is closed and every point of it
   is an accumulation point of itself.
-* `Set.scheme β α`: A `β`-scheme on `α`, a collection of subsets of `α` indexed by `List β`.
-  Used to construct maps `(β → ℕ) → α` as limiting objects.
 
 ## Main Statements
 
@@ -32,7 +30,7 @@ including a version of the Cantor-Bendixson Theorem.
 * `exists_countable_union_perfect_of_isClosed`: One version of the **Cantor-Bendixson Theorem**:
   A closed set in a second countable space can be written as the union of a countable set and a
   perfect set.
-* `exists_nat_bool_injection`: A perfect nonempty set in a complete metric space
+* `Perfect.exists_nat_bool_injection`: A perfect nonempty set in a complete metric space
   admits an embedding from the Cantor space.
 
 ## Implementation Notes
chore: forward port leanprover-community/mathlib#18864 (#3687)

Forward port changes from leanprover-community/mathlib#18864 to Topology/Perfect.lean and MeasureTheory/MeasurableSpace.lean

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

Diff
@@ -4,12 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 
 ! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 49b7f94aab3a3bdca1f9f34c5d818afb253b3993
+! leanprover-community/mathlib commit 9b2b58d6b14b895b2f375108e765cb47de71aebd
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathlib.Topology.Separation
-import Mathlib.Topology.Bases
+import Mathlib.Topology.MetricSpace.Polish
 import Mathlib.Topology.MetricSpace.CantorScheme
 
 /-!
@@ -224,7 +223,7 @@ end Kernel
 
 end Basic
 
-section CantorInj
+section CantorInjMetric
 
 open Function ENNReal
 
@@ -320,4 +319,15 @@ theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
   simpa only [← Subtype.val_inj] using hdisj'.map_injective hxy
 #align perfect.exists_nat_bool_injection Perfect.exists_nat_bool_injection
 
-end CantorInj
+end CantorInjMetric
+
+/-- Any closed uncountable subset of a Polish space admits a continuous injection
+from the Cantor space `ℕ → Bool`.-/
+theorem IsClosed.exists_nat_bool_injection_of_not_countable {α : Type _} [TopologicalSpace α]
+    [PolishSpace α] {C : Set α} (hC : IsClosed C) (hunc : ¬C.Countable) :
+    ∃ f : (ℕ → Bool) → α, range f ⊆ C ∧ Continuous f ∧ Function.Injective f := by
+  letI := upgradePolishSpace α
+  obtain ⟨D, hD, Dnonempty, hDC⟩ := exists_perfect_nonempty_of_isClosed_of_not_countable hC hunc
+  obtain ⟨f, hfD, hf⟩ := hD.exists_nat_bool_injection Dnonempty
+  exact ⟨f, hfD.trans hDC, hf⟩
+#align is_closed.exists_nat_bool_injection_of_not_countable IsClosed.exists_nat_bool_injection_of_not_countable
chore: forward port last part of leanprover-community/mathlib#18248 (#3508)

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

Diff
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Felix Weilacher
 
 ! This file was ported from Lean 3 source module topology.perfect
-! leanprover-community/mathlib commit 4c19a16e4b705bf135cf9a80ac18fcc99c438514
+! leanprover-community/mathlib commit 49b7f94aab3a3bdca1f9f34c5d818afb253b3993
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathlib.Topology.Separation
 import Mathlib.Topology.Bases
+import Mathlib.Topology.MetricSpace.CantorScheme
 
 /-!
 # Perfect Sets
@@ -21,6 +22,8 @@ including a version of the Cantor-Bendixson Theorem.
 
 * `Perfect C`: A set `C` is perfect, meaning it is closed and every point of it
   is an accumulation point of itself.
+* `Set.scheme β α`: A `β`-scheme on `α`, a collection of subsets of `α` indexed by `List β`.
+  Used to construct maps `(β → ℕ) → α` as limiting objects.
 
 ## Main Statements
 
@@ -30,6 +33,8 @@ including a version of the Cantor-Bendixson Theorem.
 * `exists_countable_union_perfect_of_isClosed`: One version of the **Cantor-Bendixson Theorem**:
   A closed set in a second countable space can be written as the union of a countable set and a
   perfect set.
+* `exists_nat_bool_injection`: A perfect nonempty set in a complete metric space
+  admits an embedding from the Cantor space.
 
 ## Implementation Notes
 
@@ -41,11 +46,11 @@ see `preperfect_iff_perfect_closure`.
 
 ## References
 
-* [kechris1995] (Chapter 6)
+* [kechris1995] (Chapters 6-7)
 
 ## Tags
 
-accumulation point, perfect set, Cantor-Bendixson.
+accumulation point, perfect set, cantor-bendixson.
 
 -/
 
@@ -54,6 +59,8 @@ open Topology Filter
 
 open TopologicalSpace Filter Set
 
+section Basic
+
 variable {α : Type _} [TopologicalSpace α] {C : Set α}
 
 /-- If `x` is an accumulation point of a set `C` and `U` is a neighborhood of `x`,
@@ -214,3 +221,103 @@ theorem exists_perfect_nonempty_of_isClosed_of_not_countable [SecondCountableTop
 #align exists_perfect_nonempty_of_is_closed_of_not_countable exists_perfect_nonempty_of_isClosed_of_not_countable
 
 end Kernel
+
+end Basic
+
+section CantorInj
+
+open Function ENNReal
+
+variable {α : Type _} [MetricSpace α] {C : Set α} (hC : Perfect C) {ε : ℝ≥0∞}
+
+private theorem Perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C) :
+    let D := closure (EMetric.ball x (ε / 2) ∩ C)
+    Perfect D ∧ D.Nonempty ∧ D ⊆ C ∧ EMetric.diam D ≤ ε := by
+  have : x ∈ EMetric.ball x (ε / 2) := by
+    apply EMetric.mem_ball_self
+    rw [ENNReal.div_pos_iff]
+    exact ⟨ne_of_gt ε_pos, by norm_num⟩
+  have := hC.closure_nhds_inter x xC this EMetric.isOpen_ball
+  refine' ⟨this.1, this.2, _, _⟩
+  · rw [IsClosed.closure_subset_iff hC.closed]
+    apply inter_subset_right
+  rw [EMetric.diam_closure]
+  apply le_trans (EMetric.diam_mono (inter_subset_left _ _))
+  convert EMetric.diam_ball (x := x)
+  rw [mul_comm, ENNReal.div_mul_cancel] <;> norm_num
+
+variable (hnonempty : C.Nonempty)
+
+/-- A refinement of `Perfect.splitting` for metric spaces, where we also control
+the diameter of the new perfect sets. -/
+theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) :
+    ∃ C₀ C₁ : Set α, (Perfect C₀ ∧ C₀.Nonempty ∧ C₀ ⊆ C ∧ EMetric.diam C₀ ≤ ε) ∧
+    (Perfect C₁ ∧ C₁.Nonempty ∧ C₁ ⊆ C ∧ EMetric.diam C₁ ≤ ε) ∧ Disjoint C₀ C₁ := by
+  rcases hC.splitting hnonempty with ⟨D₀, D₁, ⟨perf0, non0, sub0⟩, ⟨perf1, non1, sub1⟩, hdisj⟩
+  cases' non0 with x₀ hx₀
+  cases' non1 with x₁ hx₁
+  rcases perf0.small_diam_aux ε_pos hx₀ with ⟨perf0', non0', sub0', diam0⟩
+  rcases perf1.small_diam_aux ε_pos hx₁ with ⟨perf1', non1', sub1', diam1⟩
+  refine'
+    ⟨closure (EMetric.ball x₀ (ε / 2) ∩ D₀), closure (EMetric.ball x₁ (ε / 2) ∩ D₁),
+      ⟨perf0', non0', sub0'.trans sub0, diam0⟩, ⟨perf1', non1', sub1'.trans sub1, diam1⟩, _⟩
+  apply Disjoint.mono _ _ hdisj <;> assumption
+#align perfect.small_diam_splitting Perfect.small_diam_splitting
+
+open CantorScheme
+
+/-- Any nonempty perfect set in a complete metric space admits a continuous injection
+from the Cantor space, `ℕ → Bool`. -/
+theorem Perfect.exists_nat_bool_injection [CompleteSpace α] :
+    ∃ f : (ℕ → Bool) → α, range f ⊆ C ∧ Continuous f ∧ Injective f := by
+  obtain ⟨u, -, upos', hu⟩ := exists_seq_strictAnti_tendsto' (zero_lt_one' ℝ≥0∞)
+  have upos := fun n => (upos' n).1
+  let P := Subtype fun E : Set α => Perfect E ∧ E.Nonempty
+  choose C0 C1 h0 h1 hdisj using
+    fun {C : Set α} (hC : Perfect C) (hnonempty : C.Nonempty) {ε : ℝ≥0∞} (hε : 0 < ε) =>
+    hC.small_diam_splitting hnonempty hε
+  let DP : List Bool → P := fun l => by
+    induction' l with a l ih; · exact ⟨C, ⟨hC, hnonempty⟩⟩
+    cases a
+    · use C0 ih.property.1 ih.property.2 (upos l.length.succ)
+      exact ⟨(h0 _ _ _).1, (h0 _ _ _).2.1⟩
+    use C1 ih.property.1 ih.property.2 (upos l.length.succ)
+    exact ⟨(h1 _ _ _).1, (h1 _ _ _).2.1⟩
+  let D : List Bool → Set α := fun l => (DP l).val
+  have hanti : ClosureAntitone D := by
+    refine' Antitone.closureAntitone _ fun l => (DP l).property.1.closed
+    intro l a
+    cases a
+    · exact (h0 _ _ _).2.2.1
+    exact (h1 _ _ _).2.2.1
+  have hdiam : VanishingDiam D := by
+    intro x
+    apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu
+    · simp
+    rw [eventually_atTop]
+    refine' ⟨1, fun m (hm : 1 ≤ m) => _⟩
+    rw [Nat.one_le_iff_ne_zero] at hm
+    rcases Nat.exists_eq_succ_of_ne_zero hm with ⟨n, rfl⟩
+    dsimp
+    cases x n
+    · convert(h0 _ _ _).2.2.2
+      rw [PiNat.res_length]
+    convert(h1 _ _ _).2.2.2
+    rw [PiNat.res_length]
+  have hdisj' : CantorScheme.Disjoint D := by
+    rintro l (a | a) (b | b) hab <;> try contradiction
+    · exact hdisj _ _ _
+    exact (hdisj _ _ _).symm
+  have hdom : ∀ {x : ℕ → Bool}, x ∈ (inducedMap D).1 := fun {x} => by
+    rw [hanti.map_of_vanishingDiam hdiam fun l => (DP l).property.2]
+    apply mem_univ
+  refine' ⟨fun x => (inducedMap D).2 ⟨x, hdom⟩, _, _, _⟩
+  · rintro y ⟨x, rfl⟩
+    exact map_mem ⟨_, hdom⟩ 0
+  · apply hdiam.map_continuous.comp
+    continuity
+  intro x y hxy
+  simpa only [← Subtype.val_inj] using hdisj'.map_injective hxy
+#align perfect.exists_nat_bool_injection Perfect.exists_nat_bool_injection
+
+end CantorInj
chore: add missing hypothesis names to by_cases (#2679)
Diff
@@ -183,7 +183,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α]
       have hU_cnt : (U ∩ C).Countable := by
         apply @Countable.mono _ _ (E ∩ D ∪ V ∩ C)
         · rintro y ⟨yU, yC⟩
-          by_cases y ∈ V
+          by_cases h : y ∈ V
           · exact mem_union_right _ (mem_inter h yC)
           · exact mem_union_left _ (mem_inter (hU yU) ⟨yC, h⟩)
         exact Countable.union h Vct
feat: port Topology.Perfect (#2069)

Dependencies 10 + 613

614 files ported (98.4%)
270857 lines ported (98.1%)
Show graph

The unported dependencies are

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