Skip to content

Commit

Permalink
chore(Topology/Clopen): rename type variables (#7921)
Browse files Browse the repository at this point in the history
This file was using a mixture of Greek letters and letters X, Y, Z. Switch to using the latter consistently, per [Zulip discussion](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Naming.20convention.3A.20topological.20spaces/near/395769893).

Best reviewed commit by commit; each is self-contained and should be quick to review.
  • Loading branch information
grunweg committed Nov 1, 2023
1 parent 8671b30 commit d047ed6
Showing 1 changed file with 30 additions and 33 deletions.
63 changes: 30 additions & 33 deletions Mathlib/Topology/Clopen.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ open Set Filter Topology TopologicalSpace Classical

universe u v

variable {α : Type u} {β : Type v} {ι : Type*} {π : ι → Type*}
variable {X : Type u} {Y : Type v} {ι : Type*}

variable [TopologicalSpace α] [TopologicalSpace β] {s t : Set α}
variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X}

section Clopen

-- porting note: todo: redefine as `IsClosed s ∧ IsOpen s`
/-- A set is clopen if it is both open and closed. -/
def IsClopen (s : Set α) : Prop :=
def IsClopen (s : Set X) : Prop :=
IsOpen s ∧ IsClosed s
#align is_clopen IsClopen

Expand All @@ -34,7 +34,7 @@ protected theorem IsClopen.isOpen (hs : IsClopen s) : IsOpen s := hs.1
protected theorem IsClopen.isClosed (hs : IsClopen s) : IsClosed s := hs.2
#align is_clopen.is_closed IsClopen.isClosed

theorem isClopen_iff_frontier_eq_empty {s : Set α} : IsClopen s ↔ frontier s = ∅ := by
theorem isClopen_iff_frontier_eq_empty : IsClopen s ↔ frontier s = ∅ := by
rw [IsClopen, ← closure_eq_iff_isClosed, ← interior_eq_iff_isOpen, frontier, diff_eq_empty]
refine' ⟨fun h => (h.2.trans h.1.symm).subset, fun h => _⟩
exact ⟨interior_subset.antisymm (subset_closure.trans h),
Expand All @@ -44,115 +44,112 @@ theorem isClopen_iff_frontier_eq_empty {s : Set α} : IsClopen s ↔ frontier s
alias ⟨IsClopen.frontier_eq, _⟩ := isClopen_iff_frontier_eq_empty
#align is_clopen.frontier_eq IsClopen.frontier_eq

theorem IsClopen.union {s t : Set α} (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s ∪ t) :=
theorem IsClopen.union (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s ∪ t) :=
⟨hs.1.union ht.1, hs.2.union ht.2
#align is_clopen.union IsClopen.union

theorem IsClopen.inter {s t : Set α} (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s ∩ t) :=
theorem IsClopen.inter (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s ∩ t) :=
⟨hs.1.inter ht.1, hs.2.inter ht.2
#align is_clopen.inter IsClopen.inter

@[simp] theorem isClopen_empty : IsClopen (∅ : Set α) := ⟨isOpen_empty, isClosed_empty⟩
@[simp] theorem isClopen_empty : IsClopen (∅ : Set X) := ⟨isOpen_empty, isClosed_empty⟩
#align is_clopen_empty isClopen_empty

@[simp] theorem isClopen_univ : IsClopen (univ : Set α) := ⟨isOpen_univ, isClosed_univ⟩
@[simp] theorem isClopen_univ : IsClopen (univ : Set X) := ⟨isOpen_univ, isClosed_univ⟩
#align is_clopen_univ isClopen_univ

theorem IsClopen.compl {s : Set α} (hs : IsClopen s) : IsClopen sᶜ :=
theorem IsClopen.compl (hs : IsClopen s) : IsClopen sᶜ :=
⟨hs.2.isOpen_compl, hs.1.isClosed_compl⟩
#align is_clopen.compl IsClopen.compl

@[simp]
theorem isClopen_compl_iff {s : Set α} : IsClopen sᶜ ↔ IsClopen s :=
theorem isClopen_compl_iff : IsClopen sᶜ ↔ IsClopen s :=
fun h => compl_compl s ▸ IsClopen.compl h, IsClopen.compl⟩
#align is_clopen_compl_iff isClopen_compl_iff

theorem IsClopen.diff {s t : Set α} (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s \ t) :=
theorem IsClopen.diff (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s \ t) :=
hs.inter ht.compl
#align is_clopen.diff IsClopen.diff

theorem IsClopen.prod {s : Set α} {t : Set β} (hs : IsClopen s) (ht : IsClopen t) :
IsClopen (s ×ˢ t) :=
theorem IsClopen.prod {t : Set Y} (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s ×ˢ t) :=
⟨hs.1.prod ht.1, hs.2.prod ht.2
#align is_clopen.prod IsClopen.prod

theorem isClopen_iUnion_of_finite {β : Type*} [Finite β] {s : β → Set α} (h : ∀ i, IsClopen (s i)) :
theorem isClopen_iUnion_of_finite [Finite Y] {s : Y → Set X} (h : ∀ i, IsClopen (s i)) :
IsClopen (⋃ i, s i) :=
⟨isOpen_iUnion (forall_and.1 h).1, isClosed_iUnion_of_finite (forall_and.1 h).2
#align is_clopen_Union isClopen_iUnion_of_finite

theorem Set.Finite.isClopen_biUnion {β : Type*} {s : Set β} {f : β → Set α} (hs : s.Finite)
theorem Set.Finite.isClopen_biUnion {s : Set Y} {f : Y → Set X} (hs : s.Finite)
(h : ∀ i ∈ s, IsClopen <| f i) : IsClopen (⋃ i ∈ s, f i) :=
⟨isOpen_biUnion fun i hi => (h i hi).1, hs.isClosed_biUnion fun i hi => (h i hi).2
#align is_clopen_bUnion Set.Finite.isClopen_biUnion

theorem isClopen_biUnion_finset {β : Type*} {s : Finset β} {f : β → Set α}
theorem isClopen_biUnion_finset {s : Finset Y} {f : Y → Set X}
(h : ∀ i ∈ s, IsClopen <| f i) : IsClopen (⋃ i ∈ s, f i) :=
s.finite_toSet.isClopen_biUnion h
#align is_clopen_bUnion_finset isClopen_biUnion_finset

theorem isClopen_iInter_of_finite {β : Type*} [Finite β] {s : β → Set α} (h : ∀ i, IsClopen (s i)) :
theorem isClopen_iInter_of_finite [Finite Y] {s : Y → Set X} (h : ∀ i, IsClopen (s i)) :
IsClopen (⋂ i, s i) :=
⟨isOpen_iInter_of_finite (forall_and.1 h).1, isClosed_iInter (forall_and.1 h).2
#align is_clopen_Inter isClopen_iInter_of_finite

theorem Set.Finite.isClopen_biInter {β : Type*} {s : Set β} (hs : s.Finite) {f : β → Set α}
theorem Set.Finite.isClopen_biInter {s : Set Y} (hs : s.Finite) {f : Y → Set X}
(h : ∀ i ∈ s, IsClopen (f i)) : IsClopen (⋂ i ∈ s, f i) :=
⟨hs.isOpen_biInter fun i hi => (h i hi).1, isClosed_biInter fun i hi => (h i hi).2
#align is_clopen_bInter Set.Finite.isClopen_biInter

theorem isClopen_biInter_finset {β : Type*} {s : Finset β} {f : β → Set α}
theorem isClopen_biInter_finset {s : Finset Y} {f : Y → Set X}
(h : ∀ i ∈ s, IsClopen (f i)) : IsClopen (⋂ i ∈ s, f i) :=
s.finite_toSet.isClopen_biInter h
#align is_clopen_bInter_finset isClopen_biInter_finset

theorem IsClopen.preimage {s : Set β} (h : IsClopen s) {f : αβ} (hf : Continuous f) :
theorem IsClopen.preimage {s : Set Y} (h : IsClopen s) {f : XY} (hf : Continuous f) :
IsClopen (f ⁻¹' s) :=
⟨h.1.preimage hf, h.2.preimage hf⟩
#align is_clopen.preimage IsClopen.preimage

theorem ContinuousOn.preimage_clopen_of_clopen {f : αβ} {s : Set α} {t : Set β}
theorem ContinuousOn.preimage_clopen_of_clopen {f : XY} {s : Set X} {t : Set Y}
(hf : ContinuousOn f s) (hs : IsClopen s) (ht : IsClopen t) : IsClopen (s ∩ f ⁻¹' t) :=
⟨ContinuousOn.preimage_open_of_open hf hs.1 ht.1,
ContinuousOn.preimage_closed_of_closed hf hs.2 ht.2
#align continuous_on.preimage_clopen_of_clopen ContinuousOn.preimage_clopen_of_clopen

/-- The intersection of a disjoint covering by two open sets of a clopen set will be clopen. -/
theorem isClopen_inter_of_disjoint_cover_clopen {Z a b : Set α} (h : IsClopen Z) (cover : Z ⊆ a ∪ b)
(ha : IsOpen a) (hb : IsOpen b) (hab : Disjoint a b) : IsClopen (Z ∩ a) := by
theorem isClopen_inter_of_disjoint_cover_clopen {s a b : Set X} (h : IsClopen s) (cover : s ⊆ a ∪ b)
(ha : IsOpen a) (hb : IsOpen b) (hab : Disjoint a b) : IsClopen (s ∩ a) := by
refine' ⟨IsOpen.inter h.1 ha, _⟩
have : IsClosed (Z ∩ bᶜ) := IsClosed.inter h.2 (isClosed_compl_iff.2 hb)
have : IsClosed (s ∩ bᶜ) := IsClosed.inter h.2 (isClosed_compl_iff.2 hb)
convert this using 1
refine' (inter_subset_inter_right Z hab.subset_compl_right).antisymm _
refine' (inter_subset_inter_right s hab.subset_compl_right).antisymm _
rintro x ⟨hx₁, hx₂⟩
exact ⟨hx₁, by simpa [not_mem_of_mem_compl hx₂] using cover hx₁⟩
#align is_clopen_inter_of_disjoint_cover_clopen isClopen_inter_of_disjoint_cover_clopen

@[simp]
theorem isClopen_discrete [DiscreteTopology α] (x : Set α) : IsClopen x :=
theorem isClopen_discrete [DiscreteTopology X] (s : Set X) : IsClopen s :=
⟨isOpen_discrete _, isClosed_discrete _⟩
#align is_clopen_discrete isClopen_discrete

-- porting note: new lemma
theorem isClopen_range_inl : IsClopen (range (Sum.inl : ααβ)) :=
theorem isClopen_range_inl : IsClopen (range (Sum.inl : XXY)) :=
⟨isOpen_range_inl, isClosed_range_inl⟩

-- porting note: new lemma
theorem isClopen_range_inr : IsClopen (range (Sum.inr : βαβ)) :=
theorem isClopen_range_inr : IsClopen (range (Sum.inr : YXY)) :=
⟨isOpen_range_inr, isClosed_range_inr⟩

theorem isClopen_range_sigmaMk {ι : Type*} {σ : ι → Type*} [∀ i, TopologicalSpace (σ i)] {i : ι} :
IsClopen (Set.range (@Sigma.mk ι σ i)) :=
theorem isClopen_range_sigmaMk {X : ι → Type*} [∀ i, TopologicalSpace (X i)] {i : ι} :
IsClopen (Set.range (@Sigma.mk ι X i)) :=
⟨openEmbedding_sigmaMk.open_range, closedEmbedding_sigmaMk.closed_range⟩
#align clopen_range_sigma_mk isClopen_range_sigmaMk

protected theorem QuotientMap.isClopen_preimage {f : αβ} (hf : QuotientMap f) {s : Set β} :
protected theorem QuotientMap.isClopen_preimage {f : XY} (hf : QuotientMap f) {s : Set Y} :
IsClopen (f ⁻¹' s) ↔ IsClopen s :=
and_congr hf.isOpen_preimage hf.isClosed_preimage
#align quotient_map.is_clopen_preimage QuotientMap.isClopen_preimage

variable {X : Type*} [TopologicalSpace X]

theorem continuous_boolIndicator_iff_clopen (U : Set X) :
Continuous U.boolIndicator ↔ IsClopen U := by
constructor
Expand Down

0 comments on commit d047ed6

Please sign in to comment.