Lean library · module TopologyByExample.Theorems.CompactAvoidance

Avoiding zero on compact totally disconnected sets

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

theorem exists_near_nonzero

TopologyByExample.CompactAvoidance.exists_near_nonzero

A bounded continuous real function can be perturbed arbitrarily little to avoid zero on a compact totally disconnected set.

theorem exists_near_nonzero {X : Type*} [TopologicalSpace X] [T2Space X] [NormalSpace X]
    {K : Set X} (hK : IsCompact K) (ht : IsTotallyDisconnected K)
    (f : X →ᵇ ℝ) {ε : ℝ} (hε : 0 < ε) :
    ∃ g : X →ᵇ ℝ, dist g f < ε ∧ ∀ x ∈ K, g x ≠ 0
Proof
:= by
  let d := ε / 2
  have hd : 0 < d := half_pos hε
  obtain ⟨u, huA, huB, huK, hu⟩ := PlaneSeparation.exists_continuous_binary_on_compact
    hK ht (isClosed_le f.continuous continuous_const)
    (isClosed_le continuous_const f.continuous)
    (show Disjoint {x | f x ≤ -d / 2} {x | d / 2 ≤ f x} from
      Set.disjoint_left.mpr (by intro x hx hy; dsimp at hx hy; linarith))
  let v : C(X, ℝ) := ⟨fun x ↦ d * (2 * u x - 1), by fun_prop⟩
  have hv : ∀ x, |v x| ≤ d := by
    intro x
    have := hu x
    change |d * (2 * u x - 1)| ≤ d
    rw [abs_le]
    constructor <;> nlinarith [this.1, this.2]
  let b : X →ᵇ ℝ := BoundedContinuousFunction.mkOfBound v (2 * d) (by
    intro x y
    rw [Real.dist_eq, abs_le]
    have hx := abs_le.mp (hv x)
    have hy := abs_le.mp (hv y)
    constructor <;> linarith)
  refine ⟨f + b, ?_, ?_⟩
  · apply lt_of_le_of_lt ((BoundedContinuousFunction.dist_le hd.le).mpr ?_) (half_lt_self hε)
    intro x
    change dist (f x + v x) (f x) ≤ d
    simpa [Real.dist_eq] using hv x
  · intro x hx he
    change f x + d * (2 * u x - 1) = 0 at he
    rcases huK x hx with hz | ho
    · have hfx : f x < d / 2 := by
        by_contra hn
        have := huB (le_of_not_gt hn)
        simp [hz] at this
      rw [hz] at he
      linarith
    · have hfx : -d / 2 < f x := by
        by_contra hn
        have := huA (le_of_not_gt hn)
        simp [ho] at this
      rw [ho] at he
      linarith

theorem isOpen_nonzero_on_compact

TopologyByExample.CompactAvoidance.isOpen_nonzero_on_compact

Avoiding zero on a fixed compact set is an open condition in the uniform metric.

theorem isOpen_nonzero_on_compact {X : Type*} [TopologicalSpace X]
    {K : Set X} (hK : IsCompact K) :
    IsOpen {f : X →ᵇ ℝ | ∀ x ∈ K, f x ≠ 0}
Proof
:= by
  rw [isOpen_iff_mem_nhds]
  intro f hf
  apply hK.eventually_forall_of_forall_eventually
  intro x hx
  exact (isClosed_eq (by fun_prop : Continuous (fun p : (X →ᵇ ℝ) × X ↦ p.1 p.2))
    continuous_const).isOpen_compl.mem_nhds (hf x hx)

theorem dense_nonzero_on_compact

TopologyByExample.CompactAvoidance.dense_nonzero_on_compact

Avoiding zero on a compact totally disconnected set is dense in the uniform metric.

theorem dense_nonzero_on_compact {X : Type*} [TopologicalSpace X] [T2Space X] [NormalSpace X]
    {K : Set X} (hK : IsCompact K) (ht : IsTotallyDisconnected K) :
    Dense {f : X →ᵇ ℝ | ∀ x ∈ K, f x ≠ 0}
Proof
:= by
  rw [Metric.dense_iff]
  intro f ε hε
  obtain ⟨g, hg, hn⟩ := exists_near_nonzero hK ht f hε
  exact ⟨g, hg, hn⟩

theorem dense_nonzero_on_union

TopologyByExample.CompactAvoidance.dense_nonzero_on_union

Functions avoiding zero on a countable union of compact totally disconnected sets are dense in the uniform metric.

theorem dense_nonzero_on_union {X : Type*} [TopologicalSpace X] [T2Space X] [NormalSpace X]
    (K : ℕ → Set X) (hK : ∀ n, IsCompact (K n))
    (ht : ∀ n, IsTotallyDisconnected (K n)) :
    Dense {f : X →ᵇ ℝ | ∀ n, ∀ x ∈ K n, f x ≠ 0}
Proof
:= by
  have h := dense_iInter_of_isOpen_nat
    (fun n ↦ isOpen_nonzero_on_compact (hK n))
    (fun n ↦ dense_nonzero_on_compact (hK n) (ht n))
  simpa only [Set.mem_iInter, Set.ofPred_forall] using h

theorem subsingleton_of_preconnected_compact_cover

TopologyByExample.CompactAvoidance.subsingleton_of_preconnected_compact_cover

A preconnected normal Hausdorff space covered by countably many compact totally disconnected sets has at most one point.

theorem subsingleton_of_preconnected_compact_cover {X : Type*} [TopologicalSpace X]
    [T2Space X] [NormalSpace X] [PreconnectedSpace X]
    (K : ℕ → Set X) (hK : ∀ n, IsCompact (K n))
    (ht : ∀ n, IsTotallyDisconnected (K n)) (hcover : ⋃ n, K n = univ) :
    Subsingleton X
Proof
:= by
  refine ⟨fun a b ↦ ?_⟩
  by_contra hab
  obtain ⟨u, hua, hub, hu⟩ := exists_continuous_zero_one_of_isClosed
    (isClosed_singleton : IsClosed {a}) (isClosed_singleton : IsClosed {b})
    (disjoint_singleton.mpr hab)
  let v : C(X, ℝ) := ⟨fun x ↦ u x - 1 / 2, by fun_prop⟩
  let f : X →ᵇ ℝ := BoundedContinuousFunction.mkOfBound v 1 (by
    intro x y
    rw [Real.dist_eq, abs_le]
    have hx := hu x
    have hy := hu y
    change -1 ≤ (u x - 1 / 2) - (u y - 1 / 2) ∧
      (u x - 1 / 2) - (u y - 1 / 2) ≤ 1
    constructor <;> linarith [hx.1, hx.2, hy.1, hy.2])
  obtain ⟨g, hg, hn⟩ := Metric.dense_iff.mp (dense_nonzero_on_union K hK ht)
    f (1 / 4) (by norm_num)
  have hclose (x : X) : |g x - (u x - 1 / 2)| < 1 / 4 := by
    have h := lt_of_le_of_lt (BoundedContinuousFunction.dist_coe_le_dist (f := g) (g := f) x) hg
    change dist (g x) (u x - 1 / 2) < 1 / 4 at h
    rwa [Real.dist_eq] at h
  have ha : g a ≤ 0 := by
    have h := (abs_lt.mp (hclose a)).2
    rw [hua (mem_singleton a)] at h
    dsimp at h
    linarith
  have hb : 0 ≤ g b := by
    have h := (abs_lt.mp (hclose b)).1
    rw [hub (mem_singleton b)] at h
    dsimp at h
    linarith
  obtain ⟨x, hx⟩ := intermediate_value_univ₂ g.continuous continuous_const ha hb
  obtain ⟨n, hnK⟩ := mem_iUnion.mp (hcover.symm ▸ mem_univ x)
  exact hn n x hnK hx

On this site: Theorem: Connected spaces with compact totally disconnected covers