Lean library · module TopologyByExample.Spaces.ClosureComplementSubsets
The real subset giving fourteen closure–complement sets
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 rationalPiece
TopologyByExample.ClosureComplementSubsets.rationalPiece
The rational component includes its left endpoint seven.
def rationalPiece : Set ℝ
:= range (fun q : ℚ ↦ (q : ℝ)) ∩ Ico 7 8
definition exceptional
TopologyByExample.ClosureComplementSubsets.exceptional
The countable parts of the displayed subset.
def exceptional : Set ℝ
:= reciprocalSet ∪ {9 / 2} ∪ rationalPiece
definition original
TopologyByExample.ClosureComplementSubsets.original
The original subset in Example 32, item 9.
def original : Set ℝ
:= exceptional ∪ (Ioo 2 3 ∪ Ioo 3 4 ∪ Icc 5 6)
definition OriginalSpace
TopologyByExample.ClosureComplementSubsets.OriginalSpace
The original real subspace.
abbrev OriginalSpace
:= ↥original
On this site: Space: The original fourteen-set example
definition ComplementSpace
TopologyByExample.ClosureComplementSubsets.ComplementSpace
Its complement, with the real subspace topology.
abbrev ComplementSpace
:= ↥(originalᶜ)
On this site: Space: Complement of the fourteen-set example
theorem countable_rationalPiece
TopologyByExample.ClosureComplementSubsets.countable_rationalPiece
The rational component is countable.
theorem countable_rationalPiece : rationalPiece.Countable
Proof
:=
(countable_range (fun q : ℚ ↦ (q : ℝ))).mono inter_subset_left
theorem countable_exceptional
TopologyByExample.ClosureComplementSubsets.countable_exceptional
All exceptional parts together are countable.
theorem countable_exceptional : exceptional.Countable
Proof
:=
((countable_range reciprocal).union (countable_singleton _)).union countable_rationalPiece
theorem interior_exceptional
TopologyByExample.ClosureComplementSubsets.interior_exceptional
The exceptional parts have empty interior.
theorem interior_exceptional : interior exceptional = ∅
Proof
:=
interior_eq_empty_iff_dense_compl.mpr (countable_exceptional.dense_compl ℝ)
theorem closure_reciprocalSet
TopologyByExample.ClosureComplementSubsets.closure_reciprocalSet
Closing the positive reciprocal sequence adds exactly zero.
theorem closure_reciprocalSet : closure reciprocalSet = FortSpaces.harmonicSet
Proof
:= by
apply subset_antisymm
· exact closure_minimal (subset_insert 0 reciprocalSet) FortSpaces.isCompact_harmonicSet.isClosed
· apply insert_subset_iff.mpr
refine ⟨?_, subset_closure⟩
exact mem_closure_of_tendsto (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ))
(Eventually.of_forall (fun n ↦ mem_range_self n))
theorem closure_rationalPiece
TopologyByExample.ClosureComplementSubsets.closure_rationalPiece
The rational component is dense in the corresponding closed interval.
theorem closure_rationalPiece : closure rationalPiece = Icc (7 : ℝ) 8
Proof
:= by
apply subset_antisymm
· exact closure_minimal (fun _ h ↦ ⟨h.2.1, h.2.2.le⟩) isClosed_Icc
· have hd : Ioo (7 : ℝ) 8 ⊆ closure rationalPiece := by
apply (Rat.denseRange_cast.open_subset_closure_inter isOpen_Ioo).trans
apply closure_mono
intro x hx
exact ⟨hx.2, hx.1.1.le, hx.1.2⟩
have hc := closure_minimal hd isClosed_closure
simpa only [closure_Ioo (by norm_num : (7 : ℝ) ≠ 8)] using hc
theorem closure_original
TopologyByExample.ClosureComplementSubsets.closure_original
The exact closure of the original set.
theorem closure_original : closure original =
FortSpaces.harmonicSet ∪ {9 / 2} ∪ Icc 7 8 ∪ (Icc 2 4 ∪ Icc 5 6)
Proof
:= by
unfold original exceptional
rw [closure_union, closure_union, closure_union, closure_reciprocalSet,
closure_singleton, closure_rationalPiece, closure_union, closure_union,
closure_Ioo (by norm_num : (2 : ℝ) ≠ 3), closure_Ioo (by norm_num : (3 : ℝ) ≠ 4),
isClosed_Icc.closure_eq, Icc_union_Icc_eq_Icc (by norm_num) (by norm_num)]
theorem interior_twoIntervals
TopologyByExample.ClosureComplementSubsets.interior_twoIntervals
The two separated closed interval components have the expected interior.
theorem interior_twoIntervals :
interior (Icc (2 : ℝ) 4 ∪ Icc 5 6) = Ioo 2 4 ∪ Ioo 5 6
Proof
:= by
rw [interior_union_of_disjoint_closure]
· simp only [interior_Icc]
· rw [isClosed_Icc.closure_eq, isClosed_Icc.closure_eq]
exact Set.disjoint_left.mpr (fun x hx hy ↦ by linarith [hx.2, hy.1])
theorem three_not_mem_original
TopologyByExample.ClosureComplementSubsets.three_not_mem_original
Three is omitted from the original set.
theorem three_not_mem_original : (3 : ℝ) ∉ original
Proof
:= by
rintro (((⟨n, hn⟩ | hp) | hq) | ((h23 | h34) | h56))
· have h := reciprocal_le_one n
rw [hn] at h
norm_num at h
· norm_num at hp
· have h := hq.2.1
norm_num at h
· exact (lt_irrefl _ h23.2)
· exact (lt_irrefl _ h34.1)
· have h := h56.1
norm_num at h
theorem interior_original
TopologyByExample.ClosureComplementSubsets.interior_original
The exact interior of the original set.
theorem interior_original : interior original = Ioo (2 : ℝ) 3 ∪ Ioo 3 4 ∪ Ioo 5 6
Proof
:= by
apply subset_antisymm
· have hsub : original ⊆ (Icc (2 : ℝ) 4 ∪ Icc 5 6) ∪ exceptional := by
rintro x (he | ((h23 | h34) | h56))
· exact Or.inr he
· exact Or.inl (Or.inl ⟨h23.1.le, by linarith [h23.2]⟩)
· exact Or.inl (Or.inl ⟨by linarith [h34.1], h34.2.le⟩)
· exact Or.inl (Or.inr h56)
have hi := interior_mono hsub
rw [interior_union_isClosed_of_interior_empty (isClosed_Icc.union isClosed_Icc)
interior_exceptional, interior_twoIntervals] at hi
intro x hx
have hne : x ≠ 3 := fun he ↦ three_not_mem_original (he ▸ interior_subset hx)
rcases hi hx with h24 | h56
· rcases lt_or_gt_of_ne hne with h3 | h3
· exact Or.inl (Or.inl ⟨h24.1, h3⟩)
· exact Or.inl (Or.inr ⟨h3, h24.2⟩)
· exact Or.inr h56
· apply interior_maximal
· rintro x ((h23 | h34) | h56)
· exact Or.inr (Or.inl (Or.inl h23))
· exact Or.inr (Or.inl (Or.inr h34))
· exact Or.inr (Or.inr ⟨h56.1.le, h56.2.le⟩)
· exact (isOpen_Ioo.union isOpen_Ioo).union isOpen_Ioo
theorem closure_interior_original
TopologyByExample.ClosureComplementSubsets.closure_interior_original
Closing the interior gives exactly two closed intervals.
theorem closure_interior_original : closure (interior original) = Icc (2 : ℝ) 4 ∪ Icc 5 6
Proof
:= by
rw [interior_original, closure_union, closure_union,
closure_Ioo (by norm_num : (2 : ℝ) ≠ 3), closure_Ioo (by norm_num : (3 : ℝ) ≠ 4),
closure_Ioo (by norm_num : (5 : ℝ) ≠ 6),
Icc_union_Icc_eq_Icc (by norm_num) (by norm_num)]
theorem interior_closure_interior_original
TopologyByExample.ClosureComplementSubsets.interior_closure_interior_original
Taking the interior once more leaves two open intervals.
theorem interior_closure_interior_original :
interior (closure (interior original)) = Ioo (2 : ℝ) 4 ∪ Ioo 5 6
Proof
:= by
rw [closure_interior_original, interior_twoIntervals]
theorem interior_threeIntervals
TopologyByExample.ClosureComplementSubsets.interior_threeIntervals
The three closed interval components have three open interval interiors.
theorem interior_threeIntervals :
interior ((Icc (2 : ℝ) 4 ∪ Icc 5 6) ∪ Icc 7 8) =
(Ioo 2 4 ∪ Ioo 5 6) ∪ Ioo 7 8
Proof
:= by
rw [interior_union_of_disjoint_closure]
· rw [interior_twoIntervals, interior_Icc]
· rw [(isClosed_Icc.union isClosed_Icc).closure_eq, isClosed_Icc.closure_eq]
apply Set.disjoint_left.mpr
rintro x (hx | hx) hy <;> linarith [hx.2, hy.1]
theorem interior_closure_original
TopologyByExample.ClosureComplementSubsets.interior_closure_original
The interior of the closure consists of three open intervals.
theorem interior_closure_original : interior (closure original) =
(Ioo (2 : ℝ) 4 ∪ Ioo 5 6) ∪ Ioo 7 8
Proof
:= by
have hc : (FortSpaces.harmonicSet ∪ {(9 : ℝ) / 2}).Countable :=
((countable_range reciprocal).insert 0).union (countable_singleton _)
have he : closure original = ((Icc (2 : ℝ) 4 ∪ Icc 5 6) ∪ Icc 7 8) ∪
(FortSpaces.harmonicSet ∪ {9 / 2}) := by
rw [closure_original]
ext x
simp only [mem_union]
tauto
rw [he, interior_union_isClosed_of_interior_empty
((isClosed_Icc.union isClosed_Icc).union isClosed_Icc)
(interior_eq_empty_iff_dense_compl.mpr (hc.dense_compl ℝ)), interior_threeIntervals]
theorem closure_interior_closure_original
TopologyByExample.ClosureComplementSubsets.closure_interior_closure_original
Closing that interior gives exactly three closed intervals.
theorem closure_interior_closure_original : closure (interior (closure original)) =
(Icc (2 : ℝ) 4 ∪ Icc 5 6) ∪ Icc 7 8
Proof
:= by
rw [interior_closure_original, closure_union, closure_union,
closure_Ioo (by norm_num : (2 : ℝ) ≠ 4), closure_Ioo (by norm_num : (5 : ℝ) ≠ 6),
closure_Ioo (by norm_num : (7 : ℝ) ≠ 8)]