Chapter 02 — Continuous Functions on Metric Spaces
Proofs omitted. Hover over highlighted terms to see their Lean types.
Reading sections
2.1 — Continuous Functions
Lean contributors (project-level attribution): Chenyi Li, Min Cui, Qiming Dai, Shu Miao, Wanli Ma, Yi Yuan, Zichen Wang, Ziyu Wang.
Definition 2.1 (Continuous functions): (i) For x0 ∈ X, f is continuous at x0 if for every ε > 0 there exists δ > 0 such that for all x ∈ X, d_X x x0 < δ implies d_Y (f x) (f x0) < ε. (ii) f is continuous on X if it is continuous at every x ∈ X.
abbrev IsContinuousAt {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (x0 : X) : Prop :=
ContinuousAt f x0
A function between metric spaces is continuous if it is continuous at every point.
abbrev IsContinuous {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) : Prop :=
∀ x : X, IsContinuousAt f x
Proposition 2.1: Let X be a topological space and let f : X → ℝ be continuous. Define f^2 : X → ℝ by f^2 x := (f x)^2. Then f^2 is continuous.
theorem continuous_sq_of_continuous {X : Type*} [TopologicalSpace X] (f : X → ℝ) :
Continuous f → Continuous (fun x => (f x) ^ 2)
Theorem 2.1 (Continuity preserves convergence): Let (X,d_X) and (Y,d_Y) be metric spaces, f : X → Y, and x0 ∈ X. The following statements are equivalent: (a) f is continuous at x0. (b) For every sequence x : ℕ → X with x → x0, one has f ∘ x → f x0. (c) For every open set V ⊆ Y with f x0 ∈ V, there exists an open set U ⊆ X with x0 ∈ U such that f '' U ⊆ V.
theorem continuity_preserves_convergence
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (x0 : X) :
(IsContinuousAt f x0 ↔
∀ x : ℕ → X, Filter.Tendsto x Filter.atTop (nhds x0) →
Filter.Tendsto (fun n => f (x n)) Filter.atTop (nhds (f x0))) ∧
(IsContinuousAt f x0 ↔
∀ V : Set Y, IsOpen V → f x0 ∈ V →
∃ U : Set X, IsOpen U ∧ x0 ∈ U ∧ f '' U ⊆ V)
Proposition 2.2: Let (X, d) be a metric space and let (E, d|_{E × E}) be a subspace of (X, d). The inclusion map ι_{E → X} : E → X, defined by ι_{E → X}(x) = x, is continuous.
theorem isContinuous_inclusion_subtype {X : Type*} [MetricSpace X] (E : Set X) :
IsContinuous (Subtype.val : E → X)
Theorem 2.2: Let (X, d_X) and (Y, d_Y) be metric spaces and f : X → Y. The following statements are equivalent: (a) f is continuous. (b) Whenever a sequence x in X converges to x0, the sequence fun n => f (x n) converges to f x0. (c) For every open set V ⊆ Y, the preimage f ⁻¹' V is open in X. (d) For every closed set F ⊆ Y, the preimage f ⁻¹' F is closed in X.
theorem continuous_iff_sequential_iff_preimage_open_iff_preimage_closed
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) :
(IsContinuous f ↔
∀ x0 : X, ∀ x : ℕ → X, Filter.Tendsto x Filter.atTop (nhds x0) →
Filter.Tendsto (fun n => f (x n)) Filter.atTop (nhds (f x0))) ∧
(IsContinuous f ↔
∀ V : Set Y, IsOpen V → IsOpen (f ⁻¹' V)) ∧
(IsContinuous f ↔
∀ F : Set Y, IsClosed F → IsClosed (f ⁻¹' F))
Proposition 2.3: If f : X → Y is continuous at x0 ∈ E, then the restriction f|_E is continuous at x0; in particular, if f is continuous on X, then f|_E is continuous on E.
theorem continuous_restrict_of_continuous
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (E : Set X) :
(∀ x0 : E, IsContinuousAt f x0 → IsContinuousAt (fun x : E => f x) x0) ∧
(IsContinuous f → IsContinuous (fun x : E => f x))
Theorem 2.3 (Continuity preserved by composition): Let (X,d_X), (Y,d_Y), and (Z,d_Z) be metric spaces. (a) If f : X → Y is continuous at x0 and g : Y → Z is continuous at f x0, then g ∘ f is continuous at x0. (b) If f is continuous on X and g is continuous on Y, then g ∘ f is continuous on X.
theorem continuity_preserved_by_composition
{X Y Z : Type*} [MetricSpace X] [MetricSpace Y] [MetricSpace Z] :
(∀ (f : X → Y) (g : Y → Z) (x0 : X),
IsContinuousAt f x0 → IsContinuousAt g (f x0) →
IsContinuousAt (fun x => g (f x)) x0) ∧
(∀ (f : X → Y) (g : Y → Z),
IsContinuous f → IsContinuous g → IsContinuous (fun x => g (f x)))
Proposition 2.4: Let f : X → Y be a function between metric spaces, and let E ⊆ Y contain the image of f. Let g : X → E be the codomain restriction of f with g x = f x. Then for any x0 ∈ X, f is continuous at x0 iff g is continuous at x0.
theorem continuousAt_codomainRestrict_iff
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (E : Set Y)
(hE : ∀ x, f x ∈ E) (x0 : X) :
IsContinuousAt f x0 ↔ IsContinuousAt (Set.codRestrict f E hE) x0
Helper for Theorem 2.1: open-set formulation of continuity at a point.
lemma helperForTheorem_2_1_openImage_iff_continuousAt
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (x0 : X) :
IsContinuousAt f x0 ↔
∀ V : Set Y, IsOpen V → f x0 ∈ V →
∃ U : Set X, IsOpen U ∧ x0 ∈ U ∧ f '' U ⊆ V
Helper for Theorem 2.2: IsContinuous matches Continuous for metric spaces.
lemma helperForTheorem_2_2_isContinuous_iff_continuous
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) :
IsContinuous f ↔ Continuous f
Helper for Proposition 2.3: continuity at a point is preserved under restriction to a subset.
lemma helperForProposition_2_3_restrict_isContinuousAt
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (E : Set X) (x0 : E) :
IsContinuousAt f x0 → IsContinuousAt (fun x : E => f x) x0
Helper for Proposition 2.3: global continuity is preserved under restriction to a subset.
lemma helperForProposition_2_3_restrict_isContinuous
{X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (E : Set X) :
IsContinuous f → IsContinuous (fun x : E => f x)2.2 — Continuity and Product Spaces
Lean contributors (project-level attribution): Chenyi Li, Min Cui, Qiming Dai, Shu Miao, Wanli Ma, Yi Yuan, Zichen Wang, Ziyu Wang.
Definition 2.2: Pairing of functions. For functions f : X → Y and g : X → Z, the pairing (f,g) is the function X → Y × Z given by x ↦ (f x, g x).
open Filter
def pairing {X Y Z : Type*} (f : X → Y) (g : X → Z) : X → Y × Z :=
fun x => (f x, g x)
Lemma 2.1: For functions f, g : X → ℝ and their direct sum (f, g) : X → ℝ × ℝ with the Euclidean metric: (a) for any x0, f and g are both continuous at x0 iff (f, g) is continuous at x0; (b) f and g are both continuous iff (f, g) is continuous.
open Filter
lemma continuousAt_and_continuous_pairing_iff {X : Type*} [TopologicalSpace X]
(f g : X → ℝ) :
(∀ x0 : X, (ContinuousAt f x0 ∧ ContinuousAt g x0) ↔
ContinuousAt (pairing f g) x0) ∧
((Continuous f ∧ Continuous g) ↔ Continuous (pairing f g))
Lemma 2.2: The functions +, -, ·, max, and min on ℝ × ℝ are continuous; the division function (x,y) ↦ x / y is continuous on ℝ × (ℝ \ {0}); and for each c : ℝ, the function m_c(x) = c * x is continuous.
open Filter
lemma continuous_real_operations_and_scalar_mul :
Continuous (fun p : ℝ × ℝ => p.1 + p.2) ∧
Continuous (fun p : ℝ × ℝ => p.1 - p.2) ∧
Continuous (fun p : ℝ × ℝ => p.1 * p.2) ∧
Continuous (fun p : ℝ × ℝ => max p.1 p.2) ∧
Continuous (fun p : ℝ × ℝ => min p.1 p.2) ∧
Continuous (fun p : ℝ × {y : ℝ // y ≠ 0} => p.1 / p.2) ∧
(∀ c : ℝ, Continuous (fun x : ℝ => c * x))
Theorem 2.4: (a) If f and g are continuous at x0, then f + g, f - g, f g, max f g, min f g, and c f are continuous at x0, and if g(x) ≠ 0 for all x, then f/g is continuous at x0. (b) If f and g are continuous, then the same operations are continuous, and if g(x) ≠ 0 for all x, then f/g is continuous.
open Filter
theorem continuous_operations_at_and_continuous {X : Type*} [MetricSpace X]
(f g : X → ℝ) (c : ℝ) (x0 : X) :
((ContinuousAt f x0 ∧ ContinuousAt g x0) →
(ContinuousAt (fun x => f x + g x) x0 ∧
ContinuousAt (fun x => f x - g x) x0 ∧
ContinuousAt (fun x => f x * g x) x0 ∧
ContinuousAt (fun x => max (f x) (g x)) x0 ∧
ContinuousAt (fun x => min (f x) (g x)) x0 ∧
ContinuousAt (fun x => c * f x) x0 ∧
((∀ x : X, g x ≠ 0) →
ContinuousAt (fun x => f x / g x) x0))) ∧
((Continuous f ∧ Continuous g) →
(Continuous (fun x => f x + g x) ∧
Continuous (fun x => f x - g x) ∧
Continuous (fun x => f x * g x) ∧
Continuous (fun x => max (f x) (g x)) ∧
Continuous (fun x => min (f x) (g x)) ∧
Continuous (fun x => c * f x) ∧
((∀ x : X, g x ≠ 0) →
Continuous (fun x => f x / g x))))
Proposition 2.6: If f : X → ℝ is continuous on a metric space, then the function |f| defined by |f| (x) = |f x| is continuous on X.
open Filter
theorem continuous_abs_comp {X : Type*} [MetricSpace X] (f : X → ℝ)
(hf : Continuous f) : Continuous (fun x => |f x|)
Proposition 2.7: The coordinate projections π₁, π₂ : ℝ × ℝ → ℝ are continuous, and if (X, d) is a metric space with f : ℝ → X continuous, then g₁(x,y) = f x and g₂(x,y) = f y are continuous.
open Filter
theorem continuous_projections_and_coordinate_comp :
(Continuous (fun p : ℝ × ℝ => p.1) ∧
Continuous (fun p : ℝ × ℝ => p.2)) ∧
(∀ {X : Type*} [MetricSpace X] {f : ℝ → X}, Continuous f →
(Continuous (fun p : ℝ × ℝ => f p.1) ∧
Continuous (fun p : ℝ × ℝ => f p.2)))
Proposition 2.8: For integers n, m ≥ 0 and coefficients c_{ij} ∈ ℝ, define P(x,y) = ∑_{i=0}^n ∑_{j=0}^m c_{ij} x^i y^j. Then P is continuous on ℝ × ℝ. Moreover, for any metric space X and continuous f, g : X → ℝ, the map x ↦ P (f x, g x) is continuous.
open Filter
theorem continuous_polynomial_two_variables
(n m : ℕ) (c : ℕ → ℕ → ℝ) :
let P : ℝ × ℝ → ℝ :=
fun p =>
Finset.sum (Finset.range (n + 1)) fun i =>
Finset.sum (Finset.range (m + 1)) fun j =>
c i j * (p.1 ^ i) * (p.2 ^ j)
;
Continuous P ∧
(∀ {X : Type*} [MetricSpace X] {f g : X → ℝ},
Continuous f → Continuous g → Continuous (fun x => P (f x, g x)))
Proposition 2.9: If X is a topological space and f : X → ℝ^m, g : X → ℝ^n are continuous (with the Euclidean topologies), then the map x ↦ (f x, g x) into ℝ^m × ℝ^n ≃ ℝ^{m+n} is continuous.
open Filter
theorem continuous_pairing_euclidean {X : Type*} [TopologicalSpace X] {m n : ℕ}
(f : X → EuclideanSpace ℝ (Fin m)) (g : X → EuclideanSpace ℝ (Fin n))
(hf : Continuous f) (hg : Continuous g) :
Continuous (pairing f g)
Proposition 2.10: Let k ≥ 1, let I ⊆ ℕ^k be finite, let c : I → ℝ, and define P : ℝ^k → ℝ by P(x_1, ..., x_k) = ∑_{(i_1, ..., i_k) ∈ I} c(i_1, ..., i_k) * x_1^{i_1} * ... * x_k^{i_k}. Then P is continuous on ℝ^k (with the Euclidean topology).
open Filter
theorem continuous_polynomial_multi_index (k : ℕ) (hk : 1 ≤ k)
(I : Finset (Fin k → ℕ)) (c : {i // i ∈ I} → ℝ) :
let P : EuclideanSpace ℝ (Fin k) → ℝ :=
fun x =>
Finset.sum I.attach (fun i =>
c i * Finset.prod Finset.univ (fun j => x j ^ (i.1 j)))
;
Continuous P
Sum distance on a product of metric spaces: d((x,y),(x',y')) = dist x x' + dist y y'.
open Filter
def prodSumDist (X Y : Type*) [MetricSpace X] [MetricSpace Y] :
(X × Y) → (X × Y) → ℝ :=
fun p q => dist p.1 q.1 + dist p.2 q.2
Proposition 2.11: For metric spaces (X, d_X) and (Y, d_Y), the function d_{X×Y}((x,y),(x',y')) = d_X(x,x') + d_Y(y,y') is a metric on X × Y, hence (X × Y, d_{X×Y}) is a metric space.
open Filter
theorem metricSpace_prod_sum_dist (X Y : Type*) [MetricSpace X] [MetricSpace Y] :
∃ m : MetricSpace (X × Y), m.dist = prodSumDist (X:=X) (Y:=Y)
Proposition 2.12: If f : ℝ × ℝ → ℝ is continuous at (x0, y0), then lim_{x→x0} limsup_{y→y0} f(x, y) = lim_{y→y0} limsup_{x→x0} f(x, y) = f(x0, y0) and lim_{x→x0} liminf_{y→y0} f(x, y) = lim_{y→y0} liminf_{x→x0} f(x, y) = f(x0, y0). In particular, if both iterated limits exist, then lim_{x→x0} lim_{y→y0} f(x, y) = lim_{y→y0} lim_{x→x0} f(x, y).
open Filter
theorem iterated_limsup_liminf_eq_of_continuousAt
(f : ℝ × ℝ → ℝ) (x0 y0 : ℝ) (hf : ContinuousAt f (x0, y0)) :
(Filter.Tendsto (fun x => Filter.limsup (fun y => f (x, y)) (nhds y0)) (nhds x0)
(nhds (f (x0, y0))) ∧
Filter.Tendsto (fun y => Filter.limsup (fun x => f (x, y)) (nhds x0)) (nhds y0)
(nhds (f (x0, y0)))) ∧
(Filter.Tendsto (fun x => Filter.liminf (fun y => f (x, y)) (nhds y0)) (nhds x0)
(nhds (f (x0, y0))) ∧
Filter.Tendsto (fun y => Filter.liminf (fun x => f (x, y)) (nhds x0)) (nhds y0)
(nhds (f (x0, y0)))) ∧
(∀ {L1 L2 : ℝ},
Filter.Tendsto (fun x => limUnder (nhds y0) (fun y => f (x, y))) (nhds x0) (nhds L1) →
Filter.Tendsto (fun y => limUnder (nhds x0) (fun x => f (x, y))) (nhds y0) (nhds L2) →
L1 = L2)
Proposition 2.13: A jointly continuous function f : ℝ × ℝ → ℝ is continuous in each variable separately; for each x, the map y ↦ f (x, y) is continuous, and for each y, the map x ↦ f (x, y) is continuous.
open Filter
theorem continuous_in_each_variable_of_continuous (f : ℝ × ℝ → ℝ)
(hf : Continuous f) :
(∀ x : ℝ, Continuous (fun y : ℝ => f (x, y))) ∧
(∀ y : ℝ, Continuous (fun x : ℝ => f (x, y)))
The function f(x,y) = xy / (x^2 + y^2) for (x,y) ≠ (0,0), and 0 at (0,0).
open Filter
noncomputable def separateContinuityExample : ℝ × ℝ → ℝ :=
fun p =>
if p = (0, 0) then 0 else (p.1 * p.2) / (p.1 ^ 2 + p.2 ^ 2)
Proposition 2.14: For the function f : ℝ × ℝ → ℝ defined by f(x,y) = xy / (x^2 + y^2) for (x,y) ≠ (0,0) and f(0,0) = 0, (i) for each fixed x, the map y ↦ f(x,y) is continuous on ℝ; (ii) for each fixed y, the map x ↦ f(x,y) is continuous on ℝ.
open Filter
theorem continuous_in_each_variable_separateContinuityExample :
(∀ x : ℝ, Continuous (fun y : ℝ => separateContinuityExample (x, y))) ∧
(∀ y : ℝ, Continuous (fun x : ℝ => separateContinuityExample (x, y)))
Helper for Theorem 2.4: continuity of constant multiplication at a point.
open Filter
lemma helperForTheorem_2_4_continuousAt_const_mul {X : Type*} [TopologicalSpace X]
(c : ℝ) {f : X → ℝ} {x0 : X} (hf : ContinuousAt f x0) :
ContinuousAt (fun x => c * f x) x0
Helper for Theorem 2.4: continuity of constant multiplication.
open Filter
lemma helperForTheorem_2_4_continuous_const_mul {X : Type*} [TopologicalSpace X]
(c : ℝ) {f : X → ℝ} (hf : Continuous f) :
Continuous (fun x => c * f x)
Helper for Theorem 2.4: continuity of division under a global nonvanishing.
open Filter
lemma helperForTheorem_2_4_continuousAt_div_of_forall_ne_zero {X : Type*}
[TopologicalSpace X] {f g : X → ℝ} {x0 : X} (hf : ContinuousAt f x0)
(hg : ContinuousAt g x0) (hgnz : ∀ x, g x ≠ 0) :
ContinuousAt (fun x => f x / g x) x0
Helper for Proposition 2.8: continuity of a single monomial term.
open Filter
lemma helperForProposition_2_8_continuous_monomial
(c0 : ℝ) (i j : ℕ) :
Continuous (fun p : ℝ × ℝ => c0 * (p.1 ^ i) * (p.2 ^ j))
Helper for Proposition 2.8: continuity of the finite double sum defining P.
open Filter
lemma helperForProposition_2_8_continuous_double_sum
(n m : ℕ) (c : ℕ → ℕ → ℝ) :
Continuous (fun p : ℝ × ℝ =>
Finset.sum (Finset.range (n + 1)) fun i =>
Finset.sum (Finset.range (m + 1)) fun j =>
c i j * (p.1 ^ i) * (p.2 ^ j))
Helper for Proposition 2.8: continuity after composing with a pair of continuous maps.
open Filter
lemma helperForProposition_2_8_continuous_comp
{X : Type*} [MetricSpace X] {P : ℝ × ℝ → ℝ}
(hP : Continuous P) {f g : X → ℝ} (hf : Continuous f) (hg : Continuous g) :
Continuous (fun x => P (f x, g x))
Helper for Proposition 2.9: continuity of the pairing map into a product.
open Filter
lemma helperForProposition_2_9_continuous_pairing {X Y Z : Type*}
[TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
(f : X → Y) (g : X → Z) (hf : Continuous f) (hg : Continuous g) :
Continuous (pairing f g)
Helper for Proposition 2.10: continuity of a monomial on ℝ^k.
open Filter
lemma helperForProposition_2_10_continuous_monomial (k : ℕ) (multi : Fin k → ℕ) :
Continuous (fun x : EuclideanSpace ℝ (Fin k) =>
Finset.prod Finset.univ (fun j => x j ^ (multi j)))
Helper for Proposition 2.10: continuity of a weighted monomial term.
open Filter
lemma helperForProposition_2_10_continuous_weighted_monomial (k : ℕ)
(I : Finset (Fin k → ℕ)) (c : {i // i ∈ I} → ℝ) (i : {i // i ∈ I}) :
Continuous (fun x : EuclideanSpace ℝ (Fin k) =>
c i * Finset.prod Finset.univ (fun j => x j ^ (i.1 j)))
Helper for Proposition 2.11: sum distance vanishes on identical points.
open Filter
lemma helperForProposition_2_11_prodSumDist_self (X Y : Type*)
[MetricSpace X] [MetricSpace Y] :
∀ p : X × Y, prodSumDist (X:=X) (Y:=Y) p p = 0
Helper for Proposition 2.11: sum distance is symmetric.
open Filter
lemma helperForProposition_2_11_prodSumDist_comm (X Y : Type*)
[MetricSpace X] [MetricSpace Y] :
∀ p q : X × Y,
prodSumDist (X:=X) (Y:=Y) p q = prodSumDist (X:=X) (Y:=Y) q p
Helper for Proposition 2.11: sum distance satisfies the triangle inequality.
open Filter
lemma helperForProposition_2_11_prodSumDist_triangle (X Y : Type*)
[MetricSpace X] [MetricSpace Y] :
∀ p q r : X × Y,
prodSumDist (X:=X) (Y:=Y) p r ≤
prodSumDist (X:=X) (Y:=Y) p q + prodSumDist (X:=X) (Y:=Y) q r
Helper for Proposition 2.11: zero sum distance implies equality.
open Filter
lemma helperForProposition_2_11_eq_of_prodSumDist_eq_zero (X Y : Type*)
[MetricSpace X] [MetricSpace Y] :
∀ {p q : X × Y},
prodSumDist (X:=X) (Y:=Y) p q = 0 → p = q
Helper for Proposition 2.12: extract a two-variable ε-band from continuity.
open Filter
lemma helperForProposition_2_12_eventually_Ioo_of_continuousAt
(f : ℝ × ℝ → ℝ) (x0 y0 : ℝ) (hf : ContinuousAt f (x0, y0)) :
∀ {ε : ℝ}, 0 < ε →
∀ᶠ x in nhds x0, ∀ᶠ y in nhds y0,
f (x, y) ∈ Set.Ioo (f (x0, y0) - ε) (f (x0, y0) + ε)
Helper for Proposition 2.12: outer limsup (inner y) tends to f (x0,y0).
open Filter
lemma helperForProposition_2_12_tendsto_outer_limsup_inner_nhds
(f : ℝ × ℝ → ℝ) (x0 y0 : ℝ) (hf : ContinuousAt f (x0, y0)) :
Filter.Tendsto (fun x => Filter.limsup (fun y => f (x, y)) (nhds y0)) (nhds x0)
(nhds (f (x0, y0)))
Helper for Proposition 2.12: outer liminf (inner y) tends to f (x0,y0).
open Filter
lemma helperForProposition_2_12_tendsto_outer_liminf_inner_nhds
(f : ℝ × ℝ → ℝ) (x0 y0 : ℝ) (hf : ContinuousAt f (x0, y0)) :
Filter.Tendsto (fun x => Filter.liminf (fun y => f (x, y)) (nhds y0)) (nhds x0)
(nhds (f (x0, y0)))
Helper for Proposition 2.12: a nhds-limit forces the point value in a T1 space.
open Filter
lemma helperForProposition_2_12_tendsto_nhds_forces_value_at_point
{X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [T1Space Y]
{x0 : X} {g : X → Y} {a : Y} (h : Filter.Tendsto g (nhds x0) (nhds a)) :
g x0 = a
Helper for Proposition 2.12: identify section limits at the point.
open Filter
lemma helperForProposition_2_12_limUnder_section_at_point_eq
(f : ℝ × ℝ → ℝ) (x0 y0 : ℝ) (hf : ContinuousAt f (x0, y0)) :
limUnder (nhds y0) (fun y => f (x0, y)) = f (x0, y0) ∧
limUnder (nhds x0) (fun x => f (x, y0)) = f (x0, y0)
Helper for Proposition 2.14: nonvanishing of x^2 + y^2 when x ≠ 0.
open Filter
lemma helperForProposition_2_14_denominator_ne_zero_of_left_ne_zero {x : ℝ} (hx : x ≠ 0) :
∀ y : ℝ, x ^ 2 + y ^ 2 ≠ 0
Helper for Proposition 2.14: nonvanishing of x^2 + y^2 when y ≠ 0.
open Filter
lemma helperForProposition_2_14_denominator_ne_zero_of_right_ne_zero {y : ℝ} (hy : y ≠ 0) :
∀ x : ℝ, x ^ 2 + y ^ 2 ≠ 0
Helper for Proposition 2.14: continuity of the rational expression with fixed nonzero x.
open Filter
lemma helperForProposition_2_14_continuous_rational_fix_left {x : ℝ} (hx : x ≠ 0) :
Continuous (fun y : ℝ => (x * y) / (x ^ 2 + y ^ 2))
Helper for Proposition 2.14: continuity of the rational expression with fixed nonzero y.
open Filter
lemma helperForProposition_2_14_continuous_rational_fix_right {y : ℝ} (hy : y ≠ 0) :
Continuous (fun x : ℝ => (x * y) / (x ^ 2 + y ^ 2))
Helper for Proposition 2.14: simplify the y-section when x ≠ 0.
open Filter
lemma helperForProposition_2_14_simp_section_of_left_ne_zero {x : ℝ} (hx : x ≠ 0) :
(fun y : ℝ => separateContinuityExample (x, y)) =
(fun y : ℝ => (x * y) / (x ^ 2 + y ^ 2))
Helper for Proposition 2.14: simplify the x-section when y ≠ 0.
open Filter
lemma helperForProposition_2_14_simp_section_of_right_ne_zero {y : ℝ} (hy : y ≠ 0) :
(fun x : ℝ => separateContinuityExample (x, y)) =
(fun x : ℝ => (x * y) / (x ^ 2 + y ^ 2))
Helper for Proposition 2.14: the y-section at x = 0 is identically zero.
open Filter
lemma helperForProposition_2_14_section_left_zero :
(fun y : ℝ => separateContinuityExample (0, y)) = (fun _ => (0 : ℝ))
Helper for Proposition 2.14: the x-section at y = 0 is identically zero.
open Filter
lemma helperForProposition_2_14_section_right_zero :
(fun x : ℝ => separateContinuityExample (x, 0)) = (fun _ => (0 : ℝ))2.3 — Continuity and Compactness
Lean contributors (project-level attribution): Chenyi Li, Min Cui, Qiming Dai, Shu Miao, Wanli Ma, Yi Yuan, Zichen Wang, Ziyu Wang.
Theorem 2.5: [Continuous maps preserve compactness] If f : X → Y is continuous between metric spaces and K ⊆ X is compact, then the image f '' K is compact.
theorem continuous_maps_preserve_compactness {X Y : Type*} [MetricSpace X] [MetricSpace Y]
{f : X → Y} (hf : Continuous f) {K : Set X} (hK : IsCompact K) :
IsCompact (f '' K)
Proposition 2.15: [Maximum principle] Let (X, d) be a compact metric space and f : X → ℝ continuous. (i) The function f is bounded on X. (ii) If X ≠ ∅, then there exist x_max, x_min : X such that f x_max is a maximum and f x_min is a minimum of f on X.
theorem maximum_principle {X : Type*} [MetricSpace X] [CompactSpace X] {f : X → ℝ}
(hf : Continuous f) :
(∃ M : ℝ, ∀ x : X, |f x| ≤ M) ∧
(Nonempty X → ∃ x_max x_min : X, (∀ x : X, f x ≤ f x_max) ∧
(∀ x : X, f x_min ≤ f x))
Definition 2.6: [Uniform continuity] Let (X, d_X) and (Y, d_Y) be metric spaces and f : X → Y. The function f is uniformly continuous on X if for every ε > 0 there exists δ > 0 such that for all x, x' ∈ X, d_X x x' < δ → d_Y (f x) (f x') < ε.
abbrev IsUniformlyContinuous {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) : Prop :=
UniformContinuous f
The predicate IsUniformlyContinuous coincides with mathlib's UniformContinuous.
lemma isUniformlyContinuous_iff_uniformContinuous {X Y : Type*} [MetricSpace X] [MetricSpace Y]
(f : X → Y) : IsUniformlyContinuous f ↔ UniformContinuous f
Theorem 2.7: Let (X, d_X) and (Y, d_Y) be metric spaces and assume X is compact. For a function f : X → Y, f is continuous on X if and only if f is uniformly continuous on X.
theorem continuous_iff_uniformlyContinuous_of_compact {X Y : Type*} [MetricSpace X]
[MetricSpace Y] [CompactSpace X] {f : X → Y} :
Continuous f ↔ IsUniformlyContinuous f
Proposition 2.16: If f : X → Y and g : Y → Z are uniformly continuous between metric spaces, then g ∘ f : X → Z is uniformly continuous.
theorem uniformlyContinuous_comp {X Y Z : Type*} [MetricSpace X] [MetricSpace Y] [MetricSpace Z]
{f : X → Y} {g : Y → Z} (hf : IsUniformlyContinuous f)
(hg : IsUniformlyContinuous g) : IsUniformlyContinuous (g ∘ f)
Proposition 2.17: Let (X, d_X) be a metric space, and let f, g : X → ℝ be uniformly continuous. Equip ℝ² with the standard metric d((a, b), (c, d)) = √((a - c)^2 + (b - d)^2). Define (f, g) : X → ℝ² by (f, g)(x) = (f x, g x). Then (f, g) is uniformly continuous.
theorem uniformlyContinuous_pair {X : Type*} [MetricSpace X] {f g : X → ℝ}
(hf : IsUniformlyContinuous f) (hg : IsUniformlyContinuous g) :
IsUniformlyContinuous
(fun x : X => !₂[f x, g x] : X → EuclideanSpace ℝ (Fin 2))
The map a(x,y)=x+y on ℝ², viewed as EuclideanSpace ℝ (Fin 2).
def coordAdd : EuclideanSpace ℝ (Fin 2) → ℝ := fun p => p 0 + p 1
The map s(x,y)=x-y on ℝ², viewed as EuclideanSpace ℝ (Fin 2).
def coordSub : EuclideanSpace ℝ (Fin 2) → ℝ := fun p => p 0 - p 1
The map m(x,y)=x*y on ℝ², viewed as EuclideanSpace ℝ (Fin 2).
def coordMul : EuclideanSpace ℝ (Fin 2) → ℝ := fun p => p 0 * p 1
Proposition 2.18: On ℝ² with the Euclidean metric and ℝ with the usual metric, the maps a(x,y)=x+y and s(x,y)=x-y are uniformly continuous, whereas m(x,y)=x*y is not uniformly continuous.
lemma uniformlyContinuous_add_sub_not_mul :
IsUniformlyContinuous coordAdd ∧ IsUniformlyContinuous coordSub ∧
¬ IsUniformlyContinuous coordMul
Proposition 2.19: Let (X, d) be a metric space and let f, g : X → ℝ be uniformly continuous. Then the functions f + g and f - g are uniformly continuous on X.
theorem uniformlyContinuous_add_sub {X : Type*} [MetricSpace X] {f g : X → ℝ}
(hf : IsUniformlyContinuous f) (hg : IsUniformlyContinuous g) :
IsUniformlyContinuous (f + g) ∧ IsUniformlyContinuous (f - g)
Helper for Proposition 2.15: a continuous real-valued function on a compact metric space is bounded in absolute value.
lemma helperForProposition_2_15_abs_bound {X : Type*} [MetricSpace X] [CompactSpace X]
{f : X → ℝ} (hf : Continuous f) : ∃ M : ℝ, ∀ x : X, |f x| ≤ M
Helper for Proposition 2.15: existence of points attaining the maximum and minimum on a compact metric space.
lemma helperForProposition_2_15_exists_argmax_argmin {X : Type*} [MetricSpace X]
[CompactSpace X] {f : X → ℝ} (hf : Continuous f) (hne : Nonempty X) :
∃ x_max x_min : X, (∀ x : X, f x ≤ f x_max) ∧ (∀ x : X, f x_min ≤ f x)
Helper for Proposition 2.17: Euclidean distance in ℝ² is bounded by the sum of coordinate distances.
lemma helperForProposition_2_17_dist_finTwo_pair_le_add (a b c d : ℝ) :
dist (!₂[a,b] : EuclideanSpace ℝ (Fin 2)) !₂[c,d] ≤ dist a c + dist b d
Helper for Proposition 2.17: coordinate-wise bound for paired maps.
lemma helperForProposition_2_17_dist_pair_le_add_coords {X : Type*} [MetricSpace X]
{f g : X → ℝ} (x y : X) :
dist (!₂[f x, g x] : EuclideanSpace ℝ (Fin 2)) !₂[f y, g y]
≤ dist (f x) (f y) + dist (g x) (g y)
Helper for Proposition 2.18: each coordinate distance is bounded by the Euclidean distance.
lemma helperForProposition_2_18_dist_coord0_coord1_le_dist
(p q : EuclideanSpace ℝ (Fin 2)) :
dist (p 0) (q 0) ≤ dist p q ∧ dist (p 1) (q 1) ≤ dist p q
Helper for Proposition 2.18: uniform continuity of coordAdd.
lemma helperForProposition_2_18_uniformlyContinuous_coordAdd :
IsUniformlyContinuous coordAdd
Helper for Proposition 2.18: uniform continuity of coordSub.
lemma helperForProposition_2_18_uniformlyContinuous_coordSub :
IsUniformlyContinuous coordSub
Helper for Proposition 2.18: coordMul fails uniform continuity on ℝ².
lemma helperForProposition_2_18_not_uniformlyContinuous_coordMul :
¬ IsUniformlyContinuous coordMul2.4 — Continuity and Connectedness
Lean contributors (project-level attribution): Chenyi Li, Min Cui, Qiming Dai, Shu Miao, Wanli Ma, Yi Yuan, Zichen Wang, Ziyu Wang.
A metric space is disconnected if it admits disjoint nonempty open subsets whose union is the whole space.
def IsDisconnectedMetricSpace (X : Type*) [MetricSpace X] : Prop :=
∃ V W : Set X, IsOpen V ∧ IsOpen W ∧ V.Nonempty ∧ W.Nonempty ∧ Disjoint V W ∧
V ∪ W = Set.univ
Definition 2.7: [Connected and disconnected metric spaces] Let (X, d) be a metric space. We say that X is disconnected iff there exist disjoint non-empty open sets V and W in X such that V ∪ W = X (equivalently, X contains a non-empty proper subset that is both closed and open). We say that X is connected iff it is non-empty and not disconnected; the empty set is declared neither connected nor disconnected.
def TaoIsConnectedMetricSpace (X : Type*) [MetricSpace X] : Prop :=
Nonempty X ∧ ¬ IsDisconnectedMetricSpace X
Definition 2.8: [Connected sets] Let (X, d) be a metric space and let Y ⊆ X. Equip Y with the subspace metric. The subset Y is called connected if (Y, d_Y) is connected; it is called disconnected if (Y, d_Y) is disconnected.
def TaoIsConnectedSubset (X : Type*) [MetricSpace X] (Y : Set X) : Prop :=
TaoIsConnectedMetricSpace (Subtype Y)
A subset is disconnected when its subtype with the subspace metric is a disconnected metric space.
def IsDisconnectedSubset (X : Type*) [MetricSpace X] (Y : Set X) : Prop :=
IsDisconnectedMetricSpace (Subtype Y)
Theorem 2.8: Let X be a nonempty subset of the real line. Then the following statements are equivalent: (a) X is connected; (b) whenever x, y ∈ X and x < y, the interval [x, y] is contained in X; (c) X is an interval.
theorem connected_subset_real_tfae (X : Set Real) (hX : X.Nonempty) :
List.TFAE
[TaoIsConnectedSubset Real X,
∀ ⦃x y : Real⦄, x ∈ X → y ∈ X → x < y → Set.Icc x y ⊆ X,
Set.OrdConnected X]
Definition 2.9: Let (X, d) be a metric space and let E ⊆ X. The set E is path-connected iff for every x, y ∈ E there exists a continuous function γ : [0, 1] → E with γ(0) = x and γ(1) = y.
def IsPathConnectedSubset (X : Type*) [MetricSpace X] (E : Set X) : Prop :=
IsPathConnected E
Theorem 2.9: [Continuity preserves connectedness] Let f : X → Y be continuous between metric spaces. If E is a connected subset of X, then f(E) is a connected subset of Y.
theorem continuous_image_connected_subset {X Y : Type*} [MetricSpace X] [MetricSpace Y]
{f : X → Y} (hf : Continuous f) {E : Set X} (hE : TaoIsConnectedSubset X E) :
TaoIsConnectedSubset Y (f '' E)
Theorem 2.10: [Intermediate value theorem] Let (X, d_X) be a metric space, let f : X → ℝ be continuous, and let E ⊆ X be connected. For any a, b ∈ E and any y ∈ ℝ satisfying either f(a) ≤ y ≤ f(b) or f(a) ≥ y ≥ f(b), there exists c ∈ E such that f(c) = y.
theorem intermediate_value_connected_subset {X : Type*} [MetricSpace X] {f : X → ℝ}
(hf : Continuous f) {E : Set X} (hE : TaoIsConnectedSubset X E) {a b : X} (ha : a ∈ E)
(hb : b ∈ E) {y : ℝ} (hy : f a ≤ y ∧ y ≤ f b ∨ f b ≤ y ∧ y ≤ f a) :
∃ c ∈ E, f c = y
Theorem 2.11: in the discrete metric, any subset with at least two distinct points is disconnected (for the subspace topology).
theorem discreteMetric_disconnectedSubset_of_two_points {X : Type*} [MetricSpace X]
(hdisc : ∀ x y : X, dist x y = discreteMetric (X := X) x y) {E : Set X}
(hE : ∃ x ∈ E, ∃ y ∈ E, x ≠ y) :
IsDisconnectedSubset X E
Theorem 2.12: Let (X, d) be a connected metric space and let (Y, d_disc) be a metric space equipped with the discrete metric d_disc(y1,y2)=0 if y1=y2 and d_disc(y1,y2)=1 otherwise. For a function f : X → Y, the following are equivalent: (1) f is continuous; (2) f is constant.
theorem continuous_iff_constant_of_connected_discrete {X Y : Type*} [MetricSpace X] [MetricSpace Y]
(hX : TaoIsConnectedMetricSpace X)
(hdisc : ∀ y1 y2 : Y, dist y1 y2 = discreteMetric (X := Y) y1 y2) (f : X → Y) :
Continuous f ↔ ∀ x1 x2 : X, f x1 = f x2
Proposition 2.20: every non-empty path-connected set in a metric space is connected.
theorem connected_subset_of_nonempty_path_connected {X : Type*} [MetricSpace X] {E : Set X}
(hE_nonempty : E.Nonempty) (hE_path : IsPathConnectedSubset X E) :
TaoIsConnectedSubset X E
Theorem 2.13: Let (X, d) be a metric space and let E ⊆ X be nonempty. If E is path-connected, then the closure closure E of E is connected.
theorem connected_closure_of_path_connected_subset {X : Type*} [MetricSpace X] {E : Set X}
(hE_nonempty : E.Nonempty) (hE_path : IsPathConnectedSubset X E) :
TaoIsConnectedSubset X (closure E)
Proposition 2.21: Let (X, d) be a metric space and let E ⊆ X be connected. Then the closure closure E is connected.
theorem connected_closure_of_connected_subset {X : Type*} [MetricSpace X] {E : Set X}
(hE : TaoIsConnectedSubset X E) : TaoIsConnectedSubset X (closure E)
Relation on a metric space given by membership in a common connected subset.
def ConnectedInSubset (X : Type*) [MetricSpace X] (x y : X) : Prop :=
∃ C : Set X, TaoIsConnectedSubset X C ∧ x ∈ C ∧ y ∈ C
The equivalence class of a point under ConnectedInSubset.
def ConnectedInSubsetClass (X : Type*) [MetricSpace X] (x : X) : Set X :=
{y : X | ConnectedInSubset X x y}
Proposition 2.22: Let (X, d) be a metric space. Define x ∼ y iff there exists a connected subset C ⊆ X with x ∈ C and y ∈ C. Then ∼ is an equivalence relation on X. Moreover, for each x ∈ X, the equivalence class [x] = {y ∈ X : y ∼ x} is connected and closed in X.
theorem connectedInSubset_equivalence_and_class_connected_closed (X : Type*) [MetricSpace X] :
Equivalence (ConnectedInSubset X) ∧
∀ x : X, TaoIsConnectedSubset X (ConnectedInSubsetClass X x) ∧
IsClosed (ConnectedInSubsetClass X x)
Helper for Theorem 2.8: characterize disconnectedness via preconnectedness of the universe.
lemma helperForTheorem_2_8_isDisconnectedMetricSpace_iff_not_isPreconnected_univ
(Y : Type*) [MetricSpace Y] :
IsDisconnectedMetricSpace Y ↔ ¬ IsPreconnected (Set.univ : Set Y)
Helper for Theorem 2.8: connectedness of a metric space via connectedness of the universal set.
lemma helperForTheorem_2_8_isConnectedMetricSpace_iff_isConnected_univ
(Y : Type*) [MetricSpace Y] :
TaoIsConnectedMetricSpace Y ↔ IsConnected (Set.univ : Set Y)
Helper for Theorem 2.8: connectedness of a subset of Real via IsConnected of the set.
lemma helperForTheorem_2_8_isConnectedSubset_real_iff_isConnected (X : Set Real) :
TaoIsConnectedSubset Real X ↔ IsConnected X
Helper for Theorem 2.8: on Real, connectedness of a nonempty set is equivalent to order-connectedness.
lemma helperForTheorem_2_8_isConnected_iff_ordConnected_of_nonempty
{X : Set Real} (hX : X.Nonempty) : IsConnected X ↔ Set.OrdConnected X
Helper for Theorem 2.8: the strict-interval property characterizes order-connectedness.
lemma helperForTheorem_2_8_intervalProperty_lt_iff_ordConnected (X : Set Real) :
( (∀ ⦃x y : Real⦄, x ∈ X → y ∈ X → x < y → Set.Icc x y ⊆ X) ↔
Set.OrdConnected X )
Helper for Theorem 2.9: TaoIsConnectedSubset is equivalent to IsConnected.
lemma helperForTheorem_2_9_isConnectedSubset_iff_isConnected (X : Type*) [MetricSpace X]
(E : Set X) : TaoIsConnectedSubset X E ↔ IsConnected E
Helper for Theorem 2.9: continuous images preserve connectedness of sets.
lemma helperForTheorem_2_9_isConnected_image_of_continuous {X Y : Type*} [MetricSpace X]
[MetricSpace Y] {f : X → Y} (hf : Continuous f) {E : Set X} (hE : IsConnected E) :
IsConnected (f '' E)
Helper for Theorem 2.11: in a discrete subspace, points within distance < 1/2 coincide.
lemma helperForTheorem_2_11_subtype_eq_of_dist_lt_one_half {X : Type*} [MetricSpace X]
(hdisc : ∀ x y : X, dist x y = discreteMetric (X := X) x y) {E : Set X}
{x y : Subtype E} (hxy : dist x y < (1 / 2 : ℝ)) : x = y
Helper for Theorem 2.11: singleton subsets of a discrete subspace are open.
lemma helperForTheorem_2_11_isOpen_singleton_subtype {X : Type*} [MetricSpace X]
(hdisc : ∀ x y : X, dist x y = discreteMetric (X := X) x y) {E : Set X}
(x : Subtype E) : IsOpen ({x} : Set (Subtype E))
Helper for Proposition 2.22: ConnectedInSubset matches membership in the connected component.
lemma helperForProposition_2_22_connectedInSubset_iff_mem_connectedComponent
{X : Type*} [MetricSpace X] {x y : X} :
ConnectedInSubset X x y ↔ y ∈ connectedComponent x
Helper for Proposition 2.22: the equivalence class equals the connected component.
lemma helperForProposition_2_22_class_eq_connectedComponent
{X : Type*} [MetricSpace X] (x : X) :
ConnectedInSubsetClass X x = connectedComponent x
Helper for Proposition 2.22: ConnectedInSubset is an equivalence relation.
lemma helperForProposition_2_22_equivalence_connectedInSubset
{X : Type*} [MetricSpace X] :
Equivalence (ConnectedInSubset X)2.5 — Topological Spaces
Lean contributors (project-level attribution): Chenyi Li, Min Cui, Qiming Dai, Shu Miao, Wanli Ma, Yi Yuan, Zichen Wang, Ziyu Wang.
Definition 2.12: A topological space is a pair (X, O) consisting of a set X and a collection O subset 2^X such that (1) the empty set and X are in O, (2) finite intersections of members of O are in O, and (3) arbitrary unions of members of O are in O; the members of O are called open sets and O is called a topology on X. In Lean we bundle this as a type equipped with a TopologicalSpace structure.
universe u
abbrev TopologicalSpacePair : Type (u + 1) :=
Σ X : Type u, TopologicalSpace X
Definition 2.13: A set U ⊆ X is a neighborhood of x in a topological space if U is open and x ∈ U.
universe u
def IsNeighborhood {X : Type u} [TopologicalSpace X] (x : X) (U : Set X) : Prop :=
IsOpen U ∧ x ∈ U
Definition 2.14: [Topological convergence] Let (X, 𝓕) be a topological space, let m ∈ ℤ, and let (x^{(n)})_{n=m}^{∞} be a sequence in X. For x ∈ X, the sequence converges to x iff for every neighborhood V of x there exists an integer N ≥ m such that x^{(n)} ∈ V for all integers n ≥ N.
universe u
def TopologicalConvergesFrom {X : Type u} [TopologicalSpace X] (m : ℤ) (xseq : ℤ → X) (x : X) :
Prop :=
∀ V : Set X, IsNeighborhood x V → ∃ N ≥ m, ∀ n ≥ N, xseq n ∈ V
Definition 2.15: [Interior point, exterior point, boundary point] Let (X, 𝓕) be a topological space, let E ⊆ X, and let x0 ∈ X. (1) x0 is an interior point of E iff there exists a neighborhood V of x0 with V ⊆ E. (2) x0 is an exterior point of E iff there exists a neighborhood V of x0 with V ∩ E = ∅. (3) x0 is a boundary point of E iff it is neither interior nor exterior; equivalently, for every neighborhood V of x0, both V ∩ E ≠ ∅ and V ∩ (X \ E) ≠ ∅.
universe u
def IsInteriorPointTopological {X : Type u} [TopologicalSpace X] (E : Set X) (x0 : X) : Prop :=
∃ V : Set X, IsNeighborhood x0 V ∧ V ⊆ E
A point is an exterior point of E if some neighborhood of it misses E.
universe u
def IsExteriorPointTopological {X : Type u} [TopologicalSpace X] (E : Set X) (x0 : X) : Prop :=
∃ V : Set X, IsNeighborhood x0 V ∧ V ∩ E = ∅
A point is a boundary point of E if it is neither interior nor exterior.
universe u
def IsBoundaryPointTopological {X : Type u} [TopologicalSpace X] (E : Set X) (x0 : X) : Prop :=
¬ IsInteriorPointTopological E x0 ∧ ¬ IsExteriorPointTopological E x0
A point is adherent to E if every neighborhood containing an open neighborhood of it meets E.
universe u
def IsAdherentPointTopological {X : Type u} [TopologicalSpace X] (E : Set X) (x0 : X) : Prop :=
∀ V : Set X, (∃ U : Set X, IsNeighborhood x0 U ∧ U ⊆ V) → (V ∩ E).Nonempty
Definition 2.16 (Closure point): Let (X, 𝓕) be a topological space and E ⊆ X. (1) A point x0 ∈ X is an adherent point of E iff for every neighborhood V of x0 (i.e., V contains an open set containing x0), one has V ∩ E ≠ ∅. (2) The closure \overline{E} is the set of all adherent points of E: \overline{E} = {x ∈ X : for every neighborhood V of x, V ∩ E ≠ ∅}.
universe u
def closureSetTopological {X : Type u} [TopologicalSpace X] (E : Set X) : Set X :=
{x | IsAdherentPointTopological E x}
Definition 2.17: Let (X, 𝓕) be a topological space and K ⊆ X. The set K is closed iff its complement X \ K is open (i.e. X \ K ∈ 𝓕).
universe u
abbrev IsClosedTopological {X : Type u} [TopologicalSpace X] (K : Set X) : Prop :=
IsClosed K
Definition 2.18: [Relative topology] Let (X, 𝓕) be a topological space and Y ⊆ X. Define 𝓕_Y := {V ∩ Y : V ∈ 𝓕}; this collection is the relative (subspace) topology on Y, and the pair (Y, 𝓕_Y) is a topological subspace of (X, 𝓕).
universe u
def relativeTopology {X : Type u} [TopologicalSpace X] (Y : Set X) : Set (Set X) :=
{U : Set X | ∃ V : Set X, IsOpen V ∧ U = V ∩ Y}
Definition 2.19: (Continuous functions) Let (X, 𝓕_X) and (Y, 𝓕_Y) be topological spaces and let f : X → Y. For x0 ∈ X, the function f is continuous at x0 iff for every neighborhood V of f x0 there exists a neighborhood U of x0 such that f '' U ⊆ V. The function f is continuous iff it is continuous at every point x ∈ X.
universe u
def IsContinuousAtTopological {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y]
(f : X → Y) (x0 : X) : Prop :=
∀ V : Set Y, IsNeighborhood (f x0) V → ∃ U : Set X, IsNeighborhood x0 U ∧ f '' U ⊆ V
A function is continuous if it is continuous at every point.
universe u
def IsContinuousTopological {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y]
(f : X → Y) : Prop :=
∀ x : X, IsContinuousAtTopological f x
Definition 2.20: (1) A topological space is compact if every open cover has a finite subcover. (2) A subset Y ⊆ X is compact if the subspace topology on Y is compact; in Lean we use IsCompact Y, and the space is compact iff IsCompact (Set.univ : Set X).
universe u
abbrev IsCompactTopological {X : Type u} [TopologicalSpace X] (Y : Set X) : Prop :=
IsCompact Y
A topological space is compact if its underlying set is compact.
universe u
abbrev IsCompactSpaceTopological {X : Type u} [TopologicalSpace X] : Prop :=
IsCompactTopological (Set.univ : Set X)
Definition 2.22 (Hausdorff topological space): A topological space is Hausdorff if for any distinct points x, y there exist neighborhoods V of x and W of y with V ∩ W = ∅.
universe u
abbrev IsHausdorffTopological (X : Type u) [TopologicalSpace X] : Prop :=
T2Space X
Definition 2.23: [Order topology] Let (X, ≤) be a totally ordered set. A set V ⊆ X is open if for every x ∈ V there exists a set I with x ∈ I ⊆ V, where I is an interval {y : X | a < y ∧ y < b}, a ray {y : X | a < y} or {y : X | y < b}, or the whole space X; the collection of such open sets defines the order topology on X.
universe u
abbrev orderTopology (X : Type u) [LinearOrder X] : TopologicalSpace X :=
Preorder.topology X
Definition 2.24 (Cofinite topology): Let X be a set and define 𝓕 := {E ⊆ X | E = ∅ or X \ E is finite}. The pair (X, 𝓕) is called the cofinite topology on X. In Lean this is the TopologicalSpace structure induced by the CofiniteTopology type synonym.
universe u
abbrev cofiniteTopology (X : Type u) : TopologicalSpace X :=
TopologicalSpace.cofinite
A set is cocountable-open if it is empty or its complement is countable.
universe u
def IsCocountableOpen (X : Type u) (E : Set X) : Prop :=
E = ∅ ∨ (Set.univ \ E).Countable
The whole space is cocountable-open.
universe u
lemma cocountable_isOpen_univ (X : Type u) : IsCocountableOpen X (Set.univ : Set X)
Intersections of cocountable-open sets are cocountable-open.
universe u
lemma cocountable_isOpen_inter (X : Type u) (s t : Set X) :
IsCocountableOpen X s → IsCocountableOpen X t → IsCocountableOpen X (s ∩ t)
Arbitrary unions of cocountable-open sets are cocountable-open.
universe u
lemma cocountable_isOpen_sUnion (X : Type u) (S : Set (Set X)) :
(∀ t ∈ S, IsCocountableOpen X t) → IsCocountableOpen X (⋃₀ S)
Definition 2.25 (Cocountable topology): Let X be a set. Define 𝓕 := {E ⊆ X | E = ∅ or X \ E is at most countable}. The pair (X, 𝓕) is called the cocountable topology on X.
universe u
@[reducible] def cocountableTopology (X : Type u) : TopologicalSpace X :=
{ IsOpen := IsCocountableOpen X
isOpen_univ := cocountable_isOpen_univ X
isOpen_inter := cocountable_isOpen_inter X
isOpen_sUnion := cocountable_isOpen_sUnion X }
Proposition 2.23: In a metric space, the open ball Metric.ball x r with r > 0 is a neighborhood of x.
universe u
theorem metric_ball_isNeighborhood {X : Type u} [MetricSpace X] (x : X) {r : ℝ} (hr : 0 < r) :
IsNeighborhood x (Metric.ball x r)
Proposition 2.24: Let (x_n) be a sequence in ℝ, viewed in the extended real line EReal. Then x_n → +∞ iff liminf_{n→∞} x_n = +∞. Similarly, x_n → -∞ iff limsup_{n→∞} x_n = -∞.
universe u
theorem tendsto_ereal_top_iff_liminf_eq_top_and_tendsto_ereal_bot_iff_limsup_eq_bot
(x : ℕ → ℝ) :
(Filter.Tendsto (fun n => (x n : EReal)) Filter.atTop (nhds (⊤ : EReal)) ↔
Filter.liminf (fun n => (x n : EReal)) Filter.atTop = (⊤ : EReal)) ∧
(Filter.Tendsto (fun n => (x n : EReal)) Filter.atTop (nhds (⊥ : EReal)) ↔
Filter.limsup (fun n => (x n : EReal)) Filter.atTop = (⊥ : EReal))
Proposition 2.25: Let X be a set and define 𝓕 := {∅, X}. Then (X, 𝓕) is a topology on X, i.e. there is a topological structure whose open sets are exactly ∅ and Set.univ.
universe u
theorem exists_topology_only_empty_univ (X : Type u) :
∃ T : TopologicalSpace X, ∀ U : Set X, @IsOpen X T U ↔ U = ∅ ∨ U = Set.univ
Definition 2.26: [First countable topological space] A topological space (X, F) is first countable if for every x in X there exists a countable collection of neighborhoods V_1, V_2, ... of x such that every neighborhood of x contains at least one V_n. In Lean this is the predicate FirstCountableTopology.
universe u
abbrev IsFirstCountableTopological (X : Type u) [TopologicalSpace X] : Prop :=
FirstCountableTopology X