Chapter 03 — Continuous Functions
Proofs omitted. Hover over highlighted terms to see their Lean types.
Reading sections
3.1 — Limits of Functions
Lean authors: Zichen Wang, Zaiwen Wen.
Definition 3.1.1: For a set S ⊆ ℝ, a real number x is a cluster point of S if for every ε > 0 the punctured neighborhood (x - ε, x + ε) ∩ S \ {x} is nonempty.
open Filter Topology
def IsClusterPoint (S : Set ℝ) (x : ℝ) : Prop :=
∀ ⦃ε : ℝ⦄, 0 < ε →
((Set.Ioo (x - ε) (x + ε) ∩ S) \ {x}).Nonempty
Mathlib expresses cluster points via closure of punctured sets.
open Filter Topology
lemma isClusterPoint_iff_mem_closure_diff (S : Set ℝ) (x : ℝ) :
IsClusterPoint S x ↔ x ∈ closure (S \ {x})
Proposition 3.1.2: A real number x is a cluster point of S ⊆ ℝ iff there exists a sequence (xₙ) with each xₙ ∈ S, xₙ ≠ x, and xₙ → x.
open Filter Topology
lemma isClusterPoint_iff_exists_seq_tendsto (S : Set ℝ) (x : ℝ) :
IsClusterPoint S x ↔
∃ u : ℕ → ℝ,
(∀ n, u n ∈ S ∧ u n ≠ x) ∧ Tendsto u atTop (𝓝 x)
Definition 3.1.3: A function f : ℝ → ℝ converges to L as x approaches c within a set S if c is a cluster point of S and for every ε > 0 there is δ > 0 such that for all x ∈ S with x ≠ c and |x - c| < δ we have |f x - L| < ε.
open Filter Topology
def LimitWithin (S : Set ℝ) (f : ℝ → ℝ) (c L : ℝ) : Prop :=
IsClusterPoint S c ∧
∀ ⦃ε : ℝ⦄, 0 < ε →
∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ S → x ≠ c → |x - c| < δ → |f x - L| < ε
Given a cluster point and a radius, we can find a point of the set that lies within that radius yet differs from the center.
open Filter Topology
lemma exists_mem_near_cluster {S : Set ℝ} {c δ : ℝ}
(hc : IsClusterPoint S c) (hδ : 0 < δ) :
∃ x ∈ S, x ≠ c ∧ |x - c| < δ
A quantitative triangle inequality specialized to halving an epsilon.
open Filter Topology
lemma abs_sub_lt_of_add {a b c ε : ℝ} (h₁ : |a - b| < ε / 2)
(h₂ : |b - c| < ε / 2) : |a - c| < ε
Membership in S \ {c} means membership in S and inequality to c.
open Filter Topology
lemma mem_diff_singleton_iff {S : Set ℝ} {x c : ℝ} :
x ∈ S \ {c} ↔ x ∈ S ∧ x ≠ c
Convert LimitWithin to a Tendsto statement on S \ {c}.
open Filter Topology
lemma limitWithin_to_tendsto {S : Set ℝ} {f : ℝ → ℝ} {c L : ℝ} :
LimitWithin S f c L → Tendsto f (𝓝[S \ {c}] c) (𝓝 L)
Repackage a Tendsto statement on S \ {c} into eps-delta form.
open Filter Topology
lemma tendsto_to_limitWithin_epsdelta {S : Set ℝ} {f : ℝ → ℝ} {c L : ℝ} :
Tendsto f (𝓝[S \ {c}] c) (𝓝 L) →
∀ ⦃ε : ℝ⦄, 0 < ε →
∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ S → x ≠ c → |x - c| < δ → |f x - L| < ε
Mathlib expresses this limit as a Tendsto statement toward the nhdsWithin filter that omits the point c.
open Filter Topology
lemma limitWithin_iff_tendsto (S : Set ℝ) (f : ℝ → ℝ) (c L : ℝ) :
LimitWithin S f c L ↔ IsClusterPoint S c ∧ Tendsto f (𝓝[S \ {c}] c) (𝓝 L)
Proposition 3.1.4: If c is a cluster point of S ⊆ ℝ and a function f : ℝ → ℝ converges to some real number as x approaches c within S, then that limit value is unique.
open Filter Topology
lemma limitWithin_unique (S : Set ℝ) (f : ℝ → ℝ) (c L₁ L₂ : ℝ)
(h₁ : LimitWithin S f c L₁) (h₂ : LimitWithin S f c L₂) : L₁ = L₂
Bounding |x| when x lies within 1 of c.
open Filter Topology
lemma abs_le_of_abs_sub_lt_one {x c : ℝ} (h : |x - c| < 1) : |x| ≤ |c| + 1
Bounding |x^2 - c^2| by |x - c| when x is within 1 of c.
open Filter Topology
lemma abs_sq_sub_bound {x c : ℝ} (h : |x - c| < 1) :
Example 3.1.5: For the function f x = x^2 and any real c, the limit as x → c is c^2.
open Filter Topology
lemma tendsto_sq (c : ℝ) : Tendsto (fun x : ℝ => x ^ 2) (𝓝 c) (𝓝 (c ^ 2))
Example 3.1.6: The piecewise function on [0, 1) given by f x = x for x > 0 and f 0 = 1 satisfies f ⟶ 0 as x → 0 within [0, 1), even though f 0 = 1.
open Filter Topology
noncomputable def limitValueDiff (x : ℝ) : ℝ :=
if x = 0 then 1 else x
open Filter Topology
lemma limitValueDiff_of_ne_zero {x : ℝ} (hx : x ≠ 0) :
limitValueDiff x = x
open Filter Topology
lemma limitValueDiff_eq_self_of_mem_Ioo {x : ℝ}
(hx : x ∈ Set.Ioo (0 : ℝ) 1) : limitValueDiff x = x
open Filter Topology
lemma abs_limitValueDiff_eq_of_mem_Ioo {x : ℝ}
(hx : x ∈ Set.Ioo (0 : ℝ) 1) : |limitValueDiff x| = x
The limit of limitValueDiff at 0 within (0, 1) (the punctured part of [0, 1)) is 0.
open Filter Topology
lemma tendsto_limitValueDiff :
Tendsto limitValueDiff (𝓝[Set.Ioo 0 1] 0) (𝓝 (0 : ℝ))
The value of limitValueDiff at 0 is 1, differing from the limit.
open Filter Topology
lemma limitValueDiff_zero : limitValueDiff 0 = (1 : ℝ)
Lemma 3.1.7: For S ⊆ ℝ, a cluster point c of S, a function f : S → ℝ, and L : ℝ, we have f(x) → L as x → c iff for every sequence (xₙ) with xₙ ∈ S \ {c} and xₙ → c, the sequence (f xₙ) converges to L.
open Filter Topology
lemma limitWithin_iff_seq_tendsto (S : Set ℝ) (f : ℝ → ℝ) (c L : ℝ) :
LimitWithin S f c L ↔
IsClusterPoint S c ∧
∀ u : ℕ → ℝ,
(∀ n, u n ∈ S \ {c}) →
Tendsto u atTop (𝓝 c) →
Tendsto (fun n => f (u n)) atTop (𝓝 L)
The sequence uₙ = 1 / (π n + π / 2) used in Example 3.1.8.
open Filter Topology
noncomputable def sinInvSeq (n : ℕ) : ℝ :=
1 / (Real.pi * (n : ℝ) + Real.pi / 2)
open Filter Topology
lemma sinInvSeq_den_pos (n : ℕ) :
0 < Real.pi * (n : ℝ) + Real.pi / 2
open Filter Topology
lemma sinInvSeq_pos (n : ℕ) : 0 < sinInvSeq n
open Filter Topology
lemma sinInvSeq_ne_zero (n : ℕ) : sinInvSeq n ≠ 0
open Filter Topology
lemma sinInvSeq_eq (n : ℕ) :
sinInvSeq n = (1 / Real.pi) * (1 / ((n : ℝ) + (1 / 2 : ℝ)))
open Filter Topology
lemma sin_inv_seq_tendsto :
Tendsto sinInvSeq atTop (𝓝 (0 : ℝ))
open Filter Topology
lemma sin_inv_seq_values (n : ℕ) :
Real.sin (1 / sinInvSeq n) = (-1 : ℝ) ^ n
open Filter Topology
lemma sin_inv_seq_values' (n : ℕ) :
Real.sin ((sinInvSeq n)⁻¹) = (-1 : ℝ) ^ n
open Filter Topology
lemma pow_neg_one_not_convergent :
¬ ∃ L : ℝ,
Tendsto (fun n : ℕ => (-1 : ℝ) ^ n) atTop (𝓝 L)
open Filter Topology
lemma seq_mul_sin_inv_tendsto_zero {v : ℕ → ℝ}
(hv_zero : Tendsto v atTop (𝓝 (0 : ℝ))) :
Tendsto (fun n => v n * Real.sin (1 / v n)) atTop (𝓝 (0 : ℝ))
Example 3.1.8: The limit of sin (1 / x) as x → 0 does not exist, but the limit of x * sin (1 / x) as x → 0 equals 0.
open Filter Topology
lemma sin_inv_no_limit :
¬ ∃ L : ℝ, LimitWithin Set.univ (fun x : ℝ => Real.sin (1 / x)) 0 L
The product x * sin (1 / x) converges to 0 as x → 0.
open Filter Topology
lemma limit_mul_sin_inv :
LimitWithin Set.univ (fun x : ℝ => x * Real.sin (1 / x)) 0 0
If two real sequences converge and one bounds the other termwise, then their limits respect the same inequality.
open Filter Topology
lemma seq_limit_le {a b : ℕ → ℝ} {L₁ L₂ : ℝ}
(ha : Tendsto a atTop (𝓝 L₁)) (hb : Tendsto b atTop (𝓝 L₂))
(hmono : ∀ n, a n ≤ b n) :
L₁ ≤ L₂
Corollary 3.1.9: If c is a cluster point of S ⊆ ℝ, f, g : ℝ → ℝ have limits L_f, L_g as x → c within S, and f x ≤ g x for all x ∈ S \ {c}, then L_f ≤ L_g.
open Filter Topology
lemma limitWithin_le_of_le {S : Set ℝ} {c Lf Lg : ℝ} {f g : ℝ → ℝ}
(hf : LimitWithin S f c Lf) (hg : LimitWithin S g c Lg)
(hfg : ∀ ⦃x : ℝ⦄, x ∈ S → x ≠ c → f x ≤ g x) :
Lf ≤ Lg
Corollary 3.1.10: If c is a cluster point of S ⊆ ℝ, f : ℝ → ℝ has a limit L as x → c within S, and a ≤ f x ≤ b for all x ∈ S \ {c}, then a ≤ L ≤ b.
open Filter Topology
lemma limitWithin_mem_interval {S : Set ℝ} {c L a b : ℝ} {f : ℝ → ℝ}
(hlim : LimitWithin S f c L)
(hbounds : ∀ ⦃x : ℝ⦄, x ∈ S \ {c} → a ≤ f x ∧ f x ≤ b) :
a ≤ L ∧ L ≤ b
Corollary 3.1.11 (squeeze theorem): Let S ⊆ ℝ and c be a cluster point of S. If f, g, h : ℝ → ℝ satisfy f x ≤ g x ≤ h x for all x ∈ S \ {c} and f and h both have limit L as x → c within S, then g also has limit L as x → c within S.
open Filter Topology
lemma limitWithin_squeeze {S : Set ℝ} {c L : ℝ} {f g h : ℝ → ℝ}
(hf : LimitWithin S f c L) (hh : LimitWithin S h c L)
(hfg : ∀ ⦃x : ℝ⦄, x ∈ S → x ≠ c → f x ≤ g x)
(hgh : ∀ ⦃x : ℝ⦄, x ∈ S → x ≠ c → g x ≤ h x) :
LimitWithin S g c L
Corollary 3.1.12: Let S ⊆ ℝ and c be a cluster point of S. If f, g : ℝ → ℝ have limits as x → c within S, then (i) the limit of f + g equals the sum of the limits, (ii) the limit of f - g equals the difference of the limits, (iii) the limit of f * g equals the product of the limits, and (iv) if the limit of g is nonzero and g x ≠ 0 for all x ∈ S \ {c}, then the limit of f / g equals the quotient of the limits.
open Filter Topology
lemma limitWithin_add {S : Set ℝ} {c Lf Lg : ℝ} {f g : ℝ → ℝ}
(hf : LimitWithin S f c Lf) (hg : LimitWithin S g c Lg) :
LimitWithin S (fun x => f x + g x) c (Lf + Lg)
open Filter Topology
lemma limitWithin_sub {S : Set ℝ} {c Lf Lg : ℝ} {f g : ℝ → ℝ}
(hf : LimitWithin S f c Lf) (hg : LimitWithin S g c Lg) :
LimitWithin S (fun x => f x - g x) c (Lf - Lg)
open Filter Topology
lemma limitWithin_mul {S : Set ℝ} {c Lf Lg : ℝ} {f g : ℝ → ℝ}
(hf : LimitWithin S f c Lf) (hg : LimitWithin S g c Lg) :
LimitWithin S (fun x => f x * g x) c (Lf * Lg)
open Filter Topology
lemma limitWithin_div {S : Set ℝ} {c Lf Lg : ℝ} {f g : ℝ → ℝ}
(hf : LimitWithin S f c Lf) (hg : LimitWithin S g c Lg)
(hg0 : ∀ ⦃x : ℝ⦄, x ∈ S → x ≠ c → g x ≠ 0) (hL0 : Lg ≠ 0) :
LimitWithin S (fun x => f x / g x) c (Lf / Lg)
Corollary 3.1.13: If S ⊆ ℝ, c is a cluster point of S, and the limit lim_{x → c, x ∈ S} f x exists for a function f : ℝ → ℝ, then the limit of |f x| as x → c within S equals the absolute value of the limit of f.
open Filter Topology
lemma limitWithin_abs {S : Set ℝ} {c L : ℝ} {f : ℝ → ℝ}
(hlim : LimitWithin S f c L) :
LimitWithin S (fun x => |f x|) c |L|
Definition 3.1.14: For a function f : S → ℝ and a subset A ⊆ S, the restriction f|_A : A → ℝ is given by f|_A x = f x for x ∈ A.
open Filter Topology
def restrictToSubset {S A : Set ℝ} (f : S → ℝ) (hAS : A ⊆ S) : A → ℝ :=
fun x => f ⟨x, hAS x.property⟩
Proposition 3.1.15(i): If A ⊆ S ⊆ ℝ agree with S on a punctured neighborhood of c (i.e., there exists α > 0 with `(A \ {c}) ∩ (c-α, c+α) = (S \ {c}) ∩ (c-α, c+α)), then cis a cluster point ofA` iff it is a cluster point of S.
open Filter Topology
lemma clusterPoint_iff_of_local_agree
{S A : Set ℝ} {c α : ℝ}
(hα : 0 < α)
(hA : (A \ {c}) ∩ Set.Ioo (c - α) (c + α) =
(S \ {c}) ∩ Set.Ioo (c - α) (c + α)) :
IsClusterPoint A c ↔ IsClusterPoint S c
The ε–δ condition for the limit within S implies the corresponding condition within A provided the sets coincide on a punctured neighborhood of c.
open Filter Topology
lemma limitWithin_imp_of_local_agree
{S A : Set ℝ} {c α L : ℝ} {f : ℝ → ℝ}
(hα : 0 < α)
(hA : (A \ {c}) ∩ Set.Ioo (c - α) (c + α) =
(S \ {c}) ∩ Set.Ioo (c - α) (c + α))
(hlim : ∀ ⦃ε : ℝ⦄, 0 < ε →
∃ δ > 0,
∀ ⦃x : ℝ⦄, x ∈ S → x ≠ c → |x - c| < δ → |f x - L| < ε) :
∀ ⦃ε : ℝ⦄, 0 < ε →
∃ δ > 0,
∀ ⦃x : ℝ⦄, x ∈ A → x ≠ c → |x - c| < δ → |f x - L| < ε
Proposition 3.1.15(ii): Under the same local agreement near c and assuming c is a cluster point of S, the limit of f along S at c equals that of its restriction to A.
open Filter Topology
lemma limitWithin_iff_of_local_agree
{S A : Set ℝ} {c α L : ℝ} {f : ℝ → ℝ}
(hα : 0 < α)
(hA : (A \ {c}) ∩ Set.Ioo (c - α) (c + α) =
(S \ {c}) ∩ Set.Ioo (c - α) (c + α))
(_ : IsClusterPoint S c) :
LimitWithin S f c L ↔ LimitWithin A f c L
Definition 3.1.16: For a function f : ℝ → ℝ, the right-hand limit of f at c along a set S is the limit of the restriction of f to S ∩ (c, ∞) as x → c. The left-hand limit is defined analogously using S ∩ (-∞, c).
open Filter Topology
def RightLimitWithin (S : Set ℝ) (f : ℝ → ℝ) (c L : ℝ) : Prop :=
LimitWithin (S ∩ Set.Ioi c) f c L
The left-hand limit of f at c along S, given by restricting to S ∩ (-∞, c) and taking the limit as x → c.
open Filter Topology
def LeftLimitWithin (S : Set ℝ) (f : ℝ → ℝ) (c L : ℝ) : Prop :=
LimitWithin (S ∩ Set.Iio c) f c L
Right-hand limits coincide with mathlib's Tendsto along the 𝓝 within the right half-neighborhood.
open Filter Topology
lemma rightLimitWithin_iff_tendsto (S : Set ℝ) (f : ℝ → ℝ) (c L : ℝ) :
RightLimitWithin S f c L ↔
IsClusterPoint (S ∩ Set.Ioi c) c ∧
Tendsto f (𝓝[S ∩ Set.Ioi c] c) (𝓝 L)
Left-hand limits coincide with mathlib's Tendsto along the 𝓝 within the left half-neighborhood.
open Filter Topology
lemma leftLimitWithin_iff_tendsto (S : Set ℝ) (f : ℝ → ℝ) (c L : ℝ) :
LeftLimitWithin S f c L ↔
IsClusterPoint (S ∩ Set.Iio c) c ∧
Tendsto f (𝓝[S ∩ Set.Iio c] c) (𝓝 L)
Proposition 3.1.17: If c is a cluster point of both S ∩ (-∞, c) and S ∩ (c, ∞), then c is a cluster point of S, and f(x) → L as x → c within S iff both the left-hand and right-hand limits along S equal L.
open Filter Topology
lemma limitWithin_iff_left_right {S : Set ℝ} {c L : ℝ} {f : ℝ → ℝ}
(hleft : IsClusterPoint (S ∩ Set.Iio c) c)
(hright : IsClusterPoint (S ∩ Set.Ioi c) c) :
IsClusterPoint S c ∧
(LimitWithin S f c L ↔
LeftLimitWithin S f c L ∧ RightLimitWithin S f c L)3.2 — Continuous Functions
Lean authors: Zichen Wang, Zaiwen Wen.
Definition 3.2.1. A function f : S → ℝ is continuous at a point c ∈ S if for every ε > 0 there exists δ > 0 such that whenever x ∈ S satisfies |x - c| < δ, then |f x - f c| < ε. A function is continuous on S if it is continuous at every point of S.
open Filter
open Metric
open scoped Topology Rat
def continuousAtInSet (S : Set ℝ) (f : S → ℝ) (c : S) : Prop :=
∀ ε > 0, ∃ δ > 0, ∀ x : S, |(x : ℝ) - (c : ℝ)| < δ → |f x - f c| < ε
A function f : S → ℝ is continuous on S when it is continuous at every point of S.
open Filter
open Metric
open scoped Topology Rat
def continuousOnSet (S : Set ℝ) (f : S → ℝ) : Prop :=
∀ c : S, continuousAtInSet S f c
The epsilon-delta continuity at a point agrees with mathlib's notion of continuity for subtype domains.
open Filter
open Metric
open scoped Topology Rat
theorem continuousAtInSet_iff (S : Set ℝ) (f : S → ℝ) (c : S) :
continuousAtInSet S f c ↔ ContinuousAt f c
Continuity on a set agrees with mathlib's Continuous for functions defined on a subtype of ℝ.
open Filter
open Metric
open scoped Topology Rat
theorem continuousOnSet_iff (S : Set ℝ) (f : S → ℝ) :
continuousOnSet S f ↔ Continuous f
Proposition 3.2.2. For a function f : S → ℝ on a set S ⊆ ℝ and a point c ∈ S: (i) if c is not a cluster point of S, then f is continuous at c; (ii) if c is a cluster point of S, then f is continuous at c if and only if \lim_{x \to c} f x = f c; (iii) f is continuous at c if and only if for every sequence (x_n) ⊆ S with x_n → c, one has f (x_n) → f c.
open Filter
open Metric
open scoped Topology Rat
lemma proposition_3_2_2 (S : Set ℝ) (f : S → ℝ) (c : S) :
(¬ (c : ℝ) ∈ closure (S \ ({(c : ℝ)} : Set ℝ)) →
ContinuousAt f c) ∧
((c : ℝ) ∈ closure (S \ ({(c : ℝ)} : Set ℝ)) →
(ContinuousAt f c ↔ Filter.Tendsto f (𝓝 c) (𝓝 (f c)))) ∧
(ContinuousAt f c ↔
∀ u : ℕ → S,
Filter.Tendsto (fun n => (u n : ℝ)) atTop (𝓝 (c : ℝ)) →
Filter.Tendsto (fun n => f (u n)) atTop (𝓝 (f c)))
Elements of the positive real subtype are nonzero.
open Filter
open Metric
open scoped Topology Rat
lemma subtype_pos_ne_zero (x : {x : ℝ // 0 < x}) : (x : ℝ) ≠ 0
The reciprocal map is continuous at every point of (0, ∞).
open Filter
open Metric
open scoped Topology Rat
lemma continuousAt_inv_subtype (c : {x : ℝ // 0 < x}) :
ContinuousAt (fun x : {x : ℝ // 0 < x} => (x : ℝ)⁻¹) c
Example 3.2.3. The reciprocal function f : (0, ∞) → ℝ given by f x = 1 / x is continuous on its domain.
open Filter
open Metric
open scoped Topology Rat
lemma example_3_2_3 : Continuous fun x : {x : ℝ // 0 < x} => (x : ℝ)⁻¹
Proposition 3.2.4. A real polynomial `f(x) = a_d x^d + a_{d-1} x^{d-1} + ⋯ + a_1 x + a_0defines a continuous functionℝ → ℝ`.
open Filter
open Metric
open scoped Topology Rat
lemma polynomial_continuous (p : Polynomial ℝ) :
Continuous fun x : ℝ => p.eval x
Proposition 3.2.5. If f, g : S → ℝ are continuous at c ∈ S, then: (i) the sum x ↦ f x + g x is continuous at c; (ii) the difference x ↦ f x - g x is continuous at c; (iii) the product x ↦ f x * g x is continuous at c; (iv) if additionally g x ≠ 0 for all x ∈ S, the quotient x ↦ f x / g x is continuous at c.
open Filter
open Metric
open scoped Topology Rat
lemma proposition_3_2_5 {S : Set ℝ} {f g : S → ℝ} {c : S}
(hf : ContinuousAt f c) (hg : ContinuousAt g c)
(h0 : ∀ x : S, g x ≠ 0) :
ContinuousAt (fun x : S => f x + g x) c ∧
ContinuousAt (fun x : S => f x - g x) c ∧
ContinuousAt (fun x : S => f x * g x) c ∧
ContinuousAt (fun x : S => f x / g x) c
Example 3.2.6. The sine and cosine functions on ℝ are continuous. The book justifies this using trigonometric identities and the estimates |sin x| ≤ |x|, |cos x| ≤ 1, and |sin x| ≤ 1.
open Filter
open Metric
open scoped Topology Rat
lemma sin_is_continuous : Continuous fun x : ℝ => Real.sin x
open Filter
open Metric
open scoped Topology Rat
lemma cos_is_continuous : Continuous fun x : ℝ => Real.cos x
open Filter
open Metric
open scoped Topology Rat
lemma example_3_2_6 :
Continuous (fun x : ℝ => Real.sin x) ∧
Continuous (fun x : ℝ => Real.cos x)
Proposition 3.2.7. If g : A → B is continuous at c ∈ A and f : B → ℝ is continuous at g c, then the composition f ∘ g : A → ℝ is continuous at c.
open Filter
open Metric
open scoped Topology Rat
lemma composition_continuousAt {A B : Set ℝ} {f : B → ℝ} {g : A → B} {c : A}
(hg : ContinuousAt g c) (hf : ContinuousAt f (g c)) :
ContinuousAt (fun x : A => f (g x)) c
The reciprocal map is continuous on (0, ∞) when regarded as a function ℝ → ℝ.
open Filter
open Metric
open scoped Topology Rat
lemma continuousOn_inv_Ioi :
ContinuousOn (fun x : ℝ => (1 : ℝ) / x) (Set.Ioi 0)
Composing the reciprocal with the sine function yields a continuous function on (0, ∞).
open Filter
open Metric
open scoped Topology Rat
lemma continuousOn_sin_inv :
ContinuousOn (fun x : ℝ => Real.sin (1 / x)) (Set.Ioi 0)
Example 3.2.8. The function x ↦ (sin (1 / x))^2 is continuous on the open interval (0, ∞).
open Filter
open Metric
open scoped Topology Rat
lemma example_3_2_8 :
ContinuousOn (fun x : ℝ => (Real.sin (1 / x)) ^ 2) (Set.Ioi 0)
Proposition 3.2.9. If there exists a sequence (x_n) in S converging to c such that (f (x_n)) does not converge to f c, then f is discontinuous at c.
open Filter
open Metric
open scoped Topology Rat
lemma proposition_3_2_9 {S : Set ℝ} {f : S → ℝ} {c : S}
(h : ∃ u : ℕ → S,
Filter.Tendsto (fun n => (u n : ℝ)) Filter.atTop (𝓝 (c : ℝ)) ∧
¬ Filter.Tendsto (fun n => f (u n)) Filter.atTop (𝓝 (f c))) :
¬ ContinuousAt f c
Explicit values of even powers of -1 in ℝ.
open Filter
open Metric
open scoped Topology Rat
lemma neg_one_pow_even_real (m : ℕ) :
(-1 : ℝ) ^ (2 * m) = 1
Explicit values of odd powers of -1 in ℝ.
open Filter
open Metric
open scoped Topology Rat
lemma neg_one_pow_odd_real (m : ℕ) :
(-1 : ℝ) ^ (2 * m + 1) = -1
Example 3.2.10. The function f : ℝ → ℝ given by f x = -1 for x < 0 and f x = 1 for x ≥ 0 has a jump discontinuity at 0. The left-limit along x_n = -1 / n is -1, the right-limit along x_n = 1 / n is 1, and along the alternating sequence x_n = (-1)^n / n the values oscillate and diverge.
open Filter
open Metric
open scoped Topology Rat
noncomputable def jumpDiscontinuity (x : ℝ) : ℝ :=
if x < 0 then -1 else 1
open Filter
open Metric
open scoped Topology Rat
lemma jumpDiscontinuity_of_neg {x : ℝ} (hx : x < 0) :
jumpDiscontinuity x = -1
open Filter
open Metric
open scoped Topology Rat
lemma jumpDiscontinuity_of_nonneg {x : ℝ} (hx : 0 ≤ x) :
jumpDiscontinuity x = 1
open Filter
open Metric
open scoped Topology Rat
lemma jumpDiscontinuity_left_sequence :
Tendsto (fun n : ℕ => jumpDiscontinuity (-((n.succ : ℝ)⁻¹)))
atTop (𝓝 (-1 : ℝ))
open Filter
open Metric
open scoped Topology Rat
lemma jumpDiscontinuity_right_sequence :
Tendsto (fun n : ℕ => jumpDiscontinuity ((n.succ : ℝ)⁻¹))
atTop (𝓝 (1 : ℝ))
open Filter
open Metric
open scoped Topology Rat
lemma jumpDiscontinuity_alternating_sequence_diverges :
¬ ∃ l : ℝ,
Tendsto (fun n : ℕ =>
jumpDiscontinuity (((-1 : ℝ) ^ n) / (n.succ : ℝ))) atTop (𝓝 l)
open Filter
open Metric
open scoped Topology Rat
lemma example_3_2_10 : ¬ ContinuousAt jumpDiscontinuity 0
Example 3.2.11. The Dirichlet function f : ℝ → ℝ defined by f x = 1 when x is rational and f x = 0 when x is irrational is discontinuous at every real number.
open Filter
open Metric
open scoped Topology Rat
noncomputable def dirichlet (x : ℝ) : ℝ
open Filter
open Metric
open scoped Topology Rat
lemma dirichlet_value_rational {x : ℝ}
(hx : ∃ q : ℚ, (q : ℝ) = x) : dirichlet x = 1
open Filter
open Metric
open scoped Topology Rat
lemma dirichlet_value_irrational {x : ℝ}
(hx : ¬ ∃ q : ℚ, (q : ℝ) = x) : dirichlet x = 0
open Filter
open Metric
open scoped Topology Rat
lemma dirichlet_irrational_seq_at_rational {c : ℝ}
(hc : ∃ q : ℚ, (q : ℝ) = c) :
∃ u : ℕ → ℝ, Tendsto u atTop (𝓝 c) ∧ ∀ n, Irrational (u n)
open Filter
open Metric
open scoped Topology Rat
lemma dirichlet_rational_seq_at_irrational {c : ℝ}
(hc : Irrational c) :
∃ v : ℕ → ℝ, Tendsto v atTop (𝓝 c) ∧ ∀ n, ∃ q : ℚ, (q : ℝ) = v n
open Filter
open Metric
open scoped Topology Rat
lemma example_3_2_11 (c : ℝ) : ¬ ContinuousAt dirichlet c
Example 3.2.12. The popcorn (Thomae) function on (0, 1) is defined by f (m / k) = 1 / k when m, k ∈ ℕ are coprime and m / k is in lowest terms, and f x = 0 when x is irrational. It is continuous at every irrational c ∈ (0, 1) and discontinuous at every rational c ∈ (0, 1).
open Filter
open Metric
open scoped Topology Rat
noncomputable def popcorn (x : ℝ) : ℝ
open Filter
open Metric
open scoped Topology Rat
lemma popcorn_value_rational (q : ℚ) :
popcorn (q : ℝ) = (q.den : ℝ)⁻¹
open Filter
open Metric
open scoped Topology Rat
lemma popcorn_value_irrational {x : ℝ} (hx : Irrational x) :
popcorn x = 0
open Filter
open Metric
open scoped Topology Rat
lemma finite_rat_interval_small_denom (K : ℕ) :
{q : ℚ | q ∈ Set.Icc (0 : ℚ) 1 ∧ q.den ≤ K}.Finite
open Filter
open Metric
open scoped Topology Rat
lemma finite_small_denom_rationals (K : ℕ) :
{x : ℝ | x ∈ Set.Icc (0 : ℝ) 1 ∧
∃ q : ℚ, (q : ℝ) = x ∧ q.den ≤ K}.Finite
open Filter
open Metric
open scoped Topology Rat
lemma popcorn_discontinuous_at_rational {c : ℝ} (hc0 : 0 < c) (hc1 : c < 1)
(hc : ∃ q : ℚ, (q : ℝ) = c) : ¬ ContinuousAt popcorn c
open Filter
open Metric
open scoped Topology Rat
lemma popcorn_continuous_at_irrational {c : ℝ} (hc0 : 0 < c) (hc1 : c < 1)
(hc : Irrational c) : ContinuousAt popcorn c
Example 3.2.13. Define g : ℝ → ℝ by g x = 0 for x ≠ 0 and g 0 = 1. Then g is not continuous at 0 but it is continuous at every other point. The point 0 is a removable discontinuity since redefining g 0 = 0 would make the function continuous. Let A = {0} and B = ℝ \ {0}; the restriction g |_ A is continuous even though g fails to be continuous at 0, while g |_ B (and g on B) is continuous.
open Filter
open Metric
open scoped Topology Rat
noncomputable def removableDiscontinuityExample (x : ℝ) : ℝ :=
if x = 0 then 1 else 0
open Filter
open Metric
open scoped Topology Rat
lemma removableDiscontinuityExample_not_continuous_at_zero :
¬ ContinuousAt removableDiscontinuityExample 0
open Filter
open Metric
open scoped Topology Rat
lemma removableDiscontinuityExample_continuous_away_zero {x : ℝ} (hx : x ≠ 0) :
ContinuousAt removableDiscontinuityExample x
open Filter
open Metric
open scoped Topology Rat
lemma removableDiscontinuityExample_limit :
Tendsto removableDiscontinuityExample (𝓝[≠] (0 : ℝ)) (𝓝 0)
open Filter
open Metric
open scoped Topology Rat
lemma removableDiscontinuityExample_restrict_singleton :
Continuous fun x : {x : ℝ // x = 0} => removableDiscontinuityExample x
open Filter
open Metric
open scoped Topology Rat
lemma removableDiscontinuityExample_continuous_on_complement :
ContinuousOn removableDiscontinuityExample ({0}ᶜ : Set ℝ)
Helper lemma for Proposition 3.2.7: composing hf and hg gives the desired continuity conclusion.
open Filter
open Metric
open scoped Topology Rat
lemma comp_continuousAt_helper {A B : Set ℝ} {f : B → ℝ} {g : A → B} {c : A}
(hf : ContinuousAt f (g c)) (hg : ContinuousAt g c) :
ContinuousAt (fun x : A => f (g x)) c3.3 — Extreme and Intermediate Value Theorems
Lean authors: Zichen Wang, Zaiwen Wen.
Lemma 3.3.1. A continuous function f : [a, b] → ℝ is bounded.
open scoped Topology
lemma lemma_3_3_1 {a b : ℝ} (hle : a ≤ b) {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b)) :
∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M
Theorem 3.3.2 (Minimum-maximum theorem / Extreme value theorem). A continuous function f : [a, b] → ℝ attains an absolute minimum and an absolute maximum on [a, b].
open scoped Topology
theorem theorem_3_3_2 {a b : ℝ} (hle : a ≤ b) {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b)) :
(∃ c ∈ Set.Icc a b, ∀ x ∈ Set.Icc a b, f c ≤ f x) ∧
(∃ d ∈ Set.Icc a b, ∀ x ∈ Set.Icc a b, f x ≤ f d)
open scoped Topology
lemma example_3_3_3_min_bound (x : ℝ) :
(fun x : ℝ => x ^ 2 + 1) 0 ≤ (fun x : ℝ => x ^ 2 + 1) x
open scoped Topology
lemma example_3_3_3_sq_le_4 {x : ℝ} (hx : x ∈ Set.Icc (-1 : ℝ) 2) : x ^ 2 ≤ 4
open scoped Topology
lemma example_3_3_3_sq_le_100 {x : ℝ} (hx : x ∈ Set.Icc (-10 : ℝ) 10) : x ^ 2 ≤ 100
Example 3.3.3. For f x = x ^ 2 + 1 on [-1, 2], the minimum is achieved at x = 0 with value f 0 = 1 and the maximum at x = 2 with value f 2 = 5. On the larger interval [-10, 10], the maximum occurs at the endpoints x = 10 or x = -10.
open scoped Topology
lemma example_3_3_3 :
(∀ x ∈ Set.Icc (-1 : ℝ) 2,
(fun x : ℝ => x ^ 2 + 1) 0 ≤ (fun x : ℝ => x ^ 2 + 1) x) ∧
(fun x : ℝ => x ^ 2 + 1) 0 = 1 ∧
(∀ x ∈ Set.Icc (-1 : ℝ) 2,
(fun x : ℝ => x ^ 2 + 1) x ≤ (fun x : ℝ => x ^ 2 + 1) 2) ∧
(fun x : ℝ => x ^ 2 + 1) 2 = 5 ∧
(∀ x ∈ Set.Icc (-10 : ℝ) 10,
(fun x : ℝ => x ^ 2 + 1) x ≤ (fun x : ℝ => x ^ 2 + 1) 10) ∧
(∀ x ∈ Set.Icc (-10 : ℝ) 10,
(fun x : ℝ => x ^ 2 + 1) x ≤ (fun x : ℝ => x ^ 2 + 1) (-10))
Example 3.3.4. The identity function f : ℝ → ℝ, given by f x = x, achieves neither a minimum nor a maximum on ℝ, illustrating that bounded intervals are required to guarantee extrema.
open scoped Topology
lemma example_3_3_4 :
(¬ ∃ c : ℝ, ∀ x : ℝ, (fun x : ℝ => x) c ≤ (fun x : ℝ => x) x) ∧
(¬ ∃ d : ℝ, ∀ x : ℝ, (fun x : ℝ => x) x ≤ (fun x : ℝ => x) d)
Example 3.3.5. The function f : (0, 1) → ℝ given by f x = 1 / x is continuous on the open interval but achieves neither a minimum nor a maximum. The values are unbounded as x approaches 0, while as x → 1 the values tend to 1 with f x > 1 for all x ∈ (0, 1), so no point of the domain yields the value 1. This shows the need for a closed interval in the extreme value theorem.
open scoped Topology
lemma example_3_3_5 :
ContinuousOn (fun x : ℝ => (1 : ℝ) / x) (Set.Ioo 0 1) ∧
(¬ ∃ c ∈ Set.Ioo 0 1, ∀ x ∈ Set.Ioo 0 1,
(fun x : ℝ => (1 : ℝ) / x) c ≤ (fun x : ℝ => (1 : ℝ) / x) x) ∧
(¬ ∃ d ∈ Set.Ioo 0 1, ∀ x ∈ Set.Ioo 0 1,
(fun x : ℝ => (1 : ℝ) / x) x ≤ (fun x : ℝ => (1 : ℝ) / x) d) ∧
(∀ M : ℝ, ∃ x ∈ Set.Ioo 0 1, M ≤ (fun x : ℝ => (1 : ℝ) / x) x) ∧
(∀ x ∈ Set.Ioo 0 1, 1 < (fun x : ℝ => (1 : ℝ) / x) x) ∧
(∀ ε > 0, ∃ x ∈ Set.Ioo 0 1,
|(fun x : ℝ => (1 : ℝ) / x) x - 1| < ε)
Example 3.3.6. On the closed, bounded interval [0, 1], consider f : [0, 1] → ℝ given by f x = 1 / x for x > 0 and f 0 = 0. The function is not continuous at 0, and because the values blow up near 0, it fails to attain a maximum on [0, 1] despite the domain being compact.
open scoped Topology
noncomputable def example_3_3_6_function (x : ℝ) : ℝ := if x = 0 then 0 else (1 : ℝ) / x
open scoped Topology
lemma example_3_3_6_function_pos {x : ℝ} (hx : 0 < x) :
example_3_3_6_function x = (1 : ℝ) / x
open scoped Topology
lemma example_3_3_6_not_cont :
¬ ContinuousAt example_3_3_6_function 0
open scoped Topology
lemma example_3_3_6_no_max_point :
∀ {d : ℝ}, d ∈ Set.Icc (0 : ℝ) 1 →
∃ x ∈ Set.Icc (0 : ℝ) 1,
example_3_3_6_function d < example_3_3_6_function x
open scoped Topology
lemma example_3_3_6_unbounded :
∀ M : ℝ, ∃ x ∈ Set.Icc (0 : ℝ) 1, M ≤ example_3_3_6_function x
open scoped Topology
lemma example_3_3_6 :
(¬ ContinuousAt example_3_3_6_function 0) ∧
(¬ ∃ d ∈ Set.Icc (0 : ℝ) 1, ∀ x ∈ Set.Icc (0 : ℝ) 1,
example_3_3_6_function x ≤ example_3_3_6_function d) ∧
(∀ M : ℝ, ∃ x ∈ Set.Icc (0 : ℝ) 1, M ≤ example_3_3_6_function x)
Lemma 3.3.7 (Bolzano's intermediate value theorem). For a continuous function f : [a, b] → ℝ with f a < 0 and 0 < f b, there exists a point c strictly between a and b such that f c = 0.
open scoped Topology
lemma lemma_3_3_7 {a b : ℝ} (hab : a < b) {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b)) (ha : f a < 0) (hb : 0 < f b) :
∃ c ∈ Set.Ioo a b, f c = 0
Theorem 3.3.8 (Bolzano's intermediate value theorem). Let f : [a, b] → ℝ be continuous. If a real number y satisfies f a < y < f b or f a > y > f b, then there is some c strictly between a and b such that f c = y.
open scoped Topology
theorem theorem_3_3_8 {a b y : ℝ} (hab : a < b) {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b))
(hy : (f a < y ∧ y < f b) ∨ (f a > y ∧ y > f b)) :
∃ c ∈ Set.Ioo a b, f c = y
Example 3.3.9 (Bisection method). For f x = x ^ 3 - 2 x ^ 2 + x - 1, we have f 1 = -1 and f 2 = 1, so by the intermediate value theorem there is a root c ∈ (1, 2). Evaluating at midpoints shows sign changes on nested intervals: f (3/2) < 0, f (7/4) < 0, and 0 < f (15/8), so the root lies in (7/4, 15/8), numerically near 1.7549.
open scoped Topology
lemma example_3_3_9 :
(fun x : ℝ => x ^ 3 - 2 * x ^ 2 + x - 1) 1 = -1 ∧
(fun x : ℝ => x ^ 3 - 2 * x ^ 2 + x - 1) 2 = 1 ∧
(fun x : ℝ => x ^ 3 - 2 * x ^ 2 + x - 1) ((3 : ℝ) / 2) < 0 ∧
(fun x : ℝ => x ^ 3 - 2 * x ^ 2 + x - 1) ((7 : ℝ) / 4) < 0 ∧
0 < (fun x : ℝ => x ^ 3 - 2 * x ^ 2 + x - 1) ((15 : ℝ) / 8) ∧
ContinuousOn (fun x : ℝ => x ^ 3 - 2 * x ^ 2 + x - 1) (Set.Icc (1 : ℝ) 2) ∧
∃ c ∈ Set.Ioo (1 : ℝ) 2, (fun x : ℝ => x ^ 3 - 2 * x ^ 2 + x - 1) c = 0
Proposition 3.3.10. A real polynomial of odd degree has a real root.
open scoped Topology
theorem proposition_3_3_10 {p : Polynomial ℝ} (hodd : Odd p.natDegree)
(h₀ : p.leadingCoeff ≠ 0) : ∃ x : ℝ, p.eval x = 0
open scoped Topology
lemma example_3_3_11_pow_pos {k : ℕ} (hk : 1 < k) {y : ℝ} (hy : 1 < y) :
0 < y ^ k - y
Example 3.3.11. For any natural number k > 0 and any y > 0, there exists x > 0 such that x ^ k = y, which follows from Bolzano's intermediate value theorem applied to x ↦ x ^ k - y.
open scoped Topology
lemma example_3_3_11 {k : ℕ} (hk : 0 < k) {y : ℝ} (hy : 0 < y) :
∃ x : ℝ, 0 < x ∧ x ^ k = y
Example 3.3.12. The function f x = sin (1 / x) for x ≠ 0 and f 0 = 0 is discontinuous at 0, yet it still has the intermediate value property: whenever a < b and y lies strictly between f a and f b (in either order), there exists some c ∈ (a, b) with f c = y.
open scoped Topology
noncomputable def example_3_3_12_function (x : ℝ) : ℝ := if x = 0 then 0 else Real.sin (1 / x)
open scoped Topology
lemma example_3_3_12_function_of_ne {x : ℝ} (hx : x ≠ 0) :
example_3_3_12_function x = Real.sin (1 / x)
open scoped Topology
lemma example_3_3_12_function_neg (x : ℝ) :
example_3_3_12_function (-x) = -example_3_3_12_function x
open scoped Topology
lemma example_3_3_12_abs_le_one (x : ℝ) :
open scoped Topology
lemma example_3_3_12_continuous_on_nonzero {a b : ℝ}
(hzero : 0 ∉ Set.Icc a b) :
ContinuousOn example_3_3_12_function (Set.Icc a b)
open scoped Topology
lemma example_3_3_12_hits_pm_one :
∀ ε > 0, ∃ t₁ t₂,
0 < t₁ ∧ t₁ < t₂ ∧ t₂ < ε ∧
example_3_3_12_function t₁ = -1 ∧
example_3_3_12_function t₂ = 1
open scoped Topology
lemma example_3_3_12_between_bounds {a b y : ℝ}
(hy :
(example_3_3_12_function a < y ∧ y < example_3_3_12_function b) ∨
(example_3_3_12_function a > y ∧ y > example_3_3_12_function b)) :
-1 < y ∧ y < 1
open scoped Topology
lemma example_3_3_12_not_cont :
¬ ContinuousAt example_3_3_12_function 0
open scoped Topology
lemma example_3_3_12_IVT_cross_zero {a b y : ℝ}
(ha : a < 0) (hb : 0 < b)
(hy :
(example_3_3_12_function a < y ∧ y < example_3_3_12_function b) ∨
(example_3_3_12_function a > y ∧ y > example_3_3_12_function b)) :
∃ c ∈ Set.Ioo a b, example_3_3_12_function c = y
open scoped Topology
lemma example_3_3_12 :
(¬ ContinuousAt example_3_3_12_function 0) ∧
(∀ {a b y : ℝ}, a < b →
((example_3_3_12_function a < y ∧ y < example_3_3_12_function b) ∨
(example_3_3_12_function a > y ∧ y > example_3_3_12_function b)) →
∃ c ∈ Set.Ioo a b, example_3_3_12_function c = y)
If f has a minimum at xmin and a maximum at xmax on [a, b], then the image lies between the endpoint values.
open scoped Topology
lemma corollary_3_3_13_image_subset {a b : ℝ} {f : ℝ → ℝ} {xmin xmax : ℝ}
(_hxmin : xmin ∈ Set.Icc a b) (_hxmax : xmax ∈ Set.Icc a b)
(hmin : ∀ x ∈ Set.Icc a b, f xmin ≤ f x)
(hmax : ∀ x ∈ Set.Icc a b, f x ≤ f xmax) :
f '' Set.Icc a b ⊆ Set.Icc (f xmin) (f xmax)
If the minimum and maximum values are distinct, then every value between them is achieved on [a, b].
open scoped Topology
lemma corollary_3_3_13_Icc_subset_image {a b : ℝ} {f : ℝ → ℝ} {xmin xmax : ℝ}
(hxmin : xmin ∈ Set.Icc a b) (hxmax : xmax ∈ Set.Icc a b)
(hf : ContinuousOn f (Set.Icc a b))
(_hmin : ∀ x ∈ Set.Icc a b, f xmin ≤ f x)
(_hmax : ∀ x ∈ Set.Icc a b, f x ≤ f xmax)
(hcd : f xmin < f xmax) :
Set.Icc (f xmin) (f xmax) ⊆ f '' Set.Icc a b
Corollary 3.3.13. If f : [a, b] → ℝ is continuous, then the image f '' [a, b] is either a closed and bounded interval or a single point.
open scoped Topology
lemma corollary_3_3_13 {a b : ℝ} (hle : a ≤ b) {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b)) :
(∃ c d : ℝ, c ≤ d ∧ f '' Set.Icc a b = Set.Icc c d) ∨
∃ c : ℝ, f '' Set.Icc a b = {c}
Helper lemma for Theorem 3.3.2: a continuous function reaches its minimum on [a, b].
open scoped Topology
lemma theorem_3_3_2_min_helper {a b : ℝ} (hle : a ≤ b) {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b)) :
∃ c ∈ Set.Icc a b, ∀ x ∈ Set.Icc a b, f c ≤ f x
Helper lemma for Theorem 3.3.2: a continuous function reaches its maximum on [a, b].
open scoped Topology
lemma theorem_3_3_2_max_helper {a b : ℝ} (hle : a ≤ b) {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b)) :
∃ d ∈ Set.Icc a b, ∀ x ∈ Set.Icc a b, f x ≤ f d3.4 — Uniform Continuity
Lean authors: Zichen Wang, Zaiwen Wen.
Definition 3.4.1. A function f : S → ℝ is uniformly continuous if for every ε > 0 there exists δ > 0 such that whenever x, c ∈ S with |x - c| < δ, then |f x - f c| < ε.
open Filter Topology
def book_uniformContinuous (S : Set ℝ) (f : S → ℝ) : Prop :=
∀ ε > 0, ∃ δ > 0, ∀ x c : S, |(x : ℝ) - (c : ℝ)| < δ → |f x - f c| < ε
The book definition of uniform continuity on a subset of ℝ is equivalent to the standard UniformContinuous predicate for functions on the subtype.
open Filter Topology
lemma book_uniformContinuous_iff_uniformContinuous {S : Set ℝ} {f : S → ℝ} :
book_uniformContinuous S f ↔ UniformContinuous f
Example 3.4.2. The square function is uniformly continuous on the closed interval [0, 1], but it is not uniformly continuous on the whole real line.
open Filter Topology
lemma uniformContinuous_sq_on_Icc :
UniformContinuous (fun x : {x // x ∈ Set.Icc (0 : ℝ) 1} => (x : ℝ) ^ 2)
Example 3.4.2. The square function ℝ → ℝ is not uniformly continuous on the entire real line.
open Filter Topology
lemma not_uniformContinuous_sq : ¬ UniformContinuous (fun x : ℝ => x ^ 2)
Example 3.4.3 helper: the point min (δ/2) (1/3) lies in (0,1).
open Filter Topology
lemma min_half_delta_mem_Ioo {δ : ℝ} (hδ : 0 < δ) :
min (δ / 2) (1 / 3) ∈ Set.Ioo (0 : ℝ) 1
open Filter Topology
lemma inv_gap_for_double {t : ℝ} (ht : 0 < t) (hle : t ≤ 1 / 3) :
open Filter Topology
lemma not_uniformContinuous_inv_on_Ioo :
¬ UniformContinuous (fun x : {x // x ∈ Set.Ioo (0 : ℝ) 1} => (x : ℝ)⁻¹)
Theorem 3.4.4. If f : ℝ → ℝ is continuous on the closed interval [a, b], then f is uniformly continuous on [a, b].
open Filter Topology
lemma uniformContinuousOn_Icc_of_continuous {a b : ℝ} {f : ℝ → ℝ}
(hf : ContinuousOn f (Set.Icc a b)) : UniformContinuousOn f (Set.Icc a b)
Lemma 3.4.5. If f : S → ℝ is uniformly continuous and (x_n) is a Cauchy sequence in S, then (f x_n) is also Cauchy.
open Filter Topology
lemma uniformContinuous.cauchySeq_image {S : Set ℝ} {f : S → ℝ} (hf : UniformContinuous f)
{x : ℕ → S} (hx : CauchySeq x) : CauchySeq fun n => f (x n)
open Filter Topology
lemma uniformContinuousOn.cauchySeq_image {S : Set ℝ} {f : ℝ → ℝ}
(hf : UniformContinuousOn f S) {x : ℕ → ℝ}
(hx : ∀ n, x n ∈ S) (hxC : CauchySeq x) :
CauchySeq fun n => f (x n)
open Filter Topology
lemma cauchySeq_of_tendsto {x : ℕ → ℝ} {l : ℝ}
(hx : Tendsto x atTop (nhds l)) : CauchySeq x
open Filter Topology
lemma denseInducing_subtype_Ioo_Icc {a b : ℝ} (h : a < b) :
IsDenseInducing
(Set.inclusion (inclusion_Ioo_Icc_subset : Set.Ioo a b ⊆ Set.Icc a b))
open Filter Topology
lemma uniformInducing_subtype_Ioo_Icc {a b : ℝ} :
IsUniformInducing
(Set.inclusion (inclusion_Ioo_Icc_subset : Set.Ioo a b ⊆ Set.Icc a b))
open Filter Topology
lemma uniformContinuousOn_extend_to_Icc {a b : ℝ} {f : ℝ → ℝ}
(h : a < b) (hf : UniformContinuousOn f (Set.Ioo a b)) :
∃ g : ℝ → ℝ,
ContinuousOn g (Set.Icc a b) ∧
Set.EqOn g f (Set.Ioo a b) ∧
Tendsto f (nhdsWithin a (Set.Ioi a)) (nhds (g a)) ∧
Tendsto f (nhdsWithin b (Set.Iio b)) (nhds (g b))
Proposition 3.4.6. Suppose a < b. A function f : (a, b) → ℝ is uniformly continuous if and only if the limits L_a = lim_{x → a} f x, L_b = lim_{x → b} f x exist and an extension to the closed interval sending a to L_a, b to L_b, and agreeing with f on (a, b) is continuous.
open Filter Topology
lemma uniformContinuousOn_Ioo_iff_limits_extend {a b : ℝ} (h : a < b) (f : ℝ → ℝ) :
UniformContinuousOn f (Set.Ioo a b) ↔
∃ L_a L_b : ℝ,
Filter.Tendsto f (nhdsWithin a (Set.Ioi a)) (nhds L_a) ∧
Filter.Tendsto f (nhdsWithin b (Set.Iio b)) (nhds L_b) ∧
∃ g : ℝ → ℝ,
ContinuousOn g (Set.Icc a b) ∧
(∀ x ∈ Set.Ioo a b, g x = f x) ∧
g a = L_a ∧ g b = L_b
Definition 3.4.7. A function f : S → ℝ is Lipschitz continuous if there exists K ∈ ℝ such that |f x - f y| ≤ K * |x - y| for all x, y ∈ S.
open Filter Topology
def book_lipschitzOn (S : Set ℝ) (f : S → ℝ) : Prop :=
∃ K : ℝ, 0 ≤ K ∧ ∀ x y : S, |f x - f y| ≤ K * |(x : ℝ) - (y : ℝ)|
The book definition of Lipschitz continuity on a subset of ℝ coincides with the existence of some ℝ≥0 Lipschitz constant for the subtype.
open Filter Topology
lemma book_lipschitzOn_iff_lipschitzWith {S : Set ℝ} {f : S → ℝ} :
book_lipschitzOn S f ↔ ∃ K : NNReal, LipschitzWith K f
Proposition 3.4.8. A Lipschitz continuous function is uniformly continuous.
open Filter Topology
lemma uniformContinuous_of_book_lipschitzOn {S : Set ℝ} {f : S → ℝ}
(hf : book_lipschitzOn S f) : UniformContinuous f
Example 3.4.9. The sine function ℝ → ℝ is Lipschitz continuous with constant 1, as |sin x - sin y| ≤ |x - y| for all real x, y.
open Filter Topology
lemma lipschitzWith_one_real_sin :
LipschitzWith (1 : NNReal) fun x : ℝ => Real.sin x
Example 3.4.9. The cosine function ℝ → ℝ is Lipschitz continuous with constant 1, since |cos x - cos y| ≤ |x - y| for all real x, y.
open Filter Topology
lemma lipschitzWith_one_real_cos :
LipschitzWith (1 : NNReal) fun x : ℝ => Real.cos x
open Filter Topology
lemma sqrt_sub_le_sqrt_sub {x y : ℝ} (hx : 0 ≤ x) (hxy : x ≤ y) :
Real.sqrt y - Real.sqrt x ≤ Real.sqrt (y - x)
open Filter Topology
lemma abs_sqrt_sub_le_sqrt_abs {x y : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) :
Example 3.4.10. The square root function f(x) = √x is Lipschitz continuous on [1, ∞) with constant 1/2, as |√x - √y| ≤ (1/2) |x - y| for x, y ≥ 1.
open Filter Topology
lemma book_lipschitzOn_sqrt_Ici_one :
book_lipschitzOn (Set.Ici (1 : ℝ)) (fun x : Set.Ici (1 : ℝ) => Real.sqrt x)
Example 3.4.10. The square root function g(x) = √x on [0, ∞) is not Lipschitz continuous; no global constant K can satisfy |√x - √y| ≤ K |x - y| on the whole domain.
open Filter Topology
lemma not_book_lipschitzOn_sqrt_Ici_zero :
¬ book_lipschitzOn (Set.Ici (0 : ℝ)) (fun x : Set.Ici (0 : ℝ) => Real.sqrt x)
Example 3.4.10. Although not Lipschitz on [0, ∞), the square root function is uniformly continuous on that domain.
open Filter Topology
lemma uniformContinuous_sqrt_Ici_zero :
UniformContinuous (fun x : Set.Ici (0 : ℝ) => Real.sqrt x)
Helper lemma for Example 3.4.2: on [0, 1], the square function has Lipschitz constant 2.
open Filter Topology
lemma abs_sq_sub_sq_le_two_abs_sub
{x y : {t // t ∈ Set.Icc (0 : ℝ) 1}} :3.5 — Limits at Infinity
Lean authors: Zichen Wang, Zaiwen Wen.
Definition 3.5.1. ∞ is a cluster point of S ⊆ ℝ if for every real M there exists x ∈ S with x ≥ M; similarly -∞ is a cluster point if for every M there is x ∈ S with x ≤ M. For a function f : S → ℝ with ∞ (resp. -∞) a cluster point of S, the limit lim_{x → ∞} f = L (resp. lim_{x → -∞} f = L) means that for every ε > 0 there exists M ∈ ℝ such that for all x ∈ S with x ≥ M (resp. x ≤ M) one has |f x - L| < ε.
open Filter
def book_clusterPoint_atTop (S : Set ℝ) : Prop :=
∀ M : ℝ, ∃ x ∈ S, M ≤ x
Definition 3.5.1. -∞ is a cluster point of S ⊆ ℝ if every real bound is exceeded below by some x ∈ S.
open Filter
def book_clusterPoint_atBot (S : Set ℝ) : Prop :=
∀ M : ℝ, ∃ x ∈ S, x ≤ M
The book notion that ∞ is a cluster point of a subset of ℝ is equivalent to the set being unbounded above.
open Filter
lemma book_clusterPoint_atTop_iff_not_bddAbove {S : Set ℝ} :
book_clusterPoint_atTop S ↔ ¬ BddAbove S
The book notion that -∞ is a cluster point of a subset of ℝ is equivalent to the set being unbounded below.
open Filter
lemma book_clusterPoint_atBot_iff_not_bddBelow {S : Set ℝ} :
book_clusterPoint_atBot S ↔ ¬ BddBelow S
Definition 3.5.1. A function f : S → ℝ converges to L as x → ∞ if for every ε > 0 there exists M ∈ ℝ such that whenever x ∈ S satisfies x ≥ M, then |f x - L| < ε.
open Filter
def book_tendsto_atTop (S : Set ℝ) (f : S → ℝ) (L : ℝ) : Prop :=
∀ ε > 0, ∃ M : ℝ, ∀ x : S, M ≤ (x : ℝ) → |f x - L| < ε
Definition 3.5.1. A function f : S → ℝ converges to L as x → -∞ if for every ε > 0 there exists M ∈ ℝ such that whenever x ∈ S satisfies x ≤ M, then |f x - L| < ε.
open Filter
def book_tendsto_atBot (S : Set ℝ) (f : S → ℝ) (L : ℝ) : Prop :=
∀ ε > 0, ∃ M : ℝ, ∀ x : S, (x : ℝ) ≤ M → |f x - L| < ε
Assuming ∞ is a cluster point of S, the book limit at ∞ coincides with the standard Tendsto formulation along Filter.atTop for functions on the subtype domain.
open Filter
lemma book_tendsto_atTop_iff_tendsto {S : Set ℝ} {f : S → ℝ} {L : ℝ}
(hS : book_clusterPoint_atTop S) :
book_tendsto_atTop S f L ↔ Tendsto f atTop (nhds L)
The book limit at -∞ coincides with the standard Tendsto formulation along Filter.atBot for functions on the subtype domain.
open Filter
lemma book_tendsto_atBot_iff_tendsto {S : Set ℝ} {f : S → ℝ} {L : ℝ}
(hS : book_clusterPoint_atBot S) :
book_tendsto_atBot S f L ↔ Tendsto f atBot (nhds L)
Proposition 3.5.2. If a function has a limit at ∞ (resp. -∞) in the sense above, that limit value is unique.
open Filter
lemma limit_atTop_unique {S : Set ℝ} {f : S → ℝ} {L₁ L₂ : ℝ}
(hS : book_clusterPoint_atTop S)
(h₁ : book_tendsto_atTop S f L₁) (h₂ : book_tendsto_atTop S f L₂) : L₁ = L₂
Proposition 3.5.2. If a function has a limit at -∞ in the sense above, that limit value is unique.
open Filter
lemma limit_atBot_unique {S : Set ℝ} {f : S → ℝ} {L₁ L₂ : ℝ}
(hS : book_clusterPoint_atBot S)
(h₁ : book_tendsto_atBot S f L₁) (h₂ : book_tendsto_atBot S f L₂) : L₁ = L₂
Example 3.5.3. The function f x = 1 / (|x| + 1) satisfies lim_{x → ∞} f x = 0 and lim_{x → -∞} f x = 0.
open Filter
lemma example_3_5_3 :
Tendsto (fun x : ℝ => (1 : ℝ) / (|x| + 1)) atTop (nhds 0) ∧
Tendsto (fun x : ℝ => (1 : ℝ) / (|x| + 1)) atBot (nhds 0)
The affine sequence n ↦ 2n + c diverges to ∞.
open Filter
lemma tendsto_linear_shift_atTop (c : ℝ) :
Tendsto (fun n : ℕ => (2 : ℝ) * (n : ℝ) + c) atTop atTop
Exact value of sin (π (2n + 1/2)).
open Filter
lemma sin_pi_two_n_add_half (n : ℕ) :
Real.sin (Real.pi * ((2 : ℝ) * (n : ℝ) + 1 / 2)) = 1
Exact value of sin (π (2n + 3/2)).
open Filter
lemma sin_pi_two_n_add_three_halves (n : ℕ) :
Real.sin (Real.pi * ((2 : ℝ) * (n : ℝ) + 3 / 2)) = -1
Example 3.5.4. For f x = sin (π x), the limit lim_{x → ∞} f x does not exist, while the sequence limit lim_{n → ∞} sin (π n) equals 0; this illustrates the distinction between limits of continuous variables and limits of sequences.
open Filter
lemma example_3_5_4_limit_does_not_exist :
¬ ∃ L : ℝ, Tendsto (fun x : ℝ => Real.sin (Real.pi * x)) atTop (nhds L)
Example 3.5.4. The sequence sin (π n) converges to 0 as n → ∞.
open Filter
lemma example_3_5_4_sequence_limit :
Tendsto (fun n : ℕ => Real.sin (Real.pi * n)) atTop (nhds 0)
Lemma 3.5.5. If f : S → ℝ, ∞ is a cluster point of S ⊆ ℝ, and L ∈ ℝ, then lim_{x → ∞} f x = L if and only if for every sequence xₙ ∈ S with xₙ → ∞ one has lim_{n → ∞} f (xₙ) = L.
open Filter
lemma lemma_3_5_5 {S : Set ℝ} {f : S → ℝ} {L : ℝ}
(_hS : book_clusterPoint_atTop S) :
book_tendsto_atTop S f L ↔
∀ x : ℕ → S, Tendsto (fun n => (x n : ℝ)) atTop atTop →
Tendsto (fun n => f (x n)) atTop (nhds L)
Definition 3.5.6. If S ⊆ ℝ has ∞ as a cluster point, a function f : S → ℝ is said to diverge to ∞ as x → ∞ provided that for every real bound N there is some M such that whenever x ∈ S with x ≥ M, we have f x > N; this is written as lim_{x → ∞} f x = ∞.
open Filter
def book_tendsto_atTop_top (S : Set ℝ) (f : S → ℝ) : Prop :=
∀ N : ℝ, ∃ M : ℝ, ∀ x : S, M ≤ (x : ℝ) → N < f x
The book notion that a function diverges to ∞ agrees with the standard Tendsto formulation to the filter atTop on ℝ.
open Filter
lemma book_tendsto_atTop_top_iff_tendsto {S : Set ℝ} {f : S → ℝ}
(hS : book_clusterPoint_atTop S) :
book_tendsto_atTop_top S f ↔ Tendsto f atTop (atTop : Filter ℝ)
Example 3.5.7. The limit of (1 + x^2) / (1 + x) as x → ∞ diverges to ∞.
open Filter
lemma example_3_5_7 :
Tendsto (fun x : ℝ => (1 + x ^ 2) / (1 + x)) atTop (atTop : Filter ℝ)
Proposition 3.5.8. Let f : A → B and g : B → ℝ with A, B ⊆ ℝ, where a is a cluster point of A and b is a cluster point of B. Assume lim_{x → a} f x = b and lim_{y → b} g y = c for some c ∈ ℝ ∪ {±∞}; if moreover b ∈ B, suppose g b = c. Then lim_{x → a} g (f x) = c.
open Filter
lemma proposition_3_5_8 {A B : Set ℝ} {f : ℝ → ℝ} {g : ℝ → EReal}
{a b : ℝ} {c : EReal}
(_ha : ClusterPt a (Filter.principal A)) (_hb : ClusterPt b (Filter.principal B))
(hf_map : Set.MapsTo f A B)
(hf : Tendsto f (nhdsWithin a A) (nhds b))
(hg : Tendsto g (nhdsWithin b B) (nhds c))
(_hbmem : b ∈ B → g b = c) :
Tendsto (fun x => g (f x)) (nhdsWithin a A) (nhds c)
For any real bound M, the quadratic expression -x^2 + x is eventually below M along Filter.atTop.
open Filter
lemma neg_quad_eventually_le (M : ℝ) :
(∀ᶠ x : ℝ in atTop, -x ^ 2 + x ≤ M)
The quadratic polynomial -x^2 + x tends to -∞ along Filter.atTop.
open Filter
lemma tendsto_neg_quad_atTop_atBot :
Tendsto (fun x : ℝ => -x ^ 2 + x) atTop atBot
Example 3.5.9. For h x = e ^ (-x^2 + x), we have lim_{x → ∞} h x = 0, using that -x^2 + x → -∞ and e^y → 0 as y → -∞.
open Filter
lemma example_3_5_9 :
Tendsto (fun x : ℝ => Real.exp (-x ^ 2 + x)) atTop (nhds 0)
Helper for Example 3.5.7: for x ≥ 1, (1 + x^2) / (1 + x) dominates x / 2.
open Filter
lemma example_3_5_7_lower_bound {x : ℝ} (hx : 1 ≤ x) :
(1 + x ^ 2) / (1 + x) ≥ x / 2
Helper for Example 3.5.7: x / 2 diverges to ∞.
open Filter
lemma example_3_5_7_half_eventually (N : ℝ) :
(∀ᶠ x : ℝ in atTop, N < x / 2)3.6 — Monotone Functions and Continuity
Lean authors: Zichen Wang, Zaiwen Wen.
Definition 3.6.1: Let S ⊆ ℝ. A function f : ℝ → ℝ is increasing (resp. strictly increasing) on S if x < y with x, y ∈ S implies f x ≤ f y (resp. f x < f y). It is decreasing (resp. strictly decreasing) when the inequalities for f are reversed. A function that is either increasing or decreasing on S is called monotone on S, and if it is strictly increasing or strictly decreasing on S, it is called strictly monotone on S.
open Filter
open BigOperators
open scoped BigOperators
def increasingOn (f : ℝ → ℝ) (S : Set ℝ) : Prop :=
∀ ⦃x y⦄, x ∈ S → y ∈ S → x < y → f x ≤ f y
open Filter
open BigOperators
open scoped BigOperators
def strictlyIncreasingOn (f : ℝ → ℝ) (S : Set ℝ) : Prop :=
∀ ⦃x y⦄, x ∈ S → y ∈ S → x < y → f x < f y
open Filter
open BigOperators
open scoped BigOperators
def decreasingOn (f : ℝ → ℝ) (S : Set ℝ) : Prop :=
∀ ⦃x y⦄, x ∈ S → y ∈ S → x < y → f y ≤ f x
open Filter
open BigOperators
open scoped BigOperators
def strictlyDecreasingOn (f : ℝ → ℝ) (S : Set ℝ) : Prop :=
∀ ⦃x y⦄, x ∈ S → y ∈ S → x < y → f y < f x
open Filter
open BigOperators
open scoped BigOperators
def monotoneOn (f : ℝ → ℝ) (S : Set ℝ) : Prop :=
increasingOn f S ∨ decreasingOn f S
open Filter
open BigOperators
open scoped BigOperators
def strictlyMonotoneOn (f : ℝ → ℝ) (S : Set ℝ) : Prop :=
strictlyIncreasingOn f S ∨ strictlyDecreasingOn f S
open Filter
open BigOperators
open scoped BigOperators
lemma increasingOn_iff_monotoneOn_real {f : ℝ → ℝ} {S : Set ℝ} :
increasingOn f S ↔ MonotoneOn f S
open Filter
open BigOperators
open scoped BigOperators
lemma strictlyIncreasingOn_iff_strictMonoOn_real {f : ℝ → ℝ} {S : Set ℝ} :
strictlyIncreasingOn f S ↔ StrictMonoOn f S
open Filter
open BigOperators
open scoped BigOperators
lemma decreasingOn_iff_antitoneOn_real {f : ℝ → ℝ} {S : Set ℝ} :
decreasingOn f S ↔ AntitoneOn f S
open Filter
open BigOperators
open scoped BigOperators
lemma strictlyDecreasingOn_iff_strictAntiOn_real {f : ℝ → ℝ} {S : Set ℝ} :
strictlyDecreasingOn f S ↔ StrictAntiOn f S
open Filter
open BigOperators
open scoped BigOperators
lemma monotoneOn_iff_monotoneOrAntitone {f : ℝ → ℝ} {S : Set ℝ} :
monotoneOn f S ↔ MonotoneOn f S ∨ AntitoneOn f S
open Filter
open BigOperators
open scoped BigOperators
lemma strictlyMonotoneOn_iff_strictMonoOrStrictAnti {f : ℝ → ℝ} {S : Set ℝ} :
strictlyMonotoneOn f S ↔ StrictMonoOn f S ∨ StrictAntiOn f S
A technical lemma: if f is monotone on S, then the left limit along S ∩ (-∞, c) converges to the supremum of the left slice when that slice is bounded above.
open Filter
open BigOperators
open scoped BigOperators
lemma monotoneOn_left_limit_sup {S : Set ℝ} {f : ℝ → ℝ} {c : ℝ}
(hf : MonotoneOn f S) (hc : c ∈ closure (S ∩ Set.Iio c))
(hB : BddAbove (f '' (S ∩ Set.Iio c))) :
Tendsto f (nhdsWithin c (S ∩ Set.Iio c))
(nhds (sSup (f '' (S ∩ Set.Iio c))))
open Filter
open BigOperators
open scoped BigOperators
lemma monotoneOn_left_limit_atTop {S : Set ℝ} {f : ℝ → ℝ} {c : ℝ}
(hf : MonotoneOn f S) (hc : c ∈ closure (S ∩ Set.Iio c))
(hUnb : ¬ BddAbove (f '' (S ∩ Set.Iio c))) :
Tendsto f (nhdsWithin c (S ∩ Set.Iio c)) atTop
open Filter
open BigOperators
open scoped BigOperators
lemma monotoneOn_right_limit_inf {S : Set ℝ} {f : ℝ → ℝ} {c : ℝ}
(hf : MonotoneOn f S) (hc : c ∈ closure (S ∩ Set.Ioi c))
(hB : BddBelow (f '' (S ∩ Set.Ioi c))) :
Tendsto f (nhdsWithin c (S ∩ Set.Ioi c))
(nhds (sInf (f '' (S ∩ Set.Ioi c))))
open Filter
open BigOperators
open scoped BigOperators
lemma monotoneOn_right_limit_atBot {S : Set ℝ} {f : ℝ → ℝ} {c : ℝ}
(hf : MonotoneOn f S) (hc : c ∈ closure (S ∩ Set.Ioi c))
(hUnb : ¬ BddBelow (f '' (S ∩ Set.Ioi c))) :
Tendsto f (nhdsWithin c (S ∩ Set.Ioi c)) atBot
open Filter
open BigOperators
open scoped BigOperators
lemma monotoneOn_limit_atTop_cases {S : Set ℝ} {f : ℝ → ℝ}
(hf : MonotoneOn f S)
(hS : Filter.NeBot ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S)) :
(BddAbove (f '' S) →
Tendsto f ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S)
(nhds (sSup (f '' S)))) ∧
(¬ BddAbove (f '' S) →
Tendsto f ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S) atTop)
open Filter
open BigOperators
open scoped BigOperators
lemma monotoneOn_limit_atBot_cases {S : Set ℝ} {f : ℝ → ℝ}
(hf : MonotoneOn f S)
(hS : Filter.NeBot ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S)) :
(BddBelow (f '' S) →
Tendsto f ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S)
(nhds (sInf (f '' S)))) ∧
(¬ BddBelow (f '' S) →
Tendsto f ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S) atBot)
open Filter
open BigOperators
open scoped BigOperators
lemma antitoneOn_left_limit_inf {S : Set ℝ} {g : ℝ → ℝ} {c : ℝ}
(hg : AntitoneOn g S) (hc : c ∈ closure (S ∩ Set.Iio c))
(hB : BddBelow (g '' (S ∩ Set.Iio c))) :
Tendsto g (nhdsWithin c (S ∩ Set.Iio c))
(nhds (sInf (g '' (S ∩ Set.Iio c))))
open Filter
open BigOperators
open scoped BigOperators
lemma antitoneOn_left_limit_atBot {S : Set ℝ} {g : ℝ → ℝ} {c : ℝ}
(hg : AntitoneOn g S) (hc : c ∈ closure (S ∩ Set.Iio c))
(hUnb : ¬ BddBelow (g '' (S ∩ Set.Iio c))) :
Tendsto g (nhdsWithin c (S ∩ Set.Iio c)) atBot
open Filter
open BigOperators
open scoped BigOperators
lemma antitoneOn_right_limit_sup {S : Set ℝ} {g : ℝ → ℝ} {c : ℝ}
(hg : AntitoneOn g S) (hc : c ∈ closure (S ∩ Set.Ioi c))
(hB : BddAbove (g '' (S ∩ Set.Ioi c))) :
Tendsto g (nhdsWithin c (S ∩ Set.Ioi c))
(nhds (sSup (g '' (S ∩ Set.Ioi c))))
open Filter
open BigOperators
open scoped BigOperators
lemma antitoneOn_right_limit_atTop {S : Set ℝ} {g : ℝ → ℝ} {c : ℝ}
(hg : AntitoneOn g S) (hc : c ∈ closure (S ∩ Set.Ioi c))
(hUnb : ¬ BddAbove (g '' (S ∩ Set.Ioi c))) :
Tendsto g (nhdsWithin c (S ∩ Set.Ioi c)) atTop
open Filter
open BigOperators
open scoped BigOperators
lemma antitoneOn_limit_atTop_cases {S : Set ℝ} {g : ℝ → ℝ}
(hg : AntitoneOn g S)
(hS : Filter.NeBot ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S)) :
(BddBelow (g '' S) →
Tendsto g ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S)
(nhds (sInf (g '' S)))) ∧
(¬ BddBelow (g '' S) →
Tendsto g ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S) atBot)
open Filter
open BigOperators
open scoped BigOperators
lemma antitoneOn_limit_atBot_cases {S : Set ℝ} {g : ℝ → ℝ}
(hg : AntitoneOn g S)
(hS : Filter.NeBot ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S)) :
(BddAbove (g '' S) →
Tendsto g ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S)
(nhds (sSup (g '' S)))) ∧
(¬ BddAbove (g '' S) →
Tendsto g ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S) atTop)
Proposition 3.6.2: Let S ⊆ ℝ, c ∈ ℝ, f : ℝ → ℝ be increasing on S, and g : ℝ → ℝ be decreasing on S. If c is a cluster point of S ∩ (-∞, c), then lim_{x → c^-} f x = sup {f x | x ∈ S, x < c} and lim_{x → c^-} g x = inf {g x | x ∈ S, x < c}. If c is a cluster point of S ∩ (c, ∞), then lim_{x → c^+} f x = inf {f x | x ∈ S, x > c} and lim_{x → c^+} g x = sup {g x | x ∈ S, x > c}. If ∞ is a cluster point of S, then lim_{x → ∞} f x = sup {f x | x ∈ S} and lim_{x → ∞} g x = inf {g x | x ∈ S}. If -∞ is a cluster point of S, then lim_{x → -∞} f x = inf {f x | x ∈ S} and lim_{x → -∞} g x = sup {g x | x ∈ S}.
open Filter
open BigOperators
open scoped BigOperators
lemma proposition_3_6_2 {S : Set ℝ} {c : ℝ} {f g : ℝ → ℝ}
(hf : MonotoneOn f S) (hg : AntitoneOn g S) :
(c ∈ closure (S ∩ Set.Iio c) →
(BddAbove (f '' (S ∩ Set.Iio c)) →
Tendsto f (nhdsWithin c (S ∩ Set.Iio c))
(nhds (sSup (f '' (S ∩ Set.Iio c))))) ∧
(¬ BddAbove (f '' (S ∩ Set.Iio c)) →
Tendsto f (nhdsWithin c (S ∩ Set.Iio c)) atTop) ∧
(BddBelow (g '' (S ∩ Set.Iio c)) →
Tendsto g (nhdsWithin c (S ∩ Set.Iio c))
(nhds (sInf (g '' (S ∩ Set.Iio c))))) ∧
(¬ BddBelow (g '' (S ∩ Set.Iio c)) →
Tendsto g (nhdsWithin c (S ∩ Set.Iio c)) atBot)) ∧
(c ∈ closure (S ∩ Set.Ioi c) →
(BddBelow (f '' (S ∩ Set.Ioi c)) →
Tendsto f (nhdsWithin c (S ∩ Set.Ioi c))
(nhds (sInf (f '' (S ∩ Set.Ioi c))))) ∧
(¬ BddBelow (f '' (S ∩ Set.Ioi c)) →
Tendsto f (nhdsWithin c (S ∩ Set.Ioi c)) atBot) ∧
(BddAbove (g '' (S ∩ Set.Ioi c)) →
Tendsto g (nhdsWithin c (S ∩ Set.Ioi c))
(nhds (sSup (g '' (S ∩ Set.Ioi c))))) ∧
(¬ BddAbove (g '' (S ∩ Set.Ioi c)) →
Tendsto g (nhdsWithin c (S ∩ Set.Ioi c)) atTop)) ∧
(Filter.NeBot ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S) →
(BddAbove (f '' S) →
Tendsto f ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S)
(nhds (sSup (f '' S)))) ∧
(¬ BddAbove (f '' S) →
Tendsto f ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S) atTop) ∧
(BddBelow (g '' S) →
Tendsto g ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S)
(nhds (sInf (g '' S)))) ∧
(¬ BddBelow (g '' S) →
Tendsto g ((Filter.atTop : Filter ℝ) ⊓ Filter.principal S) atBot)) ∧
(Filter.NeBot ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S) →
(BddBelow (f '' S) →
Tendsto f ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S)
(nhds (sInf (f '' S)))) ∧
(¬ BddBelow (f '' S) →
Tendsto f ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S) atBot) ∧
(BddAbove (g '' S) →
Tendsto g ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S)
(nhds (sSup (g '' S)))) ∧
(¬ BddAbove (g '' S) →
Tendsto g ((Filter.atBot : Filter ℝ) ⊓ Filter.principal S) atTop))
If an interval I contains a point strictly to the left of c, then c is a closure point of I ∩ (-∞, c).
open Filter
open BigOperators
open scoped BigOperators
lemma closure_left_slice_of_ordConnected {I : Set ℝ} (hI : I.OrdConnected)
{c : I} (hleft : ∃ x ∈ I, x < c) :
(c : ℝ) ∈ closure (I ∩ Set.Iio (c : ℝ))
If an interval I contains a point strictly to the right of c, then c is a closure point of I ∩ (c, ∞).
open Filter
open BigOperators
open scoped BigOperators
lemma closure_right_slice_of_ordConnected {I : Set ℝ} (hI : I.OrdConnected)
{c : I} (hright : ∃ x ∈ I, c < x) :
(c : ℝ) ∈ closure (I ∩ Set.Ioi (c : ℝ))
Corollary 3.6.3: If I ⊆ ℝ is an interval and f : I → ℝ is monotone and not constant, then the image f(I) is an interval if and only if f is continuous.
open Filter
open BigOperators
open scoped BigOperators
theorem monotone_range_interval_iff_continuous {I : Set ℝ} (hI : I.OrdConnected)
{f : I → ℝ} (hf : Monotone f) (hconst : ∃ x y : I, f x ≠ f y) :
Set.OrdConnected (Set.range f) ↔ Continuous f
Corollary 3.6.4: Let I ⊆ ℝ be an interval and f : I → ℝ be monotone. Then f has at most countably many discontinuities.
open Filter
open BigOperators
open scoped BigOperators
theorem monotone_discontinuities_countable {I : Set ℝ} (hI : I.OrdConnected)
{f : I → ℝ} (hf : Monotone f) :
Set.Countable {x : I | ¬ ContinuousAt f x}
Example 3.6.5: There exists a strictly increasing function f : [0, 1] → ℝ that is bounded and has a discontinuity at each point 1 - 1/k for k ∈ ℕ. In particular, it is monotone on a compact interval with countably many discontinuities.
open Filter
open BigOperators
open scoped BigOperators
lemma example_3_6_5 :
∃ f : ℝ → ℝ,
StrictMonoOn f (Set.Icc 0 1) ∧
BddBelow (f '' Set.Icc 0 1) ∧ BddAbove (f '' Set.Icc 0 1) ∧
(∀ k : ℕ, ¬ ContinuousAt f (1 - (1 / (k.succ : ℝ)))) ∧
Set.Countable {x : ℝ | x ∈ Set.Icc 0 1 ∧ ¬ ContinuousAt f x}
Proposition 3.6.6: If I ⊆ ℝ is an interval and f : I → ℝ is strictly monotone, then the inverse f⁻¹ : f(I) → I is continuous.
open Filter
open BigOperators
open scoped BigOperators
theorem proposition_3_6_6 {I : Set ℝ} (hI : I.OrdConnected) {f : I → ℝ}
(hf : StrictMono f) (hTop : OrderTopology ↥(Set.range f)) :
Continuous ((StrictMono.orderIso f hf).symm)
Example 3.6.7: The piecewise function f : ℝ → ℝ given by f x = x for x < 0 and f x = x + 1 for x ≥ 0 is not continuous at 0, its image of ℝ is (-∞, 0) ∪ [1, ∞), and the inverse function f⁻¹ : (-∞, 0) ∪ [1, ∞) → ℝ defined by y if y < 0 and y - 1 if y ≥ 1 is continuous.
open Filter
open BigOperators
open scoped BigOperators
lemma example_3_6_7 :
(let f : ℝ → ℝ := fun x => if x < 0 then x else x + 1
let S : Set ℝ := {y : ℝ | y < 0 ∨ 1 ≤ y}
let g : S → ℝ := fun y => if (y : ℝ) < 0 then (y : ℝ) else (y : ℝ) - 1
¬ ContinuousAt f 0 ∧ Set.image f Set.univ = S ∧ Continuous g)