source stringlengths 17 118 | lean4 stringlengths 0 335k |
|---|---|
.lake/packages/mathlib/Mathlib/Topology/NhdsSet.lean | import Mathlib.Topology.Neighborhoods
/-!
# Neighborhoods of a set
In this file we define the filter `𝓝ˢ s` or `nhdsSet s` consisting of all neighborhoods of a set
`s`.
## Main Properties
There are a couple different notions equivalent to `s ∈ 𝓝ˢ t`:
* `s ⊆ interior t` using `subset_interior_iff_mem_nhdsSet`
* `∀ x : X, x ∈ t → s ∈ 𝓝 x` using `mem_nhdsSet_iff_forall`
* `∃ U : Set X, IsOpen U ∧ t ⊆ U ∧ U ⊆ s` using `mem_nhdsSet_iff_exists`
Furthermore, we have the following results:
* `monotone_nhdsSet`: `𝓝ˢ` is monotone
* In T₁-spaces, `𝓝ˢ`is strictly monotone and hence injective:
`strict_mono_nhdsSet`/`injective_nhdsSet`. These results are in
`Mathlib/Topology/Separation/Basic.lean`.
-/
open Set Filter Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : Filter X}
{s t s₁ s₂ t₁ t₂ : Set X} {x : X}
theorem nhdsSet_diagonal (X) [TopologicalSpace (X × X)] :
𝓝ˢ (diagonal X) = ⨆ (x : X), 𝓝 (x, x) := by
rw [nhdsSet, ← range_diag, ← range_comp]
rfl
theorem mem_nhdsSet_iff_forall : s ∈ 𝓝ˢ t ↔ ∀ x : X, x ∈ t → s ∈ 𝓝 x := by
simp_rw [nhdsSet, Filter.mem_sSup, forall_mem_image]
lemma nhdsSet_le : 𝓝ˢ s ≤ f ↔ ∀ x ∈ s, 𝓝 x ≤ f := by simp [nhdsSet]
theorem bUnion_mem_nhdsSet {t : X → Set X} (h : ∀ x ∈ s, t x ∈ 𝓝 x) : (⋃ x ∈ s, t x) ∈ 𝓝ˢ s :=
mem_nhdsSet_iff_forall.2 fun x hx => mem_of_superset (h x hx) <|
subset_iUnion₂ (s := fun x _ => t x) x hx
theorem subset_interior_iff_mem_nhdsSet : s ⊆ interior t ↔ t ∈ 𝓝ˢ s := by
simp_rw [mem_nhdsSet_iff_forall, subset_interior_iff_nhds]
theorem disjoint_principal_nhdsSet : Disjoint (𝓟 s) (𝓝ˢ t) ↔ Disjoint (closure s) t := by
rw [disjoint_principal_left, ← subset_interior_iff_mem_nhdsSet, interior_compl,
subset_compl_iff_disjoint_left]
theorem disjoint_nhdsSet_principal : Disjoint (𝓝ˢ s) (𝓟 t) ↔ Disjoint s (closure t) := by
rw [disjoint_comm, disjoint_principal_nhdsSet, disjoint_comm]
theorem mem_nhdsSet_iff_exists : s ∈ 𝓝ˢ t ↔ ∃ U : Set X, IsOpen U ∧ t ⊆ U ∧ U ⊆ s := by
rw [← subset_interior_iff_mem_nhdsSet, subset_interior_iff]
/-- A proposition is true on a set neighborhood of `s` iff it is true on a larger open set -/
theorem eventually_nhdsSet_iff_exists {p : X → Prop} :
(∀ᶠ x in 𝓝ˢ s, p x) ↔ ∃ t, IsOpen t ∧ s ⊆ t ∧ ∀ x, x ∈ t → p x :=
mem_nhdsSet_iff_exists
/-- A proposition is true on a set neighborhood of `s`
iff it is eventually true near each point in the set. -/
theorem eventually_nhdsSet_iff_forall {p : X → Prop} :
(∀ᶠ x in 𝓝ˢ s, p x) ↔ ∀ x, x ∈ s → ∀ᶠ y in 𝓝 x, p y :=
mem_nhdsSet_iff_forall
theorem hasBasis_nhdsSet (s : Set X) : (𝓝ˢ s).HasBasis (fun U => IsOpen U ∧ s ⊆ U) fun U => U :=
⟨fun t => by simp [mem_nhdsSet_iff_exists, and_assoc]⟩
@[simp]
lemma lift'_nhdsSet_interior (s : Set X) : (𝓝ˢ s).lift' interior = 𝓝ˢ s :=
(hasBasis_nhdsSet s).lift'_interior_eq_self fun _ ↦ And.left
lemma Filter.HasBasis.nhdsSet_interior {ι : Sort*} {p : ι → Prop} {s : ι → Set X} {t : Set X}
(h : (𝓝ˢ t).HasBasis p s) : (𝓝ˢ t).HasBasis p (interior <| s ·) :=
lift'_nhdsSet_interior t ▸ h.lift'_interior
theorem IsOpen.mem_nhdsSet (hU : IsOpen s) : s ∈ 𝓝ˢ t ↔ t ⊆ s := by
rw [← subset_interior_iff_mem_nhdsSet, hU.interior_eq]
/-- An open set belongs to its own set neighborhoods filter. -/
theorem IsOpen.mem_nhdsSet_self (ho : IsOpen s) : s ∈ 𝓝ˢ s := ho.mem_nhdsSet.mpr Subset.rfl
theorem principal_le_nhdsSet : 𝓟 s ≤ 𝓝ˢ s := fun _s hs =>
(subset_interior_iff_mem_nhdsSet.mpr hs).trans interior_subset
theorem subset_of_mem_nhdsSet (h : t ∈ 𝓝ˢ s) : s ⊆ t := principal_le_nhdsSet h
theorem Filter.Eventually.self_of_nhdsSet {p : X → Prop} (h : ∀ᶠ x in 𝓝ˢ s, p x) : ∀ x ∈ s, p x :=
principal_le_nhdsSet h
nonrec theorem Filter.EventuallyEq.self_of_nhdsSet {Y} {f g : X → Y} (h : f =ᶠ[𝓝ˢ s] g) :
EqOn f g s :=
h.self_of_nhdsSet
@[simp]
theorem nhdsSet_eq_principal_iff : 𝓝ˢ s = 𝓟 s ↔ IsOpen s := by
rw [← principal_le_nhdsSet.ge_iff_eq', le_principal_iff, mem_nhdsSet_iff_forall,
isOpen_iff_mem_nhds]
alias ⟨_, IsOpen.nhdsSet_eq⟩ := nhdsSet_eq_principal_iff
@[simp]
theorem nhdsSet_interior : 𝓝ˢ (interior s) = 𝓟 (interior s) :=
isOpen_interior.nhdsSet_eq
@[simp]
theorem nhdsSet_singleton : 𝓝ˢ {x} = 𝓝 x := by simp [nhdsSet]
theorem mem_nhdsSet_interior : s ∈ 𝓝ˢ (interior s) :=
subset_interior_iff_mem_nhdsSet.mp Subset.rfl
@[simp]
theorem nhdsSet_empty : 𝓝ˢ (∅ : Set X) = ⊥ := by rw [isOpen_empty.nhdsSet_eq, principal_empty]
theorem mem_nhdsSet_empty : s ∈ 𝓝ˢ (∅ : Set X) := by simp
@[simp]
theorem nhdsSet_univ : 𝓝ˢ (univ : Set X) = ⊤ := by rw [isOpen_univ.nhdsSet_eq, principal_univ]
@[gcongr, mono]
theorem nhdsSet_mono (h : s ⊆ t) : 𝓝ˢ s ≤ 𝓝ˢ t :=
sSup_le_sSup <| image_mono h
theorem monotone_nhdsSet : Monotone (𝓝ˢ : Set X → Filter X) := fun _ _ => nhdsSet_mono
theorem nhds_le_nhdsSet (h : x ∈ s) : 𝓝 x ≤ 𝓝ˢ s :=
le_sSup <| mem_image_of_mem _ h
@[simp]
theorem nhdsSet_union (s t : Set X) : 𝓝ˢ (s ∪ t) = 𝓝ˢ s ⊔ 𝓝ˢ t := by
simp only [nhdsSet, image_union, sSup_union]
theorem union_mem_nhdsSet (h₁ : s₁ ∈ 𝓝ˢ t₁) (h₂ : s₂ ∈ 𝓝ˢ t₂) : s₁ ∪ s₂ ∈ 𝓝ˢ (t₁ ∪ t₂) := by
rw [nhdsSet_union]
exact union_mem_sup h₁ h₂
@[simp]
theorem nhdsSet_insert (x : X) (s : Set X) : 𝓝ˢ (insert x s) = 𝓝 x ⊔ 𝓝ˢ s := by
rw [insert_eq, nhdsSet_union, nhdsSet_singleton]
/- This inequality cannot be improved to an equality. For instance,
if `X` has two elements and the coarse topology and `s` and `t` are distinct singletons then
`𝓝ˢ (s ∩ t) = ⊥` while `𝓝ˢ s ⊓ 𝓝ˢ t = ⊤` and those are different. -/
theorem nhdsSet_inter_le (s t : Set X) : 𝓝ˢ (s ∩ t) ≤ 𝓝ˢ s ⊓ 𝓝ˢ t :=
(monotone_nhdsSet (X := X)).map_inf_le s t
theorem nhdsSet_iInter_le {ι : Sort*} (s : ι → Set X) : 𝓝ˢ (⋂ i, s i) ≤ ⨅ i, 𝓝ˢ (s i) :=
(monotone_nhdsSet (X := X)).map_iInf_le
theorem nhdsSet_sInter_le (s : Set (Set X)) : 𝓝ˢ (⋂₀ s) ≤ ⨅ x ∈ s, 𝓝ˢ x :=
(monotone_nhdsSet (X := X)).map_sInf_le
variable (s) in
theorem IsClosed.nhdsSet_le_sup (h : IsClosed t) : 𝓝ˢ s ≤ 𝓝ˢ (s ∩ t) ⊔ 𝓟 (tᶜ) :=
calc
𝓝ˢ s = 𝓝ˢ (s ∩ t ∪ s ∩ tᶜ) := by rw [Set.inter_union_compl s t]
_ = 𝓝ˢ (s ∩ t) ⊔ 𝓝ˢ (s ∩ tᶜ) := by rw [nhdsSet_union]
_ ≤ 𝓝ˢ (s ∩ t) ⊔ 𝓝ˢ (tᶜ) := by nth_grw 2 [inter_subset_right]
_ = 𝓝ˢ (s ∩ t) ⊔ 𝓟 (tᶜ) := by rw [h.isOpen_compl.nhdsSet_eq]
variable (s) in
theorem IsClosed.nhdsSet_le_sup' (h : IsClosed t) :
𝓝ˢ s ≤ 𝓝ˢ (t ∩ s) ⊔ 𝓟 (tᶜ) := by rw [Set.inter_comm]; exact h.nhdsSet_le_sup s
theorem Filter.Eventually.eventually_nhdsSet {p : X → Prop} (h : ∀ᶠ y in 𝓝ˢ s, p y) :
∀ᶠ y in 𝓝ˢ s, ∀ᶠ x in 𝓝 y, p x :=
eventually_nhdsSet_iff_forall.mpr fun x x_in ↦
(eventually_nhdsSet_iff_forall.mp h x x_in).eventually_nhds
theorem Filter.Eventually.union_nhdsSet {p : X → Prop} :
(∀ᶠ x in 𝓝ˢ (s ∪ t), p x) ↔ (∀ᶠ x in 𝓝ˢ s, p x) ∧ ∀ᶠ x in 𝓝ˢ t, p x := by
rw [nhdsSet_union, eventually_sup]
theorem Filter.Eventually.union {p : X → Prop} (hs : ∀ᶠ x in 𝓝ˢ s, p x) (ht : ∀ᶠ x in 𝓝ˢ t, p x) :
∀ᶠ x in 𝓝ˢ (s ∪ t), p x :=
Filter.Eventually.union_nhdsSet.mpr ⟨hs, ht⟩
theorem nhdsSet_iUnion {ι : Sort*} (s : ι → Set X) : 𝓝ˢ (⋃ i, s i) = ⨆ i, 𝓝ˢ (s i) := by
simp only [nhdsSet, image_iUnion, sSup_iUnion (β := Filter X)]
theorem eventually_nhdsSet_iUnion₂ {ι : Sort*} {p : ι → Prop} {s : ι → Set X} {P : X → Prop} :
(∀ᶠ x in 𝓝ˢ (⋃ (i) (_ : p i), s i), P x) ↔ ∀ i, p i → ∀ᶠ x in 𝓝ˢ (s i), P x := by
simp only [nhdsSet_iUnion, eventually_iSup]
theorem eventually_nhdsSet_iUnion {ι : Sort*} {s : ι → Set X} {P : X → Prop} :
(∀ᶠ x in 𝓝ˢ (⋃ i, s i), P x) ↔ ∀ i, ∀ᶠ x in 𝓝ˢ (s i), P x := by
simp only [nhdsSet_iUnion, eventually_iSup] |
.lake/packages/mathlib/Mathlib/Topology/Irreducible.lean | import Mathlib.Order.Minimal
import Mathlib.Order.Zorn
import Mathlib.Topology.ContinuousOn
import Mathlib.Tactic.StacksAttribute
/-!
# Irreducibility in topological spaces
## Main definitions
* `IrreducibleSpace`: a typeclass applying to topological spaces, stating that the space
is nonempty and does not admit a nontrivial pair of disjoint opens.
* `IsIrreducible`: for a nonempty set in a topological space, the property that the set is an
irreducible space in the subspace topology.
## On the definition of irreducible and connected sets/spaces
In informal mathematics, irreducible spaces are assumed to be nonempty.
We formalise the predicate without that assumption as `IsPreirreducible`.
In other words, the only difference is whether the empty space counts as irreducible.
There are good reasons to consider the empty space to be “too simple to be simple”
See also https://ncatlab.org/nlab/show/too+simple+to+be+simple,
and in particular
https://ncatlab.org/nlab/show/too+simple+to+be+simple#relationship_to_biased_definitions.
-/
open Set Topology
variable {X : Type*} {Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X}
section Preirreducible
/-- A preirreducible set `s` is one where there is no non-trivial pair of disjoint opens on `s`. -/
def IsPreirreducible (s : Set X) : Prop :=
∀ u v : Set X, IsOpen u → IsOpen v → (s ∩ u).Nonempty → (s ∩ v).Nonempty → (s ∩ (u ∩ v)).Nonempty
/-- An irreducible set `s` is one that is nonempty and
where there is no non-trivial pair of disjoint opens on `s`. -/
@[stacks 004V "(1) as predicate on subsets of a space"]
def IsIrreducible (s : Set X) : Prop :=
s.Nonempty ∧ IsPreirreducible s
theorem IsIrreducible.nonempty (h : IsIrreducible s) : s.Nonempty :=
h.1
theorem IsIrreducible.isPreirreducible (h : IsIrreducible s) : IsPreirreducible s :=
h.2
theorem isPreirreducible_empty : IsPreirreducible (∅ : Set X) := fun _ _ _ _ _ ⟨_, h1, _⟩ =>
h1.elim
theorem Set.Subsingleton.isPreirreducible (hs : s.Subsingleton) : IsPreirreducible s :=
fun _u _v _ _ ⟨_x, hxs, hxu⟩ ⟨y, hys, hyv⟩ => ⟨y, hys, hs hxs hys ▸ hxu, hyv⟩
theorem isPreirreducible_singleton {x} : IsPreirreducible ({x} : Set X) :=
subsingleton_singleton.isPreirreducible
theorem isIrreducible_singleton {x} : IsIrreducible ({x} : Set X) :=
⟨singleton_nonempty x, isPreirreducible_singleton⟩
theorem isPreirreducible_iff_closure : IsPreirreducible (closure s) ↔ IsPreirreducible s :=
forall₄_congr fun u v hu hv => by
iterate 3 rw [closure_inter_open_nonempty_iff]
exacts [hu.inter hv, hv, hu]
@[stacks 004W "(1)"]
theorem isIrreducible_iff_closure : IsIrreducible (closure s) ↔ IsIrreducible s :=
and_congr closure_nonempty_iff isPreirreducible_iff_closure
protected alias ⟨_, IsPreirreducible.closure⟩ := isPreirreducible_iff_closure
protected alias ⟨_, IsIrreducible.closure⟩ := isIrreducible_iff_closure
theorem exists_preirreducible (s : Set X) (H : IsPreirreducible s) :
∃ t : Set X, IsPreirreducible t ∧ s ⊆ t ∧ ∀ u, IsPreirreducible u → t ⊆ u → u = t :=
let ⟨m, hsm, hm⟩ :=
zorn_subset_nonempty { t : Set X | IsPreirreducible t }
(fun c hc hcc _ =>
⟨⋃₀ c, fun u v hu hv ⟨y, hy, hyu⟩ ⟨x, hx, hxv⟩ =>
let ⟨p, hpc, hyp⟩ := mem_sUnion.1 hy
let ⟨q, hqc, hxq⟩ := mem_sUnion.1 hx
Or.casesOn (hcc.total hpc hqc)
(fun hpq : p ⊆ q =>
let ⟨x, hxp, hxuv⟩ := hc hqc u v hu hv ⟨y, hpq hyp, hyu⟩ ⟨x, hxq, hxv⟩
⟨x, mem_sUnion_of_mem hxp hqc, hxuv⟩)
fun hqp : q ⊆ p =>
let ⟨x, hxp, hxuv⟩ := hc hpc u v hu hv ⟨y, hyp, hyu⟩ ⟨x, hqp hxq, hxv⟩
⟨x, mem_sUnion_of_mem hxp hpc, hxuv⟩,
fun _ hxc => subset_sUnion_of_mem hxc⟩)
s H
⟨m, hm.prop, hsm, fun _u hu hmu => (hm.eq_of_subset hu hmu).symm⟩
/-- The set of irreducible components of a topological space. -/
@[stacks 004V "(2)"]
def irreducibleComponents (X : Type*) [TopologicalSpace X] : Set (Set X) :=
{s | Maximal IsIrreducible s}
@[stacks 004W "(2)"]
theorem isClosed_of_mem_irreducibleComponents (s) (H : s ∈ irreducibleComponents X) :
IsClosed s := by
rw [← closure_eq_iff_isClosed, eq_comm]
exact subset_closure.antisymm (H.2 H.1.closure subset_closure)
theorem irreducibleComponents_eq_maximals_closed (X : Type*) [TopologicalSpace X] :
irreducibleComponents X = { s | Maximal (fun x ↦ IsClosed x ∧ IsIrreducible x) s} := by
ext s
constructor
· intro H
exact ⟨⟨isClosed_of_mem_irreducibleComponents _ H, H.1⟩, fun x h e => H.2 h.2 e⟩
· intro H
refine ⟨H.1.2, fun x h e => ?_⟩
have : closure x ≤ s := H.2 ⟨isClosed_closure, h.closure⟩ (e.trans subset_closure)
exact le_trans subset_closure this
@[stacks 004W "(3)"]
lemma exists_mem_irreducibleComponents_subset_of_isIrreducible (s : Set X) (hs : IsIrreducible s) :
∃ u ∈ irreducibleComponents X, s ⊆ u := by
obtain ⟨u,hu⟩ := exists_preirreducible s hs.isPreirreducible
use u, ⟨⟨hs.left.mono hu.right.left,hu.left⟩,fun _ h hl => (hu.right.right _ h.right hl).le⟩
exact hu.right.left
/-- A maximal irreducible set that contains a given point. -/
@[stacks 004W "(4)"]
def irreducibleComponent (x : X) : Set X :=
Classical.choose (exists_preirreducible {x} isPreirreducible_singleton)
theorem irreducibleComponent_property (x : X) :
IsPreirreducible (irreducibleComponent x) ∧
{x} ⊆ irreducibleComponent x ∧
∀ u, IsPreirreducible u → irreducibleComponent x ⊆ u → u = irreducibleComponent x :=
Classical.choose_spec (exists_preirreducible {x} isPreirreducible_singleton)
@[stacks 004W "(4)"]
theorem mem_irreducibleComponent {x : X} : x ∈ irreducibleComponent x :=
singleton_subset_iff.1 (irreducibleComponent_property x).2.1
theorem isIrreducible_irreducibleComponent {x : X} : IsIrreducible (irreducibleComponent x) :=
⟨⟨x, mem_irreducibleComponent⟩, (irreducibleComponent_property x).1⟩
theorem eq_irreducibleComponent {x : X} :
IsPreirreducible s → irreducibleComponent x ⊆ s → s = irreducibleComponent x :=
(irreducibleComponent_property x).2.2 _
theorem irreducibleComponent_mem_irreducibleComponents (x : X) :
irreducibleComponent x ∈ irreducibleComponents X :=
⟨isIrreducible_irreducibleComponent, fun _ h₁ h₂ => (eq_irreducibleComponent h₁.2 h₂).le⟩
theorem isClosed_irreducibleComponent {x : X} : IsClosed (irreducibleComponent x) :=
isClosed_of_mem_irreducibleComponents _ (irreducibleComponent_mem_irreducibleComponents x)
/-- A preirreducible space is one where there is no non-trivial pair of disjoint opens. -/
class PreirreducibleSpace (X : Type*) [TopologicalSpace X] : Prop where
/-- In a preirreducible space, `Set.univ` is a preirreducible set. -/
isPreirreducible_univ : IsPreirreducible (univ : Set X)
/-- An irreducible space is one that is nonempty
and where there is no non-trivial pair of disjoint opens. -/
@[stacks 004V "(1) as predicate on a space"]
class IrreducibleSpace (X : Type*) [TopologicalSpace X] : Prop extends PreirreducibleSpace X where
toNonempty : Nonempty X
-- see Note [lower instance priority]
attribute [instance 50] IrreducibleSpace.toNonempty
theorem IrreducibleSpace.isIrreducible_univ (X : Type*) [TopologicalSpace X] [IrreducibleSpace X] :
IsIrreducible (univ : Set X) :=
⟨univ_nonempty, PreirreducibleSpace.isPreirreducible_univ⟩
theorem irreducibleSpace_def (X : Type*) [TopologicalSpace X] :
IrreducibleSpace X ↔ IsIrreducible (⊤ : Set X) :=
⟨@IrreducibleSpace.isIrreducible_univ X _, fun h =>
haveI : PreirreducibleSpace X := ⟨h.2⟩
⟨⟨h.1.some⟩⟩⟩
theorem nonempty_preirreducible_inter [PreirreducibleSpace X] :
IsOpen s → IsOpen t → s.Nonempty → t.Nonempty → (s ∩ t).Nonempty := by
simpa only [univ_inter, univ_subset_iff] using
@PreirreducibleSpace.isPreirreducible_univ X _ _ s t
/-- In a (pre)irreducible space, a nonempty open set is dense. -/
protected theorem IsOpen.dense [PreirreducibleSpace X] (ho : IsOpen s) (hne : s.Nonempty) :
Dense s :=
dense_iff_inter_open.2 fun _t hto htne => nonempty_preirreducible_inter hto ho htne hne
theorem IsPreirreducible.image (H : IsPreirreducible s) (f : X → Y) (hf : ContinuousOn f s) :
IsPreirreducible (f '' s) := by
rintro u v hu hv ⟨_, ⟨⟨x, hx, rfl⟩, hxu⟩⟩ ⟨_, ⟨⟨y, hy, rfl⟩, hyv⟩⟩
rw [← mem_preimage] at hxu hyv
rcases continuousOn_iff'.1 hf u hu with ⟨u', hu', u'_eq⟩
rcases continuousOn_iff'.1 hf v hv with ⟨v', hv', v'_eq⟩
have := H u' v' hu' hv'
rw [inter_comm s u', ← u'_eq] at this
rw [inter_comm s v', ← v'_eq] at this
rcases this ⟨x, hxu, hx⟩ ⟨y, hyv, hy⟩ with ⟨x, hxs, hxu', hxv'⟩
refine ⟨f x, mem_image_of_mem f hxs, ?_, ?_⟩
all_goals
rw [← mem_preimage]
apply mem_of_mem_inter_left
show x ∈ _ ∩ s
simp [*]
@[stacks 0379]
theorem IsIrreducible.image (H : IsIrreducible s) (f : X → Y) (hf : ContinuousOn f s) :
IsIrreducible (f '' s) :=
⟨H.nonempty.image _, H.isPreirreducible.image f hf⟩
theorem Subtype.preirreducibleSpace (h : IsPreirreducible s) : PreirreducibleSpace s where
isPreirreducible_univ := by
rintro _ _ ⟨u, hu, rfl⟩ ⟨v, hv, rfl⟩ ⟨⟨x, hxs⟩, -, hxu⟩ ⟨⟨y, hys⟩, -, hyv⟩
rcases h u v hu hv ⟨x, hxs, hxu⟩ ⟨y, hys, hyv⟩ with ⟨x, hxs, ⟨hxu, hxv⟩⟩
exact ⟨⟨x, hxs⟩, ⟨Set.mem_univ _, ⟨hxu, hxv⟩⟩⟩
theorem Subtype.irreducibleSpace (h : IsIrreducible s) : IrreducibleSpace s where
isPreirreducible_univ :=
(Subtype.preirreducibleSpace h.isPreirreducible).isPreirreducible_univ
toNonempty := h.nonempty.to_subtype
instance (priority := low) [Subsingleton X] : PreirreducibleSpace X :=
⟨(Set.subsingleton_univ_iff.mpr ‹_›).isPreirreducible⟩
/-- An infinite type with cofinite topology is an irreducible topological space. -/
instance (priority := 100) {X} [Infinite X] : IrreducibleSpace (CofiniteTopology X) where
isPreirreducible_univ u v := by
haveI : Infinite (CofiniteTopology X) := ‹_›
simp only [CofiniteTopology.isOpen_iff, univ_inter]
intro hu hv hu' hv'
simpa only [compl_union, compl_compl] using ((hu hu').union (hv hv')).infinite_compl.nonempty
toNonempty := (inferInstance : Nonempty X)
theorem irreducibleComponents_eq_singleton [IrreducibleSpace X] :
irreducibleComponents X = {univ} :=
Set.ext fun _ ↦ IsGreatest.maximal_iff (s := IsIrreducible (X := X))
⟨IrreducibleSpace.isIrreducible_univ X, fun _ _ ↦ Set.subset_univ _⟩
/-- A set `s` is irreducible if and only if
for every finite collection of open sets all of whose members intersect `s`,
`s` also intersects the intersection of the entire collection
(i.e., there is an element of `s` contained in every member of the collection). -/
theorem isIrreducible_iff_sInter :
IsIrreducible s ↔
∀ (U : Finset (Set X)), (∀ u ∈ U, IsOpen u) → (∀ u ∈ U, (s ∩ u).Nonempty) →
(s ∩ ⋂₀ ↑U).Nonempty := by
classical
refine ⟨fun h U hu hU => ?_, fun h => ⟨?_, ?_⟩⟩
· induction U using Finset.induction_on with
| empty => simpa using h.nonempty
| insert u U _ IH =>
rw [Finset.coe_insert, sInter_insert]
rw [Finset.forall_mem_insert] at hu hU
exact h.2 _ _ hu.1 (U.finite_toSet.isOpen_sInter hu.2) hU.1 (IH hu.2 hU.2)
· simpa using h ∅
· intro u v hu hv hu' hv'
simpa [*] using h {u, v}
/-- A set is preirreducible if and only if
for every cover by two closed sets, it is contained in one of the two covering sets. -/
theorem isPreirreducible_iff_isClosed_union_isClosed :
IsPreirreducible s ↔
∀ z₁ z₂ : Set X, IsClosed z₁ → IsClosed z₂ → s ⊆ z₁ ∪ z₂ → s ⊆ z₁ ∨ s ⊆ z₂ := by
refine compl_surjective.forall.trans <| forall_congr' fun z₁ => compl_surjective.forall.trans <|
forall_congr' fun z₂ => ?_
simp only [isOpen_compl_iff, ← compl_union, inter_compl_nonempty_iff]
refine forall₂_congr fun _ _ => ?_
rw [← and_imp, ← not_or, not_imp_not]
/-- A set is irreducible if and only if for every cover by a finite collection of closed sets, it is
contained in one of the members of the collection. -/
theorem isIrreducible_iff_sUnion_isClosed :
IsIrreducible s ↔
∀ t : Finset (Set X), (∀ z ∈ t, IsClosed z) → (s ⊆ ⋃₀ ↑t) → ∃ z ∈ t, s ⊆ z := by
simp only [isIrreducible_iff_sInter]
refine ((@compl_involutive (Set X) _).toPerm _).finsetCongr.forall_congr fun {t} => ?_
simp_rw [Equiv.finsetCongr_apply, Finset.forall_mem_map, Finset.mem_map, Finset.coe_map,
sUnion_image, Equiv.coe_toEmbedding, Function.Involutive.coe_toPerm, isClosed_compl_iff,
exists_exists_and_eq_and]
refine forall_congr' fun _ => Iff.trans ?_ not_imp_not
simp only [not_exists, not_and, ← compl_iInter₂, ← sInter_eq_biInter,
subset_compl_iff_disjoint_right, not_disjoint_iff_nonempty_inter]
/-- A nonempty open subset of a preirreducible subspace is dense in the subspace. -/
theorem subset_closure_inter_of_isPreirreducible_of_isOpen {S U : Set X} (hS : IsPreirreducible S)
(hU : IsOpen U) (h : (S ∩ U).Nonempty) : S ⊆ closure (S ∩ U) := by
by_contra h'
obtain ⟨x, h₁, h₂, h₃⟩ :=
hS _ (closure (S ∩ U))ᶜ hU isClosed_closure.isOpen_compl h (inter_compl_nonempty_iff.mpr h')
exact h₃ (subset_closure ⟨h₁, h₂⟩)
/-- If `∅ ≠ U ⊆ S ⊆ t` such that `U` is open and `t` is preirreducible, then `S` is irreducible. -/
theorem IsPreirreducible.subset_irreducible {S U : Set X} (ht : IsPreirreducible t)
(hU : U.Nonempty) (hU' : IsOpen U) (h₁ : U ⊆ S) (h₂ : S ⊆ t) : IsIrreducible S := by
obtain ⟨z, hz⟩ := hU
replace ht : IsIrreducible t := ⟨⟨z, h₂ (h₁ hz)⟩, ht⟩
refine ⟨⟨z, h₁ hz⟩, ?_⟩
rintro u v hu hv ⟨x, hx, hx'⟩ ⟨y, hy, hy'⟩
classical
obtain ⟨x, -, hx'⟩ : Set.Nonempty (t ∩ ⋂₀ ↑({U, u, v} : Finset (Set X))) := by
refine isIrreducible_iff_sInter.mp ht {U, u, v} ?_ ?_
· simp [*]
· intro U H
simp only [Finset.mem_insert, Finset.mem_singleton] at H
rcases H with (rfl | rfl | rfl)
exacts [⟨z, h₂ (h₁ hz), hz⟩, ⟨x, h₂ hx, hx'⟩, ⟨y, h₂ hy, hy'⟩]
replace hx' : x ∈ U ∧ x ∈ u ∧ x ∈ v := by simpa using hx'
exact ⟨x, h₁ hx'.1, hx'.2⟩
theorem IsPreirreducible.open_subset {U : Set X} (ht : IsPreirreducible t) (hU : IsOpen U)
(hU' : U ⊆ t) : IsPreirreducible U :=
U.eq_empty_or_nonempty.elim (fun h => h.symm ▸ isPreirreducible_empty) fun h =>
(ht.subset_irreducible h hU (fun _ => id) hU').2
theorem IsPreirreducible.interior (ht : IsPreirreducible t) : IsPreirreducible (interior t) :=
ht.open_subset isOpen_interior interior_subset
theorem IsPreirreducible.preimage (ht : IsPreirreducible t) {f : Y → X}
(hf : IsOpenEmbedding f) : IsPreirreducible (f ⁻¹' t) := by
rintro U V hU hV ⟨x, hx, hx'⟩ ⟨y, hy, hy'⟩
obtain ⟨_, h₁, ⟨y, h₂, rfl⟩, ⟨y', h₃, h₄⟩⟩ :=
ht _ _ (hf.isOpenMap _ hU) (hf.isOpenMap _ hV) ⟨f x, hx, Set.mem_image_of_mem f hx'⟩
⟨f y, hy, Set.mem_image_of_mem f hy'⟩
cases hf.injective h₄
exact ⟨y, h₁, h₂, h₃⟩
section
open Set.Notation
@[stacks 004Z]
lemma IsPreirreducible.preimage_of_dense_isPreirreducible_fiber
{V : Set Y} (hV : IsPreirreducible V) (f : X → Y) (hf' : IsOpenMap f)
(hf'' : V ⊆ closure (V ∩ { x | IsPreirreducible (f ⁻¹' {x}) })) :
IsPreirreducible (f ⁻¹' V) := by
rintro U₁ U₂ hU₁ hU₂ ⟨x, hxV, hxU₁⟩ ⟨y, hyV, hyU₂⟩
obtain ⟨z, hzV, hz₁, hz₂⟩ :=
hV _ _ (hf' _ hU₁) (hf' _ hU₂) ⟨f x, hxV, x, hxU₁, rfl⟩ ⟨f y, hyV, y, hyU₂, rfl⟩
obtain ⟨z, ⟨⟨z₁, hz₁, e₁⟩, ⟨z₂, hz₂, e₂⟩⟩, hzV, hz⟩ :=
mem_closure_iff.mp (hf'' hzV) _ ((hf' _ hU₁).inter (hf' _ hU₂)) ⟨hz₁, hz₂⟩
obtain ⟨z₃, hz₃, hz₃'⟩ := hz _ _ hU₁ hU₂ ⟨z₁, e₁, hz₁⟩ ⟨z₂, e₂, hz₂⟩
refine ⟨z₃, show f z₃ ∈ _ from (show f z₃ = z from hz₃) ▸ hzV, hz₃'⟩
lemma IsPreirreducible.preimage_of_isPreirreducible_fiber
{V : Set Y} (hV : IsPreirreducible V)
(f : X → Y) (hf' : IsOpenMap f) (hf'' : ∀ x, IsPreirreducible (f ⁻¹' {x})) :
IsPreirreducible (f ⁻¹' V) := by
refine hV.preimage_of_dense_isPreirreducible_fiber f hf' ?_
simp [hf'', subset_closure]
variable (f : X → Y) (hf₁ : Continuous f) (hf₂ : IsOpenMap f)
variable (hf₃ : ∀ x, IsPreirreducible (f ⁻¹' {x})) (hf₄ : Function.Surjective f)
include hf₁ hf₂ hf₃ hf₄
lemma preimage_mem_irreducibleComponents_of_isPreirreducible_fiber
{V : Set Y} (hV : V ∈ irreducibleComponents Y) :
f ⁻¹' V ∈ irreducibleComponents X := by
obtain ⟨Z, hZ, hWZ, H⟩ :=
exists_preirreducible _ (hV.1.2.preimage_of_isPreirreducible_fiber f hf₂ hf₃)
have hZ' : IsIrreducible Z := by
obtain ⟨x, hx⟩ := hV.1.1
obtain ⟨x, rfl⟩ := hf₄ x
exact ⟨⟨_, hWZ hx⟩, hZ⟩
have hWZ' : f ⁻¹' V = Z := by
refine hWZ.antisymm (Set.image_subset_iff.mp ?_)
exact hV.2 (IsIrreducible.image hZ' f hf₁.continuousOn)
((Set.image_preimage_eq V hf₄).symm.trans_le (Set.image_mono hWZ))
rw [hWZ']
exact ⟨hZ', fun s hs hs' ↦ (H s hs.2 hs').le⟩
lemma image_mem_irreducibleComponents_of_isPreirreducible_fiber
{V : Set X} (hV : V ∈ irreducibleComponents X) :
f '' V ∈ irreducibleComponents Y :=
⟨hV.1.image _ hf₁.continuousOn, fun Z hZ hWZ ↦ by
have := hV.2 ⟨(by obtain ⟨x, hx⟩ := hV.1.1; exact ⟨x, hWZ ⟨x, hx, rfl⟩⟩),
hZ.2.preimage_of_isPreirreducible_fiber f hf₂ hf₃⟩ (Set.image_subset_iff.mp hWZ)
rw [← Set.image_preimage_eq Z hf₄]
exact Set.image_mono this⟩
/-- If `f : X → Y` is continuous, open, and has irreducible fibers, then it induces an
bijection between irreducible components -/
@[stacks 037A]
def irreducibleComponentsEquivOfIsPreirreducibleFiber :
irreducibleComponents Y ≃o irreducibleComponents X where
invFun W := ⟨f '' W.1,
image_mem_irreducibleComponents_of_isPreirreducible_fiber f hf₁ hf₂ hf₃ hf₄ W.2⟩
toFun W := ⟨f ⁻¹' W.1,
preimage_mem_irreducibleComponents_of_isPreirreducible_fiber f hf₁ hf₂ hf₃ hf₄ W.2⟩
right_inv W := Subtype.ext <| by
refine (Set.subset_preimage_image _ _).antisymm' (W.2.2 ?_ (Set.subset_preimage_image _ _))
refine ⟨?_, (W.2.1.image _ hf₁.continuousOn).2.preimage_of_isPreirreducible_fiber _ hf₂ hf₃⟩
obtain ⟨x, hx⟩ := W.2.1.1
exact ⟨_, x, hx, rfl⟩
left_inv _ := Subtype.ext <| Set.image_preimage_eq _ hf₄
map_rel_iff' {W Z} := by
refine ⟨fun H ↦ ?_, Set.preimage_mono⟩
simpa only [Equiv.coe_fn_mk, Set.image_preimage_eq _ hf₄] using Set.image_mono (f := f) H
end
end Preirreducible |
.lake/packages/mathlib/Mathlib/Topology/ExtremallyDisconnected.lean | import Mathlib.Topology.Homeomorph.Lemmas
import Mathlib.Topology.Compactification.StoneCech
/-!
# Extremally disconnected spaces
An extremally disconnected topological space is a space in which the closure of every open set is
open. Such spaces are also called Stonean spaces. They are the projective objects in the category of
compact Hausdorff spaces.
## Main declarations
* `ExtremallyDisconnected`: Predicate for a space to be extremally disconnected.
* `CompactT2.Projective`: Predicate for a topological space to be a projective object in the
category of compact Hausdorff spaces.
* `CompactT2.Projective.extremallyDisconnected`: Compact Hausdorff spaces that are projective are
extremally disconnected.
* `CompactT2.ExtremallyDisconnected.projective`: Extremally disconnected spaces are projective
objects in the category of compact Hausdorff spaces.
## References
[Gleason, *Projective topological spaces*][gleason1958]
-/
noncomputable section
open Function Set
universe u
variable (X : Type u) [TopologicalSpace X]
/-- An extremally disconnected topological space is a space
in which the closure of every open set is open. -/
class ExtremallyDisconnected : Prop where
/-- The closure of every open set is open. -/
open_closure : ∀ U : Set X, IsOpen U → IsOpen (closure U)
theorem extremallyDisconnected_of_homeo {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
[ExtremallyDisconnected X] (e : X ≃ₜ Y) : ExtremallyDisconnected Y where
open_closure U hU := by
rw [e.symm.isInducing.closure_eq_preimage_closure_image, Homeomorph.isOpen_preimage]
exact ExtremallyDisconnected.open_closure _ (e.symm.isOpen_image.mpr hU)
section TotallySeparated
/-- Extremally disconnected spaces are totally separated. -/
instance [ExtremallyDisconnected X] [T2Space X] : TotallySeparatedSpace X :=
{ isTotallySeparated_univ := by
intro x _ y _ hxy
obtain ⟨U, V, hUV⟩ := T2Space.t2 hxy
refine ⟨closure U, (closure U)ᶜ, ExtremallyDisconnected.open_closure U hUV.1,
by simp only [isOpen_compl_iff, isClosed_closure], subset_closure hUV.2.2.1, ?_,
by simp only [Set.union_compl_self, Set.subset_univ], disjoint_compl_right⟩
rw [Set.mem_compl_iff, mem_closure_iff]
push_neg
refine ⟨V, ⟨hUV.2.1, hUV.2.2.2.1, ?_⟩⟩
rw [← Set.disjoint_iff_inter_eq_empty, disjoint_comm]
exact hUV.2.2.2.2 }
end TotallySeparated
section
/-- The assertion `CompactT2.Projective` states that given continuous maps
`f : X → Z` and `g : Y → Z` with `g` surjective between `t_2`, compact topological spaces,
there exists a continuous lift `h : X → Y`, such that `f = g ∘ h`. -/
def CompactT2.Projective : Prop :=
∀ {Y Z : Type u} [TopologicalSpace Y] [TopologicalSpace Z],
∀ [CompactSpace Y] [T2Space Y] [CompactSpace Z] [T2Space Z],
∀ {f : X → Z} {g : Y → Z} (_ : Continuous f) (_ : Continuous g) (_ : Surjective g),
∃ h : X → Y, Continuous h ∧ g ∘ h = f
variable {X}
theorem StoneCech.projective [DiscreteTopology X] : CompactT2.Projective (StoneCech X) := by
intro Y Z _tsY _tsZ _csY _t2Y _csZ _csZ f g hf hg g_sur
let s : Z → Y := fun z => Classical.choose <| g_sur z
have hs : g ∘ s = id := funext fun z => Classical.choose_spec (g_sur z)
let t := s ∘ f ∘ stoneCechUnit
have ht : Continuous t := continuous_of_discreteTopology
let h : StoneCech X → Y := stoneCechExtend ht
have hh : Continuous h := continuous_stoneCechExtend ht
refine ⟨h, hh, denseRange_stoneCechUnit.equalizer (hg.comp hh) hf ?_⟩
rw [comp_assoc, stoneCechExtend_extends ht, ← comp_assoc, hs, id_comp]
protected theorem CompactT2.Projective.extremallyDisconnected [CompactSpace X] [T2Space X]
(h : CompactT2.Projective X) : ExtremallyDisconnected X := by
refine { open_closure := fun U hU => ?_ }
let Z₁ : Set (X × Bool) := Uᶜ ×ˢ {true}
let Z₂ : Set (X × Bool) := closure U ×ˢ {false}
let Z : Set (X × Bool) := Z₁ ∪ Z₂
have hZ₁₂ : Disjoint Z₁ Z₂ := disjoint_left.2 fun x hx₁ hx₂ => by cases hx₁.2.symm.trans hx₂.2
have hZ₁ : IsClosed Z₁ := hU.isClosed_compl.prod (T1Space.t1 _)
have hZ₂ : IsClosed Z₂ := isClosed_closure.prod (T1Space.t1 false)
have hZ : IsClosed Z := hZ₁.union hZ₂
let f : Z → X := Prod.fst ∘ Subtype.val
have f_cont : Continuous f := continuous_fst.comp continuous_subtype_val
have f_sur : Surjective f := by
intro x
by_cases hx : x ∈ U
· exact ⟨⟨(x, false), Or.inr ⟨subset_closure hx, mem_singleton _⟩⟩, rfl⟩
· exact ⟨⟨(x, true), Or.inl ⟨hx, mem_singleton _⟩⟩, rfl⟩
haveI : CompactSpace Z := isCompact_iff_compactSpace.mp hZ.isCompact
obtain ⟨g, hg, g_sec⟩ := h continuous_id f_cont f_sur
let φ := Subtype.val ∘ g
have hφ : Continuous φ := continuous_subtype_val.comp hg
have hφ₁ : ∀ x, (φ x).1 = x := congr_fun g_sec
suffices closure U = φ ⁻¹' Z₂ by
rw [this, preimage_comp, ← isClosed_compl_iff, ← preimage_compl,
← preimage_subtype_coe_eq_compl Subset.rfl]
· exact hZ₁.preimage hφ
· rw [hZ₁₂.inter_eq, inter_empty]
refine (closure_minimal ?_ <| hZ₂.preimage hφ).antisymm fun x hx => ?_
· intro x hx
have : φ x ∈ Z₁ ∪ Z₂ := (g x).2
rcases this with hφ | hφ
· exact ((hφ₁ x ▸ hφ.1) hx).elim
· exact hφ
· rw [← hφ₁ x]
exact hx.1
end
section
variable {A D E : Type u} [TopologicalSpace A] [TopologicalSpace D] [TopologicalSpace E]
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {X : D → A}
(X_cont : Continuous X) (X_surj : X.Surjective) : ∃ E : Set D, CompactSpace E ∧ X '' E = univ ∧
∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict X '' E₀ ≠ univ := by
-- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
let S : Set <| Set D := {E : Set D | IsClosed E ∧ X '' E = univ}
suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
rcases zorn_superset S this with ⟨E, E_min⟩
obtain ⟨E_closed, E_surj⟩ := E_min.prop
refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
intro E₀ E₀_min E₀_closed
contrapose! E₀_min
exact eq_univ_of_image_val_eq <|
E_min.eq_of_subset ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
image_val_subset
-- suffices to prove intersection of chain is minimal
intro C C_sub C_chain
-- prove intersection of chain is closed
refine ⟨iInter (fun c : C => c), ⟨isClosed_iInter fun ⟨_, h⟩ => (C_sub h).left, ?_⟩,
fun c hc _ h => mem_iInter.mp h ⟨c, hc⟩⟩
-- prove intersection of chain is mapped onto $A$
by_cases hC : Nonempty C
· refine eq_univ_of_forall fun a => inter_nonempty_iff_exists_left.mp ?_
-- apply Cantor's intersection theorem
refine iInter_inter (ι := C) (X ⁻¹' {a}) _ ▸
IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _
?_ (fun c => ?_) (fun c => IsClosed.isCompact ?_) (fun c => ?_)
· replace C_chain : IsChain (· ⊇ ·) C := C_chain.symm
have : ∀ s t : Set D, s ⊇ t → _ ⊇ _ := fun _ _ => inter_subset_inter_left <| X ⁻¹' {a}
exact (directedOn_iff_directed.mp C_chain.directedOn).mono_comp (· ⊇ ·) this
· rw [← image_inter_nonempty_iff, (C_sub c.mem).right, univ_inter]
exact singleton_nonempty a
all_goals exact (C_sub c.mem).left.inter <| (T1Space.t1 a).preimage X_cont
· rw [@iInter_of_empty _ _ <| not_nonempty_iff.mp hC, image_univ_of_surjective X_surj]
/-- Lemma 2.1 in [Gleason, *Projective topological spaces*][gleason1958]:
if $\rho$ is a continuous surjection from a topological space $E$ to a topological space $A$
satisfying the "Zorn subset condition", then $\rho(G)$ is contained in
the closure of $A \setminus \rho(E \setminus G)$ for any open set $G$ of $E$. -/
lemma image_subset_closure_compl_image_compl_of_isOpen {ρ : E → A} (ρ_cont : Continuous ρ)
(ρ_surj : ρ.Surjective) (zorn_subset : ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → ρ '' E₀ ≠ univ)
{G : Set E} (hG : IsOpen G) : ρ '' G ⊆ closure ((ρ '' Gᶜ)ᶜ) := by
-- suffices to prove for nonempty $G$
by_cases G_empty : G = ∅
· simpa only [G_empty, image_empty] using empty_subset _
· -- let $a \in \rho(G)$
intro a ha
rw [mem_closure_iff]
-- let $N$ be a neighbourhood of $a$
intro N N_open hN
-- get $x \in A$ from nonempty open $G \cap \rho^{-1}(N)$
rcases (G.mem_image ρ a).mp ha with ⟨e, he, rfl⟩
have nonempty : (G ∩ ρ⁻¹' N).Nonempty := ⟨e, mem_inter he <| mem_preimage.mpr hN⟩
have is_open : IsOpen <| G ∩ ρ⁻¹' N := hG.inter <| N_open.preimage ρ_cont
have ne_univ : ρ '' (G ∩ ρ⁻¹' N)ᶜ ≠ univ :=
zorn_subset _ (compl_ne_univ.mpr nonempty) is_open.isClosed_compl
rcases nonempty_compl.mpr ne_univ with ⟨x, hx⟩
-- prove $x \in N \cap (A \setminus \rho(E \setminus G))$
have hx' : x ∈ (ρ '' Gᶜ)ᶜ := fun h => hx <| image_mono (by simp) h
rcases ρ_surj x with ⟨y, rfl⟩
have hy : y ∈ G ∩ ρ⁻¹' N := by simpa using mt (mem_image_of_mem ρ) <| mem_compl hx
exact ⟨ρ y, mem_inter (mem_preimage.mp <| mem_of_mem_inter_right hy) hx'⟩
/-- Lemma 2.2 in [Gleason, *Projective topological spaces*][gleason1958]:
in an extremally disconnected space, if $U_1$ and $U_2$ are disjoint open sets,
then $\overline{U_1}$ and $\overline{U_2}$ are also disjoint. -/
lemma ExtremallyDisconnected.disjoint_closure_of_disjoint_isOpen [ExtremallyDisconnected A]
{U₁ U₂ : Set A} (h : Disjoint U₁ U₂) (hU₁ : IsOpen U₁) (hU₂ : IsOpen U₂) :
Disjoint (closure U₁) (closure U₂) :=
(h.closure_right hU₁).closure_left <| open_closure U₂ hU₂
private lemma ExtremallyDisconnected.homeoCompactToT2_injective [ExtremallyDisconnected A]
[T2Space A] [T2Space E] [CompactSpace E] {ρ : E → A} (ρ_cont : Continuous ρ)
(ρ_surj : ρ.Surjective) (zorn_subset : ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → ρ '' E₀ ≠ univ) :
ρ.Injective := by
-- let $x_1, x_2 \in E$ be distinct points such that $\rho(x_1) = \rho(x_2)$
intro x₁ x₂ hρx
by_contra hx
-- let $G_1$ and $G_2$ be disjoint open neighbourhoods of $x_1$ and $x_2$ respectively
rcases t2_separation hx with ⟨G₁, G₂, G₁_open, G₂_open, hx₁, hx₂, disj⟩
-- prove $A \setminus \rho(E - G_1)$ and $A \setminus \rho(E - G_2)$ are disjoint
have G₁_comp : IsCompact G₁ᶜ := IsClosed.isCompact G₁_open.isClosed_compl
have G₂_comp : IsCompact G₂ᶜ := IsClosed.isCompact G₂_open.isClosed_compl
have G₁_open' : IsOpen (ρ '' G₁ᶜ)ᶜ := (G₁_comp.image ρ_cont).isClosed.isOpen_compl
have G₂_open' : IsOpen (ρ '' G₂ᶜ)ᶜ := (G₂_comp.image ρ_cont).isClosed.isOpen_compl
have disj' : Disjoint (ρ '' G₁ᶜ)ᶜ (ρ '' G₂ᶜ)ᶜ := by
rw [disjoint_iff_inter_eq_empty, ← compl_union, ← image_union, ← compl_inter,
disjoint_iff_inter_eq_empty.mp disj, compl_empty, compl_empty_iff,
image_univ_of_surjective ρ_surj]
-- apply Lemma 2.2 to prove their closures are disjoint
have disj'' : Disjoint (closure (ρ '' G₁ᶜ)ᶜ) (closure (ρ '' G₂ᶜ)ᶜ) :=
disjoint_closure_of_disjoint_isOpen disj' G₁_open' G₂_open'
-- apply Lemma 2.1 to prove $\rho(x_1) = \rho(x_2)$ lies in their intersection
have hx₁' := image_subset_closure_compl_image_compl_of_isOpen ρ_cont ρ_surj zorn_subset G₁_open <|
mem_image_of_mem ρ hx₁
have hx₂' := image_subset_closure_compl_image_compl_of_isOpen ρ_cont ρ_surj zorn_subset G₂_open <|
mem_image_of_mem ρ hx₂
exact disj''.ne_of_mem hx₁' hx₂' hρx
/-- Lemma 2.3 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection from a compact Hausdorff space to an extremally disconnected Hausdorff space
satisfying the "Zorn subset condition" is a homeomorphism. -/
noncomputable def ExtremallyDisconnected.homeoCompactToT2 [ExtremallyDisconnected A] [T2Space A]
[T2Space E] [CompactSpace E] {ρ : E → A} (ρ_cont : Continuous ρ) (ρ_surj : ρ.Surjective)
(zorn_subset : ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → ρ '' E₀ ≠ univ) : E ≃ₜ A :=
ρ_cont.homeoOfEquivCompactToT2
(f := Equiv.ofBijective ρ ⟨homeoCompactToT2_injective ρ_cont ρ_surj zorn_subset, ρ_surj⟩)
/-- Theorem 2.5 in [Gleason, *Projective topological spaces*][gleason1958]:
in the category of compact spaces and continuous maps,
the projective spaces are precisely the extremally disconnected spaces. -/
protected theorem CompactT2.ExtremallyDisconnected.projective [ExtremallyDisconnected A]
[CompactSpace A] [T2Space A] : CompactT2.Projective A := by
-- let $B$ and $C$ be compact; let $f : B \twoheadrightarrow C$ and $\phi : A \to C$ be continuous
intro B C _ _ _ _ _ _ φ f φ_cont f_cont f_surj
-- let $D := \{(a, b) : \phi(a) = f(b)\}$ with projections $\pi_1 : D \to A$ and $\pi_2 : D \to B$
let D : Set <| A × B := {x | φ x.fst = f x.snd}
have D_comp : CompactSpace D := isCompact_iff_compactSpace.mp
(isClosed_eq (φ_cont.comp continuous_fst) (f_cont.comp continuous_snd)).isCompact
-- apply Lemma 2.4 to get closed $E$ satisfying "Zorn subset condition"
let X₁ : D → A := Prod.fst ∘ Subtype.val
have X₁_cont : Continuous X₁ := continuous_fst.comp continuous_subtype_val
have X₁_surj : X₁.Surjective := fun a => ⟨⟨⟨a, _⟩, (f_surj <| φ a).choose_spec.symm⟩, rfl⟩
rcases exists_compact_surjective_zorn_subset X₁_cont X₁_surj with ⟨E, _, E_onto, E_min⟩
-- apply Lemma 2.3 to get homeomorphism $\pi_1|_E : E \to A$
let ρ : E → A := E.restrict X₁
have ρ_cont : Continuous ρ := X₁_cont.continuousOn.restrict
have ρ_surj : ρ.Surjective := fun a => by
rcases (E_onto ▸ mem_univ a : a ∈ X₁ '' E) with ⟨d, ⟨hd, rfl⟩⟩; exact ⟨⟨d, hd⟩, rfl⟩
let ρ' := ExtremallyDisconnected.homeoCompactToT2 ρ_cont ρ_surj E_min
-- prove $\rho := \pi_2|_E \circ \pi_1|_E^{-1}$ satisfies $\phi = f \circ \rho$
let X₂ : D → B := Prod.snd ∘ Subtype.val
have X₂_cont : Continuous X₂ := continuous_snd.comp continuous_subtype_val
refine ⟨E.restrict X₂ ∘ ρ'.symm, ⟨X₂_cont.continuousOn.restrict.comp ρ'.symm.continuous, ?_⟩⟩
suffices f ∘ E.restrict X₂ = φ ∘ ρ' by
rw [← comp_assoc, this, comp_assoc, Homeomorph.self_comp_symm, comp_id]
ext x
exact x.val.mem.symm
protected theorem CompactT2.projective_iff_extremallyDisconnected [CompactSpace A] [T2Space A] :
Projective A ↔ ExtremallyDisconnected A :=
⟨Projective.extremallyDisconnected, fun _ => ExtremallyDisconnected.projective⟩
end
-- Note: It might be possible to use Gleason for this instead
/-- The sigma-type of extremally disconnected spaces is extremally disconnected. -/
instance instExtremallyDisconnected {ι : Type*} {X : ι → Type*} [∀ i, TopologicalSpace (X i)]
[h₀ : ∀ i, ExtremallyDisconnected (X i)] : ExtremallyDisconnected (Σ i, X i) := by
constructor
intro s hs
rw [isOpen_sigma_iff] at hs ⊢
intro i
rcases h₀ i with ⟨h₀⟩
suffices h : Sigma.mk i ⁻¹' closure s = closure (Sigma.mk i ⁻¹' s) by
rw [h]
exact h₀ _ (hs i)
apply IsOpenMap.preimage_closure_eq_closure_preimage
· intro U _
rw [isOpen_sigma_iff]
intro j
by_cases ij : i = j
· rwa [← ij, sigma_mk_preimage_image_eq_self]
· rw [sigma_mk_preimage_image' ij]
exact isOpen_empty
· fun_prop
end |
.lake/packages/mathlib/Mathlib/Topology/OpenPartialHomeomorph.lean | import Mathlib.Logic.Equiv.PartialEquiv
import Mathlib.Topology.Homeomorph.Lemmas
import Mathlib.Topology.Sets.Opens
/-!
# Partial homeomorphisms
This file defines homeomorphisms between open subsets of topological spaces. An element `e` of
`OpenPartialHomeomorph X Y` is an extension of `PartialEquiv X Y`, i.e., it is a pair of functions
`e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`.
Additionally, we require that these sets are open, and that the functions are continuous on them.
Equivalently, they are homeomorphisms there.
As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout
instead of `e.toFun x` and `e.invFun x`.
## Main definitions
* `Homeomorph.toOpenPartialHomeomorph`: associating an open partial homeomorphism to a
homeomorphism, with `source = target = Set.univ`;
* `OpenPartialHomeomorph.symm`: the inverse of an open partial homeomorphism
* `OpenPartialHomeomorph.trans`: the composition of two open partial homeomorphisms
* `OpenPartialHomeomorph.refl`: the identity open partial homeomorphism
* `OpenPartialHomeomorph.const`: an open partial homeomorphism which is a constant map,
whose source and target are necessarily singleton sets
* `OpenPartialHomeomorph.ofSet`: the identity on a set `s`
* `OpenPartialHomeomorph.restr s`: restrict an open partial homeomorphism `e` to
`e.source ∩ interior s`
* `OpenPartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality
for open partial homeomorphisms
* `OpenPartialHomeomorph.prod`: the product of two open partial homeomorphisms,
as an open partial homeomorphism on the product space
* `OpenPartialHomeomorph.pi`: the product of a finite family of open partial homeomorphisms
* `OpenPartialHomeomorph.disjointUnion`: combine two open partial homeomorphisms with disjoint
sources and disjoint targets
* `OpenPartialHomeomorph.lift_openEmbedding`: extend an open partial homeomorphism `X → Y`
under an open embedding `X → X'`, to an open partial homeomorphism `X' → Z`.
(This is used to define the disjoint union of charted spaces.)
## Implementation notes
Most statements are copied from their `PartialEquiv` versions, although some care is required
especially when restricting to subsets, as these should be open subsets.
For design notes, see `PartialEquiv.lean`.
### Local coding conventions
If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`,
then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`.
-/
open Function Set Filter Topology
variable {X X' : Type*} {Y Y' : Type*} {Z Z' : Type*}
[TopologicalSpace X] [TopologicalSpace X'] [TopologicalSpace Y] [TopologicalSpace Y']
[TopologicalSpace Z] [TopologicalSpace Z']
/-- Partial homeomorphisms, defined on open subsets of the space -/
structure OpenPartialHomeomorph (X : Type*) (Y : Type*) [TopologicalSpace X]
[TopologicalSpace Y] extends PartialEquiv X Y where
open_source : IsOpen source
open_target : IsOpen target
continuousOn_toFun : ContinuousOn toFun source
continuousOn_invFun : ContinuousOn invFun target
@[deprecated (since := "2025-08-29")] alias PartialHomeomorph := OpenPartialHomeomorph
namespace OpenPartialHomeomorph
variable (e : OpenPartialHomeomorph X Y)
/-! Basic properties; inverse (symm instance) -/
section Basic
/-- Coercion of an open partial homeomorphisms to a function. We don't use `e.toFun` because it is
actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`.
While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/
@[coe] def toFun' : X → Y := e.toFun
/-- Coercion of an `OpenPartialHomeomorph` to function.
Note that an `OpenPartialHomeomorph` is not `DFunLike`. -/
instance : CoeFun (OpenPartialHomeomorph X Y) fun _ => X → Y :=
⟨fun e => e.toFun'⟩
/-- The inverse of an open partial homeomorphism -/
@[symm]
protected def symm : OpenPartialHomeomorph Y X where
toPartialEquiv := e.toPartialEquiv.symm
open_source := e.open_target
open_target := e.open_source
continuousOn_toFun := e.continuousOn_invFun
continuousOn_invFun := e.continuousOn_toFun
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. -/
def Simps.apply (e : OpenPartialHomeomorph X Y) : X → Y := e
/-- See Note [custom simps projection] -/
def Simps.symm_apply (e : OpenPartialHomeomorph X Y) : Y → X := e.symm
initialize_simps_projections OpenPartialHomeomorph (toFun → apply, invFun → symm_apply)
protected theorem continuousOn : ContinuousOn e e.source :=
e.continuousOn_toFun
theorem continuousOn_symm : ContinuousOn e.symm e.target :=
e.continuousOn_invFun
@[simp, mfld_simps]
theorem mk_coe (e : PartialEquiv X Y) (a b c d) :
(OpenPartialHomeomorph.mk e a b c d : X → Y) = e :=
rfl
@[simp, mfld_simps]
theorem mk_coe_symm (e : PartialEquiv X Y) (a b c d) :
((OpenPartialHomeomorph.mk e a b c d).symm : Y → X) = e.symm :=
rfl
theorem toPartialEquiv_injective :
Injective (toPartialEquiv : OpenPartialHomeomorph X Y → PartialEquiv X Y)
| ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl
/- Register a few simp lemmas to make sure that `simp` puts the application of a local
homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/
@[simp, mfld_simps]
theorem toFun_eq_coe (e : OpenPartialHomeomorph X Y) : e.toFun = e :=
rfl
@[simp, mfld_simps]
theorem invFun_eq_coe (e : OpenPartialHomeomorph X Y) : e.invFun = e.symm :=
rfl
@[simp, mfld_simps]
theorem coe_coe : (e.toPartialEquiv : X → Y) = e :=
rfl
@[simp, mfld_simps]
theorem coe_coe_symm : (e.toPartialEquiv.symm : Y → X) = e.symm :=
rfl
@[simp, mfld_simps]
theorem map_source {x : X} (h : x ∈ e.source) : e x ∈ e.target :=
e.map_source' h
/-- Variant of `map_source`, stated for images of subsets of `source`. -/
lemma map_source'' : e '' e.source ⊆ e.target :=
fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx)
@[simp, mfld_simps]
theorem map_target {x : Y} (h : x ∈ e.target) : e.symm x ∈ e.source :=
e.map_target' h
@[simp, mfld_simps]
theorem left_inv {x : X} (h : x ∈ e.source) : e.symm (e x) = x :=
e.left_inv' h
@[simp, mfld_simps]
theorem right_inv {x : Y} (h : x ∈ e.target) : e (e.symm x) = x :=
e.right_inv' h
theorem eq_symm_apply {x : X} {y : Y} (hx : x ∈ e.source) (hy : y ∈ e.target) :
x = e.symm y ↔ e x = y :=
e.toPartialEquiv.eq_symm_apply hx hy
protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source
protected theorem symm_mapsTo : MapsTo e.symm e.target e.source :=
e.symm.mapsTo
protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv
protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv
protected theorem invOn : InvOn e.symm e e.source e.target :=
⟨e.leftInvOn, e.rightInvOn⟩
protected theorem injOn : InjOn e e.source :=
e.leftInvOn.injOn
protected theorem bijOn : BijOn e e.source e.target :=
e.invOn.bijOn e.mapsTo e.symm_mapsTo
protected theorem surjOn : SurjOn e e.source e.target :=
e.bijOn.surjOn
end Basic
/-- Interpret a `Homeomorph` as an `OpenPartialHomeomorph` by restricting it
to an open set `s` in the domain and to `t` in the codomain. -/
@[simps! -fullyApplied apply symm_apply toPartialEquiv,
simps! -isSimp source target]
def _root_.Homeomorph.toOpenPartialHomeomorphOfImageEq (e : X ≃ₜ Y) (s : Set X) (hs : IsOpen s)
(t : Set Y) (h : e '' s = t) : OpenPartialHomeomorph X Y where
toPartialEquiv := e.toPartialEquivOfImageEq s t h
open_source := hs
open_target := by simpa [← h]
continuousOn_toFun := e.continuous.continuousOn
continuousOn_invFun := e.symm.continuous.continuousOn
@[deprecated (since := "2025-08-29")] alias
_root_.Homeomorph.toPartialHomeomorphOfImageEq := _root_.Homeomorph.toOpenPartialHomeomorphOfImageEq
/-- A homeomorphism induces an open partial homeomorphism on the whole space -/
@[simps! (attr := mfld_simps) -fullyApplied]
def _root_.Homeomorph.toOpenPartialHomeomorph (e : X ≃ₜ Y) : OpenPartialHomeomorph X Y :=
e.toOpenPartialHomeomorphOfImageEq univ isOpen_univ univ <|
by rw [image_univ, e.surjective.range_eq]
@[deprecated (since := "2025-08-29")] alias
_root_.Homeomorph.toPartialHomeomorph := _root_.Homeomorph.toOpenPartialHomeomorph
/-- Replace `toPartialEquiv` field to provide better definitional equalities. -/
def replaceEquiv (e : OpenPartialHomeomorph X Y) (e' : PartialEquiv X Y)
(h : e.toPartialEquiv = e') : OpenPartialHomeomorph X Y where
toPartialEquiv := e'
open_source := h ▸ e.open_source
open_target := h ▸ e.open_target
continuousOn_toFun := h ▸ e.continuousOn_toFun
continuousOn_invFun := h ▸ e.continuousOn_invFun
theorem replaceEquiv_eq_self (e' : PartialEquiv X Y)
(h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by
cases e
subst e'
rfl
theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target :=
e.mapsTo
theorem eventually_left_inverse {x} (hx : x ∈ e.source) :
∀ᶠ y in 𝓝 x, e.symm (e y) = y :=
(e.open_source.eventually_mem hx).mono e.left_inv'
theorem eventually_left_inverse' {x} (hx : x ∈ e.target) :
∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y :=
e.eventually_left_inverse (e.map_target hx)
theorem eventually_right_inverse {x} (hx : x ∈ e.target) :
∀ᶠ y in 𝓝 x, e (e.symm y) = y :=
(e.open_target.eventually_mem hx).mono e.right_inv'
theorem eventually_right_inverse' {x} (hx : x ∈ e.source) :
∀ᶠ y in 𝓝 (e x), e (e.symm y) = y :=
e.eventually_right_inverse (e.map_source hx)
theorem eventually_ne_nhdsWithin {x} (hx : x ∈ e.source) :
∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x :=
eventually_nhdsWithin_iff.2 <|
(e.eventually_left_inverse hx).mono fun x' hx' =>
mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx']
theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set X) : 𝓝[e.source ∩ s] x = 𝓝[s] x :=
nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx)
theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set Y) : 𝓝[e.target ∩ s] x = 𝓝[s] x :=
e.symm.nhdsWithin_source_inter hx s
theorem image_eq_target_inter_inv_preimage {s : Set X} (h : s ⊆ e.source) :
e '' s = e.target ∩ e.symm ⁻¹' s :=
e.toPartialEquiv.image_eq_target_inter_inv_preimage h
theorem image_source_inter_eq' (s : Set X) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s :=
e.toPartialEquiv.image_source_inter_eq' s
theorem image_source_inter_eq (s : Set X) :
e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) :=
e.toPartialEquiv.image_source_inter_eq s
theorem symm_image_eq_source_inter_preimage {s : Set Y} (h : s ⊆ e.target) :
e.symm '' s = e.source ∩ e ⁻¹' s :=
e.symm.image_eq_target_inter_inv_preimage h
theorem symm_image_target_inter_eq (s : Set Y) :
e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) :=
e.symm.image_source_inter_eq _
theorem source_inter_preimage_inv_preimage (s : Set X) :
e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s :=
e.toPartialEquiv.source_inter_preimage_inv_preimage s
theorem target_inter_inv_preimage_preimage (s : Set Y) :
e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s :=
e.symm.source_inter_preimage_inv_preimage _
theorem source_inter_preimage_target_inter (s : Set Y) :
e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s :=
e.toPartialEquiv.source_inter_preimage_target_inter s
theorem image_source_eq_target : e '' e.source = e.target :=
e.toPartialEquiv.image_source_eq_target
theorem symm_image_target_eq_source : e.symm '' e.target = e.source :=
e.symm.image_source_eq_target
/-- Two open partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`.
It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on
the target. This would only be true for a weaker notion of equality, arguably the right one,
called `EqOnSource`. -/
@[ext]
protected theorem ext (e' : OpenPartialHomeomorph X Y) (h : ∀ x, e x = e' x)
(hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' :=
toPartialEquiv_injective (PartialEquiv.ext h hinv hs)
@[simp, mfld_simps]
theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm :=
rfl
-- The following lemmas are already simp via `PartialEquiv`
theorem symm_source : e.symm.source = e.target :=
rfl
theorem symm_target : e.symm.target = e.source :=
rfl
@[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl
theorem symm_bijective : Function.Bijective
(OpenPartialHomeomorph.symm : OpenPartialHomeomorph X Y → OpenPartialHomeomorph Y X) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
/-- An open partial homeomorphism is continuous at any point of its source -/
protected theorem continuousAt {x : X} (h : x ∈ e.source) : ContinuousAt e x :=
(e.continuousOn x h).continuousAt (e.open_source.mem_nhds h)
/-- An open partial homeomorphism inverse is continuous at any point of its target -/
theorem continuousAt_symm {x : Y} (h : x ∈ e.target) : ContinuousAt e.symm x :=
e.symm.continuousAt h
theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by
simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx)
theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) :=
le_antisymm (e.continuousAt hx) <|
le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx)
theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x :=
(e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx]
theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set X} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) :=
e.map_nhds_eq hx ▸ Filter.image_mem_map hs
theorem map_nhdsWithin_eq {x} (hx : x ∈ e.source) (s : Set X) :
map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x :=
calc
map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) :=
congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm
_ = 𝓝[e '' (e.source ∩ s)] e x :=
(e.leftInvOn.mono inter_subset_left).map_nhdsWithin_eq (e.left_inv hx)
(e.continuousAt_symm (e.map_source hx)).continuousWithinAt
(e.continuousAt hx).continuousWithinAt
theorem map_nhdsWithin_preimage_eq {x} (hx : x ∈ e.source) (s : Set Y) :
map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by
rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage,
e.nhdsWithin_target_inter (e.map_source hx)]
theorem eventually_nhds {x : X} (p : Y → Prop) (hx : x ∈ e.source) :
(∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) :=
Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map
theorem eventually_nhds' {x : X} (p : X → Prop) (hx : x ∈ e.source) :
(∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by
rw [e.eventually_nhds _ hx]
refine eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => ?_)
rw [hy]
theorem eventually_nhdsWithin {x : X} (p : Y → Prop) {s : Set X}
(hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by
refine Iff.trans ?_ eventually_map
rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)]
theorem eventually_nhdsWithin' {x : X} (p : X → Prop) {s : Set X}
(hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by
rw [e.eventually_nhdsWithin _ hx]
refine eventually_congr <|
(eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_
rw [hy]
/-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that
locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target
of `e` and some other neighborhood of `f x` (which will be the source of a chart on `Z`). -/
theorem preimage_eventuallyEq_target_inter_preimage_inter {e : OpenPartialHomeomorph X Y}
{s : Set X} {t : Set Z} {x : X} {f : X → Z} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source)
(ht : t ∈ 𝓝 (f x)) :
e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set Y) := by
rw [eventuallyEq_set, e.eventually_nhds _ hxe]
filter_upwards [e.open_source.mem_nhds hxe,
mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)]
intro y hy hyu
simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and, iff_self_and,
e.left_inv hy, iff_true_intro hyu]
theorem isOpen_inter_preimage {s : Set Y} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) :=
e.continuousOn.isOpen_inter_preimage e.open_source hs
theorem isOpen_inter_preimage_symm {s : Set X} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) :=
e.symm.continuousOn.isOpen_inter_preimage e.open_target hs
/-- An open partial homeomorphism is an open map on its source:
the image of an open subset of the source is open. -/
lemma isOpen_image_of_subset_source {s : Set X} (hs : IsOpen s) (hse : s ⊆ e.source) :
IsOpen (e '' s) := by
rw [(image_eq_target_inter_inv_preimage (e := e) hse)]
exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs
/-- The image of the restriction of an open set to the source is open. -/
theorem isOpen_image_source_inter {s : Set X} (hs : IsOpen s) :
IsOpen (e '' (e.source ∩ s)) :=
e.isOpen_image_of_subset_source (e.open_source.inter hs) inter_subset_left
/-- The inverse of an open partial homeomorphism `e` is an open map on `e.target`. -/
lemma isOpen_image_symm_of_subset_target {t : Set Y} (ht : IsOpen t) (hte : t ⊆ e.target) :
IsOpen (e.symm '' t) :=
isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte)
lemma isOpen_symm_image_iff_of_subset_target {t : Set Y} (hs : t ⊆ e.target) :
IsOpen (e.symm '' t) ↔ IsOpen t := by
refine ⟨fun h ↦ ?_, fun h ↦ e.symm.isOpen_image_of_subset_source h hs⟩
have hs' : e.symm '' t ⊆ e.source := by
rw [e.symm_image_eq_source_inter_preimage hs]
apply Set.inter_subset_left
rw [← e.image_symm_image_of_subset_target hs]
exact e.isOpen_image_of_subset_source h hs'
theorem isOpen_image_iff_of_subset_source {s : Set X} (hs : s ⊆ e.source) :
IsOpen (e '' s) ↔ IsOpen s := by
rw [← e.symm.isOpen_symm_image_iff_of_subset_target hs, e.symm_symm]
section IsImage
/-!
### `OpenPartialHomeomorph.IsImage` relation
We say that `t : Set Y` is an image of `s : Set X` under an open partial homeomorphism `e` if any of
the following equivalent conditions hold:
* `e '' (e.source ∩ s) = e.target ∩ t`;
* `e.source ∩ e ⁻¹ t = e.source ∩ s`;
* `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition).
This definition is a restatement of `PartialEquiv.IsImage` for open partial homeomorphisms.
In this section we transfer API about `PartialEquiv.IsImage` to open partial homeomorphisms and
add a few `OpenPartialHomeomorph`-specific lemmas like `OpenPartialHomeomorph.IsImage.closure`.
-/
/-- We say that `t : Set Y` is an image of `s : Set X` under an open partial homeomorphism `e`
if any of the following equivalent conditions hold:
* `e '' (e.source ∩ s) = e.target ∩ t`;
* `e.source ∩ e ⁻¹ t = e.source ∩ s`;
* `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition).
-/
def IsImage (s : Set X) (t : Set Y) : Prop :=
∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s)
namespace IsImage
variable {e} {s : Set X} {t : Set Y} {x : X} {y : Y}
theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t :=
h
theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s :=
h hx
protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s :=
h.toPartialEquiv.symm
theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t :=
h.symm hy
@[simp]
theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t :=
⟨fun h => h.symm, fun h => h.symm⟩
protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) :=
h.toPartialEquiv.mapsTo
theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) :=
h.symm.mapsTo
theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t :=
h.toPartialEquiv.image_eq
theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s :=
h.symm.image_eq
theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s :=
PartialEquiv.IsImage.iff_preimage_eq
alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq
theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t :=
symm_iff.symm.trans iff_preimage_eq
alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq
theorem iff_symm_preimage_eq' :
e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by
rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq']
alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq'
theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s :=
symm_iff.symm.trans iff_symm_preimage_eq'
alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq'
theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t :=
PartialEquiv.IsImage.of_image_eq h
theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t :=
PartialEquiv.IsImage.of_symm_image_eq h
protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not
protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') :
e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx)
protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') :
e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx)
protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') :
e.IsImage (s \ s') (t \ t') :=
h.inter h'.compl
theorem leftInvOn_piecewise {e' : OpenPartialHomeomorph X Y} [∀ i, Decidable (i ∈ s)]
[∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) :
LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) :=
h.toPartialEquiv.leftInvOn_piecewise h'
theorem inter_eq_of_inter_eq_of_eqOn {e' : OpenPartialHomeomorph X Y} (h : e.IsImage s t)
(h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) :
e.target ∩ t = e'.target ∩ t :=
h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq
theorem symm_eqOn_of_inter_eq_of_eqOn {e' : OpenPartialHomeomorph X Y} (h : e.IsImage s t)
(hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) :
EqOn e.symm e'.symm (e.target ∩ t) :=
h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq
theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by
rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)]
protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by
simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff]
protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by
simpa only [closure_compl, compl_compl] using h.compl.closure.compl
protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) :=
h.closure.diff h.interior
theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) :=
⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs =>
h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩
/-- Restrict an `OpenPartialHomeomorph` to a pair of corresponding open sets. -/
@[simps toPartialEquiv]
def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : OpenPartialHomeomorph X Y where
toPartialEquiv := h.toPartialEquiv.restr
open_source := hs
open_target := h.isOpen_iff.1 hs
continuousOn_toFun := e.continuousOn.mono inter_subset_left
continuousOn_invFun := e.symm.continuousOn.mono inter_subset_left
end IsImage
theorem isImage_source_target : e.IsImage e.source e.target :=
e.toPartialEquiv.isImage_source_target
theorem isImage_source_target_of_disjoint (e' : OpenPartialHomeomorph X Y)
(hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) :
e.IsImage e'.source e'.target :=
e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht
/-- Preimage of interior or interior of preimage coincide for open partial homeomorphisms,
when restricted to the source. -/
theorem preimage_interior (s : Set Y) :
e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) :=
(IsImage.of_preimage_eq rfl).interior.preimage_eq
theorem preimage_closure (s : Set Y) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) :=
(IsImage.of_preimage_eq rfl).closure.preimage_eq
theorem preimage_frontier (s : Set Y) :
e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) :=
(IsImage.of_preimage_eq rfl).frontier.preimage_eq
end IsImage
/-- A `PartialEquiv` with continuous open forward map and open source is a
`OpenPartialHomeomorph`. -/
def ofContinuousOpenRestrict (e : PartialEquiv X Y) (hc : ContinuousOn e e.source)
(ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : OpenPartialHomeomorph X Y where
toPartialEquiv := e
open_source := hs
open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range
continuousOn_toFun := hc
continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn
/-- A `PartialEquiv` with continuous open forward map and open source is a
`OpenPartialHomeomorph`. -/
def ofContinuousOpen (e : PartialEquiv X Y) (hc : ContinuousOn e e.source) (ho : IsOpenMap e)
(hs : IsOpen e.source) : OpenPartialHomeomorph X Y :=
ofContinuousOpenRestrict e hc (ho.restrict hs) hs
/-- Restricting an open partial homeomorphism `e` to `e.source ∩ s` when `s` is open.
This is sometimes hard to use because of the openness assumption, but it has the advantage that
when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/
protected def restrOpen (s : Set X) (hs : IsOpen s) : OpenPartialHomeomorph X Y :=
(@IsImage.of_symm_preimage_eq X Y _ _ e s (e.symm ⁻¹' s) rfl).restr
(IsOpen.inter e.open_source hs)
@[simp, mfld_simps]
theorem restrOpen_toPartialEquiv (s : Set X) (hs : IsOpen s) :
(e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s :=
rfl
-- Already simp via `PartialEquiv`
theorem restrOpen_source (s : Set X) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s :=
rfl
/-- Restricting an open partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to
make sure that the restriction is well defined whatever the set s, since open partial homeomorphisms
are by definition defined on open sets. In applications where `s` is open, this coincides with the
restriction of partial equivalences. -/
@[simps! (attr := mfld_simps) -fullyApplied apply symm_apply,
simps! (attr := grind =) -isSimp source target]
protected def restr (s : Set X) : OpenPartialHomeomorph X Y :=
e.restrOpen (interior s) isOpen_interior
@[simp, mfld_simps]
theorem restr_toPartialEquiv (s : Set X) :
(e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) :=
rfl
theorem restr_source' (s : Set X) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by
grind
theorem restr_toPartialEquiv' (s : Set X) (hs : IsOpen s) :
(e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by
rw [e.restr_toPartialEquiv, hs.interior_eq]
theorem restr_eq_of_source_subset {e : OpenPartialHomeomorph X Y} {s : Set X} (h : e.source ⊆ s) :
e.restr s = e :=
toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <|
interior_maximal h e.open_source
@[simp, mfld_simps]
theorem restr_univ {e : OpenPartialHomeomorph X Y} : e.restr univ = e :=
restr_eq_of_source_subset (subset_univ _)
@[simp, grind =]
theorem restr_source_inter (s : Set X) : e.restr (e.source ∩ s) = e.restr s := by
refine OpenPartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) ?_
simp [e.open_source.interior_eq, ← inter_assoc]
/-- The identity on the whole space as an open partial homeomorphism. -/
@[simps! (attr := mfld_simps) -fullyApplied apply, simps! -isSimp source target]
protected def refl (X : Type*) [TopologicalSpace X] : OpenPartialHomeomorph X X :=
(Homeomorph.refl X).toOpenPartialHomeomorph
@[simp, mfld_simps]
theorem refl_partialEquiv : (OpenPartialHomeomorph.refl X).toPartialEquiv = PartialEquiv.refl X :=
rfl
@[simp, mfld_simps]
theorem refl_symm : (OpenPartialHomeomorph.refl X).symm = OpenPartialHomeomorph.refl X :=
rfl
/-! const: `PartialEquiv.const` as an open partial homeomorphism -/
section const
variable {a : X} {b : Y}
/--
This is `PartialEquiv.single` as an open partial homeomorphism: a constant map,
whose source and target are necessarily singleton sets.
-/
def const (ha : IsOpen {a}) (hb : IsOpen {b}) : OpenPartialHomeomorph X Y where
toPartialEquiv := PartialEquiv.single a b
open_source := ha
open_target := hb
continuousOn_toFun := by simp
continuousOn_invFun := by simp
@[simp, mfld_simps]
lemma const_apply (ha : IsOpen {a}) (hb : IsOpen {b}) (x : X) : (const ha hb) x = b := rfl
@[simp, mfld_simps]
lemma const_source (ha : IsOpen {a}) (hb : IsOpen {b}) : (const ha hb).source = {a} := rfl
@[simp, mfld_simps]
lemma const_target (ha : IsOpen {a}) (hb : IsOpen {b}) : (const ha hb).target = {b} := rfl
end const
/-! ofSet: the identity on a set `s` -/
section ofSet
variable {s : Set X} (hs : IsOpen s)
/-- The identity partial equivalence on a set `s` -/
@[simps! (attr := mfld_simps) -fullyApplied apply, simps! -isSimp source target]
def ofSet (s : Set X) (hs : IsOpen s) : OpenPartialHomeomorph X X where
toPartialEquiv := PartialEquiv.ofSet s
open_source := hs
open_target := hs
continuousOn_toFun := continuous_id.continuousOn
continuousOn_invFun := continuous_id.continuousOn
@[simp, mfld_simps]
theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s :=
rfl
@[simp, mfld_simps]
theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs :=
rfl
@[simp, mfld_simps]
theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = OpenPartialHomeomorph.refl X :=
by ext <;> simp
end ofSet
/-! `trans`: composition of two open partial homeomorphisms -/
section trans
variable (e' : OpenPartialHomeomorph Y Z)
/-- Composition of two open partial homeomorphisms when the target of the first and the source of
the second coincide. -/
@[simps! apply symm_apply toPartialEquiv, simps! -isSimp source target]
protected def trans' (h : e.target = e'.source) : OpenPartialHomeomorph X Z where
toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h
open_source := e.open_source
open_target := e'.open_target
continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo
continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo
/-- Composing two open partial homeomorphisms, by restricting to the maximal domain where their
composition is well defined.
Within the `Manifold` namespace, there is the notation `e ≫ₕ f` for this. -/
@[trans]
protected def trans : OpenPartialHomeomorph X Z :=
OpenPartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm
(e'.restrOpen e.target e.open_target) (by simp [inter_comm])
@[simp, mfld_simps]
theorem trans_toPartialEquiv :
(e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv :=
rfl
@[simp, mfld_simps]
theorem coe_trans : (e.trans e' : X → Z) = e' ∘ e :=
rfl
@[simp, mfld_simps]
theorem coe_trans_symm : ((e.trans e').symm : Z → X) = e.symm ∘ e'.symm :=
rfl
theorem trans_apply {x : X} : (e.trans e') x = e' (e x) :=
rfl
theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl
/- This could be considered as a simp lemma, but there are many situations where it makes something
simple into something more complicated. -/
theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source :=
PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv
theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) :=
PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv
theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) :=
PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv
theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source :=
PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv
theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target :=
rfl
theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) :=
trans_source' e'.symm e.symm
theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) :=
trans_source'' e'.symm e.symm
theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target :=
image_trans_source e'.symm e.symm
theorem trans_assoc (e'' : OpenPartialHomeomorph Z Z') :
(e.trans e').trans e'' = e.trans (e'.trans e'') :=
toPartialEquiv_injective <| e.1.trans_assoc _ _
@[simp, mfld_simps]
theorem trans_refl : e.trans (OpenPartialHomeomorph.refl Y) = e :=
toPartialEquiv_injective e.1.trans_refl
@[simp, mfld_simps]
theorem refl_trans : (OpenPartialHomeomorph.refl X).trans e = e :=
toPartialEquiv_injective e.1.refl_trans
theorem trans_ofSet {s : Set Y} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) :=
OpenPartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by
rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq]
theorem trans_of_set' {s : Set Y} (hs : IsOpen s) :
e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter]
theorem ofSet_trans {s : Set X} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s :=
OpenPartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <|
by simp [hs.interior_eq, inter_comm]
theorem ofSet_trans' {s : Set X} (hs : IsOpen s) :
(ofSet s hs).trans e = e.restr (e.source ∩ s) := by
rw [ofSet_trans, restr_source_inter]
@[simp, mfld_simps]
theorem ofSet_trans_ofSet {s : Set X} (hs : IsOpen s) {s' : Set X} (hs' : IsOpen s') :
(ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by
rw [(ofSet s hs).trans_ofSet hs']
ext <;> simp [hs'.interior_eq]
theorem restr_trans (s : Set X) : (e.restr s).trans e' = (e.trans e').restr s :=
toPartialEquiv_injective <|
PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s)
end trans
/-! `EqOnSource`: equivalence on their source -/
section EqOnSource
/-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They
should really be considered the same partial equivalence. -/
def EqOnSource (e e' : OpenPartialHomeomorph X Y) : Prop :=
e.source = e'.source ∧ EqOn e e' e.source
theorem eqOnSource_iff (e e' : OpenPartialHomeomorph X Y) :
EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv :=
Iff.rfl
/-- `EqOnSource` is an equivalence relation. -/
instance eqOnSourceSetoid : Setoid (OpenPartialHomeomorph X Y) :=
{ PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource }
theorem eqOnSource_refl : e ≈ e := Setoid.refl _
/-- If two open partial homeomorphisms are equivalent, so are their inverses. -/
theorem EqOnSource.symm' {e e' : OpenPartialHomeomorph X Y} (h : e ≈ e') : e.symm ≈ e'.symm :=
PartialEquiv.EqOnSource.symm' h
/-- Two equivalent open partial homeomorphisms have the same source. -/
theorem EqOnSource.source_eq {e e' : OpenPartialHomeomorph X Y} (h : e ≈ e') :
e.source = e'.source :=
h.1
/-- Two equivalent open partial homeomorphisms have the same target. -/
theorem EqOnSource.target_eq {e e' : OpenPartialHomeomorph X Y} (h : e ≈ e') :
e.target = e'.target :=
h.symm'.1
/-- Two equivalent open partial homeomorphisms have coinciding `toFun` on the source -/
theorem EqOnSource.eqOn {e e' : OpenPartialHomeomorph X Y} (h : e ≈ e') : EqOn e e' e.source :=
h.2
/-- Two equivalent open partial homeomorphisms have coinciding `invFun` on the target -/
theorem EqOnSource.symm_eqOn_target {e e' : OpenPartialHomeomorph X Y} (h : e ≈ e') :
EqOn e.symm e'.symm e.target :=
h.symm'.2
/-- Composition of open partial homeomorphisms respects equivalence. -/
theorem EqOnSource.trans' {e e' : OpenPartialHomeomorph X Y} {f f' : OpenPartialHomeomorph Y Z}
(he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' :=
PartialEquiv.EqOnSource.trans' he hf
/-- Restriction of open partial homeomorphisms respects equivalence -/
theorem EqOnSource.restr {e e' : OpenPartialHomeomorph X Y} (he : e ≈ e') (s : Set X) :
e.restr s ≈ e'.restr s :=
PartialEquiv.EqOnSource.restr he _
/-- Two equivalent open partial homeomorphisms are equal when the source and target are `univ`. -/
theorem Set.EqOn.restr_eqOn_source {e e' : OpenPartialHomeomorph X Y}
(h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by
constructor
· rw [e'.restr_source' _ e.open_source]
rw [e.restr_source' _ e'.open_source]
exact Set.inter_comm _ _
· rw [e.restr_source' _ e'.open_source]
refine (EqOn.trans ?_ h).trans ?_ <;> simp only [mfld_simps, eqOn_refl]
/-- Composition of an open partial homeomorphism and its inverse is equivalent to the restriction of
the identity to the source -/
theorem self_trans_symm : e.trans e.symm ≈ OpenPartialHomeomorph.ofSet e.source e.open_source :=
PartialEquiv.self_trans_symm _
theorem symm_trans_self : e.symm.trans e ≈ OpenPartialHomeomorph.ofSet e.target e.open_target :=
e.symm.self_trans_symm
theorem eq_of_eqOnSource_univ {e e' : OpenPartialHomeomorph X Y} (h : e ≈ e') (s : e.source = univ)
(t : e.target = univ) : e = e' :=
toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t
variable {s : Set X}
theorem restr_symm_trans {e' : OpenPartialHomeomorph X Y}
(hs : IsOpen s) (hs' : IsOpen (e '' s)) (hs'' : s ⊆ e.source) :
(e.restr s).symm.trans e' ≈ (e.symm.trans e').restr (e '' s) := by
refine ⟨?_, ?_⟩
· simp only [trans_toPartialEquiv, symm_toPartialEquiv, restr_toPartialEquiv,
PartialEquiv.trans_source, PartialEquiv.symm_source, PartialEquiv.restr_target, coe_coe_symm,
PartialEquiv.restr_coe_symm, PartialEquiv.restr_source]
rw [interior_eq_iff_isOpen.mpr hs', interior_eq_iff_isOpen.mpr hs]
-- Get rid of the middle term, which is merely distracting.
rw [inter_assoc, inter_assoc, inter_comm _ (e '' s), ← inter_assoc, ← inter_assoc]
congr 1
-- Now, just a bunch of rewrites: should this be a separate lemma?
rw [← image_source_inter_eq', ← image_source_eq_target]
refine image_inter_on ?_
intro x hx y hy h
rw [← left_inv e hy, ← left_inv e (hs'' hx), h]
· simp_rw [coe_trans, restr_symm_apply, restr_apply, coe_trans]
intro x hx
simp
theorem symm_trans_restr (e' : OpenPartialHomeomorph X Y) (hs : IsOpen s) :
e'.symm.trans (e.restr s) ≈ (e'.symm.trans e).restr (e'.target ∩ e'.symm ⁻¹' s) := by
have ht : IsOpen (e'.target ∩ e'.symm ⁻¹' s) := by
rw [← image_source_inter_eq']
exact isOpen_image_source_inter e' hs
refine ⟨?_, ?_⟩
· simp only [trans_toPartialEquiv, symm_toPartialEquiv, restr_toPartialEquiv,
PartialEquiv.trans_source, PartialEquiv.symm_source, coe_coe_symm, PartialEquiv.restr_source,
preimage_inter]
-- Shuffle the intersections, pull e'.target into the interior and use interior_inter.
rw [interior_eq_iff_isOpen.mpr hs,
← inter_assoc, inter_comm e'.target, inter_assoc, inter_assoc]
congr 1
nth_rw 2 [← interior_eq_iff_isOpen.mpr e'.open_target]
rw [← interior_inter, ← inter_assoc, inter_self, interior_eq_iff_isOpen.mpr ht]
· simp [Set.eqOn_refl]
lemma restr_eqOnSource_restr {s' : Set X}
(hss' : e.source ∩ interior s = e.source ∩ interior s') :
e.restr s ≈ e.restr s' := by
constructor
· simpa [e.restr_source]
· simp [Set.eqOn_refl]
lemma restr_inter_source : e.restr (e.source ∩ s) ≈ e.restr s :=
e.restr_eqOnSource_restr (by simp [interior_eq_iff_isOpen.mpr e.open_source])
end EqOnSource
/-! product of two open partial homeomorphisms -/
section Prod
/-- The product of two open partial homeomorphisms, as an open partial homeomorphism on the product
space. -/
@[simps! (attr := mfld_simps) -fullyApplied toPartialEquiv apply,
simps! -isSimp source target symm_apply]
def prod (eX : OpenPartialHomeomorph X X') (eY : OpenPartialHomeomorph Y Y') :
OpenPartialHomeomorph (X × Y) (X' × Y') where
open_source := eX.open_source.prod eY.open_source
open_target := eX.open_target.prod eY.open_target
continuousOn_toFun := eX.continuousOn.prodMap eY.continuousOn
continuousOn_invFun := eX.continuousOn_symm.prodMap eY.continuousOn_symm
toPartialEquiv := eX.toPartialEquiv.prod eY.toPartialEquiv
@[simp, mfld_simps]
theorem prod_symm (eX : OpenPartialHomeomorph X X') (eY : OpenPartialHomeomorph Y Y') :
(eX.prod eY).symm = eX.symm.prod eY.symm :=
rfl
@[simp]
theorem refl_prod_refl : (OpenPartialHomeomorph.refl X).prod (OpenPartialHomeomorph.refl Y) =
OpenPartialHomeomorph.refl (X × Y) :=
OpenPartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ
@[simp, mfld_simps]
theorem prod_trans (e : OpenPartialHomeomorph X Y) (f : OpenPartialHomeomorph Y Z)
(e' : OpenPartialHomeomorph X' Y') (f' : OpenPartialHomeomorph Y' Z') :
(e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') :=
toPartialEquiv_injective <| e.1.prod_trans ..
theorem prod_eq_prod_of_nonempty {eX eX' : OpenPartialHomeomorph X X'}
{eY eY' : OpenPartialHomeomorph Y Y'} (h : (eX.prod eY).source.Nonempty) :
eX.prod eY = eX'.prod eY' ↔ eX = eX' ∧ eY = eY' := by
obtain ⟨⟨x, y⟩, -⟩ := id h
haveI : Nonempty X := ⟨x⟩
haveI : Nonempty X' := ⟨eX x⟩
haveI : Nonempty Y := ⟨y⟩
haveI : Nonempty Y' := ⟨eY y⟩
simp_rw [OpenPartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff,
Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const,
and_assoc, and_left_comm]
theorem prod_eq_prod_of_nonempty'
{eX eX' : OpenPartialHomeomorph X X'} {eY eY' : OpenPartialHomeomorph Y Y'}
(h : (eX'.prod eY').source.Nonempty) : eX.prod eY = eX'.prod eY' ↔ eX = eX' ∧ eY = eY' := by
rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ eY']
end Prod
/-! finite product of partial homeomorphisms -/
section Pi
variable {ι : Type*} [Finite ι] {X Y : ι → Type*} [∀ i, TopologicalSpace (X i)]
[∀ i, TopologicalSpace (Y i)] (ei : ∀ i, OpenPartialHomeomorph (X i) (Y i))
/-- The product of a finite family of `OpenPartialHomeomorph`s. -/
@[simps! toPartialEquiv apply symm_apply source target]
def pi : OpenPartialHomeomorph (∀ i, X i) (∀ i, Y i) where
toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv
open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source
open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target
continuousOn_toFun := continuousOn_pi.2 fun i =>
(ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial
continuousOn_invFun := continuousOn_pi.2 fun i =>
(ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial
end Pi
/-! combining two partial homeomorphisms using `Set.piecewise` -/
section Piecewise
/-- Combine two `OpenPartialHomeomorph`s using `Set.piecewise`. The source of the new
`OpenPartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly
for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and
`e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function.
To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`,
the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`.
To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and
`e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/
@[simps! -fullyApplied toPartialEquiv apply]
def piecewise (e e' : OpenPartialHomeomorph X Y) (s : Set X) (t : Set Y) [∀ x, Decidable (x ∈ s)]
[∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t)
(Hs : e.source ∩ frontier s = e'.source ∩ frontier s)
(Heq : EqOn e e' (e.source ∩ frontier s)) : OpenPartialHomeomorph X Y where
toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H'
open_source := e.open_source.ite e'.open_source Hs
open_target :=
e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq
continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq
continuousOn_invFun :=
continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm
(H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq)
(H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq)
@[simp]
theorem symm_piecewise (e e' : OpenPartialHomeomorph X Y) {s : Set X} {t : Set Y}
[∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t)
(Hs : e.source ∩ frontier s = e'.source ∩ frontier s)
(Heq : EqOn e e' (e.source ∩ frontier s)) :
(e.piecewise e' s t H H' Hs Heq).symm =
e.symm.piecewise e'.symm t s H.symm H'.symm
(H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq)
(H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) :=
rfl
/-- Combine two `OpenPartialHomeomorph`s with disjoint sources and disjoint targets. We reuse
`OpenPartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`.
This way we have better definitional equalities for `source` and `target`. -/
def disjointUnion (e e' : OpenPartialHomeomorph X Y) [∀ x, Decidable (x ∈ e.source)]
[∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source)
(Ht : Disjoint e.target e'.target) : OpenPartialHomeomorph X Y :=
(e.piecewise e' e.source e.target e.isImage_source_target
(e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm)
(by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq])
(by
rw [e.open_source.inter_frontier_eq]
exact eqOn_empty _ _)).replaceEquiv
(e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht)
(PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm
end Piecewise
section Continuity
/-- Continuity within a set at a point can be read under right composition with a local
homeomorphism, if the point is in its target -/
theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : Y → Z} {s : Set Y} {x : Y}
(h : x ∈ e.target) :
ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by
simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e,
e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h]
/-- Continuity at a point can be read under right composition with an open partial homeomorphism, if
the point is in its target -/
theorem continuousAt_iff_continuousAt_comp_right {f : Y → Z} {x : Y} (h : x ∈ e.target) :
ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by
rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h,
preimage_univ, continuousWithinAt_univ]
/-- A function is continuous on a set if and only if its composition with an open partial
homeomorphism on the right is continuous on the corresponding set. -/
theorem continuousOn_iff_continuousOn_comp_right {f : Y → Z} {s : Set Y} (h : s ⊆ e.target) :
ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by
simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, forall_mem_image]
refine forall₂_congr fun x hx => ?_
rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx),
e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter]
exact IsOpen.mem_nhds e.open_source (e.map_target (h hx))
/-- Continuity within a set at a point can be read under left composition with a local
homeomorphism if a neighborhood of the initial point is sent to the source of the local
homeomorphism -/
theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : Z → X} {s : Set Z} {x : Z}
(hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) :
ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by
refine ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => ?_⟩
rw [← continuousWithinAt_inter' h] at fe_cont ⊢
have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x :=
haveI : ContinuousWithinAt e.symm univ (e (f x)) :=
(e.continuousAt_symm (e.map_source hx)).continuousWithinAt
ContinuousWithinAt.comp this fe_cont (subset_univ _)
exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx])
/-- Continuity at a point can be read under left composition with an open partial homeomorphism if a
neighborhood of the initial point is sent to the source of the partial homeomorphism -/
theorem continuousAt_iff_continuousAt_comp_left {f : Z → X} {x : Z} (h : f ⁻¹' e.source ∈ 𝓝 x) :
ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by
have hx : f x ∈ e.source := (mem_of_mem_nhds h :)
have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ]
rw [← continuousWithinAt_univ, ← continuousWithinAt_univ,
e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h']
/-- A function is continuous on a set if and only if its composition with an open partial
homeomorphism on the left is continuous on the corresponding set. -/
theorem continuousOn_iff_continuousOn_comp_left {f : Z → X} {s : Set Z} (h : s ⊆ f ⁻¹' e.source) :
ContinuousOn f s ↔ ContinuousOn (e ∘ f) s :=
forall₂_congr fun _x hx =>
e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx)
(mem_of_superset self_mem_nhdsWithin h)
/-- A function is continuous if and only if its composition with an open partial homeomorphism
on the left is continuous and its image is contained in the source. -/
theorem continuous_iff_continuous_comp_left {f : Z → X} (h : f ⁻¹' e.source = univ) :
Continuous f ↔ Continuous (e ∘ f) := by
simp only [← continuousOn_univ]
exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset
end Continuity
/-- The homeomorphism obtained by restricting an `OpenPartialHomeomorph` to a subset of the source.
-/
@[simps]
def homeomorphOfImageSubsetSource {s : Set X} {t : Set Y} (hs : s ⊆ e.source) (ht : e '' s = t) :
s ≃ₜ t :=
have h₁ : MapsTo e s t := mapsTo_iff_image_subset.2 ht.subset
have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_mono hs
have h₃ : MapsTo e.symm t s := ht ▸ forall_mem_image.2 fun _x hx =>
(e.left_inv (hs hx)).symm ▸ hx
{ toFun := MapsTo.restrict e s t h₁
invFun := MapsTo.restrict e.symm t s h₃
left_inv := fun a => Subtype.ext (e.left_inv (hs a.2))
right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2)
continuous_toFun := (e.continuousOn.mono hs).mapsToRestrict h₁
continuous_invFun := (e.continuousOn_symm.mono h₂).mapsToRestrict h₃ }
/-- An open partial homeomorphism defines a homeomorphism between its source and target. -/
@[simps!]
def toHomeomorphSourceTarget : e.source ≃ₜ e.target :=
e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target
theorem secondCountableTopology_source [SecondCountableTopology Y] :
SecondCountableTopology e.source :=
e.toHomeomorphSourceTarget.secondCountableTopology
theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) :
𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by
lift x to e.source using hx
rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val,
e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap]
simp only [Function.comp_def, toHomeomorphSourceTarget_apply_coe, comap_comap]
/-- If an open partial homeomorphism has source and target equal to univ, then it induces a
homeomorphism between the whole spaces, expressed in this definition. -/
@[simps (attr := mfld_simps) -fullyApplied apply symm_apply]
-- TODO: add a `PartialEquiv` version
def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set X)) (h' : e.target = univ) :
X ≃ₜ Y where
toFun := e
invFun := e.symm
left_inv x :=
e.left_inv <| by
rw [h]
exact mem_univ _
right_inv x :=
e.right_inv <| by
rw [h']
exact mem_univ _
continuous_toFun := by
simpa only [continuousOn_univ, h] using e.continuousOn
continuous_invFun := by
simpa only [continuousOn_univ, h'] using e.continuousOn_symm
theorem isOpenEmbedding_restrict : IsOpenEmbedding (e.source.restrict e) := by
refine .of_continuous_injective_isOpenMap (e.continuousOn.comp_continuous
continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_
rw [Set.restrict_eq, Set.image_comp]
exact e.isOpen_image_of_subset_source (e.open_source.isOpenMap_subtype_val V hV)
fun _ ⟨x, _, h⟩ ↦ h ▸ x.2
/-- An open partial homeomorphism whose source is all of `X` defines an open embedding of `X` into
`Y`. The converse is also true; see `IsOpenEmbedding.toOpenPartialHomeomorph`. -/
theorem to_isOpenEmbedding (h : e.source = Set.univ) : IsOpenEmbedding e :=
e.isOpenEmbedding_restrict.comp
((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ X).symm.isOpenEmbedding
end OpenPartialHomeomorph
namespace Homeomorph
variable (e : X ≃ₜ Y) (e' : Y ≃ₜ Z)
/- Register as simp lemmas that the fields of an open partial homeomorphism built from a
homeomorphism correspond to the fields of the original homeomorphism. -/
@[simp, mfld_simps]
theorem refl_toOpenPartialHomeomorph :
(Homeomorph.refl X).toOpenPartialHomeomorph = OpenPartialHomeomorph.refl X :=
rfl
@[deprecated (since := "2025-08-29")] alias
refl_toPartialHomeomorph := refl_toOpenPartialHomeomorph
@[simp, mfld_simps]
theorem symm_toOpenPartialHomeomorph :
e.symm.toOpenPartialHomeomorph = e.toOpenPartialHomeomorph.symm :=
rfl
@[deprecated (since := "2025-08-29")] alias
symm_toPartialHomeomorph := symm_toOpenPartialHomeomorph
@[simp, mfld_simps]
theorem trans_toOpenPartialHomeomorph : (e.trans e').toOpenPartialHomeomorph =
e.toOpenPartialHomeomorph.trans e'.toOpenPartialHomeomorph :=
OpenPartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _
@[deprecated (since := "2025-08-29")] alias
trans_toPartialHomeomorph := trans_toOpenPartialHomeomorph
/-- Precompose an open partial homeomorphism with a homeomorphism.
We modify the source and target to have better definitional behavior. -/
@[simps! -fullyApplied]
def transOpenPartialHomeomorph (e : X ≃ₜ Y) (f' : OpenPartialHomeomorph Y Z) :
OpenPartialHomeomorph X Z where
toPartialEquiv := e.toEquiv.transPartialEquiv f'.toPartialEquiv
open_source := f'.open_source.preimage e.continuous
open_target := f'.open_target
continuousOn_toFun := f'.continuousOn.comp e.continuous.continuousOn fun _ => id
continuousOn_invFun := e.symm.continuous.comp_continuousOn f'.symm.continuousOn
@[deprecated (since := "2025-08-29")] alias
transPartialHomeomorph := transOpenPartialHomeomorph
theorem transOpenPartialHomeomorph_eq_trans (e : X ≃ₜ Y) (f' : OpenPartialHomeomorph Y Z) :
e.transOpenPartialHomeomorph f' = e.toOpenPartialHomeomorph.trans f' :=
OpenPartialHomeomorph.toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _
@[deprecated (since := "2025-08-29")] alias
transPartialHomeomorph_eq_trans := transOpenPartialHomeomorph_eq_trans
@[simp, mfld_simps]
theorem transOpenPartialHomeomorph_trans (e : X ≃ₜ Y) (f : OpenPartialHomeomorph Y Z)
(f' : OpenPartialHomeomorph Z Z') :
(e.transOpenPartialHomeomorph f).trans f' = e.transOpenPartialHomeomorph (f.trans f') := by
simp only [transOpenPartialHomeomorph_eq_trans, OpenPartialHomeomorph.trans_assoc]
@[deprecated (since := "2025-08-29")] alias
transPartialHomeomorph_trans := transOpenPartialHomeomorph_trans
@[simp, mfld_simps]
theorem trans_transOpenPartialHomeomorph (e : X ≃ₜ Y) (e' : Y ≃ₜ Z)
(f'' : OpenPartialHomeomorph Z Z') : (e.trans e').transOpenPartialHomeomorph f'' =
e.transOpenPartialHomeomorph (e'.transOpenPartialHomeomorph f'') := by
simp only [transOpenPartialHomeomorph_eq_trans, OpenPartialHomeomorph.trans_assoc,
trans_toOpenPartialHomeomorph]
@[deprecated (since := "2025-08-29")] alias
trans_transPartialHomeomorph := trans_transOpenPartialHomeomorph
end Homeomorph
namespace Topology.IsOpenEmbedding
variable (f : X → Y) (h : IsOpenEmbedding f)
/-- An open embedding of `X` into `Y`, with `X` nonempty, defines an open partial homeomorphism
whose source is all of `X`. The converse is also true; see
`OpenPartialHomeomorph.to_isOpenEmbedding`. -/
@[simps! (attr := mfld_simps) -fullyApplied apply source target]
noncomputable def toOpenPartialHomeomorph [Nonempty X] : OpenPartialHomeomorph X Y :=
OpenPartialHomeomorph.ofContinuousOpen (h.isEmbedding.injective.injOn.toPartialEquiv f univ)
h.continuous.continuousOn h.isOpenMap isOpen_univ
@[deprecated (since := "2025-08-29")] alias toPartialHomeomorph := toOpenPartialHomeomorph
variable [Nonempty X]
lemma toOpenPartialHomeomorph_left_inv {x : X} : (h.toOpenPartialHomeomorph f).symm (f x) = x := by
rw [← congr_fun (h.toOpenPartialHomeomorph_apply f), OpenPartialHomeomorph.left_inv]
exact Set.mem_univ _
@[deprecated (since := "2025-08-29")] alias
toPartialHomeomorph_left_inv := toOpenPartialHomeomorph_left_inv
lemma toOpenPartialHomeomorph_right_inv {x : Y} (hx : x ∈ Set.range f) :
f ((h.toOpenPartialHomeomorph f).symm x) = x := by
rw [← congr_fun (h.toOpenPartialHomeomorph_apply f), OpenPartialHomeomorph.right_inv]
rwa [toOpenPartialHomeomorph_target]
@[deprecated (since := "2025-08-29")] alias
toPartialHomeomorph_right_inv := toOpenPartialHomeomorph_right_inv
end Topology.IsOpenEmbedding
/-! inclusion of an open set in a topological space -/
namespace TopologicalSpace.Opens
/- `Nonempty s` is not a type class argument because `s`, being a subset, rarely comes with a type
class instance. Then we'd have to manually provide the instance every time we use the following
lemmas, tediously using `haveI := ...` or `@foobar _ _ _ ...`. -/
variable (s : Opens X) (hs : Nonempty s)
/-- The inclusion of an open subset `s` of a space `X` into `X` is an open partial homeomorphism
from the subtype `s` to `X`. -/
noncomputable def openPartialHomeomorphSubtypeCoe : OpenPartialHomeomorph s X :=
IsOpenEmbedding.toOpenPartialHomeomorph _ s.2.isOpenEmbedding_subtypeVal
@[deprecated (since := "2025-08-29")] alias
partialHomeomorphSubtypeCoe := openPartialHomeomorphSubtypeCoe
@[simp, mfld_simps]
theorem openPartialHomeomorphSubtypeCoe_coe :
(s.openPartialHomeomorphSubtypeCoe hs : s → X) = (↑) :=
rfl
@[deprecated (since := "2025-08-29")] alias
partialHomeomorphSubtypeCoe_coe := openPartialHomeomorphSubtypeCoe_coe
@[simp, mfld_simps]
theorem openPartialHomeomorphSubtypeCoe_source :
(s.openPartialHomeomorphSubtypeCoe hs).source = Set.univ :=
rfl
@[deprecated (since := "2025-08-29")] alias
partialHomeomorphSubtypeCoe_source := openPartialHomeomorphSubtypeCoe_source
@[simp, mfld_simps]
theorem openPartialHomeomorphSubtypeCoe_target :
(s.openPartialHomeomorphSubtypeCoe hs).target = s := by
simp only [openPartialHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps]
rfl
@[deprecated (since := "2025-08-29")] alias
partialHomeomorphSubtypeCoe_target := openPartialHomeomorphSubtypeCoe_target
end TopologicalSpace.Opens
namespace OpenPartialHomeomorph
/- post-compose with an open partial homeomorphism -/
section transHomeomorph
/-- Postcompose an open partial homeomorphism with a homeomorphism.
We modify the source and target to have better definitional behavior. -/
@[simps! -fullyApplied]
def transHomeomorph (e : OpenPartialHomeomorph X Y) (f' : Y ≃ₜ Z) : OpenPartialHomeomorph X Z where
toPartialEquiv := e.toPartialEquiv.transEquiv f'.toEquiv
open_source := e.open_source
open_target := e.open_target.preimage f'.symm.continuous
continuousOn_toFun := f'.continuous.comp_continuousOn e.continuousOn
continuousOn_invFun := e.symm.continuousOn.comp f'.symm.continuous.continuousOn fun _ => id
theorem transHomeomorph_eq_trans (e : OpenPartialHomeomorph X Y) (f' : Y ≃ₜ Z) :
e.transHomeomorph f' = e.trans f'.toOpenPartialHomeomorph :=
toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _
@[simp, mfld_simps]
theorem transHomeomorph_transHomeomorph (e : OpenPartialHomeomorph X Y) (f' : Y ≃ₜ Z)
(f'' : Z ≃ₜ Z') :
(e.transHomeomorph f').transHomeomorph f'' = e.transHomeomorph (f'.trans f'') := by
simp only [transHomeomorph_eq_trans, trans_assoc, Homeomorph.trans_toOpenPartialHomeomorph]
@[simp, mfld_simps]
theorem trans_transHomeomorph (e : OpenPartialHomeomorph X Y) (e' : OpenPartialHomeomorph Y Z)
(f'' : Z ≃ₜ Z') :
(e.trans e').transHomeomorph f'' = e.trans (e'.transHomeomorph f'') := by
simp only [transHomeomorph_eq_trans, trans_assoc]
end transHomeomorph
/-! `subtypeRestr`: restriction to a subtype -/
section subtypeRestr
open TopologicalSpace
variable (e : OpenPartialHomeomorph X Y)
variable {s : Opens X} (hs : Nonempty s)
/-- The restriction of an open partial homeomorphism `e` to an open subset `s` of the domain type
produces an open partial homeomorphism whose domain is the subtype `s`. -/
noncomputable def subtypeRestr : OpenPartialHomeomorph s Y :=
(s.openPartialHomeomorphSubtypeCoe hs).trans e
theorem subtypeRestr_def : e.subtypeRestr hs = (s.openPartialHomeomorphSubtypeCoe hs).trans e :=
rfl
@[simp, mfld_simps]
theorem subtypeRestr_coe :
((e.subtypeRestr hs : OpenPartialHomeomorph s Y) : s → Y) = Set.restrict ↑s (e : X → Y) :=
rfl
@[simp, mfld_simps]
theorem subtypeRestr_source : (e.subtypeRestr hs).source = (↑) ⁻¹' e.source := by
simp only [subtypeRestr_def, mfld_simps]
theorem map_subtype_source {x : s} (hxe : (x : X) ∈ e.source) :
e x ∈ (e.subtypeRestr hs).target := by
refine ⟨e.map_source hxe, ?_⟩
rw [s.openPartialHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe]
exact x.prop
/-- This lemma characterizes the transition functions of an open subset in terms of the transition
functions of the original space. -/
theorem subtypeRestr_symm_trans_subtypeRestr (f f' : OpenPartialHomeomorph X Y) :
(f.subtypeRestr hs).symm.trans (f'.subtypeRestr hs) ≈
(f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by
simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm]
have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2
rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc]
refine EqOnSource.trans' ?_ (eqOnSource_refl _)
-- f' has been eliminated !!!
have set_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by
mfld_set_tac
have openness₂ : IsOpen (s : Set X) := s.2
rw [ofSet_trans', set_identity, ← trans_of_set' _ openness₂, trans_assoc]
refine EqOnSource.trans' (eqOnSource_refl _) ?_
-- f has been eliminated !!!
refine Setoid.trans (symm_trans_self (s.openPartialHomeomorphSubtypeCoe hs)) ?_
simp only [mfld_simps, Setoid.refl]
theorem subtypeRestr_symm_eqOn {U : Opens X} (hU : Nonempty U) :
EqOn e.symm (Subtype.val ∘ (e.subtypeRestr hU).symm) (e.subtypeRestr hU).target := by
intro y hy
rw [eq_comm, eq_symm_apply _ _ hy.1]
· change restrict _ e _ = _
rw [← subtypeRestr_coe _ hU, (e.subtypeRestr hU).right_inv hy]
· have := map_target _ hy; rwa [subtypeRestr_source] at this
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens X} (hU : Nonempty U) (hV : Nonempty V)
(hUV : U ≤ V) : EqOn (e.subtypeRestr hV).symm (Set.inclusion hUV ∘ (e.subtypeRestr hU).symm)
(e.subtypeRestr hU).target := by
set i := Set.inclusion hUV
intro y hy
dsimp [OpenPartialHomeomorph.subtypeRestr_def] at hy ⊢
have hyV : e.symm y ∈ (V.openPartialHomeomorphSubtypeCoe hV).target := by
rw [Opens.openPartialHomeomorphSubtypeCoe_target] at hy ⊢
exact hUV hy.2
refine (V.openPartialHomeomorphSubtypeCoe hV).injOn ?_ trivial ?_
· rw [← OpenPartialHomeomorph.symm_target]
apply OpenPartialHomeomorph.map_source
rw [OpenPartialHomeomorph.symm_source]
exact hyV
· rw [(V.openPartialHomeomorphSubtypeCoe hV).right_inv hyV]
change _ = U.openPartialHomeomorphSubtypeCoe hU _
rw [(U.openPartialHomeomorphSubtypeCoe hU).right_inv hy.2]
end subtypeRestr
variable {X X' Z : Type*} [TopologicalSpace X] [TopologicalSpace X'] [TopologicalSpace Z]
[Nonempty Z] {f : X → X'}
/-- Extend an open partial homeomorphism `e : X → Z` to `X' → Z`, using an open embedding
`ι : X → X'`. On `ι(X)`, the extension is specified by `e`; its value elsewhere is arbitrary
(and uninteresting). -/
noncomputable def lift_openEmbedding (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
OpenPartialHomeomorph X' Z where
toFun := extend f e (fun _ ↦ (Classical.arbitrary Z))
invFun := f ∘ e.invFun
source := f '' e.source
target := e.target
map_source' := by
rintro x ⟨x₀, hx₀, hxx₀⟩
rw [← hxx₀, hf.injective.extend_apply e]
exact e.map_source' hx₀
map_target' z hz := mem_image_of_mem f (e.map_target' hz)
left_inv' := by
intro x ⟨x₀, hx₀, hxx₀⟩
rw [← hxx₀, hf.injective.extend_apply e, comp_apply]
congr
exact e.left_inv' hx₀
right_inv' z hz := by simpa only [comp_apply, hf.injective.extend_apply e] using e.right_inv' hz
open_source := hf.isOpenMap _ e.open_source
open_target := e.open_target
continuousOn_toFun := by
by_cases Nonempty X; swap
· intro x hx; simp_all
set F := (extend f e (fun _ ↦ (Classical.arbitrary Z))) with F_eq
have heq : EqOn F (e ∘ (hf.toOpenPartialHomeomorph).symm) (f '' e.source) := by
intro x ⟨x₀, hx₀, hxx₀⟩
rw [← hxx₀, F_eq, hf.injective.extend_apply e, comp_apply,
hf.toOpenPartialHomeomorph_left_inv]
have : ContinuousOn (e ∘ (hf.toOpenPartialHomeomorph).symm) (f '' e.source) := by
apply e.continuousOn_toFun.comp; swap
· intro x' ⟨x, hx, hx'x⟩
rw [← hx'x, hf.toOpenPartialHomeomorph_left_inv]; exact hx
have : ContinuousOn (hf.toOpenPartialHomeomorph).symm (f '' univ) :=
(hf.toOpenPartialHomeomorph).continuousOn_invFun
exact this.mono <| image_mono <| subset_univ _
exact ContinuousOn.congr this heq
continuousOn_invFun := hf.continuous.comp_continuousOn e.continuousOn_invFun
@[simp, mfld_simps]
lemma lift_openEmbedding_toFun (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
(e.lift_openEmbedding hf) = extend f e (fun _ ↦ (Classical.arbitrary Z)) := rfl
lemma lift_openEmbedding_apply (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) {x : X} :
(lift_openEmbedding e hf) (f x) = e x := by
simp_rw [e.lift_openEmbedding_toFun]
apply hf.injective.extend_apply
@[simp, mfld_simps]
lemma lift_openEmbedding_source (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
(e.lift_openEmbedding hf).source = f '' e.source := rfl
@[simp, mfld_simps]
lemma lift_openEmbedding_target (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
(e.lift_openEmbedding hf).target = e.target := rfl
@[simp, mfld_simps]
lemma lift_openEmbedding_symm (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
(e.lift_openEmbedding hf).symm = f ∘ e.symm := rfl
@[simp, mfld_simps]
lemma lift_openEmbedding_symm_source (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
(e.lift_openEmbedding hf).symm.source = e.target := rfl
@[simp, mfld_simps]
lemma lift_openEmbedding_symm_target (e : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
(e.lift_openEmbedding hf).symm.target = f '' e.source := by
rw [OpenPartialHomeomorph.symm_target, e.lift_openEmbedding_source]
lemma lift_openEmbedding_trans_apply
(e e' : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) (z : Z) :
(e.lift_openEmbedding hf).symm.trans (e'.lift_openEmbedding hf) z = (e.symm.trans e') z := by
simp [hf.injective.extend_apply e']
@[simp, mfld_simps]
lemma lift_openEmbedding_trans (e e' : OpenPartialHomeomorph X Z) (hf : IsOpenEmbedding f) :
(e.lift_openEmbedding hf).symm.trans (e'.lift_openEmbedding hf) = e.symm.trans e' := by
ext z
· exact e.lift_openEmbedding_trans_apply e' hf z
· simp [hf.injective.extend_apply e]
· simp_rw [OpenPartialHomeomorph.trans_source, e.lift_openEmbedding_symm_source, e.symm_source,
e.lift_openEmbedding_symm, e'.lift_openEmbedding_source]
refine ⟨fun ⟨hx, ⟨y, hy, hxy⟩⟩ ↦ ⟨hx, ?_⟩, fun ⟨hx, hx'⟩ ↦ ⟨hx, mem_image_of_mem f hx'⟩⟩
rw [mem_preimage]; rw [comp_apply] at hxy
exact (hf.injective hxy) ▸ hy
end OpenPartialHomeomorph
set_option linter.style.longFile 1700 |
.lake/packages/mathlib/Mathlib/Topology/QuasiSeparated.lean | import Mathlib.Topology.Compactness.Bases
import Mathlib.Topology.NoetherianSpace
/-!
# Quasi-separated spaces
A topological space is quasi-separated if the intersections of any pairs of compact open subsets
are still compact.
Notable examples include spectral spaces, Noetherian spaces, and Hausdorff spaces.
A non-example is the interval `[0, 1]` with doubled origin: the two copies of `[0, 1]` are compact
open subsets, but their intersection `(0, 1]` is not.
## Main results
- `IsQuasiSeparated`: A subset `s` of a topological space is quasi-separated if the intersections
of any pairs of compact open subsets of `s` are still compact.
- `QuasiSeparatedSpace`: A topological space is quasi-separated if the intersections of any pairs
of compact open subsets are still compact.
- `QuasiSeparatedSpace.of_isOpenEmbedding`: If `f : α → β` is an open embedding, and `β` is
a quasi-separated space, then so is `α`.
-/
open Set TopologicalSpace Topology
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β}
/-- A subset `s` of a topological space is quasi-separated if the intersections of any pairs of
compact open subsets of `s` are still compact.
Note that this is equivalent to `s` being a `QuasiSeparatedSpace` only when `s` is open. -/
def IsQuasiSeparated (s : Set α) : Prop :=
∀ U V : Set α, U ⊆ s → IsOpen U → IsCompact U → V ⊆ s → IsOpen V → IsCompact V → IsCompact (U ∩ V)
/-- A topological space is quasi-separated if the intersections of any pairs of compact open
subsets are still compact. -/
@[mk_iff]
class QuasiSeparatedSpace (α : Type*) [TopologicalSpace α] : Prop where
/-- The intersection of two open compact subsets of a quasi-separated space is compact. -/
inter_isCompact :
∀ U V : Set α, IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)
theorem isQuasiSeparated_univ_iff {α : Type*} [TopologicalSpace α] :
IsQuasiSeparated (Set.univ : Set α) ↔ QuasiSeparatedSpace α := by
rw [quasiSeparatedSpace_iff]
simp [IsQuasiSeparated]
theorem isQuasiSeparated_univ {α : Type*} [TopologicalSpace α] [QuasiSeparatedSpace α] :
IsQuasiSeparated (Set.univ : Set α) :=
isQuasiSeparated_univ_iff.mpr inferInstance
theorem IsQuasiSeparated.image_of_isEmbedding {s : Set α} (H : IsQuasiSeparated s)
(h : IsEmbedding f) : IsQuasiSeparated (f '' s) := by
intro U V hU hU' hU'' hV hV' hV''
convert
(H (f ⁻¹' U) (f ⁻¹' V)
?_ (h.continuous.1 _ hU') ?_ ?_ (h.continuous.1 _ hV') ?_).image h.continuous
· symm
rw [← Set.preimage_inter, Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact Set.inter_subset_left.trans (hU.trans (Set.image_subset_range _ _))
· intro x hx
rw [← h.injective.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hU hx
· rw [h.isCompact_iff]
convert hU''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hU.trans (Set.image_subset_range _ _)
· intro x hx
rw [← h.injective.injOn.mem_image_iff (Set.subset_univ _) trivial]
exact hV hx
· rw [h.isCompact_iff]
convert hV''
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]
exact hV.trans (Set.image_subset_range _ _)
theorem Topology.IsOpenEmbedding.isQuasiSeparated_iff (h : IsOpenEmbedding f) {s : Set α} :
IsQuasiSeparated s ↔ IsQuasiSeparated (f '' s) := by
refine ⟨fun hs => hs.image_of_isEmbedding h.isEmbedding, ?_⟩
intro H U V hU hU' hU'' hV hV' hV''
rw [h.isEmbedding.isCompact_iff, Set.image_inter h.injective]
exact
H (f '' U) (f '' V) (image_mono hU) (h.isOpenMap _ hU') (hU''.image h.continuous)
(image_mono hV) (h.isOpenMap _ hV') (hV''.image h.continuous)
theorem isQuasiSeparated_iff_quasiSeparatedSpace (s : Set α) (hs : IsOpen s) :
IsQuasiSeparated s ↔ QuasiSeparatedSpace s := by
rw [← isQuasiSeparated_univ_iff]
convert (hs.isOpenEmbedding_subtypeVal.isQuasiSeparated_iff (s := Set.univ)).symm
simp
theorem IsQuasiSeparated.of_subset {s t : Set α} (ht : IsQuasiSeparated t) (h : s ⊆ t) :
IsQuasiSeparated s := by
intro U V hU hU' hU'' hV hV' hV''
exact ht U V (hU.trans h) hU' hU'' (hV.trans h) hV' hV''
instance (priority := 100) T2Space.to_quasiSeparatedSpace [T2Space α] : QuasiSeparatedSpace α :=
⟨fun _ _ _ hU' _ hV' => hU'.inter hV'⟩
instance (priority := 100) NoetherianSpace.to_quasiSeparatedSpace [NoetherianSpace α] :
QuasiSeparatedSpace α :=
⟨fun _ _ _ _ _ _ => NoetherianSpace.isCompact _⟩
lemma QuasiSeparatedSpace.of_isTopologicalBasis {ι : Type*} {b : ι → Set α}
(basis : IsTopologicalBasis (range b)) (isCompact_inter : ∀ i j, IsCompact (b i ∩ b j)) :
QuasiSeparatedSpace α where
inter_isCompact U V hUopen hUcomp hVopen hVcomp := by
have aux := isCompact_open_iff_eq_finite_iUnion_of_isTopologicalBasis b basis fun i ↦ by
simpa using isCompact_inter i i
obtain ⟨s, hs, rfl⟩ := (aux _).1 ⟨hUcomp, hUopen⟩
obtain ⟨t, ht, rfl⟩ := (aux _).1 ⟨hVcomp, hVopen⟩
rw [iUnion₂_inter_iUnion₂]
exact hs.isCompact_biUnion fun i hi ↦ ht.isCompact_biUnion fun j hj ↦ isCompact_inter ..
section QuasiSeparatedSpace
variable [QuasiSeparatedSpace α] {U V : Set α}
lemma IsQuasiSeparated.of_quasiSeparatedSpace (s : Set α) : IsQuasiSeparated s :=
isQuasiSeparated_univ.of_subset (Set.subset_univ _)
lemma QuasiSeparatedSpace.of_isOpenEmbedding {f : β → α} (h : IsOpenEmbedding f) :
QuasiSeparatedSpace β :=
isQuasiSeparated_univ_iff.mp (h.isQuasiSeparated_iff.mpr <| .of_quasiSeparatedSpace _)
lemma IsCompact.inter_of_isOpen (hUcomp : IsCompact U) (hVcomp : IsCompact V) (hUopen : IsOpen U)
(hVopen : IsOpen V) : IsCompact (U ∩ V) :=
QuasiSeparatedSpace.inter_isCompact _ _ hUopen hUcomp hVopen hVcomp
end QuasiSeparatedSpace
lemma quasiSeparatedSpace_congr (e : α ≃ₜ β) : QuasiSeparatedSpace α ↔ QuasiSeparatedSpace β where
mp _ := .of_isOpenEmbedding e.symm.isOpenEmbedding
mpr _ := .of_isOpenEmbedding e.isOpenEmbedding |
.lake/packages/mathlib/Mathlib/Topology/LocalAtTarget.lean | import Mathlib.Topology.Homeomorph.Lemmas
import Mathlib.Topology.Sets.OpenCover
import Mathlib.Topology.LocallyClosed
import Mathlib.Topology.Maps.Proper.Basic
/-!
# Properties of maps that are local at the target or at the source.
We show that the following properties of continuous maps are local at the target :
- `IsInducing`
- `IsOpenMap`
- `IsClosedMap`
- `IsEmbedding`
- `IsOpenEmbedding`
- `IsClosedEmbedding`
- `GeneralizingMap`
We show that the following properties of continuous maps are local at the source:
- `IsOpenMap`
- `GeneralizingMap`
-/
open Filter Set TopologicalSpace Topology
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β}
variable {ι : Type*} {U : ι → Opens β}
theorem Set.restrictPreimage_isInducing (s : Set β) (h : IsInducing f) :
IsInducing (s.restrictPreimage f) := by
simp_rw [← IsInducing.subtypeVal.of_comp_iff, isInducing_iff_nhds, restrictPreimage,
MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊢
intro a
rw [← h, ← IsInducing.subtypeVal.nhds_eq_comap]
alias Topology.IsInducing.restrictPreimage := Set.restrictPreimage_isInducing
theorem Set.restrictPreimage_isEmbedding (s : Set β) (h : IsEmbedding f) :
IsEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s, h.2.restrictPreimage s⟩
alias Topology.IsEmbedding.restrictPreimage := Set.restrictPreimage_isEmbedding
theorem Set.restrictPreimage_isOpenEmbedding (s : Set β) (h : IsOpenEmbedding f) :
IsOpenEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ continuous_subtype_val.isOpen_preimage _ h.isOpen_range⟩
alias Topology.IsOpenEmbedding.restrictPreimage := Set.restrictPreimage_isOpenEmbedding
theorem Set.restrictPreimage_isClosedEmbedding (s : Set β) (h : IsClosedEmbedding f) :
IsClosedEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ IsInducing.subtypeVal.isClosed_preimage _ h.isClosed_range⟩
alias Topology.IsClosedEmbedding.restrictPreimage := Set.restrictPreimage_isClosedEmbedding
theorem IsClosedMap.restrictPreimage (H : IsClosedMap f) (s : Set β) :
IsClosedMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsClosed u → Subtype.val ⁻¹' u = t →
∃ v, IsClosed v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isClosed_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
theorem IsOpenMap.restrictPreimage (H : IsOpenMap f) (s : Set β) :
IsOpenMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsOpen u → Subtype.val ⁻¹' u = t →
∃ v, IsOpen v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isOpen_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
lemma GeneralizingMap.restrictPreimage (H : GeneralizingMap f) (s : Set β) :
GeneralizingMap (s.restrictPreimage f) := by
intro x y h
obtain ⟨a, ha, hy⟩ := H (h.map <| continuous_subtype_val (p := s))
use ⟨a, by simp [hy]⟩
simp [hy, subtype_specializes_iff, ha]
lemma IsProperMap.restrictPreimage (H : IsProperMap f) (s : Set β) :
IsProperMap (s.restrictPreimage f) := by
rw [isProperMap_iff_isClosedMap_and_compact_fibers]
refine ⟨H.continuous.restrictPreimage, H.isClosedMap.restrictPreimage _, fun y ↦ ?_⟩
rw [IsEmbedding.subtypeVal.isCompact_iff, image_val_preimage_restrictPreimage, image_singleton]
exact H.isCompact_preimage isCompact_singleton
namespace TopologicalSpace.IsOpenCover
section LocalAtTarget
variable {U : ι → Opens β} {s : Set β} (hU : IsOpenCover U)
include hU
theorem isOpen_iff_inter :
IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
constructor
· exact fun H i ↦ H.inter (U i).isOpen
· intro H
simpa [← inter_iUnion, hU.iSup_set_eq_univ] using isOpen_iUnion H
theorem isOpen_iff_coe_preimage :
IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by
simp [hU.isOpen_iff_inter (s := s), (U _).2.isOpenEmbedding_subtypeVal.isOpen_iff_image_isOpen,
image_preimage_eq_inter_range]
theorem isClosed_iff_coe_preimage {s : Set β} :
IsClosed s ↔ ∀ i, IsClosed ((↑) ⁻¹' s : Set (U i)) := by
simpa using hU.isOpen_iff_coe_preimage (s := sᶜ)
theorem isLocallyClosed_iff_coe_preimage {s : Set β} :
IsLocallyClosed s ↔ ∀ i, IsLocallyClosed ((↑) ⁻¹' s : Set (U i)) := by
have (i : _) : coborder ((↑) ⁻¹' s : Set (U i)) = Subtype.val ⁻¹' coborder s :=
(U i).isOpen.isOpenEmbedding_subtypeVal.coborder_preimage _
simp [isLocallyClosed_iff_isOpen_coborder, hU.isOpen_iff_coe_preimage, this]
theorem isOpenMap_iff_restrictPreimage :
IsOpenMap f ↔ ∀ i, IsOpenMap ((U i).1.restrictPreimage f) := by
refine ⟨fun h i ↦ h.restrictPreimage _, fun H s hs ↦ ?_⟩
rw [hU.isOpen_iff_coe_preimage]
intro i
convert H i _ (hs.preimage continuous_subtype_val)
ext ⟨x, hx⟩
suffices (∃ y, y ∈ s ∧ f y = x) ↔ ∃ y, y ∈ s ∧ f y ∈ U i ∧ f y = x by simpa [← Subtype.coe_inj]
exact ⟨fun ⟨a, b, c⟩ ↦ ⟨a, b, c.symm ▸ hx, c⟩, by tauto⟩
theorem isClosedMap_iff_restrictPreimage :
IsClosedMap f ↔ ∀ i, IsClosedMap ((U i).1.restrictPreimage f) := by
refine ⟨fun h i => h.restrictPreimage _, fun H s hs ↦ ?_⟩
rw [hU.isClosed_iff_coe_preimage]
intro i
convert H i _ ⟨⟨_, hs.1, eq_compl_comm.mpr rfl⟩⟩
ext ⟨x, hx⟩
suffices (∃ y, y ∈ s ∧ f y = x) ↔ ∃ y, y ∈ s ∧ f y ∈ U i ∧ f y = x by simpa [← Subtype.coe_inj]
exact ⟨fun ⟨a, b, c⟩ => ⟨a, b, c.symm ▸ hx, c⟩, by tauto⟩
theorem isInducing_iff_restrictPreimage (h : Continuous f) :
IsInducing f ↔ ∀ i, IsInducing ((U i).1.restrictPreimage f) := by
simp_rw [← IsInducing.subtypeVal.of_comp_iff, isInducing_iff_nhds, restrictPreimage,
MapsTo.coe_restrict, restrict_eq, ← Filter.comap_comap]
constructor
· intro H i x
rw [Function.comp_apply, ← H, ← IsInducing.subtypeVal.nhds_eq_comap]
· intro H x
obtain ⟨i, hi⟩ := Opens.mem_iSup.mp (show f x ∈ iSup U by simp [hU.iSup_eq_top])
simpa [← ((h.1 _ (U i).2).isOpenEmbedding_subtypeVal).map_nhds_eq ⟨x, hi⟩, H i ⟨x, hi⟩,
subtype_coe_map_comap] using preimage_mem_comap ((U i).2.mem_nhds hi)
theorem isEmbedding_iff_restrictPreimage (h : Continuous f) :
IsEmbedding f ↔ ∀ i, IsEmbedding ((U i).1.restrictPreimage f) := by
simpa [isEmbedding_iff, forall_and] using and_congr (hU.isInducing_iff_restrictPreimage h)
(injective_iff_injective_of_iUnion_eq_univ hU.iSup_set_eq_univ)
theorem isOpenEmbedding_iff_restrictPreimage (h : Continuous f) :
IsOpenEmbedding f ↔ ∀ i, IsOpenEmbedding ((U i).1.restrictPreimage f) := by
simp_rw [isOpenEmbedding_iff, forall_and]
apply and_congr
· exact hU.isEmbedding_iff_restrictPreimage h
· simp_rw [range_restrictPreimage]
exact hU.isOpen_iff_coe_preimage
theorem isClosedEmbedding_iff_restrictPreimage (h : Continuous f) :
IsClosedEmbedding f ↔ ∀ i, IsClosedEmbedding ((U i).1.restrictPreimage f) := by
simp_rw [isClosedEmbedding_iff, forall_and]
apply and_congr
· exact hU.isEmbedding_iff_restrictPreimage h
· simp_rw [range_restrictPreimage]
exact hU.isClosed_iff_coe_preimage
omit [TopologicalSpace α] in
theorem denseRange_iff_restrictPreimage :
DenseRange f ↔ ∀ i, DenseRange ((U i).1.restrictPreimage f) := by
simp_rw [denseRange_iff_closure_range, Set.range_restrictPreimage,
← (U _).2.isOpenEmbedding_subtypeVal.isOpenMap.preimage_closure_eq_closure_preimage
continuous_subtype_val]
simp only [Opens.carrier_eq_coe, SetLike.coe_sort_coe, preimage_eq_univ_iff,
Subtype.range_coe_subtype, SetLike.mem_coe]
rw [← iUnion_subset_iff, ← Set.univ_subset_iff, iff_iff_eq]
congr 1
exact hU.iSup_set_eq_univ.symm
lemma generalizingMap_iff_restrictPreimage :
GeneralizingMap f ↔ ∀ i, GeneralizingMap ((U i).1.restrictPreimage f) := by
refine ⟨fun hf ↦ fun i ↦ hf.restrictPreimage _, fun hf ↦ fun x y h ↦ ?_⟩
obtain ⟨i, hx⟩ := hU.exists_mem (f x)
have h : (⟨y, (U i).2.stableUnderGeneralization h hx⟩ : U i) ⤳
(U i).1.restrictPreimage f ⟨x, hx⟩ := by rwa [subtype_specializes_iff]
obtain ⟨a, ha, heq⟩ := hf i h
refine ⟨a, ?_, congr(($heq).val)⟩
rwa [subtype_specializes_iff] at ha
end LocalAtTarget
section LocalAtSource
variable {U : ι → Opens α} (hU : IsOpenCover U)
include hU
lemma isOpenMap_iff_comp : IsOpenMap f ↔ ∀ i, IsOpenMap (f ∘ ((↑) : U i → α)) := by
refine ⟨fun hf ↦ fun i ↦ hf.comp (U i).isOpenEmbedding'.isOpenMap, fun hf ↦ ?_⟩
intro V hV
convert isOpen_iUnion (fun i ↦ hf i _ <| isOpen_induced hV)
simp_rw [Set.image_comp, Set.image_preimage_eq_inter_range, ← Set.image_iUnion,
Subtype.range_coe_subtype, SetLike.setOf_mem_eq, hU.iUnion_inter]
lemma generalizingMap_iff_comp :
GeneralizingMap f ↔ ∀ i, GeneralizingMap (f ∘ ((↑) : U i → α)) := by
refine ⟨fun hf ↦ fun i ↦
((U i).isOpenEmbedding'.generalizingMap
(U i).isOpenEmbedding'.isOpen_range.stableUnderGeneralization).comp hf,
fun hf ↦ fun x y h ↦ ?_⟩
obtain ⟨i, hi⟩ := hU.exists_mem x
replace h : y ⤳ (f ∘ ((↑) : U i → α)) ⟨x, hi⟩ := h
obtain ⟨a, ha, rfl⟩ := hf i h
use a.val
simp [ha.map (U i).isOpenEmbedding'.continuous]
end LocalAtSource
end TopologicalSpace.IsOpenCover
/--
Given a continuous map `f : X → Y` between topological spaces.
Suppose we have an open cover `U i` of the range of `f`, and a family of continuous maps `V i → X`
whose images are a cover of `X` that is coarser than the pullback of `U` under `f`.
To check that `f` is an embedding it suffices to check that `V i → Y` is an embedding for all `i`.
-/
-- TODO : the lemma name does not match the content (there is no hypothesis `iSup_eq_top`!)
theorem isEmbedding_of_iSup_eq_top_of_preimage_subset_range
{X Y} [TopologicalSpace X] [TopologicalSpace Y]
(f : X → Y) (h : Continuous f) {ι : Type*}
(U : ι → Opens Y) (hU : Set.range f ⊆ (iSup U :))
(V : ι → Type*) [∀ i, TopologicalSpace (V i)]
(iV : ∀ i, V i → X) (hiV : ∀ i, Continuous (iV i)) (hV : ∀ i, f ⁻¹' U i ⊆ Set.range (iV i))
(hV' : ∀ i, IsEmbedding (f ∘ iV i)) : IsEmbedding f := by
wlog hU' : iSup U = ⊤
· let f₀ : X → Set.range f := fun x ↦ ⟨f x, ⟨x, rfl⟩⟩
suffices IsEmbedding f₀ from IsEmbedding.subtypeVal.comp this
have hU'' : (⨆ i, (U i).comap ⟨Subtype.val, continuous_subtype_val⟩ :
Opens (Set.range f)) = ⊤ := by
rw [← top_le_iff]
simpa [Set.range_subset_iff, SetLike.le_def] using hU
refine this _ ?_ _ ?_ V iV hiV ?_ ?_ hU''
· fun_prop
· rw [hU'']; simp
· exact hV
· exact fun i ↦ IsEmbedding.of_comp (by fun_prop) continuous_subtype_val (hV' i)
rw [(IsOpenCover.mk hU').isEmbedding_iff_restrictPreimage h]
intro i
let f' := (Subtype.val ∘ (f ⁻¹' U i).restrictPreimage (iV i))
have : IsEmbedding f' :=
IsEmbedding.subtypeVal.comp ((IsEmbedding.of_comp (hiV i) h (hV' _)).restrictPreimage _)
have hf' : Set.range f' = f ⁻¹' U i := by
simpa [f', Set.range_comp, Set.range_restrictPreimage] using hV i
let e := this.toHomeomorph.trans (Homeomorph.setCongr hf')
refine IsEmbedding.of_comp (by fun_prop) continuous_subtype_val ?_
convert ((hV' i).comp IsEmbedding.subtypeVal).comp e.symm.isEmbedding
ext x
obtain ⟨x, rfl⟩ := e.surjective x
simp
rfl |
.lake/packages/mathlib/Mathlib/Topology/PartitionOfUnity.lean | import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.Topology.ContinuousMap.Algebra
import Mathlib.Topology.Compactness.Paracompact
import Mathlib.Topology.ShrinkingLemma
import Mathlib.Topology.UrysohnsLemma
import Mathlib.Topology.ContinuousMap.Ordered
/-!
# Continuous partition of unity
In this file we define `PartitionOfUnity (ι X : Type*) [TopologicalSpace X] (s : Set X := univ)`
to be a continuous partition of unity on `s` indexed by `ι`. More precisely,
`f : PartitionOfUnity ι X s` is a collection of continuous functions `f i : C(X, ℝ)`, `i : ι`,
such that
* the supports of `f i` form a locally finite family of sets;
* each `f i` is nonnegative;
* `∑ᶠ i, f i x = 1` for all `x ∈ s`;
* `∑ᶠ i, f i x ≤ 1` for all `x : X`.
In the case `s = univ` the last assumption follows from the previous one but it is convenient to
have this assumption in the case `s ≠ univ`.
We also define a bump function covering,
`BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ)`, to be a collection of
functions `f i : C(X, ℝ)`, `i : ι`, such that
* the supports of `f i` form a locally finite family of sets;
* each `f i` is nonnegative;
* for each `x ∈ s` there exists `i : ι` such that `f i y = 1` in a neighborhood of `x`.
The term is motivated by the smooth case.
If `f` is a bump function covering indexed by a linearly ordered type, then
`g i x = f i x * ∏ᶠ j < i, (1 - f j x)` is a partition of unity, see
`BumpCovering.toPartitionOfUnity`. Note that only finitely many terms `1 - f j x` are not equal
to one, so this product is well-defined.
Note that `g i x = ∏ᶠ j ≤ i, (1 - f j x) - ∏ᶠ j < i, (1 - f j x)`, so most terms in the sum
`∑ᶠ i, g i x` cancel, and we get `∑ᶠ i, g i x = 1 - ∏ᶠ i, (1 - f i x)`, and the latter product
equals zero because one of `f i x` is equal to one.
We say that a partition of unity or a bump function covering `f` is *subordinate* to a family of
sets `U i`, `i : ι`, if the closure of the support of each `f i` is included in `U i`. We use
Urysohn's Lemma to prove that a locally finite open covering of a normal topological space admits a
subordinate bump function covering (hence, a subordinate partition of unity), see
`BumpCovering.exists_isSubordinate_of_locallyFinite`. If `X` is a paracompact space, then any
open covering admits a locally finite refinement, hence it admits a subordinate bump function
covering and a subordinate partition of unity, see `BumpCovering.exists_isSubordinate`.
We also provide two slightly more general versions of these lemmas,
`BumpCovering.exists_isSubordinate_of_locallyFinite_of_prop` and
`BumpCovering.exists_isSubordinate_of_prop`, to be used later in the construction of a smooth
partition of unity.
## Implementation notes
Most (if not all) books only define a partition of unity of the whole space. However, quite a few
proofs only deal with `f i` such that `tsupport (f i)` meets a specific closed subset, and
it is easier to formalize these proofs if we don't have other functions right away.
We use `WellOrderingRel j i` instead of `j < i` in the definition of
`BumpCovering.toPartitionOfUnity` to avoid a `[LinearOrder ι]` assumption. While
`WellOrderingRel j i` is a well order, not only a strict linear order, we never use this property.
## Tags
partition of unity, bump function, Urysohn's lemma, normal space, paracompact space
-/
universe u v
open Function Set Filter Topology
noncomputable section
/-- A continuous partition of unity on a set `s : Set X` is a collection of continuous functions
`f i` such that
* the supports of `f i` form a locally finite family of sets, i.e., for every point `x : X` there
exists a neighborhood `U ∋ x` such that all but finitely many functions `f i` are zero on `U`;
* the functions `f i` are nonnegative;
* the sum `∑ᶠ i, f i x` is equal to one for every `x ∈ s` and is less than or equal to one
otherwise.
If `X` is a normal paracompact space, then `PartitionOfUnity.exists_isSubordinate` guarantees
that for every open covering `U : Set (Set X)` of `s` there exists a partition of unity that is
subordinate to `U`.
-/
structure PartitionOfUnity (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where
/-- The collection of continuous functions underlying this partition of unity -/
toFun : ι → C(X, ℝ)
/-- the supports of the underlying functions are a locally finite family of sets -/
locallyFinite' : LocallyFinite fun i => support (toFun i)
/-- the functions are non-negative -/
nonneg' : 0 ≤ toFun
/-- the functions sum up to one on `s` -/
sum_eq_one' : ∀ x ∈ s, ∑ᶠ i, toFun i x = 1
/-- the functions sum up to at most one, globally -/
sum_le_one' : ∀ x, ∑ᶠ i, toFun i x ≤ 1
/-- A `BumpCovering ι X s` is an indexed family of functions `f i`, `i : ι`, such that
* the supports of `f i` form a locally finite family of sets, i.e., for every point `x : X` there
exists a neighborhood `U ∋ x` such that all but finitely many functions `f i` are zero on `U`;
* for all `i`, `x` we have `0 ≤ f i x ≤ 1`;
* each point `x ∈ s` belongs to the interior of `{x | f i x = 1}` for some `i`.
One of the main use cases for a `BumpCovering` is to define a `PartitionOfUnity`, see
`BumpCovering.toPartitionOfUnity`, but some proofs can directly use a `BumpCovering` instead of
a `PartitionOfUnity`.
If `X` is a normal paracompact space, then `BumpCovering.exists_isSubordinate` guarantees that for
every open covering `U : Set (Set X)` of `s` there exists a `BumpCovering` of `s` that is
subordinate to `U`.
-/
structure BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where
/-- The collections of continuous functions underlying this bump covering -/
toFun : ι → C(X, ℝ)
/-- the supports of the underlying functions are a locally finite family of sets -/
locallyFinite' : LocallyFinite fun i => support (toFun i)
/-- the functions are non-negative -/
nonneg' : 0 ≤ toFun
/-- the functions are each at most one -/
le_one' : toFun ≤ 1
/-- Each point `x ∈ s` belongs to the interior of `{x | f i x = 1}` for some `i`. -/
eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1
variable {ι : Type u} {X : Type v} [TopologicalSpace X]
namespace PartitionOfUnity
variable {E : Type*} [AddCommMonoid E] [SMulWithZero ℝ E] [TopologicalSpace E] [ContinuousSMul ℝ E]
{s : Set X} (f : PartitionOfUnity ι X s)
instance : FunLike (PartitionOfUnity ι X s) ι C(X, ℝ) where
coe := toFun
coe_injective' f g h := by cases f; cases g; congr
protected theorem locallyFinite : LocallyFinite fun i => support (f i) :=
f.locallyFinite'
theorem locallyFinite_tsupport : LocallyFinite fun i => tsupport (f i) :=
f.locallyFinite.closure
theorem nonneg (i : ι) (x : X) : 0 ≤ f i x :=
f.nonneg' i x
theorem sum_eq_one {x : X} (hx : x ∈ s) : ∑ᶠ i, f i x = 1 :=
f.sum_eq_one' x hx
/-- If `f` is a partition of unity on `s`, then for every `x ∈ s` there exists an index `i` such
that `0 < f i x`. -/
theorem exists_pos {x : X} (hx : x ∈ s) : ∃ i, 0 < f i x := by
have H := f.sum_eq_one hx
contrapose! H
simpa only [fun i => (H i).antisymm (f.nonneg i x), finsum_zero] using zero_ne_one
theorem sum_le_one (x : X) : ∑ᶠ i, f i x ≤ 1 :=
f.sum_le_one' x
theorem sum_nonneg (x : X) : 0 ≤ ∑ᶠ i, f i x :=
finsum_nonneg fun i => f.nonneg i x
theorem le_one (i : ι) (x : X) : f i x ≤ 1 :=
(single_le_finsum i (f.locallyFinite.point_finite x) fun j => f.nonneg j x).trans (f.sum_le_one x)
section finsupport
variable {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X)
/-- The support of a partition of unity at a point `x₀` as a `Finset`.
This is the set of `i : ι` such that `x₀ ∈ support f i`, i.e. `f i ≠ x₀`. -/
def finsupport : Finset ι := (ρ.locallyFinite.point_finite x₀).toFinset
@[simp]
theorem mem_finsupport (x₀ : X) {i} :
i ∈ ρ.finsupport x₀ ↔ i ∈ support fun i ↦ ρ i x₀ := by
simp only [finsupport, mem_support, Finite.mem_toFinset, mem_setOf_eq]
@[simp]
theorem coe_finsupport (x₀ : X) :
(ρ.finsupport x₀ : Set ι) = support fun i ↦ ρ i x₀ := by
ext
rw [Finset.mem_coe, mem_finsupport]
variable {x₀ : X}
theorem sum_finsupport (hx₀ : x₀ ∈ s) : ∑ i ∈ ρ.finsupport x₀, ρ i x₀ = 1 := by
rw [← ρ.sum_eq_one hx₀, finsum_eq_sum_of_support_subset _ (ρ.coe_finsupport x₀).superset]
theorem sum_finsupport' (hx₀ : x₀ ∈ s) {I : Finset ι} (hI : ρ.finsupport x₀ ⊆ I) :
∑ i ∈ I, ρ i x₀ = 1 := by
classical
rw [← Finset.sum_sdiff hI, ρ.sum_finsupport hx₀]
suffices ∑ i ∈ I \ ρ.finsupport x₀, (ρ i) x₀ = ∑ i ∈ I \ ρ.finsupport x₀, 0 by
rw [this, add_eq_right, Finset.sum_const_zero]
apply Finset.sum_congr rfl
rintro x hx
simp only [Finset.mem_sdiff, ρ.mem_finsupport, mem_support, Classical.not_not] at hx
exact hx.2
theorem sum_finsupport_smul_eq_finsum {M : Type*} [AddCommMonoid M] [Module ℝ M] (φ : ι → X → M) :
∑ i ∈ ρ.finsupport x₀, ρ i x₀ • φ i x₀ = ∑ᶠ i, ρ i x₀ • φ i x₀ := by
apply (finsum_eq_sum_of_support_subset _ _).symm
have : (fun i ↦ (ρ i) x₀ • φ i x₀) = (fun i ↦ (ρ i) x₀) • (fun i ↦ φ i x₀) :=
funext fun _ => (Pi.smul_apply' _ _ _).symm
rw [ρ.coe_finsupport x₀, this, support_smul]
exact inter_subset_left
end finsupport
section fintsupport -- partitions of unity have locally finite `tsupport`
variable {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X)
/-- The `tsupport`s of a partition of unity are locally finite. -/
theorem finite_tsupport : {i | x₀ ∈ tsupport (ρ i)}.Finite := by
rcases ρ.locallyFinite x₀ with ⟨t, t_in, ht⟩
apply ht.subset
rintro i hi
simp only [inter_comm]
exact mem_closure_iff_nhds.mp hi t t_in
/-- The tsupport of a partition of unity at a point `x₀` as a `Finset`.
This is the set of `i : ι` such that `x₀ ∈ tsupport f i`. -/
def fintsupport (x₀ : X) : Finset ι :=
(ρ.finite_tsupport x₀).toFinset
theorem mem_fintsupport_iff (i : ι) : i ∈ ρ.fintsupport x₀ ↔ x₀ ∈ tsupport (ρ i) :=
Finite.mem_toFinset _
theorem eventually_fintsupport_subset :
∀ᶠ y in 𝓝 x₀, ρ.fintsupport y ⊆ ρ.fintsupport x₀ := by
apply (ρ.locallyFinite.closure.eventually_subset (fun _ ↦ isClosed_closure) x₀).mono
intro y hy z hz
rw [PartitionOfUnity.mem_fintsupport_iff] at *
exact hy hz
theorem finsupport_subset_fintsupport : ρ.finsupport x₀ ⊆ ρ.fintsupport x₀ := fun i hi ↦ by
rw [ρ.mem_fintsupport_iff]
apply subset_closure
exact (ρ.mem_finsupport x₀).mp hi
theorem eventually_finsupport_subset : ∀ᶠ y in 𝓝 x₀, ρ.finsupport y ⊆ ρ.fintsupport x₀ :=
(ρ.eventually_fintsupport_subset x₀).mono
fun y hy ↦ (ρ.finsupport_subset_fintsupport y).trans hy
end fintsupport
/-- If `f` is a partition of unity on `s : Set X` and `g : X → E` is continuous at every point of
the topological support of some `f i`, then `fun x ↦ f i x • g x` is continuous on the whole space.
-/
theorem continuous_smul {g : X → E} {i : ι} (hg : ∀ x ∈ tsupport (f i), ContinuousAt g x) :
Continuous fun x => f i x • g x :=
continuous_of_tsupport fun x hx =>
((f i).continuousAt x).smul <| hg x <| tsupport_smul_subset_left _ _ hx
/-- If `f` is a partition of unity on a set `s : Set X` and `g : ι → X → E` is a family of functions
such that each `g i` is continuous at every point of the topological support of `f i`, then the sum
`fun x ↦ ∑ᶠ i, f i x • g i x` is continuous on the whole space. -/
theorem continuous_finsum_smul [ContinuousAdd E] {g : ι → X → E}
(hg : ∀ (i), ∀ x ∈ tsupport (f i), ContinuousAt (g i) x) :
Continuous fun x => ∑ᶠ i, f i x • g i x :=
(continuous_finsum fun i => f.continuous_smul (hg i)) <|
f.locallyFinite.subset fun _ => support_smul_subset_left _ _
/-- A partition of unity `f i` is subordinate to a family of sets `U i` indexed by the same type if
for each `i` the closure of the support of `f i` is a subset of `U i`. -/
def IsSubordinate (U : ι → Set X) : Prop :=
∀ i, tsupport (f i) ⊆ U i
variable {f}
theorem exists_finset_nhds' {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X) :
∃ I : Finset ι, (∀ᶠ x in 𝓝[s] x₀, ∑ i ∈ I, ρ i x = 1) ∧
∀ᶠ x in 𝓝 x₀, support (ρ · x) ⊆ I := by
rcases ρ.locallyFinite.exists_finset_support x₀ with ⟨I, hI⟩
refine ⟨I, eventually_nhdsWithin_iff.mpr (hI.mono fun x hx x_in ↦ ?_), hI⟩
have : ∑ᶠ i : ι, ρ i x = ∑ i ∈ I, ρ i x := finsum_eq_sum_of_support_subset _ hx
rwa [eq_comm, ρ.sum_eq_one x_in] at this
@[deprecated (since := "2025-05-22")] alias exists_finset_nhd' := exists_finset_nhds'
theorem exists_finset_nhds (ρ : PartitionOfUnity ι X univ) (x₀ : X) :
∃ I : Finset ι, ∀ᶠ x in 𝓝 x₀, ∑ i ∈ I, ρ i x = 1 ∧ support (ρ · x) ⊆ I := by
rcases ρ.exists_finset_nhds' x₀ with ⟨I, H⟩
use I
rwa [nhdsWithin_univ, ← eventually_and] at H
@[deprecated (since := "2025-05-22")] alias exists_finset_nhd := exists_finset_nhds
theorem exists_finset_nhds_support_subset {U : ι → Set X} (hso : f.IsSubordinate U)
(ho : ∀ i, IsOpen (U i)) (x : X) :
∃ is : Finset ι, ∃ n ∈ 𝓝 x, n ⊆ ⋂ i ∈ is, U i ∧ ∀ z ∈ n, (support (f · z)) ⊆ is :=
f.locallyFinite.exists_finset_nhds_support_subset hso ho x
@[deprecated (since := "2025-05-22")]
alias exists_finset_nhd_support_subset := exists_finset_nhds_support_subset
/-- If `f` is a partition of unity that is subordinate to a family of open sets `U i` and
`g : ι → X → E` is a family of functions such that each `g i` is continuous on `U i`, then the sum
`fun x ↦ ∑ᶠ i, f i x • g i x` is a continuous function. -/
theorem IsSubordinate.continuous_finsum_smul [ContinuousAdd E] {U : ι → Set X}
(ho : ∀ i, IsOpen (U i)) (hf : f.IsSubordinate U) {g : ι → X → E}
(hg : ∀ i, ContinuousOn (g i) (U i)) : Continuous fun x => ∑ᶠ i, f i x • g i x :=
f.continuous_finsum_smul fun i _ hx => (hg i).continuousAt <| (ho i).mem_nhds <| hf i hx
end PartitionOfUnity
namespace BumpCovering
variable {s : Set X} (f : BumpCovering ι X s)
instance : FunLike (BumpCovering ι X s) ι C(X, ℝ) where
coe := toFun
coe_injective' f g h := by cases f; cases g; congr
@[simp] lemma toFun_eq_coe : f.toFun = f := rfl
protected theorem locallyFinite : LocallyFinite fun i => support (f i) :=
f.locallyFinite'
theorem locallyFinite_tsupport : LocallyFinite fun i => tsupport (f i) :=
f.locallyFinite.closure
protected theorem point_finite (x : X) : { i | f i x ≠ 0 }.Finite :=
f.locallyFinite.point_finite x
theorem nonneg (i : ι) (x : X) : 0 ≤ f i x :=
f.nonneg' i x
theorem le_one (i : ι) (x : X) : f i x ≤ 1 :=
f.le_one' i x
open Classical in
/-- A `BumpCovering` that consists of a single function, uniformly equal to one, defined as an
example for `Inhabited` instance. -/
protected def single (i : ι) (s : Set X) : BumpCovering ι X s where
toFun := Pi.single i 1
locallyFinite' x := by
refine ⟨univ, univ_mem, (finite_singleton i).subset ?_⟩
rintro j ⟨x, hx, -⟩
contrapose! hx
rw [mem_singleton_iff] at hx
simp [hx]
nonneg' := le_update_iff.2 ⟨fun _ => zero_le_one, fun _ _ => le_rfl⟩
le_one' := update_le_iff.2 ⟨le_rfl, fun _ _ _ => zero_le_one⟩
eventuallyEq_one' x _ := ⟨i, by rw [Pi.single_eq_same, ContinuousMap.coe_one]⟩
open Classical in
@[simp]
theorem coe_single (i : ι) (s : Set X) : ⇑(BumpCovering.single i s) = Pi.single i 1 := by
rfl
instance [Inhabited ι] : Inhabited (BumpCovering ι X s) :=
⟨BumpCovering.single default s⟩
/-- A collection of bump functions `f i` is subordinate to a family of sets `U i` indexed by the
same type if for each `i` the closure of the support of `f i` is a subset of `U i`. -/
def IsSubordinate (f : BumpCovering ι X s) (U : ι → Set X) : Prop :=
∀ i, tsupport (f i) ⊆ U i
theorem IsSubordinate.mono {f : BumpCovering ι X s} {U V : ι → Set X} (hU : f.IsSubordinate U)
(hV : ∀ i, U i ⊆ V i) : f.IsSubordinate V :=
fun i => Subset.trans (hU i) (hV i)
/-- If `X` is a normal topological space and `U i`, `i : ι`, is a locally finite open covering of a
closed set `s`, then there exists a `BumpCovering ι X s` that is subordinate to `U`. If `X` is a
paracompact space, then the assumption `hf : LocallyFinite U` can be omitted, see
`BumpCovering.exists_isSubordinate`. This version assumes that `p : (X → ℝ) → Prop` is a predicate
that satisfies Urysohn's lemma, and provides a `BumpCovering` such that each function of the
covering satisfies `p`. -/
theorem exists_isSubordinate_of_locallyFinite_of_prop [NormalSpace X] (p : (X → ℝ) → Prop)
(h01 : ∀ s t, IsClosed s → IsClosed t → Disjoint s t →
∃ f : C(X, ℝ), p f ∧ EqOn f 0 s ∧ EqOn f 1 t ∧ ∀ x, f x ∈ Icc (0 : ℝ) 1)
(hs : IsClosed s) (U : ι → Set X) (ho : ∀ i, IsOpen (U i)) (hf : LocallyFinite U)
(hU : s ⊆ ⋃ i, U i) : ∃ f : BumpCovering ι X s, (∀ i, p (f i)) ∧ f.IsSubordinate U := by
rcases exists_subset_iUnion_closure_subset hs ho (fun x _ => hf.point_finite x) hU with
⟨V, hsV, hVo, hVU⟩
have hVU' : ∀ i, V i ⊆ U i := fun i => Subset.trans subset_closure (hVU i)
rcases exists_subset_iUnion_closure_subset hs hVo (fun x _ => (hf.subset hVU').point_finite x)
hsV with
⟨W, hsW, hWo, hWV⟩
choose f hfp hf0 hf1 hf01 using fun i =>
h01 _ _ (isClosed_compl_iff.2 <| hVo i) isClosed_closure
(disjoint_right.2 fun x hx => Classical.not_not.2 (hWV i hx))
have hsupp : ∀ i, support (f i) ⊆ V i := fun i => support_subset_iff'.2 (hf0 i)
refine ⟨⟨f, hf.subset fun i => Subset.trans (hsupp i) (hVU' i), fun i x => (hf01 i x).1,
fun i x => (hf01 i x).2, fun x hx => ?_⟩,
hfp, fun i => Subset.trans (closure_mono (hsupp i)) (hVU i)⟩
rcases mem_iUnion.1 (hsW hx) with ⟨i, hi⟩
exact ⟨i, ((hf1 i).mono subset_closure).eventuallyEq_of_mem ((hWo i).mem_nhds hi)⟩
/-- If `X` is a normal topological space and `U i`, `i : ι`, is a locally finite open covering of a
closed set `s`, then there exists a `BumpCovering ι X s` that is subordinate to `U`. If `X` is a
paracompact space, then the assumption `hf : LocallyFinite U` can be omitted, see
`BumpCovering.exists_isSubordinate`. -/
theorem exists_isSubordinate_of_locallyFinite [NormalSpace X] (hs : IsClosed s) (U : ι → Set X)
(ho : ∀ i, IsOpen (U i)) (hf : LocallyFinite U) (hU : s ⊆ ⋃ i, U i) :
∃ f : BumpCovering ι X s, f.IsSubordinate U :=
let ⟨f, _, hfU⟩ :=
exists_isSubordinate_of_locallyFinite_of_prop (fun _ => True)
(fun _ _ hs ht hd =>
(exists_continuous_zero_one_of_isClosed hs ht hd).imp fun _ hf => ⟨trivial, hf⟩)
hs U ho hf hU
⟨f, hfU⟩
/-- If `X` is a paracompact normal topological space and `U` is an open covering of a closed set
`s`, then there exists a `BumpCovering ι X s` that is subordinate to `U`. This version assumes that
`p : (X → ℝ) → Prop` is a predicate that satisfies Urysohn's lemma, and provides a
`BumpCovering` such that each function of the covering satisfies `p`. -/
theorem exists_isSubordinate_of_prop [NormalSpace X] [ParacompactSpace X] (p : (X → ℝ) → Prop)
(h01 : ∀ s t, IsClosed s → IsClosed t → Disjoint s t →
∃ f : C(X, ℝ), p f ∧ EqOn f 0 s ∧ EqOn f 1 t ∧ ∀ x, f x ∈ Icc (0 : ℝ) 1)
(hs : IsClosed s) (U : ι → Set X) (ho : ∀ i, IsOpen (U i)) (hU : s ⊆ ⋃ i, U i) :
∃ f : BumpCovering ι X s, (∀ i, p (f i)) ∧ f.IsSubordinate U := by
rcases precise_refinement_set hs _ ho hU with ⟨V, hVo, hsV, hVf, hVU⟩
rcases exists_isSubordinate_of_locallyFinite_of_prop p h01 hs V hVo hVf hsV with ⟨f, hfp, hf⟩
exact ⟨f, hfp, hf.mono hVU⟩
/-- If `X` is a paracompact normal topological space and `U` is an open covering of a closed set
`s`, then there exists a `BumpCovering ι X s` that is subordinate to `U`. -/
theorem exists_isSubordinate [NormalSpace X] [ParacompactSpace X] (hs : IsClosed s) (U : ι → Set X)
(ho : ∀ i, IsOpen (U i)) (hU : s ⊆ ⋃ i, U i) : ∃ f : BumpCovering ι X s, f.IsSubordinate U := by
rcases precise_refinement_set hs _ ho hU with ⟨V, hVo, hsV, hVf, hVU⟩
rcases exists_isSubordinate_of_locallyFinite hs V hVo hVf hsV with ⟨f, hf⟩
exact ⟨f, hf.mono hVU⟩
/-- If `X` is a locally compact T2 topological space and `U i`, `i : ι`, is a locally finite open
covering of a compact set `s`, then there exists a `BumpCovering ι X s` that is subordinate to `U`.
If `X` is a paracompact space, then the assumption `hf : LocallyFinite U` can be omitted, see
`BumpCovering.exists_isSubordinate`. This version assumes that `p : (X → ℝ) → Prop` is a predicate
that satisfies Urysohn's lemma, and provides a `BumpCovering` such that each function of the
covering satisfies `p`. -/
theorem exists_isSubordinate_of_locallyFinite_of_prop_t2space [LocallyCompactSpace X] [T2Space X]
(p : (X → ℝ) → Prop) (h01 : ∀ s t, IsClosed s → IsCompact t → Disjoint s t → ∃ f : C(X, ℝ),
p f ∧ EqOn f 0 s ∧ EqOn f 1 t ∧ ∀ x, f x ∈ Icc (0 : ℝ) 1)
(hs : IsCompact s) (U : ι → Set X) (ho : ∀ i, IsOpen (U i)) (hf : LocallyFinite U)
(hU : s ⊆ ⋃ i, U i) :
∃ f : BumpCovering ι X s, (∀ i, p (f i)) ∧ f.IsSubordinate U ∧
∀ i, HasCompactSupport (f i) := by
rcases exists_subset_iUnion_closure_subset_t2space hs ho (fun x _ => hf.point_finite x) hU with
⟨V, hsV, hVo, hVU, hcp⟩
have hVU' i : V i ⊆ U i := subset_closure.trans (hVU i)
rcases exists_subset_iUnion_closure_subset_t2space hs hVo
(fun x _ => (hf.subset hVU').point_finite x) hsV with ⟨W, hsW, hWo, hWV, hWc⟩
choose f hfp hf0 hf1 hf01 using fun i =>
h01 _ _ (isClosed_compl_iff.2 <| hVo i) (hWc i)
(disjoint_right.2 fun x hx => Classical.not_not.2 (hWV i hx))
have hsupp i : support (f i) ⊆ V i := support_subset_iff'.2 (hf0 i)
refine ⟨⟨f, hf.subset fun i => Subset.trans (hsupp i) (hVU' i), fun i x => (hf01 i x).1,
fun i x => (hf01 i x).2, fun x hx => ?_⟩,
hfp, fun i => Subset.trans (closure_mono (hsupp i)) (hVU i),
fun i => IsCompact.of_isClosed_subset (hcp i) isClosed_closure <| closure_mono (hsupp i)⟩
rcases mem_iUnion.1 (hsW hx) with ⟨i, hi⟩
exact ⟨i, ((hf1 i).mono subset_closure).eventuallyEq_of_mem ((hWo i).mem_nhds hi)⟩
/-- If `X` is a normal topological space and `U i`, `i : ι`, is a locally finite open covering of a
closed set `s`, then there exists a `BumpCovering ι X s` that is subordinate to `U`. If `X` is a
paracompact space, then the assumption `hf : LocallyFinite U` can be omitted, see
`BumpCovering.exists_isSubordinate`. -/
theorem exists_isSubordinate_hasCompactSupport_of_locallyFinite_t2space [LocallyCompactSpace X]
[T2Space X]
(hs : IsCompact s) (U : ι → Set X) (ho : ∀ i, IsOpen (U i)) (hf : LocallyFinite U)
(hU : s ⊆ ⋃ i, U i) :
∃ f : BumpCovering ι X s, f.IsSubordinate U ∧ ∀ i, HasCompactSupport (f i) := by
-- need to switch 0 and 1 in `exists_continuous_zero_one_of_isCompact`
simpa using
exists_isSubordinate_of_locallyFinite_of_prop_t2space (fun _ => True)
(fun _ _ ht hs hd =>
(exists_continuous_zero_one_of_isCompact' hs ht hd.symm).imp fun _ hf => ⟨trivial, hf⟩)
hs U ho hf hU
/-- Index of a bump function such that `fs i =ᶠ[𝓝 x] 1`. -/
def ind (x : X) (hx : x ∈ s) : ι :=
(f.eventuallyEq_one' x hx).choose
theorem eventuallyEq_one (x : X) (hx : x ∈ s) : f (f.ind x hx) =ᶠ[𝓝 x] 1 :=
(f.eventuallyEq_one' x hx).choose_spec
theorem ind_apply (x : X) (hx : x ∈ s) : f (f.ind x hx) x = 1 :=
(f.eventuallyEq_one x hx).eq_of_nhds
/-- Partition of unity defined by a `BumpCovering`. We use this auxiliary definition to prove some
properties of the new family of functions before bundling it into a `PartitionOfUnity`. Do not use
this definition, use `BumpCovering.toPartitionOfUnity` instead.
The partition of unity is given by the formula `g i x = f i x * ∏ᶠ j < i, (1 - f j x)`. In other
words, `g i x = ∏ᶠ j < i, (1 - f j x) - ∏ᶠ j ≤ i, (1 - f j x)`, so
`∑ᶠ i, g i x = 1 - ∏ᶠ j, (1 - f j x)`. If `x ∈ s`, then one of `f j x` equals one, hence the product
of `1 - f j x` vanishes, and `∑ᶠ i, g i x = 1`.
In order to avoid an assumption `LinearOrder ι`, we use `WellOrderingRel` instead of `(<)`. -/
def toPOUFun (i : ι) (x : X) : ℝ :=
f i x * ∏ᶠ (j) (_ : WellOrderingRel j i), (1 - f j x)
theorem toPOUFun_zero_of_zero {i : ι} {x : X} (h : f i x = 0) : f.toPOUFun i x = 0 := by
rw [toPOUFun, h, zero_mul]
theorem support_toPOUFun_subset (i : ι) : support (f.toPOUFun i) ⊆ support (f i) :=
fun _ => mt <| f.toPOUFun_zero_of_zero
open Classical in
theorem toPOUFun_eq_mul_prod (i : ι) (x : X) (t : Finset ι)
(ht : ∀ j, WellOrderingRel j i → f j x ≠ 0 → j ∈ t) :
f.toPOUFun i x = f i x * ∏ j ∈ t with WellOrderingRel j i, (1 - f j x) := by
refine congr_arg _ (finprod_cond_eq_prod_of_cond_iff _ fun {j} hj => ?_)
rw [Ne, sub_eq_self] at hj
rw [Finset.mem_filter, Iff.comm, and_iff_right_iff_imp]
exact flip (ht j) hj
theorem sum_toPOUFun_eq (x : X) : ∑ᶠ i, f.toPOUFun i x = 1 - ∏ᶠ i, (1 - f i x) := by
set s := (f.point_finite x).toFinset
have hs : (s : Set ι) = { i | f i x ≠ 0 } := Finite.coe_toFinset _
have A : (support fun i => toPOUFun f i x) ⊆ s := by
rw [hs]
exact fun i hi => f.support_toPOUFun_subset i hi
have B : (mulSupport fun i => 1 - f i x) ⊆ s := by
rw [hs, mulSupport_one_sub]
exact fun i => id
classical
letI : LinearOrder ι := linearOrderOfSTO WellOrderingRel
rw [finsum_eq_sum_of_support_subset _ A, finprod_eq_prod_of_mulSupport_subset _ B,
Finset.prod_one_sub_ordered, sub_sub_cancel]
refine Finset.sum_congr rfl fun i _ => ?_
convert f.toPOUFun_eq_mul_prod _ _ _ fun j _ hj => _
rwa [Finite.mem_toFinset]
open Classical in
theorem exists_finset_toPOUFun_eventuallyEq (i : ι) (x : X) : ∃ t : Finset ι,
f.toPOUFun i =ᶠ[𝓝 x] f i * ∏ j ∈ t with WellOrderingRel j i, (1 - f j) := by
rcases f.locallyFinite x with ⟨U, hU, hf⟩
use hf.toFinset
filter_upwards [hU] with y hyU
simp only [ContinuousMap.coe_prod, Pi.mul_apply, Finset.prod_apply]
apply toPOUFun_eq_mul_prod
intro j _ hj
exact hf.mem_toFinset.2 ⟨y, ⟨hj, hyU⟩⟩
theorem continuous_toPOUFun (i : ι) : Continuous (f.toPOUFun i) := by
refine (map_continuous <| f i).mul <| continuous_finprod_cond (fun j _ => by fun_prop) ?_
simp only [mulSupport_one_sub]
exact f.locallyFinite
/-- The partition of unity defined by a `BumpCovering`.
The partition of unity is given by the formula `g i x = f i x * ∏ᶠ j < i, (1 - f j x)`. In other
words, `g i x = ∏ᶠ j < i, (1 - f j x) - ∏ᶠ j ≤ i, (1 - f j x)`, so
`∑ᶠ i, g i x = 1 - ∏ᶠ j, (1 - f j x)`. If `x ∈ s`, then one of `f j x` equals one, hence the product
of `1 - f j x` vanishes, and `∑ᶠ i, g i x = 1`.
In order to avoid an assumption `LinearOrder ι`, we use `WellOrderingRel` instead of `(<)`. -/
def toPartitionOfUnity : PartitionOfUnity ι X s where
toFun i := ⟨f.toPOUFun i, f.continuous_toPOUFun i⟩
locallyFinite' := f.locallyFinite.subset f.support_toPOUFun_subset
nonneg' i x :=
mul_nonneg (f.nonneg i x) (finprod_cond_nonneg fun j _ => sub_nonneg.2 <| f.le_one j x)
sum_eq_one' x hx := by
simp only [ContinuousMap.coe_mk, sum_toPOUFun_eq, sub_eq_self]
apply finprod_eq_zero (fun i => 1 - f i x) (f.ind x hx)
· simp only [f.ind_apply x hx, sub_self]
· rw [mulSupport_one_sub]
exact f.point_finite x
sum_le_one' x := by
simp only [ContinuousMap.coe_mk, sum_toPOUFun_eq, sub_le_self_iff]
exact finprod_nonneg fun i => sub_nonneg.2 <| f.le_one i x
theorem toPartitionOfUnity_apply (i : ι) (x : X) :
f.toPartitionOfUnity i x = f i x * ∏ᶠ (j) (_ : WellOrderingRel j i), (1 - f j x) := rfl
open Classical in
theorem toPartitionOfUnity_eq_mul_prod (i : ι) (x : X) (t : Finset ι)
(ht : ∀ j, WellOrderingRel j i → f j x ≠ 0 → j ∈ t) :
f.toPartitionOfUnity i x = f i x * ∏ j ∈ t with WellOrderingRel j i, (1 - f j x) :=
f.toPOUFun_eq_mul_prod i x t ht
open Classical in
theorem exists_finset_toPartitionOfUnity_eventuallyEq (i : ι) (x : X) : ∃ t : Finset ι,
f.toPartitionOfUnity i =ᶠ[𝓝 x] f i * ∏ j ∈ t with WellOrderingRel j i, (1 - f j) :=
f.exists_finset_toPOUFun_eventuallyEq i x
theorem toPartitionOfUnity_zero_of_zero {i : ι} {x : X} (h : f i x = 0) :
f.toPartitionOfUnity i x = 0 :=
f.toPOUFun_zero_of_zero h
theorem support_toPartitionOfUnity_subset (i : ι) :
support (f.toPartitionOfUnity i) ⊆ support (f i) :=
f.support_toPOUFun_subset i
theorem sum_toPartitionOfUnity_eq (x : X) :
∑ᶠ i, f.toPartitionOfUnity i x = 1 - ∏ᶠ i, (1 - f i x) :=
f.sum_toPOUFun_eq x
theorem IsSubordinate.toPartitionOfUnity {f : BumpCovering ι X s} {U : ι → Set X}
(h : f.IsSubordinate U) : f.toPartitionOfUnity.IsSubordinate U :=
fun i => Subset.trans (closure_mono <| f.support_toPartitionOfUnity_subset i) (h i)
end BumpCovering
namespace PartitionOfUnity
variable {s : Set X}
instance [Inhabited ι] : Inhabited (PartitionOfUnity ι X s) :=
⟨BumpCovering.toPartitionOfUnity default⟩
/-- If `X` is a normal topological space and `U` is a locally finite open covering of a closed set
`s`, then there exists a `PartitionOfUnity ι X s` that is subordinate to `U`. If `X` is a
paracompact space, then the assumption `hf : LocallyFinite U` can be omitted, see
`BumpCovering.exists_isSubordinate`. -/
theorem exists_isSubordinate_of_locallyFinite [NormalSpace X] (hs : IsClosed s) (U : ι → Set X)
(ho : ∀ i, IsOpen (U i)) (hf : LocallyFinite U) (hU : s ⊆ ⋃ i, U i) :
∃ f : PartitionOfUnity ι X s, f.IsSubordinate U :=
let ⟨f, hf⟩ := BumpCovering.exists_isSubordinate_of_locallyFinite hs U ho hf hU
⟨f.toPartitionOfUnity, hf.toPartitionOfUnity⟩
/-- If `X` is a paracompact normal topological space and `U` is an open covering of a closed set
`s`, then there exists a `PartitionOfUnity ι X s` that is subordinate to `U`. -/
theorem exists_isSubordinate [NormalSpace X] [ParacompactSpace X] (hs : IsClosed s) (U : ι → Set X)
(ho : ∀ i, IsOpen (U i)) (hU : s ⊆ ⋃ i, U i) :
∃ f : PartitionOfUnity ι X s, f.IsSubordinate U :=
let ⟨f, hf⟩ := BumpCovering.exists_isSubordinate hs U ho hU
⟨f.toPartitionOfUnity, hf.toPartitionOfUnity⟩
/-- If `X` is a locally compact T2 topological space and `U` is a locally finite open covering of a
compact set `s`, then there exists a `PartitionOfUnity ι X s` that is subordinate to `U`. -/
theorem exists_isSubordinate_of_locallyFinite_t2space [LocallyCompactSpace X] [T2Space X]
(hs : IsCompact s) (U : ι → Set X) (ho : ∀ i, IsOpen (U i)) (hf : LocallyFinite U)
(hU : s ⊆ ⋃ i, U i) :
∃ f : PartitionOfUnity ι X s, f.IsSubordinate U ∧ ∀ i, HasCompactSupport (f i) :=
let ⟨f, hfsub, hfcp⟩ :=
BumpCovering.exists_isSubordinate_hasCompactSupport_of_locallyFinite_t2space hs U ho hf hU
⟨f.toPartitionOfUnity, hfsub.toPartitionOfUnity, fun i => IsCompact.of_isClosed_subset (hfcp i)
isClosed_closure <| closure_mono (f.support_toPartitionOfUnity_subset i)⟩
end PartitionOfUnity
/-- A variation of **Urysohn's lemma**.
In a locally compact T2 space `X`, for a compact set `t` and a finite family of open sets `{s i}_i`
such that `t ⊆ ⋃ i, s i`, there is a family of compactly supported continuous functions `{f i}_i`
supported in `s i`, `∑ i, f i x = 1` on `t` and `0 ≤ f i x ≤ 1`. -/
theorem exists_continuous_sum_one_of_isOpen_isCompact [T2Space X] [LocallyCompactSpace X]
{n : ℕ} {t : Set X} {s : Fin n → Set X} (hs : ∀ (i : Fin n), IsOpen (s i)) (htcp : IsCompact t)
(hst : t ⊆ ⋃ i, s i) :
∃ f : Fin n → C(X, ℝ), (∀ (i : Fin n), tsupport (f i) ⊆ s i) ∧ EqOn (∑ i, f i) 1 t
∧ (∀ (i : Fin n), ∀ (x : X), f i x ∈ Icc (0 : ℝ) 1)
∧ (∀ (i : Fin n), HasCompactSupport (f i)) := by
obtain ⟨f, hfsub, hfcp⟩ := PartitionOfUnity.exists_isSubordinate_of_locallyFinite_t2space htcp s
hs (locallyFinite_of_finite _) hst
use f
refine ⟨fun i ↦ hfsub i, ?_, ?_, fun i => hfcp i⟩
· intro x hx
simp only [Finset.sum_apply, Pi.one_apply]
have h := f.sum_eq_one' x hx
rw [finsum_eq_sum (fun i => (f.toFun i) x)
(Finite.subset finite_univ (subset_univ (support fun i ↦ (f.toFun i) x)))] at h
rwa [Fintype.sum_subset (by simp)] at h
intro i x
exact ⟨f.nonneg i x, PartitionOfUnity.le_one f i x⟩ |
.lake/packages/mathlib/Mathlib/Topology/DiscreteSubset.lean | import Mathlib.Tactic.TautoSet
import Mathlib.Topology.Constructions
import Mathlib.Data.Set.Subset
import Mathlib.Topology.Separation.Basic
/-!
# Discrete subsets of topological spaces
This file contains various additional properties of discrete subsets of topological spaces.
## Discreteness and compact sets
Given a topological space `X` together with a subset `s ⊆ X`, there are two distinct concepts of
"discreteness" which may hold. These are:
(i) Every point of `s` is isolated (i.e., the subset topology induced on `s` is the discrete
topology).
(ii) Every compact subset of `X` meets `s` only finitely often (i.e., the inclusion map `s → X`
tends to the cocompact filter along the cofinite filter on `s`).
When `s` is closed, the two conditions are equivalent provided `X` is locally compact and T1,
see `IsClosed.tendsto_coe_cofinite_iff`.
### Main statements
* `tendsto_cofinite_cocompact_iff`:
* `IsClosed.tendsto_coe_cofinite_iff`:
## Co-discrete open sets
We define the filter `Filter.codiscreteWithin S`, which is the supremum of all `𝓝[S \ {x}] x`.
This is the filter of all open codiscrete sets within S. We also define `Filter.codiscrete` as
`Filter.codiscreteWithin univ`, which is the filter of all open codiscrete sets in the space.
-/
open Set Filter Function Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : X → Y}
theorem discreteTopology_subtype_iff {S : Set Y} :
DiscreteTopology S ↔ ∀ x ∈ S, 𝓝[≠] x ⊓ 𝓟 S = ⊥ := by
simp_rw [discreteTopology_iff_nhds_ne, SetCoe.forall', nhds_ne_subtype_eq_bot_iff]
lemma discreteTopology_subtype_iff' {S : Set Y} :
DiscreteTopology S ↔ ∀ y ∈ S, ∃ U : Set Y, IsOpen U ∧ U ∩ S = {y} := by
simp [discreteTopology_iff_isOpen_singleton, isOpen_induced_iff, Set.ext_iff]
grind
section cofinite_cocompact
omit [TopologicalSpace X] in
lemma tendsto_cofinite_cocompact_iff :
Tendsto f cofinite (cocompact _) ↔ ∀ K, IsCompact K → Set.Finite (f ⁻¹' K) := by
rw [hasBasis_cocompact.tendsto_right_iff]
refine forall₂_congr (fun K _ ↦ ?_)
simp only [mem_compl_iff, eventually_cofinite, not_not, preimage]
lemma Continuous.discrete_of_tendsto_cofinite_cocompact [T1Space X] [WeaklyLocallyCompactSpace Y]
(hf' : Continuous f) (hf : Tendsto f cofinite (cocompact _)) :
DiscreteTopology X := by
refine discreteTopology_iff_isOpen_singleton.mpr (fun x ↦ ?_)
obtain ⟨K : Set Y, hK : IsCompact K, hK' : K ∈ 𝓝 (f x)⟩ := exists_compact_mem_nhds (f x)
obtain ⟨U : Set Y, hU₁ : U ⊆ K, hU₂ : IsOpen U, hU₃ : f x ∈ U⟩ := mem_nhds_iff.mp hK'
have hU₄ : Set.Finite (f⁻¹' U) :=
Finite.subset (tendsto_cofinite_cocompact_iff.mp hf K hK) (preimage_mono hU₁)
exact isOpen_singleton_of_finite_mem_nhds _ ((hU₂.preimage hf').mem_nhds hU₃) hU₄
lemma tendsto_cofinite_cocompact_of_discrete [DiscreteTopology X]
(hf : Tendsto f (cocompact _) (cocompact _)) :
Tendsto f cofinite (cocompact _) := by
convert hf
rw [cocompact_eq_cofinite X]
lemma IsClosed.tendsto_coe_cofinite_of_discreteTopology
{s : Set X} (hs : IsClosed s) (_hs' : DiscreteTopology s) :
Tendsto ((↑) : s → X) cofinite (cocompact _) :=
tendsto_cofinite_cocompact_of_discrete hs.isClosedEmbedding_subtypeVal.tendsto_cocompact
lemma IsClosed.tendsto_coe_cofinite_iff [T1Space X] [WeaklyLocallyCompactSpace X]
{s : Set X} (hs : IsClosed s) :
Tendsto ((↑) : s → X) cofinite (cocompact _) ↔ DiscreteTopology s :=
⟨continuous_subtype_val.discrete_of_tendsto_cofinite_cocompact,
fun _ ↦ hs.tendsto_coe_cofinite_of_discreteTopology inferInstance⟩
end cofinite_cocompact
section codiscrete_filter
/-- Criterion for a subset `S ⊆ X` to be closed and discrete in terms of the punctured
neighbourhood filter at an arbitrary point of `X`. (Compare `discreteTopology_subtype_iff`.) -/
theorem isClosed_and_discrete_iff {S : Set X} :
IsClosed S ∧ DiscreteTopology S ↔ ∀ x, Disjoint (𝓝[≠] x) (𝓟 S) := by
rw [discreteTopology_subtype_iff, isClosed_iff_clusterPt, ← forall_and]
congrm (∀ x, ?_)
rw [← not_imp_not, clusterPt_iff_not_disjoint, not_not, ← disjoint_iff]
constructor <;> intro H
· by_cases hx : x ∈ S
exacts [H.2 hx, (H.1 hx).mono_left nhdsWithin_le_nhds]
· refine ⟨fun hx ↦ ?_, fun _ ↦ H⟩
simpa [disjoint_iff, nhdsWithin, inf_assoc, hx] using H
/-- The filter of sets with no accumulation points inside a set `S : Set X`, implemented
as the supremum over all punctured neighborhoods within `S`. -/
def Filter.codiscreteWithin (S : Set X) : Filter X := ⨆ x ∈ S, 𝓝[S \ {x}] x
lemma mem_codiscreteWithin {S T : Set X} :
S ∈ codiscreteWithin T ↔ ∀ x ∈ T, Disjoint (𝓝[≠] x) (𝓟 (T \ S)) := by
simp only [codiscreteWithin, mem_iSup, mem_nhdsWithin, disjoint_principal_right, subset_def,
mem_diff, mem_inter_iff, mem_compl_iff]
congr! 7 with x - u y
tauto
/--
A set `s` is codiscrete within `U` iff `s ∪ Uᶜ` is a punctured neighborhood of every point in `U`.
-/
theorem mem_codiscreteWithin_iff_forall_mem_nhdsNE {S T : Set X} :
S ∈ codiscreteWithin T ↔ ∀ x ∈ T, S ∪ Tᶜ ∈ 𝓝[≠] x := by
simp_rw [mem_codiscreteWithin, disjoint_principal_right, Set.compl_diff]
lemma mem_codiscreteWithin_accPt {S T : Set X} :
S ∈ codiscreteWithin T ↔ ∀ x ∈ T, ¬AccPt x (𝓟 (T \ S)) := by
simp only [mem_codiscreteWithin, disjoint_iff, AccPt, not_neBot]
/-- Any set is codiscrete within itself. -/
@[simp]
theorem Filter.self_mem_codiscreteWithin (U : Set X) :
U ∈ Filter.codiscreteWithin U := by simp [mem_codiscreteWithin]
/-- If a set is codiscrete within `U`, then it is codiscrete within any subset of `U`. -/
lemma Filter.codiscreteWithin.mono {U₁ U : Set X} (hU : U₁ ⊆ U) :
codiscreteWithin U₁ ≤ codiscreteWithin U := by
refine (biSup_mono hU).trans <| iSup₂_mono fun _ _ ↦ ?_
gcongr
/-- If `s` is codiscrete within `U`, then `sᶜ ∩ U` has discrete topology. -/
theorem discreteTopology_of_codiscreteWithin {U s : Set X} (h : s ∈ Filter.codiscreteWithin U) :
DiscreteTopology ((sᶜ ∩ U) : Set X) := by
rw [(by simp : ((sᶜ ∩ U) : Set X) = ((s ∪ Uᶜ)ᶜ : Set X)), discreteTopology_subtype_iff]
simp_rw [mem_codiscreteWithin, Filter.disjoint_principal_right] at h
intro x hx
rw [← Filter.mem_iff_inf_principal_compl, ← Set.compl_diff]
simp_all only [h x, Set.compl_union, compl_compl, Set.mem_inter_iff, Set.mem_compl_iff]
/-- Helper lemma for `codiscreteWithin_iff_locallyFiniteComplementWithin`: A set `s` is
`codiscreteWithin U` iff every point `z ∈ U` has a punctured neighborhood that does not intersect
`U \ s`. -/
lemma codiscreteWithin_iff_locallyEmptyComplementWithin {s U : Set X} :
s ∈ codiscreteWithin U ↔ ∀ z ∈ U, ∃ t ∈ 𝓝[≠] z, t ∩ (U \ s) = ∅ := by
simp only [mem_codiscreteWithin, disjoint_principal_right]
refine ⟨fun h z hz ↦ ⟨(U \ s)ᶜ, h z hz, by simp⟩, fun h z hz ↦ ?_⟩
rw [← exists_mem_subset_iff]
obtain ⟨t, h₁t, h₂t⟩ := h z hz
use t, h₁t, (disjoint_iff_inter_eq_empty.mpr h₂t).subset_compl_right
/-- If `U` is closed and `s` is codiscrete within `U`, then `U \ s` is closed. -/
theorem isClosed_sdiff_of_codiscreteWithin {s U : Set X} (hs : s ∈ codiscreteWithin U)
(hU : IsClosed U) :
IsClosed (U \ s) := by
rw [← isOpen_compl_iff, isOpen_iff_eventually]
intro x hx
by_cases h₁x : x ∈ U
· rw [mem_codiscreteWithin] at hs
filter_upwards [eventually_nhdsWithin_iff.1 (disjoint_principal_right.1 (hs x h₁x))]
intro a ha
by_cases h₂a : a = x
· tauto_set
· specialize ha h₂a
tauto_set
· rw [eventually_iff_exists_mem]
use Uᶜ, hU.compl_mem_nhds h₁x
intro y hy
tauto_set
/-- In a T1Space, punctured neighborhoods are stable under removing finite sets of points. -/
theorem nhdsNE_of_nhdsNE_sdiff_finite {X : Type*} [TopologicalSpace X] [T1Space X] {x : X}
{U s : Set X} (hU : U ∈ 𝓝[≠] x) (hs : Finite s) :
U \ s ∈ 𝓝[≠] x := by
rw [mem_nhdsWithin] at hU ⊢
obtain ⟨t, ht, h₁ts, h₂ts⟩ := hU
use t \ (s \ {x})
constructor
· rw [← isClosed_compl_iff, compl_diff]
exact s.toFinite.diff.isClosed.union (isClosed_compl_iff.2 ht)
· tauto_set
@[deprecated (since := "2025-05-22")]
alias nhdNE_of_nhdNE_sdiff_finite := nhdsNE_of_nhdsNE_sdiff_finite
/-- In a T1Space, a set `s` is codiscreteWithin `U` iff it has locally finite complement within `U`.
More precisely: `s` is codiscreteWithin `U` iff every point `z ∈ U` has a punctured neighborhood
intersect `U \ s` in only finitely many points. -/
theorem codiscreteWithin_iff_locallyFiniteComplementWithin [T1Space X] {s U : Set X} :
s ∈ codiscreteWithin U ↔ ∀ z ∈ U, ∃ t ∈ 𝓝 z, Set.Finite (t ∩ (U \ s)) := by
rw [codiscreteWithin_iff_locallyEmptyComplementWithin]
constructor
· intro h z h₁z
obtain ⟨t, h₁t, h₂t⟩ := h z h₁z
use insert z t, insert_mem_nhds_iff.mpr h₁t
by_cases hz : z ∈ U \ s
· rw [inter_comm, inter_insert_of_mem hz, inter_comm, h₂t]
simp
· rw [inter_comm, inter_insert_of_notMem hz, inter_comm, h₂t]
simp
· intro h z h₁z
obtain ⟨t, h₁t, h₂t⟩ := h z h₁z
use t \ (t ∩ (U \ s)), nhdsNE_of_nhdsNE_sdiff_finite (mem_nhdsWithin_of_mem_nhds h₁t) h₂t
simp
/-- In any topological space, the open sets with discrete complement form a filter,
defined as the supremum of all punctured neighborhoods.
See `Filter.mem_codiscrete'` for the equivalence. -/
def Filter.codiscrete (X : Type*) [TopologicalSpace X] : Filter X := codiscreteWithin Set.univ
lemma mem_codiscrete {S : Set X} :
S ∈ codiscrete X ↔ ∀ x, Disjoint (𝓝[≠] x) (𝓟 Sᶜ) := by
simp [codiscrete, mem_codiscreteWithin, compl_eq_univ_diff]
lemma mem_codiscrete_accPt {S : Set X} :
S ∈ codiscrete X ↔ ∀ x, ¬AccPt x (𝓟 Sᶜ) := by
simp only [mem_codiscrete, disjoint_iff, AccPt, not_neBot]
lemma mem_codiscrete' {S : Set X} :
S ∈ codiscrete X ↔ IsOpen S ∧ DiscreteTopology ↑Sᶜ := by
rw [mem_codiscrete, ← isClosed_compl_iff, isClosed_and_discrete_iff]
lemma mem_codiscrete_subtype_iff_mem_codiscreteWithin {S : Set X} {U : Set S} :
U ∈ codiscrete S ↔ (↑) '' U ∈ codiscreteWithin S := by
simp only [mem_codiscrete, disjoint_principal_right, compl_compl, Subtype.forall,
mem_codiscreteWithin]
congr! with x hx
constructor
· rw [nhdsWithin_subtype, mem_comap]
rintro ⟨t, ht1, ht2⟩
rw [mem_nhdsWithin] at ht1 ⊢
obtain ⟨u, hu1, hu2, hu3⟩ := ht1
refine ⟨u, hu1, hu2, fun v hv ↦ ?_⟩
simpa using fun hv2 ↦ ⟨hv2, ht2 <| hu3 <| by simpa [hv2]⟩
· suffices Tendsto (↑) (𝓝[≠] (⟨x, hx⟩ : S)) (𝓝[≠] x) by convert tendsto_def.mp this _; ext; simp
exact tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _
continuous_subtype_val.continuousWithinAt <| eventually_mem_nhdsWithin.mono (by simp)
end codiscrete_filter
section discrete_union
lemma compl_mem_codiscrete_iff {S : Set X} :
Sᶜ ∈ codiscrete X ↔ IsClosed S ∧ DiscreteTopology ↑S := by
rw [mem_codiscrete, compl_compl, isClosed_and_discrete_iff]
/-- The union of two discrete closed subsets is discrete. -/
theorem discreteTopology_union {S T : Set X} (hs : DiscreteTopology S) (ht : DiscreteTopology T)
(hs' : IsClosed S) (ht' : IsClosed T) : DiscreteTopology ↑(S ∪ T) := by
suffices (S ∪ T)ᶜ ∈ codiscrete X from compl_mem_codiscrete_iff.mp this |>.2
have hS : Sᶜ ∈ codiscrete X := by simpa [compl_mem_codiscrete_iff] using ⟨hs', hs⟩
have hT : Tᶜ ∈ codiscrete X := by simpa [compl_mem_codiscrete_iff] using ⟨ht', ht⟩
simpa using inter_mem hS hT
/-- The union of finitely many discrete closed subsets is discrete. -/
theorem discreteTopology_biUnion_finset {ι : Type*} {I : Finset ι} {s : ι → Set X}
(hs : ∀ i ∈ I, DiscreteTopology (s i)) (hs' : ∀ i ∈ I, IsClosed (s i)) :
DiscreteTopology (⋃ i ∈ I, s i) := by
suffices (⋃ i ∈ I, s i)ᶜ ∈ codiscrete X from (compl_mem_codiscrete_iff.mp this).2
simpa [biInter_finset_mem I] using fun i hi ↦ compl_mem_codiscrete_iff.mpr ⟨hs' i hi, hs i hi⟩
/-- The union of finitely many discrete closed subsets is discrete. -/
theorem discreteTopology_iUnion_fintype {ι : Type*} [Fintype ι] {s : ι → Set X}
(hs : ∀ i, DiscreteTopology (s i)) (hs' : ∀ i, IsClosed (s i)) :
DiscreteTopology (⋃ i, s i) := by
convert discreteTopology_biUnion_finset (I := .univ) (fun i _ ↦ hs i) (fun i _ ↦ hs' i) <;>
simp
end discrete_union |
.lake/packages/mathlib/Mathlib/Topology/Sequences.lean | import Mathlib.Topology.Defs.Sequences
import Mathlib.Topology.UniformSpace.Cauchy
/-!
# Sequences in topological spaces
In this file we prove theorems about relations
between closure/compactness/continuity etc. and their sequential counterparts.
## Main definitions
The following notions are defined in `Topology/Defs/Sequences`.
We build theory about these definitions here, so we remind the definitions.
### Set operation
* `seqClosure s`: sequential closure of a set, the set of limits of sequences of points of `s`;
### Predicates
* `IsSeqClosed s`: predicate saying that a set is sequentially closed, i.e., `seqClosure s ⊆ s`;
* `SeqContinuous f`: predicate saying that a function is sequentially continuous, i.e.,
for any sequence `u : ℕ → X` that converges to a point `x`, the sequence `f ∘ u` converges to
`f x`;
* `IsSeqCompact s`: predicate saying that a set is sequentially compact, i.e., every sequence
taking values in `s` has a converging subsequence.
### Type classes
* `FrechetUrysohnSpace X`: a typeclass saying that a topological space is a *Fréchet-Urysohn
space*, i.e., the sequential closure of any set is equal to its closure.
* `SequentialSpace X`: a typeclass saying that a topological space is a *sequential space*, i.e.,
any sequentially closed set in this space is closed. This condition is weaker than being a
Fréchet-Urysohn space.
* `SeqCompactSpace X`: a typeclass saying that a topological space is sequentially compact, i.e.,
every sequence in `X` has a converging subsequence.
## Main results
* `seqClosure_subset_closure`: closure of a set includes its sequential closure;
* `IsClosed.isSeqClosed`: a closed set is sequentially closed;
* `IsSeqClosed.seqClosure_eq`: sequential closure of a sequentially closed set `s` is equal
to `s`;
* `seqClosure_eq_closure`: in a Fréchet-Urysohn space, the sequential closure of a set is equal to
its closure;
* `tendsto_nhds_iff_seq_tendsto`, `FrechetUrysohnSpace.of_seq_tendsto_imp_tendsto`: a topological
space is a Fréchet-Urysohn space if and only if sequential convergence implies convergence;
* `FirstCountableTopology.frechetUrysohnSpace`: every topological space with
first countable topology is a Fréchet-Urysohn space;
* `FrechetUrysohnSpace.to_sequentialSpace`: every Fréchet-Urysohn space is a sequential space;
* `IsSeqCompact.isCompact`: a sequentially compact set in a uniform space with countably
generated uniformity is compact.
## Tags
sequentially closed, sequentially compact, sequential space
-/
open Bornology Filter Function Set TopologicalSpace Topology
open scoped Uniformity
variable {X Y : Type*}
/-! ### Sequential closures, sequential continuity, and sequential spaces. -/
section TopologicalSpace
variable [TopologicalSpace X] [TopologicalSpace Y]
theorem subset_seqClosure {s : Set X} : s ⊆ seqClosure s := fun p hp =>
⟨const ℕ p, fun _ => hp, tendsto_const_nhds⟩
/-- The sequential closure of a set is contained in the closure of that set.
The converse is not true. -/
theorem seqClosure_subset_closure {s : Set X} : seqClosure s ⊆ closure s := fun _p ⟨_x, xM, xp⟩ =>
mem_closure_of_tendsto xp (univ_mem' xM)
/-- The sequential closure of a sequentially closed set is the set itself. -/
theorem IsSeqClosed.seqClosure_eq {s : Set X} (hs : IsSeqClosed s) : seqClosure s = s :=
Subset.antisymm (fun _p ⟨_x, hx, hp⟩ => hs hx hp) subset_seqClosure
/-- If a set is equal to its sequential closure, then it is sequentially closed. -/
theorem isSeqClosed_of_seqClosure_eq {s : Set X} (hs : seqClosure s = s) : IsSeqClosed s :=
fun x _p hxs hxp => hs ▸ ⟨x, hxs, hxp⟩
/-- A set is sequentially closed iff it is equal to its sequential closure. -/
theorem isSeqClosed_iff {s : Set X} : IsSeqClosed s ↔ seqClosure s = s :=
⟨IsSeqClosed.seqClosure_eq, isSeqClosed_of_seqClosure_eq⟩
/-- A set is sequentially closed if it is closed. -/
protected theorem IsClosed.isSeqClosed {s : Set X} (hc : IsClosed s) : IsSeqClosed s :=
fun _u _x hu hx => hc.mem_of_tendsto hx (Eventually.of_forall hu)
theorem seqClosure_eq_closure [FrechetUrysohnSpace X] (s : Set X) : seqClosure s = closure s :=
seqClosure_subset_closure.antisymm <| FrechetUrysohnSpace.closure_subset_seqClosure s
/-- In a Fréchet-Urysohn space, a point belongs to the closure of a set iff it is a limit
of a sequence taking values in this set. -/
theorem mem_closure_iff_seq_limit [FrechetUrysohnSpace X] {s : Set X} {a : X} :
a ∈ closure s ↔ ∃ x : ℕ → X, (∀ n : ℕ, x n ∈ s) ∧ Tendsto x atTop (𝓝 a) := by
rw [← seqClosure_eq_closure]
rfl
/-- If the domain of a function `f : α → β` is a Fréchet-Urysohn space, then convergence
is equivalent to sequential convergence. See also `Filter.tendsto_iff_seq_tendsto` for a version
that works for any pair of filters assuming that the filter in the domain is countably generated.
This property is equivalent to the definition of `FrechetUrysohnSpace`, see
`FrechetUrysohnSpace.of_seq_tendsto_imp_tendsto`. -/
theorem tendsto_nhds_iff_seq_tendsto [FrechetUrysohnSpace X] {f : X → Y} {a : X} {b : Y} :
Tendsto f (𝓝 a) (𝓝 b) ↔ ∀ u : ℕ → X, Tendsto u atTop (𝓝 a) → Tendsto (f ∘ u) atTop (𝓝 b) := by
refine
⟨fun hf u hu => hf.comp hu, fun h =>
((nhds_basis_closeds _).tendsto_iff (nhds_basis_closeds _)).2 ?_⟩
rintro s ⟨hbs, hsc⟩
refine ⟨closure (f ⁻¹' s), ⟨mt ?_ hbs, isClosed_closure⟩, fun x => mt fun hx => subset_closure hx⟩
rw [← seqClosure_eq_closure]
rintro ⟨u, hus, hu⟩
exact hsc.mem_of_tendsto (h u hu) (Eventually.of_forall hus)
/-- An alternative construction for `FrechetUrysohnSpace`: if sequential convergence implies
convergence, then the space is a Fréchet-Urysohn space. -/
theorem FrechetUrysohnSpace.of_seq_tendsto_imp_tendsto
(h : ∀ (f : X → Prop) (a : X),
(∀ u : ℕ → X, Tendsto u atTop (𝓝 a) → Tendsto (f ∘ u) atTop (𝓝 (f a))) → ContinuousAt f a) :
FrechetUrysohnSpace X := by
refine ⟨fun s x hcx => ?_⟩
by_cases hx : x ∈ s
· exact subset_seqClosure hx
· obtain ⟨u, hux, hus⟩ : ∃ u : ℕ → X, Tendsto u atTop (𝓝 x) ∧ ∃ᶠ x in atTop, u x ∈ s := by
simpa only [ContinuousAt, hx, tendsto_nhds_true, (· ∘ ·), ← not_frequently, exists_prop,
← mem_closure_iff_frequently, hcx, imp_false, not_forall, not_not, not_false_eq_true,
not_true_eq_false] using h (· ∉ s) x
rcases extraction_of_frequently_atTop hus with ⟨φ, φ_mono, hφ⟩
exact ⟨u ∘ φ, hφ, hux.comp φ_mono.tendsto_atTop⟩
-- see Note [lower instance priority]
/-- Every first-countable space is a Fréchet-Urysohn space. -/
instance (priority := 100) FirstCountableTopology.frechetUrysohnSpace
[FirstCountableTopology X] : FrechetUrysohnSpace X :=
FrechetUrysohnSpace.of_seq_tendsto_imp_tendsto fun _ _ => tendsto_iff_seq_tendsto.2
-- see Note [lower instance priority]
/-- Every Fréchet-Urysohn space is a sequential space. -/
instance (priority := 100) FrechetUrysohnSpace.to_sequentialSpace [FrechetUrysohnSpace X] :
SequentialSpace X :=
⟨fun s hs => by rw [← closure_eq_iff_isClosed, ← seqClosure_eq_closure, hs.seqClosure_eq]⟩
theorem Topology.IsInducing.frechetUrysohnSpace [FrechetUrysohnSpace Y] {f : X → Y}
(hf : IsInducing f) : FrechetUrysohnSpace X := by
refine ⟨fun s x hx ↦ ?_⟩
rw [hf.closure_eq_preimage_closure_image, mem_preimage, mem_closure_iff_seq_limit] at hx
rcases hx with ⟨u, hus, hu⟩
choose v hv hvu using hus
refine ⟨v, hv, ?_⟩
simpa only [hf.tendsto_nhds_iff, Function.comp_def, hvu]
/-- Subtype of a Fréchet-Urysohn space is a Fréchet-Urysohn space. -/
instance Subtype.instFrechetUrysohnSpace [FrechetUrysohnSpace X] {p : X → Prop} :
FrechetUrysohnSpace (Subtype p) :=
IsInducing.subtypeVal.frechetUrysohnSpace
/-- In a sequential space, a set is closed iff it's sequentially closed. -/
theorem isSeqClosed_iff_isClosed [SequentialSpace X] {M : Set X} : IsSeqClosed M ↔ IsClosed M :=
⟨IsSeqClosed.isClosed, IsClosed.isSeqClosed⟩
/-- The preimage of a sequentially closed set under a sequentially continuous map is sequentially
closed. -/
theorem IsSeqClosed.preimage {f : X → Y} {s : Set Y} (hs : IsSeqClosed s) (hf : SeqContinuous f) :
IsSeqClosed (f ⁻¹' s) := fun _x _p hx hp => hs hx (hf hp)
-- A continuous function is sequentially continuous.
protected theorem Continuous.seqContinuous {f : X → Y} (hf : Continuous f) : SeqContinuous f :=
fun _x p hx => (hf.tendsto p).comp hx
/-- A sequentially continuous function defined on a sequential space is continuous. -/
protected theorem SeqContinuous.continuous [SequentialSpace X] {f : X → Y} (hf : SeqContinuous f) :
Continuous f :=
continuous_iff_isClosed.mpr fun _s hs => (hs.isSeqClosed.preimage hf).isClosed
/-- If the domain of a function is a sequential space, then continuity of this function is
equivalent to its sequential continuity. -/
theorem continuous_iff_seqContinuous [SequentialSpace X] {f : X → Y} :
Continuous f ↔ SeqContinuous f :=
⟨Continuous.seqContinuous, SeqContinuous.continuous⟩
theorem SequentialSpace.coinduced [SequentialSpace X] {Y} (f : X → Y) :
@SequentialSpace Y (.coinduced f ‹_›) :=
letI : TopologicalSpace Y := .coinduced f ‹_›
⟨fun _ hs ↦ isClosed_coinduced.2 (hs.preimage continuous_coinduced_rng.seqContinuous).isClosed⟩
protected theorem SequentialSpace.iSup {X} {ι : Sort*} {t : ι → TopologicalSpace X}
(h : ∀ i, @SequentialSpace X (t i)) : @SequentialSpace X (⨆ i, t i) := by
letI : TopologicalSpace X := ⨆ i, t i
refine ⟨fun s hs ↦ isClosed_iSup_iff.2 fun i ↦ ?_⟩
letI := t i
exact IsSeqClosed.isClosed fun u x hus hux ↦ hs hus <| hux.mono_right <| nhds_mono <| le_iSup _ _
protected theorem SequentialSpace.sup {X} {t₁ t₂ : TopologicalSpace X}
(h₁ : @SequentialSpace X t₁) (h₂ : @SequentialSpace X t₂) :
@SequentialSpace X (t₁ ⊔ t₂) := by
rw [sup_eq_iSup]
exact .iSup <| Bool.forall_bool.2 ⟨h₂, h₁⟩
lemma Topology.IsQuotientMap.sequentialSpace [SequentialSpace X] {f : X → Y}
(hf : IsQuotientMap f) : SequentialSpace Y := hf.2.symm ▸ .coinduced f
/-- The quotient of a sequential space is a sequential space. -/
instance Quotient.instSequentialSpace [SequentialSpace X] {s : Setoid X} :
SequentialSpace (Quotient s) :=
isQuotientMap_quot_mk.sequentialSpace
/-- The sum (disjoint union) of two sequential spaces is a sequential space. -/
instance Sum.instSequentialSpace [SequentialSpace X] [SequentialSpace Y] :
SequentialSpace (X ⊕ Y) :=
.sup (.coinduced Sum.inl) (.coinduced Sum.inr)
/-- The disjoint union of an indexed family of sequential spaces is a sequential space. -/
instance Sigma.instSequentialSpace {ι : Type*} {X : ι → Type*}
[∀ i, TopologicalSpace (X i)] [∀ i, SequentialSpace (X i)] : SequentialSpace (Σ i, X i) :=
.iSup fun _ ↦ .coinduced _
end TopologicalSpace
section SeqCompact
open TopologicalSpace FirstCountableTopology
variable [TopologicalSpace X]
theorem IsSeqCompact.subseq_of_frequently_in {s : Set X} (hs : IsSeqCompact s) {x : ℕ → X}
(hx : ∃ᶠ n in atTop, x n ∈ s) :
∃ a ∈ s, ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (𝓝 a) :=
let ⟨ψ, hψ, huψ⟩ := extraction_of_frequently_atTop hx
let ⟨a, a_in, φ, hφ, h⟩ := hs huψ
⟨a, a_in, ψ ∘ φ, hψ.comp hφ, h⟩
theorem SeqCompactSpace.tendsto_subseq [SeqCompactSpace X] (x : ℕ → X) :
∃ (a : X) (φ : ℕ → ℕ), StrictMono φ ∧ Tendsto (x ∘ φ) atTop (𝓝 a) :=
let ⟨a, _, φ, mono, h⟩ := isSeqCompact_univ fun n => mem_univ (x n)
⟨a, φ, mono, h⟩
section FirstCountableTopology
variable [FirstCountableTopology X]
open FirstCountableTopology
protected theorem IsCompact.isSeqCompact {s : Set X} (hs : IsCompact s) : IsSeqCompact s :=
fun _x x_in =>
let ⟨a, a_in, ha⟩ := hs (tendsto_principal.mpr (Eventually.of_forall x_in))
⟨a, a_in, tendsto_subseq ha⟩
theorem IsCompact.tendsto_subseq' {s : Set X} {x : ℕ → X} (hs : IsCompact s)
(hx : ∃ᶠ n in atTop, x n ∈ s) :
∃ a ∈ s, ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (𝓝 a) :=
hs.isSeqCompact.subseq_of_frequently_in hx
theorem IsCompact.tendsto_subseq {s : Set X} {x : ℕ → X} (hs : IsCompact s) (hx : ∀ n, x n ∈ s) :
∃ a ∈ s, ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (𝓝 a) :=
hs.isSeqCompact hx
-- see Note [lower instance priority]
instance (priority := 100) FirstCountableTopology.seq_compact_of_compact [CompactSpace X] :
SeqCompactSpace X :=
⟨isCompact_univ.isSeqCompact⟩
theorem CompactSpace.tendsto_subseq [CompactSpace X] (x : ℕ → X) :
∃ (a : _) (φ : ℕ → ℕ), StrictMono φ ∧ Tendsto (x ∘ φ) atTop (𝓝 a) :=
SeqCompactSpace.tendsto_subseq x
end FirstCountableTopology
section Image
variable [TopologicalSpace Y] {f : X → Y}
/-- Sequential compactness of sets is preserved under sequentially continuous functions. -/
theorem IsSeqCompact.image (f_cont : SeqContinuous f) {K : Set X} (K_cpt : IsSeqCompact K) :
IsSeqCompact (f '' K) := by
intro ys ys_in_fK
choose xs xs_in_K fxs_eq_ys using ys_in_fK
obtain ⟨a, a_in_K, phi, phi_mono, xs_phi_lim⟩ := K_cpt xs_in_K
refine ⟨f a, mem_image_of_mem f a_in_K, phi, phi_mono, ?_⟩
exact (f_cont xs_phi_lim).congr fun x ↦ fxs_eq_ys (phi x)
/-- The range of sequentially continuous function on a sequentially compact space is sequentially
compact. -/
theorem IsSeqCompact.range [SeqCompactSpace X] (f_cont : SeqContinuous f) :
IsSeqCompact (Set.range f) := by
simpa using isSeqCompact_univ.image f_cont
end Image
end SeqCompact
section UniformSpaceSeqCompact
open uniformity
open UniformSpace Prod
variable [UniformSpace X] {s : Set X}
theorem IsSeqCompact.exists_tendsto_of_frequently_mem (hs : IsSeqCompact s) {u : ℕ → X}
(hu : ∃ᶠ n in atTop, u n ∈ s) (huc : CauchySeq u) : ∃ x ∈ s, Tendsto u atTop (𝓝 x) :=
let ⟨x, hxs, _φ, φ_mono, hx⟩ := hs.subseq_of_frequently_in hu
⟨x, hxs, tendsto_nhds_of_cauchySeq_of_subseq huc φ_mono.tendsto_atTop hx⟩
theorem IsSeqCompact.exists_tendsto (hs : IsSeqCompact s) {u : ℕ → X} (hu : ∀ n, u n ∈ s)
(huc : CauchySeq u) : ∃ x ∈ s, Tendsto u atTop (𝓝 x) :=
hs.exists_tendsto_of_frequently_mem (Frequently.of_forall hu) huc
/-- A sequentially compact set in a uniform space is totally bounded. -/
protected theorem IsSeqCompact.totallyBounded (h : IsSeqCompact s) : TotallyBounded s := by
intro V V_in
unfold IsSeqCompact at h
contrapose! h
obtain ⟨u, u_in, hu⟩ : ∃ u : ℕ → X, (∀ n, u n ∈ s) ∧ ∀ n m, m < n → u m ∉ ball (u n) V := by
simp only [not_subset, mem_iUnion₂, not_exists, exists_prop] at h
simpa only [forall_and, forall_mem_image, not_and] using seq_of_forall_finite_exists h
refine ⟨u, u_in, fun x _ φ hφ huφ => ?_⟩
obtain ⟨N, hN⟩ : ∃ N, ∀ p q, p ≥ N → q ≥ N → (u (φ p), u (φ q)) ∈ V :=
huφ.cauchySeq.mem_entourage V_in
exact hu (φ <| N + 1) (φ N) (hφ <| Nat.lt_add_one N) (hN (N + 1) N N.le_succ le_rfl)
variable [IsCountablyGenerated (𝓤 X)]
/-- A sequentially compact set in a uniform space with countably generated uniformity filter
is complete. -/
protected theorem IsSeqCompact.isComplete (hs : IsSeqCompact s) : IsComplete s := fun l hl hls => by
have := hl.1
rcases exists_antitone_basis (𝓤 X) with ⟨V, hV⟩
choose W hW hWV using fun n => comp_mem_uniformity_sets (hV.mem n)
have hWV' : ∀ n, W n ⊆ V n := fun n ⟨x, y⟩ hx =>
@hWV n (x, y) ⟨x, refl_mem_uniformity <| hW _, hx⟩
obtain ⟨t, ht_anti, htl, htW, hts⟩ :
∃ t : ℕ → Set X, Antitone t ∧ (∀ n, t n ∈ l) ∧ (∀ n, t n ×ˢ t n ⊆ W n) ∧ ∀ n, t n ⊆ s := by
have : ∀ n, ∃ t ∈ l, t ×ˢ t ⊆ W n ∧ t ⊆ s := by
rw [le_principal_iff] at hls
have : ∀ n, W n ∩ s ×ˢ s ∈ l ×ˢ l := fun n => inter_mem (hl.2 (hW n)) (prod_mem_prod hls hls)
simpa only [l.basis_sets.prod_self.mem_iff, true_imp_iff, subset_inter_iff,
prod_self_subset_prod_self, and_assoc] using this
choose t htl htW hts using this
have : ∀ n : ℕ, ⋂ k ≤ n, t k ⊆ t n := fun n => by apply iInter₂_subset; rfl
exact ⟨fun n => ⋂ k ≤ n, t k, fun m n h =>
biInter_subset_biInter_left fun k (hk : k ≤ m) => hk.trans h, fun n =>
(biInter_mem (finite_le_nat n)).2 fun k _ => htl k, fun n =>
(prod_mono (this n) (this n)).trans (htW n), fun n => (this n).trans (hts n)⟩
choose u hu using fun n => Filter.nonempty_of_mem (htl n)
have huc : CauchySeq u := hV.toHasBasis.cauchySeq_iff.2 fun N _ =>
⟨N, fun m hm n hn => hWV' _ <| @htW N (_, _) ⟨ht_anti hm (hu _), ht_anti hn (hu _)⟩⟩
rcases hs.exists_tendsto (fun n => hts n (hu n)) huc with ⟨x, hxs, hx⟩
refine ⟨x, hxs, (nhds_basis_uniformity' hV.toHasBasis).ge_iff.2 fun N _ => ?_⟩
obtain ⟨n, hNn, hn⟩ : ∃ n, N ≤ n ∧ u n ∈ ball x (W N) :=
((eventually_ge_atTop N).and (hx <| ball_mem_nhds x (hW N))).exists
refine mem_of_superset (htl n) fun y hy => hWV N ⟨u n, hn, htW N ?_⟩
exact ⟨ht_anti hNn (hu n), ht_anti hNn hy⟩
/-- If `𝓤 β` is countably generated, then any sequentially compact set is compact. -/
protected theorem IsSeqCompact.isCompact (hs : IsSeqCompact s) : IsCompact s :=
isCompact_iff_totallyBounded_isComplete.2 ⟨hs.totallyBounded, hs.isComplete⟩
/-- A version of Bolzano-Weierstrass: in a uniform space with countably generated uniformity filter
(e.g., in a metric space), a set is compact if and only if it is sequentially compact. -/
protected theorem UniformSpace.isCompact_iff_isSeqCompact : IsCompact s ↔ IsSeqCompact s :=
⟨fun H => H.isSeqCompact, fun H => H.isCompact⟩
theorem UniformSpace.compactSpace_iff_seqCompactSpace : CompactSpace X ↔ SeqCompactSpace X := by
simp only [← isCompact_univ_iff, seqCompactSpace_iff, UniformSpace.isCompact_iff_isSeqCompact]
end UniformSpaceSeqCompact |
.lake/packages/mathlib/Mathlib/Topology/IsClosedRestrict.lean | import Mathlib.Topology.Maps.Proper.Basic
/-! # Restriction of a closed compact set in a product space to a set of coordinates
We show that the image of a compact closed set `s` in a product `Π i : ι, α i` by
the restriction to a subset of coordinates `S : Set ι` is a closed set.
The idea of the proof is to use `isClosedMap_snd_of_compactSpace`, which is the fact that if
`X` is a compact topological space, then `Prod.snd : X × Y → Y` is a closed map.
We remark that `s` is included in the set `Sᶜ.restrict ⁻¹' (Sᶜ.restrict '' s)`, and we build
a homeomorphism `Sᶜ.restrict ⁻¹' (Sᶜ.restrict '' s) ≃ₜ Sᶜ.restrict '' s × Π i : S, α i`.
`Sᶜ.restrict '' s` is a compact space since `s` is compact, and the lemma applies,
with `X = Sᶜ.restrict '' s` and `Y = Π i : S, α i`.
-/
open Set
variable {ι : Type*} {α : ι → Type*} {s : Set (Π i, α i)} {i : ι} {S : Set ι}
namespace Topology
open Classical in
/-- Given a set in a product space `s : Set (Π j, α j)` and a set of coordinates `S : Set ι`,
`Sᶜ.restrict '' s × (Π i : S, α i)` is the set of functions that coincide with an element of `s`
on `Sᶜ` and are arbitrary on `S`.
`reorderRestrictProd` sends a term of that type to `Π j, α j` by looking for the value at `j`
in one part of the product or the other depending on whether `j` is in `S` or not. -/
noncomputable def reorderRestrictProd (S : Set ι) (s : Set (Π j, α j))
(p : Sᶜ.restrict '' s × (Π i : S, α i)) :
Π j, α j :=
fun j ↦ if h : j ∈ S
then (p.2 : Π j : ↑(S : Set ι), α j) ⟨j, h⟩
else (p.1 : Π j : ↑(Sᶜ : Set ι), α j) ⟨j, h⟩
@[simp]
lemma reorderRestrictProd_of_mem (p : Sᶜ.restrict '' s × (Π i : S, α i)) (j : S) :
reorderRestrictProd S s p j = (p.2 : Π j : ↑(S : Set ι), α j) j := by
have hj : ↑j ∈ S := j.prop
simp [reorderRestrictProd, hj]
@[simp]
lemma reorderRestrictProd_of_compl (p : Sᶜ.restrict '' s × (Π i : S, α i)) (j : (Sᶜ : Set ι)) :
reorderRestrictProd S s p j = (p.1 : Π j : ↑(Sᶜ : Set ι), α j) j := by
have hj : ↑j ∉ S := j.prop
simp [reorderRestrictProd, hj]
@[simp]
lemma restrict_compl_reorderRestrictProd (p : Sᶜ.restrict '' s × (Π i : S, α i)) :
Sᶜ.restrict (reorderRestrictProd S s p) = p.1 := by ext; simp
lemma continuous_reorderRestrictProd [∀ i, TopologicalSpace (α i)] :
Continuous (reorderRestrictProd S s) := by
refine continuous_pi fun j ↦ ?_
simp only [reorderRestrictProd]
split_ifs with h
· fun_prop
· exact ((continuous_apply _).comp continuous_subtype_val).comp continuous_fst
lemma reorderRestrictProd_mem_preimage_image_restrict (p : Sᶜ.restrict '' s × (Π i : S, α i)) :
reorderRestrictProd S s p ∈ Sᶜ.restrict ⁻¹' (Sᶜ.restrict '' s) := by
obtain ⟨y, hy_mem_s, hy_eq⟩ := p.1.2
exact ⟨y, hy_mem_s, hy_eq.trans (restrict_compl_reorderRestrictProd p).symm⟩
@[simp]
lemma reorderRestrictProd_restrict_compl (x : Sᶜ.restrict ⁻¹' (Sᶜ.restrict '' s)) :
reorderRestrictProd S s ⟨⟨Sᶜ.restrict x, x.2⟩, fun i ↦ (x : Π j, α j) i⟩ = (x : Π j, α j) := by
ext; simp [reorderRestrictProd]
/-- Homeomorphism between the set of functions that coincide with a given set of functions away
from a given set `S`, and dependent functions away from `S` times any value on `S`. -/
noncomputable
def _root_.Homeomorph.preimageImageRestrict (α : ι → Type*) [∀ i, TopologicalSpace (α i)]
(S : Set ι) (s : Set (Π j, α j)) :
Sᶜ.restrict ⁻¹' (Sᶜ.restrict '' s) ≃ₜ Sᶜ.restrict '' s × (Π i : S, α i) where
toFun x := ⟨⟨Sᶜ.restrict x, x.2⟩, fun i ↦ (x : Π j, α j) i⟩
invFun p := ⟨reorderRestrictProd S s p, reorderRestrictProd_mem_preimage_image_restrict p⟩
left_inv x := by ext; simp
right_inv p := by ext <;> simp
continuous_toFun := by
refine Continuous.prodMk ?_ ?_
· exact ((Pi.continuous_restrict _).comp continuous_subtype_val).subtype_mk _
· rw [continuous_pi_iff]
exact fun _ ↦ (continuous_apply _).comp continuous_subtype_val
continuous_invFun := continuous_reorderRestrictProd.subtype_mk _
/-- The image by `preimageImageRestrict α S s` of `s` seen as a set of
`Sᶜ.restrict ⁻¹' (Sᶜ.restrict '' s)` is a set of `Sᶜ.restrict '' s × (Π i : S, α i)`, and the
image of that set by `Prod.snd` is `S.restrict '' s`.
Used in `IsCompact.isClosed_image_restrict` to prove that the restriction of a compact closed set
in a product space to a set of coordinates is closed. -/
lemma image_snd_preimageImageRestrict [∀ i, TopologicalSpace (α i)] :
Prod.snd '' (Homeomorph.preimageImageRestrict α S s ''
((fun (x : Sᶜ.restrict ⁻¹' (Sᶜ.restrict '' s)) ↦ (x : Π j, α j)) ⁻¹' s))
= S.restrict '' s := by
ext x
simp only [Homeomorph.preimageImageRestrict, Homeomorph.homeomorph_mk_coe, Equiv.coe_fn_mk,
mem_image, mem_preimage, Subtype.exists, exists_and_left, Prod.exists, Prod.mk.injEq,
exists_and_right, exists_eq_right, Subtype.mk.injEq, exists_prop]
constructor
· rintro ⟨y, _, z, hz_mem, _, hzx⟩
exact ⟨z, hz_mem, hzx⟩
· rintro ⟨z, hz_mem, hzx⟩
exact ⟨Sᶜ.restrict z, mem_image_of_mem Sᶜ.restrict hz_mem, z, hz_mem,
⟨⟨⟨z, hz_mem, rfl⟩, rfl⟩, hzx⟩⟩
end Topology
section IsClosed
variable [∀ i, TopologicalSpace (α i)]
/-- The restriction of a compact closed set in a product space to a set of coordinates is closed. -/
theorem IsCompact.isClosed_image_restrict (S : Set ι)
(hs_compact : IsCompact s) (hs_closed : IsClosed s) :
IsClosed (S.restrict '' s) := by
rw [← Topology.image_snd_preimageImageRestrict]
have : CompactSpace (Sᶜ.restrict '' s) :=
isCompact_iff_compactSpace.mp (hs_compact.image (Pi.continuous_restrict _))
refine isClosedMap_snd_of_compactSpace _ ?_
rw [Homeomorph.isClosed_image]
exact hs_closed.preimage continuous_subtype_val
lemma isClosedMap_restrict_of_compactSpace [∀ i, CompactSpace (α i)] :
IsClosedMap (S.restrict : (Π i, α i) → _) := fun s hs ↦ by
classical
have : S.restrict (π := α) = Prod.fst ∘ (Homeomorph.piEquivPiSubtypeProd S α) := rfl
rw [this, image_comp]
exact isClosedMap_fst_of_compactSpace _ <| (Homeomorph.isClosed_image _).mpr hs
lemma IsClosed.isClosed_image_eval (i : ι)
(hs_compact : IsCompact s) (hs_closed : IsClosed s) :
IsClosed ((fun x ↦ x i) '' s) := by
suffices IsClosed (Set.restrict {i} '' s) by
have : Homeomorph.piUnique _ ∘ Set.restrict {i} = fun (x : Π j, α j) ↦ x i := rfl
rwa [← this, image_comp, Homeomorph.isClosed_image (Homeomorph.piUnique _)]
exact hs_compact.isClosed_image_restrict {i} hs_closed
end IsClosed |
.lake/packages/mathlib/Mathlib/Topology/Constructible.lean | import Mathlib.Order.BooleanSubalgebra
import Mathlib.Topology.Compactness.Bases
import Mathlib.Topology.LocalAtTarget
import Mathlib.Topology.QuasiSeparated
import Mathlib.Topology.Spectral.Hom
import Mathlib.Topology.Spectral.Prespectral
/-!
# Constructible sets
This file defines constructible sets, which are morally sets in a topological space which we can
make out of finite unions and intersections of open and closed sets.
Precisely, constructible sets are the Boolean subalgebra generated by open retrocompact sets,
where a set is retrocompact if its intersection with every compact open set is compact.
In a locally Noetherian space, all sets are retrocompact, in which case this Boolean subalgebra is
simply the one generated by the open sets.
Constructible sets are useful because the image of a constructible set under a finitely presented
morphism of schemes is a constructible set (and this is *not* true at the level of varieties).
## Main declarations
* `IsRetrocompact`: Predicate for a set to be retrocompact, namely to have its intersection with
every compact open be compact.
* `IsConstructible`: Predicate for a set to be constructible, namely to belong to the Boolean
subalgebra generated by open retrocompact sets.
* `IsLocallyConstructible`: Predicate for a set to be locally constructible, namely to be
partitionable along an open cover such that each of its parts is constructible in the
respective open subspace.
-/
open Set TopologicalSpace Topology
open scoped Set.Notation
variable {ι : Sort*} {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : X → Y}
{s t U : Set X} {a : X}
/-! ### retrocompact sets -/
/-- A retrocompact set is a set whose intersection with every compact open is compact. -/
@[stacks 005A]
def IsRetrocompact (s : Set X) : Prop := ∀ ⦃U⦄, IsCompact U → IsOpen U → IsCompact (s ∩ U)
@[simp] lemma IsRetrocompact.empty : IsRetrocompact (∅ : Set X) := by simp [IsRetrocompact]
@[simp] lemma IsRetrocompact.univ : IsRetrocompact (univ : Set X) := by
simp +contextual [IsRetrocompact]
@[simp] lemma IsRetrocompact.singleton : IsRetrocompact {a} :=
fun _ _ _ ↦ Subsingleton.singleton_inter.isCompact
lemma IsRetrocompact.union (hs : IsRetrocompact s) (ht : IsRetrocompact t) :
IsRetrocompact (s ∪ t : Set X) :=
fun _U hUcomp hUopen ↦ union_inter_distrib_right .. ▸ (hs hUcomp hUopen).union (ht hUcomp hUopen)
private lemma supClosed_isRetrocompact : SupClosed {s : Set X | IsRetrocompact s} :=
fun _s hs _t ht ↦ hs.union ht
lemma IsRetrocompact.finsetSup {ι : Type*} {s : Finset ι} {t : ι → Set X}
(ht : ∀ i ∈ s, IsRetrocompact (t i)) : IsRetrocompact (s.sup t) := by
induction s using Finset.cons_induction with
| empty => simp
| cons i s ih hi =>
rw [Finset.sup_cons]
exact (ht _ <| by simp).union <| hi <| Finset.forall_of_forall_cons ht
set_option linter.docPrime false in
lemma IsRetrocompact.finsetSup' {ι : Type*} {s : Finset ι} {hs} {t : ι → Set X}
(ht : ∀ i ∈ s, IsRetrocompact (t i)) : IsRetrocompact (s.sup' hs t) := by
rw [Finset.sup'_eq_sup]; exact .finsetSup ht
lemma IsRetrocompact.iUnion [Finite ι] {f : ι → Set X} (hf : ∀ i, IsRetrocompact (f i)) :
IsRetrocompact (⋃ i, f i) := supClosed_isRetrocompact.iSup_mem .empty hf
lemma IsRetrocompact.sUnion {S : Set (Set X)} (hS : S.Finite) (hS' : ∀ s ∈ S, IsRetrocompact s) :
IsRetrocompact (⋃₀ S) := supClosed_isRetrocompact.sSup_mem hS .empty hS'
lemma IsRetrocompact.biUnion {ι : Type*} {f : ι → Set X} {t : Set ι} (ht : t.Finite)
(hf : ∀ i ∈ t, IsRetrocompact (f i)) : IsRetrocompact (⋃ i ∈ t, f i) :=
supClosed_isRetrocompact.biSup_mem ht .empty hf
section T2Space
variable [T2Space X]
lemma IsRetrocompact.inter (hs : IsRetrocompact s) (ht : IsRetrocompact t) :
IsRetrocompact (s ∩ t : Set X) :=
fun _U hUcomp hUopen ↦ inter_inter_distrib_right .. ▸ (hs hUcomp hUopen).inter (ht hUcomp hUopen)
private lemma infClosed_isRetrocompact : InfClosed {s : Set X | IsRetrocompact s} :=
fun _s hs _t ht ↦ hs.inter ht
lemma IsRetrocompact.finsetInf {ι : Type*} {s : Finset ι} {t : ι → Set X}
(ht : ∀ i ∈ s, IsRetrocompact (t i)) : IsRetrocompact (s.inf t) := by
induction s using Finset.cons_induction with
| empty => simp
| cons i s ih hi =>
rw [Finset.inf_cons]
exact (ht _ <| by simp).inter <| hi <| Finset.forall_of_forall_cons ht
set_option linter.docPrime false in
lemma IsRetrocompact.finsetInf' {ι : Type*} {s : Finset ι} {hs} {t : ι → Set X}
(ht : ∀ i ∈ s, IsRetrocompact (t i)) : IsRetrocompact (s.inf' hs t) := by
rw [Finset.inf'_eq_inf]; exact .finsetInf ht
lemma IsRetrocompact.iInter [Finite ι] {f : ι → Set X} (hf : ∀ i, IsRetrocompact (f i)) :
IsRetrocompact (⋂ i, f i) := infClosed_isRetrocompact.iInf_mem .univ hf
lemma IsRetrocompact.sInter {S : Set (Set X)} (hS : S.Finite) (hS' : ∀ s ∈ S, IsRetrocompact s) :
IsRetrocompact (⋂₀ S) := infClosed_isRetrocompact.sInf_mem hS .univ hS'
lemma IsRetrocompact.biInter {ι : Type*} {f : ι → Set X} {t : Set ι} (ht : t.Finite)
(hf : ∀ i ∈ t, IsRetrocompact (f i)) : IsRetrocompact (⋂ i ∈ t, f i) :=
infClosed_isRetrocompact.biInf_mem ht .univ hf
end T2Space
lemma IsRetrocompact.inter_isOpen (hs : IsRetrocompact s) (ht : IsRetrocompact t)
(htopen : IsOpen t) : IsRetrocompact (s ∩ t : Set X) :=
fun _U hUcomp hUopen ↦ inter_assoc .. ▸ hs (ht hUcomp hUopen) (htopen.inter hUopen)
lemma IsRetrocompact.isOpen_inter (hs : IsRetrocompact s) (ht : IsRetrocompact t)
(hsopen : IsOpen s) : IsRetrocompact (s ∩ t : Set X) :=
inter_comm .. ▸ ht.inter_isOpen hs hsopen
lemma IsRetrocompact_iff_isSpectralMap_subtypeVal :
IsRetrocompact s ↔ IsSpectralMap (Subtype.val : s → X) := by
refine ⟨fun hs ↦ ⟨continuous_subtype_val, fun t htopen htcomp ↦ ?_⟩, fun hs t htcomp htopen ↦ ?_⟩
· rw [IsEmbedding.subtypeVal.isCompact_iff, image_preimage_eq_inter_range,
Subtype.range_coe_subtype, setOf_mem_eq, inter_comm]
exact hs htcomp htopen
· simpa using (hs.isCompact_preimage_of_isOpen htopen htcomp).image continuous_subtype_val
@[stacks 005B]
lemma IsRetrocompact.image_of_isEmbedding (hs : IsRetrocompact s) (hfemb : IsEmbedding f)
(hfcomp : IsRetrocompact (range f)) : IsRetrocompact (f '' s) := by
rintro U hUcomp hUopen
rw [← image_inter_preimage, ← hfemb.isCompact_iff]
refine hs ?_ <| hUopen.preimage hfemb.continuous
rw [hfemb.isCompact_iff, image_preimage_eq_inter_range, inter_comm]
exact hfcomp hUcomp hUopen
@[stacks 005J "Extracted from the proof"]
lemma IsRetrocompact.preimage_of_isOpenEmbedding {s : Set Y} (hf : IsOpenEmbedding f)
(hs : IsRetrocompact s) : IsRetrocompact (f ⁻¹' s) := by
rintro U hUcomp hUopen
rw [hf.isCompact_iff, image_preimage_inter]
exact hs (hUcomp.image hf.continuous) <| hf.isOpenMap _ hUopen
@[stacks 09YE "Extracted from the proof"]
lemma IsRetrocompact.preimage_of_isClosedEmbedding {s : Set Y} (hf : IsClosedEmbedding f)
(hf' : IsCompact (range f)ᶜ) (hs : IsRetrocompact s) : IsRetrocompact (f ⁻¹' s) := by
rintro U hUcomp hUopen
have hfUopen : IsOpen (f '' U ∪ (range f)ᶜ) := by
simpa [← range_diff_image hf.injective, sdiff_eq, compl_inter, union_comm]
using (hf.isClosedMap _ hUopen.isClosed_compl).isOpen_compl
have hfUcomp : IsCompact (f '' U ∪ (range f)ᶜ) := (hUcomp.image hf.continuous).union hf'
simpa [inter_union_distrib_left, inter_left_comm, inter_eq_right.2 (image_subset_range ..),
hf.isCompact_iff, image_preimage_inter] using (hs hfUcomp hfUopen).inter_left hf.isClosed_range
/-! ### Constructible sets -/
namespace Topology
/-- A constructible set is a set that can be written as the
finite union/finite intersection/complement of open retrocompact sets.
In other words, constructible sets form the Boolean subalgebra generated by open retrocompact sets.
-/
def IsConstructible (s : Set X) : Prop :=
s ∈ BooleanSubalgebra.closure {U | IsOpen U ∧ IsRetrocompact U}
@[simp]
protected lemma IsConstructible.empty : IsConstructible (∅ : Set X) := BooleanSubalgebra.bot_mem
@[simp]
protected lemma IsConstructible.univ : IsConstructible (univ : Set X) := BooleanSubalgebra.top_mem
lemma IsConstructible.union : IsConstructible s → IsConstructible t → IsConstructible (s ∪ t) :=
BooleanSubalgebra.sup_mem
lemma IsConstructible.inter : IsConstructible s → IsConstructible t → IsConstructible (s ∩ t) :=
BooleanSubalgebra.inf_mem
lemma IsConstructible.sdiff : IsConstructible s → IsConstructible t → IsConstructible (s \ t) :=
BooleanSubalgebra.sdiff_mem
lemma IsConstructible.himp : IsConstructible s → IsConstructible t → IsConstructible (s ⇨ t) :=
BooleanSubalgebra.himp_mem
@[simp] lemma isConstructible_compl : IsConstructible sᶜ ↔ IsConstructible s :=
BooleanSubalgebra.compl_mem_iff
alias ⟨IsConstructible.of_compl, IsConstructible.compl⟩ := isConstructible_compl
lemma IsConstructible.iUnion [Finite ι] {f : ι → Set X} (hf : ∀ i, IsConstructible (f i)) :
IsConstructible (⋃ i, f i) := BooleanSubalgebra.iSup_mem hf
lemma IsConstructible.iInter [Finite ι] {f : ι → Set X} (hf : ∀ i, IsConstructible (f i)) :
IsConstructible (⋂ i, f i) := BooleanSubalgebra.iInf_mem hf
lemma IsConstructible.sUnion {S : Set (Set X)} (hS : S.Finite) (hS' : ∀ s ∈ S, IsConstructible s) :
IsConstructible (⋃₀ S) := BooleanSubalgebra.sSup_mem hS hS'
lemma IsConstructible.sInter {S : Set (Set X)} (hS : S.Finite) (hS' : ∀ s ∈ S, IsConstructible s) :
IsConstructible (⋂₀ S) := BooleanSubalgebra.sInf_mem hS hS'
lemma IsConstructible.biUnion {ι : Type*} {f : ι → Set X} {t : Set ι} (ht : t.Finite)
(hf : ∀ i ∈ t, IsConstructible (f i)) : IsConstructible (⋃ i ∈ t, f i) :=
BooleanSubalgebra.biSup_mem ht hf
lemma IsConstructible.biInter {ι : Type*} {f : ι → Set X} {t : Set ι} (ht : t.Finite)
(hf : ∀ i ∈ t, IsConstructible (f i)) : IsConstructible (⋂ i ∈ t, f i) :=
BooleanSubalgebra.biInf_mem ht hf
lemma _root_.IsRetrocompact.isConstructible (hUopen : IsOpen U) (hUcomp : IsRetrocompact U) :
IsConstructible U := BooleanSubalgebra.subset_closure ⟨hUopen, hUcomp⟩
/-- An induction principle for constructible sets. If `p` holds for all open retrocompact
sets, and is preserved under union and complement, then `p` holds for all constructible sets. -/
@[elab_as_elim]
lemma IsConstructible.empty_union_induction {p : ∀ s : Set X, IsConstructible s → Prop}
(open_retrocompact : ∀ U (hUopen : IsOpen U) (hUcomp : IsRetrocompact U),
p U (BooleanSubalgebra.subset_closure ⟨hUopen, hUcomp⟩))
(union : ∀ s hs t ht, p s hs → p t ht → p (s ∪ t) (hs.union ht))
(compl : ∀ s hs, p s hs → p sᶜ hs.compl) {s} (hs : IsConstructible s) : p s hs := by
induction hs using BooleanSubalgebra.closure_bot_sup_induction with
| mem U hU => exact open_retrocompact _ hU.1 hU.2
| bot => exact open_retrocompact _ isOpen_empty .empty
| sup s hs t ht hs' ht' => exact union _ _ _ _ hs' ht'
| compl s hs hs' => exact compl _ _ hs'
/-- If `f` is continuous and is such that preimages of open retrocompact sets are retrocompact,
then preimages of constructible sets are constructible. -/
@[stacks 005I]
lemma IsConstructible.preimage {s : Set Y} (hfcont : Continuous f)
(hf : ∀ s, IsOpen s → IsRetrocompact s → IsRetrocompact (f ⁻¹' s)) (hs : IsConstructible s) :
IsConstructible (f ⁻¹' s) := by
induction hs using IsConstructible.empty_union_induction with
| open_retrocompact U hUopen hUcomp =>
exact (hf _ hUopen hUcomp).isConstructible <| hUopen.preimage hfcont
| union s hs t ht hs' ht' => rw [preimage_union]; exact hs'.union ht'
| compl s hs hs' => rw [preimage_compl]; exact hs'.compl
@[stacks 005J]
lemma IsConstructible.preimage_of_isOpenEmbedding {s : Set Y} (hf : IsOpenEmbedding f)
(hs : IsConstructible s) : IsConstructible (f ⁻¹' s) :=
hs.preimage hf.continuous fun _t _ ht ↦ ht.preimage_of_isOpenEmbedding hf
@[stacks 09YE]
lemma IsConstructible.preimage_of_isClosedEmbedding {s : Set Y} (hf : IsClosedEmbedding f)
(hf' : IsCompact (range f)ᶜ) (hs : IsConstructible s) : IsConstructible (f ⁻¹' s) :=
hs.preimage hf.continuous fun _t _ ht ↦ ht.preimage_of_isClosedEmbedding hf hf'
@[stacks 09YD]
lemma IsConstructible.image_of_isOpenEmbedding (hfopen : IsOpenEmbedding f)
(hfcomp : IsRetrocompact (range f)) (hs : IsConstructible s) : IsConstructible (f '' s) := by
induction hs using IsConstructible.empty_union_induction with
| open_retrocompact U hUopen hUcomp =>
exact (hUcomp.image_of_isEmbedding hfopen.isEmbedding hfcomp).isConstructible <|
hfopen.isOpenMap _ hUopen
| union s hs t ht hs' ht' => rw [image_union]; exact hs'.union ht'
| compl s hs hs' =>
rw [← range_diff_image hfopen.injective]
exact (hfcomp.isConstructible hfopen.isOpen_range).sdiff hs'
@[stacks 09YG]
lemma IsConstructible.image_of_isClosedEmbedding (hf : IsClosedEmbedding f)
(hfcomp : IsRetrocompact (range f)ᶜ) (hs : IsConstructible s) : IsConstructible (f '' s) := by
induction hs using IsConstructible.empty_union_induction with
| open_retrocompact U hUopen hUcomp =>
have hfU : IsOpen (f '' U ∪ (range f)ᶜ) := by
simpa [← range_diff_image hf.injective, sdiff_eq, compl_inter, union_comm]
using (hf.isClosedMap _ hUopen.isClosed_compl).isOpen_compl
suffices h : IsRetrocompact (f '' U ∪ (range f)ᶜ) by
simpa [union_inter_distrib_right, inter_eq_left.2 (image_subset_range ..)]
using (h.isConstructible hfU).sdiff (hfcomp.isConstructible hf.isClosed_range.isOpen_compl)
rintro V hVcomp hVopen
rw [union_inter_distrib_right, ← image_inter_preimage]
exact ((hUcomp (hf.isCompact_preimage hVcomp) (hVopen.preimage hf.continuous)).image
hf.continuous).union <| hfcomp hVcomp hVopen
| union s hs t ht hs' ht' => rw [image_union]; exact hs'.union ht'
| compl s hs hs' =>
rw [← range_diff_image hf.injective]
exact (hfcomp.isConstructible hf.isClosed_range.isOpen_compl).of_compl.sdiff hs'
lemma isConstructible_preimage_iff_of_isOpenEmbedding {s : Set Y} (hf : IsOpenEmbedding f)
(hfcomp : IsRetrocompact (range f)) (hsf : s ⊆ range f) :
IsConstructible (f ⁻¹' s) ↔ IsConstructible s where
mp hs := by simpa [image_preimage_eq_range_inter, inter_eq_right.2 hsf]
using hs.image_of_isOpenEmbedding hf hfcomp
mpr := .preimage_of_isOpenEmbedding hf
lemma _root_.QuasiSeparatedSpace.of_isOpenCover {ι : Type*} {U : ι → Opens X} (hU : IsOpenCover U)
(h₁ : ∀ i, IsRetrocompact (X := X) (U i)) (h₂ : ∀ i, IsQuasiSeparated (α := X) (U i)) :
QuasiSeparatedSpace X where
inter_isCompact V₁ V₂ ho₁ hc₁ ho₂ hc₂ := by
obtain ⟨t, ht⟩ := hc₁.elim_finite_subcover _ (fun i ↦ (U i).2) (by simp [hU.iSup_set_eq_univ])
convert t.isCompact_biUnion fun i _ ↦ h₂ i _ _ Set.inter_subset_left ((U i).2.inter ho₁)
(h₁ i hc₁ ho₁) Set.inter_subset_left ((U i).2.inter ho₂) (h₁ i hc₂ ho₂)
apply subset_antisymm
· rintro x ⟨hx₁, hx₂⟩
obtain ⟨i, hi, hxi⟩ := Set.mem_iUnion₂.mp (ht hx₁)
exact Set.mem_iUnion₂.mpr ⟨i, hi, by simpa [*]⟩
· aesop (add simp Set.subset_def)
section CompactSpace
variable [CompactSpace X] {P : ∀ s : Set X, IsConstructible s → Prop} {B : Set (Set X)}
{b : ι → Set X}
lemma _root_.IsRetrocompact.isCompact (hs : IsRetrocompact s) : IsCompact s := by
simpa using hs CompactSpace.isCompact_univ
variable [QuasiSeparatedSpace X]
omit [CompactSpace X] in
lemma _root_.IsCompact.isRetrocompact (hU' : IsCompact U) (hU : IsOpen U) : IsRetrocompact U :=
fun _ hV' hV ↦ hU'.inter_of_isOpen hV' hU hV
omit [CompactSpace X] in
lemma _root_.IsCompact.isConstructible (hU' : IsCompact U) (hU : IsOpen U) : IsConstructible U :=
(hU'.isRetrocompact hU).isConstructible hU
@[stacks 0069 "Iff form of (2). Note that Stacks doesn't define quasi-separated spaces."]
lemma _root_.QuasiSeparatedSpace.isRetrocompact_iff_isCompact
(hU : IsOpen U) : IsRetrocompact U ↔ IsCompact U :=
⟨IsRetrocompact.isCompact, (IsCompact.isRetrocompact · hU)⟩
@[elab_as_elim]
lemma IsConstructible.induction_of_isTopologicalBasis {ι : Type*} [Nonempty ι] (b : ι → Set X)
(basis : IsTopologicalBasis (range b)) (isCompact_basis : ∀ i, IsCompact (b i))
(sdiff : ∀ i s (hs : Set.Finite s), P (b i \ ⋃ j ∈ s, b j)
(((isCompact_basis _).isConstructible (basis.isOpen ⟨i, rfl⟩)).sdiff <| .biUnion hs fun _ _ ↦
((isCompact_basis _).isConstructible (basis.isOpen ⟨_, rfl⟩))))
(union : ∀ s hs t ht, P s hs → P t ht → P (s ∪ t) (hs.union ht))
(s : Set X) (hs : IsConstructible s) : P s hs := by
induction s, hs using BooleanSubalgebra.closure_sdiff_sup_induction with
| isSublattice =>
exact ⟨fun s hs t ht ↦ ⟨hs.1.union ht.1, hs.2.union ht.2⟩,
fun s hs t ht ↦ ⟨hs.1.inter ht.1, hs.2.inter_isOpen ht.2 ht.1⟩⟩
| bot_mem => exact ⟨isOpen_empty, .empty⟩
| top_mem => exact ⟨isOpen_univ, .univ⟩
| sdiff U hU V hV =>
have := isCompact_open_iff_eq_finite_iUnion_of_isTopologicalBasis _ basis isCompact_basis
obtain ⟨s, hs, rfl⟩ := (this _).1 ⟨hU.2.isCompact, hU.1⟩
obtain ⟨t, ht, rfl⟩ := (this _).1 ⟨hV.2.isCompact, hV.1⟩
simp_rw [iUnion_diff]
induction s, hs using Set.Finite.induction_on with
| empty => simpa using sdiff (Classical.arbitrary _) {Classical.arbitrary _}
| @insert i s hi hs ih =>
simp_rw [biUnion_insert]
exact union _ _ _
(.biUnion hs fun i _ ↦ ((isCompact_basis _).isConstructible (basis.isOpen ⟨i, rfl⟩)).sdiff
<| .biUnion ht fun j _ ↦ (isCompact_basis _).isConstructible (basis.isOpen ⟨_, rfl⟩))
(sdiff _ _ ht)
(ih ⟨isOpen_biUnion fun _ _ ↦ basis.isOpen ⟨_, rfl⟩, .biUnion hs
fun i _ ↦ (isCompact_basis _).isRetrocompact (basis.isOpen ⟨i, rfl⟩)⟩)
| sup s _ t _ hs' ht' => exact union _ _ _ _ hs' ht'
end CompactSpace
/-! ### Locally constructible sets -/
/-- A set in a topological space is locally constructible, if every point has a neighborhood on
which the set is constructible. -/
@[stacks 005G]
def IsLocallyConstructible (s : Set X) : Prop := ∀ x, ∃ U ∈ 𝓝 x, IsOpen U ∧ IsConstructible (U ↓∩ s)
lemma IsConstructible.isLocallyConstructible (hs : IsConstructible s) : IsLocallyConstructible s :=
fun _ ↦ ⟨univ, by simp, by simp,
(isConstructible_preimage_iff_of_isOpenEmbedding isOpen_univ.isOpenEmbedding_subtypeVal
(by simp) (by simp)).2 hs⟩
lemma _root_.IsRetrocompact.isLocallyConstructible (hUopen : IsOpen U) (hUcomp : IsRetrocompact U) :
IsLocallyConstructible U := (hUcomp.isConstructible hUopen).isLocallyConstructible
@[simp] protected lemma IsLocallyConstructible.empty : IsLocallyConstructible (∅ : Set X) :=
IsConstructible.empty.isLocallyConstructible
@[simp] protected lemma IsLocallyConstructible.univ : IsLocallyConstructible (univ : Set X) :=
IsConstructible.univ.isLocallyConstructible
lemma IsLocallyConstructible.inter (hs : IsLocallyConstructible s) (ht : IsLocallyConstructible t) :
IsLocallyConstructible (s ∩ t) := by
rintro x
obtain ⟨U, hxU, hU, hsU⟩ := hs x
obtain ⟨V, hxV, hV, htV⟩ := ht x
refine ⟨U ∩ V, Filter.inter_mem hxU hxV, hU.inter hV, ?_⟩
change IsConstructible
(inclusion inter_subset_left ⁻¹' (U ↓∩ s) ∩ inclusion inter_subset_right ⁻¹' (V ↓∩ t))
exact .inter (hsU.preimage_of_isOpenEmbedding <| .inclusion _ <|
.preimage continuous_subtype_val <| hU.inter hV)
(htV.preimage_of_isOpenEmbedding <| .inclusion _ <|
.preimage continuous_subtype_val <| hU.inter hV )
lemma IsLocallyConstructible.finsetInf {ι : Type*} {s : Finset ι} {t : ι → Set X}
(ht : ∀ i ∈ s, IsLocallyConstructible (t i)) : IsLocallyConstructible (s.inf t) := by
induction s using Finset.cons_induction with
| empty => simp
| cons i s ih hi =>
rw [Finset.inf_cons]
exact (ht _ <| by simp).inter <| hi <| Finset.forall_of_forall_cons ht
set_option linter.docPrime false in
lemma IsLocallyConstructible.finsetInf' {ι : Type*} {s : Finset ι} {hs} {t : ι → Set X}
(ht : ∀ i ∈ s, IsLocallyConstructible (t i)) : IsLocallyConstructible (s.inf' hs t) := by
rw [Finset.inf'_eq_inf]; exact .finsetInf ht
private lemma infClosed_isLocallyConstructible : InfClosed {s : Set X | IsLocallyConstructible s} :=
fun _s hs _t ht ↦ hs.inter ht
lemma IsLocallyConstructible.iInter [Finite ι] {f : ι → Set X}
(hf : ∀ i, IsLocallyConstructible (f i)) : IsLocallyConstructible (⋂ i, f i) :=
infClosed_isLocallyConstructible.iInf_mem .univ hf
lemma IsLocallyConstructible.sInter {S : Set (Set X)} (hS : S.Finite)
(hS' : ∀ s ∈ S, IsLocallyConstructible s) : IsLocallyConstructible (⋂₀ S) :=
infClosed_isLocallyConstructible.sInf_mem hS .univ hS'
lemma IsLocallyConstructible.union (hs : IsLocallyConstructible s) (ht : IsLocallyConstructible t) :
IsLocallyConstructible (s ∪ t) := by
rintro x
obtain ⟨U, hxU, hU, hsU⟩ := hs x
obtain ⟨V, hxV, hV, htV⟩ := ht x
refine ⟨U ∩ V, Filter.inter_mem hxU hxV, hU.inter hV, ?_⟩
have : (U ∩ V) ↓∩ (s ∪ t) =
inclusion inter_subset_left ⁻¹' (U ↓∩ s) ∪ inclusion inter_subset_right ⁻¹' (V ↓∩ t) := by
ext; simp
rw [this]
exact .union (hsU.preimage_of_isOpenEmbedding <| .inclusion _ <|
.preimage continuous_subtype_val <| hU.inter hV)
(htV.preimage_of_isOpenEmbedding <| .inclusion _ <|
.preimage continuous_subtype_val <| hU.inter hV )
lemma IsLocallyConstructible.iUnion [Finite ι] {f : ι → Set X}
(hf : ∀ i, IsLocallyConstructible (f i)) : IsLocallyConstructible (⋃ i, f i) :=
SupClosed.iSup_mem (s := {s | IsLocallyConstructible s}) (fun _ h₁ _ ↦ h₁.union) .empty hf
lemma IsLocallyConstructible.biUnion {ι : Type*} {f : ι → Set X} {s : Set ι} (hs : s.Finite)
(hf : ∀ i ∈ s, IsLocallyConstructible (f i)) : IsLocallyConstructible (⋃ i ∈ s, f i) :=
SupClosed.biSup_mem (s := {s | IsLocallyConstructible s}) (fun _ h₁ _ ↦ h₁.union) hs .empty hf
lemma IsLocallyConstructible.sUnion {S : Set (Set X)} (hS : S.Finite)
(hS' : ∀ s ∈ S, IsLocallyConstructible s) : IsLocallyConstructible (⋃₀ S) :=
SupClosed.sSup_mem (s := {s | IsLocallyConstructible s}) (fun _ h₁ _ ↦ h₁.union) hS .empty hS'
lemma IsLocallyConstructible.preimage_of_isOpenEmbedding {s : Set Y}
(hs : IsLocallyConstructible s) (hf : IsOpenEmbedding f) :
IsLocallyConstructible (f ⁻¹' s) := by
intro x
obtain ⟨U, hxU, hU, H⟩ := hs (f x)
exact ⟨f ⁻¹' U, hf.continuous.continuousAt.preimage_mem_nhds hxU, hU.preimage hf.continuous,
(H.preimage_of_isOpenEmbedding (hf.restrictPreimage _) :)⟩
lemma IsLocallyConstructible.isConstructible_of_subset_of_isCompact
[PrespectralSpace X] [QuasiSeparatedSpace X]
(hs : IsLocallyConstructible s) (hst : s ⊆ t) (ht : IsCompact t) :
IsConstructible s := by
have (x : _) : ∃ U, IsOpen U ∧ IsCompact U ∧ x ∈ U ∧ IsConstructible (U ∩ s) :=
have ⟨U, hxU, hU, hUs⟩ := hs x
have ⟨V, ⟨hV₁, hV₂⟩, hxV, hVU⟩ := PrespectralSpace.isTopologicalBasis.mem_nhds_iff.mp hxU
have : IsConstructible (V ↓∩ s) :=
(hUs.preimage_of_isOpenEmbedding (IsOpenEmbedding.id.restrict hVU hV₁):)
have : IsConstructible (V ∩ s) := by
have := this.image_of_isOpenEmbedding hV₁.isOpenEmbedding_subtypeVal
(by simpa using hV₂.isRetrocompact hV₁)
rwa [Subtype.image_preimage_coe] at this
⟨V, hV₁, hV₂, hxV, this⟩
choose U hU hU' hxU hUs using this
obtain ⟨σ, hσ, htσ⟩ := ht.elim_nhds_subcover U (fun x _ ↦ (hU x).mem_nhds (hxU x))
convert IsConstructible.biUnion σ.finite_toSet (fun x _ ↦ hUs x)
apply subset_antisymm
· rw [← Set.iUnion₂_inter, Set.subset_inter_iff]
exact ⟨hst.trans htσ, subset_rfl⟩
· exact Set.iUnion₂_subset fun _ _ ↦ Set.inter_subset_right
lemma IsLocallyConstructible.isConstructible
[PrespectralSpace X] [QuasiSeparatedSpace X] [CompactSpace X]
(hs : IsLocallyConstructible s) :
IsConstructible s :=
hs.isConstructible_of_subset_of_isCompact s.subset_univ isCompact_univ
lemma IsLocallyConstructible.inter_of_isOpen_isCompact
[PrespectralSpace X] [QuasiSeparatedSpace X]
(hs : IsLocallyConstructible s) (ht : IsOpen t) (ht' : IsCompact t) :
IsConstructible (s ∩ t) :=
(hs.inter (ht'.isConstructible ht).isLocallyConstructible).isConstructible_of_subset_of_isCompact
Set.inter_subset_right ht'
variable {ι : Type*} {U : ι → Opens X}
lemma IsLocallyConstructible.of_isOpenCover
(hU : IsOpenCover U) (H : ∀ i, IsLocallyConstructible ((U i : Set X) ↓∩ s)) :
IsLocallyConstructible s := by
intro x
have ⟨i, hi⟩ := hU.exists_mem x
have ⟨V, hVx, hV, hV'⟩ := H i ⟨x, hi⟩
refine ⟨_, (U i).2.isOpenEmbedding_subtypeVal.image_mem_nhds.mpr hVx,
(U i).2.isOpenMap_subtype_val _ hV, ?_⟩
let e : V ≃ₜ Subtype.val '' V :=
(Equiv.Set.image _ V Subtype.val_injective).toHomeomorphOfIsInducing
((U i).2.isOpenEmbedding_subtypeVal.restrict (by simp [MapsTo]) hV).isInducing
convert hV'.preimage_of_isOpenEmbedding e.symm.isOpenEmbedding
ext ⟨_, x, hx, rfl⟩
simp [e, Equiv.toHomeomorphOfIsInducing]
/-- A variant that requires constructible in the ambient space.
This is as strong as the unprimed version only when the open cover consists of retrocompact sets. -/
lemma IsLocallyConstructible.of_isOpenCover'
(hU : IsOpenCover U) (H : ∀ i, IsLocallyConstructible (s ∩ U i)) :
IsLocallyConstructible s :=
.of_isOpenCover hU fun i ↦ by
rw [← Subtype.preimage_coe_inter_self]
exact (H i).preimage_of_isOpenEmbedding (U i).2.isOpenEmbedding_subtypeVal
lemma IsLocallyConstructible.iff_of_isOpenCover
(hU : IsOpenCover U) :
IsLocallyConstructible s ↔ ∀ i, IsLocallyConstructible ((U i : Set X) ↓∩ s) :=
⟨fun H i ↦ H.preimage_of_isOpenEmbedding (U i).2.isOpenEmbedding_subtypeVal,
fun H ↦ .of_isOpenCover hU H⟩
lemma IsLocallyConstructible.iff_isConstructible_of_isOpenCover
[PrespectralSpace X] [QuasiSeparatedSpace X]
(hU : IsOpenCover U) (hU' : ∀ i, IsCompact (U i : Set X)) :
IsLocallyConstructible s ↔ ∀ i, IsConstructible (s ∩ U i) :=
⟨fun H i ↦ H.inter_of_isOpen_isCompact (U i).2 (hU' i),
fun H ↦ .of_isOpenCover' hU fun i ↦ (H i).isLocallyConstructible⟩
end Topology |
.lake/packages/mathlib/Mathlib/Topology/LocallyFinite.lean | import Mathlib.Order.Filter.SmallSets
import Mathlib.Topology.ContinuousOn
/-!
### Locally finite families of sets
We say that a family of sets in a topological space is *locally finite* if at every point `x : X`,
there is a neighborhood of `x` which meets only finitely many sets in the family.
In this file we give the definition and prove basic properties of locally finite families of sets.
-/
-- locally finite family [General Topology (Bourbaki, 1995)]
open Set Function Filter Topology
variable {ι ι' α X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f g : ι → Set X}
/-- A family of sets in `Set X` is locally finite if at every point `x : X`,
there is a neighborhood of `x` which meets only finitely many sets in the family. -/
def LocallyFinite (f : ι → Set X) :=
∀ x : X, ∃ t ∈ 𝓝 x, { i | (f i ∩ t).Nonempty }.Finite
theorem locallyFinite_of_finite [Finite ι] (f : ι → Set X) : LocallyFinite f := fun _ =>
⟨univ, univ_mem, toFinite _⟩
namespace LocallyFinite
theorem point_finite (hf : LocallyFinite f) (x : X) : { b | x ∈ f b }.Finite :=
let ⟨_t, hxt, ht⟩ := hf x
ht.subset fun _b hb => ⟨x, hb, mem_of_mem_nhds hxt⟩
protected theorem subset (hf : LocallyFinite f) (hg : ∀ i, g i ⊆ f i) : LocallyFinite g := fun a =>
let ⟨t, ht₁, ht₂⟩ := hf a
⟨t, ht₁, ht₂.subset fun i hi => hi.mono <| inter_subset_inter (hg i) Subset.rfl⟩
theorem comp_injOn {g : ι' → ι} (hf : LocallyFinite f) (hg : InjOn g { i | (f (g i)).Nonempty }) :
LocallyFinite (f ∘ g) := fun x => by
let ⟨t, htx, htf⟩ := hf x
refine ⟨t, htx, htf.preimage <| ?_⟩
exact hg.mono fun i (hi : Set.Nonempty _) => hi.left
theorem comp_injective {g : ι' → ι} (hf : LocallyFinite f) (hg : Injective g) :
LocallyFinite (f ∘ g) :=
hf.comp_injOn hg.injOn
theorem of_comp_surjective {g : ι' → ι} (hg : Surjective g) (hfg : LocallyFinite (f ∘ g)) :
LocallyFinite f := by
simpa only [comp_def, surjInv_eq hg] using hfg.comp_injective (injective_surjInv hg)
theorem on_range (hf : LocallyFinite f) : LocallyFinite ((↑) : range f → Set X) :=
of_comp_surjective rangeFactorization_surjective hf
theorem _root_.locallyFinite_iff_smallSets :
LocallyFinite f ↔ ∀ x, ∀ᶠ s in (𝓝 x).smallSets, { i | (f i ∩ s).Nonempty }.Finite :=
forall_congr' fun _ => Iff.symm <|
eventually_smallSets' fun _s _t hst ht =>
ht.subset fun _i hi => hi.mono <| inter_subset_inter_right _ hst
protected theorem eventually_smallSets (hf : LocallyFinite f) (x : X) :
∀ᶠ s in (𝓝 x).smallSets, { i | (f i ∩ s).Nonempty }.Finite :=
locallyFinite_iff_smallSets.mp hf x
theorem exists_mem_basis {ι' : Sort*} (hf : LocallyFinite f) {p : ι' → Prop} {s : ι' → Set X}
{x : X} (hb : (𝓝 x).HasBasis p s) : ∃ i, p i ∧ { j | (f j ∩ s i).Nonempty }.Finite :=
let ⟨i, hpi, hi⟩ := hb.smallSets.eventually_iff.mp (hf.eventually_smallSets x)
⟨i, hpi, hi Subset.rfl⟩
protected theorem nhdsWithin_iUnion (hf : LocallyFinite f) (a : X) :
𝓝[⋃ i, f i] a = ⨆ i, 𝓝[f i] a := by
rcases hf a with ⟨U, haU, hfin⟩
refine le_antisymm ?_ (Monotone.le_map_iSup fun _ _ ↦ nhdsWithin_mono _)
calc
𝓝[⋃ i, f i] a = 𝓝[⋃ i, f i ∩ U] a := by
rw [← iUnion_inter, ← nhdsWithin_inter_of_mem' (nhdsWithin_le_nhds haU)]
_ = 𝓝[⋃ i ∈ {j | (f j ∩ U).Nonempty}, (f i ∩ U)] a := by
simp only [mem_setOf_eq, iUnion_nonempty_self]
_ = ⨆ i ∈ {j | (f j ∩ U).Nonempty}, 𝓝[f i ∩ U] a := nhdsWithin_biUnion hfin _ _
_ ≤ ⨆ i, 𝓝[f i ∩ U] a := iSup₂_le_iSup _ _
_ ≤ ⨆ i, 𝓝[f i] a := iSup_mono fun i ↦ nhdsWithin_mono _ inter_subset_left
theorem continuousOn_iUnion' {g : X → Y} (hf : LocallyFinite f)
(hc : ∀ i x, x ∈ closure (f i) → ContinuousWithinAt g (f i) x) :
ContinuousOn g (⋃ i, f i) := by
rintro x -
rw [ContinuousWithinAt, hf.nhdsWithin_iUnion, tendsto_iSup]
intro i
by_cases hx : x ∈ closure (f i)
· exact hc i _ hx
· rw [mem_closure_iff_nhdsWithin_neBot, not_neBot] at hx
rw [hx]
exact tendsto_bot
theorem continuousOn_iUnion {g : X → Y} (hf : LocallyFinite f) (h_cl : ∀ i, IsClosed (f i))
(h_cont : ∀ i, ContinuousOn g (f i)) : ContinuousOn g (⋃ i, f i) :=
hf.continuousOn_iUnion' fun i x hx ↦ h_cont i x <| (h_cl i).closure_subset hx
protected theorem continuous' {g : X → Y} (hf : LocallyFinite f) (h_cov : ⋃ i, f i = univ)
(hc : ∀ i x, x ∈ closure (f i) → ContinuousWithinAt g (f i) x) :
Continuous g :=
continuousOn_univ.1 <| h_cov ▸ hf.continuousOn_iUnion' hc
protected theorem continuous {g : X → Y} (hf : LocallyFinite f) (h_cov : ⋃ i, f i = univ)
(h_cl : ∀ i, IsClosed (f i)) (h_cont : ∀ i, ContinuousOn g (f i)) :
Continuous g :=
continuousOn_univ.1 <| h_cov ▸ hf.continuousOn_iUnion h_cl h_cont
protected theorem closure (hf : LocallyFinite f) : LocallyFinite fun i => closure (f i) := by
intro x
rcases hf x with ⟨s, hsx, hsf⟩
refine ⟨interior s, interior_mem_nhds.2 hsx, hsf.subset fun i hi => ?_⟩
exact (hi.mono isOpen_interior.closure_inter).of_closure.mono
(inter_subset_inter_right _ interior_subset)
theorem closure_iUnion (h : LocallyFinite f) : closure (⋃ i, f i) = ⋃ i, closure (f i) := by
ext x
simp only [mem_closure_iff_nhdsWithin_neBot, h.nhdsWithin_iUnion, iSup_neBot, mem_iUnion]
theorem isClosed_iUnion (hf : LocallyFinite f) (hc : ∀ i, IsClosed (f i)) :
IsClosed (⋃ i, f i) := by
simp only [← closure_eq_iff_isClosed, hf.closure_iUnion, (hc _).closure_eq]
/-- If `f : β → Set α` is a locally finite family of closed sets, then for any `x : α`, the
intersection of the complements to `f i`, `x ∉ f i`, is a neighbourhood of `x`. -/
theorem iInter_compl_mem_nhds (hf : LocallyFinite f) (hc : ∀ i, IsClosed (f i)) (x : X) :
(⋂ (i) (_ : x ∉ f i), (f i)ᶜ) ∈ 𝓝 x := by
refine IsOpen.mem_nhds ?_ (mem_iInter₂.2 fun i => id)
suffices IsClosed (⋃ i : { i // x ∉ f i }, f i) by
rwa [← isOpen_compl_iff, compl_iUnion, iInter_subtype] at this
exact (hf.comp_injective Subtype.val_injective).isClosed_iUnion fun i => hc _
/-- Let `f : ℕ → Π a, β a` be a sequence of (dependent) functions on a topological space. Suppose
that the family of sets `s n = {x | f (n + 1) x ≠ f n x}` is locally finite. Then there exists a
function `F : Π a, β a` such that for any `x`, we have `f n x = F x` on the product of an infinite
interval `[N, +∞)` and a neighbourhood of `x`.
We formulate the conclusion in terms of the product of filter `Filter.atTop` and `𝓝 x`. -/
theorem exists_forall_eventually_eq_prod {π : X → Sort*} {f : ℕ → ∀ x : X, π x}
(hf : LocallyFinite fun n => { x | f (n + 1) x ≠ f n x }) :
∃ F : ∀ x : X, π x, ∀ x, ∀ᶠ p : ℕ × X in atTop ×ˢ 𝓝 x, f p.1 p.2 = F p.2 := by
choose U hUx hU using hf
choose N hN using fun x => (hU x).bddAbove
replace hN : ∀ (x), ∀ n > N x, ∀ y ∈ U x, f (n + 1) y = f n y :=
fun x n hn y hy => by_contra fun hne => hn.lt.not_ge <| hN x ⟨y, hne, hy⟩
replace hN : ∀ (x), ∀ n ≥ N x + 1, ∀ y ∈ U x, f n y = f (N x + 1) y :=
fun x n hn y hy => Nat.le_induction rfl (fun k hle => (hN x _ hle _ hy).trans) n hn
refine ⟨fun x => f (N x + 1) x, fun x => ?_⟩
filter_upwards [Filter.prod_mem_prod (eventually_gt_atTop (N x)) (hUx x)]
rintro ⟨n, y⟩ ⟨hn : N x < n, hy : y ∈ U x⟩
calc
f n y = f (N x + 1) y := hN _ _ hn _ hy
_ = f (max (N x + 1) (N y + 1)) y := (hN _ _ (le_max_left _ _) _ hy).symm
_ = f (N y + 1) y := hN _ _ (le_max_right _ _) _ (mem_of_mem_nhds <| hUx y)
/-- Let `f : ℕ → Π a, β a` be a sequence of (dependent) functions on a topological space. Suppose
that the family of sets `s n = {x | f (n + 1) x ≠ f n x}` is locally finite. Then there exists a
function `F : Π a, β a` such that for any `x`, for sufficiently large values of `n`, we have
`f n y = F y` in a neighbourhood of `x`. -/
theorem exists_forall_eventually_atTop_eventually_eq' {π : X → Sort*} {f : ℕ → ∀ x : X, π x}
(hf : LocallyFinite fun n => { x | f (n + 1) x ≠ f n x }) :
∃ F : ∀ x : X, π x, ∀ x, ∀ᶠ n : ℕ in atTop, ∀ᶠ y : X in 𝓝 x, f n y = F y :=
hf.exists_forall_eventually_eq_prod.imp fun _F hF x => (hF x).curry
/-- Let `f : ℕ → α → β` be a sequence of functions on a topological space. Suppose
that the family of sets `s n = {x | f (n + 1) x ≠ f n x}` is locally finite. Then there exists a
function `F : α → β` such that for any `x`, for sufficiently large values of `n`, we have
`f n =ᶠ[𝓝 x] F`. -/
theorem exists_forall_eventually_atTop_eventuallyEq {f : ℕ → X → α}
(hf : LocallyFinite fun n => { x | f (n + 1) x ≠ f n x }) :
∃ F : X → α, ∀ x, ∀ᶠ n : ℕ in atTop, f n =ᶠ[𝓝 x] F :=
hf.exists_forall_eventually_atTop_eventually_eq'
theorem preimage_continuous {g : Y → X} (hf : LocallyFinite f) (hg : Continuous g) :
LocallyFinite (g ⁻¹' f ·) := fun x =>
let ⟨s, hsx, hs⟩ := hf (g x)
⟨g ⁻¹' s, hg.continuousAt hsx, hs.subset fun _ ⟨y, hy⟩ => ⟨g y, hy⟩⟩
theorem prod_right (hf : LocallyFinite f) (g : ι → Set Y) : LocallyFinite (fun i ↦ f i ×ˢ g i) :=
(hf.preimage_continuous continuous_fst).subset fun _ ↦ prod_subset_preimage_fst _ _
theorem prod_left {g : ι → Set Y} (hg : LocallyFinite g) (f : ι → Set X) :
LocallyFinite (fun i ↦ f i ×ˢ g i) :=
(hg.preimage_continuous continuous_snd).subset fun _ ↦ prod_subset_preimage_snd _ _
end LocallyFinite
@[simp]
theorem Equiv.locallyFinite_comp_iff (e : ι' ≃ ι) : LocallyFinite (f ∘ e) ↔ LocallyFinite f :=
⟨fun h => by simpa only [comp_def, e.apply_symm_apply] using h.comp_injective e.symm.injective,
fun h => h.comp_injective e.injective⟩
theorem locallyFinite_sum {f : ι ⊕ ι' → Set X} :
LocallyFinite f ↔ LocallyFinite (f ∘ Sum.inl) ∧ LocallyFinite (f ∘ Sum.inr) := by
simp only [locallyFinite_iff_smallSets, ← forall_and, ← finite_preimage_inl_and_inr,
preimage_setOf_eq, (· ∘ ·), eventually_and]
theorem LocallyFinite.sumElim {g : ι' → Set X} (hf : LocallyFinite f) (hg : LocallyFinite g) :
LocallyFinite (Sum.elim f g) :=
locallyFinite_sum.mpr ⟨hf, hg⟩
theorem locallyFinite_option {f : Option ι → Set X} :
LocallyFinite f ↔ LocallyFinite (f ∘ some) := by
rw [← (Equiv.optionEquivSumPUnit.{0, _} ι).symm.locallyFinite_comp_iff, locallyFinite_sum]
simp only [locallyFinite_of_finite, and_true]
rfl
theorem LocallyFinite.option_elim' (hf : LocallyFinite f) (s : Set X) :
LocallyFinite (Option.elim' s f) :=
locallyFinite_option.2 hf
theorem LocallyFinite.eventually_subset {s : ι → Set X}
(hs : LocallyFinite s) (hs' : ∀ i, IsClosed (s i)) (x : X) :
∀ᶠ y in 𝓝 x, {i | y ∈ s i} ⊆ {i | x ∈ s i} := by
filter_upwards [hs.iInter_compl_mem_nhds hs' x] with y hy i hi
simp only [mem_iInter, mem_compl_iff] at hy
exact not_imp_not.mp (hy i) hi |
.lake/packages/mathlib/Mathlib/Topology/ExtendFrom.lean | import Mathlib.Topology.Separation.Regular
/-!
# Extending a function from a subset
The main definition of this file is `extendFrom A f` where `f : X → Y`
and `A : Set X`. This defines a new function `g : X → Y` which maps any
`x₀ : X` to the limit of `f` as `x` tends to `x₀`, if such a limit exists.
This is analogous to the way `IsDenseInducing.extend` "extends" a function
`f : X → Z` to a function `g : Y → Z` along a dense inducing `i : X → Y`.
The main theorem we prove about this definition is `continuousOn_extendFrom`
which states that, for `extendFrom A f` to be continuous on a set `B ⊆ closure A`,
it suffices that `f` converges within `A` at any point of `B`, provided that
`f` is a function to a T₃ space.
-/
noncomputable section
open Topology
open Filter Set
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
/-- Extend a function from a set `A`. The resulting function `g` is such that
at any `x₀`, if `f` converges to some `y` as `x` tends to `x₀` within `A`,
then `g x₀` is defined to be one of these `y`. Else, `g x₀` could be anything. -/
def extendFrom (A : Set X) (f : X → Y) : X → Y :=
fun x ↦ @limUnder _ _ _ ⟨f x⟩ (𝓝[A] x) f
/-- If `f` converges to some `y` as `x` tends to `x₀` within `A`,
then `f` tends to `extendFrom A f x` as `x` tends to `x₀`. -/
theorem tendsto_extendFrom {A : Set X} {f : X → Y} {x : X} (h : ∃ y, Tendsto f (𝓝[A] x) (𝓝 y)) :
Tendsto f (𝓝[A] x) (𝓝 <| extendFrom A f x) :=
tendsto_nhds_limUnder h
theorem extendFrom_eq [T2Space Y] {A : Set X} {f : X → Y} {x : X} {y : Y} (hx : x ∈ closure A)
(hf : Tendsto f (𝓝[A] x) (𝓝 y)) : extendFrom A f x = y :=
haveI := mem_closure_iff_nhdsWithin_neBot.mp hx
tendsto_nhds_unique (tendsto_nhds_limUnder ⟨y, hf⟩) hf
theorem extendFrom_extends [T2Space Y] {f : X → Y} {A : Set X} (hf : ContinuousOn f A) :
∀ x ∈ A, extendFrom A f x = f x :=
fun x x_in ↦ extendFrom_eq (subset_closure x_in) (hf x x_in)
/-- If `f` is a function to a T₃ space `Y` which has a limit within `A` at any
point of a set `B ⊆ closure A`, then `extendFrom A f` is continuous on `B`. -/
theorem continuousOn_extendFrom [RegularSpace Y] {f : X → Y} {A B : Set X} (hB : B ⊆ closure A)
(hf : ∀ x ∈ B, ∃ y, Tendsto f (𝓝[A] x) (𝓝 y)) : ContinuousOn (extendFrom A f) B := by
set φ := extendFrom A f
intro x x_in
suffices ∀ V' ∈ 𝓝 (φ x), IsClosed V' → φ ⁻¹' V' ∈ 𝓝[B] x by
simpa [ContinuousWithinAt, (closed_nhds_basis (φ x)).tendsto_right_iff]
intro V' V'_in V'_closed
obtain ⟨V, V_in, V_op, hV⟩ : ∃ V ∈ 𝓝 x, IsOpen V ∧ V ∩ A ⊆ f ⁻¹' V' := by
have := tendsto_extendFrom (hf x x_in)
rcases (nhdsWithin_basis_open x A).tendsto_left_iff.mp this V' V'_in with ⟨V, ⟨hxV, V_op⟩, hV⟩
exact ⟨V, IsOpen.mem_nhds V_op hxV, V_op, hV⟩
suffices ∀ y ∈ V ∩ B, φ y ∈ V' from
mem_of_superset (inter_mem_inf V_in <| mem_principal_self B) this
rintro y ⟨hyV, hyB⟩
haveI := mem_closure_iff_nhdsWithin_neBot.mp (hB hyB)
have limy : Tendsto f (𝓝[A] y) (𝓝 <| φ y) := tendsto_extendFrom (hf y hyB)
have hVy : V ∈ 𝓝 y := IsOpen.mem_nhds V_op hyV
have : V ∩ A ∈ 𝓝[A] y := by simpa only [inter_comm] using inter_mem_nhdsWithin A hVy
exact V'_closed.mem_of_tendsto limy (mem_of_superset this hV)
/-- If a function `f` to a T₃ space `Y` has a limit within a
dense set `A` for any `x`, then `extendFrom A f` is continuous. -/
theorem continuous_extendFrom [RegularSpace Y] {f : X → Y} {A : Set X} (hA : Dense A)
(hf : ∀ x, ∃ y, Tendsto f (𝓝[A] x) (𝓝 y)) : Continuous (extendFrom A f) := by
rw [← continuousOn_univ]
exact continuousOn_extendFrom (fun x _ ↦ hA x) (by simpa using hf) |
.lake/packages/mathlib/Mathlib/Topology/Maps/Basic.lean | import Mathlib.Topology.Order
import Mathlib.Topology.NhdsSet
/-!
# Specific classes of maps between topological spaces
This file introduces the following properties of a map `f : X → Y` between topological spaces:
* `IsOpenMap f` means the image of an open set under `f` is open.
* `IsClosedMap f` means the image of a closed set under `f` is closed.
(Open and closed maps need not be continuous.)
* `IsInducing f` means the topology on `X` is the one induced via `f` from the topology on `Y`.
These behave like embeddings except they need not be injective. Instead, points of `X` which
are identified by `f` are also inseparable in the topology on `X`.
* `IsEmbedding f` means `f` is inducing and also injective. Equivalently, `f` identifies `X` with
a subspace of `Y`.
* `IsOpenEmbedding f` means `f` is an embedding with open image, so it identifies `X` with an
open subspace of `Y`. Equivalently, `f` is an embedding and an open map.
* `IsClosedEmbedding f` similarly means `f` is an embedding with closed image, so it identifies
`X` with a closed subspace of `Y`. Equivalently, `f` is an embedding and a closed map.
* `IsQuotientMap f` is the dual condition to `IsEmbedding f`: `f` is surjective and the topology
on `Y` is the one coinduced via `f` from the topology on `X`. Equivalently, `f` identifies
`Y` with a quotient of `X`. Quotient maps are also sometimes known as identification maps.
## References
* <https://en.wikipedia.org/wiki/Open_and_closed_maps>
* <https://en.wikipedia.org/wiki/Embedding#General_topology>
* <https://en.wikipedia.org/wiki/Quotient_space_(topology)#Quotient_map>
## Tags
open map, closed map, embedding, quotient map, identification map
-/
open Set Filter Function
open TopologicalSpace Topology Filter
variable {X : Type*} {Y : Type*} {Z : Type*} {ι : Type*} {f : X → Y} {g : Y → Z}
namespace Topology
section IsInducing
variable [TopologicalSpace Y]
protected lemma IsInducing.induced (f : X → Y) : @IsInducing X Y (induced f ‹_›) _ f :=
@IsInducing.mk _ _ (TopologicalSpace.induced f ‹_›) _ _ rfl
variable [TopologicalSpace X]
@[fun_prop]
protected lemma IsInducing.id : IsInducing (@id X) := ⟨induced_id.symm⟩
variable [TopologicalSpace Z]
@[fun_prop]
protected lemma IsInducing.comp (hg : IsInducing g) (hf : IsInducing f) :
IsInducing (g ∘ f) :=
⟨by rw [hf.eq_induced, hg.eq_induced, induced_compose]⟩
lemma IsInducing.of_comp_iff (hg : IsInducing g) : IsInducing (g ∘ f) ↔ IsInducing f := by
refine ⟨fun h ↦ ?_, hg.comp⟩
rw [isInducing_iff, hg.eq_induced, induced_compose, h.eq_induced]
lemma IsInducing.of_comp (hf : Continuous f) (hg : Continuous g) (hgf : IsInducing (g ∘ f)) :
IsInducing f :=
⟨le_antisymm hf.le_induced (by grw [hgf.eq_induced, ← induced_compose, ← hg.le_induced])⟩
lemma isInducing_iff_nhds : IsInducing f ↔ ∀ x, 𝓝 x = comap f (𝓝 (f x)) :=
(isInducing_iff _).trans (induced_iff_nhds_eq f)
namespace IsInducing
lemma nhds_eq_comap (hf : IsInducing f) : ∀ x : X, 𝓝 x = comap f (𝓝 <| f x) :=
isInducing_iff_nhds.1 hf
lemma basis_nhds {p : ι → Prop} {s : ι → Set Y} (hf : IsInducing f) {x : X}
(h_basis : (𝓝 (f x)).HasBasis p s) : (𝓝 x).HasBasis p (preimage f ∘ s) :=
hf.nhds_eq_comap x ▸ h_basis.comap f
lemma nhdsSet_eq_comap (hf : IsInducing f) (s : Set X) :
𝓝ˢ s = comap f (𝓝ˢ (f '' s)) := by
simp only [nhdsSet, sSup_image, comap_iSup, hf.nhds_eq_comap, iSup_image]
lemma map_nhds_eq (hf : IsInducing f) (x : X) : (𝓝 x).map f = 𝓝[range f] f x :=
hf.eq_induced ▸ map_nhds_induced_eq x
lemma map_nhds_of_mem (hf : IsInducing f) (x : X) (h : range f ∈ 𝓝 (f x)) :
(𝓝 x).map f = 𝓝 (f x) := hf.eq_induced ▸ map_nhds_induced_of_mem h
lemma mapClusterPt_iff (hf : IsInducing f) {x : X} {l : Filter X} :
MapClusterPt (f x) l f ↔ ClusterPt x l := by
delta MapClusterPt ClusterPt
rw [← Filter.push_pull', ← hf.nhds_eq_comap, map_neBot_iff]
lemma image_mem_nhdsWithin (hf : IsInducing f) {x : X} {s : Set X} (hs : s ∈ 𝓝 x) :
f '' s ∈ 𝓝[range f] f x :=
hf.map_nhds_eq x ▸ image_mem_map hs
lemma tendsto_nhds_iff {f : ι → Y} {l : Filter ι} {y : Y} (hg : IsInducing g) :
Tendsto f l (𝓝 y) ↔ Tendsto (g ∘ f) l (𝓝 (g y)) := by
rw [hg.nhds_eq_comap, tendsto_comap_iff]
lemma continuousAt_iff (hg : IsInducing g) {x : X} :
ContinuousAt f x ↔ ContinuousAt (g ∘ f) x :=
hg.tendsto_nhds_iff
lemma continuous_iff (hg : IsInducing g) :
Continuous f ↔ Continuous (g ∘ f) := by
simp_rw [continuous_iff_continuousAt, hg.continuousAt_iff]
lemma continuousAt_iff' (hf : IsInducing f) {x : X} (h : range f ∈ 𝓝 (f x)) :
ContinuousAt (g ∘ f) x ↔ ContinuousAt g (f x) := by
simp_rw [ContinuousAt, Filter.Tendsto, ← hf.map_nhds_of_mem _ h, Filter.map_map, comp]
@[fun_prop]
protected lemma continuous (hf : IsInducing f) : Continuous f :=
hf.continuous_iff.mp continuous_id
lemma closure_eq_preimage_closure_image (hf : IsInducing f) (s : Set X) :
closure s = f ⁻¹' closure (f '' s) := by
ext x
rw [Set.mem_preimage, ← closure_induced, hf.eq_induced]
theorem isClosed_iff (hf : IsInducing f) {s : Set X} :
IsClosed s ↔ ∃ t, IsClosed t ∧ f ⁻¹' t = s := by rw [hf.eq_induced, isClosed_induced_iff]
theorem isClosed_iff' (hf : IsInducing f) {s : Set X} :
IsClosed s ↔ ∀ x, f x ∈ closure (f '' s) → x ∈ s := by rw [hf.eq_induced, isClosed_induced_iff']
theorem isClosed_preimage (h : IsInducing f) (s : Set Y) (hs : IsClosed s) :
IsClosed (f ⁻¹' s) :=
(isClosed_iff h).mpr ⟨s, hs, rfl⟩
theorem isOpen_iff (hf : IsInducing f) {s : Set X} :
IsOpen s ↔ ∃ t, IsOpen t ∧ f ⁻¹' t = s := by rw [hf.eq_induced, isOpen_induced_iff]
theorem setOf_isOpen (hf : IsInducing f) :
{s : Set X | IsOpen s} = preimage f '' {t | IsOpen t} :=
Set.ext fun _ ↦ hf.isOpen_iff
theorem dense_iff (hf : IsInducing f) {s : Set X} :
Dense s ↔ ∀ x, f x ∈ closure (f '' s) := by
simp only [Dense, hf.closure_eq_preimage_closure_image, mem_preimage]
theorem of_subsingleton [Subsingleton X] (f : X → Y) : IsInducing f :=
⟨Subsingleton.elim _ _⟩
end IsInducing.IsInducing
namespace IsEmbedding
lemma induced [t : TopologicalSpace Y] (hf : Injective f) :
@IsEmbedding X Y (t.induced f) t f :=
@IsEmbedding.mk X Y (t.induced f) t _ (.induced f) hf
alias _root_.Function.Injective.isEmbedding_induced := IsEmbedding.induced
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
@[fun_prop]
lemma isInducing (hf : IsEmbedding f) : IsInducing f := hf.toIsInducing
lemma mk' (f : X → Y) (inj : Injective f) (induced : ∀ x, comap f (𝓝 (f x)) = 𝓝 x) :
IsEmbedding f :=
⟨isInducing_iff_nhds.2 fun x => (induced x).symm, inj⟩
@[fun_prop]
protected lemma id : IsEmbedding (@id X) := ⟨.id, fun _ _ h => h⟩
@[fun_prop]
protected lemma comp (hg : IsEmbedding g) (hf : IsEmbedding f) : IsEmbedding (g ∘ f) :=
{ hg.isInducing.comp hf.isInducing with injective := fun _ _ h => hf.injective <| hg.injective h }
lemma of_comp_iff (hg : IsEmbedding g) : IsEmbedding (g ∘ f) ↔ IsEmbedding f := by
simp_rw [isEmbedding_iff, hg.isInducing.of_comp_iff, hg.injective.of_comp_iff f]
protected lemma of_comp (hf : Continuous f) (hg : Continuous g) (hgf : IsEmbedding (g ∘ f)) :
IsEmbedding f where
toIsInducing := hgf.isInducing.of_comp hf hg
injective := hgf.injective.of_comp
lemma of_leftInverse {f : X → Y} {g : Y → X} (h : LeftInverse f g) (hf : Continuous f)
(hg : Continuous g) : IsEmbedding g := .of_comp hg hf <| h.comp_eq_id.symm ▸ .id
alias _root_.Function.LeftInverse.isEmbedding := of_leftInverse
lemma map_nhds_eq (hf : IsEmbedding f) (x : X) : (𝓝 x).map f = 𝓝[range f] f x :=
hf.1.map_nhds_eq x
lemma map_nhds_of_mem (hf : IsEmbedding f) (x : X) (h : range f ∈ 𝓝 (f x)) :
(𝓝 x).map f = 𝓝 (f x) :=
hf.1.map_nhds_of_mem x h
lemma tendsto_nhds_iff {f : ι → Y} {l : Filter ι} {y : Y} (hg : IsEmbedding g) :
Tendsto f l (𝓝 y) ↔ Tendsto (g ∘ f) l (𝓝 (g y)) := hg.isInducing.tendsto_nhds_iff
lemma continuous_iff (hg : IsEmbedding g) : Continuous f ↔ Continuous (g ∘ f) :=
hg.isInducing.continuous_iff
lemma continuous (hf : IsEmbedding f) : Continuous f := hf.isInducing.continuous
lemma closure_eq_preimage_closure_image (hf : IsEmbedding f) (s : Set X) :
closure s = f ⁻¹' closure (f '' s) :=
hf.1.closure_eq_preimage_closure_image s
/-- The topology induced under an inclusion `f : X → Y` from a discrete topological space `Y`
is the discrete topology on `X`.
See also `DiscreteTopology.of_continuous_injective`. -/
lemma discreteTopology [DiscreteTopology Y] (hf : IsEmbedding f) : DiscreteTopology X :=
.of_continuous_injective hf.continuous hf.injective
lemma of_subsingleton [Subsingleton X] (f : X → Y) : IsEmbedding f :=
⟨.of_subsingleton f, f.injective_of_subsingleton⟩
end IsEmbedding
section IsQuotientMap
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
lemma isQuotientMap_iff : IsQuotientMap f ↔ Surjective f ∧ ∀ s, IsOpen s ↔ IsOpen (f ⁻¹' s) :=
(isQuotientMap_iff' _).trans <| and_congr Iff.rfl TopologicalSpace.ext_iff
theorem isQuotientMap_iff_isClosed :
IsQuotientMap f ↔ Surjective f ∧ ∀ s : Set Y, IsClosed s ↔ IsClosed (f ⁻¹' s) :=
isQuotientMap_iff.trans <| Iff.rfl.and <| compl_surjective.forall.trans <| by
simp only [isOpen_compl_iff, preimage_compl]
namespace IsQuotientMap
@[fun_prop]
protected theorem id : IsQuotientMap (@id X) :=
⟨fun x => ⟨x, rfl⟩, coinduced_id.symm⟩
@[fun_prop]
protected theorem comp (hg : IsQuotientMap g) (hf : IsQuotientMap f) : IsQuotientMap (g ∘ f) :=
⟨hg.surjective.comp hf.surjective, by rw [hg.eq_coinduced, hf.eq_coinduced, coinduced_compose]⟩
protected theorem of_comp (hf : Continuous f) (hg : Continuous g)
(hgf : IsQuotientMap (g ∘ f)) : IsQuotientMap g :=
⟨hgf.1.of_comp,
le_antisymm (by grw [hgf.eq_coinduced, ← coinduced_compose, hf.coinduced_le]) hg.coinduced_le⟩
theorem of_inverse {g : Y → X} (hf : Continuous f) (hg : Continuous g) (h : LeftInverse g f) :
IsQuotientMap g := .of_comp hf hg <| h.comp_eq_id.symm ▸ IsQuotientMap.id
protected theorem continuous_iff (hf : IsQuotientMap f) : Continuous g ↔ Continuous (g ∘ f) := by
rw [continuous_iff_coinduced_le, continuous_iff_coinduced_le, hf.eq_coinduced, coinduced_compose]
@[fun_prop]
protected theorem continuous (hf : IsQuotientMap f) : Continuous f :=
hf.continuous_iff.mp continuous_id
protected lemma isOpen_preimage (hf : IsQuotientMap f) {s : Set Y} : IsOpen (f ⁻¹' s) ↔ IsOpen s :=
((isQuotientMap_iff.1 hf).2 s).symm
protected theorem isClosed_preimage (hf : IsQuotientMap f) {s : Set Y} :
IsClosed (f ⁻¹' s) ↔ IsClosed s :=
((isQuotientMap_iff_isClosed.1 hf).2 s).symm
end IsQuotientMap
end Topology.IsQuotientMap
section OpenMap
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
namespace IsOpenMap
protected theorem id : IsOpenMap (@id X) := fun s hs => by rwa [image_id]
protected theorem comp (hg : IsOpenMap g) (hf : IsOpenMap f) :
IsOpenMap (g ∘ f) := fun s hs => by rw [image_comp]; exact hg _ (hf _ hs)
theorem isOpen_range (hf : IsOpenMap f) : IsOpen (range f) := by
rw [← image_univ]
exact hf _ isOpen_univ
theorem image_mem_nhds (hf : IsOpenMap f) {x : X} {s : Set X} (hx : s ∈ 𝓝 x) : f '' s ∈ 𝓝 (f x) :=
let ⟨t, hts, ht, hxt⟩ := mem_nhds_iff.1 hx
mem_of_superset (IsOpen.mem_nhds (hf t ht) (mem_image_of_mem _ hxt)) (image_mono hts)
theorem range_mem_nhds (hf : IsOpenMap f) (x : X) : range f ∈ 𝓝 (f x) :=
hf.isOpen_range.mem_nhds <| mem_range_self _
theorem mapsTo_interior (hf : IsOpenMap f) {s : Set X} {t : Set Y} (h : MapsTo f s t) :
MapsTo f (interior s) (interior t) :=
mapsTo_iff_image_subset.2 <|
interior_maximal (h.mono interior_subset Subset.rfl).image_subset (hf _ isOpen_interior)
theorem image_interior_subset (hf : IsOpenMap f) (s : Set X) :
f '' interior s ⊆ interior (f '' s) :=
(hf.mapsTo_interior (mapsTo_image f s)).image_subset
theorem nhds_le (hf : IsOpenMap f) (x : X) : 𝓝 (f x) ≤ map f (𝓝 x) :=
le_map fun _ => hf.image_mem_nhds
theorem map_nhds_eq (hf : IsOpenMap f) {x : X} (hf' : ContinuousAt f x) : map f (𝓝 x) = 𝓝 (f x) :=
le_antisymm hf' (hf.nhds_le x)
theorem map_nhdsSet_eq (hf : IsOpenMap f) (hf' : Continuous f) (s : Set X) :
map f (𝓝ˢ s) = 𝓝ˢ (f '' s) := by
rw [← biUnion_of_singleton s]
simp_rw [image_iUnion, nhdsSet_iUnion, map_iSup, image_singleton, nhdsSet_singleton,
hf.map_nhds_eq hf'.continuousAt]
theorem of_nhds_le (hf : ∀ x, 𝓝 (f x) ≤ map f (𝓝 x)) : IsOpenMap f := fun _s hs =>
isOpen_iff_mem_nhds.2 fun _y ⟨_x, hxs, hxy⟩ => hxy ▸ hf _ (image_mem_map <| hs.mem_nhds hxs)
theorem of_sections
(h : ∀ x, ∃ g : Y → X, ContinuousAt g (f x) ∧ g (f x) = x ∧ RightInverse g f) : IsOpenMap f :=
of_nhds_le fun x =>
let ⟨g, hgc, hgx, hgf⟩ := h x
calc
𝓝 (f x) = map f (map g (𝓝 (f x))) := by rw [map_map, hgf.comp_eq_id, map_id]
_ ≤ map f (𝓝 (g (f x))) := map_mono hgc
_ = map f (𝓝 x) := by rw [hgx]
theorem of_inverse {f' : Y → X} (h : Continuous f') (l_inv : LeftInverse f f')
(r_inv : RightInverse f f') : IsOpenMap f :=
of_sections fun _ => ⟨f', h.continuousAt, r_inv _, l_inv⟩
/-- A continuous surjective open map is a quotient map. -/
theorem isQuotientMap (open_map : IsOpenMap f) (cont : Continuous f) (surj : Surjective f) :
IsQuotientMap f :=
isQuotientMap_iff.2
⟨surj, fun s => ⟨fun h => h.preimage cont, fun h => surj.image_preimage s ▸ open_map _ h⟩⟩
theorem interior_preimage_subset_preimage_interior (hf : IsOpenMap f) {s : Set Y} :
interior (f ⁻¹' s) ⊆ f ⁻¹' interior s :=
hf.mapsTo_interior (mapsTo_preimage _ _)
theorem preimage_interior_eq_interior_preimage (hf₁ : IsOpenMap f) (hf₂ : Continuous f)
(s : Set Y) : f ⁻¹' interior s = interior (f ⁻¹' s) :=
Subset.antisymm (preimage_interior_subset_interior_preimage hf₂)
(interior_preimage_subset_preimage_interior hf₁)
theorem preimage_closure_subset_closure_preimage (hf : IsOpenMap f) {s : Set Y} :
f ⁻¹' closure s ⊆ closure (f ⁻¹' s) := by
rw [← compl_subset_compl]
simp only [← interior_compl, ← preimage_compl, hf.interior_preimage_subset_preimage_interior]
theorem preimage_closure_eq_closure_preimage (hf : IsOpenMap f) (hfc : Continuous f) (s : Set Y) :
f ⁻¹' closure s = closure (f ⁻¹' s) :=
hf.preimage_closure_subset_closure_preimage.antisymm (hfc.closure_preimage_subset s)
theorem preimage_frontier_subset_frontier_preimage (hf : IsOpenMap f) {s : Set Y} :
f ⁻¹' frontier s ⊆ frontier (f ⁻¹' s) := by
simpa only [frontier_eq_closure_inter_closure, preimage_inter] using
inter_subset_inter hf.preimage_closure_subset_closure_preimage
hf.preimage_closure_subset_closure_preimage
theorem preimage_frontier_eq_frontier_preimage (hf : IsOpenMap f) (hfc : Continuous f) (s : Set Y) :
f ⁻¹' frontier s = frontier (f ⁻¹' s) := by
simp only [frontier_eq_closure_inter_closure, preimage_inter, preimage_compl,
hf.preimage_closure_eq_closure_preimage hfc]
theorem of_isEmpty [h : IsEmpty X] (f : X → Y) : IsOpenMap f := of_nhds_le h.elim
theorem clusterPt_comap (hf : IsOpenMap f) {x : X} {l : Filter Y} (h : ClusterPt (f x) l) :
ClusterPt x (comap f l) := by
rw [ClusterPt, ← map_neBot_iff, Filter.push_pull]
exact h.neBot.mono <| inf_le_inf_right _ <| hf.nhds_le _
end IsOpenMap
lemma isOpenMap_iff_kernImage :
IsOpenMap f ↔ ∀ {u : Set X}, IsClosed u → IsClosed (kernImage f u) := by
rw [IsOpenMap, compl_surjective.forall]
simp [kernImage_eq_compl]
theorem isOpenMap_iff_nhds_le : IsOpenMap f ↔ ∀ x : X, 𝓝 (f x) ≤ (𝓝 x).map f :=
⟨fun hf => hf.nhds_le, IsOpenMap.of_nhds_le⟩
theorem isOpenMap_iff_clusterPt_comap :
IsOpenMap f ↔ ∀ x l, ClusterPt (f x) l → ClusterPt x (comap f l) := by
refine ⟨fun hf _ _ ↦ hf.clusterPt_comap, fun h ↦ ?_⟩
simp only [isOpenMap_iff_nhds_le, le_map_iff]
intro x s hs
contrapose! hs
rw [← mem_interior_iff_mem_nhds, mem_interior_iff_not_clusterPt_compl, not_not] at hs ⊢
exact (h _ _ hs).mono <| by simp [subset_preimage_image]
theorem isOpenMap_iff_image_interior : IsOpenMap f ↔ ∀ s, f '' interior s ⊆ interior (f '' s) :=
⟨IsOpenMap.image_interior_subset, fun hs u hu =>
subset_interior_iff_isOpen.mp <| by simpa only [hu.interior_eq] using hs u⟩
@[deprecated (since := "2025-08-30")] alias isOpenMap_iff_interior := isOpenMap_iff_image_interior
/-- A map is open if and only if the `Set.kernImage` of every *closed* set is closed. -/
lemma isOpenMap_iff_closure_kernImage :
IsOpenMap f ↔ ∀ {s : Set X}, closure (kernImage f s) ⊆ kernImage f (closure s) := by
rw [isOpenMap_iff_image_interior, compl_surjective.forall]
simp [kernImage_eq_compl]
/-- An inducing map with an open range is an open map. -/
protected lemma Topology.IsInducing.isOpenMap (hi : IsInducing f) (ho : IsOpen (range f)) :
IsOpenMap f :=
IsOpenMap.of_nhds_le fun _ => (hi.map_nhds_of_mem _ <| IsOpen.mem_nhds ho <| mem_range_self _).ge
/-- Preimage of a dense set under an open map is dense. -/
protected theorem Dense.preimage {s : Set Y} (hs : Dense s) (hf : IsOpenMap f) :
Dense (f ⁻¹' s) := fun x ↦
hf.preimage_closure_subset_closure_preimage <| hs (f x)
end OpenMap
section IsClosedMap
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
namespace IsClosedMap
open Function
protected theorem id : IsClosedMap (@id X) := fun s hs => by rwa [image_id]
protected theorem comp (hg : IsClosedMap g) (hf : IsClosedMap f) : IsClosedMap (g ∘ f) := by
intro s hs
rw [image_comp]
exact hg _ (hf _ hs)
protected theorem of_comp_surjective (hf : Surjective f) (hf' : Continuous f)
(hfg : IsClosedMap (g ∘ f)) : IsClosedMap g := by
intro K hK
rw [← image_preimage_eq K hf, ← image_comp]
exact hfg _ (hK.preimage hf')
theorem closure_image_subset (hf : IsClosedMap f) (s : Set X) :
closure (f '' s) ⊆ f '' closure s :=
closure_minimal (image_mono subset_closure) (hf _ isClosed_closure)
theorem of_inverse {f' : Y → X} (h : Continuous f') (l_inv : LeftInverse f f')
(r_inv : RightInverse f f') : IsClosedMap f := fun s hs => by
rw [image_eq_preimage_of_inverse r_inv l_inv]
exact hs.preimage h
theorem of_nonempty (h : ∀ s, IsClosed s → s.Nonempty → IsClosed (f '' s)) :
IsClosedMap f := by
intro s hs; rcases eq_empty_or_nonempty s with h2s | h2s
· simp_rw [h2s, image_empty, isClosed_empty]
· exact h s hs h2s
theorem isClosed_range (hf : IsClosedMap f) : IsClosed (range f) :=
@image_univ _ _ f ▸ hf _ isClosed_univ
theorem isQuotientMap (hcl : IsClosedMap f) (hcont : Continuous f)
(hsurj : Surjective f) : IsQuotientMap f :=
isQuotientMap_iff_isClosed.2 ⟨hsurj, fun s =>
⟨fun hs => hs.preimage hcont, fun hs => hsurj.image_preimage s ▸ hcl _ hs⟩⟩
end IsClosedMap
/-- A map is closed if and only if the `Set.kernImage` of every *open* set is open.
One way to understand this result is that `f : X → Y` is closed if and only if its fibers vary in an
**upper hemicontinuous** way: for any open subset `U ⊆ X`, the set of all `y ∈ Y` such that
`f ⁻¹' {y} ⊆ U` is open in `Y`. -/
lemma isClosedMap_iff_kernImage :
IsClosedMap f ↔ ∀ {u : Set X}, IsOpen u → IsOpen (kernImage f u) := by
rw [IsClosedMap, compl_surjective.forall]
simp [kernImage_eq_compl]
lemma Topology.IsInducing.isClosedMap (hf : IsInducing f) (h : IsClosed (range f)) :
IsClosedMap f := by
intro s hs
rcases hf.isClosed_iff.1 hs with ⟨t, ht, rfl⟩
rw [image_preimage_eq_inter_range]
exact ht.inter h
theorem isClosedMap_iff_closure_image :
IsClosedMap f ↔ ∀ s, closure (f '' s) ⊆ f '' closure s :=
⟨IsClosedMap.closure_image_subset, fun hs c hc =>
isClosed_of_closure_subset <|
calc
closure (f '' c) ⊆ f '' closure c := hs c
_ = f '' c := by rw [hc.closure_eq]⟩
theorem isClosedMap_iff_kernImage_interior :
IsClosedMap f ↔ ∀ {s : Set X}, kernImage f (interior s) ⊆ interior (kernImage f s) := by
rw [isClosedMap_iff_closure_image, compl_surjective.forall]
simp [kernImage_eq_compl]
/-- A map `f : X → Y` is closed if and only if for all sets `s`, any cluster point of `f '' s` is
the image by `f` of some cluster point of `s`.
If you require this for all filters instead of just principal filters, and also that `f` is
continuous, you get the notion of **proper map**. See `isProperMap_iff_clusterPt`. -/
theorem isClosedMap_iff_clusterPt :
IsClosedMap f ↔ ∀ s y, MapClusterPt y (𝓟 s) f → ∃ x, f x = y ∧ ClusterPt x (𝓟 s) := by
simp [MapClusterPt, isClosedMap_iff_closure_image, subset_def, mem_closure_iff_clusterPt,
and_comm]
theorem isClosedMap_iff_comap_nhdsSet_le :
IsClosedMap f ↔ ∀ {s : Set Y}, comap f (𝓝ˢ s) ≤ 𝓝ˢ (f ⁻¹' s) := by
simp_rw [Filter.le_def, mem_comap'', ← subset_interior_iff_mem_nhdsSet,
← subset_kernImage_iff, isClosedMap_iff_kernImage_interior]
exact ⟨fun H s t hst ↦ hst.trans H, fun H s ↦ H _ subset_rfl⟩
alias ⟨IsClosedMap.comap_nhdsSet_le, _⟩ := isClosedMap_iff_comap_nhdsSet_le
theorem isClosedMap_iff_comap_nhds_le :
IsClosedMap f ↔ ∀ {y : Y}, comap f (𝓝 y) ≤ 𝓝ˢ (f ⁻¹' {y}) := by
rw [isClosedMap_iff_comap_nhdsSet_le]
constructor
· exact fun H y ↦ nhdsSet_singleton (x := y) ▸ H
· intro H s
rw [← Set.biUnion_of_singleton s]
simp_rw [preimage_iUnion, nhdsSet_iUnion, comap_iSup, nhdsSet_singleton]
exact iSup₂_mono fun _ _ ↦ H
alias ⟨IsClosedMap.comap_nhds_le, _⟩ := isClosedMap_iff_comap_nhds_le
theorem IsClosedMap.comap_nhds_eq (hf : IsClosedMap f) (hf' : Continuous f) (y : Y) :
comap f (𝓝 y) = 𝓝ˢ (f ⁻¹' {y}) :=
le_antisymm (isClosedMap_iff_comap_nhds_le.mp hf)
-- Note: below should be an application of `Continuous.tendsto_nhdsSet_nhds`, but this is only
-- proven later...
(nhdsSet_le.mpr fun x hx ↦ hx ▸ (hf'.tendsto x).le_comap)
theorem IsClosedMap.comap_nhdsSet_eq (hf : IsClosedMap f) (hf' : Continuous f) (s : Set Y) :
comap f (𝓝ˢ s) = 𝓝ˢ (f ⁻¹' s) :=
le_antisymm (isClosedMap_iff_comap_nhdsSet_le.mp hf)
-- Note: below should be an application of `Continuous.tendsto_nhdsSet_nhdsSet`, but this is only
-- proven later...
(nhdsSet_le.mpr fun x hx ↦ (hf'.tendsto x).le_comap.trans (comap_mono (nhds_le_nhdsSet hx)))
/-- Assume `f` is a closed map. If some property `p` holds around every point in the fiber of `f`
at `y₀`, then for any `y` close enough to `y₀` we have that `p` holds on the fiber at `y`. -/
theorem IsClosedMap.eventually_nhds_fiber (hf : IsClosedMap f) {p : X → Prop} (y₀ : Y)
(H : ∀ x₀ ∈ f ⁻¹' {y₀}, ∀ᶠ x in 𝓝 x₀, p x) :
∀ᶠ y in 𝓝 y₀, ∀ x ∈ f ⁻¹' {y}, p x := by
rw [← eventually_nhdsSet_iff_forall] at H
replace H := H.filter_mono hf.comap_nhds_le
rwa [eventually_comap] at H
/-- Assume `f` is a closed map. If there are points `y` arbitrarily close to `y₀` such that `p`
holds for at least some `x ∈ f ⁻¹' {y}`, then one can find `x₀ ∈ f ⁻¹' {y₀}` such that there
are points `x` arbitrarily close to `x₀` which satisfy `p`. -/
theorem IsClosedMap.frequently_nhds_fiber (hf : IsClosedMap f) {p : X → Prop} (y₀ : Y)
(H : ∃ᶠ y in 𝓝 y₀, ∃ x ∈ f ⁻¹' {y}, p x) :
∃ x₀ ∈ f ⁻¹' {y₀}, ∃ᶠ x in 𝓝 x₀, p x := by
/-
Note: this result could also be seen as a reformulation of `isClosedMap_iff_clusterPt`.
One would then be able to deduce the `eventually` statement,
and then go back to `isClosedMap_iff_comap_nhdsSet_le`.
Ultimately, this makes no difference.
-/
revert H
contrapose
simpa only [not_frequently, not_exists, not_and] using hf.eventually_nhds_fiber y₀
theorem IsClosedMap.closure_image_eq_of_continuous
(f_closed : IsClosedMap f) (f_cont : Continuous f) (s : Set X) :
closure (f '' s) = f '' closure s :=
subset_antisymm (f_closed.closure_image_subset s) (image_closure_subset_closure_image f_cont)
theorem IsClosedMap.lift'_closure_map_eq
(f_closed : IsClosedMap f) (f_cont : Continuous f) (F : Filter X) :
(map f F).lift' closure = map f (F.lift' closure) := by
rw [map_lift'_eq2 (monotone_closure Y), map_lift'_eq (monotone_closure X)]
congr 1
ext s : 1
exact f_closed.closure_image_eq_of_continuous f_cont s
theorem IsClosedMap.mapClusterPt_iff_lift'_closure
{F : Filter X} (f_closed : IsClosedMap f) (f_cont : Continuous f) {y : Y} :
MapClusterPt y F f ↔ ((F.lift' closure) ⊓ 𝓟 (f ⁻¹' {y})).NeBot := by
rw [MapClusterPt, clusterPt_iff_lift'_closure', f_closed.lift'_closure_map_eq f_cont,
← comap_principal, ← map_neBot_iff f, Filter.push_pull, principal_singleton]
end IsClosedMap
namespace Topology
section IsOpenEmbedding
variable [TopologicalSpace X] [TopologicalSpace Y]
@[fun_prop]
lemma IsOpenEmbedding.isEmbedding (hf : IsOpenEmbedding f) : IsEmbedding f := hf.toIsEmbedding
lemma IsOpenEmbedding.isInducing (hf : IsOpenEmbedding f) : IsInducing f :=
hf.isEmbedding.isInducing
lemma IsOpenEmbedding.isOpenMap (hf : IsOpenEmbedding f) : IsOpenMap f :=
hf.isEmbedding.isInducing.isOpenMap hf.isOpen_range
theorem IsOpenEmbedding.map_nhds_eq (hf : IsOpenEmbedding f) (x : X) :
map f (𝓝 x) = 𝓝 (f x) :=
hf.isEmbedding.map_nhds_of_mem _ <| hf.isOpen_range.mem_nhds <| mem_range_self _
lemma IsOpenEmbedding.isOpen_iff_image_isOpen (hf : IsOpenEmbedding f) {s : Set X} :
IsOpen s ↔ IsOpen (f '' s) where
mp := hf.isOpenMap s
mpr h := by convert ← h.preimage hf.isEmbedding.continuous; apply preimage_image_eq _ hf.injective
theorem IsOpenEmbedding.tendsto_nhds_iff [TopologicalSpace Z] {f : ι → Y} {l : Filter ι} {y : Y}
(hg : IsOpenEmbedding g) : Tendsto f l (𝓝 y) ↔ Tendsto (g ∘ f) l (𝓝 (g y)) :=
hg.isEmbedding.tendsto_nhds_iff
theorem IsOpenEmbedding.tendsto_nhds_iff' (hf : IsOpenEmbedding f) {l : Filter Z} {x : X} :
Tendsto (g ∘ f) (𝓝 x) l ↔ Tendsto g (𝓝 (f x)) l := by
rw [Tendsto, ← map_map, hf.map_nhds_eq]; rfl
theorem IsOpenEmbedding.continuousAt_iff [TopologicalSpace Z] (hf : IsOpenEmbedding f) {x : X} :
ContinuousAt (g ∘ f) x ↔ ContinuousAt g (f x) :=
hf.tendsto_nhds_iff'
@[fun_prop]
theorem IsOpenEmbedding.continuous (hf : IsOpenEmbedding f) : Continuous f :=
hf.isEmbedding.continuous
lemma IsOpenEmbedding.isOpen_iff_preimage_isOpen (hf : IsOpenEmbedding f) {s : Set Y}
(hs : s ⊆ range f) : IsOpen s ↔ IsOpen (f ⁻¹' s) := by
rw [hf.isOpen_iff_image_isOpen, image_preimage_eq_inter_range, inter_eq_self_of_subset_left hs]
@[fun_prop]
lemma IsOpenEmbedding.of_isEmbedding_isOpenMap (h₁ : IsEmbedding f) (h₂ : IsOpenMap f) :
IsOpenEmbedding f :=
⟨h₁, h₂.isOpen_range⟩
/-- A surjective embedding is an `IsOpenEmbedding`. -/
lemma IsEmbedding.isOpenEmbedding_of_surjective (hf : IsEmbedding f) (hsurj : f.Surjective) :
IsOpenEmbedding f :=
⟨hf, hsurj.range_eq ▸ isOpen_univ⟩
alias IsOpenEmbedding.of_isEmbedding := IsEmbedding.isOpenEmbedding_of_surjective
lemma isOpenEmbedding_iff_isEmbedding_isOpenMap : IsOpenEmbedding f ↔ IsEmbedding f ∧ IsOpenMap f :=
⟨fun h => ⟨h.1, h.isOpenMap⟩, fun h => .of_isEmbedding_isOpenMap h.1 h.2⟩
theorem IsOpenEmbedding.of_continuous_injective_isOpenMap
(h₁ : Continuous f) (h₂ : Injective f) (h₃ : IsOpenMap f) : IsOpenEmbedding f := by
simp only [isOpenEmbedding_iff_isEmbedding_isOpenMap, isEmbedding_iff, isInducing_iff_nhds, *,
and_true]
exact fun x =>
le_antisymm (h₁.tendsto _).le_comap (@comap_map _ _ (𝓝 x) _ h₂ ▸ comap_mono (h₃.nhds_le _))
lemma isOpenEmbedding_iff_continuous_injective_isOpenMap :
IsOpenEmbedding f ↔ Continuous f ∧ Injective f ∧ IsOpenMap f :=
⟨fun h => ⟨h.continuous, h.injective, h.isOpenMap⟩, fun h =>
.of_continuous_injective_isOpenMap h.1 h.2.1 h.2.2⟩
namespace IsOpenEmbedding
variable [TopologicalSpace Z]
@[fun_prop]
protected lemma id : IsOpenEmbedding (@id X) := ⟨.id, IsOpenMap.id.isOpen_range⟩
@[fun_prop]
protected lemma comp (hg : IsOpenEmbedding g)
(hf : IsOpenEmbedding f) : IsOpenEmbedding (g ∘ f) :=
⟨hg.1.comp hf.1, (hg.isOpenMap.comp hf.isOpenMap).isOpen_range⟩
theorem isOpenMap_iff (hg : IsOpenEmbedding g) :
IsOpenMap f ↔ IsOpenMap (g ∘ f) := by
simp_rw [isOpenMap_iff_nhds_le, ← map_map, comp, ← hg.map_nhds_eq, map_le_map_iff hg.injective]
theorem of_comp_iff (f : X → Y) (hg : IsOpenEmbedding g) :
IsOpenEmbedding (g ∘ f) ↔ IsOpenEmbedding f := by
simp only [isOpenEmbedding_iff_continuous_injective_isOpenMap, ← hg.isOpenMap_iff, ←
hg.1.continuous_iff, hg.injective.of_comp_iff]
lemma of_comp (f : X → Y) (hg : IsOpenEmbedding g) (h : IsOpenEmbedding (g ∘ f)) :
IsOpenEmbedding f := (IsOpenEmbedding.of_comp_iff f hg).1 h
theorem of_isEmpty [IsEmpty X] (f : X → Y) : IsOpenEmbedding f :=
of_isEmbedding_isOpenMap (.of_subsingleton f) (.of_isEmpty f)
theorem image_mem_nhds {f : X → Y} (hf : IsOpenEmbedding f) {s : Set X} {x : X} :
f '' s ∈ 𝓝 (f x) ↔ s ∈ 𝓝 x := by
rw [← hf.map_nhds_eq, mem_map, preimage_image_eq _ hf.injective]
end IsOpenEmbedding
end IsOpenEmbedding
section IsClosedEmbedding
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
namespace IsClosedEmbedding
@[fun_prop]
lemma isEmbedding (hf : IsClosedEmbedding f) : IsEmbedding f := hf.toIsEmbedding
@[fun_prop]
lemma isInducing (hf : IsClosedEmbedding f) : IsInducing f := hf.isEmbedding.isInducing
@[fun_prop]
lemma continuous (hf : IsClosedEmbedding f) : Continuous f := hf.isEmbedding.continuous
lemma tendsto_nhds_iff {g : ι → X} {l : Filter ι} {x : X} (hf : IsClosedEmbedding f) :
Tendsto g l (𝓝 x) ↔ Tendsto (f ∘ g) l (𝓝 (f x)) := hf.isEmbedding.tendsto_nhds_iff
lemma isClosedMap (hf : IsClosedEmbedding f) : IsClosedMap f :=
hf.isEmbedding.isInducing.isClosedMap hf.isClosed_range
lemma isClosed_iff_image_isClosed (hf : IsClosedEmbedding f) {s : Set X} :
IsClosed s ↔ IsClosed (f '' s) :=
⟨hf.isClosedMap s, fun h => by
rw [← preimage_image_eq s hf.injective]
exact h.preimage hf.continuous⟩
lemma isClosed_iff_preimage_isClosed (hf : IsClosedEmbedding f) {s : Set Y}
(hs : s ⊆ range f) : IsClosed s ↔ IsClosed (f ⁻¹' s) := by
rw [hf.isClosed_iff_image_isClosed, image_preimage_eq_of_subset hs]
lemma of_isEmbedding_isClosedMap (h₁ : IsEmbedding f) (h₂ : IsClosedMap f) :
IsClosedEmbedding f :=
⟨h₁, image_univ (f := f) ▸ h₂ univ isClosed_univ⟩
lemma of_continuous_injective_isClosedMap (h₁ : Continuous f) (h₂ : Injective f)
(h₃ : IsClosedMap f) : IsClosedEmbedding f := by
refine .of_isEmbedding_isClosedMap ⟨⟨?_⟩, h₂⟩ h₃
refine h₁.le_induced.antisymm fun s hs => ?_
refine ⟨(f '' sᶜ)ᶜ, (h₃ _ hs.isClosed_compl).isOpen_compl, ?_⟩
rw [preimage_compl, preimage_image_eq _ h₂, compl_compl]
lemma isClosedEmbedding_iff_continuous_injective_isClosedMap {f : X → Y} :
IsClosedEmbedding f ↔ Continuous f ∧ Injective f ∧ IsClosedMap f where
mp h := ⟨h.continuous, h.injective, h.isClosedMap⟩
mpr h := .of_continuous_injective_isClosedMap h.1 h.2.1 h.2.2
@[fun_prop]
protected theorem id : IsClosedEmbedding (@id X) := ⟨.id, IsClosedMap.id.isClosed_range⟩
@[fun_prop]
theorem comp (hg : IsClosedEmbedding g) (hf : IsClosedEmbedding f) :
IsClosedEmbedding (g ∘ f) :=
⟨hg.isEmbedding.comp hf.isEmbedding, (hg.isClosedMap.comp hf.isClosedMap).isClosed_range⟩
lemma of_comp_iff (hg : IsClosedEmbedding g) : IsClosedEmbedding (g ∘ f) ↔ IsClosedEmbedding f := by
simp_rw [isClosedEmbedding_iff, hg.isEmbedding.of_comp_iff, Set.range_comp,
← hg.isClosed_iff_image_isClosed]
theorem closure_image_eq (hf : IsClosedEmbedding f) (s : Set X) :
closure (f '' s) = f '' closure s :=
hf.isClosedMap.closure_image_eq_of_continuous hf.continuous s
end Topology.IsClosedEmbedding.IsClosedEmbedding |
.lake/packages/mathlib/Mathlib/Topology/Maps/OpenQuotient.lean | import Mathlib.Topology.Maps.Basic
/-!
# Open quotient maps
An open quotient map is an open map `f : X → Y` which is both an open map and a quotient map.
Equivalently, it is a surjective continuous open map.
We use the latter characterization as a definition.
Many important quotient maps are open quotient maps, including
- the quotient map from a topological space to its quotient by the action of a group;
- the quotient map from a topological group to its quotient by a normal subgroup;
- the quotient map from a topological space to its separation quotient.
Contrary to general quotient maps,
the category of open quotient maps is closed under `Prod.map`.
-/
open Filter Function Set Topology
variable {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] {f : X → Y}
namespace IsOpenQuotientMap
protected theorem id : IsOpenQuotientMap (id : X → X) := ⟨surjective_id, continuous_id, .id⟩
/-- An open quotient map is a quotient map. -/
theorem isQuotientMap (h : IsOpenQuotientMap f) : IsQuotientMap f :=
h.isOpenMap.isQuotientMap h.continuous h.surjective
theorem iff_isOpenMap_isQuotientMap : IsOpenQuotientMap f ↔ IsOpenMap f ∧ IsQuotientMap f :=
⟨fun h ↦ ⟨h.isOpenMap, h.isQuotientMap⟩, fun ⟨ho, hq⟩ ↦ ⟨hq.surjective, hq.continuous, ho⟩⟩
theorem of_isOpenMap_isQuotientMap (ho : IsOpenMap f) (hq : IsQuotientMap f) :
IsOpenQuotientMap f :=
iff_isOpenMap_isQuotientMap.2 ⟨ho, hq⟩
theorem comp {g : Y → Z} (hg : IsOpenQuotientMap g) (hf : IsOpenQuotientMap f) :
IsOpenQuotientMap (g ∘ f) :=
⟨.comp hg.1 hf.1, .comp hg.2 hf.2, .comp hg.3 hf.3⟩
theorem map_nhds_eq (h : IsOpenQuotientMap f) (x : X) : map f (𝓝 x) = 𝓝 (f x) :=
le_antisymm h.continuous.continuousAt <| h.isOpenMap.nhds_le _
theorem continuous_comp_iff (h : IsOpenQuotientMap f) {g : Y → Z} :
Continuous (g ∘ f) ↔ Continuous g :=
h.isQuotientMap.continuous_iff.symm
theorem continuousAt_comp_iff (h : IsOpenQuotientMap f) {g : Y → Z} {x : X} :
ContinuousAt (g ∘ f) x ↔ ContinuousAt g (f x) := by
simp only [ContinuousAt, ← h.map_nhds_eq, tendsto_map'_iff, comp_def]
theorem dense_preimage_iff (h : IsOpenQuotientMap f) {s : Set Y} : Dense (f ⁻¹' s) ↔ Dense s :=
⟨fun hs ↦ h.surjective.denseRange.dense_of_mapsTo h.continuous hs (mapsTo_preimage _ _),
fun hs ↦ hs.preimage h.isOpenMap⟩
end IsOpenQuotientMap
theorem Topology.IsInducing.isOpenQuotientMap_of_surjective (ind : IsInducing f)
(surj : Function.Surjective f) : IsOpenQuotientMap f where
surjective := surj
continuous := ind.continuous
isOpenMap U U_open := by
obtain ⟨V, hV, rfl⟩ := ind.isOpen_iff.mp U_open
rwa [V.image_preimage_eq surj]
theorem Topology.IsInducing.isQuotientMap_of_surjective (ind : IsInducing f)
(surj : Function.Surjective f) : IsQuotientMap f :=
(ind.isOpenQuotientMap_of_surjective surj).isQuotientMap
section Subquotient
variable {A B C D : Type*}
variable [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] [TopologicalSpace D]
variable (f : A → B) (g : C → D) (p : A → C) (q : B → D)
omit [TopologicalSpace C] in
/--
Given the following diagram with `f` inducing, `p` surjective,
`q` an open quotient map, and `g` injective. Suppose the image of `A` in `B` is stable
under the equivalence mod `q`, then the coinduced topology on `C` (from `A`)
coincides with the induced topology (from `D`).
```
A -f→ B
∣ ∣
p q
↓ ↓
C -g→ D
```
A typical application is when `K ≤ H` are subgroups of `G`, then the quotient topology on `H/K`
is also the subspace topology from `G/K`.
-/
lemma coinduced_eq_induced_of_isOpenQuotientMap_of_isInducing
(h : g ∘ p = q ∘ f)
(hf : IsInducing f) (hp : Function.Surjective p)
(hq : IsOpenQuotientMap q) (hg : Function.Injective g)
(H : q ⁻¹' (q '' (Set.range f)) ⊆ Set.range f) :
‹TopologicalSpace A›.coinduced p = ‹TopologicalSpace D›.induced g := by
ext U
change IsOpen (p ⁻¹' U) ↔ ∃ V, _
simp_rw [hf.isOpen_iff,
(Set.image_surjective.mpr hq.surjective).exists,
← hq.isQuotientMap.isOpen_preimage]
constructor
· rintro ⟨V, hV, e⟩
refine ⟨V, hq.continuous.1 _ (hq.isOpenMap _ hV), ?_⟩
ext x
obtain ⟨x, rfl⟩ := hp x
constructor
· rintro ⟨y, hy, e'⟩
obtain ⟨y, rfl⟩ := H ⟨_, ⟨x, rfl⟩, (e'.trans (congr_fun h x)).symm⟩
rw [← hg ((congr_fun h y).trans e')]
exact e.le hy
· intro H
exact ⟨f x, e.ge H, congr_fun h.symm x⟩
· rintro ⟨V, hV, rfl⟩
refine ⟨_, hV, ?_⟩
simp_rw [← Set.preimage_comp, h]
lemma isEmbedding_of_isOpenQuotientMap_of_isInducing
(h : g ∘ p = q ∘ f)
(hf : IsInducing f) (hp : IsQuotientMap p)
(hq : IsOpenQuotientMap q) (hg : Function.Injective g)
(H : q ⁻¹' (q '' (Set.range f)) ⊆ Set.range f) :
IsEmbedding g :=
⟨⟨hp.eq_coinduced.trans (coinduced_eq_induced_of_isOpenQuotientMap_of_isInducing
f g p q h hf hp.surjective hq hg H)⟩, hg⟩
lemma isQuotientMap_of_isOpenQuotientMap_of_isInducing
(h : g ∘ p = q ∘ f)
(hf : IsInducing f) (hp : Surjective p)
(hq : IsOpenQuotientMap q) (hg : IsEmbedding g)
(H : q ⁻¹' (q '' (Set.range f)) ⊆ Set.range f) :
IsQuotientMap p :=
⟨hp, hg.eq_induced.trans ((coinduced_eq_induced_of_isOpenQuotientMap_of_isInducing
f g p q h hf hp hq hg.injective H)).symm⟩
end Subquotient |
.lake/packages/mathlib/Mathlib/Topology/Maps/Proper/CompactlyGenerated.lean | import Mathlib.Topology.Compactness.CompactlyGeneratedSpace
import Mathlib.Topology.Maps.Proper.Basic
/-!
# A map is proper iff preimage of compact sets are compact
This file proves that if `Y` is a Hausdorff and compactly generated space, a continuous map
`f : X → Y` is proper if and only if preimage of compact sets are compact.
-/
open Set Filter
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
variable [T2Space Y] [CompactlyGeneratedSpace Y]
variable {f : X → Y}
/-- If `Y` is Hausdorff and compactly generated, then proper maps `X → Y` are exactly
continuous maps such that the preimage of any compact set is compact. This is in particular true
if `Y` is Hausdorff and sequential or locally compact.
There was an older version of this theorem which was changed to this one to make use
of the `CompactlyGeneratedSpace` typeclass. (since 2024-11-10) -/
theorem isProperMap_iff_isCompact_preimage :
IsProperMap f ↔ Continuous f ∧ ∀ ⦃K⦄, IsCompact K → IsCompact (f ⁻¹' K) where
mp hf := ⟨hf.continuous, fun _ ↦ hf.isCompact_preimage⟩
mpr := fun ⟨hf, h⟩ ↦ isProperMap_iff_isClosedMap_and_compact_fibers.2
⟨hf, fun _ hs ↦ CompactlyGeneratedSpace.isClosed
fun _ hK ↦ image_inter_preimage .. ▸ (((h hK).inter_left hs).image hf).isClosed,
fun _ ↦ h isCompact_singleton⟩
/-- Version of `isProperMap_iff_isCompact_preimage` in terms of `cocompact`.
There was an older version of this theorem which was changed to this one to make use
of the `CompactlyGeneratedSpace` typeclass. (since 2024-11-10) -/
lemma isProperMap_iff_tendsto_cocompact :
IsProperMap f ↔ Continuous f ∧ Tendsto f (cocompact X) (cocompact Y) := by
simp_rw [isProperMap_iff_isCompact_preimage,
hasBasis_cocompact.tendsto_right_iff, ← mem_preimage, eventually_mem_set, preimage_compl]
refine and_congr_right fun f_cont ↦
⟨fun H K hK ↦ (H hK).compl_mem_cocompact, fun H K hK ↦ ?_⟩
rcases mem_cocompact.mp (H K hK) with ⟨K', hK', hK'y⟩
exact hK'.of_isClosed_subset (hK.isClosed.preimage f_cont)
(compl_le_compl_iff_le.mp hK'y) |
.lake/packages/mathlib/Mathlib/Topology/Maps/Proper/Basic.lean | import Mathlib.Topology.Homeomorph.Lemmas
/-!
# Proper maps between topological spaces
This file develops the basic theory of proper maps between topological spaces. A map `f : X → Y`
between two topological spaces is said to be **proper** if it is continuous and satisfies
the following equivalent conditions:
1. `f` is closed and has compact fibers.
2. `f` is **universally closed**, in the sense that for any topological space `Z`, the map
`Prod.map f id : X × Z → Y × Z` is closed.
3. For any `ℱ : Filter X`, all cluster points of `map f ℱ` are images by `f` of some cluster point
of `ℱ`.
We take 3 as the definition in `IsProperMap`, and we show the equivalence with 1, 2, and some
other variations.
## Main statements
* `isProperMap_iff_ultrafilter`: characterization of proper maps in terms of limits of ultrafilters
instead of cluster points of filters.
* `IsProperMap.pi_map`: any product of proper maps is proper.
* `isProperMap_iff_isClosedMap_and_compact_fibers`: a map is proper if and only if it is
continuous, closed, and has compact fibers
## Implementation notes
In algebraic geometry, it is common to also ask that proper maps are *separated*, in the sense of
[Stacks: definition OCY1](https://stacks.math.columbia.edu/tag/0CY1). We don't follow this
convention because it is unclear whether it would give the right notion in all cases, and in
particular for the theory of proper group actions. That means that our terminology does **NOT**
align with that of [Stacks: Characterizing proper maps](https://stacks.math.columbia.edu/tag/005M),
instead our definition of `IsProperMap` coincides with what they call "Bourbaki-proper".
Regarding the proofs, we don't really follow Bourbaki and go for more filter-heavy proofs,
as usual. In particular, their arguments rely heavily on restriction of closed maps (see
`IsClosedMap.restrictPreimage`), which makes them somehow annoying to formalize in type theory.
In contrast, the filter-based proofs work really well thanks to the existing API.
In fact, the filter proofs work so well that I thought this would be a great pedagogical resource
about how we use filters. For that reason, **all interesting proofs in this file are commented**,
so don't hesitate to have a look!
## TODO
* prove the equivalence with condition 3 of
[Stacks: Theorem 005R](https://stacks.math.columbia.edu/tag/005R). Note that they mean something
different by "universally closed".
## References
* [N. Bourbaki, *General Topology*][bourbaki1966]
* [Stacks: Characterizing proper maps](https://stacks.math.columbia.edu/tag/005M)
-/
assert_not_exists StoneCech
open Filter Topology Function Set
open Prod (fst snd)
variable {X Y Z W ι : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
[TopologicalSpace W] {f : X → Y} {g : Y → Z}
/-- A map `f : X → Y` between two topological spaces is said to be **proper** if it is continuous
and, for all `ℱ : Filter X`, any cluster point of `map f ℱ` is the image by `f` of a cluster point
of `ℱ`. -/
@[mk_iff isProperMap_iff_clusterPt, fun_prop]
structure IsProperMap (f : X → Y) : Prop extends Continuous f where
/-- By definition, if `f` is a proper map and `ℱ` is any filter on `X`, then any cluster point of
`map f ℱ` is the image by `f` of some cluster point of `ℱ`. -/
clusterPt_of_mapClusterPt :
∀ ⦃ℱ : Filter X⦄, ∀ ⦃y : Y⦄, MapClusterPt y ℱ f → ∃ x, f x = y ∧ ClusterPt x ℱ
/-- Definition of proper maps. See also `isClosedMap_iff_clusterPt` for a related criterion
for closed maps. -/
add_decl_doc isProperMap_iff_clusterPt
/-- By definition, a proper map is continuous. -/
@[fun_prop]
lemma IsProperMap.continuous (h : IsProperMap f) : Continuous f := h.toContinuous
/-- A proper map is closed. -/
lemma IsProperMap.isClosedMap (h : IsProperMap f) : IsClosedMap f := by
rw [isClosedMap_iff_clusterPt]
exact fun s y ↦ h.clusterPt_of_mapClusterPt (ℱ := 𝓟 s) (y := y)
/-- Characterization of proper maps by ultrafilters. -/
lemma isProperMap_iff_ultrafilter : IsProperMap f ↔ Continuous f ∧
∀ ⦃𝒰 : Ultrafilter X⦄, ∀ ⦃y : Y⦄, Tendsto f 𝒰 (𝓝 y) → ∃ x, f x = y ∧ 𝒰 ≤ 𝓝 x := by
-- This is morally trivial since ultrafilters give all the information about cluster points.
rw [isProperMap_iff_clusterPt]
refine and_congr_right (fun _ ↦ ?_)
constructor <;> intro H
· intro 𝒰 y (hY : (Ultrafilter.map f 𝒰 : Filter Y) ≤ _)
simp_rw [← Ultrafilter.clusterPt_iff] at hY ⊢
exact H hY
· simp_rw [MapClusterPt, ClusterPt, ← Filter.push_pull', map_neBot_iff, ← exists_ultrafilter_iff,
forall_exists_index]
intro ℱ y 𝒰 hy
rcases H (tendsto_iff_comap.mpr <| hy.trans inf_le_left) with ⟨x, hxy, hx⟩
exact ⟨x, hxy, 𝒰, le_inf hx (hy.trans inf_le_right)⟩
lemma isProperMap_iff_ultrafilter_of_t2 [T2Space Y] : IsProperMap f ↔ Continuous f ∧
∀ ⦃𝒰 : Ultrafilter X⦄, ∀ ⦃y : Y⦄, Tendsto f 𝒰 (𝓝 y) → ∃ x, 𝒰.1 ≤ 𝓝 x :=
isProperMap_iff_ultrafilter.trans <| and_congr_right fun hc ↦ forall₃_congr fun _𝒰 _y hy ↦
exists_congr fun x ↦ and_iff_right_of_imp fun h ↦
tendsto_nhds_unique ((hc.tendsto x).mono_left h) hy
/-- If `f` is proper and converges to `y` along some ultrafilter `𝒰`, then `𝒰` converges to some
`x` such that `f x = y`. -/
lemma IsProperMap.ultrafilter_le_nhds_of_tendsto (h : IsProperMap f) ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄
(hy : Tendsto f 𝒰 (𝓝 y)) : ∃ x, f x = y ∧ 𝒰 ≤ 𝓝 x :=
(isProperMap_iff_ultrafilter.mp h).2 hy
/-- The composition of two proper maps is proper. -/
lemma IsProperMap.comp (hg : IsProperMap g) (hf : IsProperMap f) :
IsProperMap (g ∘ f) := by
refine ⟨by fun_prop, fun ℱ z h ↦ ?_⟩
rw [mapClusterPt_comp] at h
rcases hg.clusterPt_of_mapClusterPt h with ⟨y, rfl, hy⟩
rcases hf.clusterPt_of_mapClusterPt hy with ⟨x, rfl, hx⟩
use x, rfl
/-- If the composition of two continuous functions `g ∘ f` is proper and `f` is surjective,
then `g` is proper. -/
lemma isProperMap_of_comp_of_surj (hf : Continuous f)
(hg : Continuous g) (hgf : IsProperMap (g ∘ f)) (f_surj : f.Surjective) : IsProperMap g := by
refine ⟨hg, fun ℱ z h ↦ ?_⟩
rw [← ℱ.map_comap_of_surjective f_surj, ← mapClusterPt_comp] at h
rcases hgf.clusterPt_of_mapClusterPt h with ⟨x, rfl, hx⟩
rw [← ℱ.map_comap_of_surjective f_surj]
exact ⟨f x, rfl, hx.map hf.continuousAt tendsto_map⟩
/-- If the composition of two continuous functions `g ∘ f` is proper and `g` is injective,
then `f` is proper. -/
lemma isProperMap_of_comp_of_inj {f : X → Y} {g : Y → Z} (hf : Continuous f) (hg : Continuous g)
(hgf : IsProperMap (g ∘ f)) (g_inj : g.Injective) : IsProperMap f := by
refine ⟨hf, fun ℱ y h ↦ ?_⟩
rcases hgf.clusterPt_of_mapClusterPt (h.map hg.continuousAt tendsto_map) with ⟨x, hx1, hx2⟩
exact ⟨x, g_inj hx1, hx2⟩
/-- If the composition of two continuous functions `f : X → Y` and `g : Y → Z` is proper
and `Y` is T2, then `f` is proper. -/
lemma isProperMap_of_comp_of_t2 [T2Space Y] (hf : Continuous f) (hg : Continuous g)
(hgf : IsProperMap (g ∘ f)) : IsProperMap f := by
rw [isProperMap_iff_ultrafilter_of_t2]
refine ⟨hf, fun 𝒰 y h ↦ ?_⟩
rw [isProperMap_iff_ultrafilter] at hgf
rcases hgf.2 ((hg.tendsto y).comp h) with ⟨x, -, hx⟩
exact ⟨x, hx⟩
/-- A binary product of proper maps is proper. -/
lemma IsProperMap.prodMap {g : Z → W} (hf : IsProperMap f) (hg : IsProperMap g) :
IsProperMap (Prod.map f g) := by
simp_rw [isProperMap_iff_ultrafilter] at hf hg ⊢
constructor
-- Continuity is clear.
· exact hf.1.prodMap hg.1
-- Let `𝒰 : Ultrafilter (X × Z)`, and assume that `f × g` tends to some `(y, w) : Y × W`
-- along `𝒰`.
· intro 𝒰 ⟨y, w⟩ hyw
-- That means that `f` tends to `y` along `map fst 𝒰` and `g` tends to `w` along `map snd 𝒰`.
simp_rw [nhds_prod_eq, tendsto_prod_iff'] at hyw
-- Thus, by properness of `f` and `g`, we get some `x : X` and `z : Z` such that `f x = y`,
-- `g z = w`, `map fst 𝒰` tends to `x`, and `map snd 𝒰` tends to `y`.
rcases hf.2 (show Tendsto f (Ultrafilter.map fst 𝒰) (𝓝 y) by simpa using hyw.1) with
⟨x, hxy, hx⟩
rcases hg.2 (show Tendsto g (Ultrafilter.map snd 𝒰) (𝓝 w) by simpa using hyw.2) with
⟨z, hzw, hz⟩
-- By the properties of the product topology, that means that `𝒰` tends to `(x, z)`,
-- which completes the proof since `(f × g)(x, z) = (y, w)`.
refine ⟨⟨x, z⟩, Prod.ext hxy hzw, ?_⟩
rw [nhds_prod_eq, le_prod]
exact ⟨hx, hz⟩
/-- Any product of proper maps is proper. -/
lemma IsProperMap.pi_map {X Y : ι → Type*} [∀ i, TopologicalSpace (X i)]
[∀ i, TopologicalSpace (Y i)] {f : (i : ι) → X i → Y i} (h : ∀ i, IsProperMap (f i)) :
IsProperMap (fun (x : ∀ i, X i) i ↦ f i (x i)) := by
simp_rw [isProperMap_iff_ultrafilter] at h ⊢
constructor
-- Continuity is clear.
· exact continuous_pi fun i ↦ (h i).1.comp (continuous_apply i)
-- Let `𝒰 : Ultrafilter (Π i, X i)`, and assume that `Π i, f i` tends to some `y : Π i, Y i`
-- along `𝒰`.
· intro 𝒰 y hy
-- That means that each `f i` tends to `y i` along `map (eval i) 𝒰`.
have : ∀ i, Tendsto (f i) (Ultrafilter.map (eval i) 𝒰) (𝓝 (y i)) := by
simpa [tendsto_pi_nhds] using hy
-- Thus, by properness of all the `f i`s, we can choose some `x : Π i, X i` such that, for all
-- `i`, `f i (x i) = y i` and `map (eval i) 𝒰` tends to `x i`.
choose x hxy hx using fun i ↦ (h i).2 (this i)
-- By the properties of the product topology, that means that `𝒰` tends to `x`,
-- which completes the proof since `(Π i, f i) x = y`.
refine ⟨x, funext hxy, ?_⟩
rwa [nhds_pi, le_pi]
/-- The preimage of a compact set by a proper map is again compact. See also
`isProperMap_iff_isCompact_preimage` which proves that this property completely characterizes
proper map when the codomain is compactly generated and Hausdorff. -/
lemma IsProperMap.isCompact_preimage (h : IsProperMap f) {K : Set Y} (hK : IsCompact K) :
IsCompact (f ⁻¹' K) := by
rw [isCompact_iff_ultrafilter_le_nhds]
-- Let `𝒰 ≤ 𝓟 (f ⁻¹' K)` an ultrafilter.
intro 𝒰 h𝒰
-- In other words, we have `map f 𝒰 ≤ 𝓟 K`
rw [← comap_principal, ← map_le_iff_le_comap, ← Ultrafilter.coe_map] at h𝒰
-- Thus, by compactness of `K`, the ultrafilter `map f 𝒰` tends to some `y ∈ K`.
rcases hK.ultrafilter_le_nhds _ h𝒰 with ⟨y, hyK, hy⟩
-- Then, by properness of `f`, that means that `𝒰` tends to some `x ∈ f ⁻¹' {y} ⊆ f ⁻¹' K`,
-- which completes the proof.
rcases h.ultrafilter_le_nhds_of_tendsto hy with ⟨x, rfl, hx⟩
exact ⟨x, hyK, hx⟩
/-- A map is proper if and only if it is closed and its fibers are compact. -/
theorem isProperMap_iff_isClosedMap_and_compact_fibers :
IsProperMap f ↔ Continuous f ∧ IsClosedMap f ∧ ∀ y, IsCompact (f ⁻¹' {y}) := by
constructor <;> intro H
-- Note: In Bourbaki, the direct implication is proved by going through universally closed maps.
-- We could do the same (using a `TFAE` cycle) but proving it directly from
-- `IsProperMap.isCompact_preimage` is nice enough already so we don't bother with that.
· exact ⟨H.continuous, H.isClosedMap, fun y ↦ H.isCompact_preimage isCompact_singleton⟩
· rw [isProperMap_iff_clusterPt]
-- Let `ℱ : Filter X` and `y` some cluster point of `map f ℱ`.
refine ⟨H.1, fun ℱ y hy ↦ ?_⟩
-- That means that the singleton `pure y` meets the "closure" of `map f ℱ`, by which we mean
-- `Filter.lift' (map f ℱ) closure`. But `f` is closed, so
-- `closure (map f ℱ) = map f (closure ℱ)` (see `IsClosedMap.lift'_closure_map_eq`).
-- Thus `map f (closure ℱ ⊓ 𝓟 (f ⁻¹' {y})) = map f (closure ℱ) ⊓ 𝓟 {y} ≠ ⊥`, hence
-- `closure ℱ ⊓ 𝓟 (f ⁻¹' {y}) ≠ ⊥`.
rw [H.2.1.mapClusterPt_iff_lift'_closure H.1] at hy
-- Now, applying the compactness of `f ⁻¹' {y}` to the nontrivial filter
-- `closure ℱ ⊓ 𝓟 (f ⁻¹' {y})`, we obtain that it has a cluster point `x ∈ f ⁻¹' {y}`.
rcases H.2.2 y (f := Filter.lift' ℱ closure ⊓ 𝓟 (f ⁻¹' {y})) inf_le_right with ⟨x, hxy, hx⟩
refine ⟨x, hxy, ?_⟩
-- In particular `x` is a cluster point of `closure ℱ`. Since cluster points of `closure ℱ`
-- are exactly cluster points of `ℱ` (see `clusterPt_lift'_closure_iff`), this completes
-- the proof.
rw [← clusterPt_lift'_closure_iff]
exact hx.mono inf_le_left
/-- An injective and continuous function is proper if and only if it is closed. -/
lemma isProperMap_iff_isClosedMap_of_inj (f_cont : Continuous f) (f_inj : f.Injective) :
IsProperMap f ↔ IsClosedMap f := by
refine ⟨fun h ↦ h.isClosedMap, fun h ↦ ?_⟩
rw [isProperMap_iff_isClosedMap_and_compact_fibers]
exact ⟨f_cont, h, fun y ↦ (subsingleton_singleton.preimage f_inj).isCompact⟩
/-- A injective continuous and closed map is proper. -/
lemma isProperMap_of_isClosedMap_of_inj (f_cont : Continuous f) (f_inj : f.Injective)
(f_closed : IsClosedMap f) : IsProperMap f :=
(isProperMap_iff_isClosedMap_of_inj f_cont f_inj).2 f_closed
/-- A homeomorphism is proper. -/
@[simp] lemma Homeomorph.isProperMap (e : X ≃ₜ Y) : IsProperMap e :=
isProperMap_of_isClosedMap_of_inj e.continuous e.injective e.isClosedMap
protected lemma IsHomeomorph.isProperMap (hf : IsHomeomorph f) : IsProperMap f :=
isProperMap_of_isClosedMap_of_inj hf.continuous hf.injective hf.isClosedMap
/-- The identity is proper. -/
@[simp] lemma isProperMap_id : IsProperMap (id : X → X) := IsHomeomorph.id.isProperMap
/-- A closed embedding is proper. -/
lemma Topology.IsClosedEmbedding.isProperMap (hf : IsClosedEmbedding f) : IsProperMap f :=
isProperMap_of_isClosedMap_of_inj hf.continuous hf.injective hf.isClosedMap
/-- The coercion from a closed subset is proper. -/
lemma IsClosed.isProperMap_subtypeVal {C : Set X} (hC : IsClosed C) : IsProperMap ((↑) : C → X) :=
hC.isClosedEmbedding_subtypeVal.isProperMap
/-- The restriction of a proper map to a closed subset is proper. -/
lemma IsProperMap.restrict {C : Set X} (hf : IsProperMap f) (hC : IsClosed C) :
IsProperMap fun x : C ↦ f x := hf.comp hC.isProperMap_subtypeVal
/-- The range of a proper map is closed. -/
lemma IsProperMap.isClosed_range (hf : IsProperMap f) : IsClosed (range f) :=
hf.isClosedMap.isClosed_range
/-- Version of `isProperMap_iff_isClosedMap_and_compact_fibers` in terms of `cofinite` and
`cocompact`. Only works when the codomain is `T1`. -/
lemma isProperMap_iff_isClosedMap_and_tendsto_cofinite [T1Space Y] :
IsProperMap f ↔ Continuous f ∧ IsClosedMap f ∧ Tendsto f (cocompact X) cofinite := by
simp_rw [isProperMap_iff_isClosedMap_and_compact_fibers, Tendsto,
le_cofinite_iff_compl_singleton_mem, mem_map, preimage_compl]
refine and_congr_right fun f_cont ↦ and_congr_right fun _ ↦
⟨fun H y ↦ (H y).compl_mem_cocompact, fun H y ↦ ?_⟩
rcases mem_cocompact.mp (H y) with ⟨K, hK, hKy⟩
exact hK.of_isClosed_subset (isClosed_singleton.preimage f_cont)
(compl_le_compl_iff_le.mp hKy)
/-- A continuous map from a compact space to a T₂ space is a proper map. -/
theorem Continuous.isProperMap [CompactSpace X] [T2Space Y] (hf : Continuous f) : IsProperMap f :=
isProperMap_iff_isClosedMap_and_tendsto_cofinite.2 ⟨hf, hf.isClosedMap, by simp⟩
/-- A constant map to a T₁ space is proper if and only if its domain is compact. -/
theorem isProperMap_const_iff [T1Space Y] (y : Y) :
IsProperMap (fun _ : X ↦ y) ↔ CompactSpace X := by
classical
rw [isProperMap_iff_isClosedMap_and_compact_fibers]
constructor
· rintro ⟨-, -, h⟩
exact ⟨by simpa using h y⟩
· intro H
refine ⟨continuous_const, isClosedMap_const, fun y' ↦ ?_⟩
simp [preimage_const, mem_singleton_iff, apply_ite, isCompact_univ]
theorem isProperMap_const [h : CompactSpace X] [T1Space Y] (y : Y) :
IsProperMap (fun _ : X ↦ y) :=
isProperMap_const_iff y |>.mpr h
/-- If `Y` is a compact topological space, then `Prod.fst : X × Y → X` is a proper map. -/
theorem isProperMap_fst_of_compactSpace [CompactSpace Y] :
IsProperMap (Prod.fst : X × Y → X) :=
Homeomorph.prodPUnit X |>.isProperMap.comp (isProperMap_id.prodMap (isProperMap_const ()))
/-- If `X` is a compact topological space, then `Prod.snd : X × Y → Y` is a proper map. -/
theorem isProperMap_snd_of_compactSpace [CompactSpace X] :
IsProperMap (Prod.snd : X × Y → Y) :=
Homeomorph.punitProd Y |>.isProperMap.comp ((isProperMap_const ()).prodMap isProperMap_id)
/-- If `Y` is a compact topological space, then `Prod.fst : X × Y → X` is a closed map. -/
theorem isClosedMap_fst_of_compactSpace [CompactSpace Y] :
IsClosedMap (Prod.fst : X × Y → X) :=
isProperMap_fst_of_compactSpace.isClosedMap
/-- If `X` is a compact topological space, then `Prod.snd : X × Y → Y` is a closed map. -/
theorem isClosedMap_snd_of_compactSpace [CompactSpace X] :
IsClosedMap (Prod.snd : X × Y → Y) :=
isProperMap_snd_of_compactSpace.isClosedMap
/-- A proper map `f : X → Y` is **universally closed**: for any topological space `Z`, the map
`Prod.map f id : X × Z → Y × Z` is closed. We will prove in `isProperMap_iff_universally_closed`
that proper maps are exactly continuous maps which have this property, but this result should be
easier to use because it allows `Z` to live in any universe. -/
theorem IsProperMap.universally_closed (Z) [TopologicalSpace Z] (h : IsProperMap f) :
IsClosedMap (Prod.map f id : X × Z → Y × Z) :=
-- `f × id` is proper as a product of proper maps, hence closed.
(h.prodMap isProperMap_id).isClosedMap |
.lake/packages/mathlib/Mathlib/Topology/Maps/Proper/UniversallyClosed.lean | import Mathlib.Topology.Compactification.StoneCech
import Mathlib.Topology.Filter
import Mathlib.Topology.Maps.Proper.Basic
/-!
# A map is proper iff it is continuous and universally closed
-/
open Filter
universe u v
/-- A map `f : X → Y` is proper if and only if it is continuous and the map
`(Prod.map f id : X × Filter X → Y × Filter X)` is closed. This is stronger than
`isProperMap_iff_universally_closed` since it shows that there's only one space to check to get
properness, but in most cases it doesn't matter. -/
theorem isProperMap_iff_isClosedMap_filter {X : Type u} {Y : Type v} [TopologicalSpace X]
[TopologicalSpace Y] {f : X → Y} :
IsProperMap f ↔ Continuous f ∧ IsClosedMap
(Prod.map f id : X × Filter X → Y × Filter X) := by
constructor <;> intro H
-- The direct implication is clear.
· exact ⟨H.continuous, H.universally_closed _⟩
· rw [isProperMap_iff_ultrafilter]
-- Let `𝒰 : Ultrafilter X`, and assume that `f` tends to some `y` along `𝒰`.
refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩
-- In `X × Filter X`, consider the closed set `F := closure {(x, ℱ) | ℱ = pure x}`
let F : Set (X × Filter X) := closure {xℱ | xℱ.2 = pure xℱ.1}
-- Since `f × id` is closed, the set `(f × id) '' F` is also closed.
have := H.2 F isClosed_closure
-- Let us show that `(y, 𝒰) ∈ (f × id) '' F`.
have : (y, ↑𝒰) ∈ Prod.map f id '' F :=
-- Note that, by the properties of the topology on `Filter X`, the function `pure : X → Filter X`
-- tends to the point `𝒰` of `Filter X` along the filter `𝒰` on `X`. Since `f` tends to `y` along
-- `𝒰`, we get that the function `(f, pure) : X → (Y, Filter X)` tends to `(y, 𝒰)` along
-- `𝒰`. Furthermore, each `(f, pure)(x) = (f × id)(x, pure x)` is clearly an element of
-- the closed set `(f × id) '' F`, thus the limit `(y, 𝒰)` also belongs to that set.
this.mem_of_tendsto (hy.prodMk_nhds (Filter.tendsto_pure_self (𝒰 : Filter X)))
(Eventually.of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩)
-- The above shows that `(y, 𝒰) = (f x, 𝒰)`, for some `x : X` such that `(x, 𝒰) ∈ F`.
rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩
-- We already know that `f x = y`, so to finish the proof we just have to check that `𝒰` tends
-- to `x`. So, for `U ∈ 𝓝 x` arbitrary, let's show that `U ∈ 𝒰`. Since `𝒰` is a ultrafilter,
-- it is enough to show that `Uᶜ` is not in `𝒰`.
refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_notMem_iff.mp fun hUc ↦ ?_⟩
rw [mem_closure_iff_nhds] at hx
-- Indeed, if that was the case, the set `V := {𝒢 : Filter X | Uᶜ ∈ 𝒢}` would be a neighborhood
-- of `𝒰` in `Filter X`, hence `U ×ˢ V` would be a neighborhood of `(x, 𝒰) : X × Filter X`.
-- But recall that `(x, 𝒰) ∈ F = closure {(x, ℱ) | ℱ = pure x}`, so the neighborhood `U ×ˢ V`
-- must contain some element of the form `(z, pure z)`. In other words, we have `z ∈ U` and
-- `Uᶜ ∈ pure z`, which means `z ∈ Uᶜ` by the definition of pure.
-- This is a contradiction, which completes the proof.
rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU (isOpen_setOf_mem.mem_nhds hUc)) with
⟨⟨z, 𝒢⟩, ⟨⟨hz : z ∈ U, hz' : Uᶜ ∈ 𝒢⟩, rfl : 𝒢 = pure z⟩⟩
exact hz' hz
/-- A map `f : X → Y` is proper if and only if it is continuous and the map
`(Prod.map f id : X × Ultrafilter X → Y × Ultrafilter X)` is closed. This is stronger than
`isProperMap_iff_universally_closed` since it shows that there's only one space to check to get
properness, but in most cases it doesn't matter. -/
theorem isProperMap_iff_isClosedMap_ultrafilter {X : Type u} {Y : Type v} [TopologicalSpace X]
[TopologicalSpace Y] {f : X → Y} :
IsProperMap f ↔ Continuous f ∧ IsClosedMap
(Prod.map f id : X × Ultrafilter X → Y × Ultrafilter X) := by
-- The proof is basically the same as above.
constructor <;> intro H
· exact ⟨H.continuous, H.universally_closed _⟩
· rw [isProperMap_iff_ultrafilter]
refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩
let F : Set (X × Ultrafilter X) := closure {xℱ | xℱ.2 = pure xℱ.1}
have := H.2 F isClosed_closure
have : (y, 𝒰) ∈ Prod.map f id '' F :=
this.mem_of_tendsto (hy.prodMk_nhds (Ultrafilter.tendsto_pure_self 𝒰))
(Eventually.of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩)
rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩
refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_notMem_iff.mp fun hUc ↦ ?_⟩
rw [mem_closure_iff_nhds] at hx
rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU ((ultrafilter_isOpen_basic _).mem_nhds hUc))
with ⟨⟨y, 𝒢⟩, ⟨⟨hy : y ∈ U, hy' : Uᶜ ∈ 𝒢⟩, rfl : 𝒢 = pure y⟩⟩
exact hy' hy
/-- A map `f : X → Y` is proper if and only if it is continuous and **universally closed**, in the
sense that for any topological space `Z`, the map `Prod.map f id : X × Z → Y × Z` is closed. Note
that `Z` lives in the same universe as `X` here, but `IsProperMap.universally_closed` does not
have this restriction.
This is taken as the definition of properness in
[N. Bourbaki, *General Topology*][bourbaki1966]. -/
theorem isProperMap_iff_universally_closed {X : Type u} {Y : Type v} [TopologicalSpace X]
[TopologicalSpace Y] {f : X → Y} :
IsProperMap f ↔ Continuous f ∧ ∀ (Z : Type u) [TopologicalSpace Z],
IsClosedMap (Prod.map f id : X × Z → Y × Z) := by
constructor <;> intro H
· exact ⟨H.continuous, fun Z ↦ H.universally_closed _⟩
· rw [isProperMap_iff_isClosedMap_ultrafilter]
exact ⟨H.1, H.2 _⟩ |
.lake/packages/mathlib/Mathlib/Topology/Order/IsLocallyClosed.lean | import Mathlib.Topology.Order.OrderClosed
import Mathlib.Topology.LocallyClosed
/-!
# Intervals are locally closed
We prove that the intervals on a topological ordered space are locally closed.
-/
variable {X : Type*} [TopologicalSpace X] {a b : X}
theorem isLocallyClosed_Icc [Preorder X] [OrderClosedTopology X] :
IsLocallyClosed (Set.Icc a b) :=
isClosed_Icc.isLocallyClosed
theorem isLocallyClosed_Ioo [LinearOrder X] [OrderClosedTopology X] :
IsLocallyClosed (Set.Ioo a b) :=
isOpen_Ioo.isLocallyClosed
theorem isLocallyClosed_Ici [Preorder X] [ClosedIciTopology X] :
IsLocallyClosed (Set.Ici a) :=
isClosed_Ici.isLocallyClosed
theorem isLocallyClosed_Iic [Preorder X] [ClosedIicTopology X] :
IsLocallyClosed (Set.Iic a) :=
isClosed_Iic.isLocallyClosed
theorem isLocallyClosed_Ioi [LinearOrder X] [ClosedIicTopology X] :
IsLocallyClosed (Set.Ioi a) :=
isOpen_Ioi.isLocallyClosed
theorem isLocallyClosed_Iio [LinearOrder X] [ClosedIciTopology X] :
IsLocallyClosed (Set.Iio a) :=
isOpen_Iio.isLocallyClosed
theorem isLocallyClosed_Ioc [LinearOrder X] [ClosedIicTopology X] :
IsLocallyClosed (Set.Ioc a b) := by
rw [← Set.Iic_inter_Ioi]
exact isLocallyClosed_Iic.inter isLocallyClosed_Ioi
theorem isLocallyClosed_Ico [LinearOrder X] [ClosedIciTopology X] :
IsLocallyClosed (Set.Ico a b) := by
rw [← Set.Iio_inter_Ici]
exact isLocallyClosed_Iio.inter isLocallyClosed_Ici |
.lake/packages/mathlib/Mathlib/Topology/Order/MonotoneContinuity.lean | import Mathlib.Topology.Homeomorph.Defs
import Mathlib.Topology.Order.LeftRightNhds
/-!
# Continuity of monotone functions
In this file we prove the following fact: if `f` is a monotone function on a neighborhood of `a`
and the image of this neighborhood is a neighborhood of `f a`, then `f` is continuous at `a`, see
`continuousWithinAt_of_monotoneOn_of_image_mem_nhds`, as well as several similar facts.
We also prove that an `OrderIso` is continuous.
## Tags
continuous, monotone
-/
open Set Filter
open Topology
section LinearOrder
variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
variable [LinearOrder β] [TopologicalSpace β] [OrderTopology β]
/-- If `f` is a function strictly monotone on a right neighborhood of `a` and the
image of this neighborhood under `f` meets every interval `(f a, b]`, `b > f a`, then `f` is
continuous at `a` from the right.
The assumption `hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b` is required because otherwise the
function `f : ℝ → ℝ` given by `f x = if x ≤ 0 then x else x + 1` would be a counter-example at
`a = 0`. -/
theorem StrictMonoOn.continuousWithinAt_right_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b) :
ContinuousWithinAt f (Ici a) a := by
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
((h_mono.le_iff_le has hxs).2 hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
rw [h_mono.lt_iff_lt has hcs] at hac
filter_upwards [hs, Ico_mem_nhdsGE hac]
rintro x hx ⟨_, hxc⟩
exact ((h_mono.lt_iff_lt hx hcs).2 hxc).trans_le hcb
/-- If `f` is a monotone function on a right neighborhood of `a` and the image of this neighborhood
under `f` meets every interval `(f a, b)`, `b > f a`, then `f` is continuous at `a` from the right.
The assumption `hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioo (f a) b` cannot be replaced by the weaker
assumption `hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b` we use for strictly monotone functions
because otherwise the function `ceil : ℝ → ℤ` would be a counter-example at `a = 0`. -/
theorem continuousWithinAt_right_of_monotoneOn_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : MonotoneOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioo (f a) b) :
ContinuousWithinAt f (Ici a) a := by
have ha : a ∈ Ici a := left_mem_Ici
have has : a ∈ s := mem_of_mem_nhdsWithin ha hs
refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩
· filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le
(h_mono has hxs hxa)
· rcases hfs b hb with ⟨c, hcs, hac, hcb⟩
have : a < c := not_le.1 fun h => hac.not_ge <| h_mono hcs has h
filter_upwards [hs, Ico_mem_nhdsGE this]
rintro x hx ⟨_, hxc⟩
exact (h_mono hx hcs hxc.le).trans_lt hcb
/-- If a function `f` with a densely ordered codomain is monotone on a right neighborhood of `a` and
the closure of the image of this neighborhood under `f` is a right neighborhood of `f a`, then `f`
is continuous at `a` from the right. -/
theorem continuousWithinAt_right_of_monotoneOn_of_closure_image_mem_nhdsWithin [DenselyOrdered β]
{f : α → β} {s : Set α} {a : α} (h_mono : MonotoneOn f s) (hs : s ∈ 𝓝[≥] a)
(hfs : closure (f '' s) ∈ 𝓝[≥] f a) : ContinuousWithinAt f (Ici a) a := by
refine continuousWithinAt_right_of_monotoneOn_of_exists_between h_mono hs fun b hb => ?_
rcases (mem_nhdsGE_iff_exists_mem_Ioc_Ico_subset hb).1 hfs with ⟨b', ⟨hab', hbb'⟩, hb'⟩
rcases exists_between hab' with ⟨c', hc'⟩
rcases mem_closure_iff.1 (hb' ⟨hc'.1.le, hc'.2⟩) (Ioo (f a) b') isOpen_Ioo hc' with
⟨_, hc, ⟨c, hcs, rfl⟩⟩
exact ⟨c, hcs, hc.1, hc.2.trans_le hbb'⟩
/-- If a function `f` with a densely ordered codomain is monotone on a right neighborhood of `a` and
the image of this neighborhood under `f` is a right neighborhood of `f a`, then `f` is continuous at
`a` from the right. -/
theorem continuousWithinAt_right_of_monotoneOn_of_image_mem_nhdsWithin [DenselyOrdered β]
{f : α → β} {s : Set α} {a : α} (h_mono : MonotoneOn f s) (hs : s ∈ 𝓝[≥] a)
(hfs : f '' s ∈ 𝓝[≥] f a) : ContinuousWithinAt f (Ici a) a :=
continuousWithinAt_right_of_monotoneOn_of_closure_image_mem_nhdsWithin h_mono hs <|
mem_of_superset hfs subset_closure
/-- If a function `f` with a densely ordered codomain is strictly monotone on a right neighborhood
of `a` and the closure of the image of this neighborhood under `f` is a right neighborhood of `f a`,
then `f` is continuous at `a` from the right. -/
theorem StrictMonoOn.continuousWithinAt_right_of_closure_image_mem_nhdsWithin [DenselyOrdered β]
{f : α → β} {s : Set α} {a : α} (h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a)
(hfs : closure (f '' s) ∈ 𝓝[≥] f a) : ContinuousWithinAt f (Ici a) a :=
continuousWithinAt_right_of_monotoneOn_of_closure_image_mem_nhdsWithin
(fun _ hx _ hy => (h_mono.le_iff_le hx hy).2) hs hfs
/-- If a function `f` with a densely ordered codomain is strictly monotone on a right neighborhood
of `a` and the image of this neighborhood under `f` is a right neighborhood of `f a`, then `f` is
continuous at `a` from the right. -/
theorem StrictMonoOn.continuousWithinAt_right_of_image_mem_nhdsWithin [DenselyOrdered β] {f : α → β}
{s : Set α} {a : α} (h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : f '' s ∈ 𝓝[≥] f a) :
ContinuousWithinAt f (Ici a) a :=
h_mono.continuousWithinAt_right_of_closure_image_mem_nhdsWithin hs
(mem_of_superset hfs subset_closure)
/-- If a function `f` is strictly monotone on a right neighborhood of `a` and the image of this
neighborhood under `f` includes `Ioi (f a)`, then `f` is continuous at `a` from the right. -/
theorem StrictMonoOn.continuousWithinAt_right_of_surjOn {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : SurjOn f s (Ioi (f a))) :
ContinuousWithinAt f (Ici a) a :=
h_mono.continuousWithinAt_right_of_exists_between hs fun _ hb =>
let ⟨c, hcs, hcb⟩ := hfs hb
⟨c, hcs, hcb.symm ▸ hb, hcb.le⟩
/-- If `f` is a strictly monotone function on a left neighborhood of `a` and the image of this
neighborhood under `f` meets every interval `[b, f a)`, `b < f a`, then `f` is continuous at `a`
from the left.
The assumption `hfs : ∀ b < f a, ∃ c ∈ s, f c ∈ Ico b (f a)` is required because otherwise the
function `f : ℝ → ℝ` given by `f x = if x < 0 then x else x + 1` would be a counter-example at
`a = 0`. -/
theorem StrictMonoOn.continuousWithinAt_left_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≤] a) (hfs : ∀ b < f a, ∃ c ∈ s, f c ∈ Ico b (f a)) :
ContinuousWithinAt f (Iic a) a :=
h_mono.dual.continuousWithinAt_right_of_exists_between hs fun b hb =>
let ⟨c, hcs, hcb, hca⟩ := hfs b hb
⟨c, hcs, hca, hcb⟩
/-- If `f` is a monotone function on a left neighborhood of `a` and the image of this neighborhood
under `f` meets every interval `(b, f a)`, `b < f a`, then `f` is continuous at `a` from the left.
The assumption `hfs : ∀ b < f a, ∃ c ∈ s, f c ∈ Ioo b (f a)` cannot be replaced by the weaker
assumption `hfs : ∀ b < f a, ∃ c ∈ s, f c ∈ Ico b (f a)` we use for strictly monotone functions
because otherwise the function `floor : ℝ → ℤ` would be a counter-example at `a = 0`. -/
theorem continuousWithinAt_left_of_monotoneOn_of_exists_between {f : α → β} {s : Set α} {a : α}
(hf : MonotoneOn f s) (hs : s ∈ 𝓝[≤] a) (hfs : ∀ b < f a, ∃ c ∈ s, f c ∈ Ioo b (f a)) :
ContinuousWithinAt f (Iic a) a :=
@continuousWithinAt_right_of_monotoneOn_of_exists_between αᵒᵈ βᵒᵈ _ _ _ _ _ _ f s a hf.dual hs
fun b hb =>
let ⟨c, hcs, hcb, hca⟩ := hfs b hb
⟨c, hcs, hca, hcb⟩
/-- If a function `f` with a densely ordered codomain is monotone on a left neighborhood of `a` and
the closure of the image of this neighborhood under `f` is a left neighborhood of `f a`, then `f` is
continuous at `a` from the left -/
theorem continuousWithinAt_left_of_monotoneOn_of_closure_image_mem_nhdsWithin [DenselyOrdered β]
{f : α → β} {s : Set α} {a : α} (hf : MonotoneOn f s) (hs : s ∈ 𝓝[≤] a)
(hfs : closure (f '' s) ∈ 𝓝[≤] f a) : ContinuousWithinAt f (Iic a) a :=
@continuousWithinAt_right_of_monotoneOn_of_closure_image_mem_nhdsWithin αᵒᵈ βᵒᵈ _ _ _ _ _ _ _ f s
a hf.dual hs hfs
/-- If a function `f` with a densely ordered codomain is monotone on a left neighborhood of `a` and
the image of this neighborhood under `f` is a left neighborhood of `f a`, then `f` is continuous at
`a` from the left. -/
theorem continuousWithinAt_left_of_monotoneOn_of_image_mem_nhdsWithin [DenselyOrdered β] {f : α → β}
{s : Set α} {a : α} (h_mono : MonotoneOn f s) (hs : s ∈ 𝓝[≤] a) (hfs : f '' s ∈ 𝓝[≤] f a) :
ContinuousWithinAt f (Iic a) a :=
continuousWithinAt_left_of_monotoneOn_of_closure_image_mem_nhdsWithin h_mono hs
(mem_of_superset hfs subset_closure)
/-- If a function `f` with a densely ordered codomain is strictly monotone on a left neighborhood of
`a` and the closure of the image of this neighborhood under `f` is a left neighborhood of `f a`,
then `f` is continuous at `a` from the left. -/
theorem StrictMonoOn.continuousWithinAt_left_of_closure_image_mem_nhdsWithin [DenselyOrdered β]
{f : α → β} {s : Set α} {a : α} (h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≤] a)
(hfs : closure (f '' s) ∈ 𝓝[≤] f a) : ContinuousWithinAt f (Iic a) a :=
h_mono.dual.continuousWithinAt_right_of_closure_image_mem_nhdsWithin hs hfs
/-- If a function `f` with a densely ordered codomain is strictly monotone on a left neighborhood of
`a` and the image of this neighborhood under `f` is a left neighborhood of `f a`, then `f` is
continuous at `a` from the left. -/
theorem StrictMonoOn.continuousWithinAt_left_of_image_mem_nhdsWithin [DenselyOrdered β] {f : α → β}
{s : Set α} {a : α} (h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≤] a) (hfs : f '' s ∈ 𝓝[≤] f a) :
ContinuousWithinAt f (Iic a) a :=
h_mono.dual.continuousWithinAt_right_of_image_mem_nhdsWithin hs hfs
/-- If a function `f` is strictly monotone on a left neighborhood of `a` and the image of this
neighborhood under `f` includes `Iio (f a)`, then `f` is continuous at `a` from the left. -/
theorem StrictMonoOn.continuousWithinAt_left_of_surjOn {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≤] a) (hfs : SurjOn f s (Iio (f a))) :
ContinuousWithinAt f (Iic a) a :=
h_mono.dual.continuousWithinAt_right_of_surjOn hs hfs
/-- If a function `f` is strictly monotone on a neighborhood of `a` and the image of this
neighborhood under `f` meets every interval `[b, f a)`, `b < f a`, and every interval
`(f a, b]`, `b > f a`, then `f` is continuous at `a`. -/
theorem StrictMonoOn.continuousAt_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝 a) (hfs_l : ∀ b < f a, ∃ c ∈ s, f c ∈ Ico b (f a))
(hfs_r : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b) : ContinuousAt f a :=
continuousAt_iff_continuous_left_right.2
⟨h_mono.continuousWithinAt_left_of_exists_between (mem_nhdsWithin_of_mem_nhds hs) hfs_l,
h_mono.continuousWithinAt_right_of_exists_between (mem_nhdsWithin_of_mem_nhds hs) hfs_r⟩
/-- If a function `f` with a densely ordered codomain is strictly monotone on a neighborhood of `a`
and the closure of the image of this neighborhood under `f` is a neighborhood of `f a`, then `f` is
continuous at `a`. -/
theorem StrictMonoOn.continuousAt_of_closure_image_mem_nhds [DenselyOrdered β] {f : α → β}
{s : Set α} {a : α} (h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝 a)
(hfs : closure (f '' s) ∈ 𝓝 (f a)) : ContinuousAt f a :=
continuousAt_iff_continuous_left_right.2
⟨h_mono.continuousWithinAt_left_of_closure_image_mem_nhdsWithin (mem_nhdsWithin_of_mem_nhds hs)
(mem_nhdsWithin_of_mem_nhds hfs),
h_mono.continuousWithinAt_right_of_closure_image_mem_nhdsWithin
(mem_nhdsWithin_of_mem_nhds hs) (mem_nhdsWithin_of_mem_nhds hfs)⟩
/-- If a function `f` with a densely ordered codomain is strictly monotone on a neighborhood of `a`
and the image of this set under `f` is a neighborhood of `f a`, then `f` is continuous at `a`. -/
theorem StrictMonoOn.continuousAt_of_image_mem_nhds [DenselyOrdered β] {f : α → β} {s : Set α}
{a : α} (h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝 a) (hfs : f '' s ∈ 𝓝 (f a)) :
ContinuousAt f a :=
h_mono.continuousAt_of_closure_image_mem_nhds hs (mem_of_superset hfs subset_closure)
/-- If `f` is a monotone function on a neighborhood of `a` and the image of this neighborhood under
`f` meets every interval `(b, f a)`, `b < f a`, and every interval `(f a, b)`, `b > f a`, then `f`
is continuous at `a`. -/
theorem continuousAt_of_monotoneOn_of_exists_between {f : α → β} {s : Set α} {a : α}
(h_mono : MonotoneOn f s) (hs : s ∈ 𝓝 a) (hfs_l : ∀ b < f a, ∃ c ∈ s, f c ∈ Ioo b (f a))
(hfs_r : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioo (f a) b) : ContinuousAt f a :=
continuousAt_iff_continuous_left_right.2
⟨continuousWithinAt_left_of_monotoneOn_of_exists_between h_mono (mem_nhdsWithin_of_mem_nhds hs)
hfs_l,
continuousWithinAt_right_of_monotoneOn_of_exists_between h_mono
(mem_nhdsWithin_of_mem_nhds hs) hfs_r⟩
/-- If a function `f` with a densely ordered codomain is monotone on a neighborhood of `a` and the
closure of the image of this neighborhood under `f` is a neighborhood of `f a`, then `f` is
continuous at `a`. -/
theorem continuousAt_of_monotoneOn_of_closure_image_mem_nhds [DenselyOrdered β] {f : α → β}
{s : Set α} {a : α} (h_mono : MonotoneOn f s) (hs : s ∈ 𝓝 a)
(hfs : closure (f '' s) ∈ 𝓝 (f a)) : ContinuousAt f a :=
continuousAt_iff_continuous_left_right.2
⟨continuousWithinAt_left_of_monotoneOn_of_closure_image_mem_nhdsWithin h_mono
(mem_nhdsWithin_of_mem_nhds hs) (mem_nhdsWithin_of_mem_nhds hfs),
continuousWithinAt_right_of_monotoneOn_of_closure_image_mem_nhdsWithin h_mono
(mem_nhdsWithin_of_mem_nhds hs) (mem_nhdsWithin_of_mem_nhds hfs)⟩
/-- If a function `f` with a densely ordered codomain is monotone on a neighborhood of `a` and the
image of this neighborhood under `f` is a neighborhood of `f a`, then `f` is continuous at `a`. -/
theorem continuousAt_of_monotoneOn_of_image_mem_nhds [DenselyOrdered β] {f : α → β} {s : Set α}
{a : α} (h_mono : MonotoneOn f s) (hs : s ∈ 𝓝 a) (hfs : f '' s ∈ 𝓝 (f a)) : ContinuousAt f a :=
continuousAt_of_monotoneOn_of_closure_image_mem_nhds h_mono hs
(mem_of_superset hfs subset_closure)
/-- A monotone function with densely ordered codomain and a dense range is continuous. -/
theorem Monotone.continuous_of_denseRange [DenselyOrdered β] {f : α → β} (h_mono : Monotone f)
(h_dense : DenseRange f) : Continuous f :=
continuous_iff_continuousAt.mpr fun a =>
continuousAt_of_monotoneOn_of_closure_image_mem_nhds (fun _ _ _ _ hxy => h_mono hxy)
univ_mem <|
by simp only [image_univ, h_dense.closure_eq, univ_mem]
/-- A monotone surjective function with a densely ordered codomain is continuous. -/
theorem Monotone.continuous_of_surjective [DenselyOrdered β] {f : α → β} (h_mono : Monotone f)
(h_surj : Function.Surjective f) : Continuous f :=
h_mono.continuous_of_denseRange h_surj.denseRange
end LinearOrder
/-!
### Continuity of order isomorphisms
In this section we prove that an `OrderIso` is continuous, hence it is a `Homeomorph`. We prove
this for an `OrderIso` between to partial orders with order topology.
-/
namespace OrderIso
variable {α β : Type*} [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β]
[OrderTopology α] [OrderTopology β]
protected theorem continuous (e : α ≃o β) : Continuous e := by
rw [‹OrderTopology β›.topology_eq_generate_intervals, continuous_generateFrom_iff]
rintro s ⟨a, rfl | rfl⟩
· rw [e.preimage_Ioi]
apply isOpen_lt'
· rw [e.preimage_Iio]
apply isOpen_gt'
instance : HomeomorphClass (α ≃o β) α β where
map_continuous := OrderIso.continuous
inv_continuous e := e.symm.continuous
/-- An order isomorphism between two linear order `OrderTopology` spaces is a homeomorphism. -/
abbrev toHomeomorph (e : α ≃o β) : α ≃ₜ β :=
HomeomorphClass.toHomeomorph e
theorem coe_toHomeomorph (e : α ≃o β) : ⇑e.toHomeomorph = e :=
rfl --Simp can prove this too
@[simp]
theorem coe_toHomeomorph_symm (e : α ≃o β) : ⇑e.toHomeomorph.symm = e.symm :=
rfl
end OrderIso |
.lake/packages/mathlib/Mathlib/Topology/Order/LowerUpperTopology.lean | import Mathlib.Order.Hom.CompleteLattice
import Mathlib.Topology.Homeomorph.Defs
import Mathlib.Topology.Order.Lattice
/-!
# Lower and Upper topology
This file introduces the lower topology on a preorder as the topology generated by the complements
of the left-closed right-infinite intervals.
For completeness we also introduce the dual upper topology, generated by the complements of the
right-closed left-infinite intervals.
## Main statements
- `IsLower.t0Space` - the lower topology on a partial order is T₀
- `IsLower.isTopologicalBasis` - the complements of the upper closures of finite
subsets form a basis for the lower topology
- `IsLower.continuousInf` - the inf map is continuous with respect to the lower topology
## Implementation notes
A type synonym `WithLower` is introduced and for a preorder `α`, `WithLower α`
is made an instance of `TopologicalSpace` by the topology generated by the complements of the
closed intervals to infinity.
We define a mixin class `IsLower` for the class of types which are both a preorder and a
topology and where the topology is generated by the complements of the closed intervals to infinity.
It is shown that `WithLower α` is an instance of `IsLower`.
Similarly for the upper topology.
## Motivation
The lower topology is used with the `Scott` topology to define the Lawson topology. The restriction
of the lower topology to the spectrum of a complete lattice coincides with the hull-kernel topology.
## References
* [Gierz et al, *A Compendium of Continuous Lattices*][GierzEtAl1980]
## Tags
lower topology, upper topology, preorder
-/
open Set TopologicalSpace Topology
namespace Topology
/--
The lower topology is the topology generated by the complements of the left-closed right-infinite
intervals.
-/
def lower (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom {s | ∃ a, (Ici a)ᶜ = s}
/--
The upper topology is the topology generated by the complements of the right-closed left-infinite
intervals.
-/
def upper (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom {s | ∃ a, (Iic a)ᶜ = s}
/-- Type synonym for a preorder equipped with the lower set topology. -/
def WithLower (α : Type*) := α
variable {α β : Type*}
namespace WithLower
/-- `toLower` is the identity function to the `WithLower` of a type. -/
@[match_pattern] def toLower : α ≃ WithLower α := Equiv.refl _
/-- `ofLower` is the identity function from the `WithLower` of a type. -/
@[match_pattern] def ofLower : WithLower α ≃ α := Equiv.refl _
@[simp] lemma toLower_symm : (@toLower α).symm = ofLower := rfl
@[simp] lemma ofLower_symm : (@ofLower α).symm = toLower := rfl
@[simp] lemma toLower_ofLower (a : WithLower α) : toLower (ofLower a) = a := rfl
@[simp] lemma ofLower_toLower (a : α) : ofLower (toLower a) = a := rfl
lemma toLower_inj {a b : α} : toLower a = toLower b ↔ a = b := Iff.rfl
theorem ofLower_inj {a b : WithLower α} : ofLower a = ofLower b ↔ a = b :=
Iff.rfl
/-- A recursor for `WithLower`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithLower α → Sort*} (h : ∀ a, β (toLower a)) : ∀ a, β a := fun a =>
h (ofLower a)
instance [Nonempty α] : Nonempty (WithLower α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithLower α) := ‹Inhabited α›
section Preorder
variable [Preorder α] {s : Set α}
instance : Preorder (WithLower α) := ‹Preorder α›
instance : TopologicalSpace (WithLower α) := lower (WithLower α)
@[simp] lemma toLower_le_toLower {x y : α} : toLower x ≤ toLower y ↔ x ≤ y := .rfl
@[simp] lemma toLower_lt_toLower {x y : α} : toLower x < toLower y ↔ x < y := .rfl
@[simp] lemma ofLower_le_ofLower {x y : WithLower α} : ofLower x ≤ ofLower y ↔ x ≤ y := .rfl
@[simp] lemma ofLower_lt_ofLower {x y : WithLower α} : ofLower x < ofLower y ↔ x < y := .rfl
lemma isOpen_preimage_ofLower : IsOpen (ofLower ⁻¹' s) ↔ IsOpen[lower α] s := Iff.rfl
lemma isOpen_def (T : Set (WithLower α)) : IsOpen T ↔ IsOpen[lower α] (WithLower.toLower ⁻¹' T) :=
Iff.rfl
theorem continuous_toLower [TopologicalSpace α] [ClosedIciTopology α] :
Continuous (toLower : α → WithLower α) :=
continuous_generateFrom_iff.mpr <| by rintro _ ⟨a, rfl⟩; exact isClosed_Ici.isOpen_compl
end Preorder
instance [PartialOrder α] : PartialOrder (WithLower α) := ‹PartialOrder α›
instance [LinearOrder α] : LinearOrder (WithLower α) := ‹LinearOrder α›
end WithLower
/-- Type synonym for a preorder equipped with the upper topology. -/
def WithUpper (α : Type*) := α
namespace WithUpper
/-- `toUpper` is the identity function to the `WithUpper` of a type. -/
@[match_pattern] def toUpper : α ≃ WithUpper α := Equiv.refl _
/-- `ofUpper` is the identity function from the `WithUpper` of a type. -/
@[match_pattern] def ofUpper : WithUpper α ≃ α := Equiv.refl _
@[simp] lemma toUpper_symm {α} : (@toUpper α).symm = ofUpper := rfl
@[simp] lemma ofUpper_symm : (@ofUpper α).symm = toUpper := rfl
@[simp] lemma toUpper_ofUpper (a : WithUpper α) : toUpper (ofUpper a) = a := rfl
@[simp] lemma ofUpper_toUpper (a : α) : ofUpper (toUpper a) = a := rfl
lemma toUpper_inj {a b : α} : toUpper a = toUpper b ↔ a = b := Iff.rfl
lemma ofUpper_inj {a b : WithUpper α} : ofUpper a = ofUpper b ↔ a = b := Iff.rfl
/-- A recursor for `WithUpper`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithUpper α → Sort*} (h : ∀ a, β (toUpper a)) : ∀ a, β a := fun a =>
h (ofUpper a)
instance [Nonempty α] : Nonempty (WithUpper α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithUpper α) := ‹Inhabited α›
section Preorder
variable [Preorder α] {s : Set α}
instance : Preorder (WithUpper α) := ‹Preorder α›
instance : TopologicalSpace (WithUpper α) := upper (WithUpper α)
@[simp] lemma toUpper_le_toUpper {x y : α} : toUpper x ≤ toUpper y ↔ x ≤ y := .rfl
@[simp] lemma toUpper_lt_toUpper {x y : α} : toUpper x < toUpper y ↔ x < y := .rfl
@[simp] lemma ofUpper_le_ofUpper {x y : WithUpper α} : ofUpper x ≤ ofUpper y ↔ x ≤ y := .rfl
@[simp] lemma ofUpper_lt_ofUpper {x y : WithUpper α} : ofUpper x < ofUpper y ↔ x < y := .rfl
lemma isOpen_preimage_ofUpper : IsOpen (ofUpper ⁻¹' s) ↔ (upper α).IsOpen s := Iff.rfl
lemma isOpen_def {s : Set (WithUpper α)} : IsOpen s ↔ (upper α).IsOpen (toUpper ⁻¹' s) := Iff.rfl
theorem continuous_toUpper [TopologicalSpace α] [ClosedIicTopology α] :
Continuous (toUpper : α → WithUpper α) :=
continuous_generateFrom_iff.mpr <| by rintro _ ⟨a, rfl⟩; exact isClosed_Iic.isOpen_compl
end Preorder
instance [PartialOrder α] : PartialOrder (WithUpper α) := ‹PartialOrder α›
instance [LinearOrder α] : LinearOrder (WithUpper α) := ‹LinearOrder α›
end WithUpper
/--
The lower topology is the topology generated by the complements of the left-closed right-infinite
intervals.
-/
class IsLower (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where
topology_eq_lowerTopology : t = lower α
attribute [nolint docBlame] IsLower.topology_eq_lowerTopology
/--
The upper topology is the topology generated by the complements of the right-closed left-infinite
intervals.
-/
class IsUpper (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where
topology_eq_upperTopology : t = upper α
attribute [nolint docBlame] IsUpper.topology_eq_upperTopology
instance [Preorder α] : IsLower (WithLower α) := ⟨rfl⟩
instance [Preorder α] : IsUpper (WithUpper α) := ⟨rfl⟩
/--
The lower topology is homeomorphic to the upper topology on the dual order
-/
def WithLower.toDualHomeomorph [Preorder α] : WithLower α ≃ₜ WithUpper αᵒᵈ where
toFun := OrderDual.toDual
invFun := OrderDual.ofDual
left_inv := OrderDual.toDual_ofDual
right_inv := OrderDual.ofDual_toDual
continuous_toFun := continuous_coinduced_rng
continuous_invFun := continuous_coinduced_rng
namespace IsLower
/-- The complements of the upper closures of finite sets are a collection of lower sets
which form a basis for the lower topology. -/
def lowerBasis (α : Type*) [Preorder α] :=
{ s : Set α | ∃ t : Set α, t.Finite ∧ (upperClosure t : Set α)ᶜ = s }
section Preorder
variable (α)
variable [Preorder α] [TopologicalSpace α] [IsLower α] {s : Set α}
lemma topology_eq : ‹_› = lower α := topology_eq_lowerTopology
variable {α}
/-- If `α` is equipped with the lower topology, then it is homeomorphic to `WithLower α`.
-/
def withLowerHomeomorph : WithLower α ≃ₜ α :=
WithLower.ofLower.toHomeomorphOfIsInducing ⟨topology_eq α ▸ induced_id.symm⟩
theorem isOpen_iff_generate_Ici_compl : IsOpen s ↔ GenerateOpen { t | ∃ a, (Ici a)ᶜ = t } s := by
rw [topology_eq α]; rfl
instance _root_.OrderDual.instIsUpper [Preorder α] [TopologicalSpace α] [IsLower α] :
IsUpper αᵒᵈ where
topology_eq_upperTopology := topology_eq_lowerTopology (α := α)
/-- Left-closed right-infinite intervals [a, ∞) are closed in the lower topology. -/
instance : ClosedIciTopology α :=
⟨fun a ↦ isOpen_compl_iff.1 <| isOpen_iff_generate_Ici_compl.2 <| GenerateOpen.basic _ ⟨a, rfl⟩⟩
/-- The upper closure of a finite set is closed in the lower topology. -/
theorem isClosed_upperClosure (h : s.Finite) : IsClosed (upperClosure s : Set α) := by
simp only [← UpperSet.iInf_Ici, UpperSet.coe_iInf]
exact h.isClosed_biUnion fun _ _ => isClosed_Ici
/-- Every set open in the lower topology is a lower set. -/
theorem isLowerSet_of_isOpen (h : IsOpen s) : IsLowerSet s := by
replace h := isOpen_iff_generate_Ici_compl.1 h
induction h with
| basic u h' => obtain ⟨a, rfl⟩ := h'; exact (isUpperSet_Ici a).compl
| univ => exact isLowerSet_univ
| inter u v _ _ hu2 hv2 => exact hu2.inter hv2
| sUnion _ _ ih => exact isLowerSet_sUnion ih
theorem isUpperSet_of_isClosed (h : IsClosed s) : IsUpperSet s :=
isLowerSet_compl.1 <| isLowerSet_of_isOpen h.isOpen_compl
theorem tendsto_nhds_iff_not_le {β : Type*} {f : β → α} {l : Filter β} {x : α} :
Filter.Tendsto f l (𝓝 x) ↔ ∀ y, ¬y ≤ x → ∀ᶠ z in l, ¬y ≤ f z := by
simp [topology_eq_lowerTopology, tendsto_nhds_generateFrom_iff, Filter.Eventually, Ici,
compl_setOf]
/--
The closure of a singleton `{a}` in the lower topology is the left-closed right-infinite interval
[a, ∞).
-/
@[simp]
theorem closure_singleton (a : α) : closure {a} = Ici a :=
Subset.antisymm ((closure_minimal fun _ h => h.ge) <| isClosed_Ici) <|
(isUpperSet_of_isClosed isClosed_closure).Ici_subset <| subset_closure rfl
protected theorem isTopologicalBasis : IsTopologicalBasis (lowerBasis α) := by
convert isTopologicalBasis_of_subbasis (topology_eq α)
simp_rw [lowerBasis, coe_upperClosure, compl_iUnion]
ext s
constructor
· rintro ⟨F, hF, rfl⟩
refine ⟨(fun a => (Ici a)ᶜ) '' F, ⟨hF.image _, image_subset_iff.2 fun _ _ => ⟨_, rfl⟩⟩, ?_⟩
simp only [sInter_image]
· rintro ⟨F, ⟨hF, hs⟩, rfl⟩
haveI := hF.to_subtype
rw [subset_def, Subtype.forall'] at hs
choose f hf using hs
exact ⟨_, finite_range f, by simp_rw [biInter_range, hf, sInter_eq_iInter]⟩
/-- A function `f : β → α` with lower topology in the codomain is continuous
if and only if the preimage of every interval `Set.Ici a` is a closed set.
-/
lemma continuous_iff_Ici [TopologicalSpace β] {f : β → α} :
Continuous f ↔ ∀ a, IsClosed (f ⁻¹' (Ici a)) := by
obtain rfl := IsLower.topology_eq α
simp [continuous_generateFrom_iff]
end Preorder
section PartialOrder
variable [PartialOrder α] [TopologicalSpace α] [IsLower α]
-- see Note [lower instance priority]
/-- The lower topology on a partial order is T₀. -/
instance (priority := 90) t0Space : T0Space α :=
(t0Space_iff_inseparable α).2 fun x y h =>
Ici_injective <| by simpa only [inseparable_iff_closure_eq, closure_singleton] using h
end PartialOrder
section LinearOrder
variable [LinearOrder α] [TopologicalSpace α] [IsLower α]
lemma isTopologicalBasis_insert_univ_subbasis :
IsTopologicalBasis (insert univ {s : Set α | ∃ a, (Ici a)ᶜ = s}) :=
isTopologicalBasis_of_subbasis_of_inter (by rw [topology_eq α, lower]) (by
rintro _ ⟨b, rfl⟩ _ ⟨c, rfl⟩
use b ⊓ c
rw [compl_Ici, compl_Ici, compl_Ici, Iio_inter_Iio])
theorem tendsto_nhds_iff_lt {β : Type*} {f : β → α} {l : Filter β} {x : α} :
Filter.Tendsto f l (𝓝 x) ↔ ∀ y, x < y → ∀ᶠ z in l, f z < y := by
simp only [tendsto_nhds_iff_not_le, not_le]
end LinearOrder
section CompleteLinearOrder
variable [CompleteLinearOrder α] [t : TopologicalSpace α] [IsLower α]
lemma isTopologicalSpace_basis (U : Set α) : IsOpen U ↔ U = univ ∨ ∃ a, (Ici a)ᶜ = U := by
by_cases hU : U = univ
· simp only [hU, isOpen_univ, compl_Ici, true_or]
refine ⟨?_, isTopologicalBasis_insert_univ_subbasis.isOpen⟩
intro hO
apply Or.inr
convert IsTopologicalBasis.open_eq_sUnion isTopologicalBasis_insert_univ_subbasis hO
constructor
· intro ⟨a, ha⟩
use {U}
constructor
· apply subset_trans (singleton_subset_iff.mpr _) (subset_insert _ _)
use a
· rw [sUnion_singleton]
· intro ⟨S, hS1, hS2⟩
have hUS : univ ∉ S := by
by_contra hUS'
apply hU
rw [hS2]
exact sUnion_eq_univ_iff.mpr (fun a => ⟨univ, hUS', trivial⟩)
use sSup {a | (Ici a)ᶜ ∈ S}
rw [hS2, sUnion_eq_compl_sInter_compl, compl_inj_iff]
apply le_antisymm
· intro b hb
simp only [sInter_image, mem_iInter, mem_compl_iff]
intro s hs
obtain ⟨a, ha⟩ := (subset_insert_iff_of_notMem hUS).mp hS1 hs
subst hS2 ha
simp_all only [compl_Ici, mem_Ici, sSup_le_iff, mem_setOf_eq, mem_Iio, not_lt]
· intro b hb
rw [mem_Ici, sSup_le_iff]
intro c hc
simp only [sInter_image, mem_iInter] at hb
rw [← not_lt, ← mem_Iio, ← compl_Ici]
exact hb _ hc
end CompleteLinearOrder
end IsLower
namespace IsUpper
/-- The complements of the lower closures of finite sets are a collection of upper sets
which form a basis for the upper topology. -/
def upperBasis (α : Type*) [Preorder α] :=
{ s : Set α | ∃ t : Set α, t.Finite ∧ (lowerClosure t : Set α)ᶜ = s }
section Preorder
variable (α)
variable [Preorder α] [TopologicalSpace α] [IsUpper α] {s : Set α}
lemma topology_eq : ‹_› = upper α := topology_eq_upperTopology
variable {α}
/-- If `α` is equipped with the upper topology, then it is homeomorphic to `WithUpper α`.
-/
def withUpperHomeomorph : WithUpper α ≃ₜ α :=
WithUpper.ofUpper.toHomeomorphOfIsInducing ⟨topology_eq α ▸ induced_id.symm⟩
theorem isOpen_iff_generate_Iic_compl : IsOpen s ↔ GenerateOpen { t | ∃ a, (Iic a)ᶜ = t } s := by
rw [topology_eq α]; rfl
instance _root_.OrderDual.instIsLower [Preorder α] [TopologicalSpace α] [IsUpper α] :
IsLower αᵒᵈ where
topology_eq_lowerTopology := topology_eq_upperTopology (α := α)
/-- Left-infinite right-closed intervals (-∞,a] are closed in the upper topology. -/
instance : ClosedIicTopology α :=
⟨fun a ↦ isOpen_compl_iff.1 <| isOpen_iff_generate_Iic_compl.2 <| GenerateOpen.basic _ ⟨a, rfl⟩⟩
/-- The lower closure of a finite set is closed in the upper topology. -/
theorem isClosed_lowerClosure (h : s.Finite) : IsClosed (lowerClosure s : Set α) :=
IsLower.isClosed_upperClosure (α := αᵒᵈ) h
/-- Every set open in the upper topology is a upper set. -/
theorem isUpperSet_of_isOpen (h : IsOpen s) : IsUpperSet s :=
IsLower.isLowerSet_of_isOpen (α := αᵒᵈ) h
theorem isLowerSet_of_isClosed (h : IsClosed s) : IsLowerSet s :=
isUpperSet_compl.1 <| isUpperSet_of_isOpen h.isOpen_compl
theorem tendsto_nhds_iff_not_le {β : Type*} {f : β → α} {l : Filter β} {x : α} :
Filter.Tendsto f l (𝓝 x) ↔ ∀ y, ¬x ≤ y → ∀ᶠ z in l, ¬f z ≤ y :=
IsLower.tendsto_nhds_iff_not_le (α := αᵒᵈ)
/--
The closure of a singleton `{a}` in the upper topology is the left-infinite right-closed interval
(-∞,a].
-/
@[simp]
theorem closure_singleton (a : α) : closure {a} = Iic a :=
IsLower.closure_singleton (α := αᵒᵈ) _
protected theorem isTopologicalBasis : IsTopologicalBasis (upperBasis α) :=
IsLower.isTopologicalBasis (α := αᵒᵈ)
/-- A function `f : β → α` with upper topology in the codomain is continuous
if and only if the preimage of every interval `Set.Iic a` is a closed set. -/
lemma continuous_iff_Iic [TopologicalSpace β] {f : β → α} :
Continuous f ↔ ∀ a, IsClosed (f ⁻¹' (Iic a)) :=
IsLower.continuous_iff_Ici (α := αᵒᵈ)
end Preorder
section PartialOrder
variable [PartialOrder α] [TopologicalSpace α] [IsUpper α]
-- see Note [lower instance priority]
/-- The upper topology on a partial order is T₀. -/
instance (priority := 90) t0Space : T0Space α :=
IsLower.t0Space (α := αᵒᵈ)
end PartialOrder
section LinearOrder
variable [LinearOrder α] [TopologicalSpace α] [IsUpper α]
lemma isTopologicalBasis_insert_univ_subbasis :
IsTopologicalBasis (insert univ {s : Set α | ∃ a, (Iic a)ᶜ = s}) :=
IsLower.isTopologicalBasis_insert_univ_subbasis (α := αᵒᵈ)
theorem tendsto_nhds_iff_lt {β : Type*} {f : β → α} {l : Filter β} {x : α} :
Filter.Tendsto f l (𝓝 x) ↔ ∀ y < x, ∀ᶠ z in l, y < f z :=
IsLower.tendsto_nhds_iff_lt (α := αᵒᵈ)
end LinearOrder
section CompleteLinearOrder
variable [CompleteLinearOrder α] [t : TopologicalSpace α] [IsUpper α]
lemma isTopologicalSpace_basis (U : Set α) : IsOpen U ↔ U = univ ∨ ∃ a, (Iic a)ᶜ = U :=
IsLower.isTopologicalSpace_basis (α := αᵒᵈ) U
end CompleteLinearOrder
end IsUpper
instance instIsLowerProd [Preorder α] [TopologicalSpace α] [IsLower α]
[OrderBot α] [Preorder β] [TopologicalSpace β] [IsLower β] [OrderBot β] :
IsLower (α × β) where
topology_eq_lowerTopology := by
refine le_antisymm (le_generateFrom ?_) ?_
· rintro _ ⟨x, rfl⟩
exact (isClosed_Ici.prod isClosed_Ici).isOpen_compl
rw [(IsLower.isTopologicalBasis.prod
IsLower.isTopologicalBasis).eq_generateFrom, le_generateFrom_iff_subset_isOpen,
image2_subset_iff]
rintro _ ⟨s, hs, rfl⟩ _ ⟨t, ht, rfl⟩
dsimp
simp_rw [coe_upperClosure, compl_iUnion, prod_eq, preimage_iInter, preimage_compl]
-- without `let`, `refine` tries to use the product topology and fails
let _ : TopologicalSpace (α × β) := lower (α × β)
refine (hs.isOpen_biInter fun a _ => ?_).inter (ht.isOpen_biInter fun b _ => ?_)
· exact GenerateOpen.basic _ ⟨(a, ⊥), by simp [Ici_prod_eq, prod_univ]⟩
· exact GenerateOpen.basic _ ⟨(⊥, b), by simp [Ici_prod_eq, univ_prod]⟩
instance instIsUpperProd [Preorder α] [TopologicalSpace α] [IsUpper α]
[OrderTop α] [Preorder β] [TopologicalSpace β] [IsUpper β] [OrderTop β] :
IsUpper (α × β) where
topology_eq_upperTopology := by
suffices IsLower (α × β)ᵒᵈ from IsLower.topology_eq_lowerTopology (α := (α × β)ᵒᵈ)
exact instIsLowerProd (α := αᵒᵈ) (β := βᵒᵈ)
section CompleteLattice_IsLower
variable [CompleteLattice α] [CompleteLattice β] [TopologicalSpace α] [IsLower α]
[TopologicalSpace β] [IsLower β]
protected lemma _root_.sInfHom.continuous (f : sInfHom α β) : Continuous f := by
refine IsLower.continuous_iff_Ici.2 fun b => ?_
convert isClosed_Ici (a := sInf <| f ⁻¹' Ici b)
refine Subset.antisymm (fun a => sInf_le) fun a ha => le_trans ?_ <|
OrderHomClass.mono (f : α →o β) ha
refine LE.le.trans ?_ (map_sInf f _).ge
simp
-- see Note [lower instance priority]
instance (priority := 90) IsLower.toContinuousInf : ContinuousInf α :=
⟨(infsInfHom : sInfHom (α × α) α).continuous⟩
end CompleteLattice_IsLower
section CompleteLattice_IsUpper
variable [CompleteLattice α] [CompleteLattice β] [TopologicalSpace α] [IsUpper α]
[TopologicalSpace β] [IsUpper β]
protected lemma _root_.sSupHom.continuous (f : sSupHom α β) : Continuous f :=
sInfHom.continuous (α := αᵒᵈ) (β := βᵒᵈ) (sSupHom.dual.toFun f)
-- see Note [lower instance priority]
instance (priority := 90) IsUpper.toContinuousInf : ContinuousSup α :=
⟨(supsSupHom : sSupHom (α × α) α).continuous⟩
end CompleteLattice_IsUpper
lemma isUpper_orderDual [Preorder α] [TopologicalSpace α] : IsUpper αᵒᵈ ↔ IsLower α := by
constructor
· apply OrderDual.instIsLower
· apply OrderDual.instIsUpper
lemma isLower_orderDual [Preorder α] [TopologicalSpace α] : IsLower αᵒᵈ ↔ IsUpper α :=
isUpper_orderDual.symm
end Topology
/-- The Sierpiński topology on `Prop` is the upper topology -/
instance : IsUpper Prop where
topology_eq_upperTopology := by
rw [Topology.upper, sierpinskiSpace, ← generateFrom_insert_empty]
congr
exact le_antisymm
(fun h hs => by
simp only [compl_Iic, mem_setOf_eq]
rw [← Ioi_True, ← Ioi_False] at hs
rcases hs with (rfl | rfl)
· use True
· use False)
(by rintro _ ⟨a, rfl⟩; by_cases a <;> aesop (add simp [Ioi, lt_iff_le_not_ge])) |
.lake/packages/mathlib/Mathlib/Topology/Order/WithTop.lean | import Mathlib.Topology.Order.Basic
import Mathlib.Data.Fintype.WithTopBot
/-! # Order topology on `WithTop ι`
When `ι` is a topological space with the order topology, we also endow `WithTop ι` with the order
topology. If `ι` is second countable, we prove that `WithTop ι` also is.
-/
open Set Filter
open scoped Topology
namespace TopologicalSpace
variable {ι : Type*} [Preorder ι]
@[nolint unusedArguments]
instance [TopologicalSpace ι] [OrderTopology ι] : TopologicalSpace (WithTop ι) :=
Preorder.topology _
instance [TopologicalSpace ι] [OrderTopology ι] : OrderTopology (WithTop ι) := ⟨rfl⟩
instance [ts : TopologicalSpace ι] [ht : OrderTopology ι] [SecondCountableTopology ι] :
SecondCountableTopology (WithTop ι) := by
classical
rcases isEmpty_or_nonempty ι with hι | ⟨⟨x₀⟩⟩
· infer_instance
/- Let `c` be a countable set in `ι` such that the topology is generated by the sets `Iio a`
and `Ioi a` for `a ∈ c`, by second-countability. Let `c'` be a dense set in `ι`, again by
second-countability. Let `d` in `WithTop ι` be obtained from `c ∪ c'`, by adding `⊤` and a point
`x₁ : ι` with `Ioi x₁ = ∅` if there is one.
We will show that the topology on `WithTop ι` is generated by the intervals `Iio a` and `Ioi a`
for `a ∈ d`, which will conclude the proof by countability of `d`. -/
obtain ⟨c, c_count, hc⟩ : ∃ (c : Set ι), c.Countable ∧
ts = generateFrom { s | ∃ a ∈ c, s = Ioi a ∨ s = Iio a } :=
exists_countable_generateFrom_Ioi_Iio ι
obtain ⟨c', c'_count, hc'⟩ : ∃ c' : Set ι, c'.Countable ∧ Dense c' :=
SeparableSpace.exists_countable_dense
let x₁ : ι := if h : ∃ x, Ioi x = ∅ then h.choose else x₀
let d : Set (WithTop ι) := (↑)'' c ∪ (↑)'' c' ∪ {⊤} ∪ {(x₁ : WithTop ι)}
suffices H : instWithTopOfOrderTopology
= generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a} by
refine ⟨{s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a}, ?_, by rw [← H]⟩
have d_count : d.Countable :=
(((c_count.image _).union (c'_count.image _)).union (by simp)).union (by simp)
have : {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a} = Ioi '' d ∪ Iio '' d := by
ext; simp; grind
rw [this]
exact (d_count.image _).union (d_count.image _)
-- We should check the easy direction that all the elements in our generating set are open.
-- This is trivial as these are all intervals.
apply le_antisymm
· apply le_generateFrom_iff_subset_isOpen.2
simp only [setOf_subset_setOf, forall_exists_index, and_imp]
grind [isOpen_Iio', isOpen_Ioi']
/- Now, let us check that our sets indeed generates the topology. As the topology is
generated by the open half-infinite intervals by definition, we should check that open
half-infinite intervals are covered by finite intersections of our sets. -/
let basis : Set (Set ι) := {s | ∃ (f g : Set ι), f ⊆ c ∧ g ⊆ c ∧ f.Finite ∧ g.Finite
∧ s = (⋂ a ∈ f, Ioi a) ∩ (⋂ a ∈ g, Iio a)}
have h_basis : IsTopologicalBasis basis := isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom c hc
rw [OrderTopology.topology_eq_generate_intervals (α := WithTop ι)]
apply le_generateFrom_iff_subset_isOpen.2
simp only [setOf_subset_setOf, forall_exists_index]
rintro u a (rfl | rfl)
-- Consider an interval of the form `Ioi a`. We should cover it by finite intersections of
-- our sets.
· induction a with
| top =>
-- for `a = ⊤`, this is trivial as `Ioi ⊤` is in our set by design
apply isOpen_generateFrom_of_mem
exact ⟨⊤, by simp [d]⟩
| coe a =>
-- for `a : ι`, we consider an element `b ∈ Ioi a`, and seek a finite intersection of our
-- sets containing it and contained in `Ioi a`.
rw [@isOpen_iff_forall_mem_open]
intro b hb
induction b with
| top =>
-- if `b = ⊤`, then either `Ioi a` is empty in `ι` and then we use `Ioi (↑x₁)` which is
-- in our set and reduced to `⊤`
rcases eq_empty_or_nonempty (Ioi a) with ha | ha
· refine ⟨Ioi x₁, ?_, ?_, by simp⟩
· have : Ioi x₁ = ∅ := by
have h : ∃ x, Ioi x = ∅ := ⟨a, ha⟩
simp only [x₁, h, ↓reduceDIte]
exact h.choose_spec
simp [WithTop.Ioi_coe, this]
· apply isOpen_generateFrom_of_mem
simp [d]
-- If `Ioi a` is not empty in `ι`, it contains a point `b` in the dense set `c'`, and then
-- we use `Ioi (↑b)` which is in our set, contained in `Ioi (↑a)` and contains `⊤`.
· obtain ⟨b, bc', hb⟩ : ∃ b ∈ c', b ∈ Ioi a := hc'.exists_mem_open (isOpen_Ioi' a) ha
refine ⟨Ioi b, ?_, ?_, by simp⟩
· apply Ioi_subset_Ioi
simpa using hb.le
· apply isOpen_generateFrom_of_mem
exact ⟨b, by simp [d, bc'], Or.inl rfl⟩
| coe b =>
-- if `b` comes from `ι`, then in `ι` we can find a finite intersection of our sets
-- containing `b` and contained in `Ioi a`. We lift it to `WithTop ι`.
simp only [mem_Ioi, WithTop.coe_lt_coe] at hb
obtain ⟨t, ⟨f, g, hfc, hgc, f_fin, g_fin, rfl⟩, hb, hfg⟩ :
∃ t ∈ basis, b ∈ t ∧ t ⊆ Ioi a := h_basis.isOpen_iff.1 (isOpen_Ioi' a) b hb
refine ⟨(⋂ z ∈ f, Ioi z) ∩ ⋂ z ∈ g, Iio z, ?_, ?_, by simpa using hb⟩
· intro w hw
induction w with
| top => simp
| coe w =>
simp only [mem_Ioi, WithTop.coe_lt_coe]
apply hfg
simpa using hw
· apply @IsOpen.inter _ (generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a})
· apply @Finite.isOpen_biInter _ _ (generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a})
· exact f_fin
· intro i hi
apply isOpen_generateFrom_of_mem
grind
· apply @Finite.isOpen_biInter _ _ (generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a})
· exact g_fin
· intro i hi
apply isOpen_generateFrom_of_mem
grind
-- Consider an interval of the form `Iio a`. We should cover it by finite intersections of
-- our sets.
· induction a with
| top =>
-- for `a = ⊤`, this is trivial as `Iio ⊤` is in our set by design
apply isOpen_generateFrom_of_mem
exact ⟨⊤, by simp [d]⟩
| coe a =>
-- for `a : ι`, we consider an element `b ∈ Iio a`, and seek a finite intersection of our
-- sets containing it and contained in `Iio a`.
rw [@isOpen_iff_forall_mem_open]
intro b hb
induction b with
| top => simp at hb
| coe b =>
-- `b` can not be equal to `⊤`, so it comes from `ι`. In `ι` we can find a finite
-- intersection of our sets containing `b` and contained in `Iio a`. We lift it
-- to `WithTop ι`, and intersect with `Iio ⊤` (which is also in our set) to exclude `⊤`.
simp only [mem_Iio, WithTop.coe_lt_coe] at hb
obtain ⟨t, ⟨f, g, hfc, hgc, f_fin, g_fin, rfl⟩, hb, hfg⟩ :
∃ t ∈ basis, b ∈ t ∧ t ⊆ Iio a := h_basis.isOpen_iff.1 (isOpen_Iio' a) b hb
refine ⟨(⋂ z ∈ f, Ioi z) ∩ (⋂ z ∈ g, Iio z) ∩ Iio ⊤, ?_, ?_, by simpa using hb⟩
· intro w hw
induction w with
| top => simp at hw
| coe w =>
simp only [mem_Iio, WithTop.coe_lt_coe]
apply hfg
simpa using hw
· apply @IsOpen.inter _ (generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a}); swap
· apply isOpen_generateFrom_of_mem
simp [d]
apply @IsOpen.inter _ (generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a})
· apply @Finite.isOpen_biInter _ _ (generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a})
· exact f_fin
· intro i hi
apply isOpen_generateFrom_of_mem
grind
· apply @Finite.isOpen_biInter _ _ (generateFrom {s | ∃ a ∈ d, s = Ioi a ∨ s = Iio a})
· exact g_fin
· intro i hi
apply isOpen_generateFrom_of_mem
grind
end TopologicalSpace
namespace WithTop
variable {ι : Type*} [LinearOrder ι] [TopologicalSpace ι] [OrderTopology ι]
section Coe
lemma isEmbedding_coe : Topology.IsEmbedding ((↑) : ι → WithTop ι) := by
refine WithTop.coe_strictMono.isEmbedding_of_ordConnected (α := ι) ?_
rw [WithTop.range_coe]
exact Set.ordConnected_Iio
lemma isOpenEmbedding_coe : Topology.IsOpenEmbedding ((↑) : ι → WithTop ι) :=
⟨isEmbedding_coe, by rw [WithTop.range_coe]; exact isOpen_Iio⟩
lemma nhds_coe {r : ι} : 𝓝 (r : WithTop ι) = (𝓝 r).map (↑) :=
(isOpenEmbedding_coe.map_nhds_eq r).symm
@[fun_prop, continuity]
lemma continuous_coe : Continuous ((↑) : ι → WithTop ι) := isEmbedding_coe.continuous
end Coe
section ContinuousUnTop
lemma tendsto_untopD (d : ι) {a : WithTop ι} (ha : a ≠ ⊤) :
Tendsto (untopD d) (𝓝 a) (𝓝 (untopD d a)) := by
lift a to ι using ha
rw [nhds_coe, tendsto_map'_iff]
exact tendsto_id
lemma continuousOn_untopD (d : ι) : ContinuousOn (untopD d) { a : WithTop ι | a ≠ ⊤ } :=
fun _a ha ↦ ContinuousAt.continuousWithinAt (tendsto_untopD d ha)
lemma tendsto_untopA [Nonempty ι] {a : WithTop ι} (ha : a ≠ ⊤) :
Tendsto untopA (𝓝 a) (𝓝 a.untopA) := tendsto_untopD _ ha
lemma continuousOn_untopA [Nonempty ι] : ContinuousOn untopA { a : WithTop ι | a ≠ ⊤ } :=
continuousOn_untopD _
lemma tendsto_untop (a : {a : WithTop ι | a ≠ ⊤}) :
Tendsto (fun x ↦ untop x.1 x.2) (𝓝 a) (𝓝 (untop a.1 a.2)) := by
have : Nonempty ι := ⟨untop a.1 a.2⟩
simp only [← untopA_eq_untop, ne_eq, coe_setOf, mem_setOf_eq]
exact (tendsto_untopA a.2).comp <| tendsto_subtype_rng.mp tendsto_id
lemma continuous_untop : Continuous (fun x : {a : WithTop ι | a ≠ ⊤} ↦ untop x.1 x.2) :=
continuous_iff_continuousAt.mpr tendsto_untop
end ContinuousUnTop
variable (ι) in
/-- Homeomorphism between the non-top elements of `WithTop ι` and `ι`. -/
noncomputable
def neTopHomeomorph : { a : WithTop ι | a ≠ ⊤ } ≃ₜ ι where
toEquiv := Equiv.withTopSubtypeNe
continuous_toFun := continuous_untop
continuous_invFun := continuous_coe.subtype_mk _
variable (ι) in
/-- If `ι` has a top element, then `WithTop ι` is homeomorphic to `ι ⊕ Unit`. -/
noncomputable
def sumHomeomorph [OrderTop ι] : WithTop ι ≃ₜ ι ⊕ Unit where
toFun x := if h : x = ⊤ then Sum.inr () else Sum.inl x.untopA
invFun x := match x with
| Sum.inl i => (i : WithTop ι)
| Sum.inr () => ⊤
left_inv x := by cases x <;> simp
right_inv x := by cases x <;> simp
continuous_toFun := by
have h_fr : frontier ({⊤} : Set (WithTop ι)) = ∅ := by
simp only [frontier, Set.finite_singleton, Set.Finite.isClosed, IsClosed.closure_eq]
suffices interior ({⊤} : Set (WithTop ι)) = {⊤} by simp [this]
rw [interior_eq_iff_isOpen]
have : {⊤} = Set.Ioi ((⊤ : ι) : WithTop ι) := by ext; simp
rw [this]
exact isOpen_Ioi
refine continuous_if' (by simp [h_fr]) (by simp [h_fr]) (by simp) ?_
exact Continuous.comp_continuousOn (by fun_prop) continuousOn_untopA
continuous_invFun := continuous_sum_dom.mpr ⟨by fun_prop, by fun_prop⟩
end WithTop |
.lake/packages/mathlib/Mathlib/Topology/Order/DenselyOrdered.lean | import Mathlib.Topology.Order.IsLUB
/-!
# Order topology on a densely ordered set
-/
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α β : Type*}
section DenselyOrdered
variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [DenselyOrdered α] {a b : α}
{s : Set α}
/-- The closure of the interval `(a, +∞)` is the closed interval `[a, +∞)`, unless `a` is a top
element. -/
theorem closure_Ioi' {a : α} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by
apply Subset.antisymm
· exact closure_minimal Ioi_subset_Ici_self isClosed_Ici
· rw [← diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff]
exact isGLB_Ioi.mem_closure h
/-- The closure of the interval `(a, +∞)` is the closed interval `[a, +∞)`. -/
@[simp]
theorem closure_Ioi (a : α) [NoMaxOrder α] : closure (Ioi a) = Ici a :=
closure_Ioi' nonempty_Ioi
/-- The closure of the interval `(-∞, a)` is the closed interval `(-∞, a]`, unless `a` is a bottom
element. -/
theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a :=
closure_Ioi' (α := αᵒᵈ) h
/-- The closure of the interval `(-∞, a)` is the interval `(-∞, a]`. -/
@[simp]
theorem closure_Iio (a : α) [NoMinOrder α] : closure (Iio a) = Iic a :=
closure_Iio' nonempty_Iio
/-- The closure of the open interval `(a, b)` is the closed interval `[a, b]`. -/
@[simp]
theorem closure_Ioo {a b : α} (hab : a ≠ b) : closure (Ioo a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioo_subset_Icc_self isClosed_Icc
· rcases hab.lt_or_gt with hab | hab
· rw [← diff_subset_closure_iff, Icc_diff_Ioo_same hab.le]
have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab
simp only [insert_subset_iff, singleton_subset_iff]
exact ⟨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'⟩
· rw [Icc_eq_empty_of_lt hab]
exact empty_subset _
/-- The closure of the interval `(a, b]` is the closed interval `[a, b]`. -/
@[simp]
theorem closure_Ioc {a b : α} (hab : a ≠ b) : closure (Ioc a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioc_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self)
rw [closure_Ioo hab]
/-- The closure of the interval `[a, b)` is the closed interval `[a, b]`. -/
@[simp]
theorem closure_Ico {a b : α} (hab : a ≠ b) : closure (Ico a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ico_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ico_self)
rw [closure_Ioo hab]
@[simp]
theorem interior_Ici' {a : α} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by
rw [← compl_Iio, interior_compl, closure_Iio' ha, compl_Iic]
theorem interior_Ici [NoMinOrder α] {a : α} : interior (Ici a) = Ioi a :=
interior_Ici' nonempty_Iio
@[simp]
theorem interior_Iic' {a : α} (ha : (Ioi a).Nonempty) : interior (Iic a) = Iio a :=
interior_Ici' (α := αᵒᵈ) ha
theorem interior_Iic [NoMaxOrder α] {a : α} : interior (Iic a) = Iio a :=
interior_Iic' nonempty_Ioi
@[simp]
theorem interior_Icc [NoMinOrder α] [NoMaxOrder α] {a b : α} : interior (Icc a b) = Ioo a b := by
rw [← Ici_inter_Iic, interior_inter, interior_Ici, interior_Iic, Ioi_inter_Iio]
@[simp]
theorem Icc_mem_nhds_iff [NoMinOrder α] [NoMaxOrder α] {a b x : α} :
Icc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by
rw [← interior_Icc, mem_interior_iff_mem_nhds]
@[simp]
theorem interior_Ico [NoMinOrder α] {a b : α} : interior (Ico a b) = Ioo a b := by
rw [← Ici_inter_Iio, interior_inter, interior_Ici, interior_Iio, Ioi_inter_Iio]
@[simp]
theorem Ico_mem_nhds_iff [NoMinOrder α] {a b x : α} : Ico a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by
rw [← interior_Ico, mem_interior_iff_mem_nhds]
@[simp]
theorem interior_Ioc [NoMaxOrder α] {a b : α} : interior (Ioc a b) = Ioo a b := by
rw [← Ioi_inter_Iic, interior_inter, interior_Ioi, interior_Iic, Ioi_inter_Iio]
@[simp]
theorem Ioc_mem_nhds_iff [NoMaxOrder α] {a b x : α} : Ioc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by
rw [← interior_Ioc, mem_interior_iff_mem_nhds]
theorem closure_interior_Icc {a b : α} (h : a ≠ b) : closure (interior (Icc a b)) = Icc a b :=
(closure_minimal interior_subset isClosed_Icc).antisymm <|
calc
Icc a b = closure (Ioo a b) := (closure_Ioo h).symm
_ ⊆ closure (interior (Icc a b)) :=
closure_mono (interior_maximal Ioo_subset_Icc_self isOpen_Ioo)
theorem Ioc_subset_closure_interior (a b : α) : Ioc a b ⊆ closure (interior (Ioc a b)) := by
rcases eq_or_ne a b with (rfl | h)
· simp
· calc
Ioc a b ⊆ Icc a b := Ioc_subset_Icc_self
_ = closure (Ioo a b) := (closure_Ioo h).symm
_ ⊆ closure (interior (Ioc a b)) :=
closure_mono (interior_maximal Ioo_subset_Ioc_self isOpen_Ioo)
theorem Ico_subset_closure_interior (a b : α) : Ico a b ⊆ closure (interior (Ico a b)) := by
simpa only [Ioc_toDual] using
Ioc_subset_closure_interior (OrderDual.toDual b) (OrderDual.toDual a)
@[simp]
theorem frontier_Ici' {a : α} (ha : (Iio a).Nonempty) : frontier (Ici a) = {a} := by
simp [frontier, ha]
theorem frontier_Ici [NoMinOrder α] {a : α} : frontier (Ici a) = {a} :=
frontier_Ici' nonempty_Iio
@[simp]
theorem frontier_Iic' {a : α} (ha : (Ioi a).Nonempty) : frontier (Iic a) = {a} := by
simp [frontier, ha]
theorem frontier_Iic [NoMaxOrder α] {a : α} : frontier (Iic a) = {a} :=
frontier_Iic' nonempty_Ioi
@[simp]
theorem frontier_Ioi' {a : α} (ha : (Ioi a).Nonempty) : frontier (Ioi a) = {a} := by
simp [frontier, closure_Ioi' ha]
theorem frontier_Ioi [NoMaxOrder α] {a : α} : frontier (Ioi a) = {a} :=
frontier_Ioi' nonempty_Ioi
@[simp]
theorem frontier_Iio' {a : α} (ha : (Iio a).Nonempty) : frontier (Iio a) = {a} := by
simp [frontier, closure_Iio' ha]
theorem frontier_Iio [NoMinOrder α] {a : α} : frontier (Iio a) = {a} :=
frontier_Iio' nonempty_Iio
@[simp]
theorem frontier_Icc [NoMinOrder α] [NoMaxOrder α] {a b : α} (h : a ≤ b) :
frontier (Icc a b) = {a, b} := by simp [frontier, h, Icc_diff_Ioo_same]
@[simp]
theorem frontier_Ioo {a b : α} (h : a < b) : frontier (Ioo a b) = {a, b} := by
rw [frontier, closure_Ioo h.ne, interior_Ioo, Icc_diff_Ioo_same h.le]
@[simp]
theorem frontier_Ico [NoMinOrder α] {a b : α} (h : a < b) : frontier (Ico a b) = {a, b} := by
rw [frontier, closure_Ico h.ne, interior_Ico, Icc_diff_Ioo_same h.le]
@[simp]
theorem frontier_Ioc [NoMaxOrder α] {a b : α} (h : a < b) : frontier (Ioc a b) = {a, b} := by
rw [frontier, closure_Ioc h.ne, interior_Ioc, Icc_diff_Ioo_same h.le]
theorem nhdsWithin_Ioi_neBot' {a b : α} (H₁ : (Ioi a).Nonempty) (H₂ : a ≤ b) :
NeBot (𝓝[Ioi a] b) :=
mem_closure_iff_nhdsWithin_neBot.1 <| by rwa [closure_Ioi' H₁]
theorem nhdsWithin_Ioi_neBot [NoMaxOrder α] {a b : α} (H : a ≤ b) : NeBot (𝓝[Ioi a] b) :=
nhdsWithin_Ioi_neBot' nonempty_Ioi H
theorem nhdsGT_neBot_of_exists_gt {a : α} (H : ∃ b, a < b) : NeBot (𝓝[>] a) :=
nhdsWithin_Ioi_neBot' H (le_refl a)
instance nhdsGT_neBot [NoMaxOrder α] (a : α) : NeBot (𝓝[>] a) := nhdsWithin_Ioi_neBot le_rfl
theorem nhdsWithin_Iio_neBot' {b c : α} (H₁ : (Iio c).Nonempty) (H₂ : b ≤ c) :
NeBot (𝓝[Iio c] b) :=
mem_closure_iff_nhdsWithin_neBot.1 <| by rwa [closure_Iio' H₁]
theorem nhdsWithin_Iio_neBot [NoMinOrder α] {a b : α} (H : a ≤ b) : NeBot (𝓝[Iio b] a) :=
nhdsWithin_Iio_neBot' nonempty_Iio H
theorem nhdsWithin_Iio_self_neBot' {b : α} (H : (Iio b).Nonempty) : NeBot (𝓝[<] b) :=
nhdsWithin_Iio_neBot' H (le_refl b)
instance nhdsLT_neBot [NoMinOrder α] (a : α) : NeBot (𝓝[<] a) := nhdsWithin_Iio_neBot (le_refl a)
theorem right_nhdsWithin_Ico_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ico a b] b) :=
(isLUB_Ico H).nhdsWithin_neBot (nonempty_Ico.2 H)
theorem left_nhdsWithin_Ioc_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ioc a b] a) :=
(isGLB_Ioc H).nhdsWithin_neBot (nonempty_Ioc.2 H)
theorem left_nhdsWithin_Ioo_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ioo a b] a) :=
(isGLB_Ioo H).nhdsWithin_neBot (nonempty_Ioo.2 H)
theorem right_nhdsWithin_Ioo_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ioo a b] b) :=
(isLUB_Ioo H).nhdsWithin_neBot (nonempty_Ioo.2 H)
theorem comap_coe_nhdsLT_of_Ioo_subset (hb : s ⊆ Iio b) (hs : s.Nonempty → ∃ a < b, Ioo a b ⊆ s) :
comap ((↑) : s → α) (𝓝[<] b) = atTop := by
nontriviality
haveI : Nonempty s := nontrivial_iff_nonempty.1 ‹_›
rcases hs (nonempty_subtype.1 ‹_›) with ⟨a, h, hs⟩
ext u; constructor
· rintro ⟨t, ht, hts⟩
obtain ⟨x, ⟨hxa : a ≤ x, hxb : x < b⟩, hxt : Ioo x b ⊆ t⟩ :=
(mem_nhdsLT_iff_exists_mem_Ico_Ioo_subset h).mp ht
obtain ⟨y, hxy, hyb⟩ := exists_between hxb
refine mem_of_superset (mem_atTop ⟨y, hs ⟨hxa.trans_lt hxy, hyb⟩⟩) ?_
rintro ⟨z, hzs⟩ (hyz : y ≤ z)
exact hts (hxt ⟨hxy.trans_le hyz, hb hzs⟩)
· intro hu
obtain ⟨x : s, hx : ∀ z, x ≤ z → z ∈ u⟩ := mem_atTop_sets.1 hu
exact ⟨Ioo x b, Ioo_mem_nhdsLT (hb x.2), fun z hz => hx _ hz.1.le⟩
theorem comap_coe_nhdsGT_of_Ioo_subset (ha : s ⊆ Ioi a) (hs : s.Nonempty → ∃ b > a, Ioo a b ⊆ s) :
comap ((↑) : s → α) (𝓝[>] a) = atBot := by
apply comap_coe_nhdsLT_of_Ioo_subset (show ofDual ⁻¹' s ⊆ Iio (toDual a) from ha)
simp only [OrderDual.exists, Ioo_toDual]
exact hs
theorem map_coe_atTop_of_Ioo_subset (hb : s ⊆ Iio b) (hs : ∀ a' < b, ∃ a < b, Ioo a b ⊆ s) :
map ((↑) : s → α) atTop = 𝓝[<] b := by
rcases eq_empty_or_nonempty (Iio b) with (hb' | ⟨a, ha⟩)
· have : IsEmpty s := ⟨fun x => hb'.subset (hb x.2)⟩
rw [filter_eq_bot_of_isEmpty atTop, Filter.map_bot, hb', nhdsWithin_empty]
· rw [← comap_coe_nhdsLT_of_Ioo_subset hb fun _ => hs a ha, map_comap_of_mem]
rw [Subtype.range_val]
exact (mem_nhdsLT_iff_exists_Ioo_subset' ha).2 (hs a ha)
theorem map_coe_atBot_of_Ioo_subset (ha : s ⊆ Ioi a) (hs : ∀ b' > a, ∃ b > a, Ioo a b ⊆ s) :
map ((↑) : s → α) atBot = 𝓝[>] a := by
-- the elaborator gets stuck without `(... :)`
refine (map_coe_atTop_of_Ioo_subset (show ofDual ⁻¹' s ⊆ Iio (toDual a) from ha)
fun b' hb' => ?_ :)
simpa using hs b' hb'
/-- The `atTop` filter for an open interval `Ioo a b` comes from the left-neighbourhoods filter at
the right endpoint in the ambient order. -/
theorem comap_coe_Ioo_nhdsLT (a b : α) : comap ((↑) : Ioo a b → α) (𝓝[<] b) = atTop :=
comap_coe_nhdsLT_of_Ioo_subset Ioo_subset_Iio_self fun h => ⟨a, nonempty_Ioo.1 h, Subset.refl _⟩
/-- The `atBot` filter for an open interval `Ioo a b` comes from the right-neighbourhoods filter at
the left endpoint in the ambient order. -/
theorem comap_coe_Ioo_nhdsGT (a b : α) : comap ((↑) : Ioo a b → α) (𝓝[>] a) = atBot :=
comap_coe_nhdsGT_of_Ioo_subset Ioo_subset_Ioi_self fun h => ⟨b, nonempty_Ioo.1 h, Subset.refl _⟩
theorem comap_coe_Ioi_nhdsGT (a : α) : comap ((↑) : Ioi a → α) (𝓝[>] a) = atBot :=
comap_coe_nhdsGT_of_Ioo_subset (Subset.refl _) fun ⟨x, hx⟩ => ⟨x, hx, Ioo_subset_Ioi_self⟩
theorem comap_coe_Iio_nhdsLT (a : α) : comap ((↑) : Iio a → α) (𝓝[<] a) = atTop :=
comap_coe_Ioi_nhdsGT (α := αᵒᵈ) a
@[simp]
theorem map_coe_Ioo_atTop {a b : α} (h : a < b) : map ((↑) : Ioo a b → α) atTop = 𝓝[<] b :=
map_coe_atTop_of_Ioo_subset Ioo_subset_Iio_self fun _ _ => ⟨_, h, Subset.refl _⟩
@[simp]
theorem map_coe_Ioo_atBot {a b : α} (h : a < b) : map ((↑) : Ioo a b → α) atBot = 𝓝[>] a :=
map_coe_atBot_of_Ioo_subset Ioo_subset_Ioi_self fun _ _ => ⟨_, h, Subset.refl _⟩
@[simp]
theorem map_coe_Ioi_atBot (a : α) : map ((↑) : Ioi a → α) atBot = 𝓝[>] a :=
map_coe_atBot_of_Ioo_subset (Subset.refl _) fun b hb => ⟨b, hb, Ioo_subset_Ioi_self⟩
@[simp]
theorem map_coe_Iio_atTop (a : α) : map ((↑) : Iio a → α) atTop = 𝓝[<] a :=
map_coe_Ioi_atBot (α := αᵒᵈ) _
variable {l : Filter β} {f : α → β}
@[simp]
theorem tendsto_comp_coe_Ioo_atTop (h : a < b) :
Tendsto (fun x : Ioo a b => f x) atTop l ↔ Tendsto f (𝓝[<] b) l := by
rw [← map_coe_Ioo_atTop h, tendsto_map'_iff]; rfl
@[simp]
theorem tendsto_comp_coe_Ioo_atBot (h : a < b) :
Tendsto (fun x : Ioo a b => f x) atBot l ↔ Tendsto f (𝓝[>] a) l := by
rw [← map_coe_Ioo_atBot h, tendsto_map'_iff]; rfl
@[simp]
theorem tendsto_comp_coe_Ioi_atBot :
Tendsto (fun x : Ioi a => f x) atBot l ↔ Tendsto f (𝓝[>] a) l := by
rw [← map_coe_Ioi_atBot, tendsto_map'_iff]; rfl
@[simp]
theorem tendsto_comp_coe_Iio_atTop :
Tendsto (fun x : Iio a => f x) atTop l ↔ Tendsto f (𝓝[<] a) l := by
rw [← map_coe_Iio_atTop, tendsto_map'_iff]; rfl
@[simp]
theorem tendsto_Ioo_atTop {f : β → Ioo a b} :
Tendsto f l atTop ↔ Tendsto (fun x => (f x : α)) l (𝓝[<] b) := by
rw [← comap_coe_Ioo_nhdsLT, tendsto_comap_iff]; rfl
@[simp]
theorem tendsto_Ioo_atBot {f : β → Ioo a b} :
Tendsto f l atBot ↔ Tendsto (fun x => (f x : α)) l (𝓝[>] a) := by
rw [← comap_coe_Ioo_nhdsGT, tendsto_comap_iff]; rfl
@[simp]
theorem tendsto_Ioi_atBot {f : β → Ioi a} :
Tendsto f l atBot ↔ Tendsto (fun x => (f x : α)) l (𝓝[>] a) := by
rw [← comap_coe_Ioi_nhdsGT, tendsto_comap_iff]; rfl
@[simp]
theorem tendsto_Iio_atTop {f : β → Iio a} :
Tendsto f l atTop ↔ Tendsto (fun x => (f x : α)) l (𝓝[<] a) := by
rw [← comap_coe_Iio_nhdsLT, tendsto_comap_iff]; rfl
instance (x : α) [Nontrivial α] : NeBot (𝓝[≠] x) := by
refine forall_mem_nonempty_iff_neBot.1 fun s hs => ?_
obtain ⟨u, u_open, xu, us⟩ : ∃ u : Set α, IsOpen u ∧ x ∈ u ∧ u ∩ {x}ᶜ ⊆ s := mem_nhdsWithin.1 hs
obtain ⟨a, b, a_lt_b, hab⟩ : ∃ a b : α, a < b ∧ Ioo a b ⊆ u := u_open.exists_Ioo_subset ⟨x, xu⟩
obtain ⟨y, hy⟩ : ∃ y, a < y ∧ y < b := exists_between a_lt_b
rcases ne_or_eq x y with (xy | rfl)
· exact ⟨y, us ⟨hab hy, xy.symm⟩⟩
obtain ⟨z, hz⟩ : ∃ z, a < z ∧ z < x := exists_between hy.1
exact ⟨z, us ⟨hab ⟨hz.1, hz.2.trans hy.2⟩, hz.2.ne⟩⟩
/-- If the order topology for a dense linear ordering is discrete, the space has at most one point.
We would prefer for this to be an instance but even at `(priority := 100)` this was problematic so
we have deferred this issue. TODO Promote this to an `instance`! -/
lemma DenselyOrdered.subsingleton_of_discreteTopology [DiscreteTopology α] : Subsingleton α := by
suffices ∀ a b : α, b ≤ a from ⟨fun a b ↦ le_antisymm (this b a) (this a b)⟩
intro a b
by_contra! contra
suffices b ∈ Ioo a b by grind
rw [← (isClosed_discrete (Ioo a b)).closure_eq, closure_Ioo contra.ne]
grind
/-- Let `s` be a dense set in a nontrivial dense linear order `α`. If `s` is a
separable space (e.g., if `α` has a second countable topology), then there exists a countable
dense subset `t ⊆ s` such that `t` does not contain bottom/top elements of `α`. -/
theorem Dense.exists_countable_dense_subset_no_bot_top [Nontrivial α] {s : Set α} [SeparableSpace s]
(hs : Dense s) :
∃ t, t ⊆ s ∧ t.Countable ∧ Dense t ∧ (∀ x, IsBot x → x ∉ t) ∧ ∀ x, IsTop x → x ∉ t := by
rcases hs.exists_countable_dense_subset with ⟨t, hts, htc, htd⟩
refine ⟨t \ ({ x | IsBot x } ∪ { x | IsTop x }), ?_, ?_, ?_, fun x hx => ?_, fun x hx => ?_⟩
· exact diff_subset.trans hts
· exact htc.mono diff_subset
· exact htd.diff_finite ((subsingleton_isBot α).finite.union (subsingleton_isTop α).finite)
· simp [hx]
· simp [hx]
variable (α) in
/-- If `α` is a nontrivial separable dense linear order, then there exists a
countable dense set `s : Set α` that contains neither top nor bottom elements of `α`.
For a dense set containing both bot and top elements, see
`exists_countable_dense_bot_top`. -/
theorem exists_countable_dense_no_bot_top [SeparableSpace α] [Nontrivial α] :
∃ s : Set α, s.Countable ∧ Dense s ∧ (∀ x, IsBot x → x ∉ s) ∧ ∀ x, IsTop x → x ∉ s := by
simpa using dense_univ.exists_countable_dense_subset_no_bot_top
/-- `Set.Ico a b` is only closed if it is empty. -/
@[simp]
theorem isClosed_Ico_iff {a b : α} : IsClosed (Set.Ico a b) ↔ b ≤ a := by
refine ⟨fun h => le_of_not_gt fun hab => ?_, by simp_all⟩
have := h.closure_eq
rw [closure_Ico hab.ne, Icc_eq_Ico_same_iff] at this
exact this hab.le
/-- `Set.Ioc a b` is only closed if it is empty. -/
@[simp]
theorem isClosed_Ioc_iff {a b : α} : IsClosed (Set.Ioc a b) ↔ b ≤ a := by
refine ⟨fun h => le_of_not_gt fun hab => ?_, by simp_all⟩
have := h.closure_eq
rw [closure_Ioc hab.ne, Icc_eq_Ioc_same_iff] at this
exact this hab.le
/-- `Set.Ioo a b` is only closed if it is empty. -/
@[simp]
theorem isClosed_Ioo_iff {a b : α} : IsClosed (Set.Ioo a b) ↔ b ≤ a := by
refine ⟨fun h => le_of_not_gt fun hab => ?_, by simp_all⟩
have := h.closure_eq
rw [closure_Ioo hab.ne, Icc_eq_Ioo_same_iff] at this
exact this hab.le
end DenselyOrdered |
.lake/packages/mathlib/Mathlib/Topology/Order/OrderClosedExtr.lean | import Mathlib.Topology.Order.OrderClosed
import Mathlib.Topology.Order.LocalExtr
/-!
# Local maxima from monotonicity and antitonicity
In this file we prove a lemma that is useful for the First Derivative Test in calculus,
and its dual.
## Main statements
* `isLocalMax_of_mono_anti` : if a function `f` is monotone to the left of `x`
and antitone to the right of `x` then `f` has a local maximum at `x`.
* `isLocalMin_of_anti_mono` : the dual statement for minima.
* `isLocalMax_of_mono_anti'` : a version of `isLocalMax_of_mono_anti` for filters.
* `isLocalMin_of_anti_mono'` : a version of `isLocalMax_of_mono_anti'` for minima.
-/
open Set Topology Filter
/-- If `f` is monotone on `(a,b]` and antitone on `[b,c)` then `f` has
a local maximum at `b`. -/
lemma isLocalMax_of_mono_anti
{α : Type*} [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α]
{β : Type*} [Preorder β]
{a b c : α} (g₀ : a < b) (g₁ : b < c) {f : α → β}
(h₀ : MonotoneOn f (Ioc a b))
(h₁ : AntitoneOn f (Ico b c)) : IsLocalMax f b :=
isLocalMax_of_mono_anti' (Ioc_mem_nhdsLE g₀) (Ico_mem_nhdsGE g₁) h₀ h₁
/-- If `f` is antitone on `(a,b]` and monotone on `[b,c)` then `f` has
a local minimum at `b`. -/
lemma isLocalMin_of_anti_mono
{α : Type*} [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α]
{β : Type*} [Preorder β] {a b c : α} (g₀ : a < b) (g₁ : b < c) {f : α → β}
(h₀ : AntitoneOn f (Ioc a b)) (h₁ : MonotoneOn f (Ico b c)) : IsLocalMin f b :=
mem_of_superset (Ioo_mem_nhds g₀ g₁) (fun x hx => by rcases le_total x b <;> aesop) |
.lake/packages/mathlib/Mathlib/Topology/Order/Bornology.lean | import Mathlib.Topology.Bornology.Constructions
/-!
# Bornology of order-bounded sets
This file relates the notion of bornology-boundedness (sets that lie in a bornology) to the notion
of order-boundedness (sets that are bounded above and below).
## Main declarations
* `orderBornology`: The bornology of order-bounded sets of a nonempty lattice.
* `IsOrderBornology`: Typeclass predicate for a preorder to be equipped with its order-bornology.
-/
open Bornology Set
variable {α : Type*} {s t : Set α}
section Lattice
variable [Lattice α] [Nonempty α]
/-- Order-bornology on a nonempty lattice. The bounded sets are the sets that are bounded both above
and below. -/
def orderBornology : Bornology α := .ofBounded
{s | BddBelow s ∧ BddAbove s}
(by simp)
(fun _ hs _ hst ↦ ⟨hs.1.mono hst, hs.2.mono hst⟩)
(fun _ hs _ ht ↦ ⟨hs.1.union ht.1, hs.2.union ht.2⟩)
(by simp)
@[simp] lemma orderBornology_isBounded : orderBornology.IsBounded s ↔ BddBelow s ∧ BddAbove s := by
simp [IsBounded, IsCobounded, -isCobounded_compl_iff]
end Lattice
variable [Bornology α]
variable (α) [Preorder α] in
/-- Predicate for a preorder to be equipped with its order-bornology, namely for its bounded sets
to be the ones that are bounded both above and below. -/
class IsOrderBornology : Prop where
protected isBounded_iff_bddBelow_bddAbove (s : Set α) : IsBounded s ↔ BddBelow s ∧ BddAbove s
lemma isOrderBornology_iff_eq_orderBornology [Lattice α] [Nonempty α] :
IsOrderBornology α ↔ ‹Bornology α› = orderBornology := by
refine ⟨fun h ↦ ?_, fun h ↦ ⟨fun s ↦ by rw [h, orderBornology_isBounded]⟩⟩
ext s
exact isBounded_compl_iff.symm.trans (h.1 _)
section Preorder
variable [Preorder α] [IsOrderBornology α]
lemma isBounded_iff_bddBelow_bddAbove : IsBounded s ↔ BddBelow s ∧ BddAbove s :=
IsOrderBornology.isBounded_iff_bddBelow_bddAbove _
protected lemma Bornology.IsBounded.bddBelow (hs : IsBounded s) : BddBelow s :=
(isBounded_iff_bddBelow_bddAbove.1 hs).1
protected lemma Bornology.IsBounded.bddAbove (hs : IsBounded s) : BddAbove s :=
(isBounded_iff_bddBelow_bddAbove.1 hs).2
protected lemma BddBelow.isBounded (hs₀ : BddBelow s) (hs₁ : BddAbove s) : IsBounded s :=
isBounded_iff_bddBelow_bddAbove.2 ⟨hs₀, hs₁⟩
protected lemma BddAbove.isBounded (hs₀ : BddAbove s) (hs₁ : BddBelow s) : IsBounded s :=
isBounded_iff_bddBelow_bddAbove.2 ⟨hs₁, hs₀⟩
lemma BddBelow.isBounded_inter (hs : BddBelow s) (ht : BddAbove t) : IsBounded (s ∩ t) :=
(hs.mono inter_subset_left).isBounded <| ht.mono inter_subset_right
lemma BddAbove.isBounded_inter (hs : BddAbove s) (ht : BddBelow t) : IsBounded (s ∩ t) :=
(hs.mono inter_subset_left).isBounded <| ht.mono inter_subset_right
instance OrderDual.instIsOrderBornology : IsOrderBornology αᵒᵈ where
isBounded_iff_bddBelow_bddAbove s := by
rw [← isBounded_preimage_toDual, ← bddBelow_preimage_toDual, ← bddAbove_preimage_toDual,
isBounded_iff_bddBelow_bddAbove, and_comm]
instance Prod.instIsOrderBornology {β : Type*} [Preorder β] [Bornology β] [IsOrderBornology β] :
IsOrderBornology (α × β) where
isBounded_iff_bddBelow_bddAbove s := by
rw [← isBounded_image_fst_and_snd, bddBelow_prod, bddAbove_prod, and_and_and_comm,
isBounded_iff_bddBelow_bddAbove, isBounded_iff_bddBelow_bddAbove]
instance Pi.instIsOrderBornology {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)]
[∀ i, Bornology (α i)] [∀ i, IsOrderBornology (α i)] : IsOrderBornology (∀ i, α i) where
isBounded_iff_bddBelow_bddAbove s := by
simp_rw [← forall_isBounded_image_eval_iff, bddBelow_pi, bddAbove_pi, ← forall_and,
isBounded_iff_bddBelow_bddAbove]
end Preorder
section ConditionallyCompleteLattice
variable [ConditionallyCompleteLattice α] [IsOrderBornology α] {s : Set α}
protected lemma Bornology.IsBounded.subset_Icc_sInf_sSup (hs : IsBounded s) :
s ⊆ Icc (sInf s) (sSup s) := subset_Icc_csInf_csSup hs.bddBelow hs.bddAbove
end ConditionallyCompleteLattice |
.lake/packages/mathlib/Mathlib/Topology/Order/Compact.lean | import Mathlib.Topology.Algebra.Support
import Mathlib.Topology.Order.IntermediateValue
import Mathlib.Topology.Order.IsLUB
import Mathlib.Topology.Order.LocalExtr
/-!
# Compactness of a closed interval
In this file we prove that a closed interval in a conditionally complete linear ordered type with
order topology (or a product of such types) is compact.
We prove the extreme value theorem (`IsCompact.exists_isMinOn`, `IsCompact.exists_isMaxOn`):
a continuous function on a compact set takes its minimum and maximum values. We provide many
variations of this theorem.
We also prove that the image of a closed interval under a continuous map is a closed interval, see
`ContinuousOn.image_Icc`.
## Tags
compact, extreme value theorem
-/
open Filter OrderDual TopologicalSpace Function Set
open scoped Filter Topology
/-!
### Compactness of a closed interval
In this section we define a typeclass `CompactIccSpace α` saying that all closed intervals in `α`
are compact. Then we provide an instance for a `ConditionallyCompleteLinearOrder` and prove that
the product (both `α × β` and an indexed product) of spaces with this property inherits the
property.
We also prove some simple lemmas about spaces with this property.
-/
/-- This typeclass says that all closed intervals in `α` are compact. This is true for all
conditionally complete linear orders with order topology and products (finite or infinite)
of such spaces. -/
class CompactIccSpace (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where
/-- A closed interval `Set.Icc a b` is a compact set for all `a` and `b`. -/
isCompact_Icc : ∀ {a b : α}, IsCompact (Icc a b)
export CompactIccSpace (isCompact_Icc)
variable {α : Type*}
-- TODO: make it the definition
lemma CompactIccSpace.mk' [TopologicalSpace α] [Preorder α]
(h : ∀ {a b : α}, a ≤ b → IsCompact (Icc a b)) : CompactIccSpace α where
isCompact_Icc {a b} := by_cases h fun hab => by rw [Icc_eq_empty hab]; exact isCompact_empty
-- TODO: drop one `'`
lemma CompactIccSpace.mk'' [TopologicalSpace α] [PartialOrder α]
(h : ∀ {a b : α}, a < b → IsCompact (Icc a b)) : CompactIccSpace α :=
.mk' fun hab => hab.eq_or_lt.elim (by rintro rfl; simp) h
instance [TopologicalSpace α] [Preorder α] [CompactIccSpace α] : CompactIccSpace (αᵒᵈ) where
isCompact_Icc := by
intro a b
convert isCompact_Icc (α := α) (a := b) (b := a) using 1
exact Icc_toDual (α := α)
/-- A closed interval in a conditionally complete linear order is compact. -/
instance (priority := 100) ConditionallyCompleteLinearOrder.toCompactIccSpace (α : Type*)
[ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] :
CompactIccSpace α := by
refine .mk'' fun {a b} hlt => ?_
rcases le_or_gt a b with hab | hab
swap
· simp [hab]
refine isCompact_iff_ultrafilter_le_nhds.2 fun f hf => ?_
contrapose! hf
rw [le_principal_iff]
have hpt : ∀ x ∈ Icc a b, {x} ∉ f := fun x hx hxf =>
hf x hx ((le_pure_iff.2 hxf).trans (pure_le_nhds x))
set s := { x ∈ Icc a b | Icc a x ∉ f }
have hsb : b ∈ upperBounds s := fun x hx => hx.1.2
have sbd : BddAbove s := ⟨b, hsb⟩
have ha : a ∈ s := by simp [s, hpt, hab]
rcases hab.eq_or_lt with (rfl | _hlt)
· exact ha.2
let c := sSup s
have hsc : IsLUB s c := isLUB_csSup ⟨a, ha⟩ ⟨b, hsb⟩
have hc : c ∈ Icc a b := ⟨hsc.1 ha, hsc.2 hsb⟩
specialize hf c hc
have hcs : c ∈ s := by
-- rcases ... with (rfl | ... ) fails here, rewrite manually.
rcases hc.1.eq_or_lt with (h | hlt)
· rwa [h] at ha
refine ⟨hc, fun hcf => hf fun U hU => ?_⟩
rcases (mem_nhdsLE_iff_exists_Ioc_subset' hlt).1 (mem_nhdsWithin_of_mem_nhds hU)
with ⟨x, hxc, hxU⟩
rcases ((hsc.frequently_mem ⟨a, ha⟩).and_eventually (Ioc_mem_nhdsLE hxc)).exists
with ⟨y, ⟨_hyab, hyf⟩, hy⟩
refine mem_of_superset (f.diff_mem_iff.2 ⟨hcf, hyf⟩) (Subset.trans ?_ hxU)
rw [diff_subset_iff]
exact Subset.trans Icc_subset_Icc_union_Ioc <| union_subset_union Subset.rfl <|
Ioc_subset_Ioc_left hy.1.le
-- rcases ... with (rfl | ... ) fails here, rewrite manually.
rcases hc.2.eq_or_lt with (h | hlt)
· simpa [h] using hcs.2
exfalso
refine hf fun U hU => ?_
rcases (mem_nhdsGE_iff_exists_mem_Ioc_Ico_subset hlt).1 (mem_nhdsWithin_of_mem_nhds hU)
with ⟨y, hxy, hyU⟩
refine mem_of_superset ?_ hyU; clear! U
have hy : y ∈ Icc a b := ⟨hc.1.trans hxy.1.le, hxy.2⟩
by_cases hay : Icc a y ∈ f
· refine mem_of_superset (f.diff_mem_iff.2 ⟨f.diff_mem_iff.2 ⟨hay, hcs.2⟩, hpt y hy⟩) ?_
rw [diff_subset_iff, union_comm, Ico_union_right hxy.1.le, diff_subset_iff]
exact Icc_subset_Icc_union_Icc
· exact ((hsc.1 ⟨hy, hay⟩).not_gt hxy.1).elim
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)]
[∀ i, CompactIccSpace (α i)] : CompactIccSpace (∀ i, α i) :=
⟨fun {a b} => (pi_univ_Icc a b ▸ isCompact_univ_pi) fun _ => isCompact_Icc⟩
instance Pi.compact_Icc_space' {α β : Type*} [Preorder β] [TopologicalSpace β]
[CompactIccSpace β] : CompactIccSpace (α → β) :=
inferInstance
instance {α β : Type*} [Preorder α] [TopologicalSpace α] [CompactIccSpace α] [Preorder β]
[TopologicalSpace β] [CompactIccSpace β] : CompactIccSpace (α × β) :=
⟨fun {a b} => (Icc_prod_eq a b).symm ▸ isCompact_Icc.prod isCompact_Icc⟩
/-- An unordered closed interval is compact. -/
theorem isCompact_uIcc {α : Type*} [LinearOrder α] [TopologicalSpace α] [CompactIccSpace α]
{a b : α} : IsCompact (uIcc a b) :=
isCompact_Icc
-- See note [lower instance priority]
/-- A complete linear order is a compact space.
We do not register an instance for a `[CompactIccSpace α]` because this would only add instances
for products (indexed or not) of complete linear orders, and we have instances with higher priority
that cover these cases. -/
instance (priority := 100) compactSpace_of_completeLinearOrder {α : Type*} [CompleteLinearOrder α]
[TopologicalSpace α] [OrderTopology α] : CompactSpace α :=
⟨by simp only [← Icc_bot_top, isCompact_Icc]⟩
section
variable {α : Type*} [Preorder α] [TopologicalSpace α] [CompactIccSpace α]
instance compactSpace_Icc (a b : α) : CompactSpace (Icc a b) :=
isCompact_iff_compactSpace.mp isCompact_Icc
end
section openIntervals
variable {α : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α] [DenselyOrdered α]
/-- `Set.Ico a b` is only compact if it is empty. -/
@[simp]
theorem isCompact_Ico_iff {a b : α} : IsCompact (Set.Ico a b) ↔ b ≤ a :=
⟨fun h => isClosed_Ico_iff.mp h.isClosed, by simp_all⟩
/-- `Set.Ioc a b` is only compact if it is empty. -/
@[simp]
theorem isCompact_Ioc_iff {a b : α} : IsCompact (Set.Ioc a b) ↔ b ≤ a :=
⟨fun h => isClosed_Ioc_iff.mp h.isClosed, by simp_all⟩
/-- `Set.Ioo a b` is only compact if it is empty. -/
@[simp]
theorem isCompact_Ioo_iff {a b : α} : IsCompact (Set.Ioo a b) ↔ b ≤ a :=
⟨fun h => isClosed_Ioo_iff.mp h.isClosed, by simp_all⟩
end openIntervals
/-!
### Extreme value theorem
-/
section LinearOrder
variable {α β γ : Type*} [LinearOrder α] [TopologicalSpace α]
[TopologicalSpace β] [TopologicalSpace γ]
theorem IsCompact.exists_isLeast [ClosedIicTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : ∃ x, IsLeast s x := by
haveI : Nonempty s := ne_s.to_subtype
suffices (s ∩ ⋂ x ∈ s, Iic x).Nonempty from
⟨this.choose, this.choose_spec.1, mem_iInter₂.mp this.choose_spec.2⟩
rw [biInter_eq_iInter]
by_contra H
rw [not_nonempty_iff_eq_empty] at H
rcases hs.elim_directed_family_closed (fun x : s => Iic ↑x) (fun x => isClosed_Iic) H
(Monotone.directed_ge fun _ _ h => Iic_subset_Iic.mpr h) with ⟨x, hx⟩
exact not_nonempty_iff_eq_empty.mpr hx ⟨x, x.2, le_rfl⟩
theorem IsCompact.exists_isGreatest [ClosedIciTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : ∃ x, IsGreatest s x :=
IsCompact.exists_isLeast (α := αᵒᵈ) hs ne_s
theorem IsCompact.exists_isGLB [ClosedIicTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : ∃ x ∈ s, IsGLB s x :=
(hs.exists_isLeast ne_s).imp (fun x (hx : IsLeast s x) => ⟨hx.1, hx.isGLB⟩)
theorem IsCompact.exists_isLUB [ClosedIciTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : ∃ x ∈ s, IsLUB s x :=
IsCompact.exists_isGLB (α := αᵒᵈ) hs ne_s
theorem cocompact_le_atBot_atTop [CompactIccSpace α] :
cocompact α ≤ atBot ⊔ atTop := by
refine fun s hs ↦ mem_cocompact.mpr <| (isEmpty_or_nonempty α).casesOn ?_ ?_ <;> intro
· exact ⟨∅, isCompact_empty, fun x _ ↦ (IsEmpty.false x).elim⟩
· obtain ⟨t, ht⟩ := mem_atBot_sets.mp hs.1
obtain ⟨u, hu⟩ := mem_atTop_sets.mp hs.2
refine ⟨Icc t u, isCompact_Icc, fun x hx ↦ ?_⟩
exact (not_and_or.mp hx).casesOn (fun h ↦ ht x (le_of_not_ge h)) fun h ↦ hu x (le_of_not_ge h)
theorem cocompact_le_atBot [OrderTop α] [CompactIccSpace α] :
cocompact α ≤ atBot := by
refine fun _ hs ↦ mem_cocompact.mpr <| (isEmpty_or_nonempty α).casesOn ?_ ?_ <;> intro
· exact ⟨∅, isCompact_empty, fun x _ ↦ (IsEmpty.false x).elim⟩
· obtain ⟨t, ht⟩ := mem_atBot_sets.mp hs
refine ⟨Icc t ⊤, isCompact_Icc, fun _ hx ↦ ?_⟩
exact (not_and_or.mp hx).casesOn (fun h ↦ ht _ (le_of_not_ge h)) (fun h ↦ (h le_top).elim)
theorem cocompact_le_atTop [OrderBot α] [CompactIccSpace α] :
cocompact α ≤ atTop :=
cocompact_le_atBot (α := αᵒᵈ)
theorem atBot_le_cocompact [NoMinOrder α] [ClosedIicTopology α] :
atBot ≤ cocompact α := by
refine fun s hs ↦ ?_
obtain ⟨t, ht, hts⟩ := mem_cocompact.mp hs
refine (Set.eq_empty_or_nonempty t).casesOn (fun h_empty ↦ ?_) (fun h_nonempty ↦ ?_)
· rewrite [compl_univ_iff.mpr h_empty, univ_subset_iff] at hts
convert univ_mem
· haveI := h_nonempty.nonempty
obtain ⟨a, ha⟩ := ht.exists_isLeast h_nonempty
obtain ⟨b, hb⟩ := exists_lt a
exact Filter.mem_atBot_sets.mpr ⟨b, fun b' hb' ↦ hts <| Classical.byContradiction
fun hc ↦ LT.lt.false <| hb'.trans_lt <| hb.trans_le <| ha.2 (not_notMem.mp hc)⟩
theorem atTop_le_cocompact [NoMaxOrder α] [ClosedIciTopology α] :
atTop ≤ cocompact α :=
atBot_le_cocompact (α := αᵒᵈ)
theorem atBot_atTop_le_cocompact [NoMinOrder α] [NoMaxOrder α]
[OrderClosedTopology α] : atBot ⊔ atTop ≤ cocompact α :=
sup_le atBot_le_cocompact atTop_le_cocompact
@[simp 900]
theorem cocompact_eq_atBot_atTop [NoMaxOrder α] [NoMinOrder α]
[OrderClosedTopology α] [CompactIccSpace α] : cocompact α = atBot ⊔ atTop :=
cocompact_le_atBot_atTop.antisymm atBot_atTop_le_cocompact
@[simp]
theorem cocompact_eq_atBot [NoMinOrder α] [OrderTop α]
[ClosedIicTopology α] [CompactIccSpace α] : cocompact α = atBot :=
cocompact_le_atBot.antisymm atBot_le_cocompact
@[simp]
theorem cocompact_eq_atTop [NoMaxOrder α] [OrderBot α]
[ClosedIciTopology α] [CompactIccSpace α] : cocompact α = atTop :=
cocompact_le_atTop.antisymm atTop_le_cocompact
/-- The **extreme value theorem**: a continuous function realizes its minimum on a compact set. -/
theorem IsCompact.exists_isMinOn [ClosedIicTopology α] {s : Set β} (hs : IsCompact s)
(ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, IsMinOn f s x := by
rcases (hs.image_of_continuousOn hf).exists_isLeast (ne_s.image f) with ⟨_, ⟨x, hxs, rfl⟩, hx⟩
refine ⟨x, hxs, forall_mem_image.1 (fun _ hb => hx <| mem_image_of_mem f ?_)⟩
rwa [(image_id' s).symm]
/-- If a continuous function lies strictly above `a` on a compact set,
it has a lower bound strictly above `a`. -/
theorem IsCompact.exists_forall_le' [ClosedIicTopology α] [NoMaxOrder α] {f : β → α}
{s : Set β} (hs : IsCompact s) (hf : ContinuousOn f s) {a : α} (hf' : ∀ b ∈ s, a < f b) :
∃ a', a < a' ∧ ∀ b ∈ s, a' ≤ f b := by
rcases s.eq_empty_or_nonempty with (rfl | hs')
· obtain ⟨a', ha'⟩ := exists_gt a
exact ⟨a', ha', fun _ a ↦ a.elim⟩
· obtain ⟨x, hx, hx'⟩ := hs.exists_isMinOn hs' hf
exact ⟨f x, hf' x hx, hx'⟩
/-- The **extreme value theorem**: a continuous function realizes its maximum on a compact set. -/
theorem IsCompact.exists_isMaxOn [ClosedIciTopology α] {s : Set β} (hs : IsCompact s)
(ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, IsMaxOn f s x :=
IsCompact.exists_isMinOn (α := αᵒᵈ) hs ne_s hf
/-- The **extreme value theorem**: if a function `f` is continuous on a closed set `s` and it is
larger than a value in its image away from compact sets, then it has a minimum on this set. -/
theorem ContinuousOn.exists_isMinOn' [ClosedIicTopology α] {s : Set β} {f : β → α}
(hf : ContinuousOn f s) (hsc : IsClosed s) {x₀ : β} (h₀ : x₀ ∈ s)
(hc : ∀ᶠ x in cocompact β ⊓ 𝓟 s, f x₀ ≤ f x) : ∃ x ∈ s, IsMinOn f s x := by
rcases (hasBasis_cocompact.inf_principal _).eventually_iff.1 hc with ⟨K, hK, hKf⟩
have hsub : insert x₀ (K ∩ s) ⊆ s := insert_subset_iff.2 ⟨h₀, inter_subset_right⟩
obtain ⟨x, hx, hxf⟩ : ∃ x ∈ insert x₀ (K ∩ s), ∀ y ∈ insert x₀ (K ∩ s), f x ≤ f y :=
((hK.inter_right hsc).insert x₀).exists_isMinOn (insert_nonempty _ _) (hf.mono hsub)
refine ⟨x, hsub hx, fun y hy => ?_⟩
by_cases hyK : y ∈ K
exacts [hxf _ (Or.inr ⟨hyK, hy⟩), (hxf _ (Or.inl rfl)).trans (hKf ⟨hyK, hy⟩)]
/-- The **extreme value theorem**: if a function `f` is continuous on a closed set `s` and it is
smaller than a value in its image away from compact sets, then it has a maximum on this set. -/
theorem ContinuousOn.exists_isMaxOn' [ClosedIciTopology α] {s : Set β} {f : β → α}
(hf : ContinuousOn f s) (hsc : IsClosed s) {x₀ : β} (h₀ : x₀ ∈ s)
(hc : ∀ᶠ x in cocompact β ⊓ 𝓟 s, f x ≤ f x₀) : ∃ x ∈ s, IsMaxOn f s x :=
ContinuousOn.exists_isMinOn' (α := αᵒᵈ) hf hsc h₀ hc
/-- The **extreme value theorem**: if a continuous function `f` is larger than a value in its range
away from compact sets, then it has a global minimum. -/
theorem Continuous.exists_forall_le' [ClosedIicTopology α] {f : β → α} (hf : Continuous f)
(x₀ : β) (h : ∀ᶠ x in cocompact β, f x₀ ≤ f x) : ∃ x : β, ∀ y : β, f x ≤ f y :=
let ⟨x, _, hx⟩ := hf.continuousOn.exists_isMinOn' isClosed_univ (mem_univ x₀)
(by rwa [principal_univ, inf_top_eq])
⟨x, fun y => hx (mem_univ y)⟩
/-- The **extreme value theorem**: if a continuous function `f` is smaller than a value in its range
away from compact sets, then it has a global maximum. -/
theorem Continuous.exists_forall_ge' [ClosedIciTopology α] {f : β → α} (hf : Continuous f)
(x₀ : β) (h : ∀ᶠ x in cocompact β, f x ≤ f x₀) : ∃ x : β, ∀ y : β, f y ≤ f x :=
Continuous.exists_forall_le' (α := αᵒᵈ) hf x₀ h
/-- The **extreme value theorem**: if a continuous function `f` tends to infinity away from compact
sets, then it has a global minimum. -/
theorem Continuous.exists_forall_le [ClosedIicTopology α] [Nonempty β] {f : β → α}
(hf : Continuous f) (hlim : Tendsto f (cocompact β) atTop) : ∃ x, ∀ y, f x ≤ f y := by
inhabit β
exact hf.exists_forall_le' default (hlim.eventually <| eventually_ge_atTop _)
/-- The **extreme value theorem**: if a continuous function `f` tends to negative infinity away from
compact sets, then it has a global maximum. -/
theorem Continuous.exists_forall_ge [ClosedIciTopology α] [Nonempty β] {f : β → α}
(hf : Continuous f) (hlim : Tendsto f (cocompact β) atBot) : ∃ x, ∀ y, f y ≤ f x :=
Continuous.exists_forall_le (α := αᵒᵈ) hf hlim
/-- A continuous function with compact support has a global minimum. -/
@[to_additive /-- A continuous function with compact support has a global minimum. -/]
theorem Continuous.exists_forall_le_of_hasCompactMulSupport [ClosedIicTopology α] [Nonempty β]
[One α] {f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) :
∃ x : β, ∀ y : β, f x ≤ f y := by
obtain ⟨_, ⟨x, rfl⟩, hx⟩ := (h.isCompact_range hf).exists_isLeast (range_nonempty _)
rw [mem_lowerBounds, forall_mem_range] at hx
exact ⟨x, hx⟩
/-- A continuous function with compact support has a global maximum. -/
@[to_additive /-- A continuous function with compact support has a global maximum. -/]
theorem Continuous.exists_forall_ge_of_hasCompactMulSupport [ClosedIciTopology α] [Nonempty β]
[One α] {f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) :
∃ x : β, ∀ y : β, f y ≤ f x :=
Continuous.exists_forall_le_of_hasCompactMulSupport (α := αᵒᵈ) hf h
/-- A compact set is bounded below -/
theorem IsCompact.bddBelow [ClosedIicTopology α] [Nonempty α] {s : Set α} (hs : IsCompact s) :
BddBelow s := by
rcases s.eq_empty_or_nonempty with rfl | hne
· exact bddBelow_empty
· obtain ⟨a, -, has⟩ := hs.exists_isLeast hne
exact ⟨a, has⟩
/-- A compact set is bounded above -/
theorem IsCompact.bddAbove [ClosedIciTopology α] [Nonempty α] {s : Set α} (hs : IsCompact s) :
BddAbove s :=
IsCompact.bddBelow (α := αᵒᵈ) hs
/-- A continuous function is bounded below on a compact set. -/
theorem IsCompact.bddBelow_image [ClosedIicTopology α] [Nonempty α] {f : β → α} {K : Set β}
(hK : IsCompact K) (hf : ContinuousOn f K) : BddBelow (f '' K) :=
(hK.image_of_continuousOn hf).bddBelow
/-- A continuous function is bounded above on a compact set. -/
theorem IsCompact.bddAbove_image [ClosedIciTopology α] [Nonempty α] {f : β → α} {K : Set β}
(hK : IsCompact K) (hf : ContinuousOn f K) : BddAbove (f '' K) :=
IsCompact.bddBelow_image (α := αᵒᵈ) hK hf
/-- A continuous function with compact support is bounded below. -/
@[to_additive /-- A continuous function with compact support is bounded below. -/]
theorem Continuous.bddBelow_range_of_hasCompactMulSupport [ClosedIicTopology α] [One α]
{f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) : BddBelow (range f) :=
(h.isCompact_range hf).bddBelow
/-- A continuous function with compact support is bounded above. -/
@[to_additive /-- A continuous function with compact support is bounded above. -/]
theorem Continuous.bddAbove_range_of_hasCompactMulSupport [ClosedIciTopology α] [One α]
{f : β → α} (hf : Continuous f) (h : HasCompactMulSupport f) : BddAbove (range f) :=
Continuous.bddBelow_range_of_hasCompactMulSupport (α := αᵒᵈ) hf h
end LinearOrder
section ConditionallyCompleteLinearOrder
variable {α β γ : Type*} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α]
[TopologicalSpace β] [TopologicalSpace γ]
theorem IsCompact.sSup_lt_iff_of_continuous [ClosedIciTopology α] {f : β → α} {K : Set β}
(hK : IsCompact K) (h0K : K.Nonempty) (hf : ContinuousOn f K) (y : α) :
sSup (f '' K) < y ↔ ∀ x ∈ K, f x < y := by
refine ⟨fun h x hx => (le_csSup (hK.bddAbove_image hf) <| mem_image_of_mem f hx).trans_lt h,
fun h => ?_⟩
obtain ⟨x, hx, h2x⟩ := hK.exists_isMaxOn h0K hf
refine (csSup_le (h0K.image f) ?_).trans_lt (h x hx)
rintro _ ⟨x', hx', rfl⟩; exact h2x hx'
theorem IsCompact.lt_sInf_iff_of_continuous [ClosedIicTopology α] {f : β → α} {K : Set β}
(hK : IsCompact K) (h0K : K.Nonempty) (hf : ContinuousOn f K) (y : α) :
y < sInf (f '' K) ↔ ∀ x ∈ K, y < f x :=
IsCompact.sSup_lt_iff_of_continuous (α := αᵒᵈ) hK h0K hf y
end ConditionallyCompleteLinearOrder
/-!
### Min and max elements of a compact set
-/
section InfSup
variable {α β : Type*} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α]
[TopologicalSpace β]
theorem IsCompact.sInf_mem [ClosedIicTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : sInf s ∈ s :=
let ⟨_a, ha⟩ := hs.exists_isLeast ne_s
ha.csInf_mem
theorem IsCompact.sSup_mem [ClosedIciTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : sSup s ∈ s :=
IsCompact.sInf_mem (α := αᵒᵈ) hs ne_s
theorem IsCompact.isGLB_sInf [ClosedIicTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : IsGLB s (sInf s) :=
isGLB_csInf ne_s hs.bddBelow
theorem IsCompact.isLUB_sSup [ClosedIciTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : IsLUB s (sSup s) :=
IsCompact.isGLB_sInf (α := αᵒᵈ) hs ne_s
theorem IsCompact.isLeast_sInf [ClosedIicTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : IsLeast s (sInf s) :=
⟨hs.sInf_mem ne_s, (hs.isGLB_sInf ne_s).1⟩
theorem IsCompact.isGreatest_sSup [ClosedIciTopology α] {s : Set α} (hs : IsCompact s)
(ne_s : s.Nonempty) : IsGreatest s (sSup s) :=
IsCompact.isLeast_sInf (α := αᵒᵈ) hs ne_s
theorem IsCompact.exists_sInf_image_eq_and_le [ClosedIicTopology α] {s : Set β}
(hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) :
∃ x ∈ s, sInf (f '' s) = f x ∧ ∀ y ∈ s, f x ≤ f y :=
let ⟨x, hxs, hx⟩ := (hs.image_of_continuousOn hf).sInf_mem (ne_s.image f)
⟨x, hxs, hx.symm, fun _y hy =>
hx.trans_le <| csInf_le (hs.image_of_continuousOn hf).bddBelow <| mem_image_of_mem f hy⟩
theorem IsCompact.exists_sSup_image_eq_and_ge [ClosedIciTopology α] {s : Set β}
(hs : IsCompact s) (ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) :
∃ x ∈ s, sSup (f '' s) = f x ∧ ∀ y ∈ s, f y ≤ f x :=
IsCompact.exists_sInf_image_eq_and_le (α := αᵒᵈ) hs ne_s hf
theorem IsCompact.exists_sInf_image_eq [ClosedIicTopology α] {s : Set β} (hs : IsCompact s)
(ne_s : s.Nonempty) {f : β → α} (hf : ContinuousOn f s) : ∃ x ∈ s, sInf (f '' s) = f x :=
let ⟨x, hxs, hx, _⟩ := hs.exists_sInf_image_eq_and_le ne_s hf
⟨x, hxs, hx⟩
theorem IsCompact.exists_sSup_image_eq [ClosedIciTopology α] {s : Set β} (hs : IsCompact s)
(ne_s : s.Nonempty) : ∀ {f : β → α}, ContinuousOn f s → ∃ x ∈ s, sSup (f '' s) = f x :=
IsCompact.exists_sInf_image_eq (α := αᵒᵈ) hs ne_s
end InfSup
section ExistsExtr
variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [TopologicalSpace β]
theorem IsCompact.exists_isMinOn_mem_subset [ClosedIicTopology α] {f : β → α} {s t : Set β}
{z : β} (ht : IsCompact t) (hf : ContinuousOn f t) (hz : z ∈ t)
(hfz : ∀ z' ∈ t \ s, f z < f z') : ∃ x ∈ s, IsMinOn f t x :=
let ⟨x, hxt, hfx⟩ := ht.exists_isMinOn ⟨z, hz⟩ hf
⟨x, by_contra fun hxs => (hfz x ⟨hxt, hxs⟩).not_ge (hfx hz), hfx⟩
theorem IsCompact.exists_isMaxOn_mem_subset [ClosedIciTopology α] {f : β → α} {s t : Set β}
{z : β} (ht : IsCompact t) (hf : ContinuousOn f t) (hz : z ∈ t)
(hfz : ∀ z' ∈ t \ s, f z' < f z) : ∃ x ∈ s, IsMaxOn f t x :=
let ⟨x, hxt, hfx⟩ := ht.exists_isMaxOn ⟨z, hz⟩ hf
⟨x, by_contra fun hxs => (hfz x ⟨hxt, hxs⟩).not_ge (hfx hz), hfx⟩
-- TODO: we could assume `t ∈ 𝓝ˢ s` (a.k.a. `s ⊆ interior t`) instead of `s ⊆ t` and `IsOpen s`.
theorem IsCompact.exists_isLocalMin_mem_open [ClosedIicTopology α] {f : β → α} {s t : Set β}
{z : β} (ht : IsCompact t) (hst : s ⊆ t) (hf : ContinuousOn f t) (hz : z ∈ t)
(hfz : ∀ z' ∈ t \ s, f z < f z') (hs : IsOpen s) : ∃ x ∈ s, IsLocalMin f x :=
let ⟨x, hxs, h⟩ := ht.exists_isMinOn_mem_subset hf hz hfz
⟨x, hxs, h.isLocalMin <| mem_nhds_iff.2 ⟨s, hst, hs, hxs⟩⟩
theorem IsCompact.exists_isLocalMax_mem_open [ClosedIciTopology α] {f : β → α} {s t : Set β}
{z : β} (ht : IsCompact t) (hst : s ⊆ t) (hf : ContinuousOn f t) (hz : z ∈ t)
(hfz : ∀ z' ∈ t \ s, f z' < f z) (hs : IsOpen s) : ∃ x ∈ s, IsLocalMax f x :=
let ⟨x, hxs, h⟩ := ht.exists_isMaxOn_mem_subset hf hz hfz
⟨x, hxs, h.isLocalMax <| mem_nhds_iff.2 ⟨s, hst, hs, hxs⟩⟩
end ExistsExtr
variable {α β γ : Type*} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α]
[OrderTopology α] [TopologicalSpace β] [TopologicalSpace γ]
theorem eq_Icc_of_connected_compact {s : Set α} (h₁ : IsConnected s) (h₂ : IsCompact s) :
s = Icc (sInf s) (sSup s) :=
eq_Icc_csInf_csSup_of_connected_bdd_closed h₁ h₂.bddBelow h₂.bddAbove h₂.isClosed
/-- If `f : γ → β → α` is a function that is continuous as a function on `γ × β`, `α` is a
conditionally complete linear order, and `K : Set β` is a compact set, then
`fun x ↦ sSup (f x '' K)` is a continuous function. -/
/- TODO: generalize. The following version seems to be true:
```
theorem IsCompact.tendsto_sSup {f : γ → β → α} {g : β → α} {K : Set β} {l : Filter γ}
(hK : IsCompact K) (hf : ∀ y ∈ K, Tendsto ↿f (l ×ˢ 𝓝[K] y) (𝓝 (g y)))
(hgc : ContinuousOn g K) :
Tendsto (fun x => sSup (f x '' K)) l (𝓝 (sSup (g '' K))) := _
```
Moreover, it seems that `hgc` follows from `hf` (Yury Kudryashov). -/
theorem IsCompact.continuous_sSup {f : γ → β → α} {K : Set β} (hK : IsCompact K)
(hf : Continuous ↿f) : Continuous fun x => sSup (f x '' K) := by
rcases eq_empty_or_nonempty K with (rfl | h0K)
· simp_rw [image_empty]
exact continuous_const
rw [continuous_iff_continuousAt]
intro x
obtain ⟨y, hyK, h2y, hy⟩ :=
hK.exists_sSup_image_eq_and_ge h0K
(show Continuous (f x) from hf.comp <| .prodMk_right x).continuousOn
rw [ContinuousAt, h2y, tendsto_order]
have := tendsto_order.mp ((show Continuous fun x => f x y
from hf.comp <| .prodMk_left _).tendsto x)
refine ⟨fun z hz => ?_, fun z hz => ?_⟩
· refine (this.1 z hz).mono fun x' hx' =>
hx'.trans_le <| le_csSup ?_ <| mem_image_of_mem (f x') hyK
exact hK.bddAbove_image (hf.comp <| .prodMk_right x').continuousOn
· have h : ({x} : Set γ) ×ˢ K ⊆ ↿f ⁻¹' Iio z := by
rintro ⟨x', y'⟩ ⟨(rfl : x' = x), hy'⟩
exact (hy y' hy').trans_lt hz
obtain ⟨u, v, hu, _, hxu, hKv, huv⟩ :=
generalized_tube_lemma isCompact_singleton hK (isOpen_Iio.preimage hf) h
refine eventually_of_mem (hu.mem_nhds (singleton_subset_iff.mp hxu)) fun x' hx' => ?_
rw [hK.sSup_lt_iff_of_continuous h0K
(show Continuous (f x') from hf.comp <| .prodMk_right x').continuousOn]
exact fun y' hy' => huv (mk_mem_prod hx' (hKv hy'))
theorem IsCompact.continuous_sInf {f : γ → β → α} {K : Set β} (hK : IsCompact K)
(hf : Continuous ↿f) : Continuous fun x => sInf (f x '' K) :=
IsCompact.continuous_sSup (α := αᵒᵈ) hK hf
namespace ContinuousOn
/-!
### Image of a closed interval
-/
variable [DenselyOrdered α] [ConditionallyCompleteLinearOrder β] [OrderTopology β] {f : α → β}
{a b c : α}
open scoped Interval
theorem image_Icc (hab : a ≤ b) (h : ContinuousOn f <| Icc a b) :
f '' Icc a b = Icc (sInf <| f '' Icc a b) (sSup <| f '' Icc a b) :=
eq_Icc_of_connected_compact ⟨(nonempty_Icc.2 hab).image f, isPreconnected_Icc.image f h⟩
(isCompact_Icc.image_of_continuousOn h)
theorem image_uIcc_eq_Icc (h : ContinuousOn f [[a, b]]) :
f '' [[a, b]] = Icc (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]])) :=
image_Icc min_le_max h
theorem image_uIcc (h : ContinuousOn f <| [[a, b]]) :
f '' [[a, b]] = [[sInf (f '' [[a, b]]), sSup (f '' [[a, b]])]] := by
refine h.image_uIcc_eq_Icc.trans (uIcc_of_le ?_).symm
refine csInf_le_csSup ?_ ?_ (nonempty_uIcc.image _) <;> rw [h.image_uIcc_eq_Icc]
exacts [bddBelow_Icc, bddAbove_Icc]
theorem sInf_image_Icc_le (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
sInf (f '' Icc a b) ≤ f c := by
have := mem_image_of_mem f hc
rw [h.image_Icc (hc.1.trans hc.2)] at this
exact this.1
theorem le_sSup_image_Icc (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
f c ≤ sSup (f '' Icc a b) := by
have := mem_image_of_mem f hc
rw [h.image_Icc (hc.1.trans hc.2)] at this
exact this.2
theorem image_Icc_of_monotoneOn (hab : a ≤ b) (h : ContinuousOn f <| Icc a b)
(h' : MonotoneOn f <| Icc a b) : f '' Icc a b = Icc (f a) (f b) := by
rw [h.image_Icc hab]
congr!
· exact h'.sInf_image_Icc hab
· exact h'.sSup_image_Icc hab
theorem image_Icc_of_antitoneOn (hab : a ≤ b) (h : ContinuousOn f <| Icc a b)
(h' : AntitoneOn f <| Icc a b) : f '' Icc a b = Icc (f b) (f a) := by
have : Icc (f b) (f a) = Icc (toDual (f a)) (toDual (f b)) := by rw [Icc_toDual]; rfl
rw [this]
exact image_Icc_of_monotoneOn (β := βᵒᵈ) hab h h'.dual_right
end ContinuousOn |
.lake/packages/mathlib/Mathlib/Topology/Order/ScottTopology.lean | import Mathlib.Order.ScottContinuity
import Mathlib.Topology.Order.UpperLowerSetTopology
/-!
# Scott topology
This file introduces the Scott topology on a preorder.
## Main definitions
- `DirSupInacc` - a set `u` is said to be inaccessible by directed joins if, when the least upper
bound of a directed set `d` lies in `u` then `d` has non-empty intersection with `u`.
- `DirSupClosed` - a set `s` is said to be closed under directed joins if, whenever a directed set
`d` has a least upper bound `a` and is a subset of `s` then `a` also lies in `s`.
- `Topology.scott` - the Scott topology is defined as the join of the topology of upper sets and the
Scott-Hausdorff topology (the topological space where a set `u` is open if, when the least upper
bound of a directed set `d` lies in `u` then there is a tail of `d` which is a subset of `u`).
## Main statements
- `Topology.IsScott.isUpperSet_of_isOpen`: Scott open sets are upper.
- `Topology.IsScott.isLowerSet_of_isClosed`: Scott closed sets are lower.
- `Topology.IsScott.monotone_of_continuous`: Functions continuous w.r.t. the Scott topology are
monotone.
- `Topology.IsScott.scottContinuousOn_iff_continuous` - a function is Scott continuous (preserves
least upper bounds of directed sets) if and only if it is continuous w.r.t. the Scott topology.
- `Topology.IsScott.instT0Space` - the Scott topology on a partial order is T₀.
## Implementation notes
A type synonym `WithScott` is introduced and for a preorder `α`, `WithScott α` is made an instance
of `TopologicalSpace` by the `scott` topology.
We define a mixin class `IsScott` for the class of types which are both a preorder and a
topology and where the topology is the `scott` topology. It is shown that `WithScott α` is an
instance of `IsScott`.
A class `Scott` is defined in `Topology/OmegaCompletePartialOrder` and made an instance of a
topological space by defining the open sets to be those which have characteristic functions which
are monotone and preserve limits of countable chains (`OmegaCompletePartialOrder.Continuous'`).
A Scott continuous function between `OmegaCompletePartialOrder`s is always
`OmegaCompletePartialOrder.Continuous'` (`OmegaCompletePartialOrder.ScottContinuous.continuous'`).
The converse is true in some special cases, but not in general
([Domain Theory, 2.2.4][abramsky_gabbay_maibaum_1994]).
## References
* [Abramsky and Jung, *Domain Theory*][abramsky_gabbay_maibaum_1994]
* [Gierz et al, *A Compendium of Continuous Lattices*][GierzEtAl1980]
* [Karner, *Continuous monoids and semirings*][Karner2004]
## Tags
Scott topology, preorder
-/
open Set
variable {α β : Type*}
/-! ### Prerequisite order properties -/
section Preorder
variable [Preorder α] {s t : Set α}
/-- A set `s` is said to be inaccessible by directed joins on `D` if, when the least upper bound of
a directed set `d` in `D` lies in `s` then `d` has non-empty intersection with `s`. -/
def DirSupInaccOn (D : Set (Set α)) (s : Set α) : Prop :=
∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty
/-- A set `s` is said to be inaccessible by directed joins if, when the least upper bound of a
directed set `d` lies in `s` then `d` has non-empty intersection with `s`. -/
def DirSupInacc (s : Set α) : Prop :=
∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty
@[simp] lemma dirSupInaccOn_univ : DirSupInaccOn univ s ↔ DirSupInacc s := by
simp [DirSupInaccOn, DirSupInacc]
@[simp] lemma DirSupInacc.dirSupInaccOn {D : Set (Set α)} :
DirSupInacc s → DirSupInaccOn D s := fun h _ _ d₂ d₃ _ hda => h d₂ d₃ hda
lemma DirSupInaccOn.mono {D₁ D₂ : Set (Set α)} (hD : D₁ ⊆ D₂) (hf : DirSupInaccOn D₂ s) :
DirSupInaccOn D₁ s := fun ⦃_⦄ a ↦ hf (hD a)
/--
A set `s` is said to be closed under directed joins if, whenever a directed set `d` has a least
upper bound `a` and is a subset of `s` then `a` also lies in `s`.
-/
def DirSupClosed (s : Set α) : Prop :=
∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → d ⊆ s → a ∈ s
@[simp] lemma dirSupInacc_compl : DirSupInacc sᶜ ↔ DirSupClosed s := by
simp [DirSupInacc, DirSupClosed, ← not_disjoint_iff_nonempty_inter, not_imp_not,
disjoint_compl_right_iff]
@[simp] lemma dirSupClosed_compl : DirSupClosed sᶜ ↔ DirSupInacc s := by
rw [← dirSupInacc_compl, compl_compl]
alias ⟨DirSupInacc.of_compl, DirSupClosed.compl⟩ := dirSupInacc_compl
alias ⟨DirSupClosed.of_compl, DirSupInacc.compl⟩ := dirSupClosed_compl
lemma DirSupClosed.inter (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∩ t) :=
fun _d hd hd' _a ha hds ↦ ⟨hs hd hd' ha <| hds.trans inter_subset_left,
ht hd hd' ha <| hds.trans inter_subset_right⟩
lemma DirSupInacc.union (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∪ t) := by
rw [← dirSupClosed_compl, compl_union]; exact hs.compl.inter ht.compl
lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s :=
fun _d ⟨_b, hb⟩ _ _a ha hds ↦ hs (ha.1 hb) <| hds hb
lemma IsLowerSet.dirSupInacc (hs : IsLowerSet s) : DirSupInacc s := hs.compl.dirSupClosed.of_compl
lemma dirSupClosed_Iic (a : α) : DirSupClosed (Iic a) := fun _d _ _ _a ha ↦ (isLUB_le_iff ha).2
end Preorder
section CompleteLattice
variable [CompleteLattice α] {s : Set α}
lemma dirSupInacc_iff_forall_sSup :
DirSupInacc s ↔ ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by
simp [DirSupInacc, isLUB_iff_sSup_eq]
lemma dirSupClosed_iff_forall_sSup :
DirSupClosed s ↔ ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → d ⊆ s → sSup d ∈ s := by
simp [DirSupClosed, isLUB_iff_sSup_eq]
end CompleteLattice
namespace Topology
/-! ### Scott-Hausdorff topology -/
section ScottHausdorff
/-- The Scott-Hausdorff topology.
A set `u` is open in the Scott-Hausdorff topology iff when the least upper bound of a directed set
`d` lies in `u` then there is a tail of `d` which is a subset of `u`. -/
def scottHausdorff (α : Type*) (D : Set (Set α)) [Preorder α] : TopologicalSpace α where
IsOpen u := ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a →
a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u
isOpen_univ := fun d _ ⟨b, hb⟩ _ _ _ _ ↦ ⟨b, hb, (Ici b ∩ d).subset_univ⟩
isOpen_inter s t hs ht d hd₀ hd₁ hd₂ a hd₃ ha := by
obtain ⟨b₁, hb₁d, hb₁ds⟩ := hs hd₀ hd₁ hd₂ hd₃ ha.1
obtain ⟨b₂, hb₂d, hb₂dt⟩ := ht hd₀ hd₁ hd₂ hd₃ ha.2
obtain ⟨c, hcd, hc⟩ := hd₂ b₁ hb₁d b₂ hb₂d
exact ⟨c, hcd, fun e ⟨hce, hed⟩ ↦ ⟨hb₁ds ⟨hc.1.trans hce, hed⟩, hb₂dt ⟨hc.2.trans hce, hed⟩⟩⟩
isOpen_sUnion := fun s h d hd₀ hd₁ hd₂ a hd₃ ⟨s₀, hs₀s, has₀⟩ ↦ by
obtain ⟨b, hbd, hbds₀⟩ := h s₀ hs₀s hd₀ hd₁ hd₂ hd₃ has₀
exact ⟨b, hbd, Set.subset_sUnion_of_subset s s₀ hbds₀ hs₀s⟩
variable (α) (D : Set (Set α)) [Preorder α] [TopologicalSpace α]
/-- Predicate for an ordered topological space to be equipped with its Scott-Hausdorff topology.
A set `u` is open in the Scott-Hausdorff topology iff when the least upper bound of a directed set
`d` lies in `u` then there is a tail of `d` which is a subset of `u`. -/
class IsScottHausdorff : Prop where
topology_eq_scottHausdorff : ‹TopologicalSpace α› = scottHausdorff α D
instance : @IsScottHausdorff α D _ (scottHausdorff α D) :=
@IsScottHausdorff.mk _ _ _ (scottHausdorff α D) rfl
namespace IsScottHausdorff
variable {s : Set α}
lemma topology_eq [IsScottHausdorff α D] : ‹_› = scottHausdorff α D := topology_eq_scottHausdorff
variable {α D}
lemma isOpen_iff [IsScottHausdorff α D] :
IsOpen s ↔ ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a →
a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s := by
simp [topology_eq_scottHausdorff (α := α) (D := D), IsOpen, scottHausdorff]
lemma dirSupInaccOn_of_isOpen [IsScottHausdorff α D] (h : IsOpen s) : DirSupInaccOn D s :=
fun d hd₀ hd₁ hd₂ a hda hd₃ ↦ by
obtain ⟨b, hbd, hb⟩ := isOpen_iff.mp h hd₀ hd₁ hd₂ hda hd₃; exact ⟨b, hbd, hb ⟨le_rfl, hbd⟩⟩
lemma dirSupClosed_of_isClosed [IsScottHausdorff α univ] (h : IsClosed s) : DirSupClosed s := by
apply DirSupInacc.of_compl
rw [← dirSupInaccOn_univ]
exact (dirSupInaccOn_of_isOpen h.isOpen_compl)
end IsScottHausdorff
end ScottHausdorff
section ScottHausdorff
namespace IsScottHausdorff
variable {s : Set α} [Preorder α] {t : TopologicalSpace α} [IsScottHausdorff α univ]
lemma isOpen_of_isLowerSet (h : IsLowerSet s) : IsOpen s :=
(isOpen_iff (D := univ)).2 fun _d _ ⟨b, hb⟩ _ _ hda ha ↦
⟨b, hb, fun _ hc ↦ h (mem_upperBounds.1 hda.1 _ hc.2) ha⟩
lemma isClosed_of_isUpperSet (h : IsUpperSet s) : IsClosed s :=
isOpen_compl_iff.1 <| isOpen_of_isLowerSet h.compl
end IsScottHausdorff
end ScottHausdorff
/-! ### Scott topology -/
section Scott
section Preorder
/-- The Scott topology.
It is defined as the join of the topology of upper sets and the Scott-Hausdorff topology. -/
def scott (α : Type*) (D : Set (Set α)) [Preorder α] : TopologicalSpace α :=
upperSet α ⊔ scottHausdorff α D
lemma upperSet_le_scott [Preorder α] : upperSet α ≤ scott α univ := le_sup_left
lemma scottHausdorff_le_scott [Preorder α] : scottHausdorff α univ ≤ scott α univ := le_sup_right
variable (α) (D) [Preorder α] [TopologicalSpace α]
/-- Predicate for an ordered topological space to be equipped with its Scott topology.
The Scott topology is defined as the join of the topology of upper sets and the Scott Hausdorff
topology. -/
class IsScott : Prop where
topology_eq_scott : ‹TopologicalSpace α› = scott α D
end Preorder
namespace IsScott
section Preorder
variable (α) (D) [Preorder α] [TopologicalSpace α]
lemma topology_eq [IsScott α D] : ‹_› = scott α D := topology_eq_scott
variable {α} {D} {s : Set α} {a : α}
lemma isOpen_iff_isUpperSet_and_scottHausdorff_open [IsScott α D] :
IsOpen s ↔ IsUpperSet s ∧ IsOpen[scottHausdorff α D] s := by rw [topology_eq α D]; rfl
lemma isOpen_iff_isUpperSet_and_dirSupInaccOn [IsScott α D] :
IsOpen s ↔ IsUpperSet s ∧ DirSupInaccOn D s := by
rw [isOpen_iff_isUpperSet_and_scottHausdorff_open (D := D)]
refine and_congr_right fun h ↦
⟨@IsScottHausdorff.dirSupInaccOn_of_isOpen _ _ _ (scottHausdorff α D) _ _,
fun h' d d₀ d₁ d₂ _ d₃ ha ↦ ?_⟩
obtain ⟨b, hbd, hbu⟩ := h' d₀ d₁ d₂ d₃ ha
exact ⟨b, hbd, Subset.trans inter_subset_left (h.Ici_subset hbu)⟩
lemma isClosed_iff_isLowerSet_and_dirSupClosed [IsScott α univ] :
IsClosed s ↔ IsLowerSet s ∧ DirSupClosed s := by
rw [← isOpen_compl_iff, isOpen_iff_isUpperSet_and_dirSupInaccOn (D := univ), isUpperSet_compl,
dirSupInaccOn_univ, dirSupInacc_compl]
lemma isUpperSet_of_isOpen [IsScott α D] : IsOpen s → IsUpperSet s := fun h ↦
(isOpen_iff_isUpperSet_and_scottHausdorff_open (D := D).mp h).left
lemma isLowerSet_of_isClosed [IsScott α univ] : IsClosed s → IsLowerSet s := fun h ↦
(isClosed_iff_isLowerSet_and_dirSupClosed.mp h).left
lemma dirSupClosed_of_isClosed [IsScott α univ] : IsClosed s → DirSupClosed s := fun h ↦
(isClosed_iff_isLowerSet_and_dirSupClosed.mp h).right
lemma lowerClosure_subset_closure [IsScott α univ] : ↑(lowerClosure s) ⊆ closure s := by
convert closure.mono (@upperSet_le_scott α _)
· rw [@IsUpperSet.closure_eq_lowerClosure α _ (upperSet α) ?_ s]
infer_instance
· exact topology_eq α univ
instance [IsScott α univ] : ClosedIicTopology α where
isClosed_Iic _ :=
isClosed_iff_isLowerSet_and_dirSupClosed.2 ⟨isLowerSet_Iic _, dirSupClosed_Iic _⟩
@[deprecated (since := "2025-07-02")] protected alias isClosed_Iic := isClosed_Iic
/--
The closure of a singleton `{a}` in the Scott topology is the right-closed left-infinite interval
`(-∞,a]`.
-/
@[simp] lemma closure_singleton [IsScott α univ] : closure {a} = Iic a := le_antisymm
(closure_minimal (by rw [singleton_subset_iff, mem_Iic]) isClosed_Iic) <| by
rw [← LowerSet.coe_Iic, ← lowerClosure_singleton]
apply lowerClosure_subset_closure
variable [Preorder β] [TopologicalSpace β] [IsScott β univ] {f : α → β}
lemma monotone_of_continuous [IsScott α D] (hf : Continuous f) : Monotone f := fun _ b hab ↦ by
by_contra h
simpa only [mem_compl_iff, mem_preimage, mem_Iic, le_refl, not_true]
using isUpperSet_of_isOpen (D := D) ((isOpen_compl_iff.2 isClosed_Iic).preimage hf) hab h
@[simp] lemma scottContinuousOn_iff_continuous {D : Set (Set α)} [Topology.IsScott α D]
(hD : ∀ a b : α, a ≤ b → {a, b} ∈ D) : ScottContinuousOn D f ↔ Continuous f := by
refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
· rw [isOpen_iff_isUpperSet_and_dirSupInaccOn (D := D)]
exact ⟨(isUpperSet_of_isOpen (D := univ) hu).preimage (h.monotone D hD),
fun t h₀ hd₁ hd₂ a hd₃ ha ↦ image_inter_nonempty_iff.mp <|
(isOpen_iff_isUpperSet_and_dirSupInaccOn (D := univ).mp hu).2 trivial (Nonempty.image f hd₁)
(directedOn_image.mpr (hd₂.mono @(h.monotone D hD))) (h h₀ hd₁ hd₂ hd₃) ha⟩
· refine fun hf t h₀ d₁ d₂ a d₃ ↦
⟨(monotone_of_continuous (D := D) hf).mem_upperBounds_image d₃.1,
fun b hb ↦ ?_⟩
by_contra h
let u := (Iic b)ᶜ
have hu : IsOpen (f ⁻¹' u) := isClosed_Iic.isOpen_compl.preimage hf
rw [isOpen_iff_isUpperSet_and_dirSupInaccOn (D := D)] at hu
obtain ⟨c, hcd, hfcb⟩ := hu.2 h₀ d₁ d₂ d₃ h
simp only [upperBounds, mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂,
mem_setOf] at hb
exact hfcb <| hb _ hcd
@[deprecated (since := "2025-07-02")]
alias scottContinuous_iff_continuous := scottContinuousOn_iff_continuous
end Preorder
section PartialOrder
variable [PartialOrder α] [TopologicalSpace α] [IsScott α univ]
/--
The Scott topology on a partial order is T₀.
-/
-- see Note [lower instance priority]
instance (priority := 90) : T0Space α :=
(t0Space_iff_inseparable α).2 fun x y h ↦ Iic_injective <| by
simpa only [inseparable_iff_closure_eq, IsScott.closure_singleton] using h
end PartialOrder
section CompleteLinearOrder
variable [CompleteLinearOrder α]
lemma isOpen_iff_Iic_compl_or_univ [TopologicalSpace α] [Topology.IsScott α univ] (U : Set α) :
IsOpen U ↔ U = univ ∨ ∃ a, (Iic a)ᶜ = U := by
constructor
· intro hU
rcases eq_empty_or_nonempty Uᶜ with eUc | neUc
· exact Or.inl (compl_empty_iff.mp eUc)
· apply Or.inr
use sSup Uᶜ
rw [compl_eq_comm, le_antisymm_iff]
exact ⟨fun _ ha ↦ le_sSup ha, (isLowerSet_of_isClosed hU.isClosed_compl).Iic_subset
(dirSupClosed_iff_forall_sSup.mp (dirSupClosed_of_isClosed hU.isClosed_compl)
neUc (isChain_of_trichotomous Uᶜ).directedOn le_rfl)⟩
· rintro (rfl | ⟨a, rfl⟩)
· exact isOpen_univ
· exact isClosed_Iic.isOpen_compl
-- N.B. A number of conditions equivalent to `scott α = upper α` are given in Gierz _et al_,
-- Chapter III, Exercise 3.23.
lemma scott_eq_upper_of_completeLinearOrder : scott α univ = upper α := by
letI := upper α
ext U
rw [@Topology.IsUpper.isTopologicalSpace_basis _ _ (upper α)
({ topology_eq_upperTopology := rfl }) U]
letI := scott α univ
rw [@isOpen_iff_Iic_compl_or_univ _ _ (scott α univ) ({ topology_eq_scott := rfl }) U]
/- The upper topology on a complete linear order is the Scott topology -/
instance [TopologicalSpace α] [IsUpper α] : IsScott α univ where
topology_eq_scott := by
rw [scott_eq_upper_of_completeLinearOrder]
exact IsUpper.topology_eq α
end CompleteLinearOrder
lemma isOpen_iff_scottContinuous_mem [Preorder α] {s : Set α} [TopologicalSpace α]
[IsScott α univ] : IsOpen s ↔ ScottContinuous fun x ↦ x ∈ s := by
rw [← scottContinuousOn_univ, scottContinuousOn_iff_continuous (fun _ _ _ ↦ by trivial)]
exact isOpen_iff_continuous_mem
end IsScott
/--
Type synonym for a preorder equipped with the Scott topology
-/
def WithScott (α : Type*) := α
namespace WithScott
/-- `toScott` is the identity function to the `WithScott` of a type. -/
@[match_pattern] def toScott : α ≃ WithScott α := Equiv.refl _
/-- `ofScott` is the identity function from the `WithScott` of a type. -/
@[match_pattern] def ofScott : WithScott α ≃ α := Equiv.refl _
@[simp] lemma toScott_symm_eq : (@toScott α).symm = ofScott := rfl
@[simp] lemma ofScott_symm_eq : (@ofScott α).symm = toScott := rfl
@[simp] lemma toScott_ofScott (a : WithScott α) : toScott (ofScott a) = a := rfl
@[simp] lemma ofScott_toScott (a : α) : ofScott (toScott a) = a := rfl
lemma toScott_inj {a b : α} : toScott a = toScott b ↔ a = b := Iff.rfl
lemma ofScott_inj {a b : WithScott α} : ofScott a = ofScott b ↔ a = b := Iff.rfl
/-- A recursor for `WithScott`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithScott α → Sort _}
(h : ∀ a, β (toScott a)) : ∀ a, β a := fun a ↦ h (ofScott a)
instance [Nonempty α] : Nonempty (WithScott α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithScott α) := ‹Inhabited α›
variable [Preorder α]
instance : Preorder (WithScott α) := ‹Preorder α›
instance : TopologicalSpace (WithScott α) := scott α univ
instance : IsScott (WithScott α) univ := ⟨rfl⟩
lemma isOpen_iff_isUpperSet_and_scottHausdorff_open' {u : Set α} :
IsOpen (WithScott.ofScott ⁻¹' u) ↔ IsUpperSet u ∧ (scottHausdorff α univ).IsOpen u := Iff.rfl
end WithScott
end Scott
variable [Preorder α]
lemma scottHausdorff_le_lower : scottHausdorff α univ ≤ lower α :=
fun s h => IsScottHausdorff.isOpen_of_isLowerSet (t := scottHausdorff α univ)
<| (@IsLower.isLowerSet_of_isOpen (Topology.WithLower α) _ _ _ s h)
variable [TopologicalSpace α]
/-- If `α` is equipped with the Scott topology, then it is homeomorphic to `WithScott α`.
-/
def IsScott.withScottHomeomorph [IsScott α univ] : WithScott α ≃ₜ α :=
WithScott.ofScott.toHomeomorphOfIsInducing ⟨IsScott.topology_eq α univ ▸ induced_id.symm⟩
lemma IsScott.scottHausdorff_le [IsScott α univ] :
scottHausdorff α univ ≤ ‹TopologicalSpace α› := by
rw [IsScott.topology_eq α univ, scott]; exact le_sup_right
lemma IsLower.scottHausdorff_le [IsLower α] : scottHausdorff α univ ≤ ‹TopologicalSpace α› :=
fun _ h ↦
IsScottHausdorff.isOpen_of_isLowerSet (t := scottHausdorff α univ)
<| IsLower.isLowerSet_of_isOpen h
end Topology |
.lake/packages/mathlib/Mathlib/Topology/Order/CountableSeparating.lean | import Mathlib.Topology.Order.Basic
import Mathlib.Order.Filter.CountableSeparatingOn
/-!
# Countably many infinite intervals separate points
In this file we prove that in a linear order with second countable order topology,
the points can be separated by countably many infinite intervals.
We prove 4 versions of this statement (one for each of the infinite intervals),
as well as provide convenience corollaries about `Filter.EventuallyEq`.
-/
open Set
variable {X : Type*} [TopologicalSpace X] [LinearOrder X]
[OrderTopology X] [SecondCountableTopology X]
namespace HasCountableSeparatingOn
variable {s : Set X}
instance range_Iio : HasCountableSeparatingOn X (· ∈ range Iio) s := by
constructor
rcases TopologicalSpace.exists_countable_dense X with ⟨s, hsc, hsd⟩
set t := s ∪ {x | ∃ y, y ⋖ x}
refine ⟨Iio '' t, .image ?_ _, ?_, ?_⟩
· exact hsc.union countable_setOf_covBy_left
· exact image_subset_range _ _
· rintro x - y - h
by_contra! hne
wlog hlt : x < y generalizing x y
· refine this y x ?_ hne.symm (hne.lt_or_gt.resolve_left hlt)
simpa only [iff_comm] using h
cases (Ioo x y).eq_empty_or_nonempty with
| inl he =>
specialize h (Iio y) (mem_image_of_mem _ (.inr ⟨x, hlt, by simpa using Set.ext_iff.mp he⟩))
simp [hlt.not_ge] at h
| inr hne =>
rcases hsd.inter_open_nonempty _ isOpen_Ioo hne with ⟨z, ⟨hxz, hzy⟩, hzs⟩
simpa [hxz, hzy.not_gt] using h (Iio z) (mem_image_of_mem _ (.inl hzs))
instance range_Ioi : HasCountableSeparatingOn X (· ∈ range Ioi) s :=
.range_Iio (X := Xᵒᵈ)
instance range_Iic : HasCountableSeparatingOn X (· ∈ range Iic) s :=
let ⟨t, htc, ht_sub, ht⟩ := (range_Ioi (X := X) (s := s)).1
⟨compl '' t, htc.image _, by simpa [← compl_inj_iff (x := Ioi _)] using ht_sub,
by simpa [not_iff_not]⟩
instance range_Ici : HasCountableSeparatingOn X (· ∈ range Ici) s :=
range_Iic (X := Xᵒᵈ)
end HasCountableSeparatingOn
namespace Filter.EventuallyEq
variable {α : Type*} {l : Filter α} [CountableInterFilter l] {f g : α → X}
lemma of_forall_eventually_lt_iff (h : ∀ x, ∀ᶠ a in l, f a < x ↔ g a < x) : f =ᶠ[l] g :=
of_forall_separating_preimage (· ∈ range Iio) <| forall_mem_range.2 <| fun x ↦ .set_eq (h x)
lemma of_forall_eventually_le_iff (h : ∀ x, ∀ᶠ a in l, f a ≤ x ↔ g a ≤ x) : f =ᶠ[l] g :=
of_forall_separating_preimage (· ∈ range Iic) <| forall_mem_range.2 <| fun x ↦ .set_eq (h x)
lemma of_forall_eventually_gt_iff (h : ∀ x, ∀ᶠ a in l, x < f a ↔ x < g a) : f =ᶠ[l] g :=
of_forall_eventually_lt_iff (X := Xᵒᵈ) h
lemma of_forall_eventually_ge_iff (h : ∀ x, ∀ᶠ a in l, x ≤ f a ↔ x ≤ g a) : f =ᶠ[l] g :=
of_forall_eventually_le_iff (X := Xᵒᵈ) h
end Filter.EventuallyEq |
.lake/packages/mathlib/Mathlib/Topology/Order/T5.lean | import Mathlib.Order.Interval.Set.OrdConnectedComponent
import Mathlib.Topology.Order.Basic
import Mathlib.Topology.Separation.Regular
/-!
# Linear order is a completely normal Hausdorff topological space
In this file we prove that a linear order with order topology is a completely normal Hausdorff
topological space.
-/
open Filter Set Function OrderDual Topology Interval
variable {X : Type*} [LinearOrder X] [TopologicalSpace X] [OrderTopology X] {a : X} {s t : Set X}
namespace Set
@[simp]
theorem ordConnectedComponent_mem_nhds : ordConnectedComponent s a ∈ 𝓝 a ↔ s ∈ 𝓝 a := by
refine ⟨fun h => mem_of_superset h ordConnectedComponent_subset, fun h => ?_⟩
rcases exists_Icc_mem_subset_of_mem_nhds h with ⟨b, c, ha, ha', hs⟩
exact mem_of_superset ha' (subset_ordConnectedComponent ha hs)
theorem compl_ordConnectedSection_ordSeparatingSet_mem_nhdsGE (hd : Disjoint s (closure t))
(ha : a ∈ s) : (ordConnectedSection (ordSeparatingSet s t))ᶜ ∈ 𝓝[≥] a := by
have hmem : tᶜ ∈ 𝓝[≥] a := by
refine mem_nhdsWithin_of_mem_nhds ?_
rw [← mem_interior_iff_mem_nhds, interior_compl]
exact disjoint_left.1 hd ha
rcases exists_Icc_mem_subset_of_mem_nhdsGE hmem with ⟨b, hab, hmem', hsub⟩
by_cases H : Disjoint (Icc a b) (ordConnectedSection <| ordSeparatingSet s t)
· exact mem_of_superset hmem' (disjoint_left.1 H)
· simp only [Set.disjoint_left, not_forall, Classical.not_not] at H
rcases H with ⟨c, ⟨hac, hcb⟩, hc⟩
have hsub' : Icc a b ⊆ ordConnectedComponent tᶜ a :=
subset_ordConnectedComponent (left_mem_Icc.2 hab) hsub
have hd : Disjoint s (ordConnectedSection (ordSeparatingSet s t)) :=
disjoint_left_ordSeparatingSet.mono_right ordConnectedSection_subset
replace hac : a < c := hac.lt_of_ne <| Ne.symm <| ne_of_mem_of_not_mem hc <|
disjoint_left.1 hd ha
filter_upwards [Ico_mem_nhdsGE hac] with x hx hx'
refine hx.2.ne (eq_of_mem_ordConnectedSection_of_uIcc_subset hx' hc ?_)
refine subset_inter (subset_iUnion₂_of_subset a ha ?_) ?_
· exact OrdConnected.uIcc_subset inferInstance (hsub' ⟨hx.1, hx.2.le.trans hcb⟩)
(hsub' ⟨hac.le, hcb⟩)
· rcases mem_iUnion₂.1 (ordConnectedSection_subset hx').2 with ⟨y, hyt, hxy⟩
refine subset_iUnion₂_of_subset y hyt (OrdConnected.uIcc_subset inferInstance hxy ?_)
refine subset_ordConnectedComponent left_mem_uIcc hxy ?_
suffices c < y by
rw [uIcc_of_ge (hx.2.trans this).le]
exact ⟨hx.2.le, this.le⟩
refine lt_of_not_ge fun hyc => ?_
have hya : y < a := not_le.1 fun hay => hsub ⟨hay, hyc.trans hcb⟩ hyt
exact hxy (Icc_subset_uIcc ⟨hya.le, hx.1⟩) ha
theorem compl_ordConnectedSection_ordSeparatingSet_mem_nhdsLE (hd : Disjoint s (closure t))
(ha : a ∈ s) : (ordConnectedSection <| ordSeparatingSet s t)ᶜ ∈ 𝓝[≤] a := by
have hd' : Disjoint (ofDual ⁻¹' s) (closure <| ofDual ⁻¹' t) := hd
have ha' : toDual a ∈ ofDual ⁻¹' s := ha
simpa only [dual_ordSeparatingSet, dual_ordConnectedSection] using
compl_ordConnectedSection_ordSeparatingSet_mem_nhdsGE hd' ha'
theorem compl_ordConnectedSection_ordSeparatingSet_mem_nhds (hd : Disjoint s (closure t))
(ha : a ∈ s) : (ordConnectedSection <| ordSeparatingSet s t)ᶜ ∈ 𝓝 a := by
rw [← nhdsLE_sup_nhdsGE, mem_sup]
exact ⟨compl_ordConnectedSection_ordSeparatingSet_mem_nhdsLE hd ha,
compl_ordConnectedSection_ordSeparatingSet_mem_nhdsGE hd ha⟩
theorem ordT5Nhd_mem_nhdsSet (hd : Disjoint s (closure t)) : ordT5Nhd s t ∈ 𝓝ˢ s :=
bUnion_mem_nhdsSet fun x hx => ordConnectedComponent_mem_nhds.2 <| inter_mem
(by
rw [← mem_interior_iff_mem_nhds, interior_compl]
exact disjoint_left.1 hd hx)
(compl_ordConnectedSection_ordSeparatingSet_mem_nhds hd hx)
end Set
open Set
/-- A linear order with order topology is a completely normal Hausdorff topological space. -/
instance (priority := 100) OrderTopology.completelyNormalSpace : CompletelyNormalSpace X :=
⟨fun s t h₁ h₂ => Filter.disjoint_iff.2
⟨ordT5Nhd s t, ordT5Nhd_mem_nhdsSet h₂, ordT5Nhd t s, ordT5Nhd_mem_nhdsSet h₁.symm,
disjoint_ordT5Nhd⟩⟩
instance (priority := 100) OrderTopology.t5Space : T5Space X := T5Space.mk |
.lake/packages/mathlib/Mathlib/Topology/Order/ExtrClosure.lean | import Mathlib.Topology.Order.OrderClosed
import Mathlib.Topology.Order.LocalExtr
/-!
# Maximum/minimum on the closure of a set
In this file we prove several versions of the following statement: if `f : X → Y` has a (local or
not) maximum (or minimum) on a set `s` at a point `a` and is continuous on the closure of `s`, then
`f` has an extremum of the same type on `Closure s` at `a`.
-/
open Filter Set
open Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [Preorder Y]
[OrderClosedTopology Y] {f : X → Y} {s : Set X} {a : X}
protected theorem IsMaxOn.closure (h : IsMaxOn f s a) (hc : ContinuousOn f (closure s)) :
IsMaxOn f (closure s) a := fun x hx =>
ContinuousWithinAt.closure_le hx ((hc x hx).mono subset_closure) continuousWithinAt_const h
protected theorem IsMinOn.closure (h : IsMinOn f s a) (hc : ContinuousOn f (closure s)) :
IsMinOn f (closure s) a :=
h.dual.closure hc
protected theorem IsExtrOn.closure (h : IsExtrOn f s a) (hc : ContinuousOn f (closure s)) :
IsExtrOn f (closure s) a :=
h.elim (fun h => Or.inl <| h.closure hc) fun h => Or.inr <| h.closure hc
protected theorem IsLocalMaxOn.closure (h : IsLocalMaxOn f s a) (hc : ContinuousOn f (closure s)) :
IsLocalMaxOn f (closure s) a := by
rcases mem_nhdsWithin.1 h with ⟨U, Uo, aU, hU⟩
refine mem_nhdsWithin.2 ⟨U, Uo, aU, ?_⟩
rintro x ⟨hxU, hxs⟩
refine ContinuousWithinAt.closure_le ?_ ?_ continuousWithinAt_const hU
· rwa [mem_closure_iff_nhdsWithin_neBot, nhdsWithin_inter_of_mem, ←
mem_closure_iff_nhdsWithin_neBot]
exact nhdsWithin_le_nhds (Uo.mem_nhds hxU)
· exact (hc _ hxs).mono (inter_subset_right.trans subset_closure)
protected theorem IsLocalMinOn.closure (h : IsLocalMinOn f s a) (hc : ContinuousOn f (closure s)) :
IsLocalMinOn f (closure s) a :=
IsLocalMaxOn.closure h.dual hc
protected theorem IsLocalExtrOn.closure (h : IsLocalExtrOn f s a)
(hc : ContinuousOn f (closure s)) : IsLocalExtrOn f (closure s) a :=
h.elim (fun h => Or.inl <| h.closure hc) fun h => Or.inr <| h.closure hc |
.lake/packages/mathlib/Mathlib/Topology/Order/LiminfLimsup.lean | import Mathlib.Order.Filter.CountableInter
import Mathlib.Order.LiminfLimsup
import Mathlib.Topology.Order.Monotone
/-!
# Lemmas about liminf and limsup in an order topology.
## Main declarations
* `BoundedLENhdsClass`: Typeclass stating that neighborhoods are eventually bounded above.
* `BoundedGENhdsClass`: Typeclass stating that neighborhoods are eventually bounded below.
## Implementation notes
The same lemmas are true in `ℝ`, `ℝ × ℝ`, `ι → ℝ`, `EuclideanSpace ι ℝ`. To avoid code
duplication, we provide an ad hoc axiomatisation of the properties we need.
-/
open Filter TopologicalSpace
open scoped Topology
universe u v
variable {ι α β R S : Type*} {π : ι → Type*}
/-- Ad hoc typeclass stating that neighborhoods are eventually bounded above. -/
class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where
isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·)
/-- Ad hoc typeclass stating that neighborhoods are eventually bounded below. -/
class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where
isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·)
section Preorder
variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β]
section BoundedLENhdsClass
variable [BoundedLENhdsClass α] [BoundedLENhdsClass β] {f : Filter ι} {u : ι → α} {a : α}
theorem isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) :=
BoundedLENhdsClass.isBounded_le_nhds _
theorem Filter.Tendsto.isBoundedUnder_le (h : Tendsto u f (𝓝 a)) : f.IsBoundedUnder (· ≤ ·) u :=
(isBounded_le_nhds a).mono h
theorem Filter.Tendsto.bddAbove_range_of_cofinite [IsDirected α (· ≤ ·)]
(h : Tendsto u cofinite (𝓝 a)) : BddAbove (Set.range u) :=
h.isBoundedUnder_le.bddAbove_range_of_cofinite
theorem Filter.Tendsto.bddAbove_range [IsDirected α (· ≤ ·)] {u : ℕ → α}
(h : Tendsto u atTop (𝓝 a)) : BddAbove (Set.range u) :=
h.isBoundedUnder_le.bddAbove_range
theorem isCobounded_ge_nhds (a : α) : (𝓝 a).IsCobounded (· ≥ ·) :=
(isBounded_le_nhds a).isCobounded_flip
theorem Filter.Tendsto.isCoboundedUnder_ge [NeBot f] (h : Tendsto u f (𝓝 a)) :
f.IsCoboundedUnder (· ≥ ·) u :=
h.isBoundedUnder_le.isCobounded_flip
instance : BoundedGENhdsClass αᵒᵈ := ⟨@isBounded_le_nhds α _ _ _⟩
instance Prod.instBoundedLENhdsClass : BoundedLENhdsClass (α × β) := by
refine ⟨fun x ↦ ?_⟩
obtain ⟨a, ha⟩ := isBounded_le_nhds x.1
obtain ⟨b, hb⟩ := isBounded_le_nhds x.2
rw [← @Prod.mk.eta _ _ x, nhds_prod_eq]
exact ⟨(a, b), ha.prod_mk hb⟩
instance Pi.instBoundedLENhdsClass [Finite ι] [∀ i, Preorder (π i)] [∀ i, TopologicalSpace (π i)]
[∀ i, BoundedLENhdsClass (π i)] : BoundedLENhdsClass (∀ i, π i) := by
refine ⟨fun x ↦ ?_⟩
rw [nhds_pi]
choose f hf using fun i ↦ isBounded_le_nhds (x i)
exact ⟨f, eventually_pi hf⟩
end BoundedLENhdsClass
section BoundedGENhdsClass
variable [BoundedGENhdsClass α] [BoundedGENhdsClass β] {f : Filter ι} {u : ι → α} {a : α}
theorem isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) :=
BoundedGENhdsClass.isBounded_ge_nhds _
theorem Filter.Tendsto.isBoundedUnder_ge (h : Tendsto u f (𝓝 a)) : f.IsBoundedUnder (· ≥ ·) u :=
(isBounded_ge_nhds a).mono h
theorem Filter.Tendsto.bddBelow_range_of_cofinite [IsDirected α (· ≥ ·)]
(h : Tendsto u cofinite (𝓝 a)) : BddBelow (Set.range u) :=
h.isBoundedUnder_ge.bddBelow_range_of_cofinite
theorem Filter.Tendsto.bddBelow_range [IsDirected α (· ≥ ·)] {u : ℕ → α}
(h : Tendsto u atTop (𝓝 a)) : BddBelow (Set.range u) :=
h.isBoundedUnder_ge.bddBelow_range
theorem isCobounded_le_nhds (a : α) : (𝓝 a).IsCobounded (· ≤ ·) :=
(isBounded_ge_nhds a).isCobounded_flip
theorem Filter.Tendsto.isCoboundedUnder_le [NeBot f] (h : Tendsto u f (𝓝 a)) :
f.IsCoboundedUnder (· ≤ ·) u :=
h.isBoundedUnder_ge.isCobounded_flip
instance : BoundedLENhdsClass αᵒᵈ := ⟨@isBounded_ge_nhds α _ _ _⟩
instance Prod.instBoundedGENhdsClass : BoundedGENhdsClass (α × β) :=
⟨(Prod.instBoundedLENhdsClass (α := αᵒᵈ) (β := βᵒᵈ)).isBounded_le_nhds⟩
instance Pi.instBoundedGENhdsClass [Finite ι] [∀ i, Preorder (π i)] [∀ i, TopologicalSpace (π i)]
[∀ i, BoundedGENhdsClass (π i)] : BoundedGENhdsClass (∀ i, π i) :=
⟨(Pi.instBoundedLENhdsClass (π := fun i ↦ (π i)ᵒᵈ)).isBounded_le_nhds⟩
end BoundedGENhdsClass
-- See note [lower instance priority]
instance (priority := 100) OrderTop.to_BoundedLENhdsClass [OrderTop α] : BoundedLENhdsClass α :=
⟨fun _a ↦ isBounded_le_of_top⟩
-- See note [lower instance priority]
instance (priority := 100) OrderBot.to_BoundedGENhdsClass [OrderBot α] : BoundedGENhdsClass α :=
⟨fun _a ↦ isBounded_ge_of_bot⟩
end Preorder
-- See note [lower instance priority]
instance (priority := 100) BoundedLENhdsClass.of_closedIciTopology [LinearOrder α]
[TopologicalSpace α] [ClosedIciTopology α] : BoundedLENhdsClass α :=
⟨fun a ↦ ((isTop_or_exists_gt a).elim fun h ↦ ⟨a, Eventually.of_forall h⟩) <|
Exists.imp fun _b ↦ eventually_le_nhds⟩
-- See note [lower instance priority]
instance (priority := 100) BoundedGENhdsClass.of_closedIicTopology [LinearOrder α]
[TopologicalSpace α] [ClosedIicTopology α] : BoundedGENhdsClass α :=
inferInstanceAs <| BoundedGENhdsClass αᵒᵈᵒᵈ
section LiminfLimsup
section ConditionallyCompleteLinearOrder
variable [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α]
/-- If the liminf and the limsup of a filter coincide, then this filter converges to
their common value, at least if the filter is eventually bounded above and below. -/
theorem le_nhds_of_limsSup_eq_limsInf {f : Filter α} {a : α} (hl : f.IsBounded (· ≤ ·))
(hg : f.IsBounded (· ≥ ·)) (hs : f.limsSup = a) (hi : f.limsInf = a) : f ≤ 𝓝 a :=
tendsto_order.2 ⟨fun _ hb ↦ gt_mem_sets_of_limsInf_gt hg <| hi.symm ▸ hb,
fun _ hb ↦ lt_mem_sets_of_limsSup_lt hl <| hs.symm ▸ hb⟩
theorem limsSup_nhds (a : α) : limsSup (𝓝 a) = a :=
csInf_eq_of_forall_ge_of_forall_gt_exists_lt (isBounded_le_nhds a)
(fun a' (h : { n : α | n ≤ a' } ∈ 𝓝 a) ↦ show a ≤ a' from @mem_of_mem_nhds _ _ a _ h)
fun b (hba : a < b) ↦
show ∃ c, { n : α | n ≤ c } ∈ 𝓝 a ∧ c < b from
match dense_or_discrete a b with
| Or.inl ⟨c, hac, hcb⟩ => ⟨c, ge_mem_nhds hac, hcb⟩
| Or.inr ⟨_, h⟩ => ⟨a, (𝓝 a).sets_of_superset (gt_mem_nhds hba) h, hba⟩
theorem limsInf_nhds (a : α) : limsInf (𝓝 a) = a :=
limsSup_nhds (α := αᵒᵈ) a
/-- If a filter is converging, its limsup coincides with its limit. -/
theorem limsInf_eq_of_le_nhds {f : Filter α} {a : α} [NeBot f] (h : f ≤ 𝓝 a) : f.limsInf = a :=
have hb_ge : IsBounded (· ≥ ·) f := (isBounded_ge_nhds a).mono h
have hb_le : IsBounded (· ≤ ·) f := (isBounded_le_nhds a).mono h
le_antisymm
(calc
f.limsInf ≤ f.limsSup := limsInf_le_limsSup hb_le hb_ge
_ ≤ (𝓝 a).limsSup := limsSup_le_limsSup_of_le h hb_ge.isCobounded_flip (isBounded_le_nhds a)
_ = a := limsSup_nhds a)
(calc
a = (𝓝 a).limsInf := (limsInf_nhds a).symm
_ ≤ f.limsInf := limsInf_le_limsInf_of_le h (isBounded_ge_nhds a) hb_le.isCobounded_flip)
/-- If a filter is converging, its liminf coincides with its limit. -/
theorem limsSup_eq_of_le_nhds {f : Filter α} {a : α} [NeBot f] (h : f ≤ 𝓝 a) : f.limsSup = a :=
limsInf_eq_of_le_nhds (α := αᵒᵈ) h
/-- If a function has a limit, then its limsup coincides with its limit. -/
theorem Filter.Tendsto.limsup_eq {f : Filter β} {u : β → α} {a : α} [NeBot f]
(h : Tendsto u f (𝓝 a)) : limsup u f = a :=
limsSup_eq_of_le_nhds h
/-- If a function has a limit, then its liminf coincides with its limit. -/
theorem Filter.Tendsto.liminf_eq {f : Filter β} {u : β → α} {a : α} [NeBot f]
(h : Tendsto u f (𝓝 a)) : liminf u f = a :=
limsInf_eq_of_le_nhds h
/-- If the liminf and the limsup of a function coincide, then the limit of the function
exists and has the same value. -/
theorem tendsto_of_liminf_eq_limsup {f : Filter β} {u : β → α} {a : α} (hinf : liminf u f = a)
(hsup : limsup u f = a) (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault)
(h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) : Tendsto u f (𝓝 a) :=
le_nhds_of_limsSup_eq_limsInf h h' hsup hinf
/-- If a number `a` is less than or equal to the `liminf` of a function `f` at some filter
and is greater than or equal to the `limsup` of `f`, then `f` tends to `a` along this filter. -/
theorem tendsto_of_le_liminf_of_limsup_le {f : Filter β} {u : β → α} {a : α} (hinf : a ≤ liminf u f)
(hsup : limsup u f ≤ a) (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault)
(h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) : Tendsto u f (𝓝 a) := by
rcases f.eq_or_neBot with rfl | _
· exact tendsto_bot
· exact tendsto_of_liminf_eq_limsup (le_antisymm (le_trans (liminf_le_limsup h h') hsup) hinf)
(le_antisymm hsup (le_trans hinf (liminf_le_limsup h h'))) h h'
/-- Assume that, for any `a < b`, a sequence cannot be infinitely many times below `a` and
above `b`. If it is also ultimately bounded above and below, then it has to converge. This even
works if `a` and `b` are restricted to a dense subset.
-/
theorem tendsto_of_no_upcrossings [DenselyOrdered α] {f : Filter β} {u : β → α} {s : Set α}
(hs : Dense s) (H : ∀ a ∈ s, ∀ b ∈ s, a < b → ¬((∃ᶠ n in f, u n < a) ∧ ∃ᶠ n in f, b < u n))
(h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault)
(h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) :
∃ c : α, Tendsto u f (𝓝 c) := by
rcases f.eq_or_neBot with rfl | hbot
· exact ⟨sInf ∅, tendsto_bot⟩
refine ⟨limsup u f, ?_⟩
apply tendsto_of_le_liminf_of_limsup_le _ le_rfl h h'
by_contra! hlt
obtain ⟨a, ⟨⟨la, au⟩, as⟩⟩ : ∃ a, (f.liminf u < a ∧ a < f.limsup u) ∧ a ∈ s :=
dense_iff_inter_open.1 hs (Set.Ioo (f.liminf u) (f.limsup u)) isOpen_Ioo
(Set.nonempty_Ioo.2 hlt)
obtain ⟨b, ⟨⟨ab, bu⟩, bs⟩⟩ : ∃ b, (a < b ∧ b < f.limsup u) ∧ b ∈ s :=
dense_iff_inter_open.1 hs (Set.Ioo a (f.limsup u)) isOpen_Ioo (Set.nonempty_Ioo.2 au)
have A : ∃ᶠ n in f, u n < a := frequently_lt_of_liminf_lt (IsBounded.isCobounded_ge h) la
have B : ∃ᶠ n in f, b < u n := frequently_lt_of_lt_limsup (IsBounded.isCobounded_le h') bu
exact H a as b bs ab ⟨A, B⟩
variable [FirstCountableTopology α] {f : Filter β} [CountableInterFilter f] {u : β → α}
theorem eventually_le_limsup (hf : IsBoundedUnder (· ≤ ·) f u := by isBoundedDefault) :
∀ᶠ b in f, u b ≤ f.limsup u := by
obtain ha | ha := isTop_or_exists_gt (f.limsup u)
· exact Eventually.of_forall fun _ => ha _
by_cases H : IsGLB (Set.Ioi (f.limsup u)) (f.limsup u)
· obtain ⟨u, -, -, hua, hu⟩ := H.exists_seq_antitone_tendsto ha
have := fun n => eventually_lt_of_limsup_lt (hu n) hf
exact
(eventually_countable_forall.2 this).mono fun b hb =>
ge_of_tendsto hua <| Eventually.of_forall fun n => (hb _).le
· obtain ⟨x, hx, xa⟩ : ∃ x, (∀ ⦃b⦄, f.limsup u < b → x ≤ b) ∧ f.limsup u < x := by
simp only [IsGLB, IsGreatest, lowerBounds, upperBounds, Set.mem_Ioi, Set.mem_setOf_eq,
not_and, not_forall, not_le, exists_prop] at H
exact H fun x => le_of_lt
filter_upwards [eventually_lt_of_limsup_lt xa hf] with y hy
contrapose! hy
exact hx hy
theorem eventually_liminf_le (hf : IsBoundedUnder (· ≥ ·) f u := by isBoundedDefault) :
∀ᶠ b in f, f.liminf u ≤ u b :=
eventually_le_limsup (α := αᵒᵈ) hf
end ConditionallyCompleteLinearOrder
section CompleteLinearOrder
variable [CompleteLinearOrder α] [TopologicalSpace α] [FirstCountableTopology α] [OrderTopology α]
{f : Filter β} [CountableInterFilter f] {u : β → α}
@[simp]
theorem limsup_eq_bot : f.limsup u = ⊥ ↔ u =ᶠ[f] ⊥ :=
⟨fun h =>
(EventuallyLE.trans eventually_le_limsup <| Eventually.of_forall fun _ => h.le).mono fun _ hx =>
le_antisymm hx bot_le,
fun h => by
rw [limsup_congr h]
exact limsup_const_bot⟩
@[simp]
theorem liminf_eq_top : f.liminf u = ⊤ ↔ u =ᶠ[f] ⊤ :=
limsup_eq_bot (α := αᵒᵈ)
end CompleteLinearOrder
end LiminfLimsup
section Monotone
variable {F : Filter ι} [NeBot F]
[ConditionallyCompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R]
[ConditionallyCompleteLinearOrder S] [TopologicalSpace S] [OrderTopology S]
/-- An antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsSup` to the `Filter.liminf` of the image if the function is continuous at the `limsSup`
(and the filter is bounded from above and frequently bounded from below). -/
theorem Antitone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_decr : Antitone f) (f_cont : ContinuousAt f F.limsSup)
(bdd_above : F.IsBounded (· ≤ ·) := by isBoundedDefault)
(cobdd : F.IsCobounded (· ≤ ·) := by isBoundedDefault) :
f F.limsSup = F.liminf f := by
apply le_antisymm
· rw [limsSup, f_decr.map_csInf_of_continuousAt f_cont bdd_above cobdd]
apply le_of_forall_lt
intro c hc
simp only [liminf, limsInf, eventually_map] at hc ⊢
obtain ⟨d, hd, h'd⟩ :=
exists_lt_of_lt_csSup (bdd_above.recOn fun x hx ↦ ⟨f x, Set.mem_image_of_mem f hx⟩) hc
apply lt_csSup_of_lt ?_ ?_ h'd
· simpa only [BddAbove, upperBounds]
using Antitone.isCoboundedUnder_ge_of_isCobounded f_decr cobdd
· rcases hd with ⟨e, ⟨he, fe_eq_d⟩⟩
filter_upwards [he] with x hx using (fe_eq_d.symm ▸ f_decr hx)
· by_cases! h' : ∃ c, c < F.limsSup ∧ Set.Ioo c F.limsSup = ∅
· rcases h' with ⟨c, c_lt, hc⟩
have B : ∃ᶠ n in F, F.limsSup ≤ n := by
apply (frequently_lt_of_lt_limsSup cobdd c_lt).mono
intro x hx
by_contra!
have : (Set.Ioo c F.limsSup).Nonempty := ⟨x, ⟨hx, this⟩⟩
simp only [hc, Set.not_nonempty_empty] at this
apply liminf_le_of_frequently_le _ (bdd_above.isBoundedUnder f_decr)
exact B.mono fun x hx ↦ f_decr hx
by_contra! H
have not_bot : ¬ IsBot F.limsSup := fun maybe_bot ↦
lt_irrefl (F.liminf f) <| lt_of_le_of_lt
(liminf_le_of_frequently_le (Frequently.of_forall (fun r ↦ f_decr (maybe_bot r)))
(bdd_above.isBoundedUnder f_decr)) H
obtain ⟨l, l_lt, h'l⟩ :
∃ l < F.limsSup, Set.Ioc l F.limsSup ⊆ { x : R | f x < F.liminf f } := by
apply exists_Ioc_subset_of_mem_nhds ((tendsto_order.1 f_cont.tendsto).2 _ H)
simpa [IsBot] using not_bot
obtain ⟨m, l_m, m_lt⟩ : (Set.Ioo l F.limsSup).Nonempty := by
contrapose! h'
exact ⟨l, l_lt, h'⟩
have B : F.liminf f ≤ f m := by
apply liminf_le_of_frequently_le _ _
· apply (frequently_lt_of_lt_limsSup cobdd m_lt).mono
exact fun x hx ↦ f_decr hx.le
· exact IsBounded.isBoundedUnder f_decr bdd_above
have I : f m < F.liminf f := h'l ⟨l_m, m_lt.le⟩
exact lt_irrefl _ (B.trans_lt I)
/-- A continuous antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsup` to the `Filter.liminf` of the images (if the filter is bounded from above and
frequently bounded from below). -/
theorem Antitone.map_limsup_of_continuousAt {f : R → S} (f_decr : Antitone f) (a : ι → R)
(f_cont : ContinuousAt f (F.limsup a))
(bdd_above : F.IsBoundedUnder (· ≤ ·) a := by isBoundedDefault)
(cobdd : F.IsCoboundedUnder (· ≤ ·) a := by isBoundedDefault) :
f (F.limsup a) = F.liminf (f ∘ a) :=
f_decr.map_limsSup_of_continuousAt f_cont bdd_above cobdd
/-- An antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsInf` to the `Filter.limsup` of the image if the function is continuous at the `limsInf`
(and the filter is bounded from below and frequently bounded from above). -/
theorem Antitone.map_limsInf_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_decr : Antitone f) (f_cont : ContinuousAt f F.limsInf)
(cobdd : F.IsCobounded (· ≥ ·) := by isBoundedDefault)
(bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsInf = F.limsup f :=
Antitone.map_limsSup_of_continuousAt (R := Rᵒᵈ) (S := Sᵒᵈ) f_decr.dual f_cont bdd_below cobdd
/-- A continuous antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.liminf` to the `Filter.limsup` of the images (if the filter is bounded from below and
frequently bounded from above). -/
theorem Antitone.map_liminf_of_continuousAt {f : R → S} (f_decr : Antitone f) (a : ι → R)
(f_cont : ContinuousAt f (F.liminf a))
(cobdd : F.IsCoboundedUnder (· ≥ ·) a := by isBoundedDefault)
(bdd_below : F.IsBoundedUnder (· ≥ ·) a := by isBoundedDefault) :
f (F.liminf a) = F.limsup (f ∘ a) :=
f_decr.map_limsInf_of_continuousAt f_cont cobdd bdd_below
/-- A monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsSup` to the `Filter.limsup` of the image if the function is continuous at the `limsSup`
(and the filter is bounded from above and frequently bounded from below). -/
theorem Monotone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_incr : Monotone f) (f_cont : ContinuousAt f F.limsSup)
(bdd_above : F.IsBounded (· ≤ ·) := by isBoundedDefault)
(cobdd : F.IsCobounded (· ≤ ·) := by isBoundedDefault) : f F.limsSup = F.limsup f :=
Antitone.map_limsSup_of_continuousAt (S := Sᵒᵈ) f_incr f_cont bdd_above cobdd
/-- A continuous monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsup` to the `Filter.limsup` of the images (if the filter is bounded from above and
frequently bounded from below). -/
theorem Monotone.map_limsup_of_continuousAt {f : R → S} (f_incr : Monotone f) (a : ι → R)
(f_cont : ContinuousAt f (F.limsup a))
(bdd_above : F.IsBoundedUnder (· ≤ ·) a := by isBoundedDefault)
(cobdd : F.IsCoboundedUnder (· ≤ ·) a := by isBoundedDefault) :
f (F.limsup a) = F.limsup (f ∘ a) :=
f_incr.map_limsSup_of_continuousAt f_cont bdd_above cobdd
/-- A monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsInf` to the `Filter.liminf` of the image if the function is continuous at the `limsInf`
(and the filter is bounded from below and frequently bounded from above). -/
theorem Monotone.map_limsInf_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_incr : Monotone f) (f_cont : ContinuousAt f F.limsInf)
(cobdd : F.IsCobounded (· ≥ ·) := by isBoundedDefault)
(bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsInf = F.liminf f :=
Antitone.map_limsSup_of_continuousAt (R := Rᵒᵈ) f_incr.dual f_cont bdd_below cobdd
/-- A continuous monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.liminf` to the `Filter.liminf` of the images (if the filter is bounded from below and
frequently bounded from above). -/
theorem Monotone.map_liminf_of_continuousAt {f : R → S} (f_incr : Monotone f) (a : ι → R)
(f_cont : ContinuousAt f (F.liminf a))
(cobdd : F.IsCoboundedUnder (· ≥ ·) a := by isBoundedDefault)
(bdd_below : F.IsBoundedUnder (· ≥ ·) a := by isBoundedDefault) :
f (F.liminf a) = F.liminf (f ∘ a) :=
f_incr.map_limsInf_of_continuousAt f_cont cobdd bdd_below
end Monotone |
.lake/packages/mathlib/Mathlib/Topology/Order/IntermediateValue.lean | import Mathlib.Order.Interval.Set.Image
import Mathlib.Order.CompleteLatticeIntervals
import Mathlib.Topology.Order.DenselyOrdered
import Mathlib.Topology.Order.Monotone
import Mathlib.Topology.Connected.TotallyDisconnected
/-!
# Intermediate Value Theorem
In this file we prove the Intermediate Value Theorem: if `f : α → β` is a function defined on a
connected set `s` that takes both values `≤ a` and values `≥ a` on `s`, then it is equal to `a` at
some point of `s`. We also prove that intervals in a dense conditionally complete order are
preconnected and any preconnected set is an interval. Then we specialize IVT to functions continuous
on intervals.
## Main results
* `IsPreconnected_I??` : all intervals `I??` are preconnected,
* `IsPreconnected.intermediate_value`, `intermediate_value_univ` : Intermediate Value Theorem for
connected sets and connected spaces, respectively;
* `intermediate_value_Icc`, `intermediate_value_Icc'`: Intermediate Value Theorem for functions
on closed intervals.
### Miscellaneous facts
* `IsClosed.Icc_subset_of_forall_mem_nhdsWithin` : “Continuous induction” principle;
if `s ∩ [a, b]` is closed, `a ∈ s`, and for each `x ∈ [a, b) ∩ s` some of its right neighborhoods
is included `s`, then `[a, b] ⊆ s`.
* `IsClosed.Icc_subset_of_forall_exists_gt`, `IsClosed.mem_of_ge_of_forall_exists_gt` : two
other versions of the “continuous induction” principle.
* `ContinuousOn.StrictMonoOn_of_InjOn_Ioo` :
Every continuous injective `f : (a, b) → δ` is strictly monotone
or antitone (increasing or decreasing).
## Tags
intermediate value theorem, connected space, connected set
-/
open Filter OrderDual TopologicalSpace Function Set
open scoped Topology Filter Interval
universe u v
/-!
### Intermediate value theorem on a (pre)connected space
In this section we prove the following theorem (see `IsPreconnected.intermediate_value₂`): if `f`
and `g` are two functions continuous on a preconnected set `s`, `f a ≤ g a` at some `a ∈ s` and
`g b ≤ f b` at some `b ∈ s`, then `f c = g c` at some `c ∈ s`. We prove several versions of this
statement, including the classical IVT that corresponds to a constant function `g`.
-/
section
variable {X : Type u} {α : Type v} [TopologicalSpace X] [LinearOrder α] [TopologicalSpace α]
[OrderClosedTopology α]
/-- Intermediate value theorem for two functions: if `f` and `g` are two continuous functions
on a preconnected space and `f a ≤ g a` and `g b ≤ f b`, then for some `x` we have `f x = g x`. -/
theorem intermediate_value_univ₂ [PreconnectedSpace X] {a b : X} {f g : X → α} (hf : Continuous f)
(hg : Continuous g) (ha : f a ≤ g a) (hb : g b ≤ f b) : ∃ x, f x = g x := by
obtain ⟨x, _, hfg, hgf⟩ : (univ ∩ { x | f x ≤ g x ∧ g x ≤ f x }).Nonempty :=
isPreconnected_closed_iff.1 PreconnectedSpace.isPreconnected_univ _ _ (isClosed_le hf hg)
(isClosed_le hg hf) (fun _ _ => le_total _ _) ⟨a, trivial, ha⟩ ⟨b, trivial, hb⟩
exact ⟨x, le_antisymm hfg hgf⟩
theorem intermediate_value_univ₂_eventually₁ [PreconnectedSpace X] {a : X} {l : Filter X} [NeBot l]
{f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (he : g ≤ᶠ[l] f) :
∃ x, f x = g x :=
let ⟨_, h⟩ := he.exists; intermediate_value_univ₂ hf hg ha h
theorem intermediate_value_univ₂_eventually₂ [PreconnectedSpace X] {l₁ l₂ : Filter X} [NeBot l₁]
[NeBot l₂] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (he₁ : f ≤ᶠ[l₁] g)
(he₂ : g ≤ᶠ[l₂] f) : ∃ x, f x = g x :=
let ⟨_, h₁⟩ := he₁.exists
let ⟨_, h₂⟩ := he₂.exists
intermediate_value_univ₂ hf hg h₁ h₂
/-- Intermediate value theorem for two functions: if `f` and `g` are two functions continuous
on a preconnected set `s` and for some `a b ∈ s` we have `f a ≤ g a` and `g b ≤ f b`,
then for some `x ∈ s` we have `f x = g x`. -/
theorem IsPreconnected.intermediate_value₂ {s : Set X} (hs : IsPreconnected s) {a b : X}
(ha : a ∈ s) (hb : b ∈ s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s)
(ha' : f a ≤ g a) (hb' : g b ≤ f b) : ∃ x ∈ s, f x = g x :=
let ⟨x, hx⟩ :=
@intermediate_value_univ₂ s α _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ ⟨b, hb⟩ _ _
(continuousOn_iff_continuous_restrict.1 hf) (continuousOn_iff_continuous_restrict.1 hg) ha'
hb'
⟨x, x.2, hx⟩
theorem IsPreconnected.intermediate_value₂_eventually₁ {s : Set X} (hs : IsPreconnected s) {a : X}
{l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f g : X → α} (hf : ContinuousOn f s)
(hg : ContinuousOn g s) (ha' : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x ∈ s, f x = g x := by
rw [continuousOn_iff_continuous_restrict] at hf hg
obtain ⟨b, h⟩ :=
@intermediate_value_univ₂_eventually₁ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ _
(comap_coe_neBot_of_le_principal hl) _ _ hf hg ha' (he.comap _)
exact ⟨b, b.prop, h⟩
theorem IsPreconnected.intermediate_value₂_eventually₂ {s : Set X} (hs : IsPreconnected s)
{l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f g : X → α}
(hf : ContinuousOn f s) (hg : ContinuousOn g s) (he₁ : f ≤ᶠ[l₁] g) (he₂ : g ≤ᶠ[l₂] f) :
∃ x ∈ s, f x = g x := by
rw [continuousOn_iff_continuous_restrict] at hf hg
obtain ⟨b, h⟩ :=
@intermediate_value_univ₂_eventually₂ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) _ _
(comap_coe_neBot_of_le_principal hl₁) (comap_coe_neBot_of_le_principal hl₂) _ _ hf hg
(he₁.comap _) (he₂.comap _)
exact ⟨b, b.prop, h⟩
/-- **Intermediate Value Theorem** for continuous functions on connected sets. -/
theorem IsPreconnected.intermediate_value {s : Set X} (hs : IsPreconnected s) {a b : X} (ha : a ∈ s)
(hb : b ∈ s) {f : X → α} (hf : ContinuousOn f s) : Icc (f a) (f b) ⊆ f '' s := fun _x hx =>
hs.intermediate_value₂ ha hb hf continuousOn_const hx.1 hx.2
theorem IsPreconnected.intermediate_value_Ico {s : Set X} (hs : IsPreconnected s) {a : X}
{l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) {v : α}
(ht : Tendsto f l (𝓝 v)) : Ico (f a) v ⊆ f '' s := fun _ h =>
hs.intermediate_value₂_eventually₁ ha hl hf continuousOn_const h.1 (ht.eventually_const_le h.2)
theorem IsPreconnected.intermediate_value_Ioc {s : Set X} (hs : IsPreconnected s) {a : X}
{l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) {v : α}
(ht : Tendsto f l (𝓝 v)) : Ioc v (f a) ⊆ f '' s := fun _ h =>
(hs.intermediate_value₂_eventually₁ ha hl continuousOn_const hf h.2
(ht.eventually_le_const h.1)).imp fun _ h => h.imp_right Eq.symm
theorem IsPreconnected.intermediate_value_Ioo {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X}
[NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s)
{v₁ v₂ : α} (ht₁ : Tendsto f l₁ (𝓝 v₁)) (ht₂ : Tendsto f l₂ (𝓝 v₂)) :
Ioo v₁ v₂ ⊆ f '' s := fun _ h =>
hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const
(ht₁.eventually_le_const h.1) (ht₂.eventually_const_le h.2)
theorem IsPreconnected.intermediate_value_Ici {s : Set X} (hs : IsPreconnected s) {a : X}
{l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s)
(ht : Tendsto f l atTop) : Ici (f a) ⊆ f '' s := fun y h =>
hs.intermediate_value₂_eventually₁ ha hl hf continuousOn_const h (tendsto_atTop.1 ht y)
theorem IsPreconnected.intermediate_value_Iic {s : Set X} (hs : IsPreconnected s) {a : X}
{l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s)
(ht : Tendsto f l atBot) : Iic (f a) ⊆ f '' s := fun y h =>
(hs.intermediate_value₂_eventually₁ ha hl continuousOn_const hf h (tendsto_atBot.1 ht y)).imp
fun _ h => h.imp_right Eq.symm
theorem IsPreconnected.intermediate_value_Ioi {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X}
[NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s)
{v : α} (ht₁ : Tendsto f l₁ (𝓝 v)) (ht₂ : Tendsto f l₂ atTop) : Ioi v ⊆ f '' s := fun y h =>
hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const
(ht₁.eventually_le_const h) (ht₂.eventually_ge_atTop y)
theorem IsPreconnected.intermediate_value_Iio {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X}
[NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s)
{v : α} (ht₁ : Tendsto f l₁ atBot) (ht₂ : Tendsto f l₂ (𝓝 v)) : Iio v ⊆ f '' s := fun y h =>
hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const (ht₁.eventually_le_atBot y)
(ht₂.eventually_const_le h)
theorem IsPreconnected.intermediate_value_Iii {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X}
[NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s)
(ht₁ : Tendsto f l₁ atBot) (ht₂ : Tendsto f l₂ atTop) : univ ⊆ f '' s := fun y _ =>
hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const (ht₁.eventually_le_atBot y)
(ht₂.eventually_ge_atTop y)
/-- **Intermediate Value Theorem** for continuous functions on connected spaces. -/
theorem intermediate_value_univ [PreconnectedSpace X] (a b : X) {f : X → α} (hf : Continuous f) :
Icc (f a) (f b) ⊆ range f := fun _ hx => intermediate_value_univ₂ hf continuous_const hx.1 hx.2
/-- **Intermediate Value Theorem** for continuous functions on connected spaces. -/
theorem mem_range_of_exists_le_of_exists_ge [PreconnectedSpace X] {c : α} {f : X → α}
(hf : Continuous f) (h₁ : ∃ a, f a ≤ c) (h₂ : ∃ b, c ≤ f b) : c ∈ range f :=
let ⟨a, ha⟩ := h₁; let ⟨b, hb⟩ := h₂; intermediate_value_univ a b hf ⟨ha, hb⟩
/-!
### (Pre)connected sets in a linear order
In this section we prove the following results:
* `IsPreconnected.ordConnected`: any preconnected set `s` in a linear order is `OrdConnected`,
i.e. `a ∈ s` and `b ∈ s` imply `Icc a b ⊆ s`;
* `IsPreconnected.mem_intervals`: any preconnected set `s` in a conditionally complete linear order
is one of the intervals `Set.Icc`, `set.`Ico`, `set.Ioc`, `set.Ioo`, ``Set.Ici`, `Set.Iic`,
`Set.Ioi`, `Set.Iio`; note that this is false for non-complete orders: e.g., in `ℝ \ {0}`, the set
of positive numbers cannot be represented as `Set.Ioi _`.
-/
/-- If a preconnected set contains endpoints of an interval, then it includes the whole interval. -/
theorem IsPreconnected.Icc_subset {s : Set α} (hs : IsPreconnected s) {a b : α} (ha : a ∈ s)
(hb : b ∈ s) : Icc a b ⊆ s := by
simpa only [image_id] using hs.intermediate_value ha hb continuousOn_id
theorem IsPreconnected.ordConnected {s : Set α} (h : IsPreconnected s) : OrdConnected s :=
⟨fun _ hx _ hy => h.Icc_subset hx hy⟩
/-- If a preconnected set contains endpoints of an interval, then it includes the whole interval. -/
theorem IsConnected.Icc_subset {s : Set α} (hs : IsConnected s) {a b : α} (ha : a ∈ s)
(hb : b ∈ s) : Icc a b ⊆ s :=
hs.2.Icc_subset ha hb
/-- If preconnected set in a linear order space is unbounded below and above, then it is the whole
space. -/
theorem IsPreconnected.eq_univ_of_unbounded {s : Set α} (hs : IsPreconnected s) (hb : ¬BddBelow s)
(ha : ¬BddAbove s) : s = univ := by
refine eq_univ_of_forall fun x => ?_
obtain ⟨y, ys, hy⟩ : ∃ y ∈ s, y < x := not_bddBelow_iff.1 hb x
obtain ⟨z, zs, hz⟩ : ∃ z ∈ s, x < z := not_bddAbove_iff.1 ha x
exact hs.Icc_subset ys zs ⟨le_of_lt hy, le_of_lt hz⟩
end
variable {α : Type u} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α]
/-- A bounded connected subset of a conditionally complete linear order includes the open interval
`(Inf s, Sup s)`. -/
theorem IsConnected.Ioo_csInf_csSup_subset {s : Set α} (hs : IsConnected s) (hb : BddBelow s)
(ha : BddAbove s) : Ioo (sInf s) (sSup s) ⊆ s := fun _x hx =>
let ⟨_y, ys, hy⟩ := (isGLB_lt_iff (isGLB_csInf hs.nonempty hb)).1 hx.1
let ⟨_z, zs, hz⟩ := (lt_isLUB_iff (isLUB_csSup hs.nonempty ha)).1 hx.2
hs.Icc_subset ys zs ⟨hy.le, hz.le⟩
theorem eq_Icc_csInf_csSup_of_connected_bdd_closed {s : Set α} (hc : IsConnected s)
(hb : BddBelow s) (ha : BddAbove s) (hcl : IsClosed s) : s = Icc (sInf s) (sSup s) :=
(subset_Icc_csInf_csSup hb ha).antisymm <|
hc.Icc_subset (hcl.csInf_mem hc.nonempty hb) (hcl.csSup_mem hc.nonempty ha)
theorem IsPreconnected.Ioi_csInf_subset {s : Set α} (hs : IsPreconnected s) (hb : BddBelow s)
(ha : ¬BddAbove s) : Ioi (sInf s) ⊆ s := fun x hx =>
have sne : s.Nonempty := nonempty_of_not_bddAbove ha
let ⟨_y, ys, hy⟩ : ∃ y ∈ s, y < x := (isGLB_lt_iff (isGLB_csInf sne hb)).1 hx
let ⟨_z, zs, hz⟩ : ∃ z ∈ s, x < z := not_bddAbove_iff.1 ha x
hs.Icc_subset ys zs ⟨hy.le, hz.le⟩
theorem IsPreconnected.Iio_csSup_subset {s : Set α} (hs : IsPreconnected s) (hb : ¬BddBelow s)
(ha : BddAbove s) : Iio (sSup s) ⊆ s :=
IsPreconnected.Ioi_csInf_subset (α := αᵒᵈ) hs ha hb
/-- A preconnected set in a conditionally complete linear order is either one of the intervals
`[Inf s, Sup s]`, `[Inf s, Sup s)`, `(Inf s, Sup s]`, `(Inf s, Sup s)`, `[Inf s, +∞)`,
`(Inf s, +∞)`, `(-∞, Sup s]`, `(-∞, Sup s)`, `(-∞, +∞)`, or `∅`. The converse statement requires
`α` to be densely ordered. -/
theorem IsPreconnected.mem_intervals {s : Set α} (hs : IsPreconnected s) :
s ∈
({Icc (sInf s) (sSup s), Ico (sInf s) (sSup s), Ioc (sInf s) (sSup s), Ioo (sInf s) (sSup s),
Ici (sInf s), Ioi (sInf s), Iic (sSup s), Iio (sSup s), univ, ∅} : Set (Set α)) := by
rcases s.eq_empty_or_nonempty with (rfl | hne)
· apply_rules [Or.inr, mem_singleton]
have hs' : IsConnected s := ⟨hne, hs⟩
by_cases hb : BddBelow s <;> by_cases ha : BddAbove s
· refine mem_of_subset_of_mem ?_ <| mem_Icc_Ico_Ioc_Ioo_of_subset_of_subset
(hs'.Ioo_csInf_csSup_subset hb ha) (subset_Icc_csInf_csSup hb ha)
simp only [insert_subset_iff, mem_insert_iff, mem_singleton_iff, true_or, or_true,
singleton_subset_iff, and_self]
· refine Or.inr <| Or.inr <| Or.inr <| Or.inr ?_
rcases mem_Ici_Ioi_of_subset_of_subset (hs.Ioi_csInf_subset hb ha) fun x hx ↦
csInf_le hb hx with hs | hs
· exact Or.inl hs
· exact Or.inr (Or.inl hs)
· iterate 6 apply Or.inr
rcases mem_Iic_Iio_of_subset_of_subset (hs.Iio_csSup_subset hb ha) fun x hx ↦
le_csSup ha hx with hs | hs
· exact Or.inl hs
· exact Or.inr (Or.inl hs)
· iterate 8 apply Or.inr
exact Or.inl (hs.eq_univ_of_unbounded hb ha)
/-- A preconnected set is either one of the intervals `Icc`, `Ico`, `Ioc`, `Ioo`, `Ici`, `Ioi`,
`Iic`, `Iio`, or `univ`, or `∅`. The converse statement requires `α` to be densely ordered. Though
one can represent `∅` as `(Inf ∅, Inf ∅)`, we include it into the list of possible cases to improve
readability. -/
theorem setOf_isPreconnected_subset_of_ordered :
{ s : Set α | IsPreconnected s } ⊆
-- bounded intervals
(range (uncurry Icc) ∪ range (uncurry Ico) ∪ range (uncurry Ioc) ∪ range (uncurry Ioo)) ∪
-- unbounded intervals and `univ`
(range Ici ∪ range Ioi ∪ range Iic ∪ range Iio ∪ {univ, ∅}) := by
intro s hs
rcases hs.mem_intervals with (hs | hs | hs | hs | hs | hs | hs | hs | hs | hs) <;> rw [hs] <;>
simp only [union_insert, union_singleton, mem_insert_iff, mem_union, mem_range, Prod.exists,
uncurry_apply_pair, exists_apply_eq_apply, true_or, or_true, exists_apply_eq_apply2]
/-!
### Intervals are connected
In this section we prove that a closed interval (hence, any `OrdConnected` set) in a dense
conditionally complete linear order is preconnected.
-/
/-- A "continuous induction principle" for a closed interval: if a set `s` meets `[a, b]`
on a closed subset, contains `a`, and the set `s ∩ [a, b)` has no maximal point, then `b ∈ s`. -/
theorem IsClosed.mem_of_ge_of_forall_exists_gt {a b : α} {s : Set α} (hs : IsClosed (s ∩ Icc a b))
(ha : a ∈ s) (hab : a ≤ b) (hgt : ∀ x ∈ s ∩ Ico a b, (s ∩ Ioc x b).Nonempty) : b ∈ s := by
let S := s ∩ Icc a b
replace ha : a ∈ S := ⟨ha, left_mem_Icc.2 hab⟩
have Sbd : BddAbove S := ⟨b, fun z hz => hz.2.2⟩
let c := sSup (s ∩ Icc a b)
have c_mem : c ∈ S := hs.csSup_mem ⟨_, ha⟩ Sbd
have c_le : c ≤ b := csSup_le ⟨_, ha⟩ fun x hx => hx.2.2
rcases eq_or_lt_of_le c_le with hc | hc
· exact hc ▸ c_mem.1
exfalso
rcases hgt c ⟨c_mem.1, c_mem.2.1, hc⟩ with ⟨x, xs, cx, xb⟩
exact not_lt_of_ge (le_csSup Sbd ⟨xs, le_trans (le_csSup Sbd ha) (le_of_lt cx), xb⟩) cx
/-- A "continuous induction principle" for a closed interval: if a set `s` meets `[a, b]`
on a closed subset, contains `a`, and for any `a ≤ x < y ≤ b`, `x ∈ s`, the set `s ∩ (x, y]`
is not empty, then `[a, b] ⊆ s`. -/
theorem IsClosed.Icc_subset_of_forall_exists_gt {a b : α} {s : Set α} (hs : IsClosed (s ∩ Icc a b))
(ha : a ∈ s) (hgt : ∀ x ∈ s ∩ Ico a b, ∀ y ∈ Ioi x, (s ∩ Ioc x y).Nonempty) : Icc a b ⊆ s := by
intro y hy
have : IsClosed (s ∩ Icc a y) := by
suffices s ∩ Icc a y = s ∩ Icc a b ∩ Icc a y from this ▸ hs.inter isClosed_Icc
grind [inter_assoc, inter_eq_self_of_subset_right, Icc_subset_Icc_right]
exact IsClosed.mem_of_ge_of_forall_exists_gt this ha hy.1 fun x hx ↦
hgt x ⟨hx.1, Ico_subset_Ico_right hy.2 hx.2⟩ y hx.2.2
/-- A "continuous induction principle" for a closed interval: if a set `s` meets `[a, b]`
on a closed subset, contains `b`, and the set `s ∩ (a, b]` has no minimal point, then `a ∈ s`. -/
theorem IsClosed.mem_of_ge_of_forall_exists_lt {a b : α} {s : Set α} (hs : IsClosed (s ∩ Icc a b))
(hb : b ∈ s) (hab : a ≤ b) (hgt : ∀ x ∈ s ∩ Ioc a b, (s ∩ Ico a x).Nonempty) : a ∈ s := by
suffices OrderDual.toDual a ∈ ofDual ⁻¹' s by aesop
have : IsClosed (OrderDual.ofDual ⁻¹' (s ∩ Icc a b)) := hs
rw [preimage_inter, ← Icc_toDual] at this
apply this.mem_of_ge_of_forall_exists_gt (by aesop) (by aesop) (fun x hx ↦ ?_)
rw [Ico_toDual, ← preimage_inter, ← Equiv.image_symm_eq_preimage, mem_image] at hx
aesop
/-- A "continuous induction principle" for a closed interval: if a set `s` meets `[a, b]`
on a closed subset, contains `b`, and for any `a ≤ y < x ≤ b`, `x ∈ s`, the set `s ∩ [y, x)`
is not empty, then `[a, b] ⊆ s`. -/
theorem IsClosed.Icc_subset_of_forall_exists_lt {a b : α} {s : Set α} (hs : IsClosed (s ∩ Icc a b))
(hb : b ∈ s) (hgt : ∀ x ∈ s ∩ Ioc a b, ∀ y ∈ Iio x, (s ∩ Ico y x).Nonempty) : Icc a b ⊆ s := by
intro y hy
have : IsClosed (s ∩ Icc y b) := by
suffices s ∩ Icc y b = s ∩ Icc a b ∩ Icc y b from this ▸ hs.inter isClosed_Icc
grind [Icc_subset_Icc_left, inter_eq_self_of_subset_right, inter_assoc]
exact IsClosed.mem_of_ge_of_forall_exists_lt this hb hy.2 fun x hx ↦
hgt x ⟨hx.1, Ioc_subset_Ioc_left hy.1 hx.2⟩ y hx.2.1
variable [DenselyOrdered α] {a b : α}
/-- A "continuous induction principle" for a closed interval: if a set `s` meets `[a, b]`
on a closed subset, contains `a`, and for any `x ∈ [a, b)` such that `[a, x]` is included in `s`,
the set `s` includes some open neighborhood of `x` within `(x, +∞)`, then `[a, b] ⊆ s`. -/
lemma IsClosed.Icc_subset_of_forall_mem_nhdsGT_of_Icc_subset {a b : α} {s : Set α}
(hs : IsClosed (s ∩ Icc a b)) (ha : a ∈ s)
(h : ∀ t ∈ Ico a b, Icc a t ⊆ s → s ∈ 𝓝[>] t) :
Icc a b ⊆ s := by
rcases lt_or_ge b a with hab | hab
· simp_all
set A := {t ∈ Icc a b | Icc a t ⊆ s}
have a_mem : a ∈ A := ⟨left_mem_Icc.mpr hab, by simp [ha]⟩
have bdd_A : BddAbove A := ⟨b, fun t ht ↦ ht.1.2⟩
set t₁ := sSup A
have t₁_mem : t₁ ∈ Icc a b := ⟨le_csSup bdd_A a_mem, csSup_le ⟨a, a_mem⟩ (fun t ht ↦ ht.1.2)⟩
obtain ⟨⟨t₁a, t₁b⟩, ht₁⟩ : t₁ ∈ A := by
refine ⟨t₁_mem, fun t ht ↦ ?_⟩
rcases ht.2.eq_or_lt with rfl | h
· have : closure A ⊆ s ∩ Icc a b := by
apply (closure_subset_iff hs).2 (fun t ht ↦ ⟨?_, ht.1⟩)
have : t ∈ Icc a t := ⟨ht.1.1, le_rfl⟩
exact ht.2 this
apply this.trans inter_subset_left
exact csSup_mem_closure ⟨a, a_mem⟩ bdd_A
· obtain ⟨c, cA, tc⟩ : ∃ c ∈ A, t < c := (lt_csSup_iff bdd_A ⟨a, a_mem⟩).1 h
apply cA.2
exact ⟨ht.1, tc.le⟩
suffices t₁ = b by simpa [this] using ht₁
apply eq_of_le_of_not_lt t₁b fun t₁b' ↦ ?_
obtain ⟨m, t₁m, H⟩ : ∃ m > t₁, Ioo t₁ m ⊆ s :=
(mem_nhdsGT_iff_exists_Ioo_subset' t₁b').mp (h t₁ ⟨t₁a, t₁b'⟩ (fun s hs ↦ ht₁ hs))
obtain ⟨t, hat, ht⟩ : ∃ t, t₁ < t ∧ t < min m b := exists_between (lt_min t₁m t₁b')
have : t ∈ A := by
refine ⟨⟨by order, ht.le.trans (min_le_right _ _)⟩, fun t' ht' ↦ ?_⟩
rcases le_or_gt t' t₁ with h't' | h't'
· exact ht₁ ⟨ht'.1, h't'⟩
· exact H ⟨h't', ht'.2.trans_lt <| ht.trans_le <| min_le_left ..⟩
have : t ≤ t₁ := le_csSup bdd_A this
order
/-- A "continuous induction principle" for a closed interval: if a set `s` meets `[a, b]`
on a closed subset, contains `a`, and for any `x ∈ s ∩ [a, b)` the set `s` includes some open
neighborhood of `x` within `(x, +∞)`, then `[a, b] ⊆ s`. -/
theorem IsClosed.Icc_subset_of_forall_mem_nhdsWithin {a b : α} {s : Set α}
(hs : IsClosed (s ∩ Icc a b)) (ha : a ∈ s) (hgt : ∀ x ∈ s ∩ Ico a b, s ∈ 𝓝[>] x) :
Icc a b ⊆ s :=
hs.Icc_subset_of_forall_mem_nhdsGT_of_Icc_subset ha
(fun _t ht h't ↦ hgt _ ⟨h't ⟨ht.1, le_rfl⟩, ht⟩)
theorem isPreconnected_Icc_aux (x y : α) (s t : Set α) (hxy : x ≤ y) (hs : IsClosed s)
(ht : IsClosed t) (hab : Icc a b ⊆ s ∪ t) (hx : x ∈ Icc a b ∩ s) (hy : y ∈ Icc a b ∩ t) :
(Icc a b ∩ (s ∩ t)).Nonempty := by
have xyab : Icc x y ⊆ Icc a b := Icc_subset_Icc hx.1.1 hy.1.2
by_contra hst
suffices Icc x y ⊆ s from
hst ⟨y, xyab <| right_mem_Icc.2 hxy, this <| right_mem_Icc.2 hxy, hy.2⟩
apply (IsClosed.inter hs isClosed_Icc).Icc_subset_of_forall_mem_nhdsWithin hx.2
rintro z ⟨zs, hz⟩
have zt : z ∈ tᶜ := fun zt => hst ⟨z, xyab <| Ico_subset_Icc_self hz, zs, zt⟩
have : tᶜ ∩ Ioc z y ∈ 𝓝[>] z := by
rw [← nhdsWithin_Ioc_eq_nhdsGT hz.2]
exact mem_nhdsWithin.2 ⟨tᶜ, ht.isOpen_compl, zt, Subset.rfl⟩
apply mem_of_superset this
have : Ioc z y ⊆ s ∪ t := fun w hw => hab (xyab ⟨le_trans hz.1 (le_of_lt hw.1), hw.2⟩)
exact fun w ⟨wt, wzy⟩ => (this wzy).elim id fun h => (wt h).elim
/-- A closed interval in a densely ordered conditionally complete linear order is preconnected. -/
theorem isPreconnected_Icc : IsPreconnected (Icc a b) :=
isPreconnected_closed_iff.2
(by
rintro s t hs ht hab ⟨x, hx⟩ ⟨y, hy⟩
-- This used to use `wlog`, but it was causing timeouts.
rcases le_total x y with h | h
· exact isPreconnected_Icc_aux x y s t h hs ht hab hx hy
· rw [inter_comm s t]
rw [union_comm s t] at hab
exact isPreconnected_Icc_aux y x t s h ht hs hab hy hx)
theorem isPreconnected_uIcc : IsPreconnected ([[a, b]]) :=
isPreconnected_Icc
theorem Set.OrdConnected.isPreconnected {s : Set α} (h : s.OrdConnected) : IsPreconnected s :=
isPreconnected_of_forall_pair fun x hx y hy =>
⟨[[x, y]], h.uIcc_subset hx hy, left_mem_uIcc, right_mem_uIcc, isPreconnected_uIcc⟩
theorem isPreconnected_iff_ordConnected {s : Set α} : IsPreconnected s ↔ OrdConnected s :=
⟨IsPreconnected.ordConnected, Set.OrdConnected.isPreconnected⟩
theorem isPreconnected_Ici : IsPreconnected (Ici a) :=
ordConnected_Ici.isPreconnected
theorem isPreconnected_Iic : IsPreconnected (Iic a) :=
ordConnected_Iic.isPreconnected
theorem isPreconnected_Iio : IsPreconnected (Iio a) :=
ordConnected_Iio.isPreconnected
theorem isPreconnected_Ioi : IsPreconnected (Ioi a) :=
ordConnected_Ioi.isPreconnected
theorem isPreconnected_Ioo : IsPreconnected (Ioo a b) :=
ordConnected_Ioo.isPreconnected
theorem isPreconnected_Ioc : IsPreconnected (Ioc a b) :=
ordConnected_Ioc.isPreconnected
theorem isPreconnected_Ico : IsPreconnected (Ico a b) :=
ordConnected_Ico.isPreconnected
theorem isConnected_Ici : IsConnected (Ici a) :=
⟨nonempty_Ici, isPreconnected_Ici⟩
theorem isConnected_Iic : IsConnected (Iic a) :=
⟨nonempty_Iic, isPreconnected_Iic⟩
theorem isConnected_Ioi [NoMaxOrder α] : IsConnected (Ioi a) :=
⟨nonempty_Ioi, isPreconnected_Ioi⟩
theorem isConnected_Iio [NoMinOrder α] : IsConnected (Iio a) :=
⟨nonempty_Iio, isPreconnected_Iio⟩
theorem isConnected_Icc (h : a ≤ b) : IsConnected (Icc a b) :=
⟨nonempty_Icc.2 h, isPreconnected_Icc⟩
theorem isConnected_Ioo (h : a < b) : IsConnected (Ioo a b) :=
⟨nonempty_Ioo.2 h, isPreconnected_Ioo⟩
theorem isConnected_Ioc (h : a < b) : IsConnected (Ioc a b) :=
⟨nonempty_Ioc.2 h, isPreconnected_Ioc⟩
theorem isConnected_Ico (h : a < b) : IsConnected (Ico a b) :=
⟨nonempty_Ico.2 h, isPreconnected_Ico⟩
instance (priority := 100) ordered_connected_space : PreconnectedSpace α :=
⟨ordConnected_univ.isPreconnected⟩
/-- In a dense conditionally complete linear order, the set of preconnected sets is exactly
the set of the intervals `Icc`, `Ico`, `Ioc`, `Ioo`, `Ici`, `Ioi`, `Iic`, `Iio`, `(-∞, +∞)`,
or `∅`. Though one can represent `∅` as `(sInf s, sInf s)`, we include it into the list of
possible cases to improve readability. -/
theorem setOf_isPreconnected_eq_of_ordered :
{ s : Set α | IsPreconnected s } =
-- bounded intervals
range (uncurry Icc) ∪ range (uncurry Ico) ∪ range (uncurry Ioc) ∪ range (uncurry Ioo) ∪
-- unbounded intervals and `univ`
(range Ici ∪ range Ioi ∪ range Iic ∪ range Iio ∪ {univ, ∅}) := by
refine Subset.antisymm setOf_isPreconnected_subset_of_ordered ?_
simp only [subset_def, forall_mem_range, uncurry, or_imp, forall_and, mem_union,
mem_setOf_eq, insert_eq, mem_singleton_iff, forall_eq, forall_true_iff, and_true,
isPreconnected_Icc, isPreconnected_Ico, isPreconnected_Ioc, isPreconnected_Ioo,
isPreconnected_Ioi, isPreconnected_Iio, isPreconnected_Ici, isPreconnected_Iic,
isPreconnected_univ, isPreconnected_empty]
/-- This lemmas characterizes when a subset `s` of a densely ordered conditionally complete linear
order is totally disconnected with respect to the order topology: between any two distinct points
of `s` must lie a point not in `s`. -/
lemma isTotallyDisconnected_iff_lt {s : Set α} :
IsTotallyDisconnected s ↔ ∀ x ∈ s, ∀ y ∈ s, x < y → ∃ z ∉ s, z ∈ Ioo x y := by
simp only [IsTotallyDisconnected, isPreconnected_iff_ordConnected, ← not_nontrivial_iff,
nontrivial_iff_exists_lt, not_exists, not_and]
refine ⟨fun h x hx y hy hxy ↦ ?_, fun h t hts ht x hx y hy hxy ↦ ?_⟩
· simp_rw [← not_ordConnected_inter_Icc_iff hx hy]
exact fun hs ↦ h _ inter_subset_left hs _ ⟨hx, le_rfl, hxy.le⟩ _ ⟨hy, hxy.le, le_rfl⟩ hxy
· obtain ⟨z, h1z, h2z⟩ := h x (hts hx) y (hts hy) hxy
exact h1z <| hts <| ht.1 hx hy ⟨h2z.1.le, h2z.2.le⟩
/-!
### Intermediate Value Theorem on an interval
In this section we prove several versions of the Intermediate Value Theorem for a function
continuous on an interval.
-/
variable {δ : Type*} [LinearOrder δ] [TopologicalSpace δ] [OrderClosedTopology δ]
/-- **Intermediate Value Theorem** for continuous functions on closed intervals, case
`f a ≤ t ≤ f b`. -/
theorem intermediate_value_Icc {a b : α} (hab : a ≤ b) {f : α → δ} (hf : ContinuousOn f (Icc a b)) :
Icc (f a) (f b) ⊆ f '' Icc a b :=
isPreconnected_Icc.intermediate_value (left_mem_Icc.2 hab) (right_mem_Icc.2 hab) hf
/-- **Intermediate Value Theorem** for continuous functions on closed intervals, case
`f a ≥ t ≥ f b`. -/
theorem intermediate_value_Icc' {a b : α} (hab : a ≤ b) {f : α → δ}
(hf : ContinuousOn f (Icc a b)) : Icc (f b) (f a) ⊆ f '' Icc a b :=
isPreconnected_Icc.intermediate_value (right_mem_Icc.2 hab) (left_mem_Icc.2 hab) hf
/-- **Intermediate Value Theorem** for continuous functions on closed intervals, unordered case. -/
theorem intermediate_value_uIcc {a b : α} {f : α → δ} (hf : ContinuousOn f [[a, b]]) :
[[f a, f b]] ⊆ f '' uIcc a b := by
cases le_total (f a) (f b) <;> simp [*, isPreconnected_uIcc.intermediate_value]
/-- If `f : α → α` is continuous on `[[a, b]]`, `a ≤ f a`, and `f b ≤ b`,
then `f` has a fixed point on `[[a, b]]`. -/
theorem exists_mem_uIcc_isFixedPt {a b : α} {f : α → α} (hf : ContinuousOn f (uIcc a b))
(ha : a ≤ f a) (hb : f b ≤ b) : ∃ c ∈ [[a, b]], IsFixedPt f c :=
isPreconnected_uIcc.intermediate_value₂ right_mem_uIcc left_mem_uIcc hf continuousOn_id hb ha
/-- If `f : α → α` is continuous on `[a, b]`, `a ≤ b`, `a ≤ f a`, and `f b ≤ b`,
then `f` has a fixed point on `[a, b]`.
In particular, if `[a, b]` is forward-invariant under `f`,
then `f` has a fixed point on `[a, b]`, see `exists_mem_Icc_isFixedPt_of_mapsTo`. -/
theorem exists_mem_Icc_isFixedPt {a b : α} {f : α → α} (hf : ContinuousOn f (Icc a b))
(hle : a ≤ b) (ha : a ≤ f a) (hb : f b ≤ b) : ∃ c ∈ Icc a b, IsFixedPt f c :=
isPreconnected_Icc.intermediate_value₂
(right_mem_Icc.2 hle) (left_mem_Icc.2 hle) hf continuousOn_id hb ha
/-- If a closed interval is forward-invariant under a continuous map `f : α → α`,
then this map has a fixed point on this interval. -/
theorem exists_mem_Icc_isFixedPt_of_mapsTo {a b : α} {f : α → α} (hf : ContinuousOn f (Icc a b))
(hle : a ≤ b) (hmaps : MapsTo f (Icc a b) (Icc a b)) : ∃ c ∈ Icc a b, IsFixedPt f c :=
exists_mem_Icc_isFixedPt hf hle (hmaps <| left_mem_Icc.2 hle).1 (hmaps <| right_mem_Icc.2 hle).2
theorem intermediate_value_Ico {a b : α} (hab : a ≤ b) {f : α → δ} (hf : ContinuousOn f (Icc a b)) :
Ico (f a) (f b) ⊆ f '' Ico a b :=
Or.elim (eq_or_lt_of_le hab) (fun he _ h => absurd h.2 (not_lt_of_ge (he ▸ h.1))) fun hlt =>
@IsPreconnected.intermediate_value_Ico _ _ _ _ _ _ _ isPreconnected_Ico _ _ ⟨refl a, hlt⟩
(right_nhdsWithin_Ico_neBot hlt) inf_le_right _ (hf.mono Ico_subset_Icc_self) _
((hf.continuousWithinAt ⟨hab, refl b⟩).mono Ico_subset_Icc_self)
theorem intermediate_value_Ico' {a b : α} (hab : a ≤ b) {f : α → δ}
(hf : ContinuousOn f (Icc a b)) : Ioc (f b) (f a) ⊆ f '' Ico a b :=
Or.elim (eq_or_lt_of_le hab) (fun he _ h => absurd h.1 (not_lt_of_ge (he ▸ h.2))) fun hlt =>
@IsPreconnected.intermediate_value_Ioc _ _ _ _ _ _ _ isPreconnected_Ico _ _ ⟨refl a, hlt⟩
(right_nhdsWithin_Ico_neBot hlt) inf_le_right _ (hf.mono Ico_subset_Icc_self) _
((hf.continuousWithinAt ⟨hab, refl b⟩).mono Ico_subset_Icc_self)
theorem intermediate_value_Ioc {a b : α} (hab : a ≤ b) {f : α → δ} (hf : ContinuousOn f (Icc a b)) :
Ioc (f a) (f b) ⊆ f '' Ioc a b :=
Or.elim (eq_or_lt_of_le hab) (fun he _ h => absurd h.2 (not_le_of_gt (he ▸ h.1))) fun hlt =>
@IsPreconnected.intermediate_value_Ioc _ _ _ _ _ _ _ isPreconnected_Ioc _ _ ⟨hlt, refl b⟩
(left_nhdsWithin_Ioc_neBot hlt) inf_le_right _ (hf.mono Ioc_subset_Icc_self) _
((hf.continuousWithinAt ⟨refl a, hab⟩).mono Ioc_subset_Icc_self)
theorem intermediate_value_Ioc' {a b : α} (hab : a ≤ b) {f : α → δ}
(hf : ContinuousOn f (Icc a b)) : Ico (f b) (f a) ⊆ f '' Ioc a b :=
Or.elim (eq_or_lt_of_le hab) (fun he _ h => absurd h.1 (not_le_of_gt (he ▸ h.2))) fun hlt =>
@IsPreconnected.intermediate_value_Ico _ _ _ _ _ _ _ isPreconnected_Ioc _ _ ⟨hlt, refl b⟩
(left_nhdsWithin_Ioc_neBot hlt) inf_le_right _ (hf.mono Ioc_subset_Icc_self) _
((hf.continuousWithinAt ⟨refl a, hab⟩).mono Ioc_subset_Icc_self)
theorem intermediate_value_Ioo {a b : α} (hab : a ≤ b) {f : α → δ} (hf : ContinuousOn f (Icc a b)) :
Ioo (f a) (f b) ⊆ f '' Ioo a b :=
Or.elim (eq_or_lt_of_le hab) (fun he _ h => absurd h.2 (not_lt_of_gt (he ▸ h.1))) fun hlt =>
@IsPreconnected.intermediate_value_Ioo _ _ _ _ _ _ _ isPreconnected_Ioo _ _
(left_nhdsWithin_Ioo_neBot hlt) (right_nhdsWithin_Ioo_neBot hlt) inf_le_right inf_le_right _
(hf.mono Ioo_subset_Icc_self) _ _
((hf.continuousWithinAt ⟨refl a, hab⟩).mono Ioo_subset_Icc_self)
((hf.continuousWithinAt ⟨hab, refl b⟩).mono Ioo_subset_Icc_self)
theorem intermediate_value_Ioo' {a b : α} (hab : a ≤ b) {f : α → δ}
(hf : ContinuousOn f (Icc a b)) : Ioo (f b) (f a) ⊆ f '' Ioo a b :=
Or.elim (eq_or_lt_of_le hab) (fun he _ h => absurd h.1 (not_lt_of_gt (he ▸ h.2))) fun hlt =>
@IsPreconnected.intermediate_value_Ioo _ _ _ _ _ _ _ isPreconnected_Ioo _ _
(right_nhdsWithin_Ioo_neBot hlt) (left_nhdsWithin_Ioo_neBot hlt) inf_le_right inf_le_right _
(hf.mono Ioo_subset_Icc_self) _ _
((hf.continuousWithinAt ⟨hab, refl b⟩).mono Ioo_subset_Icc_self)
((hf.continuousWithinAt ⟨refl a, hab⟩).mono Ioo_subset_Icc_self)
/-- **Intermediate value theorem**: if `f` is continuous on an order-connected set `s` and `a`,
`b` are two points of this set, then `f` sends `s` to a superset of `Icc (f x) (f y)`. -/
theorem ContinuousOn.surjOn_Icc {s : Set α} [hs : OrdConnected s] {f : α → δ}
(hf : ContinuousOn f s) {a b : α} (ha : a ∈ s) (hb : b ∈ s) : SurjOn f s (Icc (f a) (f b)) :=
hs.isPreconnected.intermediate_value ha hb hf
/-- **Intermediate value theorem**: if `f` is continuous on an order-connected set `s` and `a`,
`b` are two points of this set, then `f` sends `s` to a superset of `[f x, f y]`. -/
theorem ContinuousOn.surjOn_uIcc {s : Set α} [hs : OrdConnected s] {f : α → δ}
(hf : ContinuousOn f s) {a b : α} (ha : a ∈ s) (hb : b ∈ s) :
SurjOn f s (uIcc (f a) (f b)) := by
rcases le_total (f a) (f b) with hab | hab <;> simp [hf.surjOn_Icc, *]
/-- A continuous function which tendsto `Filter.atTop` along `Filter.atTop` and to `atBot` along
`at_bot` is surjective. -/
theorem Continuous.surjective {f : α → δ} (hf : Continuous f) (h_top : Tendsto f atTop atTop)
(h_bot : Tendsto f atBot atBot) : Function.Surjective f := fun p =>
mem_range_of_exists_le_of_exists_ge hf (h_bot.eventually (eventually_le_atBot p)).exists
(h_top.eventually (eventually_ge_atTop p)).exists
/-- A continuous function which tendsto `Filter.atBot` along `Filter.atTop` and to `Filter.atTop`
along `atBot` is surjective. -/
theorem Continuous.surjective' {f : α → δ} (hf : Continuous f) (h_top : Tendsto f atBot atTop)
(h_bot : Tendsto f atTop atBot) : Function.Surjective f :=
Continuous.surjective (α := αᵒᵈ) hf h_top h_bot
/-- If a function `f : α → β` is continuous on a nonempty interval `s`, its restriction to `s`
tends to `at_bot : Filter β` along `at_bot : Filter ↥s` and tends to `Filter.atTop : Filter β` along
`Filter.atTop : Filter ↥s`, then the restriction of `f` to `s` is surjective. We formulate the
conclusion as `Function.surjOn f s Set.univ`. -/
theorem ContinuousOn.surjOn_of_tendsto {f : α → δ} {s : Set α} [OrdConnected s] (hs : s.Nonempty)
(hf : ContinuousOn f s) (hbot : Tendsto (fun x : s => f x) atBot atBot)
(htop : Tendsto (fun x : s => f x) atTop atTop) : SurjOn f s univ :=
haveI := Classical.inhabited_of_nonempty hs.to_subtype
surjOn_iff_surjective.2 <| hf.restrict.surjective htop hbot
/-- If a function `f : α → β` is continuous on a nonempty interval `s`, its restriction to `s`
tends to `Filter.atTop : Filter β` along `Filter.atBot : Filter ↥s` and tends to
`Filter.atBot : Filter β` along `Filter.atTop : Filter ↥s`, then the restriction of `f` to `s` is
surjective. We formulate the conclusion as `Function.surjOn f s Set.univ`. -/
theorem ContinuousOn.surjOn_of_tendsto' {f : α → δ} {s : Set α} [OrdConnected s] (hs : s.Nonempty)
(hf : ContinuousOn f s) (hbot : Tendsto (fun x : s => f x) atBot atTop)
(htop : Tendsto (fun x : s => f x) atTop atBot) : SurjOn f s univ :=
ContinuousOn.surjOn_of_tendsto (δ := δᵒᵈ) hs hf hbot htop
theorem Continuous.strictMono_of_inj_boundedOrder [BoundedOrder α] {f : α → δ}
(hf_c : Continuous f) (hf : f ⊥ ≤ f ⊤) (hf_i : Injective f) : StrictMono f := by
intro a b hab
by_contra! h
have H : f b < f a := lt_of_le_of_ne h <| hf_i.ne hab.ne'
by_cases! ha : f a ≤ f ⊥
· obtain ⟨u, hu⟩ := intermediate_value_Ioc le_top hf_c.continuousOn ⟨H.trans_le ha, hf⟩
have : u = ⊥ := hf_i hu.2
simp_all
· by_cases! hb : f ⊥ < f b
· obtain ⟨u, hu⟩ := intermediate_value_Ioo bot_le hf_c.continuousOn ⟨hb, H⟩
rw [hf_i hu.2] at hu
exact (hab.trans hu.1.2).false
· replace hb : f b < f ⊥ := lt_of_le_of_ne hb <| hf_i.ne (lt_of_lt_of_le' hab bot_le).ne'
obtain ⟨u, hu⟩ := intermediate_value_Ioo' hab.le hf_c.continuousOn ⟨hb, ha⟩
have : u = ⊥ := hf_i hu.2
simp_all
theorem Continuous.strictAnti_of_inj_boundedOrder [BoundedOrder α] {f : α → δ}
(hf_c : Continuous f) (hf : f ⊤ ≤ f ⊥) (hf_i : Injective f) : StrictAnti f :=
hf_c.strictMono_of_inj_boundedOrder (δ := δᵒᵈ) hf hf_i
theorem Continuous.strictMono_of_inj_boundedOrder' [BoundedOrder α] {f : α → δ}
(hf_c : Continuous f) (hf_i : Injective f) : StrictMono f ∨ StrictAnti f :=
(le_total (f ⊥) (f ⊤)).imp
(hf_c.strictMono_of_inj_boundedOrder · hf_i)
(hf_c.strictAnti_of_inj_boundedOrder · hf_i)
/-- Suppose `α` is equipped with a conditionally complete linear dense order and `f : α → δ` is
continuous and injective. Then `f` is strictly monotone (increasing) if
it is strictly monotone (increasing) on some closed interval `[a, b]`. -/
theorem Continuous.strictMonoOn_of_inj_rigidity {f : α → δ}
(hf_c : Continuous f) (hf_i : Injective f) {a b : α} (hab : a < b)
(hf_mono : StrictMonoOn f (Icc a b)) : StrictMono f := by
intro x y hxy
let s := min a x
let t := max b y
have hsa : s ≤ a := min_le_left a x
have hbt : b ≤ t := le_max_left b y
have hf_mono_st : StrictMonoOn f (Icc s t) ∨ StrictAntiOn f (Icc s t) := by
have : Fact (s ≤ t) := ⟨hsa.trans <| hbt.trans' hab.le⟩
have := Continuous.strictMono_of_inj_boundedOrder' (f := Set.restrict (Icc s t) f)
hf_c.continuousOn.restrict hf_i.injOn.injective
exact this.imp strictMono_restrict.mp strictAntiOn_iff_strictAnti.mpr
have (h : StrictAntiOn f (Icc s t)) : False := by
have : Icc a b ⊆ Icc s t := Icc_subset_Icc hsa hbt
replace : StrictAntiOn f (Icc a b) := StrictAntiOn.mono h this
replace : IsAntichain (· ≤ ·) (Icc a b) :=
IsAntichain.of_strictMonoOn_antitoneOn hf_mono this.antitoneOn
exact this.not_lt (left_mem_Icc.mpr (le_of_lt hab)) (right_mem_Icc.mpr (le_of_lt hab)) hab
replace hf_mono_st : StrictMonoOn f (Icc s t) := hf_mono_st.resolve_right this
have hsx : s ≤ x := min_le_right a x
have hyt : y ≤ t := le_max_right b y
replace : Icc x y ⊆ Icc s t := Icc_subset_Icc hsx hyt
replace : StrictMonoOn f (Icc x y) := StrictMonoOn.mono hf_mono_st this
exact this (left_mem_Icc.mpr (le_of_lt hxy)) (right_mem_Icc.mpr (le_of_lt hxy)) hxy
/-- Suppose `f : [a, b] → δ` is
continuous and injective. Then `f` is strictly monotone (increasing) if `f(a) ≤ f(b)`. -/
theorem ContinuousOn.strictMonoOn_of_injOn_Icc {a b : α} {f : α → δ}
(hab : a ≤ b) (hfab : f a ≤ f b)
(hf_c : ContinuousOn f (Icc a b)) (hf_i : InjOn f (Icc a b)) :
StrictMonoOn f (Icc a b) := by
have : Fact (a ≤ b) := ⟨hab⟩
refine StrictMono.of_restrict ?_
set g : Icc a b → δ := Set.restrict (Icc a b) f
have hgab : g ⊥ ≤ g ⊤ := by aesop
exact Continuous.strictMono_of_inj_boundedOrder (f := g) hf_c.restrict hgab hf_i.injective
/-- Suppose `f : [a, b] → δ` is
continuous and injective. Then `f` is strictly antitone (decreasing) if `f(b) ≤ f(a)`. -/
theorem ContinuousOn.strictAntiOn_of_injOn_Icc {a b : α} {f : α → δ}
(hab : a ≤ b) (hfab : f b ≤ f a)
(hf_c : ContinuousOn f (Icc a b)) (hf_i : InjOn f (Icc a b)) :
StrictAntiOn f (Icc a b) := ContinuousOn.strictMonoOn_of_injOn_Icc (δ := δᵒᵈ) hab hfab hf_c hf_i
/-- Suppose `f : [a, b] → δ` is continuous and injective. Then `f` is strictly monotone
or antitone (increasing or decreasing). -/
theorem ContinuousOn.strictMonoOn_of_injOn_Icc' {a b : α} {f : α → δ} (hab : a ≤ b)
(hf_c : ContinuousOn f (Icc a b)) (hf_i : InjOn f (Icc a b)) :
StrictMonoOn f (Icc a b) ∨ StrictAntiOn f (Icc a b) :=
(le_total (f a) (f b)).imp
(ContinuousOn.strictMonoOn_of_injOn_Icc hab · hf_c hf_i)
(ContinuousOn.strictAntiOn_of_injOn_Icc hab · hf_c hf_i)
/-- Suppose `α` is equipped with a conditionally complete linear dense order and `f : α → δ` is
continuous and injective. Then `f` is strictly monotone or antitone (increasing or decreasing). -/
theorem Continuous.strictMono_of_inj {f : α → δ}
(hf_c : Continuous f) (hf_i : Injective f) : StrictMono f ∨ StrictAnti f := by
have H {c d : α} (hcd : c < d) : StrictMono f ∨ StrictAnti f :=
(hf_c.continuousOn.strictMonoOn_of_injOn_Icc' hcd.le hf_i.injOn).imp
(hf_c.strictMonoOn_of_inj_rigidity hf_i hcd)
(hf_c.strictMonoOn_of_inj_rigidity (δ := δᵒᵈ) hf_i hcd)
cases subsingleton_or_nontrivial α with
| inl h => exact Or.inl <| Subsingleton.strictMono f
| inr h =>
obtain ⟨a, b, hab⟩ := exists_pair_lt α
exact H hab
/-- Every continuous injective `f : (a, b) → δ` is strictly monotone
or antitone (increasing or decreasing). -/
theorem ContinuousOn.strictMonoOn_of_injOn_Ioo {a b : α} {f : α → δ} (hab : a < b)
(hf_c : ContinuousOn f (Ioo a b)) (hf_i : InjOn f (Ioo a b)) :
StrictMonoOn f (Ioo a b) ∨ StrictAntiOn f (Ioo a b) := by
haveI : Inhabited (Ioo a b) := Classical.inhabited_of_nonempty (nonempty_Ioo_subtype hab)
let g : Ioo a b → δ := Set.restrict (Ioo a b) f
have : StrictMono g ∨ StrictAnti g :=
Continuous.strictMono_of_inj hf_c.restrict hf_i.injective
exact this.imp strictMono_restrict.mp strictAntiOn_iff_strictAnti.mpr |
.lake/packages/mathlib/Mathlib/Topology/Order/Basic.lean | import Mathlib.Order.Filter.Interval
import Mathlib.Order.Interval.Set.Pi
import Mathlib.Order.OrdContinuous
import Mathlib.Tactic.TFAE
import Mathlib.Tactic.NormNum
import Mathlib.Topology.Order.LeftRight
import Mathlib.Topology.Order.OrderClosed
/-!
# Theory of topology on ordered spaces
## Main definitions
The order topology on an ordered space is the topology generated by all open intervals (or
equivalently by those of the form `(-∞, a)` and `(b, +∞)`). We define it as `Preorder.topology α`.
However, we do *not* register it as an instance (as many existing ordered types already have
topologies, which would be equal but not definitionally equal to `Preorder.topology α`). Instead,
we introduce a class `OrderTopology α` (which is a `Prop`, also known as a mixin) saying that on
the type `α` having already a topological space structure and a preorder structure, the topological
structure is equal to the order topology.
We prove many basic properties of such topologies.
## Main statements
This file contains the proofs of the following facts. For exact requirements
(`OrderClosedTopology` vs `OrderTopology`, `Preorder` vs `PartialOrder` vs `LinearOrder` etc)
see their statements.
* `exists_Ioc_subset_of_mem_nhds`, `exists_Ico_subset_of_mem_nhds` : if `x < y`, then any
neighborhood of `x` includes an interval `[x, z)` for some `z ∈ (x, y]`, and any neighborhood
of `y` includes an interval `(z, y]` for some `z ∈ [x, y)`.
* `tendsto_of_tendsto_of_tendsto_of_le_of_le` : theorem known as squeeze theorem,
sandwich theorem, theorem of Carabinieri, and two policemen (and a drunk) theorem; if `g` and `h`
both converge to `a`, and eventually `g x ≤ f x ≤ h x`, then `f` converges to `a`.
## Implementation notes
We do _not_ register the order topology as an instance on a preorder (or even on a linear order).
Indeed, on many such spaces, a topology has already been constructed in a different way (think
of the discrete spaces `ℕ` or `ℤ`, or `ℝ` that could inherit a topology as the completion of `ℚ`),
and is in general not defeq to the one generated by the intervals. We make it available as a
definition `Preorder.topology α` though, that can be registered as an instance when necessary, or
for specific types.
-/
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
-- TODO: define `Preorder.topology` before `OrderTopology` and reuse the def
/-- The order topology on an ordered type is the topology generated by open intervals. We register
it on a preorder, but it is mostly interesting in linear orders, where it is also order-closed.
We define it as a mixin. If you want to introduce the order topology on a preorder, use
`Preorder.topology`. -/
class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where
/-- The topology is generated by open intervals `Set.Ioi _` and `Set.Iio _`. -/
topology_eq_generate_intervals : t = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a }
/-- (Order) topology on a partial order `α` generated by the subbase of open intervals
`(a, ∞) = { x ∣ a < x }, (-∞, b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an
instance as many ordered sets are already endowed with the same topology, most often in a non-defeq
way though. Register as a local instance when necessary. -/
def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α :=
generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } }
section Preorder
variable [ts : TopologicalSpace α] [Preorder α]
instance [t : OrderTopology α] : OrderTopology αᵒᵈ :=
⟨by
convert OrderTopology.topology_eq_generate_intervals (α := α) using 6
apply or_comm⟩
protected theorem OrderTopology.continuous_iff [OrderTopology α] [TopologicalSpace β] {f : β → α} :
Continuous f ↔ ∀ a, IsOpen (f ⁻¹' Ioi a) ∧ IsOpen (f ⁻¹' Iio a) := by
simp_rw [OrderTopology.topology_eq_generate_intervals, continuous_generateFrom_iff]
aesop
theorem isOpen_iff_generate_intervals [t : OrderTopology α] {s : Set α} :
IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s := by
rw [t.topology_eq_generate_intervals]; rfl
theorem isOpen_lt' [OrderTopology α] (a : α) : IsOpen { b : α | a < b } :=
isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inl rfl⟩
theorem isOpen_Ioi' [OrderTopology α] (a : α) : IsOpen (Ioi a) := isOpen_lt' a
theorem isOpen_gt' [OrderTopology α] (a : α) : IsOpen { b : α | b < a } :=
isOpen_iff_generate_intervals.2 <| .basic _ ⟨a, .inr rfl⟩
theorem isOpen_Iio' [OrderTopology α] (a : α) : IsOpen (Iio a) := isOpen_gt' a
theorem lt_mem_nhds [OrderTopology α] {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a < x :=
(isOpen_lt' _).mem_nhds h
theorem le_mem_nhds [OrderTopology α] {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 b, a ≤ x :=
(lt_mem_nhds h).mono fun _ => le_of_lt
theorem gt_mem_nhds [OrderTopology α] {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x < b :=
(isOpen_gt' _).mem_nhds h
theorem ge_mem_nhds [OrderTopology α] {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b :=
(gt_mem_nhds h).mono fun _ => le_of_lt
theorem nhds_eq_order [OrderTopology α] (a : α) :
𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by
rw [OrderTopology.topology_eq_generate_intervals (α := α), nhds_generateFrom]
simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and,
iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio]
theorem tendsto_order [OrderTopology α] {f : β → α} {a : α} {x : Filter β} :
Tendsto f x (𝓝 a) ↔ (∀ a' < a, ∀ᶠ b in x, a' < f b) ∧ ∀ a' > a, ∀ᶠ b in x, f b < a' := by
simp only [nhds_eq_order a, tendsto_inf, tendsto_iInf, tendsto_principal]; rfl
instance tendstoIccClassNhds [OrderTopology α] (a : α) : TendstoIxxClass Icc (𝓝 a) (𝓝 a) := by
simp only [nhds_eq_order, iInf_subtype']
refine
((hasBasis_iInf_principal_finite _).inf (hasBasis_iInf_principal_finite _)).tendstoIxxClass
fun s _ => ?_
refine ((ordConnected_biInter ?_).inter (ordConnected_biInter ?_)).out <;> intro _ _
exacts [ordConnected_Ioi, ordConnected_Iio]
instance tendstoIcoClassNhds [OrderTopology α] (a : α) : TendstoIxxClass Ico (𝓝 a) (𝓝 a) :=
tendstoIxxClass_of_subset fun _ _ => Ico_subset_Icc_self
instance tendstoIocClassNhds [OrderTopology α] (a : α) : TendstoIxxClass Ioc (𝓝 a) (𝓝 a) :=
tendstoIxxClass_of_subset fun _ _ => Ioc_subset_Icc_self
instance tendstoIooClassNhds [OrderTopology α] (a : α) : TendstoIxxClass Ioo (𝓝 a) (𝓝 a) :=
tendstoIxxClass_of_subset fun _ _ => Ioo_subset_Icc_self
variable (α) in
/-- In a second countable topological space with the order topology, the topology is generated
by half-infinite open intervals with endpoints in a countable set. -/
lemma exists_countable_generateFrom_Ioi_Iio
[OrderTopology α] [SecondCountableTopology α] :
∃ (c : Set α), c.Countable ∧ ts = generateFrom { s | ∃ a ∈ c, s = Ioi a ∨ s = Iio a } := by
rcases isEmpty_or_nonempty α with hα | hα
· exact ⟨∅, by simp, Subsingleton.elim _ _⟩
obtain ⟨t, t_subs, t_count, ht⟩ : ∃ t ⊆ { s | ∃ a, s = Ioi a ∨ s = Iio a },
t.Countable ∧ ts = generateFrom t :=
exists_countable_of_generateFrom OrderTopology.topology_eq_generate_intervals
have A : ∀ s ∈ t, ∃ a, s = Ioi a ∨ s = Iio a := t_subs
choose! a ha using A
refine ⟨a '' t, t_count.image _, ?_⟩
apply le_antisymm
· apply le_generateFrom_iff_subset_isOpen.2
simp only [mem_image, exists_exists_and_eq_and, setOf_subset_setOf, forall_exists_index,
and_imp]
grind [isOpen_Iio', isOpen_Ioi']
· rw [ht]
apply generateFrom_anti
grind
/-- If a topology is generated by half-open intervals with endpoints in a set `c`, then the sets
formed by intersecting finitely many of these intervals form a topological basis. -/
lemma isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom (c : Set α)
(h : ts = generateFrom { s | ∃ a ∈ c, s = Ioi a ∨ s = Iio a }) :
IsTopologicalBasis {s | ∃ (f g : Set α), f ⊆ c ∧ g ⊆ c ∧ f.Finite ∧ g.Finite
∧ s = (⋂ a ∈ f, Ioi a) ∩ (⋂ a ∈ g, Iio a)} := by
refine IsTopologicalBasis.of_isOpen_of_subset ?_ (isTopologicalBasis_of_subbasis h) ?_
· rintro u ⟨f, g, hfc, hgc, hf_fin, hg_fin, rfl⟩
apply IsOpen.inter
· apply hf_fin.isOpen_biInter (fun i hi ↦ ?_)
rw [h]
exact isOpen_generateFrom_of_mem ⟨i, hfc hi, Or.inl rfl⟩
· apply hg_fin.isOpen_biInter (fun i hi ↦ ?_)
rw [h]
exact isOpen_generateFrom_of_mem ⟨i, hgc hi, Or.inr rfl⟩
simp only [exists_and_left, image_subset_iff, preimage_setOf_eq, setOf_subset_setOf, and_imp]
intro k k_fin hk
let kl := {s ∈ k | ∃ a ∈ c, s = Ioi a}
let kr := {s ∈ k | ∃ a ∈ c, s = Iio a}
have k_eq : k = kl ∪ kr := by
have : ∀ s ∈ k, ∃ a ∈ c, s = Ioi a ∨ s = Iio a := hk
ext
simp only [mem_union, mem_setOf_eq, kl, kr]
grind
have : Finite kl := k_fin.subset (by simp [k_eq])
have : Finite kr := k_fin.subset (by simp [k_eq])
have Al : ∀ s : kl, ∃ a ∈ c, s = Ioi a := fun s ↦ s.2.2
choose al alc hal using Al
have Ar : ∀ s : kr, ∃ a ∈ c, s = Iio a := fun s ↦ s.2.2
choose ar arc har using Ar
refine ⟨range al, by simp [range_subset_iff, alc], range ar,
by simp [range_subset_iff, arc], finite_range _, finite_range _, ?_⟩
rw [k_eq, sInter_eq_biInter, biInter_union, biInter_range, biInter_range, biInter_eq_iInter,
biInter_eq_iInter]
simp [hal, har]
/-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities
hold eventually for the filter. -/
theorem tendsto_of_tendsto_of_tendsto_of_le_of_le' [OrderTopology α] {f g h : β → α} {b : Filter β}
{a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : ∀ᶠ b in b, g b ≤ f b)
(hfh : ∀ᶠ b in b, f b ≤ h b) : Tendsto f b (𝓝 a) :=
(hg.Icc hh).of_smallSets <| hgf.and hfh
alias Filter.Tendsto.squeeze' := tendsto_of_tendsto_of_tendsto_of_le_of_le'
/-- **Squeeze theorem** (also known as **sandwich theorem**). This version assumes that inequalities
hold everywhere. -/
theorem tendsto_of_tendsto_of_tendsto_of_le_of_le [OrderTopology α] {f g h : β → α} {b : Filter β}
{a : α} (hg : Tendsto g b (𝓝 a)) (hh : Tendsto h b (𝓝 a)) (hgf : g ≤ f) (hfh : f ≤ h) :
Tendsto f b (𝓝 a) :=
tendsto_of_tendsto_of_tendsto_of_le_of_le' hg hh (Eventually.of_forall hgf)
(Eventually.of_forall hfh)
alias Filter.Tendsto.squeeze := tendsto_of_tendsto_of_tendsto_of_le_of_le
theorem nhds_order_unbounded [OrderTopology α] {a : α} (hu : ∃ u, a < u) (hl : ∃ l, l < a) :
𝓝 a = ⨅ (l) (_ : l < a) (u) (_ : a < u), 𝓟 (Ioo l u) := by
simp only [nhds_eq_order, ← inf_biInf, ← biInf_inf, *, ← inf_principal, ← Ioi_inter_Iio]; rfl
theorem tendsto_order_unbounded [OrderTopology α] {f : β → α} {a : α} {x : Filter β}
(hu : ∃ u, a < u) (hl : ∃ l, l < a) (h : ∀ l u, l < a → a < u → ∀ᶠ b in x, l < f b ∧ f b < u) :
Tendsto f x (𝓝 a) := by
simp only [nhds_order_unbounded hu hl, tendsto_iInf, tendsto_principal]
exact fun l hl u => h l u hl
end Preorder
instance tendstoIxxNhdsWithin {α : Type*} [TopologicalSpace α] (a : α) {s t : Set α}
{Ixx} [TendstoIxxClass Ixx (𝓝 a) (𝓝 a)] [TendstoIxxClass Ixx (𝓟 s) (𝓟 t)] :
TendstoIxxClass Ixx (𝓝[s] a) (𝓝[t] a) :=
Filter.tendstoIxxClass_inf
instance tendstoIccClassNhdsPi {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)]
[∀ i, TopologicalSpace (α i)] [∀ i, OrderTopology (α i)] (f : ∀ i, α i) :
TendstoIxxClass Icc (𝓝 f) (𝓝 f) := by
constructor
conv in (𝓝 f).smallSets => rw [nhds_pi, Filter.pi]
simp only [smallSets_iInf, smallSets_comap_eq_comap_image, tendsto_iInf, tendsto_comap_iff]
intro i
have : Tendsto (fun g : ∀ i, α i => g i) (𝓝 f) (𝓝 (f i)) := (continuous_apply i).tendsto f
refine (this.comp tendsto_fst).Icc (this.comp tendsto_snd) |>.smallSets_mono ?_
filter_upwards [] using fun ⟨f, g⟩ ↦ image_subset_iff.mpr fun p hp ↦ ⟨hp.1 i, hp.2 i⟩
theorem induced_topology_le_preorder [Preorder α] [Preorder β] [TopologicalSpace β]
[OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y) :
induced f ‹TopologicalSpace β› ≤ Preorder.topology α := by
let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩
refine le_of_nhds_le_nhds fun x => ?_
simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, ← hf]
refine inf_le_inf (le_iInf₂ fun a ha => ?_) (le_iInf₂ fun a ha => ?_)
exacts [iInf₂_le (f a) ha, iInf₂_le (f a) ha]
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β]
[OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y)
(H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y)
(H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) :
induced f ‹TopologicalSpace β› = Preorder.topology α := by
let _ := Preorder.topology α; have : OrderTopology α := ⟨rfl⟩
refine le_antisymm (induced_topology_le_preorder hf) ?_
refine le_of_nhds_le_nhds fun a => ?_
simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal]
refine inf_le_inf (le_iInf₂ fun b hb => ?_) (le_iInf₂ fun b hb => ?_)
· by_cases! h : ∃ x, ¬(b < f x)
· rcases h with ⟨x, hx⟩
rcases H₁ hb hx with ⟨y, hya, hyb⟩
exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz))
· exact le_principal_iff.2 (univ_mem' h)
· by_cases! h : ∃ x, ¬(f x < b)
· rcases h with ⟨x, hx⟩
rcases H₂ hb hx with ⟨y, hya, hyb⟩
exact iInf₂_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb)
· exact le_principal_iff.2 (univ_mem' h)
theorem induced_orderTopology' {α : Type u} {β : Type v} [Preorder α] [ta : TopologicalSpace β]
[Preorder β] [OrderTopology β] (f : α → β) (hf : ∀ {x y}, f x < f y ↔ x < y)
(H₁ : ∀ {a x}, x < f a → ∃ b < a, x ≤ f b) (H₂ : ∀ {a x}, f a < x → ∃ b > a, f b ≤ x) :
@OrderTopology _ (induced f ta) _ :=
let _ := induced f ta
⟨induced_topology_eq_preorder hf (fun h _ => H₁ h) (fun h _ => H₂ h)⟩
theorem induced_orderTopology {α : Type u} {β : Type v} [Preorder α] [ta : TopologicalSpace β]
[Preorder β] [OrderTopology β] (f : α → β) (hf : ∀ {x y}, f x < f y ↔ x < y)
(H : ∀ {x y}, x < y → ∃ a, x < f a ∧ f a < y) : @OrderTopology _ (induced f ta) _ :=
induced_orderTopology' f (hf)
(fun xa => let ⟨b, xb, ba⟩ := H xa; ⟨b, hf.1 ba, le_of_lt xb⟩)
fun ax => let ⟨b, ab, bx⟩ := H ax; ⟨b, hf.1 ab, le_of_lt bx⟩
/-- The topology induced by a strictly monotone function with order-connected range is the preorder
topology. -/
nonrec theorem StrictMono.induced_topology_eq_preorder {α β : Type*} [LinearOrder α]
[LinearOrder β] [t : TopologicalSpace β] [OrderTopology β] {f : α → β}
(hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology α := by
refine induced_topology_eq_preorder hf.lt_iff_lt (fun h₁ h₂ => ?_) fun h₁ h₂ => ?_
· rcases hc.out (mem_range_self _) (mem_range_self _) ⟨not_lt.1 h₂, h₁.le⟩ with ⟨y, rfl⟩
exact ⟨y, hf.lt_iff_lt.1 h₁, le_rfl⟩
· rcases hc.out (mem_range_self _) (mem_range_self _) ⟨h₁.le, not_lt.1 h₂⟩ with ⟨y, rfl⟩
exact ⟨y, hf.lt_iff_lt.1 h₁, le_rfl⟩
/-- A strictly monotone function between linear orders with order topology is a topological
embedding provided that the range of `f` is order-connected. -/
theorem StrictMono.isEmbedding_of_ordConnected {α β : Type*} [LinearOrder α] [LinearOrder β]
[TopologicalSpace α] [h : OrderTopology α] [TopologicalSpace β] [OrderTopology β] {f : α → β}
(hf : StrictMono f) (hc : OrdConnected (range f)) : IsEmbedding f :=
⟨⟨h.1.trans <| Eq.symm <| hf.induced_topology_eq_preorder hc⟩, hf.injective⟩
/-- An `OrderEmbedding` is a topological embedding provided that the range of `f` is
order-connected -/
lemma OrderEmbedding.isEmbedding_of_ordConnected {α β : Type*} [LinearOrder α] [LinearOrder β]
[TopologicalSpace α] [OrderTopology α] [TopologicalSpace β] [OrderTopology β]
(f : α ↪o β) (hc : OrdConnected (range f)) : Topology.IsEmbedding f :=
f.strictMono.isEmbedding_of_ordConnected hc
/-- On a `Set.OrdConnected` subset of a linear order, the order topology for the restriction of the
order is the same as the restriction to the subset of the order topology. -/
instance orderTopology_of_ordConnected {α : Type u} [TopologicalSpace α] [LinearOrder α]
[OrderTopology α] {t : Set α} [ht : OrdConnected t] : OrderTopology t :=
⟨(Subtype.strictMono_coe t).induced_topology_eq_preorder <| by
rwa [← @Subtype.range_val _ t] at ht⟩
theorem nhdsGE_eq_iInf_inf_principal [TopologicalSpace α] [Preorder α] [OrderTopology α] (a : α) :
𝓝[≥] a = (⨅ (u) (_ : a < u), 𝓟 (Iio u)) ⊓ 𝓟 (Ici a) := by
rw [nhdsWithin, nhds_eq_order]
refine le_antisymm (inf_le_inf_right _ inf_le_right) (le_inf (le_inf ?_ inf_le_left) inf_le_right)
exact inf_le_right.trans (le_iInf₂ fun l hl => principal_mono.2 <| Ici_subset_Ioi.2 hl)
theorem nhdsLE_eq_iInf_inf_principal [TopologicalSpace α] [Preorder α] [OrderTopology α] (a : α) :
𝓝[≤] a = (⨅ l < a, 𝓟 (Ioi l)) ⊓ 𝓟 (Iic a) :=
nhdsGE_eq_iInf_inf_principal (toDual a)
theorem nhdsGE_eq_iInf_principal [TopologicalSpace α] [Preorder α] [OrderTopology α] {a : α}
(ha : ∃ u, a < u) : 𝓝[≥] a = ⨅ (u) (_ : a < u), 𝓟 (Ico a u) := by
simp only [nhdsGE_eq_iInf_inf_principal, biInf_inf ha, inf_principal, Iio_inter_Ici]
theorem nhdsLE_eq_iInf_principal [TopologicalSpace α] [Preorder α] [OrderTopology α] {a : α}
(ha : ∃ l, l < a) : 𝓝[≤] a = ⨅ l < a, 𝓟 (Ioc l a) := by
simp only [nhdsLE_eq_iInf_inf_principal, biInf_inf ha, inf_principal, Ioi_inter_Iic]
theorem nhdsGE_basis_of_exists_gt [TopologicalSpace α] [LinearOrder α] [OrderTopology α] {a : α}
(ha : ∃ u, a < u) : (𝓝[≥] a).HasBasis (fun u => a < u) fun u => Ico a u :=
(nhdsGE_eq_iInf_principal ha).symm ▸
hasBasis_biInf_principal
(fun b hb c hc => ⟨min b c, lt_min hb hc, Ico_subset_Ico_right (min_le_left _ _),
Ico_subset_Ico_right (min_le_right _ _)⟩)
ha
theorem nhdsLE_basis_of_exists_lt [TopologicalSpace α] [LinearOrder α] [OrderTopology α] {a : α}
(ha : ∃ l, l < a) : (𝓝[≤] a).HasBasis (fun l => l < a) fun l => Ioc l a := by
convert nhdsGE_basis_of_exists_gt (α := αᵒᵈ) ha using 2
exact Ico_toDual.symm
theorem nhdsGE_basis [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [NoMaxOrder α] (a : α) :
(𝓝[≥] a).HasBasis (fun u => a < u) fun u => Ico a u :=
nhdsGE_basis_of_exists_gt (exists_gt a)
theorem nhdsLE_basis [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [NoMinOrder α] (a : α) :
(𝓝[≤] a).HasBasis (fun l => l < a) fun l => Ioc l a :=
nhdsLE_basis_of_exists_lt (exists_lt a)
theorem nhds_top_order [TopologicalSpace α] [Preorder α] [OrderTop α] [OrderTopology α] :
𝓝 (⊤ : α) = ⨅ (l) (_ : l < ⊤), 𝓟 (Ioi l) := by simp [nhds_eq_order (⊤ : α)]
theorem nhds_bot_order [TopologicalSpace α] [Preorder α] [OrderBot α] [OrderTopology α] :
𝓝 (⊥ : α) = ⨅ (l) (_ : ⊥ < l), 𝓟 (Iio l) := by simp [nhds_eq_order (⊥ : α)]
theorem nhds_top_basis [TopologicalSpace α] [LinearOrder α] [OrderTop α] [OrderTopology α]
[Nontrivial α] : (𝓝 ⊤).HasBasis (fun a : α => a < ⊤) fun a : α => Ioi a := by
have : ∃ x : α, x < ⊤ := (exists_ne ⊤).imp fun x hx => hx.lt_top
simpa only [Iic_top, nhdsWithin_univ, Ioc_top] using nhdsLE_basis_of_exists_lt this
theorem nhds_bot_basis [TopologicalSpace α] [LinearOrder α] [OrderBot α] [OrderTopology α]
[Nontrivial α] : (𝓝 ⊥).HasBasis (fun a : α => ⊥ < a) fun a : α => Iio a :=
nhds_top_basis (α := αᵒᵈ)
theorem nhds_top_basis_Ici [TopologicalSpace α] [LinearOrder α] [OrderTop α] [OrderTopology α]
[Nontrivial α] [DenselyOrdered α] : (𝓝 ⊤).HasBasis (fun a : α => a < ⊤) Ici :=
nhds_top_basis.to_hasBasis
(fun _a ha => let ⟨b, hab, hb⟩ := exists_between ha; ⟨b, hb, Ici_subset_Ioi.mpr hab⟩)
fun a ha => ⟨a, ha, Ioi_subset_Ici_self⟩
theorem nhds_bot_basis_Iic [TopologicalSpace α] [LinearOrder α] [OrderBot α] [OrderTopology α]
[Nontrivial α] [DenselyOrdered α] : (𝓝 ⊥).HasBasis (fun a : α => ⊥ < a) Iic :=
nhds_top_basis_Ici (α := αᵒᵈ)
theorem tendsto_nhds_top_mono [TopologicalSpace β] [Preorder β] [OrderTop β] [OrderTopology β]
{l : Filter α} {f g : α → β} (hf : Tendsto f l (𝓝 ⊤)) (hg : f ≤ᶠ[l] g) : Tendsto g l (𝓝 ⊤) := by
simp only [nhds_top_order, tendsto_iInf, tendsto_principal] at hf ⊢
intro x hx
filter_upwards [hf x hx, hg] with _ using lt_of_lt_of_le
theorem tendsto_nhds_bot_mono [TopologicalSpace β] [Preorder β] [OrderBot β] [OrderTopology β]
{l : Filter α} {f g : α → β} (hf : Tendsto f l (𝓝 ⊥)) (hg : g ≤ᶠ[l] f) : Tendsto g l (𝓝 ⊥) :=
tendsto_nhds_top_mono (β := βᵒᵈ) hf hg
theorem tendsto_nhds_top_mono' [TopologicalSpace β] [Preorder β] [OrderTop β] [OrderTopology β]
{l : Filter α} {f g : α → β} (hf : Tendsto f l (𝓝 ⊤)) (hg : f ≤ g) : Tendsto g l (𝓝 ⊤) :=
tendsto_nhds_top_mono hf (Eventually.of_forall hg)
theorem tendsto_nhds_bot_mono' [TopologicalSpace β] [Preorder β] [OrderBot β] [OrderTopology β]
{l : Filter α} {f g : α → β} (hf : Tendsto f l (𝓝 ⊥)) (hg : g ≤ f) : Tendsto g l (𝓝 ⊥) :=
tendsto_nhds_bot_mono hf (Eventually.of_forall hg)
section LinearOrder
variable [TopologicalSpace α] [LinearOrder α]
section OrderTopology
theorem order_separated [OrderTopology α] {a₁ a₂ : α} (h : a₁ < a₂) :
∃ u v : Set α, IsOpen u ∧ IsOpen v ∧ a₁ ∈ u ∧ a₂ ∈ v ∧ ∀ b₁ ∈ u, ∀ b₂ ∈ v, b₁ < b₂ :=
let ⟨x, hx, y, hy, h⟩ := h.exists_disjoint_Iio_Ioi
⟨Iio x, Ioi y, isOpen_gt' _, isOpen_lt' _, hx, hy, h⟩
-- see Note [lower instance priority]
instance (priority := 100) OrderTopology.to_orderClosedTopology [OrderTopology α] :
OrderClosedTopology α where
isClosed_le' := isOpen_compl_iff.1 <| isOpen_prod_iff.mpr fun a₁ a₂ (h : ¬a₁ ≤ a₂) =>
have h : a₂ < a₁ := lt_of_not_ge h
let ⟨u, v, hu, hv, ha₁, ha₂, h⟩ := order_separated h
⟨v, u, hv, hu, ha₂, ha₁, fun ⟨b₁, b₂⟩ ⟨h₁, h₂⟩ => not_le_of_gt <| h b₂ h₂ b₁ h₁⟩
theorem exists_Ioc_subset_of_mem_nhds [OrderTopology α] {a : α} {s : Set α} (hs : s ∈ 𝓝 a)
(h : ∃ l, l < a) : ∃ l < a, Ioc l a ⊆ s :=
(nhdsLE_basis_of_exists_lt h).mem_iff.mp (nhdsWithin_le_nhds hs)
theorem exists_Ioc_subset_of_mem_nhds' [OrderTopology α] {a : α} {s : Set α} (hs : s ∈ 𝓝 a) {l : α}
(hl : l < a) : ∃ l' ∈ Ico l a, Ioc l' a ⊆ s :=
let ⟨l', hl'a, hl's⟩ := exists_Ioc_subset_of_mem_nhds hs ⟨l, hl⟩
⟨max l l', ⟨le_max_left _ _, max_lt hl hl'a⟩,
(Ioc_subset_Ioc_left <| le_max_right _ _).trans hl's⟩
theorem exists_Ico_subset_of_mem_nhds' [OrderTopology α] {a : α} {s : Set α} (hs : s ∈ 𝓝 a) {u : α}
(hu : a < u) : ∃ u' ∈ Ioc a u, Ico a u' ⊆ s := by
simpa only [OrderDual.exists, exists_prop, Ico_toDual, Ioc_toDual] using
exists_Ioc_subset_of_mem_nhds' (show ofDual ⁻¹' s ∈ 𝓝 (toDual a) from hs) hu.dual
theorem exists_Ico_subset_of_mem_nhds [OrderTopology α] {a : α} {s : Set α} (hs : s ∈ 𝓝 a)
(h : ∃ u, a < u) : ∃ u, a < u ∧ Ico a u ⊆ s :=
let ⟨_l', hl'⟩ := h
let ⟨l, hl⟩ := exists_Ico_subset_of_mem_nhds' hs hl'
⟨l, hl.1.1, hl.2⟩
theorem exists_Icc_mem_subset_of_mem_nhdsGE [OrderTopology α] {a : α} {s : Set α}
(hs : s ∈ 𝓝[≥] a) : ∃ b, a ≤ b ∧ Icc a b ∈ 𝓝[≥] a ∧ Icc a b ⊆ s := by
rcases (em (IsMax a)).imp_right not_isMax_iff.mp with (ha | ha)
· use a
simpa [ha.Ici_eq] using hs
· rcases(nhdsGE_basis_of_exists_gt ha).mem_iff.mp hs with ⟨b, hab, hbs⟩
rcases eq_empty_or_nonempty (Ioo a b) with (H | ⟨c, hac, hcb⟩)
· have : Ico a b = Icc a a := by rw [← Icc_union_Ioo_eq_Ico le_rfl hab, H, union_empty]
exact ⟨a, le_rfl, this ▸ ⟨Ico_mem_nhdsGE hab, hbs⟩⟩
· refine ⟨c, hac.le, Icc_mem_nhdsGE hac, ?_⟩
exact (Icc_subset_Ico_right hcb).trans hbs
theorem exists_Icc_mem_subset_of_mem_nhdsLE [OrderTopology α] {a : α} {s : Set α}
(hs : s ∈ 𝓝[≤] a) : ∃ b ≤ a, Icc b a ∈ 𝓝[≤] a ∧ Icc b a ⊆ s := by
simpa only [Icc_toDual, toDual.surjective.exists] using
exists_Icc_mem_subset_of_mem_nhdsGE (α := αᵒᵈ) (a := toDual a) hs
theorem exists_Icc_mem_subset_of_mem_nhds [OrderTopology α] {a : α} {s : Set α} (hs : s ∈ 𝓝 a) :
∃ b c, a ∈ Icc b c ∧ Icc b c ∈ 𝓝 a ∧ Icc b c ⊆ s := by
rcases exists_Icc_mem_subset_of_mem_nhdsLE (nhdsWithin_le_nhds hs) with
⟨b, hba, hb_nhds, hbs⟩
rcases exists_Icc_mem_subset_of_mem_nhdsGE (nhdsWithin_le_nhds hs) with
⟨c, hac, hc_nhds, hcs⟩
refine ⟨b, c, ⟨hba, hac⟩, ?_⟩
rw [← Icc_union_Icc_eq_Icc hba hac, ← nhdsLE_sup_nhdsGE]
exact ⟨union_mem_sup hb_nhds hc_nhds, union_subset hbs hcs⟩
theorem IsOpen.exists_Ioo_subset [OrderTopology α] [Nontrivial α] {s : Set α} (hs : IsOpen s)
(h : s.Nonempty) : ∃ a b, a < b ∧ Ioo a b ⊆ s := by
obtain ⟨x, hx⟩ : ∃ x, x ∈ s := h
obtain ⟨y, hy⟩ : ∃ y, y ≠ x := exists_ne x
rcases lt_trichotomy x y with (H | rfl | H)
· obtain ⟨u, xu, hu⟩ : ∃ u, x < u ∧ Ico x u ⊆ s :=
exists_Ico_subset_of_mem_nhds (hs.mem_nhds hx) ⟨y, H⟩
exact ⟨x, u, xu, Ioo_subset_Ico_self.trans hu⟩
· exact (hy rfl).elim
· obtain ⟨l, lx, hl⟩ : ∃ l, l < x ∧ Ioc l x ⊆ s :=
exists_Ioc_subset_of_mem_nhds (hs.mem_nhds hx) ⟨y, H⟩
exact ⟨l, x, lx, Ioo_subset_Ioc_self.trans hl⟩
theorem dense_of_exists_between [OrderTopology α] [Nontrivial α] {s : Set α}
(h : ∀ ⦃a b⦄, a < b → ∃ c ∈ s, a < c ∧ c < b) : Dense s := by
refine dense_iff_inter_open.2 fun U U_open U_nonempty => ?_
obtain ⟨a, b, hab, H⟩ : ∃ a b : α, a < b ∧ Ioo a b ⊆ U := U_open.exists_Ioo_subset U_nonempty
obtain ⟨x, xs, hx⟩ : ∃ x ∈ s, a < x ∧ x < b := h hab
exact ⟨x, ⟨H hx, xs⟩⟩
theorem IsUpperSet.isClosed [OrderTopology α] [WellFoundedLT α] {s : Set α} (h : IsUpperSet s) :
IsClosed s := by
obtain rfl | ⟨a, rfl⟩ := h.eq_empty_or_Ici
exacts [isClosed_empty, isClosed_Ici]
theorem IsLowerSet.isClosed [OrderTopology α] [WellFoundedGT α] {s : Set α} (h : IsLowerSet s) :
IsClosed s :=
h.toDual.isClosed
theorem IsLowerSet.isOpen [OrderTopology α] [WellFoundedLT α] {s : Set α} (h : IsLowerSet s) :
IsOpen s := by
simpa using h.compl.isClosed
theorem IsUpperSet.isOpen [OrderTopology α] [WellFoundedGT α] {s : Set α} (h : IsUpperSet s) :
IsOpen s :=
h.toDual.isOpen
/-- A set in a nontrivial densely linear ordered type is dense in the sense of topology if and only
if for any `a < b` there exists `c ∈ s`, `a < c < b`. Each implication requires less typeclass
assumptions. -/
theorem dense_iff_exists_between [OrderTopology α] [DenselyOrdered α] [Nontrivial α] {s : Set α} :
Dense s ↔ ∀ a b, a < b → ∃ c ∈ s, a < c ∧ c < b :=
⟨fun h _ _ hab => h.exists_between hab, dense_of_exists_between⟩
/-- A set is a neighborhood of `a` if and only if it contains an interval `(l, u)` containing `a`,
provided `a` is neither a bottom element nor a top element. -/
theorem mem_nhds_iff_exists_Ioo_subset' [OrderTopology α] {a : α} {s : Set α} (hl : ∃ l, l < a)
(hu : ∃ u, a < u) : s ∈ 𝓝 a ↔ ∃ l u, a ∈ Ioo l u ∧ Ioo l u ⊆ s := by
constructor
· intro h
rcases exists_Ico_subset_of_mem_nhds h hu with ⟨u, au, hu⟩
rcases exists_Ioc_subset_of_mem_nhds h hl with ⟨l, la, hl⟩
exact ⟨l, u, ⟨la, au⟩, Ioc_union_Ico_eq_Ioo la au ▸ union_subset hl hu⟩
· rintro ⟨l, u, ha, h⟩
apply mem_of_superset (Ioo_mem_nhds ha.1 ha.2) h
/-- A set is a neighborhood of `a` if and only if it contains an interval `(l, u)` containing `a`.
-/
theorem mem_nhds_iff_exists_Ioo_subset [OrderTopology α] [NoMaxOrder α] [NoMinOrder α] {a : α}
{s : Set α} : s ∈ 𝓝 a ↔ ∃ l u, a ∈ Ioo l u ∧ Ioo l u ⊆ s :=
mem_nhds_iff_exists_Ioo_subset' (exists_lt a) (exists_gt a)
theorem nhds_basis_Ioo' [OrderTopology α] {a : α} (hl : ∃ l, l < a) (hu : ∃ u, a < u) :
(𝓝 a).HasBasis (fun b : α × α => b.1 < a ∧ a < b.2) fun b => Ioo b.1 b.2 :=
⟨fun s => (mem_nhds_iff_exists_Ioo_subset' hl hu).trans <| by simp⟩
theorem nhds_basis_Ioo [OrderTopology α] [NoMaxOrder α] [NoMinOrder α] (a : α) :
(𝓝 a).HasBasis (fun b : α × α => b.1 < a ∧ a < b.2) fun b => Ioo b.1 b.2 :=
nhds_basis_Ioo' (exists_lt a) (exists_gt a)
theorem Filter.Eventually.exists_Ioo_subset [OrderTopology α] [NoMaxOrder α] [NoMinOrder α] {a : α}
{p : α → Prop} (hp : ∀ᶠ x in 𝓝 a, p x) : ∃ l u, a ∈ Ioo l u ∧ Ioo l u ⊆ { x | p x } :=
mem_nhds_iff_exists_Ioo_subset.1 hp
theorem Dense.topology_eq_generateFrom [OrderTopology α] [DenselyOrdered α] {s : Set α}
(hs : Dense s) : ‹TopologicalSpace α› = .generateFrom (Ioi '' s ∪ Iio '' s) := by
refine (OrderTopology.topology_eq_generate_intervals (α := α)).trans ?_
refine le_antisymm (generateFrom_anti ?_) (le_generateFrom ?_)
· simp only [union_subset_iff, image_subset_iff]
exact ⟨fun a _ ↦ ⟨a, .inl rfl⟩, fun a _ ↦ ⟨a, .inr rfl⟩⟩
· rintro _ ⟨a, rfl | rfl⟩
· rw [hs.Ioi_eq_biUnion]
let _ := generateFrom (Ioi '' s ∪ Iio '' s)
exact isOpen_iUnion fun x ↦ isOpen_iUnion fun h ↦ .basic _ <| .inl <| mem_image_of_mem _ h.1
· rw [hs.Iio_eq_biUnion]
let _ := generateFrom (Ioi '' s ∪ Iio '' s)
exact isOpen_iUnion fun x ↦ isOpen_iUnion fun h ↦ .basic _ <| .inr <| mem_image_of_mem _ h.1
theorem PredOrder.hasBasis_nhds_Ioc_of_exists_gt [OrderTopology α] [PredOrder α] {a : α}
(ha : ∃ u, a < u) : (𝓝 a).HasBasis (a < ·) (Set.Ico a ·) :=
PredOrder.nhdsGE_eq_nhds a ▸ nhdsGE_basis_of_exists_gt ha
theorem PredOrder.hasBasis_nhds_Ioc [OrderTopology α] [PredOrder α] [NoMaxOrder α] {a : α} :
(𝓝 a).HasBasis (a < ·) (Set.Ico a ·) :=
PredOrder.hasBasis_nhds_Ioc_of_exists_gt (exists_gt a)
theorem SuccOrder.hasBasis_nhds_Ioc_of_exists_lt [OrderTopology α] [SuccOrder α] {a : α}
(ha : ∃ l, l < a) : (𝓝 a).HasBasis (· < a) (Set.Ioc · a) :=
SuccOrder.nhdsLE_eq_nhds a ▸ nhdsLE_basis_of_exists_lt ha
theorem SuccOrder.hasBasis_nhds_Ioc [OrderTopology α] [SuccOrder α] {a : α} [NoMinOrder α] :
(𝓝 a).HasBasis (· < a) (Set.Ioc · a) :=
SuccOrder.hasBasis_nhds_Ioc_of_exists_lt (exists_lt a)
variable (α) in
/-- Let `α` be a densely ordered linear order with order topology. If `α` is a separable space, then
it has second countable topology. Note that the "densely ordered" assumption cannot be dropped, see
[double arrow space](https://topology.pi-base.org/spaces/S000093) for a counterexample. -/
theorem SecondCountableTopology.of_separableSpace_orderTopology [OrderTopology α] [DenselyOrdered α]
[SeparableSpace α] : SecondCountableTopology α := by
rcases exists_countable_dense α with ⟨s, hc, hd⟩
refine ⟨⟨_, ?_, hd.topology_eq_generateFrom⟩⟩
exact (hc.image _).union (hc.image _)
/-- The set of points which are isolated on the right is countable when the space is
second-countable. -/
theorem countable_setOf_covBy_right [OrderTopology α] [SecondCountableTopology α] :
Set.Countable { x : α | ∃ y, x ⋖ y } := by
nontriviality α
let s := { x : α | ∃ y, x ⋖ y }
have : ∀ x ∈ s, ∃ y, x ⋖ y := fun x => id
choose! y hy using this
have Hy : ∀ x z, x ∈ s → z < y x → z ≤ x := fun x z hx => (hy x hx).le_of_lt
suffices H : ∀ a : Set α, IsOpen a → Set.Countable { x | x ∈ s ∧ x ∈ a ∧ y x ∉ a } by
have : s ⊆ ⋃ a ∈ countableBasis α, { x | x ∈ s ∧ x ∈ a ∧ y x ∉ a } := fun x hx => by
rcases (isBasis_countableBasis α).exists_mem_of_ne (hy x hx).ne with ⟨a, ab, xa, ya⟩
exact mem_iUnion₂.2 ⟨a, ab, hx, xa, ya⟩
refine Set.Countable.mono this ?_
refine Countable.biUnion (countable_countableBasis α) fun a ha => H _ ?_
exact isOpen_of_mem_countableBasis ha
intro a ha
suffices H : Set.Countable { x | (x ∈ s ∧ x ∈ a ∧ y x ∉ a) ∧ ¬IsBot x } from
H.of_diff (subsingleton_isBot α).countable
simp only [and_assoc]
let t := { x | x ∈ s ∧ x ∈ a ∧ y x ∉ a ∧ ¬IsBot x }
have : ∀ x ∈ t, ∃ z < x, Ioc z x ⊆ a := by
intro x hx
apply exists_Ioc_subset_of_mem_nhds (ha.mem_nhds hx.2.1)
simpa only [IsBot, not_forall, not_le] using hx.right.right.right
choose! z hz h'z using this
have : PairwiseDisjoint t fun x => Ioc (z x) x := fun x xt x' x't hxx' => by
rcases hxx'.lt_or_gt with (h' | h')
· refine disjoint_left.2 fun u ux ux' => xt.2.2.1 ?_
refine h'z x' x't ⟨ux'.1.trans_le (ux.2.trans (hy x xt.1).le), ?_⟩
by_contra! H
exact lt_irrefl _ ((Hy _ _ xt.1 H).trans_lt h')
· refine disjoint_left.2 fun u ux ux' => x't.2.2.1 ?_
refine h'z x xt ⟨ux.1.trans_le (ux'.2.trans (hy x' x't.1).le), ?_⟩
by_contra! H
exact lt_irrefl _ ((Hy _ _ x't.1 H).trans_lt h')
refine this.countable_of_isOpen (fun x hx => ?_) fun x hx => ⟨x, hz x hx, le_rfl⟩
suffices H : Ioc (z x) x = Ioo (z x) (y x) by
rw [H]
exact isOpen_Ioo
exact Subset.antisymm (Ioc_subset_Ioo_right (hy x hx.1).lt) fun u hu => ⟨hu.1, Hy _ _ hx.1 hu.2⟩
/-- The set of points which are isolated on the left is countable when the space is
second-countable. -/
theorem countable_setOf_covBy_left [OrderTopology α] [SecondCountableTopology α] :
Set.Countable { x : α | ∃ y, y ⋖ x } := by
convert countable_setOf_covBy_right (α := αᵒᵈ) using 5
exact toDual_covBy_toDual_iff.symm
/-- The set of points which are isolated on the left is countable when the space is
second-countable. -/
theorem countable_of_isolated_left' [OrderTopology α] [SecondCountableTopology α] :
Set.Countable { x : α | ∃ y, y < x ∧ Ioo y x = ∅ } := by
simpa only [← covBy_iff_Ioo_eq] using countable_setOf_covBy_left
/-- Consider a disjoint family of intervals `(x, y)` with `x < y` in a second-countable space.
Then the family is countable.
This is not a straightforward consequence of second-countability as some of these intervals might be
empty (but in fact this can happen only for countably many of them). -/
theorem Set.PairwiseDisjoint.countable_of_Ioo [OrderTopology α] [SecondCountableTopology α]
{y : α → α} {s : Set α} (h : PairwiseDisjoint s fun x => Ioo x (y x))
(h' : ∀ x ∈ s, x < y x) : s.Countable :=
have : (s \ { x | ∃ y, x ⋖ y }).Countable :=
(h.subset diff_subset).countable_of_isOpen (fun _ _ => isOpen_Ioo)
fun x hx => (h' _ hx.1).exists_lt_lt (mt (Exists.intro (y x)) hx.2)
this.of_diff countable_setOf_covBy_right
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(x, ∞)` is separated above from `f x` is countable. We give
here a version relative to a set `t`. -/
theorem countable_image_lt_image_Ioi_within
[OrderTopology α] [LinearOrder β] [SecondCountableTopology α] (t : Set β) (f : β → α) :
Set.Countable {x ∈ t | ∃ z, f x < z ∧ ∀ y ∈ t, x < y → z ≤ f y} := by
/- If the values of `f` are separated above on the right of `x`, there is an interval `(f x, z x)`
which is not reached by `f`. This gives a family of disjoint open intervals in `α`. Such a
family can only be countable as `α` is second-countable. -/
nontriviality β
have : Nonempty α := Nonempty.map f (by infer_instance)
let s := {x ∈ t | ∃ z, f x < z ∧ ∀ y ∈ t, x < y → z ≤ f y}
have : ∀ x, x ∈ s → ∃ z, f x < z ∧ ∀ y ∈ t, x < y → z ≤ f y := fun x hx ↦ hx.2
-- choose `z x` such that `f` does not take the values in `(f x, z x)`.
choose! z hz using this
have I : InjOn f s := by
apply StrictMonoOn.injOn
intro x hx y hy hxy
calc
f x < z x := (hz x hx).1
_ ≤ f y := (hz x hx).2 y hy.1 hxy
-- show that `f s` is countable by arguing that a disjoint family of disjoint open intervals
-- (the intervals `(f x, z x)`) is at most countable.
have fs_count : (f '' s).Countable := by
have A : (f '' s).PairwiseDisjoint fun x => Ioo x (z (invFunOn f s x)) := by
rintro _ ⟨u, us, rfl⟩ _ ⟨v, vs, rfl⟩ huv
wlog hle : u ≤ v generalizing u v
· exact (this v vs u us huv.symm (le_of_not_ge hle)).symm
have hlt : u < v := hle.lt_of_ne (ne_of_apply_ne _ huv)
apply disjoint_iff_forall_ne.2
rintro a ha b hb rfl
simp only [I.leftInvOn_invFunOn us, I.leftInvOn_invFunOn vs] at ha hb
exact lt_irrefl _ ((ha.2.trans_le ((hz u us).2 v vs.1 hlt)).trans hb.1)
apply Set.PairwiseDisjoint.countable_of_Ioo A
rintro _ ⟨y, ys, rfl⟩
simpa only [I.leftInvOn_invFunOn ys] using (hz y ys).1
exact MapsTo.countable_of_injOn (mapsTo_image f s) I fs_count
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(x, ∞)` is separated above from `f x` is countable. -/
theorem countable_image_lt_image_Ioi [OrderTopology α] [LinearOrder β] (f : β → α)
[SecondCountableTopology α] : Set.Countable {x | ∃ z, f x < z ∧ ∀ y, x < y → z ≤ f y} := by
simpa using countable_image_lt_image_Ioi_within univ f
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(x, ∞)` is separated below from `f x` is countable. We give
here a version relative to a set `t`. -/
theorem countable_image_gt_image_Ioi_within
[OrderTopology α] [LinearOrder β] [SecondCountableTopology α] (t : Set β) (f : β → α) :
Set.Countable {x ∈ t | ∃ z, z < f x ∧ ∀ y ∈ t, x < y → f y ≤ z} :=
countable_image_lt_image_Ioi_within (α := αᵒᵈ) t f
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(x, ∞)` is separated below from `f x` is countable. -/
theorem countable_image_gt_image_Ioi [OrderTopology α] [LinearOrder β] (f : β → α)
[SecondCountableTopology α] : Set.Countable {x | ∃ z, z < f x ∧ ∀ y, x < y → f y ≤ z} :=
countable_image_lt_image_Ioi (α := αᵒᵈ) f
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(-∞, x)` is separated above from `f x` is countable. We give
here a version relative to a set `t`. -/
theorem countable_image_lt_image_Iio_within
[OrderTopology α] [LinearOrder β] [SecondCountableTopology α] (t : Set β) (f : β → α) :
Set.Countable {x ∈ t | ∃ z, f x < z ∧ ∀ y ∈ t, y < x → z ≤ f y} :=
countable_image_lt_image_Ioi_within (β := βᵒᵈ) t f
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(-∞, x)` is separated above from `f x` is countable. -/
theorem countable_image_lt_image_Iio [OrderTopology α] [LinearOrder β] (f : β → α)
[SecondCountableTopology α] : Set.Countable {x | ∃ z, f x < z ∧ ∀ y, y < x → z ≤ f y} :=
countable_image_lt_image_Ioi (β := βᵒᵈ) f
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(-∞, x)` is separated below from `f x` is countable. We give
here a version relative to a set `t`. -/
theorem countable_image_gt_image_Iio_within
[OrderTopology α] [LinearOrder β] [SecondCountableTopology α] (t : Set β) (f : β → α) :
Set.Countable {x ∈ t | ∃ z, z < f x ∧ ∀ y ∈ t, y < x → f y ≤ z} :=
countable_image_lt_image_Ioi_within (α := αᵒᵈ) (β := βᵒᵈ) t f
/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(-∞, x)` is separated below from `f x` is countable. -/
theorem countable_image_gt_image_Iio [OrderTopology α] [LinearOrder β] (f : β → α)
[SecondCountableTopology α] : Set.Countable {x | ∃ z, z < f x ∧ ∀ y, y < x → f y ≤ z} :=
countable_image_lt_image_Ioi (α := αᵒᵈ) (β := βᵒᵈ) f
instance instIsCountablyGenerated_atTop [OrderTopology α] [SecondCountableTopology α] :
IsCountablyGenerated (atTop : Filter α) := by
by_cases h : ∃ (x : α), IsTop x
· rcases h with ⟨x, hx⟩
rw [atTop_eq_pure_of_isTop hx]
exact isCountablyGenerated_pure x
· rcases exists_countable_basis α with ⟨b, b_count, b_ne, hb⟩
have : Countable b := by exact Iff.mpr countable_coe_iff b_count
have A : ∀ (s : b), ∃ (x : α), x ∈ (s : Set α) := by
intro s
have : (s : Set α) ≠ ∅ := by
intro H
apply b_ne
convert s.2
exact H.symm
exact Iff.mp notMem_singleton_empty this
choose a ha using A
have : (atTop : Filter α) = (generate (Ici '' (range a))) := by
apply atTop_eq_generate_of_not_bddAbove
intro ⟨x, hx⟩
simp only [IsTop, not_exists, not_forall, not_le] at h
rcases h x with ⟨y, hy⟩
obtain ⟨s, sb, -, hs⟩ : ∃ s, s ∈ b ∧ y ∈ s ∧ s ⊆ Ioi x :=
hb.exists_subset_of_mem_open hy isOpen_Ioi
have I : a ⟨s, sb⟩ ≤ x := hx (mem_range_self _)
have J : x < a ⟨s, sb⟩ := hs (ha ⟨s, sb⟩)
exact lt_irrefl _ (I.trans_lt J)
rw [this]
exact ⟨_, (countable_range _).image _, rfl⟩
instance instIsCountablyGenerated_atBot [OrderTopology α] [SecondCountableTopology α] :
IsCountablyGenerated (atBot : Filter α) :=
@instIsCountablyGenerated_atTop αᵒᵈ _ _ _ _
section Pi
/-!
### Intervals in `Π i, X i` belong to `𝓝 x`
For each lemma `pi_Ixx_mem_nhds` we add a non-dependent version `pi_Ixx_mem_nhds'` because
sometimes Lean fails to unify different instances while trying to apply the dependent version to,
e.g., `ι → ℝ`.
-/
variable [OrderTopology α] {ι : Type*} {X : ι → Type*} [Finite ι] [∀ i, LinearOrder (X i)]
[∀ i, TopologicalSpace (X i)] [∀ i, OrderTopology (X i)] {a b x : ∀ i, X i} {a' b' x' : ι → α}
theorem pi_Iic_mem_nhds (ha : ∀ i, x i < a i) : Iic a ∈ 𝓝 x :=
pi_univ_Iic a ▸ set_pi_mem_nhds (Set.toFinite _) fun _ _ => Iic_mem_nhds (ha _)
theorem pi_Iic_mem_nhds' (ha : ∀ i, x' i < a' i) : Iic a' ∈ 𝓝 x' :=
pi_Iic_mem_nhds ha
theorem pi_Ici_mem_nhds (ha : ∀ i, a i < x i) : Ici a ∈ 𝓝 x :=
pi_univ_Ici a ▸ set_pi_mem_nhds (Set.toFinite _) fun _ _ => Ici_mem_nhds (ha _)
theorem pi_Ici_mem_nhds' (ha : ∀ i, a' i < x' i) : Ici a' ∈ 𝓝 x' :=
pi_Ici_mem_nhds ha
theorem pi_Icc_mem_nhds (ha : ∀ i, a i < x i) (hb : ∀ i, x i < b i) : Icc a b ∈ 𝓝 x :=
pi_univ_Icc a b ▸ set_pi_mem_nhds finite_univ fun _ _ => Icc_mem_nhds (ha _) (hb _)
theorem pi_Icc_mem_nhds' (ha : ∀ i, a' i < x' i) (hb : ∀ i, x' i < b' i) : Icc a' b' ∈ 𝓝 x' :=
pi_Icc_mem_nhds ha hb
variable [Nonempty ι]
theorem pi_Iio_mem_nhds (ha : ∀ i, x i < a i) : Iio a ∈ 𝓝 x := mem_of_superset
(set_pi_mem_nhds finite_univ fun i _ ↦ Iio_mem_nhds (ha i)) (pi_univ_Iio_subset a)
theorem pi_Iio_mem_nhds' (ha : ∀ i, x' i < a' i) : Iio a' ∈ 𝓝 x' :=
pi_Iio_mem_nhds ha
theorem pi_Ioi_mem_nhds (ha : ∀ i, a i < x i) : Ioi a ∈ 𝓝 x :=
pi_Iio_mem_nhds (X := fun i => (X i)ᵒᵈ) ha
theorem pi_Ioi_mem_nhds' (ha : ∀ i, a' i < x' i) : Ioi a' ∈ 𝓝 x' :=
pi_Ioi_mem_nhds ha
theorem pi_Ioc_mem_nhds (ha : ∀ i, a i < x i) (hb : ∀ i, x i < b i) : Ioc a b ∈ 𝓝 x := by
refine mem_of_superset (set_pi_mem_nhds Set.finite_univ fun i _ => ?_) (pi_univ_Ioc_subset a b)
exact Ioc_mem_nhds (ha i) (hb i)
theorem pi_Ioc_mem_nhds' (ha : ∀ i, a' i < x' i) (hb : ∀ i, x' i < b' i) : Ioc a' b' ∈ 𝓝 x' :=
pi_Ioc_mem_nhds ha hb
theorem pi_Ico_mem_nhds (ha : ∀ i, a i < x i) (hb : ∀ i, x i < b i) : Ico a b ∈ 𝓝 x := by
refine mem_of_superset (set_pi_mem_nhds Set.finite_univ fun i _ => ?_) (pi_univ_Ico_subset a b)
exact Ico_mem_nhds (ha i) (hb i)
theorem pi_Ico_mem_nhds' (ha : ∀ i, a' i < x' i) (hb : ∀ i, x' i < b' i) : Ico a' b' ∈ 𝓝 x' :=
pi_Ico_mem_nhds ha hb
theorem pi_Ioo_mem_nhds (ha : ∀ i, a i < x i) (hb : ∀ i, x i < b i) : Ioo a b ∈ 𝓝 x := by
refine mem_of_superset (set_pi_mem_nhds Set.finite_univ fun i _ => ?_) (pi_univ_Ioo_subset a b)
exact Ioo_mem_nhds (ha i) (hb i)
theorem pi_Ioo_mem_nhds' (ha : ∀ i, a' i < x' i) (hb : ∀ i, x' i < b' i) : Ioo a' b' ∈ 𝓝 x' :=
pi_Ioo_mem_nhds ha hb
end Pi
end OrderTopology
end LinearOrder
section ConditionallyCompleteLinearOrder
variable {X : Type*} [ConditionallyCompleteLinearOrder X] [TopologicalSpace X] [OrderTopology X]
variable {Y : Type*} [ConditionallyCompleteLinearOrder Y] [TopologicalSpace Y] [OrderTopology Y]
variable [DenselyOrdered X] {f : X → Y} {x : X}
/-- An order-theoretically left-continuous function is topologically left-continuous, assuming
the function is between conditionally complete linear orders with order topologies, and the domain
is densely ordered. -/
lemma LeftOrdContinuous.continuousWithinAt_Iic (hf : LeftOrdContinuous f) :
ContinuousWithinAt f (Iic x) x := by
rw [ContinuousWithinAt, OrderTopology.topology_eq_generate_intervals (α := Y)]
simp_rw [TopologicalSpace.tendsto_nhds_generateFrom_iff, mem_nhdsWithin]
rintro V ⟨z, rfl | rfl⟩ hxz
-- The case `V = Ioi z`.
· obtain ⟨_, ⟨a, hax, rfl⟩, hza⟩ := (lt_isLUB_iff <| hf isLUB_Iio).mp hxz
exact ⟨Ioi a, isOpen_Ioi, hax, fun b hab ↦ hza.trans_le <| hf.mono hab.1.le⟩
-- The case `V = Iio z`.
· exact ⟨univ, isOpen_univ, trivial, fun a ha ↦ (hf.mono ha.2).trans_lt hxz⟩
/-- An order-theoretically right-continuous function is topologically right-continuous, assuming
the function is between conditionally complete linear orders with order topologies, and the domain
is densely ordered. -/
lemma RightOrdContinuous.continuousWithinAt_Ici (hf : RightOrdContinuous f) :
ContinuousWithinAt f (Ici x) x := hf.orderDual.continuousWithinAt_Iic
end ConditionallyCompleteLinearOrder |
.lake/packages/mathlib/Mathlib/Topology/Order/Priestley.lean | import Mathlib.Order.UpperLower.Basic
import Mathlib.Topology.Connected.TotallyDisconnected
/-!
# Priestley spaces
This file defines Priestley spaces. A Priestley space is an ordered compact topological space such
that any two distinct points can be separated by a clopen upper set.
## Main declarations
* `PriestleySpace`: Prop-valued mixin stating the Priestley separation axiom: Any two distinct
points can be separated by a clopen upper set.
## Implementation notes
We do not include compactness in the definition, so a Priestley space is to be declared as follows:
`[Preorder α] [TopologicalSpace α] [CompactSpace α] [PriestleySpace α]`
## References
* [Wikipedia, *Priestley space*](https://en.wikipedia.org/wiki/Priestley_space)
* [Davey, Priestley *Introduction to Lattices and Order*][davey_priestley]
-/
open Set
variable {α : Type*}
/-- A Priestley space is an ordered topological space such that any two distinct points can be
separated by a clopen upper set. Compactness is often assumed, but we do not include it here. -/
class PriestleySpace (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where
priestley {x y : α} : ¬x ≤ y → ∃ U : Set α, IsClopen U ∧ IsUpperSet U ∧ x ∈ U ∧ y ∉ U
variable [TopologicalSpace α]
section Preorder
variable [Preorder α] [PriestleySpace α] {x y : α}
theorem exists_isClopen_upper_of_not_le :
¬x ≤ y → ∃ U : Set α, IsClopen U ∧ IsUpperSet U ∧ x ∈ U ∧ y ∉ U :=
PriestleySpace.priestley
theorem exists_isClopen_lower_of_not_le (h : ¬x ≤ y) :
∃ U : Set α, IsClopen U ∧ IsLowerSet U ∧ x ∉ U ∧ y ∈ U :=
let ⟨U, hU, hU', hx, hy⟩ := exists_isClopen_upper_of_not_le h
⟨Uᶜ, hU.compl, hU'.compl, Classical.not_not.2 hx, hy⟩
end Preorder
section PartialOrder
variable [PartialOrder α] [PriestleySpace α] {x y : α}
theorem exists_isClopen_upper_or_lower_of_ne (h : x ≠ y) :
∃ U : Set α, IsClopen U ∧ (IsUpperSet U ∨ IsLowerSet U) ∧ x ∈ U ∧ y ∉ U := by
obtain h | h := h.not_le_or_not_ge
· exact (exists_isClopen_upper_of_not_le h).imp fun _ ↦ And.imp_right <| And.imp_left Or.inl
· obtain ⟨U, hU, hU', hy, hx⟩ := exists_isClopen_lower_of_not_le h
exact ⟨U, hU, Or.inr hU', hx, hy⟩
-- See note [lower instance priority]
instance (priority := 100) PriestleySpace.toTotallySeparatedSpace : TotallySeparatedSpace α where
isTotallySeparated_univ _ _ _ _ h :=
(exists_isClopen_upper_or_lower_of_ne h).elim fun U ⟨hU, _, hx, hy⟩ =>
⟨U, Uᶜ, hU.isOpen, hU.compl.isOpen, hx, hy,
union_compl_self U ▸ subset_rfl, disjoint_compl_right⟩
end PartialOrder |
.lake/packages/mathlib/Mathlib/Topology/Order/ProjIcc.lean | import Mathlib.Order.Interval.Set.ProjIcc
import Mathlib.Topology.Order.Basic
/-!
# Projection onto a closed interval
In this file we prove that the projection `Set.projIcc f a b h` is a quotient map, and use it
to show that `Set.IccExtend h f` is continuous if and only if `f` is continuous.
-/
open Set Filter Topology
variable {α β γ : Type*} [LinearOrder α] {a b c : α} {h : a ≤ b}
protected theorem Filter.Tendsto.IccExtend (f : γ → Icc a b → β) {la : Filter α} {lb : Filter β}
{lc : Filter γ} (hf : Tendsto ↿f (lc ×ˢ la.map (projIcc a b h)) lb) :
Tendsto (↿(IccExtend h ∘ f)) (lc ×ˢ la) lb :=
hf.comp <| tendsto_id.prodMap tendsto_map
variable [TopologicalSpace α] [OrderTopology α] [TopologicalSpace β] [TopologicalSpace γ]
@[continuity, fun_prop]
theorem continuous_projIcc : Continuous (projIcc a b h) :=
(continuous_const.max <| continuous_const.min continuous_id).subtype_mk _
theorem isQuotientMap_projIcc : IsQuotientMap (projIcc a b h) :=
isQuotientMap_iff.2 ⟨projIcc_surjective h, fun s =>
⟨fun hs => hs.preimage continuous_projIcc, fun hs => ⟨_, hs, by ext; simp⟩⟩⟩
@[simp]
theorem continuous_IccExtend_iff {f : Icc a b → β} : Continuous (IccExtend h f) ↔ Continuous f :=
isQuotientMap_projIcc.continuous_iff.symm
/-- See Note [continuity lemma statement]. -/
@[fun_prop]
protected theorem Continuous.IccExtend {f : γ → Icc a b → β} {g : γ → α} (hf : Continuous ↿f)
(hg : Continuous g) : Continuous fun a => IccExtend h (f a) (g a) :=
show Continuous (↿f ∘ fun x => (x, projIcc a b h (g x)))
from hf.comp <| continuous_id.prodMk <| continuous_projIcc.comp hg
/-- A useful special case of `Continuous.IccExtend`. -/
@[continuity, fun_prop]
protected theorem Continuous.Icc_extend' {f : Icc a b → β} (hf : Continuous f) :
Continuous (IccExtend h f) :=
hf.comp continuous_projIcc
@[fun_prop]
theorem ContinuousAt.IccExtend {x : γ} (f : γ → Icc a b → β) {g : γ → α}
(hf : ContinuousAt ↿f (x, projIcc a b h (g x))) (hg : ContinuousAt g x) :
ContinuousAt (fun a => IccExtend h (f a) (g a)) x :=
show ContinuousAt (↿f ∘ fun x => (x, projIcc a b h (g x))) x from
ContinuousAt.comp hf <| continuousAt_id.prodMk <| continuous_projIcc.continuousAt.comp hg |
.lake/packages/mathlib/Mathlib/Topology/Order/PartialSups.lean | import Mathlib.Topology.Order.Lattice
import Mathlib.Order.PartialSups
/-!
# Continuity of `partialSups`
In this file we prove that `partialSups` of a sequence of continuous functions is continuous
as well as versions for `Filter.Tendsto`, `ContinuousAt`, `ContinuousWithinAt`, and `ContinuousOn`.
-/
open Filter
open scoped Topology
variable {L : Type*} [SemilatticeSup L] [TopologicalSpace L] [ContinuousSup L]
namespace Filter.Tendsto
variable {α : Type*} {l : Filter α} {f : ℕ → α → L} {g : ℕ → L} {n : ℕ}
protected lemma partialSups (hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))) :
Tendsto (partialSups f n) l (𝓝 (partialSups g n)) := by
simp only [partialSups_eq_sup'_range]
refine finset_sup'_nhds _ ?_
simpa [Nat.lt_succ_iff]
protected lemma partialSups_apply (hf : ∀ k ≤ n, Tendsto (f k) l (𝓝 (g k))) :
Tendsto (fun a ↦ partialSups (f · a) n) l (𝓝 (partialSups g n)) := by
simpa only [← Pi.partialSups_apply] using Tendsto.partialSups hf
end Filter.Tendsto
variable {X : Type*} [TopologicalSpace X] {f : ℕ → X → L} {n : ℕ} {s : Set X} {x : X}
protected lemma ContinuousAt.partialSups_apply (hf : ∀ k ≤ n, ContinuousAt (f k) x) :
ContinuousAt (fun a ↦ partialSups (f · a) n) x :=
Tendsto.partialSups_apply hf
protected lemma ContinuousAt.partialSups (hf : ∀ k ≤ n, ContinuousAt (f k) x) :
ContinuousAt (partialSups f n) x := by
simpa only [← Pi.partialSups_apply] using ContinuousAt.partialSups_apply hf
protected lemma ContinuousWithinAt.partialSups_apply (hf : ∀ k ≤ n, ContinuousWithinAt (f k) s x) :
ContinuousWithinAt (fun a ↦ partialSups (f · a) n) s x :=
Tendsto.partialSups_apply hf
protected lemma ContinuousWithinAt.partialSups (hf : ∀ k ≤ n, ContinuousWithinAt (f k) s x) :
ContinuousWithinAt (partialSups f n) s x := by
simpa only [← Pi.partialSups_apply] using ContinuousWithinAt.partialSups_apply hf
protected lemma ContinuousOn.partialSups_apply (hf : ∀ k ≤ n, ContinuousOn (f k) s) :
ContinuousOn (fun a ↦ partialSups (f · a) n) s := fun x hx ↦
ContinuousWithinAt.partialSups_apply fun k hk ↦ hf k hk x hx
protected lemma ContinuousOn.partialSups (hf : ∀ k ≤ n, ContinuousOn (f k) s) :
ContinuousOn (partialSups f n) s := fun x hx ↦
ContinuousWithinAt.partialSups fun k hk ↦ hf k hk x hx
protected lemma Continuous.partialSups_apply (hf : ∀ k ≤ n, Continuous (f k)) :
Continuous (fun a ↦ partialSups (f · a) n) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.partialSups_apply fun k hk ↦
(hf k hk).continuousAt
protected lemma Continuous.partialSups (hf : ∀ k ≤ n, Continuous (f k)) :
Continuous (partialSups f n) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.partialSups fun k hk ↦ (hf k hk).continuousAt |
.lake/packages/mathlib/Mathlib/Topology/Order/IsLUB.lean | import Mathlib.Topology.Order.LeftRightNhds
/-!
# Properties of LUB and GLB in an order topology
-/
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α γ : Type*}
section OrderTopology
variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α]
theorem IsLUB.frequently_mem {a : α} {s : Set α} (ha : IsLUB s a) (hs : s.Nonempty) :
∃ᶠ x in 𝓝[≤] a, x ∈ s := by
rcases hs with ⟨a', ha'⟩
intro h
rcases (ha.1 ha').eq_or_lt with (rfl | ha'a)
· exact h.self_of_nhdsWithin le_rfl ha'
· rcases (mem_nhdsLE_iff_exists_Ioc_subset' ha'a).1 h with ⟨b, hba, hb⟩
rcases ha.exists_between hba with ⟨b', hb's, hb'⟩
exact hb hb' hb's
theorem IsLUB.frequently_nhds_mem {a : α} {s : Set α} (ha : IsLUB s a) (hs : s.Nonempty) :
∃ᶠ x in 𝓝 a, x ∈ s :=
(ha.frequently_mem hs).filter_mono inf_le_left
theorem IsGLB.frequently_mem {a : α} {s : Set α} (ha : IsGLB s a) (hs : s.Nonempty) :
∃ᶠ x in 𝓝[≥] a, x ∈ s :=
IsLUB.frequently_mem (α := αᵒᵈ) ha hs
theorem IsGLB.frequently_nhds_mem {a : α} {s : Set α} (ha : IsGLB s a) (hs : s.Nonempty) :
∃ᶠ x in 𝓝 a, x ∈ s :=
(ha.frequently_mem hs).filter_mono inf_le_left
theorem IsLUB.mem_closure {a : α} {s : Set α} (ha : IsLUB s a) (hs : s.Nonempty) : a ∈ closure s :=
(ha.frequently_nhds_mem hs).mem_closure
theorem IsGLB.mem_closure {a : α} {s : Set α} (ha : IsGLB s a) (hs : s.Nonempty) : a ∈ closure s :=
(ha.frequently_nhds_mem hs).mem_closure
theorem IsLUB.nhdsWithin_neBot {a : α} {s : Set α} (ha : IsLUB s a) (hs : s.Nonempty) :
NeBot (𝓝[s] a) :=
mem_closure_iff_nhdsWithin_neBot.1 (ha.mem_closure hs)
theorem IsGLB.nhdsWithin_neBot {a : α} {s : Set α} (ha : IsGLB s a) (hs : s.Nonempty) :
NeBot (𝓝[s] a) :=
IsLUB.nhdsWithin_neBot (α := αᵒᵈ) ha hs
theorem isLUB_of_mem_nhds {s : Set α} {a : α} {f : Filter α} (hsa : a ∈ upperBounds s) (hsf : s ∈ f)
[NeBot (f ⊓ 𝓝 a)] : IsLUB s a :=
⟨hsa, fun b hb =>
not_lt.1 fun hba =>
have : s ∩ { a | b < a } ∈ f ⊓ 𝓝 a := inter_mem_inf hsf (IsOpen.mem_nhds (isOpen_lt' _) hba)
let ⟨_x, ⟨hxs, hxb⟩⟩ := Filter.nonempty_of_mem this
have : b < b := lt_of_lt_of_le hxb <| hb hxs
lt_irrefl b this⟩
theorem isLUB_of_mem_closure {s : Set α} {a : α} (hsa : a ∈ upperBounds s) (hsf : a ∈ closure s) :
IsLUB s a := by
rw [mem_closure_iff_clusterPt, ClusterPt, inf_comm] at hsf
exact isLUB_of_mem_nhds hsa (mem_principal_self s)
theorem isGLB_of_mem_nhds {s : Set α} {a : α} {f : Filter α} (hsa : a ∈ lowerBounds s) (hsf : s ∈ f)
[NeBot (f ⊓ 𝓝 a)] :
IsGLB s a :=
isLUB_of_mem_nhds (α := αᵒᵈ) hsa hsf
theorem isGLB_of_mem_closure {s : Set α} {a : α} (hsa : a ∈ lowerBounds s) (hsf : a ∈ closure s) :
IsGLB s a :=
isLUB_of_mem_closure (α := αᵒᵈ) hsa hsf
theorem IsLUB.mem_upperBounds_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ]
{f : α → γ} {s : Set α} {a : α} {b : γ} (hf : MonotoneOn f s) (ha : IsLUB s a)
(hb : Tendsto f (𝓝[s] a) (𝓝 b)) : b ∈ upperBounds (f '' s) := by
rintro _ ⟨x, hx, rfl⟩
replace ha := ha.inter_Ici_of_mem hx
haveI := ha.nhdsWithin_neBot ⟨x, hx, le_rfl⟩
refine ge_of_tendsto (hb.mono_left (nhdsWithin_mono a (inter_subset_left (t := Ici x)))) ?_
exact mem_of_superset self_mem_nhdsWithin fun y hy => hf hx hy.1 hy.2
-- For a version of this theorem in which the convergence considered on the domain `α` is as `x : α`
-- tends to infinity, rather than tending to a point `x` in `α`, see `isLUB_of_tendsto_atTop`
theorem IsLUB.isLUB_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ] {f : α → γ}
{s : Set α} {a : α} {b : γ} (hf : MonotoneOn f s) (ha : IsLUB s a) (hs : s.Nonempty)
(hb : Tendsto f (𝓝[s] a) (𝓝 b)) : IsLUB (f '' s) b :=
haveI := ha.nhdsWithin_neBot hs
⟨ha.mem_upperBounds_of_tendsto hf hb, fun _b' hb' =>
le_of_tendsto hb (mem_of_superset self_mem_nhdsWithin fun _ hx => hb' <| mem_image_of_mem _ hx)⟩
theorem IsGLB.mem_lowerBounds_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ]
{f : α → γ} {s : Set α} {a : α} {b : γ} (hf : MonotoneOn f s) (ha : IsGLB s a)
(hb : Tendsto f (𝓝[s] a) (𝓝 b)) : b ∈ lowerBounds (f '' s) :=
IsLUB.mem_upperBounds_of_tendsto (α := αᵒᵈ) (γ := γᵒᵈ) hf.dual ha hb
-- For a version of this theorem in which the convergence considered on the domain `α` is as
-- `x : α` tends to negative infinity, rather than tending to a point `x` in `α`, see
-- `isGLB_of_tendsto_atBot`
theorem IsGLB.isGLB_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ] {f : α → γ}
{s : Set α} {a : α} {b : γ} (hf : MonotoneOn f s) :
IsGLB s a → s.Nonempty → Tendsto f (𝓝[s] a) (𝓝 b) → IsGLB (f '' s) b :=
IsLUB.isLUB_of_tendsto (α := αᵒᵈ) (γ := γᵒᵈ) hf.dual
theorem IsLUB.mem_lowerBounds_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ]
{f : α → γ} {s : Set α} {a : α} {b : γ} (hf : AntitoneOn f s) (ha : IsLUB s a)
(hb : Tendsto f (𝓝[s] a) (𝓝 b)) : b ∈ lowerBounds (f '' s) :=
IsLUB.mem_upperBounds_of_tendsto (γ := γᵒᵈ) hf ha hb
theorem IsLUB.isGLB_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ] {f : α → γ}
{s : Set α} {a : α} {b : γ} (hf : AntitoneOn f s) (ha : IsLUB s a) (hs : s.Nonempty)
(hb : Tendsto f (𝓝[s] a) (𝓝 b)) : IsGLB (f '' s) b :=
IsLUB.isLUB_of_tendsto (γ := γᵒᵈ) hf ha hs hb
theorem IsGLB.mem_upperBounds_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ]
{f : α → γ} {s : Set α} {a : α} {b : γ} (hf : AntitoneOn f s) (ha : IsGLB s a)
(hb : Tendsto f (𝓝[s] a) (𝓝 b)) : b ∈ upperBounds (f '' s) :=
IsGLB.mem_lowerBounds_of_tendsto (γ := γᵒᵈ) hf ha hb
theorem IsGLB.isLUB_of_tendsto [Preorder γ] [TopologicalSpace γ] [OrderClosedTopology γ] {f : α → γ}
{s : Set α} {a : α} {b : γ} (hf : AntitoneOn f s) (ha : IsGLB s a) (hs : s.Nonempty)
(hb : Tendsto f (𝓝[s] a) (𝓝 b)) : IsLUB (f '' s) b :=
IsGLB.isGLB_of_tendsto (γ := γᵒᵈ) hf ha hs hb
theorem IsLUB.mem_of_isClosed {a : α} {s : Set α} (ha : IsLUB s a) (hs : s.Nonempty)
(sc : IsClosed s) : a ∈ s :=
sc.closure_subset <| ha.mem_closure hs
alias IsClosed.isLUB_mem := IsLUB.mem_of_isClosed
theorem IsGLB.mem_of_isClosed {a : α} {s : Set α} (ha : IsGLB s a) (hs : s.Nonempty)
(sc : IsClosed s) : a ∈ s :=
sc.closure_subset <| ha.mem_closure hs
alias IsClosed.isGLB_mem := IsGLB.mem_of_isClosed
theorem isLUB_iff_of_subset_of_subset_closure {α : Type*} [TopologicalSpace α] [Preorder α]
[ClosedIicTopology α] {s t : Set α} (hst : s ⊆ t) (hts : t ⊆ closure s) {x : α} :
IsLUB s x ↔ IsLUB t x :=
isLUB_congr <| (upperBounds_closure (s := s) ▸ upperBounds_mono_set hts).antisymm <|
upperBounds_mono_set hst
theorem isGLB_iff_of_subset_of_subset_closure {α : Type*} [TopologicalSpace α] [Preorder α]
[ClosedIciTopology α] {s t : Set α} (hst : s ⊆ t) (hts : t ⊆ closure s) {x : α} :
IsGLB s x ↔ IsGLB t x :=
isLUB_iff_of_subset_of_subset_closure (α := αᵒᵈ) hst hts
theorem Dense.isLUB_inter_iff {α : Type*} [TopologicalSpace α] [Preorder α] [ClosedIicTopology α]
{s t : Set α} (hs : Dense s) (ht : IsOpen t) {x : α} :
IsLUB (t ∩ s) x ↔ IsLUB t x :=
isLUB_iff_of_subset_of_subset_closure (by simp) <| hs.open_subset_closure_inter ht
theorem Dense.isGLB_inter_iff {α : Type*} [TopologicalSpace α] [Preorder α] [ClosedIciTopology α]
{s t : Set α} (hs : Dense s) (ht : IsOpen t) {x : α} :
IsGLB (t ∩ s) x ↔ IsGLB t x :=
hs.isLUB_inter_iff (α := αᵒᵈ) ht
/-!
### Existence of sequences tending to `sInf` or `sSup` of a given set
-/
theorem IsLUB.exists_seq_strictMono_tendsto_of_notMem {t : Set α} {x : α}
[IsCountablyGenerated (𝓝 x)] (htx : IsLUB t x) (notMem : x ∉ t) (ht : t.Nonempty) :
∃ u : ℕ → α, StrictMono u ∧ (∀ n, u n < x) ∧ Tendsto u atTop (𝓝 x) ∧ ∀ n, u n ∈ t := by
obtain ⟨v, hvx, hvt⟩ := exists_seq_forall_of_frequently (htx.frequently_mem ht)
replace hvx := hvx.mono_right nhdsWithin_le_nhds
have hvx' : ∀ {n}, v n < x := (htx.1 (hvt _)).lt_of_ne (ne_of_mem_of_not_mem (hvt _) notMem)
have : ∀ k, ∀ᶠ l in atTop, v k < v l := fun k => hvx.eventually (lt_mem_nhds hvx')
choose N hN hvN using fun k => ((eventually_gt_atTop k).and (this k)).exists
refine ⟨fun k => v (N^[k] 0), strictMono_nat_of_lt_succ fun _ => ?_, fun _ => hvx',
hvx.comp (strictMono_nat_of_lt_succ fun _ => ?_).tendsto_atTop, fun _ => hvt _⟩
· rw [iterate_succ_apply']; exact hvN _
· rw [iterate_succ_apply']; exact hN _
@[deprecated (since := "2025-05-23")]
alias IsLUB.exists_seq_strictMono_tendsto_of_not_mem :=
IsLUB.exists_seq_strictMono_tendsto_of_notMem
theorem IsLUB.exists_seq_monotone_tendsto {t : Set α} {x : α} [IsCountablyGenerated (𝓝 x)]
(htx : IsLUB t x) (ht : t.Nonempty) :
∃ u : ℕ → α, Monotone u ∧ (∀ n, u n ≤ x) ∧ Tendsto u atTop (𝓝 x) ∧ ∀ n, u n ∈ t := by
by_cases h : x ∈ t
· exact ⟨fun _ => x, monotone_const, fun n => le_rfl, tendsto_const_nhds, fun _ => h⟩
· rcases htx.exists_seq_strictMono_tendsto_of_notMem h ht with ⟨u, hu⟩
exact ⟨u, hu.1.monotone, fun n => (hu.2.1 n).le, hu.2.2⟩
theorem exists_seq_strictMono_tendsto' {α : Type*} [LinearOrder α] [TopologicalSpace α]
[DenselyOrdered α] [OrderTopology α] [FirstCountableTopology α] {x y : α} (hy : y < x) :
∃ u : ℕ → α, StrictMono u ∧ (∀ n, u n ∈ Ioo y x) ∧ Tendsto u atTop (𝓝 x) := by
have hx : x ∉ Ioo y x := fun h => (lt_irrefl x h.2).elim
have ht : Set.Nonempty (Ioo y x) := nonempty_Ioo.2 hy
rcases (isLUB_Ioo hy).exists_seq_strictMono_tendsto_of_notMem hx ht with ⟨u, hu⟩
exact ⟨u, hu.1, hu.2.2.symm⟩
theorem exists_seq_strictMono_tendsto [DenselyOrdered α] [NoMinOrder α] [FirstCountableTopology α]
(x : α) : ∃ u : ℕ → α, StrictMono u ∧ (∀ n, u n < x) ∧ Tendsto u atTop (𝓝 x) := by
obtain ⟨y, hy⟩ : ∃ y, y < x := exists_lt x
rcases exists_seq_strictMono_tendsto' hy with ⟨u, hu_mono, hu_mem, hux⟩
exact ⟨u, hu_mono, fun n => (hu_mem n).2, hux⟩
theorem exists_seq_strictMono_tendsto_nhdsWithin [DenselyOrdered α] [NoMinOrder α]
[FirstCountableTopology α] (x : α) :
∃ u : ℕ → α, StrictMono u ∧ (∀ n, u n < x) ∧ Tendsto u atTop (𝓝[<] x) :=
let ⟨u, hu, hx, h⟩ := exists_seq_strictMono_tendsto x
⟨u, hu, hx, tendsto_nhdsWithin_mono_right (range_subset_iff.2 hx) <| tendsto_nhdsWithin_range.2 h⟩
theorem exists_seq_tendsto_sSup {α : Type*} [ConditionallyCompleteLinearOrder α]
[TopologicalSpace α] [OrderTopology α] [FirstCountableTopology α] {S : Set α} (hS : S.Nonempty)
(hS' : BddAbove S) : ∃ u : ℕ → α, Monotone u ∧ Tendsto u atTop (𝓝 (sSup S)) ∧ ∀ n, u n ∈ S := by
rcases (isLUB_csSup hS hS').exists_seq_monotone_tendsto hS with ⟨u, hu⟩
exact ⟨u, hu.1, hu.2.2⟩
theorem Dense.exists_seq_strictMono_tendsto_of_lt [DenselyOrdered α] [FirstCountableTopology α]
{s : Set α} (hs : Dense s) {x y : α} (hy : y < x) :
∃ u : ℕ → α, StrictMono u ∧ (∀ n, u n ∈ (Ioo y x ∩ s)) ∧ Tendsto u atTop (𝓝 x) := by
have hnonempty : (Ioo y x ∩ s).Nonempty := by
obtain ⟨z, hyz, hzx⟩ := hs.exists_between hy
exact ⟨z, mem_inter hzx hyz⟩
have hx : IsLUB (Ioo y x ∩ s) x := hs.isLUB_inter_iff isOpen_Ioo |>.mpr <| isLUB_Ioo hy
apply hx.exists_seq_strictMono_tendsto_of_notMem (by simp) hnonempty |>.imp
simp_all
theorem Dense.exists_seq_strictMono_tendsto [DenselyOrdered α] [NoMinOrder α]
[FirstCountableTopology α] {s : Set α} (hs : Dense s) (x : α) :
∃ u : ℕ → α, StrictMono u ∧ (∀ n, u n ∈ (Iio x ∩ s)) ∧ Tendsto u atTop (𝓝 x) := by
obtain ⟨y, hy⟩ := exists_lt x
apply hs.exists_seq_strictMono_tendsto_of_lt (exists_lt x).choose_spec |>.imp
simp_all
theorem DenseRange.exists_seq_strictMono_tendsto_of_lt {β : Type*} [LinearOrder β]
[DenselyOrdered α] [FirstCountableTopology α] {f : β → α} {x y : α} (hf : DenseRange f)
(hmono : Monotone f) (hlt : y < x) :
∃ u : ℕ → β, StrictMono u ∧ (∀ n, f (u n) ∈ Ioo y x) ∧ Tendsto (f ∘ u) atTop (𝓝 x) := by
rcases Dense.exists_seq_strictMono_tendsto_of_lt hf hlt with ⟨u, hu, huyxf, hlim⟩
have huyx (n : ℕ) : u n ∈ Ioo y x := (huyxf n).1
have huf (n : ℕ) : u n ∈ range f := (huyxf n).2
choose v hv using huf
obtain rfl : f ∘ v = u := funext hv
exact ⟨v, fun a b hlt ↦ hmono.reflect_lt <| hu hlt, huyx, hlim⟩
theorem DenseRange.exists_seq_strictMono_tendsto {β : Type*} [LinearOrder β] [DenselyOrdered α]
[NoMinOrder α] [FirstCountableTopology α] {f : β → α} (hf : DenseRange f) (hmono : Monotone f)
(x : α) :
∃ u : ℕ → β, StrictMono u ∧ (∀ n, f (u n) ∈ Iio x) ∧ Tendsto (f ∘ u) atTop (𝓝 x) := by
rcases Dense.exists_seq_strictMono_tendsto hf x with ⟨u, hu, huxf, hlim⟩
have hux (n : ℕ) : u n ∈ Iio x := (huxf n).1
have huf (n : ℕ) : u n ∈ range f := (huxf n).2
choose v hv using huf
obtain rfl : f ∘ v = u := funext hv
exact ⟨v, fun a b hlt ↦ hmono.reflect_lt <| hu hlt, hux, hlim⟩
theorem IsGLB.exists_seq_strictAnti_tendsto_of_notMem {t : Set α} {x : α}
[IsCountablyGenerated (𝓝 x)] (htx : IsGLB t x) (notMem : x ∉ t) (ht : t.Nonempty) :
∃ u : ℕ → α, StrictAnti u ∧ (∀ n, x < u n) ∧ Tendsto u atTop (𝓝 x) ∧ ∀ n, u n ∈ t :=
IsLUB.exists_seq_strictMono_tendsto_of_notMem (α := αᵒᵈ) htx notMem ht
@[deprecated (since := "2025-05-23")]
alias IsGLB.exists_seq_strictAnti_tendsto_of_not_mem :=
IsGLB.exists_seq_strictAnti_tendsto_of_notMem
theorem IsGLB.exists_seq_antitone_tendsto {t : Set α} {x : α} [IsCountablyGenerated (𝓝 x)]
(htx : IsGLB t x) (ht : t.Nonempty) :
∃ u : ℕ → α, Antitone u ∧ (∀ n, x ≤ u n) ∧ Tendsto u atTop (𝓝 x) ∧ ∀ n, u n ∈ t :=
IsLUB.exists_seq_monotone_tendsto (α := αᵒᵈ) htx ht
theorem exists_seq_strictAnti_tendsto' [DenselyOrdered α] [FirstCountableTopology α] {x y : α}
(hy : x < y) : ∃ u : ℕ → α, StrictAnti u ∧ (∀ n, u n ∈ Ioo x y) ∧ Tendsto u atTop (𝓝 x) := by
simpa using exists_seq_strictMono_tendsto' (α := αᵒᵈ) (OrderDual.toDual_lt_toDual.2 hy)
theorem exists_seq_strictAnti_tendsto [DenselyOrdered α] [NoMaxOrder α] [FirstCountableTopology α]
(x : α) : ∃ u : ℕ → α, StrictAnti u ∧ (∀ n, x < u n) ∧ Tendsto u atTop (𝓝 x) :=
exists_seq_strictMono_tendsto (α := αᵒᵈ) x
theorem exists_seq_strictAnti_tendsto_nhdsWithin [DenselyOrdered α] [NoMaxOrder α]
[FirstCountableTopology α] (x : α) :
∃ u : ℕ → α, StrictAnti u ∧ (∀ n, x < u n) ∧ Tendsto u atTop (𝓝[>] x) :=
exists_seq_strictMono_tendsto_nhdsWithin (α := αᵒᵈ) _
theorem exists_seq_strictAnti_strictMono_tendsto [DenselyOrdered α] [FirstCountableTopology α]
{x y : α} (h : x < y) :
∃ u v : ℕ → α, StrictAnti u ∧ StrictMono v ∧ (∀ k, u k ∈ Ioo x y) ∧ (∀ l, v l ∈ Ioo x y) ∧
(∀ k l, u k < v l) ∧ Tendsto u atTop (𝓝 x) ∧ Tendsto v atTop (𝓝 y) := by
rcases exists_seq_strictAnti_tendsto' h with ⟨u, hu_anti, hu_mem, hux⟩
rcases exists_seq_strictMono_tendsto' (hu_mem 0).2 with ⟨v, hv_mono, hv_mem, hvy⟩
exact
⟨u, v, hu_anti, hv_mono, hu_mem, fun l => ⟨(hu_mem 0).1.trans (hv_mem l).1, (hv_mem l).2⟩,
fun k l => (hu_anti.antitone (zero_le k)).trans_lt (hv_mem l).1, hux, hvy⟩
theorem exists_seq_tendsto_sInf {α : Type*} [ConditionallyCompleteLinearOrder α]
[TopologicalSpace α] [OrderTopology α] [FirstCountableTopology α] {S : Set α} (hS : S.Nonempty)
(hS' : BddBelow S) : ∃ u : ℕ → α, Antitone u ∧ Tendsto u atTop (𝓝 (sInf S)) ∧ ∀ n, u n ∈ S :=
exists_seq_tendsto_sSup (α := αᵒᵈ) hS hS'
theorem Dense.exists_seq_strictAnti_tendsto_of_lt [DenselyOrdered α] [FirstCountableTopology α]
{s : Set α} (hs : Dense s) {x y : α} (hy : x < y) :
∃ u : ℕ → α, StrictAnti u ∧ (∀ n, u n ∈ (Ioo x y ∩ s)) ∧ Tendsto u atTop (𝓝 x) := by
simpa using hs.exists_seq_strictMono_tendsto_of_lt (α := αᵒᵈ) (OrderDual.toDual_lt_toDual.2 hy)
theorem Dense.exists_seq_strictAnti_tendsto [DenselyOrdered α] [NoMaxOrder α]
[FirstCountableTopology α] {s : Set α} (hs : Dense s) (x : α) :
∃ u : ℕ → α, StrictAnti u ∧ (∀ n, u n ∈ (Ioi x ∩ s)) ∧ Tendsto u atTop (𝓝 x) :=
hs.exists_seq_strictMono_tendsto (α := αᵒᵈ) x
theorem DenseRange.exists_seq_strictAnti_tendsto_of_lt {β : Type*} [LinearOrder β]
[DenselyOrdered α] [FirstCountableTopology α] {f : β → α} {x y : α} (hf : DenseRange f)
(hmono : Monotone f) (hlt : x < y) :
∃ u : ℕ → β, StrictAnti u ∧ (∀ n, f (u n) ∈ Ioo x y) ∧ Tendsto (f ∘ u) atTop (𝓝 x) := by
simpa using hf.exists_seq_strictMono_tendsto_of_lt (α := αᵒᵈ) (β := βᵒᵈ) hmono.dual
(OrderDual.toDual_lt_toDual.2 hlt)
theorem DenseRange.exists_seq_strictAnti_tendsto {β : Type*} [LinearOrder β] [DenselyOrdered α]
[NoMaxOrder α] [FirstCountableTopology α] {f : β → α} (hf : DenseRange f) (hmono : Monotone f)
(x : α) :
∃ u : ℕ → β, StrictAnti u ∧ (∀ n, f (u n) ∈ Ioi x) ∧ Tendsto (f ∘ u) atTop (𝓝 x) :=
hf.exists_seq_strictMono_tendsto (α := αᵒᵈ) (β := βᵒᵈ) hmono.dual x
end OrderTopology |
.lake/packages/mathlib/Mathlib/Topology/Order/IsNormal.lean | import Mathlib.Order.IsNormal
import Mathlib.Topology.Order.IsLUB
/-!
# A normal function is strictly monotone and continuous
We defined the predicate `Order.IsNormal` in terms of `IsLUB`, which avoids having to import
topology in order theory files. This file shows that the predicate is equivalent to the definition
in the literature, being that of a strictly monotonic function, continuous in the order topology.
-/
open Set
namespace Order
variable {α β : Type*}
[LinearOrder α] [WellFoundedLT α] [TopologicalSpace α] [OrderTopology α]
[LinearOrder β] [WellFoundedLT β] [TopologicalSpace β] [OrderTopology β]
attribute [local instance]
WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot in
theorem IsNormal.continuous {f : α → β} (hf : IsNormal f) : Continuous f := by
rw [OrderTopology.continuous_iff]
refine fun b ↦ ⟨?_, ((isLowerSet_Iio b).preimage hf.strictMono.monotone).isOpen⟩
rw [← isClosed_compl_iff, ← Set.preimage_compl, Set.compl_Ioi]
obtain ha | ⟨a, ha⟩ := ((isLowerSet_Iic b).preimage hf.strictMono.monotone).eq_univ_or_Iio
· exact ha ▸ isClosed_univ
· obtain h | h := (f ⁻¹' Iic b).eq_empty_or_nonempty
· exact h ▸ isClosed_empty
· have : Nonempty α := ⟨a⟩
have : Nonempty β := ⟨b⟩
rw [hf.preimage_Iic h (ha ▸ bddAbove_Iio)]
exact isClosed_Iic
/-- A normal function between well-orders is equivalent to a strictly monotone,
continuous function. -/
theorem isNormal_iff_strictMono_and_continuous {f : α → β} :
IsNormal f ↔ StrictMono f ∧ Continuous f where
mp hf := ⟨hf.strictMono, hf.continuous⟩
mpr := by
rintro ⟨hs, hc⟩
refine ⟨hs, fun {a} ha ↦ (isLUB_of_mem_closure ?_ ?_).2⟩
· rintro _ ⟨b, hb, rfl⟩
exact (hs hb).le
· apply image_closure_subset_closure_image hc (mem_image_of_mem ..)
exact ha.isLUB_Iio.mem_closure (Iio_nonempty.2 ha.1)
end Order |
.lake/packages/mathlib/Mathlib/Topology/Order/Filter.lean | import Mathlib.Topology.Filter
import Mathlib.Topology.Order.Basic
/-!
# Topology on filters of a space with order topology
In this file we prove that `𝓝 (f x)` tends to `𝓝 Filter.atTop` provided that `f` tends to
`Filter.atTop`, and similarly for `Filter.atBot`.
-/
open Topology
namespace Filter
variable {α X : Type*} [TopologicalSpace X] [PartialOrder X] [OrderTopology X]
protected theorem tendsto_nhds_atTop [NoMaxOrder X] : Tendsto 𝓝 (atTop : Filter X) (𝓝 atTop) :=
Filter.tendsto_nhds_atTop_iff.2 fun x => (eventually_gt_atTop x).mono fun _ => le_mem_nhds
protected theorem tendsto_nhds_atBot [NoMinOrder X] : Tendsto 𝓝 (atBot : Filter X) (𝓝 atBot) :=
@Filter.tendsto_nhds_atTop Xᵒᵈ _ _ _ _
theorem Tendsto.nhds_atTop [NoMaxOrder X] {f : α → X} {l : Filter α} (h : Tendsto f l atTop) :
Tendsto (𝓝 ∘ f) l (𝓝 atTop) :=
Filter.tendsto_nhds_atTop.comp h
theorem Tendsto.nhds_atBot [NoMinOrder X] {f : α → X} {l : Filter α} (h : Tendsto f l atBot) :
Tendsto (𝓝 ∘ f) l (𝓝 atBot) :=
@Tendsto.nhds_atTop α Xᵒᵈ _ _ _ _ _ _ h
end Filter |
.lake/packages/mathlib/Mathlib/Topology/Order/OrderClosed.lean | import Mathlib.Topology.Order.LeftRight
import Mathlib.Topology.Separation.Hausdorff
/-!
# Order-closed topologies
In this file we introduce 3 typeclass mixins that relate topology and order structures:
- `ClosedIicTopology` says that all the intervals $(-∞, a]$ (formally, `Set.Iic a`)
are closed sets;
- `ClosedIciTopology` says that all the intervals $[a, +∞)$ (formally, `Set.Ici a`)
are closed sets;
- `OrderClosedTopology` says that the set of points `(x, y)` such that `x ≤ y`
is closed in the product topology.
The last predicate implies the first two.
We prove many basic properties of such topologies.
## Main statements
This file contains the proofs of the following facts.
For exact requirements
(`OrderClosedTopology` vs `ClosedIciTopology` vs `ClosedIicTopology,
`Preorder` vs `PartialOrder` vs `LinearOrder` etc)
see their statements.
### Open / closed sets
* `isOpen_lt` : if `f` and `g` are continuous functions, then `{x | f x < g x}` is open;
* `isOpen_Iio`, `isOpen_Ioi`, `isOpen_Ioo` : open intervals are open;
* `isClosed_le` : if `f` and `g` are continuous functions, then `{x | f x ≤ g x}` is closed;
* `isClosed_Iic`, `isClosed_Ici`, `isClosed_Icc` : closed intervals are closed;
* `frontier_le_subset_eq`, `frontier_lt_subset_eq` : frontiers of both `{x | f x ≤ g x}`
and `{x | f x < g x}` are included by `{x | f x = g x}`;
### Convergence and inequalities
* `le_of_tendsto_of_tendsto` : if `f` converges to `a`, `g` converges to `b`, and eventually
`f x ≤ g x`, then `a ≤ b`
* `le_of_tendsto`, `ge_of_tendsto` : if `f` converges to `a` and eventually `f x ≤ b`
(resp., `b ≤ f x`), then `a ≤ b` (resp., `b ≤ a`); we also provide primed versions
that assume the inequalities to hold for all `x`.
### Min, max, `sSup` and `sInf`
* `Continuous.min`, `Continuous.max`: pointwise `min`/`max` of two continuous functions is
continuous.
* `Tendsto.min`, `Tendsto.max` : if `f` tends to `a` and `g` tends to `b`, then their pointwise
`min`/`max` tend to `min a b` and `max a b`, respectively.
-/
open Set Filter
open OrderDual (toDual)
open scoped Topology
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
/-- If `α` is a topological space and a preorder, `ClosedIicTopology α` means that `Iic a` is
closed for all `a : α`. -/
class ClosedIicTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where
/-- For any `a`, the set `(-∞, a]` is closed. -/
isClosed_Iic (a : α) : IsClosed (Iic a)
/-- If `α` is a topological space and a preorder, `ClosedIciTopology α` means that `Ici a` is
closed for all `a : α`. -/
class ClosedIciTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where
/-- For any `a`, the set `[a, +∞)` is closed. -/
isClosed_Ici (a : α) : IsClosed (Ici a)
/-- A topology on a set which is both a topological space and a preorder is _order-closed_ if the
set of points `(x, y)` with `x ≤ y` is closed in the product space. We introduce this as a mixin.
This property is satisfied for the order topology on a linear order, but it can be satisfied more
generally, and suffices to derive many interesting properties relating order and topology. -/
class OrderClosedTopology (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where
/-- The set `{ (x, y) | x ≤ y }` is a closed set. -/
isClosed_le' : IsClosed { p : α × α | p.1 ≤ p.2 }
instance [TopologicalSpace α] [h : FirstCountableTopology α] : FirstCountableTopology αᵒᵈ := h
instance [TopologicalSpace α] [h : SecondCountableTopology α] : SecondCountableTopology αᵒᵈ := h
theorem Dense.orderDual [TopologicalSpace α] {s : Set α} (hs : Dense s) :
Dense (OrderDual.ofDual ⁻¹' s) :=
hs
section General
variable [TopologicalSpace α] [Preorder α] {s : Set α}
protected lemma BddAbove.of_closure : BddAbove (closure s) → BddAbove s :=
BddAbove.mono subset_closure
protected lemma BddBelow.of_closure : BddBelow (closure s) → BddBelow s :=
BddBelow.mono subset_closure
end General
section ClosedIicTopology
section Preorder
variable [TopologicalSpace α] [Preorder α] [ClosedIicTopology α] {f : β → α} {a b : α} {s : Set α}
theorem isClosed_Iic : IsClosed (Iic a) :=
ClosedIicTopology.isClosed_Iic a
instance : ClosedIciTopology αᵒᵈ where
isClosed_Ici _ := isClosed_Iic (α := α)
@[simp]
theorem closure_Iic (a : α) : closure (Iic a) = Iic a :=
isClosed_Iic.closure_eq
theorem le_of_tendsto_of_frequently {x : Filter β} (lim : Tendsto f x (𝓝 a))
(h : ∃ᶠ c in x, f c ≤ b) : a ≤ b :=
isClosed_Iic.mem_of_frequently_of_tendsto h lim
theorem le_of_tendsto {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a))
(h : ∀ᶠ c in x, f c ≤ b) : a ≤ b :=
isClosed_Iic.mem_of_tendsto lim h
theorem le_of_tendsto' {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a))
(h : ∀ c, f c ≤ b) : a ≤ b :=
le_of_tendsto lim (Eventually.of_forall h)
@[simp] lemma upperBounds_closure (s : Set α) : upperBounds (closure s : Set α) = upperBounds s :=
ext fun a ↦ by simp_rw [mem_upperBounds_iff_subset_Iic, isClosed_Iic.closure_subset_iff]
@[simp] lemma bddAbove_closure : BddAbove (closure s) ↔ BddAbove s := by
simp_rw [BddAbove, upperBounds_closure]
protected alias ⟨_, BddAbove.closure⟩ := bddAbove_closure
@[simp]
theorem disjoint_nhds_atBot_iff : Disjoint (𝓝 a) atBot ↔ ¬IsBot a := by
constructor
· intro hd hbot
rw [hbot.atBot_eq, disjoint_principal_right] at hd
exact mem_of_mem_nhds hd le_rfl
· simp only [IsBot, not_forall]
rintro ⟨b, hb⟩
refine disjoint_of_disjoint_of_mem disjoint_compl_left ?_ (Iic_mem_atBot b)
exact isClosed_Iic.isOpen_compl.mem_nhds hb
theorem IsLUB.range_of_tendsto {F : Filter β} [F.NeBot] (hle : ∀ i, f i ≤ a)
(hlim : Tendsto f F (𝓝 a)) : IsLUB (range f) a :=
⟨forall_mem_range.mpr hle, fun _c hc ↦ le_of_tendsto' hlim fun i ↦ hc <| mem_range_self i⟩
end Preorder
section NoBotOrder
variable [Preorder α] [NoBotOrder α] [TopologicalSpace α] [ClosedIicTopology α] {a : α}
{l : Filter β} [NeBot l] {f : β → α}
theorem disjoint_nhds_atBot (a : α) : Disjoint (𝓝 a) atBot := by simp
@[simp]
theorem inf_nhds_atBot (a : α) : 𝓝 a ⊓ atBot = ⊥ := (disjoint_nhds_atBot a).eq_bot
theorem not_tendsto_nhds_of_tendsto_atBot (hf : Tendsto f l atBot) (a : α) : ¬Tendsto f l (𝓝 a) :=
hf.not_tendsto (disjoint_nhds_atBot a).symm
theorem not_tendsto_atBot_of_tendsto_nhds (hf : Tendsto f l (𝓝 a)) : ¬Tendsto f l atBot :=
hf.not_tendsto (disjoint_nhds_atBot a)
end NoBotOrder
theorem iSup_eq_of_forall_le_of_tendsto {ι : Type*} {F : Filter ι} [Filter.NeBot F]
[ConditionallyCompleteLattice α] [TopologicalSpace α] [ClosedIicTopology α]
{a : α} {f : ι → α} (hle : ∀ i, f i ≤ a) (hlim : Filter.Tendsto f F (𝓝 a)) :
⨆ i, f i = a :=
have := F.nonempty_of_neBot
(IsLUB.range_of_tendsto hle hlim).ciSup_eq
theorem iUnion_Iic_eq_Iio_of_lt_of_tendsto {ι : Type*} {F : Filter ι} [F.NeBot]
[ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [ClosedIicTopology α]
{a : α} {f : ι → α} (hlt : ∀ i, f i < a) (hlim : Tendsto f F (𝓝 a)) :
⋃ i : ι, Iic (f i) = Iio a := by
have obs : a ∉ range f := by
rw [mem_range]
rintro ⟨i, rfl⟩
exact (hlt i).false
rw [← biUnion_range, (IsLUB.range_of_tendsto (le_of_lt <| hlt ·) hlim).biUnion_Iic_eq_Iio obs]
section LinearOrder
variable [TopologicalSpace α] [LinearOrder α] [ClosedIicTopology α] [TopologicalSpace β]
{a b c : α} {f : α → β}
theorem isOpen_Ioi : IsOpen (Ioi a) := by
rw [← compl_Iic]
exact isClosed_Iic.isOpen_compl
@[simp]
theorem interior_Ioi : interior (Ioi a) = Ioi a :=
isOpen_Ioi.interior_eq
theorem Ioi_mem_nhds (h : a < b) : Ioi a ∈ 𝓝 b := IsOpen.mem_nhds isOpen_Ioi h
theorem eventually_gt_nhds (hab : b < a) : ∀ᶠ x in 𝓝 a, b < x := Ioi_mem_nhds hab
theorem Ici_mem_nhds (h : a < b) : Ici a ∈ 𝓝 b :=
mem_of_superset (Ioi_mem_nhds h) Ioi_subset_Ici_self
theorem eventually_ge_nhds (hab : b < a) : ∀ᶠ x in 𝓝 a, b ≤ x := Ici_mem_nhds hab
theorem Filter.Tendsto.eventually_const_lt {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v)
(h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u < f a :=
h.eventually <| eventually_gt_nhds hv
theorem Filter.Tendsto.eventually_const_le {l : Filter γ} {f : γ → α} {u v : α} (hv : u < v)
(h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, u ≤ f a :=
h.eventually <| eventually_ge_nhds hv
protected theorem Dense.exists_gt [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) :
∃ y ∈ s, x < y :=
hs.exists_mem_open isOpen_Ioi (exists_gt x)
protected theorem Dense.exists_ge [NoMaxOrder α] {s : Set α} (hs : Dense s) (x : α) :
∃ y ∈ s, x ≤ y :=
(hs.exists_gt x).imp fun _ h ↦ ⟨h.1, h.2.le⟩
theorem Dense.exists_ge' {s : Set α} (hs : Dense s) (htop : ∀ x, IsTop x → x ∈ s) (x : α) :
∃ y ∈ s, x ≤ y := by
by_cases hx : IsTop x
· exact ⟨x, htop x hx, le_rfl⟩
· simp only [IsTop, not_forall, not_le] at hx
rcases hs.exists_mem_open isOpen_Ioi hx with ⟨y, hys, hy : x < y⟩
exact ⟨y, hys, hy.le⟩
/-!
### Left neighborhoods on a `ClosedIicTopology`
Limits to the left of real functions are defined in terms of neighborhoods to the left,
either open or closed, i.e., members of `𝓝[<] a` and `𝓝[≤] a`.
Here we prove that all left-neighborhoods of a point are equal,
and we prove other useful characterizations which require the stronger hypothesis `OrderTopology α`
in another file.
-/
/-!
#### Point excluded
-/
theorem Ioo_mem_nhdsLT (H : a < b) : Ioo a b ∈ 𝓝[<] b := by
simpa only [← Iio_inter_Ioi] using inter_mem_nhdsWithin _ (Ioi_mem_nhds H)
theorem Ioo_mem_nhdsLT_of_mem (H : b ∈ Ioc a c) : Ioo a c ∈ 𝓝[<] b :=
mem_of_superset (Ioo_mem_nhdsLT H.1) <| Ioo_subset_Ioo_right H.2
protected theorem CovBy.nhdsLT (h : a ⋖ b) : 𝓝[<] b = ⊥ :=
empty_mem_iff_bot.mp <| h.Ioo_eq ▸ Ioo_mem_nhdsLT h.1
protected theorem PredOrder.nhdsLT [PredOrder α] : 𝓝[<] a = ⊥ := by
if h : IsMin a then simp [h.Iio_eq]
else exact (Order.pred_covBy_of_not_isMin h).nhdsLT
theorem PredOrder.nhdsGT_eq_nhdsNE [PredOrder α] (a : α) : 𝓝[>] a = 𝓝[≠] a := by
rw [← nhdsLT_sup_nhdsGT, PredOrder.nhdsLT, bot_sup_eq]
theorem PredOrder.nhdsGE_eq_nhds [PredOrder α] (a : α) : 𝓝[≥] a = 𝓝 a := by
rw [← nhdsLT_sup_nhdsGE, PredOrder.nhdsLT, bot_sup_eq]
theorem Ico_mem_nhdsLT_of_mem (H : b ∈ Ioc a c) : Ico a c ∈ 𝓝[<] b :=
mem_of_superset (Ioo_mem_nhdsLT_of_mem H) Ioo_subset_Ico_self
theorem Ico_mem_nhdsLT (H : a < b) : Ico a b ∈ 𝓝[<] b := Ico_mem_nhdsLT_of_mem ⟨H, le_rfl⟩
theorem Ioc_mem_nhdsLT_of_mem (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b :=
mem_of_superset (Ioo_mem_nhdsLT_of_mem H) Ioo_subset_Ioc_self
theorem Ioc_mem_nhdsLT (H : a < b) : Ioc a b ∈ 𝓝[<] b := Ioc_mem_nhdsLT_of_mem ⟨H, le_rfl⟩
theorem Icc_mem_nhdsLT_of_mem (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b :=
mem_of_superset (Ioo_mem_nhdsLT_of_mem H) Ioo_subset_Icc_self
theorem Icc_mem_nhdsLT (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsLT_of_mem ⟨H, le_rfl⟩
@[simp]
theorem nhdsWithin_Ico_eq_nhdsLT (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b :=
nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ici_mem_nhds h
@[simp]
theorem nhdsWithin_Ioo_eq_nhdsLT (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b :=
nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ioi_mem_nhds h
@[simp]
theorem continuousWithinAt_Ico_iff_Iio (h : a < b) :
ContinuousWithinAt f (Ico a b) b ↔ ContinuousWithinAt f (Iio b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsLT h]
@[simp]
theorem continuousWithinAt_Ioo_iff_Iio (h : a < b) :
ContinuousWithinAt f (Ioo a b) b ↔ ContinuousWithinAt f (Iio b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsLT h]
/-!
#### Point included
-/
protected theorem CovBy.nhdsLE (H : a ⋖ b) : 𝓝[≤] b = pure b := by
rw [← Iio_insert, nhdsWithin_insert, H.nhdsLT, sup_bot_eq]
protected theorem PredOrder.nhdsLE [PredOrder α] : 𝓝[≤] b = pure b := by
rw [← Iio_insert, nhdsWithin_insert, PredOrder.nhdsLT, sup_bot_eq]
theorem Ioc_mem_nhdsLE (H : a < b) : Ioc a b ∈ 𝓝[≤] b :=
inter_mem (nhdsWithin_le_nhds <| Ioi_mem_nhds H) self_mem_nhdsWithin
theorem Ioo_mem_nhdsLE_of_mem (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≤] b :=
mem_of_superset (Ioc_mem_nhdsLE H.1) <| Ioc_subset_Ioo_right H.2
theorem Ico_mem_nhdsLE_of_mem (H : b ∈ Ioo a c) : Ico a c ∈ 𝓝[≤] b :=
mem_of_superset (Ioo_mem_nhdsLE_of_mem H) Ioo_subset_Ico_self
theorem Ioc_mem_nhdsLE_of_mem (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[≤] b :=
mem_of_superset (Ioc_mem_nhdsLE H.1) <| Ioc_subset_Ioc_right H.2
theorem Icc_mem_nhdsLE_of_mem (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[≤] b :=
mem_of_superset (Ioc_mem_nhdsLE_of_mem H) Ioc_subset_Icc_self
theorem Icc_mem_nhdsLE (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsLE_of_mem ⟨H, le_rfl⟩
@[simp]
theorem nhdsWithin_Icc_eq_nhdsLE (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b :=
nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ici_mem_nhds h
@[simp]
theorem nhdsWithin_Ioc_eq_nhdsLE (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b :=
nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ioi_mem_nhds h
@[simp]
theorem continuousWithinAt_Icc_iff_Iic (h : a < b) :
ContinuousWithinAt f (Icc a b) b ↔ ContinuousWithinAt f (Iic b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsLE h]
@[simp]
theorem continuousWithinAt_Ioc_iff_Iic (h : a < b) :
ContinuousWithinAt f (Ioc a b) b ↔ ContinuousWithinAt f (Iic b) b := by
simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsLE h]
end LinearOrder
end ClosedIicTopology
section ClosedIciTopology
section Preorder
variable [TopologicalSpace α] [Preorder α] [ClosedIciTopology α] {f : β → α} {a b : α} {s : Set α}
theorem isClosed_Ici {a : α} : IsClosed (Ici a) :=
ClosedIciTopology.isClosed_Ici a
instance : ClosedIicTopology αᵒᵈ where
isClosed_Iic _ := isClosed_Ici (α := α)
@[simp]
theorem closure_Ici (a : α) : closure (Ici a) = Ici a :=
isClosed_Ici.closure_eq
lemma ge_of_tendsto_of_frequently {x : Filter β} (lim : Tendsto f x (𝓝 a))
(h : ∃ᶠ c in x, b ≤ f c) : b ≤ a :=
isClosed_Ici.mem_of_frequently_of_tendsto h lim
theorem ge_of_tendsto {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a))
(h : ∀ᶠ c in x, b ≤ f c) : b ≤ a :=
isClosed_Ici.mem_of_tendsto lim h
theorem ge_of_tendsto' {x : Filter β} [NeBot x] (lim : Tendsto f x (𝓝 a))
(h : ∀ c, b ≤ f c) : b ≤ a :=
ge_of_tendsto lim (Eventually.of_forall h)
@[simp] lemma lowerBounds_closure (s : Set α) : lowerBounds (closure s : Set α) = lowerBounds s :=
ext fun a ↦ by simp_rw [mem_lowerBounds_iff_subset_Ici, isClosed_Ici.closure_subset_iff]
@[simp] lemma bddBelow_closure : BddBelow (closure s) ↔ BddBelow s := by
simp_rw [BddBelow, lowerBounds_closure]
protected alias ⟨_, BddBelow.closure⟩ := bddBelow_closure
@[simp]
theorem disjoint_nhds_atTop_iff : Disjoint (𝓝 a) atTop ↔ ¬IsTop a :=
disjoint_nhds_atBot_iff (α := αᵒᵈ)
theorem IsGLB.range_of_tendsto {F : Filter β} [F.NeBot] (hle : ∀ i, a ≤ f i)
(hlim : Tendsto f F (𝓝 a)) : IsGLB (range f) a :=
IsLUB.range_of_tendsto (α := αᵒᵈ) hle hlim
end Preorder
section NoTopOrder
variable [Preorder α] [NoTopOrder α] [TopologicalSpace α] [ClosedIciTopology α] {a : α}
{l : Filter β} [NeBot l] {f : β → α}
theorem disjoint_nhds_atTop (a : α) : Disjoint (𝓝 a) atTop := disjoint_nhds_atBot (toDual a)
@[simp]
theorem inf_nhds_atTop (a : α) : 𝓝 a ⊓ atTop = ⊥ := (disjoint_nhds_atTop a).eq_bot
theorem not_tendsto_nhds_of_tendsto_atTop (hf : Tendsto f l atTop) (a : α) : ¬Tendsto f l (𝓝 a) :=
hf.not_tendsto (disjoint_nhds_atTop a).symm
theorem not_tendsto_atTop_of_tendsto_nhds (hf : Tendsto f l (𝓝 a)) : ¬Tendsto f l atTop :=
hf.not_tendsto (disjoint_nhds_atTop a)
end NoTopOrder
theorem iInf_eq_of_forall_le_of_tendsto {ι : Type*} {F : Filter ι} [F.NeBot]
[ConditionallyCompleteLattice α] [TopologicalSpace α] [ClosedIciTopology α]
{a : α} {f : ι → α} (hle : ∀ i, a ≤ f i) (hlim : Tendsto f F (𝓝 a)) :
⨅ i, f i = a :=
iSup_eq_of_forall_le_of_tendsto (α := αᵒᵈ) hle hlim
theorem iUnion_Ici_eq_Ioi_of_lt_of_tendsto {ι : Type*} {F : Filter ι} [F.NeBot]
[ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [ClosedIciTopology α]
{a : α} {f : ι → α} (hlt : ∀ i, a < f i) (hlim : Tendsto f F (𝓝 a)) :
⋃ i : ι, Ici (f i) = Ioi a :=
iUnion_Iic_eq_Iio_of_lt_of_tendsto (α := αᵒᵈ) hlt hlim
section LinearOrder
variable [TopologicalSpace α] [LinearOrder α] [ClosedIciTopology α] [TopologicalSpace β]
{a b c : α} {f : α → β}
theorem isOpen_Iio : IsOpen (Iio a) := isOpen_Ioi (α := αᵒᵈ)
@[simp] theorem interior_Iio : interior (Iio a) = Iio a := isOpen_Iio.interior_eq
theorem Iio_mem_nhds (h : a < b) : Iio b ∈ 𝓝 a := isOpen_Iio.mem_nhds h
theorem eventually_lt_nhds (hab : a < b) : ∀ᶠ x in 𝓝 a, x < b := Iio_mem_nhds hab
theorem Iic_mem_nhds (h : a < b) : Iic b ∈ 𝓝 a :=
mem_of_superset (Iio_mem_nhds h) Iio_subset_Iic_self
theorem eventually_le_nhds (hab : a < b) : ∀ᶠ x in 𝓝 a, x ≤ b := Iic_mem_nhds hab
theorem Filter.Tendsto.eventually_lt_const {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u)
(h : Filter.Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a < u :=
h.eventually <| eventually_lt_nhds hv
theorem Filter.Tendsto.eventually_le_const {l : Filter γ} {f : γ → α} {u v : α} (hv : v < u)
(h : Tendsto f l (𝓝 v)) : ∀ᶠ a in l, f a ≤ u :=
h.eventually <| eventually_le_nhds hv
protected theorem Dense.exists_lt [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) :
∃ y ∈ s, y < x :=
hs.orderDual.exists_gt x
protected theorem Dense.exists_le [NoMinOrder α] {s : Set α} (hs : Dense s) (x : α) :
∃ y ∈ s, y ≤ x :=
hs.orderDual.exists_ge x
theorem Dense.exists_le' {s : Set α} (hs : Dense s) (hbot : ∀ x, IsBot x → x ∈ s) (x : α) :
∃ y ∈ s, y ≤ x :=
hs.orderDual.exists_ge' hbot x
/-!
### Right neighborhoods on a `ClosedIciTopology`
Limits to the right of real functions are defined in terms of neighborhoods to the right,
either open or closed, i.e., members of `𝓝[>] a` and `𝓝[≥] a`.
Here we prove that all right-neighborhoods of a point are equal,
and we prove other useful characterizations which require the stronger hypothesis `OrderTopology α`
in another file.
-/
/-!
#### Point excluded
-/
theorem Ioo_mem_nhdsGT_of_mem (H : b ∈ Ico a c) : Ioo a c ∈ 𝓝[>] b :=
mem_nhdsWithin.2
⟨Iio c, isOpen_Iio, H.2, by rw [inter_comm, Ioi_inter_Iio]; exact Ioo_subset_Ioo_left H.1⟩
theorem Ioo_mem_nhdsGT (H : a < b) : Ioo a b ∈ 𝓝[>] a := Ioo_mem_nhdsGT_of_mem ⟨le_rfl, H⟩
protected theorem CovBy.nhdsGT (h : a ⋖ b) : 𝓝[>] a = ⊥ := h.toDual.nhdsLT
protected theorem SuccOrder.nhdsGT [SuccOrder α] : 𝓝[>] a = ⊥ := PredOrder.nhdsLT (α := αᵒᵈ)
theorem SuccOrder.nhdsLT_eq_nhdsNE [SuccOrder α] (a : α) : 𝓝[<] a = 𝓝[≠] a :=
PredOrder.nhdsGT_eq_nhdsNE (α := αᵒᵈ) a
theorem SuccOrder.nhdsLE_eq_nhds [SuccOrder α] (a : α) : 𝓝[≤] a = 𝓝 a :=
PredOrder.nhdsGE_eq_nhds (α := αᵒᵈ) a
theorem Ioc_mem_nhdsGT_of_mem (H : b ∈ Ico a c) : Ioc a c ∈ 𝓝[>] b :=
mem_of_superset (Ioo_mem_nhdsGT_of_mem H) Ioo_subset_Ioc_self
theorem Ioc_mem_nhdsGT (H : a < b) : Ioc a b ∈ 𝓝[>] a := Ioc_mem_nhdsGT_of_mem ⟨le_rfl, H⟩
theorem Ico_mem_nhdsGT_of_mem (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[>] b :=
mem_of_superset (Ioo_mem_nhdsGT_of_mem H) Ioo_subset_Ico_self
theorem Ico_mem_nhdsGT (H : a < b) : Ico a b ∈ 𝓝[>] a := Ico_mem_nhdsGT_of_mem ⟨le_rfl, H⟩
theorem Icc_mem_nhdsGT_of_mem (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[>] b :=
mem_of_superset (Ioo_mem_nhdsGT_of_mem H) Ioo_subset_Icc_self
theorem Icc_mem_nhdsGT (H : a < b) : Icc a b ∈ 𝓝[>] a := Icc_mem_nhdsGT_of_mem ⟨le_rfl, H⟩
@[simp]
theorem nhdsWithin_Ioc_eq_nhdsGT (h : a < b) : 𝓝[Ioc a b] a = 𝓝[>] a :=
nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h
@[simp]
theorem nhdsWithin_Ioo_eq_nhdsGT (h : a < b) : 𝓝[Ioo a b] a = 𝓝[>] a :=
nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h
@[simp]
theorem continuousWithinAt_Ioc_iff_Ioi (h : a < b) :
ContinuousWithinAt f (Ioc a b) a ↔ ContinuousWithinAt f (Ioi a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Ioc_eq_nhdsGT h]
@[simp]
theorem continuousWithinAt_Ioo_iff_Ioi (h : a < b) :
ContinuousWithinAt f (Ioo a b) a ↔ ContinuousWithinAt f (Ioi a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Ioo_eq_nhdsGT h]
/-!
### Point included
-/
protected theorem CovBy.nhdsGE (H : a ⋖ b) : 𝓝[≥] a = pure a := H.toDual.nhdsLE
protected theorem SuccOrder.nhdsGE [SuccOrder α] : 𝓝[≥] a = pure a :=
PredOrder.nhdsLE (α := αᵒᵈ)
theorem Ico_mem_nhdsGE (H : a < b) : Ico a b ∈ 𝓝[≥] a :=
inter_mem_nhdsWithin _ <| Iio_mem_nhds H
theorem Ico_mem_nhdsGE_of_mem (H : b ∈ Ico a c) : Ico a c ∈ 𝓝[≥] b :=
mem_of_superset (Ico_mem_nhdsGE H.2) <| Ico_subset_Ico_left H.1
theorem Ioo_mem_nhdsGE_of_mem (H : b ∈ Ioo a c) : Ioo a c ∈ 𝓝[≥] b :=
mem_of_superset (Ico_mem_nhdsGE H.2) <| Ico_subset_Ioo_left H.1
theorem Ioc_mem_nhdsGE_of_mem (H : b ∈ Ioo a c) : Ioc a c ∈ 𝓝[≥] b :=
mem_of_superset (Ioo_mem_nhdsGE_of_mem H) Ioo_subset_Ioc_self
theorem Icc_mem_nhdsGE_of_mem (H : b ∈ Ico a c) : Icc a c ∈ 𝓝[≥] b :=
mem_of_superset (Ico_mem_nhdsGE_of_mem H) Ico_subset_Icc_self
theorem Icc_mem_nhdsGE (H : a < b) : Icc a b ∈ 𝓝[≥] a := Icc_mem_nhdsGE_of_mem ⟨le_rfl, H⟩
@[simp]
theorem nhdsWithin_Icc_eq_nhdsGE (h : a < b) : 𝓝[Icc a b] a = 𝓝[≥] a :=
nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iic_mem_nhds h
@[simp]
theorem nhdsWithin_Ico_eq_nhdsGE (h : a < b) : 𝓝[Ico a b] a = 𝓝[≥] a :=
nhdsWithin_inter_of_mem' <| nhdsWithin_le_nhds <| Iio_mem_nhds h
@[simp]
theorem continuousWithinAt_Icc_iff_Ici (h : a < b) :
ContinuousWithinAt f (Icc a b) a ↔ ContinuousWithinAt f (Ici a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsGE h]
@[simp]
theorem continuousWithinAt_Ico_iff_Ici (h : a < b) :
ContinuousWithinAt f (Ico a b) a ↔ ContinuousWithinAt f (Ici a) a := by
simp only [ContinuousWithinAt, nhdsWithin_Ico_eq_nhdsGE h]
end LinearOrder
end ClosedIciTopology
section OrderClosedTopology
section Preorder
variable [TopologicalSpace α] [Preorder α] [t : OrderClosedTopology α]
namespace Subtype
-- todo: add `OrderEmbedding.orderClosedTopology`
instance {p : α → Prop} : OrderClosedTopology (Subtype p) :=
have this : Continuous fun p : Subtype p × Subtype p => ((p.fst : α), (p.snd : α)) :=
continuous_subtype_val.prodMap continuous_subtype_val
OrderClosedTopology.mk (t.isClosed_le'.preimage this)
end Subtype
theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 } :=
t.isClosed_le'
theorem isClosed_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) :
IsClosed { b | f b ≤ g b } :=
continuous_iff_isClosed.mp (hf.prodMk hg) _ isClosed_le_prod
instance : ClosedIicTopology α where
isClosed_Iic _ := isClosed_le continuous_id continuous_const
instance : ClosedIciTopology α where
isClosed_Ici _ := isClosed_le continuous_const continuous_id
instance : OrderClosedTopology αᵒᵈ :=
⟨(OrderClosedTopology.isClosed_le' (α := α)).preimage continuous_swap⟩
theorem isClosed_Icc {a b : α} : IsClosed (Icc a b) :=
IsClosed.inter isClosed_Ici isClosed_Iic
@[simp]
theorem closure_Icc (a b : α) : closure (Icc a b) = Icc a b :=
isClosed_Icc.closure_eq
theorem le_of_tendsto_of_tendsto_of_frequently {f g : β → α} {b : Filter β} {a₁ a₂ : α}
(hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∃ᶠ x in b, f x ≤ g x) : a₁ ≤ a₂ :=
t.isClosed_le'.mem_of_frequently_of_tendsto h (hf.prodMk_nhds hg)
theorem le_of_tendsto_of_tendsto {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b]
(hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : f ≤ᶠ[b] g) : a₁ ≤ a₂ :=
le_of_tendsto_of_tendsto_of_frequently hf hg <| Eventually.frequently h
alias tendsto_le_of_eventuallyLE := le_of_tendsto_of_tendsto
theorem le_of_tendsto_of_tendsto' {f g : β → α} {b : Filter β} {a₁ a₂ : α} [NeBot b]
(hf : Tendsto f b (𝓝 a₁)) (hg : Tendsto g b (𝓝 a₂)) (h : ∀ x, f x ≤ g x) : a₁ ≤ a₂ :=
le_of_tendsto_of_tendsto hf hg (Eventually.of_forall h)
@[simp]
theorem closure_le_eq [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) :
closure { b | f b ≤ g b } = { b | f b ≤ g b } :=
(isClosed_le hf hg).closure_eq
theorem closure_lt_subset_le [TopologicalSpace β] {f g : β → α} (hf : Continuous f)
(hg : Continuous g) : closure { b | f b < g b } ⊆ { b | f b ≤ g b } :=
(closure_minimal fun _ => le_of_lt) <| isClosed_le hf hg
theorem ContinuousWithinAt.closure_le [TopologicalSpace β] {f g : β → α} {s : Set β} {x : β}
(hx : x ∈ closure s) (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x)
(h : ∀ y ∈ s, f y ≤ g y) : f x ≤ g x :=
show (f x, g x) ∈ { p : α × α | p.1 ≤ p.2 } from
OrderClosedTopology.isClosed_le'.closure_subset ((hf.prodMk hg).mem_closure hx h)
/-- If `s` is a closed set and two functions `f` and `g` are continuous on `s`,
then the set `{x ∈ s | f x ≤ g x}` is a closed set. -/
theorem IsClosed.isClosed_le [TopologicalSpace β] {f g : β → α} {s : Set β} (hs : IsClosed s)
(hf : ContinuousOn f s) (hg : ContinuousOn g s) : IsClosed ({ x ∈ s | f x ≤ g x }) :=
(hf.prodMk hg).preimage_isClosed_of_isClosed hs OrderClosedTopology.isClosed_le'
theorem le_on_closure [TopologicalSpace β] {f g : β → α} {s : Set β} (h : ∀ x ∈ s, f x ≤ g x)
(hf : ContinuousOn f (closure s)) (hg : ContinuousOn g (closure s)) ⦃x⦄ (hx : x ∈ closure s) :
f x ≤ g x :=
have : s ⊆ { y ∈ closure s | f y ≤ g y } := fun y hy => ⟨subset_closure hy, h y hy⟩
(closure_minimal this (isClosed_closure.isClosed_le hf hg) hx).2
theorem IsClosed.epigraph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s)
(hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ f p.1 ≤ p.2 } :=
(hs.preimage continuous_fst).isClosed_le (hf.comp continuousOn_fst Subset.rfl) continuousOn_snd
theorem IsClosed.hypograph [TopologicalSpace β] {f : β → α} {s : Set β} (hs : IsClosed s)
(hf : ContinuousOn f s) : IsClosed { p : β × α | p.1 ∈ s ∧ p.2 ≤ f p.1 } :=
(hs.preimage continuous_fst).isClosed_le continuousOn_snd (hf.comp continuousOn_fst Subset.rfl)
/-- The set of monotone functions on a set is closed. -/
theorem isClosed_monotoneOn [Preorder β] {s : Set β} : IsClosed {f : β → α | MonotoneOn f s} := by
simp only [isClosed_iff_clusterPt, clusterPt_principal_iff_frequently]
intro g hg a ha b hb hab
have hmain (x) : Tendsto (fun f' ↦ f' x) (𝓝 g) (𝓝 (g x)) := continuousAt_apply x _
exact le_of_tendsto_of_tendsto_of_frequently (hmain a) (hmain b) (hg.mono fun g h ↦ h ha hb hab)
/-- The set of monotone functions is closed. -/
theorem isClosed_monotone [Preorder β] : IsClosed {f : β → α | Monotone f} := by
simp_rw [← monotoneOn_univ]
exact isClosed_monotoneOn
/-- The set of antitone functions on a set is closed. -/
theorem isClosed_antitoneOn [Preorder β] {s : Set β} : IsClosed {f : β → α | AntitoneOn f s} :=
isClosed_monotoneOn (α := αᵒᵈ) (β := β)
/-- The set of antitone functions is closed. -/
theorem isClosed_antitone [Preorder β] : IsClosed {f : β → α | Antitone f} :=
isClosed_monotone (α := αᵒᵈ) (β := β)
end Preorder
section PartialOrder
variable [TopologicalSpace α] [PartialOrder α] [t : OrderClosedTopology α]
-- see Note [lower instance priority]
instance (priority := 90) OrderClosedTopology.to_t2Space : T2Space α :=
t2_iff_isClosed_diagonal.2 <| by
simpa only [diagonal, le_antisymm_iff] using
t.isClosed_le'.inter (isClosed_le continuous_snd continuous_fst)
end PartialOrder
section LinearOrder
variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α]
theorem isOpen_lt [TopologicalSpace β] {f g : β → α} (hf : Continuous f) (hg : Continuous g) :
IsOpen { b | f b < g b } := by
simpa only [lt_iff_not_ge] using (isClosed_le hg hf).isOpen_compl
theorem isOpen_lt_prod : IsOpen { p : α × α | p.1 < p.2 } :=
isOpen_lt continuous_fst continuous_snd
variable {a b : α}
theorem isOpen_Ioo : IsOpen (Ioo a b) :=
IsOpen.inter isOpen_Ioi isOpen_Iio
@[simp]
theorem interior_Ioo : interior (Ioo a b) = Ioo a b :=
isOpen_Ioo.interior_eq
theorem Ioo_subset_closure_interior : Ioo a b ⊆ closure (interior (Ioo a b)) := by
simp only [interior_Ioo, subset_closure]
theorem Ioo_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioo a b ∈ 𝓝 x :=
IsOpen.mem_nhds isOpen_Ioo ⟨ha, hb⟩
theorem Ioc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ioc a b ∈ 𝓝 x :=
mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ioc_self
theorem Ico_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Ico a b ∈ 𝓝 x :=
mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Ico_self
theorem Icc_mem_nhds {a b x : α} (ha : a < x) (hb : x < b) : Icc a b ∈ 𝓝 x :=
mem_of_superset (Ioo_mem_nhds ha hb) Ioo_subset_Icc_self
/-- The only order closed topology on a linear order which is a `PredOrder` and a `SuccOrder`
is the discrete topology.
This theorem is not an instance,
because it causes searches for `PredOrder` and `SuccOrder` with their `Preorder` arguments
and very rarely matches. -/
theorem DiscreteTopology.of_predOrder_succOrder [PredOrder α] [SuccOrder α] :
DiscreteTopology α := by
refine discreteTopology_iff_nhds.mpr fun a ↦ ?_
rw [← nhdsWithin_univ, ← Iic_union_Ioi, nhdsWithin_union, PredOrder.nhdsLE, SuccOrder.nhdsGT,
sup_bot_eq]
end LinearOrder
section LinearOrder
variable [TopologicalSpace α] [LinearOrder α] [OrderClosedTopology α] {f g : β → α}
section
variable [TopologicalSpace β]
theorem lt_subset_interior_le (hf : Continuous f) (hg : Continuous g) :
{ b | f b < g b } ⊆ interior { b | f b ≤ g b } :=
(interior_maximal fun _ => le_of_lt) <| isOpen_lt hf hg
theorem frontier_le_subset_eq (hf : Continuous f) (hg : Continuous g) :
frontier { b | f b ≤ g b } ⊆ { b | f b = g b } := by
rw [frontier_eq_closure_inter_closure, closure_le_eq hf hg]
rintro b ⟨hb₁, hb₂⟩
refine le_antisymm hb₁ (closure_lt_subset_le hg hf ?_)
convert hb₂ using 2; simp only [not_le.symm]; rfl
theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} :=
frontier_le_subset_eq (@continuous_id α _) continuous_const
theorem frontier_Ici_subset (a : α) : frontier (Ici a) ⊆ {a} :=
frontier_Iic_subset (α := αᵒᵈ) _
theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) :
frontier { b | f b < g b } ⊆ { b | f b = g b } := by
simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf
theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ}
(hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x })
(hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) :
Continuous fun x => if f x ≤ g x then f' x else g' x := by
refine continuous_if (fun a ha => hfg _ (frontier_le_subset_eq hf hg ha)) ?_ (hg'.mono ?_)
· rwa [(isClosed_le hf hg).closure_eq]
· simp only [not_le]
exact closure_lt_subset_le hg hf
theorem Continuous.if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ}
(hf' : Continuous f') (hg' : Continuous g') (hf : Continuous f) (hg : Continuous g)
(hfg : ∀ x, f x = g x → f' x = g' x) : Continuous fun x => if f x ≤ g x then f' x else g' x :=
continuous_if_le hf hg hf'.continuousOn hg'.continuousOn hfg
theorem Filter.Tendsto.eventually_lt {l : Filter γ} {f g : γ → α} {y z : α} (hf : Tendsto f l (𝓝 y))
(hg : Tendsto g l (𝓝 z)) (hyz : y < z) : ∀ᶠ x in l, f x < g x :=
let ⟨_a, ha, _b, hb, h⟩ := hyz.exists_disjoint_Iio_Ioi
(hg.eventually (Ioi_mem_nhds hb)).mp <| (hf.eventually (Iio_mem_nhds ha)).mono fun _ h₁ h₂ =>
h _ h₁ _ h₂
nonrec theorem ContinuousAt.eventually_lt {x₀ : β} (hf : ContinuousAt f x₀) (hg : ContinuousAt g x₀)
(hfg : f x₀ < g x₀) : ∀ᶠ x in 𝓝 x₀, f x < g x :=
hf.eventually_lt hg hfg
@[continuity, fun_prop]
protected theorem Continuous.min (hf : Continuous f) (hg : Continuous g) :
Continuous fun b => min (f b) (g b) := by
simp only [min_def]
exact hf.if_le hg hf hg fun x => id
@[continuity, fun_prop]
protected theorem Continuous.max (hf : Continuous f) (hg : Continuous g) :
Continuous fun b => max (f b) (g b) :=
Continuous.min (α := αᵒᵈ) hf hg
end
theorem continuous_min : Continuous fun p : α × α => min p.1 p.2 :=
continuous_fst.min continuous_snd
theorem continuous_max : Continuous fun p : α × α => max p.1 p.2 :=
continuous_fst.max continuous_snd
protected theorem Filter.Tendsto.max {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁))
(hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => max (f b) (g b)) b (𝓝 (max a₁ a₂)) :=
(continuous_max.tendsto (a₁, a₂)).comp (hf.prodMk_nhds hg)
protected theorem Filter.Tendsto.min {b : Filter β} {a₁ a₂ : α} (hf : Tendsto f b (𝓝 a₁))
(hg : Tendsto g b (𝓝 a₂)) : Tendsto (fun b => min (f b) (g b)) b (𝓝 (min a₁ a₂)) :=
(continuous_min.tendsto (a₁, a₂)).comp (hf.prodMk_nhds hg)
protected theorem Filter.Tendsto.max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) :
Tendsto (fun i => max a (f i)) l (𝓝 a) := by
simpa only [sup_idem] using (tendsto_const_nhds (x := a)).max h
protected theorem Filter.Tendsto.max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) :
Tendsto (fun i => max (f i) a) l (𝓝 a) := by
simp_rw [max_comm _ a]
exact h.max_right
theorem Filter.tendsto_nhds_max_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) :
Tendsto (fun i => max a (f i)) l (𝓝[>] a) := by
obtain ⟨h₁ : Tendsto f l (𝓝 a), h₂ : ∀ᶠ i in l, f i ∈ Ioi a⟩ := tendsto_nhdsWithin_iff.mp h
exact tendsto_nhdsWithin_iff.mpr ⟨h₁.max_right, h₂.mono fun i hi => lt_max_of_lt_right hi⟩
theorem Filter.tendsto_nhds_max_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[>] a)) :
Tendsto (fun i => max (f i) a) l (𝓝[>] a) := by
simp_rw [max_comm _ a]
exact Filter.tendsto_nhds_max_right h
theorem Filter.Tendsto.min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) :
Tendsto (fun i => min a (f i)) l (𝓝 a) :=
Filter.Tendsto.max_right (α := αᵒᵈ) h
theorem Filter.Tendsto.min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝 a)) :
Tendsto (fun i => min (f i) a) l (𝓝 a) :=
Filter.Tendsto.max_left (α := αᵒᵈ) h
theorem Filter.tendsto_nhds_min_right {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) :
Tendsto (fun i => min a (f i)) l (𝓝[<] a) :=
Filter.tendsto_nhds_max_right (α := αᵒᵈ) h
theorem Filter.tendsto_nhds_min_left {l : Filter β} {a : α} (h : Tendsto f l (𝓝[<] a)) :
Tendsto (fun i => min (f i) a) l (𝓝[<] a) :=
Filter.tendsto_nhds_max_left (α := αᵒᵈ) h
theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) :
∃ z ∈ s, z ∈ Ioo x y :=
hs.exists_mem_open isOpen_Ioo (nonempty_Ioo.2 h)
theorem Dense.Ioi_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) :
Ioi x = ⋃ y ∈ s ∩ Ioi x, Ioi y := by
refine Subset.antisymm (fun z hz ↦ ?_) (iUnion₂_subset fun y hy ↦ Ioi_subset_Ioi (le_of_lt hy.2))
rcases hs.exists_between hz with ⟨y, hys, hxy, hyz⟩
exact mem_iUnion₂.2 ⟨y, ⟨hys, hxy⟩, hyz⟩
theorem Dense.Iio_eq_biUnion [DenselyOrdered α] {s : Set α} (hs : Dense s) (x : α) :
Iio x = ⋃ y ∈ s ∩ Iio x, Iio y :=
Dense.Ioi_eq_biUnion (α := αᵒᵈ) hs x
end LinearOrder
end OrderClosedTopology
instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder β] [TopologicalSpace β]
[OrderClosedTopology β] : OrderClosedTopology (α × β) :=
⟨(isClosed_le continuous_fst.fst continuous_snd.fst).inter
(isClosed_le continuous_fst.snd continuous_snd.snd)⟩
instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)]
[∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by
constructor
simp only [Pi.le_def, setOf_forall]
exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd'
instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] :
OrderClosedTopology (α → β) :=
inferInstance |
.lake/packages/mathlib/Mathlib/Topology/Order/LeftRight.lean | import Mathlib.Order.Antichain
import Mathlib.Topology.ContinuousOn
/-!
# Left and right continuity
In this file we prove a few lemmas about left and right continuous functions:
* `continuousWithinAt_Ioi_iff_Ici`: two definitions of right continuity
(with `(a, ∞)` and with `[a, ∞)`) are equivalent;
* `continuousWithinAt_Iio_iff_Iic`: two definitions of left continuity
(with `(-∞, a)` and with `(-∞, a]`) are equivalent;
* `continuousAt_iff_continuous_left_right`, `continuousAt_iff_continuous_left'_right'` :
a function is continuous at `a` if and only if it is left and right continuous at `a`.
## Tags
left continuous, right continuous
-/
open Set Filter Topology
section Preorder
variable {α : Type*} [TopologicalSpace α] [Preorder α]
lemma frequently_lt_nhds (a : α) [NeBot (𝓝[<] a)] : ∃ᶠ x in 𝓝 a, x < a :=
frequently_iff_neBot.2 ‹_›
lemma frequently_gt_nhds (a : α) [NeBot (𝓝[>] a)] : ∃ᶠ x in 𝓝 a, a < x :=
frequently_iff_neBot.2 ‹_›
theorem Filter.Eventually.exists_lt {a : α} [NeBot (𝓝[<] a)] {p : α → Prop}
(h : ∀ᶠ x in 𝓝 a, p x) : ∃ b < a, p b :=
((frequently_lt_nhds a).and_eventually h).exists
theorem Filter.Eventually.exists_gt {a : α} [NeBot (𝓝[>] a)] {p : α → Prop}
(h : ∀ᶠ x in 𝓝 a, p x) : ∃ b > a, p b :=
((frequently_gt_nhds a).and_eventually h).exists
theorem nhdsWithin_Ici_neBot {a b : α} (H₂ : a ≤ b) : NeBot (𝓝[Ici a] b) :=
nhdsWithin_neBot_of_mem H₂
instance nhdsGE_neBot (a : α) : NeBot (𝓝[≥] a) := nhdsWithin_Ici_neBot (le_refl a)
theorem nhdsWithin_Iic_neBot {a b : α} (H : a ≤ b) : NeBot (𝓝[Iic b] a) :=
nhdsWithin_neBot_of_mem H
instance nhdsLE_neBot (a : α) : NeBot (𝓝[≤] a) := nhdsWithin_Iic_neBot (le_refl a)
theorem nhdsLT_le_nhdsNE (a : α) : 𝓝[<] a ≤ 𝓝[≠] a :=
nhdsWithin_mono a fun _ => ne_of_lt
theorem nhdsGT_le_nhdsNE (a : α) : 𝓝[>] a ≤ 𝓝[≠] a := nhdsWithin_mono a fun _ => ne_of_gt
-- TODO: add instances for `NeBot (𝓝[<] x)` on (indexed) product types
lemma IsAntichain.interior_eq_empty [∀ x : α, (𝓝[<] x).NeBot] {s : Set α}
(hs : IsAntichain (· ≤ ·) s) : interior s = ∅ := by
refine eq_empty_of_forall_notMem fun x hx ↦ ?_
have : ∀ᶠ y in 𝓝 x, y ∈ s := mem_interior_iff_mem_nhds.1 hx
rcases this.exists_lt with ⟨y, hyx, hys⟩
exact hs hys (interior_subset hx) hyx.ne hyx.le
lemma IsAntichain.interior_eq_empty' [∀ x : α, (𝓝[>] x).NeBot] {s : Set α}
(hs : IsAntichain (· ≤ ·) s) : interior s = ∅ :=
have : ∀ x : αᵒᵈ, NeBot (𝓝[<] x) := ‹_›
hs.to_dual.interior_eq_empty
end Preorder
section PartialOrder
variable {α β : Type*} [TopologicalSpace α] [PartialOrder α] [TopologicalSpace β]
theorem continuousWithinAt_Ioi_iff_Ici {a : α} {f : α → β} :
ContinuousWithinAt f (Ioi a) a ↔ ContinuousWithinAt f (Ici a) a := by
simp only [← Ici_diff_left, continuousWithinAt_diff_self]
theorem continuousWithinAt_Iio_iff_Iic {a : α} {f : α → β} :
ContinuousWithinAt f (Iio a) a ↔ ContinuousWithinAt f (Iic a) a :=
continuousWithinAt_Ioi_iff_Ici (α := αᵒᵈ)
theorem continuousWithinAt_inter_Ioi_iff_Ici {a : α} {f : α → β} {s : Set α} :
ContinuousWithinAt f (s ∩ Ioi a) a ↔ ContinuousWithinAt f (s ∩ Ici a) a := by
simp [← Ici_diff_left, ← inter_diff_assoc, continuousWithinAt_diff_self]
theorem continuousWithinAt_inter_Iio_iff_Iic {a : α} {f : α → β} {s : Set α} :
ContinuousWithinAt f (s ∩ Iio a) a ↔ ContinuousWithinAt f (s ∩ Iic a) a :=
continuousWithinAt_inter_Ioi_iff_Ici (α := αᵒᵈ)
end PartialOrder
section TopologicalSpace
variable {α β : Type*} [TopologicalSpace α] [LinearOrder α] [TopologicalSpace β] {s : Set α}
theorem nhdsLE_sup_nhdsGE (a : α) : 𝓝[≤] a ⊔ 𝓝[≥] a = 𝓝 a := by
rw [← nhdsWithin_union, Iic_union_Ici, nhdsWithin_univ]
theorem nhdsWithinLE_sup_nhdsWithinGE (a : α) : 𝓝[s ∩ Iic a] a ⊔ 𝓝[s ∩ Ici a] a = 𝓝[s] a := by
rw [← nhdsWithin_union, ← inter_union_distrib_left, Iic_union_Ici, inter_univ]
theorem nhdsLT_sup_nhdsGE (a : α) : 𝓝[<] a ⊔ 𝓝[≥] a = 𝓝 a := by
rw [← nhdsWithin_union, Iio_union_Ici, nhdsWithin_univ]
theorem nhdsWithinLT_sup_nhdsWithinGE (a : α) : 𝓝[s ∩ Iio a] a ⊔ 𝓝[s ∩ Ici a] a = 𝓝[s] a := by
rw [← nhdsWithin_union, ← inter_union_distrib_left, Iio_union_Ici, inter_univ]
theorem nhdsLE_sup_nhdsGT (a : α) : 𝓝[≤] a ⊔ 𝓝[>] a = 𝓝 a := by
rw [← nhdsWithin_union, Iic_union_Ioi, nhdsWithin_univ]
theorem nhdsWithinLE_sup_nhdsWithinGT (a : α) : 𝓝[s ∩ Iic a] a ⊔ 𝓝[s ∩ Ioi a] a = 𝓝[s] a := by
rw [← nhdsWithin_union, ← inter_union_distrib_left, Iic_union_Ioi, inter_univ]
theorem nhdsLT_sup_nhdsGT (a : α) : 𝓝[<] a ⊔ 𝓝[>] a = 𝓝[≠] a := by
rw [← nhdsWithin_union, Iio_union_Ioi]
theorem nhdsWithinLT_sup_nhdsWithinGT (a : α) :
𝓝[s ∩ Iio a] a ⊔ 𝓝[s ∩ Ioi a] a = 𝓝[s \ {a}] a := by
rw [← nhdsWithin_union, ← inter_union_distrib_left, Iio_union_Ioi, compl_eq_univ_diff,
inter_sdiff_left_comm, univ_inter]
lemma nhdsGT_sup_nhdsWithin_singleton (a : α) :
𝓝[>] a ⊔ 𝓝[{a}] a = 𝓝[≥] a := by
simp only [union_singleton, Ioi_insert, ← nhdsWithin_union]
@[deprecated (since := "2025-06-15")]
alias nhdsWithin_right_sup_nhds_singleton := nhdsGT_sup_nhdsWithin_singleton
theorem continuousAt_iff_continuous_left_right {a : α} {f : α → β} :
ContinuousAt f a ↔ ContinuousWithinAt f (Iic a) a ∧ ContinuousWithinAt f (Ici a) a := by
simp only [ContinuousWithinAt, ContinuousAt, ← tendsto_sup, nhdsLE_sup_nhdsGE]
theorem continuousAt_iff_continuous_left'_right' {a : α} {f : α → β} :
ContinuousAt f a ↔ ContinuousWithinAt f (Iio a) a ∧ ContinuousWithinAt f (Ioi a) a := by
rw [continuousWithinAt_Ioi_iff_Ici, continuousWithinAt_Iio_iff_Iic,
continuousAt_iff_continuous_left_right]
theorem continuousWithinAt_iff_continuous_left_right {a : α} {f : α → β} :
ContinuousWithinAt f s a ↔
ContinuousWithinAt f (s ∩ Iic a) a ∧ ContinuousWithinAt f (s ∩ Ici a) a := by
simp only [ContinuousWithinAt, ← tendsto_sup, nhdsWithinLE_sup_nhdsWithinGE]
theorem continuousWithinAt_iff_continuous_left'_right' {a : α} {f : α → β} :
ContinuousWithinAt f s a ↔
ContinuousWithinAt f (s ∩ Iio a) a ∧ ContinuousWithinAt f (s ∩ Ioi a) a := by
rw [continuousWithinAt_inter_Ioi_iff_Ici, continuousWithinAt_inter_Iio_iff_Iic,
continuousWithinAt_iff_continuous_left_right]
end TopologicalSpace |
.lake/packages/mathlib/Mathlib/Topology/Order/LeftRightLim.lean | import Mathlib.Topology.Order.LeftRight
import Mathlib.Topology.Order.Monotone
/-!
# Left and right limits
We define the (strict) left and right limits of a function.
* `leftLim f x` is the strict left limit of `f` at `x` (using `f x` as a garbage value if `x`
is isolated to its left).
* `rightLim f x` is the strict right limit of `f` at `x` (using `f x` as a garbage value if `x`
is isolated to its right).
We develop a comprehensive API for monotone functions. Notably,
* `Monotone.continuousAt_iff_leftLim_eq_rightLim` states that a monotone function is continuous
at a point if and only if its left and right limits coincide.
* `Monotone.countable_not_continuousAt` asserts that a monotone function taking values in a
second-countable space has at most countably many discontinuity points.
We also port the API to antitone functions.
## TODO
Prove corresponding stronger results for `StrictMono` and `StrictAnti` functions.
-/
open Set Filter
open Topology
section
variable {α β : Type*} [LinearOrder α] [TopologicalSpace β]
/-- Let `f : α → β` be a function from a linear order `α` to a topological space `β`, and
let `a : α`. The limit strictly to the left of `f` at `a`, denoted with `leftLim f a`, is defined
by using the order topology on `α`. If `a` is isolated to its left or the function has no left
limit, we use `f a` instead to guarantee a good behavior in most cases. -/
noncomputable def Function.leftLim (f : α → β) (a : α) : β := by
classical
haveI : Nonempty β := ⟨f a⟩
letI : TopologicalSpace α := Preorder.topology α
exact if 𝓝[<] a = ⊥ ∨ ¬∃ y, Tendsto f (𝓝[<] a) (𝓝 y) then f a else limUnder (𝓝[<] a) f
/-- Let `f : α → β` be a function from a linear order `α` to a topological space `β`, and
let `a : α`. The limit strictly to the right of `f` at `a`, denoted with `rightLim f a`, is defined
by using the order topology on `α`. If `a` is isolated to its right or the function has no right
limit, we use `f a` instead to guarantee a good behavior in most cases. -/
noncomputable def Function.rightLim (f : α → β) (a : α) : β :=
@Function.leftLim αᵒᵈ β _ _ f a
open Function
theorem leftLim_eq_of_tendsto [hα : TopologicalSpace α] [h'α : OrderTopology α] [T2Space β]
{f : α → β} {a : α} {y : β} (h : 𝓝[<] a ≠ ⊥) (h' : Tendsto f (𝓝[<] a) (𝓝 y)) :
leftLim f a = y := by
have h'' : ∃ y, Tendsto f (𝓝[<] a) (𝓝 y) := ⟨y, h'⟩
rw [h'α.topology_eq_generate_intervals] at h h' h''
simp only [leftLim, h, h'', not_true, or_self_iff, if_false]
haveI := neBot_iff.2 h
exact lim_eq h'
theorem leftLim_eq_of_eq_bot [hα : TopologicalSpace α] [h'α : OrderTopology α] (f : α → β) {a : α}
(h : 𝓝[<] a = ⊥) : leftLim f a = f a := by
rw [h'α.topology_eq_generate_intervals] at h
simp [leftLim, h]
theorem rightLim_eq_of_tendsto [TopologicalSpace α] [OrderTopology α] [T2Space β]
{f : α → β} {a : α} {y : β} (h : 𝓝[>] a ≠ ⊥) (h' : Tendsto f (𝓝[>] a) (𝓝 y)) :
Function.rightLim f a = y :=
@leftLim_eq_of_tendsto αᵒᵈ _ _ _ _ _ _ f a y h h'
theorem rightLim_eq_of_eq_bot [TopologicalSpace α] [OrderTopology α] (f : α → β) {a : α}
(h : 𝓝[>] a = ⊥) : rightLim f a = f a :=
@leftLim_eq_of_eq_bot αᵒᵈ _ _ _ _ _ f a h
end
open Function
namespace Monotone
variable {α β : Type*} [LinearOrder α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β]
[OrderTopology β] {f : α → β} (hf : Monotone f) {x y : α}
include hf
theorem leftLim_eq_sSup [TopologicalSpace α] [OrderTopology α] (h : 𝓝[<] x ≠ ⊥) :
leftLim f x = sSup (f '' Iio x) :=
leftLim_eq_of_tendsto h (hf.tendsto_nhdsLT x)
theorem rightLim_eq_sInf [TopologicalSpace α] [OrderTopology α] (h : 𝓝[>] x ≠ ⊥) :
rightLim f x = sInf (f '' Ioi x) :=
rightLim_eq_of_tendsto h (hf.tendsto_nhdsGT x)
theorem leftLim_le (h : x ≤ y) : leftLim f x ≤ f y := by
letI : TopologicalSpace α := Preorder.topology α
haveI : OrderTopology α := ⟨rfl⟩
rcases eq_or_ne (𝓝[<] x) ⊥ with (h' | h')
· simpa [leftLim, h'] using hf h
haveI A : NeBot (𝓝[<] x) := neBot_iff.2 h'
rw [leftLim_eq_sSup hf h']
refine csSup_le ?_ ?_
· simp only [image_nonempty]
exact (forall_mem_nonempty_iff_neBot.2 A) _ self_mem_nhdsWithin
· simp only [mem_image, mem_Iio, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
intro z hz
exact hf (hz.le.trans h)
theorem le_leftLim (h : x < y) : f x ≤ leftLim f y := by
letI : TopologicalSpace α := Preorder.topology α
haveI : OrderTopology α := ⟨rfl⟩
rcases eq_or_ne (𝓝[<] y) ⊥ with (h' | h')
· rw [leftLim_eq_of_eq_bot _ h']
exact hf h.le
rw [leftLim_eq_sSup hf h']
refine le_csSup ⟨f y, ?_⟩ (mem_image_of_mem _ h)
simp only [upperBounds, mem_image, mem_Iio, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂, mem_setOf_eq]
intro z hz
exact hf hz.le
@[mono]
protected theorem leftLim : Monotone (leftLim f) := by
intro x y h
rcases eq_or_lt_of_le h with (rfl | hxy)
· exact le_rfl
· exact (hf.leftLim_le le_rfl).trans (hf.le_leftLim hxy)
theorem le_rightLim (h : x ≤ y) : f x ≤ rightLim f y :=
hf.dual.leftLim_le h
theorem rightLim_le (h : x < y) : rightLim f x ≤ f y :=
hf.dual.le_leftLim h
@[mono]
protected theorem rightLim : Monotone (rightLim f) := fun _ _ h => hf.dual.leftLim h
theorem leftLim_le_rightLim (h : x ≤ y) : leftLim f x ≤ rightLim f y :=
(hf.leftLim_le le_rfl).trans (hf.le_rightLim h)
theorem rightLim_le_leftLim (h : x < y) : rightLim f x ≤ leftLim f y := by
letI : TopologicalSpace α := Preorder.topology α
haveI : OrderTopology α := ⟨rfl⟩
rcases eq_or_neBot (𝓝[<] y) with (h' | h')
· simpa [leftLim, h'] using rightLim_le hf h
obtain ⟨a, ⟨xa, ay⟩⟩ : (Ioo x y).Nonempty := nonempty_of_mem (Ioo_mem_nhdsLT h)
calc
rightLim f x ≤ f a := hf.rightLim_le xa
_ ≤ leftLim f y := hf.le_leftLim ay
variable [TopologicalSpace α] [OrderTopology α]
theorem tendsto_leftLim (x : α) : Tendsto f (𝓝[<] x) (𝓝 (leftLim f x)) := by
rcases eq_or_ne (𝓝[<] x) ⊥ with (h' | h')
· simp [h']
rw [leftLim_eq_sSup hf h']
exact hf.tendsto_nhdsLT x
theorem tendsto_leftLim_within (x : α) : Tendsto f (𝓝[<] x) (𝓝[≤] leftLim f x) := by
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within f (hf.tendsto_leftLim x)
filter_upwards [@self_mem_nhdsWithin _ _ x (Iio x)] with y hy using hf.le_leftLim hy
theorem tendsto_rightLim (x : α) : Tendsto f (𝓝[>] x) (𝓝 (rightLim f x)) :=
hf.dual.tendsto_leftLim x
theorem tendsto_rightLim_within (x : α) : Tendsto f (𝓝[>] x) (𝓝[≥] rightLim f x) :=
hf.dual.tendsto_leftLim_within x
/-- A monotone function is continuous to the left at a point if and only if its left limit
coincides with the value of the function. -/
theorem continuousWithinAt_Iio_iff_leftLim_eq :
ContinuousWithinAt f (Iio x) x ↔ leftLim f x = f x := by
rcases eq_or_ne (𝓝[<] x) ⊥ with (h' | h')
· simp [leftLim_eq_of_eq_bot f h', ContinuousWithinAt, h']
haveI : (𝓝[Iio x] x).NeBot := neBot_iff.2 h'
refine ⟨fun h => tendsto_nhds_unique (hf.tendsto_leftLim x) h.tendsto, fun h => ?_⟩
have := hf.tendsto_leftLim x
rwa [h] at this
/-- A monotone function is continuous to the right at a point if and only if its right limit
coincides with the value of the function. -/
theorem continuousWithinAt_Ioi_iff_rightLim_eq :
ContinuousWithinAt f (Ioi x) x ↔ rightLim f x = f x :=
hf.dual.continuousWithinAt_Iio_iff_leftLim_eq
/-- A monotone function is continuous at a point if and only if its left and right limits
coincide. -/
theorem continuousAt_iff_leftLim_eq_rightLim : ContinuousAt f x ↔ leftLim f x = rightLim f x := by
refine ⟨fun h => ?_, fun h => ?_⟩
· have A : leftLim f x = f x :=
hf.continuousWithinAt_Iio_iff_leftLim_eq.1 h.continuousWithinAt
have B : rightLim f x = f x :=
hf.continuousWithinAt_Ioi_iff_rightLim_eq.1 h.continuousWithinAt
exact A.trans B.symm
· have h' : leftLim f x = f x := by
apply le_antisymm (leftLim_le hf (le_refl _))
rw [h]
exact le_rightLim hf (le_refl _)
refine continuousAt_iff_continuous_left'_right'.2 ⟨?_, ?_⟩
· exact hf.continuousWithinAt_Iio_iff_leftLim_eq.2 h'
· rw [h] at h'
exact hf.continuousWithinAt_Ioi_iff_rightLim_eq.2 h'
end Monotone
namespace Antitone
variable {α β : Type*} [LinearOrder α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β]
[OrderTopology β] {f : α → β} (hf : Antitone f) {x y : α}
include hf
theorem le_leftLim (h : x ≤ y) : f y ≤ leftLim f x :=
hf.dual_right.leftLim_le h
theorem leftLim_le (h : x < y) : leftLim f y ≤ f x :=
hf.dual_right.le_leftLim h
@[mono]
protected theorem leftLim : Antitone (leftLim f) :=
hf.dual_right.leftLim
theorem rightLim_le (h : x ≤ y) : rightLim f y ≤ f x :=
hf.dual_right.le_rightLim h
theorem le_rightLim (h : x < y) : f y ≤ rightLim f x :=
hf.dual_right.rightLim_le h
@[mono]
protected theorem rightLim : Antitone (rightLim f) :=
hf.dual_right.rightLim
theorem rightLim_le_leftLim (h : x ≤ y) : rightLim f y ≤ leftLim f x :=
hf.dual_right.leftLim_le_rightLim h
theorem leftLim_le_rightLim (h : x < y) : leftLim f y ≤ rightLim f x :=
hf.dual_right.rightLim_le_leftLim h
variable [TopologicalSpace α] [OrderTopology α]
theorem tendsto_leftLim (x : α) : Tendsto f (𝓝[<] x) (𝓝 (leftLim f x)) :=
hf.dual_right.tendsto_leftLim x
theorem tendsto_leftLim_within (x : α) : Tendsto f (𝓝[<] x) (𝓝[≥] leftLim f x) :=
hf.dual_right.tendsto_leftLim_within x
theorem tendsto_rightLim (x : α) : Tendsto f (𝓝[>] x) (𝓝 (rightLim f x)) :=
hf.dual_right.tendsto_rightLim x
theorem tendsto_rightLim_within (x : α) : Tendsto f (𝓝[>] x) (𝓝[≤] rightLim f x) :=
hf.dual_right.tendsto_rightLim_within x
/-- An antitone function is continuous to the left at a point if and only if its left limit
coincides with the value of the function. -/
theorem continuousWithinAt_Iio_iff_leftLim_eq :
ContinuousWithinAt f (Iio x) x ↔ leftLim f x = f x :=
hf.dual_right.continuousWithinAt_Iio_iff_leftLim_eq
/-- An antitone function is continuous to the right at a point if and only if its right limit
coincides with the value of the function. -/
theorem continuousWithinAt_Ioi_iff_rightLim_eq :
ContinuousWithinAt f (Ioi x) x ↔ rightLim f x = f x :=
hf.dual_right.continuousWithinAt_Ioi_iff_rightLim_eq
/-- An antitone function is continuous at a point if and only if its left and right limits
coincide. -/
theorem continuousAt_iff_leftLim_eq_rightLim : ContinuousAt f x ↔ leftLim f x = rightLim f x :=
hf.dual_right.continuousAt_iff_leftLim_eq_rightLim
end Antitone |
.lake/packages/mathlib/Mathlib/Topology/Order/LawsonTopology.lean | import Mathlib.Topology.Order.LowerUpperTopology
import Mathlib.Topology.Order.ScottTopology
/-!
# Lawson topology
This file introduces the Lawson topology on a preorder.
## Main definitions
- `Topology.lawson` - the Lawson topology is defined as the meet of the lower topology and the
Scott topology.
- `Topology.IsLawson.lawsonBasis` - The complements of the upper closures of finite sets
intersected with Scott open sets.
## Main statements
- `Topology.IsLawson.isTopologicalBasis` - `Topology.IsLawson.lawsonBasis` is a basis for
`Topology.IsLawson`
- `Topology.lawsonOpen_iff_scottOpen_of_isUpperSet'` - An upper set is Lawson open if and only if it
is Scott open
- `Topology.lawsonClosed_iff_dirSupClosed_of_isLowerSet` - A lower set is Lawson closed if and only
if it is closed under sups of directed sets
- `Topology.IsLawson.t0Space` - The Lawson topology is T₀
## Implementation notes
A type synonym `Topology.WithLawson` is introduced and for a preorder `α`, `Topology.WithLawson α`
is made an instance of `TopologicalSpace` by `Topology.lawson`.
We define a mixin class `Topology.IsLawson` for the class of types which are both a preorder and a
topology and where the topology is `Topology.lawson`.
It is shown that `Topology.WithLawson α` is an instance of `Topology.IsLawson`.
## References
* [Gierz et al, *A Compendium of Continuous Lattices*][GierzEtAl1980]
## Tags
Lawson topology, preorder
-/
open Set TopologicalSpace
variable {α : Type*}
namespace Topology
/-! ### Lawson topology -/
section Lawson
section Preorder
/--
The Lawson topology is defined as the meet of `Topology.lower` and the `Topology.scott`.
-/
def lawson (α : Type*) [Preorder α] : TopologicalSpace α := lower α ⊓ scott α univ
variable (α) [Preorder α] [TopologicalSpace α]
/-- Predicate for an ordered topological space to be equipped with its Lawson topology.
The Lawson topology is defined as the meet of `Topology.lower` and the `Topology.scott`.
-/
class IsLawson : Prop where
topology_eq_lawson : ‹TopologicalSpace α› = lawson α
end Preorder
namespace IsLawson
section Preorder
variable (α) [Preorder α] [TopologicalSpace α] [IsLawson α]
/-- The complements of the upper closures of finite sets intersected with Scott open sets form
a basis for the lawson topology. -/
def lawsonBasis := { s : Set α | ∃ t : Set α, t.Finite ∧ ∃ u : Set α, IsOpen[scott α univ] u ∧
u \ upperClosure t = s }
protected theorem isTopologicalBasis : TopologicalSpace.IsTopologicalBasis (lawsonBasis α) := by
have lawsonBasis_image2 : lawsonBasis α =
(image2 (fun x x_1 ↦ ⇑WithLower.toLower ⁻¹' x ∩ ⇑WithScott.toScott ⁻¹' x_1)
(IsLower.lowerBasis (WithLower α)) {U | IsOpen[scott α univ] U}) := by
rw [lawsonBasis, image2, IsLower.lowerBasis]
simp_rw [diff_eq_compl_inter]
aesop
rw [lawsonBasis_image2]
convert IsTopologicalBasis.inf_induced IsLower.isTopologicalBasis
(isTopologicalBasis_opens (α := WithScott α))
WithLower.toLower WithScott.toScott
rw [@topology_eq_lawson α _ _ _, lawson]
apply (congrArg₂ min _) _
· letI _ := lower α
exact (@IsLower.withLowerHomeomorph α ‹_› (lower α) ⟨rfl⟩).isInducing.eq_induced
· letI _ := scott α univ
exact (@IsScott.withScottHomeomorph α _ (scott α univ) ⟨rfl⟩).isInducing.eq_induced
end Preorder
end IsLawson
/--
Type synonym for a preorder equipped with the Lawson topology.
-/
def WithLawson (α : Type*) := α
namespace WithLawson
/-- `toLawson` is the identity function to the `WithLawson` of a type. -/
@[match_pattern] def toLawson : α ≃ WithLawson α := Equiv.refl _
/-- `ofLawson` is the identity function from the `WithLawson` of a type. -/
@[match_pattern] def ofLawson : WithLawson α ≃ α := Equiv.refl _
@[simp] lemma to_Lawson_symm_eq : (@toLawson α).symm = ofLawson := rfl
@[simp] lemma of_Lawson_symm_eq : (@ofLawson α).symm = toLawson := rfl
@[simp] lemma toLawson_ofLawson (a : WithLawson α) : toLawson (ofLawson a) = a := rfl
@[simp] lemma ofLawson_toLawson (a : α) : ofLawson (toLawson a) = a := rfl
lemma toLawson_inj {a b : α} : toLawson a = toLawson b ↔ a = b := Iff.rfl
lemma ofLawson_inj {a b : WithLawson α} : ofLawson a = ofLawson b ↔ a = b := Iff.rfl
/-- A recursor for `WithLawson`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithLawson α → Sort*}
(h : ∀ a, β (toLawson a)) : ∀ a, β a := fun a => h (ofLawson a)
instance [Nonempty α] : Nonempty (WithLawson α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithLawson α) := ‹Inhabited α›
variable [Preorder α]
instance instPreorder : Preorder (WithLawson α) := ‹Preorder α›
instance instTopologicalSpace : TopologicalSpace (WithLawson α) := lawson α
instance instIsLawson : IsLawson (WithLawson α) := ⟨rfl⟩
/-- If `α` is equipped with the Lawson topology, then it is homeomorphic to `WithLawson α`.
-/
def homeomorph [TopologicalSpace α] [IsLawson α] : WithLawson α ≃ₜ α :=
ofLawson.toHomeomorphOfIsInducing ⟨IsLawson.topology_eq_lawson (α := α) ▸ induced_id.symm⟩
theorem isOpen_preimage_ofLawson {S : Set α} :
IsOpen (ofLawson ⁻¹' S) ↔ (lawson α).IsOpen S := Iff.rfl
theorem isClosed_preimage_ofLawson {S : Set α} :
IsClosed (ofLawson ⁻¹' S) ↔ IsClosed[lawson α] S := Iff.rfl
theorem isOpen_def {T : Set (WithLawson α)} :
IsOpen T ↔ (lawson α).IsOpen (toLawson ⁻¹' T) := Iff.rfl
end WithLawson
end Lawson
section Preorder
variable [Preorder α]
lemma lawson_le_scott : lawson α ≤ scott α univ := inf_le_right
lemma lawson_le_lower : lawson α ≤ lower α := inf_le_left
lemma scottHausdorff_le_lawson : scottHausdorff α univ ≤ lawson α :=
le_inf scottHausdorff_le_lower scottHausdorff_le_scott
lemma lawsonClosed_of_scottClosed (s : Set α) (h : IsClosed (WithScott.ofScott ⁻¹' s)) :
IsClosed (WithLawson.ofLawson ⁻¹' s) := h.mono lawson_le_scott
lemma lawsonClosed_of_lowerClosed (s : Set α) (h : IsClosed (WithLower.ofLower ⁻¹' s)) :
IsClosed (WithLawson.ofLawson ⁻¹' s) := h.mono lawson_le_lower
/-- An upper set is Lawson open if and only if it is Scott open -/
lemma lawsonOpen_iff_scottOpen_of_isUpperSet {s : Set α} (h : IsUpperSet s) :
IsOpen (WithLawson.ofLawson ⁻¹' s) ↔ IsOpen (WithScott.ofScott ⁻¹' s) :=
⟨fun hs => IsScott.isOpen_iff_isUpperSet_and_scottHausdorff_open (D := univ).mpr
⟨h, (scottHausdorff_le_lawson s) hs⟩, lawson_le_scott _⟩
variable (L : TopologicalSpace α) (S : TopologicalSpace α)
variable [@IsLawson α _ L] [@IsScott α univ _ S]
lemma isLawson_le_isScott : L ≤ S := by
rw [@IsScott.topology_eq α univ _ S _, @IsLawson.topology_eq_lawson α _ L _]
exact inf_le_right
lemma scottHausdorff_le_isLawson : scottHausdorff α univ ≤ L := by
rw [@IsLawson.topology_eq_lawson α _ L _]
exact scottHausdorff_le_lawson
/-- An upper set is Lawson open if and only if it is Scott open -/
lemma lawsonOpen_iff_scottOpen_of_isUpperSet' (s : Set α) (h : IsUpperSet s) :
IsOpen[L] s ↔ IsOpen[S] s := by
rw [@IsLawson.topology_eq_lawson α _ L _, @IsScott.topology_eq α univ _ S _]
exact lawsonOpen_iff_scottOpen_of_isUpperSet h
lemma lawsonClosed_iff_scottClosed_of_isLowerSet (s : Set α) (h : IsLowerSet s) :
IsClosed[L] s ↔ IsClosed[S] s := by
rw [← @isOpen_compl_iff, ← isOpen_compl_iff,
(lawsonOpen_iff_scottOpen_of_isUpperSet' L S _ (isUpperSet_compl.mpr h))]
include S in
/-- A lower set is Lawson closed if and only if it is closed under sups of directed sets -/
lemma lawsonClosed_iff_dirSupClosed_of_isLowerSet (s : Set α) (h : IsLowerSet s) :
IsClosed[L] s ↔ DirSupClosed s := by
rw [lawsonClosed_iff_scottClosed_of_isLowerSet L S _ h,
@IsScott.isClosed_iff_isLowerSet_and_dirSupClosed]
simp_all
end Preorder
namespace IsLawson
variable [PartialOrder α] [TopologicalSpace α] [IsLawson α]
/-- The Lawson topology on a partial order is T₁. -/
-- see Note [lower instance priority]
instance (priority := 90) toT1Space : T1Space α where
t1 a := by
simp only [IsLawson.topology_eq_lawson]
rw [← (Set.OrdConnected.upperClosure_inter_lowerClosure ordConnected_singleton),
← WithLawson.isClosed_preimage_ofLawson]
apply IsClosed.inter
(lawsonClosed_of_lowerClosed _ (IsLower.isClosed_upperClosure (finite_singleton a)))
rw [lowerClosure_singleton, LowerSet.coe_Iic, ← WithLawson.isClosed_preimage_ofLawson]
exact lawsonClosed_of_scottClosed _ isClosed_Iic
@[deprecated (since := "2025-07-02")] protected alias singleton_isClosed := isClosed_singleton
end IsLawson
end Topology |
.lake/packages/mathlib/Mathlib/Topology/Order/MonotoneConvergence.lean | import Mathlib.Topology.Order.Basic
/-!
# Bounded monotone sequences converge
In this file we prove a few theorems of the form “if the range of a monotone function `f : ι → α`
admits a least upper bound `a`, then `f x` tends to `a` as `x → ∞`”, as well as version of this
statement for (conditionally) complete lattices that use `⨆ x, f x` instead of `IsLUB`.
These theorems work for linear orders with order topologies as well as their products (both in terms
of `Prod` and in terms of function types). In order to reduce code duplication, we introduce two
typeclasses (one for the property formulated above and one for the dual property), prove theorems
assuming one of these typeclasses, and provide instances for linear orders and their products.
We also prove some "inverse" results: if `f n` is a monotone sequence and `a` is its limit,
then `f n ≤ a` for all `n`.
## Tags
monotone convergence
-/
open Filter Set Function
open scoped Topology
variable {α β : Type*}
/-- We say that `α` is a `SupConvergenceClass` if the following holds. Let `f : ι → α` be a
monotone function, let `a : α` be a least upper bound of `Set.range f`. Then `f x` tends to `𝓝 a`
as `x → ∞` (formally, at the filter `Filter.atTop`). We require this for `ι = (s : Set α)`,
`f = (↑)` in the definition, then prove it for any `f` in `tendsto_atTop_isLUB`.
This property holds for linear orders with order topology as well as their products. -/
class SupConvergenceClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where
/-- proof that a monotone function tends to `𝓝 a` as `x → ∞` -/
tendsto_coe_atTop_isLUB :
∀ (a : α) (s : Set α), IsLUB s a → Tendsto ((↑) : s → α) atTop (𝓝 a)
/-- We say that `α` is an `InfConvergenceClass` if the following holds. Let `f : ι → α` be a
monotone function, let `a : α` be a greatest lower bound of `Set.range f`. Then `f x` tends to `𝓝 a`
as `x → -∞` (formally, at the filter `Filter.atBot`). We require this for `ι = (s : Set α)`,
`f = (↑)` in the definition, then prove it for any `f` in `tendsto_atBot_isGLB`.
This property holds for linear orders with order topology as well as their products. -/
class InfConvergenceClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where
/-- proof that a monotone function tends to `𝓝 a` as `x → -∞` -/
tendsto_coe_atBot_isGLB :
∀ (a : α) (s : Set α), IsGLB s a → Tendsto ((↑) : s → α) atBot (𝓝 a)
instance OrderDual.supConvergenceClass [Preorder α] [TopologicalSpace α] [InfConvergenceClass α] :
SupConvergenceClass αᵒᵈ :=
⟨‹InfConvergenceClass α›.1⟩
instance OrderDual.infConvergenceClass [Preorder α] [TopologicalSpace α] [SupConvergenceClass α] :
InfConvergenceClass αᵒᵈ :=
⟨‹SupConvergenceClass α›.1⟩
-- see Note [lower instance priority]
instance (priority := 100) LinearOrder.supConvergenceClass [TopologicalSpace α] [LinearOrder α]
[OrderTopology α] : SupConvergenceClass α := by
refine ⟨fun a s ha => tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩⟩
· rcases ha.exists_between hb with ⟨c, hcs, bc, bca⟩
lift c to s using hcs
exact (eventually_ge_atTop c).mono fun x hx => bc.trans_le hx
· exact Eventually.of_forall fun x => (ha.1 x.2).trans_lt hb
-- see Note [lower instance priority]
instance (priority := 100) LinearOrder.infConvergenceClass [TopologicalSpace α] [LinearOrder α]
[OrderTopology α] : InfConvergenceClass α :=
show InfConvergenceClass αᵒᵈᵒᵈ from OrderDual.infConvergenceClass
section
variable {ι : Type*} [Preorder ι] [TopologicalSpace α]
section IsLUB
variable [Preorder α] [SupConvergenceClass α] {f : ι → α} {a : α}
theorem tendsto_atTop_isLUB (h_mono : Monotone f) (ha : IsLUB (Set.range f) a) :
Tendsto f atTop (𝓝 a) := by
suffices Tendsto (rangeFactorization f) atTop atTop from
(SupConvergenceClass.tendsto_coe_atTop_isLUB _ _ ha).comp this
exact h_mono.rangeFactorization.tendsto_atTop_atTop fun b => b.2.imp fun a ha => ha.ge
theorem tendsto_atBot_isLUB (h_anti : Antitone f) (ha : IsLUB (Set.range f) a) :
Tendsto f atBot (𝓝 a) := by convert tendsto_atTop_isLUB h_anti.dual_left ha using 1
end IsLUB
section IsGLB
variable [Preorder α] [InfConvergenceClass α] {f : ι → α} {a : α}
theorem tendsto_atBot_isGLB (h_mono : Monotone f) (ha : IsGLB (Set.range f) a) :
Tendsto f atBot (𝓝 a) := by convert tendsto_atTop_isLUB h_mono.dual ha.dual using 1
theorem tendsto_atTop_isGLB (h_anti : Antitone f) (ha : IsGLB (Set.range f) a) :
Tendsto f atTop (𝓝 a) := by convert tendsto_atBot_isLUB h_anti.dual ha.dual using 1
end IsGLB
section CiSup
variable [ConditionallyCompleteLattice α] [SupConvergenceClass α] {f : ι → α}
theorem tendsto_atTop_ciSup (h_mono : Monotone f) (hbdd : BddAbove <| range f) :
Tendsto f atTop (𝓝 (⨆ i, f i)) := by
cases isEmpty_or_nonempty ι
exacts [tendsto_of_isEmpty, tendsto_atTop_isLUB h_mono (isLUB_ciSup hbdd)]
theorem tendsto_atBot_ciSup (h_anti : Antitone f) (hbdd : BddAbove <| range f) :
Tendsto f atBot (𝓝 (⨆ i, f i)) := by convert tendsto_atTop_ciSup h_anti.dual hbdd.dual using 1
end CiSup
section CiInf
variable [ConditionallyCompleteLattice α] [InfConvergenceClass α] {f : ι → α}
theorem tendsto_atBot_ciInf (h_mono : Monotone f) (hbdd : BddBelow <| range f) :
Tendsto f atBot (𝓝 (⨅ i, f i)) := by convert tendsto_atTop_ciSup h_mono.dual hbdd.dual using 1
theorem tendsto_atTop_ciInf (h_anti : Antitone f) (hbdd : BddBelow <| range f) :
Tendsto f atTop (𝓝 (⨅ i, f i)) := by convert tendsto_atBot_ciSup h_anti.dual hbdd.dual using 1
end CiInf
section iSup
variable [CompleteLattice α] [SupConvergenceClass α] {f : ι → α}
theorem tendsto_atTop_iSup (h_mono : Monotone f) : Tendsto f atTop (𝓝 (⨆ i, f i)) :=
tendsto_atTop_ciSup h_mono (OrderTop.bddAbove _)
theorem tendsto_atBot_iSup (h_anti : Antitone f) : Tendsto f atBot (𝓝 (⨆ i, f i)) :=
tendsto_atBot_ciSup h_anti (OrderTop.bddAbove _)
end iSup
section iInf
variable [CompleteLattice α] [InfConvergenceClass α] {f : ι → α}
theorem tendsto_atBot_iInf (h_mono : Monotone f) : Tendsto f atBot (𝓝 (⨅ i, f i)) :=
tendsto_atBot_ciInf h_mono (OrderBot.bddBelow _)
theorem tendsto_atTop_iInf (h_anti : Antitone f) : Tendsto f atTop (𝓝 (⨅ i, f i)) :=
tendsto_atTop_ciInf h_anti (OrderBot.bddBelow _)
end iInf
end
instance Prod.supConvergenceClass
[Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β]
[SupConvergenceClass α] [SupConvergenceClass β] : SupConvergenceClass (α × β) := by
constructor
rintro ⟨a, b⟩ s h
rw [isLUB_prod, ← range_restrict, ← range_restrict] at h
have A : Tendsto (fun x : s => (x : α × β).1) atTop (𝓝 a) :=
tendsto_atTop_isLUB (monotone_fst.restrict s) h.1
have B : Tendsto (fun x : s => (x : α × β).2) atTop (𝓝 b) :=
tendsto_atTop_isLUB (monotone_snd.restrict s) h.2
exact A.prodMk_nhds B
instance [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β] [InfConvergenceClass α]
[InfConvergenceClass β] : InfConvergenceClass (α × β) :=
show InfConvergenceClass (αᵒᵈ × βᵒᵈ)ᵒᵈ from OrderDual.infConvergenceClass
instance Pi.supConvergenceClass
{ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)]
[∀ i, SupConvergenceClass (α i)] : SupConvergenceClass (∀ i, α i) := by
refine ⟨fun f s h => ?_⟩
simp only [isLUB_pi, ← range_restrict] at h
exact tendsto_pi_nhds.2 fun i => tendsto_atTop_isLUB ((monotone_eval _).restrict _) (h i)
instance Pi.infConvergenceClass
{ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)]
[∀ i, InfConvergenceClass (α i)] : InfConvergenceClass (∀ i, α i) :=
show InfConvergenceClass (∀ i, (α i)ᵒᵈ)ᵒᵈ from OrderDual.infConvergenceClass
instance Pi.supConvergenceClass' {ι : Type*} [Preorder α] [TopologicalSpace α]
[SupConvergenceClass α] : SupConvergenceClass (ι → α) :=
supConvergenceClass
instance Pi.infConvergenceClass' {ι : Type*} [Preorder α] [TopologicalSpace α]
[InfConvergenceClass α] : InfConvergenceClass (ι → α) :=
Pi.infConvergenceClass
theorem tendsto_of_monotone {ι α : Type*} [Preorder ι] [TopologicalSpace α]
[ConditionallyCompleteLinearOrder α] [OrderTopology α] {f : ι → α} (h_mono : Monotone f) :
Tendsto f atTop atTop ∨ ∃ l, Tendsto f atTop (𝓝 l) := by
classical
exact if H : BddAbove (range f) then Or.inr ⟨_, tendsto_atTop_ciSup h_mono H⟩
else Or.inl <| tendsto_atTop_atTop_of_monotone' h_mono H
theorem tendsto_of_antitone {ι α : Type*} [Preorder ι] [TopologicalSpace α]
[ConditionallyCompleteLinearOrder α] [OrderTopology α] {f : ι → α} (h_mono : Antitone f) :
Tendsto f atTop atBot ∨ ∃ l, Tendsto f atTop (𝓝 l) :=
@tendsto_of_monotone ι αᵒᵈ _ _ _ _ _ h_mono
theorem tendsto_iff_tendsto_subseq_of_monotone {ι₁ ι₂ α : Type*} [SemilatticeSup ι₁] [Preorder ι₂]
[Nonempty ι₁] [TopologicalSpace α] [ConditionallyCompleteLinearOrder α] [OrderTopology α]
[NoMaxOrder α] {f : ι₂ → α} {φ : ι₁ → ι₂} {l : α} (hf : Monotone f)
(hg : Tendsto φ atTop atTop) : Tendsto f atTop (𝓝 l) ↔ Tendsto (f ∘ φ) atTop (𝓝 l) := by
constructor <;> intro h
· exact h.comp hg
· rcases tendsto_of_monotone hf with (h' | ⟨l', hl'⟩)
· exact (not_tendsto_atTop_of_tendsto_nhds h (h'.comp hg)).elim
· rwa [tendsto_nhds_unique h (hl'.comp hg)]
theorem tendsto_iff_tendsto_subseq_of_antitone {ι₁ ι₂ α : Type*} [SemilatticeSup ι₁] [Preorder ι₂]
[Nonempty ι₁] [TopologicalSpace α] [ConditionallyCompleteLinearOrder α] [OrderTopology α]
[NoMinOrder α] {f : ι₂ → α} {φ : ι₁ → ι₂} {l : α} (hf : Antitone f)
(hg : Tendsto φ atTop atTop) : Tendsto f atTop (𝓝 l) ↔ Tendsto (f ∘ φ) atTop (𝓝 l) :=
tendsto_iff_tendsto_subseq_of_monotone (α := αᵒᵈ) hf hg
/-! The next family of results, such as `isLUB_of_tendsto_atTop` and `iSup_eq_of_tendsto`, are
converses to the standard fact that bounded monotone functions converge. They state, that if a
monotone function `f` tends to `a` along `Filter.atTop`, then that value `a` is a least upper bound
for the range of `f`.
Related theorems above (`IsLUB.isLUB_of_tendsto`, `IsGLB.isGLB_of_tendsto` etc) cover the case
when `f x` tends to `a` as `x` tends to some point `b` in the domain. -/
theorem Monotone.ge_of_tendsto [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[SemilatticeSup β] {f : β → α} {a : α} (hf : Monotone f) (ha : Tendsto f atTop (𝓝 a)) (b : β) :
f b ≤ a :=
haveI : Nonempty β := Nonempty.intro b
_root_.ge_of_tendsto ha ((eventually_ge_atTop b).mono fun _ hxy => hf hxy)
theorem Monotone.le_of_tendsto [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[SemilatticeInf β] {f : β → α} {a : α} (hf : Monotone f) (ha : Tendsto f atBot (𝓝 a)) (b : β) :
a ≤ f b :=
hf.dual.ge_of_tendsto ha b
theorem Antitone.le_of_tendsto [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[SemilatticeSup β] {f : β → α} {a : α} (hf : Antitone f) (ha : Tendsto f atTop (𝓝 a)) (b : β) :
a ≤ f b :=
hf.dual_right.ge_of_tendsto ha b
theorem Antitone.ge_of_tendsto [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[SemilatticeInf β] {f : β → α} {a : α} (hf : Antitone f) (ha : Tendsto f atBot (𝓝 a)) (b : β) :
f b ≤ a :=
hf.dual_right.le_of_tendsto ha b
theorem isLUB_of_tendsto_atTop [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[Nonempty β] [SemilatticeSup β] {f : β → α} {a : α} (hf : Monotone f)
(ha : Tendsto f atTop (𝓝 a)) : IsLUB (Set.range f) a := by
constructor
· rintro _ ⟨b, rfl⟩
exact hf.ge_of_tendsto ha b
· exact fun _ hb => le_of_tendsto' ha fun x => hb (Set.mem_range_self x)
theorem isGLB_of_tendsto_atBot [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[Nonempty β] [SemilatticeInf β] {f : β → α} {a : α} (hf : Monotone f)
(ha : Tendsto f atBot (𝓝 a)) : IsGLB (Set.range f) a :=
@isLUB_of_tendsto_atTop αᵒᵈ βᵒᵈ _ _ _ _ _ _ _ hf.dual ha
theorem isLUB_of_tendsto_atBot [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[Nonempty β] [SemilatticeInf β] {f : β → α} {a : α} (hf : Antitone f)
(ha : Tendsto f atBot (𝓝 a)) : IsLUB (Set.range f) a :=
@isLUB_of_tendsto_atTop α βᵒᵈ _ _ _ _ _ _ _ hf.dual_left ha
theorem isGLB_of_tendsto_atTop [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
[Nonempty β] [SemilatticeSup β] {f : β → α} {a : α} (hf : Antitone f)
(ha : Tendsto f atTop (𝓝 a)) : IsGLB (Set.range f) a :=
@isGLB_of_tendsto_atBot α βᵒᵈ _ _ _ _ _ _ _ hf.dual_left ha
theorem iSup_eq_of_tendsto {α β} [TopologicalSpace α] [CompleteLinearOrder α] [OrderTopology α]
[Nonempty β] [SemilatticeSup β] {f : β → α} {a : α} (hf : Monotone f) :
Tendsto f atTop (𝓝 a) → iSup f = a :=
tendsto_nhds_unique (tendsto_atTop_iSup hf)
theorem iInf_eq_of_tendsto {α} [TopologicalSpace α] [CompleteLinearOrder α] [OrderTopology α]
[Nonempty β] [SemilatticeSup β] {f : β → α} {a : α} (hf : Antitone f) :
Tendsto f atTop (𝓝 a) → iInf f = a :=
tendsto_nhds_unique (tendsto_atTop_iInf hf)
theorem iSup_eq_iSup_subseq_of_monotone {ι₁ ι₂ α : Type*} [Preorder ι₂] [CompleteLattice α]
{l : Filter ι₁} [l.NeBot] {f : ι₂ → α} {φ : ι₁ → ι₂} (hf : Monotone f)
(hφ : Tendsto φ l atTop) : ⨆ i, f i = ⨆ i, f (φ i) :=
le_antisymm
(iSup_mono' fun i =>
Exists.imp (fun j (hj : i ≤ φ j) => hf hj) (hφ.eventually <| eventually_ge_atTop i).exists)
(iSup_mono' fun i => ⟨φ i, le_rfl⟩)
theorem iSup_eq_iSup_subseq_of_antitone {ι₁ ι₂ α : Type*} [Preorder ι₂] [CompleteLattice α]
{l : Filter ι₁} [l.NeBot] {f : ι₂ → α} {φ : ι₁ → ι₂} (hf : Antitone f)
(hφ : Tendsto φ l atBot) : ⨆ i, f i = ⨆ i, f (φ i) :=
le_antisymm
(iSup_mono' fun i =>
Exists.imp (fun j (hj : φ j ≤ i) => hf hj) (hφ.eventually <| eventually_le_atBot i).exists)
(iSup_mono' fun i => ⟨φ i, le_rfl⟩)
theorem iInf_eq_iInf_subseq_of_monotone {ι₁ ι₂ α : Type*} [Preorder ι₂] [CompleteLattice α]
{l : Filter ι₁} [l.NeBot] {f : ι₂ → α} {φ : ι₁ → ι₂} (hf : Monotone f)
(hφ : Tendsto φ l atBot) : ⨅ i, f i = ⨅ i, f (φ i) :=
iSup_eq_iSup_subseq_of_monotone hf.dual hφ
theorem iInf_eq_iInf_subseq_of_antitone {ι₁ ι₂ α : Type*} [Preorder ι₂] [CompleteLattice α]
{l : Filter ι₁} [l.NeBot] {f : ι₂ → α} {φ : ι₁ → ι₂} (hf : Antitone f)
(hφ : Tendsto φ l atTop) : ⨅ i, f i = ⨅ i, f (φ i) :=
iSup_eq_iSup_subseq_of_antitone hf.dual hφ |
.lake/packages/mathlib/Mathlib/Topology/Order/NhdsSet.lean | import Mathlib.Topology.Order.Basic
/-!
# Set neighborhoods of intervals
In this file we prove basic theorems about `𝓝ˢ s`,
where `s` is one of the intervals
`Set.Ici`, `Set.Iic`, `Set.Ioi`, `Set.Iio`, `Set.Ico`, `Set.Ioc`, `Set.Ioo`, and `Set.Icc`.
First, we prove lemmas in terms of filter equalities.
Then we prove lemmas about `s ∈ 𝓝ˢ t`, where both `s` and `t` are intervals.
Finally, we prove a few lemmas about filter bases of `𝓝ˢ (Iic a)` and `𝓝ˢ (Ici a)`.
-/
open Set Filter OrderDual
open scoped Topology
section OrderClosedTopology
variable {α : Type*} [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] {a b c d : α}
/-!
### Formulae for `𝓝ˢ` of intervals
-/
@[simp] theorem nhdsSet_Ioi : 𝓝ˢ (Ioi a) = 𝓟 (Ioi a) := isOpen_Ioi.nhdsSet_eq
@[simp] theorem nhdsSet_Iio : 𝓝ˢ (Iio a) = 𝓟 (Iio a) := isOpen_Iio.nhdsSet_eq
@[simp] theorem nhdsSet_Ioo : 𝓝ˢ (Ioo a b) = 𝓟 (Ioo a b) := isOpen_Ioo.nhdsSet_eq
theorem nhdsSet_Ici : 𝓝ˢ (Ici a) = 𝓝 a ⊔ 𝓟 (Ioi a) := by
rw [← Ioi_insert, nhdsSet_insert, nhdsSet_Ioi]
theorem nhdsSet_Iic : 𝓝ˢ (Iic a) = 𝓝 a ⊔ 𝓟 (Iio a) := nhdsSet_Ici (α := αᵒᵈ)
theorem nhdsSet_Ico (h : a < b) : 𝓝ˢ (Ico a b) = 𝓝 a ⊔ 𝓟 (Ioo a b) := by
rw [← Ioo_insert_left h, nhdsSet_insert, nhdsSet_Ioo]
theorem nhdsSet_Ioc (h : a < b) : 𝓝ˢ (Ioc a b) = 𝓝 b ⊔ 𝓟 (Ioo a b) := by
rw [← Ioo_insert_right h, nhdsSet_insert, nhdsSet_Ioo]
theorem nhdsSet_Icc (h : a ≤ b) : 𝓝ˢ (Icc a b) = 𝓝 a ⊔ 𝓝 b ⊔ 𝓟 (Ioo a b) := by
rcases h.eq_or_lt with rfl | hlt
· simp
· rw [← Ioc_insert_left h, nhdsSet_insert, nhdsSet_Ioc hlt, sup_assoc]
/-!
### Lemmas about `Ixi _ ∈ 𝓝ˢ (Set.Ici _)`
-/
@[simp]
theorem Ioi_mem_nhdsSet_Ici_iff : Ioi a ∈ 𝓝ˢ (Ici b) ↔ a < b := by
rw [isOpen_Ioi.mem_nhdsSet, Ici_subset_Ioi]
alias ⟨_, Ioi_mem_nhdsSet_Ici⟩ := Ioi_mem_nhdsSet_Ici_iff
theorem Ici_mem_nhdsSet_Ici (h : a < b) : Ici a ∈ 𝓝ˢ (Ici b) :=
mem_of_superset (Ioi_mem_nhdsSet_Ici h) Ioi_subset_Ici_self
/-!
### Lemmas about `Iix _ ∈ 𝓝ˢ (Set.Iic _)`
-/
theorem Iio_mem_nhdsSet_Iic_iff : Iio b ∈ 𝓝ˢ (Iic a) ↔ a < b :=
Ioi_mem_nhdsSet_Ici_iff (α := αᵒᵈ)
alias ⟨_, Iio_mem_nhdsSet_Iic⟩ := Iio_mem_nhdsSet_Iic_iff
theorem Iic_mem_nhdsSet_Iic (h : a < b) : Iic b ∈ 𝓝ˢ (Iic a) :=
Ici_mem_nhdsSet_Ici (α := αᵒᵈ) h
/-!
### Lemmas about `Ixx _ ?_ ∈ 𝓝ˢ (Set.Icc _ _)`
-/
theorem Ioi_mem_nhdsSet_Icc (h : a < b) : Ioi a ∈ 𝓝ˢ (Icc b c) :=
nhdsSet_mono Icc_subset_Ici_self <| Ioi_mem_nhdsSet_Ici h
theorem Ici_mem_nhdsSet_Icc (h : a < b) : Ici a ∈ 𝓝ˢ (Icc b c) :=
mem_of_superset (Ioi_mem_nhdsSet_Icc h) Ioi_subset_Ici_self
theorem Iio_mem_nhdsSet_Icc (h : b < c) : Iio c ∈ 𝓝ˢ (Icc a b) :=
nhdsSet_mono Icc_subset_Iic_self <| Iio_mem_nhdsSet_Iic h
theorem Iic_mem_nhdsSet_Icc (h : b < c) : Iic c ∈ 𝓝ˢ (Icc a b) :=
mem_of_superset (Iio_mem_nhdsSet_Icc h) Iio_subset_Iic_self
theorem Ioo_mem_nhdsSet_Icc (h : a < b) (h' : c < d) : Ioo a d ∈ 𝓝ˢ (Icc b c) :=
inter_mem (Ioi_mem_nhdsSet_Icc h) (Iio_mem_nhdsSet_Icc h')
theorem Ico_mem_nhdsSet_Icc (h : a < b) (h' : c < d) : Ico a d ∈ 𝓝ˢ (Icc b c) :=
inter_mem (Ici_mem_nhdsSet_Icc h) (Iio_mem_nhdsSet_Icc h')
theorem Ioc_mem_nhdsSet_Icc (h : a < b) (h' : c < d) : Ioc a d ∈ 𝓝ˢ (Icc b c) :=
inter_mem (Ioi_mem_nhdsSet_Icc h) (Iic_mem_nhdsSet_Icc h')
theorem Icc_mem_nhdsSet_Icc (h : a < b) (h' : c < d) : Icc a d ∈ 𝓝ˢ (Icc b c) :=
inter_mem (Ici_mem_nhdsSet_Icc h) (Iic_mem_nhdsSet_Icc h')
/-!
### Lemmas about `Ixx _ ?_ ∈ 𝓝ˢ (Set.Ico _ _)`
-/
theorem Ici_mem_nhdsSet_Ico (h : a < b) : Ici a ∈ 𝓝ˢ (Ico b c) :=
nhdsSet_mono Ico_subset_Icc_self <| Ici_mem_nhdsSet_Icc h
theorem Ioi_mem_nhdsSet_Ico (h : a < b) : Ioi a ∈ 𝓝ˢ (Ico b c) :=
nhdsSet_mono Ico_subset_Icc_self <| Ioi_mem_nhdsSet_Icc h
theorem Iio_mem_nhdsSet_Ico (h : b ≤ c) : Iio c ∈ 𝓝ˢ (Ico a b) :=
nhdsSet_mono Ico_subset_Iio_self <| by simpa
theorem Iic_mem_nhdsSet_Ico (h : b ≤ c) : Iic c ∈ 𝓝ˢ (Ico a b) :=
mem_of_superset (Iio_mem_nhdsSet_Ico h) Iio_subset_Iic_self
theorem Ioo_mem_nhdsSet_Ico (h : a < b) (h' : c ≤ d) : Ioo a d ∈ 𝓝ˢ (Ico b c) :=
inter_mem (Ioi_mem_nhdsSet_Ico h) (Iio_mem_nhdsSet_Ico h')
theorem Icc_mem_nhdsSet_Ico (h : a < b) (h' : c ≤ d) : Icc a d ∈ 𝓝ˢ (Ico b c) :=
inter_mem (Ici_mem_nhdsSet_Ico h) (Iic_mem_nhdsSet_Ico h')
theorem Ioc_mem_nhdsSet_Ico (h : a < b) (h' : c ≤ d) : Ioc a d ∈ 𝓝ˢ (Ico b c) :=
inter_mem (Ioi_mem_nhdsSet_Ico h) (Iic_mem_nhdsSet_Ico h')
theorem Ico_mem_nhdsSet_Ico (h : a < b) (h' : c ≤ d) : Ico a d ∈ 𝓝ˢ (Ico b c) :=
inter_mem (Ici_mem_nhdsSet_Ico h) (Iio_mem_nhdsSet_Ico h')
/-!
### Lemmas about `Ixx _ ?_ ∈ 𝓝ˢ (Set.Ioc _ _)`
-/
theorem Ioi_mem_nhdsSet_Ioc (h : a ≤ b) : Ioi a ∈ 𝓝ˢ (Ioc b c) :=
nhdsSet_mono Ioc_subset_Ioi_self <| by simpa
theorem Iio_mem_nhdsSet_Ioc (h : b < c) : Iio c ∈ 𝓝ˢ (Ioc a b) :=
nhdsSet_mono Ioc_subset_Icc_self <| Iio_mem_nhdsSet_Icc h
theorem Ici_mem_nhdsSet_Ioc (h : a ≤ b) : Ici a ∈ 𝓝ˢ (Ioc b c) :=
mem_of_superset (Ioi_mem_nhdsSet_Ioc h) Ioi_subset_Ici_self
theorem Iic_mem_nhdsSet_Ioc (h : b < c) : Iic c ∈ 𝓝ˢ (Ioc a b) :=
nhdsSet_mono Ioc_subset_Icc_self <| Iic_mem_nhdsSet_Icc h
theorem Ioo_mem_nhdsSet_Ioc (h : a ≤ b) (h' : c < d) : Ioo a d ∈ 𝓝ˢ (Ioc b c) :=
inter_mem (Ioi_mem_nhdsSet_Ioc h) (Iio_mem_nhdsSet_Ioc h')
theorem Icc_mem_nhdsSet_Ioc (h : a ≤ b) (h' : c < d) : Icc a d ∈ 𝓝ˢ (Ioc b c) :=
inter_mem (Ici_mem_nhdsSet_Ioc h) (Iic_mem_nhdsSet_Ioc h')
theorem Ioc_mem_nhdsSet_Ioc (h : a ≤ b) (h' : c < d) : Ioc a d ∈ 𝓝ˢ (Ioc b c) :=
inter_mem (Ioi_mem_nhdsSet_Ioc h) (Iic_mem_nhdsSet_Ioc h')
theorem Ico_mem_nhdsSet_Ioc (h : a ≤ b) (h' : c < d) : Ico a d ∈ 𝓝ˢ (Ioc b c) :=
inter_mem (Ici_mem_nhdsSet_Ioc h) (Iio_mem_nhdsSet_Ioc h')
end OrderClosedTopology
/-!
### Filter bases of `𝓝ˢ (Iic a)` and `𝓝ˢ (Ici a)`
-/
variable {α : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
theorem hasBasis_nhdsSet_Iic_Iio (a : α) [h : Nonempty (Ioi a)] :
HasBasis (𝓝ˢ (Iic a)) (a < ·) Iio := by
refine ⟨fun s ↦ ⟨fun hs ↦ ?_, fun ⟨b, hab, hb⟩ ↦ mem_of_superset (Iio_mem_nhdsSet_Iic hab) hb⟩⟩
rw [nhdsSet_Iic, mem_sup, mem_principal] at hs
rcases exists_Ico_subset_of_mem_nhds hs.1 (Set.nonempty_coe_sort.1 h) with ⟨b, hab, hbs⟩
exact ⟨b, hab, Iio_subset_Iio_union_Ico.trans (union_subset hs.2 hbs)⟩
theorem hasBasis_nhdsSet_Iic_Iic (a : α) [NeBot (𝓝[>] a)] :
HasBasis (𝓝ˢ (Iic a)) (a < ·) Iic := by
have : Nonempty (Ioi a) :=
(Filter.nonempty_of_mem (self_mem_nhdsWithin : Ioi a ∈ 𝓝[>] a)).to_subtype
refine (hasBasis_nhdsSet_Iic_Iio _).to_hasBasis
(fun c hc ↦ ?_) (fun _ h ↦ ⟨_, h, Iio_subset_Iic_self⟩)
simpa only [Iic_subset_Iio] using Filter.nonempty_of_mem (Ioo_mem_nhdsGT hc)
@[simp]
theorem Iic_mem_nhdsSet_Iic_iff {a b : α} [NeBot (𝓝[>] b)] : Iic a ∈ 𝓝ˢ (Iic b) ↔ b < a :=
(hasBasis_nhdsSet_Iic_Iic b).mem_iff.trans
⟨fun ⟨_c, hbc, hca⟩ ↦ hbc.trans_le (Iic_subset_Iic.1 hca), fun h ↦ ⟨_, h, Subset.rfl⟩⟩
theorem hasBasis_nhdsSet_Ici_Ioi (a : α) [Nonempty (Iio a)] :
HasBasis (𝓝ˢ (Ici a)) (· < a) Ioi :=
have : Nonempty (Ioi (toDual a)) := ‹_›; hasBasis_nhdsSet_Iic_Iio (toDual a)
theorem hasBasis_nhdsSet_Ici_Ici (a : α) [NeBot (𝓝[<] a)] :
HasBasis (𝓝ˢ (Ici a)) (· < a) Ici :=
have : NeBot (𝓝[>] (toDual a)) := ‹_›; hasBasis_nhdsSet_Iic_Iic (toDual a)
@[simp]
theorem Ici_mem_nhdsSet_Ici_iff {a b : α} [NeBot (𝓝[<] b)] : Ici a ∈ 𝓝ˢ (Ici b) ↔ a < b :=
have : NeBot (𝓝[>] (toDual b)) := ‹_›; Iic_mem_nhdsSet_Iic_iff (a := toDual a) (b := toDual b) |
.lake/packages/mathlib/Mathlib/Topology/Order/UpperLowerSetTopology.lean | import Mathlib.Logic.Lemmas
import Mathlib.Topology.AlexandrovDiscrete
import Mathlib.Topology.ContinuousMap.Basic
import Mathlib.Topology.Order.LowerUpperTopology
/-!
# Upper and lower sets topologies
This file introduces the upper set topology on a preorder as the topology where the open sets are
the upper sets and the lower set topology on a preorder as the topology where the open sets are
the lower sets.
In general the upper set topology does not coincide with the upper topology and the lower set
topology does not coincide with the lower topology.
## Main statements
- `Topology.IsUpperSet.toAlexandrovDiscrete`: The upper set topology is Alexandrov-discrete.
- `Topology.IsUpperSet.isClosed_iff_isLower` - a set is closed if and only if it is a Lower set
- `Topology.IsUpperSet.closure_eq_lowerClosure` - topological closure coincides with lower closure
- `Topology.IsUpperSet.monotone_iff_continuous` - the continuous functions are the monotone
functions
- `IsUpperSet.monotone_to_upperTopology_continuous`: A monotone map from a preorder with the upper
set topology to a preorder with the upper topology is continuous.
We provide the upper set topology in three ways (and similarly for the lower set topology):
* `Topology.upperSet`: The upper set topology as a `TopologicalSpace α`
* `Topology.IsUpperSet`: Prop-valued mixin typeclass stating that an existing topology is the upper
set topology.
* `Topology.WithUpperSet`: Type synonym equipping a preorder with its upper set topology.
## Motivation
An Alexandrov topology is a topology where the intersection of any collection of open sets is open.
The upper set topology is an Alexandrov topology and, given any Alexandrov topological space, we can
equip it with a preorder (namely the specialization preorder) whose upper set topology coincides
with the original topology. See `Topology.Specialization`.
## Tags
upper set topology, lower set topology, preorder, Alexandrov
-/
open Set TopologicalSpace Filter
variable {α β γ : Type*}
namespace Topology
/-- Topology whose open sets are upper sets.
Note: In general the upper set topology does not coincide with the upper topology. -/
def upperSet (α : Type*) [Preorder α] : TopologicalSpace α where
IsOpen := IsUpperSet
isOpen_univ := isUpperSet_univ
isOpen_inter _ _ := IsUpperSet.inter
isOpen_sUnion _ := isUpperSet_sUnion
/-- Topology whose open sets are lower sets.
Note: In general the lower set topology does not coincide with the lower topology. -/
def lowerSet (α : Type*) [Preorder α] : TopologicalSpace α where
IsOpen := IsLowerSet
isOpen_univ := isLowerSet_univ
isOpen_inter _ _ := IsLowerSet.inter
isOpen_sUnion _ := isLowerSet_sUnion
/-- Type synonym for a preorder equipped with the upper set topology. -/
def WithUpperSet (α : Type*) := α
namespace WithUpperSet
/-- `toUpperSet` is the identity function to the `WithUpperSet` of a type. -/
@[match_pattern] def toUpperSet : α ≃ WithUpperSet α := Equiv.refl _
/-- `ofUpperSet` is the identity function from the `WithUpperSet` of a type. -/
@[match_pattern] def ofUpperSet : WithUpperSet α ≃ α := Equiv.refl _
@[simp] lemma toUpperSet_symm : (@toUpperSet α).symm = ofUpperSet := rfl
@[simp] lemma ofUpperSet_symm : (@ofUpperSet α).symm = toUpperSet := rfl
@[simp] lemma toUpperSet_ofUpperSet (a : WithUpperSet α) : toUpperSet (ofUpperSet a) = a := rfl
@[simp] lemma ofUpperSet_toUpperSet (a : α) : ofUpperSet (toUpperSet a) = a := rfl
lemma toUpperSet_inj {a b : α} : toUpperSet a = toUpperSet b ↔ a = b := Iff.rfl
lemma ofUpperSet_inj {a b : WithUpperSet α} : ofUpperSet a = ofUpperSet b ↔ a = b := Iff.rfl
/-- A recursor for `WithUpperSet`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithUpperSet α → Sort*} (h : ∀ a, β (toUpperSet a)) : ∀ a, β a :=
fun a => h (ofUpperSet a)
instance [Nonempty α] : Nonempty (WithUpperSet α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithUpperSet α) := ‹Inhabited α›
variable [Preorder α] [Preorder β]
instance : Preorder (WithUpperSet α) := ‹Preorder α›
instance : TopologicalSpace (WithUpperSet α) := upperSet α
lemma ofUpperSet_le_iff {a b : WithUpperSet α} : ofUpperSet a ≤ ofUpperSet b ↔ a ≤ b := Iff.rfl
lemma toUpperSet_le_iff {a b : α} : toUpperSet a ≤ toUpperSet b ↔ a ≤ b := Iff.rfl
/-- `ofUpperSet` as an `OrderIso` -/
def ofUpperSetOrderIso : WithUpperSet α ≃o α where
toEquiv := ofUpperSet
map_rel_iff' := ofUpperSet_le_iff
/-- `toUpperSet` as an `OrderIso` -/
def toUpperSetOrderIso : α ≃o WithUpperSet α where
toEquiv := toUpperSet
map_rel_iff' := toUpperSet_le_iff
end WithUpperSet
/-- Type synonym for a preorder equipped with the lower set topology. -/
def WithLowerSet (α : Type*) := α
namespace WithLowerSet
/-- `toLowerSet` is the identity function to the `WithLowerSet` of a type. -/
@[match_pattern] def toLowerSet : α ≃ WithLowerSet α := Equiv.refl _
/-- `ofLowerSet` is the identity function from the `WithLowerSet` of a type. -/
@[match_pattern] def ofLowerSet : WithLowerSet α ≃ α := Equiv.refl _
@[simp] lemma toLowerSet_symm : (@toLowerSet α).symm = ofLowerSet := rfl
@[simp] lemma ofLowerSet_symm : (@ofLowerSet α).symm = toLowerSet := rfl
@[simp] lemma toLowerSet_ofLowerSet (a : WithLowerSet α) : toLowerSet (ofLowerSet a) = a := rfl
@[simp] lemma ofLowerSet_toLowerSet (a : α) : ofLowerSet (toLowerSet a) = a := rfl
lemma toLowerSet_inj {a b : α} : toLowerSet a = toLowerSet b ↔ a = b := Iff.rfl
lemma ofLowerSet_inj {a b : WithLowerSet α} : ofLowerSet a = ofLowerSet b ↔ a = b := Iff.rfl
/-- A recursor for `WithLowerSet`. Use as `induction x`. -/
@[elab_as_elim, cases_eliminator, induction_eliminator]
protected def rec {β : WithLowerSet α → Sort*} (h : ∀ a, β (toLowerSet a)) : ∀ a, β a :=
fun a => h (ofLowerSet a)
instance [Nonempty α] : Nonempty (WithLowerSet α) := ‹Nonempty α›
instance [Inhabited α] : Inhabited (WithLowerSet α) := ‹Inhabited α›
variable [Preorder α]
instance : Preorder (WithLowerSet α) := ‹Preorder α›
instance : TopologicalSpace (WithLowerSet α) := lowerSet α
lemma ofLowerSet_le_iff {a b : WithLowerSet α} : ofLowerSet a ≤ ofLowerSet b ↔ a ≤ b := Iff.rfl
lemma toLowerSet_le_iff {a b : α} : toLowerSet a ≤ toLowerSet b ↔ a ≤ b := Iff.rfl
/-- `ofLowerSet` as an `OrderIso` -/
def ofLowerSetOrderIso : WithLowerSet α ≃o α where
toEquiv := ofLowerSet
map_rel_iff' := ofLowerSet_le_iff
/-- `toLowerSet` as an `OrderIso` -/
def toLowerSetOrderIso : α ≃o WithLowerSet α where
toEquiv := toLowerSet
map_rel_iff' := toLowerSet_le_iff
end WithLowerSet
/--
The Upper Set topology is homeomorphic to the Lower Set topology on the dual order
-/
def WithUpperSet.toDualHomeomorph [Preorder α] : WithUpperSet α ≃ₜ WithLowerSet αᵒᵈ where
toFun := OrderDual.toDual
invFun := OrderDual.ofDual
left_inv := OrderDual.toDual_ofDual
right_inv := OrderDual.ofDual_toDual
continuous_toFun := continuous_coinduced_rng
continuous_invFun := continuous_coinduced_rng
/-- Prop-valued mixin for an ordered topological space to be
The upper set topology is the topology where the open sets are the upper sets. In general the upper
set topology does not coincide with the upper topology.
-/
protected class IsUpperSet (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where
topology_eq_upperSetTopology : t = upperSet α
attribute [nolint docBlame] IsUpperSet.topology_eq_upperSetTopology
instance [Preorder α] : Topology.IsUpperSet (WithUpperSet α) := ⟨rfl⟩
instance [Preorder α] : @Topology.IsUpperSet α (upperSet α) _ := by
letI := upperSet α
exact ⟨rfl⟩
/--
The lower set topology is the topology where the open sets are the lower sets. In general the lower
set topology does not coincide with the lower topology.
-/
protected class IsLowerSet (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop where
topology_eq_lowerSetTopology : t = lowerSet α
attribute [nolint docBlame] IsLowerSet.topology_eq_lowerSetTopology
instance [Preorder α] : Topology.IsLowerSet (WithLowerSet α) := ⟨rfl⟩
instance [Preorder α] : @Topology.IsLowerSet α (lowerSet α) _ := by
letI := lowerSet α
exact ⟨rfl⟩
namespace IsUpperSet
section Preorder
variable (α)
variable [Preorder α] [TopologicalSpace α] [Topology.IsUpperSet α] {s : Set α}
lemma topology_eq : ‹_› = upperSet α := topology_eq_upperSetTopology
variable {α}
instance _root_.OrderDual.instIsLowerSet [Preorder α] [TopologicalSpace α] [Topology.IsUpperSet α] :
Topology.IsLowerSet αᵒᵈ where
topology_eq_lowerSetTopology := by ext; rw [IsUpperSet.topology_eq α]
/-- If `α` is equipped with the upper set topology, then it is homeomorphic to
`WithUpperSet α`. -/
def WithUpperSetHomeomorph : WithUpperSet α ≃ₜ α :=
WithUpperSet.ofUpperSet.toHomeomorphOfIsInducing ⟨topology_eq α ▸ induced_id.symm⟩
lemma isOpen_iff_isUpperSet : IsOpen s ↔ IsUpperSet s := by
rw [topology_eq α]
rfl
instance toAlexandrovDiscrete : AlexandrovDiscrete α where
isOpen_sInter S := by simpa only [isOpen_iff_isUpperSet] using isUpperSet_sInter (α := α)
-- c.f. isClosed_iff_lower_and_subset_implies_LUB_mem
lemma isClosed_iff_isLower : IsClosed s ↔ IsLowerSet s := by
rw [← isOpen_compl_iff, isOpen_iff_isUpperSet,
isLowerSet_compl.symm, compl_compl]
lemma closure_eq_lowerClosure {s : Set α} : closure s = lowerClosure s := by
rw [subset_antisymm_iff]
refine ⟨?_, lowerClosure_min subset_closure (isClosed_iff_isLower.1 isClosed_closure)⟩
· apply closure_minimal subset_lowerClosure _
rw [isClosed_iff_isLower]
exact LowerSet.lower (lowerClosure s)
/--
The closure of a singleton `{a}` in the upper set topology is the right-closed left-infinite
interval (-∞,a].
-/
@[simp] lemma closure_singleton {a : α} : closure {a} = Iic a := by
rw [closure_eq_lowerClosure, lowerClosure_singleton]
rfl
lemma specializes_iff_le {a b : α} : a ⤳ b ↔ b ≤ a := by
simp only [specializes_iff_closure_subset, closure_singleton, Iic_subset_Iic]
lemma nhdsKer_eq_upperClosure (s : Set α) : nhdsKer s = ↑(upperClosure s) := by
ext; simp [mem_nhdsKer_iff_specializes, specializes_iff_le]
@[simp] lemma nhdsKer_singleton (a : α) : nhdsKer {a} = Ici a := by
rw [nhdsKer_eq_upperClosure, upperClosure_singleton, UpperSet.coe_Ici]
lemma nhds_eq_principal_Ici (a : α) : 𝓝 a = 𝓟 (Ici a) := by
rw [← principal_nhdsKer_singleton, nhdsKer_singleton]
lemma nhdsSet_eq_principal_upperClosure (s : Set α) : 𝓝ˢ s = 𝓟 ↑(upperClosure s) := by
rw [← principal_nhdsKer, nhdsKer_eq_upperClosure]
end Preorder
protected lemma _root_.Topology.isUpperSet_iff_nhds {α : Type*} [TopologicalSpace α] [Preorder α] :
Topology.IsUpperSet α ↔ (∀ a : α, 𝓝 a = 𝓟 (Ici a)) where
mp _ a := nhds_eq_principal_Ici a
mpr hα := ⟨by simp [TopologicalSpace.ext_iff_nhds, hα, nhds_eq_principal_Ici]⟩
instance : Topology.IsUpperSet Prop := by
simp [Topology.isUpperSet_iff_nhds, Prop.forall]
section maps
variable [Preorder α] [Preorder β]
open Topology
protected lemma monotone_iff_continuous [TopologicalSpace α] [TopologicalSpace β]
[Topology.IsUpperSet α] [Topology.IsUpperSet β] {f : α → β} : Monotone f ↔ Continuous f := by
constructor
· intro hf
simp_rw [continuous_def, isOpen_iff_isUpperSet]
exact fun _ hs ↦ IsUpperSet.preimage hs hf
· intro hf a b hab
rw [← mem_Iic, ← closure_singleton] at hab ⊢
apply Continuous.closure_preimage_subset hf {f b}
apply mem_of_mem_of_subset hab
apply closure_mono
rw [singleton_subset_iff, mem_preimage, mem_singleton_iff]
lemma monotone_to_upperTopology_continuous [TopologicalSpace α] [TopologicalSpace β]
[Topology.IsUpperSet α] [IsUpper β] {f : α → β} (hf : Monotone f) : Continuous f := by
simp_rw [continuous_def, isOpen_iff_isUpperSet]
intro s hs
exact (IsUpper.isUpperSet_of_isOpen hs).preimage hf
lemma upperSet_le_upper {t₁ t₂ : TopologicalSpace α} [@Topology.IsUpperSet α t₁ _]
[@Topology.IsUpper α t₂ _] : t₁ ≤ t₂ := fun s hs => by
rw [@isOpen_iff_isUpperSet α _ t₁]
exact IsUpper.isUpperSet_of_isOpen hs
end maps
end IsUpperSet
namespace IsLowerSet
section Preorder
variable (α)
variable [Preorder α] [TopologicalSpace α] [Topology.IsLowerSet α] {s : Set α}
lemma topology_eq : ‹_› = lowerSet α := topology_eq_lowerSetTopology
variable {α}
instance _root_.OrderDual.instIsUpperSet [Preorder α] [TopologicalSpace α] [Topology.IsLowerSet α] :
Topology.IsUpperSet αᵒᵈ where
topology_eq_upperSetTopology := by ext; rw [IsLowerSet.topology_eq α]
/-- If `α` is equipped with the lower set topology, then it is homeomorphic to `WithLowerSet α`. -/
def WithLowerSetHomeomorph : WithLowerSet α ≃ₜ α :=
WithLowerSet.ofLowerSet.toHomeomorphOfIsInducing ⟨topology_eq α ▸ induced_id.symm⟩
lemma isOpen_iff_isLowerSet : IsOpen s ↔ IsLowerSet s := by rw [topology_eq α]; rfl
instance toAlexandrovDiscrete : AlexandrovDiscrete α := IsUpperSet.toAlexandrovDiscrete (α := αᵒᵈ)
lemma isClosed_iff_isUpper : IsClosed s ↔ IsUpperSet s := by
rw [← isOpen_compl_iff, isOpen_iff_isLowerSet, isUpperSet_compl.symm, compl_compl]
lemma closure_eq_upperClosure {s : Set α} : closure s = upperClosure s :=
IsUpperSet.closure_eq_lowerClosure (α := αᵒᵈ)
/--
The closure of a singleton `{a}` in the lower set topology is the right-closed left-infinite
interval (-∞,a].
-/
@[simp] lemma closure_singleton {a : α} : closure {a} = Ici a := by
rw [closure_eq_upperClosure, upperClosure_singleton]
rfl
lemma specializes_iff_le {a b : α} : a ⤳ b ↔ a ≤ b := by
simp only [specializes_iff_closure_subset, closure_singleton, Ici_subset_Ici]
lemma nhdsKer_eq_lowerClosure (s : Set α) : nhdsKer s = ↑(lowerClosure s) := by
ext; simp [mem_nhdsKer_iff_specializes, specializes_iff_le]
@[simp] lemma nhdsKer_singleton (a : α) : nhdsKer {a} = Iic a := by
rw [nhdsKer_eq_lowerClosure, lowerClosure_singleton, LowerSet.coe_Iic]
lemma nhds_eq_principal_Iic (a : α) : 𝓝 a = 𝓟 (Iic a) := by
rw [← principal_nhdsKer_singleton, nhdsKer_singleton]
lemma nhdsSet_eq_principal_lowerClosure (s : Set α) : 𝓝ˢ s = 𝓟 ↑(lowerClosure s) := by
rw [← principal_nhdsKer, nhdsKer_eq_lowerClosure]
end Preorder
protected lemma _root_.Topology.isLowerSet_iff_nhds {α : Type*} [TopologicalSpace α] [Preorder α] :
Topology.IsLowerSet α ↔ (∀ a : α, 𝓝 a = 𝓟 (Iic a)) where
mp _ a := nhds_eq_principal_Iic a
mpr hα := ⟨by simp [TopologicalSpace.ext_iff_nhds, hα, nhds_eq_principal_Iic]⟩
section maps
variable [Preorder α] [Preorder β]
open Topology
open OrderDual
protected lemma monotone_iff_continuous [TopologicalSpace α] [TopologicalSpace β]
[Topology.IsLowerSet α] [Topology.IsLowerSet β] {f : α → β} : Monotone f ↔ Continuous f := by
rw [← monotone_dual_iff]
exact IsUpperSet.monotone_iff_continuous (α := αᵒᵈ) (β := βᵒᵈ)
(f := (toDual ∘ f ∘ ofDual : αᵒᵈ → βᵒᵈ))
lemma monotone_to_lowerTopology_continuous [TopologicalSpace α] [TopologicalSpace β]
[Topology.IsLowerSet α] [IsLower β] {f : α → β} (hf : Monotone f) : Continuous f :=
IsUpperSet.monotone_to_upperTopology_continuous (α := αᵒᵈ) (β := βᵒᵈ) hf.dual
lemma lowerSet_le_lower {t₁ t₂ : TopologicalSpace α} [@Topology.IsLowerSet α t₁ _]
[@IsLower α t₂ _] : t₁ ≤ t₂ := fun s hs => by
rw [@isOpen_iff_isLowerSet α _ t₁]
exact IsLower.isLowerSet_of_isOpen hs
end maps
end IsLowerSet
lemma isUpperSet_orderDual [Preorder α] [TopologicalSpace α] :
Topology.IsUpperSet αᵒᵈ ↔ Topology.IsLowerSet α := by
constructor
· apply OrderDual.instIsLowerSet
· apply OrderDual.instIsUpperSet
lemma isLowerSet_orderDual [Preorder α] [TopologicalSpace α] :
Topology.IsLowerSet αᵒᵈ ↔ Topology.IsUpperSet α := isUpperSet_orderDual.symm
namespace WithUpperSet
variable [Preorder α] [Preorder β] [Preorder γ]
/-- A monotone map between preorders spaces induces a continuous map between themselves considered
with the upper set topology. -/
def map (f : α →o β) : C(WithUpperSet α, WithUpperSet β) where
toFun := toUpperSet ∘ f ∘ ofUpperSet
continuous_toFun := continuous_def.2 fun _s hs ↦ IsUpperSet.preimage hs f.monotone
@[simp] lemma map_id : map (OrderHom.id : α →o α) = ContinuousMap.id _ := rfl
@[simp] lemma map_comp (g : β →o γ) (f : α →o β) : map (g.comp f) = (map g).comp (map f) := rfl
@[simp] lemma toUpperSet_specializes_toUpperSet {a b : α} :
toUpperSet a ⤳ toUpperSet b ↔ b ≤ a := by
simp_rw [specializes_iff_closure_subset, IsUpperSet.closure_singleton, Iic_subset_Iic,
toUpperSet_le_iff]
@[simp] lemma ofUpperSet_le_ofUpperSet {a b : WithUpperSet α} :
ofUpperSet a ≤ ofUpperSet b ↔ b ⤳ a := toUpperSet_specializes_toUpperSet.symm
@[simp] lemma isUpperSet_toUpperSet_preimage {s : Set (WithUpperSet α)} :
IsUpperSet (toUpperSet ⁻¹' s) ↔ IsOpen s := Iff.rfl
@[simp] lemma isOpen_ofUpperSet_preimage {s : Set α} :
IsOpen (ofUpperSet ⁻¹' s) ↔ IsUpperSet s := isUpperSet_toUpperSet_preimage.symm
end WithUpperSet
namespace WithLowerSet
variable [Preorder α] [Preorder β] [Preorder γ]
/-- A monotone map between preorders spaces induces a continuous map between themselves considered
with the lower set topology. -/
def map (f : α →o β) : C(WithLowerSet α, WithLowerSet β) where
toFun := toLowerSet ∘ f ∘ ofLowerSet
continuous_toFun := continuous_def.2 fun _s hs ↦ IsLowerSet.preimage hs f.monotone
@[simp] lemma map_id : map (OrderHom.id : α →o α) = ContinuousMap.id _ := rfl
@[simp] lemma map_comp (g : β →o γ) (f : α →o β) : map (g.comp f) = (map g).comp (map f) := rfl
@[simp] lemma toLowerSet_specializes_toLowerSet {a b : α} :
toLowerSet a ⤳ toLowerSet b ↔ a ≤ b := by
simp_rw [specializes_iff_closure_subset, IsLowerSet.closure_singleton, Ici_subset_Ici,
toLowerSet_le_iff]
@[simp] lemma ofLowerSet_le_ofLowerSet {a b : WithLowerSet α} :
ofLowerSet a ≤ ofLowerSet b ↔ a ⤳ b := toLowerSet_specializes_toLowerSet.symm
@[simp] lemma isLowerSet_toLowerSet_preimage {s : Set (WithLowerSet α)} :
IsLowerSet (toLowerSet ⁻¹' s) ↔ IsOpen s := Iff.rfl
@[simp] lemma isOpen_ofLowerSet_preimage {s : Set α} :
IsOpen (ofLowerSet ⁻¹' s) ↔ IsLowerSet s := isLowerSet_toLowerSet_preimage.symm
end WithLowerSet
end Topology |
.lake/packages/mathlib/Mathlib/Topology/Order/LeftRightNhds.lean | import Mathlib.Algebra.Ring.Pointwise.Set
import Mathlib.Order.Filter.AtTopBot.CompleteLattice
import Mathlib.Order.Filter.AtTopBot.Group
import Mathlib.Topology.Order.Basic
/-!
# Neighborhoods to the left and to the right on an `OrderTopology`
We've seen some properties of left and right neighborhood of a point in an `OrderClosedTopology`.
In an `OrderTopology`, such neighborhoods can be characterized as the sets containing suitable
intervals to the right or to the left of `a`. We give now these characterizations. -/
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α β γ : Type*}
section LinearOrder
variable [TopologicalSpace α] [LinearOrder α]
section OrderTopology
variable [OrderTopology α]
open List in
/-- The following statements are equivalent:
0. `s` is a neighborhood of `a` within `(a, +∞)`;
1. `s` is a neighborhood of `a` within `(a, b]`;
2. `s` is a neighborhood of `a` within `(a, b)`;
3. `s` includes `(a, u)` for some `u ∈ (a, b]`;
4. `s` includes `(a, u)` for some `u > a`.
-/
theorem TFAE_mem_nhdsGT {a b : α} (hab : a < b) (s : Set α) :
TFAE [s ∈ 𝓝[>] a,
s ∈ 𝓝[Ioc a b] a,
s ∈ 𝓝[Ioo a b] a,
∃ u ∈ Ioc a b, Ioo a u ⊆ s,
∃ u ∈ Ioi a, Ioo a u ⊆ s] := by
tfae_have 1 ↔ 2 := by
rw [nhdsWithin_Ioc_eq_nhdsGT hab]
tfae_have 1 ↔ 3 := by
rw [nhdsWithin_Ioo_eq_nhdsGT hab]
tfae_have 4 → 5 := fun ⟨u, umem, hu⟩ => ⟨u, umem.1, hu⟩
tfae_have 5 → 1
| ⟨u, hau, hu⟩ => mem_of_superset (Ioo_mem_nhdsGT hau) hu
tfae_have 1 → 4
| h => by
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 h with ⟨v, va, hv⟩
rcases exists_Ico_subset_of_mem_nhds' va hab with ⟨u, au, hu⟩
exact ⟨u, au, fun x hx => hv ⟨hu ⟨le_of_lt hx.1, hx.2⟩, hx.1⟩⟩
tfae_finish
theorem mem_nhdsGT_iff_exists_mem_Ioc_Ioo_subset {a u' : α} {s : Set α} (hu' : a < u') :
s ∈ 𝓝[>] a ↔ ∃ u ∈ Ioc a u', Ioo a u ⊆ s :=
(TFAE_mem_nhdsGT hu' s).out 0 3
/-- A set is a neighborhood of `a` within `(a, +∞)` if and only if it contains an interval `(a, u)`
with `a < u < u'`, provided `a` is not a top element. -/
theorem mem_nhdsGT_iff_exists_Ioo_subset' {a u' : α} {s : Set α} (hu' : a < u') :
s ∈ 𝓝[>] a ↔ ∃ u ∈ Ioi a, Ioo a u ⊆ s :=
(TFAE_mem_nhdsGT hu' s).out 0 4
theorem nhdsGT_basis_of_exists_gt {a : α} (h : ∃ b, a < b) : (𝓝[>] a).HasBasis (a < ·) (Ioo a) :=
let ⟨_, h⟩ := h
⟨fun _ => mem_nhdsGT_iff_exists_Ioo_subset' h⟩
lemma nhdsGT_basis [NoMaxOrder α] (a : α) : (𝓝[>] a).HasBasis (a < ·) (Ioo a) :=
nhdsGT_basis_of_exists_gt <| exists_gt a
theorem nhdsGT_eq_bot_iff {a : α} : 𝓝[>] a = ⊥ ↔ IsTop a ∨ ∃ b, a ⋖ b := by
by_cases ha : IsTop a
· simp [ha, ha.isMax.Ioi_eq]
· simp only [ha, false_or]
rw [isTop_iff_isMax, not_isMax_iff] at ha
simp only [(nhdsGT_basis_of_exists_gt ha).eq_bot_iff, covBy_iff_Ioo_eq]
/-- A set is a neighborhood of `a` within `(a, +∞)` if and only if it contains an interval `(a, u)`
with `a < u`. -/
theorem mem_nhdsGT_iff_exists_Ioo_subset [NoMaxOrder α] {a : α} {s : Set α} :
s ∈ 𝓝[>] a ↔ ∃ u ∈ Ioi a, Ioo a u ⊆ s :=
let ⟨_u', hu'⟩ := exists_gt a
mem_nhdsGT_iff_exists_Ioo_subset' hu'
/-- The set of points which are isolated on the right is countable when the space is
second-countable. -/
theorem countable_setOf_isolated_right [SecondCountableTopology α] :
{ x : α | 𝓝[>] x = ⊥ }.Countable := by
simp only [nhdsGT_eq_bot_iff, setOf_or]
exact (subsingleton_isTop α).countable.union countable_setOf_covBy_right
/-- The set of points which are isolated on the left is countable when the space is
second-countable. -/
theorem countable_setOf_isolated_left [SecondCountableTopology α] :
{ x : α | 𝓝[<] x = ⊥ }.Countable :=
countable_setOf_isolated_right (α := αᵒᵈ)
/-- The set of points in a set which are isolated on the right in this set is countable when the
space is second-countable. -/
theorem countable_setOf_isolated_right_within [SecondCountableTopology α] {s : Set α} :
{ x ∈ s | 𝓝[s ∩ Ioi x] x = ⊥ }.Countable := by
/- This does not follow from `countable_setOf_isolated_right`, which gives the result when `s`
is the whole space, as one cannot use it inside the subspace since it doesn't have the order
topology. Instead, we follow the main steps of its proof. -/
let t := { x ∈ s | 𝓝[s ∩ Ioi x] x = ⊥ ∧ ¬ IsTop x}
suffices H : t.Countable by
have : { x ∈ s | 𝓝[s ∩ Ioi x] x = ⊥ } ⊆ t ∪ {x | IsTop x} := by
intro x hx
by_cases h'x : IsTop x
· simp [h'x]
· simpa [-sep_and, t, h'x]
apply Countable.mono this
simp [H, (subsingleton_isTop α).countable]
have (x) (hx : x ∈ t) : ∃ y > x, s ∩ Ioo x y = ∅ := by
simp only [← empty_mem_iff_bot, mem_nhdsWithin_iff_exists_mem_nhds_inter,
subset_empty_iff, IsTop, not_forall, not_le, mem_setOf_eq, t] at hx
rcases hx.2.1 with ⟨u, hu, h'u⟩
obtain ⟨y, hxy, hy⟩ : ∃ y, x < y ∧ Ico x y ⊆ u := exists_Ico_subset_of_mem_nhds hu hx.2.2
refine ⟨y, hxy, ?_⟩
contrapose! h'u
apply h'u.mono
intro z hz
exact ⟨hy ⟨hz.2.1.le, hz.2.2⟩, hz.1, hz.2.1⟩
choose! y hy h'y using this
apply Set.PairwiseDisjoint.countable_of_Ioo (y := y) _ hy
simp only [PairwiseDisjoint, Set.Pairwise, Function.onFun]
intro a ha b hb hab
wlog H : a < b generalizing a b with h
· have : b < a := lt_of_le_of_ne (not_lt.1 H) hab.symm
exact (h hb ha hab.symm this).symm
have : y a ≤ b := by
by_contra!
have : b ∈ s ∩ Ioo a (y a) := by simp [hb.1, H, this]
simp [h'y a ha] at this
rw [disjoint_iff_forall_ne]
exact fun u hu v hv ↦ ((hu.2.trans_le this).trans hv.1).ne
/-- The set of points in a set which are isolated on the left in this set is countable when the
space is second-countable. -/
theorem countable_setOf_isolated_left_within [SecondCountableTopology α] {s : Set α} :
{ x ∈ s | 𝓝[s ∩ Iio x] x = ⊥ }.Countable :=
countable_setOf_isolated_right_within (α := αᵒᵈ)
/-- A set is a neighborhood of `a` within `(a, +∞)` if and only if it contains an interval `(a, u]`
with `a < u`. -/
theorem mem_nhdsGT_iff_exists_Ioc_subset [NoMaxOrder α] [DenselyOrdered α] {a : α} {s : Set α} :
s ∈ 𝓝[>] a ↔ ∃ u ∈ Ioi a, Ioc a u ⊆ s := by
rw [mem_nhdsGT_iff_exists_Ioo_subset]
constructor
· rintro ⟨u, au, as⟩
rcases exists_between au with ⟨v, hv⟩
exact ⟨v, hv.1, fun x hx => as ⟨hx.1, lt_of_le_of_lt hx.2 hv.2⟩⟩
· rintro ⟨u, au, as⟩
exact ⟨u, au, Subset.trans Ioo_subset_Ioc_self as⟩
open List in
/-- The following statements are equivalent:
0. `s` is a neighborhood of `b` within `(-∞, b)`
1. `s` is a neighborhood of `b` within `[a, b)`
2. `s` is a neighborhood of `b` within `(a, b)`
3. `s` includes `(l, b)` for some `l ∈ [a, b)`
4. `s` includes `(l, b)` for some `l < b` -/
theorem TFAE_mem_nhdsLT {a b : α} (h : a < b) (s : Set α) :
TFAE [s ∈ 𝓝[<] b,-- 0 : `s` is a neighborhood of `b` within `(-∞, b)`
s ∈ 𝓝[Ico a b] b,-- 1 : `s` is a neighborhood of `b` within `[a, b)`
s ∈ 𝓝[Ioo a b] b,-- 2 : `s` is a neighborhood of `b` within `(a, b)`
∃ l ∈ Ico a b, Ioo l b ⊆ s,-- 3 : `s` includes `(l, b)` for some `l ∈ [a, b)`
∃ l ∈ Iio b, Ioo l b ⊆ s] := by-- 4 : `s` includes `(l, b)` for some `l < b`
simpa using TFAE_mem_nhdsGT h.dual (ofDual ⁻¹' s)
theorem mem_nhdsLT_iff_exists_mem_Ico_Ioo_subset {a l' : α} {s : Set α} (hl' : l' < a) :
s ∈ 𝓝[<] a ↔ ∃ l ∈ Ico l' a, Ioo l a ⊆ s :=
(TFAE_mem_nhdsLT hl' s).out 0 3
/-- A set is a neighborhood of `a` within `(-∞, a)` if and only if it contains an interval `(l, a)`
with `l < a`, provided `a` is not a bottom element. -/
theorem mem_nhdsLT_iff_exists_Ioo_subset' {a l' : α} {s : Set α} (hl' : l' < a) :
s ∈ 𝓝[<] a ↔ ∃ l ∈ Iio a, Ioo l a ⊆ s :=
(TFAE_mem_nhdsLT hl' s).out 0 4
/-- A set is a neighborhood of `a` within `(-∞, a)` if and only if it contains an interval `(l, a)`
with `l < a`. -/
theorem mem_nhdsLT_iff_exists_Ioo_subset [NoMinOrder α] {a : α} {s : Set α} :
s ∈ 𝓝[<] a ↔ ∃ l ∈ Iio a, Ioo l a ⊆ s :=
let ⟨_, h⟩ := exists_lt a
mem_nhdsLT_iff_exists_Ioo_subset' h
/-- A set is a neighborhood of `a` within `(-∞, a)` if and only if it contains an interval `[l, a)`
with `l < a`. -/
theorem mem_nhdsLT_iff_exists_Ico_subset [NoMinOrder α] [DenselyOrdered α] {a : α} {s : Set α} :
s ∈ 𝓝[<] a ↔ ∃ l ∈ Iio a, Ico l a ⊆ s := by
have : ofDual ⁻¹' s ∈ 𝓝[>] toDual a ↔ _ := mem_nhdsGT_iff_exists_Ioc_subset
simpa using this
theorem nhdsLT_basis_of_exists_lt {a : α} (h : ∃ b, b < a) : (𝓝[<] a).HasBasis (· < a) (Ioo · a) :=
let ⟨_, h⟩ := h
⟨fun _ => mem_nhdsLT_iff_exists_Ioo_subset' h⟩
theorem nhdsLT_basis [NoMinOrder α] (a : α) : (𝓝[<] a).HasBasis (· < a) (Ioo · a) :=
nhdsLT_basis_of_exists_lt <| exists_lt a
theorem nhdsLT_eq_bot_iff {a : α} : 𝓝[<] a = ⊥ ↔ IsBot a ∨ ∃ b, b ⋖ a := by
convert (config := {preTransparency := .default}) nhdsGT_eq_bot_iff (a := OrderDual.toDual a)
using 4
exact ofDual_covBy_ofDual_iff
open List in
/-- The following statements are equivalent:
0. `s` is a neighborhood of `a` within `[a, +∞)`;
1. `s` is a neighborhood of `a` within `[a, b]`;
2. `s` is a neighborhood of `a` within `[a, b)`;
3. `s` includes `[a, u)` for some `u ∈ (a, b]`;
4. `s` includes `[a, u)` for some `u > a`.
-/
theorem TFAE_mem_nhdsGE {a b : α} (hab : a < b) (s : Set α) :
TFAE [s ∈ 𝓝[≥] a,
s ∈ 𝓝[Icc a b] a,
s ∈ 𝓝[Ico a b] a,
∃ u ∈ Ioc a b, Ico a u ⊆ s,
∃ u ∈ Ioi a, Ico a u ⊆ s] := by
tfae_have 1 ↔ 2 := by
rw [nhdsWithin_Icc_eq_nhdsGE hab]
tfae_have 1 ↔ 3 := by
rw [nhdsWithin_Ico_eq_nhdsGE hab]
tfae_have 1 ↔ 5 := (nhdsGE_basis_of_exists_gt ⟨b, hab⟩).mem_iff
tfae_have 4 → 5 := fun ⟨u, umem, hu⟩ => ⟨u, umem.1, hu⟩
tfae_have 5 → 4
| ⟨u, hua, hus⟩ => ⟨min u b, ⟨lt_min hua hab, min_le_right _ _⟩,
(Ico_subset_Ico_right <| min_le_left _ _).trans hus⟩
tfae_finish
theorem mem_nhdsGE_iff_exists_mem_Ioc_Ico_subset {a u' : α} {s : Set α} (hu' : a < u') :
s ∈ 𝓝[≥] a ↔ ∃ u ∈ Ioc a u', Ico a u ⊆ s :=
(TFAE_mem_nhdsGE hu' s).out 0 3 (by simp) (by simp)
/-- A set is a neighborhood of `a` within `[a, +∞)` if and only if it contains an interval `[a, u)`
with `a < u < u'`, provided `a` is not a top element. -/
theorem mem_nhdsGE_iff_exists_Ico_subset' {a u' : α} {s : Set α} (hu' : a < u') :
s ∈ 𝓝[≥] a ↔ ∃ u ∈ Ioi a, Ico a u ⊆ s :=
(TFAE_mem_nhdsGE hu' s).out 0 4 (by simp) (by simp)
/-- A set is a neighborhood of `a` within `[a, +∞)` if and only if it contains an interval `[a, u)`
with `a < u`. -/
theorem mem_nhdsGE_iff_exists_Ico_subset [NoMaxOrder α] {a : α} {s : Set α} :
s ∈ 𝓝[≥] a ↔ ∃ u ∈ Ioi a, Ico a u ⊆ s :=
let ⟨_, hu'⟩ := exists_gt a
mem_nhdsGE_iff_exists_Ico_subset' hu'
theorem nhdsGE_basis_Ico [NoMaxOrder α] (a : α) : (𝓝[≥] a).HasBasis (fun u => a < u) (Ico a) :=
⟨fun _ => mem_nhdsGE_iff_exists_Ico_subset⟩
/-- The filter of right neighborhoods has a basis of closed intervals. -/
theorem nhdsGE_basis_Icc [NoMaxOrder α] [DenselyOrdered α] {a : α} :
(𝓝[≥] a).HasBasis (a < ·) (Icc a) :=
(nhdsGE_basis _).to_hasBasis
(fun _u hu ↦ (exists_between hu).imp fun _v hv ↦ hv.imp_right Icc_subset_Ico_right) fun u hu ↦
⟨u, hu, Ico_subset_Icc_self⟩
/-- A set is a neighborhood of `a` within `[a, +∞)` if and only if it contains an interval `[a, u]`
with `a < u`. -/
theorem mem_nhdsGE_iff_exists_Icc_subset [NoMaxOrder α] [DenselyOrdered α] {a : α} {s : Set α} :
s ∈ 𝓝[≥] a ↔ ∃ u, a < u ∧ Icc a u ⊆ s :=
nhdsGE_basis_Icc.mem_iff
open List in
/-- The following statements are equivalent:
0. `s` is a neighborhood of `b` within `(-∞, b]`
1. `s` is a neighborhood of `b` within `[a, b]`
2. `s` is a neighborhood of `b` within `(a, b]`
3. `s` includes `(l, b]` for some `l ∈ [a, b)`
4. `s` includes `(l, b]` for some `l < b` -/
theorem TFAE_mem_nhdsLE {a b : α} (h : a < b) (s : Set α) :
TFAE [s ∈ 𝓝[≤] b,-- 0 : `s` is a neighborhood of `b` within `(-∞, b]`
s ∈ 𝓝[Icc a b] b,-- 1 : `s` is a neighborhood of `b` within `[a, b]`
s ∈ 𝓝[Ioc a b] b,-- 2 : `s` is a neighborhood of `b` within `(a, b]`
∃ l ∈ Ico a b, Ioc l b ⊆ s,-- 3 : `s` includes `(l, b]` for some `l ∈ [a, b)`
∃ l ∈ Iio b, Ioc l b ⊆ s] := by-- 4 : `s` includes `(l, b]` for some `l < b`
simpa using TFAE_mem_nhdsGE h.dual (ofDual ⁻¹' s)
theorem mem_nhdsLE_iff_exists_mem_Ico_Ioc_subset {a l' : α} {s : Set α} (hl' : l' < a) :
s ∈ 𝓝[≤] a ↔ ∃ l ∈ Ico l' a, Ioc l a ⊆ s :=
(TFAE_mem_nhdsLE hl' s).out 0 3 (by simp) (by simp)
/-- A set is a neighborhood of `a` within `(-∞, a]` if and only if it contains an interval `(l, a]`
with `l < a`, provided `a` is not a bottom element. -/
theorem mem_nhdsLE_iff_exists_Ioc_subset' {a l' : α} {s : Set α} (hl' : l' < a) :
s ∈ 𝓝[≤] a ↔ ∃ l ∈ Iio a, Ioc l a ⊆ s :=
(TFAE_mem_nhdsLE hl' s).out 0 4 (by simp) (by simp)
/-- A set is a neighborhood of `a` within `(-∞, a]` if and only if it contains an interval `(l, a]`
with `l < a`. -/
theorem mem_nhdsLE_iff_exists_Ioc_subset [NoMinOrder α] {a : α} {s : Set α} :
s ∈ 𝓝[≤] a ↔ ∃ l ∈ Iio a, Ioc l a ⊆ s :=
let ⟨_, hl'⟩ := exists_lt a
mem_nhdsLE_iff_exists_Ioc_subset' hl'
/-- A set is a neighborhood of `a` within `(-∞, a]` if and only if it contains an interval `[l, a]`
with `l < a`. -/
theorem mem_nhdsLE_iff_exists_Icc_subset [NoMinOrder α] [DenselyOrdered α] {a : α}
{s : Set α} : s ∈ 𝓝[≤] a ↔ ∃ l, l < a ∧ Icc l a ⊆ s :=
calc s ∈ 𝓝[≤] a ↔ ofDual ⁻¹' s ∈ 𝓝[≥] (toDual a) := Iff.rfl
_ ↔ ∃ u : α, toDual a < toDual u ∧ Icc (toDual a) (toDual u) ⊆ ofDual ⁻¹' s :=
mem_nhdsGE_iff_exists_Icc_subset
_ ↔ ∃ l, l < a ∧ Icc l a ⊆ s := by simp
/-- The filter of left neighborhoods has a basis of closed intervals. -/
theorem nhdsLE_basis_Icc [NoMinOrder α] [DenselyOrdered α] {a : α} :
(𝓝[≤] a).HasBasis (· < a) (Icc · a) :=
⟨fun _ ↦ mem_nhdsLE_iff_exists_Icc_subset⟩
end OrderTopology
end LinearOrder
section LinearOrderedCommGroup
variable [TopologicalSpace α] [CommGroup α] [LinearOrder α] [IsOrderedMonoid α]
[OrderTopology α]
variable {l : Filter β} {f g : β → α}
@[to_additive]
theorem nhds_eq_iInf_mabs_div (a : α) : 𝓝 a = ⨅ r > 1, 𝓟 { b | |a / b|ₘ < r } := by
simp only [nhds_eq_order, mabs_lt, setOf_and, ← inf_principal, iInf_inf_eq]
refine (congr_arg₂ _ ?_ ?_).trans (inf_comm ..)
· refine (Equiv.divLeft a).iInf_congr fun x => ?_; simp [Ioi]
· refine (Equiv.divRight a).iInf_congr fun x => ?_; simp [Iio]
@[to_additive]
theorem orderTopology_of_nhds_mabs {α : Type*} [TopologicalSpace α] [CommGroup α] [LinearOrder α]
[IsOrderedMonoid α]
(h_nhds : ∀ a : α, 𝓝 a = ⨅ r > 1, 𝓟 { b | |a / b|ₘ < r }) : OrderTopology α := by
refine ⟨TopologicalSpace.ext_nhds fun a => ?_⟩
rw [h_nhds]
letI := Preorder.topology α; letI : OrderTopology α := ⟨rfl⟩
exact (nhds_eq_iInf_mabs_div a).symm
@[to_additive]
theorem LinearOrderedCommGroup.tendsto_nhds {x : Filter β} {a : α} :
Tendsto f x (𝓝 a) ↔ ∀ ε > (1 : α), ∀ᶠ b in x, |f b / a|ₘ < ε := by
simp [nhds_eq_iInf_mabs_div, mabs_div_comm a]
@[to_additive]
theorem eventually_mabs_div_lt (a : α) {ε : α} (hε : 1 < ε) : ∀ᶠ x in 𝓝 a, |x / a|ₘ < ε :=
(nhds_eq_iInf_mabs_div a).symm ▸
mem_iInf_of_mem ε (mem_iInf_of_mem hε <| by simp only [mabs_div_comm, mem_principal_self])
/-- In a linearly ordered commutative group with the order topology,
if `f` tends to `C` and `g` tends to `atTop` then `f * g` tends to `atTop`. -/
@[to_additive add_atTop /-- In a linearly ordered additive commutative group with the order
topology, if `f` tends to `C` and `g` tends to `atTop` then `f + g` tends to `atTop`. -/]
theorem Filter.Tendsto.mul_atTop' {C : α} (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atTop) :
Tendsto (fun x => f x * g x) l atTop := by
nontriviality α
obtain ⟨C', hC'⟩ : ∃ C', C' < C := exists_lt C
refine tendsto_atTop_mul_left_of_le' _ C' ?_ hg
exact (hf.eventually (lt_mem_nhds hC')).mono fun x => le_of_lt
/-- In a linearly ordered commutative group with the order topology,
if `f` tends to `C` and `g` tends to `atBot` then `f * g` tends to `atBot`. -/
@[to_additive add_atBot /-- In a linearly ordered additive commutative group with the order
topology, if `f` tends to `C` and `g` tends to `atBot` then `f + g` tends to `atBot`. -/]
theorem Filter.Tendsto.mul_atBot' {C : α} (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atBot) :
Tendsto (fun x => f x * g x) l atBot :=
Filter.Tendsto.mul_atTop' (α := αᵒᵈ) hf hg
/-- In a linearly ordered commutative group with the order topology,
if `f` tends to `atTop` and `g` tends to `C` then `f * g` tends to `atTop`. -/
@[to_additive atTop_add /-- In a linearly ordered additive commutative group with the order
topology, if `f` tends to `atTop` and `g` tends to `C` then `f + g` tends to `atTop`. -/]
theorem Filter.Tendsto.atTop_mul' {C : α} (hf : Tendsto f l atTop) (hg : Tendsto g l (𝓝 C)) :
Tendsto (fun x => f x * g x) l atTop := by
conv in _ * _ => rw [mul_comm]
exact hg.mul_atTop' hf
/-- In a linearly ordered commutative group with the order topology,
if `f` tends to `atBot` and `g` tends to `C` then `f * g` tends to `atBot`. -/
@[to_additive atBot_add /-- In a linearly ordered additive commutative group with the order
topology, if `f` tends to `atBot` and `g` tends to `C` then `f + g` tends to `atBot`. -/]
theorem Filter.Tendsto.atBot_mul' {C : α} (hf : Tendsto f l atBot) (hg : Tendsto g l (𝓝 C)) :
Tendsto (fun x => f x * g x) l atBot := by
conv in _ * _ => rw [mul_comm]
exact hg.mul_atBot' hf
@[to_additive]
theorem nhds_basis_mabs_div_lt [NoMaxOrder α] (a : α) :
(𝓝 a).HasBasis (fun ε : α => (1 : α) < ε) fun ε => { b | |b / a|ₘ < ε } := by
simp only [nhds_eq_iInf_mabs_div, mabs_div_comm (a := a)]
refine hasBasis_biInf_principal' (fun x hx y hy => ?_) (exists_gt _)
exact ⟨min x y, lt_min hx hy, fun _ hz => hz.trans_le (min_le_left _ _),
fun _ hz => hz.trans_le (min_le_right _ _)⟩
@[to_additive]
theorem nhds_basis_Ioo_one_lt [NoMaxOrder α] (a : α) :
(𝓝 a).HasBasis (fun ε : α => (1 : α) < ε) fun ε => Ioo (a / ε) (a * ε) := by
convert nhds_basis_mabs_div_lt a
simp only [Ioo, mabs_lt, ← div_lt_iff_lt_mul, inv_lt_div_iff_lt_mul, div_lt_comm]
@[to_additive]
theorem nhds_basis_Icc_one_lt [NoMaxOrder α] [DenselyOrdered α] (a : α) :
(𝓝 a).HasBasis ((1 : α) < ·) fun ε ↦ Icc (a / ε) (a * ε) :=
(nhds_basis_Ioo_one_lt a).to_hasBasis
(fun _ε ε₁ ↦ let ⟨δ, δ₁, δε⟩ := exists_between ε₁
⟨δ, δ₁, Icc_subset_Ioo (by gcongr) (by gcongr)⟩)
(fun ε ε₁ ↦ ⟨ε, ε₁, Ioo_subset_Icc_self⟩)
variable (α) in
@[to_additive]
theorem nhds_basis_one_mabs_lt [NoMaxOrder α] :
(𝓝 (1 : α)).HasBasis (fun ε : α => (1 : α) < ε) fun ε => { b | |b|ₘ < ε } := by
simpa using nhds_basis_mabs_div_lt (1 : α)
/-- If `a > 1`, then open intervals `(a / ε, aε)`, `1 < ε ≤ a`,
form a basis of neighborhoods of `a`.
This upper bound for `ε` guarantees that all elements of these intervals are greater than one. -/
@[to_additive /-- If `a` is positive, then the intervals `(a - ε, a + ε)`, `0 < ε ≤ a`,
form a basis of neighborhoods of `a`.
This upper bound for `ε` guarantees that all elements of these intervals are positive. -/]
theorem nhds_basis_Ioo_one_lt_of_one_lt [NoMaxOrder α] {a : α} (ha : 1 < a) :
(𝓝 a).HasBasis (fun ε : α => (1 : α) < ε ∧ ε ≤ a) fun ε => Ioo (a / ε) (a * ε) :=
(nhds_basis_Ioo_one_lt a).restrict fun ε hε ↦
⟨min a ε, lt_min ha hε, min_le_left _ _, by gcongr <;> apply min_le_right⟩
end LinearOrderedCommGroup
namespace Set.OrdConnected
section ClosedIciTopology
variable [TopologicalSpace α] [LinearOrder α] [ClosedIciTopology α] {S : Set α} {x y : α}
/-- If `S` is order-connected and contains two points `x < y`,
then `S` is a right neighbourhood of `x`. -/
lemma mem_nhdsGE (hS : OrdConnected S) (hx : x ∈ S) (hy : y ∈ S) (hxy : x < y) : S ∈ 𝓝[≥] x :=
mem_of_superset (Icc_mem_nhdsGE hxy) <| hS.out hx hy
/-- If `S` is order-connected and contains two points `x < y`,
then `S` is a punctured right neighbourhood of `x`. -/
lemma mem_nhdsGT (hS : OrdConnected S) (hx : x ∈ S) (hy : y ∈ S) (hxy : x < y) : S ∈ 𝓝[>] x :=
nhdsWithin_mono _ Ioi_subset_Ici_self <| hS.mem_nhdsGE hx hy hxy
end ClosedIciTopology
variable [TopologicalSpace α] [LinearOrder α] [ClosedIicTopology α] {S : Set α} {x y : α}
/-- If `S` is order-connected and contains two points `x < y`, then `S` is a left neighbourhood
of `y`. -/
lemma mem_nhdsLE (hS : OrdConnected S) (hx : x ∈ S) (hy : y ∈ S) (hxy : x < y) : S ∈ 𝓝[≤] y :=
hS.dual.mem_nhdsGE hy hx hxy
/-- If `S` is order-connected and contains two points `x < y`, then `S` is a punctured left
neighbourhood of `y`. -/
lemma mem_nhdsLT (hS : OrdConnected S) (hx : x ∈ S) (hy : y ∈ S) (hxy : x < y) : S ∈ 𝓝[<] y :=
hS.dual.mem_nhdsGT hy hx hxy
end OrdConnected
end Set |
.lake/packages/mathlib/Mathlib/Topology/Order/Monotone.lean | import Mathlib.Tactic.Order
import Mathlib.Topology.Order.IsLUB
/-!
# Monotone functions on an order topology
This file contains lemmas about limits and continuity for monotone / antitone functions on
linearly-ordered sets (with the order topology). For example, we prove that a monotone function
has left and right limits at any point (`Monotone.tendsto_nhdsLT`, `Monotone.tendsto_nhdsGT`).
-/
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α β : Type*}
section LinearOrder
variable [LinearOrder α] [TopologicalSpace α] [OrderTopology α] [LinearOrder β]
{s : Set α} {x : α} {f : α → β}
lemma MonotoneOn.insert_of_continuousWithinAt [TopologicalSpace β] [OrderClosedTopology β]
(hf : MonotoneOn f s) (hx : ClusterPt x (𝓟 s)) (h'x : ContinuousWithinAt f s x) :
MonotoneOn f (insert x s) := by
have : (𝓝[s] x).NeBot := hx
apply monotoneOn_insert_iff.2 ⟨fun b hb hbx ↦ ?_, fun b hb hxb ↦ ?_, hf⟩
· rcases hbx.eq_or_lt with rfl | hbx
· exact le_rfl
simp only [ContinuousWithinAt] at h'x
apply ge_of_tendsto h'x
have : s ∩ Ioi b ∈ 𝓝[s] x := inter_mem_nhdsWithin _ (Ioi_mem_nhds hbx)
filter_upwards [this] with y hy using hf hb hy.1 (le_of_lt hy.2)
· rcases hxb.eq_or_lt with rfl | hxb
· exact le_rfl
simp only [ContinuousWithinAt] at h'x
apply le_of_tendsto h'x
have : s ∩ Iio b ∈ 𝓝[s] x := inter_mem_nhdsWithin _ (Iio_mem_nhds hxb)
filter_upwards [this] with y hy
exact hf hy.1 hb (le_of_lt hy.2)
/-- If a function is monotone on a set in a second countable topological space, then there
are only countably many points that have several preimages. -/
lemma MonotoneOn.countable_setOf_two_preimages [SecondCountableTopology α]
(hf : MonotoneOn f s) :
Set.Countable {c | ∃ x y, x ∈ s ∧ y ∈ s ∧ x < y ∧ f x = c ∧ f y = c} := by
nontriviality α
let t := {c | ∃ x, ∃ y, x ∈ s ∧ y ∈ s ∧ x < y ∧ f x = c ∧ f y = c}
have : ∀ c ∈ t, ∃ x, ∃ y, x ∈ s ∧ y ∈ s ∧ x < y ∧ f x = c ∧ f y = c := fun c hc ↦ hc
choose! x y hxs hys hxy hfx hfy using this
let u := x '' t
suffices H : Set.Countable (x '' t) by
have : Set.InjOn x t := by
intro c hc d hd hcd
have : f (x c) = f (x d) := by simp [hcd]
rwa [hfx _ hc, hfx _ hd] at this
exact countable_of_injective_of_countable_image this H
apply Set.PairwiseDisjoint.countable_of_Ioo (y := fun a ↦ y (f a)); swap
· rintro a ⟨c, hc, rfl⟩
rw [hfx _ hc]
exact hxy _ hc
simp only [PairwiseDisjoint, Set.Pairwise, mem_image, onFun, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro c hc d hd hcd
wlog H : c < d generalizing c d with h
· apply (h d hd c hc hcd.symm ?_).symm
have : c ≠ d := fun h ↦ hcd (congrArg x h)
order
simp only [disjoint_iff_forall_ne, mem_Ioo, ne_eq, and_imp]
rintro a xca ayc b xda ayd rfl
rw [hfx _ hc] at ayc
have : x d ≤ y c := (xda.trans ayc).le
have : f (x d) ≤ f (y c) := hf (hxs _ hd) (hys _ hc) this
rw [hfx _ hd, hfy _ hc] at this
exact not_le.2 H this
/-- If a function is monotone in a second countable topological space, then there
are only countably many points that have several preimages. -/
lemma Monotone.countable_setOf_two_preimages [SecondCountableTopology α]
(hf : Monotone f) :
Set.Countable {c | ∃ x y, x < y ∧ f x = c ∧ f y = c} := by
rw [← monotoneOn_univ] at hf
simpa using hf.countable_setOf_two_preimages
/-- If a function is antitone on a set in a second countable topological space, then there
are only countably many points that have several preimages. -/
lemma AntitoneOn.countable_setOf_two_preimages [SecondCountableTopology α]
(hf : AntitoneOn f s) :
Set.Countable {c | ∃ x y, x ∈ s ∧ y ∈ s ∧ x < y ∧ f x = c ∧ f y = c} :=
(MonotoneOn.countable_setOf_two_preimages hf.dual_right :)
/-- If a function is antitone in a second countable topological space, then there
are only countably many points that have several preimages. -/
lemma Antitone.countable_setOf_two_preimages [SecondCountableTopology α]
(hf : Antitone f) :
Set.Countable {c | ∃ x y, x < y ∧ f x = c ∧ f y = c} :=
(Monotone.countable_setOf_two_preimages hf.dual_right :)
section Continuity
variable [TopologicalSpace β] [OrderTopology β] [SecondCountableTopology β]
/-- In a second countable space, the set of points where a monotone function is not right-continuous
within a set is at most countable. Superseded by `MonotoneOn.countable_not_continuousWithinAt`
which gives the two-sided version. -/
theorem MonotoneOn.countable_not_continuousWithinAt_Ioi (hf : MonotoneOn f s) :
Set.Countable {x ∈ s | ¬ContinuousWithinAt f (s ∩ Ioi x) x} := by
apply (countable_image_lt_image_Ioi_within s f).mono
rintro x ⟨xs, hx : ¬ContinuousWithinAt f (s ∩ Ioi x) x⟩
dsimp only [mem_setOf_eq]
contrapose! hx
refine tendsto_order.2 ⟨fun m hm => ?_, fun u hu => ?_⟩
· filter_upwards [@self_mem_nhdsWithin _ _ x (s ∩ Ioi x)] with y hy
exact hm.trans_le (hf xs hy.1 (le_of_lt hy.2))
rcases hx xs u hu with ⟨v, vs, xv, fvu⟩
have : s ∩ Ioo x v ∈ 𝓝[s ∩ Ioi x] x := by simp [nhdsWithin_inter, mem_inf_of_left,
self_mem_nhdsWithin, mem_inf_of_right, Ioo_mem_nhdsGT xv]
filter_upwards [this] with y hy
exact (hf hy.1 vs hy.2.2.le).trans_lt fvu
/-- In a second countable space, the set of points where a monotone function is not left-continuous
within a set is at most countable. Superseded by `MonotoneOn.countable_not_continuousWithinAt`
which gives the two-sided version. -/
theorem MonotoneOn.countable_not_continuousWithinAt_Iio (hf : MonotoneOn f s) :
Set.Countable {x ∈ s | ¬ContinuousWithinAt f (s ∩ Iio x) x} :=
hf.dual.countable_not_continuousWithinAt_Ioi
/-- In a second countable space, the set of points where a monotone function is not continuous
within a set is at most countable. -/
theorem MonotoneOn.countable_not_continuousWithinAt (hf : MonotoneOn f s) :
Set.Countable {x ∈ s | ¬ContinuousWithinAt f s x} := by
apply (hf.countable_not_continuousWithinAt_Ioi.union hf.countable_not_continuousWithinAt_Iio).mono
refine compl_subset_compl.1 ?_
simp only [compl_union]
rintro x ⟨hx, h'x⟩
simp only [mem_compl_iff, mem_setOf_eq, not_and, not_not] at hx h'x ⊢
intro xs
exact continuousWithinAt_iff_continuous_left'_right'.2 ⟨h'x xs, hx xs⟩
/-- In a second countable space, the set of points where a monotone function is not continuous
is at most countable. -/
theorem Monotone.countable_not_continuousAt (hf : Monotone f) :
Set.Countable {x | ¬ContinuousAt f x} := by
simpa [continuousWithinAt_univ] using (hf.monotoneOn univ).countable_not_continuousWithinAt
/-- In a second countable space, the set of points where an antitone function is not continuous
within a set is at most countable. -/
theorem _root_.AntitoneOn.countable_not_continuousWithinAt
{s : Set α} (hf : AntitoneOn f s) :
Set.Countable {x ∈ s | ¬ContinuousWithinAt f s x} :=
hf.dual_right.countable_not_continuousWithinAt
/-- In a second countable space, the set of points where an antitone function is not continuous
is at most countable. -/
theorem Antitone.countable_not_continuousAt (hf : Antitone f) :
Set.Countable {x | ¬ContinuousAt f x} :=
hf.dual_right.countable_not_continuousAt
end Continuity
end LinearOrder
section ConditionallyCompleteLinearOrder
variable [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderClosedTopology β]
/-- A monotone function continuous at the supremum of a nonempty set sends this supremum to
the supremum of the image of this set. -/
theorem MonotoneOn.map_csSup_of_continuousWithinAt {f : α → β} {A : Set α}
(Cf : ContinuousWithinAt f A (sSup A))
(Mf : MonotoneOn f A) (A_nonemp : A.Nonempty) (A_bdd : BddAbove A := by bddDefault) :
f (sSup A) = sSup (f '' A) :=
--This is a particular case of the more general `IsLUB.isLUB_of_tendsto`
.symm <| ((isLUB_csSup A_nonemp A_bdd).isLUB_of_tendsto Mf A_nonemp <|
Cf.mono_left fun ⦃_⦄ a ↦ a).csSup_eq (A_nonemp.image f)
/-- A monotone function continuous at the supremum of a nonempty set sends this supremum to
the supremum of the image of this set. -/
theorem Monotone.map_csSup_of_continuousAt {f : α → β} {A : Set α}
(Cf : ContinuousAt f (sSup A)) (Mf : Monotone f) (A_nonemp : A.Nonempty)
(A_bdd : BddAbove A := by bddDefault) : f (sSup A) = sSup (f '' A) :=
MonotoneOn.map_csSup_of_continuousWithinAt Cf.continuousWithinAt
(Mf.monotoneOn _) A_nonemp A_bdd
/-- A monotone function continuous at the indexed supremum over a nonempty `Sort` sends this indexed
supremum to the indexed supremum of the composition. -/
theorem Monotone.map_ciSup_of_continuousAt {ι : Sort*} [Nonempty ι] {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iSup g)) (Mf : Monotone f)
(bdd : BddAbove (range g) := by bddDefault) : f (⨆ i, g i) = ⨆ i, f (g i) := by
rw [iSup, Monotone.map_csSup_of_continuousAt Cf Mf (range_nonempty g) bdd, ← range_comp, iSup,
comp_def]
/-- A monotone function continuous at the infimum of a nonempty set sends this infimum to
the infimum of the image of this set. -/
theorem MonotoneOn.map_csInf_of_continuousWithinAt {f : α → β} {A : Set α}
(Cf : ContinuousWithinAt f A (sInf A))
(Mf : MonotoneOn f A) (A_nonemp : A.Nonempty) (A_bdd : BddBelow A := by bddDefault) :
f (sInf A) = sInf (f '' A) :=
MonotoneOn.map_csSup_of_continuousWithinAt (α := αᵒᵈ) (β := βᵒᵈ) Cf Mf.dual A_nonemp A_bdd
/-- A monotone function continuous at the infimum of a nonempty set sends this infimum to
the infimum of the image of this set. -/
theorem Monotone.map_csInf_of_continuousAt {f : α → β} {A : Set α} (Cf : ContinuousAt f (sInf A))
(Mf : Monotone f) (A_nonemp : A.Nonempty) (A_bdd : BddBelow A := by bddDefault) :
f (sInf A) = sInf (f '' A) :=
Monotone.map_csSup_of_continuousAt (α := αᵒᵈ) (β := βᵒᵈ) Cf Mf.dual A_nonemp A_bdd
/-- A monotone function continuous at the indexed infimum over a nonempty `Sort` sends this indexed
infimum to the indexed infimum of the composition. -/
theorem Monotone.map_ciInf_of_continuousAt {ι : Sort*} [Nonempty ι] {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iInf g)) (Mf : Monotone f)
(bdd : BddBelow (range g) := by bddDefault) : f (⨅ i, g i) = ⨅ i, f (g i) := by
rw [iInf, Monotone.map_csInf_of_continuousAt Cf Mf (range_nonempty g) bdd, ← range_comp, iInf,
comp_def]
/-- An antitone function continuous at the infimum of a nonempty set sends this infimum to
the supremum of the image of this set. -/
theorem AntitoneOn.map_csInf_of_continuousWithinAt {f : α → β} {A : Set α}
(Cf : ContinuousWithinAt f A (sInf A))
(Af : AntitoneOn f A) (A_nonemp : A.Nonempty) (A_bdd : BddBelow A := by bddDefault) :
f (sInf A) = sSup (f '' A) :=
MonotoneOn.map_csInf_of_continuousWithinAt (β := βᵒᵈ) Cf Af.dual_right A_nonemp A_bdd
/-- An antitone function continuous at the infimum of a nonempty set sends this infimum to
the supremum of the image of this set. -/
theorem Antitone.map_csInf_of_continuousAt {f : α → β} {A : Set α} (Cf : ContinuousAt f (sInf A))
(Af : Antitone f) (A_nonemp : A.Nonempty) (A_bdd : BddBelow A := by bddDefault) :
f (sInf A) = sSup (f '' A) :=
Monotone.map_csInf_of_continuousAt (β := βᵒᵈ) Cf Af.dual_right A_nonemp A_bdd
/-- An antitone function continuous at the indexed infimum over a nonempty `Sort` sends this indexed
infimum to the indexed supremum of the composition. -/
theorem Antitone.map_ciInf_of_continuousAt {ι : Sort*} [Nonempty ι] {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iInf g)) (Af : Antitone f)
(bdd : BddBelow (range g) := by bddDefault) : f (⨅ i, g i) = ⨆ i, f (g i) := by
rw [iInf, Antitone.map_csInf_of_continuousAt Cf Af (range_nonempty g) bdd, ← range_comp, iSup,
comp_def]
/-- An antitone function continuous at the supremum of a nonempty set sends this supremum to
the infimum of the image of this set. -/
theorem AntitoneOn.map_csSup_of_continuousWithinAt {f : α → β} {A : Set α}
(Cf : ContinuousWithinAt f A (sSup A))
(Af : AntitoneOn f A) (A_nonemp : A.Nonempty) (A_bdd : BddAbove A := by bddDefault) :
f (sSup A) = sInf (f '' A) :=
MonotoneOn.map_csSup_of_continuousWithinAt (β := βᵒᵈ) Cf Af.dual_right A_nonemp A_bdd
/-- An antitone function continuous at the supremum of a nonempty set sends this supremum to
the infimum of the image of this set. -/
theorem Antitone.map_csSup_of_continuousAt {f : α → β} {A : Set α} (Cf : ContinuousAt f (sSup A))
(Af : Antitone f) (A_nonemp : A.Nonempty) (A_bdd : BddAbove A := by bddDefault) :
f (sSup A) = sInf (f '' A) :=
Monotone.map_csSup_of_continuousAt (β := βᵒᵈ) Cf Af.dual_right A_nonemp A_bdd
/-- An antitone function continuous at the indexed supremum over a nonempty `Sort` sends this
indexed supremum to the indexed infimum of the composition. -/
theorem Antitone.map_ciSup_of_continuousAt {ι : Sort*} [Nonempty ι] {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iSup g)) (Af : Antitone f)
(bdd : BddAbove (range g) := by bddDefault) : f (⨆ i, g i) = ⨅ i, f (g i) := by
rw [iSup, Antitone.map_csSup_of_continuousAt Cf Af (range_nonempty g) bdd, ← range_comp, iInf,
comp_def]
end ConditionallyCompleteLinearOrder
section CompleteLinearOrder
variable [CompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] [CompleteLinearOrder β]
[TopologicalSpace β] [OrderClosedTopology β]
theorem sSup_mem_closure {s : Set α} (hs : s.Nonempty) : sSup s ∈ closure s :=
(isLUB_sSup s).mem_closure hs
theorem sInf_mem_closure {s : Set α} (hs : s.Nonempty) : sInf s ∈ closure s :=
(isGLB_sInf s).mem_closure hs
theorem IsClosed.sSup_mem {s : Set α} (hs : s.Nonempty) (hc : IsClosed s) : sSup s ∈ s :=
(isLUB_sSup s).mem_of_isClosed hs hc
theorem IsClosed.sInf_mem {s : Set α} (hs : s.Nonempty) (hc : IsClosed s) : sInf s ∈ s :=
(isGLB_sInf s).mem_of_isClosed hs hc
/-- A monotone function `f` sending `bot` to `bot` and continuous at the supremum of a set sends
this supremum to the supremum of the image of this set. -/
theorem MonotoneOn.map_sSup_of_continuousWithinAt {f : α → β} {s : Set α}
(Cf : ContinuousWithinAt f s (sSup s))
(Mf : MonotoneOn f s) (fbot : f ⊥ = ⊥) : f (sSup s) = sSup (f '' s) := by
rcases s.eq_empty_or_nonempty with h | h
· simp [h, fbot]
· exact Mf.map_csSup_of_continuousWithinAt Cf h
/-- A monotone function `f` sending `bot` to `bot` and continuous at the supremum of a set sends
this supremum to the supremum of the image of this set. -/
theorem Monotone.map_sSup_of_continuousAt {f : α → β} {s : Set α} (Cf : ContinuousAt f (sSup s))
(Mf : Monotone f) (fbot : f ⊥ = ⊥) : f (sSup s) = sSup (f '' s) :=
MonotoneOn.map_sSup_of_continuousWithinAt Cf.continuousWithinAt (Mf.monotoneOn _) fbot
/-- If a monotone function sending `bot` to `bot` is continuous at the indexed supremum over
a `Sort`, then it sends this indexed supremum to the indexed supremum of the composition. -/
theorem Monotone.map_iSup_of_continuousAt {ι : Sort*} {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iSup g)) (Mf : Monotone f) (fbot : f ⊥ = ⊥) :
f (⨆ i, g i) = ⨆ i, f (g i) := by
rw [iSup, Mf.map_sSup_of_continuousAt Cf fbot, ← range_comp, iSup, comp_def]
/-- A monotone function `f` sending `top` to `top` and continuous at the infimum of a set sends
this infimum to the infimum of the image of this set. -/
theorem MonotoneOn.map_sInf_of_continuousWithinAt {f : α → β} {s : Set α}
(Cf : ContinuousWithinAt f s (sInf s)) (Mf : MonotoneOn f s) (ftop : f ⊤ = ⊤) :
f (sInf s) = sInf (f '' s) :=
MonotoneOn.map_sSup_of_continuousWithinAt (α := αᵒᵈ) (β := βᵒᵈ) Cf Mf.dual ftop
/-- A monotone function `f` sending `top` to `top` and continuous at the infimum of a set sends
this infimum to the infimum of the image of this set. -/
theorem Monotone.map_sInf_of_continuousAt {f : α → β} {s : Set α} (Cf : ContinuousAt f (sInf s))
(Mf : Monotone f) (ftop : f ⊤ = ⊤) : f (sInf s) = sInf (f '' s) :=
Monotone.map_sSup_of_continuousAt (α := αᵒᵈ) (β := βᵒᵈ) Cf Mf.dual ftop
/-- If a monotone function sending `top` to `top` is continuous at the indexed infimum over
a `Sort`, then it sends this indexed infimum to the indexed infimum of the composition. -/
theorem Monotone.map_iInf_of_continuousAt {ι : Sort*} {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iInf g)) (Mf : Monotone f) (ftop : f ⊤ = ⊤) : f (iInf g) = iInf (f ∘ g) :=
Monotone.map_iSup_of_continuousAt (α := αᵒᵈ) (β := βᵒᵈ) Cf Mf.dual ftop
/-- An antitone function `f` sending `bot` to `top` and continuous at the supremum of a set sends
this supremum to the infimum of the image of this set. -/
theorem AntitoneOn.map_sSup_of_continuousWithinAt {f : α → β} {s : Set α}
(Cf : ContinuousWithinAt f s (sSup s)) (Af : AntitoneOn f s) (fbot : f ⊥ = ⊤) :
f (sSup s) = sInf (f '' s) :=
MonotoneOn.map_sSup_of_continuousWithinAt
(show ContinuousWithinAt (OrderDual.toDual ∘ f) s (sSup s) from Cf) Af fbot
/-- An antitone function `f` sending `bot` to `top` and continuous at the supremum of a set sends
this supremum to the infimum of the image of this set. -/
theorem Antitone.map_sSup_of_continuousAt {f : α → β} {s : Set α} (Cf : ContinuousAt f (sSup s))
(Af : Antitone f) (fbot : f ⊥ = ⊤) : f (sSup s) = sInf (f '' s) :=
Monotone.map_sSup_of_continuousAt (show ContinuousAt (OrderDual.toDual ∘ f) (sSup s) from Cf) Af
fbot
/-- An antitone function sending `bot` to `top` is continuous at the indexed supremum over
a `Sort`, then it sends this indexed supremum to the indexed supremum of the composition. -/
theorem Antitone.map_iSup_of_continuousAt {ι : Sort*} {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iSup g)) (Af : Antitone f) (fbot : f ⊥ = ⊤) :
f (⨆ i, g i) = ⨅ i, f (g i) :=
Monotone.map_iSup_of_continuousAt (show ContinuousAt (OrderDual.toDual ∘ f) (iSup g) from Cf) Af
fbot
/-- An antitone function `f` sending `top` to `bot` and continuous at the infimum of a set sends
this infimum to the supremum of the image of this set. -/
theorem AntitoneOn.map_sInf_of_continuousWithinAt {f : α → β} {s : Set α}
(Cf : ContinuousWithinAt f s (sInf s)) (Af : AntitoneOn f s) (ftop : f ⊤ = ⊥) :
f (sInf s) = sSup (f '' s) :=
MonotoneOn.map_sInf_of_continuousWithinAt
(show ContinuousWithinAt (OrderDual.toDual ∘ f) s (sInf s) from Cf) Af ftop
/-- An antitone function `f` sending `top` to `bot` and continuous at the infimum of a set sends
this infimum to the supremum of the image of this set. -/
theorem Antitone.map_sInf_of_continuousAt {f : α → β} {s : Set α} (Cf : ContinuousAt f (sInf s))
(Af : Antitone f) (ftop : f ⊤ = ⊥) : f (sInf s) = sSup (f '' s) :=
Monotone.map_sInf_of_continuousAt (show ContinuousAt (OrderDual.toDual ∘ f) (sInf s) from Cf) Af
ftop
/-- If an antitone function sending `top` to `bot` is continuous at the indexed infimum over
a `Sort`, then it sends this indexed infimum to the indexed supremum of the composition. -/
theorem Antitone.map_iInf_of_continuousAt {ι : Sort*} {f : α → β} {g : ι → α}
(Cf : ContinuousAt f (iInf g)) (Af : Antitone f) (ftop : f ⊤ = ⊥) : f (iInf g) = iSup (f ∘ g) :=
Monotone.map_iInf_of_continuousAt (show ContinuousAt (OrderDual.toDual ∘ f) (iInf g) from Cf) Af
ftop
end CompleteLinearOrder
section ConditionallyCompleteLinearOrder
variable [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α]
theorem csSup_mem_closure {s : Set α} (hs : s.Nonempty) (B : BddAbove s) : sSup s ∈ closure s :=
(isLUB_csSup hs B).mem_closure hs
theorem csInf_mem_closure {s : Set α} (hs : s.Nonempty) (B : BddBelow s) : sInf s ∈ closure s :=
(isGLB_csInf hs B).mem_closure hs
theorem IsClosed.csSup_mem {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddAbove s) :
sSup s ∈ s :=
(isLUB_csSup hs B).mem_of_isClosed hs hc
theorem IsClosed.csInf_mem {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddBelow s) :
sInf s ∈ s :=
(isGLB_csInf hs B).mem_of_isClosed hs hc
theorem IsClosed.isLeast_csInf {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddBelow s) :
IsLeast s (sInf s) :=
⟨hc.csInf_mem hs B, (isGLB_csInf hs B).1⟩
theorem IsClosed.isGreatest_csSup {s : Set α} (hc : IsClosed s) (hs : s.Nonempty) (B : BddAbove s) :
IsGreatest s (sSup s) :=
IsClosed.isLeast_csInf (α := αᵒᵈ) hc hs B
lemma MonotoneOn.tendsto_nhdsWithin_Ioo_left {α β : Type*} [LinearOrder α] [TopologicalSpace α]
[OrderTopology α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β]
{f : α → β} {x y : α} (h_nonempty : (Ioo y x).Nonempty) (Mf : MonotoneOn f (Ioo y x))
(h_bdd : BddAbove (f '' Ioo y x)) :
Tendsto f (𝓝[<] x) (𝓝 (sSup (f '' Ioo y x))) := by
refine tendsto_order.2 ⟨fun l hl => ?_, fun m hm => ?_⟩
· obtain ⟨z, ⟨yz, zx⟩, lz⟩ : ∃ a : α, a ∈ Ioo y x ∧ l < f a := by
simpa only [mem_image, exists_prop, exists_exists_and_eq_and] using
exists_lt_of_lt_csSup (h_nonempty.image _) hl
filter_upwards [Ioo_mem_nhdsLT zx] with w hw
exact lz.trans_le <| Mf ⟨yz, zx⟩ ⟨yz.trans_le hw.1.le, hw.2⟩ hw.1.le
· rcases h_nonempty with ⟨_, hy, hx⟩
filter_upwards [Ioo_mem_nhdsLT (hy.trans hx)] with w hw
exact (le_csSup h_bdd (mem_image_of_mem _ hw)).trans_lt hm
lemma MonotoneOn.tendsto_nhdsWithin_Ioo_right {α β : Type*} [LinearOrder α] [TopologicalSpace α]
[OrderTopology α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β]
{f : α → β} {x y : α} (h_nonempty : (Ioo x y).Nonempty) (Mf : MonotoneOn f (Ioo x y))
(h_bdd : BddBelow (f '' Ioo x y)) :
Tendsto f (𝓝[>] x) (𝓝 (sInf (f '' Ioo x y))) := by
refine tendsto_order.2 ⟨fun l hl => ?_, fun m hm => ?_⟩
· rcases h_nonempty with ⟨p, hy, hx⟩
filter_upwards [Ioo_mem_nhdsGT (hy.trans hx)] with w hw
exact hl.trans_le <| csInf_le h_bdd (mem_image_of_mem _ hw)
· obtain ⟨z, ⟨xz, zy⟩, zm⟩ : ∃ a : α, a ∈ Ioo x y ∧ f a < m := by
simpa [mem_image, exists_prop, exists_exists_and_eq_and] using
exists_lt_of_csInf_lt (h_nonempty.image _) hm
filter_upwards [Ioo_mem_nhdsGT xz] with w hw
exact (Mf ⟨hw.1, hw.2.trans zy⟩ ⟨xz, zy⟩ hw.2.le).trans_lt zm
lemma MonotoneOn.tendsto_nhdsLT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} {x : α}
(Mf : MonotoneOn f (Iio x)) (h_bdd : BddAbove (f '' Iio x)) :
Tendsto f (𝓝[<] x) (𝓝 (sSup (f '' Iio x))) := by
rcases eq_empty_or_nonempty (Iio x) with (h | h); · simp [h]
refine tendsto_order.2 ⟨fun l hl => ?_, fun m hm => ?_⟩
· obtain ⟨z, zx, lz⟩ : ∃ a : α, a < x ∧ l < f a := by
simpa only [mem_image, exists_prop, exists_exists_and_eq_and] using
exists_lt_of_lt_csSup (h.image _) hl
filter_upwards [Ioo_mem_nhdsLT zx] with y hy using lz.trans_le (Mf zx hy.2 hy.1.le)
· refine mem_of_superset self_mem_nhdsWithin fun y hy => lt_of_le_of_lt ?_ hm
exact le_csSup h_bdd (mem_image_of_mem _ hy)
lemma MonotoneOn.tendsto_nhdsGT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} {x : α}
(Mf : MonotoneOn f (Ioi x)) (h_bdd : BddBelow (f '' Ioi x)) :
Tendsto f (𝓝[>] x) (𝓝 (sInf (f '' Ioi x))) :=
MonotoneOn.tendsto_nhdsLT (α := αᵒᵈ) (β := βᵒᵈ) Mf.dual h_bdd
/-- A monotone map has a limit to the left of any point `x`, equal to `sSup (f '' (Iio x))`. -/
theorem Monotone.tendsto_nhdsLT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β}
(Mf : Monotone f) (x : α) : Tendsto f (𝓝[<] x) (𝓝 (sSup (f '' Iio x))) :=
MonotoneOn.tendsto_nhdsLT (Mf.monotoneOn _) (Mf.map_bddAbove bddAbove_Iio)
/-- A monotone map has a limit to the right of any point `x`, equal to `sInf (f '' (Ioi x))`. -/
theorem Monotone.tendsto_nhdsGT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β}
(Mf : Monotone f) (x : α) : Tendsto f (𝓝[>] x) (𝓝 (sInf (f '' Ioi x))) :=
Monotone.tendsto_nhdsLT (α := αᵒᵈ) (β := βᵒᵈ) Mf.dual x
lemma AntitoneOn.tendsto_nhdsWithin_Ioo_left {α β : Type*} [LinearOrder α] [TopologicalSpace α]
[OrderTopology α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β]
{f : α → β} {x y : α} (h_nonempty : (Ioo y x).Nonempty) (Af : AntitoneOn f (Ioo y x))
(h_bdd : BddBelow (f '' Ioo y x)) :
Tendsto f (𝓝[<] x) (𝓝 (sInf (f '' Ioo y x))) :=
MonotoneOn.tendsto_nhdsWithin_Ioo_left h_nonempty Af.dual_right h_bdd
lemma AntitoneOn.tendsto_nhdsWithin_Ioo_right {α β : Type*} [LinearOrder α] [TopologicalSpace α]
[OrderTopology α] [ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β]
{f : α → β} {x y : α} (h_nonempty : (Ioo x y).Nonempty) (Af : AntitoneOn f (Ioo x y))
(h_bdd : BddAbove (f '' Ioo x y)) :
Tendsto f (𝓝[>] x) (𝓝 (sSup (f '' Ioo x y))) :=
MonotoneOn.tendsto_nhdsWithin_Ioo_right h_nonempty Af.dual_right h_bdd
lemma AntitoneOn.tendsto_nhdsLT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} {x : α}
(Af : AntitoneOn f (Iio x)) (h_bdd : BddBelow (f '' Iio x)) :
Tendsto f (𝓝[<] x) (𝓝 (sInf (f '' Iio x))) :=
MonotoneOn.tendsto_nhdsLT Af.dual_right h_bdd
lemma AntitoneOn.tendsto_nhdsGT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β} {x : α}
(Af : AntitoneOn f (Ioi x)) (h_bdd : BddAbove (f '' Ioi x)) :
Tendsto f (𝓝[>] x) (𝓝 (sSup (f '' Ioi x))) :=
MonotoneOn.tendsto_nhdsGT Af.dual_right h_bdd
/-- An antitone map has a limit to the left of any point `x`, equal to `sInf (f '' (Iio x))`. -/
theorem Antitone.tendsto_nhdsLT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β}
(Af : Antitone f) (x : α) : Tendsto f (𝓝[<] x) (𝓝 (sInf (f '' Iio x))) :=
Monotone.tendsto_nhdsLT Af.dual_right x
/-- An antitone map has a limit to the right of any point `x`, equal to `sSup (f '' (Ioi x))`. -/
theorem Antitone.tendsto_nhdsGT {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α]
[ConditionallyCompleteLinearOrder β] [TopologicalSpace β] [OrderTopology β] {f : α → β}
(Af : Antitone f) (x : α) : Tendsto f (𝓝[>] x) (𝓝 (sSup (f '' Ioi x))) :=
Monotone.tendsto_nhdsGT Af.dual_right x
end ConditionallyCompleteLinearOrder |
.lake/packages/mathlib/Mathlib/Topology/Order/Lattice.lean | import Mathlib.Topology.Constructions
import Mathlib.Topology.Order.OrderClosed
/-!
# Topological lattices
In this file we define mixin classes `ContinuousInf` and `ContinuousSup`. We define the
class `TopologicalLattice` as a topological space and lattice `L` extending `ContinuousInf` and
`ContinuousSup`.
## References
* [Gierz et al, A Compendium of Continuous Lattices][GierzEtAl1980]
## Tags
topological, lattice
-/
open Filter
open Topology
/-- Let `L` be a topological space and let `L×L` be equipped with the product topology and let
`⊓:L×L → L` be an infimum. Then `L` is said to have *(jointly) continuous infimum* if the map
`⊓:L×L → L` is continuous.
-/
class ContinuousInf (L : Type*) [TopologicalSpace L] [Min L] : Prop where
/-- The infimum is continuous -/
continuous_inf : Continuous fun p : L × L => p.1 ⊓ p.2
/-- Let `L` be a topological space and let `L×L` be equipped with the product topology and let
`⊓:L×L → L` be a supremum. Then `L` is said to have *(jointly) continuous supremum* if the map
`⊓:L×L → L` is continuous.
-/
class ContinuousSup (L : Type*) [TopologicalSpace L] [Max L] : Prop where
/-- The supremum is continuous -/
continuous_sup : Continuous fun p : L × L => p.1 ⊔ p.2
-- see Note [lower instance priority]
instance (priority := 100) OrderDual.continuousSup (L : Type*) [TopologicalSpace L] [Min L]
[ContinuousInf L] : ContinuousSup Lᵒᵈ where
continuous_sup := @ContinuousInf.continuous_inf L _ _ _
-- see Note [lower instance priority]
instance (priority := 100) OrderDual.continuousInf (L : Type*) [TopologicalSpace L] [Max L]
[ContinuousSup L] : ContinuousInf Lᵒᵈ where
continuous_inf := @ContinuousSup.continuous_sup L _ _ _
/-- Let `L` be a lattice equipped with a topology such that `L` has continuous infimum and supremum.
Then `L` is said to be a *topological lattice*.
-/
class TopologicalLattice (L : Type*) [TopologicalSpace L] [Lattice L] : Prop
extends ContinuousInf L, ContinuousSup L
-- see Note [lower instance priority]
instance (priority := 100) OrderDual.topologicalLattice (L : Type*) [TopologicalSpace L]
[Lattice L] [TopologicalLattice L] : TopologicalLattice Lᵒᵈ where
-- see Note [lower instance priority]
instance (priority := 100) LinearOrder.topologicalLattice {L : Type*} [TopologicalSpace L]
[LinearOrder L] [OrderClosedTopology L] : TopologicalLattice L where
continuous_inf := continuous_min
continuous_sup := continuous_max
variable {L X : Type*} [TopologicalSpace L] [TopologicalSpace X]
@[continuity]
theorem continuous_inf [Min L] [ContinuousInf L] : Continuous fun p : L × L => p.1 ⊓ p.2 :=
ContinuousInf.continuous_inf
@[continuity, fun_prop]
theorem Continuous.inf [Min L] [ContinuousInf L] {f g : X → L} (hf : Continuous f)
(hg : Continuous g) : Continuous fun x => f x ⊓ g x :=
continuous_inf.comp (hf.prodMk hg :)
@[continuity]
theorem continuous_sup [Max L] [ContinuousSup L] : Continuous fun p : L × L => p.1 ⊔ p.2 :=
ContinuousSup.continuous_sup
@[continuity, fun_prop]
theorem Continuous.sup [Max L] [ContinuousSup L] {f g : X → L} (hf : Continuous f)
(hg : Continuous g) : Continuous fun x => f x ⊔ g x :=
continuous_sup.comp (hf.prodMk hg :)
namespace Filter.Tendsto
section SupInf
variable {α : Type*} {l : Filter α} {f g : α → L} {x y : L}
lemma sup_nhds' [Max L] [ContinuousSup L] (hf : Tendsto f l (𝓝 x)) (hg : Tendsto g l (𝓝 y)) :
Tendsto (f ⊔ g) l (𝓝 (x ⊔ y)) :=
(continuous_sup.tendsto _).comp (hf.prodMk_nhds hg)
lemma sup_nhds [Max L] [ContinuousSup L] (hf : Tendsto f l (𝓝 x)) (hg : Tendsto g l (𝓝 y)) :
Tendsto (fun i => f i ⊔ g i) l (𝓝 (x ⊔ y)) :=
hf.sup_nhds' hg
lemma inf_nhds' [Min L] [ContinuousInf L] (hf : Tendsto f l (𝓝 x)) (hg : Tendsto g l (𝓝 y)) :
Tendsto (f ⊓ g) l (𝓝 (x ⊓ y)) :=
(continuous_inf.tendsto _).comp (hf.prodMk_nhds hg)
lemma inf_nhds [Min L] [ContinuousInf L] (hf : Tendsto f l (𝓝 x)) (hg : Tendsto g l (𝓝 y)) :
Tendsto (fun i => f i ⊓ g i) l (𝓝 (x ⊓ y)) :=
hf.inf_nhds' hg
end SupInf
open Finset
variable {ι α : Type*} {s : Finset ι} {f : ι → α → L} {l : Filter α} {g : ι → L}
lemma finset_sup'_nhds [SemilatticeSup L] [ContinuousSup L]
(hne : s.Nonempty) (hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) :
Tendsto (s.sup' hne f) l (𝓝 (s.sup' hne g)) := by
induction hne using Finset.Nonempty.cons_induction with
| singleton => simpa using hs
| cons a s ha hne ihs =>
rw [forall_mem_cons] at hs
simp only [sup'_cons, hne]
exact hs.1.sup_nhds (ihs hs.2)
lemma finset_sup'_nhds_apply [SemilatticeSup L] [ContinuousSup L]
(hne : s.Nonempty) (hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) :
Tendsto (fun a ↦ s.sup' hne (f · a)) l (𝓝 (s.sup' hne g)) := by
simpa only [← Finset.sup'_apply] using finset_sup'_nhds hne hs
lemma finset_inf'_nhds [SemilatticeInf L] [ContinuousInf L]
(hne : s.Nonempty) (hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) :
Tendsto (s.inf' hne f) l (𝓝 (s.inf' hne g)) :=
finset_sup'_nhds (L := Lᵒᵈ) hne hs
lemma finset_inf'_nhds_apply [SemilatticeInf L] [ContinuousInf L]
(hne : s.Nonempty) (hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) :
Tendsto (fun a ↦ s.inf' hne (f · a)) l (𝓝 (s.inf' hne g)) :=
finset_sup'_nhds_apply (L := Lᵒᵈ) hne hs
lemma finset_sup_nhds [SemilatticeSup L] [OrderBot L] [ContinuousSup L]
(hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) : Tendsto (s.sup f) l (𝓝 (s.sup g)) := by
rcases s.eq_empty_or_nonempty with rfl | hne
· simpa using tendsto_const_nhds
· simp only [← sup'_eq_sup hne]
exact finset_sup'_nhds hne hs
lemma finset_sup_nhds_apply [SemilatticeSup L] [OrderBot L] [ContinuousSup L]
(hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) :
Tendsto (fun a ↦ s.sup (f · a)) l (𝓝 (s.sup g)) := by
simpa only [← Finset.sup_apply] using finset_sup_nhds hs
lemma finset_inf_nhds [SemilatticeInf L] [OrderTop L] [ContinuousInf L]
(hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) : Tendsto (s.inf f) l (𝓝 (s.inf g)) :=
finset_sup_nhds (L := Lᵒᵈ) hs
lemma finset_inf_nhds_apply [SemilatticeInf L] [OrderTop L] [ContinuousInf L]
(hs : ∀ i ∈ s, Tendsto (f i) l (𝓝 (g i))) :
Tendsto (fun a ↦ s.inf (f · a)) l (𝓝 (s.inf g)) :=
finset_sup_nhds_apply (L := Lᵒᵈ) hs
end Filter.Tendsto
section Sup
variable [Max L] [ContinuousSup L] {f g : X → L} {s : Set X} {x : X}
lemma ContinuousAt.sup' (hf : ContinuousAt f x) (hg : ContinuousAt g x) :
ContinuousAt (f ⊔ g) x :=
hf.sup_nhds' hg
@[fun_prop]
lemma ContinuousAt.sup (hf : ContinuousAt f x) (hg : ContinuousAt g x) :
ContinuousAt (fun a ↦ f a ⊔ g a) x :=
hf.sup' hg
lemma ContinuousWithinAt.sup' (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) :
ContinuousWithinAt (f ⊔ g) s x :=
hf.sup_nhds' hg
lemma ContinuousWithinAt.sup (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) :
ContinuousWithinAt (fun a ↦ f a ⊔ g a) s x :=
hf.sup' hg
lemma ContinuousOn.sup' (hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (f ⊔ g) s := fun x hx ↦
(hf x hx).sup' (hg x hx)
@[fun_prop]
lemma ContinuousOn.sup (hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (fun a ↦ f a ⊔ g a) s :=
hf.sup' hg
lemma Continuous.sup' (hf : Continuous f) (hg : Continuous g) : Continuous (f ⊔ g) := hf.sup hg
end Sup
section Inf
variable [Min L] [ContinuousInf L] {f g : X → L} {s : Set X} {x : X}
lemma ContinuousAt.inf' (hf : ContinuousAt f x) (hg : ContinuousAt g x) :
ContinuousAt (f ⊓ g) x :=
hf.inf_nhds' hg
@[fun_prop]
lemma ContinuousAt.inf (hf : ContinuousAt f x) (hg : ContinuousAt g x) :
ContinuousAt (fun a ↦ f a ⊓ g a) x :=
hf.inf' hg
lemma ContinuousWithinAt.inf' (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) :
ContinuousWithinAt (f ⊓ g) s x :=
hf.inf_nhds' hg
lemma ContinuousWithinAt.inf (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) :
ContinuousWithinAt (fun a ↦ f a ⊓ g a) s x :=
hf.inf' hg
lemma ContinuousOn.inf' (hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (f ⊓ g) s := fun x hx ↦
(hf x hx).inf' (hg x hx)
@[fun_prop]
lemma ContinuousOn.inf (hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (fun a ↦ f a ⊓ g a) s :=
hf.inf' hg
lemma Continuous.inf' (hf : Continuous f) (hg : Continuous g) : Continuous (f ⊓ g) := hf.inf hg
end Inf
section FinsetSup'
variable {ι : Type*} [SemilatticeSup L] [ContinuousSup L] {s : Finset ι}
{f : ι → X → L} {t : Set X} {x : X}
lemma ContinuousAt.finset_sup'_apply (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (fun a ↦ s.sup' hne (f · a)) x :=
Tendsto.finset_sup'_nhds_apply hne hs
lemma ContinuousAt.finset_sup' (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (s.sup' hne f) x := by
simpa only [← Finset.sup'_apply] using finset_sup'_apply hne hs
lemma ContinuousWithinAt.finset_sup'_apply (hne : s.Nonempty)
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) :
ContinuousWithinAt (fun a ↦ s.sup' hne (f · a)) t x :=
Tendsto.finset_sup'_nhds_apply hne hs
lemma ContinuousWithinAt.finset_sup' (hne : s.Nonempty)
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) : ContinuousWithinAt (s.sup' hne f) t x := by
simpa only [← Finset.sup'_apply] using finset_sup'_apply hne hs
lemma ContinuousOn.finset_sup'_apply (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (fun a ↦ s.sup' hne (f · a)) t := fun x hx ↦
ContinuousWithinAt.finset_sup'_apply hne fun i hi ↦ hs i hi x hx
lemma ContinuousOn.finset_sup' (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (s.sup' hne f) t := fun x hx ↦
ContinuousWithinAt.finset_sup' hne fun i hi ↦ hs i hi x hx
lemma Continuous.finset_sup'_apply (hne : s.Nonempty) (hs : ∀ i ∈ s, Continuous (f i)) :
Continuous (fun a ↦ s.sup' hne (f · a)) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_sup'_apply _ fun i hi ↦
(hs i hi).continuousAt
lemma Continuous.finset_sup' (hne : s.Nonempty) (hs : ∀ i ∈ s, Continuous (f i)) :
Continuous (s.sup' hne f) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_sup' _ fun i hi ↦ (hs i hi).continuousAt
end FinsetSup'
section FinsetSup
variable {ι : Type*} [SemilatticeSup L] [OrderBot L] [ContinuousSup L] {s : Finset ι}
{f : ι → X → L} {t : Set X} {x : X}
lemma ContinuousAt.finset_sup_apply (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (fun a ↦ s.sup (f · a)) x :=
Tendsto.finset_sup_nhds_apply hs
lemma ContinuousAt.finset_sup (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (s.sup f) x := by
simpa only [← Finset.sup_apply] using finset_sup_apply hs
lemma ContinuousWithinAt.finset_sup_apply
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) :
ContinuousWithinAt (fun a ↦ s.sup (f · a)) t x :=
Tendsto.finset_sup_nhds_apply hs
lemma ContinuousWithinAt.finset_sup
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) : ContinuousWithinAt (s.sup f) t x := by
simpa only [← Finset.sup_apply] using finset_sup_apply hs
lemma ContinuousOn.finset_sup_apply (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (fun a ↦ s.sup (f · a)) t := fun x hx ↦
ContinuousWithinAt.finset_sup_apply fun i hi ↦ hs i hi x hx
lemma ContinuousOn.finset_sup (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (s.sup f) t := fun x hx ↦
ContinuousWithinAt.finset_sup fun i hi ↦ hs i hi x hx
lemma Continuous.finset_sup_apply (hs : ∀ i ∈ s, Continuous (f i)) :
Continuous (fun a ↦ s.sup (f · a)) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_sup_apply fun i hi ↦
(hs i hi).continuousAt
lemma Continuous.finset_sup (hs : ∀ i ∈ s, Continuous (f i)) : Continuous (s.sup f) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_sup fun i hi ↦ (hs i hi).continuousAt
end FinsetSup
section FinsetInf'
variable {ι : Type*} [SemilatticeInf L] [ContinuousInf L] {s : Finset ι}
{f : ι → X → L} {t : Set X} {x : X}
lemma ContinuousAt.finset_inf'_apply (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (fun a ↦ s.inf' hne (f · a)) x :=
Tendsto.finset_inf'_nhds_apply hne hs
lemma ContinuousAt.finset_inf' (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (s.inf' hne f) x := by
simpa only [← Finset.inf'_apply] using finset_inf'_apply hne hs
lemma ContinuousWithinAt.finset_inf'_apply (hne : s.Nonempty)
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) :
ContinuousWithinAt (fun a ↦ s.inf' hne (f · a)) t x :=
Tendsto.finset_inf'_nhds_apply hne hs
lemma ContinuousWithinAt.finset_inf' (hne : s.Nonempty)
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) : ContinuousWithinAt (s.inf' hne f) t x := by
simpa only [← Finset.inf'_apply] using finset_inf'_apply hne hs
lemma ContinuousOn.finset_inf'_apply (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (fun a ↦ s.inf' hne (f · a)) t := fun x hx ↦
ContinuousWithinAt.finset_inf'_apply hne fun i hi ↦ hs i hi x hx
lemma ContinuousOn.finset_inf' (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (s.inf' hne f) t := fun x hx ↦
ContinuousWithinAt.finset_inf' hne fun i hi ↦ hs i hi x hx
lemma Continuous.finset_inf'_apply (hne : s.Nonempty) (hs : ∀ i ∈ s, Continuous (f i)) :
Continuous (fun a ↦ s.inf' hne (f · a)) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_inf'_apply _ fun i hi ↦
(hs i hi).continuousAt
lemma Continuous.finset_inf' (hne : s.Nonempty) (hs : ∀ i ∈ s, Continuous (f i)) :
Continuous (s.inf' hne f) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_inf' _ fun i hi ↦ (hs i hi).continuousAt
end FinsetInf'
section FinsetInf
variable {ι : Type*} [SemilatticeInf L] [OrderTop L] [ContinuousInf L] {s : Finset ι}
{f : ι → X → L} {t : Set X} {x : X}
lemma ContinuousAt.finset_inf_apply (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (fun a ↦ s.inf (f · a)) x :=
Tendsto.finset_inf_nhds_apply hs
lemma ContinuousAt.finset_inf (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
ContinuousAt (s.inf f) x := by
simpa only [← Finset.inf_apply] using finset_inf_apply hs
lemma ContinuousWithinAt.finset_inf_apply
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) :
ContinuousWithinAt (fun a ↦ s.inf (f · a)) t x :=
Tendsto.finset_inf_nhds_apply hs
lemma ContinuousWithinAt.finset_inf
(hs : ∀ i ∈ s, ContinuousWithinAt (f i) t x) : ContinuousWithinAt (s.inf f) t x := by
simpa only [← Finset.inf_apply] using finset_inf_apply hs
lemma ContinuousOn.finset_inf_apply (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (fun a ↦ s.inf (f · a)) t := fun x hx ↦
ContinuousWithinAt.finset_inf_apply fun i hi ↦ hs i hi x hx
lemma ContinuousOn.finset_inf (hs : ∀ i ∈ s, ContinuousOn (f i) t) :
ContinuousOn (s.inf f) t := fun x hx ↦
ContinuousWithinAt.finset_inf fun i hi ↦ hs i hi x hx
lemma Continuous.finset_inf_apply (hs : ∀ i ∈ s, Continuous (f i)) :
Continuous (fun a ↦ s.inf (f · a)) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_inf_apply fun i hi ↦
(hs i hi).continuousAt
lemma Continuous.finset_inf (hs : ∀ i ∈ s, Continuous (f i)) : Continuous (s.inf f) :=
continuous_iff_continuousAt.2 fun _ ↦ ContinuousAt.finset_inf fun i hi ↦ (hs i hi).continuousAt
end FinsetInf |
.lake/packages/mathlib/Mathlib/Topology/Order/HullKernel.lean | import Mathlib.Data.Set.Subset
import Mathlib.Order.Irreducible
import Mathlib.Topology.Order.LowerUpperTopology
import Mathlib.Topology.Sets.Closeds
/-!
# Hull-Kernel Topology
Let `α` be a `CompleteLattice` and let `T` be a subset of `α`. The pair of maps
`S → sInf (Subtype.val '' S)` and `a → T ↓∩ Ici a` are often referred to as the `kernel` and the
`hull` respectively. They form an antitone Galois connection between the subsets of `T` and `α`.
When `α` can be generated from `T` by taking infs, this becomes a Galois insertion and the relative
topology (`Topology.lower`) on `T` takes on a particularly simple form: the relative-open sets are
exactly the sets of the form `(hull T a)ᶜ` for some `a` in `α`. The topological closure coincides
with the closure arising from the Galois insertion. For this reason the relative lower topology on
`T` is often referred to as the "hull-kernel topology". The names "Jacobson topology" and "structure
topology" also occur in the literature.
## Main statements
- `PrimitiveSpectrum.isTopologicalBasis_relativeLower` - the sets `(hull a)ᶜ` form a basis for the
relative lower topology on `T`.
- `PrimitiveSpectrum.isOpen_iff` - for a complete lattice, the sets `(hull a)ᶜ` are the relative
topology.
- `PrimitiveSpectrum.gc` - the `kernel` and the `hull` form a Galois connection
- `PrimitiveSpectrum.gi` - when `T` generates `α`, the Galois connection becomes an insertion.
## Implementation notes
The antitone Galois connection from `Set T` to `α` is implemented as a monotone Galois connection
between `Set T` to `αᵒᵈ`.
## Motivation
The motivating example for the study of a set `T` of prime elements which generate `α` is the
primitive spectrum of the lattice of M-ideals of a Banach space.
## References
* [Gierz et al, *A Compendium of Continuous Lattices*][GierzEtAl1980]
* [Henriksen et al, *Joincompact spaces, continuous lattices and C*-algebras*][henriksen_et_al1997]
## Tags
lower topology, hull-kernel topology, Jacobson topology, structure topology, primitive spectrum
-/
variable {α}
open TopologicalSpace
open Topology
open Set
open Set.Notation
section SemilatticeInf
variable [SemilatticeInf α]
namespace PrimitiveSpectrum
/-- For `a` of type `α` the set of element of `T` which dominate `a` is the `hull` of `a` in `T`. -/
abbrev hull (T : Set α) (a : α) := T ↓∩ Ici a
variable {T : Set α}
/- The set of relative-closed sets of the form `hull T a` for some `a` in `α` is closed under
pairwise union. -/
lemma hull_inf (hT : ∀ p ∈ T, InfPrime p) (a b : α) :
hull T (a ⊓ b) = hull T a ∪ hull T b := by
ext p
constructor <;> intro h
· exact (hT p p.2).2 h
· rcases h with (h1 | h3)
· exact inf_le_of_left_le h1
· exact inf_le_of_right_le h3
variable [OrderTop α]
/- Every relative-closed set of the form `T ↓∩ (↑(upperClosure F))` for `F` finite is a
relative-closed set of the form `hull T a` where `a = ⨅ F`. -/
open Finset in
lemma hull_finsetInf (hT : ∀ p ∈ T, InfPrime p) (F : Finset α) :
hull T (inf F id) = T ↓∩ upperClosure (F : Set α) := by
rw [coe_upperClosure]
induction F using Finset.cons_induction with
| empty =>
simp only [coe_empty, mem_empty_iff_false, iUnion_of_empty, iUnion_empty, Set.preimage_empty,
inf_empty]
by_contra hf
rw [← Set.not_nonempty_iff_eq_empty, not_not] at hf
obtain ⟨x, hx⟩ := hf
exact (hT x (Subtype.coe_prop x)).1 (isMax_iff_eq_top.mpr (eq_top_iff.mpr hx))
| cons a F' _ I4 => simp [hull_inf hT, I4]
/- Every relative-open set of the form `T ↓∩ (↑(upperClosure F))ᶜ` for `F` finite is a relative-open
set of the form `(hull T a)ᶜ` where `a = ⨅ F`. -/
open Finset in
lemma preimage_upperClosure_compl_finset (hT : ∀ p ∈ T, InfPrime p) (F : Finset α) :
T ↓∩ (upperClosure (F : Set α))ᶜ = (hull T (inf F id))ᶜ := by
rw [Set.preimage_compl, (hull_finsetInf hT)]
variable [TopologicalSpace α] [IsLower α]
/-
The relative-open sets of the form `(hull T a)ᶜ` for `a` in `α` form a basis for the relative
Lower topology.
-/
lemma isTopologicalBasis_relativeLower (hT : ∀ p ∈ T, InfPrime p) :
IsTopologicalBasis { S : Set T | ∃ (a : α), (hull T a)ᶜ = S } := by
convert isTopologicalBasis_subtype Topology.IsLower.isTopologicalBasis T
ext R
simp only [preimage_compl, mem_setOf_eq, IsLower.lowerBasis, mem_image, exists_exists_and_eq_and]
constructor <;> intro ha
· obtain ⟨a, ha'⟩ := ha
use {a}
rw [← (Function.Injective.preimage_image Subtype.val_injective R), ← ha']
simp only [finite_singleton, upperClosure_singleton, UpperSet.coe_Ici, image_val_compl,
Subtype.image_preimage_coe, diff_self_inter, preimage_diff, Subtype.coe_preimage_self,
true_and]
exact compl_eq_univ_diff (Subtype.val ⁻¹' Ici a)
· obtain ⟨F, hF⟩ := ha
lift F to Finset α using hF.1
use Finset.inf F id
ext
simp [hull_finsetInf hT, ← hF.2]
end PrimitiveSpectrum
end SemilatticeInf
namespace PrimitiveSpectrum
variable [CompleteLattice α] {T : Set α}
universe v
lemma hull_iSup {ι : Sort v} (s : ι → α) : hull T (iSup s) = ⋂ i, hull T (s i) := by aesop
lemma hull_sSup (S : Set α) : hull T (sSup S) = ⋂₀ { hull T a | a ∈ S } := by aesop
/- When `α` is complete, a set is Lower topology relative-open if and only if it is of the form
`(hull T a)ᶜ` for some `a` in `α`.-/
lemma isOpen_iff [TopologicalSpace α] [IsLower α] (hT : ∀ p ∈ T, InfPrime p)
(S : Set T) : IsOpen S ↔ ∃ (a : α), S = (hull T a)ᶜ := by
constructor <;> intro h
· let R := {a : α | (hull T a)ᶜ ⊆ S}
use sSup R
rw [IsTopologicalBasis.open_eq_sUnion' (isTopologicalBasis_relativeLower hT) h]
aesop
· obtain ⟨a, ha⟩ := h
exact ⟨(Ici a)ᶜ, isClosed_Ici.isOpen_compl, ha.symm⟩
/- When `α` is complete, a set is closed in the relative lower topology if and only if it is of the
form `hull T a` for some `a` in `α`.-/
lemma isClosed_iff [TopologicalSpace α] [IsLower α] (hT : ∀ p ∈ T, InfPrime p)
{S : Set T} : IsClosed S ↔ ∃ (a : α), S = hull T a := by
simp only [← isOpen_compl_iff, isOpen_iff hT, compl_inj_iff]
/-- For a subset `S` of `T`, `kernel S` is the infimum of `S` (considered as a set of `α`) -/
abbrev kernel (S : Set T) := sInf (Subtype.val '' S)
/- The pair of maps `kernel` and `hull` form an antitone Galois connection between the
subsets of `T` and `α`. -/
open OrderDual in
theorem gc : GaloisConnection (α := Set T) (β := αᵒᵈ)
(fun S => toDual (kernel S)) (fun a => hull T (ofDual a)) := fun S a => by
simp [Set.subset_def]
lemma gc_closureOperator (S : Set T) : gc.closureOperator S = hull T (kernel S) := by
simp only [toDual_sInf, GaloisConnection.closureOperator_apply, ofDual_sSup]
rw [← preimage_comp, ← OrderDual.toDual_symm_eq, Equiv.symm_comp_self, preimage_id_eq, id_eq]
variable (T)
/-- `T` order generates `α` if, for every `a` in `α`, there exists a subset of `T` such that `a` is
the `kernel` of `S`. -/
def OrderGenerates := ∀ (a : α), ∃ (S : Set T), a = kernel S
variable {T}
/--
When `T` is order generating, the `kernel` and the `hull` form a Galois insertion
-/
def gi (hG : OrderGenerates T) : GaloisInsertion (α := Set T) (β := αᵒᵈ)
(OrderDual.toDual ∘ kernel)
(hull T ∘ OrderDual.ofDual) :=
gc.toGaloisInsertion fun a ↦ by
obtain ⟨S, rfl⟩ := hG a
rw [OrderDual.le_toDual, kernel, kernel]
exact sInf_le_sInf <| image_val_mono fun c hcS => by
rw [hull, mem_preimage, mem_Ici]
exact CompleteSemilatticeInf.sInf_le _ _ (mem_image_of_mem Subtype.val hcS)
lemma kernel_hull (hG : OrderGenerates T) (a : α) : kernel (hull T a) = a := by
conv_rhs => rw [← OrderDual.ofDual_toDual a, ← (gi hG).l_u_eq a]
rfl
lemma hull_kernel_of_isClosed [TopologicalSpace α] [IsLower α]
(hT : ∀ p ∈ T, InfPrime p) (hG : OrderGenerates T) {C : Set T} (h : IsClosed C) :
hull T (kernel C) = C := by
obtain ⟨a, ha⟩ := (isClosed_iff hT).mp h
rw [ha, kernel_hull hG]
lemma closedsGC_closureOperator [TopologicalSpace α] [IsLower α]
(hT : ∀ p ∈ T, InfPrime p) (hG : OrderGenerates T) (S : Set T) :
(TopologicalSpace.Closeds.gc (α := T)).closureOperator S = hull T (kernel S) := by
simp only [GaloisConnection.closureOperator_apply, Closeds.coe_closure, closure, le_antisymm_iff]
constructor
· exact fun ⦃a⦄ a ↦ a (hull T (kernel S)) ⟨(isClosed_iff hT).mpr ⟨kernel S, rfl⟩,
image_subset_iff.mp (fun _ hbS => CompleteSemilatticeInf.sInf_le _ _ hbS)⟩
· simp_rw [le_eq_subset, subset_sInter_iff]
intro R hR
rw [← (hull_kernel_of_isClosed hT hG hR.1), ← gc_closureOperator]
exact ClosureOperator.monotone _ hR.2
end PrimitiveSpectrum |
.lake/packages/mathlib/Mathlib/Topology/Order/Rolle.lean | import Mathlib.Topology.Order.ExtendFrom
import Mathlib.Topology.Order.Compact
import Mathlib.Topology.Order.LocalExtr
import Mathlib.Topology.Order.T5
/-!
# Rolle's Theorem (topological part)
In this file we prove the purely topological part of Rolle's Theorem:
a function that is continuous on an interval $[a, b]$, $a < b$,
has a local extremum at a point $x ∈ (a, b)$ provided that $f(a)=f(b)$.
We also prove several variations of this statement.
In `Mathlib/Analysis/Calculus/LocalExtr/Rolle` we use these lemmas
to prove several versions of Rolle's Theorem from calculus.
## Keywords
local minimum, local maximum, extremum, Rolle's Theorem
-/
open Filter Set Topology
variable {X Y : Type*}
[ConditionallyCompleteLinearOrder X] [DenselyOrdered X] [TopologicalSpace X] [OrderTopology X]
[LinearOrder Y] [TopologicalSpace Y] [OrderTopology Y]
{f : X → Y} {a b : X} {l : Y}
/-- A continuous function on a closed interval with `f a = f b`
takes either its maximum or its minimum value at a point in the interior of the interval. -/
theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
∃ c ∈ Ioo a b, IsExtrOn f (Icc a b) c := by
have ne : (Icc a b).Nonempty := nonempty_Icc.2 (le_of_lt hab)
-- Consider absolute min and max points
obtain ⟨c, cmem, cle⟩ : ∃ c ∈ Icc a b, ∀ x ∈ Icc a b, f c ≤ f x :=
isCompact_Icc.exists_isMinOn ne hfc
obtain ⟨C, Cmem, Cge⟩ : ∃ C ∈ Icc a b, ∀ x ∈ Icc a b, f x ≤ f C :=
isCompact_Icc.exists_isMaxOn ne hfc
by_cases hc : f c = f a
· by_cases hC : f C = f a
· have : ∀ x ∈ Icc a b, f x = f a := fun x hx => le_antisymm (hC ▸ Cge x hx) (hc ▸ cle x hx)
-- `f` is a constant, so we can take any point in `Ioo a b`
rcases nonempty_Ioo.2 hab with ⟨c', hc'⟩
refine ⟨c', hc', Or.inl fun x hx ↦ ?_⟩
simp only [mem_setOf_eq, this x hx, this c' (Ioo_subset_Icc_self hc'), le_rfl]
· refine ⟨C, ⟨lt_of_le_of_ne Cmem.1 <| mt ?_ hC, lt_of_le_of_ne Cmem.2 <| mt ?_ hC⟩, Or.inr Cge⟩
exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
· refine ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt ?_ hc, lt_of_le_of_ne cmem.2 <| mt ?_ hc⟩, Or.inl cle⟩
exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
/-- A continuous function on a closed interval with `f a = f b`
has a local extremum at some point of the corresponding open interval. -/
theorem exists_isLocalExtr_Ioo (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
∃ c ∈ Ioo a b, IsLocalExtr f c :=
let ⟨c, cmem, hc⟩ := exists_Ioo_extr_on_Icc hab hfc hfI
⟨c, cmem, hc.isLocalExtr <| Icc_mem_nhds cmem.1 cmem.2⟩
/-- If a function `f` is continuous on an open interval
and tends to the same value at its endpoints, then it has an extremum on this open interval. -/
lemma exists_isExtrOn_Ioo_of_tendsto (hab : a < b) (hfc : ContinuousOn f (Ioo a b))
(ha : Tendsto f (𝓝[>] a) (𝓝 l)) (hb : Tendsto f (𝓝[<] b) (𝓝 l)) :
∃ c ∈ Ioo a b, IsExtrOn f (Ioo a b) c := by
have h : EqOn (extendFrom (Ioo a b) f) f (Ioo a b) := extendFrom_extends hfc
obtain ⟨c, hc, hfc⟩ : ∃ c ∈ Ioo a b, IsExtrOn (extendFrom (Ioo a b) f) (Icc a b) c :=
exists_Ioo_extr_on_Icc hab (continuousOn_Icc_extendFrom_Ioo hab.ne hfc ha hb)
((eq_lim_at_left_extendFrom_Ioo hab ha).trans (eq_lim_at_right_extendFrom_Ioo hab hb).symm)
exact ⟨c, hc, (hfc.on_subset Ioo_subset_Icc_self).congr h (h hc)⟩
/-- If a function `f` is continuous on an open interval
and tends to the same value at its endpoints,
then it has a local extremum on this open interval. -/
lemma exists_isLocalExtr_Ioo_of_tendsto (hab : a < b) (hfc : ContinuousOn f (Ioo a b))
(ha : Tendsto f (𝓝[>] a) (𝓝 l)) (hb : Tendsto f (𝓝[<] b) (𝓝 l)) :
∃ c ∈ Ioo a b, IsLocalExtr f c :=
let ⟨c, cmem, hc⟩ := exists_isExtrOn_Ioo_of_tendsto hab hfc ha hb
⟨c, cmem, hc.isLocalExtr <| Ioo_mem_nhds cmem.1 cmem.2⟩ |
.lake/packages/mathlib/Mathlib/Topology/Order/LocalExtr.lean | import Mathlib.Order.Filter.Extr
import Mathlib.Topology.ContinuousOn
/-!
# Local extrema of functions on topological spaces
## Main definitions
This file defines special versions of `Is*Filter f a l`, `*=Min/Max/Extr`, from
`Mathlib/Order/Filter/Extr.lean` for two kinds of filters: `nhdsWithin` and `nhds`.
These versions are called `IsLocal*On` and `IsLocal*`, respectively.
## Main statements
Many lemmas in this file restate those from `Mathlib/Order/Filter/Extr.lean`, and you can find
detailed documentation there. These convenience lemmas are provided only to make the dot notation
return propositions of expected types, not just `Is*Filter`.
Here is the list of statements specific to these two types of filters:
* `IsLocal*.on`, `IsLocal*On.on_subset`: restrict to a subset;
* `IsLocal*On.inter` : intersect the set with another one;
* `Is*On.localize` : a global extremum is a local extremum too.
* `Is[Local]*On.isLocal*` : if we have `IsLocal*On f s a` and `s ∈ 𝓝 a`, then we have
`IsLocal* f a`.
-/
universe u v w x
variable {α : Type u} {β : Type v} {γ : Type w} {δ : Type x} [TopologicalSpace α]
open Set Filter Topology
section Preorder
variable [Preorder β] [Preorder γ] (f : α → β) (s : Set α) (a : α)
/-- `IsLocalMinOn f s a` means that `f a ≤ f x` for all `x ∈ s` in some neighborhood of `a`. -/
def IsLocalMinOn :=
IsMinFilter f (𝓝[s] a) a
/-- `IsLocalMaxOn f s a` means that `f x ≤ f a` for all `x ∈ s` in some neighborhood of `a`. -/
def IsLocalMaxOn :=
IsMaxFilter f (𝓝[s] a) a
/-- `IsLocalExtrOn f s a` means `IsLocalMinOn f s a ∨ IsLocalMaxOn f s a`. -/
def IsLocalExtrOn :=
IsExtrFilter f (𝓝[s] a) a
/-- `IsLocalMin f a` means that `f a ≤ f x` for all `x` in some neighborhood of `a`. -/
def IsLocalMin :=
IsMinFilter f (𝓝 a) a
/-- `IsLocalMax f a` means that `f x ≤ f a` for all `x ∈ s` in some neighborhood of `a`. -/
def IsLocalMax :=
IsMaxFilter f (𝓝 a) a
/-- `IsLocalExtr f s a` means `IsLocalMin f s a ∨ IsLocalMax f s a`. -/
def IsLocalExtr :=
IsExtrFilter f (𝓝 a) a
variable {f s a}
theorem IsLocalExtrOn.elim {p : Prop} :
IsLocalExtrOn f s a → (IsLocalMinOn f s a → p) → (IsLocalMaxOn f s a → p) → p :=
Or.elim
theorem IsLocalExtr.elim {p : Prop} :
IsLocalExtr f a → (IsLocalMin f a → p) → (IsLocalMax f a → p) → p :=
Or.elim
/-! ### Restriction to (sub)sets -/
theorem IsLocalMin.on (h : IsLocalMin f a) (s) : IsLocalMinOn f s a :=
h.filter_inf _
theorem IsLocalMax.on (h : IsLocalMax f a) (s) : IsLocalMaxOn f s a :=
h.filter_inf _
theorem IsLocalExtr.on (h : IsLocalExtr f a) (s) : IsLocalExtrOn f s a :=
h.filter_inf _
theorem IsLocalMinOn.on_subset {t : Set α} (hf : IsLocalMinOn f t a) (h : s ⊆ t) :
IsLocalMinOn f s a :=
hf.filter_mono <| nhdsWithin_mono a h
theorem IsLocalMaxOn.on_subset {t : Set α} (hf : IsLocalMaxOn f t a) (h : s ⊆ t) :
IsLocalMaxOn f s a :=
hf.filter_mono <| nhdsWithin_mono a h
theorem IsLocalExtrOn.on_subset {t : Set α} (hf : IsLocalExtrOn f t a) (h : s ⊆ t) :
IsLocalExtrOn f s a :=
hf.filter_mono <| nhdsWithin_mono a h
theorem IsLocalMinOn.inter (hf : IsLocalMinOn f s a) (t) : IsLocalMinOn f (s ∩ t) a :=
hf.on_subset inter_subset_left
theorem IsLocalMaxOn.inter (hf : IsLocalMaxOn f s a) (t) : IsLocalMaxOn f (s ∩ t) a :=
hf.on_subset inter_subset_left
theorem IsLocalExtrOn.inter (hf : IsLocalExtrOn f s a) (t) : IsLocalExtrOn f (s ∩ t) a :=
hf.on_subset inter_subset_left
theorem IsMinOn.localize (hf : IsMinOn f s a) : IsLocalMinOn f s a :=
hf.filter_mono <| inf_le_right
theorem IsMaxOn.localize (hf : IsMaxOn f s a) : IsLocalMaxOn f s a :=
hf.filter_mono <| inf_le_right
theorem IsExtrOn.localize (hf : IsExtrOn f s a) : IsLocalExtrOn f s a :=
hf.filter_mono <| inf_le_right
theorem IsLocalMinOn.isLocalMin (hf : IsLocalMinOn f s a) (hs : s ∈ 𝓝 a) : IsLocalMin f a :=
have : 𝓝 a ≤ 𝓟 s := le_principal_iff.2 hs
hf.filter_mono <| le_inf le_rfl this
theorem IsLocalMaxOn.isLocalMax (hf : IsLocalMaxOn f s a) (hs : s ∈ 𝓝 a) : IsLocalMax f a :=
have : 𝓝 a ≤ 𝓟 s := le_principal_iff.2 hs
hf.filter_mono <| le_inf le_rfl this
theorem IsLocalExtrOn.isLocalExtr (hf : IsLocalExtrOn f s a) (hs : s ∈ 𝓝 a) : IsLocalExtr f a :=
hf.elim (fun hf => (hf.isLocalMin hs).isExtr) fun hf => (hf.isLocalMax hs).isExtr
lemma isLocalMinOn_univ_iff : IsLocalMinOn f univ a ↔ IsLocalMin f a := by
simp only [IsLocalMinOn, IsLocalMin, nhdsWithin_univ]
lemma isLocalMaxOn_univ_iff : IsLocalMaxOn f univ a ↔ IsLocalMax f a := by
simp only [IsLocalMaxOn, IsLocalMax, nhdsWithin_univ]
lemma isLocalExtrOn_univ_iff : IsLocalExtrOn f univ a ↔ IsLocalExtr f a :=
isLocalMinOn_univ_iff.or isLocalMaxOn_univ_iff
theorem IsMinOn.isLocalMin (hf : IsMinOn f s a) (hs : s ∈ 𝓝 a) : IsLocalMin f a :=
hf.localize.isLocalMin hs
theorem IsMaxOn.isLocalMax (hf : IsMaxOn f s a) (hs : s ∈ 𝓝 a) : IsLocalMax f a :=
hf.localize.isLocalMax hs
theorem IsExtrOn.isLocalExtr (hf : IsExtrOn f s a) (hs : s ∈ 𝓝 a) : IsLocalExtr f a :=
hf.localize.isLocalExtr hs
theorem IsLocalMinOn.not_nhds_le_map [TopologicalSpace β] (hf : IsLocalMinOn f s a)
[NeBot (𝓝[<] f a)] : ¬𝓝 (f a) ≤ map f (𝓝[s] a) := fun hle =>
have : ∀ᶠ y in 𝓝[<] f a, f a ≤ y := (eventually_map.2 hf).filter_mono (inf_le_left.trans hle)
let ⟨_y, hy⟩ := (this.and self_mem_nhdsWithin).exists
hy.1.not_gt hy.2
theorem IsLocalMaxOn.not_nhds_le_map [TopologicalSpace β] (hf : IsLocalMaxOn f s a)
[NeBot (𝓝[>] f a)] : ¬𝓝 (f a) ≤ map f (𝓝[s] a) :=
@IsLocalMinOn.not_nhds_le_map α βᵒᵈ _ _ _ _ _ ‹_› hf ‹_›
theorem IsLocalExtrOn.not_nhds_le_map [TopologicalSpace β] (hf : IsLocalExtrOn f s a)
[NeBot (𝓝[<] f a)] [NeBot (𝓝[>] f a)] : ¬𝓝 (f a) ≤ map f (𝓝[s] a) :=
hf.elim (fun h => h.not_nhds_le_map) fun h => h.not_nhds_le_map
/-! ### Constant -/
theorem isLocalMinOn_const {b : β} : IsLocalMinOn (fun _ => b) s a :=
isMinFilter_const
theorem isLocalMaxOn_const {b : β} : IsLocalMaxOn (fun _ => b) s a :=
isMaxFilter_const
theorem isLocalExtrOn_const {b : β} : IsLocalExtrOn (fun _ => b) s a :=
isExtrFilter_const
theorem isLocalMin_const {b : β} : IsLocalMin (fun _ => b) a :=
isMinFilter_const
theorem isLocalMax_const {b : β} : IsLocalMax (fun _ => b) a :=
isMaxFilter_const
theorem isLocalExtr_const {b : β} : IsLocalExtr (fun _ => b) a :=
isExtrFilter_const
/-! ### Composition with (anti)monotone functions -/
nonrec theorem IsLocalMin.comp_mono (hf : IsLocalMin f a) {g : β → γ} (hg : Monotone g) :
IsLocalMin (g ∘ f) a :=
hf.comp_mono hg
nonrec theorem IsLocalMax.comp_mono (hf : IsLocalMax f a) {g : β → γ} (hg : Monotone g) :
IsLocalMax (g ∘ f) a :=
hf.comp_mono hg
nonrec theorem IsLocalExtr.comp_mono (hf : IsLocalExtr f a) {g : β → γ} (hg : Monotone g) :
IsLocalExtr (g ∘ f) a :=
hf.comp_mono hg
nonrec theorem IsLocalMin.comp_antitone (hf : IsLocalMin f a) {g : β → γ} (hg : Antitone g) :
IsLocalMax (g ∘ f) a :=
hf.comp_antitone hg
nonrec theorem IsLocalMax.comp_antitone (hf : IsLocalMax f a) {g : β → γ} (hg : Antitone g) :
IsLocalMin (g ∘ f) a :=
hf.comp_antitone hg
nonrec theorem IsLocalExtr.comp_antitone (hf : IsLocalExtr f a) {g : β → γ} (hg : Antitone g) :
IsLocalExtr (g ∘ f) a :=
hf.comp_antitone hg
nonrec theorem IsLocalMinOn.comp_mono (hf : IsLocalMinOn f s a) {g : β → γ} (hg : Monotone g) :
IsLocalMinOn (g ∘ f) s a :=
hf.comp_mono hg
nonrec theorem IsLocalMaxOn.comp_mono (hf : IsLocalMaxOn f s a) {g : β → γ} (hg : Monotone g) :
IsLocalMaxOn (g ∘ f) s a :=
hf.comp_mono hg
nonrec theorem IsLocalExtrOn.comp_mono (hf : IsLocalExtrOn f s a) {g : β → γ} (hg : Monotone g) :
IsLocalExtrOn (g ∘ f) s a :=
hf.comp_mono hg
nonrec theorem IsLocalMinOn.comp_antitone (hf : IsLocalMinOn f s a) {g : β → γ} (hg : Antitone g) :
IsLocalMaxOn (g ∘ f) s a :=
hf.comp_antitone hg
nonrec theorem IsLocalMaxOn.comp_antitone (hf : IsLocalMaxOn f s a) {g : β → γ} (hg : Antitone g) :
IsLocalMinOn (g ∘ f) s a :=
hf.comp_antitone hg
nonrec theorem IsLocalExtrOn.comp_antitone (hf : IsLocalExtrOn f s a) {g : β → γ}
(hg : Antitone g) : IsLocalExtrOn (g ∘ f) s a :=
hf.comp_antitone hg
open scoped Relator
nonrec theorem IsLocalMin.bicomp_mono [Preorder δ] {op : β → γ → δ}
(hop : ((· ≤ ·) ⇒ (· ≤ ·) ⇒ (· ≤ ·)) op op) (hf : IsLocalMin f a) {g : α → γ}
(hg : IsLocalMin g a) : IsLocalMin (fun x => op (f x) (g x)) a :=
hf.bicomp_mono hop hg
nonrec theorem IsLocalMax.bicomp_mono [Preorder δ] {op : β → γ → δ}
(hop : ((· ≤ ·) ⇒ (· ≤ ·) ⇒ (· ≤ ·)) op op) (hf : IsLocalMax f a) {g : α → γ}
(hg : IsLocalMax g a) : IsLocalMax (fun x => op (f x) (g x)) a :=
hf.bicomp_mono hop hg
nonrec theorem IsLocalMinOn.bicomp_mono [Preorder δ] {op : β → γ → δ}
(hop : ((· ≤ ·) ⇒ (· ≤ ·) ⇒ (· ≤ ·)) op op) (hf : IsLocalMinOn f s a) {g : α → γ}
(hg : IsLocalMinOn g s a) : IsLocalMinOn (fun x => op (f x) (g x)) s a :=
hf.bicomp_mono hop hg
nonrec theorem IsLocalMaxOn.bicomp_mono [Preorder δ] {op : β → γ → δ}
(hop : ((· ≤ ·) ⇒ (· ≤ ·) ⇒ (· ≤ ·)) op op) (hf : IsLocalMaxOn f s a) {g : α → γ}
(hg : IsLocalMaxOn g s a) : IsLocalMaxOn (fun x => op (f x) (g x)) s a :=
hf.bicomp_mono hop hg
/-! ### Composition with `ContinuousAt` -/
theorem IsLocalMin.comp_continuous [TopologicalSpace δ] {g : δ → α} {b : δ}
(hf : IsLocalMin f (g b)) (hg : ContinuousAt g b) : IsLocalMin (f ∘ g) b :=
hg hf
theorem IsLocalMax.comp_continuous [TopologicalSpace δ] {g : δ → α} {b : δ}
(hf : IsLocalMax f (g b)) (hg : ContinuousAt g b) : IsLocalMax (f ∘ g) b :=
hg hf
theorem IsLocalExtr.comp_continuous [TopologicalSpace δ] {g : δ → α} {b : δ}
(hf : IsLocalExtr f (g b)) (hg : ContinuousAt g b) : IsLocalExtr (f ∘ g) b :=
hf.comp_tendsto hg
theorem IsLocalMin.comp_continuousOn [TopologicalSpace δ] {s : Set δ} {g : δ → α} {b : δ}
(hf : IsLocalMin f (g b)) (hg : ContinuousOn g s) (hb : b ∈ s) : IsLocalMinOn (f ∘ g) s b :=
hf.comp_tendsto (hg b hb)
theorem IsLocalMax.comp_continuousOn [TopologicalSpace δ] {s : Set δ} {g : δ → α} {b : δ}
(hf : IsLocalMax f (g b)) (hg : ContinuousOn g s) (hb : b ∈ s) : IsLocalMaxOn (f ∘ g) s b :=
hf.comp_tendsto (hg b hb)
theorem IsLocalExtr.comp_continuousOn [TopologicalSpace δ] {s : Set δ} (g : δ → α) {b : δ}
(hf : IsLocalExtr f (g b)) (hg : ContinuousOn g s) (hb : b ∈ s) : IsLocalExtrOn (f ∘ g) s b :=
hf.elim (fun hf => (hf.comp_continuousOn hg hb).isExtr) fun hf =>
(IsLocalMax.comp_continuousOn hf hg hb).isExtr
theorem IsLocalMinOn.comp_continuousOn [TopologicalSpace δ] {t : Set α} {s : Set δ} {g : δ → α}
{b : δ} (hf : IsLocalMinOn f t (g b)) (hst : s ⊆ g ⁻¹' t) (hg : ContinuousOn g s) (hb : b ∈ s) :
IsLocalMinOn (f ∘ g) s b :=
hf.comp_tendsto
(tendsto_nhdsWithin_mono_right (image_subset_iff.mpr hst)
(ContinuousWithinAt.tendsto_nhdsWithin_image (hg b hb)))
theorem IsLocalMaxOn.comp_continuousOn [TopologicalSpace δ] {t : Set α} {s : Set δ} {g : δ → α}
{b : δ} (hf : IsLocalMaxOn f t (g b)) (hst : s ⊆ g ⁻¹' t) (hg : ContinuousOn g s) (hb : b ∈ s) :
IsLocalMaxOn (f ∘ g) s b :=
hf.comp_tendsto
(tendsto_nhdsWithin_mono_right (image_subset_iff.mpr hst)
(ContinuousWithinAt.tendsto_nhdsWithin_image (hg b hb)))
theorem IsLocalExtrOn.comp_continuousOn [TopologicalSpace δ] {t : Set α} {s : Set δ} (g : δ → α)
{b : δ} (hf : IsLocalExtrOn f t (g b)) (hst : s ⊆ g ⁻¹' t) (hg : ContinuousOn g s)
(hb : b ∈ s) : IsLocalExtrOn (f ∘ g) s b :=
hf.elim (fun hf => (hf.comp_continuousOn hst hg hb).isExtr) fun hf =>
(IsLocalMaxOn.comp_continuousOn hf hst hg hb).isExtr
end Preorder
/-! ### Pointwise addition -/
section OrderedAddCommMonoid
variable [AddCommMonoid β] [PartialOrder β] [IsOrderedAddMonoid β]
{f g : α → β} {a : α} {s : Set α} {l : Filter α}
nonrec theorem IsLocalMin.add (hf : IsLocalMin f a) (hg : IsLocalMin g a) :
IsLocalMin (fun x => f x + g x) a :=
hf.add hg
nonrec theorem IsLocalMax.add (hf : IsLocalMax f a) (hg : IsLocalMax g a) :
IsLocalMax (fun x => f x + g x) a :=
hf.add hg
nonrec theorem IsLocalMinOn.add (hf : IsLocalMinOn f s a) (hg : IsLocalMinOn g s a) :
IsLocalMinOn (fun x => f x + g x) s a :=
hf.add hg
nonrec theorem IsLocalMaxOn.add (hf : IsLocalMaxOn f s a) (hg : IsLocalMaxOn g s a) :
IsLocalMaxOn (fun x => f x + g x) s a :=
hf.add hg
end OrderedAddCommMonoid
/-! ### Pointwise negation and subtraction -/
section OrderedAddCommGroup
variable [AddCommGroup β] [PartialOrder β] [IsOrderedAddMonoid β]
{f g : α → β} {a : α} {s : Set α} {l : Filter α}
nonrec theorem IsLocalMin.neg (hf : IsLocalMin f a) : IsLocalMax (fun x => -f x) a :=
hf.neg
nonrec theorem IsLocalMax.neg (hf : IsLocalMax f a) : IsLocalMin (fun x => -f x) a :=
hf.neg
nonrec theorem IsLocalExtr.neg (hf : IsLocalExtr f a) : IsLocalExtr (fun x => -f x) a :=
hf.neg
nonrec theorem IsLocalMinOn.neg (hf : IsLocalMinOn f s a) : IsLocalMaxOn (fun x => -f x) s a :=
hf.neg
nonrec theorem IsLocalMaxOn.neg (hf : IsLocalMaxOn f s a) : IsLocalMinOn (fun x => -f x) s a :=
hf.neg
nonrec theorem IsLocalExtrOn.neg (hf : IsLocalExtrOn f s a) : IsLocalExtrOn (fun x => -f x) s a :=
hf.neg
nonrec theorem IsLocalMin.sub (hf : IsLocalMin f a) (hg : IsLocalMax g a) :
IsLocalMin (fun x => f x - g x) a :=
hf.sub hg
nonrec theorem IsLocalMax.sub (hf : IsLocalMax f a) (hg : IsLocalMin g a) :
IsLocalMax (fun x => f x - g x) a :=
hf.sub hg
nonrec theorem IsLocalMinOn.sub (hf : IsLocalMinOn f s a) (hg : IsLocalMaxOn g s a) :
IsLocalMinOn (fun x => f x - g x) s a :=
hf.sub hg
nonrec theorem IsLocalMaxOn.sub (hf : IsLocalMaxOn f s a) (hg : IsLocalMinOn g s a) :
IsLocalMaxOn (fun x => f x - g x) s a :=
hf.sub hg
end OrderedAddCommGroup
/-! ### Pointwise `sup`/`inf` -/
section SemilatticeSup
variable [SemilatticeSup β] {f g : α → β} {a : α} {s : Set α} {l : Filter α}
nonrec theorem IsLocalMin.sup (hf : IsLocalMin f a) (hg : IsLocalMin g a) :
IsLocalMin (fun x => f x ⊔ g x) a :=
hf.sup hg
nonrec theorem IsLocalMax.sup (hf : IsLocalMax f a) (hg : IsLocalMax g a) :
IsLocalMax (fun x => f x ⊔ g x) a :=
hf.sup hg
nonrec theorem IsLocalMinOn.sup (hf : IsLocalMinOn f s a) (hg : IsLocalMinOn g s a) :
IsLocalMinOn (fun x => f x ⊔ g x) s a :=
hf.sup hg
nonrec theorem IsLocalMaxOn.sup (hf : IsLocalMaxOn f s a) (hg : IsLocalMaxOn g s a) :
IsLocalMaxOn (fun x => f x ⊔ g x) s a :=
hf.sup hg
end SemilatticeSup
section SemilatticeInf
variable [SemilatticeInf β] {f g : α → β} {a : α} {s : Set α} {l : Filter α}
nonrec theorem IsLocalMin.inf (hf : IsLocalMin f a) (hg : IsLocalMin g a) :
IsLocalMin (fun x => f x ⊓ g x) a :=
hf.inf hg
nonrec theorem IsLocalMax.inf (hf : IsLocalMax f a) (hg : IsLocalMax g a) :
IsLocalMax (fun x => f x ⊓ g x) a :=
hf.inf hg
nonrec theorem IsLocalMinOn.inf (hf : IsLocalMinOn f s a) (hg : IsLocalMinOn g s a) :
IsLocalMinOn (fun x => f x ⊓ g x) s a :=
hf.inf hg
nonrec theorem IsLocalMaxOn.inf (hf : IsLocalMaxOn f s a) (hg : IsLocalMaxOn g s a) :
IsLocalMaxOn (fun x => f x ⊓ g x) s a :=
hf.inf hg
end SemilatticeInf
/-! ### Pointwise `min`/`max` -/
section LinearOrder
variable [LinearOrder β] {f g : α → β} {a : α} {s : Set α} {l : Filter α}
nonrec theorem IsLocalMin.min (hf : IsLocalMin f a) (hg : IsLocalMin g a) :
IsLocalMin (fun x => min (f x) (g x)) a :=
hf.min hg
nonrec theorem IsLocalMax.min (hf : IsLocalMax f a) (hg : IsLocalMax g a) :
IsLocalMax (fun x => min (f x) (g x)) a :=
hf.min hg
nonrec theorem IsLocalMinOn.min (hf : IsLocalMinOn f s a) (hg : IsLocalMinOn g s a) :
IsLocalMinOn (fun x => min (f x) (g x)) s a :=
hf.min hg
nonrec theorem IsLocalMaxOn.min (hf : IsLocalMaxOn f s a) (hg : IsLocalMaxOn g s a) :
IsLocalMaxOn (fun x => min (f x) (g x)) s a :=
hf.min hg
nonrec theorem IsLocalMin.max (hf : IsLocalMin f a) (hg : IsLocalMin g a) :
IsLocalMin (fun x => max (f x) (g x)) a :=
hf.max hg
nonrec theorem IsLocalMax.max (hf : IsLocalMax f a) (hg : IsLocalMax g a) :
IsLocalMax (fun x => max (f x) (g x)) a :=
hf.max hg
nonrec theorem IsLocalMinOn.max (hf : IsLocalMinOn f s a) (hg : IsLocalMinOn g s a) :
IsLocalMinOn (fun x => max (f x) (g x)) s a :=
hf.max hg
nonrec theorem IsLocalMaxOn.max (hf : IsLocalMaxOn f s a) (hg : IsLocalMaxOn g s a) :
IsLocalMaxOn (fun x => max (f x) (g x)) s a :=
hf.max hg
end LinearOrder
section Eventually
/-! ### Relation with `eventually` comparisons of two functions -/
variable [Preorder β] {s : Set α}
theorem Filter.EventuallyLE.isLocalMaxOn {f g : α → β} {a : α} (hle : g ≤ᶠ[𝓝[s] a] f)
(hfga : f a = g a) (h : IsLocalMaxOn f s a) : IsLocalMaxOn g s a :=
hle.isMaxFilter hfga h
nonrec theorem IsLocalMaxOn.congr {f g : α → β} {a : α} (h : IsLocalMaxOn f s a)
(heq : f =ᶠ[𝓝[s] a] g) (hmem : a ∈ s) : IsLocalMaxOn g s a :=
h.congr heq <| heq.eq_of_nhdsWithin hmem
theorem Filter.EventuallyEq.isLocalMaxOn_iff {f g : α → β} {a : α} (heq : f =ᶠ[𝓝[s] a] g)
(hmem : a ∈ s) : IsLocalMaxOn f s a ↔ IsLocalMaxOn g s a :=
heq.isMaxFilter_iff <| heq.eq_of_nhdsWithin hmem
theorem Filter.EventuallyLE.isLocalMinOn {f g : α → β} {a : α} (hle : f ≤ᶠ[𝓝[s] a] g)
(hfga : f a = g a) (h : IsLocalMinOn f s a) : IsLocalMinOn g s a :=
hle.isMinFilter hfga h
nonrec theorem IsLocalMinOn.congr {f g : α → β} {a : α} (h : IsLocalMinOn f s a)
(heq : f =ᶠ[𝓝[s] a] g) (hmem : a ∈ s) : IsLocalMinOn g s a :=
h.congr heq <| heq.eq_of_nhdsWithin hmem
nonrec theorem Filter.EventuallyEq.isLocalMinOn_iff {f g : α → β} {a : α} (heq : f =ᶠ[𝓝[s] a] g)
(hmem : a ∈ s) : IsLocalMinOn f s a ↔ IsLocalMinOn g s a :=
heq.isMinFilter_iff <| heq.eq_of_nhdsWithin hmem
nonrec theorem IsLocalExtrOn.congr {f g : α → β} {a : α} (h : IsLocalExtrOn f s a)
(heq : f =ᶠ[𝓝[s] a] g) (hmem : a ∈ s) : IsLocalExtrOn g s a :=
h.congr heq <| heq.eq_of_nhdsWithin hmem
theorem Filter.EventuallyEq.isLocalExtrOn_iff {f g : α → β} {a : α} (heq : f =ᶠ[𝓝[s] a] g)
(hmem : a ∈ s) : IsLocalExtrOn f s a ↔ IsLocalExtrOn g s a :=
heq.isExtrFilter_iff <| heq.eq_of_nhdsWithin hmem
theorem Filter.EventuallyLE.isLocalMax {f g : α → β} {a : α} (hle : g ≤ᶠ[𝓝 a] f) (hfga : f a = g a)
(h : IsLocalMax f a) : IsLocalMax g a :=
hle.isMaxFilter hfga h
nonrec theorem IsLocalMax.congr {f g : α → β} {a : α} (h : IsLocalMax f a) (heq : f =ᶠ[𝓝 a] g) :
IsLocalMax g a :=
h.congr heq heq.eq_of_nhds
theorem Filter.EventuallyEq.isLocalMax_iff {f g : α → β} {a : α} (heq : f =ᶠ[𝓝 a] g) :
IsLocalMax f a ↔ IsLocalMax g a :=
heq.isMaxFilter_iff heq.eq_of_nhds
theorem Filter.EventuallyLE.isLocalMin {f g : α → β} {a : α} (hle : f ≤ᶠ[𝓝 a] g) (hfga : f a = g a)
(h : IsLocalMin f a) : IsLocalMin g a :=
hle.isMinFilter hfga h
nonrec theorem IsLocalMin.congr {f g : α → β} {a : α} (h : IsLocalMin f a) (heq : f =ᶠ[𝓝 a] g) :
IsLocalMin g a :=
h.congr heq heq.eq_of_nhds
theorem Filter.EventuallyEq.isLocalMin_iff {f g : α → β} {a : α} (heq : f =ᶠ[𝓝 a] g) :
IsLocalMin f a ↔ IsLocalMin g a :=
heq.isMinFilter_iff heq.eq_of_nhds
nonrec theorem IsLocalExtr.congr {f g : α → β} {a : α} (h : IsLocalExtr f a) (heq : f =ᶠ[𝓝 a] g) :
IsLocalExtr g a :=
h.congr heq heq.eq_of_nhds
theorem Filter.EventuallyEq.isLocalExtr_iff {f g : α → β} {a : α} (heq : f =ᶠ[𝓝 a] g) :
IsLocalExtr f a ↔ IsLocalExtr g a :=
heq.isExtrFilter_iff heq.eq_of_nhds
end Eventually
/-- If `f` is monotone to the left and antitone to the right, then it has a local maximum. -/
lemma isLocalMax_of_mono_anti' {α : Type*} [TopologicalSpace α] [LinearOrder α]
{β : Type*} [Preorder β] {b : α} {f : α → β}
{a : Set α} (ha : a ∈ 𝓝[≤] b) {c : Set α} (hc : c ∈ 𝓝[≥] b)
(h₀ : MonotoneOn f a) (h₁ : AntitoneOn f c) : IsLocalMax f b :=
have : b ∈ a := mem_of_mem_nhdsWithin (by simp) ha
have : b ∈ c := mem_of_mem_nhdsWithin (by simp) hc
mem_of_superset (nhds_of_Ici_Iic ha hc) (fun x _ => by rcases le_total x b <;> aesop)
/-- If `f` is antitone to the left and monotone to the right, then it has a local minimum. -/
lemma isLocalMin_of_anti_mono' {α : Type*} [TopologicalSpace α] [LinearOrder α]
{β : Type*} [Preorder β] {b : α} {f : α → β}
{a : Set α} (ha : a ∈ 𝓝[≤] b) {c : Set α} (hc : c ∈ 𝓝[≥] b)
(h₀ : AntitoneOn f a) (h₁ : MonotoneOn f c) : IsLocalMin f b :=
have : b ∈ a := mem_of_mem_nhdsWithin (by simp) ha
have : b ∈ c := mem_of_mem_nhdsWithin (by simp) hc
mem_of_superset (nhds_of_Ici_Iic ha hc) (fun x _ => by rcases le_total x b <;> aesop) |
.lake/packages/mathlib/Mathlib/Topology/Order/ExtendFrom.lean | import Mathlib.Topology.ExtendFrom
import Mathlib.Topology.Order.DenselyOrdered
/-!
# Lemmas about `extendFrom` in an order topology.
-/
open Filter Set Topology
variable {α β : Type*}
theorem continuousOn_Icc_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α]
[OrderTopology α] [TopologicalSpace β] [RegularSpace β] {f : α → β} {a b : α} {la lb : β}
(hab : a ≠ b) (hf : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 la))
(hb : Tendsto f (𝓝[<] b) (𝓝 lb)) : ContinuousOn (extendFrom (Ioo a b) f) (Icc a b) := by
apply continuousOn_extendFrom
· rw [closure_Ioo hab]
· intro x x_in
rcases eq_endpoints_or_mem_Ioo_of_mem_Icc x_in with (rfl | rfl | h)
· exact ⟨la, ha.mono_left <| nhdsWithin_mono _ Ioo_subset_Ioi_self⟩
· exact ⟨lb, hb.mono_left <| nhdsWithin_mono _ Ioo_subset_Iio_self⟩
· exact ⟨f x, hf x h⟩
theorem eq_lim_at_left_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α]
[OrderTopology α] [TopologicalSpace β] [T2Space β] {f : α → β} {a b : α} {la : β} (hab : a < b)
(ha : Tendsto f (𝓝[>] a) (𝓝 la)) : extendFrom (Ioo a b) f a = la := by
apply extendFrom_eq
· rw [closure_Ioo hab.ne]
simp only [le_of_lt hab, left_mem_Icc]
· simpa [hab]
theorem eq_lim_at_right_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α]
[OrderTopology α] [TopologicalSpace β] [T2Space β] {f : α → β} {a b : α} {lb : β} (hab : a < b)
(hb : Tendsto f (𝓝[<] b) (𝓝 lb)) : extendFrom (Ioo a b) f b = lb := by
apply extendFrom_eq
· rw [closure_Ioo hab.ne]
simp only [le_of_lt hab, right_mem_Icc]
· simpa [hab]
theorem continuousOn_Ico_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α]
[OrderTopology α] [TopologicalSpace β] [RegularSpace β] {f : α → β} {a b : α} {la : β}
(hab : a < b) (hf : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 la)) :
ContinuousOn (extendFrom (Ioo a b) f) (Ico a b) := by
apply continuousOn_extendFrom
· rw [closure_Ioo hab.ne]
exact Ico_subset_Icc_self
· intro x x_in
rcases eq_left_or_mem_Ioo_of_mem_Ico x_in with (rfl | h)
· use la
simpa [hab]
· exact ⟨f x, hf x h⟩
theorem continuousOn_Ioc_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α]
[OrderTopology α] [TopologicalSpace β] [RegularSpace β] {f : α → β} {a b : α} {lb : β}
(hab : a < b) (hf : ContinuousOn f (Ioo a b)) (hb : Tendsto f (𝓝[<] b) (𝓝 lb)) :
ContinuousOn (extendFrom (Ioo a b) f) (Ioc a b) := by
have := @continuousOn_Ico_extendFrom_Ioo αᵒᵈ _ _ _ _ _ _ _ f _ _ lb hab
erw [Ico_toDual, Ioi_toDual, Ioo_toDual] at this
exact this hf hb |
.lake/packages/mathlib/Mathlib/Topology/Order/Real.lean | import Mathlib.Data.EReal.Basic
import Mathlib.Topology.Order.T5
/-!
# The reals are equipped with their order topology
This file contains results related to the order topology on (extended) (non-negative) real numbers.
We
- prove that `ℝ` and `ℝ≥0` are equipped with the order topology and bornology,
- endow `EReal` with the order topology (and prove some very basic lemmas),
- define the topology `ℝ≥0∞` (which is the order topology, *not* the `EMetricSpace` topology)
-/
assert_not_exists IsTopologicalRing UniformSpace
open Set
namespace EReal
/-!
### Topological structure on `EReal`
We endow `EReal` with the order topology.
Most proofs are adapted from the corresponding proofs on `ℝ≥0∞`.
-/
instance : TopologicalSpace EReal := Preorder.topology EReal
instance : OrderTopology EReal := ⟨rfl⟩
instance : T5Space EReal := inferInstance
instance : T2Space EReal := inferInstance
lemma denseRange_ratCast : DenseRange (fun r : ℚ ↦ ((r : ℝ) : EReal)) :=
dense_of_exists_between fun _ _ h => exists_range_iff.2 <| exists_rat_btwn_of_lt h
end EReal
namespace ENNReal
/-- Topology on `ℝ≥0∞`.
Note: this is different from the `EMetricSpace` topology. The `EMetricSpace` topology has
`IsOpen {∞}`, while this topology doesn't have singleton elements. -/
instance : TopologicalSpace ℝ≥0∞ := Preorder.topology ℝ≥0∞
instance : OrderTopology ℝ≥0∞ := ⟨rfl⟩
-- short-circuit type class inference
instance : T2Space ℝ≥0∞ := inferInstance
instance : T5Space ℝ≥0∞ := inferInstance
instance : T4Space ℝ≥0∞ := inferInstance
end ENNReal |
.lake/packages/mathlib/Mathlib/Topology/Order/Hom/Esakia.lean | import Mathlib.Order.Hom.Bounded
import Mathlib.Topology.Order.Hom.Basic
/-!
# Esakia morphisms
This file defines pseudo-epimorphisms and Esakia morphisms.
We use the `DFunLike` design, so each type of morphisms has a companion typeclass which is meant to
be satisfied by itself and all stricter types.
## Types of morphisms
* `PseudoEpimorphism`: Pseudo-epimorphisms. Maps `f` such that `f a ≤ b` implies the existence of
`a'` such that `a ≤ a'` and `f a' = b`.
* `EsakiaHom`: Esakia morphisms. Continuous pseudo-epimorphisms.
## Typeclasses
* `PseudoEpimorphismClass`
* `EsakiaHomClass`
## References
* [Wikipedia, *Esakia space*](https://en.wikipedia.org/wiki/Esakia_space)
-/
open Function
variable {F α β γ δ : Type*}
/-- The type of pseudo-epimorphisms, aka p-morphisms, aka bounded maps, from `α` to `β`. -/
structure PseudoEpimorphism (α β : Type*) [Preorder α] [Preorder β] extends α →o β where
exists_map_eq_of_map_le' ⦃a : α⦄ ⦃b : β⦄ : toFun a ≤ b → ∃ c, a ≤ c ∧ toFun c = b
/-- The type of Esakia morphisms, aka continuous pseudo-epimorphisms, from `α` to `β`. -/
structure EsakiaHom (α β : Type*) [TopologicalSpace α] [Preorder α] [TopologicalSpace β]
[Preorder β] extends α →Co β where
exists_map_eq_of_map_le' ⦃a : α⦄ ⦃b : β⦄ : toFun a ≤ b → ∃ c, a ≤ c ∧ toFun c = b
section
/-- `PseudoEpimorphismClass F α β` states that `F` is a type of `⊔`-preserving morphisms.
You should extend this class when you extend `PseudoEpimorphism`. -/
class PseudoEpimorphismClass (F : Type*) (α β : outParam Type*)
[Preorder α] [Preorder β] [FunLike F α β] : Prop
extends RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) where
exists_map_eq_of_map_le (f : F) ⦃a : α⦄ ⦃b : β⦄ : f a ≤ b → ∃ c, a ≤ c ∧ f c = b
/-- `EsakiaHomClass F α β` states that `F` is a type of lattice morphisms.
You should extend this class when you extend `EsakiaHom`. -/
class EsakiaHomClass (F : Type*) (α β : outParam Type*) [TopologicalSpace α] [Preorder α]
[TopologicalSpace β] [Preorder β] [FunLike F α β] : Prop
extends ContinuousOrderHomClass F α β where
exists_map_eq_of_map_le (f : F) ⦃a : α⦄ ⦃b : β⦄ : f a ≤ b → ∃ c, a ≤ c ∧ f c = b
end
export PseudoEpimorphismClass (exists_map_eq_of_map_le)
section Hom
variable [FunLike F α β]
-- See note [lower instance priority]
instance (priority := 100) PseudoEpimorphismClass.toTopHomClass [PartialOrder α] [OrderTop α]
[Preorder β] [OrderTop β] [PseudoEpimorphismClass F α β] : TopHomClass F α β where
map_top f := by
let ⟨b, h⟩ := exists_map_eq_of_map_le f (@le_top _ _ _ <| f ⊤)
rw [← top_le_iff.1 h.1, h.2]
-- See note [lower instance priority]
instance (priority := 100) EsakiaHomClass.toPseudoEpimorphismClass [TopologicalSpace α] [Preorder α]
[TopologicalSpace β] [Preorder β] [EsakiaHomClass F α β] : PseudoEpimorphismClass F α β :=
{ ‹EsakiaHomClass F α β› with
map_rel := ContinuousOrderHomClass.map_monotone }
instance [Preorder α] [Preorder β] [PseudoEpimorphismClass F α β] :
CoeTC F (PseudoEpimorphism α β) :=
⟨fun f => ⟨f, exists_map_eq_of_map_le f⟩⟩
instance [TopologicalSpace α] [Preorder α] [TopologicalSpace β] [Preorder β]
[EsakiaHomClass F α β] : CoeTC F (EsakiaHom α β) :=
⟨fun f => ⟨f, exists_map_eq_of_map_le f⟩⟩
end Hom
-- See note [lower instance priority]
instance (priority := 100) OrderIsoClass.toPseudoEpimorphismClass [Preorder α] [Preorder β]
[EquivLike F α β] [OrderIsoClass F α β] : PseudoEpimorphismClass F α β where
exists_map_eq_of_map_le f _a b h :=
⟨EquivLike.inv f b, (le_map_inv_iff f).2 h, EquivLike.right_inv _ _⟩
/-! ### Pseudo-epimorphisms -/
namespace PseudoEpimorphism
variable [Preorder α] [Preorder β] [Preorder γ] [Preorder δ]
instance instFunLike : FunLike (PseudoEpimorphism α β) α β where
coe f := f.toFun
coe_injective' f g h := by
obtain ⟨⟨_, _⟩, _⟩ := f
obtain ⟨⟨_, _⟩, _⟩ := g
congr
instance : PseudoEpimorphismClass (PseudoEpimorphism α β) α β where
map_rel f _ _ h := f.monotone' h
exists_map_eq_of_map_le := PseudoEpimorphism.exists_map_eq_of_map_le'
@[simp]
theorem toOrderHom_eq_coe (f : PseudoEpimorphism α β) : ⇑f.toOrderHom = f := rfl
theorem toFun_eq_coe {f : PseudoEpimorphism α β} : f.toFun = (f : α → β) := rfl
@[ext]
theorem ext {f g : PseudoEpimorphism α β} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext f g h
/-- Copy of a `PseudoEpimorphism` with a new `toFun` equal to the old one. Useful to fix
definitional equalities. -/
protected def copy (f : PseudoEpimorphism α β) (f' : α → β) (h : f' = f) : PseudoEpimorphism α β :=
⟨f.toOrderHom.copy f' h, by simpa only [h.symm, toFun_eq_coe] using f.exists_map_eq_of_map_le'⟩
@[simp]
theorem coe_copy (f : PseudoEpimorphism α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl
theorem copy_eq (f : PseudoEpimorphism α β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
variable (α)
/-- `id` as a `PseudoEpimorphism`. -/
protected def id : PseudoEpimorphism α α :=
⟨OrderHom.id, fun _ b h => ⟨b, h, rfl⟩⟩
instance : Inhabited (PseudoEpimorphism α α) :=
⟨PseudoEpimorphism.id α⟩
@[simp, norm_cast]
theorem coe_id : ⇑(PseudoEpimorphism.id α) = id := rfl
@[simp, norm_cast]
theorem coe_id_orderHom : (PseudoEpimorphism.id α : α →o α) = OrderHom.id := rfl
variable {α}
@[simp]
theorem id_apply (a : α) : PseudoEpimorphism.id α a = a := rfl
/-- Composition of `PseudoEpimorphism`s as a `PseudoEpimorphism`. -/
def comp (g : PseudoEpimorphism β γ) (f : PseudoEpimorphism α β) : PseudoEpimorphism α γ :=
⟨g.toOrderHom.comp f.toOrderHom, fun a b h₀ => by
obtain ⟨b, h₁, rfl⟩ := g.exists_map_eq_of_map_le' h₀
obtain ⟨b, h₂, rfl⟩ := f.exists_map_eq_of_map_le' h₁
exact ⟨b, h₂, rfl⟩⟩
@[simp]
theorem coe_comp (g : PseudoEpimorphism β γ) (f : PseudoEpimorphism α β) :
(g.comp f : α → γ) = g ∘ f := rfl
@[simp]
theorem coe_comp_orderHom (g : PseudoEpimorphism β γ) (f : PseudoEpimorphism α β) :
(g.comp f : α →o γ) = (g : β →o γ).comp f := rfl
@[simp]
theorem comp_apply (g : PseudoEpimorphism β γ) (f : PseudoEpimorphism α β) (a : α) :
(g.comp f) a = g (f a) := rfl
@[simp]
theorem comp_assoc (h : PseudoEpimorphism γ δ) (g : PseudoEpimorphism β γ)
(f : PseudoEpimorphism α β) : (h.comp g).comp f = h.comp (g.comp f) := rfl
@[simp]
theorem comp_id (f : PseudoEpimorphism α β) : f.comp (PseudoEpimorphism.id α) = f :=
ext fun _ => rfl
@[simp]
theorem id_comp (f : PseudoEpimorphism α β) : (PseudoEpimorphism.id β).comp f = f :=
ext fun _ => rfl
@[simp]
theorem cancel_right {g₁ g₂ : PseudoEpimorphism β γ} {f : PseudoEpimorphism α β}
(hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, congr_arg (comp · f)⟩
@[simp]
theorem cancel_left {g : PseudoEpimorphism β γ} {f₁ f₂ : PseudoEpimorphism α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
end PseudoEpimorphism
/-! ### Esakia morphisms -/
namespace EsakiaHom
variable [TopologicalSpace α] [Preorder α] [TopologicalSpace β] [Preorder β] [TopologicalSpace γ]
[Preorder γ] [TopologicalSpace δ] [Preorder δ]
def toPseudoEpimorphism (f : EsakiaHom α β) : PseudoEpimorphism α β :=
{ f with }
instance instFunLike : FunLike (EsakiaHom α β) α β where
coe f := f.toFun
coe_injective' f g h := by
obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := f
obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := g
congr
instance : EsakiaHomClass (EsakiaHom α β) α β where
map_monotone f := f.monotone'
map_continuous f := f.continuous_toFun
exists_map_eq_of_map_le f := f.exists_map_eq_of_map_le'
@[simp]
theorem toContinuousOrderHom_coe {f : EsakiaHom α β} :
f.toContinuousOrderHom = (f : α → β) := rfl
theorem toFun_eq_coe {f : EsakiaHom α β} : f.toFun = (f : α → β) := rfl
@[ext]
theorem ext {f g : EsakiaHom α β} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext f g h
/-- Copy of an `EsakiaHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : EsakiaHom α β) (f' : α → β) (h : f' = f) : EsakiaHom α β :=
⟨f.toContinuousOrderHom.copy f' h, by
simpa only [h.symm, toFun_eq_coe] using f.exists_map_eq_of_map_le'⟩
@[simp]
theorem coe_copy (f : EsakiaHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl
theorem copy_eq (f : EsakiaHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
variable (α)
/-- `id` as an `EsakiaHom`. -/
protected def id : EsakiaHom α α :=
⟨ContinuousOrderHom.id α, fun _ b h => ⟨b, h, rfl⟩⟩
instance : Inhabited (EsakiaHom α α) :=
⟨EsakiaHom.id α⟩
@[simp, norm_cast]
theorem coe_id : ⇑(EsakiaHom.id α) = id := rfl
@[simp, norm_cast]
theorem coe_id_pseudoEpimorphism :
(EsakiaHom.id α : PseudoEpimorphism α α) = PseudoEpimorphism.id α := rfl
variable {α}
@[simp]
theorem id_apply (a : α) : EsakiaHom.id α a = a := rfl
@[simp, norm_cast]
theorem coe_id_continuousOrderHom : (EsakiaHom.id α : α →Co α) = ContinuousOrderHom.id α := rfl
/-- Composition of `EsakiaHom`s as an `EsakiaHom`. -/
def comp (g : EsakiaHom β γ) (f : EsakiaHom α β) : EsakiaHom α γ :=
⟨g.toContinuousOrderHom.comp f.toContinuousOrderHom, fun a b h₀ => by
obtain ⟨b, h₁, rfl⟩ := g.exists_map_eq_of_map_le' h₀
obtain ⟨b, h₂, rfl⟩ := f.exists_map_eq_of_map_le' h₁
exact ⟨b, h₂, rfl⟩⟩
@[simp]
theorem coe_comp_continuousOrderHom (g : EsakiaHom β γ) (f : EsakiaHom α β) :
(g.comp f : α →Co γ) = (g : β →Co γ).comp f := rfl
@[simp]
theorem coe_comp_pseudoEpimorphism (g : EsakiaHom β γ) (f : EsakiaHom α β) :
(g.comp f : PseudoEpimorphism α γ) = (g : PseudoEpimorphism β γ).comp f := rfl
@[simp]
theorem coe_comp (g : EsakiaHom β γ) (f : EsakiaHom α β) : (g.comp f : α → γ) = g ∘ f := rfl
@[simp]
theorem comp_apply (g : EsakiaHom β γ) (f : EsakiaHom α β) (a : α) : (g.comp f) a = g (f a) := rfl
@[simp]
theorem comp_assoc (h : EsakiaHom γ δ) (g : EsakiaHom β γ) (f : EsakiaHom α β) :
(h.comp g).comp f = h.comp (g.comp f) := rfl
@[simp]
theorem comp_id (f : EsakiaHom α β) : f.comp (EsakiaHom.id α) = f :=
ext fun _ => rfl
@[simp]
theorem id_comp (f : EsakiaHom α β) : (EsakiaHom.id β).comp f = f :=
ext fun _ => rfl
@[simp]
theorem cancel_right {g₁ g₂ : EsakiaHom β γ} {f : EsakiaHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, congr_arg (comp · f)⟩
@[simp]
theorem cancel_left {g : EsakiaHom β γ} {f₁ f₂ : EsakiaHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
end EsakiaHom |
.lake/packages/mathlib/Mathlib/Topology/Order/Hom/Basic.lean | import Mathlib.Topology.Continuous
import Mathlib.Topology.ContinuousMap.Defs
/-!
# Continuous order homomorphisms
This file defines continuous order homomorphisms, that is maps which are both continuous and
monotone. They are also called Priestley homomorphisms because they are the morphisms of the
category of Priestley spaces.
We use the `DFunLike` design, so each type of morphisms has a companion typeclass which is meant to
be satisfied by itself and all stricter types.
## Types of morphisms
* `ContinuousOrderHom`: Continuous monotone functions, aka Priestley homomorphisms.
## Typeclasses
* `ContinuousOrderHomClass`
-/
open Function
variable {F α β γ δ : Type*}
/-- The type of continuous monotone maps from `α` to `β`, aka Priestley homomorphisms. -/
structure ContinuousOrderHom (α β : Type*) [Preorder α] [Preorder β] [TopologicalSpace α]
[TopologicalSpace β] extends OrderHom α β where
continuous_toFun : Continuous toFun
@[inherit_doc] infixr:25 " →Co " => ContinuousOrderHom
section
/-- `ContinuousOrderHomClass F α β` states that `F` is a type of continuous monotone maps.
You should extend this class when you extend `ContinuousOrderHom`. -/
class ContinuousOrderHomClass (F : Type*) (α β : outParam Type*) [Preorder α] [Preorder β]
[TopologicalSpace α] [TopologicalSpace β] [FunLike F α β] : Prop
extends ContinuousMapClass F α β where
map_monotone (f : F) : Monotone f
namespace ContinuousOrderHomClass
variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β]
[FunLike F α β] [ContinuousOrderHomClass F α β]
-- See note [lower instance priority]
instance (priority := 100) toOrderHomClass :
OrderHomClass F α β :=
{ ‹ContinuousOrderHomClass F α β› with
map_rel := ContinuousOrderHomClass.map_monotone }
/-- Turn an element of a type `F` satisfying `ContinuousOrderHomClass F α β` into an actual
`ContinuousOrderHom`. This is declared as the default coercion from `F` to `α →Co β`. -/
@[coe]
def toContinuousOrderHom (f : F) : α →Co β :=
{ toFun := f
monotone' := ContinuousOrderHomClass.map_monotone f
continuous_toFun := map_continuous f }
instance : CoeTC F (α →Co β) :=
⟨toContinuousOrderHom⟩
end ContinuousOrderHomClass
/-! ### Top homomorphisms -/
namespace ContinuousOrderHom
variable [TopologicalSpace α] [Preorder α] [TopologicalSpace β]
section Preorder
variable [Preorder β] [TopologicalSpace γ] [Preorder γ] [TopologicalSpace δ] [Preorder δ]
/-- Reinterpret a `ContinuousOrderHom` as a `ContinuousMap`. -/
def toContinuousMap (f : α →Co β) : C(α, β) :=
{ f with }
instance instFunLike : FunLike (α →Co β) α β where
coe f := f.toFun
coe_injective' f g h := by
obtain ⟨⟨_, _⟩, _⟩ := f
obtain ⟨⟨_, _⟩, _⟩ := g
congr
instance : ContinuousOrderHomClass (α →Co β) α β where
map_monotone f := f.monotone'
map_continuous f := f.continuous_toFun
@[simp] theorem coe_toOrderHom (f : α →Co β) : ⇑f.toOrderHom = f := rfl
theorem toFun_eq_coe {f : α →Co β} : f.toFun = (f : α → β) := rfl
@[ext]
theorem ext {f g : α →Co β} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext f g h
/-- Copy of a `ContinuousOrderHom` with a new `ContinuousMap` equal to the old one. Useful to fix
definitional equalities. -/
protected def copy (f : α →Co β) (f' : α → β) (h : f' = f) : α →Co β :=
⟨f.toOrderHom.copy f' h, h.symm.subst f.continuous_toFun⟩
@[simp]
theorem coe_copy (f : α →Co β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
theorem copy_eq (f : α →Co β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
variable (α)
/-- `id` as a `ContinuousOrderHom`. -/
protected def id : α →Co α :=
⟨OrderHom.id, continuous_id⟩
instance : Inhabited (α →Co α) :=
⟨ContinuousOrderHom.id _⟩
@[simp, norm_cast]
theorem coe_id : ⇑(ContinuousOrderHom.id α) = id :=
rfl
variable {α}
@[simp]
theorem id_apply (a : α) : ContinuousOrderHom.id α a = a :=
rfl
/-- Composition of `ContinuousOrderHom`s as a `ContinuousOrderHom`. -/
def comp (f : β →Co γ) (g : α →Co β) : ContinuousOrderHom α γ :=
⟨f.toOrderHom.comp g.toOrderHom, f.continuous_toFun.comp g.continuous_toFun⟩
@[simp]
theorem coe_comp (f : β →Co γ) (g : α →Co β) : (f.comp g : α → γ) = f ∘ g :=
rfl
@[simp]
theorem comp_apply (f : β →Co γ) (g : α →Co β) (a : α) : (f.comp g) a = f (g a) :=
rfl
@[simp]
theorem comp_assoc (f : γ →Co δ) (g : β →Co γ) (h : α →Co β) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
@[simp]
theorem comp_id (f : α →Co β) : f.comp (ContinuousOrderHom.id α) = f :=
ext fun _ => rfl
@[simp]
theorem id_comp (f : α →Co β) : (ContinuousOrderHom.id β).comp f = f :=
ext fun _ => rfl
@[simp]
theorem cancel_right {g₁ g₂ : β →Co γ} {f : α →Co β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
@[simp]
theorem cancel_left {g : β →Co γ} {f₁ f₂ : α →Co β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
instance : Preorder (α →Co β) :=
Preorder.lift ((↑) : (α →Co β) → α → β)
end Preorder
instance [PartialOrder β] : PartialOrder (α →Co β) :=
PartialOrder.lift ((↑) : (α →Co β) → α → β) DFunLike.coe_injective
end ContinuousOrderHom
end |
.lake/packages/mathlib/Mathlib/Topology/Order/Category/FrameAdjunction.lean | import Mathlib.Topology.Category.Locale
/-!
# Adjunction between Locales and Topological Spaces
This file defines the point functor from the category of locales to topological spaces
and proves that it is right adjoint to the forgetful functor from topological spaces to locales.
## Main declarations
* `Locale.pt`: the *points* functor from the category of locales to the category of topological
spaces.
* `Locale.adjunctionTopToLocalePT`: the adjunction between the functors `topToLocale` and `pt`.
## Motivation
This adjunction provides a framework in which several Stone-type dualities fit.
## Implementation notes
* In naming the various functions below, we follow common terminology and reserve the word *point*
for an inhabitant of a type `X` which is a topological space, while we use the word *element* for
an inhabitant of a type `L` which is a locale.
## References
* [J. Picado and A. Pultr, Frames and Locales: topology without points][picado2011frames]
## Tags
topological space, frame, locale, Stone duality, adjunction, points
-/
open CategoryTheory Order Set Topology TopologicalSpace
namespace Locale
/-! ### Definition of the points functor `pt` -/
section pt_definition
variable (L : Type*) [CompleteLattice L]
/-- The type of points of a complete lattice `L`, where a *point* of a complete lattice is,
by definition, a frame homomorphism from `L` to `Prop`. -/
abbrev PT := FrameHom L Prop
/-- The frame homomorphism from a complete lattice `L` to the complete lattice of sets of
points of `L`. -/
@[simps]
def openOfElementHom : FrameHom L (Set (PT L)) where
toFun u := {x | x u}
map_inf' a b := by simp [Set.setOf_and]
map_top' := by simp
map_sSup' S := by ext; simp [Prop.exists_iff]
namespace PT
/-- The topology on the set of points of the complete lattice `L`. -/
instance instTopologicalSpace : TopologicalSpace (PT L) where
IsOpen s := ∃ u, {x | x u} = s
isOpen_univ := ⟨⊤, by simp⟩
isOpen_inter := by rintro s t ⟨u, rfl⟩ ⟨v, rfl⟩; use u ⊓ v; simp_rw [map_inf]; rfl
isOpen_sUnion S hS := by
choose f hf using hS
use ⨆ t, ⨆ ht, f t ht
simp_rw [map_iSup, iSup_Prop_eq, setOf_exists, hf, sUnion_eq_biUnion]
/-- Characterization of when a subset of the space of points is open. -/
lemma isOpen_iff (U : Set (PT L)) : IsOpen U ↔ ∃ u : L, {x | x u} = U := Iff.rfl
end PT
/-- The covariant functor `pt` from the category of locales to the category of
topological spaces, which sends a locale `L` to the topological space `PT L` of homomorphisms
from `L` to `Prop` and a locale homomorphism `f` to a continuous function between the spaces
of points. -/
def pt : Locale ⥤ TopCat where
obj L := .of (PT L.unop)
map f := TopCat.ofHom ⟨fun p ↦ p.comp f.unop.hom,
continuous_def.2 <| by rintro s ⟨u, rfl⟩; use f.unop u; rfl⟩
end pt_definition
section locale_top_adjunction
variable (X : Type*) [TopologicalSpace X] (L : Locale)
/-- The unit of the adjunction between locales and topological spaces, which associates with
a point `x` of the space `X` a point of the locale of opens of `X`. -/
@[simps]
def localePointOfSpacePoint (x : X) : PT (Opens X) where
toFun := (x ∈ ·)
map_inf' _ _ := rfl
map_top' := rfl
map_sSup' S := by simp [Prop.exists_iff]
/-- The counit is a frame homomorphism. -/
def counitAppCont : FrameHom L (Opens <| PT L) where
toFun u := ⟨openOfElementHom L u, u, rfl⟩
map_inf' a b := by simp
map_top' := by simp
map_sSup' S := by ext; simp
/-- The forgetful functor `topToLocale` is left adjoint to the functor `pt`. -/
def adjunctionTopToLocalePT : topToLocale ⊣ pt where
unit := { app := fun X ↦ TopCat.ofHom ⟨localePointOfSpacePoint X, continuous_def.2 <|
by rintro _ ⟨u, rfl⟩; simpa using u.2⟩ }
counit := { app := fun L ↦ ⟨Frm.ofHom (counitAppCont L)⟩ }
end locale_top_adjunction
end Locale |
.lake/packages/mathlib/Mathlib/Topology/Order/Category/AlexDisc.lean | import Mathlib.Topology.Specialization
/-!
# Category of Alexandrov-discrete topological spaces
This defines `AlexDisc`, the category of Alexandrov-discrete topological spaces with continuous
maps, and proves it's equivalent to the category of preorders.
-/
open CategoryTheory Topology
/-- The category of Alexandrov-discrete spaces. -/
structure AlexDisc extends TopCat where
[is_alexandrovDiscrete : AlexandrovDiscrete carrier]
namespace AlexDisc
attribute [instance] is_alexandrovDiscrete
instance : CoeSort AlexDisc (Type _) :=
⟨fun X => X.toTopCat⟩
instance category : Category AlexDisc :=
InducedCategory.category toTopCat
instance concreteCategory : ConcreteCategory AlexDisc (C(·, ·)) :=
InducedCategory.concreteCategory toTopCat
instance instHasForgetToTop : HasForget₂ AlexDisc TopCat := InducedCategory.hasForget₂ toTopCat
-- TODO: generalize to `InducedCategory.forget₂_full`?
instance forgetToTop_full : (forget₂ AlexDisc TopCat).Full where
map_surjective f := ⟨f, rfl⟩
instance forgetToTop_faithful : (forget₂ AlexDisc TopCat).Faithful where
/-- Construct a bundled `AlexDisc` from the underlying topological space. -/
abbrev of (X : Type*) [TopologicalSpace X] [AlexandrovDiscrete X] : AlexDisc where
toTopCat := TopCat.of X
lemma coe_of (α : Type*) [TopologicalSpace α] [AlexandrovDiscrete α] : ↥(of α) = α := rfl
@[simp] lemma forgetToTop_of (α : Type*) [TopologicalSpace α] [AlexandrovDiscrete α] :
(forget₂ AlexDisc TopCat).obj (of α) = TopCat.of α := rfl
@[simp] lemma coe_forgetToTop (X : AlexDisc) : ↥((forget₂ _ TopCat).obj X) = X := rfl
/-- Constructs an equivalence between preorders from an order isomorphism between them. -/
@[simps]
def Iso.mk {α β : AlexDisc} (e : α ≃ₜ β) : α ≅ β where
hom := TopCat.ofHom (e : ContinuousMap α β)
inv := TopCat.ofHom (e.symm : ContinuousMap β α)
hom_inv_id := by ext; apply e.symm_apply_apply
inv_hom_id := by ext; apply e.apply_symm_apply
end AlexDisc
/-- Sends a topological space to its specialisation order. -/
@[simps]
def alexDiscEquivPreord : AlexDisc ≌ Preord where
functor := forget₂ _ _ ⋙ topToPreord
inverse.obj X := AlexDisc.of (WithUpperSet X)
inverse.map f := TopCat.ofHom (WithUpperSet.map f.hom)
unitIso := NatIso.ofComponents fun X ↦ AlexDisc.Iso.mk <| by
dsimp; exact homeoWithUpperSetTopologyorderIso X
counitIso := NatIso.ofComponents fun X ↦ Preord.Iso.mk <| by
dsimp; exact (orderIsoSpecializationWithUpperSetTopology X).symm |
.lake/packages/mathlib/Mathlib/Topology/Hom/ContinuousEval.lean | import Mathlib.Topology.Hom.ContinuousEvalConst
import Mathlib.Topology.ContinuousMap.Defs
/-!
# Bundled maps with evaluation continuous in both variables
In this file we define a class `ContinuousEval F X Y`
saying that `F` is a bundled morphism class (in the sense of `FunLike`)
with a topology such that `fun (f, x) : F × X ↦ f x` is a continuous function.
-/
open scoped Topology
open Filter
/-- A typeclass saying that `F` is a bundled morphism class (in the sense of `FunLike`)
with a topology such that `fun (f, x) : F × X ↦ f x` is a continuous function. -/
class ContinuousEval (F : Type*) (X Y : outParam Type*) [FunLike F X Y]
[TopologicalSpace F] [TopologicalSpace X] [TopologicalSpace Y] : Prop where
/-- Evaluation of a bundled morphism at a point is continuous in both variables. -/
continuous_eval : Continuous fun fx : F × X ↦ fx.1 fx.2
export ContinuousEval (continuous_eval)
variable {F X Y Z : Type*} [FunLike F X Y]
[TopologicalSpace F] [TopologicalSpace X] [TopologicalSpace Y] [ContinuousEval F X Y]
[TopologicalSpace Z] {f : Z → F} {g : Z → X} {s : Set Z} {z : Z}
@[continuity, fun_prop]
protected theorem Continuous.eval (hf : Continuous f) (hg : Continuous g) :
Continuous fun z ↦ f z (g z) :=
continuous_eval.comp (hf.prodMk hg)
/-- If a type `F'` of bundled morphisms admits a continuous projection
to a type satisfying `ContinuousEval`,
then `F'` satisfies this predicate too.
The word "forget" in the name is motivated by the term "forgetful functor". -/
theorem ContinuousEval.of_continuous_forget {F' : Type*} [FunLike F' X Y] [TopologicalSpace F']
{f : F' → F} (hc : Continuous f) (hf : ∀ g, ⇑(f g) = g := by intro; rfl) :
ContinuousEval F' X Y where
continuous_eval := by simpa only [← hf] using hc.fst'.eval continuous_snd
instance (priority := 100) ContinuousEval.toContinuousMapClass : ContinuousMapClass F X Y where
map_continuous _ := continuous_const.eval continuous_id
instance (priority := 100) ContinuousEval.toContinuousEvalConst : ContinuousEvalConst F X Y where
continuous_eval_const _ := continuous_id.eval continuous_const
protected theorem Filter.Tendsto.eval {α : Type*} {l : Filter α} {f : α → F} {f₀ : F}
{g : α → X} {x₀ : X} (hf : Tendsto f l (𝓝 f₀)) (hg : Tendsto g l (𝓝 x₀)) :
Tendsto (fun a ↦ f a (g a)) l (𝓝 (f₀ x₀)) :=
(ContinuousEval.continuous_eval.tendsto _).comp (hf.prodMk_nhds hg)
protected nonrec theorem ContinuousAt.eval (hf : ContinuousAt f z) (hg : ContinuousAt g z) :
ContinuousAt (fun z ↦ f z (g z)) z :=
hf.eval hg
protected nonrec theorem ContinuousWithinAt.eval (hf : ContinuousWithinAt f s z)
(hg : ContinuousWithinAt g s z) : ContinuousWithinAt (fun z ↦ f z (g z)) s z :=
hf.eval hg
protected theorem ContinuousOn.eval (hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (fun z ↦ f z (g z)) s :=
fun z hz ↦ (hf z hz).eval (hg z hz) |
.lake/packages/mathlib/Mathlib/Topology/Hom/ContinuousEvalConst.lean | import Mathlib.Topology.Constructions
/-!
# Bundled morphisms with continuous evaluation at a point
In this file we define a typeclass
saying that `F` is a type of bundled morphisms (in the sense of `DFunLike`)
with a topology on `F` such that evaluation at a point is continuous in `f : F`.
## Implementation Notes
For now, we define the typeclass for non-dependent bundled functions only.
Whenever we add a type of bundled dependent functions with a topology having this property,
we may decide to generalize from `FunLike` to `DFunLike`.
-/
open scoped Topology
open Filter
/-- A typeclass saying that `F` is a type of bundled morphisms (in the sense of `DFunLike`)
with a topology on `F` such that evaluation at a point is continuous in `f : F`. -/
class ContinuousEvalConst (F : Type*) (α X : outParam Type*) [FunLike F α X]
[TopologicalSpace F] [TopologicalSpace X] : Prop where
continuous_eval_const (x : α) : Continuous fun f : F ↦ f x
export ContinuousEvalConst (continuous_eval_const)
section ContinuousEvalConst
variable {F α X Z : Type*} [FunLike F α X] [TopologicalSpace F] [TopologicalSpace X]
[ContinuousEvalConst F α X] [TopologicalSpace Z] {f : Z → F} {s : Set Z} {z : Z}
/-- If a type `F'` of bundled morphisms admits a continuous projection
to a type satisfying `ContinuousEvalConst`,
then `F'` satisfies this predicate too.
The word "forget" in the name is motivated by the term "forgetful functor". -/
theorem ContinuousEvalConst.of_continuous_forget {F' : Type*} [FunLike F' α X] [TopologicalSpace F']
{f : F' → F} (hc : Continuous f) (hf : ∀ g, ⇑(f g) = g := by intro; rfl) :
ContinuousEvalConst F' α X where
continuous_eval_const x := by simpa only [← hf] using (continuous_eval_const x).comp hc
@[continuity, fun_prop]
protected theorem Continuous.eval_const (hf : Continuous f) (x : α) : Continuous (f · x) :=
(continuous_eval_const x).comp hf
theorem continuous_coeFun : Continuous (DFunLike.coe : F → α → X) :=
continuous_pi continuous_eval_const
protected theorem Continuous.coeFun (hf : Continuous f) : Continuous fun z ↦ ⇑(f z) :=
continuous_pi hf.eval_const
protected theorem Filter.Tendsto.eval_const {ι : Type*} {l : Filter ι} {f : ι → F} {g : F}
(hf : Tendsto f l (𝓝 g)) (a : α) : Tendsto (f · a) l (𝓝 (g a)) :=
((continuous_id.eval_const a).tendsto _).comp hf
protected theorem Filter.Tendsto.coeFun {ι : Type*} {l : Filter ι} {f : ι → F} {g : F}
(hf : Tendsto f l (𝓝 g)) : Tendsto (fun i ↦ ⇑(f i)) l (𝓝 ⇑g) :=
(continuous_id.coeFun.tendsto _).comp hf
protected nonrec theorem ContinuousAt.eval_const (hf : ContinuousAt f z) (x : α) :
ContinuousAt (f · x) z :=
hf.eval_const x
protected nonrec theorem ContinuousAt.coeFun (hf : ContinuousAt f z) :
ContinuousAt (fun z ↦ ⇑(f z)) z :=
hf.coeFun
protected nonrec theorem ContinuousWithinAt.eval_const (hf : ContinuousWithinAt f s z) (x : α) :
ContinuousWithinAt (f · x) s z :=
hf.eval_const x
protected nonrec theorem ContinuousWithinAt.coeFun (hf : ContinuousWithinAt f s z) :
ContinuousWithinAt (fun z ↦ ⇑(f z)) s z :=
hf.coeFun
protected theorem ContinuousOn.eval_const (hf : ContinuousOn f s) (x : α) :
ContinuousOn (f · x) s :=
fun z hz ↦ (hf z hz).eval_const x
protected theorem ContinuousOn.coeFun (hf : ContinuousOn f s) (x : α) : ContinuousOn (f · x) s :=
fun z hz ↦ (hf z hz).eval_const x
end ContinuousEvalConst |
.lake/packages/mathlib/Mathlib/Topology/Hom/Open.lean | import Mathlib.Topology.ContinuousMap.Basic
/-!
# Continuous open maps
This file defines bundled continuous open maps.
We use the `DFunLike` design, so each type of morphisms has a companion typeclass which is meant to
be satisfied by itself and all stricter types.
## Types of morphisms
* `ContinuousOpenMap`: Continuous open maps.
## Typeclasses
* `ContinuousOpenMapClass`
-/
open Function
variable {F α β γ δ : Type*}
/-- The type of continuous open maps from `α` to `β`, aka Priestley homomorphisms. -/
structure ContinuousOpenMap (α β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends
ContinuousMap α β where
map_open' : IsOpenMap toFun
@[inherit_doc] infixr:25 " →CO " => ContinuousOpenMap
section
/-- `ContinuousOpenMapClass F α β` states that `F` is a type of continuous open maps.
You should extend this class when you extend `ContinuousOpenMap`. -/
class ContinuousOpenMapClass (F : Type*) (α β : outParam Type*) [TopologicalSpace α]
[TopologicalSpace β] [FunLike F α β] : Prop extends ContinuousMapClass F α β where
map_open (f : F) : IsOpenMap f
end
export ContinuousOpenMapClass (map_open)
instance [TopologicalSpace α] [TopologicalSpace β] [FunLike F α β]
[ContinuousOpenMapClass F α β] :
CoeTC F (α →CO β) :=
⟨fun f => ⟨f, map_open f⟩⟩
/-! ### Continuous open maps -/
namespace ContinuousOpenMap
variable [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ]
instance instFunLike : FunLike (α →CO β) α β where
coe f := f.toFun
coe_injective' f g h := by
obtain ⟨⟨_, _⟩, _⟩ := f
obtain ⟨⟨_, _⟩, _⟩ := g
congr
instance : ContinuousOpenMapClass (α →CO β) α β where
map_continuous f := f.continuous_toFun
map_open f := f.map_open'
theorem toFun_eq_coe {f : α →CO β} : f.toFun = (f : α → β) :=
rfl
/-- `simp`-normal form of `toFun_eq_coe`. -/
@[simp]
theorem coe_toContinuousMap (f : α →CO β) : (f.toContinuousMap : α → β) = f := rfl
@[ext]
theorem ext {f g : α →CO β} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext f g h
/-- Copy of a `ContinuousOpenMap` with a new `ContinuousMap` equal to the old one. Useful to fix
definitional equalities. -/
protected def copy (f : α →CO β) (f' : α → β) (h : f' = f) : α →CO β :=
⟨f.toContinuousMap.copy f' <| h, h.symm.subst f.map_open'⟩
@[simp]
theorem coe_copy (f : α →CO β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
theorem copy_eq (f : α →CO β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
variable (α)
/-- `id` as a `ContinuousOpenMap`. -/
protected def id : α →CO α :=
⟨ContinuousMap.id _, IsOpenMap.id⟩
instance : Inhabited (α →CO α) :=
⟨ContinuousOpenMap.id _⟩
@[simp, norm_cast]
theorem coe_id : ⇑(ContinuousOpenMap.id α) = id :=
rfl
variable {α}
@[simp]
theorem id_apply (a : α) : ContinuousOpenMap.id α a = a :=
rfl
/-- Composition of `ContinuousOpenMap`s as a `ContinuousOpenMap`. -/
def comp (f : β →CO γ) (g : α →CO β) : ContinuousOpenMap α γ :=
⟨f.toContinuousMap.comp g.toContinuousMap, f.map_open'.comp g.map_open'⟩
@[simp]
theorem coe_comp (f : β →CO γ) (g : α →CO β) : (f.comp g : α → γ) = f ∘ g :=
rfl
@[simp]
theorem comp_apply (f : β →CO γ) (g : α →CO β) (a : α) : (f.comp g) a = f (g a) :=
rfl
@[simp]
theorem comp_assoc (f : γ →CO δ) (g : β →CO γ) (h : α →CO β) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
@[simp]
theorem comp_id (f : α →CO β) : f.comp (ContinuousOpenMap.id α) = f :=
ext fun _ => rfl
@[simp]
theorem id_comp (f : α →CO β) : (ContinuousOpenMap.id β).comp f = f :=
ext fun _ => rfl
@[simp]
theorem cancel_right {g₁ g₂ : β →CO γ} {f : α →CO β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
@[simp]
theorem cancel_left {g : β →CO γ} {f₁ f₂ : α →CO β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
end ContinuousOpenMap |
.lake/packages/mathlib/Mathlib/Topology/CWComplex/Abstract/Basic.lean | import Mathlib.Topology.Category.TopCat.Limits.Basic
import Mathlib.Topology.Category.TopCat.Sphere
import Mathlib.AlgebraicTopology.RelativeCellComplex.Basic
/-!
# CW-complexes
This file defines (relative) CW-complexes using a categorical approach.
## Main definitions
* `RelativeCWComplex`: A relative CW-complex is the colimit of an expanding sequence of subspaces
`sk i` (called the $(i-1)$-skeleton) for `i ≥ 0`, where `sk 0` (i.e., the $(-1)$-skeleton) is an
arbitrary topological space, and each `sk (n + 1)` (i.e., the $n$-skeleton) is obtained from
`sk n` (i.e., the $(n-1)$-skeleton) by attaching `n`-disks.
* `CWComplex`: A CW-complex is a relative CW-complex whose `sk 0` (i.e., $(-1)$-skeleton) is empty.
## Implementation Notes
This file provides a categorical approach to CW complexes,
defining them via colimits and transfinite compositions.
For a classical approach that defines CW complexes via explicit cells and attaching maps,
see `Mathlib/Topology/CWComplex/Classical/Basic.lean`.
The two approaches are equivalent but serve different purposes:
* This approach is more suitable for categorical arguments and generalizations
* The classical approach is more convenient for concrete geometric arguments
## References
* [R. Fritsch and R. Piccinini, *Cellular Structures in Topology*][fritsch-piccinini1990]
## TODO
* Prove the equivalence between this categorical approach and the classical approach in
`Mathlib/Topology/CWComplex/Classical/Basic.lean`.
Currently there is no way to move between the two definitions.
-/
open TopCat
universe u
open CategoryTheory Limits HomotopicalAlgebra
namespace TopCat
namespace RelativeCWComplex
/-- For each `n : ℕ`, this is the family of morphisms which sends the unique
element of `Unit` to `diskBoundaryInclusion n : ∂𝔻 n ⟶ 𝔻 n`. -/
@[nolint unusedArguments]
abbrev basicCell (n : ℕ) (_ : Unit) : ∂𝔻 n ⟶ 𝔻 n := diskBoundaryInclusion n
end RelativeCWComplex
open RelativeCWComplex in
/-- A relative CW-complex is a morphism `f : X ⟶ Y` equipped with data expressing
that `Y` identifies to the colimit of a functor `F : ℕ ⥤ TopCat` with that
`F.obj 0 ≅ X` and for any `n : ℕ`, `F.obj (n + 1)` is obtained from `F.obj n`
by attaching `n`-disks. -/
abbrev RelativeCWComplex {X Y : TopCat.{u}} (f : X ⟶ Y) := RelativeCellComplex.{u} basicCell f
/-- A CW-complex is a topological space such that `⊥_ _ ⟶ X` is a relative CW-complex. -/
abbrev CWComplex (X : TopCat.{u}) := RelativeCWComplex (initial.to X)
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/CWComplex/Classical/Finite.lean | import Mathlib.Topology.CWComplex.Classical.Basic
/-!
# Finiteness notions on CW complexes
In this file we define what it means for a CW complex to be finite dimensional, of finite type or
finite. We define constructors with relaxed conditions for CW complexes of finite type and
finite CW complexes.
## Main definitions
* `RelCWComplex.FiniteDimensional`: a CW complex is finite dimensional if it has only finitely many
nonempty indexing types for the cells.
* `RelCWComplex.FiniteType`: a CW complex is of finite type if it has only finitely many cells in
each dimension.
* `RelCWComplex.Finite`: a CW complex is finite if it is finite dimensional and of finite type.
## Main statements
* `RelCWComplex.mkFiniteType`: if we want to construct a CW complex of finite type, we can relax the
condition `mapsTo`.
* `RelCWComplex.mkFinite`: if we want to construct a finite CW complex, we can relax the condition
`mapsTo` and can leave out the condition `closed'`.
* `RelCWComplex.finite_iff_finite_cells`: a CW complex is finite iff the total number of its cells
is finite.
-/
open Metric Set
namespace Topology
/-- A CW complex is finite dimensional if `cell C n` is empty for all but finitely many `n`. -/
class RelCWComplex.FiniteDimensional.{u} {X : Type u} [TopologicalSpace X] (C : Set X) {D : Set X}
[RelCWComplex C D] : Prop where
/-- For some natural number `n`, the type `cell C m` is empty for all `m ≥ n`. -/
eventually_isEmpty_cell : ∀ᶠ n in Filter.atTop, IsEmpty (cell C n)
/-- A CW complex is of finite type if `cell C n` is finite for every `n`. -/
class RelCWComplex.FiniteType.{u} {X : Type u} [TopologicalSpace X] (C : Set X) {D : Set X}
[RelCWComplex C D] : Prop where
/-- `cell C n` is finite for every `n`. -/
finite_cell (n : ℕ) : Finite (cell C n)
/-- A CW complex is finite if it is finite dimensional and of finite type. -/
class RelCWComplex.Finite {X : Type*} [TopologicalSpace X] (C : Set X) {D : Set X}
[RelCWComplex C D] extends FiniteDimensional C, FiniteType C
variable {X : Type*} [TopologicalSpace X] (C : Set X) {D : Set X} [RelCWComplex C D]
lemma RelCWComplex.finite_of_finiteDimensional_finiteType [FiniteDimensional C]
[FiniteType C] : Finite C where
eventually_isEmpty_cell := FiniteDimensional.eventually_isEmpty_cell
finite_cell n := FiniteType.finite_cell n
namespace CWComplex
export RelCWComplex (FiniteDimensional FiniteType Finite FiniteDimensional.eventually_isEmpty_cell
FiniteType.finite_cell finite_of_finiteDimensional_finiteType)
end CWComplex
/-- If we want to construct a relative CW complex of finite type, we can add the condition
`finite_cell` and relax the condition `mapsTo`. -/
@[simps -isSimp]
def RelCWComplex.mkFiniteType.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(D : outParam (Set X))
(cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(disjointBase' : ∀ (n : ℕ) (i : cell n), Disjoint (map n i '' ball 0 1) D)
(mapsTo : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (D ∪ ⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(closed' : ∀ (A : Set X) (_ : A ⊆ C),
((∀ n j, IsClosed (A ∩ map n j '' closedBall 0 1)) ∧ IsClosed (A ∩ D)) → IsClosed A)
(isClosedBase : IsClosed D)
(union' : D ∪ ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
RelCWComplex C D where
cell := cell
map := map
source_eq := source_eq
continuousOn := continuousOn
continuousOn_symm := continuousOn_symm
pairwiseDisjoint' := pairwiseDisjoint'
disjointBase' := disjointBase'
mapsTo n i := by
use fun m ↦ finite_univ.toFinset (s := (univ : Set (cell m)))
simp only [Finite.mem_toFinset, mem_univ, iUnion_true]
exact mapsTo n i
closed' := closed'
isClosedBase := isClosedBase
union' := union'
/-- A CW complex that was constructed using `RelCWComplex.mkFiniteType` is of finite type. -/
lemma RelCWComplex.finiteType_mkFiniteType.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(D : outParam (Set X))
(cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(disjointBase' : ∀ (n : ℕ) (i : cell n), Disjoint (map n i '' ball 0 1) D)
(mapsTo : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (D ∪ ⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(closed' : ∀ (A : Set X) (_ : A ⊆ C),
((∀ n j, IsClosed (A ∩ map n j '' closedBall 0 1)) ∧ IsClosed (A ∩ D)) → IsClosed A)
(isClosedBase : IsClosed D)
(union' : D ∪ ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
letI := mkFiniteType C D cell map finite_cell source_eq continuousOn continuousOn_symm
pairwiseDisjoint' disjointBase' mapsTo closed' isClosedBase union'
FiniteType C :=
letI := mkFiniteType C D cell map finite_cell source_eq continuousOn continuousOn_symm
pairwiseDisjoint' disjointBase' mapsTo closed' isClosedBase union'
{ finite_cell := finite_cell }
/-- If we want to construct a CW complex of finite type, we can add the condition `finite_cell` and
relax the condition `mapsTo`. -/
@[simps -isSimp]
def CWComplex.mkFiniteType.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(mapsTo : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(closed' : ∀ (A : Set X) (_ : A ⊆ C),
(∀ n j, IsClosed (A ∩ map n j '' closedBall 0 1)) → IsClosed A)
(union' : ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
CWComplex C where
cell := cell
map := map
source_eq := source_eq
continuousOn := continuousOn
continuousOn_symm := continuousOn_symm
pairwiseDisjoint' := pairwiseDisjoint'
mapsTo' n i := by
use fun m ↦ finite_univ.toFinset (s := (univ : Set (cell m)))
simp only [Finite.mem_toFinset, mem_univ, iUnion_true]
exact mapsTo n i
closed' := closed'
union' := union'
/-- A CW complex that was constructed using `CWComplex.mkFiniteType` is of finite type. -/
lemma CWComplex.finiteType_mkFiniteType.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(mapsTo : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(closed' : ∀ (A : Set X) (_ : A ⊆ C),
(∀ n j, IsClosed (A ∩ map n j '' closedBall 0 1)) → IsClosed A)
(union' : ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
letI := mkFiniteType C cell map finite_cell source_eq continuousOn continuousOn_symm
pairwiseDisjoint' mapsTo closed' union'
FiniteType C :=
letI := mkFiniteType C cell map finite_cell source_eq continuousOn continuousOn_symm
pairwiseDisjoint' mapsTo closed' union'
{ finite_cell := finite_cell }
/-- If we want to construct a finite relative CW complex we can add the conditions
`eventually_isEmpty_cell` and `finite_cell`, relax the condition `mapsTo` and remove the condition
`closed'`. -/
@[simps -isSimp]
def RelCWComplex.mkFinite.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(D : outParam (Set X)) (cell : (n : ℕ) → Type u)
(map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(eventually_isEmpty_cell : ∀ᶠ n in Filter.atTop, IsEmpty (cell n))
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(disjointBase' : ∀ (n : ℕ) (i : cell n), Disjoint (map n i '' ball 0 1) D)
(mapsTo : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (D ∪ ⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(isClosedBase : IsClosed D)
(union' : D ∪ ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
RelCWComplex C D where
cell := cell
map := map
source_eq := source_eq
continuousOn := continuousOn
continuousOn_symm := continuousOn_symm
pairwiseDisjoint' := pairwiseDisjoint'
disjointBase' := disjointBase'
mapsTo n i := by
use fun m ↦ finite_univ.toFinset (s := (univ : Set (cell m)))
simp only [Finite.mem_toFinset, mem_univ, iUnion_true]
exact mapsTo n i
closed' A asubc := by
intro h
-- `A = A ∩ C = A ∩ (D ∪ ⋃ n, ⋃ j, closedCell n j)` is closed by assumption since `C` has only
-- finitely many cells.
rw [← inter_eq_left.2 asubc]
simp_rw [Filter.eventually_atTop, ge_iff_le] at eventually_isEmpty_cell
obtain ⟨N, hN⟩ := eventually_isEmpty_cell
suffices IsClosed (A ∩ (D ∪ ⋃ (n : {n : ℕ // n < N}), ⋃ j, ↑(map n j) '' closedBall 0 1)) by
convert this using 2
rw [← union', iUnion_subtype]
congrm D ∪ ⋃ n, ?_
refine subset_antisymm ?_ (iUnion_subset (fun i ↦ by rfl))
apply iUnion_subset
intro i
have : n < N := Decidable.byContradiction fun h ↦ (hN n (Nat.ge_of_not_lt h)).false i
exact subset_iUnion₂ (s := fun _ i ↦ (map n i) '' closedBall 0 1) this i
simp_rw [inter_union_distrib_left, inter_iUnion]
exact h.2.union (isClosed_iUnion_of_finite (fun n ↦ isClosed_iUnion_of_finite (h.1 n.1)))
isClosedBase := isClosedBase
union' := union'
/-- A CW complex that was constructed using `RelCWComplex.mkFinite` is finite. -/
lemma RelCWComplex.finite_mkFinite.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(D : outParam (Set X)) (cell : (n : ℕ) → Type u)
(map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(eventually_isEmpty_cell : ∀ᶠ n in Filter.atTop, IsEmpty (cell n))
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(disjointBase' : ∀ (n : ℕ) (i : cell n), Disjoint (map n i '' ball 0 1) D)
(mapsTo : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (D ∪ ⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(isClosedBase : IsClosed D)
(union' : D ∪ ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
letI := mkFinite C D cell map eventually_isEmpty_cell finite_cell source_eq continuousOn
continuousOn_symm pairwiseDisjoint' disjointBase' mapsTo isClosedBase union'
Finite C :=
letI := mkFinite C D cell map eventually_isEmpty_cell finite_cell source_eq continuousOn
continuousOn_symm pairwiseDisjoint' disjointBase' mapsTo isClosedBase union'
{ eventually_isEmpty_cell := eventually_isEmpty_cell
finite_cell := finite_cell }
/-- If we want to construct a finite CW complex we can add the conditions `eventually_isEmpty_cell`
and `finite_cell`, relax the condition `mapsTo` and remove the condition `closed'`. -/
@[simps! -isSimp]
def CWComplex.mkFinite.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(eventually_isEmpty_cell : ∀ᶠ n in Filter.atTop, IsEmpty (cell n))
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(mapsTo_iff_image_subset : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(union' : ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
CWComplex C := (RelCWComplex.mkFinite C ∅
(cell := cell)
(map := map)
(eventually_isEmpty_cell := eventually_isEmpty_cell)
(finite_cell := finite_cell)
(source_eq := source_eq)
(continuousOn := continuousOn)
(continuousOn_symm := continuousOn_symm)
(pairwiseDisjoint' := pairwiseDisjoint')
(disjointBase' := by simp only [disjoint_empty, implies_true])
(mapsTo := by simpa only [empty_union])
(isClosedBase := isClosed_empty)
(union' := by simpa only [empty_union])).toCWComplex
/-- A CW complex that was constructed using `CWComplex.mkFinite` is finite. -/
lemma CWComplex.finite_mkFinite.{u} {X : Type u} [TopologicalSpace X] (C : Set X)
(cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X)
(eventually_isEmpty_cell : ∀ᶠ n in Filter.atTop, IsEmpty (cell n))
(finite_cell : ∀ (n : ℕ), _root_.Finite (cell n))
(source_eq : ∀ (n : ℕ) (i : cell n), (map n i).source = ball 0 1)
(continuousOn : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i) (closedBall 0 1))
(continuousOn_symm : ∀ (n : ℕ) (i : cell n), ContinuousOn (map n i).symm (map n i).target)
(pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1))
(mapsTo : ∀ (n : ℕ) (i : cell n),
MapsTo (map n i) (sphere 0 1) (⋃ (m < n) (j : cell m), map m j '' closedBall 0 1))
(union' : ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C) :
letI := mkFinite C cell map eventually_isEmpty_cell finite_cell source_eq continuousOn
continuousOn_symm pairwiseDisjoint' mapsTo union'
Finite C :=
letI := mkFinite C cell map eventually_isEmpty_cell finite_cell source_eq continuousOn
continuousOn_symm pairwiseDisjoint' mapsTo union'
{ eventually_isEmpty_cell := eventually_isEmpty_cell
finite_cell := finite_cell }
variable {X : Type*} [TopologicalSpace X] {C D : Set X} [RelCWComplex C D]
/-- If the collection of all cells (of any dimension) of a relative CW complex `C` is finite, then
`C` is finite as a CW complex. -/
lemma RelCWComplex.finite_of_finite_cells (finite : _root_.Finite (Σ n, cell C n)) : Finite C where
eventually_isEmpty_cell := by
simp only [Filter.eventually_atTop, ge_iff_le]
cases isEmpty_or_nonempty (Σ n, cell C n)
· exact ⟨0, by simp_all⟩
-- We take the greatest `n` such that there is a `j : cell C n` and show that this fulfills
-- the necessary conditions.
have _ := Fintype.ofFinite (Σ n, cell C n)
classical
let A := (Finset.univ : Finset (Σ n, cell C n)).image Sigma.fst
use A.max' (Finset.image_nonempty.2 Finset.univ_nonempty) + 1
intro m _
by_contra! h'
have hmA : m ∈ A := by
simp only [Finset.mem_image, Finset.mem_univ, true_and, A]
simp only [← exists_true_iff_nonempty] at h'
obtain ⟨j, _⟩ := h'
use ⟨m, j⟩
linarith [A.le_max' m hmA]
finite_cell _ := Finite.of_injective (Sigma.mk _) sigma_mk_injective
/-- If `C` is finite as a CW complex then the collection of all cells (of any dimension) is
finite. -/
lemma RelCWComplex.finite_cells_of_finite [finite : Finite C] : _root_.Finite (Σ n, cell C n) := by
-- We show that there is a bijection between `Σ n, cell C n` and
-- `Σ (m : {m : ℕ // m < n}), cell C m`.
have h := finite.eventually_isEmpty_cell
have _ := finite.finite_cell
simp only [Filter.eventually_atTop, ge_iff_le] at h
rcases h with ⟨n, hn⟩
have (m) (j : cell C m) : m < n := by
by_contra h
exact (hn m (not_lt.1 h)).false j
let f : (Σ (m : {m : ℕ // m < n}), cell C m) ≃ Σ m, cell C m := {
toFun := fun ⟨m, j⟩ ↦ ⟨m, j⟩
invFun := fun ⟨m, j⟩ ↦ ⟨⟨m, this m j⟩, j⟩
left_inv := by simp [Function.LeftInverse]
right_inv := by simp [Function.RightInverse, Function.LeftInverse]}
rw [← Equiv.finite_iff f]
exact Finite.instSigma
/-- A CW complex is finite iff the total number of its cells is finite. -/
lemma RelCWComplex.finite_iff_finite_cells : Finite C ↔ _root_.Finite (Σ n, cell C n) :=
⟨fun h ↦ finite_cells_of_finite (finite := h), finite_of_finite_cells⟩
namespace CWComplex
export RelCWComplex (finite_of_finite_cells finite_cells_of_finite finite_iff_finite_cells)
end CWComplex
end Topology |
.lake/packages/mathlib/Mathlib/Topology/CWComplex/Classical/Subcomplex.lean | import Mathlib.Topology.CWComplex.Classical.Finite
import Mathlib.Analysis.Normed.Module.RCLike.Real
/-!
# Subcomplexes
In this file we discuss subcomplexes of CW complexes.
The definintion of subcomplexes is in the file `Topology.CWComplex.Classical.Basic`.
## Main results
* `RelCWComplex.Subcomplex.instRelCWComplex`: a subcomplex of a (relative) CW complex is again a
(relative) CW complex.
## References
* [K. Jänich, *Topology*][Janich1984]
-/
noncomputable section
open Metric Set
namespace Topology
variable {X : Type*} [t : TopologicalSpace X] {C D : Set X}
lemma RelCWComplex.Subcomplex.closedCell_subset_of_mem [T2Space X] [RelCWComplex C D]
(E : Subcomplex C) {n : ℕ} {i : cell C n} (hi : i ∈ E.I n) :
closedCell n i ⊆ E := by
rw [← closure_openCell_eq_closedCell, E.closed.closure_subset_iff, ← E.union]
apply subset_union_of_subset_right
exact subset_iUnion_of_subset n
(subset_iUnion (fun (j : ↑(E.I n)) ↦ openCell (C := C) n j) ⟨i, hi⟩)
lemma RelCWComplex.Subcomplex.openCell_subset_of_mem [T2Space X] [RelCWComplex C D]
(E : Subcomplex C) {n : ℕ} {i : cell C n} (hi : i ∈ E.I n) :
openCell n i ⊆ E :=
(openCell_subset_closedCell n i).trans (closedCell_subset_of_mem E hi)
lemma RelCWComplex.Subcomplex.cellFrontier_subset_of_mem [T2Space X] [RelCWComplex C D]
(E : Subcomplex C) {n : ℕ} {i : cell C n} (hi : i ∈ E.I n) :
cellFrontier n i ⊆ E :=
(cellFrontier_subset_closedCell n i).trans (closedCell_subset_of_mem E hi)
/-- A subcomplex is the union of its closed cells and its base. -/
lemma RelCWComplex.Subcomplex.union_closedCell [T2Space X] [RelCWComplex C D] (E : Subcomplex C) :
D ∪ ⋃ (n : ℕ) (j : E.I n), closedCell (C := C) n j = E := by
apply subset_antisymm
· apply union_subset E.base_subset
exact iUnion₂_subset fun n i ↦ closedCell_subset_of_mem E i.2
· rw [← E.union]
apply union_subset_union_right
apply iUnion₂_mono fun n i ↦ ?_
exact openCell_subset_closedCell (C := C) n i
/-- A subcomplex is the union of its closed cells. -/
lemma CWComplex.Subcomplex.union_closedCell [T2Space X] [CWComplex C] (E : Subcomplex C) :
⋃ (n : ℕ) (j : E.I n), closedCell (C := C) n j = E :=
(empty_union _).symm.trans (RelCWComplex.Subcomplex.union_closedCell E)
lemma RelCWComplex.Subcomplex.disjoint_openCell_subcomplex_of_not_mem [RelCWComplex C D]
(E : Subcomplex C) {n : ℕ} {i : cell C n} (h : i ∉ E.I n) : Disjoint (openCell n i) E := by
simp_rw [← union, disjoint_union_right, disjoint_iUnion_right]
exact ⟨disjointBase n i , fun _ _ ↦ disjoint_openCell_of_ne (by aesop)⟩
open Classical in
/-- A subcomplex is again a CW complex. -/
@[simps]
instance RelCWComplex.Subcomplex.instRelCWComplex [T2Space X] [RelCWComplex C D]
(E : Subcomplex C) : RelCWComplex E D where
cell n := E.I n
map n i := map (C := C) n i
source_eq n i := source_eq (C := C) n i
continuousOn n i := continuousOn (C := C) n i
continuousOn_symm n i := continuousOn_symm (C := C) n i
pairwiseDisjoint' := by
intro ⟨n, i⟩ _ ⟨m, j⟩ _ hne
refine @pairwiseDisjoint' _ _ C D _ ⟨n, i⟩ trivial ⟨m, j⟩ trivial ?_
exact Function.injective_id.sigma_map (fun _ ↦ Subtype.val_injective) |>.ne hne
disjointBase' n i := disjointBase' (C := C) n i
mapsTo := by
intro n i
rcases cellFrontier_subset_finite_openCell (C := C) n i with ⟨J, hJ⟩
use fun m ↦ Finset.preimage (J m) Subtype.val Subtype.val_injective.injOn
rw [mapsTo_iff_image_subset]
intro x hx
specialize hJ hx
simp_rw [iUnion_coe_set, mem_union, mem_iUnion, Finset.mem_preimage, exists_prop,
Decidable.or_iff_not_imp_left] at hJ ⊢
intro h
specialize hJ h
obtain ⟨m, hmn, j, hj, hxj⟩ := hJ
suffices j ∈ E.I m from ⟨m, hmn, j, this, hj, openCell_subset_closedCell _ _ hxj⟩
have : x ∈ (E : Set X) := E.cellFrontier_subset_of_mem i.2 hx
by_contra hj'
exact E.disjoint_openCell_subcomplex_of_not_mem hj' |>.notMem_of_mem_left hxj this
closed' A hA h := by
apply isClosed_of_disjoint_openCell_or_isClosed_inter_closedCell
(subset_trans hA (subset_complex (C := C) E)) h.2
intro n _ j
by_cases hj : j ∈ E.I n
· exact Or.intro_right _ (h.1 n ⟨j, hj⟩)
· exact Or.intro_left _ ((disjoint_openCell_subcomplex_of_not_mem E hj).symm.mono_left hA)
isClosedBase := isClosedBase (C := C)
union' := union_closedCell E
/-- A subcomplex is again a CW complex. -/
instance CWComplex.Subcomplex.instCWComplex [T2Space X] [CWComplex C] (E : Subcomplex C) :
CWComplex (E : Set X) :=
RelCWComplex.toCWComplex (E : Set X)
@[simp]
lemma CWComplex.Subcomplex.cell_def [T2Space X] [CWComplex C] (E : Subcomplex C)
(n : ℕ) : cell (E : Set X) n = E.I (C := C) n :=
rfl
@[simp]
lemma CWComplex.Subcomplex.map_def [T2Space X] [CWComplex C] (E : Subcomplex C) (n : ℕ)
(i : E.I n) : map (C := E) n i = map (C := C) n i :=
rfl
@[simp]
lemma RelCWComplex.Subcomplex.openCell_eq [T2Space X] [RelCWComplex C D] (E : Subcomplex C) (n : ℕ)
(i : E.I n) : openCell (C := E) n i = openCell n (i : cell C n) := by
rfl
@[simp]
lemma RelCWComplex.Subcomplex.closedCell_eq [T2Space X] [RelCWComplex C D] (E : Subcomplex C)
(n : ℕ) (i : E.I n) : closedCell (C := E) n i = closedCell n (i : cell C n) := by
rfl
@[simp]
lemma RelCWComplex.Subcomplex.cellFrontier_eq [T2Space X] [RelCWComplex C D] (E : Subcomplex C)
(n : ℕ) (i : E.I n) : cellFrontier (C := E) n i = cellFrontier n (i : cell C n) := by
rfl
instance RelCWComplex.Subcomplex.finiteType_subcomplex_of_finiteType [T2Space X]
[RelCWComplex C D] [FiniteType C] (E : Subcomplex C) : FiniteType (E : Set X) where
finite_cell n :=
let _ := FiniteType.finite_cell (C := C) (D := D) n
Subtype.finite
instance RelCWComplex.Subcomplex.finiteDimensional_subcomplex_of_finiteDimensional
[T2Space X] [RelCWComplex C D] [FiniteDimensional C] (E : Subcomplex C) :
FiniteDimensional (E : Set X) where
eventually_isEmpty_cell := by
filter_upwards [FiniteDimensional.eventually_isEmpty_cell (C := C) (D := D)] with n hn
simp [isEmpty_subtype]
/-- A subcomplex of a finite CW complex is again finite. -/
instance RelCWComplex.Subcomplex.finite_subcomplex_of_finite [T2Space X] [RelCWComplex C D]
[Finite C] (E : Subcomplex C) : Finite (E : Set X) :=
finite_of_finiteDimensional_finiteType _
namespace CWComplex.Subcomplex
export RelCWComplex.Subcomplex (closedCell_subset_of_mem openCell_subset_of_mem
cellFrontier_subset_of_mem disjoint_openCell_subcomplex_of_not_mem subset_complex
finiteType_subcomplex_of_finiteType finiteDimensional_subcomplex_of_finiteDimensional
finite_subcomplex_of_finite)
end CWComplex.Subcomplex
end Topology |
.lake/packages/mathlib/Mathlib/Topology/CWComplex/Classical/Basic.lean | import Mathlib.Analysis.Normed.Module.RCLike.Real
import Mathlib.Data.ENat.Basic
import Mathlib.Logic.Equiv.PartialEquiv
import Mathlib.Topology.MetricSpace.ProperSpace.Real
/-!
# CW complexes
This file defines (relative) CW complexes and proves basic properties about them using the classical
approach of Whitehead.
A CW complex is a topological space that is made by gluing closed disks of different dimensions
together.
## Main definitions
* `RelCWComplex C D`: the class of CW structures on a subspace `C` relative to a base set
`D` of a topological space `X`.
* `CWComplex C`: an abbreviation for `RelCWComplex C ∅`. The class of CW structures on a
subspace `C` of the topological space `X`.
* `openCell n`: indexed family of all open cells of dimension `n`.
* `closedCell n`: indexed family of all closed cells of dimension `n`.
* `cellFrontier n`: indexed family of the boundaries of cells of dimension `n`.
* `skeleton C n`: the `n`-skeleton of the (relative) CW complex `C`.
## Main statements
* `iUnion_openCell_eq_skeleton`: the skeletons can also be seen as a union of open cells.
* `cellFrontier_subset_finite_openCell`: the edge of a cell is contained in a finite union of
open cells of a lower dimension.
## Implementation notes
* We use the historical definition of CW complexes, due to Whitehead: a CW complex is a collection
of cells with attaching maps - all cells are subspaces of one ambient topological space.
This way, we avoid having to work with a lot of different topological spaces.
On the other hand, it requires the union of all cells to be closed.
If that is not the case, you need to consider that union as a subspace of itself.
* For a categorical approach that defines CW complexes via colimits and transfinite compositions,
see `Mathlib/Topology/CWComplex/Abstract/Basic.lean`.
The two approaches are equivalent but serve different purposes:
* This approach is more convenient for concrete geometric arguments
* The categorical approach is more suitable for abstract arguments and generalizations
* The definition `RelCWComplex` does not require `X` to be a Hausdorff space.
A lot of the lemmas will however require this property.
* This definition is a class to ease working with different constructions and their properties.
Overall this means that being a CW complex is treated more like a property than data.
* The natural number is explicit in `openCell`, `closedCell` and `cellFrontier` because `cell n` and
`cell m` might be the same type in an explicit CW complex even when `n` and `m` are different.
* `CWComplex` is a separate class from `RelCWComplex`. This not only gives absolute CW complexes a
better constructor but also aids typeclass inference: a construction on relative CW complexes may
yield a base that for the special case of CW complexes is provably equal to the empty set but not
definitionally so. In that case we define an instance specifically for absolute CW complexes and
want this to be inferred over the relative version. Since the base is an `outParam` this is
especially necessary since you cannot provide typeclass inference with a specified base.
But having the type `CWComplex` be separate from `RelCWComplex` makes this specification possible.
* For a similar reason to the previous bullet point we make the instance
`CWComplex.instRelCWComplex` have high priority. For example, when talking about the type of
cells `cell C` of an absolute CW complex `C`, this actually refers to `RelCWComplex.cell C`
through this instance. Again, we want typeclass inference to first consider absolute CW
structures.
* For statements, the auxiliary construction `skeletonLT` is preferred over `skeleton` as it makes
the base case of inductions easier. The statement about `skeleton` should then be derived from the
one about `skeletonLT`.
## References
* [A. Hatcher, *Algebraic Topology*][hatcher02]
-/
noncomputable section
open Metric Set
namespace Topology
/-- A CW complex of a topological space `X` relative to another subspace `D` is the data of its
*`n`-cells* `cell n i` for each `n : ℕ` along with *attaching maps* that satisfy a number of
properties with the most important being closure-finiteness (`mapsTo`) and weak topology
(`closed'`). Note that this definition requires `C` and `D` to be closed subspaces.
If `C` is not closed choose `X` to be `C`. -/
class RelCWComplex.{u} {X : Type u} [TopologicalSpace X] (C : Set X) (D : outParam (Set X)) where
/-- The indexing type of the cells of dimension `n`. -/
cell (n : ℕ) : Type u
/-- The characteristic map of the `n`-cell given by the index `i`.
This map is a bijection when restricting to `ball 0 1`, where we consider `(Fin n → ℝ)`
endowed with the maximum metric. -/
map (n : ℕ) (i : cell n) : PartialEquiv (Fin n → ℝ) X
/-- The source of every characteristic map of dimension `n` is
`(ball 0 1 : Set (Fin n → ℝ))`. -/
source_eq (n : ℕ) (i : cell n) : (map n i).source = ball 0 1
/-- The characteristic maps are continuous when restricting to `closedBall 0 1`. -/
continuousOn (n : ℕ) (i : cell n) : ContinuousOn (map n i) (closedBall 0 1)
/-- The inverse of the restriction to `ball 0 1` is continuous on the image. -/
continuousOn_symm (n : ℕ) (i : cell n) : ContinuousOn (map n i).symm (map n i).target
/-- The open cells are pairwise disjoint. Use `RelCWComplex.pairwiseDisjoint` or
`RelCWComplex.disjoint_openCell_of_ne` instead. -/
pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1)
/-- All open cells are disjoint with the base. Use `RelCWComplex.disjointBase` instead. -/
disjointBase' (n : ℕ) (i : cell n) : Disjoint (map n i '' ball 0 1) D
/-- The boundary of a cell is contained in the union of the base with a finite union of closed
cells of a lower dimension. Use `RelCWComplex.cellFrontier_subset_base_union_finite_closedCell`
instead. -/
mapsTo (n : ℕ) (i : cell n) : ∃ I : Π m, Finset (cell m),
MapsTo (map n i) (sphere 0 1) (D ∪ ⋃ (m < n) (j ∈ I m), map m j '' closedBall 0 1)
/-- A CW complex has weak topology, i.e. a set `A` in `X` is closed iff its intersection with
every closed cell and `D` is closed. Use `RelCWComplex.closed` instead. -/
closed' (A : Set X) (hAC : A ⊆ C) :
((∀ n j, IsClosed (A ∩ map n j '' closedBall 0 1)) ∧ IsClosed (A ∩ D)) → IsClosed A
/-- The base `D` is closed. -/
isClosedBase : IsClosed D
/-- The union of all closed cells equals `C`. Use `RelCWComplex.union` instead. -/
union' : D ∪ ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C
/-- Characterizing when a subspace `C` of a topological space `X` is a CW complex. Note that this
requires `C` to be closed. If `C` is not closed choose `X` to be `C`. -/
class CWComplex.{u} {X : Type u} [TopologicalSpace X] (C : Set X) where
/-- The indexing type of the cells of dimension `n`. -/
protected cell (n : ℕ) : Type u
/-- The characteristic map of the `n`-cell given by the index `i`.
This map is a bijection when restricting to `ball 0 1`, where we consider `(Fin n → ℝ)`
endowed with the maximum metric. -/
protected map (n : ℕ) (i : cell n) : PartialEquiv (Fin n → ℝ) X
/-- The source of every characteristic map of dimension `n` is
`(ball 0 1 : Set (Fin n → ℝ))`. -/
protected source_eq (n : ℕ) (i : cell n) : (map n i).source = ball 0 1
/-- The characteristic maps are continuous when restricting to `closedBall 0 1`. -/
protected continuousOn (n : ℕ) (i : cell n) : ContinuousOn (map n i) (closedBall 0 1)
/-- The inverse of the restriction to `ball 0 1` is continuous on the image. -/
protected continuousOn_symm (n : ℕ) (i : cell n) : ContinuousOn (map n i).symm (map n i).target
/-- The open cells are pairwise disjoint. Use `CWComplex.pairwiseDisjoint` or
`CWComplex.disjoint_openCell_of_ne` instead. -/
protected pairwiseDisjoint' :
(univ : Set (Σ n, cell n)).PairwiseDisjoint (fun ni ↦ map ni.1 ni.2 '' ball 0 1)
/-- The boundary of a cell is contained in a finite union of closed cells of a lower dimension.
Use `CWComplex.mapsTo` or `CWComplex.cellFrontier_subset_finite_closedCell` instead. -/
protected mapsTo' (n : ℕ) (i : cell n) : ∃ I : Π m, Finset (cell m),
MapsTo (map n i) (sphere 0 1) (⋃ (m < n) (j ∈ I m), map m j '' closedBall 0 1)
/-- A CW complex has weak topology, i.e. a set `A` in `X` is closed iff its intersection with
every closed cell is closed. Use `CWComplex.closed` instead. -/
protected closed' (A : Set X) (hAC : A ⊆ C) :
(∀ n j, IsClosed (A ∩ map n j '' closedBall 0 1)) → IsClosed A
/-- The union of all closed cells equals `C`. Use `CWComplex.union` instead. -/
protected union' : ⋃ (n : ℕ) (j : cell n), map n j '' closedBall 0 1 = C
@[simps -isSimp]
instance (priority := high) CWComplex.instRelCWComplex {X : Type*} [TopologicalSpace X] (C : Set X)
[CWComplex C] : RelCWComplex C ∅ where
cell := CWComplex.cell C
map := CWComplex.map
source_eq := CWComplex.source_eq
continuousOn := CWComplex.continuousOn
continuousOn_symm := CWComplex.continuousOn_symm
pairwiseDisjoint' := CWComplex.pairwiseDisjoint'
disjointBase' := by simp [disjoint_empty]
mapsTo := by simpa only [empty_union] using CWComplex.mapsTo'
closed' := by simpa only [inter_empty, isClosed_empty, and_true] using CWComplex.closed'
isClosedBase := isClosed_empty
union' := by simpa only [empty_union] using CWComplex.union'
/-- A relative CW complex with an empty base is an absolute CW complex. -/
@[simps -isSimp]
def RelCWComplex.toCWComplex {X : Type*} [TopologicalSpace X] (C : Set X) [RelCWComplex C ∅] :
CWComplex C where
cell := cell C
map := map
source_eq := source_eq
continuousOn := continuousOn
continuousOn_symm := continuousOn_symm
pairwiseDisjoint' := pairwiseDisjoint'
mapsTo' := by simpa using mapsTo (C := C)
closed' := by simpa using closed' (C := C)
union' := by simpa using union' (C := C)
lemma RelCWComplex.toCWComplex_eq {X : Type*} [TopologicalSpace X] (C : Set X)
[h : RelCWComplex C ∅] : (toCWComplex C).instRelCWComplex = h :=
rfl
variable {X : Type*} [t : TopologicalSpace X] {C D : Set X}
/-- The open `n`-cell given by the index `i`. Use this instead of `map n i '' ball 0 1` whenever
possible. -/
def RelCWComplex.openCell [RelCWComplex C D] (n : ℕ) (i : cell C n) : Set X := map n i '' ball 0 1
/-- The closed `n`-cell given by the index `i`. Use this instead of `map n i '' closedBall 0 1`
whenever possible. -/
def RelCWComplex.closedCell [RelCWComplex C D] (n : ℕ) (i : cell C n) : Set X :=
map n i '' closedBall 0 1
/-- The boundary of the `n`-cell given by the index `i`. Use this instead of `map n i '' sphere 0 1`
whenever possible. -/
def RelCWComplex.cellFrontier [RelCWComplex C D] (n : ℕ) (i : cell C n) : Set X :=
map n i '' sphere 0 1
namespace CWComplex
export RelCWComplex (cell map source_eq continuousOn continuousOn_symm mapsTo isClosedBase openCell
closedCell cellFrontier)
end CWComplex
lemma CWComplex.mapsTo [CWComplex C] (n : ℕ) (i : cell C n) : ∃ I : Π m, Finset (cell C m),
MapsTo (map n i) (sphere 0 1) (⋃ (m < n) (j ∈ I m), map m j '' closedBall 0 1) := by
have := RelCWComplex.mapsTo n i
simp_rw [empty_union] at this
exact this
lemma RelCWComplex.pairwiseDisjoint [RelCWComplex C D] :
(univ : Set (Σ n, cell C n)).PairwiseDisjoint (fun ni ↦ openCell ni.1 ni.2) :=
RelCWComplex.pairwiseDisjoint'
lemma RelCWComplex.disjointBase [RelCWComplex C D] (n : ℕ) (i : cell C n) :
Disjoint (openCell n i) D :=
RelCWComplex.disjointBase' n i
lemma RelCWComplex.disjoint_openCell_of_ne [RelCWComplex C D] {n m : ℕ} {i : cell C n}
{j : cell C m} (ne : (⟨n, i⟩ : Σ n, cell C n) ≠ ⟨m, j⟩) :
Disjoint (openCell n i) (openCell m j) :=
pairwiseDisjoint (mem_univ _) (mem_univ _) ne
lemma RelCWComplex.cellFrontier_subset_base_union_finite_closedCell [RelCWComplex C D]
(n : ℕ) (i : cell C n) : ∃ I : Π m, Finset (cell C m), cellFrontier n i ⊆
D ∪ ⋃ (m < n) (j ∈ I m), closedCell m j := by
rcases mapsTo n i with ⟨I, hI⟩
use I
rw [mapsTo_iff_image_subset] at hI
exact hI
lemma CWComplex.cellFrontier_subset_finite_closedCell [CWComplex C] (n : ℕ) (i : cell C n) :
∃ I : Π m, Finset (cell C m), cellFrontier n i ⊆ ⋃ (m < n) (j ∈ I m), closedCell m j := by
rcases RelCWComplex.mapsTo n i with ⟨I, hI⟩
use I
rw [mapsTo_iff_image_subset, empty_union] at hI
exact hI
lemma RelCWComplex.union [RelCWComplex C D] : D ∪ ⋃ (n : ℕ) (j : cell C n), closedCell n j = C :=
RelCWComplex.union'
lemma CWComplex.union [CWComplex C] : ⋃ (n : ℕ) (j : cell C n), closedCell n j = C := by
have := RelCWComplex.union' (C := C)
rw [empty_union] at this
exact this
lemma RelCWComplex.openCell_subset_closedCell [RelCWComplex C D] (n : ℕ) (i : cell C n) :
openCell n i ⊆ closedCell n i := image_mono Metric.ball_subset_closedBall
lemma RelCWComplex.cellFrontier_subset_closedCell [RelCWComplex C D] (n : ℕ) (i : cell C n) :
cellFrontier n i ⊆ closedCell n i := image_mono Metric.sphere_subset_closedBall
lemma RelCWComplex.cellFrontier_union_openCell_eq_closedCell [RelCWComplex C D] (n : ℕ)
(i : cell C n) : cellFrontier n i ∪ openCell n i = closedCell n i := by
rw [cellFrontier, openCell, closedCell, ← image_union]
congrm map n i '' ?_
exact sphere_union_ball
lemma RelCWComplex.map_zero_mem_openCell [RelCWComplex C D] (n : ℕ) (i : cell C n) :
map n i 0 ∈ openCell n i := by
apply mem_image_of_mem
simp only [mem_ball, dist_self, zero_lt_one]
lemma RelCWComplex.map_zero_mem_closedCell [RelCWComplex C D] (n : ℕ) (i : cell C n) :
map n i 0 ∈ closedCell n i :=
openCell_subset_closedCell _ _ (map_zero_mem_openCell _ _)
/-- This is an auxiliary lemma used to prove `RelCWComplex.eq_of_eq_union_iUnion`. -/
private lemma RelCWComplex.subset_of_eq_union_iUnion [RelCWComplex C D] (I J : Π n, Set (cell C n))
(hIJ : D ∪ ⋃ (n : ℕ) (j : I n), openCell (C := C) n j =
D ∪ ⋃ (n : ℕ) (j : J n), openCell (C := C) n j) (n : ℕ) :
I n ⊆ J n := by
intro i hi
by_contra hJ
have h : openCell n i ⊆ D ∪ ⋃ n, ⋃ (j : J n), openCell (C := C) n j :=
hIJ.symm ▸ subset_union_of_subset_right
(subset_iUnion_of_subset n (subset_iUnion_of_subset ⟨i, hi⟩ (subset_refl (openCell n i)))) D
have h' : Disjoint (openCell n i) (D ∪ ⋃ n, ⋃ (j : J n), openCell (C := C) n j) := by
simp_rw [disjoint_union_right, disjoint_iUnion_right]
exact ⟨disjointBase n i, fun m j ↦ disjoint_openCell_of_ne (by aesop)⟩
rw [disjoint_of_subset_iff_left_eq_empty h] at h'
exact notMem_empty _ (h' ▸ map_zero_mem_openCell n i)
lemma RelCWComplex.eq_of_eq_union_iUnion [RelCWComplex C D] (I J : Π n, Set (cell C n))
(hIJ : D ∪ ⋃ (n : ℕ) (j : I n), openCell (C := C) n j =
D ∪ ⋃ (n : ℕ) (j : J n), openCell (C := C) n j) :
I = J := by
ext n x
exact ⟨fun h ↦ subset_of_eq_union_iUnion I J hIJ n h,
fun h ↦ subset_of_eq_union_iUnion J I hIJ.symm n h⟩
lemma CWComplex.eq_of_eq_union_iUnion [CWComplex C] (I J : Π n, Set (cell C n))
(hIJ : ⋃ (n : ℕ) (j : I n), openCell (C := C) n j =
⋃ (n : ℕ) (j : J n), openCell (C := C) n j) :
I = J := by
apply RelCWComplex.eq_of_eq_union_iUnion
simp_rw [empty_union, hIJ]
lemma RelCWComplex.isCompact_closedCell [RelCWComplex C D] {n : ℕ} {i : cell C n} :
IsCompact (closedCell n i) :=
(isCompact_closedBall _ _).image_of_continuousOn (continuousOn n i)
lemma RelCWComplex.isClosed_closedCell [RelCWComplex C D] [T2Space X] {n : ℕ} {i : cell C n} :
IsClosed (closedCell n i) := isCompact_closedCell.isClosed
lemma RelCWComplex.isCompact_cellFrontier [RelCWComplex C D] {n : ℕ} {i : cell C n} :
IsCompact (cellFrontier n i) :=
(isCompact_sphere _ _).image_of_continuousOn ((continuousOn n i).mono sphere_subset_closedBall)
lemma RelCWComplex.isClosed_cellFrontier [RelCWComplex C D] [T2Space X] {n : ℕ} {i : cell C n} :
IsClosed (cellFrontier n i) :=
isCompact_cellFrontier.isClosed
lemma RelCWComplex.closure_openCell_eq_closedCell [RelCWComplex C D] [T2Space X] {n : ℕ}
{j : cell C n} : closure (openCell n j) = closedCell n j := by
apply subset_antisymm (isClosed_closedCell.closure_subset_iff.2 (openCell_subset_closedCell n j))
rw [closedCell, ← closure_ball 0 (by exact one_ne_zero)]
apply ContinuousOn.image_closure
rw [closure_ball 0 (by exact one_ne_zero)]
exact continuousOn n j
lemma RelCWComplex.closed (C : Set X) {D : Set X} [RelCWComplex C D] [T2Space X] (A : Set X)
(asubc : A ⊆ C) :
IsClosed A ↔ (∀ n (j : cell C n), IsClosed (A ∩ closedCell n j)) ∧ IsClosed (A ∩ D) := by
refine ⟨?_, closed' A asubc⟩
exact fun closedA ↦ ⟨fun _ _ ↦ closedA.inter isClosed_closedCell, closedA.inter (isClosedBase C)⟩
lemma CWComplex.closed (C : Set X) [CWComplex C] [T2Space X] (A : Set X) (asubc : A ⊆ C) :
IsClosed A ↔ ∀ n (j : cell C n), IsClosed (A ∩ closedCell n j) := by
have := RelCWComplex.closed C A asubc
simp_all
lemma RelCWComplex.closedCell_subset_complex [RelCWComplex C D] (n : ℕ) (j : cell C n) :
closedCell n j ⊆ C := by
simp_rw [← union]
exact subset_union_of_subset_right (subset_iUnion₂ _ _) _
lemma RelCWComplex.openCell_subset_complex [RelCWComplex C D] (n : ℕ) (j : cell C n) :
openCell n j ⊆ C :=
(openCell_subset_closedCell _ _).trans (closedCell_subset_complex _ _)
lemma RelCWComplex.cellFrontier_subset_complex [RelCWComplex C D] (n : ℕ) (j : cell C n) :
cellFrontier n j ⊆ C :=
(cellFrontier_subset_closedCell n j).trans (closedCell_subset_complex n j)
lemma RelCWComplex.closedCell_zero_eq_singleton [RelCWComplex C D] {j : cell C 0} :
closedCell 0 j = {map 0 j ![]} := by
simp [closedCell, Matrix.empty_eq]
lemma RelCWComplex.openCell_zero_eq_singleton [RelCWComplex C D] {j : cell C 0} :
openCell 0 j = {map 0 j ![]} := by
simp [openCell, Matrix.empty_eq]
lemma RelCWComplex.cellFrontier_zero_eq_empty [RelCWComplex C D] {j : cell C 0} :
cellFrontier 0 j = ∅ := by
simp [cellFrontier, sphere_eq_empty_of_subsingleton]
lemma RelCWComplex.base_subset_complex [RelCWComplex C D] : D ⊆ C := by
simp_rw [← union]
exact subset_union_left
lemma RelCWComplex.isClosed [T2Space X] [RelCWComplex C D] : IsClosed C := by
rw [closed C C (by rfl)]
constructor
· intros
rw [inter_eq_right.2 (closedCell_subset_complex _ _)]
exact isClosed_closedCell
· rw [inter_eq_right.2 base_subset_complex]
exact isClosedBase C
/-- A helper lemma that is essentially the same as `RelCWComplex.iUnion_openCell_eq_skeletonLT`.
Use that lemma instead. -/
private lemma RelCWComplex.iUnion_openCell_eq_iUnion_closedCell [RelCWComplex C D] (n : ℕ∞) :
D ∪ ⋃ (m : ℕ) (_ : m < n) (j : cell C m), openCell m j =
D ∪ ⋃ (m : ℕ) (_ : m < n) (j : cell C m), closedCell m j := by
apply subset_antisymm
· apply union_subset
· exact subset_union_left
· apply iUnion₂_subset fun m hm ↦ iUnion_subset fun j ↦ ?_
apply subset_union_of_subset_right
apply subset_iUnion₂_of_subset m hm
apply subset_iUnion_of_subset j
exact openCell_subset_closedCell m j
· apply union_subset subset_union_left
refine iUnion₂_subset fun m hm ↦ iUnion_subset fun j ↦ ?_
rw [← cellFrontier_union_openCell_eq_closedCell]
apply union_subset
· induction m using Nat.case_strong_induction_on with
| hz => simp [cellFrontier_zero_eq_empty]
| hi m hm' =>
obtain ⟨I, hI⟩ := cellFrontier_subset_base_union_finite_closedCell (m + 1) j
apply hI.trans
apply union_subset subset_union_left
apply iUnion₂_subset fun l hl ↦ iUnion₂_subset fun i _ ↦ ?_
rw [← cellFrontier_union_openCell_eq_closedCell]
apply union_subset
· exact (hm' l (Nat.le_of_lt_succ hl) ((ENat.coe_lt_coe.2 hl).trans hm) i)
· apply subset_union_of_subset_right
exact subset_iUnion₂_of_subset l ((ENat.coe_lt_coe.2 hl).trans hm) <| subset_iUnion _ i
· exact subset_union_of_subset_right (subset_iUnion₂_of_subset m hm (subset_iUnion _ j)) _
lemma RelCWComplex.union_iUnion_openCell_eq_complex [RelCWComplex C D] :
D ∪ ⋃ (n : ℕ) (j : cell C n), openCell n j = C := by
suffices D ∪ ⋃ n, ⋃ (j : cell C n), openCell n j =
D ∪ ⋃ (m : ℕ) (_ : m < (⊤ : ℕ∞)) (j : cell C m), closedCell m j by
simpa [union] using this
simp_rw [← RelCWComplex.iUnion_openCell_eq_iUnion_closedCell, ENat.coe_lt_top, iUnion_true]
lemma CWComplex.iUnion_openCell_eq_complex [CWComplex C] :
⋃ (n : ℕ) (j : cell C n), openCell n j = C := by
simpa using RelCWComplex.union_iUnion_openCell_eq_complex (C := C)
/-- The contrapositive of `disjoint_openCell_of_ne`. -/
lemma RelCWComplex.eq_of_not_disjoint_openCell [RelCWComplex C D] {n : ℕ} {j : cell C n} {m : ℕ}
{i : cell C m} (h : ¬ Disjoint (openCell n j) (openCell m i)) :
(⟨n, j⟩ : (Σ n, cell C n)) = ⟨m, i⟩ := by
contrapose! h
exact disjoint_openCell_of_ne h
lemma RelCWComplex.disjoint_base_iUnion_openCell [RelCWComplex C D] :
Disjoint D (⋃ (n : ℕ) (j : cell C n), openCell n j) := by
simp_rw [disjoint_iff_inter_eq_empty, inter_iUnion, iUnion_eq_empty]
intro n i
rw [inter_comm, (disjointBase n i).inter_eq]
/-- If for all `m ≤ n` and every `i : cell C m` the intersection `A ∩ closedCell m j` is closed
and `A ∩ D` is closed then `A ∩ cellFrontier (n + 1) j` is closed for every
`j : cell C (n + 1)`. -/
lemma RelCWComplex.isClosed_inter_cellFrontier_succ_of_le_isClosed_inter_closedCell
[RelCWComplex C D] [T2Space X] {A : Set X} {n : ℕ} (hn : ∀ m ≤ n, ∀ (j : cell C m),
IsClosed (A ∩ closedCell m j)) (j : cell C (n + 1)) (hD : IsClosed (A ∩ D)) :
IsClosed (A ∩ cellFrontier (n + 1) j) := by
-- this is a consequence of `cellFrontier_subset_base_union_finite_closedCell`
obtain ⟨I, hI⟩ := cellFrontier_subset_base_union_finite_closedCell (n + 1) j
rw [← inter_eq_right.2 hI, ← inter_assoc]
refine IsClosed.inter ?_ isClosed_cellFrontier
simp_rw [inter_union_distrib_left, inter_iUnion,
← iUnion_subtype (fun m ↦ m < n + 1) (fun m ↦ ⋃ i ∈ I m, A ∩ closedCell m i)]
apply hD.union
apply isClosed_iUnion_of_finite
intro ⟨m, mlt⟩
rw [← iUnion_subtype (fun i ↦ i ∈ I m) (fun i ↦ A ∩ closedCell m i.1)]
exact isClosed_iUnion_of_finite (fun ⟨j, _⟩ ↦ hn m (Nat.le_of_lt_succ mlt) j)
lemma CWComplex.isClosed_inter_cellFrontier_succ_of_le_isClosed_inter_closedCell
[CWComplex C] [T2Space X] {A : Set X} {n : ℕ} (hn : ∀ m ≤ n, ∀ (j : cell C m),
IsClosed (A ∩ closedCell m j)) (j : cell C (n + 1)) :
IsClosed (A ∩ cellFrontier (n + 1) j) :=
RelCWComplex.isClosed_inter_cellFrontier_succ_of_le_isClosed_inter_closedCell hn j
(by simp only [inter_empty, isClosed_empty])
/-- If for every cell either `A ∩ openCell n j` or `A ∩ closedCell n j` is closed then
`A` is closed. -/
lemma RelCWComplex.isClosed_of_isClosed_inter_openCell_or_isClosed_inter_closedCell
[RelCWComplex C D] [T2Space X] {A : Set X} (hAC : A ⊆ C) (hDA : IsClosed (A ∩ D))
(h : ∀ n (_ : 0 < n), ∀ (j : cell C n),
IsClosed (A ∩ openCell n j) ∨ IsClosed (A ∩ closedCell n j)) : IsClosed A := by
rw [closed C A hAC]
refine ⟨?_, hDA⟩
intro n j
induction n using Nat.case_strong_induction_on with
| hz =>
rw [closedCell_zero_eq_singleton]
exact isClosed_inter_singleton
| hi n hn =>
specialize h n.succ n.zero_lt_succ j
rcases h with h1 | h2
· rw [← cellFrontier_union_openCell_eq_closedCell, inter_union_distrib_left]
exact (isClosed_inter_cellFrontier_succ_of_le_isClosed_inter_closedCell hn j hDA).union h1
· exact h2
/-- If for every cell either `A ∩ openCell n j` is empty or `A ∩ closedCell n j` is closed then
`A` is closed. -/
lemma RelCWComplex.isClosed_of_disjoint_openCell_or_isClosed_inter_closedCell
[RelCWComplex C D] [T2Space X] {A : Set X} (hAC : A ⊆ C) (hDA : IsClosed (A ∩ D))
(h : ∀ n (_ : 0 < n), ∀ (j : cell C n),
Disjoint A (openCell n j) ∨ IsClosed (A ∩ closedCell n j)) : IsClosed A := by
apply isClosed_of_isClosed_inter_openCell_or_isClosed_inter_closedCell hAC hDA
intro n hn j
rcases h n hn j with h | h
· left
rw [disjoint_iff_inter_eq_empty.1 h]
exact isClosed_empty
· exact Or.inr h
/-- If for every cell either `A ∩ openCell n j` or `A ∩ closedCell n j` is closed then
`A` is closed. -/
lemma CWComplex.isClosed_of_isClosed_inter_openCell_or_isClosed_inter_closedCell
[CWComplex C] [T2Space X] {A : Set X} (hAC : A ⊆ C) (h : ∀ n (_ : 0 < n), ∀ (j : cell C n),
IsClosed (A ∩ openCell n j) ∨ IsClosed (A ∩ closedCell n j)) : IsClosed A :=
RelCWComplex.isClosed_of_isClosed_inter_openCell_or_isClosed_inter_closedCell hAC (by simp) h
/-- If for every cell either `A ∩ openCell n j` is empty or `A ∩ closedCell n j` is closed then
`A` is closed. -/
lemma CWComplex.isClosed_of_disjoint_openCell_or_isClosed_inter_closedCell
[CWComplex C] [T2Space X] {A : Set X} (hAC : A ⊆ C) (h : ∀ n (_ : 0 < n), ∀ (j : cell C n),
Disjoint A (openCell n j) ∨ IsClosed (A ∩ closedCell n j)) : IsClosed A :=
RelCWComplex.isClosed_of_disjoint_openCell_or_isClosed_inter_closedCell hAC (by simp) h
/-- A version of `cellFrontier_subset_base_union_finite_closedCell` using open cells:
The boundary of a cell is contained in a finite union of open cells of a lower dimension. -/
lemma RelCWComplex.cellFrontier_subset_finite_openCell [RelCWComplex C D] (n : ℕ) (i : cell C n) :
∃ I : Π m, Finset (cell C m),
cellFrontier n i ⊆ D ∪ (⋃ (m < n) (j ∈ I m), openCell m j) := by
induction n using Nat.case_strong_induction_on with
| hz => simp [cellFrontier_zero_eq_empty]
| hi n hn =>
-- We apply `cellFrontier_subset_base_union_finite_closedCell` once and then apply
-- the induction hypothesis to the finitely many cells that
-- `cellFrontier_subset_base_union_finite_closedCell` gives us.
classical
obtain ⟨J, hJ⟩ := cellFrontier_subset_base_union_finite_closedCell n.succ i
choose p hp using hn
let I m := J m ∪ ((Finset.range n.succ).biUnion
(fun l ↦ (J l).biUnion (fun y ↦ if h : l ≤ n then p l h y m else ∅)))
use I
intro x hx
specialize hJ hx
simp only [mem_union, mem_iUnion, exists_prop] at hJ ⊢
rcases hJ with hJ | hJ
· exact .inl hJ
obtain ⟨l, hln, j, hj, hxj⟩ := hJ
rw [← cellFrontier_union_openCell_eq_closedCell] at hxj
rcases hxj with hxj | hxj
· specialize hp l (Nat.le_of_lt_succ hln) j hxj
simp_rw [mem_union, mem_iUnion, exists_prop] at hp
refine .imp_right (fun ⟨k, hkl, i, hi, hxi⟩ ↦ ⟨k, lt_trans hkl hln, i, ?_, hxi⟩) hp
simp only [Nat.succ_eq_add_one, Finset.mem_union, Finset.mem_biUnion, Finset.mem_range, I]
exact .inr ⟨l, hln, j, hj, by simp [Nat.le_of_lt_succ hln, hi]⟩
· right
use l, hln, j
simp only [Nat.succ_eq_add_one, Finset.mem_union, I]
exact ⟨Or.intro_left _ hj, hxj⟩
/-- A version of `cellFrontier_subset_finite_closedCell` using open cells: The boundary of a cell is
contained in a finite union of open cells of a lower dimension. -/
lemma CWComplex.cellFrontier_subset_finite_openCell [CWComplex C] (n : ℕ) (i : cell C n) :
∃ I : Π m, Finset (cell C m),
cellFrontier n i ⊆ ⋃ (m < n) (j ∈ I m), openCell m j := by
simpa using RelCWComplex.cellFrontier_subset_finite_openCell n i
section Subcomplex
namespace RelCWComplex
/-- A subcomplex is a closed subspace of a CW complex that is the union of open cells of the
CW complex. -/
structure Subcomplex (C : Set X) {D : Set X} [RelCWComplex C D] where
/-- The underlying set of the subcomplex. -/
carrier : Set X
/-- The indexing set of cells of the subcomplex. -/
I : Π n, Set (cell C n)
/-- A subcomplex is closed. -/
closed' : IsClosed carrier
/-- The union of all open cells of the subcomplex equals the subcomplex. -/
union' : D ∪ ⋃ (n : ℕ) (j : I n), openCell (C := C) n j = carrier
namespace Subcomplex
variable [RelCWComplex C D]
instance : SetLike (Subcomplex C) X where
coe E := E.carrier
coe_injective' E F h := by
obtain ⟨E, _, _, hE⟩ := E
obtain ⟨F, _, _, hF⟩ := F
congr
apply eq_of_eq_union_iUnion
rw [hE, hF]
simpa using h
initialize_simps_projections Subcomplex (carrier → coe, as_prefix coe)
lemma mem_carrier {E : Subcomplex C} {x : X} : x ∈ E.carrier ↔ x ∈ (E : Set X) := Iff.rfl
lemma coe_eq_carrier {E : Subcomplex C} : (E : Set X) = E.carrier := rfl
@[ext] lemma ext {E F : Subcomplex C} (h : ∀ x, x ∈ E ↔ x ∈ F) : E = F :=
SetLike.ext h
lemma eq_iff (E F : Subcomplex C) : E = F ↔ (E : Set X) = F :=
SetLike.coe_injective.eq_iff.symm
/-- Copy of a `Subcomplex` with a new `carrier` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (E : Subcomplex C) (F : Set X) (hF : F = E) (J : (n : ℕ) → Set (cell C n))
(hJ : J = E.I) : Subcomplex C :=
{ carrier := F
I := J
closed' := hF.symm ▸ E.closed'
union' := hF.symm ▸ hJ ▸ E.union' }
@[simp] lemma coe_copy (E : Subcomplex C) (F : Set X) (hF : F = E) (J : (n : ℕ) → Set (cell C n))
(hJ : J = E.I) : (E.copy F hF J hJ : Set X) = F :=
rfl
lemma copy_eq (E : Subcomplex C) (F : Set X) (hF : F = E) (J : (n : ℕ) → Set (cell C n))
(hJ : J = E.I) : E.copy F hF J hJ = E :=
SetLike.coe_injective hF
lemma union (E : Subcomplex C) :
D ∪ ⋃ (n : ℕ) (j : E.I n), openCell (C := C) n j.1 = E := by
rw [E.union']
rfl
lemma closed (E : Subcomplex C) : IsClosed (E : Set X) := E.closed'
end Subcomplex
end RelCWComplex
namespace CWComplex
export RelCWComplex (Subcomplex)
namespace Subcomplex
export RelCWComplex.Subcomplex (I closed union mem_carrier coe_eq_carrier ext copy coe_copy copy_eq)
end CWComplex.Subcomplex
lemma CWComplex.Subcomplex.union {C : Set X} [CWComplex C] {E : Subcomplex C} :
⋃ (n : ℕ) (j : E.I n), openCell (C := C) n j = E := by
have := RelCWComplex.Subcomplex.union E (C := C)
rw [empty_union] at this
exact this
/-- An alternative version of `Subcomplex.mk`: Instead of requiring that `E` is closed it requires
that for every cell of the subcomplex the corresponding closed cell is a subset of `E`. -/
@[simps -isSimp]
def RelCWComplex.Subcomplex.mk' [T2Space X] (C : Set X) {D : Set X} [RelCWComplex C D]
(E : Set X) (I : Π n, Set (cell C n))
(closedCell_subset : ∀ (n : ℕ) (i : I n), closedCell (C := C) n i ⊆ E)
(union : D ∪ ⋃ (n : ℕ) (j : I n), openCell (C := C) n j = E) : Subcomplex C where
carrier := E
I := I
closed' := by
have hEC : (E : Set X) ⊆ C := by
simp_rw [← union, ← union_iUnion_openCell_eq_complex (C := C)]
exact union_subset_union_right D
(iUnion_mono fun n ↦ iUnion_subset fun i ↦ subset_iUnion _ (i : cell C n))
apply isClosed_of_disjoint_openCell_or_isClosed_inter_closedCell hEC
· have : D ⊆ E := by
rw [← union]
exact subset_union_left
rw [inter_eq_right.2 this]
exact isClosedBase C
intro n _ j
by_cases h : j ∈ I n
· right
suffices closedCell n j ⊆ E by
rw [inter_eq_right.2 this]
exact isClosed_closedCell
exact closedCell_subset n ⟨j, h⟩
· left
simp_rw [← union, disjoint_union_left, disjoint_iUnion_left]
exact ⟨disjointBase n j |>.symm, fun _ _ ↦ disjoint_openCell_of_ne (by aesop)⟩
union' := union
/-- An alternative version of `Subcomplex.mk`: Instead of requiring that `E` is closed it requires
that for every cell of the subcomplex the corresponding closed cell is a subset of `E`. -/
@[simps! -isSimp]
def CWComplex.Subcomplex.mk' [T2Space X] (C : Set X) [CWComplex C] (E : Set X)
(I : Π n, Set (cell C n))
(closedCell_subset : ∀ (n : ℕ) (i : I n), closedCell (C := C) n i ⊆ E)
(union : ⋃ (n : ℕ) (j : I n), openCell (C := C) n j = E) : Subcomplex C :=
RelCWComplex.Subcomplex.mk' C E I closedCell_subset (by rw [empty_union]; exact union)
/-- An alternative version of `Subcomplex.mk`: Instead of requiring that `E` is closed it requires
that `E` is a CW-complex. -/
@[simps -isSimp]
def RelCWComplex.Subcomplex.mk'' [T2Space X] (C : Set X) {D : Set X} [RelCWComplex C D] (E : Set X)
(I : Π n, Set (cell C n)) [RelCWComplex E D]
(union : D ∪ ⋃ (n : ℕ) (j : I n), openCell (C := C) n j = E) : Subcomplex C where
carrier := E
I := I
closed' := isClosed
union' := union
/-- An alternative version of `Subcomplex.mk`: Instead of requiring that `E` is closed it requires
that `E` is a CW-complex. -/
@[simps -isSimp]
def CWComplex.Subcomplex.mk'' [T2Space X] (C : Set X) [h : CWComplex C] (E : Set X)
(I : Π n, Set (cell C n)) [CWComplex E]
(union : ⋃ (n : ℕ) (j : I n), openCell (C := C) n j = E) :
Subcomplex C where
carrier := E
I := I
closed' := RelCWComplex.isClosed
union' := by
rw [empty_union]
exact union
lemma RelCWComplex.Subcomplex.subset_complex {C D : Set X} [RelCWComplex C D] (E : Subcomplex C) :
↑E ⊆ C := by
simp_rw [← union, ← RelCWComplex.union_iUnion_openCell_eq_complex]
exact union_subset_union_right _ (iUnion_mono fun _ ↦ iUnion_mono' fun j ↦ ⟨j, subset_rfl⟩)
lemma RelCWComplex.Subcomplex.base_subset {C D : Set X} [RelCWComplex C D] (E : Subcomplex C) :
D ⊆ E := by
simp_rw [← union]
exact subset_union_left
namespace CWComplex.Subcomplex
export RelCWComplex.Subcomplex (subset_complex base_subset)
end CWComplex.Subcomplex
end Subcomplex
section skeleton
variable [T2Space X]
namespace RelCWComplex
/-- A non-standard definition of the `n`-skeleton of a CW complex for `n ∈ ℕ ∪ {∞}`.
This allows the base case of induction to be about the base instead of being about the union of
the base and some points.
The standard `skeleton` is defined in terms of `skeletonLT`. `skeletonLT` is preferred
in statements. You should then derive the statement about `skeleton`. -/
@[simps! -isSimp, irreducible]
def skeletonLT (C : Set X) {D : Set X} [RelCWComplex C D] (n : ℕ∞) : Subcomplex C :=
Subcomplex.mk' _ (D ∪ ⋃ (m : ℕ) (_ : m < n) (j : cell C m), closedCell m j)
(fun l ↦ {x : cell C l | l < n})
(by
intro l ⟨i, hi⟩
apply subset_union_of_subset_right
apply subset_iUnion₂_of_subset l hi
exact subset_iUnion _ _)
(by
rw [← RelCWComplex.iUnion_openCell_eq_iUnion_closedCell]
congrm D ∪ ?_
apply iUnion_congr fun m ↦ ?_
rw [iUnion_subtype, iUnion_comm]
rfl)
/-- The `n`-skeleton of a CW complex, for `n ∈ ℕ ∪ {∞}`. For statements use `skeletonLT` instead
and then derive the statement about `skeleton`. -/
abbrev skeleton (C : Set X) {D : Set X} [RelCWComplex C D] (n : ℕ∞) : Subcomplex C :=
skeletonLT C (n + 1)
end RelCWComplex
namespace CWComplex
export RelCWComplex (skeletonLT coe_skeletonLT skeletonLT_I skeleton)
end CWComplex
lemma RelCWComplex.skeletonLT_zero_eq_base [RelCWComplex C D] : skeletonLT C 0 = D := by
simp [coe_skeletonLT]
lemma CWComplex.skeletonLT_zero_eq_empty [CWComplex C] : (skeletonLT C 0 : Set X) = ∅ :=
RelCWComplex.skeletonLT_zero_eq_base
@[simp] lemma RelCWComplex.skeletonLT_top [RelCWComplex C D] : skeletonLT C ⊤ = C := by
simp [coe_skeletonLT, union]
@[simp] lemma RelCWComplex.skeleton_top [RelCWComplex C D] : skeleton C ⊤ = C := skeletonLT_top
lemma RelCWComplex.skeletonLT_mono [RelCWComplex C D] {n m : ℕ∞} (h : m ≤ n) :
(skeletonLT C m : Set X) ⊆ skeletonLT C n := by
simp_rw [coe_skeletonLT]
apply union_subset_union_right
intro x xmem
simp_rw [mem_iUnion, exists_prop] at xmem ⊢
obtain ⟨l, lltm, xmeml⟩ := xmem
exact ⟨l, lt_of_lt_of_le lltm h, xmeml⟩
lemma RelCWComplex.skeletonLT_monotone [RelCWComplex C D] : Monotone (skeletonLT C) :=
fun _ _ h ↦ skeletonLT_mono h
lemma RelCWComplex.skeleton_mono [RelCWComplex C D] {n m : ℕ∞} (h : m ≤ n) :
(skeleton C m : Set X) ⊆ skeleton C n :=
skeletonLT_mono (by gcongr)
lemma RelCWComplex.skeleton_monotone [RelCWComplex C D] : Monotone (skeleton C) :=
fun _ _ h ↦ skeleton_mono h
lemma RelCWComplex.closedCell_subset_skeletonLT [RelCWComplex C D] (n : ℕ) (j : cell C n) :
closedCell n j ⊆ skeletonLT C (n + 1) := by
intro x xmem
rw [coe_skeletonLT]
right
simp_rw [mem_iUnion, exists_prop]
refine ⟨n, (by norm_cast; exact lt_add_one n), ⟨j,xmem⟩⟩
lemma RelCWComplex.closedCell_subset_skeleton [RelCWComplex C D] (n : ℕ) (j : cell C n) :
closedCell n j ⊆ skeleton C n :=
closedCell_subset_skeletonLT n j
lemma RelCWComplex.openCell_subset_skeletonLT [RelCWComplex C D] (n : ℕ) (j : cell C n) :
openCell n j ⊆ skeletonLT C (n + 1) :=
(openCell_subset_closedCell _ _).trans (closedCell_subset_skeletonLT _ _)
lemma RelCWComplex.openCell_subset_skeleton [RelCWComplex C D] (n : ℕ) (j : cell C n) :
openCell n j ⊆ skeleton C n :=
(openCell_subset_closedCell _ _).trans (closedCell_subset_skeleton _ _)
lemma RelCWComplex.cellFrontier_subset_skeletonLT [RelCWComplex C D] (n : ℕ) (j : cell C n) :
cellFrontier n j ⊆ skeletonLT C n := by
obtain ⟨I, hI⟩ := cellFrontier_subset_base_union_finite_closedCell n j
apply subset_trans hI
rw [coe_skeletonLT]
apply union_subset_union_right
intro x xmem
simp only [mem_iUnion, exists_prop] at xmem ⊢
obtain ⟨i, iltn, j, _, xmem⟩ := xmem
exact ⟨i, by norm_cast, j, xmem⟩
lemma RelCWComplex.cellFrontier_subset_skeleton [RelCWComplex C D] (n : ℕ) (j : cell C (n + 1)) :
cellFrontier (n + 1) j ⊆ skeleton C n :=
cellFrontier_subset_skeletonLT _ _
lemma RelCWComplex.iUnion_cellFrontier_subset_skeletonLT [RelCWComplex C D] (l : ℕ) :
⋃ (j : cell C l), cellFrontier l j ⊆ skeletonLT C l :=
iUnion_subset (fun _ ↦ cellFrontier_subset_skeletonLT _ _)
lemma RelCWComplex.iUnion_cellFrontier_subset_skeleton [RelCWComplex C D] (l : ℕ) :
⋃ (j : cell C l), cellFrontier l j ⊆ skeleton C l :=
(iUnion_cellFrontier_subset_skeletonLT l).trans (skeletonLT_mono le_self_add)
lemma RelCWComplex.skeletonLT_union_iUnion_closedCell_eq_skeletonLT_succ [RelCWComplex C D]
(n : ℕ) :
(skeletonLT C n : Set X) ∪ ⋃ (j : cell C n), closedCell n j = skeletonLT C (n + 1) := by
rw [coe_skeletonLT, coe_skeletonLT, union_assoc]
congr
norm_cast
exact (biUnion_lt_succ _ _).symm
lemma RelCWComplex.skeleton_union_iUnion_closedCell_eq_skeleton_succ [RelCWComplex C D] (n : ℕ) :
(skeleton C n : Set X) ∪ ⋃ (j : cell C (n + 1)), closedCell (n + 1) j = skeleton C (n + 1) :=
skeletonLT_union_iUnion_closedCell_eq_skeletonLT_succ _
/-- A version of the definition of `skeletonLT` with open cells. -/
lemma RelCWComplex.iUnion_openCell_eq_skeletonLT [RelCWComplex C D] (n : ℕ∞) :
D ∪ ⋃ (m : ℕ) (_ : m < n) (j : cell C m), openCell m j = skeletonLT C n :=
(coe_skeletonLT C _).symm ▸ RelCWComplex.iUnion_openCell_eq_iUnion_closedCell n
lemma CWComplex.iUnion_openCell_eq_skeletonLT [CWComplex C] (n : ℕ∞) :
⋃ (m : ℕ) (_ : m < n) (j : cell C m), openCell m j = skeletonLT C n := by
rw [← RelCWComplex.iUnion_openCell_eq_skeletonLT, empty_union]
lemma RelCWComplex.iUnion_openCell_eq_skeleton [RelCWComplex C D] (n : ℕ∞) :
D ∪ ⋃ (m : ℕ) (_ : m < n + 1) (j : cell C m), openCell m j = skeleton C n :=
iUnion_openCell_eq_skeletonLT _
lemma CWComplex.iUnion_openCell_eq_skeleton [CWComplex C] (n : ℕ∞) :
⋃ (m : ℕ) (_ : m < n + 1) (j : cell C m), openCell m j = skeleton C n :=
iUnion_openCell_eq_skeletonLT _
lemma RelCWComplex.iUnion_skeletonLT_eq_complex [RelCWComplex C D] :
⋃ (n : ℕ), skeletonLT C n = C := by
apply subset_antisymm (iUnion_subset_iff.2 fun _ ↦ (skeletonLT C _).subset_complex)
simp_rw [← union_iUnion_openCell_eq_complex, union_subset_iff, iUnion₂_subset_iff]
exact ⟨subset_iUnion_of_subset 0 (skeletonLT C 0).base_subset,
fun n i ↦ subset_iUnion_of_subset _ (openCell_subset_skeletonLT n i)⟩
lemma RelCWComplex.iUnion_skeleton_eq_complex [RelCWComplex C D] :
⋃ (n : ℕ), skeleton C n = C := by
apply subset_antisymm (iUnion_subset_iff.2 fun _ ↦ (skeleton C _).subset_complex)
simp_rw [← union_iUnion_openCell_eq_complex, union_subset_iff, iUnion₂_subset_iff]
exact ⟨subset_iUnion_of_subset 0 (skeleton C 0).base_subset,
fun n i ↦ subset_iUnion_of_subset _ (openCell_subset_skeleton n i)⟩
lemma RelCWComplex.mem_skeletonLT_iff [RelCWComplex C D] {n : ℕ∞} {x : X} :
x ∈ skeletonLT C n ↔ x ∈ D ∨ ∃ (m : ℕ) (_ : m < n) (j : cell C m), x ∈ openCell m j := by
simp [← SetLike.mem_coe, ← iUnion_openCell_eq_skeletonLT]
lemma CWComplex.mem_skeletonLT_iff [CWComplex C] {n : ℕ∞} {x : X} :
x ∈ skeletonLT C n ↔ ∃ (m : ℕ) (_ : m < n) (j : cell C m), x ∈ openCell m j := by
simp [← SetLike.mem_coe, ← iUnion_openCell_eq_skeletonLT]
lemma RelCWComplex.mem_skeleton_iff [RelCWComplex C D] {n : ℕ∞} {x : X} :
x ∈ skeleton C n ↔ x ∈ D ∨ ∃ (m : ℕ) (_ : m ≤ n) (j : cell C m), x ∈ openCell m j := by
rw [skeleton, mem_skeletonLT_iff]
suffices ∀ (m : ℕ), m < n + 1 ↔ m ≤ n by simp_rw [this]
intro m
cases n
· simp
· rw [← Nat.cast_one, ← Nat.cast_add, Nat.cast_lt, Nat.cast_le, Order.lt_add_one_iff]
lemma CWComplex.exists_mem_openCell_of_mem_skeleton [CWComplex C] {n : ℕ∞} {x : X} :
x ∈ skeleton C n ↔ ∃ (m : ℕ) (_ : m ≤ n) (j : cell C m), x ∈ openCell m j := by
rw [RelCWComplex.mem_skeleton_iff, mem_empty_iff_false, false_or]
/-- A skeleton and an open cell of a higher dimension are disjoint. -/
lemma RelCWComplex.disjoint_skeletonLT_openCell [RelCWComplex C D] {n : ℕ∞} {m : ℕ}
{j : cell C m} (hnm : n ≤ m) : Disjoint (skeletonLT C n : Set X) (openCell m j) := by
-- This is a consequence of `iUnion_openCell_eq_skeletonLT` and `disjoint_openCell_of_ne`
simp_rw [← iUnion_openCell_eq_skeletonLT, disjoint_union_left, disjoint_iUnion_left]
refine ⟨(disjointBase m j).symm, ?_⟩
intro l hln i
apply disjoint_openCell_of_ne
intro
simp_all only [Sigma.mk.inj_iff]
exact (lt_self_iff_false m).mp (ENat.coe_lt_coe.1 (hln.trans_le hnm))
/-- A skeleton and an open cell of a higher dimension are disjoint. -/
lemma RelCWComplex.disjoint_skeleton_openCell [RelCWComplex C D] {n : ℕ∞} {m : ℕ}
{j : cell C m} (nlem : n < m) : Disjoint (skeleton C n : Set X) (openCell m j) :=
disjoint_skeletonLT_openCell (Order.add_one_le_of_lt nlem)
/-- A skeleton intersected with a closed cell of a higher dimension is the skeleton intersected with
the boundary of the cell. -/
lemma RelCWComplex.skeletonLT_inter_closedCell_eq_skeletonLT_inter_cellFrontier [RelCWComplex C D]
{n : ℕ∞} {m : ℕ} {j : cell C m} (hnm : n ≤ m) :
(skeletonLT C n : Set X) ∩ closedCell m j = (skeletonLT C n : Set X) ∩ cellFrontier m j := by
refine subset_antisymm ?_ (inter_subset_inter_right _ (cellFrontier_subset_closedCell _ _))
rw [← cellFrontier_union_openCell_eq_closedCell, inter_union_distrib_left]
apply union_subset (by rfl)
rw [(disjoint_skeletonLT_openCell hnm).inter_eq]
exact empty_subset _
/-- Version of `skeletonLT_inter_closedCell_eq_skeletonLT_inter_cellFrontier` using `skeleton`. -/
lemma RelCWComplex.skeleton_inter_closedCell_eq_skeleton_inter_cellFrontier [RelCWComplex C D]
{n : ℕ∞} {m : ℕ} {j : cell C m} (hnm : n < m) :
(skeleton C n : Set X) ∩ closedCell m j = (skeleton C n : Set X) ∩ cellFrontier m j :=
skeletonLT_inter_closedCell_eq_skeletonLT_inter_cellFrontier (Order.add_one_le_of_lt hnm)
end skeleton
lemma RelCWComplex.disjoint_interior_base_closedCell [T2Space X] [RelCWComplex C D] {n : ℕ}
{j : cell C n} : Disjoint (interior D) (closedCell n j) := by
rw [disjoint_iff_inter_eq_empty]
by_contra! h
rw [← closure_openCell_eq_closedCell, inter_comm,
closure_inter_open_nonempty_iff isOpen_interior] at h
rcases h with ⟨x, xmemcell, xmemD⟩
suffices x ∈ (skeletonLT C 0 : Set X) ∩ openCell n j by
rwa [(disjoint_skeletonLT_openCell n.cast_nonneg').inter_eq] at this
exact ⟨(skeletonLT C 0).base_subset (interior_subset xmemD), xmemcell⟩
lemma RelCWComplex.disjoint_interior_base_iUnion_closedCell [T2Space X] [RelCWComplex C D] :
Disjoint (interior D) (⋃ (n : ℕ) (j : cell C n), closedCell n j) := by
simp_rw [disjoint_iff_inter_eq_empty, inter_iUnion, disjoint_interior_base_closedCell.inter_eq,
iUnion_empty]
namespace CWComplex
export RelCWComplex (pairwiseDisjoint disjoint_openCell_of_ne openCell_subset_closedCell
cellFrontier_subset_closedCell cellFrontier_union_openCell_eq_closedCell map_zero_mem_openCell
map_zero_mem_closedCell isCompact_closedCell isClosed_closedCell isCompact_cellFrontier
isClosed_cellFrontier closure_openCell_eq_closedCell skeletonLT_top skeleton_top skeletonLT_mono
skeleton_mono skeletonLT_monotone skeleton_monotone closedCell_subset_skeletonLT
closedCell_subset_skeleton closedCell_subset_complex openCell_subset_skeletonLT
openCell_subset_skeleton
openCell_subset_complex cellFrontier_subset_skeletonLT cellFrontier_subset_skeleton
cellFrontier_subset_complex iUnion_cellFrontier_subset_skeletonLT
iUnion_cellFrontier_subset_skeleton closedCell_zero_eq_singleton openCell_zero_eq_singleton
cellFrontier_zero_eq_empty isClosed skeletonLT_union_iUnion_closedCell_eq_skeletonLT_succ
skeleton_union_iUnion_closedCell_eq_skeleton_succ iUnion_skeletonLT_eq_complex
iUnion_skeleton_eq_complex eq_of_not_disjoint_openCell disjoint_skeletonLT_openCell
disjoint_skeleton_openCell skeletonLT_inter_closedCell_eq_skeletonLT_inter_cellFrontier
skeleton_inter_closedCell_eq_skeleton_inter_cellFrontier)
end CWComplex
end Topology |
.lake/packages/mathlib/Mathlib/Topology/LocallyConstant/Basic.lean | import Mathlib.Algebra.Notation.Indicator
import Mathlib.Tactic.FinCases
import Mathlib.Topology.Connected.LocallyConnected
import Mathlib.Topology.Sets.Closeds
/-!
# Locally constant functions
This file sets up the theory of locally constant function from a topological space to a type.
## Main definitions and constructions
* `IsLocallyConstant f` : a map `f : X → Y` where `X` is a topological space is locally
constant if every set in `Y` has an open preimage.
* `LocallyConstant X Y` : the type of locally constant maps from `X` to `Y`
* `LocallyConstant.map` : push-forward of locally constant maps
* `LocallyConstant.comap` : pull-back of locally constant maps
-/
variable {X Y Z α : Type*} [TopologicalSpace X]
open Set Filter
open scoped Topology
/-- A function between topological spaces is locally constant if the preimage of any set is open. -/
def IsLocallyConstant (f : X → Y) : Prop :=
∀ s : Set Y, IsOpen (f ⁻¹' s)
namespace IsLocallyConstant
open List in
protected theorem tfae (f : X → Y) :
TFAE [IsLocallyConstant f,
∀ x, ∀ᶠ x' in 𝓝 x, f x' = f x,
∀ x, IsOpen { x' | f x' = f x },
∀ y, IsOpen (f ⁻¹' {y}),
∀ x, ∃ U : Set X, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x] := by
tfae_have 1 → 4 := fun h y => h {y}
tfae_have 4 → 3 := fun h x => h (f x)
tfae_have 3 → 2 := fun h x => IsOpen.mem_nhds (h x) rfl
tfae_have 2 → 5
| h, x => by
rcases mem_nhds_iff.1 (h x) with ⟨U, eq, hU, hx⟩
exact ⟨U, hU, hx, eq⟩
tfae_have 5 → 1
| h, s => by
refine isOpen_iff_forall_mem_open.2 fun x hx ↦ ?_
rcases h x with ⟨U, hU, hxU, eq⟩
exact ⟨U, fun x' hx' => mem_preimage.2 <| (eq x' hx').symm ▸ hx, hU, hxU⟩
tfae_finish
@[nontriviality]
theorem of_discrete [DiscreteTopology X] (f : X → Y) : IsLocallyConstant f := fun _ =>
isOpen_discrete _
theorem isOpen_fiber {f : X → Y} (hf : IsLocallyConstant f) (y : Y) : IsOpen { x | f x = y } :=
hf {y}
theorem isClosed_fiber {f : X → Y} (hf : IsLocallyConstant f) (y : Y) : IsClosed { x | f x = y } :=
⟨hf {y}ᶜ⟩
theorem isClopen_fiber {f : X → Y} (hf : IsLocallyConstant f) (y : Y) : IsClopen { x | f x = y } :=
⟨isClosed_fiber hf _, isOpen_fiber hf _⟩
theorem iff_exists_open (f : X → Y) :
IsLocallyConstant f ↔ ∀ x, ∃ U : Set X, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x :=
(IsLocallyConstant.tfae f).out 0 4
theorem iff_eventually_eq (f : X → Y) : IsLocallyConstant f ↔ ∀ x, ∀ᶠ y in 𝓝 x, f y = f x :=
(IsLocallyConstant.tfae f).out 0 1
theorem exists_open {f : X → Y} (hf : IsLocallyConstant f) (x : X) :
∃ U : Set X, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x :=
(iff_exists_open f).1 hf x
protected theorem eventually_eq {f : X → Y} (hf : IsLocallyConstant f) (x : X) :
∀ᶠ y in 𝓝 x, f y = f x :=
(iff_eventually_eq f).1 hf x
theorem iff_isOpen_fiber_apply {f : X → Y} : IsLocallyConstant f ↔ ∀ x, IsOpen (f ⁻¹' {f x}) :=
(IsLocallyConstant.tfae f).out 0 2
theorem iff_isOpen_fiber {f : X → Y} : IsLocallyConstant f ↔ ∀ y, IsOpen (f ⁻¹' {y}) :=
(IsLocallyConstant.tfae f).out 0 3
protected theorem continuous [TopologicalSpace Y] {f : X → Y} (hf : IsLocallyConstant f) :
Continuous f :=
⟨fun _ _ => hf _⟩
theorem iff_continuous {_ : TopologicalSpace Y} [DiscreteTopology Y] (f : X → Y) :
IsLocallyConstant f ↔ Continuous f :=
⟨IsLocallyConstant.continuous, fun h s => h.isOpen_preimage s (isOpen_discrete _)⟩
theorem of_constant (f : X → Y) (h : ∀ x y, f x = f y) : IsLocallyConstant f :=
(iff_eventually_eq f).2 fun _ => Eventually.of_forall fun _ => h _ _
protected theorem const (y : Y) : IsLocallyConstant (Function.const X y) :=
of_constant _ fun _ _ => rfl
protected theorem comp {f : X → Y} (hf : IsLocallyConstant f) (g : Y → Z) :
IsLocallyConstant (g ∘ f) := fun s => by
rw [Set.preimage_comp]
exact hf _
theorem prodMk {Y'} {f : X → Y} {f' : X → Y'} (hf : IsLocallyConstant f)
(hf' : IsLocallyConstant f') : IsLocallyConstant fun x => (f x, f' x) :=
(iff_eventually_eq _).2 fun x =>
(hf.eventually_eq x).mp <| (hf'.eventually_eq x).mono fun _ hf' hf => Prod.ext hf hf'
theorem comp₂ {Y₁ Y₂ Z : Type*} {f : X → Y₁} {g : X → Y₂} (hf : IsLocallyConstant f)
(hg : IsLocallyConstant g) (h : Y₁ → Y₂ → Z) : IsLocallyConstant fun x => h (f x) (g x) :=
(hf.prodMk hg).comp fun x : Y₁ × Y₂ => h x.1 x.2
theorem comp_continuous [TopologicalSpace Y] {g : Y → Z} {f : X → Y} (hg : IsLocallyConstant g)
(hf : Continuous f) : IsLocallyConstant (g ∘ f) := fun s => by
rw [Set.preimage_comp]
exact hf.isOpen_preimage _ (hg _)
/-- A locally constant function is constant on any preconnected set. -/
theorem apply_eq_of_isPreconnected {f : X → Y} (hf : IsLocallyConstant f) {s : Set X}
(hs : IsPreconnected s) {x y : X} (hx : x ∈ s) (hy : y ∈ s) : f x = f y := by
let U := f ⁻¹' {f y}
suffices x ∉ Uᶜ from Classical.not_not.1 this
intro hxV
specialize hs U Uᶜ (hf {f y}) (hf {f y}ᶜ) _ ⟨y, ⟨hy, rfl⟩⟩ ⟨x, ⟨hx, hxV⟩⟩
· simp only [union_compl_self, subset_univ]
· simp only [inter_empty, Set.not_nonempty_empty, inter_compl_self] at hs
theorem apply_eq_of_preconnectedSpace [PreconnectedSpace X] {f : X → Y} (hf : IsLocallyConstant f)
(x y : X) : f x = f y :=
hf.apply_eq_of_isPreconnected isPreconnected_univ trivial trivial
theorem eq_const [PreconnectedSpace X] {f : X → Y} (hf : IsLocallyConstant f) (x : X) :
f = Function.const X (f x) :=
funext fun y => hf.apply_eq_of_preconnectedSpace y x
theorem exists_eq_const [PreconnectedSpace X] [Nonempty Y] {f : X → Y} (hf : IsLocallyConstant f) :
∃ y, f = Function.const X y := by
rcases isEmpty_or_nonempty X with h | h
· exact ⟨Classical.arbitrary Y, funext <| h.elim⟩
· exact ⟨f (Classical.arbitrary X), hf.eq_const _⟩
theorem iff_is_const [PreconnectedSpace X] {f : X → Y} : IsLocallyConstant f ↔ ∀ x y, f x = f y :=
⟨fun h _ _ => h.apply_eq_of_isPreconnected isPreconnected_univ trivial trivial, of_constant _⟩
theorem range_finite [CompactSpace X] {f : X → Y} (hf : IsLocallyConstant f) :
(Set.range f).Finite := by
letI : TopologicalSpace Y := ⊥; haveI := discreteTopology_bot Y
exact (isCompact_range hf.continuous).finite_of_discrete
@[to_additive]
theorem one [One Y] : IsLocallyConstant (1 : X → Y) := IsLocallyConstant.const 1
@[to_additive]
theorem inv [Inv Y] ⦃f : X → Y⦄ (hf : IsLocallyConstant f) : IsLocallyConstant f⁻¹ :=
hf.comp fun x => x⁻¹
@[to_additive]
theorem mul [Mul Y] ⦃f g : X → Y⦄ (hf : IsLocallyConstant f) (hg : IsLocallyConstant g) :
IsLocallyConstant (f * g) :=
hf.comp₂ hg (· * ·)
@[to_additive]
theorem div [Div Y] ⦃f g : X → Y⦄ (hf : IsLocallyConstant f) (hg : IsLocallyConstant g) :
IsLocallyConstant (f / g) :=
hf.comp₂ hg (· / ·)
/-- If a composition of a function `f` followed by an injection `g` is locally
constant, then the locally constant property descends to `f`. -/
theorem desc {α β : Type*} (f : X → α) (g : α → β) (h : IsLocallyConstant (g ∘ f))
(inj : Function.Injective g) : IsLocallyConstant f := fun s => by
rw [← preimage_image_eq s inj, preimage_preimage]
exact h (g '' s)
theorem of_constant_on_connected_components [LocallyConnectedSpace X] {f : X → Y}
(h : ∀ x, ∀ y ∈ connectedComponent x, f y = f x) : IsLocallyConstant f :=
(iff_exists_open _).2 fun x =>
⟨connectedComponent x, isOpen_connectedComponent, mem_connectedComponent, h x⟩
theorem of_constant_on_connected_clopens [LocallyConnectedSpace X] {f : X → Y}
(h : ∀ U : Set X, IsConnected U → IsClopen U → ∀ x ∈ U, ∀ y ∈ U, f y = f x) :
IsLocallyConstant f :=
of_constant_on_connected_components fun x =>
h (connectedComponent x) isConnected_connectedComponent isClopen_connectedComponent x
mem_connectedComponent
theorem of_constant_on_preconnected_clopens [LocallyConnectedSpace X] {f : X → Y}
(h : ∀ U : Set X, IsPreconnected U → IsClopen U → ∀ x ∈ U, ∀ y ∈ U, f y = f x) :
IsLocallyConstant f :=
of_constant_on_connected_clopens fun U hU ↦ h U hU.isPreconnected
end IsLocallyConstant
/-- A (bundled) locally constant function from a topological space `X` to a type `Y`. -/
structure LocallyConstant (X Y : Type*) [TopologicalSpace X] where
/-- The underlying function. -/
protected toFun : X → Y
/-- The map is locally constant. -/
protected isLocallyConstant : IsLocallyConstant toFun
namespace LocallyConstant
instance [Inhabited Y] : Inhabited (LocallyConstant X Y) :=
⟨⟨_, IsLocallyConstant.const default⟩⟩
instance : FunLike (LocallyConstant X Y) X Y where
coe := LocallyConstant.toFun
coe_injective' := by rintro ⟨_, _⟩ ⟨_, _⟩ _; congr
/-- See Note [custom simps projections]. -/
def Simps.apply (f : LocallyConstant X Y) : X → Y := f
initialize_simps_projections LocallyConstant (toFun → apply)
@[simp]
theorem toFun_eq_coe (f : LocallyConstant X Y) : f.toFun = f :=
rfl
@[simp]
theorem coe_mk (f : X → Y) (h) : ⇑(⟨f, h⟩ : LocallyConstant X Y) = f :=
rfl
protected theorem congr_fun {f g : LocallyConstant X Y} (h : f = g) (x : X) : f x = g x :=
DFunLike.congr_fun h x
protected theorem congr_arg (f : LocallyConstant X Y) {x y : X} (h : x = y) : f x = f y :=
DFunLike.congr_arg f h
theorem coe_injective : @Function.Injective (LocallyConstant X Y) (X → Y) (↑) := fun _ _ =>
DFunLike.ext'
@[norm_cast]
theorem coe_inj {f g : LocallyConstant X Y} : (f : X → Y) = g ↔ f = g :=
coe_injective.eq_iff
@[ext]
theorem ext ⦃f g : LocallyConstant X Y⦄ (h : ∀ x, f x = g x) : f = g :=
DFunLike.ext _ _ h
section CodomainTopologicalSpace
variable [TopologicalSpace Y] (f : LocallyConstant X Y)
protected theorem continuous : Continuous f :=
f.isLocallyConstant.continuous
/-- We can turn a locally-constant function into a bundled `ContinuousMap`. -/
@[coe] def toContinuousMap : C(X, Y) :=
⟨f, f.continuous⟩
/-- As a shorthand, `LocallyConstant.toContinuousMap` is available as a coercion -/
instance : Coe (LocallyConstant X Y) C(X, Y) := ⟨toContinuousMap⟩
@[simp] theorem coe_continuousMap : ((f : C(X, Y)) : X → Y) = (f : X → Y) := rfl
theorem toContinuousMap_injective :
Function.Injective (toContinuousMap : LocallyConstant X Y → C(X, Y)) := fun _ _ h =>
ext (ContinuousMap.congr_fun h)
end CodomainTopologicalSpace
/-- The constant locally constant function on `X` with value `y : Y`. -/
def const (X : Type*) {Y : Type*} [TopologicalSpace X] (y : Y) : LocallyConstant X Y :=
⟨Function.const X y, IsLocallyConstant.const _⟩
@[simp]
theorem coe_const (y : Y) : (const X y : X → Y) = Function.const X y :=
rfl
/-- Evaluation/projection as a locally constant function. -/
@[simps]
def eval {ι : Type*} {X : ι → Type*}
[∀ i, TopologicalSpace (X i)] (i : ι) [DiscreteTopology (X i)] :
LocallyConstant (Π i, X i) (X i) where
toFun := fun f ↦ f i
isLocallyConstant := (IsLocallyConstant.iff_continuous _).mpr <| continuous_apply i
/-- The locally constant function to `Fin 2` associated to a clopen set. -/
def ofIsClopen {X : Type*} [TopologicalSpace X] {U : Set X} [∀ x, Decidable (x ∈ U)]
(hU : IsClopen U) : LocallyConstant X (Fin 2) where
toFun x := if x ∈ U then 0 else 1
isLocallyConstant := by
refine IsLocallyConstant.iff_isOpen_fiber.2 <| Fin.forall_fin_two.2 ⟨?_, ?_⟩
· convert hU.2 using 1
ext
simp only [mem_singleton_iff, Fin.one_eq_zero_iff, mem_preimage, ite_eq_left_iff,
Nat.succ_succ_ne_one]
tauto
· rw [← isClosed_compl_iff]
convert hU.1
ext
simp
@[simp]
theorem ofIsClopen_fiber_zero {X : Type*} [TopologicalSpace X] {U : Set X} [∀ x, Decidable (x ∈ U)]
(hU : IsClopen U) : ofIsClopen hU ⁻¹' ({0} : Set (Fin 2)) = U := by
ext
simp only [ofIsClopen, mem_singleton_iff, Fin.one_eq_zero_iff, coe_mk, mem_preimage,
ite_eq_left_iff, Nat.succ_succ_ne_one]
tauto
@[simp]
theorem ofIsClopen_fiber_one {X : Type*} [TopologicalSpace X] {U : Set X} [∀ x, Decidable (x ∈ U)]
(hU : IsClopen U) : ofIsClopen hU ⁻¹' ({1} : Set (Fin 2)) = Uᶜ := by
ext
simp only [ofIsClopen, mem_singleton_iff, coe_mk, Fin.zero_eq_one_iff, mem_preimage,
ite_eq_right_iff, mem_compl_iff, Nat.succ_succ_ne_one]
theorem locallyConstant_eq_of_fiber_zero_eq {X : Type*} [TopologicalSpace X]
(f g : LocallyConstant X (Fin 2)) (h : f ⁻¹' ({0} : Set (Fin 2)) = g ⁻¹' {0}) : f = g := by
simp only [Set.ext_iff, mem_singleton_iff, mem_preimage] at h
ext1 x
exact Fin.fin_two_eq_of_eq_zero_iff (h x)
theorem range_finite [CompactSpace X] (f : LocallyConstant X Y) : (Set.range f).Finite :=
f.isLocallyConstant.range_finite
theorem apply_eq_of_isPreconnected (f : LocallyConstant X Y) {s : Set X} (hs : IsPreconnected s)
{x y : X} (hx : x ∈ s) (hy : y ∈ s) : f x = f y :=
f.isLocallyConstant.apply_eq_of_isPreconnected hs hx hy
theorem apply_eq_of_preconnectedSpace [PreconnectedSpace X] (f : LocallyConstant X Y) (x y : X) :
f x = f y :=
f.isLocallyConstant.apply_eq_of_isPreconnected isPreconnected_univ trivial trivial
theorem eq_const [PreconnectedSpace X] (f : LocallyConstant X Y) (x : X) : f = const X (f x) :=
ext fun _ => apply_eq_of_preconnectedSpace f _ _
theorem exists_eq_const [PreconnectedSpace X] [Nonempty Y] (f : LocallyConstant X Y) :
∃ y, f = const X y := by
rcases Classical.em (Nonempty X) with (⟨⟨x⟩⟩ | hX)
· exact ⟨f x, f.eq_const x⟩
· exact ⟨Classical.arbitrary Y, ext fun x => (hX ⟨x⟩).elim⟩
/-- Push forward of locally constant maps under any map, by post-composition. -/
def map (f : Y → Z) (g : LocallyConstant X Y) : LocallyConstant X Z :=
⟨f ∘ g, g.isLocallyConstant.comp f⟩
@[simp]
theorem map_apply (f : Y → Z) (g : LocallyConstant X Y) : ⇑(map f g) = f ∘ g :=
rfl
@[simp]
theorem map_id : @map X Y Y _ id = id := rfl
@[simp]
theorem map_comp {Y₁ Y₂ Y₃ : Type*} (g : Y₂ → Y₃) (f : Y₁ → Y₂) :
@map X _ _ _ g ∘ map f = map (g ∘ f) := rfl
/-- Given a locally constant function to `α → β`, construct a family of locally constant
functions with values in β indexed by α. -/
def flip {X α β : Type*} [TopologicalSpace X] (f : LocallyConstant X (α → β)) (a : α) :
LocallyConstant X β :=
f.map fun f => f a
/-- If α is finite, this constructs a locally constant function to `α → β` given a
family of locally constant functions with values in β indexed by α. -/
def unflip {X α β : Type*} [Finite α] [TopologicalSpace X] (f : α → LocallyConstant X β) :
LocallyConstant X (α → β) where
toFun x a := f a x
isLocallyConstant := IsLocallyConstant.iff_isOpen_fiber.2 fun g => by
have : (fun (x : X) (a : α) => f a x) ⁻¹' {g} = ⋂ a : α, f a ⁻¹' {g a} := by
ext; simp [funext_iff]
rw [this]
exact isOpen_iInter_of_finite fun a => (f a).isLocallyConstant _
@[simp]
theorem unflip_flip {X α β : Type*} [Finite α] [TopologicalSpace X]
(f : LocallyConstant X (α → β)) : unflip f.flip = f := rfl
@[simp]
theorem flip_unflip {X α β : Type*} [Finite α] [TopologicalSpace X]
(f : α → LocallyConstant X β) : (unflip f).flip = f := rfl
section Comap
variable [TopologicalSpace Y]
/-- Pull back of locally constant maps under a continuous map, by pre-composition. -/
def comap (f : C(X, Y)) (g : LocallyConstant Y Z) : LocallyConstant X Z :=
⟨g ∘ f, g.isLocallyConstant.comp_continuous f.continuous⟩
@[simp]
theorem coe_comap (f : C(X, Y)) (g : LocallyConstant Y Z) :
(comap f g) = g ∘ f := rfl
theorem coe_comap_apply (f : C(X, Y)) (g : LocallyConstant Y Z) (x : X) :
comap f g x = g (f x) := rfl
@[simp]
theorem comap_id : comap (@ContinuousMap.id X _) = @id (LocallyConstant X Z) := rfl
theorem comap_comp {W : Type*} [TopologicalSpace W] (f : C(W, X)) (g : C(X, Y)) :
comap (Z := Z) (g.comp f) = comap f ∘ comap g := rfl
theorem comap_comap {W : Type*} [TopologicalSpace W] (f : C(W, X)) (g : C(X, Y))
(x : LocallyConstant Y Z) : comap f (comap g x) = comap (g.comp f) x := rfl
theorem comap_const (f : C(X, Y)) (y : Y) (h : ∀ x, f x = y) :
(comap f : LocallyConstant Y Z → LocallyConstant X Z) = fun g => const X (g y) := by
ext; simp [h]
lemma comap_injective (f : C(X, Y)) (hfs : f.1.Surjective) :
(comap (Z := Z) f).Injective := by
intro a b h
ext y
obtain ⟨x, hx⟩ := hfs y
simpa [← hx] using LocallyConstant.congr_fun h x
end Comap
section Desc
/-- If a locally constant function factors through an injection, then it factors through a locally
constant function. -/
def desc {X α β : Type*} [TopologicalSpace X] {g : α → β} (f : X → α) (h : LocallyConstant X β)
(cond : g ∘ f = h) (inj : Function.Injective g) : LocallyConstant X α where
toFun := f
isLocallyConstant := IsLocallyConstant.desc _ g (cond.symm ▸ h.isLocallyConstant) inj
@[simp]
theorem coe_desc {X α β : Type*} [TopologicalSpace X] (f : X → α) (g : α → β)
(h : LocallyConstant X β) (cond : g ∘ f = h) (inj : Function.Injective g) :
⇑(desc f h cond inj) = f :=
rfl
end Desc
section Indicator
variable {R : Type*} [One R] {U : Set X} (f : LocallyConstant X R)
/-- Given a clopen set `U` and a locally constant function `f`, `LocallyConstant.mulIndicator`
returns the locally constant function that is `f` on `U` and `1` otherwise. -/
@[to_additive (attr := simps) /-- Given a clopen set `U` and a locally constant function `f`,
`LocallyConstant.indicator` returns the locally constant function that is `f` on `U` and `0`
otherwise. -/]
noncomputable def mulIndicator (hU : IsClopen U) : LocallyConstant X R where
toFun := Set.mulIndicator U f
isLocallyConstant := fun s => by
rw [mulIndicator_preimage, Set.ite, Set.diff_eq]
exact ((f.2 s).inter hU.isOpen).union ((IsLocallyConstant.const 1 s).inter hU.compl.isOpen)
variable (a : X)
open Classical in
@[to_additive]
theorem mulIndicator_apply_eq_if (hU : IsClopen U) :
mulIndicator f hU a = if a ∈ U then f a else 1 :=
Set.mulIndicator_apply U f a
variable {a}
@[to_additive]
theorem mulIndicator_of_mem (hU : IsClopen U) (h : a ∈ U) : f.mulIndicator hU a = f a :=
Set.mulIndicator_of_mem h _
@[to_additive]
theorem mulIndicator_of_notMem (hU : IsClopen U) (h : a ∉ U) : f.mulIndicator hU a = 1 :=
Set.mulIndicator_of_notMem h _
@[deprecated (since := "2025-05-23")] alias indicator_of_not_mem := indicator_of_notMem
@[to_additive existing, deprecated (since := "2025-05-23")]
alias mulIndicator_of_not_mem := mulIndicator_of_notMem
end Indicator
section Equiv
/--
The equivalence between `LocallyConstant X Z` and `LocallyConstant Y Z` given a
homeomorphism `X ≃ₜ Y`
-/
@[simps]
def congrLeft [TopologicalSpace Y] (e : X ≃ₜ Y) : LocallyConstant X Z ≃ LocallyConstant Y Z where
toFun := comap e.symm
invFun := comap e
left_inv := by
intro
simp [comap_comap]
right_inv := by
intro
simp [comap_comap]
/--
The equivalence between `LocallyConstant X Y` and `LocallyConstant X Z` given an
equivalence `Y ≃ Z`
-/
@[simps]
def congrRight (e : Y ≃ Z) : LocallyConstant X Y ≃ LocallyConstant X Z where
toFun := map e
invFun := map e.symm
left_inv := by intro; ext; simp
right_inv := by intro; ext; simp
variable (X) in
/--
The set of clopen subsets of a topological space is equivalent to the locally constant maps to
a two-element set
-/
def equivClopens [∀ (s : Set X) x, Decidable (x ∈ s)] :
LocallyConstant X (Fin 2) ≃ TopologicalSpace.Clopens X where
toFun f := ⟨f ⁻¹' {0}, f.2.isClopen_fiber _⟩
invFun s := ofIsClopen s.2
left_inv _ := locallyConstant_eq_of_fiber_zero_eq _ _ (by simp)
right_inv _ := by simp
end Equiv
section Piecewise
/-- Given two closed sets covering a topological space, and locally constant maps on these two sets,
then if these two locally constant maps agree on the intersection, we get a piecewise defined
locally constant map on the whole space.
TODO: Generalise this construction to `ContinuousMap`. -/
def piecewise {C₁ C₂ : Set X} (h₁ : IsClosed C₁) (h₂ : IsClosed C₂) (h : C₁ ∪ C₂ = Set.univ)
(f : LocallyConstant C₁ Z) (g : LocallyConstant C₂ Z)
(hfg : ∀ (x : X) (hx : x ∈ C₁ ∩ C₂), f ⟨x, hx.1⟩ = g ⟨x, hx.2⟩)
[DecidablePred (· ∈ C₁)] : LocallyConstant X Z where
toFun i := if hi : i ∈ C₁ then f ⟨i, hi⟩ else g ⟨i, (Set.compl_subset_iff_union.mpr h) hi⟩
isLocallyConstant := by
let dZ : TopologicalSpace Z := ⊥
haveI : DiscreteTopology Z := discreteTopology_bot Z
obtain ⟨f, hf⟩ := f
obtain ⟨g, hg⟩ := g
rw [IsLocallyConstant.iff_continuous] at hf hg ⊢
dsimp only [coe_mk]
rw [Set.union_eq_iUnion] at h
refine (locallyFinite_of_finite _).continuous h (fun i ↦ ?_) (fun i ↦ ?_)
· cases i <;> [exact h₂; exact h₁]
· cases i <;> rw [continuousOn_iff_continuous_restrict]
· convert hg
ext x
simp only [cond_false, restrict_apply, Subtype.coe_eta, dite_eq_right_iff]
exact fun hx ↦ hfg x ⟨hx, x.prop⟩
· simp only [cond_true, restrict_dite, Subtype.coe_eta]
exact hf
@[simp]
lemma piecewise_apply_left {C₁ C₂ : Set X} (h₁ : IsClosed C₁) (h₂ : IsClosed C₂)
(h : C₁ ∪ C₂ = Set.univ) (f : LocallyConstant C₁ Z) (g : LocallyConstant C₂ Z)
(hfg : ∀ (x : X) (hx : x ∈ C₁ ∩ C₂), f ⟨x, hx.1⟩ = g ⟨x, hx.2⟩)
[DecidablePred (· ∈ C₁)] (x : X) (hx : x ∈ C₁) :
piecewise h₁ h₂ h f g hfg x = f ⟨x, hx⟩ := by
simp only [piecewise,
coe_mk]
rw [dif_pos hx]
@[simp]
lemma piecewise_apply_right {C₁ C₂ : Set X} (h₁ : IsClosed C₁) (h₂ : IsClosed C₂)
(h : C₁ ∪ C₂ = Set.univ) (f : LocallyConstant C₁ Z) (g : LocallyConstant C₂ Z)
(hfg : ∀ (x : X) (hx : x ∈ C₁ ∩ C₂), f ⟨x, hx.1⟩ = g ⟨x, hx.2⟩)
[DecidablePred (· ∈ C₁)] (x : X) (hx : x ∈ C₂) :
piecewise h₁ h₂ h f g hfg x = g ⟨x, hx⟩ := by
simp only [piecewise,
coe_mk]
split_ifs with h
· exact hfg x ⟨h, hx⟩
· rfl
/-- A variant of `LocallyConstant.piecewise` where the two closed sets cover a subset.
TODO: Generalise this construction to `ContinuousMap`. -/
def piecewise' {C₀ C₁ C₂ : Set X} (h₀ : C₀ ⊆ C₁ ∪ C₂) (h₁ : IsClosed C₁)
(h₂ : IsClosed C₂) (f₁ : LocallyConstant C₁ Z) (f₂ : LocallyConstant C₂ Z)
[DecidablePred (· ∈ C₁)] (hf : ∀ x (hx : x ∈ C₁ ∩ C₂), f₁ ⟨x, hx.1⟩ = f₂ ⟨x, hx.2⟩) :
LocallyConstant C₀ Z :=
letI : ∀ j : C₀, Decidable (j ∈ Subtype.val ⁻¹' C₁) := fun j ↦ decidable_of_iff (↑j ∈ C₁) Iff.rfl
piecewise (h₁.preimage continuous_subtype_val) (h₂.preimage continuous_subtype_val)
(by simpa [eq_univ_iff_forall] using h₀)
(f₁.comap ⟨(restrictPreimage C₁ ((↑) : C₀ → X)), continuous_subtype_val.restrictPreimage⟩)
(f₂.comap ⟨(restrictPreimage C₂ ((↑) : C₀ → X)), continuous_subtype_val.restrictPreimage⟩) <| by
rintro ⟨x, hx₀⟩ ⟨hx₁ : x ∈ C₁, hx₂ : x ∈ C₂⟩
simpa using hf x ⟨hx₁, hx₂⟩
@[simp]
lemma piecewise'_apply_left {C₀ C₁ C₂ : Set X} (h₀ : C₀ ⊆ C₁ ∪ C₂) (h₁ : IsClosed C₁)
(h₂ : IsClosed C₂) (f₁ : LocallyConstant C₁ Z) (f₂ : LocallyConstant C₂ Z)
[DecidablePred (· ∈ C₁)] (hf : ∀ x (hx : x ∈ C₁ ∩ C₂), f₁ ⟨x, hx.1⟩ = f₂ ⟨x, hx.2⟩)
(x : C₀) (hx : x.val ∈ C₁) :
piecewise' h₀ h₁ h₂ f₁ f₂ hf x = f₁ ⟨x.val, hx⟩ := by
letI : ∀ j : C₀, Decidable (j ∈ Subtype.val ⁻¹' C₁) := fun j ↦ decidable_of_iff (↑j ∈ C₁) Iff.rfl
rw [piecewise', piecewise_apply_left (f := (f₁.comap
⟨(restrictPreimage C₁ ((↑) : C₀ → X)), continuous_subtype_val.restrictPreimage⟩))
(hx := hx)]
rfl
@[simp]
lemma piecewise'_apply_right {C₀ C₁ C₂ : Set X} (h₀ : C₀ ⊆ C₁ ∪ C₂) (h₁ : IsClosed C₁)
(h₂ : IsClosed C₂) (f₁ : LocallyConstant C₁ Z) (f₂ : LocallyConstant C₂ Z)
[DecidablePred (· ∈ C₁)] (hf : ∀ x (hx : x ∈ C₁ ∩ C₂), f₁ ⟨x, hx.1⟩ = f₂ ⟨x, hx.2⟩)
(x : C₀) (hx : x.val ∈ C₂) :
piecewise' h₀ h₁ h₂ f₁ f₂ hf x = f₂ ⟨x.val, hx⟩ := by
letI : ∀ j : C₀, Decidable (j ∈ Subtype.val ⁻¹' C₁) := fun j ↦ decidable_of_iff (↑j ∈ C₁) Iff.rfl
rw [piecewise', piecewise_apply_right (f := (f₁.comap
⟨(restrictPreimage C₁ ((↑) : C₀ → X)), continuous_subtype_val.restrictPreimage⟩))
(hx := hx)]
rfl
end Piecewise
end LocallyConstant |
.lake/packages/mathlib/Mathlib/Topology/LocallyConstant/Algebra.lean | import Mathlib.Algebra.Algebra.Pi
import Mathlib.Algebra.GroupWithZero.Indicator
import Mathlib.LinearAlgebra.Pi
import Mathlib.Topology.LocallyConstant.Basic
/-!
# Algebraic structure on locally constant functions
This file puts algebraic structure (`Group`, `AddGroup`, etc)
on the type of locally constant functions.
-/
namespace LocallyConstant
variable {X Y : Type*} [TopologicalSpace X]
@[to_additive]
instance [One Y] : One (LocallyConstant X Y) where one := const X 1
@[to_additive (attr := simp)]
theorem coe_one [One Y] : ⇑(1 : LocallyConstant X Y) = (1 : X → Y) :=
rfl
@[to_additive]
theorem one_apply [One Y] (x : X) : (1 : LocallyConstant X Y) x = 1 :=
rfl
@[to_additive]
instance [Inv Y] : Inv (LocallyConstant X Y) where inv f := ⟨f⁻¹, f.isLocallyConstant.inv⟩
@[to_additive (attr := simp)]
theorem coe_inv [Inv Y] (f : LocallyConstant X Y) : ⇑(f⁻¹ : LocallyConstant X Y) = (f : X → Y)⁻¹ :=
rfl
@[to_additive]
theorem inv_apply [Inv Y] (f : LocallyConstant X Y) (x : X) : f⁻¹ x = (f x)⁻¹ :=
rfl
@[to_additive]
instance [Mul Y] : Mul (LocallyConstant X Y) where
mul f g := ⟨f * g, f.isLocallyConstant.mul g.isLocallyConstant⟩
@[to_additive (attr := simp)]
theorem coe_mul [Mul Y] (f g : LocallyConstant X Y) : ⇑(f * g) = f * g :=
rfl
@[to_additive]
theorem mul_apply [Mul Y] (f g : LocallyConstant X Y) (x : X) : (f * g) x = f x * g x :=
rfl
@[to_additive]
instance [MulOneClass Y] : MulOneClass (LocallyConstant X Y) :=
Function.Injective.mulOneClass DFunLike.coe DFunLike.coe_injective' rfl fun _ _ => rfl
/-- `DFunLike.coe` as a `MonoidHom`. -/
@[to_additive (attr := simps) /-- `DFunLike.coe` as an `AddMonoidHom`. -/]
def coeFnMonoidHom [MulOneClass Y] : LocallyConstant X Y →* X → Y where
toFun := DFunLike.coe
map_one' := rfl
map_mul' _ _ := rfl
/-- The constant-function embedding, as a multiplicative monoid hom. -/
@[to_additive (attr := simps) /-- The constant-function embedding, as an additive monoid hom. -/]
def constMonoidHom [MulOneClass Y] : Y →* LocallyConstant X Y where
toFun := const X
map_one' := rfl
map_mul' _ _ := rfl
instance [MulZeroClass Y] : MulZeroClass (LocallyConstant X Y) :=
Function.Injective.mulZeroClass DFunLike.coe DFunLike.coe_injective' rfl fun _ _ => rfl
instance [MulZeroOneClass Y] : MulZeroOneClass (LocallyConstant X Y) :=
Function.Injective.mulZeroOneClass DFunLike.coe DFunLike.coe_injective' rfl rfl fun _ _ => rfl
section CharFn
variable (Y) [MulZeroOneClass Y] {U V : Set X}
/-- Characteristic functions are locally constant functions taking `x : X` to `1` if `x ∈ U`,
where `U` is a clopen set, and `0` otherwise. -/
noncomputable def charFn (hU : IsClopen U) : LocallyConstant X Y :=
indicator 1 hU
theorem coe_charFn (hU : IsClopen U) : (charFn Y hU : X → Y) = Set.indicator U 1 :=
rfl
theorem charFn_eq_one [Nontrivial Y] (x : X) (hU : IsClopen U) : charFn Y hU x = (1 : Y) ↔ x ∈ U :=
Set.indicator_eq_one_iff_mem _
theorem charFn_eq_zero [Nontrivial Y] (x : X) (hU : IsClopen U) : charFn Y hU x = (0 : Y) ↔ x ∉ U :=
Set.indicator_eq_zero_iff_notMem _
theorem charFn_inj [Nontrivial Y] (hU : IsClopen U) (hV : IsClopen V)
(h : charFn Y hU = charFn Y hV) : U = V :=
Set.indicator_one_inj Y <| coe_inj.mpr h
end CharFn
@[to_additive]
instance [Div Y] : Div (LocallyConstant X Y) where
div f g := ⟨f / g, f.isLocallyConstant.div g.isLocallyConstant⟩
@[to_additive]
theorem coe_div [Div Y] (f g : LocallyConstant X Y) : ⇑(f / g) = f / g :=
rfl
@[to_additive]
theorem div_apply [Div Y] (f g : LocallyConstant X Y) (x : X) : (f / g) x = f x / g x :=
rfl
@[to_additive]
instance [Semigroup Y] : Semigroup (LocallyConstant X Y) :=
Function.Injective.semigroup DFunLike.coe DFunLike.coe_injective' fun _ _ => rfl
instance [SemigroupWithZero Y] : SemigroupWithZero (LocallyConstant X Y) :=
Function.Injective.semigroupWithZero DFunLike.coe DFunLike.coe_injective' rfl fun _ _ => rfl
@[to_additive]
instance [CommSemigroup Y] : CommSemigroup (LocallyConstant X Y) :=
Function.Injective.commSemigroup DFunLike.coe DFunLike.coe_injective' fun _ _ => rfl
variable {α R : Type*}
@[to_additive]
instance smul [SMul α Y] : SMul α (LocallyConstant X Y) where
smul n f := f.map (n • ·)
@[to_additive (attr := simp)]
theorem coe_smul [SMul R Y] (r : R) (f : LocallyConstant X Y) : ⇑(r • f) = r • (f : X → Y) :=
rfl
@[to_additive]
theorem smul_apply [SMul R Y] (r : R) (f : LocallyConstant X Y) (x : X) : (r • f) x = r • f x :=
rfl
@[to_additive existing LocallyConstant.smul]
instance [Pow Y α] : Pow (LocallyConstant X Y) α where
pow f n := f.map (· ^ n)
@[to_additive]
instance [Monoid Y] : Monoid (LocallyConstant X Y) :=
Function.Injective.monoid DFunLike.coe DFunLike.coe_injective' rfl (fun _ _ => rfl) fun _ _ => rfl
instance [NatCast Y] : NatCast (LocallyConstant X Y) where
natCast n := const X n
instance [IntCast Y] : IntCast (LocallyConstant X Y) where
intCast n := const X n
instance [AddMonoidWithOne Y] : AddMonoidWithOne (LocallyConstant X Y) :=
Function.Injective.addMonoidWithOne DFunLike.coe DFunLike.coe_injective' rfl rfl (fun _ _ => rfl)
(fun _ _ => rfl) fun _ => rfl
@[to_additive]
instance [CommMonoid Y] : CommMonoid (LocallyConstant X Y) :=
Function.Injective.commMonoid DFunLike.coe DFunLike.coe_injective' rfl (fun _ _ => rfl)
fun _ _ => rfl
@[to_additive]
instance [Group Y] : Group (LocallyConstant X Y) :=
Function.Injective.group DFunLike.coe DFunLike.coe_injective' rfl (fun _ _ => rfl)
(fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
@[to_additive]
instance [CommGroup Y] : CommGroup (LocallyConstant X Y) :=
Function.Injective.commGroup DFunLike.coe DFunLike.coe_injective' rfl (fun _ _ => rfl)
(fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
instance [Distrib Y] : Distrib (LocallyConstant X Y) :=
Function.Injective.distrib DFunLike.coe DFunLike.coe_injective' (fun _ _ => rfl) fun _ _ => rfl
instance [NonUnitalNonAssocSemiring Y] : NonUnitalNonAssocSemiring (LocallyConstant X Y) :=
Function.Injective.nonUnitalNonAssocSemiring DFunLike.coe DFunLike.coe_injective' rfl
(fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
instance [NonUnitalSemiring Y] : NonUnitalSemiring (LocallyConstant X Y) :=
Function.Injective.nonUnitalSemiring DFunLike.coe DFunLike.coe_injective' rfl
(fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
instance [NonAssocSemiring Y] : NonAssocSemiring (LocallyConstant X Y) :=
Function.Injective.nonAssocSemiring DFunLike.coe DFunLike.coe_injective' rfl rfl
(fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) fun _ => rfl
/-- The constant-function embedding, as a ring hom. -/
@[simps]
def constRingHom [NonAssocSemiring Y] : Y →+* LocallyConstant X Y :=
{ constMonoidHom, constAddMonoidHom with toFun := const X }
instance [Semiring Y] : Semiring (LocallyConstant X Y) :=
Function.Injective.semiring DFunLike.coe DFunLike.coe_injective' rfl rfl
(fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) fun _ => rfl
instance [NonUnitalCommSemiring Y] : NonUnitalCommSemiring (LocallyConstant X Y) :=
Function.Injective.nonUnitalCommSemiring DFunLike.coe DFunLike.coe_injective' rfl
(fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
instance [CommSemiring Y] : CommSemiring (LocallyConstant X Y) :=
Function.Injective.commSemiring DFunLike.coe DFunLike.coe_injective' rfl rfl
(fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) fun _ => rfl
instance [NonUnitalNonAssocRing Y] : NonUnitalNonAssocRing (LocallyConstant X Y) :=
Function.Injective.nonUnitalNonAssocRing DFunLike.coe DFunLike.coe_injective' rfl (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
instance [NonUnitalRing Y] : NonUnitalRing (LocallyConstant X Y) :=
Function.Injective.nonUnitalRing DFunLike.coe DFunLike.coe_injective' rfl (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
instance [NonAssocRing Y] : NonAssocRing (LocallyConstant X Y) :=
Function.Injective.nonAssocRing DFunLike.coe DFunLike.coe_injective' rfl rfl (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
(fun _ => rfl) (fun _ => rfl)
instance [Ring Y] : Ring (LocallyConstant X Y) :=
Function.Injective.ring DFunLike.coe DFunLike.coe_injective' rfl rfl (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) fun _ => rfl
instance [NonUnitalCommRing Y] : NonUnitalCommRing (LocallyConstant X Y) :=
Function.Injective.nonUnitalCommRing DFunLike.coe DFunLike.coe_injective' rfl (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
instance [CommRing Y] : CommRing (LocallyConstant X Y) :=
Function.Injective.commRing DFunLike.coe DFunLike.coe_injective' rfl rfl (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
(fun _ _ => rfl) (fun _ => rfl) fun _ => rfl
variable {R : Type*}
instance [Monoid R] [MulAction R Y] : MulAction R (LocallyConstant X Y) :=
Function.Injective.mulAction _ coe_injective fun _ _ => rfl
instance [Monoid R] [AddMonoid Y] [DistribMulAction R Y] :
DistribMulAction R (LocallyConstant X Y) :=
Function.Injective.distribMulAction coeFnAddMonoidHom coe_injective fun _ _ => rfl
instance [Semiring R] [AddCommMonoid Y] [Module R Y] : Module R (LocallyConstant X Y) :=
Function.Injective.module R coeFnAddMonoidHom coe_injective fun _ _ => rfl
section Algebra
variable [CommSemiring R] [Semiring Y] [Algebra R Y]
instance : Algebra R (LocallyConstant X Y) where
algebraMap := constRingHom.comp <| algebraMap R Y
commutes' := by
intros
ext
exact Algebra.commutes' _ _
smul_def' := by
intros
ext
exact Algebra.smul_def' _ _
@[simp]
theorem coe_algebraMap (r : R) : ⇑(algebraMap R (LocallyConstant X Y) r) = algebraMap R (X → Y) r :=
rfl
end Algebra
section coeFn
/-- `DFunLike.coe` as a `RingHom`. -/
@[simps!] def coeFnRingHom [Semiring Y] : LocallyConstant X Y →+* X → Y where
toMonoidHom := coeFnMonoidHom
__ := coeFnAddMonoidHom
/-- `DFunLike.coe` as a linear map. -/
@[simps!] def coeFnₗ (R : Type*) [Semiring R] [AddCommMonoid Y]
[Module R Y] : LocallyConstant X Y →ₗ[R] X → Y where
toAddHom := coeFnAddMonoidHom.toAddHom
map_smul' _ _ := rfl
/-- `DFunLike.coe` as an `AlgHom`. -/
@[simps!] def coeFnAlgHom (R : Type*) [CommSemiring R] [Semiring Y] [Algebra R Y] :
LocallyConstant X Y →ₐ[R] X → Y where
toRingHom := coeFnRingHom
commutes' _ := rfl
end coeFn
section Eval
/-- Evaluation as a `MonoidHom` -/
@[to_additive (attr := simps!) /-- Evaluation as an `AddMonoidHom` -/]
def evalMonoidHom [MulOneClass Y] (x : X) : LocallyConstant X Y →* Y :=
(Pi.evalMonoidHom _ x).comp coeFnMonoidHom
/-- Evaluation as a linear map -/
@[simps!] def evalₗ (R : Type*) [Semiring R] [AddCommMonoid Y]
[Module R Y] (x : X) : LocallyConstant X Y →ₗ[R] Y :=
(LinearMap.proj x).comp (coeFnₗ R)
/-- Evaluation as a `RingHom` -/
@[simps!] def evalRingHom [Semiring Y] (x : X) : LocallyConstant X Y →+* Y :=
(Pi.evalRingHom _ x).comp coeFnRingHom
/-- Evaluation as an `AlgHom` -/
@[simps!]
def evalₐ (R : Type*) [CommSemiring R] [Semiring Y] [Algebra R Y] (x : X) :
LocallyConstant X Y →ₐ[R] Y :=
(Pi.evalAlgHom _ _ x).comp (coeFnAlgHom R)
end Eval
section Comap
variable [TopologicalSpace Y] {Z : Type*}
/-- `LocallyConstant.comap` as a `MonoidHom`. -/
@[to_additive (attr := simps) /-- `LocallyConstant.comap` as an `AddMonoidHom`. -/]
def comapMonoidHom [MulOneClass Z] (f : C(X, Y)) :
LocallyConstant Y Z →* LocallyConstant X Z where
toFun := comap f
map_one' := rfl
map_mul' _ _ := rfl
/-- `LocallyConstant.comap` as a linear map. -/
@[simps!]
def comapₗ (R : Type*) [Semiring R] [AddCommMonoid Z] [Module R Z] (f : C(X, Y)) :
LocallyConstant Y Z →ₗ[R] LocallyConstant X Z where
toFun := comap f
map_add' := map_add (comapAddMonoidHom f)
map_smul' _ _ := rfl
/-- `LocallyConstant.comap` as a `RingHom`. -/
@[simps!]
def comapRingHom [Semiring Z] (f : C(X, Y)) :
LocallyConstant Y Z →+* LocallyConstant X Z where
toMonoidHom := comapMonoidHom f
__ := (comapAddMonoidHom f)
/-- `LocallyConstant.comap` as an `AlgHom` -/
@[simps!]
def comapₐ (R : Type*) [CommSemiring R] [Semiring Z] [Algebra R Z]
(f : C(X, Y)) : LocallyConstant Y Z →ₐ[R] LocallyConstant X Z where
toRingHom := comapRingHom f
commutes' _ := rfl
lemma ker_comapₗ [Semiring R] [AddCommMonoid Z] [Module R Z] (f : C(X, Y))
(hfs : Function.Surjective f) :
LinearMap.ker (comapₗ R f : LocallyConstant Y Z →ₗ[R] LocallyConstant X Z) = ⊥ :=
LinearMap.ker_eq_bot_of_injective <| comap_injective _ hfs
/-- `LocallyConstant.congrLeft` as a linear equivalence. -/
@[simps!]
def congrLeftₗ (R : Type*) [Semiring R] [AddCommMonoid Z] [Module R Z] (e : X ≃ₜ Y) :
LocallyConstant X Z ≃ₗ[R] LocallyConstant Y Z where
toLinearMap := comapₗ R ⟨_, e.symm.continuous⟩
__ := congrLeft e
/-- `LocallyConstant.congrLeft` as a `RingEquiv`. -/
@[simps!]
def congrLeftRingEquiv [Semiring Z] (e : X ≃ₜ Y) :
LocallyConstant X Z ≃+* LocallyConstant Y Z where
toEquiv := congrLeft e
__ := comapMonoidHom ⟨_, e.symm.continuous⟩
__ := comapAddMonoidHom ⟨_, e.symm.continuous⟩
/-- `LocallyConstant.congrLeft` as an `AlgEquiv`. -/
@[simps!]
def congrLeftₐ (R : Type*) [CommSemiring R] [Semiring Z] [Algebra R Z] (e : X ≃ₜ Y) :
LocallyConstant X Z ≃ₐ[R] LocallyConstant Y Z where
toEquiv := congrLeft e
__ := comapₐ R ⟨_, e.symm.continuous⟩
end Comap
section Map
variable {Z : Type*}
/-- `LocallyConstant.map` as a `MonoidHom`. -/
@[to_additive (attr := simps) /-- `LocallyConstant.map` as an `AddMonoidHom`. -/]
def mapMonoidHom [MulOneClass Y] [MulOneClass Z] (f : Y →* Z) :
LocallyConstant X Y →* LocallyConstant X Z where
toFun := map f
map_one' := by aesop
map_mul' := by aesop
/-- `LocallyConstant.map` as a linear map. -/
@[simps!]
def mapₗ (R : Type*) [Semiring R] [AddCommMonoid Y] [Module R Y]
[AddCommMonoid Z] [Module R Z] (f : Y →ₗ[R] Z) :
LocallyConstant X Y →ₗ[R] LocallyConstant X Z where
toFun := map f
map_add' := by aesop
map_smul' := by aesop
/-- `LocallyConstant.map` as a `RingHom`. -/
@[simps!]
def mapRingHom [Semiring Y] [Semiring Z] (f : Y →+* Z) :
LocallyConstant X Y →+* LocallyConstant X Z where
toMonoidHom := mapMonoidHom f
__ := (mapAddMonoidHom f.toAddMonoidHom)
/-- `LocallyConstant.map` as an `AlgHom` -/
@[simps!]
def mapₐ (R : Type*) [CommSemiring R] [Semiring Y] [Algebra R Y] [Semiring Z] [Algebra R Z]
(f : Y →ₐ[R] Z) : LocallyConstant X Y →ₐ[R] LocallyConstant X Z where
toRingHom := mapRingHom f
commutes' _ := by aesop
/-- `LocallyConstant.congrRight` as a linear equivalence. -/
@[simps!]
def congrRightₗ (R : Type*) [Semiring R] [AddCommMonoid Y] [Module R Y]
[AddCommMonoid Z] [Module R Z] (e : Y ≃ₗ[R] Z) :
LocallyConstant X Y ≃ₗ[R] LocallyConstant X Z where
toLinearMap := mapₗ R e
__ := congrRight e.toEquiv
/-- `LocallyConstant.congrRight` as a `RingEquiv`. -/
@[simps!]
def congrRightRingEquiv [Semiring Y] [Semiring Z] (e : Y ≃+* Z) :
LocallyConstant X Y ≃+* LocallyConstant X Z where
toEquiv := congrRight e
__ := mapMonoidHom e.toMonoidHom
__ := mapAddMonoidHom e.toAddMonoidHom
/-- `LocallyConstant.congrRight` as an `AlgEquiv`. -/
@[simps!]
def congrRightₐ (R : Type*) [CommSemiring R] [Semiring Y] [Algebra R Y] [Semiring Z] [Algebra R Z]
(e : Y ≃ₐ[R] Z) : LocallyConstant X Y ≃ₐ[R] LocallyConstant X Z where
toEquiv := congrRight e
__ := mapₐ R e.toAlgHom
end Map
section Const
/-- `LocallyConstant.const` as a linear map. -/
@[simps!]
def constₗ (R : Type*) [Semiring R] [AddCommMonoid Y] [Module R Y] :
Y →ₗ[R] LocallyConstant X Y where
toFun := const X
map_add' _ _ := rfl
map_smul' _ _ := rfl
/-- `LocallyConstant.const` as an `AlgHom` -/
@[simps!]
def constₐ (R : Type*) [CommSemiring R] [Semiring Y] [Algebra R Y] :
Y →ₐ[R] LocallyConstant X Y where
toRingHom := constRingHom
commutes' _ := rfl
end Const
end LocallyConstant |
.lake/packages/mathlib/Mathlib/Topology/Category/Sequential.lean | import Mathlib.CategoryTheory.Elementwise
import Mathlib.Topology.Sequences
import Mathlib.Topology.Instances.Discrete
import Mathlib.Topology.Category.TopCat.Basic
/-!
# The category of sequential topological spaces
We define the category `Sequential` of sequential topological spaces. We follow the usual template
for defining categories of topological spaces, by giving it the induced category structure from
`TopCat`.
-/
open CategoryTheory
universe u
/-- The type sequential topological spaces. -/
structure Sequential where
/-- The underlying topological space of an object of `Sequential`. -/
toTop : TopCat.{u} -- TODO: turn this into `extends`
/-- The underlying topological space is sequential. -/
[is_sequential : SequentialSpace toTop]
namespace Sequential
instance : Inhabited Sequential.{u} :=
⟨{ toTop := TopCat.of (ULift (Fin 37)) }⟩
instance : CoeSort Sequential Type* :=
⟨fun X => X.toTop⟩
attribute [instance] is_sequential
instance : Category.{u, u+1} Sequential.{u} :=
InducedCategory.category toTop
instance : ConcreteCategory.{u} Sequential.{u} (C(·, ·)) :=
InducedCategory.concreteCategory toTop
variable (X : Type u) [TopologicalSpace X] [SequentialSpace X]
/-- Constructor for objects of the category `Sequential`. -/
abbrev of : Sequential.{u} where
toTop := TopCat.of X
is_sequential := ‹_›
/-- The fully faithful embedding of `Sequential` in `TopCat`. -/
@[simps!]
def sequentialToTop : Sequential.{u} ⥤ TopCat.{u} :=
inducedFunctor _
/-- The functor to `TopCat` is indeed fully faithful. -/
def fullyFaithfulSequentialToTop : sequentialToTop.FullyFaithful :=
fullyFaithfulInducedFunctor _
instance : sequentialToTop.{u}.Full :=
inferInstanceAs (inducedFunctor _).Full
instance : sequentialToTop.{u}.Faithful :=
inferInstanceAs (inducedFunctor _).Faithful
/-- Construct an isomorphism from a homeomorphism. -/
@[simps hom inv]
def isoOfHomeo {X Y : Sequential.{u}} (f : X ≃ₜ Y) : X ≅ Y where
hom := TopCat.ofHom ⟨f, f.continuous⟩
inv := TopCat.ofHom ⟨f.symm, f.symm.continuous⟩
hom_inv_id := by
ext x
exact f.symm_apply_apply x
inv_hom_id := by
ext x
exact f.apply_symm_apply x
/-- Construct a homeomorphism from an isomorphism. -/
@[simps]
def homeoOfIso {X Y : Sequential.{u}} (f : X ≅ Y) : X ≃ₜ Y where
toFun := f.hom
invFun := f.inv
left_inv := f.hom_inv_id_apply
right_inv := f.inv_hom_id_apply
continuous_toFun := f.hom.hom.continuous
continuous_invFun := f.inv.hom.continuous
/-- The equivalence between isomorphisms in `Sequential` and homeomorphisms
of topological spaces. -/
@[simps]
def isoEquivHomeo {X Y : Sequential.{u}} : (X ≅ Y) ≃ (X ≃ₜ Y) where
toFun := homeoOfIso
invFun := isoOfHomeo
end Sequential |
.lake/packages/mathlib/Mathlib/Topology/Category/CompactlyGenerated.lean | import Mathlib.Topology.Compactness.CompactlyGeneratedSpace
import Mathlib.CategoryTheory.Elementwise
/-!
# Compactly generated topological spaces
This file defines the category of compactly generated topological spaces. These are spaces `X` such
that a map `f : X → Y` is continuous whenever the composition `S → X → Y` is continuous for all
compact Hausdorff spaces `S` mapping continuously to `X`.
## TODO
* `CompactlyGenerated` is a reflective subcategory of `TopCat`.
* `CompactlyGenerated` is Cartesian closed.
* Every first-countable space is `u`-compactly generated for every universe `u`.
-/
universe u w
open CategoryTheory Topology TopologicalSpace
/-- `CompactlyGenerated.{u, w}` is the type of `u`-compactly generated `w`-small topological spaces.
This should always be used with explicit universe parameters. -/
structure CompactlyGenerated where
/-- The underlying topological space of an object of `CompactlyGenerated`. -/
toTop : TopCat.{w}
/-- The underlying topological space is compactly generated. -/
[is_compactly_generated : UCompactlyGeneratedSpace.{u} toTop]
namespace CompactlyGenerated
instance : Inhabited CompactlyGenerated.{u, w} :=
⟨{ toTop := TopCat.of (ULift (Fin 37)) }⟩
instance : CoeSort CompactlyGenerated Type* :=
⟨fun X => X.toTop⟩
attribute [instance] is_compactly_generated
instance : Category.{w, w+1} CompactlyGenerated.{u, w} :=
InducedCategory.category toTop
instance : ConcreteCategory.{w} CompactlyGenerated.{u, w} (C(·, ·)) :=
InducedCategory.concreteCategory toTop
variable (X : Type w) [TopologicalSpace X] [UCompactlyGeneratedSpace.{u} X]
/-- Constructor for objects of the category `CompactlyGenerated`. -/
abbrev of : CompactlyGenerated.{u, w} where
toTop := TopCat.of X
is_compactly_generated := ‹_›
section
variable {X} {Y : Type w} [TopologicalSpace Y] [UCompactlyGeneratedSpace.{u} Y]
/-- Typecheck a `ContinuousMap` as a morphism in `CompactlyGenerated`. -/
abbrev ofHom (f : C(X, Y)) : of X ⟶ of Y := ConcreteCategory.ofHom f
end
/-- The fully faithful embedding of `CompactlyGenerated` in `TopCat`. -/
@[simps!]
def compactlyGeneratedToTop : CompactlyGenerated.{u, w} ⥤ TopCat.{w} :=
inducedFunctor _
/-- `compactlyGeneratedToTop` is fully faithful. -/
def fullyFaithfulCompactlyGeneratedToTop : compactlyGeneratedToTop.{u, w}.FullyFaithful :=
fullyFaithfulInducedFunctor _
instance : compactlyGeneratedToTop.{u, w}.Full := fullyFaithfulCompactlyGeneratedToTop.full
instance : compactlyGeneratedToTop.{u, w}.Faithful := fullyFaithfulCompactlyGeneratedToTop.faithful
/-- Construct an isomorphism from a homeomorphism. -/
@[simps hom inv]
def isoOfHomeo {X Y : CompactlyGenerated.{u, w}} (f : X ≃ₜ Y) : X ≅ Y where
hom := ofHom ⟨f, f.continuous⟩
inv := ofHom ⟨f.symm, f.symm.continuous⟩
hom_inv_id := by
ext x
exact f.symm_apply_apply x
inv_hom_id := by
ext x
exact f.apply_symm_apply x
/-- Construct a homeomorphism from an isomorphism. -/
@[simps]
def homeoOfIso {X Y : CompactlyGenerated.{u, w}} (f : X ≅ Y) : X ≃ₜ Y where
toFun := f.hom
invFun := f.inv
left_inv := f.hom_inv_id_apply
right_inv := f.inv_hom_id_apply
continuous_toFun := f.hom.hom.continuous
continuous_invFun := f.inv.hom.continuous
/-- The equivalence between isomorphisms in `CompactlyGenerated` and homeomorphisms
of topological spaces. -/
@[simps]
def isoEquivHomeo {X Y : CompactlyGenerated.{u, w}} : (X ≅ Y) ≃ (X ≃ₜ Y) where
toFun := homeoOfIso
invFun := isoOfHomeo
end CompactlyGenerated |
.lake/packages/mathlib/Mathlib/Topology/Category/Born.lean | import Mathlib.CategoryTheory.ConcreteCategory.Basic
import Mathlib.Topology.Bornology.Hom
/-!
# The category of bornologies
This defines `Born`, the category of bornologies.
-/
universe u
open CategoryTheory
/-- The category of bornologies. -/
structure Born where
/-- Construct a bundled `Born` from a `Bornology`. -/
of ::
/-- The underlying bornology. -/
carrier : Type*
[str : Bornology carrier]
attribute [instance] Born.str
namespace Born
instance : CoeSort Born Type* :=
⟨carrier⟩
instance : Inhabited Born :=
⟨of PUnit⟩
instance : LargeCategory.{u} Born where
Hom X Y := LocallyBoundedMap X Y
id X := LocallyBoundedMap.id X
comp f g := g.comp f
instance : ConcreteCategory Born (LocallyBoundedMap · ·) where
hom f := f
ofHom f := f
end Born |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCommRingCat.lean | import Mathlib.Algebra.Category.Ring.Basic
import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.Topology.Algebra.Ring.Basic
/-!
# Category of topological commutative rings
We introduce the category `TopCommRingCat` of topological commutative rings together with the
relevant forgetful functors to topological spaces and commutative rings.
-/
universe u
open CategoryTheory
/-- A bundled topological commutative ring. -/
structure TopCommRingCat where
/-- Construct a bundled `TopCommRingCat` from the underlying type and the appropriate typeclasses.
-/
of ::
/-- carrier of a topological commutative ring. -/
α : Type u
[isCommRing : CommRing α]
[isTopologicalSpace : TopologicalSpace α]
[isTopologicalRing : IsTopologicalRing α]
namespace TopCommRingCat
instance : Inhabited TopCommRingCat :=
⟨⟨PUnit⟩⟩
instance : CoeSort TopCommRingCat (Type u) :=
⟨TopCommRingCat.α⟩
attribute [instance] isCommRing isTopologicalSpace isTopologicalRing
instance : Category TopCommRingCat.{u} where
Hom R S := { f : R →+* S // Continuous f }
id R := ⟨RingHom.id R, by rw [RingHom.id]; continuity⟩
comp f g :=
⟨g.val.comp f.val, by
-- TODO automate
cases f
cases g
continuity⟩
instance (R S : TopCommRingCat.{u}) : FunLike { f : R →+* S // Continuous f } R S where
coe f := f.val
coe_injective' _ _ h := Subtype.ext (DFunLike.coe_injective h)
instance : ConcreteCategory TopCommRingCat.{u} fun R S => { f : R →+* S // Continuous f } where
hom f := f
ofHom f := f
theorem coe_of (X : Type u) [CommRing X] [TopologicalSpace X] [IsTopologicalRing X] :
(of X : Type u) = X := rfl
instance hasForgetToCommRingCat : HasForget₂ TopCommRingCat CommRingCat :=
HasForget₂.mk' (fun R => CommRingCat.of R) (fun _ => rfl)
(fun f => CommRingCat.ofHom f.val) HEq.rfl
instance forgetToCommRingCatTopologicalSpace (R : TopCommRingCat) :
TopologicalSpace ((forget₂ TopCommRingCat CommRingCat).obj R) :=
R.isTopologicalSpace
/-- The forgetful functor to `TopCat`. -/
instance hasForgetToTopCat : HasForget₂ TopCommRingCat TopCat :=
HasForget₂.mk' (fun R => TopCat.of R) (fun _ => rfl) (fun f => TopCat.ofHom ⟨⇑f.1, f.2⟩) HEq.rfl
instance forgetToTopCatCommRing (R : TopCommRingCat) :
CommRing ((forget₂ TopCommRingCat TopCat).obj R) :=
R.isCommRing
instance forgetToTopCatTopologicalRing (R : TopCommRingCat) :
IsTopologicalRing ((forget₂ TopCommRingCat TopCat).obj R) :=
R.isTopologicalRing
/-- The forgetful functors to `Type` do not reflect isomorphisms,
but the forgetful functor from `TopCommRingCat` to `TopCat` does.
-/
instance : (forget₂ TopCommRingCat.{u} TopCat.{u}).ReflectsIsomorphisms where
reflects {X Y} f _ := by
-- We have an isomorphism in `TopCat`,
let i_Top := asIso ((forget₂ TopCommRingCat TopCat).map f)
-- and a `RingEquiv`.
let e_Ring : X ≃+* Y := { f.1, ((forget TopCat).mapIso i_Top).toEquiv with }
-- Putting these together we obtain the isomorphism we're after:
exact
⟨⟨⟨e_Ring.symm, i_Top.inv.hom.2⟩,
⟨by
ext x
exact e_Ring.left_inv x, by
ext x
exact e_Ring.right_inv x⟩⟩⟩
end TopCommRingCat |
.lake/packages/mathlib/Mathlib/Topology/Category/FinTopCat.lean | import Mathlib.CategoryTheory.FintypeCat
import Mathlib.Topology.Category.TopCat.Basic
/-!
# Category of finite topological spaces
Definition of the category of finite topological spaces with the canonical
forgetful functors.
-/
universe u
open CategoryTheory
/-- A bundled finite topological space. -/
structure FinTopCat where
/-- carrier of a finite topological space. -/
toTop : TopCat.{u} -- TODO: turn this into an `extends`?
[fintype : Fintype toTop]
namespace FinTopCat
instance : Inhabited FinTopCat :=
⟨{ toTop := TopCat.of PEmpty }⟩
instance : CoeSort FinTopCat (Type u) :=
⟨fun X => X.toTop⟩
attribute [instance] fintype
instance : Category FinTopCat :=
InducedCategory.category toTop
instance : ConcreteCategory FinTopCat (C(·, ·)) :=
InducedCategory.concreteCategory toTop
/-- Construct a bundled `FinTopCat` from the underlying type and the appropriate typeclasses. -/
def of (X : Type u) [Fintype X] [TopologicalSpace X] : FinTopCat where
toTop := TopCat.of X
fintype := ‹_›
@[simp]
theorem coe_of (X : Type u) [Fintype X] [TopologicalSpace X] :
(of X : Type u) = X :=
rfl
/-- The forgetful functor to `FintypeCat`. -/
instance : HasForget₂ FinTopCat FintypeCat :=
HasForget₂.mk' (fun X ↦ FintypeCat.of X) (fun _ ↦ rfl) (fun f ↦ f.hom.toFun) HEq.rfl
instance (X : FinTopCat) : TopologicalSpace ((forget₂ FinTopCat FintypeCat).obj X) :=
inferInstanceAs <| TopologicalSpace X
/-- The forgetful functor to `TopCat`. -/
instance : HasForget₂ FinTopCat TopCat :=
InducedCategory.hasForget₂ _
instance (X : FinTopCat) : Fintype ((forget₂ FinTopCat TopCat).obj X) :=
X.fintype
end FinTopCat
namespace FintypeCatDiscrete
/-- Scoped topological space instance on objects of the category of finite types, assigning
the discrete topology. -/
scoped instance (X : FintypeCat) : TopologicalSpace X := ⊥
scoped instance (X : FintypeCat) : DiscreteTopology X := ⟨rfl⟩
/-- The forgetful functor from finite types to topological spaces, forgetting discreteness.
This is a scoped instance. -/
scoped instance : HasForget₂ FintypeCat TopCat where
forget₂.obj X := TopCat.of X
forget₂.map f := TopCat.ofHom ⟨f, continuous_of_discreteTopology⟩
end FintypeCatDiscrete |
.lake/packages/mathlib/Mathlib/Topology/Category/UniformSpace.lean | import Mathlib.CategoryTheory.Adjunction.Reflective
import Mathlib.CategoryTheory.Monad.Limits
import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.Topology.UniformSpace.Completion
/-!
# The category of uniform spaces
We construct the category of uniform spaces, show that the complete separated uniform spaces
form a reflective subcategory, and hence possess all limits that uniform spaces do.
TODO: show that uniform spaces actually have all limits!
-/
universe u
open CategoryTheory
/-- An object in the category of uniform spaces. -/
structure UniformSpaceCat : Type (u + 1) where
/-- Construct a bundled `UniformSpace` from the underlying type and the typeclass. -/
of ::
/-- The underlying uniform space. -/
carrier : Type u
[str : UniformSpace carrier]
attribute [instance] UniformSpaceCat.str
namespace UniformSpaceCat
instance : CoeSort UniformSpaceCat Type* :=
⟨carrier⟩
/-- A bundled uniform continuous map. -/
@[ext]
structure Hom (X Y : UniformSpaceCat) where
/-- The underlying `UniformContinuous` function. -/
hom' : { f : X → Y // UniformContinuous f }
instance : LargeCategory.{u} UniformSpaceCat.{u} where
Hom := Hom
id X := ⟨id, uniformContinuous_id⟩
comp f g := ⟨⟨g.hom'.val ∘ f.hom'.val, g.hom'.property.comp f.hom'.property⟩⟩
id_comp := by intros; apply Hom.ext; simp
comp_id := by intros; apply Hom.ext; simp
assoc := by intros; apply Hom.ext; ext; simp
instance instFunLike (X Y : UniformSpaceCat) :
FunLike { f : X → Y // UniformContinuous f } X Y where
coe := Subtype.val
coe_injective' _ _ h := Subtype.ext h
instance : ConcreteCategory UniformSpaceCat ({ f : · → · // UniformContinuous f }) where
hom f := f.hom'
ofHom f := ⟨f⟩
/-- Turn a morphism in `UniformSpaceCat` back into a function which is `UniformContinuous`. -/
abbrev Hom.hom {X Y : UniformSpaceCat} (f : Hom X Y) :=
ConcreteCategory.hom (C := UniformSpaceCat) f
/-- Typecheck a function which is `UniformContinuous` as a morphism in `UniformSpaceCat`. -/
abbrev ofHom {X Y : Type u} [UniformSpace X] [UniformSpace Y]
(f : { f : X → Y // UniformContinuous f }) : of X ⟶ of Y :=
ConcreteCategory.ofHom f
instance : Inhabited UniformSpaceCat :=
⟨UniformSpaceCat.of Empty⟩
theorem coe_of (X : Type u) [UniformSpace X] : (of X : Type u) = X :=
rfl
@[simp]
theorem hom_comp {X Y Z : UniformSpaceCat} (f : X ⟶ Y) (g : Y ⟶ Z) :
(f ≫ g).hom = ⟨g ∘ f, g.hom.prop.comp f.hom.prop⟩ :=
rfl
@[simp]
theorem hom_id (X : UniformSpaceCat) : (𝟙 X : X ⟶ X).hom = ⟨id, uniformContinuous_id⟩ :=
rfl
@[simp]
theorem hom_ofHom {X Y : Type u} [UniformSpace X] [UniformSpace Y]
(f : { f : X → Y // UniformContinuous f }) : (ofHom f).hom = f :=
rfl
theorem coe_comp {X Y Z : UniformSpaceCat} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g : X → Z) = g ∘ f :=
rfl
theorem coe_id (X : UniformSpaceCat) : (𝟙 X : X → X) = id :=
rfl
theorem coe_mk {X Y : UniformSpaceCat} (f : X → Y) (hf : UniformContinuous f) :
(⟨f, hf⟩ : X ⟶ Y).hom = f :=
rfl
@[ext]
theorem hom_ext {X Y : UniformSpaceCat} {f g : X ⟶ Y} (h : (f : X → Y) = g) : f = g :=
Hom.ext (Subtype.ext h)
/-- The forgetful functor from uniform spaces to topological spaces. -/
instance hasForgetToTop : HasForget₂ UniformSpaceCat.{u} TopCat.{u} where
forget₂ :=
{ obj := fun X => TopCat.of X
map := fun f => TopCat.ofHom
{ toFun := f
continuous_toFun := f.hom.property.continuous } }
end UniformSpaceCat
/-- A (bundled) complete separated uniform space. -/
structure CpltSepUniformSpace where
/-- The underlying space -/
α : Type u
[isUniformSpace : UniformSpace α]
[isCompleteSpace : CompleteSpace α]
[isT0 : T0Space α]
namespace CpltSepUniformSpace
instance : CoeSort CpltSepUniformSpace (Type u) :=
⟨CpltSepUniformSpace.α⟩
attribute [instance] isUniformSpace isCompleteSpace isT0
/-- The function forgetting that a complete separated uniform spaces is complete and separated. -/
def toUniformSpace (X : CpltSepUniformSpace) : UniformSpaceCat :=
UniformSpaceCat.of X
instance completeSpace (X : CpltSepUniformSpace) : CompleteSpace (toUniformSpace X).carrier :=
CpltSepUniformSpace.isCompleteSpace X
instance t0Space (X : CpltSepUniformSpace) : T0Space (toUniformSpace X).carrier :=
CpltSepUniformSpace.isT0 X
/-- Construct a bundled `UniformSpace` from the underlying type and the appropriate typeclasses. -/
def of (X : Type u) [UniformSpace X] [CompleteSpace X] [T0Space X] : CpltSepUniformSpace :=
⟨X⟩
@[simp]
theorem coe_of (X : Type u) [UniformSpace X] [CompleteSpace X] [T0Space X] :
(of X : Type u) = X :=
rfl
instance : Inhabited CpltSepUniformSpace :=
⟨CpltSepUniformSpace.of Empty⟩
/-- The category instance on `CpltSepUniformSpace`. -/
instance category : LargeCategory CpltSepUniformSpace :=
InducedCategory.category toUniformSpace
instance instFunLike (X Y : CpltSepUniformSpace) :
FunLike { f : X → Y // UniformContinuous f } X Y where
coe := Subtype.val
coe_injective' _ _ h := Subtype.ext h
/-- The concrete category instance on `CpltSepUniformSpace`. -/
instance concreteCategory : ConcreteCategory CpltSepUniformSpace
({ f : · → · // UniformContinuous f }) :=
InducedCategory.concreteCategory toUniformSpace
instance hasForgetToUniformSpace : HasForget₂ CpltSepUniformSpace UniformSpaceCat :=
InducedCategory.hasForget₂ toUniformSpace
@[simp]
theorem hom_comp {X Y Z : CpltSepUniformSpace} (f : X ⟶ Y) (g : Y ⟶ Z) :
ConcreteCategory.hom (f ≫ g) = ⟨g ∘ f, g.hom.prop.comp f.hom.prop⟩ :=
rfl
@[simp]
theorem hom_id (X : CpltSepUniformSpace) :
ConcreteCategory.hom (𝟙 X : X ⟶ X) = ⟨id, uniformContinuous_id⟩ :=
rfl
@[simp]
theorem hom_ofHom {X Y : Type u} [UniformSpace X] [UniformSpace Y]
(f : { f : X → Y // UniformContinuous f }) : (UniformSpaceCat.ofHom f).hom = f :=
rfl
end CpltSepUniformSpace
namespace UniformSpaceCat
open UniformSpace
open CpltSepUniformSpace
/-- The functor turning uniform spaces into complete separated uniform spaces. -/
@[simps map]
noncomputable def completionFunctor : UniformSpaceCat ⥤ CpltSepUniformSpace where
obj X := CpltSepUniformSpace.of (Completion X)
map f := ofHom ⟨Completion.map f.1, Completion.uniformContinuous_map⟩
map_id _ := hom_ext Completion.map_id
map_comp f g := hom_ext (Completion.map_comp g.hom.property f.hom.property).symm
/-- The inclusion of a uniform space into its completion. -/
def completionHom (X : UniformSpaceCat) :
X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj (completionFunctor.obj X) where
hom'.val := ((↑) : X → Completion X)
hom'.property := Completion.uniformContinuous_coe X
@[simp]
theorem completionHom_val (X : UniformSpaceCat) (x) : (completionHom X) x = (x : Completion X) :=
rfl
/-- The mate of a morphism from a `UniformSpace` to a `CpltSepUniformSpace`. -/
noncomputable def extensionHom {X : UniformSpaceCat} {Y : CpltSepUniformSpace}
(f : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj Y) :
completionFunctor.obj X ⟶ Y where
hom'.val := Completion.extension f
hom'.property := Completion.uniformContinuous_extension
@[simp]
theorem extensionHom_val {X : UniformSpaceCat} {Y : CpltSepUniformSpace}
(f : X ⟶ (forget₂ _ _).obj Y) (x) : (extensionHom f) x = Completion.extension f x :=
rfl
@[simp]
theorem extension_comp_coe {X : UniformSpaceCat} {Y : CpltSepUniformSpace}
(f : toUniformSpace (CpltSepUniformSpace.of (Completion X)) ⟶ toUniformSpace Y) :
extensionHom (completionHom X ≫ f) = f := by
ext x
exact congr_fun (Completion.extension_comp_coe f.hom.property) x
/-- The completion functor is left adjoint to the forgetful functor. -/
noncomputable def adj : completionFunctor ⊣ forget₂ CpltSepUniformSpace UniformSpaceCat :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun X Y =>
{ toFun := fun f => completionHom X ≫ f
invFun := fun f => extensionHom f
left_inv := fun f => by dsimp; rw [extension_comp_coe]
right_inv := fun f => by
ext x
rcases f with ⟨⟨_, _⟩⟩
exact @Completion.extension_coe _ _ _ _ _ (CpltSepUniformSpace.t0Space _)
‹_› _ }
homEquiv_naturality_left_symm := fun {X' X Y} f g => by
ext x
dsimp [-Function.comp_apply]
erw [Completion.extension_map (γ := Y) g.hom.2 f.hom.2]
rfl }
noncomputable instance : Reflective (forget₂ CpltSepUniformSpace UniformSpaceCat) where
L := completionFunctor
adj := adj
map_surjective f := ⟨f, rfl⟩
open CategoryTheory.Limits
-- TODO Once someone defines `HasLimits UniformSpace`, turn this into an instance.
example [HasLimits.{u} UniformSpaceCat.{u}] : HasLimits.{u} CpltSepUniformSpace.{u} :=
hasLimits_of_reflective <| forget₂ CpltSepUniformSpace UniformSpaceCat.{u}
end UniformSpaceCat |
.lake/packages/mathlib/Mathlib/Topology/Category/DeltaGenerated.lean | import Mathlib.CategoryTheory.Monad.Limits
import Mathlib.Topology.Category.TopCat.Limits.Basic
import Mathlib.Topology.Compactness.DeltaGeneratedSpace
/-!
# Delta-generated topological spaces
The category of delta-generated spaces.
See https://ncatlab.org/nlab/show/Delta-generated+topological+space.
Adapted from `Mathlib/Topology/Category/CompactlyGenerated.lean`.
## TODO
* `DeltaGenerated` is Cartesian closed.
-/
universe u
open CategoryTheory
/-- The type of delta-generated topological spaces. -/
structure DeltaGenerated where
/-- the underlying topological space -/
toTop : TopCat.{u}
/-- The underlying topological space is delta-generated. -/
deltaGenerated : DeltaGeneratedSpace toTop := by infer_instance
namespace DeltaGenerated
instance : CoeSort DeltaGenerated Type* :=
⟨fun X ↦ X.toTop⟩
attribute [instance] deltaGenerated
instance : LargeCategory.{u} DeltaGenerated.{u} :=
InducedCategory.category toTop
instance : ConcreteCategory.{u} DeltaGenerated.{u} (C(·, ·)) :=
InducedCategory.concreteCategory toTop
/-- Constructor for objects of the category `DeltaGenerated` -/
abbrev of (X : Type u) [TopologicalSpace X] [DeltaGeneratedSpace X] : DeltaGenerated.{u} where
toTop := TopCat.of X
deltaGenerated := ‹_›
/-- The forgetful functor `DeltaGenerated ⥤ TopCat` -/
@[simps!]
def deltaGeneratedToTop : DeltaGenerated.{u} ⥤ TopCat.{u} :=
inducedFunctor _
/-- `deltaGeneratedToTop` is fully faithful. -/
def fullyFaithfulDeltaGeneratedToTop : deltaGeneratedToTop.{u}.FullyFaithful :=
fullyFaithfulInducedFunctor _
instance : deltaGeneratedToTop.{u}.Full := fullyFaithfulDeltaGeneratedToTop.full
instance : deltaGeneratedToTop.{u}.Faithful := fullyFaithfulDeltaGeneratedToTop.faithful
/-- The faithful (but not full) functor taking each topological space to its delta-generated
coreflection. -/
@[simps!]
def topToDeltaGenerated : TopCat.{u} ⥤ DeltaGenerated.{u} where
obj X := of (DeltaGeneratedSpace.of X)
map {_ Y} f := TopCat.ofHom ⟨f, (continuous_to_deltaGenerated (Y := Y)).mpr <|
continuous_le_dom deltaGenerated_le f.hom.continuous⟩
instance : topToDeltaGenerated.{u}.Faithful :=
⟨fun h ↦ by ext x; exact CategoryTheory.congr_fun h x⟩
/-- The adjunction between the forgetful functor `DeltaGenerated ⥤ TopCat` and its coreflector. -/
def coreflectorAdjunction : deltaGeneratedToTop ⊣ topToDeltaGenerated :=
Adjunction.mkOfUnitCounit {
unit := {
app X := TopCat.ofHom ⟨id, continuous_iff_coinduced_le.mpr (eq_deltaGenerated (X := X)).le⟩ }
counit := {
app X := TopCat.ofHom ⟨DeltaGeneratedSpace.counit, DeltaGeneratedSpace.continuous_counit⟩ }}
/-- The category of delta-generated spaces is coreflective in the category of topological spaces. -/
instance deltaGeneratedToTop.coreflective : Coreflective deltaGeneratedToTop where
R := topToDeltaGenerated
adj := coreflectorAdjunction
noncomputable instance deltaGeneratedToTop.createsColimits : CreatesColimits deltaGeneratedToTop :=
comonadicCreatesColimits deltaGeneratedToTop
instance hasLimits : Limits.HasLimits DeltaGenerated :=
hasLimits_of_coreflective deltaGeneratedToTop
instance hasColimits : Limits.HasColimits DeltaGenerated :=
hasColimits_of_hasColimits_createsColimits deltaGeneratedToTop
end DeltaGenerated |
.lake/packages/mathlib/Mathlib/Topology/Category/Locale.lean | import Mathlib.Order.Category.Frm
import Mathlib.Topology.Category.CompHaus.Frm
/-!
# The category of locales
This file defines `Locale`, the category of locales. This is the opposite of the category of frames.
-/
universe u
open CategoryTheory Opposite Order TopologicalSpace
/-- The category of locales. -/
def Locale :=
Frmᵒᵖ deriving LargeCategory
namespace Locale
instance : CoeSort Locale Type* :=
⟨fun X => X.unop⟩
instance (X : Locale) : Frame X :=
X.unop.str
/-- Construct a bundled `Locale` from a `Frame`. -/
def of (α : Type*) [Frame α] : Locale :=
op <| Frm.of α
@[simp]
theorem coe_of (α : Type*) [Frame α] : ↥(of α) = α :=
rfl
instance : Inhabited Locale :=
⟨of PUnit⟩
end Locale
/-- The forgetful functor from `Top` to `Locale` which forgets that the space has "enough points".
-/
@[simps!]
def topToLocale : TopCat ⥤ Locale :=
topCatOpToFrm.rightOp
-- Note, `CompHaus` is too strong. We only need `T0Space`.
instance CompHausToLocale.faithful : (compHausToTop ⋙ topToLocale.{u}).Faithful :=
⟨fun h => by
dsimp at h
exact ConcreteCategory.ext (Opens.comap_injective (congr_arg Frm.Hom.hom
(Quiver.Hom.op_inj h)))⟩ |
.lake/packages/mathlib/Mathlib/Topology/Category/Compactum.lean | import Mathlib.CategoryTheory.Monad.Types
import Mathlib.CategoryTheory.Monad.Limits
import Mathlib.CategoryTheory.Equivalence
import Mathlib.Topology.Category.CompHaus.Basic
import Mathlib.Topology.Category.Profinite.Basic
import Mathlib.Data.Set.Constructions
/-!
# Compacta and Compact Hausdorff Spaces
Recall that, given a monad `M` on `Type*`, an *algebra* for `M` consists of the following data:
- A type `X : Type*`
- A "structure" map `M X → X`.
This data must also satisfy a distributivity and unit axiom, and algebras for `M` form a category
in an evident way.
See the file `CategoryTheory.Monad.Algebra` for a general version, as well as the following link.
https://ncatlab.org/nlab/show/monad
This file proves the equivalence between the category of *compact Hausdorff topological spaces*
and the category of algebras for the *ultrafilter monad*.
## Notation:
Here are the main objects introduced in this file.
- `Compactum` is the type of compacta, which we define as algebras for the ultrafilter monad.
- `compactumToCompHaus` is the functor `Compactum ⥤ CompHaus`. Here `CompHaus` is the usual
category of compact Hausdorff spaces.
- `compactumToCompHaus.isEquivalence` is a term of type `IsEquivalence compactumToCompHaus`.
The proof of this equivalence is a bit technical. But the idea is quite simply that the structure
map `Ultrafilter X → X` for an algebra `X` of the ultrafilter monad should be considered as the map
sending an ultrafilter to its limit in `X`. The topology on `X` is then defined by mimicking the
characterization of open sets in terms of ultrafilters.
Any `X : Compactum` is endowed with a coercion to `Type*`, as well as the following instances:
- `TopologicalSpace X`.
- `CompactSpace X`.
- `T2Space X`.
Any morphism `f : X ⟶ Y` of is endowed with a coercion to a function `X → Y`, which is shown to
be continuous in `continuous_of_hom`.
The function `Compactum.ofTopologicalSpace` can be used to construct a `Compactum` from a
topological space which satisfies `CompactSpace` and `T2Space`.
We also add wrappers around structures which already exist. Here are the main ones, all in the
`Compactum` namespace:
- `forget : Compactum ⥤ Type*` is the forgetful functor, which induces a `ConcreteCategory`
instance for `Compactum`.
- `free : Type* ⥤ Compactum` is the left adjoint to `forget`, and the adjunction is in `adj`.
- `str : Ultrafilter X → X` is the structure map for `X : Compactum`.
The notation `X.str` is preferred.
- `join : Ultrafilter (Ultrafilter X) → Ultrafilter X` is the monadic join for `X : Compactum`.
Again, the notation `X.join` is preferred.
- `incl : X → Ultrafilter X` is the unit for `X : Compactum`. The notation `X.incl` is preferred.
## References
- E. Manes, Algebraic Theories, Graduate Texts in Mathematics 26, Springer-Verlag, 1976.
- https://ncatlab.org/nlab/show/ultrafilter
-/
universe u
open CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter
open scoped Topology
local notation "β" => ofTypeMonad Ultrafilter
/-- The type `Compactum` of Compacta, defined as algebras for the ultrafilter monad. -/
def Compactum :=
Monad.Algebra β deriving Category, Inhabited
namespace Compactum
/-- The forgetful functor to Type* -/
def forget : Compactum ⥤ Type* :=
Monad.forget _
instance : forget.Faithful :=
show (Monad.forget _).Faithful from inferInstance
noncomputable instance : CreatesLimits forget :=
show CreatesLimits <| Monad.forget _ from inferInstance
/-- The "free" Compactum functor. -/
def free : Type* ⥤ Compactum :=
Monad.free _
/-- The adjunction between `free` and `forget`. -/
def adj : free ⊣ forget :=
Monad.adj _
instance : CoeSort Compactum Type* :=
⟨fun X => X.A⟩
instance {X Y : Compactum} : FunLike (X ⟶ Y) X Y where
coe f := f.f
coe_injective' _ _ h := (Monad.forget_faithful β).map_injective h
-- Basic instances
instance : ConcreteCategory Compactum (· ⟶ ·) where
hom f := f
ofHom f := f
instance : HasLimits Compactum :=
hasLimits_of_hasLimits_createsLimits forget
/-- The structure map for a compactum, essentially sending an ultrafilter to its limit. -/
def str (X : Compactum) : Ultrafilter X → X :=
X.a
/-- The monadic join. -/
def join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X :=
(β).μ.app _
/-- The inclusion of `X` into `Ultrafilter X`. -/
def incl (X : Compactum) : X → Ultrafilter X :=
(β).η.app _
@[simp]
theorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by
change ((β).η.app _ ≫ X.a) _ = _
rw [Monad.Algebra.unit]
rfl
@[simp]
theorem str_hom_commute (X Y : Compactum) (f : X ⟶ Y) (xs : Ultrafilter X) :
f (X.str xs) = Y.str (map f xs) := by
change (X.a ≫ f.f) _ = _
rw [← f.h]
rfl
@[simp]
theorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) :
X.str (X.join uux) = X.str (map X.str uux) := by
change ((β).μ.app _ ≫ X.a) _ = _
rw [Monad.Algebra.assoc]
rfl
instance {X : Compactum} : TopologicalSpace X where
IsOpen U := ∀ F : Ultrafilter X, X.str F ∈ U → U ∈ F
isOpen_univ _ _ := Filter.univ_sets _
isOpen_inter _ _ h3 h4 _ h6 := Filter.inter_sets _ (h3 _ h6.1) (h4 _ h6.2)
isOpen_sUnion := fun _ h1 _ ⟨T, hT, h2⟩ =>
mem_of_superset (h1 T hT _ h2) (Set.subset_sUnion_of_mem hT)
theorem isClosed_iff {X : Compactum} (S : Set X) :
IsClosed S ↔ ∀ F : Ultrafilter X, S ∈ F → X.str F ∈ S := by
rw [← isOpen_compl_iff]
constructor
· intro cond F h
by_contra c
specialize cond F c
rw [compl_mem_iff_notMem] at cond
contradiction
· intro h1 F h2
specialize h1 F
rcases F.mem_or_compl_mem S with h | h
exacts [absurd (h1 h) h2, h]
instance {X : Compactum} : CompactSpace X := by
constructor
rw [isCompact_iff_ultrafilter_le_nhds]
intro F _
refine ⟨X.str F, by tauto, ?_⟩
rw [le_nhds_iff]
intro S h1 h2
exact h2 F h1
/-- A local definition used only in the proofs. -/
private def basic {X : Compactum} (A : Set X) : Set (Ultrafilter X) :=
{ F | A ∈ F }
/-- A local definition used only in the proofs. -/
private def cl {X : Compactum} (A : Set X) : Set X :=
X.str '' basic A
private theorem basic_inter {X : Compactum} (A B : Set X) : basic (A ∩ B) = basic A ∩ basic B := by
ext G
constructor
· intro hG
constructor <;> filter_upwards [hG] with _
exacts [And.left, And.right]
· rintro ⟨h1, h2⟩
exact inter_mem h1 h2
private theorem subset_cl {X : Compactum} (A : Set X) : A ⊆ cl A := fun a ha =>
⟨X.incl a, ha, by simp⟩
private theorem cl_cl {X : Compactum} (A : Set X) : cl (cl A) ⊆ cl A := by
rintro _ ⟨F, hF, rfl⟩
-- Notation to be used in this proof.
let fsu := Finset (Set (Ultrafilter X))
let ssu := Set (Set (Ultrafilter X))
let ι : fsu → ssu := fun x ↦ ↑x
let C0 : ssu := { Z | ∃ B ∈ F, X.str ⁻¹' B = Z }
let AA := { G : Ultrafilter X | A ∈ G }
let C1 := insert AA C0
let C2 := finiteInterClosure C1
-- C0 is closed under intersections.
have claim1 : ∀ (B) (_ : B ∈ C0) (C) (_ : C ∈ C0), B ∩ C ∈ C0 := by
rintro B ⟨Q, hQ, rfl⟩ C ⟨R, hR, rfl⟩
use Q ∩ R
simp only [and_true, Set.preimage_inter]
exact inter_sets _ hQ hR
-- All sets in C0 are nonempty.
have claim2 : ∀ B ∈ C0, Set.Nonempty B := by
rintro B ⟨Q, hQ, rfl⟩
obtain ⟨q⟩ := Filter.nonempty_of_mem hQ
use X.incl q
simpa
-- The intersection of AA with every set in C0 is nonempty.
have claim3 : ∀ B ∈ C0, (AA ∩ B).Nonempty := by
rintro B ⟨Q, hQ, rfl⟩
have : (Q ∩ cl A).Nonempty := Filter.nonempty_of_mem (inter_mem hQ hF)
rcases this with ⟨q, hq1, P, hq2, hq3⟩
refine ⟨P, hq2, ?_⟩
rw [← hq3] at hq1
simpa
-- Suffices to show that the intersection of any finite subcollection of C1 is nonempty.
suffices ∀ T : fsu, ι T ⊆ C1 → (⋂₀ ι T).Nonempty by
obtain ⟨G, h1⟩ := exists_ultrafilter_of_finite_inter_nonempty _ this
use X.join G
have : G.map X.str = F := Ultrafilter.coe_le_coe.1 fun S hS => h1 (Or.inr ⟨S, hS, rfl⟩)
rw [join_distrib, this]
exact ⟨h1 (Or.inl rfl), rfl⟩
-- C2 is closed under finite intersections (by construction!).
have claim4 := finiteInterClosure_finiteInter C1
-- C0 is closed under finite intersections by claim1.
have claim5 : FiniteInter C0 := ⟨⟨_, univ_mem, Set.preimage_univ⟩, claim1⟩
-- Every element of C2 is nonempty.
have claim6 : ∀ P ∈ C2, (P : Set (Ultrafilter X)).Nonempty := by
suffices ∀ P ∈ C2, P ∈ C0 ∨ ∃ Q ∈ C0, P = AA ∩ Q by
intro P hP
rcases this P hP with h | h
· exact claim2 _ h
· rcases h with ⟨Q, hQ, rfl⟩
exact claim3 _ hQ
intro P hP
exact claim5.finiteInterClosure_insert _ hP
intro T hT
-- Suffices to show that the intersection of the T's is contained in C2.
suffices ⋂₀ ι T ∈ C2 by exact claim6 _ this
-- Finish
apply claim4.finiteInter_mem T
intro t ht
exact finiteInterClosure.basic (@hT t ht)
theorem isClosed_cl {X : Compactum} (A : Set X) : IsClosed (cl A) := by
rw [isClosed_iff]
intro F hF
exact cl_cl _ ⟨F, hF, rfl⟩
theorem str_eq_of_le_nhds {X : Compactum} (F : Ultrafilter X) (x : X) : ↑F ≤ 𝓝 x → X.str F = x := by
-- Notation to be used in this proof.
let fsu := Finset (Set (Ultrafilter X))
let ssu := Set (Set (Ultrafilter X))
let ι : fsu → ssu := fun x ↦ ↑x
let T0 : ssu := { S | ∃ A ∈ F, S = basic A }
let AA := X.str ⁻¹' {x}
let T1 := insert AA T0
let T2 := finiteInterClosure T1
intro cond
-- If F contains a closed set A, then x is contained in A.
have claim1 : ∀ A : Set X, IsClosed A → A ∈ F → x ∈ A := by
intro A hA h
by_contra H
rw [le_nhds_iff] at cond
specialize cond Aᶜ H hA.isOpen_compl
rw [Ultrafilter.mem_coe, Ultrafilter.compl_mem_iff_notMem] at cond
contradiction
-- If A ∈ F, then x ∈ cl A.
have claim2 : ∀ A : Set X, A ∈ F → x ∈ cl A := by
intro A hA
exact claim1 (cl A) (isClosed_cl A) (mem_of_superset hA (subset_cl A))
-- T0 is closed under intersections.
have claim3 : ∀ (S1) (_ : S1 ∈ T0) (S2) (_ : S2 ∈ T0), S1 ∩ S2 ∈ T0 := by
rintro S1 ⟨S1, hS1, rfl⟩ S2 ⟨S2, hS2, rfl⟩
exact ⟨S1 ∩ S2, inter_mem hS1 hS2, by simp [basic_inter]⟩
-- For every S ∈ T0, the intersection AA ∩ S is nonempty.
have claim4 : ∀ S ∈ T0, (AA ∩ S).Nonempty := by
rintro S ⟨S, hS, rfl⟩
rcases claim2 _ hS with ⟨G, hG, hG2⟩
exact ⟨G, hG2, hG⟩
-- Every element of T0 is nonempty.
have claim5 : ∀ S ∈ T0, Set.Nonempty S := by
rintro S ⟨S, hS, rfl⟩
exact ⟨F, hS⟩
-- Every element of T2 is nonempty.
have claim6 : ∀ S ∈ T2, Set.Nonempty S := by
suffices ∀ S ∈ T2, S ∈ T0 ∨ ∃ Q ∈ T0, S = AA ∩ Q by
intro S hS
rcases this _ hS with h | h
· exact claim5 S h
· rcases h with ⟨Q, hQ, rfl⟩
exact claim4 Q hQ
intro S hS
apply finiteInterClosure_insert
· constructor
· use Set.univ
refine ⟨Filter.univ_sets _, ?_⟩
ext
refine ⟨?_, by tauto⟩
· intro
apply Filter.univ_sets
· exact claim3
· exact hS
-- It suffices to show that the intersection of any finite subset of T1 is nonempty.
suffices ∀ F : fsu, ↑F ⊆ T1 → (⋂₀ ι F).Nonempty by
obtain ⟨G, h1⟩ := Ultrafilter.exists_ultrafilter_of_finite_inter_nonempty _ this
have c1 : X.join G = F := Ultrafilter.coe_le_coe.1 fun P hP => h1 (Or.inr ⟨P, hP, rfl⟩)
have c2 : G.map X.str = X.incl x := by
refine Ultrafilter.coe_le_coe.1 fun P hP => ?_
apply mem_of_superset (h1 (Or.inl rfl))
rintro x ⟨rfl⟩
exact hP
simp [← c1, c2]
-- Finish...
intro T hT
refine claim6 _ (finiteInter_mem (.finiteInterClosure_finiteInter _) _ ?_)
intro t ht
exact finiteInterClosure.basic (@hT t ht)
theorem le_nhds_of_str_eq {X : Compactum} (F : Ultrafilter X) (x : X) : X.str F = x → ↑F ≤ 𝓝 x :=
fun h => le_nhds_iff.mpr fun s hx hs => hs _ <| by rwa [h]
-- All the hard work above boils down to this `T2Space` instance.
instance {X : Compactum} : T2Space X := by
rw [t2_iff_ultrafilter]
intro _ _ F hx hy
rw [← str_eq_of_le_nhds _ _ hx, ← str_eq_of_le_nhds _ _ hy]
/-- The structure map of a compactum actually computes limits. -/
theorem lim_eq_str {X : Compactum} (F : Ultrafilter X) : F.lim = X.str F := by
rw [Ultrafilter.lim_eq_iff_le_nhds, le_nhds_iff]
tauto
theorem cl_eq_closure {X : Compactum} (A : Set X) : cl A = closure A := by
ext
rw [mem_closure_iff_ultrafilter]
constructor
· rintro ⟨F, h1, h2⟩
exact ⟨F, h1, le_nhds_of_str_eq _ _ h2⟩
· rintro ⟨F, h1, h2⟩
exact ⟨F, h1, str_eq_of_le_nhds _ _ h2⟩
/-- Any morphism of compacta is continuous. -/
theorem continuous_of_hom {X Y : Compactum} (f : X ⟶ Y) : Continuous f := by
rw [continuous_iff_ultrafilter]
intro x g h
rw [Tendsto, ← coe_map]
apply le_nhds_of_str_eq
rw [← str_hom_commute, str_eq_of_le_nhds _ x _]
apply h
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
[T2Space X] : Compactum where
A := X
a := Ultrafilter.lim
unit := by
ext x
exact lim_eq (pure_le_nhds _)
assoc := by
ext FF
change Ultrafilter (Ultrafilter X) at FF
set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
intro U F h1 hU
exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
rw [le_nhds_iff]
intro U hx hU
exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
intro U hx hU
suffices Ultrafilter.lim ⁻¹' U ∈ FF by
apply mem_of_superset this
intro P hP
exact c2 U P hP hU
exact @c3 U (IsOpen.mem_nhds hU hx)
apply lim_eq
rw [le_nhds_iff]
exact c4
/-- Any continuous map between Compacta is a morphism of compacta. -/
def homOfContinuous {X Y : Compactum} (f : X → Y) (cont : Continuous f) : X ⟶ Y :=
{ f
h := by
rw [continuous_iff_ultrafilter] at cont
ext (F : Ultrafilter X)
specialize cont (X.str F) F (le_nhds_of_str_eq F (X.str F) rfl)
simp only [types_comp_apply]
exact str_eq_of_le_nhds (Ultrafilter.map f F) _ cont }
end Compactum
/-- The functor from Compactum to CompHaus. -/
def compactumToCompHaus : Compactum ⥤ CompHaus where
obj X := { toTop := TopCat.of X, prop := trivial }
map := fun f => CompHausLike.ofHom _
{ toFun := f
continuous_toFun := Compactum.continuous_of_hom _ }
namespace compactumToCompHaus
/-- The functor `compactumToCompHaus` is full. -/
instance full : compactumToCompHaus.{u}.Full where
map_surjective f := ⟨Compactum.homOfContinuous f.1 f.hom.2, rfl⟩
/-- The functor `compactumToCompHaus` is faithful. -/
instance faithful : compactumToCompHaus.Faithful where
-- Porting note: this used to be obviously (though it consumed a bit of memory)
map_injective := by
intro _ _ _ _ h
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext` gets confused by coercion using forget.
apply Monad.Algebra.Hom.ext
apply congrArg (fun f => f.hom.toFun) h
/-- This definition is used to prove essential surjectivity of `compactumToCompHaus`. -/
noncomputable def isoOfTopologicalSpace {D : CompHaus} :
compactumToCompHaus.obj (Compactum.ofTopologicalSpace D) ≅ D where
hom := CompHausLike.ofHom _
{ toFun := id
continuous_toFun :=
continuous_def.2 fun _ h => by
rw [isOpen_iff_ultrafilter'] at h
exact h }
inv := CompHausLike.ofHom _
{ toFun := id
continuous_toFun :=
continuous_def.2 fun _ h1 => by
rw [isOpen_iff_ultrafilter']
intro _ h2
exact h1 _ h2 }
/-- The functor `compactumToCompHaus` is essentially surjective. -/
instance essSurj : compactumToCompHaus.EssSurj :=
{ mem_essImage := fun X => ⟨Compactum.ofTopologicalSpace X, ⟨isoOfTopologicalSpace⟩⟩ }
/-- The functor `compactumToCompHaus` is an equivalence of categories. -/
instance isEquivalence : compactumToCompHaus.IsEquivalence where
end compactumToCompHaus
/-- The forgetful functors of `Compactum` and `CompHaus` are compatible via
`compactumToCompHaus`. -/
def compactumToCompHausCompForget :
compactumToCompHaus ⋙ CategoryTheory.forget CompHaus ≅ Compactum.forget :=
NatIso.ofComponents fun _ => eqToIso rfl
/-
TODO: `forget CompHaus` is monadic, as it is isomorphic to the composition
of an equivalence with the monadic functor `forget Compactum`.
Once we have the API to transfer monadicity of functors along such isomorphisms,
the instance `CreatesLimits (forget CompHaus)` can be deduced from this
monadicity.
-/
noncomputable instance CompHaus.forgetCreatesLimits : CreatesLimits (forget CompHaus) := by
let e : forget CompHaus ≅ compactumToCompHaus.inv ⋙ Compactum.forget :=
(((forget CompHaus).leftUnitor.symm ≪≫
Functor.isoWhiskerRight compactumToCompHaus.asEquivalence.symm.unitIso (forget CompHaus)) ≪≫
compactumToCompHaus.inv.associator compactumToCompHaus (forget CompHaus)) ≪≫
Functor.isoWhiskerLeft _ compactumToCompHausCompForget
exact createsLimitsOfNatIso e.symm
noncomputable instance Profinite.forgetCreatesLimits : CreatesLimits (forget Profinite) := by
change CreatesLimits (profiniteToCompHaus ⋙ forget _)
infer_instance |
.lake/packages/mathlib/Mathlib/Topology/Category/LightProfinite/EffectiveEpi.lean | import Mathlib.Topology.Category.CompHausLike.EffectiveEpi
import Mathlib.Topology.Category.LightProfinite.Limits
/-!
# Effective epimorphisms in `LightProfinite`
This file proves that `EffectiveEpi` and `Surjective` are equivalent in `LightProfinite`.
As a consequence we deduce from the material in
`Mathlib/Topology/Category/CompHausLike/EffectiveEpi.lean` that `LightProfinite` is `Preregular`
and `Precoherent`.
-/
universe u
open CategoryTheory Limits CompHausLike
namespace LightProfinite
theorem effectiveEpi_iff_surjective {X Y : LightProfinite.{u}} (f : X ⟶ Y) :
EffectiveEpi f ↔ Function.Surjective f := by
refine ⟨fun h ↦ ?_, fun h ↦ ⟨⟨effectiveEpiStruct f h⟩⟩⟩
rw [← epi_iff_surjective]
infer_instance
instance : Preregular LightProfinite.{u} := by
apply CompHausLike.preregular
intro _ _ f
exact (effectiveEpi_iff_surjective f).mp
example : Precoherent LightProfinite.{u} := inferInstance
end LightProfinite |
.lake/packages/mathlib/Mathlib/Topology/Category/LightProfinite/Sequence.lean | import Mathlib.Topology.Compactification.OnePoint.Basic
import Mathlib.Topology.Category.LightProfinite.Basic
/-!
# The light profinite set classifying convergent sequences
This file defines the light profinite set `ℕ∪{∞}`, defined as the one point compactification of
`ℕ`.
-/
open CategoryTheory OnePoint TopologicalSpace Topology
namespace LightProfinite
/-- The continuous map from `ℕ∪{∞}` to `ℝ` sending `n` to `1/(n+1)` and `∞` to `0`. -/
noncomputable def natUnionInftyEmbedding : C(OnePoint ℕ, ℝ) where
toFun
| ∞ => 0
| OnePoint.some n => 1 / (n + 1 : ℝ)
continuous_toFun := OnePoint.continuous_iff_from_nat _ |>.mpr
tendsto_one_div_add_atTop_nhds_zero_nat
/--
The continuous map from `ℕ∪{∞}` to `ℝ` sending `n` to `1/(n+1)` and `∞` to `0` is a closed
embedding.
-/
lemma isClosedEmbedding_natUnionInftyEmbedding : IsClosedEmbedding natUnionInftyEmbedding := by
refine .of_continuous_injective_isClosedMap
natUnionInftyEmbedding.continuous ?_ ?_
· rintro (_ | n) (_ | m) h
· rfl
· simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, zero_eq_inv] at h
assumption_mod_cast
· simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, inv_eq_zero] at h
assumption_mod_cast
· simp only [natUnionInftyEmbedding, one_div, ContinuousMap.coe_mk, inv_inj, add_left_inj,
Nat.cast_inj] at h
rw [h]
· exact fun _ hC => (hC.isCompact.image natUnionInftyEmbedding.continuous).isClosed
instance : MetrizableSpace (OnePoint ℕ) := isClosedEmbedding_natUnionInftyEmbedding.metrizableSpace
/-- The one point compactification of the natural numbers as a light profinite set. -/
abbrev NatUnionInfty : LightProfinite := of (OnePoint ℕ)
@[inherit_doc]
scoped notation "ℕ∪{∞}" => NatUnionInfty
instance : Coe ℕ ℕ∪{∞} := optionCoe
open Filter Topology
lemma continuous_iff_convergent {Y : Type*} [TopologicalSpace Y] (f : ℕ∪{∞} → Y) :
Continuous f ↔ Tendsto (fun x : ℕ ↦ f x) atTop (𝓝 (f ∞)) :=
continuous_iff_from_nat f
end LightProfinite |
.lake/packages/mathlib/Mathlib/Topology/Category/LightProfinite/Basic.lean | import Mathlib.CategoryTheory.Limits.Shapes.Countable
import Mathlib.Topology.Category.Profinite.AsLimit
import Mathlib.Topology.Category.Profinite.CofilteredLimit
import Mathlib.Topology.ClopenBox
/-!
# Light profinite spaces
We construct the category `LightProfinite` of light profinite topological spaces. These are
implemented as totally disconnected second countable compact Hausdorff spaces.
This file also defines the category `LightDiagram`, which consists of those spaces that can be
written as a sequential limit (in `Profinite`) of finite sets.
We define an equivalence of categories `LightProfinite ≌ LightDiagram` and prove that these are
essentially small categories.
## Implementation
The category `LightProfinite` is defined using the structure `CompHausLike`. See the file
`CompHausLike.Basic` for more information.
-/
/- The basic API for `LightProfinite` is largely copied from the API of `Profinite`;
where possible, try to keep them in sync -/
universe v u
open CategoryTheory Limits Opposite FintypeCat Topology TopologicalSpace CompHausLike
/-- `LightProfinite` is the category of second countable profinite spaces. -/
abbrev LightProfinite := CompHausLike
(fun X ↦ TotallyDisconnectedSpace X ∧ SecondCountableTopology X)
namespace LightProfinite
instance (X : Type*) [TopologicalSpace X]
[TotallyDisconnectedSpace X] [SecondCountableTopology X] : HasProp (fun Y ↦
TotallyDisconnectedSpace Y ∧ SecondCountableTopology Y) X :=
⟨⟨(inferInstance : TotallyDisconnectedSpace X), (inferInstance : SecondCountableTopology X)⟩⟩
/--
Construct a term of `LightProfinite` from a type endowed with the structure of a compact,
Hausdorff, totally disconnected and second countable topological space.
-/
abbrev of (X : Type*) [TopologicalSpace X] [CompactSpace X] [T2Space X]
[TotallyDisconnectedSpace X] [SecondCountableTopology X] : LightProfinite :=
CompHausLike.of _ X
instance : Inhabited LightProfinite :=
⟨LightProfinite.of PEmpty⟩
instance {X : LightProfinite} : TotallyDisconnectedSpace X :=
X.prop.1
instance {X : LightProfinite} : SecondCountableTopology X :=
X.prop.2
end LightProfinite
/-- The fully faithful embedding of `LightProfinite` in `Profinite`. -/
abbrev lightToProfinite : LightProfinite ⥤ Profinite :=
CompHausLike.toCompHausLike (fun _ ↦ inferInstance)
/-- `lightToProfinite` is fully faithful. -/
abbrev lightToProfiniteFullyFaithful : lightToProfinite.FullyFaithful :=
fullyFaithfulToCompHausLike _
/-- The fully faithful embedding of `LightProfinite` in `CompHaus`. -/
abbrev lightProfiniteToCompHaus : LightProfinite ⥤ CompHaus :=
compHausLikeToCompHaus _
/-- The fully faithful embedding of `LightProfinite` in `TopCat`.
This is definitionally the same as the obvious composite. -/
abbrev LightProfinite.toTopCat : LightProfinite ⥤ TopCat :=
CompHausLike.compHausLikeToTop _
section DiscreteTopology
attribute [local instance] FintypeCat.botTopology
attribute [local instance] FintypeCat.discreteTopology
/-- The natural functor from `Fintype` to `LightProfinite`, endowing a finite type with the
discrete topology. -/
@[simps! -isSimp map_hom_apply]
def FintypeCat.toLightProfinite : FintypeCat ⥤ LightProfinite where
obj A := LightProfinite.of A
map f := CompHausLike.ofHom _ ⟨f, by continuity⟩
/-- `FintypeCat.toLightProfinite` is fully faithful. -/
def FintypeCat.toLightProfiniteFullyFaithful : toLightProfinite.FullyFaithful where
preimage f := (f : _ → _)
map_preimage _ := rfl
preimage_map _ := rfl
instance : FintypeCat.toLightProfinite.Faithful :=
FintypeCat.toLightProfiniteFullyFaithful.faithful
instance : FintypeCat.toLightProfinite.Full :=
FintypeCat.toLightProfiniteFullyFaithful.full
instance (X : FintypeCat.{u}) : Fintype (FintypeCat.toLightProfinite.obj X) :=
inferInstanceAs (Fintype X)
instance (X : FintypeCat.{u}) : Fintype (LightProfinite.of X) := inferInstanceAs (Fintype X)
end DiscreteTopology
namespace LightProfinite
instance {J : Type v} [SmallCategory J] (F : J ⥤ LightProfinite.{max u v}) :
TotallyDisconnectedSpace
(CompHaus.limitCone.{v, u} (F ⋙ lightProfiniteToCompHaus)).pt.toTop := by
change TotallyDisconnectedSpace ({ u : ∀ j : J, F.obj j | _ } : Type _)
exact Subtype.totallyDisconnectedSpace
/-- An explicit limit cone for a functor `F : J ⥤ LightProfinite`, for a countable category `J`
defined in terms of `CompHaus.limitCone`, which is defined in terms of `TopCat.limitCone`. -/
def limitCone {J : Type v} [SmallCategory J] [CountableCategory J]
(F : J ⥤ LightProfinite.{max u v}) :
Limits.Cone F where
pt :=
{ toTop := (CompHaus.limitCone.{v, u} (F ⋙ lightProfiniteToCompHaus)).pt.toTop
prop := by
constructor
· infer_instance
· change SecondCountableTopology ({ u : ∀ j : J, F.obj j | _ } : Type _)
apply IsInducing.subtypeVal.secondCountableTopology }
π :=
{ app := (CompHaus.limitCone.{v, u} (F ⋙ lightProfiniteToCompHaus)).π.app
naturality := by
intro j k f
ext ⟨g, p⟩
exact (p f).symm }
/-- The limit cone `LightProfinite.limitCone F` is indeed a limit cone. -/
def limitConeIsLimit {J : Type v} [SmallCategory J] [CountableCategory J]
(F : J ⥤ LightProfinite.{max u v}) :
Limits.IsLimit (limitCone F) where
lift S :=
(CompHaus.limitConeIsLimit.{v, u} (F ⋙ lightProfiniteToCompHaus)).lift
(lightProfiniteToCompHaus.mapCone S)
uniq S _ h := (CompHaus.limitConeIsLimit.{v, u} _).uniq (lightProfiniteToCompHaus.mapCone S) _ h
noncomputable instance createsCountableLimits {J : Type v} [SmallCategory J] [CountableCategory J] :
CreatesLimitsOfShape J lightToProfinite.{max v u} where
CreatesLimit {F} :=
createsLimitOfFullyFaithfulOfIso (limitCone.{v, u} F).pt <|
(Profinite.limitConeIsLimit.{v, u} (F ⋙ lightToProfinite)).conePointUniqueUpToIso
(limit.isLimit _)
instance : HasCountableLimits LightProfinite where
out _ := { has_limit := fun F ↦ ⟨limitCone F, limitConeIsLimit F⟩ }
instance : PreservesLimitsOfShape ℕᵒᵖ (forget LightProfinite.{u}) :=
have : PreservesLimitsOfSize.{0, 0} (forget Profinite.{u}) := preservesLimitsOfSize_shrink _
inferInstanceAs (PreservesLimitsOfShape ℕᵒᵖ (lightToProfinite ⋙ forget Profinite))
variable {X Y : LightProfinite.{u}} (f : X ⟶ Y)
/-- Any morphism of light profinite spaces is a closed map. -/
theorem isClosedMap : IsClosedMap f :=
CompHausLike.isClosedMap _
/-- Any continuous bijection of light profinite spaces induces an isomorphism. -/
theorem isIso_of_bijective (bij : Function.Bijective f) : IsIso f :=
haveI := CompHausLike.isIso_of_bijective (lightProfiniteToCompHaus.map f) bij
isIso_of_fully_faithful lightProfiniteToCompHaus _
/-- Any continuous bijection of light profinite spaces induces an isomorphism. -/
noncomputable def isoOfBijective (bij : Function.Bijective f) : X ≅ Y :=
letI := LightProfinite.isIso_of_bijective f bij
asIso f
instance forget_reflectsIsomorphisms : (forget LightProfinite).ReflectsIsomorphisms := by
constructor
intro A B f hf
rw [isIso_iff_bijective] at hf
exact LightProfinite.isIso_of_bijective _ hf
theorem epi_iff_surjective {X Y : LightProfinite.{u}} (f : X ⟶ Y) :
Epi f ↔ Function.Surjective f := by
constructor
· -- Note: in mathlib3 `contrapose` saw through `Function.Surjective`.
dsimp [Function.Surjective]
contrapose!
rintro ⟨y, hy⟩ hf
let C := Set.range f
have hC : IsClosed C := (isCompact_range f.hom.continuous).isClosed
let U := Cᶜ
have hyU : y ∈ U := by
refine Set.mem_compl ?_
rintro ⟨y', hy'⟩
exact hy y' hy'
have hUy : U ∈ 𝓝 y := hC.compl_mem_nhds hyU
obtain ⟨V, hV, hyV, hVU⟩ := isTopologicalBasis_isClopen.mem_nhds_iff.mp hUy
classical
let Z := of (ULift.{u} <| Fin 2)
let g : Y ⟶ Z := CompHausLike.ofHom _
⟨(LocallyConstant.ofIsClopen hV).map ULift.up, LocallyConstant.continuous _⟩
let h : Y ⟶ Z := CompHausLike.ofHom _ ⟨fun _ => ⟨1⟩, continuous_const⟩
have H : h = g := by
rw [← cancel_epi f]
ext x
dsimp [g, LocallyConstant.ofIsClopen]
rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, hom_ofHom, ContinuousMap.coe_mk,
Function.comp_apply, if_neg]
refine mt (fun α => hVU α) ?_
simp [U, C]
apply_fun fun e => (e y).down at H
dsimp [g, LocallyConstant.ofIsClopen] at H
rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Function.comp_apply, if_pos hyV] at H
exact top_ne_bot H
· rw [← CategoryTheory.epi_iff_surjective]
apply (forget LightProfinite).epi_of_epi_map
instance : lightToProfinite.PreservesEpimorphisms where
preserves f _ := (Profinite.epi_iff_surjective _).mpr ((epi_iff_surjective f).mp inferInstance)
end LightProfinite
/-- A structure containing the data of sequential limit in `Profinite` of finite sets. -/
structure LightDiagram : Type (u+1) where
/-- The indexing diagram. -/
diagram : ℕᵒᵖ ⥤ FintypeCat
/-- The limit cone. -/
cone : Cone (diagram ⋙ FintypeCat.toProfinite.{u})
/-- The limit cone is limiting. -/
isLimit : IsLimit cone
namespace LightDiagram
/-- The underlying `Profinite` of a `LightDiagram`. -/
def toProfinite (S : LightDiagram) : Profinite := S.cone.pt
@[simps!]
instance : Category LightDiagram := InducedCategory.category toProfinite
instance hasForget : ConcreteCategory LightDiagram (fun X Y => C(X.toProfinite, Y.toProfinite)) :=
InducedCategory.concreteCategory toProfinite
end LightDiagram
/-- The fully faithful embedding `LightDiagram ⥤ Profinite` -/
@[simps!]
def lightDiagramToProfinite : LightDiagram ⥤ Profinite := inducedFunctor _
instance : lightDiagramToProfinite.Faithful := show (inducedFunctor _).Faithful from inferInstance
instance : lightDiagramToProfinite.Full := show (inducedFunctor _).Full from inferInstance
namespace LightProfinite
instance (S : LightProfinite) : Countable (Clopens S) := by
rw [TopologicalSpace.Clopens.countable_iff_secondCountable]
infer_instance
instance instCountableDiscreteQuotient (S : LightProfinite) :
Countable (DiscreteQuotient ((lightToProfinite.obj S))) :=
(DiscreteQuotient.finsetClopens_inj S).countable
/-- A profinite space which is light gives rise to a light profinite space. -/
noncomputable def toLightDiagram (S : LightProfinite.{u}) : LightDiagram.{u} where
diagram := IsCofiltered.sequentialFunctor _ ⋙ (lightToProfinite.obj S).fintypeDiagram
cone := (Functor.Initial.limitConeComp (IsCofiltered.sequentialFunctor _)
(lightToProfinite.obj S).lim).cone
isLimit := (Functor.Initial.limitConeComp (IsCofiltered.sequentialFunctor _)
(lightToProfinite.obj S).lim).isLimit
end LightProfinite
/-- The functor part of the equivalence `LightProfinite ≌ LightDiagram` -/
@[simps]
noncomputable def lightProfiniteToLightDiagram : LightProfinite.{u} ⥤ LightDiagram.{u} where
obj X := X.toLightDiagram
map f := f
open scoped Classical in
instance (S : LightDiagram.{u}) : SecondCountableTopology S.cone.pt := by
rw [← TopologicalSpace.Clopens.countable_iff_secondCountable]
refine @Countable.of_equiv _ _ ?_ (LocallyConstant.equivClopens (X := S.cone.pt))
refine @Function.Surjective.countable
(Σ (n : ℕ), LocallyConstant ((S.diagram ⋙ FintypeCat.toProfinite).obj ⟨n⟩) (Fin 2)) _ ?_ ?_ ?_
· apply @instCountableSigma _ _ _ ?_
intro n
refine @Finite.to_countable _ ?_
refine @Finite.of_injective _ ((S.diagram ⋙ FintypeCat.toProfinite).obj ⟨n⟩ → (Fin 2)) ?_ _
LocallyConstant.coe_injective
refine @Pi.finite _ _ ?_ _
simp only [Functor.comp_obj]
exact show (Finite (S.diagram.obj _)) from inferInstance
· exact fun a ↦ a.snd.comap (S.cone.π.app ⟨a.fst⟩).hom
· intro a
obtain ⟨n, g, h⟩ := Profinite.exists_locallyConstant S.cone S.isLimit a
exact ⟨⟨unop n, g⟩, h.symm⟩
/-- The inverse part of the equivalence `LightProfinite ≌ LightDiagram` -/
@[simps obj map]
def lightDiagramToLightProfinite : LightDiagram.{u} ⥤ LightProfinite.{u} where
obj X := LightProfinite.of X.cone.pt
map f := f
/-- The equivalence of categories `LightProfinite ≌ LightDiagram` -/
noncomputable def LightProfinite.equivDiagram : LightProfinite.{u} ≌ LightDiagram.{u} where
functor := lightProfiniteToLightDiagram
inverse := lightDiagramToLightProfinite
unitIso := Iso.refl _
counitIso := NatIso.ofComponents
(fun _ ↦ lightDiagramToProfinite.preimageIso (Iso.refl _)) (by
intro _ _ f
simp only [Functor.comp_obj, lightDiagramToLightProfinite_obj,
lightProfiniteToLightDiagram_obj, Functor.id_obj, Functor.comp_map,
lightDiagramToLightProfinite_map, lightProfiniteToLightDiagram_map,
lightDiagramToProfinite_obj, Functor.preimageIso_hom, Iso.refl_hom, Functor.id_map]
erw [lightDiagramToProfinite.preimage_id, lightDiagramToProfinite.preimage_id,
Category.comp_id f])
functor_unitIso_comp _ := by simpa using lightDiagramToProfinite.preimage_id
instance : lightProfiniteToLightDiagram.IsEquivalence :=
show LightProfinite.equivDiagram.functor.IsEquivalence from inferInstance
instance : lightDiagramToLightProfinite.IsEquivalence :=
show LightProfinite.equivDiagram.inverse.IsEquivalence from inferInstance
noncomputable section EssentiallySmall
open LightDiagram
/--
This is an auxiliary definition used to show that `LightDiagram` is essentially small.
Note that below we put a category instance on this structure which is completely different from the
category instance on `ℕᵒᵖ ⥤ FintypeCat.Skeleton.{u}`. Neither the morphisms nor the objects are the
same.
-/
structure LightDiagram' : Type u where
/-- The diagram takes values in a small category equivalent to `FintypeCat`. -/
diagram : ℕᵒᵖ ⥤ FintypeCat.Skeleton.{u}
/-- A `LightDiagram'` yields a `Profinite`. -/
def LightDiagram'.toProfinite (S : LightDiagram') : Profinite :=
limit (S.diagram ⋙ FintypeCat.Skeleton.equivalence.functor ⋙ FintypeCat.toProfinite.{u})
instance : Category LightDiagram' := InducedCategory.category LightDiagram'.toProfinite
/-- The functor part of the equivalence of categories `LightDiagram' ≌ LightDiagram`. -/
def LightDiagram'.toLightFunctor : LightDiagram'.{u} ⥤ LightDiagram.{u} where
obj X := ⟨X.diagram ⋙ Skeleton.equivalence.functor, _, limit.isLimit _⟩
map f := f
instance : LightDiagram'.toLightFunctor.{u}.Faithful := ⟨id⟩
instance : LightDiagram'.toLightFunctor.{u}.Full where
map_surjective f := ⟨f, rfl⟩
instance : LightDiagram'.toLightFunctor.{u}.EssSurj where
mem_essImage Y :=
⟨⟨Y.diagram ⋙ Skeleton.equivalence.inverse⟩, ⟨lightDiagramToProfinite.preimageIso (
(Limits.lim.mapIso (Functor.isoWhiskerRight ((Functor.isoWhiskerLeft Y.diagram
Skeleton.equivalence.counitIso)) toProfinite)) ≪≫
(limit.isLimit _).conePointUniqueUpToIso Y.isLimit)⟩⟩
instance : LightDiagram'.toLightFunctor.IsEquivalence where
/-- The equivalence between `LightDiagram` and a small category. -/
def LightDiagram.equivSmall : LightDiagram.{u} ≌ LightDiagram'.{u} :=
LightDiagram'.toLightFunctor.asEquivalence.symm
instance : EssentiallySmall.{u} LightDiagram.{u} where
equiv_smallCategory := ⟨LightDiagram', inferInstance, ⟨LightDiagram.equivSmall⟩⟩
instance : EssentiallySmall.{u} LightProfinite.{u} where
equiv_smallCategory := ⟨LightDiagram', inferInstance,
⟨LightProfinite.equivDiagram.trans LightDiagram.equivSmall⟩⟩
end EssentiallySmall |
.lake/packages/mathlib/Mathlib/Topology/Category/LightProfinite/Limits.lean | import Mathlib.Topology.Category.CompHausLike.Limits
import Mathlib.Topology.Category.LightProfinite.Basic
/-!
# Explicit limits and colimits
This file applies the general API for explicit limits and colimits in `CompHausLike P` (see
the file `Mathlib/Topology/Category/CompHausLike/Limits.lean`) to the special case of
`LightProfinite`.
-/
namespace LightProfinite
universe u w
open CategoryTheory Limits CompHausLike
instance : HasExplicitPullbacks
(fun Y ↦ TotallyDisconnectedSpace Y ∧ SecondCountableTopology Y) where
hasProp _ _ := {
hasProp := ⟨show TotallyDisconnectedSpace {_xy : _ | _} from inferInstance,
show SecondCountableTopology {_xy : _ | _} from inferInstance⟩ }
instance : HasExplicitFiniteCoproducts.{w, u}
(fun Y ↦ TotallyDisconnectedSpace Y ∧ SecondCountableTopology Y) where
hasProp _ := { hasProp :=
⟨show TotallyDisconnectedSpace (Σ (_a : _), _) from inferInstance,
show SecondCountableTopology (Σ (_a : _), _) from inferInstance⟩ }
/-- A one-element space is terminal in `Profinite` -/
abbrev isTerminalPUnit : IsTerminal (LightProfinite.of PUnit.{u + 1}) :=
CompHausLike.isTerminalPUnit
example : FinitaryExtensive LightProfinite.{u} := inferInstance
noncomputable example : PreservesFiniteCoproducts lightProfiniteToCompHaus.{u} := inferInstance
end LightProfinite |
.lake/packages/mathlib/Mathlib/Topology/Category/LightProfinite/Extend.lean | import Mathlib.Topology.Category.LightProfinite.AsLimit
import Mathlib.Topology.Category.Profinite.Extend
/-!
# Extending cones in `LightProfinite`
Let `(Sₙ)_{n : ℕᵒᵖ}` be a sequential inverse system of finite sets and let `S` be
its limit in `Profinite`. Let `G` be a functor from `LightProfinite` to a category `C` and suppose
that `G` preserves the limit described above. Suppose further that the projection maps `S ⟶ Sₙ` are
epimorphic for all `n`. Then `G.obj S` is isomorphic to a limit indexed by
`StructuredArrow S toLightProfinite` (see `LightProfinite.Extend.isLimitCone`).
We also provide the dual result for a functor of the form `G : LightProfiniteᵒᵖ ⥤ C`.
We apply this to define `LightProfinite.diagram'`, `LightProfinite.asLimitCone'`, and
`LightProfinite.asLimit'`, analogues to their unprimed versions in
`Mathlib/Topology/Category/LightProfinite/AsLimit.lean`, in which the
indexing category is `StructuredArrow S toLightProfinite` instead of `ℕᵒᵖ`.
-/
universe u
open CategoryTheory Limits FintypeCat Functor
attribute [local instance] FintypeCat.discreteTopology
namespace LightProfinite
variable {F : ℕᵒᵖ ⥤ FintypeCat.{u}} (c : Cone <| F ⋙ toLightProfinite)
namespace Extend
/--
Given a sequential cone in `LightProfinite` consisting of finite sets,
we obtain a functor from the indexing category to `StructuredArrow c.pt toLightProfinite`.
-/
@[simps]
def functor : ℕᵒᵖ ⥤ StructuredArrow c.pt toLightProfinite where
obj i := StructuredArrow.mk (c.π.app i)
map f := StructuredArrow.homMk (F.map f) (c.w f)
-- We check that the original diagram factors through `LightProfinite.Extend.functor`.
example : functor c ⋙ StructuredArrow.proj c.pt toLightProfinite ≅ F := Iso.refl _
/--
Given a sequential cone in `LightProfinite` consisting of finite sets,
we obtain a functor from the opposite of the indexing category to
`CostructuredArrow toProfinite.op ⟨c.pt⟩`.
-/
@[simps! obj map]
def functorOp : ℕ ⥤ CostructuredArrow toLightProfinite.op ⟨c.pt⟩ :=
(functor c).rightOp ⋙ StructuredArrow.toCostructuredArrow _ _
-- We check that the opposite of the original diagram factors through `Profinite.Extend.functorOp`.
example : functorOp c ⋙ CostructuredArrow.proj toLightProfinite.op ⟨c.pt⟩ ≅ F.rightOp := Iso.refl _
-- We check that `Profinite.Extend.functor` factors through `LightProfinite.Extend.functor`,
-- via the equivalence `StructuredArrow.post _ _ lightToProfinite`.
example : functor c ⋙ (StructuredArrow.post _ _ lightToProfinite) =
Profinite.Extend.functor (lightToProfinite.mapCone c) := rfl
/--
If the projection maps in the cone are epimorphic and the cone is limiting, then
`LightProfinite.Extend.functor` is initial.
-/
theorem functor_initial (hc : IsLimit c) [∀ i, Epi (c.π.app i)] : Initial (functor c) := by
rw [initial_iff_comp_equivalence _ (StructuredArrow.post _ _ lightToProfinite)]
have : ∀ i, Epi ((lightToProfinite.mapCone c).π.app i) :=
fun i ↦ inferInstanceAs (Epi (lightToProfinite.map (c.π.app i)))
exact Profinite.Extend.functor_initial _ (isLimitOfPreserves lightToProfinite hc)
/--
If the projection maps in the cone are epimorphic and the cone is limiting, then
`LightProfinite.Extend.functorOp` is final.
-/
theorem functorOp_final (hc : IsLimit c) [∀ i, Epi (c.π.app i)] : Final (functorOp c) := by
have := functor_initial c hc
have : ((StructuredArrow.toCostructuredArrow toLightProfinite c.pt)).IsEquivalence :=
(inferInstance : (structuredArrowOpEquivalence _ _).functor.IsEquivalence )
have : (functor c).rightOp.Final :=
inferInstanceAs ((opOpEquivalence ℕ).inverse ⋙ (functor c).op).Final
exact Functor.final_comp (functor c).rightOp _
section Limit
variable {C : Type*} [Category C] (G : LightProfinite ⥤ C)
/--
Given a functor `G` from `LightProfinite` and `S : LightProfinite`, we obtain a cone on
`(StructuredArrow.proj S toLightProfinite ⋙ toLightProfinite ⋙ G)` with cone point `G.obj S`.
Whiskering this cone with `LightProfinite.Extend.functor c` gives `G.mapCone c` as we check in the
example below.
-/
def cone (S : LightProfinite) :
Cone (StructuredArrow.proj S toLightProfinite ⋙ toLightProfinite ⋙ G) where
pt := G.obj S
π := {
app := fun i ↦ G.map i.hom
naturality := fun _ _ f ↦ (by
have := f.w
simp only [const_obj_obj, StructuredArrow.left_eq_id, const_obj_map, Category.id_comp,
StructuredArrow.w] at this
simp only [const_obj_obj, comp_obj, StructuredArrow.proj_obj, const_obj_map, Category.id_comp,
Functor.comp_map, StructuredArrow.proj_map, ← map_comp, StructuredArrow.w]) }
example : G.mapCone c = (cone G c.pt).whisker (functor c) := rfl
/--
If `c` and `G.mapCone c` are limit cones and the projection maps in `c` are epimorphic,
then `cone G c.pt` is a limit cone.
-/
noncomputable
def isLimitCone (hc : IsLimit c) [∀ i, Epi (c.π.app i)] (hc' : IsLimit <| G.mapCone c) :
IsLimit (cone G c.pt) := (functor_initial c hc).isLimitWhiskerEquiv _ _ hc'
end Limit
section Colimit
variable {C : Type*} [Category C] (G : LightProfiniteᵒᵖ ⥤ C)
/--
Given a functor `G` from `LightProfiniteᵒᵖ` and `S : LightProfinite`, we obtain a cocone on
`(CostructuredArrow.proj toLightProfinite.op ⟨S⟩ ⋙ toLightProfinite.op ⋙ G)` with cocone point
`G.obj ⟨S⟩`.
Whiskering this cocone with `LightProfinite.Extend.functorOp c` gives `G.mapCocone c.op` as we
check in the example below.
-/
@[simps]
def cocone (S : LightProfinite) :
Cocone (CostructuredArrow.proj toLightProfinite.op ⟨S⟩ ⋙ toLightProfinite.op ⋙ G) where
pt := G.obj ⟨S⟩
ι := {
app := fun i ↦ G.map i.hom
naturality := fun _ _ f ↦ (by
have := f.w
simp only [op_obj, const_obj_obj, op_map, CostructuredArrow.right_eq_id, const_obj_map,
Category.comp_id] at this
simp only [comp_obj, CostructuredArrow.proj_obj, op_obj, const_obj_obj, Functor.comp_map,
CostructuredArrow.proj_map, op_map, ← map_comp, this, const_obj_map, Category.comp_id]) }
example : G.mapCocone c.op = (cocone G c.pt).whisker
((opOpEquivalence ℕ).functor ⋙ functorOp c) := rfl
/--
If `c` is a limit cone, `G.mapCocone c.op` is a colimit cone and the projection maps in `c`
are epimorphic, then `cocone G c.pt` is a colimit cone.
-/
noncomputable
def isColimitCocone (hc : IsLimit c) [∀ i, Epi (c.π.app i)] (hc' : IsColimit <| G.mapCocone c.op) :
IsColimit (cocone G c.pt) :=
haveI := functorOp_final c hc
(Functor.final_comp (opOpEquivalence ℕ).functor (functorOp c)).isColimitWhiskerEquiv _ _ hc'
end Colimit
end Extend
open Extend
section LightProfiniteAsLimit
variable (S : LightProfinite.{u})
/--
A functor `StructuredArrow S toLightProfinite ⥤ FintypeCat` whose limit in `LightProfinite` is
isomorphic to `S`.
-/
abbrev fintypeDiagram' : StructuredArrow S toLightProfinite ⥤ FintypeCat :=
StructuredArrow.proj S toLightProfinite
/-- An abbreviation for `S.fintypeDiagram' ⋙ toLightProfinite`. -/
abbrev diagram' : StructuredArrow S toLightProfinite ⥤ LightProfinite :=
S.fintypeDiagram' ⋙ toLightProfinite
/-- A cone over `S.diagram'` whose cone point is `S`. -/
def asLimitCone' : Cone (S.diagram') := cone (𝟭 _) S
instance (i : ℕᵒᵖ) : Epi (S.asLimitCone.π.app i) :=
(epi_iff_surjective _).mpr (S.proj_surjective _)
/-- `S.asLimitCone'` is a limit cone. -/
noncomputable def asLimit' : IsLimit S.asLimitCone' := isLimitCone _ (𝟭 _) S.asLimit S.asLimit
/-- A bundled version of `S.asLimitCone'` and `S.asLimit'`. -/
noncomputable def lim' : LimitCone S.diagram' := ⟨S.asLimitCone', S.asLimit'⟩
end LightProfiniteAsLimit
end LightProfinite |
.lake/packages/mathlib/Mathlib/Topology/Category/LightProfinite/AsLimit.lean | import Mathlib.Topology.Category.LightProfinite.Basic
/-!
# Light profinite sets as limits of finite sets.
We show that any light profinite set is isomorphic to a sequential limit of finite sets.
The limit cone for `S : LightProfinite` is `S.asLimitCone`, the fact that it's a limit is
`S.asLimit`.
We also prove that the projection and transition maps in this limit are surjective.
-/
noncomputable section
open CategoryTheory Limits CompHausLike
namespace LightProfinite
universe u
variable (S : LightProfinite.{u})
/-- The functor `ℕᵒᵖ ⥤ FintypeCat` whose limit is isomorphic to `S`. -/
abbrev fintypeDiagram : ℕᵒᵖ ⥤ FintypeCat := S.toLightDiagram.diagram
/-- An abbreviation for `S.fintypeDiagram ⋙ FintypeCat.toProfinite`. -/
abbrev diagram : ℕᵒᵖ ⥤ LightProfinite := S.fintypeDiagram ⋙ FintypeCat.toLightProfinite
/--
A cone over `S.diagram` whose cone point is isomorphic to `S`.
(Auxiliary definition, use `S.asLimitCone` instead.)
-/
def asLimitConeAux : Cone S.diagram :=
let c : Cone (S.diagram ⋙ lightToProfinite) := S.toLightDiagram.cone
let hc : IsLimit c := S.toLightDiagram.isLimit
liftLimit hc
/-- An auxiliary isomorphism of cones used to prove that `S.asLimitConeAux` is a limit cone. -/
def isoMapCone : lightToProfinite.mapCone S.asLimitConeAux ≅ S.toLightDiagram.cone :=
let c : Cone (S.diagram ⋙ lightToProfinite) := S.toLightDiagram.cone
let hc : IsLimit c := S.toLightDiagram.isLimit
liftedLimitMapsToOriginal hc
/--
`S.asLimitConeAux` is indeed a limit cone.
(Auxiliary definition, use `S.asLimit` instead.)
-/
def asLimitAux : IsLimit S.asLimitConeAux :=
let hc : IsLimit (lightToProfinite.mapCone S.asLimitConeAux) :=
S.toLightDiagram.isLimit.ofIsoLimit S.isoMapCone.symm
isLimitOfReflects lightToProfinite hc
/-- A cone over `S.diagram` whose cone point is `S`. -/
def asLimitCone : Cone S.diagram where
pt := S
π := {
app := fun n ↦ (lightToProfiniteFullyFaithful.preimageIso <|
(Cones.forget _).mapIso S.isoMapCone).inv ≫ S.asLimitConeAux.π.app n
naturality := fun _ _ _ ↦ by simp only [Category.assoc, S.asLimitConeAux.w]; rfl }
/-- `S.asLimitCone` is indeed a limit cone. -/
def asLimit : IsLimit S.asLimitCone := S.asLimitAux.ofIsoLimit <|
Cones.ext (lightToProfiniteFullyFaithful.preimageIso <|
(Cones.forget _).mapIso S.isoMapCone) (fun _ ↦ by rw [← @Iso.inv_comp_eq]; rfl)
/-- A bundled version of `S.asLimitCone` and `S.asLimit`. -/
def lim : Limits.LimitCone S.diagram := ⟨S.asLimitCone, S.asLimit⟩
/-- The projection from `S` to the `n`th component of `S.diagram`. -/
abbrev proj (n : ℕ) : S ⟶ S.diagram.obj ⟨n⟩ := S.asLimitCone.π.app ⟨n⟩
lemma lightToProfinite_map_proj_eq (n : ℕ) : lightToProfinite.map (S.proj n) =
(lightToProfinite.obj S).asLimitCone.π.app _ := by
simp only [Functor.comp_obj, toCompHausLike_map]
let c : Cone (S.diagram ⋙ lightToProfinite) := S.toLightDiagram.cone
let hc : IsLimit c := S.toLightDiagram.isLimit
exact liftedLimitMapsToOriginal_inv_map_π hc _
lemma proj_surjective (n : ℕ) : Function.Surjective (S.proj n) := by
change Function.Surjective (lightToProfinite.map (S.proj n))
rw [lightToProfinite_map_proj_eq]
exact DiscreteQuotient.proj_surjective _
/-- An abbreviation for the `n`th component of `S.diagram`. -/
abbrev component (n : ℕ) : LightProfinite := S.diagram.obj ⟨n⟩
/-- The transition map from `S_{n+1}` to `S_n` in `S.diagram`. -/
abbrev transitionMap (n : ℕ) : S.component (n + 1) ⟶ S.component n :=
S.diagram.map ⟨homOfLE (Nat.le_succ _)⟩
/-- The transition map from `S_m` to `S_n` in `S.diagram`, when `m ≤ n`. -/
abbrev transitionMapLE {n m : ℕ} (h : n ≤ m) : S.component m ⟶ S.component n :=
S.diagram.map ⟨homOfLE h⟩
lemma proj_comp_transitionMap (n : ℕ) :
S.proj (n + 1) ≫ S.diagram.map ⟨homOfLE (Nat.le_succ _)⟩ = S.proj n :=
S.asLimitCone.w (homOfLE (Nat.le_succ n)).op
lemma proj_comp_transitionMap' (n : ℕ) : S.transitionMap n ∘ S.proj (n + 1) = S.proj n := by
rw [← S.proj_comp_transitionMap n]
rfl
lemma proj_comp_transitionMapLE {n m : ℕ} (h : n ≤ m) :
S.proj m ≫ S.diagram.map ⟨homOfLE h⟩ = S.proj n :=
S.asLimitCone.w (homOfLE h).op
lemma proj_comp_transitionMapLE' {n m : ℕ} (h : n ≤ m) :
S.transitionMapLE h ∘ S.proj m = S.proj n := by
rw [← S.proj_comp_transitionMapLE h]
rfl
lemma surjective_transitionMap (n : ℕ) : Function.Surjective (S.transitionMap n) := by
apply Function.Surjective.of_comp (g := S.proj (n + 1))
simpa only [proj_comp_transitionMap'] using S.proj_surjective n
lemma surjective_transitionMapLE {n m : ℕ} (h : n ≤ m) :
Function.Surjective (S.transitionMapLE h) := by
apply Function.Surjective.of_comp (g := S.proj m)
simpa only [proj_comp_transitionMapLE'] using S.proj_surjective n
end LightProfinite |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Yoneda.lean | import Mathlib.CategoryTheory.Limits.Preserves.Finite
import Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products
import Mathlib.CategoryTheory.Limits.Types.Products
import Mathlib.Topology.Category.TopCat.Limits.Products
/-!
# Yoneda presheaves on topologically concrete categories
This file develops some API for "topologically concrete" categories, defining universe polymorphic
"Yoneda presheaves" on such categories.
-/
universe w w' v u
open CategoryTheory Opposite Limits
variable {C : Type u} [Category.{v} C] (F : C ⥤ TopCat.{w}) (Y : Type w') [TopologicalSpace Y]
namespace ContinuousMap
/--
A universe polymorphic "Yoneda presheaf" on `C` given by continuous maps into a topological space
`Y`.
-/
@[simps]
def yonedaPresheaf : Cᵒᵖ ⥤ Type (max w w') where
obj X := C(F.obj (unop X), Y)
map f g := ContinuousMap.comp g (F.map f.unop).hom
/--
A universe polymorphic Yoneda presheaf on `TopCat` given by continuous maps into a topological
space `Y`.
-/
@[simps]
def yonedaPresheaf' : TopCat.{w}ᵒᵖ ⥤ Type (max w w') where
obj X := C((unop X).1, Y)
map f g := ContinuousMap.comp g f.unop.hom
theorem comp_yonedaPresheaf' : yonedaPresheaf F Y = F.op ⋙ yonedaPresheaf' Y := rfl
theorem piComparison_fac {α : Type} (X : α → TopCat) :
piComparison (yonedaPresheaf'.{w, w'} Y) (fun x ↦ op (X x)) =
(yonedaPresheaf' Y).map ((opCoproductIsoProduct X).inv ≫ (TopCat.sigmaIsoSigma X).inv.op) ≫
(equivEquivIso (sigmaEquiv Y (fun x ↦ (X x).1))).inv ≫ (Types.productIso _).inv := by
rw [← Category.assoc, Iso.eq_comp_inv]
ext
simp only [yonedaPresheaf', unop_op, piComparison, types_comp_apply,
Types.productIso_hom_comp_eval_apply, Types.pi_lift_π_apply, comp_apply, TopCat.coe_of,
unop_comp, Quiver.Hom.unop_op, sigmaEquiv, equivEquivIso_hom, Equiv.toIso_inv,
Equiv.coe_fn_symm_mk, comp_assoc, sigmaMk_apply, ← opCoproductIsoProduct_inv_comp_ι]
rfl
/-- The universe polymorphic Yoneda presheaf on `TopCat` preserves finite products. -/
noncomputable instance : PreservesFiniteProducts (yonedaPresheaf'.{w, w'} Y) where
preserves _ :=
{ preservesLimit := fun {K} =>
have : ∀ {α : Type} (X : α → TopCat), PreservesLimit (Discrete.functor (fun x ↦ op (X x)))
(yonedaPresheaf'.{w, w'} Y) := fun X => @PreservesProduct.of_iso_comparison _ _ _ _
(yonedaPresheaf' Y) _ (fun x ↦ op (X x)) _ _ (by rw [piComparison_fac]; infer_instance)
let i : K ≅ Discrete.functor (fun i ↦ op (unop (K.obj ⟨i⟩))) := Discrete.natIsoFunctor
preservesLimit_of_iso_diagram _ i.symm }
end ContinuousMap |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/EpiMono.lean | import Mathlib.Topology.Category.TopCat.Adjunctions
import Mathlib.CategoryTheory.Functor.EpiMono
/-!
# Epi- and monomorphisms in `Top`
This file shows that a continuous function is an epimorphism in the category of topological spaces
if and only if it is surjective, and that a continuous function is a monomorphism in the category of
topological spaces if and only if it is injective.
-/
universe u
open CategoryTheory
open TopCat
namespace TopCat
theorem epi_iff_surjective {X Y : TopCat.{u}} (f : X ⟶ Y) : Epi f ↔ Function.Surjective f := by
suffices Epi f ↔ Epi ((forget TopCat).map f) by
rw [this, CategoryTheory.epi_iff_surjective]
rfl
constructor
· intro
infer_instance
· apply Functor.epi_of_epi_map
theorem mono_iff_injective {X Y : TopCat.{u}} (f : X ⟶ Y) : Mono f ↔ Function.Injective f := by
suffices Mono f ↔ Mono ((forget TopCat).map f) by
rw [this, CategoryTheory.mono_iff_injective]
rfl
constructor
· intro
infer_instance
· apply Functor.mono_of_mono_map
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Opens.lean | import Mathlib.CategoryTheory.Category.GaloisConnection
import Mathlib.CategoryTheory.EqToHom
import Mathlib.Topology.Category.TopCat.EpiMono
import Mathlib.Topology.Sets.Opens
/-!
# The category of open sets in a topological space.
We define `toTopCat : Opens X ⥤ TopCat` and
`map (f : X ⟶ Y) : Opens Y ⥤ Opens X`, given by taking preimages of open sets.
Unfortunately `Opens` isn't (usefully) a functor `TopCat ⥤ Cat`.
(One can in fact define such a functor,
but using it results in unresolvable `Eq.rec` terms in goals.)
Really it's a 2-functor from (spaces, continuous functions, equalities)
to (categories, functors, natural isomorphisms).
We don't attempt to set up the full theory here, but do provide the natural isomorphisms
`mapId : map (𝟙 X) ≅ 𝟭 (Opens X)` and
`mapComp : map (f ≫ g) ≅ map g ⋙ map f`.
Beyond that, there's a collection of simp lemmas for working with these constructions.
-/
open CategoryTheory TopologicalSpace Opposite Topology
universe u
namespace TopologicalSpace.Opens
variable {X Y Z : TopCat.{u}} {U V W : Opens X}
/-!
Since `Opens X` has a partial order, it automatically receives a `Category` instance.
Unfortunately, because we do not allow morphisms in `Prop`,
the morphisms `U ⟶ V` are not just proofs `U ≤ V`, but rather
`ULift (PLift (U ≤ V))`.
-/
instance opensHom.instFunLike : FunLike (U ⟶ V) U V where
coe f := Set.inclusion f.le
coe_injective' := by rintro ⟨⟨_⟩⟩ _ _; congr!
lemma apply_def (f : U ⟶ V) (x : U) : f x = ⟨x, f.le x.2⟩ := rfl
@[simp] lemma apply_mk (f : U ⟶ V) (x : X) (hx) : f ⟨x, hx⟩ = ⟨x, f.le hx⟩ := rfl
@[simp] lemma val_apply (f : U ⟶ V) (x : U) : (f x : X) = x := rfl
@[simp, norm_cast] lemma coe_id (f : U ⟶ U) : ⇑f = id := rfl
lemma id_apply (f : U ⟶ U) (x : U) : f x = x := rfl
@[simp] lemma comp_apply (f : U ⟶ V) (g : V ⟶ W) (x : U) : (f ≫ g) x = g (f x) := rfl
/-!
We now construct as morphisms various inclusions of open sets.
-/
-- This is tedious, but necessary because we decided not to allow Prop as morphisms in a category...
/-- The inclusion `U ⊓ V ⟶ U` as a morphism in the category of open sets.
-/
noncomputable def infLELeft (U V : Opens X) : U ⊓ V ⟶ U :=
inf_le_left.hom
/-- The inclusion `U ⊓ V ⟶ V` as a morphism in the category of open sets.
-/
noncomputable def infLERight (U V : Opens X) : U ⊓ V ⟶ V :=
inf_le_right.hom
/-- The inclusion `U i ⟶ iSup U` as a morphism in the category of open sets.
-/
noncomputable def leSupr {ι : Type*} (U : ι → Opens X) (i : ι) : U i ⟶ iSup U :=
(le_iSup U i).hom
/-- The inclusion `⊥ ⟶ U` as a morphism in the category of open sets.
-/
noncomputable def botLE (U : Opens X) : ⊥ ⟶ U :=
bot_le.hom
/-- The inclusion `U ⟶ ⊤` as a morphism in the category of open sets.
-/
noncomputable def leTop (U : Opens X) : U ⟶ ⊤ :=
le_top.hom
-- We do not mark this as a simp lemma because it breaks open `x`.
-- Nevertheless, it is useful in `SheafOfFunctions`.
theorem infLELeft_apply (U V : Opens X) (x) :
(infLELeft U V) x = ⟨x.1, (@inf_le_left _ _ U V : _ ≤ _) x.2⟩ :=
rfl
@[simp]
theorem infLELeft_apply_mk (U V : Opens X) (x) (m) :
(infLELeft U V) ⟨x, m⟩ = ⟨x, (@inf_le_left _ _ U V : _ ≤ _) m⟩ :=
rfl
@[simp]
theorem leSupr_apply_mk {ι : Type*} (U : ι → Opens X) (i : ι) (x) (m) :
(leSupr U i) ⟨x, m⟩ = ⟨x, (le_iSup U i :) m⟩ :=
rfl
/-- The functor from open sets in `X` to `TopCat`,
realising each open set as a topological space itself.
-/
def toTopCat (X : TopCat.{u}) : Opens X ⥤ TopCat where
obj U := TopCat.of U
map i := TopCat.ofHom ⟨fun x ↦ ⟨x.1, i.le x.2⟩,
IsEmbedding.subtypeVal.continuous_iff.2 continuous_induced_dom⟩
@[simp]
theorem toTopCat_map (X : TopCat.{u}) {U V : Opens X} {f : U ⟶ V} {x} {h} :
((toTopCat X).map f) ⟨x, h⟩ = ⟨x, f.le h⟩ :=
rfl
/-- The inclusion map from an open subset to the whole space, as a morphism in `TopCat`.
-/
@[simps! -fullyApplied]
def inclusion' {X : TopCat.{u}} (U : Opens X) : (toTopCat X).obj U ⟶ X :=
TopCat.ofHom
{ toFun := _
continuous_toFun := continuous_subtype_val }
@[simp]
theorem coe_inclusion' {X : TopCat} {U : Opens X} :
(inclusion' U : U → X) = Subtype.val := rfl
theorem isOpenEmbedding {X : TopCat.{u}} (U : Opens X) : IsOpenEmbedding (inclusion' U) :=
U.2.isOpenEmbedding_subtypeVal
/-- The inclusion of the top open subset (i.e. the whole space) is an isomorphism.
-/
def inclusionTopIso (X : TopCat.{u}) : (toTopCat X).obj ⊤ ≅ X where
hom := inclusion' ⊤
inv := TopCat.ofHom ⟨fun x => ⟨x, trivial⟩, continuous_def.2 fun _ ⟨_, hS, hSU⟩ => hSU ▸ hS⟩
/-- `Opens.map f` gives the functor from open sets in Y to open set in X,
given by taking preimages under f. -/
def map (f : X ⟶ Y) : Opens Y ⥤ Opens X where
obj U := ⟨f ⁻¹' (U : Set Y), U.isOpen.preimage f.hom.continuous⟩
map i := ⟨⟨fun _ h => i.le h⟩⟩
@[simp]
theorem map_coe (f : X ⟶ Y) (U : Opens Y) : ((map f).obj U : Set X) = f ⁻¹' (U : Set Y) :=
rfl
@[simp]
theorem map_obj (f : X ⟶ Y) (U) (p) : (map f).obj ⟨U, p⟩ = ⟨f ⁻¹' U, p.preimage f.hom.continuous⟩ :=
rfl
@[simp]
lemma map_homOfLE (f : X ⟶ Y) {U V : Opens Y} (e : U ≤ V) :
(TopologicalSpace.Opens.map f).map (homOfLE e) =
homOfLE (show (Opens.map f).obj U ≤ (Opens.map f).obj V from fun _ hx ↦ e hx) :=
rfl
@[simp]
theorem map_id_obj (U : Opens X) : (map (𝟙 X)).obj U = U :=
let ⟨_, _⟩ := U
rfl
@[simp]
theorem map_id_obj' (U) (p) : (map (𝟙 X)).obj ⟨U, p⟩ = ⟨U, p⟩ :=
rfl
theorem map_id_obj_unop (U : (Opens X)ᵒᵖ) : (map (𝟙 X)).obj (unop U) = unop U := by
simp
theorem op_map_id_obj (U : (Opens X)ᵒᵖ) : (map (𝟙 X)).op.obj U = U := by simp
@[simp]
lemma map_top (f : X ⟶ Y) : (Opens.map f).obj ⊤ = ⊤ := rfl
/-- The inclusion `U ⟶ (map f).obj ⊤` as a morphism in the category of open sets.
-/
noncomputable def leMapTop (f : X ⟶ Y) (U : Opens X) : U ⟶ (map f).obj ⊤ :=
leTop U
@[simp]
theorem map_comp_obj (f : X ⟶ Y) (g : Y ⟶ Z) (U) :
(map (f ≫ g)).obj U = (map f).obj ((map g).obj U) :=
rfl
@[simp]
theorem map_comp_obj' (f : X ⟶ Y) (g : Y ⟶ Z) (U) (p) :
(map (f ≫ g)).obj ⟨U, p⟩ = (map f).obj ((map g).obj ⟨U, p⟩) :=
rfl
@[simp]
theorem map_comp_map (f : X ⟶ Y) (g : Y ⟶ Z) {U V} (i : U ⟶ V) :
(map (f ≫ g)).map i = (map f).map ((map g).map i) :=
rfl
@[simp]
theorem map_comp_obj_unop (f : X ⟶ Y) (g : Y ⟶ Z) (U) :
(map (f ≫ g)).obj (unop U) = (map f).obj ((map g).obj (unop U)) :=
rfl
@[simp]
theorem op_map_comp_obj (f : X ⟶ Y) (g : Y ⟶ Z) (U) :
(map (f ≫ g)).op.obj U = (map f).op.obj ((map g).op.obj U) :=
rfl
theorem map_iSup (f : X ⟶ Y) {ι : Type*} (U : ι → Opens Y) :
(map f).obj (iSup U) = iSup ((map f).obj ∘ U) := by
ext
simp
section
variable (X)
/-- The functor `Opens X ⥤ Opens X` given by taking preimages under the identity function
is naturally isomorphic to the identity functor.
-/
@[simps]
def mapId : map (𝟙 X) ≅ 𝟭 (Opens X) where
hom := { app := fun U => eqToHom (map_id_obj U) }
inv := { app := fun U => eqToHom (map_id_obj U).symm }
theorem map_id_eq : map (𝟙 X) = 𝟭 (Opens X) := by
rfl
end
/-- The natural isomorphism between taking preimages under `f ≫ g`, and the composite
of taking preimages under `g`, then preimages under `f`.
-/
@[simps]
def mapComp (f : X ⟶ Y) (g : Y ⟶ Z) : map (f ≫ g) ≅ map g ⋙ map f where
hom := { app := fun U => eqToHom (map_comp_obj f g U) }
inv := { app := fun U => eqToHom (map_comp_obj f g U).symm }
theorem map_comp_eq (f : X ⟶ Y) (g : Y ⟶ Z) : map (f ≫ g) = map g ⋙ map f :=
rfl
-- We could make `f g` implicit here, but it's nice to be able to see when
-- they are the identity (often!)
/-- If two continuous maps `f g : X ⟶ Y` are equal,
then the functors `Opens Y ⥤ Opens X` they induce are isomorphic.
-/
def mapIso (f g : X ⟶ Y) (h : f = g) : map f ≅ map g :=
NatIso.ofComponents fun U => eqToIso (by rw [congr_arg map h])
theorem map_eq (f g : X ⟶ Y) (h : f = g) : map f = map g := by
subst h
rfl
@[simp]
theorem mapIso_refl (f : X ⟶ Y) (h) : mapIso f f h = Iso.refl (map _) :=
rfl
@[simp]
theorem mapIso_hom_app (f g : X ⟶ Y) (h : f = g) (U : Opens Y) :
(mapIso f g h).hom.app U = eqToHom (by rw [h]) :=
rfl
@[simp]
theorem mapIso_inv_app (f g : X ⟶ Y) (h : f = g) (U : Opens Y) :
(mapIso f g h).inv.app U = eqToHom (by rw [h]) :=
rfl
/-- A homeomorphism of spaces gives an equivalence of categories of open sets.
TODO: define `OrderIso.equivalence`, use it.
-/
@[simps]
def mapMapIso {X Y : TopCat.{u}} (H : X ≅ Y) : Opens Y ≌ Opens X where
functor := map H.hom
inverse := map H.inv
unitIso := NatIso.ofComponents fun U => eqToIso (by simp [map, Set.preimage_preimage])
counitIso := NatIso.ofComponents fun U => eqToIso (by simp [map, Set.preimage_preimage])
end TopologicalSpace.Opens
/-- An open map `f : X ⟶ Y` induces a functor `Opens X ⥤ Opens Y`.
-/
@[simps obj_coe]
def IsOpenMap.functor {X Y : TopCat} {f : X ⟶ Y} (hf : IsOpenMap f) : Opens X ⥤ Opens Y where
obj U := ⟨f '' (U : Set X), hf (U : Set X) U.2⟩
map h := ⟨⟨Set.image_mono h.down.down⟩⟩
/-- An open map `f : X ⟶ Y` induces an adjunction between `Opens X` and `Opens Y`.
-/
def IsOpenMap.adjunction {X Y : TopCat} {f : X ⟶ Y} (hf : IsOpenMap f) :
hf.functor ⊣ Opens.map f where
unit := { app := fun _ => homOfLE fun x hxU => ⟨x, hxU, rfl⟩ }
counit := { app := fun _ => homOfLE fun _ ⟨_, hfxV, hxy⟩ => hxy ▸ hfxV }
instance IsOpenMap.functorFullOfMono {X Y : TopCat} {f : X ⟶ Y} (hf : IsOpenMap f) [H : Mono f] :
hf.functor.Full where
map_surjective i :=
⟨homOfLE fun x hx => by
obtain ⟨y, hy, eq⟩ := i.le ⟨x, hx, rfl⟩
exact (TopCat.mono_iff_injective f).mp H eq ▸ hy, rfl⟩
instance IsOpenMap.functor_faithful {X Y : TopCat} {f : X ⟶ Y} (hf : IsOpenMap f) :
hf.functor.Faithful where
lemma Topology.IsOpenEmbedding.functor_obj_injective {X Y : TopCat} {f : X ⟶ Y}
(hf : IsOpenEmbedding f) : Function.Injective hf.isOpenMap.functor.obj :=
fun _ _ e ↦ Opens.ext (Set.image_injective.mpr hf.injective (congr_arg (↑· : Opens Y → Set Y) e))
namespace Topology.IsInducing
/-- Given an inducing map `X ⟶ Y` and some `U : Opens X`, this is the union of all open sets
whose preimage is `U`. This is right adjoint to `Opens.map`. -/
@[nolint unusedArguments]
def functorObj {X Y : TopCat} {f : X ⟶ Y} (_ : IsInducing f) (U : Opens X) : Opens Y :=
sSup { s : Opens Y | (Opens.map f).obj s = U }
lemma map_functorObj {X Y : TopCat} {f : X ⟶ Y} (hf : IsInducing f)
(U : Opens X) :
(Opens.map f).obj (hf.functorObj U) = U := by
apply le_antisymm
· rintro x ⟨_, ⟨s, rfl⟩, _, ⟨rfl : _ = U, rfl⟩, hx : f x ∈ s⟩; exact hx
· intro x hx
obtain ⟨U, hU⟩ := U
obtain ⟨t, ht, rfl⟩ := hf.isOpen_iff.mp hU
exact Opens.mem_sSup.mpr ⟨⟨_, ht⟩, rfl, hx⟩
lemma mem_functorObj_iff {X Y : TopCat} {f : X ⟶ Y} (hf : IsInducing f) (U : Opens X)
{x : X} : f x ∈ hf.functorObj U ↔ x ∈ U := by
conv_rhs => rw [← hf.map_functorObj U]
rfl
lemma le_functorObj_iff {X Y : TopCat} {f : X ⟶ Y} (hf : IsInducing f) {U : Opens X}
{V : Opens Y} : V ≤ hf.functorObj U ↔ (Opens.map f).obj V ≤ U := by
obtain ⟨U, hU⟩ := U
obtain ⟨t, ht, rfl⟩ := hf.isOpen_iff.mp hU
constructor
· exact fun i x hx ↦ (hf.mem_functorObj_iff ((Opens.map f).obj ⟨t, ht⟩)).mp (i hx)
· intro h x hx
refine Opens.mem_sSup.mpr ⟨⟨_, V.2.union ht⟩, Opens.ext ?_, Set.mem_union_left t hx⟩
dsimp
rwa [Set.union_eq_right]
/-- An inducing map `f : X ⟶ Y` induces a Galois insertion between `Opens Y` and `Opens X`. -/
def opensGI {X Y : TopCat} {f : X ⟶ Y} (hf : IsInducing f) :
GaloisInsertion (Opens.map f).obj hf.functorObj :=
⟨_, fun _ _ ↦ hf.le_functorObj_iff.symm, fun U ↦ (hf.map_functorObj U).ge, fun _ _ ↦ rfl⟩
/-- An inducing map `f : X ⟶ Y` induces a functor `Opens X ⥤ Opens Y`. -/
@[simps]
def functor {X Y : TopCat} {f : X ⟶ Y} (hf : IsInducing f) :
Opens X ⥤ Opens Y where
obj := hf.functorObj
map {U V} h := homOfLE (hf.le_functorObj_iff.mpr ((hf.map_functorObj U).trans_le h.le))
/-- An inducing map `f : X ⟶ Y` induces an adjunction between `Opens Y` and `Opens X`. -/
def adjunction {X Y : TopCat} {f : X ⟶ Y} (hf : IsInducing f) :
Opens.map f ⊣ hf.functor :=
hf.opensGI.gc.adjunction
end Topology.IsInducing
namespace TopologicalSpace.Opens
open TopologicalSpace
@[simp]
theorem isOpenEmbedding_obj_top {X : TopCat} (U : Opens X) :
U.isOpenEmbedding.isOpenMap.functor.obj ⊤ = U := by
ext1
exact Set.image_univ.trans Subtype.range_coe
@[simp]
theorem inclusion'_map_eq_top {X : TopCat} (U : Opens X) : (Opens.map U.inclusion').obj U = ⊤ := by
ext1
exact Subtype.coe_preimage_self _
@[simp]
theorem adjunction_counit_app_self {X : TopCat} (U : Opens X) :
U.isOpenEmbedding.isOpenMap.adjunction.counit.app U = eqToHom (by simp) := Subsingleton.elim _ _
theorem inclusion'_top_functor (X : TopCat) :
(@Opens.isOpenEmbedding X ⊤).isOpenMap.functor = map (inclusionTopIso X).inv := by
refine CategoryTheory.Functor.ext ?_ ?_
· intro U
ext x
exact ⟨fun ⟨⟨_, _⟩, h, rfl⟩ => h, fun h => ⟨⟨x, trivial⟩, h, rfl⟩⟩
· subsingleton
theorem functor_obj_map_obj {X Y : TopCat} {f : X ⟶ Y} (hf : IsOpenMap f) (U : Opens Y) :
hf.functor.obj ((Opens.map f).obj U) = hf.functor.obj ⊤ ⊓ U := by
ext
constructor
· rintro ⟨x, hx, rfl⟩
exact ⟨⟨x, trivial, rfl⟩, hx⟩
· rintro ⟨⟨x, -, rfl⟩, hx⟩
exact ⟨x, hx, rfl⟩
lemma set_range_inclusion' {X : TopCat} (U : Opens X) :
Set.range (inclusion' U) = (U : Set X) := by
ext x
constructor
· rintro ⟨x, rfl⟩
exact x.2
· intro h
exact ⟨⟨x, h⟩, rfl⟩
@[simp]
theorem functor_map_eq_inf {X : TopCat} (U V : Opens X) :
U.isOpenEmbedding.isOpenMap.functor.obj ((Opens.map U.inclusion').obj V) = V ⊓ U := by
ext1
simp only [IsOpenMap.coe_functor_obj, map_coe, coe_inf,
Set.image_preimage_eq_inter_range, set_range_inclusion' U]
theorem map_functor_eq' {X U : TopCat} (f : U ⟶ X) (hf : IsOpenEmbedding f) (V) :
((Opens.map f).obj <| hf.isOpenMap.functor.obj V) = V :=
Opens.ext <| Set.preimage_image_eq _ hf.injective
@[simp]
theorem map_functor_eq {X : TopCat} {U : Opens X} (V : Opens U) :
((Opens.map U.inclusion').obj <| U.isOpenEmbedding.isOpenMap.functor.obj V) = V :=
TopologicalSpace.Opens.map_functor_eq' _ U.isOpenEmbedding V
@[simp]
theorem adjunction_counit_map_functor {X : TopCat} {U : Opens X} (V : Opens U) :
U.isOpenEmbedding.isOpenMap.adjunction.counit.app (U.isOpenEmbedding.isOpenMap.functor.obj V) =
eqToHom (by dsimp; rw [map_functor_eq V]) := by
subsingleton
end TopologicalSpace.Opens |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/EffectiveEpi.lean | import Mathlib.CategoryTheory.EffectiveEpi.RegularEpi
import Mathlib.Topology.Category.TopCat.Limits.Pullbacks
/-!
# Effective epimorphisms in `TopCat`
This file proves the result `TopCat.effectiveEpi_iff_isQuotientMap`:
The effective epimorphisms in `TopCat` are precisely the quotient maps.
-/
universe u
open CategoryTheory Limits Topology
namespace TopCat
/--
Implementation: If `π` is a morphism in `TopCat` which is a quotient map, then it is an effective
epimorphism. The theorem `TopCat.effectiveEpi_iff_isQuotientMap` should be used instead of
this definition.
-/
noncomputable
def effectiveEpiStructOfQuotientMap {B X : TopCat.{u}} (π : X ⟶ B) (hπ : IsQuotientMap π) :
EffectiveEpiStruct π where
/- `IsQuotientMap.lift` gives the required morphism -/
desc e h := ofHom <| hπ.lift e.hom fun a b hab ↦
CategoryTheory.congr_fun (h
(ofHom ⟨fun _ ↦ a, continuous_const⟩)
(ofHom ⟨fun _ ↦ b, continuous_const⟩)
(by ext; exact hab)) a
/- `IsQuotientMap.lift_comp` gives the factorisation -/
fac e h := hom_ext (hπ.lift_comp e.hom
fun a b hab ↦ CategoryTheory.congr_fun (h
(ofHom ⟨fun _ ↦ a, continuous_const⟩)
(ofHom ⟨fun _ ↦ b, continuous_const⟩)
(by ext; exact hab)) a)
/- Uniqueness follows from the fact that `IsQuotientMap.lift` is an equivalence (given by
`IsQuotientMap.liftEquiv`). -/
uniq e h g hm := by
suffices g = ofHom (hπ.liftEquiv ⟨e.hom,
fun a b hab ↦ CategoryTheory.congr_fun (h
(ofHom ⟨fun _ ↦ a, continuous_const⟩)
(ofHom ⟨fun _ ↦ b, continuous_const⟩)
(by ext; exact hab))
a⟩) by assumption
apply hom_ext
rw [hom_ofHom, ← Equiv.symm_apply_eq hπ.liftEquiv]
ext
simp only [IsQuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm]
rfl
/-- The effective epimorphisms in `TopCat` are precisely the quotient maps. -/
theorem effectiveEpi_iff_isQuotientMap {B X : TopCat.{u}} (π : X ⟶ B) :
EffectiveEpi π ↔ IsQuotientMap π := by
/- The backward direction is given by `effectiveEpiStructOfQuotientMap` above. -/
refine ⟨fun _ ↦ ?_, fun hπ ↦ ⟨⟨effectiveEpiStructOfQuotientMap π hπ⟩⟩⟩
/- Since `TopCat` has pullbacks, `π` is in fact a `RegularEpi`. This means that it exhibits `B` as
a coequalizer of two maps into `X`. It suffices to prove that `π` followed by the isomorphism to
an arbitrary coequalizer is a quotient map. -/
have hπ : RegularEpi π := inferInstance
exact isQuotientMap_of_isColimit_cofork _ hπ.isColimit
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Basic.lean | import Mathlib.CategoryTheory.Elementwise
import Mathlib.Topology.ContinuousMap.Basic
/-!
# Category instance for topological spaces
We introduce the bundled category `TopCat` of topological spaces together with the functors
`TopCat.discrete` and `TopCat.trivial` from the category of types to `TopCat` which equip a type
with the corresponding discrete, resp. trivial, topology. For a proof that these functors are left,
resp. right adjoint to the forgetful functor, see
`Mathlib/Topology/Category/TopCat/Adjunctions.lean`.
-/
assert_not_exists Module
open CategoryTheory TopologicalSpace Topology
universe u
/-- The category of topological spaces. -/
structure TopCat where
/-- The object in `TopCat` associated to a type equipped with the appropriate
typeclasses. -/
of ::
/-- The underlying type. -/
carrier : Type u
[str : TopologicalSpace carrier]
attribute [instance] TopCat.str
initialize_simps_projections TopCat (-str)
namespace TopCat
instance : CoeSort (TopCat) (Type u) :=
⟨TopCat.carrier⟩
attribute [coe] TopCat.carrier
lemma coe_of (X : Type u) [TopologicalSpace X] : (of X : Type u) = X :=
rfl
lemma of_carrier (X : TopCat.{u}) : of X = X := rfl
variable {X} in
/-- The type of morphisms in `TopCat`. -/
@[ext]
structure Hom (X Y : TopCat.{u}) where
private mk ::
/-- The underlying `ContinuousMap`. -/
hom' : C(X, Y)
instance : Category TopCat where
Hom X Y := Hom X Y
id X := ⟨ContinuousMap.id X⟩
comp f g := ⟨g.hom'.comp f.hom'⟩
instance : ConcreteCategory.{u} TopCat (fun X Y => C(X, Y)) where
hom := Hom.hom'
ofHom f := ⟨f⟩
/-- Turn a morphism in `TopCat` back into a `ContinuousMap`. -/
abbrev Hom.hom {X Y : TopCat.{u}} (f : Hom X Y) :=
ConcreteCategory.hom (C := TopCat) f
/-- Typecheck a `ContinuousMap` as a morphism in `TopCat`. -/
abbrev ofHom {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y] (f : C(X, Y)) : of X ⟶ of Y :=
ConcreteCategory.ofHom (C := TopCat) f
/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/
def Hom.Simps.hom (X Y : TopCat) (f : Hom X Y) :=
f.hom
initialize_simps_projections Hom (hom' → hom)
/-!
The results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`.
-/
@[simp]
lemma hom_id {X : TopCat.{u}} : (𝟙 X : X ⟶ X).hom = ContinuousMap.id X := rfl
@[simp]
theorem id_app (X : TopCat.{u}) (x : ↑X) : (𝟙 X : X ⟶ X) x = x := rfl
@[simp] theorem coe_id (X : TopCat.{u}) : (𝟙 X : X → X) = id := rfl
@[simp]
lemma hom_comp {X Y Z : TopCat.{u}} (f : X ⟶ Y) (g : Y ⟶ Z) :
(f ≫ g).hom = g.hom.comp f.hom := rfl
@[simp]
theorem comp_app {X Y Z : TopCat.{u}} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) :
(f ≫ g : X → Z) x = g (f x) := rfl
@[simp] theorem coe_comp {X Y Z : TopCat.{u}} (f : X ⟶ Y) (g : Y ⟶ Z) :
(f ≫ g : X → Z) = g ∘ f := rfl
@[ext]
lemma hom_ext {X Y : TopCat} {f g : X ⟶ Y} (hf : f.hom = g.hom) : f = g :=
Hom.ext hf
@[ext]
lemma ext {X Y : TopCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=
ConcreteCategory.hom_ext _ _ w
@[simp]
lemma hom_ofHom {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y] (f : C(X, Y)) :
(ofHom f).hom = f := rfl
@[simp]
lemma ofHom_hom {X Y : TopCat} (f : X ⟶ Y) :
ofHom (Hom.hom f) = f := rfl
@[simp]
lemma ofHom_id {X : Type u} [TopologicalSpace X] : ofHom (ContinuousMap.id X) = 𝟙 (of X) := rfl
@[simp]
lemma ofHom_comp {X Y Z : Type u} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
(f : C(X, Y)) (g : C(Y, Z)) :
ofHom (g.comp f) = ofHom f ≫ ofHom g :=
rfl
lemma ofHom_apply {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y] (f : C(X, Y)) (x : X) :
(ofHom f) x = f x := rfl
lemma hom_inv_id_apply {X Y : TopCat} (f : X ≅ Y) (x : X) : f.inv (f.hom x) = x := by
simp
lemma inv_hom_id_apply {X Y : TopCat} (f : X ≅ Y) (y : Y) : f.hom (f.inv y) = y := by
simp
/--
Replace a function coercion for a morphism `TopCat.of X ⟶ TopCat.of Y` with the definitionally
equal function coercion for a continuous map `C(X, Y)`.
-/
@[simp] theorem coe_of_of {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y]
{f : C(X, Y)} {x} :
@DFunLike.coe (TopCat.of X ⟶ TopCat.of Y) ((CategoryTheory.forget TopCat).obj (TopCat.of X))
(fun _ ↦ (CategoryTheory.forget TopCat).obj (TopCat.of Y)) HasForget.instFunLike
(ofHom f) x =
@DFunLike.coe C(X, Y) X
(fun _ ↦ Y) _
f x :=
rfl
instance inhabited : Inhabited TopCat :=
⟨TopCat.of Empty⟩
/-- The discrete topology on any type. -/
def discrete : Type u ⥤ TopCat.{u} where
obj X := @of X ⊥
map f := @ofHom _ _ ⊥ ⊥ <| @ContinuousMap.mk _ _ ⊥ ⊥ f continuous_bot
instance {X : Type u} : DiscreteTopology (discrete.obj X) :=
⟨rfl⟩
/-- The trivial topology on any type. -/
def trivial : Type u ⥤ TopCat.{u} where
obj X := @of X ⊤
map f := @ofHom _ _ ⊤ ⊤ <| @ContinuousMap.mk _ _ ⊤ ⊤ f continuous_top
/-- Any homeomorphisms induces an isomorphism in `Top`. -/
@[simps]
def isoOfHomeo {X Y : TopCat.{u}} (f : X ≃ₜ Y) : X ≅ Y where
hom := ofHom f
inv := ofHom f.symm
/-- Any isomorphism in `Top` induces a homeomorphism. -/
@[simps]
def homeoOfIso {X Y : TopCat.{u}} (f : X ≅ Y) : X ≃ₜ Y where
toFun := f.hom
invFun := f.inv
left_inv x := by simp
right_inv x := by simp
continuous_toFun := f.hom.hom.continuous
continuous_invFun := f.inv.hom.continuous
@[simp]
theorem of_isoOfHomeo {X Y : TopCat.{u}} (f : X ≃ₜ Y) : homeoOfIso (isoOfHomeo f) = f := by
ext
rfl
@[simp]
theorem of_homeoOfIso {X Y : TopCat.{u}} (f : X ≅ Y) : isoOfHomeo (homeoOfIso f) = f := by
ext
rfl
lemma isIso_of_bijective_of_isOpenMap {X Y : TopCat.{u}} (f : X ⟶ Y)
(hfbij : Function.Bijective f) (hfcl : IsOpenMap f) : IsIso f :=
let e : X ≃ₜ Y :=
(Equiv.ofBijective f hfbij).toHomeomorphOfContinuousOpen f.hom.continuous hfcl
inferInstanceAs <| IsIso (TopCat.isoOfHomeo e).hom
lemma isIso_of_bijective_of_isClosedMap {X Y : TopCat.{u}} (f : X ⟶ Y)
(hfbij : Function.Bijective f) (hfcl : IsClosedMap f) : IsIso f :=
let e : X ≃ₜ Y :=
(Equiv.ofBijective f hfbij).toHomeomorphOfContinuousClosed f.hom.continuous hfcl
inferInstanceAs <| IsIso (TopCat.isoOfHomeo e).hom
lemma isIso_iff_isHomeomorph {X Y : TopCat.{u}} (f : X ⟶ Y) :
IsIso f ↔ IsHomeomorph f :=
⟨fun _ ↦ (homeoOfIso (asIso f)).isHomeomorph,
fun H ↦ isIso_of_bijective_of_isOpenMap _ H.bijective H.isOpenMap⟩
theorem isOpenEmbedding_iff_comp_isIso {X Y Z : TopCat} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso g] :
IsOpenEmbedding (f ≫ g) ↔ IsOpenEmbedding f :=
(TopCat.homeoOfIso (asIso g)).isOpenEmbedding.of_comp_iff f
@[simp]
theorem isOpenEmbedding_iff_comp_isIso' {X Y Z : TopCat} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso g] :
IsOpenEmbedding (g ∘ f) ↔ IsOpenEmbedding f := by
simp only
exact isOpenEmbedding_iff_comp_isIso f g
theorem isOpenEmbedding_iff_isIso_comp {X Y Z : TopCat} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso f] :
IsOpenEmbedding (f ≫ g) ↔ IsOpenEmbedding g := by
constructor
· intro h
convert h.comp (TopCat.homeoOfIso (asIso f).symm).isOpenEmbedding
exact congr_arg (DFunLike.coe ∘ ConcreteCategory.hom) (IsIso.inv_hom_id_assoc f g).symm
· exact fun h => h.comp (TopCat.homeoOfIso (asIso f)).isOpenEmbedding
@[simp]
theorem isOpenEmbedding_iff_isIso_comp' {X Y Z : TopCat} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso f] :
IsOpenEmbedding (g ∘ f) ↔ IsOpenEmbedding g := by
simp only
exact isOpenEmbedding_iff_isIso_comp f g
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/ULift.lean | import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.Topology.Homeomorph.Lemmas
/-!
# Lifting topological spaces to a higher universe
In this file, we construct the functor `uliftFunctor.{v, u} : TopCat.{u} ⥤ TopCat.{max u v}`
which sends a topological space `X : Type u` to a homeomorphic space in `Type (max u v)`.
-/
universe v u
open CategoryTheory
namespace TopCat
-- Note: no `@[simps!]` attribute here in order to get good simplification lemmas
-- like `uliftFunctorObjHomeo_naturality_apply` below. We should access
-- `uliftFunctor.obj X` via the homeomorphism `X.uliftFunctorObjHomeo`.
/-- The functor which sends a topological space in `Type u` to a homeomorphic
space in `Type (max u v)`. -/
def uliftFunctor : TopCat.{u} ⥤ TopCat.{max u v} where
obj X := TopCat.of (ULift.{v} X)
map {X Y} f := ofHom ⟨ULift.map f, by continuity⟩
/-- Given `X : TopCat.{u}`, this is the homeomorphism `X ≃ₜ uliftFunctor.{v}.obj X`. -/
def uliftFunctorObjHomeo (X : TopCat.{u}) : X ≃ₜ uliftFunctor.{v}.obj X :=
Homeomorph.ulift.symm
@[simp]
lemma uliftFunctorObjHomeo_naturality_apply {X Y : TopCat.{u}} (f : X ⟶ Y) (x : X) :
uliftFunctor.{v}.map f (X.uliftFunctorObjHomeo x) =
Y.uliftFunctorObjHomeo (f x) := rfl
@[simp]
lemma uliftFunctorObjHomeo_symm_naturality_apply {X Y : TopCat.{u}} (f : X ⟶ Y)
(x : uliftFunctor.{v}.obj X) :
Y.uliftFunctorObjHomeo.symm (uliftFunctor.{v}.map f x) =
f (X.uliftFunctorObjHomeo.symm x) :=
rfl
/-- The `ULift` functor on categories of topological spaces is compatible
with the one defined on categories of types. -/
@[simps!]
def uliftFunctorCompForgetIso : uliftFunctor.{v, u} ⋙ forget TopCat.{max u v} ≅
forget TopCat.{u} ⋙ CategoryTheory.uliftFunctor.{v, u} := Iso.refl _
/-- The `ULift` functor on categories of topological spaces is fully faithful. -/
def uliftFunctorFullyFaithful : uliftFunctor.{v, u}.FullyFaithful where
preimage f := ofHom ⟨ULift.down ∘ f ∘ ULift.up, by continuity⟩
instance : uliftFunctor.{v, u}.Full :=
uliftFunctorFullyFaithful.full
instance : uliftFunctor.{v, u}.Faithful :=
uliftFunctorFullyFaithful.faithful
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/OpenNhds.lean | import Mathlib.Topology.Category.TopCat.Opens
import Mathlib.Data.Set.Subsingleton
/-!
# The category of open neighborhoods of a point
Given an object `X` of the category `TopCat` of topological spaces and a point `x : X`, this file
builds the type `OpenNhds x` of open neighborhoods of `x` in `X` and endows it with the partial
order given by inclusion and the corresponding category structure (as a full subcategory of the
poset category `Set X`). This is used in `Topology.Sheaves.Stalks` to build the stalk of a sheaf
at `x` as a limit over `OpenNhds x`.
## Main declarations
Besides `OpenNhds`, the main constructions here are:
* `inclusion (x : X)`: the obvious functor `OpenNhds x ⥤ Opens X`
* `functorNhds`: An open map `f : X ⟶ Y` induces a functor `OpenNhds x ⥤ OpenNhds (f x)`
* `adjunctionNhds`: An open map `f : X ⟶ Y` induces an adjunction between `OpenNhds x` and
`OpenNhds (f x)`.
-/
open CategoryTheory TopologicalSpace Opposite Topology
universe u
variable {X Y : TopCat.{u}} (f : X ⟶ Y)
namespace TopologicalSpace
/-- The type of open neighbourhoods of a point `x` in a (bundled) topological space. -/
def OpenNhds (x : X) :=
ObjectProperty.FullSubcategory fun U : Opens X => x ∈ U
namespace OpenNhds
variable {x : X} {U V W : OpenNhds x}
instance partialOrder (x : X) : PartialOrder (OpenNhds x) where
le U V := U.1 ≤ V.1
le_refl _ := le_rfl
le_trans _ _ _ := le_trans
le_antisymm _ _ i j := ObjectProperty.FullSubcategory.ext <| le_antisymm i j
instance (x : X) : Lattice (OpenNhds x) :=
{ OpenNhds.partialOrder x with
inf := fun U V => ⟨U.1 ⊓ V.1, ⟨U.2, V.2⟩⟩
le_inf := fun U V W => @le_inf _ _ U.1.1 V.1.1 W.1.1
inf_le_left := fun U V => @inf_le_left _ _ U.1.1 V.1.1
inf_le_right := fun U V => @inf_le_right _ _ U.1.1 V.1.1
sup := fun U V => ⟨U.1 ⊔ V.1, Set.mem_union_left V.1.1 U.2⟩
sup_le := fun U V W => @sup_le _ _ U.1.1 V.1.1 W.1.1
le_sup_left := fun U V => @le_sup_left _ _ U.1.1 V.1.1
le_sup_right := fun U V => @le_sup_right _ _ U.1.1 V.1.1 }
instance (x : X) : OrderTop (OpenNhds x) where
top := ⟨⊤, trivial⟩
le_top _ := by dsimp [LE.le]; exact le_top
instance (x : X) : Inhabited (OpenNhds x) :=
⟨⊤⟩
instance openNhdsCategory (x : X) : Category.{u} (OpenNhds x) := inferInstance
instance opensNhds.instFunLike : FunLike (U ⟶ V) U.1 V.1 where
coe f := Set.inclusion f.le
coe_injective' := by rintro ⟨⟨_⟩⟩ _ _; congr!
@[simp] lemma apply_mk (f : U ⟶ V) (y : X) (hy) : f ⟨y, hy⟩ = ⟨y, f.le hy⟩ := rfl
@[simp] lemma val_apply (f : U ⟶ V) (y : U.1) : (f y : X) = y := rfl
@[simp, norm_cast] lemma coe_id (f : U ⟶ U) : ⇑f = id := rfl
lemma id_apply (f : U ⟶ U) (y : U.1) : f y = y := rfl
@[simp] lemma comp_apply (f : U ⟶ V) (g : V ⟶ W) (x : U.1) : (f ≫ g) x = g (f x) := rfl
/-- The inclusion `U ⊓ V ⟶ U` as a morphism in the category of open sets. -/
def infLELeft {x : X} (U V : OpenNhds x) : U ⊓ V ⟶ U :=
homOfLE inf_le_left
/-- The inclusion `U ⊓ V ⟶ V` as a morphism in the category of open sets. -/
def infLERight {x : X} (U V : OpenNhds x) : U ⊓ V ⟶ V :=
homOfLE inf_le_right
/-- The inclusion functor from open neighbourhoods of `x`
to open sets in the ambient topological space. -/
def inclusion (x : X) : OpenNhds x ⥤ Opens X :=
ObjectProperty.ι _
@[simp]
theorem inclusion_obj (x : X) (U) (p) : (inclusion x).obj ⟨U, p⟩ = U :=
rfl
theorem isOpenEmbedding {x : X} (U : OpenNhds x) : IsOpenEmbedding U.1.inclusion' :=
U.1.isOpenEmbedding
/-- The preimage functor from neighborhoods of `f x` to neighborhoods of `x`. -/
def map (x : X) : OpenNhds (f x) ⥤ OpenNhds x where
obj U := ⟨(Opens.map f).obj U.1, U.2⟩
map i := (Opens.map f).map i
@[simp]
theorem map_obj (x : X) (U) (q) : (map f x).obj ⟨U, q⟩ = ⟨(Opens.map f).obj U, q⟩ :=
rfl
@[simp]
theorem map_id_obj (x : X) (U) : (map (𝟙 X) x).obj U = U := rfl
@[simp]
theorem map_id_obj' (x : X) (U) (p) (q) : (map (𝟙 X) x).obj ⟨⟨U, p⟩, q⟩ = ⟨⟨U, p⟩, q⟩ :=
rfl
@[simp]
theorem map_id_obj_unop (x : X) (U : (OpenNhds x)ᵒᵖ) : (map (𝟙 X) x).obj (unop U) = unop U := by
simp
@[simp]
theorem op_map_id_obj (x : X) (U : (OpenNhds x)ᵒᵖ) : (map (𝟙 X) x).op.obj U = U := by simp
/-- `Opens.map f` and `OpenNhds.map f` form a commuting square (up to natural isomorphism)
with the inclusion functors into `Opens X`. -/
@[simps! hom_app inv_app]
def inclusionMapIso (x : X) : inclusion (f x) ⋙ Opens.map f ≅ map f x ⋙ inclusion x :=
NatIso.ofComponents fun U => { hom := 𝟙 _, inv := 𝟙 _ }
@[simp]
theorem inclusionMapIso_hom (x : X) : (inclusionMapIso f x).hom = 𝟙 _ :=
rfl
@[simp]
theorem inclusionMapIso_inv (x : X) : (inclusionMapIso f x).inv = 𝟙 _ :=
rfl
end OpenNhds
end TopologicalSpace
namespace IsOpenMap
open TopologicalSpace
variable {f}
/-- An open map `f : X ⟶ Y` induces a functor `OpenNhds x ⥤ OpenNhds (f x)`. -/
@[simps]
def functorNhds (h : IsOpenMap f) (x : X) : OpenNhds x ⥤ OpenNhds (f x) where
obj U := ⟨h.functor.obj U.1, ⟨x, U.2, rfl⟩⟩
map i := h.functor.map i
/-- An open map `f : X ⟶ Y` induces an adjunction between `OpenNhds x` and `OpenNhds (f x)`. -/
def adjunctionNhds (h : IsOpenMap f) (x : X) : IsOpenMap.functorNhds h x ⊣ OpenNhds.map f x where
unit := { app := fun _ => homOfLE fun x hxU => ⟨x, hxU, rfl⟩ }
counit := { app := fun _ => homOfLE fun _ ⟨_, hfxV, hxy⟩ => hxy ▸ hfxV }
end IsOpenMap
namespace Topology.IsInducing
open TopologicalSpace
variable {f}
/-- An inducing map `f : X ⟶ Y` induces a functor `open_nhds x ⥤ open_nhds (f x)`. -/
@[simps]
def functorNhds (h : IsInducing f) (x : X) :
OpenNhds x ⥤ OpenNhds (f x) where
obj U := ⟨h.functor.obj U.1, (h.mem_functorObj_iff U.1).mpr U.2⟩
map := h.functor.map
/--
An inducing map `f : X ⟶ Y` induces an adjunction between `open_nhds x` and `open_nhds (f x)`.
-/
def adjunctionNhds (h : IsInducing f) (x : X) :
OpenNhds.map f x ⊣ h.functorNhds x where
unit := { app := fun U => homOfLE (h.adjunction.unit.app U.1).le }
counit := { app := fun U => homOfLE (h.adjunction.counit.app U.1).le }
end Topology.IsInducing |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Sphere.lean | import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Topology.Category.TopCat.EpiMono
/-!
# Euclidean spheres
This file defines the `n`-sphere `𝕊 n`, the `n`-disk `𝔻 n`, its boundary `∂𝔻 n` and its interior
`𝔹 n` as objects in `TopCat`.
-/
universe u
namespace TopCat
open CategoryTheory
/-- The `n`-disk is the set of points in ℝⁿ whose norm is at most `1`,
endowed with the subspace topology. -/
noncomputable def disk (n : ℕ) : TopCat.{u} :=
TopCat.of <| ULift <| Metric.closedBall (0 : EuclideanSpace ℝ (Fin n)) 1
/-- The boundary of the `n`-disk. -/
noncomputable def diskBoundary (n : ℕ) : TopCat.{u} :=
TopCat.of <| ULift <| Metric.sphere (0 : EuclideanSpace ℝ (Fin n)) 1
/-- The `n`-sphere is the set of points in ℝⁿ⁺¹ whose norm equals `1`,
endowed with the subspace topology. -/
noncomputable def sphere (n : ℕ) : TopCat.{u} :=
diskBoundary (n + 1)
/-- The `n`-ball is the set of points in ℝⁿ whose norm is strictly less than `1`,
endowed with the subspace topology. -/
noncomputable def ball (n : ℕ) : TopCat.{u} :=
TopCat.of <| ULift <| Metric.ball (0 : EuclideanSpace ℝ (Fin n)) 1
/-- `𝔻 n` denotes the `n`-disk. -/
scoped prefix:arg "𝔻 " => disk
/-- `∂𝔻 n` denotes the boundary of the `n`-disk. -/
scoped prefix:arg "∂𝔻 " => diskBoundary
/-- `𝕊 n` denotes the `n`-sphere. -/
scoped prefix:arg "𝕊 " => sphere
/-- `𝔹 n` denotes the `n`-ball, the interior of the `n`-disk. -/
scoped prefix:arg "𝔹 " => ball
/-- The inclusion `∂𝔻 n ⟶ 𝔻 n` of the boundary of the `n`-disk. -/
def diskBoundaryInclusion (n : ℕ) : ∂𝔻 n ⟶ 𝔻 n :=
ofHom
{ toFun := fun ⟨p, hp⟩ ↦ ⟨p, le_of_eq hp⟩
continuous_toFun := ⟨fun t ⟨s, ⟨r, hro, hrs⟩, hst⟩ ↦ by
rw [isOpen_induced_iff, ← hst, ← hrs]
tauto⟩ }
/-- The inclusion `𝔹 n ⟶ 𝔻 n` of the interior of the `n`-disk. -/
def ballInclusion (n : ℕ) : 𝔹 n ⟶ 𝔻 n :=
ofHom
{ toFun := fun ⟨p, hp⟩ ↦ ⟨p, Metric.ball_subset_closedBall hp⟩
continuous_toFun := ⟨fun t ⟨s, ⟨r, hro, hrs⟩, hst⟩ ↦ by
rw [isOpen_induced_iff, ← hst, ← hrs]
tauto⟩ }
instance {n : ℕ} : Mono (diskBoundaryInclusion n) := mono_iff_injective _ |>.mpr <| by
intro ⟨x, hx⟩ ⟨y, hy⟩ h
obtain rfl : x = y := by simpa [diskBoundaryInclusion, disk] using h
congr
instance {n : ℕ} : Mono (ballInclusion n) := TopCat.mono_iff_injective _ |>.mpr <| by
intro ⟨x, hx⟩ ⟨y, hy⟩ h
obtain rfl : x = y := by simpa [ballInclusion, disk] using h
congr
instance (n : ℕ) : CompactSpace (𝔻 n) := by
convert Homeomorph.compactSpace Homeomorph.ulift.symm
infer_instance
instance (n : ℕ) : CompactSpace (∂𝔻 n) := by
convert Homeomorph.compactSpace Homeomorph.ulift.symm
infer_instance
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Adjunctions.lean | import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.CategoryTheory.Adjunction.Basic
/-!
# Adjunctions regarding the category of topological spaces
This file shows that the forgetful functor from topological spaces to types has a left and right
adjoint, given by `TopCat.discrete`, resp. `TopCat.trivial`, the functors which equip a type with
the discrete, resp. trivial, topology.
-/
universe u
open CategoryTheory
open TopCat
namespace TopCat
/-- Equipping a type with the discrete topology is left adjoint to the forgetful functor
`Top ⥤ Type`. -/
@[simps! unit counit]
def adj₁ : discrete ⊣ forget TopCat.{u} where
unit := { app := fun _ => id }
counit := { app := fun X => TopCat.ofHom (X := discrete.obj X) ⟨id, continuous_bot⟩ }
/-- Equipping a type with the trivial topology is right adjoint to the forgetful functor
`Top ⥤ Type`. -/
@[simps! unit counit]
def adj₂ : forget TopCat.{u} ⊣ trivial where
unit := { app := fun X => TopCat.ofHom (Y := trivial.obj X) ⟨id, continuous_top⟩ }
counit := { app := fun _ => id }
instance : (forget TopCat.{u}).IsRightAdjoint :=
⟨_, ⟨adj₁⟩⟩
instance : (forget TopCat.{u}).IsLeftAdjoint :=
⟨_, ⟨adj₂⟩⟩
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Limits/Products.lean | import Mathlib.Topology.Category.TopCat.EpiMono
import Mathlib.Topology.Category.TopCat.Limits.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.ConcreteCategory.Basic
import Mathlib.Data.Set.Subsingleton
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.Topology.Homeomorph.Lemmas
/-!
# Products and coproducts in the category of topological spaces
-/
open CategoryTheory Limits Set TopologicalSpace Topology
universe v u w
noncomputable section
namespace TopCat
variable {J : Type v} [Category.{w} J]
/-- The projection from the product as a bundled continuous map. -/
abbrev piπ {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : TopCat.of (∀ i, α i) ⟶ α i :=
ofHom ⟨fun f => f i, continuous_apply i⟩
/-- The explicit fan of a family of topological spaces given by the pi type. -/
@[simps! pt π_app]
def piFan {ι : Type v} (α : ι → TopCat.{max v u}) : Fan α :=
Fan.mk (TopCat.of (∀ i, α i)) (piπ.{v,u} α)
/-- The constructed fan is indeed a limit -/
def piFanIsLimit {ι : Type v} (α : ι → TopCat.{max v u}) : IsLimit (piFan α) where
lift S := ofHom
{ toFun := fun s i => S.π.app ⟨i⟩ s
continuous_toFun := continuous_pi (fun i => (S.π.app ⟨i⟩).hom.2) }
uniq := by
intro S m h
ext x
funext i
simp [ContinuousMap.coe_mk, ← h ⟨i⟩]
fac _ _ := rfl
/-- The product is homeomorphic to the product of the underlying spaces,
equipped with the product topology.
-/
def piIsoPi {ι : Type v} (α : ι → TopCat.{max v u}) : ∏ᶜ α ≅ TopCat.of (∀ i, α i) :=
(limit.isLimit _).conePointUniqueUpToIso (piFanIsLimit.{v, u} α)
@[reassoc (attr := simp)]
theorem piIsoPi_inv_π {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) :
(piIsoPi α).inv ≫ Pi.π α i = piπ α i := by simp [piIsoPi]
theorem piIsoPi_inv_π_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : ∀ i, α i) :
(Pi.π α i :) ((piIsoPi α).inv x) = x i :=
ConcreteCategory.congr_hom (piIsoPi_inv_π α i) x
theorem piIsoPi_hom_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι)
(x : (∏ᶜ α : TopCat.{max v u})) : (piIsoPi α).hom x i = (Pi.π α i :) x := rfl
/-- The inclusion to the coproduct as a bundled continuous map. -/
abbrev sigmaι {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : α i ⟶ TopCat.of (Σ i, α i) := by
refine ofHom (ContinuousMap.mk ?_ ?_)
· dsimp
apply Sigma.mk i
· dsimp; continuity
/-- The explicit cofan of a family of topological spaces given by the sigma type. -/
@[simps! pt ι_app]
def sigmaCofan {ι : Type v} (α : ι → TopCat.{max v u}) : Cofan α :=
Cofan.mk (TopCat.of (Σ i, α i)) (sigmaι α)
/-- The constructed cofan is indeed a colimit -/
def sigmaCofanIsColimit {ι : Type v} (β : ι → TopCat.{max v u}) : IsColimit (sigmaCofan β) where
desc S := ofHom
{ toFun := fun (s : of (Σ i, β i)) => S.ι.app ⟨s.1⟩ s.2
continuous_toFun := by continuity }
uniq := by
intro S m h
ext ⟨i, x⟩
simp only [← h]
congr
fac s j := by
cases j
cat_disch
/-- The coproduct is homeomorphic to the disjoint union of the topological spaces.
-/
def sigmaIsoSigma {ι : Type v} (α : ι → TopCat.{max v u}) : ∐ α ≅ TopCat.of (Σ i, α i) :=
(colimit.isColimit _).coconePointUniqueUpToIso (sigmaCofanIsColimit.{v, u} α)
@[reassoc (attr := simp)]
theorem sigmaIsoSigma_hom_ι {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) :
Sigma.ι α i ≫ (sigmaIsoSigma α).hom = sigmaι α i := by simp [sigmaIsoSigma]
theorem sigmaIsoSigma_hom_ι_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : α i) :
(sigmaIsoSigma α).hom ((Sigma.ι α i :) x) = Sigma.mk i x :=
ConcreteCategory.congr_hom (sigmaIsoSigma_hom_ι α i) x
theorem sigmaIsoSigma_inv_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : α i) :
(sigmaIsoSigma α).inv ⟨i, x⟩ = (Sigma.ι α i :) x := by
rw [← sigmaIsoSigma_hom_ι_apply, ← comp_app, ← comp_app, Iso.hom_inv_id,
Category.comp_id]
section Prod
/-- The first projection from the product. -/
abbrev prodFst {X Y : TopCat.{u}} : TopCat.of (X × Y) ⟶ X :=
ofHom { toFun := Prod.fst }
/-- The second projection from the product. -/
abbrev prodSnd {X Y : TopCat.{u}} : TopCat.of (X × Y) ⟶ Y :=
ofHom { toFun := Prod.snd }
/-- The explicit binary cofan of `X, Y` given by `X × Y`. -/
def prodBinaryFan (X Y : TopCat.{u}) : BinaryFan X Y :=
BinaryFan.mk prodFst prodSnd
/-- The constructed binary fan is indeed a limit -/
def prodBinaryFanIsLimit (X Y : TopCat.{u}) : IsLimit (prodBinaryFan X Y) where
lift := fun S : BinaryFan X Y => ofHom {
toFun := fun s => (S.fst s, S.snd s)
continuous_toFun := by continuity }
fac := by
rintro S (_ | _) <;> {dsimp; ext; rfl}
uniq := by
intro S m h
ext x
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): used to be part of `ext x`
refine Prod.ext ?_ ?_
· specialize h ⟨WalkingPair.left⟩
apply_fun fun e => e x at h
exact h
· specialize h ⟨WalkingPair.right⟩
apply_fun fun e => e x at h
exact h
/-- The homeomorphism between `X ⨯ Y` and the set-theoretic product of `X` and `Y`,
equipped with the product topology.
-/
def prodIsoProd (X Y : TopCat.{u}) : X ⨯ Y ≅ TopCat.of (X × Y) :=
(limit.isLimit _).conePointUniqueUpToIso (prodBinaryFanIsLimit X Y)
@[reassoc (attr := simp)]
theorem prodIsoProd_hom_fst (X Y : TopCat.{u}) :
(prodIsoProd X Y).hom ≫ prodFst = Limits.prod.fst := by
simp [← Iso.eq_inv_comp, prodIsoProd]
rfl
@[reassoc (attr := simp)]
theorem prodIsoProd_hom_snd (X Y : TopCat.{u}) :
(prodIsoProd X Y).hom ≫ prodSnd = Limits.prod.snd := by
simp [← Iso.eq_inv_comp, prodIsoProd]
rfl
-- Note that `(x : X ⨯ Y)` would mean `(x : ↑X × ↑Y)` below:
theorem prodIsoProd_hom_apply {X Y : TopCat.{u}} (x : ↑(X ⨯ Y)) :
(prodIsoProd X Y).hom x = ((Limits.prod.fst : X ⨯ Y ⟶ _) x,
(Limits.prod.snd : X ⨯ Y ⟶ _) x) := rfl
@[reassoc (attr := simp), elementwise]
theorem prodIsoProd_inv_fst (X Y : TopCat.{u}) :
(prodIsoProd X Y).inv ≫ Limits.prod.fst = prodFst := by simp [Iso.inv_comp_eq]
@[reassoc (attr := simp), elementwise]
theorem prodIsoProd_inv_snd (X Y : TopCat.{u}) :
(prodIsoProd X Y).inv ≫ Limits.prod.snd = prodSnd := by simp [Iso.inv_comp_eq]
theorem prod_topology {X Y : TopCat.{u}} :
(X ⨯ Y).str =
induced (Limits.prod.fst : X ⨯ Y ⟶ _) X.str ⊓
induced (Limits.prod.snd : X ⨯ Y ⟶ _) Y.str := by
let homeo := homeoOfIso (prodIsoProd X Y)
refine homeo.isInducing.eq_induced.trans ?_
change induced homeo (_ ⊓ _) = _
simp [induced_compose]
rfl
theorem range_prod_map {W X Y Z : TopCat.{u}} (f : W ⟶ Y) (g : X ⟶ Z) :
Set.range (Limits.prod.map f g) =
(Limits.prod.fst : Y ⨯ Z ⟶ _) ⁻¹' Set.range f ∩
(Limits.prod.snd : Y ⨯ Z ⟶ _) ⁻¹' Set.range g := by
ext x
constructor
· rintro ⟨y, rfl⟩
simp_rw [Set.mem_inter_iff, Set.mem_preimage, Set.mem_range, ← ConcreteCategory.comp_apply,
Limits.prod.map_fst, Limits.prod.map_snd, ConcreteCategory.comp_apply, exists_apply_eq_apply,
and_self_iff]
· rintro ⟨⟨x₁, hx₁⟩, ⟨x₂, hx₂⟩⟩
use (prodIsoProd W X).inv (x₁, x₂)
apply Concrete.limit_ext
rintro ⟨⟨⟩⟩
· rw [← ConcreteCategory.comp_apply]
erw [Limits.prod.map_fst]
rw [ConcreteCategory.comp_apply, TopCat.prodIsoProd_inv_fst_apply]
exact hx₁
· rw [← ConcreteCategory.comp_apply]
erw [Limits.prod.map_snd]
rw [ConcreteCategory.comp_apply, TopCat.prodIsoProd_inv_snd_apply]
exact hx₂
theorem isInducing_prodMap {W X Y Z : TopCat.{u}} {f : W ⟶ X} {g : Y ⟶ Z} (hf : IsInducing f)
(hg : IsInducing g) : IsInducing (Limits.prod.map f g) := by
constructor
simp_rw [prod_topology, induced_inf, induced_compose, ← coe_comp,
prod.map_fst, prod.map_snd, coe_comp, ← induced_compose (g := f), ← induced_compose (g := g)]
rw [← hf.eq_induced, ← hg.eq_induced]
theorem isEmbedding_prodMap {W X Y Z : TopCat.{u}} {f : W ⟶ X} {g : Y ⟶ Z} (hf : IsEmbedding f)
(hg : IsEmbedding g) : IsEmbedding (Limits.prod.map f g) :=
⟨isInducing_prodMap hf.isInducing hg.isInducing, by
haveI := (TopCat.mono_iff_injective _).mpr hf.injective
haveI := (TopCat.mono_iff_injective _).mpr hg.injective
exact (TopCat.mono_iff_injective _).mp inferInstance⟩
end Prod
/-- The binary coproduct cofan in `TopCat`. -/
protected def binaryCofan (X Y : TopCat.{u}) : BinaryCofan X Y :=
BinaryCofan.mk (ofHom ⟨Sum.inl, by continuity⟩) (ofHom ⟨Sum.inr, by continuity⟩)
/-- The constructed binary coproduct cofan in `TopCat` is the coproduct. -/
def binaryCofanIsColimit (X Y : TopCat.{u}) : IsColimit (TopCat.binaryCofan X Y) := by
refine Limits.BinaryCofan.isColimitMk (fun s => ofHom
{ toFun := Sum.elim s.inl s.inr, continuous_toFun := ?_ }) ?_ ?_ ?_
· continuity
· intro s
ext
rfl
· intro s
ext
rfl
· intro s m h₁ h₂
ext (x | x)
exacts [ConcreteCategory.congr_hom h₁ x, ConcreteCategory.congr_hom h₂ x]
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
Nonempty (IsColimit c) ↔
IsOpenEmbedding c.inl ∧ IsOpenEmbedding c.inr ∧ IsCompl (range c.inl) (range c.inr) := by
classical
constructor
· rintro ⟨h⟩
rw [← show _ = c.inl from
h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
← show _ = c.inr from
h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
dsimp
refine ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
(binaryCofanIsColimit X Y)).symm.isOpenEmbedding.comp .inl,
(homeoOfIso <| h.coconePointUniqueUpToIso
(binaryCofanIsColimit X Y)).symm.isOpenEmbedding.comp .inr, ?_⟩
rw [Set.range_comp, ← eq_compl_iff_isCompl]
conv_rhs => rw [Set.range_comp]
erw [← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
(binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
· rintro ⟨h₁, h₂, h₃⟩
have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
rw [eq_compl_iff_isCompl.mpr h₃.symm]
exact fun _ => or_not
refine ⟨BinaryCofan.IsColimit.mk _ ?_ ?_ ?_ ?_⟩
· intro T f g
refine ofHom (ContinuousMap.mk ?_ ?_)
· exact fun x =>
if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.injective).symm ⟨x, h⟩)
else g ((Equiv.ofInjective _ h₂.injective).symm ⟨x, (this x).resolve_left h⟩)
rw [continuous_iff_continuousAt]
intro x
by_cases h : x ∈ Set.range c.inl
· revert h x
apply (IsOpen.continuousOn_iff _).mp
· rw [continuousOn_iff_continuous_restrict]
convert_to Continuous (f ∘ h₁.isEmbedding.toHomeomorph.symm)
· ext ⟨x, hx⟩
exact dif_pos hx
continuity
· exact h₁.isOpen_range
· revert h x
apply (IsOpen.continuousOn_iff _).mp
· rw [continuousOn_iff_continuous_restrict]
have : ∀ a, a ∉ Set.range c.inl → a ∈ Set.range c.inr := by
rintro a (h : a ∈ (Set.range c.inl)ᶜ)
rwa [eq_compl_iff_isCompl.mpr h₃.symm]
convert_to Continuous
(g ∘ h₂.isEmbedding.toHomeomorph.symm ∘ Subtype.map _ this)
· ext ⟨x, hx⟩
exact dif_neg hx
apply Continuous.comp
· exact g.hom.continuous_toFun
· apply Continuous.comp
· continuity
· rw [IsEmbedding.subtypeVal.isInducing.continuous_iff]
exact continuous_subtype_val
· change IsOpen (Set.range c.inl)ᶜ
rw [← eq_compl_iff_isCompl.mpr h₃.symm]
exact h₂.isOpen_range
· intro T f g
ext x
dsimp
rw [dif_pos ⟨x, rfl⟩]
conv_lhs => rw [Equiv.ofInjective_symm_apply]
· intro T f g
ext x
dsimp
rw [dif_neg]
· exact congr_arg g (Equiv.ofInjective_symm_apply _ _)
· rintro ⟨y, e⟩
have : c.inr x ∈ Set.range c.inl ⊓ Set.range c.inr := ⟨⟨_, e⟩, ⟨_, rfl⟩⟩
rwa [disjoint_iff.mp h₃.1] at this
· rintro T _ _ m rfl rfl
ext x
change m x = dite _ _ _
split_ifs <;> exact congr_arg _ (Equiv.apply_ofInjective_symm _ ⟨_, _⟩).symm
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Limits/Konig.lean | import Mathlib.CategoryTheory.Filtered.Basic
import Mathlib.Topology.Category.TopCat.Limits.Basic
/-!
# Topological Kőnig's lemma
A topological version of Kőnig's lemma is that the inverse limit of nonempty compact Hausdorff
spaces is nonempty. (Note: this can be generalized further to inverse limits of nonempty compact
T0 spaces, where all the maps are closed maps; see [Stone1979] --- however there is an erratum
for Theorem 4 that the element in the inverse limit can have cofinally many components that are
not closed points.)
We give this in a more general form, which is that cofiltered limits
of nonempty compact Hausdorff spaces are nonempty
(`nonempty_limitCone_of_compact_t2_cofiltered_system`).
This also applies to inverse limits, where `{J : Type u} [Preorder J] [IsDirected J (≤)]` and
`F : Jᵒᵖ ⥤ TopCat`.
The theorem is specialized to nonempty finite types (which are compact Hausdorff with the
discrete topology) in lemmas `nonempty_sections_of_finite_cofiltered_system` and
`nonempty_sections_of_finite_inverse_system` in `Mathlib/CategoryTheory/CofilteredSystem.lean`.
(See <https://stacks.math.columbia.edu/tag/086J> for the Set version.)
-/
open CategoryTheory
open CategoryTheory.Limits
universe v u w
noncomputable section
namespace TopCat
section TopologicalKonig
variable {J : Type u} [SmallCategory J]
variable (F : J ⥤ TopCat.{v})
private abbrev FiniteDiagramArrow {J : Type u} [SmallCategory J] (G : Finset J) :=
Σ' (X Y : J) (_ : X ∈ G) (_ : Y ∈ G), X ⟶ Y
private abbrev FiniteDiagram (J : Type u) [SmallCategory J] :=
Σ G : Finset J, Finset (FiniteDiagramArrow G)
/-- Partial sections of a cofiltered limit are sections when restricted to
a finite subset of objects and morphisms of `J`.
-/
def partialSections {J : Type u} [SmallCategory J] (F : J ⥤ TopCat.{v}) {G : Finset J}
(H : Finset (FiniteDiagramArrow G)) : Set (∀ j, F.obj j) :=
{u | ∀ {f : FiniteDiagramArrow G} (_ : f ∈ H), F.map f.2.2.2.2 (u f.1) = u f.2.1}
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)]
{G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
classical
cases isEmpty_or_nonempty J
· exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩
haveI : IsCofiltered J := ⟨⟩
use fun j : J =>
if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some
else (h _).some
rintro ⟨X, Y, hX, hY, f⟩ hf
dsimp only
rwa [dif_pos hX, dif_pos hY, ← comp_app, ← F.map_comp, @IsCofiltered.infTo_commutes _ _ _ G H]
theorem partialSections.directed :
Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
classical
intro A B
let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
refine ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, ?_, ?_⟩
· rintro u hu f hf
have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_left
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
· rintro u hu f hf
have : ιB f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_right
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
theorem partialSections.closed [∀ j : J, T2Space (F.obj j)] {G : Finset J}
(H : Finset (FiniteDiagramArrow G)) : IsClosed (partialSections F H) := by
have :
partialSections F H =
⋂ (f : FiniteDiagramArrow G) (_ : f ∈ H), {u | F.map f.2.2.2.2 (u f.1) = u f.2.1} := by
ext1
simp only [Set.mem_iInter, Set.mem_setOf_eq]
rfl
rw [this]
apply isClosed_biInter
intro f _
apply isClosed_eq <;> fun_prop
/-- Cofiltered limits of nonempty compact Hausdorff spaces are nonempty topological spaces.
-/
theorem nonempty_limitCone_of_compact_t2_cofiltered_system (F : J ⥤ TopCat.{max v u})
[IsCofilteredOrEmpty J]
[∀ j : J, Nonempty (F.obj j)] [∀ j : J, CompactSpace (F.obj j)] [∀ j : J, T2Space (F.obj j)] :
Nonempty (TopCat.limitCone F).pt := by
classical
obtain ⟨u, hu⟩ :=
IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed (fun G => partialSections F _)
(partialSections.directed F) (fun G => partialSections.nonempty F _)
(fun G => IsClosed.isCompact (partialSections.closed F _)) fun G =>
partialSections.closed F _
use u
intro X Y f
let G : FiniteDiagram J := ⟨{X, Y}, {⟨X, Y, by grind, by grind, f⟩}⟩
exact hu _ ⟨G, rfl⟩ (Finset.mem_singleton_self _)
end TopologicalKonig
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Limits/Basic.lean | import Mathlib.Topology.Category.TopCat.Adjunctions
import Mathlib.CategoryTheory.Limits.Types.Limits
import Mathlib.CategoryTheory.Limits.Types.Colimits
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.CategoryTheory.Adjunction.Limits
/-!
# The category of topological spaces has all limits and colimits
Further, these limits and colimits are preserved by the forgetful functor --- that is, the
underlying types are just the limits in the category of types.
-/
open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite
universe v u u' w
noncomputable section
local notation "forget" => forget TopCat
namespace TopCat
section Limits
variable {J : Type v} [Category.{w} J]
attribute [local fun_prop] continuous_subtype_val
/-- A choice of limit cone for a functor `F : J ⥤ TopCat`.
Generally you should just use `limit.cone F`, unless you need the actual definition
(which is in terms of `Types.limitCone`).
-/
def limitCone (F : J ⥤ TopCat.{max v u}) : Cone F where
pt := TopCat.of { u : ∀ j : J, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j }
π :=
{ app := fun j => ofHom
{ toFun := fun u => u.val j
-- Porting note: `continuity` from the original mathlib3 proof failed here.
continuous_toFun := Continuous.comp (continuous_apply _) (continuous_subtype_val) }
naturality := fun X Y f => by
ext a
exact (a.2 f).symm }
/-- The chosen cone `TopCat.limitCone F` for a functor `F : J ⥤ TopCat` is a limit cone.
Generally you should just use `limit.isLimit F`, unless you need the actual definition
(which is in terms of `Types.limitConeIsLimit`).
-/
def limitConeIsLimit (F : J ⥤ TopCat.{max v u}) : IsLimit (limitCone.{v,u} F) where
lift S := ofHom
{ toFun := fun x =>
⟨fun _ => S.π.app _ x, fun f => by
dsimp
rw [← S.w f]
rfl⟩
continuous_toFun :=
Continuous.subtype_mk (continuous_pi fun j => (S.π.app j).hom.2) fun x i j f => by
dsimp
rw [← S.w f]
rfl }
uniq S m h := by
ext a
simp [← h]
rfl
section
variable {F : J ⥤ TopCat.{u}} (c : Cone (F ⋙ forget))
/-- Given a functor `F : J ⥤ TopCat` and a cone `c : Cone (F ⋙ forget)`
of the underlying functor to types, this is the type `c.pt`
with the infimum of the induced topologies by the maps `c.π.app j`. -/
def conePtOfConeForget : Type _ := c.pt
instance topologicalSpaceConePtOfConeForget :
TopologicalSpace (conePtOfConeForget c) :=
(⨅ j, (F.obj j).str.induced (c.π.app j))
/-- Given a functor `F : J ⥤ TopCat` and a cone `c : Cone (F ⋙ forget)`
of the underlying functor to types, this is a cone for `F` whose point is
`c.pt` with the infimum of the induced topologies by the maps `c.π.app j`. -/
@[simps pt π_app]
def coneOfConeForget : Cone F where
pt := of (conePtOfConeForget c)
π :=
{ app j := ofHom (ContinuousMap.mk (c.π.app j) (by
rw [continuous_iff_le_induced]
exact iInf_le (fun j ↦ (F.obj j).str.induced (c.π.app j)) j))
naturality j j' φ := by
ext
apply congr_fun (c.π.naturality φ) }
/-- Given a functor `F : J ⥤ TopCat` and a cone `c : Cone (F ⋙ forget)`
of the underlying functor to types, the limit of `F` is `c.pt` equipped
with the infimum of the induced topologies by the maps `c.π.app j`. -/
def isLimitConeOfForget (c : Cone (F ⋙ forget)) (hc : IsLimit c) :
IsLimit (coneOfConeForget c) := by
refine IsLimit.ofFaithful forget (ht := hc)
(fun s ↦ ofHom (ContinuousMap.mk (hc.lift ((forget).mapCone s)) ?_)) (fun _ ↦ rfl)
rw [continuous_iff_coinduced_le]
dsimp [topologicalSpaceConePtOfConeForget]
rw [le_iInf_iff]
intro j
rw [coinduced_le_iff_le_induced, induced_compose]
convert continuous_iff_le_induced.1 (s.π.app j).hom.continuous
exact hc.fac ((forget).mapCone s) j
end
section IsLimit
variable {F : J ⥤ TopCat.{u}} (c : Cone F) (hc : IsLimit c)
include hc
theorem induced_of_isLimit :
c.pt.str = ⨅ j, (F.obj j).str.induced (c.π.app j) := by
let c' := coneOfConeForget ((forget).mapCone c)
let hc' : IsLimit c' := isLimitConeOfForget _ (isLimitOfPreserves forget hc)
let e := IsLimit.conePointUniqueUpToIso hc' hc
have he (j : J) : e.inv ≫ c'.π.app j = c.π.app j :=
IsLimit.conePointUniqueUpToIso_inv_comp hc' hc j
apply (homeoOfIso e.symm).induced_eq.symm.trans
dsimp [coneOfConeForget_pt, c', topologicalSpaceConePtOfConeForget]
conv_rhs => simp only [← he]
simp [← induced_compose, homeoOfIso, c']
end IsLimit
variable (F : J ⥤ TopCat.{u})
theorem limit_topology [HasLimit F] :
(limit F).str = ⨅ j, (F.obj j).str.induced (limit.π F j) :=
induced_of_isLimit _ (limit.isLimit _)
lemma hasLimit_iff_small_sections :
HasLimit F ↔ Small.{u} ((F ⋙ forget).sections) := by
rw [← Types.hasLimit_iff_small_sections]
constructor <;> intro
· infer_instance
· exact ⟨⟨_, isLimitConeOfForget _ (limit.isLimit _)⟩⟩
instance topCat_hasLimitsOfShape (J : Type v) [Category J] [Small.{u} J] :
HasLimitsOfShape J TopCat.{u} where
has_limit := fun F => by
rw [hasLimit_iff_small_sections]
infer_instance
instance topCat_hasLimitsOfSize [UnivLE.{v, u}] : HasLimitsOfSize.{w, v} TopCat.{u} where
instance topCat_hasLimits : HasLimits TopCat.{u} :=
TopCat.topCat_hasLimitsOfSize.{u, u}
instance forget_preservesLimitsOfSize :
PreservesLimitsOfSize.{w, v} (forget : TopCat.{u} ⥤ _) where
instance forget_preservesLimits : PreservesLimits (forget : TopCat.{u} ⥤ _) where
end Limits
section Colimits
variable {J : Type v} [Category.{w} J] {F : J ⥤ TopCat.{u}}
section
variable (c : Cocone (F ⋙ forget))
/-- Given a functor `F : J ⥤ TopCat` and a cocone `c : Cocone (F ⋙ forget)`
of the underlying cocone of types, this is the type `c.pt`
with the supremum of the topologies that are coinduced by the maps `c.ι.app j`. -/
def coconePtOfCoconeForget : Type _ := c.pt
instance topologicalSpaceCoconePtOfCoconeForget :
TopologicalSpace (coconePtOfCoconeForget c) :=
(⨆ j, (F.obj j).str.coinduced (c.ι.app j))
/-- Given a functor `F : J ⥤ TopCat` and a cocone `c : Cocone (F ⋙ forget)`
of the underlying cocone of types, this is a cocone for `F` whose point is
`c.pt` with the supremum of the coinduced topologies by the maps `c.ι.app j`. -/
@[simps pt ι_app]
def coconeOfCoconeForget : Cocone F where
pt := of (coconePtOfCoconeForget c)
ι :=
{ app j := ofHom (ContinuousMap.mk (c.ι.app j) (by
rw [continuous_iff_coinduced_le]
exact le_iSup (fun j ↦ (F.obj j).str.coinduced (c.ι.app j)) j))
naturality j j' φ := by
ext
apply congr_fun (c.ι.naturality φ) }
/-- Given a functor `F : J ⥤ TopCat` and a cocone `c : Cocone (F ⋙ forget)`
of the underlying cocone of types, the colimit of `F` is `c.pt` equipped
with the supremum of the coinduced topologies by the maps `c.ι.app j`. -/
def isColimitCoconeOfForget (c : Cocone (F ⋙ forget)) (hc : IsColimit c) :
IsColimit (coconeOfCoconeForget c) := by
refine IsColimit.ofFaithful forget (ht := hc)
(fun s ↦ ofHom (ContinuousMap.mk (hc.desc ((forget).mapCocone s)) ?_)) (fun _ ↦ rfl)
rw [continuous_iff_le_induced]
dsimp [topologicalSpaceCoconePtOfCoconeForget]
rw [iSup_le_iff]
intro j
rw [coinduced_le_iff_le_induced, induced_compose]
convert continuous_iff_le_induced.1 (s.ι.app j).hom.continuous
exact hc.fac ((forget).mapCocone s) j
end
section IsColimit
variable (c : Cocone F) (hc : IsColimit c)
include hc
theorem coinduced_of_isColimit :
c.pt.str = ⨆ j, (F.obj j).str.coinduced (c.ι.app j) := by
let c' := coconeOfCoconeForget ((forget).mapCocone c)
let hc' : IsColimit c' := isColimitCoconeOfForget _ (isColimitOfPreserves forget hc)
let e := IsColimit.coconePointUniqueUpToIso hc' hc
have he (j : J) : c'.ι.app j ≫ e.hom = c.ι.app j :=
IsColimit.comp_coconePointUniqueUpToIso_hom hc' hc j
apply (homeoOfIso e).coinduced_eq.symm.trans
dsimp [coconeOfCoconeForget_pt, c', topologicalSpaceCoconePtOfCoconeForget]
simp only [coinduced_iSup]
conv_rhs => simp only [← he]
rfl
lemma isOpen_iff_of_isColimit (X : Set c.pt) :
IsOpen X ↔ ∀ (j : J), IsOpen (c.ι.app j ⁻¹' X) := by
trans (⨆ (j : J), (F.obj j).str.coinduced (c.ι.app j)).IsOpen X
· rw [← coinduced_of_isColimit c hc, isOpen_fold]
· simp only [← isOpen_coinduced]
apply isOpen_iSup_iff
lemma isClosed_iff_of_isColimit (X : Set c.pt) :
IsClosed X ↔ ∀ (j : J), IsClosed (c.ι.app j ⁻¹' X) := by
simp only [← isOpen_compl_iff, isOpen_iff_of_isColimit _ hc,
Functor.const_obj_obj, Set.preimage_compl]
lemma continuous_iff_of_isColimit {X : Type u'} [TopologicalSpace X] (f : c.pt → X) :
Continuous f ↔ ∀ (j : J), Continuous (f ∘ c.ι.app j) := by
simp only [continuous_def, isOpen_iff_of_isColimit _ hc]
tauto
end IsColimit
variable (F)
theorem colimit_topology (F : J ⥤ TopCat.{u}) [HasColimit F] :
(colimit F).str = ⨆ j, (F.obj j).str.coinduced (colimit.ι F j) :=
coinduced_of_isColimit _ (colimit.isColimit _)
theorem colimit_isOpen_iff (F : J ⥤ TopCat.{u}) [HasColimit F]
(U : Set ((colimit F : _) : Type u)) :
IsOpen U ↔ ∀ j, IsOpen (colimit.ι F j ⁻¹' U) := by
apply isOpen_iff_of_isColimit _ (colimit.isColimit _)
lemma hasColimit_iff_small_colimitType :
HasColimit F ↔ Small.{u} (F ⋙ forget).ColimitType := by
rw [← Types.hasColimit_iff_small_colimitType]
constructor <;> intro
· infer_instance
· exact ⟨⟨_, isColimitCoconeOfForget _ (colimit.isColimit _)⟩⟩
instance topCat_hasColimitsOfShape (J : Type v) [Category J] [Small.{u} J] :
HasColimitsOfShape J TopCat.{u} where
has_colimit := fun F => by
rw [hasColimit_iff_small_colimitType]
infer_instance
instance topCat_hasColimitsOfSize [UnivLE.{v, u}] : HasColimitsOfSize.{w, v} TopCat.{u} where
instance topCat_hasColimits : HasColimits TopCat.{u} :=
TopCat.topCat_hasColimitsOfSize.{u, u}
instance forget_preservesColimitsOfSize :
PreservesColimitsOfSize.{w, v} (forget : TopCat.{u} ⥤ _) where
instance forget_preservesColimits : PreservesColimits (forget : TopCat.{u} ⥤ Type u) where
end Colimits
/-- The terminal object of `Top` is `PUnit`. -/
def isTerminalPUnit : IsTerminal (TopCat.of PUnit.{u + 1}) :=
haveI : ∀ X, Unique (X ⟶ TopCat.of PUnit.{u + 1}) := fun X =>
⟨⟨ofHom ⟨fun _ => PUnit.unit, continuous_const⟩⟩, fun f => by ext⟩
Limits.IsTerminal.ofUnique _
/-- The terminal object of `Top` is `PUnit`. -/
def terminalIsoPUnit : ⊤_ TopCat.{u} ≅ TopCat.of PUnit :=
terminalIsTerminal.uniqueUpToIso isTerminalPUnit
/-- The initial object of `Top` is `PEmpty`. -/
def isInitialPEmpty : IsInitial (TopCat.of PEmpty.{u + 1}) :=
haveI : ∀ X, Unique (TopCat.of PEmpty.{u + 1} ⟶ X) := fun X =>
⟨⟨ofHom ⟨fun x => x.elim, by continuity⟩⟩, fun f => by ext ⟨⟩⟩
Limits.IsInitial.ofUnique _
/-- The initial object of `Top` is `PEmpty`. -/
def initialIsoPEmpty : ⊥_ TopCat.{u} ≅ TopCat.of PEmpty :=
initialIsInitial.uniqueUpToIso isInitialPEmpty
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Limits/Cofiltered.lean | import Mathlib.Topology.Category.TopCat.Limits.Basic
import Mathlib.CategoryTheory.Filtered.Basic
/-!
# Cofiltered limits in the category of topological spaces
Given a *compatible* collection of topological bases for the factors in a cofiltered limit
which contain `Set.univ` and are closed under intersections, the induced *naive* collection
of sets in the limit is, in fact, a topological basis.
-/
open TopologicalSpace Topology
open CategoryTheory
open CategoryTheory.Limits
universe u v w
noncomputable section
namespace TopCat
section CofilteredLimit
variable {J : Type v} [Category.{w} J] [IsCofiltered J] (F : J ⥤ TopCat.{max v u}) (C : Cone F)
/-- Given a *compatible* collection of topological bases for the factors in a cofiltered limit
which contain `Set.univ` and are closed under intersections, the induced *naive* collection
of sets in the limit is, in fact, a topological basis.
-/
theorem isTopologicalBasis_cofiltered_limit (hC : IsLimit C) (T : ∀ j, Set (Set (F.obj j)))
(hT : ∀ j, IsTopologicalBasis (T j)) (univ : ∀ i : J, Set.univ ∈ T i)
(inter : ∀ (i) (U1 U2 : Set (F.obj i)), U1 ∈ T i → U2 ∈ T i → U1 ∩ U2 ∈ T i)
(compat : ∀ (i j : J) (f : i ⟶ j) (V : Set (F.obj j)) (_hV : V ∈ T j), F.map f ⁻¹' V ∈ T i) :
IsTopologicalBasis
{U : Set C.pt | ∃ (j : _) (V : Set (F.obj j)), V ∈ T j ∧ U = C.π.app j ⁻¹' V} := by
classical
convert IsTopologicalBasis.iInf_induced hT fun j (x : C.pt) => C.π.app j x using 1
· exact induced_of_isLimit C hC
ext U0
constructor
· rintro ⟨j, V, hV, rfl⟩
let U : ∀ i, Set (F.obj i) := fun i => if h : i = j then by rw [h]; exact V else Set.univ
refine ⟨U, {j}, ?_, ?_⟩
· simp only [Finset.mem_singleton]
rintro i rfl
simpa [U]
· simp [U]
· rintro ⟨U, G, h1, h2⟩
obtain ⟨j, hj⟩ := IsCofiltered.inf_objs_exists G
let g : ∀ e ∈ G, j ⟶ e := fun _ he => (hj he).some
let Vs : J → Set (F.obj j) := fun e => if h : e ∈ G then F.map (g e h) ⁻¹' U e else Set.univ
let V : Set (F.obj j) := ⋂ (e : J) (_he : e ∈ G), Vs e
refine ⟨j, V, ?_, ?_⟩
· -- An intermediate claim used to apply induction along `G : Finset J` later on.
have :
∀ (S : Set (Set (F.obj j))) (E : Finset J) (P : J → Set (F.obj j)) (_univ : Set.univ ∈ S)
(_inter : ∀ A B : Set (F.obj j), A ∈ S → B ∈ S → A ∩ B ∈ S)
(_cond : ∀ (e : J) (_he : e ∈ E), P e ∈ S), (⋂ (e) (_he : e ∈ E), P e) ∈ S := by
intro S E
induction E using Finset.induction_on with
| empty =>
intro P he _hh
simpa
| insert a E _ha hh1 =>
intro hh2 hh3 hh4 hh5
rw [Finset.set_biInter_insert]
refine hh4 _ _ (hh5 _ (Finset.mem_insert_self _ _)) (hh1 _ hh3 hh4 ?_)
intro e he
exact hh5 e (Finset.mem_insert_of_mem he)
-- use the intermediate claim to finish off the goal using `univ` and `inter`.
refine this _ _ _ (univ _) (inter _) ?_
intro e he
dsimp [Vs]
rw [dif_pos he]
exact compat j e (g e he) (U e) (h1 e he)
· -- conclude...
rw [h2]
change _ = (C.π.app j)⁻¹' ⋂ (e : J) (_ : e ∈ G), Vs e
rw [Set.preimage_iInter]
apply congrArg
ext1 e
rw [Set.preimage_iInter]
apply congrArg
ext1 he
simp [Vs, dif_pos he, ← Set.preimage_comp, ← coe_comp]
end CofilteredLimit
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean | import Mathlib.Topology.Category.TopCat.Limits.Products
/-!
# Pullbacks and pushouts in the category of topological spaces
-/
open TopologicalSpace Topology
open CategoryTheory
open CategoryTheory.Limits
universe v u w
noncomputable section
namespace TopCat
variable {J : Type v} [Category.{w} J]
section Pullback
variable {X Y Z : TopCat.{u}}
/-- The first projection from the pullback. -/
abbrev pullbackFst (f : X ⟶ Z) (g : Y ⟶ Z) : TopCat.of { p : X × Y // f p.1 = g p.2 } ⟶ X :=
ofHom ⟨Prod.fst ∘ Subtype.val, by fun_prop⟩
lemma pullbackFst_apply (f : X ⟶ Z) (g : Y ⟶ Z) (x) : pullbackFst f g x = x.1.1 := rfl
/-- The second projection from the pullback. -/
abbrev pullbackSnd (f : X ⟶ Z) (g : Y ⟶ Z) : TopCat.of { p : X × Y // f p.1 = g p.2 } ⟶ Y :=
ofHom ⟨Prod.snd ∘ Subtype.val, by fun_prop⟩
lemma pullbackSnd_apply (f : X ⟶ Z) (g : Y ⟶ Z) (x) : pullbackSnd f g x = x.1.2 := rfl
/-- The explicit pullback cone of `X, Y` given by `{ p : X × Y // f p.1 = g p.2 }`. -/
def pullbackCone (f : X ⟶ Z) (g : Y ⟶ Z) : PullbackCone f g :=
PullbackCone.mk (pullbackFst f g) (pullbackSnd f g)
(by
dsimp [pullbackFst, pullbackSnd, Function.comp_def]
ext ⟨x, h⟩
simpa)
/-- The constructed cone is a limit. -/
def pullbackConeIsLimit (f : X ⟶ Z) (g : Y ⟶ Z) : IsLimit (pullbackCone f g) :=
PullbackCone.isLimitAux' _
(by
intro S
constructor; swap
· exact ofHom
{ toFun := fun x =>
⟨⟨S.fst x, S.snd x⟩, by simpa using ConcreteCategory.congr_hom S.condition x⟩
continuous_toFun := by fun_prop }
refine ⟨?_, ?_, ?_⟩
· delta pullbackCone
ext a
dsimp
· delta pullbackCone
ext a
dsimp
· intro m h₁ h₂
ext x
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): used to be `ext x`.
apply Subtype.ext
apply Prod.ext
· simpa using ConcreteCategory.congr_hom h₁ x
· simpa using ConcreteCategory.congr_hom h₂ x)
/-- The pullback of two maps can be identified as a subspace of `X × Y`. -/
def pullbackIsoProdSubtype (f : X ⟶ Z) (g : Y ⟶ Z) :
pullback f g ≅ TopCat.of { p : X × Y // f p.1 = g p.2 } :=
(limit.isLimit _).conePointUniqueUpToIso (pullbackConeIsLimit f g)
@[reassoc (attr := simp)]
theorem pullbackIsoProdSubtype_inv_fst (f : X ⟶ Z) (g : Y ⟶ Z) :
(pullbackIsoProdSubtype f g).inv ≫ pullback.fst _ _ = pullbackFst f g := by
simp [pullbackCone, pullbackIsoProdSubtype]
theorem pullbackIsoProdSubtype_inv_fst_apply (f : X ⟶ Z) (g : Y ⟶ Z)
(x : { p : X × Y // f p.1 = g p.2 }) :
pullback.fst f g ((pullbackIsoProdSubtype f g).inv x) = (x : X × Y).fst :=
ConcreteCategory.congr_hom (pullbackIsoProdSubtype_inv_fst f g) x
@[reassoc (attr := simp)]
theorem pullbackIsoProdSubtype_inv_snd (f : X ⟶ Z) (g : Y ⟶ Z) :
(pullbackIsoProdSubtype f g).inv ≫ pullback.snd _ _ = pullbackSnd f g := by
simp [pullbackCone, pullbackIsoProdSubtype]
theorem pullbackIsoProdSubtype_inv_snd_apply (f : X ⟶ Z) (g : Y ⟶ Z)
(x : { p : X × Y // f p.1 = g p.2 }) :
pullback.snd f g ((pullbackIsoProdSubtype f g).inv x) = (x : X × Y).snd :=
ConcreteCategory.congr_hom (pullbackIsoProdSubtype_inv_snd f g) x
theorem pullbackIsoProdSubtype_hom_fst (f : X ⟶ Z) (g : Y ⟶ Z) :
(pullbackIsoProdSubtype f g).hom ≫ pullbackFst f g = pullback.fst _ _ := by
rw [← Iso.eq_inv_comp, pullbackIsoProdSubtype_inv_fst]
theorem pullbackIsoProdSubtype_hom_snd (f : X ⟶ Z) (g : Y ⟶ Z) :
(pullbackIsoProdSubtype f g).hom ≫ pullbackSnd f g = pullback.snd _ _ := by
rw [← Iso.eq_inv_comp, pullbackIsoProdSubtype_inv_snd]
theorem pullbackIsoProdSubtype_hom_apply {f : X ⟶ Z} {g : Y ⟶ Z}
(x : ↑(pullback f g)) :
(pullbackIsoProdSubtype f g).hom x =
⟨⟨pullback.fst f g x, pullback.snd f g x⟩, by
simpa using CategoryTheory.congr_fun pullback.condition x⟩ := rfl
theorem pullback_topology {X Y Z : TopCat.{u}} (f : X ⟶ Z) (g : Y ⟶ Z) :
(pullback f g).str =
induced (pullback.fst f g) X.str ⊓
induced (pullback.snd f g) Y.str := by
let homeo := homeoOfIso (pullbackIsoProdSubtype f g)
refine homeo.isInducing.eq_induced.trans ?_
change induced homeo (induced _ ( (induced Prod.fst X.str) ⊓ (induced Prod.snd Y.str))) = _
simp only [induced_compose, induced_inf]
rfl
theorem range_pullback_to_prod {X Y Z : TopCat} (f : X ⟶ Z) (g : Y ⟶ Z) :
Set.range (prod.lift (pullback.fst f g) (pullback.snd f g)) =
{ x | (Limits.prod.fst ≫ f) x = (Limits.prod.snd ≫ g) x } := by
ext x
constructor
· rintro ⟨y, rfl⟩
simp only [← ConcreteCategory.comp_apply, Set.mem_setOf_eq]
simp [pullback.condition]
· rintro (h : f (_, _).1 = g (_, _).2)
use (pullbackIsoProdSubtype f g).inv ⟨⟨_, _⟩, h⟩
apply Concrete.limit_ext
rintro ⟨⟨⟩⟩ <;>
rw [← ConcreteCategory.comp_apply, ← ConcreteCategory.comp_apply, limit.lift_π] <;>
-- This used to be `simp` before https://github.com/leanprover/lean4/pull/2644
cat_disch
/-- The pullback along an embedding is (isomorphic to) the preimage. -/
noncomputable
def pullbackHomeoPreimage
{X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
(f : X → Z) (hf : Continuous f) (g : Y → Z) (hg : IsEmbedding g) :
{ p : X × Y // f p.1 = g p.2 } ≃ₜ f ⁻¹' Set.range g where
toFun := fun x ↦ ⟨x.1.1, _, x.2.symm⟩
invFun := fun x ↦ ⟨⟨x.1, Exists.choose x.2⟩, (Exists.choose_spec x.2).symm⟩
left_inv := by
intro x
ext <;> dsimp
apply hg.injective
convert x.prop
exact Exists.choose_spec (p := fun y ↦ g y = f (↑x : X × Y).1) _
continuous_toFun := by fun_prop
continuous_invFun := by
apply Continuous.subtype_mk
refine continuous_subtype_val.prodMk <| hg.isInducing.continuous_iff.mpr ?_
convert hf.comp continuous_subtype_val
ext x
exact Exists.choose_spec x.2
theorem isInducing_pullback_to_prod {X Y Z : TopCat.{u}} (f : X ⟶ Z) (g : Y ⟶ Z) :
IsInducing <| ⇑(prod.lift (pullback.fst f g) (pullback.snd f g)) :=
⟨by simp [prod_topology, pullback_topology, induced_compose, ← coe_comp]⟩
theorem isEmbedding_pullback_to_prod {X Y Z : TopCat.{u}} (f : X ⟶ Z) (g : Y ⟶ Z) :
IsEmbedding <| ⇑(prod.lift (pullback.fst f g) (pullback.snd f g)) :=
⟨isInducing_pullback_to_prod f g, (TopCat.mono_iff_injective _).mp inferInstance⟩
/-- If the map `S ⟶ T` is mono, then there is a description of the image of `W ×ₛ X ⟶ Y ×ₜ Z`. -/
theorem range_pullback_map {W X Y Z S T : TopCat} (f₁ : W ⟶ S) (f₂ : X ⟶ S) (g₁ : Y ⟶ T)
(g₂ : Z ⟶ T) (i₁ : W ⟶ Y) (i₂ : X ⟶ Z) (i₃ : S ⟶ T) [H₃ : Mono i₃] (eq₁ : f₁ ≫ i₃ = i₁ ≫ g₁)
(eq₂ : f₂ ≫ i₃ = i₂ ≫ g₂) :
Set.range (pullback.map f₁ f₂ g₁ g₂ i₁ i₂ i₃ eq₁ eq₂) =
(pullback.fst g₁ g₂) ⁻¹' Set.range i₁ ∩ (pullback.snd g₁ g₂) ⁻¹' Set.range i₂ := by
ext
constructor
· rintro ⟨y, rfl⟩
simp only [Set.mem_inter_iff, Set.mem_preimage, Set.mem_range]
rw [← ConcreteCategory.comp_apply, ← ConcreteCategory.comp_apply]
simp only [limit.lift_π, PullbackCone.mk_pt, PullbackCone.mk_π_app]
exact ⟨exists_apply_eq_apply _ _, exists_apply_eq_apply _ _⟩
rintro ⟨⟨x₁, hx₁⟩, ⟨x₂, hx₂⟩⟩
have : f₁ x₁ = f₂ x₂ := by
apply (TopCat.mono_iff_injective _).mp H₃
rw [← ConcreteCategory.comp_apply, eq₁, ← ConcreteCategory.comp_apply, eq₂,
ConcreteCategory.comp_apply, ConcreteCategory.comp_apply, hx₁, hx₂,
← ConcreteCategory.comp_apply, pullback.condition, ConcreteCategory.comp_apply]
use (pullbackIsoProdSubtype f₁ f₂).inv ⟨⟨x₁, x₂⟩, this⟩
apply Concrete.limit_ext
rintro (_ | _ | _) <;>
rw [← ConcreteCategory.comp_apply, ← ConcreteCategory.comp_apply]
· simp [hx₁, ← limit.w _ WalkingCospan.Hom.inl]
· simp [hx₁]
· simp [hx₂]
theorem pullback_fst_range {X Y S : TopCat} (f : X ⟶ S) (g : Y ⟶ S) :
Set.range (pullback.fst f g) = { x : X | ∃ y : Y, f x = g y } := by
ext x
constructor
· rintro ⟨y, rfl⟩
use pullback.snd f g y
exact CategoryTheory.congr_fun pullback.condition y
· rintro ⟨y, eq⟩
use (TopCat.pullbackIsoProdSubtype f g).inv ⟨⟨x, y⟩, eq⟩
rw [pullbackIsoProdSubtype_inv_fst_apply]
theorem pullback_snd_range {X Y S : TopCat} (f : X ⟶ S) (g : Y ⟶ S) :
Set.range (pullback.snd f g) = { y : Y | ∃ x : X, f x = g y } := by
ext y
constructor
· rintro ⟨x, rfl⟩
use pullback.fst f g x
exact CategoryTheory.congr_fun pullback.condition x
· rintro ⟨x, eq⟩
use (TopCat.pullbackIsoProdSubtype f g).inv ⟨⟨x, y⟩, eq⟩
rw [pullbackIsoProdSubtype_inv_snd_apply]
/-- If there is a diagram where the morphisms `W ⟶ Y` and `X ⟶ Z` are embeddings,
then the induced morphism `W ×ₛ X ⟶ Y ×ₜ Z` is also an embedding.
```
W ⟶ Y
↘ ↘
S ⟶ T
↗ ↗
X ⟶ Z
```
-/
theorem pullback_map_isEmbedding {W X Y Z S T : TopCat.{u}} (f₁ : W ⟶ S) (f₂ : X ⟶ S)
(g₁ : Y ⟶ T) (g₂ : Z ⟶ T) {i₁ : W ⟶ Y} {i₂ : X ⟶ Z} (H₁ : IsEmbedding i₁)
(H₂ : IsEmbedding i₂) (i₃ : S ⟶ T) (eq₁ : f₁ ≫ i₃ = i₁ ≫ g₁) (eq₂ : f₂ ≫ i₃ = i₂ ≫ g₂) :
IsEmbedding (pullback.map f₁ f₂ g₁ g₂ i₁ i₂ i₃ eq₁ eq₂) := by
refine .of_comp (ContinuousMap.continuous_toFun _)
(show Continuous (prod.lift (pullback.fst g₁ g₂) (pullback.snd g₁ g₂)) from
ContinuousMap.continuous_toFun _)
?_
suffices
IsEmbedding (prod.lift (pullback.fst f₁ f₂) (pullback.snd f₁ f₂) ≫ Limits.prod.map i₁ i₂) by
simpa [← coe_comp] using this
rw [coe_comp]
exact (isEmbedding_prodMap H₁ H₂).comp (isEmbedding_pullback_to_prod _ _)
/-- If there is a diagram where the morphisms `W ⟶ Y` and `X ⟶ Z` are open embeddings, and `S ⟶ T`
is mono, then the induced morphism `W ×ₛ X ⟶ Y ×ₜ Z` is also an open embedding.
```
W ⟶ Y
↘ ↘
S ⟶ T
↗ ↗
X ⟶ Z
```
-/
theorem pullback_map_isOpenEmbedding {W X Y Z S T : TopCat.{u}} (f₁ : W ⟶ S)
(f₂ : X ⟶ S) (g₁ : Y ⟶ T) (g₂ : Z ⟶ T) {i₁ : W ⟶ Y} {i₂ : X ⟶ Z} (H₁ : IsOpenEmbedding i₁)
(H₂ : IsOpenEmbedding i₂) (i₃ : S ⟶ T) [H₃ : Mono i₃] (eq₁ : f₁ ≫ i₃ = i₁ ≫ g₁)
(eq₂ : f₂ ≫ i₃ = i₂ ≫ g₂) : IsOpenEmbedding (pullback.map f₁ f₂ g₁ g₂ i₁ i₂ i₃ eq₁ eq₂) := by
constructor
· apply
pullback_map_isEmbedding f₁ f₂ g₁ g₂ H₁.isEmbedding H₂.isEmbedding i₃ eq₁ eq₂
· rw [range_pullback_map]
apply IsOpen.inter <;> apply Continuous.isOpen_preimage
· apply ContinuousMap.continuous_toFun
· exact H₁.isOpen_range
· apply ContinuousMap.continuous_toFun
· exact H₂.isOpen_range
lemma snd_isEmbedding_of_left {X Y S : TopCat} {f : X ⟶ S} (H : IsEmbedding f) (g : Y ⟶ S) :
IsEmbedding <| ⇑(pullback.snd f g) := by
convert (homeoOfIso (asIso (pullback.snd (𝟙 S) g))).isEmbedding.comp
(pullback_map_isEmbedding (i₂ := 𝟙 Y)
f g (𝟙 S) g H (homeoOfIso (Iso.refl _)).isEmbedding (𝟙 _) rfl (by simp))
simp [homeoOfIso, ← coe_comp]
theorem fst_isEmbedding_of_right {X Y S : TopCat} (f : X ⟶ S) {g : Y ⟶ S}
(H : IsEmbedding g) : IsEmbedding <| ⇑(pullback.fst f g) := by
convert (homeoOfIso (asIso (pullback.fst f (𝟙 S)))).isEmbedding.comp
(pullback_map_isEmbedding (i₁ := 𝟙 X)
f g f (𝟙 _) (homeoOfIso (Iso.refl _)).isEmbedding H (𝟙 _) rfl (by simp))
simp [homeoOfIso, ← coe_comp]
theorem isEmbedding_of_pullback {X Y S : TopCat} {f : X ⟶ S} {g : Y ⟶ S} (H₁ : IsEmbedding f)
(H₂ : IsEmbedding g) : IsEmbedding (limit.π (cospan f g) WalkingCospan.one) := by
convert H₂.comp (snd_isEmbedding_of_left H₁ g)
rw [← coe_comp, ← limit.w _ WalkingCospan.Hom.inr]
rfl
theorem snd_isOpenEmbedding_of_left {X Y S : TopCat} {f : X ⟶ S} (H : IsOpenEmbedding f)
(g : Y ⟶ S) : IsOpenEmbedding <| ⇑(pullback.snd f g) := by
convert (homeoOfIso (asIso (pullback.snd (𝟙 S) g))).isOpenEmbedding.comp
(pullback_map_isOpenEmbedding (i₂ := 𝟙 Y) f g (𝟙 _) g H
(homeoOfIso (Iso.refl _)).isOpenEmbedding (𝟙 _) rfl (by simp))
simp [homeoOfIso, ← coe_comp]
theorem fst_isOpenEmbedding_of_right {X Y S : TopCat} (f : X ⟶ S) {g : Y ⟶ S}
(H : IsOpenEmbedding g) : IsOpenEmbedding <| ⇑(pullback.fst f g) := by
convert (homeoOfIso (asIso (pullback.fst f (𝟙 S)))).isOpenEmbedding.comp
(pullback_map_isOpenEmbedding (i₁ := 𝟙 X) f g f (𝟙 _)
(homeoOfIso (Iso.refl _)).isOpenEmbedding H (𝟙 _) rfl (by simp))
simp [homeoOfIso, ← coe_comp]
/-- If `X ⟶ S`, `Y ⟶ S` are open embeddings, then so is `X ×ₛ Y ⟶ S`. -/
theorem isOpenEmbedding_of_pullback {X Y S : TopCat} {f : X ⟶ S} {g : Y ⟶ S}
(H₁ : IsOpenEmbedding f) (H₂ : IsOpenEmbedding g) :
IsOpenEmbedding (limit.π (cospan f g) WalkingCospan.one) := by
convert H₂.comp (snd_isOpenEmbedding_of_left H₁ g)
rw [← coe_comp, ← limit.w _ WalkingCospan.Hom.inr]
rfl
theorem fst_iso_of_right_embedding_range_subset {X Y S : TopCat} (f : X ⟶ S) {g : Y ⟶ S}
(hg : IsEmbedding g) (H : Set.range f ⊆ Set.range g) :
IsIso (pullback.fst f g) := by
let esto : (pullback f g : TopCat) ≃ₜ X :=
(fst_isEmbedding_of_right f hg).toHomeomorph.trans
{ toFun := Subtype.val
invFun := fun x =>
⟨x, by
rw [pullback_fst_range]
exact ⟨_, (H (Set.mem_range_self x)).choose_spec.symm⟩⟩ }
convert (isoOfHomeo esto).isIso_hom
theorem snd_iso_of_left_embedding_range_subset {X Y S : TopCat} {f : X ⟶ S} (hf : IsEmbedding f)
(g : Y ⟶ S) (H : Set.range g ⊆ Set.range f) : IsIso (pullback.snd f g) := by
let esto : (pullback f g : TopCat) ≃ₜ Y :=
(snd_isEmbedding_of_left hf g).toHomeomorph.trans
{ toFun := Subtype.val
invFun := fun x =>
⟨x, by
rw [pullback_snd_range]
exact ⟨_, (H (Set.mem_range_self x)).choose_spec⟩⟩ }
convert (isoOfHomeo esto).isIso_hom
theorem pullback_snd_image_fst_preimage (f : X ⟶ Z) (g : Y ⟶ Z) (U : Set X) :
(pullback.snd f g) '' ((pullback.fst f g) ⁻¹' U) =
g ⁻¹' (f '' U) := by
ext x
constructor
· rintro ⟨y, hy, rfl⟩
exact
⟨(pullback.fst f g) y, hy, CategoryTheory.congr_fun pullback.condition y⟩
· rintro ⟨y, hy, eq⟩
-- next 5 lines were
-- `exact ⟨(TopCat.pullbackIsoProdSubtype f g).inv ⟨⟨_, _⟩, eq⟩, by simpa, by simp⟩` before https://github.com/leanprover-community/mathlib4/pull/13170
refine ⟨(TopCat.pullbackIsoProdSubtype f g).inv ⟨⟨_, _⟩, eq⟩, ?_, ?_⟩
· simp only [coe_of, Set.mem_preimage]
convert hy
rw [pullbackIsoProdSubtype_inv_fst_apply]
· rw [pullbackIsoProdSubtype_inv_snd_apply]
theorem pullback_fst_image_snd_preimage (f : X ⟶ Z) (g : Y ⟶ Z) (U : Set Y) :
(pullback.fst f g) '' ((pullback.snd f g) ⁻¹' U) =
f ⁻¹' (g '' U) := by
ext x
constructor
· rintro ⟨y, hy, rfl⟩
exact
⟨(pullback.snd f g) y, hy,
(CategoryTheory.congr_fun pullback.condition y).symm⟩
· rintro ⟨y, hy, eq⟩
-- next 5 lines were
-- `exact ⟨(TopCat.pullbackIsoProdSubtype f g).inv ⟨⟨_, _⟩, eq.symm⟩, by simpa, by simp⟩`
-- before https://github.com/leanprover-community/mathlib4/pull/13170
refine ⟨(TopCat.pullbackIsoProdSubtype f g).inv ⟨⟨_, _⟩, eq.symm⟩, ?_, ?_⟩
· simp only [coe_of, Set.mem_preimage]
convert hy
rw [pullbackIsoProdSubtype_inv_snd_apply]
· rw [pullbackIsoProdSubtype_inv_fst_apply]
end Pullback
section
variable {X Y : TopCat.{u}} {f g : X ⟶ Y}
lemma isOpen_iff_of_isColimit_cofork (c : Cofork f g) (hc : IsColimit c) (U : Set c.pt) :
IsOpen U ↔ IsOpen (c.π ⁻¹' U) := by
rw [isOpen_iff_of_isColimit _ hc]
constructor
· intro h
exact h .one
· rintro h (_ | _)
· rw [← c.w .left]
exact Continuous.isOpen_preimage f.hom.continuous (c.π ⁻¹' U) h
· exact h
lemma isQuotientMap_of_isColimit_cofork (c : Cofork f g) (hc : IsColimit c) :
IsQuotientMap c.π := by
rw [isQuotientMap_iff]
constructor
· simpa only [← epi_iff_surjective] using epi_of_isColimit_cofork hc
· exact isOpen_iff_of_isColimit_cofork c hc
theorem coequalizer_isOpen_iff (U : Set ((coequalizer f g :) : Type u)) :
IsOpen U ↔ IsOpen (coequalizer.π f g ⁻¹' U) :=
isOpen_iff_of_isColimit_cofork _ (coequalizerIsCoequalizer f g) _
end
end TopCat |
.lake/packages/mathlib/Mathlib/Topology/Category/CompHausLike/SigmaComparison.lean | import Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products
import Mathlib.Topology.Category.CompHausLike.Limits
/-!
# The sigma-comparison map
This file defines the map `CompHausLike.sigmaComparison` associated to a presheaf `X` on
`CompHausLike P`, and a finite family `S₁,...,Sₙ` of spaces in `CompHausLike P`, where `P` is
stable under taking finite disjoint unions.
The map `sigmaComparison` is the canonical map `X(S₁ ⊔ ... ⊔ Sₙ) ⟶ X(S₁) × ... × X(Sₙ)` induced by
the inclusion maps `Sᵢ ⟶ S₁ ⊔ ... ⊔ Sₙ`, and it is an isomorphism when `X` preserves finite
products.
-/
universe u w
open CategoryTheory Limits
namespace CompHausLike
variable {P : TopCat.{u} → Prop} [HasExplicitFiniteCoproducts.{u} P]
(X : (CompHausLike.{u} P)ᵒᵖ ⥤ Type max u w) [PreservesFiniteProducts X]
{α : Type u} [Finite α] (σ : α → Type u)
[∀ a, TopologicalSpace (σ a)] [∀ a, CompactSpace (σ a)] [∀ a, T2Space (σ a)]
[∀ a, HasProp P (σ a)]
instance : HasProp P (Σ (a : α), (σ a)) := HasExplicitFiniteCoproducts.hasProp (fun a ↦ of P (σ a))
/--
The comparison map from the value of a condensed set on a finite coproduct to the product of the
values on the components.
-/
def sigmaComparison : X.obj ⟨(of P ((a : α) × σ a))⟩ ⟶ ((a : α) → X.obj ⟨of P (σ a)⟩) :=
fun x a ↦ X.map (ofHom _ ⟨Sigma.mk a, continuous_sigmaMk⟩).op x
theorem sigmaComparison_eq_comp_isos : sigmaComparison X σ =
(X.mapIso (opCoproductIsoProduct'
(finiteCoproduct.isColimit.{u, u} (fun a ↦ of P (σ a)))
(productIsProduct fun x ↦ Opposite.op (of P (σ x))))).hom ≫
(PreservesProduct.iso X fun a ↦ ⟨of P (σ a)⟩).hom ≫
(Types.productIso.{u, max u w} fun a ↦ X.obj ⟨of P (σ a)⟩).hom := by
ext x a
simp only [Cofan.mk_pt, Fan.mk_pt, Functor.mapIso_hom,
PreservesProduct.iso_hom, types_comp_apply, Types.productIso_hom_comp_eval_apply]
have := congrFun (piComparison_comp_π X (fun a ↦ ⟨of P (σ a)⟩) a)
simp only [types_comp_apply] at this
rw [this, ← FunctorToTypes.map_comp_apply]
simp only [sigmaComparison]
apply congrFun
congr 2
rw [← opCoproductIsoProduct_inv_comp_ι]
simp only [Opposite.unop_op, unop_comp, Quiver.Hom.unop_op, Category.assoc]
simp only [opCoproductIsoProduct, ← unop_comp, opCoproductIsoProduct'_comp_self]
erw [IsColimit.fac]
rfl
instance isIsoSigmaComparison : IsIso <| sigmaComparison X σ := by
rw [sigmaComparison_eq_comp_isos]
infer_instance
end CompHausLike |
.lake/packages/mathlib/Mathlib/Topology/Category/CompHausLike/EffectiveEpi.lean | import Mathlib.CategoryTheory.Sites.Coherent.Comparison
import Mathlib.Topology.Category.CompHausLike.Limits
/-!
# Effective epimorphisms in `CompHausLike`
In any category of compact Hausdorff spaces, continuous surjections are effective epimorphisms.
We deduce that if the converse holds and explicit pullbacks exist, then `CompHausLike P` is
preregular.
If furthermore explicit finite coproducts exist, then `CompHausLike P` is precoherent.
-/
universe u
open CategoryTheory Limits Topology
namespace CompHausLike
variable {P : TopCat.{u} → Prop}
/--
If `π` is a surjective morphism in `CompHausLike P`, then it is an effective epi.
-/
noncomputable
def effectiveEpiStruct {B X : CompHausLike P} (π : X ⟶ B) (hπ : Function.Surjective π) :
EffectiveEpiStruct π where
desc e h := ofHom _ ((IsQuotientMap.of_surjective_continuous hπ π.hom.continuous).lift e.hom
fun a b hab ↦
CategoryTheory.congr_fun (h
(ofHom _ ⟨fun _ ↦ a, continuous_const⟩)
(ofHom _ ⟨fun _ ↦ b, continuous_const⟩)
(by ext; exact hab)) a)
fac e h := TopCat.hom_ext ((IsQuotientMap.of_surjective_continuous hπ π.hom.continuous).lift_comp
e.hom
fun a b hab ↦ CategoryTheory.congr_fun (h
(ofHom _ ⟨fun _ ↦ a, continuous_const⟩)
(ofHom _ ⟨fun _ ↦ b, continuous_const⟩)
(by ext; exact hab)) a)
uniq e h g hm := by
suffices g = ofHom _ ((IsQuotientMap.of_surjective_continuous hπ π.hom.continuous).liftEquiv
⟨e.hom,
fun a b hab ↦ CategoryTheory.congr_fun
(h
(ofHom _ ⟨fun _ ↦ a, continuous_const⟩)
(ofHom _ ⟨fun _ ↦ b, continuous_const⟩)
(by ext; exact hab))
a⟩) by assumption
apply ConcreteCategory.ext
rw [hom_ofHom,
← Equiv.symm_apply_eq (IsQuotientMap.of_surjective_continuous hπ π.hom.continuous).liftEquiv]
ext
simp only [IsQuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm]
rfl
theorem preregular [HasExplicitPullbacks P]
(hs : ∀ ⦃X Y : CompHausLike P⦄ (f : X ⟶ Y), EffectiveEpi f → Function.Surjective f) :
Preregular (CompHausLike P) where
exists_fac := by
intro X Y Z f π hπ
refine ⟨pullback f π, pullback.fst f π, ⟨⟨effectiveEpiStruct _ ?_⟩⟩, pullback.snd f π,
(pullback.condition _ _).symm⟩
intro y
obtain ⟨z, hz⟩ := hs π hπ (f y)
exact ⟨⟨(y, z), hz.symm⟩, rfl⟩
theorem precoherent [HasExplicitPullbacks P] [HasExplicitFiniteCoproducts.{0} P]
(hs : ∀ ⦃X Y : CompHausLike P⦄ (f : X ⟶ Y), EffectiveEpi f → Function.Surjective f) :
Precoherent (CompHausLike P) := by
have : Preregular (CompHausLike P) := preregular hs
infer_instance
end CompHausLike |
.lake/packages/mathlib/Mathlib/Topology/Category/CompHausLike/Basic.lean | import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.CategoryTheory.Functor.EpiMono
import Mathlib.CategoryTheory.Functor.ReflectsIso.Basic
/-!
# Categories of Compact Hausdorff Spaces
We construct the category of compact Hausdorff spaces satisfying an additional property `P`.
## Implementation
We define a structure `CompHausLike` which takes as an argument a predicate `P` on topological
spaces. It consists of the data of a topological space, satisfying the additional properties of
being compact and Hausdorff, and satisfying `P`. We give a category structure to `CompHausLike P`
induced by the forgetful functor to topological spaces.
It used to be the case (before https://github.com/leanprover-community/mathlib4/pull/12930 was merged) that several different categories of compact
Hausdorff spaces, possibly satisfying some extra property, were defined from scratch in this way.
For example, one would define a structure `CompHaus` as follows:
```lean
structure CompHaus where
toTop : TopCat
[is_compact : CompactSpace toTop]
[is_hausdorff : T2Space toTop]
```
and give it the category structure induced from topological spaces. Then the category of profinite
spaces was defined as follows:
```lean
structure Profinite where
toCompHaus : CompHaus
[isTotallyDisconnected : TotallyDisconnectedSpace toCompHaus]
```
The categories `Stonean` consisting of extremally disconnected compact Hausdorff spaces and
`LightProfinite` consisting of totally disconnected, second countable compact Hausdorff spaces were
defined in a similar way. This resulted in code duplication, and reducing this duplication was part
of the motivation for introducing `CompHausLike`.
Using `CompHausLike`, we can now define
`CompHaus := CompHausLike (fun _ ↦ True)`
`Profinite := CompHausLike (fun X ↦ TotallyDisconnectedSpace X)`.
`Stonean := CompHausLike (fun X ↦ ExtremallyDisconnected X)`.
`LightProfinite := CompHausLike (fun X ↦ TotallyDisconnectedSpace X ∧ SecondCountableTopology X)`.
These four categories are important building blocks of condensed objects (see the files
`Condensed.Basic` and `Condensed.Light.Basic`). These categories share many properties and often,
one wants to argue about several of them simultaneously. This is the other part of the motivation
for introducing `CompHausLike`. On paper, one would say "let `C` be on of the categories `CompHaus`
or `Profinite`, then the following holds: ...". This was not possible in Lean using the old
definitions. Using the new definitions, this becomes a matter of identifying what common property
of `CompHaus` and `Profinite` is used in the proof in question, and then proving the theorem for
`CompHausLike P` satisfying that property, and it will automatically apply to both `CompHaus` and
`Profinite`.
-/
universe u
open CategoryTheory
variable (P : TopCat.{u} → Prop)
/-- The type of Compact Hausdorff topological spaces satisfying an additional property `P`. -/
structure CompHausLike where
/-- The underlying topological space of an object of `CompHausLike P`. -/
toTop : TopCat
/-- The underlying topological space is compact. -/
[is_compact : CompactSpace toTop]
/-- The underlying topological space is T2. -/
[is_hausdorff : T2Space toTop]
/-- The underlying topological space satisfies P. -/
prop : P toTop
namespace CompHausLike
attribute [instance] is_compact is_hausdorff
instance : CoeSort (CompHausLike P) (Type u) :=
⟨fun X => X.toTop⟩
instance category : Category (CompHausLike P) :=
InducedCategory.category toTop
instance concreteCategory : ConcreteCategory (CompHausLike P) (C(·, ·)) :=
InducedCategory.concreteCategory toTop
instance hasForget₂ : HasForget₂ (CompHausLike P) TopCat :=
InducedCategory.hasForget₂ _
variable (X : Type u) [TopologicalSpace X] [CompactSpace X] [T2Space X]
/-- This wraps the predicate `P : TopCat → Prop` in a typeclass. -/
class HasProp : Prop where
hasProp : P (TopCat.of X)
instance (X : CompHausLike P) : HasProp P X := ⟨X.4⟩
variable [HasProp P X]
/-- A constructor for objects of the category `CompHausLike P`,
taking a type, and bundling the compact Hausdorff topology
found by typeclass inference. -/
abbrev of : CompHausLike P where
toTop := TopCat.of X
is_compact := ‹_›
is_hausdorff := ‹_›
prop := HasProp.hasProp
theorem coe_of : (CompHausLike.of P X : Type _) = X := rfl
@[simp]
theorem coe_id (X : CompHausLike P) : (𝟙 X : X → X) = id :=
rfl
@[simp]
theorem coe_comp {X Y Z : CompHausLike P} (f : X ⟶ Y) (g : Y ⟶ Z) :
(f ≫ g : X → Z) = g ∘ f :=
rfl
section
variable {X} {Y : Type u} [TopologicalSpace Y] [CompactSpace Y] [T2Space Y] [HasProp P Y]
variable {Z : Type u} [TopologicalSpace Z] [CompactSpace Z] [T2Space Z] [HasProp P Z]
/-- Typecheck a continuous map as a morphism in the category `CompHausLike P`. -/
abbrev ofHom (f : C(X, Y)) : of P X ⟶ of P Y := ConcreteCategory.ofHom f
@[simp] lemma hom_ofHom (f : C(X, Y)) : ConcreteCategory.hom (ofHom P f) = f := rfl
@[simp] lemma ofHom_id : ofHom P (ContinuousMap.id X) = 𝟙 (of _ X) := rfl
@[simp] lemma ofHom_comp (f : C(X, Y)) (g : C(Y, Z)) :
ofHom P (g.comp f) = ofHom _ f ≫ ofHom _ g := rfl
end
variable {P}
/-- If `P` implies `P'`, then there is a functor from `CompHausLike P` to `CompHausLike P'`. -/
@[simps map]
def toCompHausLike {P P' : TopCat → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) :
CompHausLike P ⥤ CompHausLike P' where
obj X :=
have : HasProp P' X := ⟨(h _ X.prop)⟩
CompHausLike.of _ X
map f := f
section
variable {P P' : TopCat → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop)
/-- If `P` implies `P'`, then the functor from `CompHausLike P` to `CompHausLike P'` is fully
faithful. -/
def fullyFaithfulToCompHausLike : (toCompHausLike h).FullyFaithful :=
fullyFaithfulInducedFunctor _
instance : (toCompHausLike h).Full := (fullyFaithfulToCompHausLike h).full
instance : (toCompHausLike h).Faithful := (fullyFaithfulToCompHausLike h).faithful
end
variable (P)
/-- The fully faithful embedding of `CompHausLike P` in `TopCat`. -/
@[simps! map]
def compHausLikeToTop : CompHausLike.{u} P ⥤ TopCat.{u} :=
inducedFunctor _
-- The `Full, Faithful` instances should be constructed by a deriving handler.
-- https://github.com/leanprover-community/mathlib4/issues/380
example {P P' : TopCat → Prop} (h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) :
toCompHausLike h ⋙ compHausLikeToTop P' = compHausLikeToTop P := rfl
/-- The functor from `CompHausLike P` to `TopCat` is fully faithful. -/
def fullyFaithfulCompHausLikeToTop : (compHausLikeToTop P).FullyFaithful :=
fullyFaithfulInducedFunctor _
instance : (compHausLikeToTop P).Full :=
inferInstanceAs (inducedFunctor _).Full
instance : (compHausLikeToTop P).Faithful :=
inferInstanceAs (inducedFunctor _).Faithful
instance (X : CompHausLike P) : CompactSpace ((compHausLikeToTop P).obj X) :=
inferInstanceAs (CompactSpace X.toTop)
instance (X : CompHausLike P) : T2Space ((compHausLikeToTop P).obj X) :=
inferInstanceAs (T2Space X.toTop)
variable {P}
theorem epi_of_surjective {X Y : CompHausLike.{u} P} (f : X ⟶ Y) (hf : Function.Surjective f) :
Epi f := by
rw [← CategoryTheory.epi_iff_surjective] at hf
exact (forget (CompHausLike P)).epi_of_epi_map hf
theorem mono_iff_injective {X Y : CompHausLike.{u} P} (f : X ⟶ Y) :
Mono f ↔ Function.Injective f := by
constructor
· intro hf x₁ x₂ h
let g₁ : X ⟶ X := ofHom _ ⟨fun _ => x₁, continuous_const⟩
let g₂ : X ⟶ X := ofHom _ ⟨fun _ => x₂, continuous_const⟩
have : g₁ ≫ f = g₂ ≫ f := by ext; exact h
exact CategoryTheory.congr_fun ((cancel_mono _).mp this) x₁
· rw [← CategoryTheory.mono_iff_injective]
apply (forget (CompHausLike P)).mono_of_mono_map
/-- Any continuous function on compact Hausdorff spaces is a closed map. -/
theorem isClosedMap {X Y : CompHausLike.{u} P} (f : X ⟶ Y) : IsClosedMap f := fun _ hC =>
(hC.isCompact.image f.hom.continuous).isClosed
/-- Any continuous bijection of compact Hausdorff spaces is an isomorphism. -/
theorem isIso_of_bijective {X Y : CompHausLike.{u} P} (f : X ⟶ Y) (bij : Function.Bijective f) :
IsIso f := by
let E := Equiv.ofBijective _ bij
have hE : Continuous E.symm := by
rw [continuous_iff_isClosed]
intro S hS
rw [← E.image_eq_preimage_symm]
exact isClosedMap f S hS
refine ⟨⟨ofHom _ ⟨E.symm, hE⟩, ?_, ?_⟩⟩
· ext x
apply E.symm_apply_apply
· ext x
apply E.apply_symm_apply
instance forget_reflectsIsomorphisms :
(forget (CompHausLike.{u} P)).ReflectsIsomorphisms :=
⟨by intro A B f hf; rw [isIso_iff_bijective] at hf; exact isIso_of_bijective _ hf⟩
/-- Any continuous bijection of compact Hausdorff spaces induces an isomorphism. -/
noncomputable def isoOfBijective {X Y : CompHausLike.{u} P} (f : X ⟶ Y)
(bij : Function.Bijective f) : X ≅ Y :=
letI := isIso_of_bijective _ bij
asIso f
/-- Construct an isomorphism from a homeomorphism. -/
@[simps!]
def isoOfHomeo {X Y : CompHausLike.{u} P} (f : X ≃ₜ Y) : X ≅ Y :=
(fullyFaithfulCompHausLikeToTop P).preimageIso (TopCat.isoOfHomeo f)
/-- Construct a homeomorphism from an isomorphism. -/
@[simps!]
def homeoOfIso {X Y : CompHausLike.{u} P} (f : X ≅ Y) : X ≃ₜ Y :=
TopCat.homeoOfIso <| (compHausLikeToTop P).mapIso f
/-- The equivalence between isomorphisms in `CompHaus` and homeomorphisms
of topological spaces. -/
@[simps]
def isoEquivHomeo {X Y : CompHausLike.{u} P} : (X ≅ Y) ≃ (X ≃ₜ Y) where
toFun := homeoOfIso
invFun := isoOfHomeo
/-- A constant map as a morphism in `CompHausLike` -/
def const {P : TopCat.{u} → Prop}
(T : CompHausLike.{u} P) {S : CompHausLike.{u} P} (s : S) : T ⟶ S :=
ofHom _ (ContinuousMap.const _ s)
lemma const_comp {P : TopCat.{u} → Prop} {S T U : CompHausLike.{u} P}
(s : S) (g : S ⟶ U) : T.const s ≫ g = T.const (g s) :=
rfl
end CompHausLike |
.lake/packages/mathlib/Mathlib/Topology/Category/CompHausLike/Limits.lean | import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Limits.Preserves.Finite
import Mathlib.Topology.Category.CompHausLike.Basic
/-!
# Explicit limits and colimits
This file collects some constructions of explicit limits and colimits in `CompHausLike P`,
which may be useful due to their definitional properties.
## Main definitions
* `HasExplicitFiniteCoproducts`: A typeclass describing the property that forming all finite
disjoint unions is stable under the property `P`.
- Given this property, we deduce that `CompHausLike P` has finite coproducts and the inclusion
functors to other `CompHausLike P'` and to `TopCat` preserve them.
* `HasExplicitPullbacks`: A typeclass describing the property that forming all "explicit pullbacks"
is stable under the property `P`. Here, explicit pullbacks are defined as a subset of the product.
- Given this property, we deduce that `CompHausLike P` has pullbacks and the inclusion
functors to other `CompHausLike P'` and to `TopCat` preserve them.
- We also define a variant `HasExplicitPullbacksOfInclusions` which is says that explicit
pullbacks along inclusion maps into finite disjoint unions exist. `Stonean` has this property
but not the stronger one.
## Main results
* Given `[HasExplicitPullbacksOfInclusions P]` (which is implied by `[HasExplicitPullbacks P]`),
we provide an instance `FinitaryExtensive (CompHausLike P)`.
-/
open CategoryTheory Limits Topology
namespace CompHausLike
universe w u
section FiniteCoproducts
variable {P : TopCat.{max u w} → Prop} {α : Type w} [Finite α] (X : α → CompHausLike P)
/--
A typeclass describing the property that forming the disjoint union is stable under the
property `P`.
-/
abbrev HasExplicitFiniteCoproduct := HasProp P (Σ (a : α), X a)
variable [HasExplicitFiniteCoproduct X]
/--
The coproduct of a finite family of objects in `CompHaus`, constructed as the disjoint
union with its usual topology.
-/
def finiteCoproduct : CompHausLike P := CompHausLike.of P (Σ (a : α), X a)
/--
The inclusion of one of the factors into the explicit finite coproduct.
-/
def finiteCoproduct.ι (a : α) : X a ⟶ finiteCoproduct X :=
ofHom _
{ toFun := fun x ↦ ⟨a, x⟩
continuous_toFun := continuous_sigmaMk (σ := fun a ↦ X a) }
/--
To construct a morphism from the explicit finite coproduct, it suffices to
specify a morphism from each of its factors.
This is essentially the universal property of the coproduct.
-/
def finiteCoproduct.desc {B : CompHausLike P} (e : (a : α) → (X a ⟶ B)) :
finiteCoproduct X ⟶ B :=
ofHom _
{ toFun := fun ⟨a, x⟩ ↦ e a x
continuous_toFun := by
apply continuous_sigma
intro a; exact (e a).hom.continuous }
@[reassoc (attr := simp)]
lemma finiteCoproduct.ι_desc {B : CompHausLike P} (e : (a : α) → (X a ⟶ B)) (a : α) :
finiteCoproduct.ι X a ≫ finiteCoproduct.desc X e = e a := rfl
lemma finiteCoproduct.hom_ext {B : CompHausLike P} (f g : finiteCoproduct X ⟶ B)
(h : ∀ a : α, finiteCoproduct.ι X a ≫ f = finiteCoproduct.ι X a ≫ g) : f = g := by
ext ⟨a, x⟩
specialize h a
apply_fun (fun q ↦ q x) at h
exact h
/-- The coproduct cocone associated to the explicit finite coproduct. -/
abbrev finiteCoproduct.cofan : Limits.Cofan X :=
Cofan.mk (finiteCoproduct X) (finiteCoproduct.ι X)
/-- The explicit finite coproduct cocone is a colimit cocone. -/
def finiteCoproduct.isColimit : Limits.IsColimit (finiteCoproduct.cofan X) :=
mkCofanColimit _
(fun s ↦ desc _ fun a ↦ s.inj a)
(fun _ _ ↦ ι_desc _ _ _)
fun _ _ hm ↦ finiteCoproduct.hom_ext _ _ _ fun a ↦
(ConcreteCategory.hom_ext _ _ fun t ↦ congrFun (congrArg _ (hm a)) t)
lemma finiteCoproduct.ι_injective (a : α) : Function.Injective (finiteCoproduct.ι X a) := by
intro x y hxy
exact eq_of_heq (Sigma.ext_iff.mp hxy).2
lemma finiteCoproduct.ι_jointly_surjective (R : finiteCoproduct X) :
∃ (a : α) (r : X a), R = finiteCoproduct.ι X a r := ⟨R.fst, R.snd, rfl⟩
lemma finiteCoproduct.ι_desc_apply {B : CompHausLike P} {π : (a : α) → X a ⟶ B} (a : α) :
∀ x, finiteCoproduct.desc X π (finiteCoproduct.ι X a x) = π a x := by
tauto
instance : HasCoproduct X where
exists_colimit := ⟨finiteCoproduct.cofan X, finiteCoproduct.isColimit X⟩
variable (P) in
/--
A typeclass describing the property that forming all finite disjoint unions is stable under the
property `P`.
-/
class HasExplicitFiniteCoproducts : Prop where
hasProp {α : Type w} [Finite α] (X : α → CompHausLike.{max u w} P) : HasExplicitFiniteCoproduct X
/-
This linter complains that the universes `u` and `w` only occur together, but `w` appears by itself
in the indexing type of the coproduct. In almost all cases, `w` will be either `0` or `u`, but we
want to allow both possibilities.
-/
attribute [nolint checkUnivs] HasExplicitFiniteCoproducts
attribute [instance] HasExplicitFiniteCoproducts.hasProp
instance [HasExplicitFiniteCoproducts.{w} P] (α : Type w) [Finite α] :
HasColimitsOfShape (Discrete α) (CompHausLike P) where
has_colimit _ := hasColimit_of_iso Discrete.natIsoFunctor
instance [HasExplicitFiniteCoproducts.{w} P] : HasFiniteCoproducts (CompHausLike.{max u w} P) where
out n := by
let α := ULift.{w} (Fin n)
let e : Discrete α ≌ Discrete (Fin n) := Discrete.equivalence Equiv.ulift
exact hasColimitsOfShape_of_equivalence e
variable {P : TopCat.{u} → Prop} [HasExplicitFiniteCoproducts.{0} P]
example : HasFiniteCoproducts (CompHausLike.{u} P) := inferInstance
/-- The inclusion maps into the explicit finite coproduct are open embeddings. -/
lemma finiteCoproduct.isOpenEmbedding_ι (a : α) :
IsOpenEmbedding (finiteCoproduct.ι X a) :=
.sigmaMk (σ := fun a ↦ X a)
/-- The inclusion maps into the abstract finite coproduct are open embeddings. -/
lemma Sigma.isOpenEmbedding_ι (a : α) :
IsOpenEmbedding (Sigma.ι X a) := by
refine IsOpenEmbedding.of_comp _ (homeoOfIso ((colimit.isColimit _).coconePointUniqueUpToIso
(finiteCoproduct.isColimit X))).isOpenEmbedding ?_
convert finiteCoproduct.isOpenEmbedding_ι X a
ext x
change (Sigma.ι X a ≫ _) x = _
simp
/-- The functor to `TopCat` preserves finite coproducts if they exist. -/
instance (P) [HasExplicitFiniteCoproducts.{0} P] :
PreservesFiniteCoproducts (compHausLikeToTop P) := by
refine ⟨fun _ ↦ ⟨fun {F} ↦ ?_⟩⟩
suffices PreservesColimit (Discrete.functor (F.obj ∘ Discrete.mk)) (compHausLikeToTop P) from
preservesColimit_of_iso_diagram _ Discrete.natIsoFunctor.symm
apply preservesColimit_of_preserves_colimit_cocone (CompHausLike.finiteCoproduct.isColimit _)
exact TopCat.sigmaCofanIsColimit _
/-- The functor to another `CompHausLike` preserves finite coproducts if they exist. -/
noncomputable instance {P' : TopCat.{u} → Prop}
(h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) :
PreservesFiniteCoproducts (toCompHausLike h) := by
have : PreservesFiniteCoproducts (toCompHausLike h ⋙ compHausLikeToTop P') :=
inferInstanceAs (PreservesFiniteCoproducts (compHausLikeToTop _))
exact preservesFiniteCoproducts_of_reflects_of_preserves (toCompHausLike h) (compHausLikeToTop P')
end FiniteCoproducts
section Pullbacks
variable {P : TopCat.{u} → Prop} {X Y B : CompHausLike P} (f : X ⟶ B) (g : Y ⟶ B)
/--
A typeclass describing the property that an explicit pullback is stable under the property `P`.
-/
abbrev HasExplicitPullback := HasProp P { xy : X × Y | f xy.fst = g xy.snd }
variable [HasExplicitPullback f g] -- (hP : P (TopCat.of { xy : X × Y | f xy.fst = g xy.snd }))
/--
The pullback of two morphisms `f,g` in `CompHaus`, constructed explicitly as the set of
pairs `(x,y)` such that `f x = g y`, with the topology induced by the product.
-/
def pullback : CompHausLike P :=
letI set := { xy : X × Y | f xy.fst = g xy.snd }
haveI : CompactSpace set :=
isCompact_iff_compactSpace.mp (isClosed_eq (by fun_prop) (by fun_prop)).isCompact
CompHausLike.of P set
/--
The projection from the pullback to the first component.
-/
def pullback.fst : pullback f g ⟶ X :=
TopCat.ofHom
{ toFun := fun ⟨⟨x, _⟩, _⟩ ↦ x
continuous_toFun := Continuous.comp continuous_fst continuous_subtype_val }
/--
The projection from the pullback to the second component.
-/
def pullback.snd : pullback f g ⟶ Y :=
TopCat.ofHom
{ toFun := fun ⟨⟨_,y⟩,_⟩ ↦ y
continuous_toFun := Continuous.comp continuous_snd continuous_subtype_val }
@[reassoc]
lemma pullback.condition : pullback.fst f g ≫ f = pullback.snd f g ≫ g := by
ext ⟨_,h⟩; exact h
/--
Construct a morphism to the explicit pullback given morphisms to the factors
which are compatible with the maps to the base.
This is essentially the universal property of the pullback.
-/
def pullback.lift {Z : CompHausLike P} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
Z ⟶ pullback f g :=
TopCat.ofHom
{ toFun := fun z ↦ ⟨⟨a z, b z⟩, by apply_fun (fun q ↦ q z) at w; exact w⟩
continuous_toFun := by fun_prop }
@[reassoc (attr := simp)]
lemma pullback.lift_fst {Z : CompHausLike P} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
pullback.lift f g a b w ≫ pullback.fst f g = a := rfl
@[reassoc (attr := simp)]
lemma pullback.lift_snd {Z : CompHausLike P} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
pullback.lift f g a b w ≫ pullback.snd f g = b := rfl
lemma pullback.hom_ext {Z : CompHausLike P} (a b : Z ⟶ pullback f g)
(hfst : a ≫ pullback.fst f g = b ≫ pullback.fst f g)
(hsnd : a ≫ pullback.snd f g = b ≫ pullback.snd f g) : a = b := by
ext z
apply_fun (fun q ↦ q z) at hfst hsnd
apply Subtype.ext
apply Prod.ext
· exact hfst
· exact hsnd
/--
The pullback cone whose cone point is the explicit pullback.
-/
@[simps! pt π]
def pullback.cone : Limits.PullbackCone f g :=
Limits.PullbackCone.mk (pullback.fst f g) (pullback.snd f g) (pullback.condition f g)
/--
The explicit pullback cone is a limit cone.
-/
@[simps! lift]
def pullback.isLimit : Limits.IsLimit (pullback.cone f g) :=
Limits.PullbackCone.isLimitAux _
(fun s ↦ pullback.lift f g s.fst s.snd s.condition)
(fun _ ↦ pullback.lift_fst _ _ _ _ _)
(fun _ ↦ pullback.lift_snd _ _ _ _ _)
(fun _ _ hm ↦ pullback.hom_ext _ _ _ _ (hm .left) (hm .right))
instance : HasLimit (cospan f g) where
exists_limit := ⟨⟨pullback.cone f g, pullback.isLimit f g⟩⟩
/-- The functor to `TopCat` creates pullbacks if they exist. -/
noncomputable instance : CreatesLimit (cospan f g) (compHausLikeToTop P) := by
refine createsLimitOfFullyFaithfulOfIso (pullback f g)
(((TopCat.pullbackConeIsLimit f g).conePointUniqueUpToIso
(limit.isLimit _)) ≪≫ Limits.lim.mapIso (?_ ≪≫ (diagramIsoCospan _).symm))
exact Iso.refl _
/-- The functor to `TopCat` preserves pullbacks. -/
noncomputable instance : PreservesLimit (cospan f g) (compHausLikeToTop P) :=
preservesLimit_of_createsLimit_and_hasLimit _ _
/-- The functor to another `CompHausLike` preserves pullbacks. -/
noncomputable instance {P' : TopCat → Prop}
(h : ∀ (X : CompHausLike P), P X.toTop → P' X.toTop) :
PreservesLimit (cospan f g) (toCompHausLike h) := by
have : PreservesLimit (cospan f g) (toCompHausLike h ⋙ compHausLikeToTop P') :=
inferInstanceAs (PreservesLimit _ (compHausLikeToTop _))
exact preservesLimit_of_reflects_of_preserves (toCompHausLike h) (compHausLikeToTop P')
variable (P) in
/--
A typeclass describing the property that forming all explicit pullbacks is stable under the
property `P`.
-/
class HasExplicitPullbacks : Prop where
hasProp {X Y B : CompHausLike P} (f : X ⟶ B) (g : Y ⟶ B) : HasExplicitPullback f g
attribute [instance] HasExplicitPullbacks.hasProp
instance [HasExplicitPullbacks P] : HasPullbacks (CompHausLike P) where
has_limit F := hasLimit_of_iso (diagramIsoCospan F).symm
variable (P) in
/--
A typeclass describing the property that explicit pullbacks along inclusion maps into disjoint
unions is stable under the property `P`.
-/
class HasExplicitPullbacksOfInclusions [HasExplicitFiniteCoproducts.{0} P] : Prop where
hasProp : ∀ {X Y Z : CompHausLike P} (f : Z ⟶ X ⨿ Y), HasExplicitPullback coprod.inl f
attribute [instance] HasExplicitPullbacksOfInclusions.hasProp
instance [HasExplicitPullbacks P] [HasExplicitFiniteCoproducts.{0} P] :
HasExplicitPullbacksOfInclusions P where
hasProp _ := inferInstance
end Pullbacks
section FiniteCoproducts
variable {P : TopCat.{u} → Prop} [HasExplicitFiniteCoproducts.{0} P]
instance [HasExplicitPullbacksOfInclusions P] : HasPullbacksOfInclusions (CompHausLike P) where
hasPullbackInl _ := inferInstance
theorem hasPullbacksOfInclusions
(hP' : ∀ ⦃X Y B : CompHausLike.{u} P⦄ (f : X ⟶ B) (g : Y ⟶ B)
(_ : IsOpenEmbedding f), HasExplicitPullback f g) :
HasExplicitPullbacksOfInclusions P :=
{ hasProp := by
intro _ _ _ f
apply hP'
exact Sigma.isOpenEmbedding_ι _ _ }
/-- The functor to `TopCat` preserves pullbacks of inclusions if they exist. -/
noncomputable instance [HasExplicitPullbacksOfInclusions P] :
PreservesPullbacksOfInclusions (compHausLikeToTop P) :=
{ preservesPullbackInl := by
intro X Y Z f
infer_instance }
instance [HasExplicitPullbacksOfInclusions P] : FinitaryExtensive (CompHausLike P) :=
finitaryExtensive_of_preserves_and_reflects (compHausLikeToTop P)
theorem finitaryExtensive (hP' : ∀ ⦃X Y B : CompHausLike.{u} P⦄ (f : X ⟶ B) (g : Y ⟶ B)
(_ : IsOpenEmbedding f), HasExplicitPullback f g) :
FinitaryExtensive (CompHausLike P) :=
have := hasPullbacksOfInclusions hP'
finitaryExtensive_of_preserves_and_reflects (compHausLikeToTop P)
end FiniteCoproducts
section Terminal
variable {P : TopCat.{u} → Prop}
/-- A one-element space is terminal in `CompHaus` -/
def isTerminalPUnit [HasProp P PUnit.{u + 1}] :
IsTerminal (CompHausLike.of P PUnit.{u + 1}) :=
haveI : ∀ X, Unique (X ⟶ CompHausLike.of P PUnit.{u + 1}) := fun _ ↦
⟨⟨ofHom _ ⟨fun _ ↦ PUnit.unit, continuous_const⟩⟩, fun _ ↦ rfl⟩
Limits.IsTerminal.ofUnique _
end Terminal
end CompHausLike |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.