Lean library · module TopologyByExample.Theorems.Compactness
Compactness properties: disjoint sums, products and a few implications
For compactness, σ-compactness, countable compactness, sequential compactness and weak local
compactness, a binary disjoint sum X ⊕ Y has the property if and only if both summands have it.
Mathlib has the instances for compactness and σ-compactness of X ⊕ Y; this file adds the others
and the equivalences. It also proves a few implications through intermediate properties that the
second study of the project uses.
Main statements
TopologyByExample.compactSpace_sum_iff,sigmaCompactSpace_sum_iff,countablyCompactSpace_sum_iff,weaklyLocallyCompactSpace_sum_iff;TopologyByExample.sigmaCompactSpace_of_countable: a countable space is σ-compact;TopologyByExample.sigmaCompactSpace_of_lindelofSpace_of_weaklyLocallyCompactSpace;TopologyByExample.limitPointCompact_of_countablyCompactSpace: in a countably compact space, every infinite set has an accumulation point;TopologyByExample.countableExtent_of_limitPointCompact;TopologyByExample.compactSpace_of_separableSpace_of_omegaBounded;TopologyByExample.compactSpace_prod_iff,compactSpace_pi_nat_iff;TopologyByExample.nhds_eq_comap_of_preimage_singleton: for a continuous map from a compact space to a Hausdorff space, the neighbourhoods of the only preimage of a point are the preimages of the neighbourhoods of that point;IsSeqCompact.union,isSeqCompact_singleton: a union of two sequentially compact sets, and a singleton, are sequentially compact;TopologyByExample.seqCompactSpace_of_compactSpace_of_countable: a countable compact space is sequentially compact (with no separation axiom).
This file was written by Claude (Anthropic's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.
Imports
theorem IsSeqCompact.union
A union of two sequentially compact sets is sequentially compact.
theorem IsSeqCompact.union {X : Type*} [TopologicalSpace X] {s t : Set X} (hs : IsSeqCompact s)
(ht : IsSeqCompact t) : IsSeqCompact (s ∪ t)
Proof
:= by
intro x hx
by_cases h : ∃ᶠ n in atTop, x n ∈ s
· obtain ⟨φ, hφ, hφs⟩ := extraction_of_frequently_atTop h
obtain ⟨a, ha, ψ, hψ, hlim⟩ := hs hφs
exact ⟨a, .inl ha, φ ∘ ψ, hφ.comp hψ, hlim⟩
· have : ∃ᶠ n in atTop, x n ∈ t :=
(not_frequently.1 h).frequently.mono fun n hn ↦ (hx n).resolve_left hn
obtain ⟨φ, hφ, hφt⟩ := extraction_of_frequently_atTop this
obtain ⟨a, ha, ψ, hψ, hlim⟩ := ht hφt
exact ⟨a, .inr ha, φ ∘ ψ, hφ.comp hψ, hlim⟩
On this site: Theorem: A union of two sequentially compact sets is sequentially compact
theorem isSeqCompact_singleton
A singleton is sequentially compact.
theorem isSeqCompact_singleton {X : Type*} [TopologicalSpace X] {a : X} :
IsSeqCompact ({a} : Set X)
Proof
:= fun _ hx ↦
⟨a, rfl, id, strictMono_id, tendsto_const_nhds.congr fun n ↦ (hx n).symm⟩
variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y]
Disjoint sums
theorem compactSpace_sum_iff
TopologyByExample.compactSpace_sum_iff
A disjoint sum is compact if and only if both summands are.
theorem compactSpace_sum_iff : CompactSpace (X ⊕ Y) ↔ CompactSpace X ∧ CompactSpace Y
Proof
:=
⟨fun _ ↦ ⟨(IsClosedEmbedding.inl (Y := Y)).compactSpace,
(IsClosedEmbedding.inr (X := X)).compactSpace⟩, fun ⟨_, _⟩ ↦ inferInstance⟩
On this site: Theorem: A disjoint sum is compact iff both summands are
theorem sigmaCompactSpace_sum_iff
TopologyByExample.sigmaCompactSpace_sum_iff
A disjoint sum is σ-compact if and only if both summands are.
theorem sigmaCompactSpace_sum_iff :
SigmaCompactSpace (X ⊕ Y) ↔ SigmaCompactSpace X ∧ SigmaCompactSpace Y
Proof
:=
⟨fun _ ↦ ⟨(IsClosedEmbedding.inl (Y := Y)).sigmaCompactSpace,
(IsClosedEmbedding.inr (X := X)).sigmaCompactSpace⟩, fun ⟨_, _⟩ ↦ inferInstance⟩
On this site: Theorem: A disjoint sum is σ-compact iff both summands are
theorem countablyCompactSpace
Topology.IsClosedEmbedding.countablyCompactSpace
A closed embedding pulls back countable compactness.
theorem _root_.Topology.IsClosedEmbedding.countablyCompactSpace {f : X → Y}
(hf : IsClosedEmbedding f) [CountablyCompactSpace Y] : CountablyCompactSpace X
Proof
:= by
rw [← isCountablyCompact_univ_iff, hf.isEmbedding.isCountablyCompact_iff, image_univ]
exact (isCountablyCompact_univ_iff.2 ‹_›).of_isClosed_subset hf.isClosed_range (subset_univ _)
theorem countablyCompactSpace_sum_iff
TopologyByExample.countablyCompactSpace_sum_iff
A disjoint sum is countably compact if and only if both summands are.
theorem countablyCompactSpace_sum_iff :
CountablyCompactSpace (X ⊕ Y) ↔ CountablyCompactSpace X ∧ CountablyCompactSpace Y
Proof
:= by
refine ⟨fun _ ↦ ⟨(IsClosedEmbedding.inl (Y := Y)).countablyCompactSpace,
(IsClosedEmbedding.inr (X := X)).countablyCompactSpace⟩, fun ⟨hX, hY⟩ ↦ ?_⟩
rw [← isCountablyCompact_univ_iff, ← range_inl_union_range_inr, ← image_univ, ← image_univ]
exact ((isCountablyCompact_univ_iff.2 hX).image continuous_inl).union
((isCountablyCompact_univ_iff.2 hY).image continuous_inr)
On this site: Theorem: A disjoint sum is countably compact iff both summands are
theorem seqCompactSpace
Topology.IsClosedEmbedding.seqCompactSpace
A closed embedding pulls back sequential compactness.
theorem _root_.Topology.IsClosedEmbedding.seqCompactSpace {f : X → Y} (hf : IsClosedEmbedding f)
[SeqCompactSpace Y] : SeqCompactSpace X
Proof
:= by
refine ⟨fun u _ ↦ ?_⟩
obtain ⟨y, -, φ, hφ, h⟩ := isSeqCompact_univ (X := Y) (x := f ∘ u) fun _ ↦ mem_univ _
obtain ⟨x, rfl⟩ : y ∈ range f :=
hf.isClosed_range.mem_of_tendsto h (Eventually.of_forall fun n ↦ mem_range_self _)
exact ⟨x, mem_univ _, φ, hφ, hf.isInducing.tendsto_nhds_iff.2 h⟩
theorem exists_tendsto_subseq_of_frequently
TopologyByExample.exists_tendsto_subseq_of_frequently
If infinitely many terms of a sequence lie in the image of g, and the sequence of their
preimages has a convergent subsequence in every case, then so does the sequence.
private theorem exists_tendsto_subseq_of_frequently {Z : Type*} [TopologicalSpace Z]
[SeqCompactSpace Z] {g : Z → X ⊕ Y} (hg : Continuous g) {u : ℕ → X ⊕ Y}
(h : ∃ᶠ n in atTop, ∃ z, u n = g z) :
∃ a, ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (u ∘ φ) atTop (𝓝 a)
Proof
:= by
obtain ⟨φ, hφ, hz⟩ := extraction_of_frequently_atTop h
choose v hv using hz
obtain ⟨z, -, ψ, hψ, hzψ⟩ := isSeqCompact_univ (X := Z) (x := v) fun _ ↦ mem_univ _
refine ⟨g z, φ ∘ ψ, hφ.comp hψ, ?_⟩
have : u ∘ (φ ∘ ψ) = g ∘ (v ∘ ψ) := funext fun n ↦ hv (ψ n)
rw [this]
exact (hg.tendsto z).comp hzψ
theorem seqCompactSpace_sum_iff
TopologyByExample.seqCompactSpace_sum_iff
A disjoint sum is sequentially compact if and only if both summands are.
theorem seqCompactSpace_sum_iff :
SeqCompactSpace (X ⊕ Y) ↔ SeqCompactSpace X ∧ SeqCompactSpace Y
Proof
:= by
refine ⟨fun _ ↦ ⟨(IsClosedEmbedding.inl (Y := Y)).seqCompactSpace,
(IsClosedEmbedding.inr (X := X)).seqCompactSpace⟩, fun ⟨_, _⟩ ↦ ⟨fun u _ ↦ ?_⟩⟩
by_cases h : ∃ᶠ n in atTop, ∃ x, u n = Sum.inl x
· obtain ⟨a, φ, hφ, ha⟩ := exists_tendsto_subseq_of_frequently continuous_inl h
exact ⟨a, mem_univ _, φ, hφ, ha⟩
· have h' : ∃ᶠ n in atTop, ∃ y, u n = Sum.inr y := by
refine (not_frequently.1 h).frequently.mono fun n hn ↦ ?_
rcases hu : u n with x | y
· exact absurd ⟨x, hu⟩ hn
· exact ⟨y, rfl⟩
obtain ⟨a, φ, hφ, ha⟩ := exists_tendsto_subseq_of_frequently continuous_inr h'
exact ⟨a, mem_univ _, φ, hφ, ha⟩
On this site: Theorem: A disjoint sum is sequentially compact iff both summands are
theorem weaklyLocallyCompactSpace_sum_iff
TopologyByExample.weaklyLocallyCompactSpace_sum_iff
A disjoint sum is weakly locally compact if and only if both summands are.
theorem weaklyLocallyCompactSpace_sum_iff :
WeaklyLocallyCompactSpace (X ⊕ Y) ↔
WeaklyLocallyCompactSpace X ∧ WeaklyLocallyCompactSpace Y
Proof
:= by
refine ⟨fun _ ↦ ⟨(IsClosedEmbedding.inl (Y := Y)).weaklyLocallyCompactSpace,
(IsClosedEmbedding.inr (X := X)).weaklyLocallyCompactSpace⟩, fun ⟨hX, hY⟩ ↦ ⟨?_⟩⟩
rintro (x | y)
· obtain ⟨K, hK, hKx⟩ := hX.exists_compact_mem_nhds x
exact ⟨_, hK.image continuous_inl, IsOpenEmbedding.inl.image_mem_nhds.2 hKx⟩
· obtain ⟨K, hK, hKy⟩ := hY.exists_compact_mem_nhds y
exact ⟨_, hK.image continuous_inr, IsOpenEmbedding.inr.image_mem_nhds.2 hKy⟩
On this site: Theorem: A disjoint sum is weakly locally compact iff both summands are
Implications
theorem sigmaCompactSpace_of_countable
TopologyByExample.sigmaCompactSpace_of_countable
A countable space is σ-compact: it is the countable union of its (compact) singletons.
theorem sigmaCompactSpace_of_countable [Countable X] : SigmaCompactSpace X
Proof
:= by
rw [← isSigmaCompact_univ_iff, ← biUnion_of_singleton univ]
exact isSigmaCompact_biUnion countable_univ fun x _ ↦ isCompact_singleton.isSigmaCompact
On this site: Theorem: Countable spaces are σ-compact
theorem sigmaCompactSpace_of_lindelofSpace_of_weaklyLocallyCompactSpace
TopologyByExample.sigmaCompactSpace_of_lindelofSpace_of_weaklyLocallyCompactSpace
A weakly locally compact Lindelöf space is σ-compact: countably many interiors of compact neighbourhoods cover it.
theorem sigmaCompactSpace_of_lindelofSpace_of_weaklyLocallyCompactSpace [LindelofSpace X]
[WeaklyLocallyCompactSpace X] : SigmaCompactSpace X
Proof
:= by
choose K hK hKx using fun x : X ↦ exists_compact_mem_nhds x
obtain ⟨t, htc, hcov⟩ := isLindelof_univ.elim_countable_subcover (fun x ↦ interior (K x))
(fun _ ↦ isOpen_interior) fun x _ ↦ mem_iUnion.2 ⟨x, mem_interior_iff_mem_nhds.2 (hKx x)⟩
rw [← isSigmaCompact_univ_iff]
have : (⋃ x ∈ t, K x) = univ :=
eq_univ_of_univ_subset (hcov.trans (iUnion₂_mono fun x _ ↦ interior_subset))
exact this ▸ isSigmaCompact_biUnion htc fun x _ ↦ (hK x).isSigmaCompact
On this site: Theorem: Weakly locally compact Lindelöf spaces are σ-compact
theorem limitPointCompact_of_countablyCompactSpace
TopologyByExample.limitPointCompact_of_countablyCompactSpace
In a countably compact space every infinite set has an accumulation point: the space is limit point compact.
theorem limitPointCompact_of_countablyCompactSpace [CountablyCompactSpace X] :
∀ s : Set X, s.Infinite → ∃ x, AccPt x (𝓟 s)
Proof
:= fun s hs ↦
let ⟨x, _, hx⟩ := (isCountablyCompact_univ_iff.2 ‹_›).exists_accPt_of_infinite (subset_univ s) hs
⟨x, hx⟩
On this site: Theorem: Countably compact spaces are limit point compact
theorem countableExtent_of_limitPointCompact
TopologyByExample.countableExtent_of_limitPointCompact
A limit point compact space has countable extent: every uncountable set is infinite, so it has an accumulation point.
theorem countableExtent_of_limitPointCompact (h : ∀ s : Set X, s.Infinite → ∃ x, AccPt x (𝓟 s)) :
∀ s : Set X, ¬s.Countable → ∃ x, AccPt x (𝓟 s)
Proof
:= fun s hs ↦
h s fun hf ↦ hs hf.countable
On this site: Theorem: Limit point compact spaces have countable extent
theorem compactSpace_of_separableSpace_of_omegaBounded
TopologyByExample.compactSpace_of_separableSpace_of_omegaBounded
A separable space in which every countable set has compact closure is compact.
theorem compactSpace_of_separableSpace_of_omegaBounded [SeparableSpace X]
(h : ∀ s : Set X, s.Countable → IsCompact (closure s)) : CompactSpace X
Proof
:= by
obtain ⟨s, hs, hd⟩ := exists_countable_dense X
exact ⟨hd.closure_eq ▸ h s hs⟩
On this site: Theorem: Separable ω-bounded spaces are compact
Products
theorem compactSpace_prod_iff
TopologyByExample.compactSpace_prod_iff
A product of two nonempty spaces is compact if and only if both factors are.
theorem compactSpace_prod_iff [Nonempty X] [Nonempty Y] :
CompactSpace (X × Y) ↔ CompactSpace X ∧ CompactSpace Y
Proof
:=
⟨fun _ ↦ ⟨Function.Surjective.compactSpace (continuous_fst (X := X) (Y := Y)) Prod.fst_surjective,
Function.Surjective.compactSpace (continuous_snd (X := X) (Y := Y)) Prod.snd_surjective⟩,
fun ⟨_, _⟩ ↦ inferInstance⟩
On this site: Theorem: A product of two nonempty spaces is compact iff both factors are
theorem sigmaCompactSpace_of_surjective
TopologyByExample.sigmaCompactSpace_of_surjective
The image of a σ-compact space under a continuous surjection is σ-compact.
theorem sigmaCompactSpace_of_surjective [SigmaCompactSpace X] {f : X → Y} (hf : Continuous f)
(hs : Function.Surjective f) : SigmaCompactSpace Y
Proof
:= by
rw [← isSigmaCompact_univ_iff, ← hs.range_eq, ← image_univ]
exact isSigmaCompact_univ.image hf
theorem sigmaCompactSpace_prod_iff
TopologyByExample.sigmaCompactSpace_prod_iff
A product of two nonempty spaces is σ-compact if and only if both factors are.
theorem sigmaCompactSpace_prod_iff [Nonempty X] [Nonempty Y] :
SigmaCompactSpace (X × Y) ↔ SigmaCompactSpace X ∧ SigmaCompactSpace Y
Proof
:=
⟨fun _ ↦ ⟨sigmaCompactSpace_of_surjective (continuous_fst (X := X) (Y := Y)) Prod.fst_surjective,
sigmaCompactSpace_of_surjective (continuous_snd (X := X) (Y := Y)) Prod.snd_surjective⟩,
fun ⟨_, _⟩ ↦ inferInstance⟩
On this site: Theorem: A product of two nonempty spaces is σ-compact iff both factors are
theorem weaklyLocallyCompactSpace_prod_iff
TopologyByExample.weaklyLocallyCompactSpace_prod_iff
A product of two nonempty spaces is weakly locally compact if and only if both factors are.
theorem weaklyLocallyCompactSpace_prod_iff [Nonempty X] [Nonempty Y] :
WeaklyLocallyCompactSpace (X × Y) ↔
WeaklyLocallyCompactSpace X ∧ WeaklyLocallyCompactSpace Y
Proof
:=
⟨fun _ ↦ ⟨(isOpenQuotientMap_fst (X := X) (Y := Y)).weaklyLocallyCompactSpace,
(isOpenQuotientMap_snd (X := X) (Y := Y)).weaklyLocallyCompactSpace⟩,
fun ⟨_, _⟩ ↦ inferInstance⟩
On this site: Theorem: A product of two nonempty spaces is weakly locally compact iff both factors are
theorem compactSpace_pi_nat_iff
TopologyByExample.compactSpace_pi_nat_iff
A countable power ℕ → X is compact if and only if X is.
theorem compactSpace_pi_nat_iff : CompactSpace (ℕ → X) ↔ CompactSpace X
Proof
:= by
refine ⟨fun _ ↦ ?_, fun _ ↦ inferInstance⟩
rcases isEmpty_or_nonempty X with hX | hX
· infer_instance
· exact Function.Surjective.compactSpace (continuous_apply 0)
fun x ↦ ⟨fun _ ↦ x, rfl⟩
On this site: Theorem: A countable power is compact iff the space is
Neighbourhoods and maps from compact spaces
theorem nhds_eq_comap_of_preimage_singleton
TopologyByExample.nhds_eq_comap_of_preimage_singleton
If f is a continuous map from a compact space to a Hausdorff space and x is the only point
mapped to y, then the neighbourhoods of x are the preimages of the neighbourhoods of y.
theorem nhds_eq_comap_of_preimage_singleton {X Y : Type*} [TopologicalSpace X]
[TopologicalSpace Y] [CompactSpace X] [T2Space Y] {f : X → Y}
(hf : Continuous f) {x : X} {y : Y} (h : f ⁻¹' {y} = {x}) : 𝓝 x = comap f (𝓝 y)
Proof
:= by
have hfx : f x = y := by
have : x ∈ f ⁻¹' {y} := h ▸ rfl
exact this
refine le_antisymm (hfx ▸ (hf.tendsto x).le_comap) fun N hN ↦ ?_
obtain ⟨U, hUN, hU, hxU⟩ := mem_nhds_iff.1 hN
have hC : IsClosed (f '' Uᶜ) := (hU.isClosed_compl.isCompact.image hf).isClosed
have hy : y ∉ f '' Uᶜ := by
rintro ⟨z, hz, hzy⟩
have : z ∈ f ⁻¹' {y} := hzy
rw [h] at this
exact hz (this ▸ hxU)
refine mem_comap.2 ⟨(f '' Uᶜ)ᶜ, hC.isOpen_compl.mem_nhds hy, fun z hz ↦ hUN ?_⟩
by_contra hzU
exact hz ⟨z, hzU, rfl⟩
On this site: Theorem: Neighbourhoods of the only preimage of a point under a map from a compact space
Countable compact spaces
theorem exists_strictMono_tendsto_of_finite
TopologyByExample.exists_strictMono_tendsto_of_finite
If, for every open set U containing a, only finitely many indices n in an infinite set
s have x n ∉ U, then some subsequence of x converges to a.
theorem exists_strictMono_tendsto_of_finite {x : ℕ → X} {a : X} {s : Set ℕ} (hs : s.Infinite)
(h : ∀ U, IsOpen U → a ∈ U → {n | n ∈ s ∧ x n ∉ U}.Finite) :
∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (𝓝 a)
Proof
:= by
obtain ⟨φ, hφ, hφs⟩ := extraction_of_frequently_atTop (Nat.frequently_atTop_iff_infinite.2 hs)
refine ⟨φ, hφ, (nhds_basis_opens a).tendsto_right_iff.2 fun U ⟨haU, hU⟩ ↦ ?_⟩
have hfin : ∀ᶠ n in atTop, n ∉ {n | n ∈ s ∧ x n ∉ U} := by
rw [← Nat.cofinite_eq_atTop]
exact (h U hU haU).compl_mem_cofinite
filter_upwards [hφ.tendsto_atTop.eventually hfin] with n hn
by_contra hxn
exact hn ⟨hφs n, hxn⟩
theorem seqCompactSpace_of_compactSpace_of_countable
TopologyByExample.seqCompactSpace_of_compactSpace_of_countable
A countable compact space is sequentially compact. No separation axiom is assumed.
theorem seqCompactSpace_of_compactSpace_of_countable [CompactSpace X] [Countable X] :
SeqCompactSpace X
Proof
:= by
refine ⟨fun x _ ↦ ?_⟩
by_contra hcon
push Not at hcon
have : Nonempty X := ⟨x 0⟩
obtain ⟨e, he⟩ := exists_surjective_nat X
-- For every point `a` and every infinite set of indices, some open set containing `a` misses
-- infinitely many of the terms with those indices.
have step : ∀ (a : X) (s : Set ℕ), s.Infinite →
∃ U, IsOpen U ∧ a ∈ U ∧ {n | n ∈ s ∧ x n ∉ U}.Infinite := by
intro a s hs
by_contra hU
push Not at hU
obtain ⟨φ, hφ, hlim⟩ := exists_strictMono_tendsto_of_finite hs hU
exact hcon a (mem_univ a) φ hφ hlim
choose! U hUo hUa hUinf using step
-- The nested infinite sets of indices.
let S : ℕ → Set ℕ := fun k ↦
Nat.rec (motive := fun _ ↦ Set ℕ) univ (fun k s ↦ {n | n ∈ s ∧ x n ∉ U (e k) s}) k
have hSsucc : ∀ k, S (k + 1) = {n | n ∈ S k ∧ x n ∉ U (e k) (S k)} := fun _ ↦ rfl
have hSinf : ∀ k, (S k).Infinite := by
intro k
induction k with
| zero => exact infinite_univ
| succ k ih => rw [hSsucc]; exact hUinf _ _ ih
have hSanti : Antitone S :=
antitone_nat_of_succ_le fun k ↦ by rw [hSsucc]; exact fun n hn ↦ hn.1
obtain ⟨t, ht⟩ := isCompact_univ.elim_finite_subcover (fun k ↦ U (e k) (S k))
(fun k ↦ hUo _ _ (hSinf k)) fun y _ ↦ by
obtain ⟨k, rfl⟩ := he y
exact mem_iUnion.2 ⟨k, hUa _ _ (hSinf k)⟩
obtain ⟨n, hn⟩ := (hSinf (t.sup id + 1)).nonempty
obtain ⟨k, hk, hxk⟩ := mem_iUnion₂.1 (ht (mem_univ (x n)))
have hkn : n ∈ S (k + 1) :=
hSanti (Nat.succ_le_succ (Finset.le_sup (f := id) hk)) hn
rw [hSsucc] at hkn
exact hkn.2 hxk
On this site: Theorem: Countable compact spaces are sequentially compact