doc-next-gen

Mathlib.Topology.Connected.Clopen

Module docstring

{"# Connected subsets and their relation to clopen sets

In this file we show how connected subsets of a topological space are intimately connected to clopen sets.

Main declarations

  • IsClopen.biUnion_connectedComponent_eq: a clopen set is the union of its connected components.
  • PreconnectedSpace.induction₂: an induction principle for preconnected spaces.
  • ConnectedComponents: The connected components of a topological space, as a quotient type.

"}

IsPreconnected.subset_isClopen theorem
{s t : Set α} (hs : IsPreconnected s) (ht : IsClopen t) (hne : (s ∩ t).Nonempty) : s ⊆ t
Full source
/-- Preconnected sets are either contained in or disjoint to any given clopen set. -/
theorem IsPreconnected.subset_isClopen {s t : Set α} (hs : IsPreconnected s) (ht : IsClopen t)
    (hne : (s ∩ t).Nonempty) : s ⊆ t :=
  hs.subset_left_of_subset_union ht.isOpen ht.compl.isOpen disjoint_compl_right (by simp) hne
Preconnected subsets are contained in intersecting clopen sets
Informal description
Let $s$ and $t$ be subsets of a topological space $\alpha$. If $s$ is preconnected, $t$ is clopen (both closed and open), and $s \cap t$ is nonempty, then $s$ is entirely contained in $t$.
Sigma.isConnected_iff theorem
[∀ i, TopologicalSpace (π i)] {s : Set (Σ i, π i)} : IsConnected s ↔ ∃ i t, IsConnected t ∧ s = Sigma.mk i '' t
Full source
theorem Sigma.isConnected_iff [∀ i, TopologicalSpace (π i)] {s : Set (Σ i, π i)} :
    IsConnectedIsConnected s ↔ ∃ i t, IsConnected t ∧ s = Sigma.mk i '' t := by
  refine ⟨fun hs => ?_, ?_⟩
  · obtain ⟨⟨i, x⟩, hx⟩ := hs.nonempty
    have : s ⊆ range (Sigma.mk i) :=
      hs.isPreconnected.subset_isClopen isClopen_range_sigmaMk ⟨⟨i, x⟩, hx, x, rfl⟩
    exact ⟨i, Sigma.mk i ⁻¹' s, hs.preimage_of_isOpenMap sigma_mk_injective isOpenMap_sigmaMk this,
      (Set.image_preimage_eq_of_subset this).symm⟩
  · rintro ⟨i, t, ht, rfl⟩
    exact ht.image _ continuous_sigmaMk.continuousOn
Characterization of Connected Subsets in Disjoint Union Topology
Informal description
Let $\{\pi_i\}_{i \in \iota}$ be a family of topological spaces indexed by $\iota$, and let $s$ be a subset of the disjoint union $\Sigma_{i \in \iota} \pi_i$. Then $s$ is connected if and only if there exists an index $i \in \iota$ and a connected subset $t \subseteq \pi_i$ such that $s$ is the image of $t$ under the canonical inclusion map $\Sigma.\text{mk}_i : \pi_i \to \Sigma_{i \in \iota} \pi_i$.
Sigma.isPreconnected_iff theorem
[hι : Nonempty ι] [∀ i, TopologicalSpace (π i)] {s : Set (Σ i, π i)} : IsPreconnected s ↔ ∃ i t, IsPreconnected t ∧ s = Sigma.mk i '' t
Full source
theorem Sigma.isPreconnected_iff [hι : Nonempty ι] [∀ i, TopologicalSpace (π i)]
    {s : Set (Σ i, π i)} : IsPreconnectedIsPreconnected s ↔ ∃ i t, IsPreconnected t ∧ s = Sigma.mk i '' t := by
  refine ⟨fun hs => ?_, ?_⟩
  · obtain rfl | h := s.eq_empty_or_nonempty
    · exact ⟨Classical.choice hι, ∅, isPreconnected_empty, (Set.image_empty _).symm⟩
    · obtain ⟨a, t, ht, rfl⟩ := Sigma.isConnected_iff.1 ⟨h, hs⟩
      exact ⟨a, t, ht.isPreconnected, rfl⟩
  · rintro ⟨a, t, ht, rfl⟩
    exact ht.image _ continuous_sigmaMk.continuousOn
Characterization of Preconnected Subsets in Disjoint Union Topology
Informal description
Let $\{\pi_i\}_{i \in \iota}$ be a family of topological spaces indexed by a nonempty type $\iota$, and let $s$ be a subset of the disjoint union $\Sigma_{i \in \iota} \pi_i$. Then $s$ is preconnected if and only if there exists an index $i \in \iota$ and a preconnected subset $t \subseteq \pi_i$ such that $s$ is the image of $t$ under the canonical inclusion map $\Sigma.\text{mk}_i : \pi_i \to \Sigma_{i \in \iota} \pi_i$.
Sum.isConnected_iff theorem
[TopologicalSpace β] {s : Set (α ⊕ β)} : IsConnected s ↔ (∃ t, IsConnected t ∧ s = Sum.inl '' t) ∨ ∃ t, IsConnected t ∧ s = Sum.inr '' t
Full source
theorem Sum.isConnected_iff [TopologicalSpace β] {s : Set (α ⊕ β)} :
    IsConnectedIsConnected s ↔
      (∃ t, IsConnected t ∧ s = Sum.inl '' t) ∨ ∃ t, IsConnected t ∧ s = Sum.inr '' t := by
  refine ⟨fun hs => ?_, ?_⟩
  · obtain ⟨x | x, hx⟩ := hs.nonempty
    · have h : s ⊆ range Sum.inl :=
        hs.isPreconnected.subset_isClopen isClopen_range_inl ⟨.inl x, hx, x, rfl⟩
      refine Or.inl ⟨Sum.inl ⁻¹' s, ?_, ?_⟩
      · exact hs.preimage_of_isOpenMap Sum.inl_injective isOpenMap_inl h
      · exact (image_preimage_eq_of_subset h).symm
    · have h : s ⊆ range Sum.inr :=
        hs.isPreconnected.subset_isClopen isClopen_range_inr ⟨.inr x, hx, x, rfl⟩
      refine Or.inr ⟨Sum.inr ⁻¹' s, ?_, ?_⟩
      · exact hs.preimage_of_isOpenMap Sum.inr_injective isOpenMap_inr h
      · exact (image_preimage_eq_of_subset h).symm
  · rintro (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩)
    · exact ht.image _ continuous_inl.continuousOn
    · exact ht.image _ continuous_inr.continuousOn
Characterization of Connected Subsets in Disjoint Union Topology
Informal description
A subset $s$ of the disjoint union $X \oplus Y$ of two topological spaces $X$ and $Y$ is connected if and only if either: 1. There exists a connected subset $t \subseteq X$ such that $s$ is the image of $t$ under the left inclusion map $\text{inl} \colon X \to X \oplus Y$, or 2. There exists a connected subset $t \subseteq Y$ such that $s$ is the image of $t$ under the right inclusion map $\text{inr} \colon Y \to X \oplus Y$.
Sum.isPreconnected_iff theorem
[TopologicalSpace β] {s : Set (α ⊕ β)} : IsPreconnected s ↔ (∃ t, IsPreconnected t ∧ s = Sum.inl '' t) ∨ ∃ t, IsPreconnected t ∧ s = Sum.inr '' t
Full source
theorem Sum.isPreconnected_iff [TopologicalSpace β] {s : Set (α ⊕ β)} :
    IsPreconnectedIsPreconnected s ↔
      (∃ t, IsPreconnected t ∧ s = Sum.inl '' t) ∨ ∃ t, IsPreconnected t ∧ s = Sum.inr '' t := by
  refine ⟨fun hs => ?_, ?_⟩
  · obtain rfl | h := s.eq_empty_or_nonempty
    · exact Or.inl ⟨∅, isPreconnected_empty, (Set.image_empty _).symm⟩
    obtain ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩ := Sum.isConnected_iff.1 ⟨h, hs⟩
    · exact Or.inl ⟨t, ht.isPreconnected, rfl⟩
    · exact Or.inr ⟨t, ht.isPreconnected, rfl⟩
  · rintro (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩)
    · exact ht.image _ continuous_inl.continuousOn
    · exact ht.image _ continuous_inr.continuousOn
Characterization of Preconnected Subsets in Disjoint Union Topology
Informal description
A subset $s$ of the disjoint union $X \oplus Y$ of two topological spaces $X$ and $Y$ is preconnected if and only if either: 1. There exists a preconnected subset $t \subseteq X$ such that $s$ is the image of $t$ under the left inclusion map $\text{inl} \colon X \to X \oplus Y$, or 2. There exists a preconnected subset $t \subseteq Y$ such that $s$ is the image of $t$ under the right inclusion map $\text{inr} \colon Y \to X \oplus Y$.
Continuous.exists_lift_sigma theorem
[ConnectedSpace α] [∀ i, TopologicalSpace (π i)] {f : α → Σ i, π i} (hf : Continuous f) : ∃ (i : ι) (g : α → π i), Continuous g ∧ f = Sigma.mk i ∘ g
Full source
/-- A continuous map from a connected space to a disjoint union `Σ i, π i` can be lifted to one of
the components `π i`. See also `ContinuousMap.exists_lift_sigma` for a version with bundled
`ContinuousMap`s. -/
theorem Continuous.exists_lift_sigma [ConnectedSpace α] [∀ i, TopologicalSpace (π i)]
    {f : α → Σ i, π i} (hf : Continuous f) :
    ∃ (i : ι) (g : α → π i), Continuous g ∧ f = Sigma.mk i ∘ g := by
  obtain ⟨i, hi⟩ : ∃ i, range f ⊆ range (.mk i) := by
    rcases Sigma.isConnected_iff.1 (isConnected_range hf) with ⟨i, s, -, hs⟩
    exact ⟨i, hs.trans_subset (image_subset_range _ _)⟩
  rcases range_subset_range_iff_exists_comp.1 hi with ⟨g, rfl⟩
  refine ⟨i, g, ?_, rfl⟩
  rwa [← IsEmbedding.sigmaMk.continuous_iff] at hf
Lifting of Continuous Maps from Connected Spaces to Disjoint Unions
Informal description
Let $\alpha$ be a connected topological space and $\{\pi_i\}_{i \in \iota}$ be a family of topological spaces. For any continuous function $f \colon \alpha \to \Sigma_{i \in \iota} \pi_i$ (where $\Sigma$ denotes the disjoint union with the disjoint union topology), there exists an index $i \in \iota$ and a continuous function $g \colon \alpha \to \pi_i$ such that $f$ factors as $f = \iota_i \circ g$, where $\iota_i \colon \pi_i \to \Sigma_{i \in \iota} \pi_i$ is the canonical inclusion map.
nonempty_inter theorem
[PreconnectedSpace α] {s t : Set α} : IsOpen s → IsOpen t → s ∪ t = univ → s.Nonempty → t.Nonempty → (s ∩ t).Nonempty
Full source
theorem nonempty_inter [PreconnectedSpace α] {s t : Set α} :
    IsOpen s → IsOpen t → s ∪ t = univ → s.Nonempty → t.Nonempty → (s ∩ t).Nonempty := by
  simpa only [univ_inter, univ_subset_iff] using @PreconnectedSpace.isPreconnected_univ α _ _ s t
Nonempty Intersection of Open Covers in Preconnected Spaces
Informal description
Let $\alpha$ be a preconnected topological space, and let $s$ and $t$ be open subsets of $\alpha$ such that $s \cup t = \alpha$, with both $s$ and $t$ nonempty. Then the intersection $s \cap t$ is nonempty.
isClopen_iff theorem
[PreconnectedSpace α] {s : Set α} : IsClopen s ↔ s = ∅ ∨ s = univ
Full source
theorem isClopen_iff [PreconnectedSpace α] {s : Set α} : IsClopenIsClopen s ↔ s = ∅ ∨ s = univ :=
  ⟨fun hs =>
    by_contradiction fun h =>
      have h1 : s ≠ ∅ ∧ sᶜ ≠ ∅ :=
        ⟨mt Or.inl h,
          mt (fun h2 => Or.inr <| (by rw [← compl_compl s, h2, compl_empty] : s = univ)) h⟩
      let ⟨_, h2, h3⟩ :=
        nonempty_inter hs.2 hs.1.isOpen_compl (union_compl_self s) (nonempty_iff_ne_empty.2 h1.1)
          (nonempty_iff_ne_empty.2 h1.2)
      h3 h2,
    by rintro (rfl | rfl) <;> [exact isClopen_empty; exact isClopen_univ]⟩
Characterization of Clopen Sets in Preconnected Spaces: $s$ clopen $\iff$ $s = \emptyset$ or $s = \alpha$
Informal description
Let $\alpha$ be a preconnected topological space. A subset $s$ of $\alpha$ is clopen (both closed and open) if and only if $s$ is either the empty set or the entire space $\alpha$.
isClopen_preimage_val theorem
{X : Type*} [TopologicalSpace X] {u v : Set X} (hu : IsOpen u) (huv : Disjoint (frontier u) v) : IsClopen (v ↓∩ u)
Full source
lemma isClopen_preimage_val {X : Type*} [TopologicalSpace X] {u v : Set X}
    (hu : IsOpen u) (huv : Disjoint (frontier u) v) : IsClopen (v ↓∩ u) := by
  refine ⟨?_, isOpen_induced hu (f := Subtype.val)⟩
  refine isClosed_induced_iff.mpr ⟨closure u, isClosed_closure, ?_⟩
  apply image_val_injective
  simp only [Subtype.image_preimage_coe]
  rw [closure_eq_self_union_frontier, inter_union_distrib_left, inter_comm _ (frontier u),
    huv.inter_eq, union_empty]
Clopenness of Intersection with Open Set Disjoint from Frontier
Informal description
Let $X$ be a topological space, and let $u, v \subseteq X$ be subsets such that $u$ is open and the frontier of $u$ is disjoint from $v$. Then the intersection $v \cap u$ is a clopen set in the subspace topology on $v$.
subsingleton_of_disjoint_isClopen theorem
(h_clopen : ∀ i, IsClopen (s i)) : Subsingleton ι
Full source
/-- In a preconnected space, any disjoint family of non-empty clopen subsets has at most one
element. -/
lemma subsingleton_of_disjoint_isClopen
    (h_clopen : ∀ i, IsClopen (s i)) :
    Subsingleton ι := by
  replace h_nonempty : ∀ i, s i ≠ ∅ := by intro i; rw [← nonempty_iff_ne_empty]; exact h_nonempty i
  rw [← not_nontrivial_iff_subsingleton]
  by_contra contra
  obtain ⟨i, j, h_ne⟩ := contra
  replace h_ne : s i ∩ s j =  := by
    simpa only [← bot_eq_empty, eq_bot_iff, ← inf_eq_inter, ← disjoint_iff_inf_le] using h_disj h_ne
  rcases isClopen_iff.mp (h_clopen i) with hi | hi
  · exact h_nonempty i hi
  · rw [hi, univ_inter] at h_ne
    exact h_nonempty j h_ne
At Most One Nonempty Clopen Set in Preconnected Space
Informal description
Let $\alpha$ be a preconnected topological space and $\{s_i\}_{i \in \iota}$ be a pairwise disjoint family of non-empty clopen subsets of $\alpha$. Then the index set $\iota$ is a subsingleton (i.e., has at most one element).
subsingleton_of_disjoint_isOpen_iUnion_eq_univ theorem
(h_open : ∀ i, IsOpen (s i)) (h_Union : ⋃ i, s i = univ) : Subsingleton ι
Full source
/-- In a preconnected space, any disjoint cover by non-empty open subsets has at most one
element. -/
lemma subsingleton_of_disjoint_isOpen_iUnion_eq_univ
    (h_open : ∀ i, IsOpen (s i)) (h_Union : ⋃ i, s i = univ) :
    Subsingleton ι := by
  refine subsingleton_of_disjoint_isClopen h_nonempty h_disj (fun i ↦ ⟨?_, h_open i⟩)
  rw [← isOpen_compl_iff, compl_eq_univ_diff, ← h_Union, iUnion_diff]
  refine isOpen_iUnion (fun j ↦ ?_)
  rcases eq_or_ne i j with rfl | h_ne
  · simp
  · simpa only [(h_disj h_ne.symm).sdiff_eq_left] using h_open j
At Most One Partition in Preconnected Space by Pairwise Disjoint Open Sets
Informal description
Let $\alpha$ be a preconnected topological space and $\{s_i\}_{i \in \iota}$ be a pairwise disjoint family of non-empty open subsets of $\alpha$ whose union is the entire space. Then the index set $\iota$ is a subsingleton (i.e., has at most one element).
subsingleton_of_disjoint_isClosed_iUnion_eq_univ theorem
[Finite ι] (h_closed : ∀ i, IsClosed (s i)) (h_Union : ⋃ i, s i = univ) : Subsingleton ι
Full source
/-- In a preconnected space, any finite disjoint cover by non-empty closed subsets has at most one
element. -/
lemma subsingleton_of_disjoint_isClosed_iUnion_eq_univ [Finite ι]
    (h_closed : ∀ i, IsClosed (s i)) (h_Union : ⋃ i, s i = univ) :
    Subsingleton ι := by
  refine subsingleton_of_disjoint_isClopen h_nonempty h_disj (fun i ↦ ⟨h_closed i, ?_⟩)
  rw [← isClosed_compl_iff, compl_eq_univ_diff, ← h_Union, iUnion_diff]
  refine isClosed_iUnion_of_finite (fun j ↦ ?_)
  rcases eq_or_ne i j with rfl | h_ne
  · simp
  · simpa only [(h_disj h_ne.symm).sdiff_eq_left] using h_closed j
At Most One Partition Element in Preconnected Space for Finite Closed Cover
Informal description
Let $\alpha$ be a preconnected topological space and $\{s_i\}_{i \in \iota}$ be a finite family of pairwise disjoint non-empty closed subsets of $\alpha$ whose union is the entire space. Then the index set $\iota$ has at most one element.
frontier_eq_empty_iff theorem
[PreconnectedSpace α] {s : Set α} : frontier s = ∅ ↔ s = ∅ ∨ s = univ
Full source
theorem frontier_eq_empty_iff [PreconnectedSpace α] {s : Set α} :
    frontierfrontier s = ∅ ↔ s = ∅ ∨ s = univ :=
  isClopen_iff_frontier_eq_empty.symm.trans isClopen_iff
Empty Frontier Characterization in Preconnected Spaces: $\text{frontier}(s) = \emptyset \leftrightarrow s = \emptyset \lor s = \alpha$
Informal description
Let $\alpha$ be a preconnected topological space and $s$ be a subset of $\alpha$. The frontier of $s$ is empty if and only if $s$ is either the empty set or the entire space $\alpha$, i.e., $\text{frontier}(s) = \emptyset \leftrightarrow s = \emptyset \lor s = \alpha$.
nonempty_frontier_iff theorem
[PreconnectedSpace α] {s : Set α} : (frontier s).Nonempty ↔ s.Nonempty ∧ s ≠ univ
Full source
theorem nonempty_frontier_iff [PreconnectedSpace α] {s : Set α} :
    (frontier s).Nonempty ↔ s.Nonempty ∧ s ≠ univ := by
  simp only [nonempty_iff_ne_empty, Ne, frontier_eq_empty_iff, not_or]
Nonempty Frontier Characterization in Preconnected Spaces
Informal description
Let $\alpha$ be a preconnected topological space and $s$ be a subset of $\alpha$. The frontier of $s$ is nonempty if and only if $s$ is nonempty and $s$ is not equal to the entire space $\alpha$.
PreconnectedSpace.induction₂' theorem
[PreconnectedSpace α] (P : α → α → Prop) (h : ∀ x, ∀ᶠ y in 𝓝 x, P x y ∧ P y x) (h' : Transitive P) (x y : α) : P x y
Full source
/-- In a preconnected space, given a transitive relation `P`, if `P x y` and `P y x` are true
for `y` close enough to `x`, then `P x y` holds for all `x, y`. This is a version of the fact
that, if an equivalence relation has open classes, then it has a single equivalence class. -/
lemma PreconnectedSpace.induction₂' [PreconnectedSpace α] (P : α → α → Prop)
    (h : ∀ x, ∀ᶠ y in 𝓝 x, P x y ∧ P y x) (h' : Transitive P) (x y : α) :
    P x y := by
  let u := {z | P x z}
  have A : IsClosed u := by
    apply isClosed_iff_nhds.2 (fun z hz ↦ ?_)
    rcases hz _ (h z) with ⟨t, ht, h't⟩
    exact h' h't ht.2
  have B : IsOpen u := by
    apply isOpen_iff_mem_nhds.2 (fun z hz ↦ ?_)
    filter_upwards [h z] with t ht
    exact h' hz ht.1
  have C : u.Nonempty := ⟨x, (mem_of_mem_nhds (h x)).1⟩
  have D : u = Set.univ := IsClopen.eq_univ ⟨A, B⟩ C
  show y ∈ u
  simp [D]
Transitive Relation Induction Principle in Preconnected Spaces
Informal description
Let $\alpha$ be a preconnected topological space and $P : \alpha \to \alpha \to \mathrm{Prop}$ be a transitive relation. Suppose that for every $x \in \alpha$, there exists a neighborhood of $x$ such that for all $y$ in this neighborhood, both $P(x, y)$ and $P(y, x)$ hold. Then $P(x, y)$ holds for all $x, y \in \alpha$.
PreconnectedSpace.induction₂ theorem
[PreconnectedSpace α] (P : α → α → Prop) (h : ∀ x, ∀ᶠ y in 𝓝 x, P x y) (h' : Transitive P) (h'' : Symmetric P) (x y : α) : P x y
Full source
/-- In a preconnected space, if a symmetric transitive relation `P x y` is true for `y` close
enough to `x`, then it holds for all `x, y`. This is a version of the fact that, if an equivalence
relation has open classes, then it has a single equivalence class. -/
lemma PreconnectedSpace.induction₂ [PreconnectedSpace α] (P : α → α → Prop)
    (h : ∀ x, ∀ᶠ y in 𝓝 x, P x y) (h' : Transitive P) (h'' : Symmetric P) (x y : α) :
    P x y := by
  refine PreconnectedSpace.induction₂' P (fun z ↦ ?_) h' x y
  filter_upwards [h z] with a ha
  exact ⟨ha, h'' ha⟩
Global Symmetric Transitive Relation Induction in Preconnected Spaces
Informal description
Let $\alpha$ be a preconnected topological space and $P : \alpha \to \alpha \to \mathrm{Prop}$ be a symmetric and transitive relation. Suppose that for every $x \in \alpha$, there exists a neighborhood of $x$ such that for all $y$ in this neighborhood, $P(x, y)$ holds. Then $P(x, y)$ holds for all $x, y \in \alpha$.
IsPreconnected.induction₂' theorem
{s : Set α} (hs : IsPreconnected s) (P : α → α → Prop) (h : ∀ x ∈ s, ∀ᶠ y in 𝓝[s] x, P x y ∧ P y x) (h' : ∀ x y z, x ∈ s → y ∈ s → z ∈ s → P x y → P y z → P x z) {x y : α} (hx : x ∈ s) (hy : y ∈ s) : P x y
Full source
/-- In a preconnected set, given a transitive relation `P`, if `P x y` and `P y x` are true
for `y` close enough to `x`, then `P x y` holds for all `x, y`. This is a version of the fact
that, if an equivalence relation has open classes, then it has a single equivalence class. -/
lemma IsPreconnected.induction₂' {s : Set α} (hs : IsPreconnected s) (P : α → α → Prop)
    (h : ∀ x ∈ s, ∀ᶠ y in 𝓝[s] x, P x y ∧ P y x)
    (h' : ∀ x y z, x ∈ sy ∈ sz ∈ s → P x y → P y z → P x z)
    {x y : α} (hx : x ∈ s) (hy : y ∈ s) : P x y := by
  let Q : s → s → Prop := fun a b ↦ P a b
  show Q ⟨x, hx⟩ ⟨y, hy⟩
  have : PreconnectedSpace s := Subtype.preconnectedSpace hs
  apply PreconnectedSpace.induction₂'
  · rintro ⟨x, hx⟩
    have Z := h x hx
    rwa [nhdsWithin_eq_map_subtype_coe] at Z
  · rintro ⟨a, ha⟩ ⟨b, hb⟩ ⟨c, hc⟩ hab hbc
    exact h' a b c ha hb hc hab hbc
Transitive Relation Induction on Preconnected Sets
Informal description
Let $s$ be a preconnected subset of a topological space $\alpha$, and let $P : \alpha \to \alpha \to \mathrm{Prop}$ be a transitive relation. Suppose that for every $x \in s$, there exists a neighborhood of $x$ within $s$ such that for all $y$ in this neighborhood, both $P(x, y)$ and $P(y, x)$ hold. Then, for any two points $x, y \in s$, the relation $P(x, y)$ holds.
IsPreconnected.induction₂ theorem
{s : Set α} (hs : IsPreconnected s) (P : α → α → Prop) (h : ∀ x ∈ s, ∀ᶠ y in 𝓝[s] x, P x y) (h' : ∀ x y z, x ∈ s → y ∈ s → z ∈ s → P x y → P y z → P x z) (h'' : ∀ x y, x ∈ s → y ∈ s → P x y → P y x) {x y : α} (hx : x ∈ s) (hy : y ∈ s) : P x y
Full source
/-- In a preconnected set, if a symmetric transitive relation `P x y` is true for `y` close
enough to `x`, then it holds for all `x, y`. This is a version of the fact that, if an equivalence
relation has open classes, then it has a single equivalence class. -/
lemma IsPreconnected.induction₂ {s : Set α} (hs : IsPreconnected s) (P : α → α → Prop)
    (h : ∀ x ∈ s, ∀ᶠ y in 𝓝[s] x, P x y)
    (h' : ∀ x y z, x ∈ sy ∈ sz ∈ s → P x y → P y z → P x z)
    (h'' : ∀ x y, x ∈ sy ∈ s → P x y → P y x)
    {x y : α} (hx : x ∈ s) (hy : y ∈ s) : P x y := by
  apply hs.induction₂' P (fun z hz ↦ ?_) h' hx hy
  filter_upwards [h z hz, self_mem_nhdsWithin] with a ha h'a
  exact ⟨ha, h'' z a hz h'a ha⟩
Symmetric Transitive Relation Induction on Preconnected Sets
Informal description
Let $s$ be a preconnected subset of a topological space $\alpha$, and let $P : \alpha \to \alpha \to \mathrm{Prop}$ be a symmetric and transitive relation. Suppose that for every $x \in s$, there exists a neighborhood of $x$ within $s$ such that for all $y$ in this neighborhood, $P(x, y)$ holds. Then, for any two points $x, y \in s$, the relation $P(x, y)$ holds.
isPreconnected_iff_subset_of_disjoint theorem
{s : Set α} : IsPreconnected s ↔ ∀ u v, IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
Full source
/-- A set `s` is preconnected if and only if for every cover by two open sets that are disjoint on
`s`, it is contained in one of the two covering sets. -/
theorem isPreconnected_iff_subset_of_disjoint {s : Set α} :
    IsPreconnectedIsPreconnected s ↔
      ∀ u v, IsOpen u → IsOpen v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v := by
  constructor <;> intro h
  · intro u v hu hv hs huv
    specialize h u v hu hv hs
    contrapose! huv
    simp only [not_subset] at huv
    rcases huv with ⟨⟨x, hxs, hxu⟩, ⟨y, hys, hyv⟩⟩
    have hxv : x ∈ v := or_iff_not_imp_left.mp (hs hxs) hxu
    have hyu : y ∈ u := or_iff_not_imp_right.mp (hs hys) hyv
    exact h ⟨y, hys, hyu⟩ ⟨x, hxs, hxv⟩
  · intro u v hu hv hs hsu hsv
    by_contra H
    specialize h u v hu hv hs (Set.not_nonempty_iff_eq_empty.mp H)
    apply H
    rcases h with h | h
    · rcases hsv with ⟨x, hxs, hxv⟩
      exact ⟨x, hxs, ⟨h hxs, hxv⟩⟩
    · rcases hsu with ⟨x, hxs, hxu⟩
      exact ⟨x, hxs, ⟨hxu, h hxs⟩⟩
Characterization of Preconnected Sets via Open Covers
Informal description
A subset $s$ of a topological space $\alpha$ is preconnected if and only if for every pair of open sets $u$ and $v$ such that: 1. $s \subseteq u \cup v$, and 2. $s \cap (u \cap v) = \emptyset$, it follows that either $s \subseteq u$ or $s \subseteq v$.
isConnected_iff_sUnion_disjoint_open theorem
{s : Set α} : IsConnected s ↔ ∀ U : Finset (Set α), (∀ u v : Set α, u ∈ U → v ∈ U → (s ∩ (u ∩ v)).Nonempty → u = v) → (∀ u ∈ U, IsOpen u) → (s ⊆ ⋃₀ ↑U) → ∃ u ∈ U, s ⊆ u
Full source
/-- A set `s` is connected if and only if
for every cover by a finite collection of open sets that are pairwise disjoint on `s`,
it is contained in one of the members of the collection. -/
theorem isConnected_iff_sUnion_disjoint_open {s : Set α} :
    IsConnectedIsConnected s ↔
      ∀ U : Finset (Set α), (∀ u v : Set α, u ∈ U → v ∈ U → (s ∩ (u ∩ v)).Nonempty → u = v) →
        (∀ u ∈ U, IsOpen u) → (s ⊆ ⋃₀ ↑U) → ∃ u ∈ U, s ⊆ u := by
  rw [IsConnected, isPreconnected_iff_subset_of_disjoint]
  classical
  refine ⟨fun ⟨hne, h⟩ U hU hUo hsU => ?_, fun h => ⟨?_, fun u v hu hv hs hsuv => ?_⟩⟩
  · induction U using Finset.induction_on with
    | empty => exact absurd (by simpa using hsU) hne.not_subset_empty
    | insert u U uU IH =>
      simp only [← forall_cond_comm, Finset.forall_mem_insert, Finset.exists_mem_insert,
        Finset.coe_insert, sUnion_insert, implies_true, true_and] at *
      refine (h _ hUo.1 (⋃₀ ↑U) (isOpen_sUnion hUo.2) hsU ?_).imp_right ?_
      · refine subset_empty_iff.1 fun x ⟨hxs, hxu, v, hvU, hxv⟩ => ?_
        exact ne_of_mem_of_not_mem hvU uU (hU.1 v hvU ⟨x, hxs, hxu, hxv⟩).symm
      · exact IH (fun u hu => (hU.2 u hu).2) hUo.2
  · simpa [subset_empty_iff, nonempty_iff_ne_empty] using h 
  · rw [← not_nonempty_iff_eq_empty] at hsuv
    have := hsuv; rw [inter_comm u] at this
    simpa [*, or_imp, forall_and] using h {u, v}
Characterization of Connected Sets via Finite Open Covers with Pairwise Disjointness on the Set
Informal description
A subset $s$ of a topological space $\alpha$ is connected if and only if for every finite family $\mathcal{U}$ of open sets that are pairwise disjoint on $s$ (i.e., for any $u, v \in \mathcal{U}$, if $s \cap u \cap v \neq \emptyset$ then $u = v$) and covers $s$ (i.e., $s \subseteq \bigcup \mathcal{U}$), there exists some $u \in \mathcal{U}$ such that $s \subseteq u$.
disjoint_or_subset_of_isClopen theorem
{s t : Set α} (hs : IsPreconnected s) (ht : IsClopen t) : Disjoint s t ∨ s ⊆ t
Full source
/-- Preconnected sets are either contained in or disjoint to any given clopen set. -/
theorem disjoint_or_subset_of_isClopen {s t : Set α} (hs : IsPreconnected s) (ht : IsClopen t) :
    DisjointDisjoint s t ∨ s ⊆ t :=
  (disjoint_or_nonempty_inter s t).imp_right <| hs.subset_isClopen ht
Preconnected Sets are Either Disjoint from or Contained in Clopen Sets
Informal description
Let $s$ and $t$ be subsets of a topological space $\alpha$. If $s$ is preconnected and $t$ is clopen (both closed and open), then either $s$ and $t$ are disjoint or $s$ is entirely contained in $t$.
isPreconnected_iff_subset_of_disjoint_closed theorem
: IsPreconnected s ↔ ∀ u v, IsClosed u → IsClosed v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v
Full source
/-- A set `s` is preconnected if and only if
for every cover by two closed sets that are disjoint on `s`,
it is contained in one of the two covering sets. -/
theorem isPreconnected_iff_subset_of_disjoint_closed :
    IsPreconnectedIsPreconnected s ↔
      ∀ u v, IsClosed u → IsClosed v → s ⊆ u ∪ v → s ∩ (u ∩ v) = ∅ → s ⊆ u ∨ s ⊆ v := by
  constructor <;> intro h
  · intro u v hu hv hs huv
    rw [isPreconnected_closed_iff] at h
    specialize h u v hu hv hs
    contrapose! huv
    simp only [not_subset] at huv
    rcases huv with ⟨⟨x, hxs, hxu⟩, ⟨y, hys, hyv⟩⟩
    have hxv : x ∈ v := or_iff_not_imp_left.mp (hs hxs) hxu
    have hyu : y ∈ u := or_iff_not_imp_right.mp (hs hys) hyv
    exact h ⟨y, hys, hyu⟩ ⟨x, hxs, hxv⟩
  · rw [isPreconnected_closed_iff]
    intro u v hu hv hs hsu hsv
    by_contra H
    specialize h u v hu hv hs (Set.not_nonempty_iff_eq_empty.mp H)
    apply H
    rcases h with h | h
    · rcases hsv with ⟨x, hxs, hxv⟩
      exact ⟨x, hxs, ⟨h hxs, hxv⟩⟩
    · rcases hsu with ⟨x, hxs, hxu⟩
      exact ⟨x, hxs, ⟨hxu, h hxs⟩⟩
Characterization of Preconnected Sets via Disjoint Closed Covers
Informal description
A subset $s$ of a topological space $\alpha$ is preconnected if and only if for any two closed sets $u$ and $v$ such that $s \subseteq u \cup v$ and $s \cap (u \cap v) = \emptyset$, either $s \subseteq u$ or $s \subseteq v$.
isPreconnected_iff_subset_of_fully_disjoint_closed theorem
{s : Set α} (hs : IsClosed s) : IsPreconnected s ↔ ∀ u v, IsClosed u → IsClosed v → s ⊆ u ∪ v → Disjoint u v → s ⊆ u ∨ s ⊆ v
Full source
/-- A closed set `s` is preconnected if and only if for every cover by two closed sets that are
disjoint, it is contained in one of the two covering sets. -/
theorem isPreconnected_iff_subset_of_fully_disjoint_closed {s : Set α} (hs : IsClosed s) :
    IsPreconnectedIsPreconnected s ↔
      ∀ u v, IsClosed u → IsClosed v → s ⊆ u ∪ v → Disjoint u v → s ⊆ u ∨ s ⊆ v := by
  refine isPreconnected_iff_subset_of_disjoint_closed.trans ⟨?_, ?_⟩ <;> intro H u v hu hv hss huv
  · apply H u v hu hv hss
    rw [huv.inter_eq, inter_empty]
  have H1 := H (u ∩ s) (v ∩ s)
  rw [subset_inter_iff, subset_inter_iff] at H1
  simp only [Subset.refl, and_true] at H1
  apply H1 (hu.inter hs) (hv.inter hs)
  · rw [← union_inter_distrib_right]
    exact subset_inter hss Subset.rfl
  · rwa [disjoint_iff_inter_eq_empty, ← inter_inter_distrib_right, inter_comm]
Characterization of Preconnected Closed Sets via Disjoint Closed Covers
Informal description
For a closed subset $s$ of a topological space $\alpha$, $s$ is preconnected if and only if for any two disjoint closed sets $u$ and $v$ covering $s$ (i.e., $s \subseteq u \cup v$ and $u \cap v = \emptyset$), either $s \subseteq u$ or $s \subseteq v$.
IsClopen.connectedComponent_subset theorem
{x} (hs : IsClopen s) (hx : x ∈ s) : connectedComponent x ⊆ s
Full source
theorem IsClopen.connectedComponent_subset {x} (hs : IsClopen s) (hx : x ∈ s) :
    connectedComponentconnectedComponent x ⊆ s :=
  isPreconnected_connectedComponent.subset_isClopen hs ⟨x, mem_connectedComponent, hx⟩
Connected components are contained in intersecting clopen sets
Informal description
For any clopen set $s$ in a topological space and any point $x \in s$, the connected component of $x$ is entirely contained in $s$.
connectedComponent_subset_iInter_isClopen theorem
{x : α} : connectedComponent x ⊆ ⋂ Z : { Z : Set α // IsClopen Z ∧ x ∈ Z }, Z
Full source
/-- The connected component of a point is always a subset of the intersection of all its clopen
neighbourhoods. -/
theorem connectedComponent_subset_iInter_isClopen {x : α} :
    connectedComponentconnectedComponent x ⊆ ⋂ Z : { Z : Set α // IsClopen Z ∧ x ∈ Z }, Z :=
  subset_iInter fun Z => Z.2.1.connectedComponent_subset Z.2.2
Connected Component is Contained in Intersection of Clopen Neighborhoods
Informal description
For any point $x$ in a topological space $\alpha$, the connected component of $x$ is contained in the intersection of all clopen subsets of $\alpha$ that contain $x$. In other words, if $\mathcal{C}(x)$ denotes the connected component of $x$ and $\{Z_i\}_{i \in I}$ is the family of all clopen sets containing $x$, then $\mathcal{C}(x) \subseteq \bigcap_{i \in I} Z_i$.
IsClopen.biUnion_connectedComponent_eq theorem
{Z : Set α} (h : IsClopen Z) : ⋃ x ∈ Z, connectedComponent x = Z
Full source
/-- A clopen set is the union of its connected components. -/
theorem IsClopen.biUnion_connectedComponent_eq {Z : Set α} (h : IsClopen Z) :
    ⋃ x ∈ Z, connectedComponent x = Z :=
  Subset.antisymm (iUnion₂_subset fun _ => h.connectedComponent_subset) fun _ h =>
    mem_iUnion₂_of_mem h mem_connectedComponent
Clopen Sets as Unions of Their Connected Components
Informal description
For any clopen subset $Z$ of a topological space $\alpha$, the union of the connected components of all points in $Z$ equals $Z$ itself, i.e., \[ \bigcup_{x \in Z} \text{connectedComponent}(x) = Z. \]
IsClopen.biUnion_connectedComponentIn theorem
{X : Type*} [TopologicalSpace X] {u v : Set X} (hu : IsClopen (v ↓∩ u)) (huv₁ : u ⊆ v) : u = ⋃ x ∈ u, connectedComponentIn v x
Full source
/-- If `u v : Set X` and `u ⊆ v` is clopen in `v`, then `u` is the union of the connected
components of `v` in `X` which intersect `u`. -/
lemma IsClopen.biUnion_connectedComponentIn {X : Type*} [TopologicalSpace X] {u v : Set X}
    (hu : IsClopen (v ↓∩ u)) (huv₁ : u ⊆ v) :
    u = ⋃ x ∈ u, connectedComponentIn v x := by
  have := congr(((↑) : Set v → Set X) $(hu.biUnion_connectedComponent_eq.symm))
  simp only [Subtype.image_preimage_coe, mem_preimage, iUnion_coe_set, image_val_iUnion,
    inter_eq_right.mpr huv₁] at this
  nth_rw 1 [this]
  congr! 2 with x hx
  simp only [← connectedComponentIn_eq_image]
  exact le_antisymm (iUnion_subset fun _ ↦ le_rfl) <|
    iUnion_subset fun hx ↦ subset_iUnion₂_of_subset (huv₁ hx) hx le_rfl
Clopen Subset as Union of Connected Components in Larger Subset
Informal description
Let $X$ be a topological space and $u, v \subseteq X$ such that $u \subseteq v$. If the intersection $u \cap v$ is clopen in the subspace topology of $v$, then $u$ is equal to the union of the connected components (within $v$) of all points in $u$. In other words, \[ u = \bigcup_{x \in u} \text{connectedComponentIn}_v(x). \]
preimage_connectedComponent_connected theorem
(connected_fibers : ∀ t : β, IsConnected (f ⁻¹' { t })) (hcl : ∀ T : Set β, IsClosed T ↔ IsClosed (f ⁻¹' T)) (t : β) : IsConnected (f ⁻¹' connectedComponent t)
Full source
/-- The preimage of a connected component is preconnected if the function has connected fibers
and a subset is closed iff the preimage is. -/
theorem preimage_connectedComponent_connected
    (connected_fibers : ∀ t : β, IsConnected (f ⁻¹' {t}))
    (hcl : ∀ T : Set β, IsClosedIsClosed T ↔ IsClosed (f ⁻¹' T)) (t : β) :
    IsConnected (f ⁻¹' connectedComponent t) := by
  -- The following proof is essentially https://stacks.math.columbia.edu/tag/0377
  -- although the statement is slightly different
  have hf : Surjective f := Surjective.of_comp fun t : β => (connected_fibers t).1
  refine ⟨Nonempty.preimage connectedComponent_nonempty hf, ?_⟩
  have hT : IsClosed (f ⁻¹' connectedComponent t) :=
    (hcl (connectedComponent t)).1 isClosed_connectedComponent
  -- To show it's preconnected we decompose (f ⁻¹' connectedComponent t) as a subset of two
  -- closed disjoint sets in α. We want to show that it's a subset of either.
  rw [isPreconnected_iff_subset_of_fully_disjoint_closed hT]
  intro u v hu hv huv uv_disj
  -- To do this we decompose connectedComponent t into T₁ and T₂
  -- we will show that connectedComponent t is a subset of either and hence
  -- (f ⁻¹' connectedComponent t) is a subset of u or v
  let T₁ := { t' ∈ connectedComponent t | f ⁻¹' {t'} ⊆ u }
  let T₂ := { t' ∈ connectedComponent t | f ⁻¹' {t'} ⊆ v }
  have fiber_decomp : ∀ t' ∈ connectedComponent t, f ⁻¹' {t'} ⊆ u ∨ f ⁻¹' {t'} ⊆ v := by
    intro t' ht'
    apply isPreconnected_iff_subset_of_disjoint_closed.1 (connected_fibers t').2 u v hu hv
    · exact Subset.trans (preimage_mono (singleton_subset_iff.2 ht')) huv
    rw [uv_disj.inter_eq, inter_empty]
  have T₁_u : f ⁻¹' T₁ = f ⁻¹' connectedComponent tf ⁻¹' connectedComponent t ∩ u := by
    apply eq_of_subset_of_subset
    · rw [← biUnion_preimage_singleton]
      refine iUnion₂_subset fun t' ht' => subset_inter ?_ ht'.2
      rw [hf.preimage_subset_preimage_iff, singleton_subset_iff]
      exact ht'.1
    rintro a ⟨hat, hau⟩
    constructor
    · exact mem_preimage.1 hat
    refine (fiber_decomp (f a) (mem_preimage.1 hat)).resolve_right fun h => ?_
    exact uv_disj.subset_compl_right hau (h rfl)
  -- This proof is exactly the same as the above (modulo some symmetry)
  have T₂_v : f ⁻¹' T₂ = f ⁻¹' connectedComponent tf ⁻¹' connectedComponent t ∩ v := by
    apply eq_of_subset_of_subset
    · rw [← biUnion_preimage_singleton]
      refine iUnion₂_subset fun t' ht' => subset_inter ?_ ht'.2
      rw [hf.preimage_subset_preimage_iff, singleton_subset_iff]
      exact ht'.1
    rintro a ⟨hat, hav⟩
    constructor
    · exact mem_preimage.1 hat
    · refine (fiber_decomp (f a) (mem_preimage.1 hat)).resolve_left fun h => ?_
      exact uv_disj.subset_compl_left hav (h rfl)
  -- Now we show T₁, T₂ are closed, cover connectedComponent t and are disjoint.
  have hT₁ : IsClosed T₁ := (hcl T₁).2 (T₁_u.symmIsClosed.inter hT hu)
  have hT₂ : IsClosed T₂ := (hcl T₂).2 (T₂_v.symmIsClosed.inter hT hv)
  have T_decomp : connectedComponentconnectedComponent t ⊆ T₁ ∪ T₂ := fun t' ht' => by
    rw [mem_union t' T₁ T₂]
    rcases fiber_decomp t' ht' with htu | htv
    · left; exact ⟨ht', htu⟩
    · right; exact ⟨ht', htv⟩
  have T_disjoint : Disjoint T₁ T₂ := by
    refine Disjoint.of_preimage hf ?_
    rw [T₁_u, T₂_v, disjoint_iff_inter_eq_empty, ← inter_inter_distrib_left, uv_disj.inter_eq,
      inter_empty]
  -- Now we do cases on whether (connectedComponent t) is a subset of T₁ or T₂ to show
  -- that the preimage is a subset of u or v.
  rcases (isPreconnected_iff_subset_of_fully_disjoint_closed isClosed_connectedComponent).1
    isPreconnected_connectedComponent T₁ T₂ hT₁ hT₂ T_decomp T_disjoint with h | h
  · left
    rw [Subset.antisymm_iff] at T₁_u
    suffices f ⁻¹' connectedComponent tf ⁻¹' connectedComponent t ⊆ f ⁻¹' T₁
      from (this.trans T₁_u.1).trans inter_subset_right
    exact preimage_mono h
  · right
    rw [Subset.antisymm_iff] at T₂_v
    suffices f ⁻¹' connectedComponent tf ⁻¹' connectedComponent t ⊆ f ⁻¹' T₂
      from (this.trans T₂_v.1).trans inter_subset_right
    exact preimage_mono h
Connectedness of Preimages of Connected Components under Fiberwise Connected and Closed-Preserving Maps
Informal description
Let $f \colon \alpha \to \beta$ be a function between topological spaces such that: 1. For every $t \in \beta$, the fiber $f^{-1}(\{t\})$ is connected. 2. A subset $T \subseteq \beta$ is closed if and only if its preimage $f^{-1}(T)$ is closed in $\alpha$. Then for any $t \in \beta$, the preimage of the connected component of $t$ under $f$ is connected in $\alpha$.
Topology.IsQuotientMap.preimage_connectedComponent theorem
(hf : IsQuotientMap f) (h_fibers : ∀ y : β, IsConnected (f ⁻¹' { y })) (a : α) : f ⁻¹' connectedComponent (f a) = connectedComponent a
Full source
theorem Topology.IsQuotientMap.preimage_connectedComponent (hf : IsQuotientMap f)
    (h_fibers : ∀ y : β, IsConnected (f ⁻¹' {y})) (a : α) :
    f ⁻¹' connectedComponent (f a) = connectedComponent a :=
  ((preimage_connectedComponent_connected h_fibers (fun _ => hf.isClosed_preimage.symm)
      _).subset_connectedComponent mem_connectedComponent).antisymm
    (hf.continuous.mapsTo_connectedComponent a)
Preimage of Connected Component under Quotient Map with Connected Fibers
Informal description
Let $f \colon X \to Y$ be a quotient map between topological spaces such that for every $y \in Y$, the fiber $f^{-1}(\{y\})$ is connected. Then for any point $a \in X$, the preimage of the connected component of $f(a)$ under $f$ equals the connected component of $a$ in $X$, i.e., \[ f^{-1}(\text{connectedComponent}(f(a))) = \text{connectedComponent}(a). \]
Topology.IsQuotientMap.image_connectedComponent theorem
{f : α → β} (hf : IsQuotientMap f) (h_fibers : ∀ y : β, IsConnected (f ⁻¹' { y })) (a : α) : f '' connectedComponent a = connectedComponent (f a)
Full source
lemma Topology.IsQuotientMap.image_connectedComponent {f : α → β} (hf : IsQuotientMap f)
    (h_fibers : ∀ y : β, IsConnected (f ⁻¹' {y})) (a : α) :
    f '' connectedComponent a = connectedComponent (f a) := by
  rw [← hf.preimage_connectedComponent h_fibers, image_preimage_eq _ hf.surjective]
Image of Connected Component under Quotient Map with Connected Fibers
Informal description
Let $f \colon X \to Y$ be a quotient map between topological spaces such that for every $y \in Y$, the fiber $f^{-1}(\{y\})$ is connected. Then for any point $a \in X$, the image of the connected component of $a$ under $f$ equals the connected component of $f(a)$ in $Y$, i.e., \[ f(\text{connectedComponent}(a)) = \text{connectedComponent}(f(a)). \]
connectedComponentSetoid definition
(α : Type*) [TopologicalSpace α] : Setoid α
Full source
/-- The setoid of connected components of a topological space -/
def connectedComponentSetoid (α : Type*) [TopologicalSpace α] : Setoid α :=
  ⟨fun x y => connectedComponent x = connectedComponent y,
    ⟨fun x => by trivial, fun h1 => h1.symm, fun h1 h2 => h1.trans h2⟩⟩
Connected component setoid
Informal description
The setoid (equivalence relation) on a topological space $\alpha$ where two points $x$ and $y$ are equivalent if their connected components are equal, i.e., $x \sim y$ if and only if $\text{connectedComponent}(x) = \text{connectedComponent}(y)$. This equivalence relation is reflexive, symmetric, and transitive by construction.
ConnectedComponents definition
(α : Type u) [TopologicalSpace α]
Full source
/-- The quotient of a space by its connected components -/
def ConnectedComponents (α : Type u) [TopologicalSpace α] :=
  Quotient (connectedComponentSetoid α)
Connected Components of a Topological Space
Informal description
The type of connected components of a topological space $\alpha$, defined as the quotient of $\alpha$ by the equivalence relation where two points are equivalent if they belong to the same connected component.
ConnectedComponents.mk definition
: α → ConnectedComponents α
Full source
/-- Coercion from a topological space to the set of connected components of this space. -/
def mk : α → ConnectedComponents α := Quotient.mk''
Canonical map to connected components
Informal description
The function maps a point $x$ in a topological space $\alpha$ to its corresponding connected component in the quotient space $\text{ConnectedComponents } \alpha$.
ConnectedComponents.instCoeTC instance
: CoeTC α (ConnectedComponents α)
Full source
instance : CoeTC α (ConnectedComponents α) := ⟨mk⟩
Canonical Embedding into Connected Components Space
Informal description
For any topological space $\alpha$, there is a canonical way to view an element of $\alpha$ as an element of its connected components space $\text{ConnectedComponents } \alpha$.
ConnectedComponents.coe_eq_coe theorem
{x y : α} : (x : ConnectedComponents α) = y ↔ connectedComponent x = connectedComponent y
Full source
@[simp]
theorem coe_eq_coe {x y : α} :
    (x : ConnectedComponents α) = y ↔ connectedComponent x = connectedComponent y :=
  Quotient.eq''
Equality in Connected Components Space Corresponds to Equal Connected Components
Informal description
For any two points $x$ and $y$ in a topological space $\alpha$, the equivalence classes of $x$ and $y$ in the connected components space are equal if and only if their connected components in $\alpha$ are equal. In symbols: $$[x] = [y] \leftrightarrow \text{connectedComponent}(x) = \text{connectedComponent}(y)$$
ConnectedComponents.coe_ne_coe theorem
{x y : α} : (x : ConnectedComponents α) ≠ y ↔ connectedComponent x ≠ connectedComponent y
Full source
theorem coe_ne_coe {x y : α} :
    (x : ConnectedComponents α) ≠ y(x : ConnectedComponents α) ≠ y ↔ connectedComponent x ≠ connectedComponent y :=
  coe_eq_coe.not
Inequality in Connected Components Space Corresponds to Unequal Connected Components
Informal description
For any two points $x$ and $y$ in a topological space $\alpha$, the equivalence classes of $x$ and $y$ in the connected components space are not equal if and only if their connected components in $\alpha$ are not equal. In symbols: $$[x] \neq [y] \leftrightarrow \text{connectedComponent}(x) \neq \text{connectedComponent}(y)$$
ConnectedComponents.coe_eq_coe' theorem
{x y : α} : (x : ConnectedComponents α) = y ↔ x ∈ connectedComponent y
Full source
theorem coe_eq_coe' {x y : α} : (x : ConnectedComponents α) = y ↔ x ∈ connectedComponent y :=
  coe_eq_coe.trans connectedComponent_eq_iff_mem
Equality in Connected Components Space via Membership in Connected Component
Informal description
For any two points $x$ and $y$ in a topological space $\alpha$, the equivalence classes of $x$ and $y$ in the connected components space are equal if and only if $x$ belongs to the connected component of $y$. In symbols: $$[x] = [y] \leftrightarrow x \in \text{connectedComponent}(y)$$
ConnectedComponents.instInhabited instance
[Inhabited α] : Inhabited (ConnectedComponents α)
Full source
instance [Inhabited α] : Inhabited (ConnectedComponents α) :=
  ⟨mk default⟩
Inhabited Space of Connected Components for Inhabited Topological Spaces
Informal description
For any inhabited topological space $\alpha$, the space of connected components $\text{ConnectedComponents}(\alpha)$ is also inhabited.
ConnectedComponents.instTopologicalSpace instance
: TopologicalSpace (ConnectedComponents α)
Full source
instance : TopologicalSpace (ConnectedComponents α) :=
  inferInstanceAs (TopologicalSpace (Quotient _))
Topology on the Space of Connected Components
Informal description
The space of connected components of a topological space $\alpha$ is equipped with the quotient topology induced by the natural projection $\alpha \to \text{ConnectedComponents}(\alpha)$.
ConnectedComponents.surjective_coe theorem
: Surjective (mk : α → ConnectedComponents α)
Full source
theorem surjective_coe : Surjective (mk : α → ConnectedComponents α) :=
  Quot.mk_surjective
Surjectivity of the Connected Component Projection
Informal description
The canonical projection map $\pi : \alpha \to \text{ConnectedComponents}(\alpha)$, which sends each point to its connected component, is surjective. That is, for every connected component $C$ in $\text{ConnectedComponents}(\alpha)$, there exists a point $x \in \alpha$ such that $\pi(x) = C$.
ConnectedComponents.isQuotientMap_coe theorem
: IsQuotientMap (mk : α → ConnectedComponents α)
Full source
theorem isQuotientMap_coe : IsQuotientMap (mk : α → ConnectedComponents α) :=
  isQuotientMap_quot_mk
Quotient Map Property of the Connected Component Projection
Informal description
The canonical projection map $\pi : \alpha \to \text{ConnectedComponents}(\alpha)$, which sends each point to its connected component, is a quotient map. That is, $\pi$ is continuous and surjective, and the topology on $\text{ConnectedComponents}(\alpha)$ is the finest topology for which $\pi$ is continuous.
ConnectedComponents.continuous_coe theorem
: Continuous (mk : α → ConnectedComponents α)
Full source
@[continuity]
theorem continuous_coe : Continuous (mk : α → ConnectedComponents α) :=
  isQuotientMap_coe.continuous
Continuity of the Connected Component Projection
Informal description
The canonical projection map $\pi \colon \alpha \to \text{ConnectedComponents}(\alpha)$, which sends each point to its connected component, is continuous.
ConnectedComponents.range_coe theorem
: range (mk : α → ConnectedComponents α) = univ
Full source
@[simp]
theorem range_coe : range (mk : α → ConnectedComponents α) = univ :=
  surjective_coe.range_eq
Range of Connected Component Projection is Universal Set
Informal description
The range of the canonical projection map $\pi : \alpha \to \text{ConnectedComponents}(\alpha)$, which sends each point to its connected component, is equal to the universal set of $\text{ConnectedComponents}(\alpha)$. That is, every connected component in $\text{ConnectedComponents}(\alpha)$ is the image of some point in $\alpha$ under $\pi$.
connectedComponents_preimage_singleton theorem
{x : α} : (↑) ⁻¹' ({↑x} : Set (ConnectedComponents α)) = connectedComponent x
Full source
/-- The preimage of a singleton in `connectedComponents` is the connected component
of an element in the equivalence class. -/
theorem connectedComponents_preimage_singleton {x : α} :
    (↑) ⁻¹' ({↑x} : Set (ConnectedComponents α)) = connectedComponent x := by
  ext y
  rw [mem_preimage, mem_singleton_iff, ConnectedComponents.coe_eq_coe']
Preimage of Connected Component Singleton is the Connected Component
Informal description
For any point $x$ in a topological space $\alpha$, the preimage of the singleton set $\{[x]\}$ under the canonical projection $\pi \colon \alpha \to \text{ConnectedComponents}(\alpha)$ is equal to the connected component of $x$. In symbols: $$\pi^{-1}(\{[x]\}) = \text{connectedComponent}(x)$$
connectedComponents_preimage_image theorem
(U : Set α) : (↑) ⁻¹' ((↑) '' U : Set (ConnectedComponents α)) = ⋃ x ∈ U, connectedComponent x
Full source
/-- The preimage of the image of a set under the quotient map to `connectedComponents α`
is the union of the connected components of the elements in it. -/
theorem connectedComponents_preimage_image (U : Set α) :
    (↑) ⁻¹' ((↑) '' U : Set (ConnectedComponents α)) = ⋃ x ∈ U, connectedComponent x := by
  simp only [connectedComponents_preimage_singleton, preimage_iUnion₂, image_eq_iUnion]
Preimage of Image under Connected Component Projection is Union of Connected Components
Informal description
For any subset $U$ of a topological space $\alpha$, the preimage under the canonical projection $\pi \colon \alpha \to \text{ConnectedComponents}(\alpha)$ of the image of $U$ under $\pi$ is equal to the union of the connected components of all points in $U$. In symbols: $$\pi^{-1}(\pi(U)) = \bigcup_{x \in U} \text{connectedComponent}(x)$$
isPreconnected_of_forall_constant theorem
{s : Set α} (hs : ∀ f : α → Bool, ContinuousOn f s → ∀ x ∈ s, ∀ y ∈ s, f x = f y) : IsPreconnected s
Full source
/-- If every map to `Bool` (a discrete two-element space), that is
continuous on a set `s`, is constant on s, then s is preconnected -/
theorem isPreconnected_of_forall_constant {s : Set α}
    (hs : ∀ f : α → Bool, ContinuousOn f s → ∀ x ∈ s, ∀ y ∈ s, f x = f y) : IsPreconnected s := by
  unfold IsPreconnected
  by_contra!
  rcases this with ⟨u, v, u_op, v_op, hsuv, ⟨x, x_in_s, x_in_u⟩, ⟨y, y_in_s, y_in_v⟩, H⟩
  have hy : y ∉ u := fun y_in_u => eq_empty_iff_forall_not_mem.mp H y ⟨y_in_s, ⟨y_in_u, y_in_v⟩⟩
  have : ContinuousOn u.boolIndicator s := by
    apply (continuousOn_boolIndicator_iff_isClopen _ _).mpr ⟨_, _⟩
    · rw [preimage_subtype_coe_eq_compl hsuv H]
      exact (v_op.preimage continuous_subtype_val).isClosed_compl
    · exact u_op.preimage continuous_subtype_val
  simpa [(u.mem_iff_boolIndicator _).mp x_in_u, (u.not_mem_iff_boolIndicator _).mp hy] using
    hs _ this x x_in_s y y_in_s
Preconnectedness via Constant Boolean-Valued Continuous Functions
Informal description
A subset $s$ of a topological space $\alpha$ is preconnected if every continuous function $f \colon \alpha \to \mathrm{Bool}$ (where $\mathrm{Bool}$ has the discrete topology) that is continuous on $s$ is constant on $s$.
preconnectedSpace_of_forall_constant theorem
(hs : ∀ f : α → Bool, Continuous f → ∀ x y, f x = f y) : PreconnectedSpace α
Full source
/-- A `PreconnectedSpace` version of `isPreconnected_of_forall_constant` -/
theorem preconnectedSpace_of_forall_constant
    (hs : ∀ f : α → Bool, Continuous f → ∀ x y, f x = f y) : PreconnectedSpace α :=
  ⟨isPreconnected_of_forall_constant fun f hf x _ y _ =>
      hs f (continuous_iff_continuousOn_univ.mpr hf) x y⟩
Characterization of Preconnected Spaces via Constant Boolean-Valued Functions
Informal description
A topological space $\alpha$ is preconnected if every continuous function $f \colon \alpha \to \mathrm{Bool}$ (where $\mathrm{Bool}$ has the discrete topology) is constant on $\alpha$.