The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V13. General topology

Mathlib.Topology.UrysohnsLemma

50 declarations. Mathlib docs · Source

Urysohn's lemma

In this file we prove Urysohn's lemma exists_continuous_zero_one_of_isClosed: for any two disjoint closed sets s and t in a normal topological space X there exists a continuous function f : X → ℝ such that

  • f equals zero on s;
  • f equals one on t;
  • 0 ≤ f x ≤ 1 for all x.

We also give versions in a regular locally compact space where one assumes that s is compact and t is closed, in exists_continuous_zero_one_of_isCompact and exists_continuous_one_zero_of_isCompact (the latter providing additionally a function with compact support).

We write a generic proof so that it applies both to normal spaces and to regular locally compact spaces.

Implementation notes

Most paper sources prove Urysohn's lemma using a family of open sets indexed by dyadic rational numbers on [0, 1]. There are many technical difficulties with formalizing this proof (e.g., one needs to formalize the "dyadic induction", then prove that the resulting family of open sets is monotone). So, we formalize a slightly different proof.

Let Urysohns.CU be the type of pairs (C, U) of a closed set C and an open set U such that C ⊆ U. Since X is a normal topological space, for each c : CU there exists an open set u such that c.C ⊆ u ∧ closure u ⊆ c.U. We define c.left and c.right to be (c.C, u) and (closure u, c.U), respectively. Then we define a family of functions Urysohns.CU.approx (c : Urysohns.CU) (n : ℕ) : X → ℝ by recursion on n:

  • c.approx 0 is the indicator of c.Uᶜ;
  • c.approx (n + 1) x = (c.left.approx n x + c.right.approx n x) / 2.

For each x this is a monotone family of functions that are equal to zero on c.C and are equal to one outside of c.U. We also have c.approx n x ∈ [0, 1] for all c, n, and x.

Let Urysohns.CU.lim c be the supremum (or equivalently, the limit) of c.approx n. Then properties of Urysohns.CU.approx immediately imply that

  • c.lim x ∈ [0, 1] for all x;
  • c.lim equals zero on c.C and equals one outside of c.U;
  • c.lim x = (c.left.lim x + c.right.lim x) / 2.

In order to prove that c.lim is continuous at x, we prove by induction on n : ℕ that for y in a small neighborhood of x we have |c.lim y - c.lim x| ≤ (3 / 4) ^ n. Induction base follows from c.lim x ∈ [0, 1], c.lim y ∈ [0, 1]. For the induction step, consider two cases:

  • x ∈ c.left.U; then for y in a small neighborhood of x we have y ∈ c.left.U ⊆ c.right.C (hence c.right.lim x = c.right.lim y = 0) and |c.left.lim y - c.left.lim x| ≤ (3 / 4) ^ n. Then |c.lim y - c.lim x| = |c.left.lim y - c.left.lim x| / 2 ≤ (3 / 4) ^ n / 2 < (3 / 4) ^ (n + 1).
  • otherwise, x ∉ c.left.right.C; then for y in a small neighborhood of x we have y ∉ c.left.right.C ⊇ c.left.left.U (hence c.left.left.lim x = c.left.left.lim y = 1), |c.left.right.lim y - c.left.right.lim x| ≤ (3 / 4) ^ n, and |c.right.lim y - c.right.lim x| ≤ (3 / 4) ^ n. Combining these inequalities, the triangle inequality, and the recurrence formula for c.lim, we get |c.lim x - c.lim y| ≤ (3 / 4) ^ (n + 1).

The actual formalization uses midpoint ℝ x y instead of (x + y) / 2 because we have more API lemmas about midpoint.

Tags

Urysohn's lemma, normal topological space, locally compact topological space

theorem Urysohns.CU.approx.match_1.congr_eq_2 E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (motive : ℕ → Urysohns.CU P → X → Sort u_2)
  (x : ℕ) (x_1 : Urysohns.CU P) (x_2 : X) (h_1 : (c : Urysohns.CU P) → (x : X) → motive 0 c x)
  (h_2 : (n : ℕ) → (c : Urysohns.CU P) → (x : X) → motive n.succ c x) (n : ℕ) (c : Urysohns.CU P) (x_3 : X),
  x = n.succ →
    x_1 = c →
      x_2 = x_3 →
        (match x, x_1, x_2 with
          | 0, c, x => h_1 c x
          | n.succ, c, x => h_2 n c x) ≍
          h_2 n c x_3

theorem Urysohns.CU.mk.injEq E0 #

∀ {X : Type u_2} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (C U : Set X) (P_C_U : P C U)
  (closed_C : IsClosed C) (open_U : IsOpen U) (subset : C ⊆ U)
  (hP :
    ∀ {c u : Set X},
      IsClosed c → P c u → IsOpen u → c ⊆ u → ∃ v, IsOpen v ∧ c ⊆ v ∧ closure v ⊆ u ∧ P c v ∧ P (closure v) u)
  (C_1 U_1 : Set X) (P_C_U_1 : P C_1 U_1) (closed_C_1 : IsClosed C_1) (open_U_1 : IsOpen U_1) (subset_1 : C_1 ⊆ U_1)
  (hP_1 :
    ∀ {c u : Set X},
      IsClosed c → P c u → IsOpen u → c ⊆ u → ∃ v, IsOpen v ∧ c ⊆ v ∧ closure v ⊆ u ∧ P c v ∧ P (closure v) u),
  ({ C := C, U := U, P_C_U := P_C_U, closed_C := closed_C, open_U := open_U, subset := subset, hP := hP } =
      { C := C_1, U := U_1, P_C_U := P_C_U_1, closed_C := closed_C_1, open_U := open_U_1, subset := subset_1,
        hP := hP_1 }) =
    (C = C_1 ∧ U = U_1)

theorem Urysohns.CU.approx.match_1.congr_eq_1 E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (motive : ℕ → Urysohns.CU P → X → Sort u_2)
  (x : ℕ) (x_1 : Urysohns.CU P) (x_2 : X) (h_1 : (c : Urysohns.CU P) → (x : X) → motive 0 c x)
  (h_2 : (n : ℕ) → (c : Urysohns.CU P) → (x : X) → motive n.succ c x) (c : Urysohns.CU P) (x_3 : X),
  x = 0 →
    x_1 = c →
      x_2 = x_3 →
        (match x, x_1, x_2 with
          | 0, c, x => h_1 c x
          | n.succ, c, x => h_2 n c x) ≍
          h_1 c x_3

theorem Urysohns.CU.mk.inj E1 #

∀ {X : Type u_2} {inst : TopologicalSpace X} {P : Set X → Set X → Prop} {C U : Set X} {P_C_U : P C U}
  {closed_C : IsClosed C} {open_U : IsOpen U} {subset : C ⊆ U}
  {hP :
    ∀ {c u : Set X},
      IsClosed c → P c u → IsOpen u → c ⊆ u → ∃ v, IsOpen v ∧ c ⊆ v ∧ closure v ⊆ u ∧ P c v ∧ P (closure v) u}
  {C_1 U_1 : Set X} {P_C_U_1 : P C_1 U_1} {closed_C_1 : IsClosed C_1} {open_U_1 : IsOpen U_1} {subset_1 : C_1 ⊆ U_1}
  {hP_1 :
    ∀ {c u : Set X},
      IsClosed c → P c u → IsOpen u → c ⊆ u → ∃ v, IsOpen v ∧ c ⊆ v ∧ closure v ⊆ u ∧ P c v ∧ P (closure v) u},
  { C := C, U := U, P_C_U := P_C_U, closed_C := closed_C, open_U := open_U, subset := subset, hP := hP } =
      { C := C_1, U := U_1, P_C_U := P_C_U_1, closed_C := closed_C_1, open_U := open_U_1, subset := subset_1,
        hP := hP_1 } →
    C = C_1 ∧ U = U_1

def Urysohns.CU.ctorIdx E1 #

{X : Type u_2} → {inst : TopologicalSpace X} → {P : Set X → Set X → Prop} → Urysohns.CU P → ℕ

structure Urysohns.CU E1 #

{X : Type u_2} → [TopologicalSpace X] → (Set X → Set X → Prop) → Type u_2

An auxiliary type for the proof of Urysohn's lemma: a pair of a closed set C and its open neighborhood U, together with the assumption that C and U satisfy the property P C U. The latter assumption will make it possible to prove simultaneously both versions of Urysohn's lemma, in normal spaces (with P always true) and in locally compact spaces (with P C U = IsCompact C). We put also in the structure the assumption that, for any such pair, one may find an intermediate pair in between satisfying P, to avoid carrying it around in the argument.

ctor Urysohns.CU.mk E0 #

{X : Type u_2} →
  [inst : TopologicalSpace X] →
    {P : Set X → Set X → Prop} →
      (C U : Set X) →
        P C U →
          IsClosed C →
            IsOpen U →
              C ⊆ U →
                (∀ {c u : Set X},
                    IsClosed c →
                      P c u → IsOpen u → c ⊆ u → ∃ v, IsOpen v ∧ c ⊆ v ∧ closure v ⊆ u ∧ P c v ∧ P (closure v) u) →
                  Urysohns.CU P

abbrev Urysohns.CU.C E1 #

{X : Type u_2} → [inst : TopologicalSpace X] → {P : Set X → Set X → Prop} → Urysohns.CU P → Set X

The inner set in the inductive construction towards Urysohn's lemma

abbrev Urysohns.CU.U E1 #

{X : Type u_2} → [inst : TopologicalSpace X] → {P : Set X → Set X → Prop} → Urysohns.CU P → Set X

The outer set in the inductive construction towards Urysohn's lemma

theorem Urysohns.CU.P_C_U E1 #

∀ {X : Type u_2} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (self : Urysohns.CU P), P self.C self.U

The proof that C and U satisfy the property P C U

theorem Urysohns.CU.closed_C E1 #

∀ {X : Type u_2} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (self : Urysohns.CU P), IsClosed self.C

theorem Urysohns.CU.open_U E1 #

∀ {X : Type u_2} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (self : Urysohns.CU P), IsOpen self.U

theorem Urysohns.CU.subset E1 #

∀ {X : Type u_2} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (self : Urysohns.CU P), self.C ⊆ self.U

theorem Urysohns.CU.hP E1 #

∀ {X : Type u_2} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (self : Urysohns.CU P) {c u : Set X},
  IsClosed c → P c u → IsOpen u → c ⊆ u → ∃ v, IsOpen v ∧ c ⊆ v ∧ closure v ⊆ u ∧ P c v ∧ P (closure v) u

The proof that we can divide CU pairs in half

def Urysohns.CU.left E1 #

{X : Type u_1} → [inst : TopologicalSpace X] → {P : Set X → Set X → Prop} → Urysohns.CU P → Urysohns.CU P

By assumption, for each c : CU P there exists an open set u such that c.C ⊆ u and closure u ⊆ c.U. c.left is the pair (c.C, u).

theorem Urysohns.CU.left_C E0 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), c.left.C = c.C

def Urysohns.CU.right E1 #

{X : Type u_1} → [inst : TopologicalSpace X] → {P : Set X → Set X → Prop} → Urysohns.CU P → Urysohns.CU P

By assumption, for each c : CU P there exists an open set u such that c.C ⊆ u and closure u ⊆ c.U. c.right is the pair (closure u, c.U).

theorem Urysohns.CU.right_U E0 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), c.right.U = c.U

theorem Urysohns.CU.left_U_subset_right_C E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), c.left.U ⊆ c.right.C

theorem Urysohns.CU.left_U_subset E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), c.left.U ⊆ c.U

theorem Urysohns.CU.subset_right_C E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), c.C ⊆ c.right.C

def Urysohns.CU.approx E1 #

{X : Type u_1} → [inst : TopologicalSpace X] → {P : Set X → Set X → Prop} → ℕ → Urysohns.CU P → X → ℝ

n-th approximation to a continuous function f : X → ℝ such that f = 0 on c.C and f = 1 outside of c.U.

theorem Urysohns.CU.approx_of_mem_C E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (n : ℕ) {x : X},
  x ∈ c.C → Urysohns.CU.approx n c x = 0

theorem Urysohns.CU.approx_of_notMem_U E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (n : ℕ) {x : X},
  x ∉ c.U → Urysohns.CU.approx n c x = 1

theorem Urysohns.CU.approx_nonneg E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (n : ℕ) (x : X),
  0 ≤ Urysohns.CU.approx n c x

theorem Urysohns.CU.approx_le_one E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (n : ℕ) (x : X),
  Urysohns.CU.approx n c x ≤ 1

theorem Urysohns.CU.bddAbove_range_approx E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X),
  BddAbove (Set.range fun n ↦ Urysohns.CU.approx n c x)

theorem Urysohns.CU.approx_le_approx_of_U_sub_C E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} {c₁ c₂ : Urysohns.CU P},
  c₁.U ⊆ c₂.C → ∀ (n₁ n₂ : ℕ) (x : X), Urysohns.CU.approx n₂ c₂ x ≤ Urysohns.CU.approx n₁ c₁ x

theorem Urysohns.CU.approx_mem_Icc_right_left E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (n : ℕ) (x : X),
  Urysohns.CU.approx n c x ∈ Set.Icc (Urysohns.CU.approx n c.right x) (Urysohns.CU.approx n c.left x)

theorem Urysohns.CU.approx_le_succ E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (n : ℕ) (x : X),
  Urysohns.CU.approx n c x ≤ Urysohns.CU.approx (n + 1) c x

theorem Urysohns.CU.approx_mono E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X),
  Monotone fun n ↦ Urysohns.CU.approx n c x

def Urysohns.CU.lim E1 #

{X : Type u_1} → [inst : TopologicalSpace X] → {P : Set X → Set X → Prop} → Urysohns.CU P → X → ℝ

A continuous function f : X → ℝ such that

  • 0 ≤ f x ≤ 1 for all x;
  • f equals zero on c.C and equals one outside of c.U;

theorem Urysohns.CU.tendsto_approx_atTop E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X),
  Filter.Tendsto (fun n ↦ Urysohns.CU.approx n c x) Filter.atTop (nhds (c.lim x))

theorem Urysohns.CU.lim_of_mem_C E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), ∀ x ∈ c.C, c.lim x = 0

theorem Urysohns.CU.disjoint_C_support_lim E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P),
  Disjoint c.C (Function.support c.lim)

theorem Urysohns.CU.lim_of_notMem_U E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), ∀ x ∉ c.U, c.lim x = 1

theorem Urysohns.CU.lim_eq_midpoint E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X),
  c.lim x = midpoint ℝ (c.left.lim x) (c.right.lim x)

theorem Urysohns.CU.approx_le_lim E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X) (n : ℕ),
  Urysohns.CU.approx n c x ≤ c.lim x

theorem Urysohns.CU.lim_nonneg E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X), 0 ≤ c.lim x

theorem Urysohns.CU.lim_le_one E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X), c.lim x ≤ 1

theorem Urysohns.CU.lim_mem_Icc E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P) (x : X),
  c.lim x ∈ Set.Icc 0 1

theorem Urysohns.CU.continuous_lim E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {P : Set X → Set X → Prop} (c : Urysohns.CU P), Continuous c.lim

Continuity of Urysohns.CU.lim. See module docstring for a sketch of the proofs.

theorem exists_continuous_zero_one_of_isClosed E3 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [NormalSpace X] {s t : Set X},
  IsClosed s → IsClosed t → Disjoint s t → ∃ f, Set.EqOn (⇑f) 0 s ∧ Set.EqOn (⇑f) 1 t ∧ ∀ (x : X), f x ∈ Set.Icc 0 1

Urysohn's lemma: if s and t are two disjoint closed sets in a normal topological space X, then there exists a continuous function f : X → ℝ such that

  • f equals zero on s;
  • f equals one on t;
  • 0 ≤ f x ≤ 1 for all x.

theorem exists_continuous_zero_one_of_isCompact E2 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [RegularSpace X] [LocallyCompactSpace X] {s t : Set X},
  IsCompact s → IsClosed t → Disjoint s t → ∃ f, Set.EqOn (⇑f) 0 s ∧ Set.EqOn (⇑f) 1 t ∧ ∀ (x : X), f x ∈ Set.Icc 0 1

Urysohn's lemma: if s and t are two disjoint sets in a regular locally compact topological space X, with s compact and t closed, then there exists a continuous function f : X → ℝ such that

  • f equals zero on s;
  • f equals one on t;
  • 0 ≤ f x ≤ 1 for all x.

theorem exists_continuous_zero_one_of_isCompact' E2 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [RegularSpace X] [LocallyCompactSpace X] {s t : Set X},
  IsCompact s → IsClosed t → Disjoint s t → ∃ f, Set.EqOn (⇑f) 0 t ∧ Set.EqOn (⇑f) 1 s ∧ ∀ (x : X), f x ∈ Set.Icc 0 1

Urysohn's lemma: if s and t are two disjoint sets in a regular locally compact topological space X, with s compact and t closed, then there exists a continuous function f : X → ℝ such that

  • f equals zero on t;
  • f equals one on s;
  • 0 ≤ f x ≤ 1 for all x.

theorem exists_continuous_one_zero_of_isCompact E2 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [RegularSpace X] [LocallyCompactSpace X] {s t : Set X},
  IsCompact s →
    IsClosed t →
      Disjoint s t → ∃ f, Set.EqOn (⇑f) 1 s ∧ Set.EqOn (⇑f) 0 t ∧ HasCompactSupport ⇑f ∧ ∀ (x : X), f x ∈ Set.Icc 0 1

Urysohn's lemma: if s and t are two disjoint sets in a regular locally compact topological space X, with s compact and t closed, then there exists a continuous compactly supported function f : X → ℝ such that

  • f equals one on s;
  • f equals zero on t;
  • 0 ≤ f x ≤ 1 for all x.

theorem exists_continuous_one_zero_of_isCompact_of_isGδ E2 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [RegularSpace X] [LocallyCompactSpace X] {s t : Set X},
  IsCompact s →
    IsGδ s →
      IsClosed t →
        Disjoint s t → ∃ f, s = ⇑f ⁻¹' {1} ∧ Set.EqOn (⇑f) 0 t ∧ HasCompactSupport ⇑f ∧ ∀ (x : X), f x ∈ Set.Icc 0 1

Urysohn's lemma: if s and t are two disjoint sets in a regular locally compact topological space X, with s compact and t closed, then there exists a continuous compactly supported function f : X → ℝ such that

  • f equals one on s;
  • f equals zero on t;
  • 0 ≤ f x ≤ 1 for all x.

Moreover, if s is Gδ, one can ensure that f ⁻¹ {1} is exactly s.

theorem exists_tsupport_one_of_isOpen_isClosed E2 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [R1Space X] {s t : Set X},
  IsOpen s →
    IsCompact (closure s) → IsClosed t → t ⊆ s → ∃ f, tsupport ⇑f ⊆ s ∧ Set.EqOn (⇑f) 1 t ∧ ∀ (x : X), f x ∈ Set.Icc 0 1

A variation of Urysohn's lemma. In a R1Space X, for a closed set t and a relatively compact open set s such that t ⊆ s, there is a continuous function f supported in s, f x = 1 on t and 0 ≤ f x ≤ 1.

theorem exists_continuousMap_one_of_isCompact_subset_isOpen E2 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [R1Space X] [LocallyCompactSpace X] {K V : Set X},
  IsCompact K →
    IsOpen V → K ⊆ V → ∃ f, Set.EqOn (⇑f) 1 K ∧ IsCompact (tsupport ⇑f) ∧ tsupport ⇑f ⊆ V ∧ ∀ (x : X), f x ∈ Set.Icc 0 1

A variation of Urysohn's lemma. In a Hausdorff locally compact space, for a compact set K contained in an open set V, there exists a compactly supported continuous function f such that 0 ≤ f ≤ 1, f = 1 on K and the support of f is contained in V.

theorem exists_continuous_nonneg_pos E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] [RegularSpace X] [LocallyCompactSpace X] (x : X),
  ∃ f, HasCompactSupport ⇑f ∧ 0 ≤ ⇑f ∧ f x ≠ 0