Lean library · module TopologyByExample.Theorems.RealIntervalOperations
Interval operations in the real-line examples
Exact interval and closure/interior comparisons for Example 32, items 4--6.
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 shrinking
TopologyByExample.BookIntervals.shrinking
The shrinking intervals, indexed from zero.
def shrinking (n : ℕ) : Set ℝ
:= Ioo (1 - 1 / (n + 1 : ℝ)) (1 + 1 / (n + 1 : ℝ))
definition shrinkingHomeomorph
TopologyByExample.BookIntervals.shrinkingHomeomorph
Each shrinking interval is homeomorphic to the real line.
def shrinkingHomeomorph (n : ℕ) : shrinking n ≃ₜ ℝ
Definition
:=
SeparatedRealSubsets.intervalReal _ _ (by
have h : 0 < (1 : ℝ) / (n + 1) := by positivity
linarith)
theorem iInter_shrinking
TopologyByExample.BookIntervals.iInter_shrinking
The intervals have precisely their common centre in the intersection.
theorem iInter_shrinking : ⋂ n, shrinking n = {1}
Proof
:= by
ext x
simp only [mem_iInter, mem_singleton_iff]
constructor
· intro hx
by_contra hne
rcases lt_or_gt_of_ne hne with hlt | hgt
· obtain ⟨n, hn⟩ := exists_nat_one_div_lt (sub_pos.mpr hlt)
have h := (hx n).1
change 1 - 1 / (n + 1 : ℝ) < x at h
linarith
· obtain ⟨n, hn⟩ := exists_nat_one_div_lt (sub_pos.mpr hgt)
have h := (hx n).2
change x < 1 + 1 / (n + 1 : ℝ) at h
linarith
· rintro rfl n
have h : 0 < (1 : ℝ) / (n + 1) := by positivity
constructor <;> linarith
theorem interior_iInter_shrinking
TopologyByExample.BookIntervals.interior_iInter_shrinking
Taking interiors after the intersection removes the common centre.
theorem interior_iInter_shrinking : interior (⋂ n, shrinking n) = ∅
Proof
:= by
rw [iInter_shrinking, interior_singleton]
theorem iInter_interior_shrinking
TopologyByExample.BookIntervals.iInter_interior_shrinking
Taking the interiors first leaves the same nonempty intersection.
theorem iInter_interior_shrinking : ⋂ n, interior (shrinking n) = {1}
Proof
:= by
simp only [show ∀ n, interior (shrinking n) = shrinking n from
fun _ ↦ isOpen_Ioo.interior_eq, iInter_shrinking]
definition leftOpen
TopologyByExample.BookIntervals.leftOpen
The left interval in the punctured unit interval.
def leftOpen : Set ℝ
:= Ioo 0 (1 / 2)
definition rightOpen
TopologyByExample.BookIntervals.rightOpen
The right interval in the punctured unit interval.
def rightOpen : Set ℝ
:= Ioo (1 / 2) 1
theorem isOpen_punctured
TopologyByExample.BookIntervals.isOpen_punctured
The punctured interval is open.
theorem isOpen_punctured : IsOpen PuncturedInterval.subset
Proof
:= isOpen_Ioo.union isOpen_Ioo
theorem closure_punctured
TopologyByExample.BookIntervals.closure_punctured
Closing the punctured interval fills its midpoint and both endpoints.
theorem closure_punctured : closure PuncturedInterval.subset = Icc (0 : ℝ) 1
Proof
:= by
rw [PuncturedInterval.subset, closure_union, closure_Ioo (by norm_num : (0 : ℝ) ≠ 1 / 2),
closure_Ioo (by norm_num : (1 / 2 : ℝ) ≠ 1)]
exact Icc_union_Icc_eq_Icc (by norm_num) (by norm_num)
theorem interior_closure_punctured
TopologyByExample.BookIntervals.interior_closure_punctured
The interior of its closure is the unpunctured open interval.
theorem interior_closure_punctured : interior (closure PuncturedInterval.subset) =
Ioo (0 : ℝ) 1
Proof
:= by rw [closure_punctured, interior_Icc]
theorem component_interiors_closures
TopologyByExample.BookIntervals.component_interiors_closures
The two component intervals are individually regular open.
theorem component_interiors_closures :
interior (closure leftOpen) = leftOpen ∧ interior (closure rightOpen) = rightOpen
theorem punctured_ne_interior_closure
TopologyByExample.BookIntervals.punctured_ne_interior_closure
Their open union fails to be regular open.
theorem punctured_ne_interior_closure :
PuncturedInterval.subset ≠ interior (closure PuncturedInterval.subset)
Proof
:= by
intro h
have hm : (1 / 2 : ℝ) ∈ interior (closure PuncturedInterval.subset) := by
rw [interior_closure_punctured]
constructor <;> norm_num
rw [← h] at hm
norm_num [PuncturedInterval.subset] at hm
theorem open_intersection
TopologyByExample.BookIntervals.open_intersection
The two open intervals are disjoint.
theorem open_intersection : leftOpen ∩ rightOpen = ∅
theorem closed_intersection
TopologyByExample.BookIntervals.closed_intersection
Their closures instead intersect in the midpoint.
theorem closed_intersection : Icc (0 : ℝ) (1 / 2) ∩ Icc (1 / 2) 1 = {1 / 2}
Proof
:= by
ext x
simp only [mem_inter_iff, mem_Icc, mem_singleton_iff]
constructor
· rintro ⟨⟨_, hx⟩, ⟨hy, _⟩⟩
exact le_antisymm hx hy
· rintro rfl
norm_num
theorem closure_intersection_comparison
TopologyByExample.BookIntervals.closure_intersection_comparison
Closing the intersection and intersecting the closures give different sets.
theorem closure_intersection_comparison :
closure (leftOpen ∩ rightOpen) = ∅ ∧
closure leftOpen ∩ closure rightOpen = {1 / 2}
Proof
:= by
constructor
· simp [open_intersection]
· simpa [leftOpen, rightOpen, closure_Ioo] using closed_intersection
On this site: Punctured open interval: Closure need not preserve intersections
theorem component_closures_interiors
TopologyByExample.BookIntervals.component_closures_interiors
Each of the two adjoining closed intervals is regular closed.
theorem component_closures_interiors :
closure (interior (Icc (0 : ℝ) (1 / 2))) = Icc 0 (1 / 2) ∧
closure (interior (Icc (1 / 2 : ℝ) 1)) = Icc (1 / 2) 1
Proof
:= by
constructor <;> simp [interior_Icc, closure_Ioo]
theorem singleton_not_regularClosed
TopologyByExample.BookIntervals.singleton_not_regularClosed
Their singleton intersection is not regular closed.
theorem singleton_not_regularClosed :
closure (interior ({1 / 2} : Set ℝ)) ≠ {1 / 2}
Proof
:= by simp
theorem interiors_union
TopologyByExample.BookIntervals.interiors_union
The interiors of the two closed intervals omit their common midpoint.
theorem interiors_union :
interior (Icc (0 : ℝ) (1 / 2)) ∪ interior (Icc (1 / 2) 1) =
PuncturedInterval.subset
Proof
:= by simp only [interior_Icc, PuncturedInterval.subset]
theorem interior_union
TopologyByExample.BookIntervals.interior_union
The interior of their union includes the midpoint.
theorem interior_union :
interior (Icc (0 : ℝ) (1 / 2) ∪ Icc (1 / 2) 1) = Ioo 0 1
Proof
:= by
rw [Icc_union_Icc_eq_Icc (by norm_num) (by norm_num), interior_Icc]
definition leftOpenHomeomorph
TopologyByExample.BookIntervals.leftOpenHomeomorph
The two open components have the real-line topological type.
def leftOpenHomeomorph : leftOpen ≃ₜ ℝ
:=
SeparatedRealSubsets.intervalReal 0 (1 / 2) (by norm_num)
definition rightOpenHomeomorph
TopologyByExample.BookIntervals.rightOpenHomeomorph
The right component has the real-line topological type.
def rightOpenHomeomorph : rightOpen ≃ₜ ℝ
:=
SeparatedRealSubsets.intervalReal (1 / 2) 1 (by norm_num)
definition leftClosedHomeomorph
TopologyByExample.BookIntervals.leftClosedHomeomorph
The left closed half is a closed unit interval.
def leftClosedHomeomorph : Icc (0 : ℝ) (1 / 2) ≃ₜ unitInterval
:=
iccHomeoI 0 (1 / 2) (by norm_num)
definition rightClosedHomeomorph
TopologyByExample.BookIntervals.rightClosedHomeomorph
The right closed half is a closed unit interval.
def rightClosedHomeomorph : Icc (1 / 2 : ℝ) 1 ≃ₜ unitInterval
:=
iccHomeoI (1 / 2) 1 (by norm_num)
theorem punctured_operation_table
TopologyByExample.BookIntervals.punctured_operation_table
The iterated interior and closure operations from the punctured-interval example.
theorem punctured_operation_table :
interior PuncturedInterval.subset = PuncturedInterval.subset ∧
interior (closure (interior PuncturedInterval.subset)) = Ioo (0 : ℝ) 1 ∧
interior (closure PuncturedInterval.subset) = Ioo (0 : ℝ) 1 ∧
closure (interior PuncturedInterval.subset) = Icc (0 : ℝ) 1 ∧
closure (interior (closure PuncturedInterval.subset)) = Icc (0 : ℝ) 1 ∧
closure PuncturedInterval.subset = Icc (0 : ℝ) 1
Proof
:= by
simp only [isOpen_punctured.interior_eq, closure_punctured, interior_Icc,
closure_Ioo (by norm_num : (0 : ℝ) ≠ 1)]
trivial
On this site: Punctured open interval: Interior and closure in the real line
theorem exterior_exterior_punctured
TopologyByExample.BookIntervals.exterior_exterior_punctured
Applying exterior twice fills the missing midpoint but not the two endpoints.
theorem exterior_exterior_punctured :
interior (interior PuncturedInterval.subsetᶜ)ᶜ = Ioo (0 : ℝ) 1
Proof
:= by
have h : interior PuncturedInterval.subsetᶜ = (closure PuncturedInterval.subset)ᶜ :=
interior_compl
rw [h, compl_compl, interior_closure_punctured]
On this site: Punctured open interval: Applying exterior twice