Lean library · module TopologyByExample.Spaces.ClosedRealRaySums

Closed-ray sums in the closure–complement example

Source file

This file was written by Codex (OpenAI's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.

Imports

definition Ray

TopologyByExample.ClosedRealRaySums.Ray

The standard closed ray.

abbrev Ray
:= ↥(Ici (0 : ℝ))

definition Space

TopologyByExample.ClosedRealRaySums.Space

Two closed rays and one closed interval.

abbrev Space
:= (Ray ⊕ unitInterval) ⊕ Ray

On this site: Space: Two closed rays and a closed interval

definition upper

TopologyByExample.ClosedRealRaySums.upper

Translation of a closed upper ray.

def upper (a : ℝ) : Ici a ≃ₜ Ray
Definition
where
  toFun x := ⟨x.val - a, sub_nonneg.mpr x.property⟩
  invFun y := ⟨y.val + a, by have h : 0 ≤ y.val := y.property; change a ≤ y.val + a; linarith⟩
  left_inv x := Subtype.ext (by simp)
  right_inv y := Subtype.ext (by simp)
  continuous_toFun := by fun_prop
  continuous_invFun := by fun_prop

definition lower

TopologyByExample.ClosedRealRaySums.lower

Reflection of a closed lower ray.

def lower (a : ℝ) : Iic a ≃ₜ Ray
Definition
where
  toFun x := ⟨a - x.val, sub_nonneg.mpr x.property⟩
  invFun y := ⟨a - y.val, by have h : 0 ≤ y.val := y.property; change a - y.val ≤ a; linarith⟩
  left_inv x := Subtype.ext (by ring)
  right_inv y := Subtype.ext (by ring)
  continuous_toFun := by fun_prop
  continuous_invFun := by fun_prop

definition closedUnion

TopologyByExample.ClosedRealRaySums.closedUnion

Two disjoint closed subsets form a topological sum inside their union.

def closedUnion {X : Type*} [TopologicalSpace X] (s t : Set X)
    (hs : IsClosed s) (ht : IsClosed t) (hd : Disjoint s t) :
    (s ∪ t : Set X) ≃ₜ s ⊕ t
Definition
:= by
  apply unionHomeomorph s t hd
  · have he : (Subtype.val ⁻¹' s : Set ↥(s ∪ t)) = (Subtype.val ⁻¹' t)ᶜ := by
      ext x
      exact ⟨fun h h' ↦ hd.notMem_of_mem_left h h', fun h ↦ x.property.resolve_right h⟩
    rw [he]
    exact (ht.preimage continuous_subtypeVal).isOpen_compl
  · have he : (Subtype.val ⁻¹' t : Set ↥(s ∪ t)) = (Subtype.val ⁻¹' s)ᶜ := by
      ext x
      exact ⟨fun h h' ↦ hd.notMem_of_mem_right h h', fun h ↦ x.property.resolve_left h⟩
    rw [he]
    exact (hs.preimage continuous_subtypeVal).isOpen_compl

theorem complement_twoOpen

TopologyByExample.ClosedRealRaySums.complement_twoOpen

The complement of two open bounded intervals.

theorem complement_twoOpen : (Ioo (2 : ℝ) 4 ∪ Ioo 5 6)ᶜ =
    (Iic 2 ∪ Icc 4 5) ∪ Ici 6
Proof
:= by
  ext x
  simp only [mem_compl_iff, mem_union, mem_Icc, mem_Iic, mem_Ioo, mem_Ici, not_or]
  constructor
  · rintro ⟨h24, h56⟩
    by_cases h2 : x ≤ 2
    · exact Or.inl (Or.inl h2)
    · have h4 : 4 ≤ x := le_of_not_gt (fun h ↦ h24 ⟨lt_of_not_ge h2, h⟩)
      by_cases h5 : x ≤ 5
      · exact Or.inl (Or.inr ⟨h4, h5⟩)
      · exact Or.inr (le_of_not_gt (fun h ↦ h56 ⟨lt_of_not_ge h5, h⟩))
  · rintro ((h | ⟨h4, h5⟩) | h)
    · constructor <;> rintro ⟨ha, hb⟩ <;> linarith
    · constructor <;> rintro ⟨ha, hb⟩ <;> linarith
    · constructor <;> rintro ⟨ha, hb⟩ <;> linarith

definition firstPair

TopologyByExample.ClosedRealRaySums.firstPair

The first ray and the bounded interval have the expected sum topology.

def firstPair : (Iic (2 : ℝ) ∪ Icc 4 5 : Set ℝ) ≃ₜ Ray ⊕ unitInterval
Definition
:=
  (cutHomeomorph (Iic 2) (Icc 4 5) 3
    (by intro x hx; change x < 3; have h : x ≤ 2 := hx; linarith)
    (by intro x hx; change 3 < x; linarith [hx.1])).trans
    ((lower 2).sumCongr (iccHomeoI 4 5 (by norm_num)))

definition basicHomeomorph

TopologyByExample.ClosedRealRaySums.basicHomeomorph

The complementary closed set is two rays and one interval.

def basicHomeomorph : ((Iic (2 : ℝ) ∪ Icc 4 5) ∪ Ici 6 : Set ℝ) ≃ₜ Space
Definition
:=
  (cutHomeomorph (Iic 2 ∪ Icc 4 5) (Ici 6) (11 / 2)
    (by
      rintro x (hx | hx)
      · change x < (11 : ℝ) / 2; have h : x ≤ 2 := hx; linarith
      · change x < (11 : ℝ) / 2; linarith [hx.2])
    (by intro x hx; change (11 : ℝ) / 2 < x; have h : 6 ≤ x := hx; linarith)).trans
    (firstPair.sumCongr (upper 6))

definition complementInteriorClosureInteriorHomeomorph

TopologyByExample.ClosedRealRaySums.complementInteriorClosureInteriorHomeomorph

Complementing the interior of the closed interior gives the basic mixed sum.

def complementInteriorClosureInteriorHomeomorph :
    ↥((interior (closure (interior original)))ᶜ) ≃ₜ Space
:=
  (Homeomorph.setCongr ((congrArg compl interior_closure_interior_original).trans
    complement_twoOpen)).trans basicHomeomorph

On this site: Two closed rays and a closed interval: Identification of the complementary real subset

theorem complement_threeOpen

TopologyByExample.ClosedRealRaySums.complement_threeOpen

The complement of three separated open intervals.

theorem complement_threeOpen : ((Ioo (2 : ℝ) 4 ∪ Ioo 5 6) ∪ Ioo 7 8)ᶜ =
    (Iic 2 ∪ Icc 4 5) ∪ (Icc 6 7 ∪ Ici 8)
Proof
:= by
  rw [compl_union, complement_twoOpen]
  ext x
  simp only [mem_inter_iff, mem_compl_iff, mem_union, mem_Icc, mem_Iic, mem_Ioo, mem_Ici]
  constructor
  · rintro ⟨(h | h6), h78⟩
    · exact Or.inl h
    · by_cases h7 : x ≤ 7
      · exact Or.inr (Or.inl ⟨h6, h7⟩)
      · exact Or.inr (Or.inr (le_of_not_gt (fun h ↦ h78 ⟨lt_of_not_ge h7, h⟩)))
  · rintro (h | (h | h))
    · refine ⟨Or.inl h, ?_⟩
      rcases h with h | ⟨_, h⟩ <;> rintro ⟨ha, hb⟩ <;> linarith
    · exact ⟨Or.inr h.1, fun hx ↦ (not_lt_of_ge h.2) hx.1⟩
    · exact ⟨Or.inr (by linarith), fun hx ↦ (not_lt_of_ge h) hx.2⟩

definition lastPair

TopologyByExample.ClosedRealRaySums.lastPair

The last interval and closed ray form a sum.

def lastPair : (Icc (6 : ℝ) 7 ∪ Ici 8 : Set ℝ) ≃ₜ unitInterval ⊕ Ray
Definition
:=
  (cutHomeomorph (Icc 6 7) (Ici 8) (15 / 2)
    (by intro x hx; change x < (15 : ℝ) / 2; linarith [hx.2])
    (by intro x hx; change (15 : ℝ) / 2 < x; have h : 8 ≤ x := hx; linarith)).trans
    ((iccHomeoI 6 7 (by norm_num)).sumCongr (upper 8))

definition complementInteriorClosureHomeomorph

TopologyByExample.ClosedRealRaySums.complementInteriorClosureHomeomorph

The complement of the interior of the closure adds a second compact interval.

def complementInteriorClosureHomeomorph : ↥((interior (closure original))ᶜ) ≃ₜ
    Space ⊕ unitInterval
Definition
:=
  (Homeomorph.setCongr ((congrArg compl interior_closure_original).trans
    complement_threeOpen)).trans
    ((cutHomeomorph (Iic 2 ∪ Icc 4 5) (Icc 6 7 ∪ Ici 8) (11 / 2)
      (by
        rintro x (hx | hx)
        · change x < (11 : ℝ) / 2; have h : x ≤ 2 := hx; linarith
        · change x < (11 : ℝ) / 2; linarith [hx.2])
      (by
        rintro x (hx | hx)
        · change (11 : ℝ) / 2 < x; linarith [hx.1]
        · change (11 : ℝ) / 2 < x; have h : 8 ≤ x := hx; linarith)).trans
      ((firstPair.sumCongr (lastPair.trans (Homeomorph.sumComm _ _))).trans
        (Homeomorph.sumAssoc _ _ _).symm))

On this site: Two closed rays and two closed intervals: Identification of the complementary real subset

theorem complement_interior_eq

TopologyByExample.ClosedRealRaySums.complement_interior_eq

Complementing the original interior retains the isolated missing point three.

theorem complement_interior_eq : (interior original)ᶜ =
    ((interior (closure (interior original)))ᶜ) ∪ {3}
Proof
:= by
  have he : interior original = interior (closure (interior original)) \ {3} := by
    rw [interior_closure_interior_original, interior_original, union_sdiff_distrib,
      Ioo_union_Ioo_eq_Ioo_sdiff_singleton (by norm_num) (by norm_num)]
    congr 1
    symm
    exact sdiff_eq_left.mpr (disjoint_singleton_right.mpr (by norm_num))
  calc
    (interior original)ᶜ = (interior (closure (interior original)) \ {3})ᶜ := congrArg compl he
    _ = _ := by rw [Set.compl_sdiff, union_comm]

definition complementInteriorHomeomorph

TopologyByExample.ClosedRealRaySums.complementInteriorHomeomorph

The complement of the original interior is the basic mixed sum plus a point.

def complementInteriorHomeomorph : ↥((interior original)ᶜ) ≃ₜ Space ⊕ Unit
Definition
:=
  (Homeomorph.setCongr complement_interior_eq).trans
    ((closedUnion ((interior (closure (interior original)))ᶜ) {3}
      isOpen_interior.isClosed_compl isClosed_singleton
      (disjoint_singleton_right.mpr (by
        simp only [mem_compl_iff, not_not]
        rw [interior_closure_interior_original]
        norm_num))).trans
      (complementInteriorClosureInteriorHomeomorph.sumCongr (Homeomorph.homeomorphOfUnique _ _)))

On this site: Two closed rays, a closed interval and an isolated point: Identification of the complementary real subset