Chapter 03 — Uniform Convergence

Proofs omitted. Hover over highlighted terms to see their Lean types.

Reading sections

3.1 — Limiting Values of Functions

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Definition 3.1: [Limiting value of a function] The limit of f at x0 along E is L if x0 is an adherent point of E and for every ε > 0 there exists δ > 0 such that for all x ∈ E, dist x x0 < δ implies dist (f x) L < ε.

def IsLimitAlong {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) : Prop := x0 ∈ closure E ∧ ∀ ε > 0, ∃ δ > 0, ∀ x : E, dist x.1 x0 < δ → dist (f x) L < ε

Lean source

Proposition 3.1: A function between metric spaces is continuous at x0 iff for every ε > 0 there exists δ > 0 such that 0 < dist x x0 < δ implies dist (f x) (f x0) < ε; consequently, f is continuous on X iff this holds for all x0.

theorem continuousAt_iff_limit_and_continuous_iff_limit_all {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (x0 : X) : (ContinuousAt f x0 ↔ ∀ ε > 0, ∃ δ > 0, ∀ x : X, 0 < dist x x0 ∧ dist x x0 < δ → dist (f x) (f x0) < ε) ∧ (Continuous f ↔ ∀ x1 : X, ∀ ε > 0, ∃ δ > 0, ∀ x : X, 0 < dist x x1 ∧ dist x x1 < δ → dist (f x) (f x1) < ε)

Lean source

Example 3.1.1: If f : Real → Real is the function f x = x^2 - 4, then lim_{x → 1} f(x) = f(1) = 1 - 4 = -3 since f is continuous.

lemma limit_quadratic_minus_four_at_one : IsLimitAlong (E := (Set.univ : Set Real)) (f := fun x : (Set.univ : Set Real) => (x : Real)^2 - 4) 1 ((1 : Real)^2 - 4) ∧ ((1 : Real)^2 - 4 = -3)

Lean source

The punctured epsilon-delta limit along E at x0, excluding the base point.

def IsLimitAlongPunctured {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) : Prop := ∀ ε > 0, ∃ δ > 0, ∀ x : E, 0 < dist x.1 x0 ∧ dist x.1 x0 < δ → dist (f x) L < ε

Lean source

The extension of f to E ∪ {x0} taking the value L at x0.

noncomputable def limitExtension {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) : {x : X // x ∈ E ∪ {x0}} → Y := fun x => if hx0 : (x : X) = x0 then L else f ⟨(x : X), helperForProposition_3_2_mem_of_mem_union_singleton_ne E x0 (x : X) x.property hx0⟩

Lean source

The base point x0 lies in E ∪ {x0}.

lemma mem_union_singleton_self {X : Type*} (E : Set X) (x0 : X) : x0 ∈ E ∪ {x0}

Lean source

Proposition 3.2: Let E ⊆ X and f : E → Y, and let x0 be an adherent point of E with L ∈ Y. The following are equivalent: (a) the punctured epsilon-delta limit of f along E at x0 equals L; (b) for every sequence in E converging to x0 with all terms distinct from x0, the sequence of f-values converges to L; (c) for every open V ⊆ Y with L ∈ V, there is an open U ⊆ X with x0 ∈ U such that f(U ∩ E \ {x0}) ⊆ V; (d) the extension g to E ∪ {x0} with g(x0)=L and g|_{E\{x0}} = f is continuous at x0, and if x0 ∈ E and f is continuous at x0 (as a function on E), then f x0 = L.

theorem limit_along_equiv_sequence_open_continuous {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) : x0 ∈ closure E → ((IsLimitAlongPunctured E f x0 L) ↔ (∀ x : ℕ → E, Filter.Tendsto (fun n => (x n : X)) Filter.atTop (nhds x0) → (∀ n, (x n : X) ≠ x0) → Filter.Tendsto (fun n => f (x n)) Filter.atTop (nhds L))) ∧ ((∀ x : ℕ → E, Filter.Tendsto (fun n => (x n : X)) Filter.atTop (nhds x0) → (∀ n, (x n : X) ≠ x0) → Filter.Tendsto (fun n => f (x n)) Filter.atTop (nhds L)) ↔ (∀ V : Set Y, IsOpen V → L ∈ V → ∃ U : Set X, IsOpen U ∧ x0 ∈ U ∧ ∀ x : E, x.1 ∈ U → x.1 ≠ x0 → f x ∈ V)) ∧ ((∀ V : Set Y, IsOpen V → L ∈ V → ∃ U : Set X, IsOpen U ∧ x0 ∈ U ∧ ∀ x : E, x.1 ∈ U → x.1 ≠ x0 → f x ∈ V) ↔ (ContinuousAt (limitExtension E f x0 L) ⟨x0, mem_union_singleton_self E x0⟩ ∧ (x0 ∈ closure (E \ {x0}) → ∀ hx0E : x0 ∈ E, ContinuousAt f ⟨x0, hx0E⟩ → f ⟨x0, hx0E⟩ = L)))

Lean source

Proposition 3.3: [Uniqueness of limit] If the limit of f at x0 along E equals both L and M, then L = M.

theorem limit_along_unique {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L M : Y) (hL : IsLimitAlong E f x0 L) (hM : IsLimitAlong E f x0 M) : L = M

Lean source

Helper for Proposition 3.1: equivalence between unpunctured and punctured epsilon-delta conditions.

lemma helperForProp_3_1_unpuncturedEpsDelta_iff_punctured {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (x0 : X) : (∀ ε > 0, ∃ δ > 0, ∀ x : X, dist x x0 < δ → dist (f x) (f x0) < ε) ↔ (∀ ε > 0, ∃ δ > 0, ∀ x : X, 0 < dist x x0 ∧ dist x x0 < δ → dist (f x) (f x0) < ε)

Lean source

Helper for Proposition 3.1: punctured epsilon-delta characterization of continuity at a point.

lemma helperForProp_3_1_continuousAt_iff_punctured {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) (x0 : X) : ContinuousAt f x0 ↔ ∀ ε > 0, ∃ δ > 0, ∀ x : X, 0 < dist x x0 ∧ dist x x0 < δ → dist (f x) (f x0) < ε

Lean source

Helper for Example 3.1.1: continuity of x ↦ x^2 - 4 at 1.

lemma helperForExample_3_1_1_continuousAt_quadraticMinusFour : ContinuousAt (fun x : Real => x^2 - 4) 1

Lean source

Helper for Proposition 3.2: points in E ∪ {x0} distinct from x0 lie in E.

lemma helperForProposition_3_2_mem_of_mem_union_singleton_ne {X : Type*} (E : Set X) (x0 x : X) (hx : x ∈ E ∪ ({x0} : Set X)) (hx0 : x ≠ x0) : x ∈ E

Lean source

Helper for Proposition 3.2: if E ⊆ {x0}, the punctured limit holds for any L.

lemma helperForProposition_3_2_isLimitPunctured_of_subset_singleton {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) (hE : E ⊆ ({x0} : Set X)) : IsLimitAlongPunctured E f x0 L

Lean source

Helper for Proposition 3.2: if E ⊆ {x0}, the sequential condition is vacuous.

lemma helperForProposition_3_2_seqCondition_of_subset_singleton {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) (hE : E ⊆ ({x0} : Set X)) : (∀ x : ℕ → E, Filter.Tendsto (fun n => (x n : X)) Filter.atTop (nhds x0) → (∀ n, (x n : X) ≠ x0) → Filter.Tendsto (fun n => f (x n)) Filter.atTop (nhds L))

Lean source

Helper for Proposition 3.2: if E ⊆ {x0}, the open-set condition is vacuous.

lemma helperForProposition_3_2_openCondition_of_subset_singleton {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) (hE : E ⊆ ({x0} : Set X)) : (∀ V : Set Y, IsOpen V → L ∈ V → ∃ U : Set X, IsOpen U ∧ x0 ∈ U ∧ ∀ x : E, x.1 ∈ U → x.1 ≠ x0 → f x ∈ V)

Lean source

Helper for Proposition 3.2: points of E ∪ {x0} are equal to x0 when E ⊆ {x0}.

lemma helperForProposition_3_2_eq_x0_of_mem_union_singleton {X : Type*} (E : Set X) (x0 : X) (hE : E ⊆ ({x0} : Set X)) : ∀ x : {x : X // x ∈ E ∪ {x0}}, (x : X) = x0

Lean source

Helper for Proposition 3.2: the limit extension takes value L when x = x0.

lemma helperForProposition_3_2_limitExtension_eq_L_of_eq {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) (x : {x : X // x ∈ E ∪ {x0}}) (hx : (x : X) = x0) : limitExtension E f x0 L x = L

Lean source

Helper for Proposition 3.2: continuity of the limit extension for E ⊆ {x0}.

lemma helperForProposition_3_2_continuousAt_limitExtension_of_subset_singleton {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) (hE : E ⊆ ({x0} : Set X)) : ContinuousAt (limitExtension E f x0 L) ⟨x0, mem_union_singleton_self E x0⟩

Lean source

Helper for Proposition 3.2: punctured epsilon-delta limit iff sequential criterion.

lemma helperForProposition_3_2_punctured_iff_sequence {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) : IsLimitAlongPunctured E f x0 L ↔ (∀ x : ℕ → E, Filter.Tendsto (fun n => (x n : X)) Filter.atTop (nhds x0) → (∀ n, (x n : X) ≠ x0) → Filter.Tendsto (fun n => f (x n)) Filter.atTop (nhds L))

Lean source

Helper for Proposition 3.2: punctured epsilon-delta limit iff open-set criterion.

lemma helperForProposition_3_2_punctured_iff_open {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) : IsLimitAlongPunctured E f x0 L ↔ (∀ V : Set Y, IsOpen V → L ∈ V → ∃ U : Set X, IsOpen U ∧ x0 ∈ U ∧ ∀ x : E, x.1 ∈ U → x.1 ≠ x0 → f x ∈ V)

Lean source

Helper for Proposition 3.2: isolated-point counterexample to the extra clause.

lemma helperForProposition_3_2_counterexample_isolated_point : ∃ (E : Set Real) (f : E → Real) (x0 L : Real), x0 ∈ closure E ∧ IsLimitAlongPunctured E f x0 L ∧ (∀ x : ℕ → E, Filter.Tendsto (fun n => (x n : Real)) Filter.atTop (nhds x0) → (∀ n, (x n : Real) ≠ x0) → Filter.Tendsto (fun n => f (x n)) Filter.atTop (nhds L)) ∧ (∀ V : Set Real, IsOpen V → L ∈ V → ∃ U : Set Real, IsOpen U ∧ x0 ∈ U ∧ ∀ x : E, x.1 ∈ U → x.1 ≠ x0 → f x ∈ V) ∧ ContinuousAt (limitExtension E f x0 L) ⟨x0, mem_union_singleton_self E x0⟩ ∧ (∃ hx0E : x0 ∈ E, ContinuousAt f ⟨x0, hx0E⟩ ∧ f ⟨x0, hx0E⟩ ≠ L)

Lean source

Helper for Proposition 3.2: a non-isolated base point forces f x0 = L from a punctured limit and continuity on E.

lemma helperForProposition_3_2_value_eq_of_nonisolated_and_puncturedLimit_and_continuousAt {X Y : Type*} [MetricSpace X] [MetricSpace Y] (E : Set X) (f : E → Y) (x0 : X) (L : Y) (hx0cl : x0 ∈ closure (E \ {x0})) : IsLimitAlongPunctured E f x0 L → ∀ hx0E : x0 ∈ E, ContinuousAt f ⟨x0, hx0E⟩ → f ⟨x0, hx0E⟩ = L

3.2 — Pointwise and Uniform Convergence

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Definition 3.2: Pointwise convergence. A sequence of functions f converges pointwise to g on X if for every x, the sequence n ↦ f n x tends to g x (equivalently: for every x and ε > 0 there exists N such that for all n ≥ N, dist (f n x) (g x) < ε).

open scoped Topology def PointwiseConvergent {X Y : Type*} [MetricSpace Y] (f : ℕ → X → Y) (g : X → Y) : Prop := ∀ x : X, Filter.Tendsto (fun n : ℕ => f n x) Filter.atTop (𝓝 (g x))

Lean source

Example 3.2.3: for any fixed x ∈ ℝ, the sequence n ↦ x / n converges to 0 as n → ∞.

open scoped Topology theorem tendsto_const_div_nat_atTop (x : ℝ) : Filter.Tendsto (fun n : ℕ => x / (n : ℝ)) Filter.atTop (𝓝 (0 : ℝ))

Lean source

Example 3.2.4: for f^{(n)}(x) := x^n on [0,1], the pointwise limit f is given by f(x) = 0 for 0 ≤ x < 1 and f(1) = 1.

open scoped Topology theorem pointwiseConvergent_pow_on_unitInterval : PointwiseConvergent (X := {x : ℝ // x ∈ Set.Icc (0 : ℝ) 1}) (Y := ℝ) (fun n x => (x : ℝ) ^ n) (fun x => if (x : ℝ) < 1 then 0 else 1)

Lean source

Example 3.2.5: for f^{(n)}(x) = x^n on [0,1), each f^{(n)} has limit 1 as x → 1 within [0,1), while the pointwise limit on [0,1) is 0, so iterated limits need not agree and pointwise convergence does not preserve limits.

open scoped Topology theorem pointwiseConvergence_not_preserve_limit_on_Ico : (∀ n : ℕ, Filter.Tendsto (fun x : ℝ => x ^ n) (𝓝[Set.Ico (0 : ℝ) 1] (1 : ℝ)) (𝓝 (1 : ℝ))) ∧ (∀ x ∈ Set.Ico (0 : ℝ) 1, Filter.Tendsto (fun n : ℕ => x ^ n) Filter.atTop (𝓝 (0 : ℝ))) ∧ (Filter.Tendsto (fun x : ℝ => (0 : ℝ)) (𝓝[Set.Ico (0 : ℝ) 1] (1 : ℝ)) (𝓝 (0 : ℝ))) ∧ (¬ Filter.Tendsto (fun x : ℝ => (0 : ℝ)) (𝓝[Set.Ico (0 : ℝ) 1] (1 : ℝ)) (𝓝 (1 : ℝ)))

Lean source

A spike function on [0,1] used in a pointwise-convergence counterexample.

open scoped Topology noncomputable def spikeFunction (n : ℕ) (x : ℝ) : ℝ := if x ∈ Set.Icc (1 / (2 * (n + 1 : ℝ))) (1 / (n + 1 : ℝ)) then 2 * (n + 1 : ℝ) else 0

Lean source

Example 3.2.6: the spike functions on [0,1] converge pointwise to 0, each has integral 1, and hence the limit of the integrals is not the integral of the pointwise limit.

open scoped Topology theorem counterexample_pointwiseIntegral_limit : PointwiseConvergent spikeFunction (fun _ : ℝ => 0) ∧ (∀ n : ℕ, IntervalIntegrable (spikeFunction n) (μ := MeasureTheory.volume) (0 : ℝ) 1) ∧ (∀ n : ℕ, ∫ x in (0 : ℝ)..(1 : ℝ), spikeFunction n x = (1 : ℝ)) ∧ (∫ x in (0 : ℝ)..(1 : ℝ), (0 : ℝ)) = (0 : ℝ) ∧ (Filter.Tendsto (fun n : ℕ => ∫ x in (0 : ℝ)..(1 : ℝ), spikeFunction n x) Filter.atTop (𝓝 (1 : ℝ))) ∧ (1 : ℝ) ≠ (0 : ℝ)

Lean source

A moving bump function on ℝ given by the indicator of [n, n+1].

open scoped Topology noncomputable def movingBump (n : ℕ) (x : ℝ) : ℝ := if x ∈ Set.Icc (n : ℝ) (n + 1) then 1 else 0

Lean source

Example 3.2.7: [Moving bump: pointwise convergence does not commute with integration] for f_n the indicator of [n, n+1], (1) f_n(x) → 0 pointwise on ℝ, (2) ∫ f_n = 1 for all n, and (3) ∫ (lim_n f_n) = 0, hence lim_n ∫ f_n ≠ ∫ lim_n f_n.

open scoped Topology theorem movingBump_pointwiseIntegral_counterexample : PointwiseConvergent movingBump (fun _ : ℝ => 0) ∧ (∀ n : ℕ, ∫ x, movingBump n x = (1 : ℝ)) ∧ ((∫ x : ℝ, (0 : ℝ)) = (0 : ℝ)) ∧ (Filter.Tendsto (fun n : ℕ => ∫ x, movingBump n x) Filter.atTop (𝓝 (1 : ℝ))) ∧ (1 : ℝ) ≠ (0 : ℝ)

Lean source

Example 3.2.8: [Pointwise limit of x^n on [0,1]]. For f_n(x) = x^n on [0,1], the pointwise limit is f(x) = 0 for 0 ≤ x < 1 and f(1) = 1.

open scoped Topology theorem pointwiseConvergent_pow_on_Icc_zero_one : PointwiseConvergent (X := {x : ℝ // x ∈ Set.Icc (0 : ℝ) 1}) (Y := ℝ) (fun n x => (x : ℝ) ^ n) (fun x => if (x : ℝ) < 1 then 0 else 1)

Lean source

Example 3.2.9: [x^n does not converge uniformly on [0,1]]. Let f_n(x) = x^n on [0,1], and let f be the pointwise limit above. Then f_n does not converge uniformly to f on [0,1].

open scoped Topology theorem not_tendstoUniformly_pow_on_Icc_zero_one : ¬ TendstoUniformly (fun n x => (x : ℝ) ^ n) (fun x => if (x : ℝ) < 1 then 0 else 1) Filter.atTop

Lean source

Definition 3.3: Uniform convergence. A sequence f converges uniformly to g on X if for every ε > 0 there exists N such that for all n ≥ N and all x, dist (f n x) (g x) < ε. In this case, g is the uniform limit of the sequence.

open scoped Topology def UniformlyConvergent {X Y : Type*} [MetricSpace Y] (f : ℕ → X → Y) (g : X → Y) : Prop := TendstoUniformly f g Filter.atTop

Lean source

Example 3.2.10: if a sequence of functions converges uniformly to f on X, then it converges pointwise to f on X.

open scoped Topology theorem uniformlyConvergent_implies_pointwiseConvergent {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : ℕ → X → Y) (g : X → Y) : UniformlyConvergent f g → PointwiseConvergent f g

Lean source

Example 3.2.11: [Uniform convergence of x/n on [0,1]]. Let f_n(x) = x/n on [0,1] and f(x) = 0. Then f_n converges uniformly to f on [0,1].

open scoped Topology theorem uniformlyConvergent_x_div_nat_on_Icc_zero_one : UniformlyConvergent (X := {x : ℝ // x ∈ Set.Icc (0 : ℝ) 1}) (Y := ℝ) (fun n x => (x : ℝ) / (n : ℝ)) (fun _ => (0 : ℝ))

Lean source

Example 3.2.12: (i) pointwise convergence on X restricts to pointwise convergence on E; (ii) uniform convergence on X restricts to uniform convergence on E.

open scoped Topology theorem convergence_restrict_subset {X Y : Type*} [MetricSpace Y] (E : Set X) (f : ℕ → X → Y) (g : X → Y) : (PointwiseConvergent f g → PointwiseConvergent (X := {x : X // x ∈ E}) (Y := Y) (fun n x => f n x) (fun x => g x)) ∧ (UniformlyConvergent f g → UniformlyConvergent (X := {x : X // x ∈ E}) (Y := Y) (fun n x => f n x) (fun x => g x))

Lean source

Helper for Example 3.2.4: if 0 ≤ r < 1 then |r| < 1.

open scoped Topology lemma helperForExample_3_2_4_abs_lt_one_of_nonneg_of_lt_one {r : ℝ} (hr : 0 ≤ r) (h : r < 1) : |r| < 1

Lean source

Helper for Example 3.2.4: if r ≤ 1 and ¬ r < 1, then r = 1.

open scoped Topology lemma helperForExample_3_2_4_eq_one_of_le_one_of_not_lt_one {r : ℝ} (hr : r ≤ 1) (h : ¬ r < 1) : r = 1

Lean source

Helper for Example 3.2.5: the within-neighborhood filter on Ico 0 1 at 1 is nontrivial.

open scoped Topology lemma helperForExample_3_2_5_nhdsWithin_Ico_neBot : (Filter.NeBot (𝓝[Set.Ico (0 : ℝ) 1] (1 : ℝ)))

Lean source

Helper for Example 3.2.6: rewrite spikeFunction as an indicator of an interval.

open scoped Topology lemma helperForExample_3_2_6_spikeFunction_as_indicator (n : ℕ) : spikeFunction n = Set.indicator (Set.Icc (1 / (2 * (n + 1 : ℝ))) (1 / (n + 1 : ℝ))) (fun _ : ℝ => 2 * (n + 1 : ℝ))

Lean source

Helper for Example 3.2.6: basic inequalities for the spike interval endpoints.

open scoped Topology lemma helperForExample_3_2_6_endpoints_properties (n : ℕ) : (0 : ℝ) < 1 / (2 * (n + 1 : ℝ)) ∧ 1 / (2 * (n + 1 : ℝ)) ≤ 1 / (n + 1 : ℝ) ∧ 1 / (n + 1 : ℝ) ≤ (1 : ℝ)

Lean source

Helper for Example 3.2.6: the spike functions are eventually zero at each point.

open scoped Topology lemma helperForExample_3_2_6_eventually_spikeFunction_eq_zero (x : ℝ) : (∀ᶠ n in Filter.atTop, spikeFunction n x = 0)

Lean source

Helper for Example 3.2.6: the spike functions are interval integrable on [0,1].

open scoped Topology lemma helperForExample_3_2_6_intervalIntegrable_spikeFunction (n : ℕ) : IntervalIntegrable (spikeFunction n) (μ := MeasureTheory.volume) (0 : ℝ) 1

Lean source

Helper for Example 3.2.6: the spike interval integral equals 1.

open scoped Topology lemma helperForExample_3_2_6_intervalIntegral_spikeFunction (n : ℕ) : ∫ x in (0 : ℝ)..(1 : ℝ), spikeFunction n x = (1 : ℝ)

Lean source

Helper for Example 3.2.7: movingBump is the indicator of [n, n+1].

open scoped Topology lemma helperForExample_3_2_7_movingBump_eq_indicator (n : ℕ) : movingBump n = (Set.Icc (n : ℝ) (n + 1)).indicator (1 : ℝ → ℝ)

Lean source

Helper for Example 3.2.7: for fixed x, the moving bump is eventually zero.

open scoped Topology lemma helperForExample_3_2_7_eventually_movingBump_eq_zero (x : ℝ) : (fun n : ℕ => movingBump n x) =ᶠ[Filter.atTop] (fun _ : ℕ => (0 : ℝ))

Lean source

Helper for Example 3.2.7: the Lebesgue measure of [n, n+1] is 1.

open scoped Topology lemma helperForExample_3_2_7_volume_real_Icc_nat (n : ℕ) : MeasureTheory.volume.real (Set.Icc (n : ℝ) (n + 1)) = (1 : ℝ)

Lean source

Helper for Example 3.2.7: the integral of movingBump n is 1.

open scoped Topology lemma helperForExample_3_2_7_integral_movingBump (n : ℕ) : (∫ x : ℝ, movingBump n x) = (1 : ℝ)

Lean source

Helper for Example 3.2.9: the pointwise limit evaluates to 1 at x = 2.

open scoped Topology lemma helperForExample_3_2_9_limitValue_at_two : (if (2 : ℝ) < 1 then (0 : ℝ) else 1) = 1

Lean source

Helper for Example 3.2.9: the sequence 2^n does not converge to 1.

open scoped Topology lemma helperForExample_3_2_9_not_tendsto_pow_two_nhds_one : ¬ Filter.Tendsto (fun n : ℕ => ((2 : ℝ) ^ n)) Filter.atTop (𝓝 (1 : ℝ))

Lean source

Helper for Example 3.2.11: points in [0,1] have absolute value at most 1.

open scoped Topology lemma helperForExample_3_2_11_abs_val_le_one (x : {x : ℝ // x ∈ Set.Icc (0 : ℝ) 1}) : |(x : ℝ)| ≤ 1

Lean source

Helper for Example 3.2.11: the distance from 0 to x/n is bounded by 1/n.

open scoped Topology lemma helperForExample_3_2_11_dist_zero_div_nat_le_one_div_nat (x : {x : ℝ // x ∈ Set.Icc (0 : ℝ) 1}) (n : ℕ) : dist (0 : ℝ) ((x : ℝ) / (n : ℝ)) ≤ 1 / (n : ℝ)

3.3 — Uniform Convergence and Continuity

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Theorem 3.3.1: [Uniform limits preserve continuity I] Suppose (X, d_X) and (Y, d_Y) are metric spaces, f^{(n)} : X → Y converges uniformly to f : X → Y, and x0 ∈ X. If each f^{(n)} is continuous at x0, then f is continuous at x0.

open scoped Topology open Filter theorem uniformLimit_continuousAt {X Y : Type*} [MetricSpace X] [MetricSpace Y] {fseq : ℕ → X → Y} {f : X → Y} (h_unif : TendstoUniformly fseq f atTop) (x0 : X) (hcont : ∀ n, ContinuousAt (fseq n) x0) : ContinuousAt f x0

Lean source

Theorem 3.3.2: [Uniform limits preserve continuity] Suppose (X, d_X) and (Y, d_Y) are metric spaces and f^{(n)} : X → Y converges uniformly to f : X → Y. If each f^{(n)} is continuous at every point of X, then f is continuous at every point of X.

open scoped Topology open Filter theorem uniformLimit_continuous {X Y : Type*} [MetricSpace X] [MetricSpace Y] {fseq : ℕ → X → Y} {f : X → Y} (h_unif : TendstoUniformly fseq f atTop) (hcont : ∀ n, Continuous (fseq n)) : Continuous f

Lean source

Proposition 3.3.3: [Interchange of limits and uniform limits] Let (X, d_X) and (Y, d_Y) be metric spaces with Y complete, let E ⊆ X, and let f^{(n)} : E → Y converge uniformly on E to f : E → Y. If x0 is an adherent point of E and each f^{(n)} has a limit at x0 along E equal to ℓ n, then ℓ n converges and f has a limit at x0 along E, with the two iterated limits equal.

open scoped Topology open Filter theorem uniformLimit_interchange_limits {X Y : Type*} [MetricSpace X] [MetricSpace Y] [CompleteSpace Y] {E : Set X} {fseq : ℕ → E → Y} {f : E → Y} (h_unif : TendstoUniformly fseq f atTop) (x0 : X) (hx0 : x0 ∈ closure E) (ℓ : ℕ → Y) (hlim : ∀ n, Tendsto (fseq n) (Filter.comap (fun x : E => (x : X)) (𝓝 x0)) (𝓝 (ℓ n))) : ∃ l : Y, Tendsto ℓ atTop (𝓝 l) ∧ Tendsto f (Filter.comap (fun x : E => (x : X)) (𝓝 x0)) (𝓝 l)

Lean source

Proposition 3.3.4: Let (X, d_X) and (Y, d_Y) be metric spaces. Let f^{(n)} : X → Y be continuous for each n, and suppose f^{(n)} → f : X → Y uniformly on X. If (x^{(n)}) is a sequence in X with x^{(n)} → x, then f^{(n)}(x^{(n)}) → f(x) in Y.

open scoped Topology open Filter theorem uniformLimit_eval_tendsto {X Y : Type*} [MetricSpace X] [MetricSpace Y] {fseq : ℕ → X → Y} {f : X → Y} (h_unif : TendstoUniformly fseq f atTop) (hcont : ∀ n, Continuous (fseq n)) {xseq : ℕ → X} {x : X} (hx : Tendsto xseq atTop (𝓝 x)) : Tendsto (fun n => fseq n (xseq n)) atTop (𝓝 (f x))

Lean source

Definition 3.4: A function f : X → Y between metric spaces is bounded if its image lies in some ball, i.e., there exist y0 ∈ Y and R > 0 such that dist (f x) y0 < R for all x ∈ X.

open scoped Topology open Filter def IsBoundedFunction {X Y : Type*} [MetricSpace X] [MetricSpace Y] (f : X → Y) : Prop := ∃ y0 : Y, ∃ R : ℝ, 0 < R ∧ ∀ x : X, dist (f x) y0 < R

Lean source

Proposition 3.3.5: [Uniform limits preserve boundedness] Let (X, d_X) and (Y, d_Y) be metric spaces. Let f^{(n)} : X → Y converge uniformly to f : X → Y. If each f^{(n)} is bounded on X, then f is bounded on X.

open scoped Topology open Filter theorem uniformLimit_bounded {X Y : Type*} [MetricSpace X] [MetricSpace Y] {fseq : ℕ → X → Y} {f : X → Y} (h_unif : TendstoUniformly fseq f atTop) (hbounded : ∀ n, IsBoundedFunction (fseq n)) : IsBoundedFunction f

Lean source

Proposition 3.3.6: [Uniform limits preserve boundedness] Let (X, d_X) and (Y, d_Y) be metric spaces. Let f^{(n)} : X → Y converge uniformly to f : X → Y. If each f^{(n)} is bounded on X, then f is bounded on X.

open scoped Topology open Filter theorem uniformLimit_boundedness {X Y : Type*} [MetricSpace X] [MetricSpace Y] {fseq : ℕ → X → Y} {f : X → Y} (h_unif : TendstoUniformly fseq f atTop) (hbounded : ∀ n, IsBoundedFunction (fseq n)) : IsBoundedFunction f

Lean source

Helper for Proposition 3.3.3: the comap filter at an adherent point is nontrivial.

open scoped Topology open Filter lemma helperForProp_3_3_3_comap_neBot {X : Type*} [TopologicalSpace X] {E : Set X} {x0 : X} (hx0 : x0 ∈ closure E) : (Filter.comap (fun x : E => (x : X)) (𝓝 x0)).NeBot

Lean source

Helper for Proposition 3.3.3: convert a limit into an eventual distance bound.

open scoped Topology open Filter lemma helperForProp_3_3_3_eventually_dist_lt_of_hlim {X Y : Type*} [MetricSpace X] [MetricSpace Y] {F : Filter X} {g : X → Y} {l : Y} (hlim : Tendsto g F (𝓝 l)) : ∀ ε > 0, {x : X | dist (g x) l < ε} ∈ F

Lean source

Helper for Proposition 3.3.3: the sequence of limits ℓ is Cauchy.

open scoped Topology open Filter lemma helperForProp_3_3_3_cauchySeq_ell {X Y : Type*} [MetricSpace X] [MetricSpace Y] {E : Set X} {fseq : ℕ → E → Y} {f : E → Y} (h_unif : TendstoUniformly fseq f atTop) (x0 : X) (hx0 : x0 ∈ closure E) (ℓ : ℕ → Y) (hlim : ∀ n, Tendsto (fseq n) (Filter.comap (fun x : E => (x : X)) (𝓝 x0)) (𝓝 (ℓ n))) : CauchySeq ℓ

Lean source

Helper for Proposition 3.3.3: the uniform limit has the expected limit at x0.

open scoped Topology open Filter lemma helperForProp_3_3_3_tendsto_f_limit {X Y : Type*} [MetricSpace X] [MetricSpace Y] {E : Set X} {fseq : ℕ → E → Y} {f : E → Y} (h_unif : TendstoUniformly fseq f atTop) (x0 : X) (ℓ : ℕ → Y) (hlim : ∀ n, Tendsto (fseq n) (Filter.comap (fun x : E => (x : X)) (𝓝 x0)) (𝓝 (ℓ n))) {l : Y} (hl : Tendsto ℓ atTop (𝓝 l)) : Tendsto f (Filter.comap (fun x : E => (x : X)) (𝓝 x0)) (𝓝 l)

Lean source

Helper for Proposition 3.3.4: uniform convergence with the distance order reversed.

open scoped Topology open Filter lemma helperForProp_3_3_4_unif_dist_lt {X Y : Type*} [MetricSpace X] [MetricSpace Y] {fseq : ℕ → X → Y} {f : X → Y} (h_unif : TendstoUniformly fseq f atTop) : ∀ ε > 0, ∀ᶠ n in atTop, ∀ x : X, dist (fseq n x) (f x) < ε

Lean source

Helper for Proposition 3.3.4: a 5-point triangle inequality chain.

open scoped Topology open Filter lemma helperForProp_3_3_4_dist_triangle5 {Y : Type*} [MetricSpace Y] (a b c d e : Y) : dist a e ≤ dist a b + dist b c + dist c d + dist d e

Lean source

Helper for Proposition 3.3.5: boundedness is stable under a uniform perturbation.

open scoped Topology open Filter lemma helperForProp_3_3_5_isBounded_of_uniform_dist_lt {X Y : Type*} [MetricSpace X] [MetricSpace Y] {f g : X → Y} {ε : ℝ} (hε : 0 < ε) (hbounded : IsBoundedFunction g) (hfg : ∀ x, dist (f x) (g x) < ε) : IsBoundedFunction f

3.4 — The Metric of Uniform Convergence

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Definition 3.5 (Space of bounded functions): for metric spaces X and Y, define B(X → Y) as the set of functions f : X → Y for which there exist y0 : Y and M < ∞ such that dist (f x) y0 ≤ M for all x : X.

def boundedFunctionSpace (X Y : Type*) [MetricSpace Y] : Set (X -> Y) := {f : X -> Y | ∃ y0 : Y, ∃ M : ℝ, ∀ x : X, dist (f x) y0 <= M}

Lean source

Definition 3.6: [Uniform (supremum) metric] If X is nonempty, define d_∞(f,g) = sup_{x ∈ X} dist (f x) (g x) for f,g ∈ B(X → Y); if X is empty, set d_∞(f,g) = 0 for all f,g ∈ B(X → Y).

noncomputable def uniformSupMetric (X Y : Type*) [MetricSpace Y] (f g : {f : X → Y // f ∈ boundedFunctionSpace X Y}) : ℝ := if _ : IsEmpty X then 0 else sSup (Set.range (fun x : X => dist (f.1 x) (g.1 x)))

Lean source

Definition 3.7 [Bounded continuous functions]: for metric spaces X and Y, define C(X → Y) as the set of bounded functions f : X → Y that are continuous.

def boundedContinuousFunctionSpace (X Y : Type*) [MetricSpace X] [MetricSpace Y] : Set (X → Y) := {f : X → Y | f ∈ boundedFunctionSpace X Y ∧ Continuous f}

Lean source

The unit interval as a subtype of ℝ.

abbrev unitIntervalSubtype : Type := {x : ℝ // x ∈ Set.Icc (0:ℝ) 1}

Lean source

The function x ↦ 2x on the unit interval is bounded.

lemma doubleOnUnitInterval_bounded : (fun x : unitIntervalSubtype => (2:ℝ) * x.1) ∈ boundedFunctionSpace unitIntervalSubtype ℝ

Lean source

The function x ↦ 3x on the unit interval is bounded.

lemma tripleOnUnitInterval_bounded : (fun x : unitIntervalSubtype => (3:ℝ) * x.1) ∈ boundedFunctionSpace unitIntervalSubtype ℝ

Lean source

The function x ↦ 2x on the unit interval, as an element of the bounded function space.

def doubleOnUnitInterval : {f : unitIntervalSubtype -> ℝ // f ∈ boundedFunctionSpace unitIntervalSubtype ℝ} := ⟨fun x : unitIntervalSubtype => (2:ℝ) * x.1, doubleOnUnitInterval_bounded⟩

Lean source

The function x ↦ 3x on the unit interval, as an element of the bounded function space.

def tripleOnUnitInterval : {f : unitIntervalSubtype -> ℝ // f ∈ boundedFunctionSpace unitIntervalSubtype ℝ} := ⟨fun x : unitIntervalSubtype => (3:ℝ) * x.1, tripleOnUnitInterval_bounded⟩

Lean source

Example 3.4.3: for X = [0,1] and Y = ℝ with the usual metrics, if f(x)=2x and g(x)=3x, then d_∞(f,g)=1.

lemma uniformSupMetric_double_triple_unitInterval : uniformSupMetric unitIntervalSubtype ℝ doubleOnUnitInterval tripleOnUnitInterval = 1

Lean source

Proposition 3.4.4: Let X and Y be metric spaces and let f^{(n)} be a sequence in B(X → Y) with f ∈ B(X → Y). Then the following are equivalent: (1) d_∞(f^{(n)}, f) → 0 as n → ∞; (2) f^{(n)} → f uniformly on X (i.e. the usual ε–N condition).

theorem tendsto_uniformSupMetric_iff_uniformlyConvergent {X Y : Type*} [MetricSpace X] [MetricSpace Y] (fseq : ℕ → {f : X → Y // f ∈ boundedFunctionSpace X Y}) (f : {f : X → Y // f ∈ boundedFunctionSpace X Y}) : (Filter.Tendsto (fun n => uniformSupMetric X Y (fseq n) f) Filter.atTop (nhds (0 : ℝ))) ↔ TendstoUniformly (fun n => (fseq n).1) f.1 Filter.atTop

Lean source

Proposition 3.4.5 (Inclusion into bounded functions): for metric spaces X and Y, C(X → Y) is a subset of B(X → Y).

theorem boundedContinuousFunctionSpace_subset_boundedFunctionSpace (X Y : Type*) [MetricSpace X] [MetricSpace Y] : boundedContinuousFunctionSpace X Y ⊆ boundedFunctionSpace X Y

Lean source

Theorem 3.4.5 (Completeness of bounded continuous functions): for metric spaces X and Y with Y complete, the space of bounded continuous functions C(X → Y) is complete with respect to the uniform metric (equivalently, every Cauchy sequence converges uniformly to a bounded continuous function).

theorem completeSpace_boundedContinuousFunction (X Y : Type*) [MetricSpace X] [MetricSpace Y] [CompleteSpace Y] : CompleteSpace (BoundedContinuousFunction X Y)

Lean source

Proposition 3.4.6 (Uniform limits preserve continuity): let X and Y be metric spaces. If (fseq n) is a sequence of functions X → Y converging uniformly to f (with respect to the uniform metric), and each fseq n is continuous, then f is continuous.

theorem continuous_of_tendstoUniformly {X Y : Type*} [MetricSpace X] [MetricSpace Y] (fseq : ℕ → X → Y) (f : X → Y) (hcont : ∀ n, Continuous (fseq n)) (hconv : TendstoUniformly fseq f Filter.atTop) : Continuous f

Lean source

Helper for Example 3.4.3: the unit interval subtype is nonempty.

lemma helperForExample_3_4_3_not_isEmpty_unitIntervalSubtype : ¬ IsEmpty unitIntervalSubtype

Lean source

Helper for Example 3.4.3: the distance between 2x and 3x is x on [0,1].

lemma helperForExample_3_4_3_dist_double_triple : ∀ x : unitIntervalSubtype, dist ((2:ℝ) * x.1) ((3:ℝ) * x.1) = x.1

Lean source

Helper for Example 3.4.3: the range of the coercion from [0,1] is Set.Icc 0 1.

lemma helperForExample_3_4_3_range_coe_unitIntervalSubtype : Set.range (fun x : unitIntervalSubtype => x.1) = Set.Icc (0:ℝ) 1

Lean source

Helper for Proposition 3.4.4: the range of pointwise distances is bounded above.

lemma helperForProposition_3_4_4_bddAbove_dist_range {X Y : Type*} [MetricSpace Y] (f g : {f : X → Y // f ∈ boundedFunctionSpace X Y}) : BddAbove (Set.range (fun x : X => dist (f.1 x) (g.1 x)))

Lean source

Helper for Proposition 3.4.4: each pointwise distance is bounded by the uniform metric.

lemma helperForProposition_3_4_4_dist_le_uniformSupMetric {X Y : Type*} [MetricSpace Y] (hX : ¬ IsEmpty X) (f g : {f : X → Y // f ∈ boundedFunctionSpace X Y}) (x : X) : dist (f.1 x) (g.1 x) ≤ uniformSupMetric X Y f g

Lean source

Helper for Proposition 3.4.4: a uniform pointwise bound controls the uniform metric.

lemma helperForProposition_3_4_4_uniformSupMetric_le_of_forall_dist_le {X Y : Type*} [MetricSpace Y] (hX : ¬ IsEmpty X) (f g : {f : X → Y // f ∈ boundedFunctionSpace X Y}) (R : ℝ) (hR : ∀ x : X, dist (f.1 x) (g.1 x) ≤ R) : uniformSupMetric X Y f g ≤ R

Lean source

Helper for Proposition 3.4.4: the uniform metric is nonnegative.

lemma helperForProposition_3_4_4_uniformSupMetric_nonneg {X Y : Type*} [MetricSpace Y] (f g : {f : X → Y // f ∈ boundedFunctionSpace X Y}) : 0 ≤ uniformSupMetric X Y f g

3.5 — Series of Functions; the Weierstrass M-Test

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Definition 3.8: (Finite sum of real-valued functions) Let (X,d_X) be a metric space and let f^{(1)},...,f^{(N)} : X -> Real. The finite sum sum_{i=1}^N f^{(i)} : X -> Real is defined by (sum_{i=1}^N f^{(i)})(x) = sum_{i=1}^N f^{(i)}(x).

def finiteSumRealFunctions {X : Type*} {N : ℕ} (f : Fin N → X → Real) : X → Real := fun x => Finset.univ.sum (fun i => f i x)

Lean source

The family of three functions x, x^2, and x^3 indexed by Fin 3.

def example351_fi : Fin 3 → ℝ → ℝ := ![(fun x : ℝ => x), (fun x : ℝ => x ^ 2), (fun x : ℝ => x ^ 3)]

Lean source

Example 3.5.1: Let f^{(1)}(x) = x, f^{(2)}(x) = x^2, and f^{(3)}(x) = x^3. Define f := ∑_{i=1}^3 f^{(i)}, so that f(x) = x + x^2 + x^3.

def example351_f : ℝ → ℝ := finiteSumRealFunctions example351_fi

Lean source

The finite sum of example351_fi evaluates to x + x^2 + x^3.

lemma example351_f_apply (x : ℝ) : example351_f x = x + x ^ 2 + x ^ 3

Lean source

Text 3.5.2: [Finite sums of bounded functions are bounded] Let X be a nonempty set and let (Y, d_Y) be a metric space, with Y a normed vector space and d_Y(u,v)=‖u-v‖. If f^{(1)}, …, f^{(n)} ∈ B(X → Y), then the pointwise sum f(x)=∑_{i=1}^n f^{(i)}(x) is bounded, hence f ∈ B(X → Y).

theorem finiteSum_boundedFunctions {X Y : Type*} [Nonempty X] [NormedAddCommGroup Y] [NormedSpace ℝ Y] {n : ℕ} (f : Fin n → X → Y) (hfb : ∀ i, ∃ y0 : Y, ∃ M : ℝ, ∀ x : X, dist (f i x) y0 ≤ M) : ∃ y0 : Y, ∃ M : ℝ, ∀ x : X, dist (Finset.univ.sum (fun i => f i x)) y0 ≤ M

Lean source

Text 3.5.3: [Finite sums of continuous functions are continuous] Let (X, d_X) be a metric space and let Y be a normed vector space (with its metric). If f^{(1)}, …, f^{(n)} : X → Y are continuous, then f := ∑_{i=1}^n f^{(i)} is continuous.

theorem finiteSum_continuousFunctions {X Y : Type*} [MetricSpace X] [NormedAddCommGroup Y] [NormedSpace ℝ Y] {n : ℕ} (f : Fin n → X → Y) (hfc : ∀ i, Continuous (f i)) : Continuous (fun x => Finset.univ.sum (fun i => f i x))

Lean source

Convergence mode for a series of functions: pointwise or uniform.

inductive SeriesConvergenceMode | pointwise | uniform

Lean source

Partial sum function S_N(x) = ∑_{n=1}^N f^{(n)}(x).

def seriesPartialSum {X : Type*} (f : ℕ → X → ℝ) (N : ℕ) : X → ℝ := fun x => (Finset.Icc 1 N).sum (fun n => f n x)

Lean source

Definition 3.9: [Infinite series of functions] Let (X,d_X) be a metric space and let (f^{(n)})_{n≥1} be functions f^{(n)} : X → ℝ, with partial sums S_N(x) = ∑_{n=1}^N f^{(n)}(x). Let f : X → ℝ. (i) The series ∑_{n=1}^∞ f^{(n)} converges pointwise to f on X if for every x ∈ X, lim_{N→∞} S_N(x) = f(x). (ii) The series converges uniformly to f on X if S_N → f uniformly on X, i.e. lim_{N→∞} sup_{x∈X} |S_N(x) - f(x)| = 0.

def seriesConverges {X : Type*} [MetricSpace X] (f : ℕ → X → ℝ) (g : X → ℝ) (mode : SeriesConvergenceMode) : Prop := match mode with | SeriesConvergenceMode.pointwise => ∀ x, Filter.Tendsto (fun N => seriesPartialSum f N x) Filter.atTop (nhds (g x)) | SeriesConvergenceMode.uniform => TendstoUniformly (fun N => seriesPartialSum f N) g Filter.atTop

Lean source

A real-valued function on X is bounded if there exists M ≥ 0 with |f x| ≤ M for all x.

def IsBoundedRealFunction {X : Type*} (f : X → ℝ) : Prop := ∃ M : ℝ, 0 ≤ M ∧ ∀ x : X, |f x| ≤ M

Lean source

Definition 3.10: [Sup norm] Let X be a set and let f : X → ℝ be bounded. The sup norm (uniform norm) is ‖f‖∞ = sup { |f(x)| : x ∈ X }, and if X = ∅ then ‖f‖∞ = 0.

noncomputable def supNorm {X : Type*} (f : {f : X → ℝ // IsBoundedRealFunction f}) : ℝ := sSup (Set.range fun x => |f.1 x|)

Lean source

Text 3.5.4: [Finiteness and nonnegativity of the sup norm] Let X be a nonempty set and let f : X → ℝ be bounded. Define ‖f‖∞ := sup_{x∈X} |f(x)|. Then ‖f‖∞ ∈ [0,∞), in particular it is finite and nonnegative.

theorem supNorm_nonneg {X : Type*} [Nonempty X] (f : {f : X → ℝ // IsBoundedRealFunction f}) : 0 ≤ supNorm f

Lean source

Theorem 3.5: [Weierstrass M-test] Let (X,d) be a metric space and let (f^{(n)}) be a sequence of bounded real-valued continuous functions on X. Assume the series ∑ ‖f^{(n)}‖∞ converges. Then the series of functions ∑ f^{(n)} converges uniformly on X to a function f : X → ℝ, and f is continuous on X.

theorem weierstrass_M_test {X : Type*} [MetricSpace X] (f : ℕ → X → ℝ) (hcont : ∀ n, Continuous (f n)) (hbounded : ∀ n, IsBoundedRealFunction (f n)) (hsum : Summable (fun n => supNorm ⟨f n, hbounded n⟩)) : ∃ g : X → ℝ, seriesConverges f g SeriesConvergenceMode.uniform ∧ Continuous g

Lean source

The geometric series term function on (-1,1) given by x ↦ x^n.

def geometricSeriesTermOnIoo (n : ℕ) (x : {x : ℝ // x ∈ Set.Ioo (-1) 1}) : ℝ := (x : ℝ) ^ n

Lean source

The geometric series sum function on (-1,1) given by x ↦ x/(1-x).

noncomputable def geometricSeriesSumOnIoo (x : {x : ℝ // x ∈ Set.Ioo (-1) 1}) : ℝ := (x : ℝ) / (1 - (x : ℝ))

Lean source

Example 3.5.2: Pointwise but not uniform convergence of a geometric series. For f^{(n)}(x) = x^n on (-1,1), the series converges pointwise to x/(1-x), but the convergence is not uniform on (-1,1).

theorem example352_pointwise_not_uniform : seriesConverges geometricSeriesTermOnIoo geometricSeriesSumOnIoo SeriesConvergenceMode.pointwise ∧ ¬ seriesConverges geometricSeriesTermOnIoo geometricSeriesSumOnIoo SeriesConvergenceMode.uniform

Lean source

Proposition 3.17: If a series of functions converges uniformly to f on X, then it converges pointwise to f on X.

theorem seriesConverges_pointwise_of_uniform {X : Type*} [MetricSpace X] (f : ℕ → X → ℝ) (g : X → ℝ) : seriesConverges f g SeriesConvergenceMode.uniform → seriesConverges f g SeriesConvergenceMode.pointwise

Lean source

The interval (-2,1) as a subtype of ℝ.

def example356_X : Type := {x : ℝ // x ∈ Set.Ioo (-2 : ℝ) 1}

Lean source

The function x ↦ 2x on (-2,1).

def example356_f : example356_X → ℝ := fun x => 2 * x.1

Lean source

The function x ↦ 2x on (-2,1) is bounded.

lemma example356_f_bounded : IsBoundedRealFunction example356_f

Lean source

The bounded function x ↦ 2x on (-2,1) packaged for supNorm.

def example356_f_boundedSubtype : {f : example356_X → ℝ // IsBoundedRealFunction f} := ⟨example356_f, example356_f_bounded⟩

Lean source

Pointwise bound for |2x| on (-2,1).

lemma example356_abs_value_le_four (x : example356_X) :

Lean source

A canonical point near -2 that still lies in (-2,1).

lemma example356_delta_point_mem_Ioo (a : ℝ) (ha : a < 4) : let δ : ℝ := min ((4 - a) / 4) 1 (-2 + δ) ∈ Set.Ioo (-2 : ℝ) 1

Lean source

Any level strictly below 4 is exceeded by |2x| at some point of (-2,1).

lemma example356_exists_abs_gt_of_lt_four (a : ℝ) (ha : a < 4) : ∃ x : example356_X, a < |example356_f x|

Lean source

Upper bound ‖x ↦ 2x‖∞ ≤ 4 on (-2,1).

lemma example356_supNorm_le_four : supNorm example356_f_boundedSubtype ≤ 4

Lean source

Example 3.5.6: (Computing the sup norm) For X = (-2,1) and f(x) = 2x, the sup norm ‖f‖∞ = sup_{x∈X} |f(x)| equals 4.

theorem example356_supNorm_eq : supNorm example356_f_boundedSubtype = 4

Lean source

The geometric series term function on [-r,r] given by x ↦ x^n.

def geometricSeriesTermOnIcc (r : ℝ) (n : ℕ) (x : {x : ℝ // x ∈ Set.Icc (-r) r}) : ℝ := (x : ℝ) ^ n

Lean source

The geometric series sum function on [-r,r] given by x ↦ x/(1-x).

noncomputable def geometricSeriesSumOnIcc (r : ℝ) (x : {x : ℝ // x ∈ Set.Icc (-r) r}) : ℝ := (x : ℝ) / (1 - (x : ℝ))

Lean source

Example 3.5.8: [Uniform convergence on [-r,r] for a geometric series] Let 0 < r < 1 and define f^{(n)}(x) = x^n on [-r,r]. Each f^{(n)} is continuous and bounded, with sup norm ‖f^{(n)}‖∞ = r^n. The series ∑ f^{(n)} converges uniformly on [-r,r] to x/(1-x), and ∑ x^n is pointwise but not uniformly convergent on (-1,1).

theorem example358_uniform_convergence_geometric_on_Icc {r : ℝ} (hr0 : 0 < r) (hr1 : r < 1) : (∀ n, Continuous (geometricSeriesTermOnIcc r n)) ∧ (∀ n, IsBoundedRealFunction (geometricSeriesTermOnIcc r n)) ∧ (∀ n, ∃ h : IsBoundedRealFunction (geometricSeriesTermOnIcc r n), supNorm ⟨geometricSeriesTermOnIcc r n, h⟩ = r ^ n) ∧ seriesConverges (geometricSeriesTermOnIcc r) (geometricSeriesSumOnIcc r) SeriesConvergenceMode.uniform ∧ Continuous (geometricSeriesSumOnIcc r) ∧ (seriesConverges geometricSeriesTermOnIoo geometricSeriesSumOnIoo SeriesConvergenceMode.pointwise ∧ ¬ seriesConverges geometricSeriesTermOnIoo geometricSeriesSumOnIoo SeriesConvergenceMode.uniform)

Lean source

Helper for Text 3.5.2: choose centers and bounds for a bounded family.

lemma helperForText_3_5_2_chooseData {X Y : Type*} [Nonempty X] [NormedAddCommGroup Y] [NormedSpace ℝ Y] {n : ℕ} (f : Fin n → X → Y) (hfb : ∀ i, ∃ y0 : Y, ∃ M : ℝ, ∀ x : X, dist (f i x) y0 ≤ M) : ∃ c : Fin n → Y, ∃ B : Fin n → ℝ, ∀ i x, dist (f i x) (c i) ≤ B i

Lean source

Helper for Text 3.5.2: extend a pointwise bound to max (B i) 0.

lemma helperForText_3_5_2_dist_le_maxBound {X Y : Type*} [NormedAddCommGroup Y] [NormedSpace ℝ Y] {n : ℕ} {f : Fin n → X → Y} {c : Fin n → Y} {B : Fin n → ℝ} {i : Fin n} {x : X} (h : dist (f i x) (c i) ≤ B i) : dist (f i x) (c i) ≤ max (B i) 0

Lean source

Helper for Text 3.5.2: dist between sums is bounded by sum of pointwise dists.

lemma helperForText_3_5_2_dist_sum_sum_le {X Y : Type*} [NormedAddCommGroup Y] [NormedSpace ℝ Y] {n : ℕ} (f : Fin n → X → Y) (c : Fin n → Y) (x : X) : dist (Finset.univ.sum (fun i => f i x)) (Finset.univ.sum (fun i => c i)) ≤ Finset.univ.sum (fun i => dist (f i x) (c i))

Lean source

Helper for Text 3.5.2: sum of pointwise dists is bounded by sum of max bounds.

lemma helperForText_3_5_2_sum_dist_le_sum_max {X Y : Type*} [NormedAddCommGroup Y] [NormedSpace ℝ Y] {n : ℕ} (f : Fin n → X → Y) (c : Fin n → Y) (B : Fin n → ℝ) (hcB : ∀ i x, dist (f i x) (c i) ≤ B i) (x : X) : Finset.univ.sum (fun i => dist (f i x) (c i)) ≤ Finset.univ.sum (fun i => max (B i) 0)

Lean source

Helper for Text 3.5.4: bounded above range of absolute values.

lemma helperForText_3_5_4_bddAbove_range_abs {X : Type*} (f : {f : X → ℝ // IsBoundedRealFunction f}) : BddAbove (Set.range (fun x : X => |f.1 x|))

Lean source

Helper for Text 3.5.4: pointwise bound by the sup norm.

lemma helperForText_3_5_4_abs_le_supNorm {X : Type*} (f : {f : X → ℝ // IsBoundedRealFunction f}) (x : X) :

Lean source

Helper for Theorem 3.5: rewrite seriesPartialSum as a Finset.range sum.

lemma helperForTheorem_3_5_seriesPartialSum_eq_sum_range_succ {X : Type*} (f : ℕ → X → ℝ) (N : ℕ) (x : X) : seriesPartialSum f N x = (Finset.range N).sum (fun n => f (n + 1) x)

Lean source

Helper for Theorem 3.5: pointwise norm bound by the sup norm.

lemma helperForTheorem_3_5_norm_le_supNorm {X : Type*} {f0 : X → ℝ} (hbf : IsBoundedRealFunction f0) (x : X) : ‖f0 x‖ ≤ supNorm ⟨f0, hbf⟩

Lean source

Helper for Theorem 3.5: uniform convergence of partial sums to the tsum.

lemma helperForTheorem_3_5_tendstoUniformly_seriesPartialSum_tsum {X : Type*} [MetricSpace X] (f : ℕ → X → ℝ) (hbounded : ∀ n, IsBoundedRealFunction (f n)) (hsum : Summable (fun n => supNorm ⟨f n, hbounded n⟩)) : TendstoUniformly (fun N => seriesPartialSum f N) (fun x => ∑' n, f (n + 1) x) Filter.atTop

Lean source

Helper for Theorem 3.5: continuity of each partial sum.

lemma helperForTheorem_3_5_seriesPartialSum_continuous {X : Type*} [MetricSpace X] (f : ℕ → X → ℝ) (hcont : ∀ n, Continuous (f n)) : ∀ N, Continuous (seriesPartialSum f N)

Lean source

Helper for Example 3.5.2: closed form for the geometric series partial sum on (-1,1).

lemma helperForExample_3_5_2_seriesPartialSum_closedForm (x : {x : ℝ // x ∈ Set.Ioo (-1) 1}) (N : ℕ) : seriesPartialSum geometricSeriesTermOnIoo N x = ((x : ℝ) - (x : ℝ) ^ (N + 1)) / (1 - (x : ℝ))

Lean source

Helper for Example 3.5.2: distance from partial sum to limit in closed form.

lemma helperForExample_3_5_2_dist_to_limit_closedForm (x : {x : ℝ // x ∈ Set.Ioo (-1) 1}) (N : ℕ) : dist (seriesPartialSum geometricSeriesTermOnIoo N x) (geometricSeriesSumOnIoo x) =

Lean source

Helper for Example 3.5.2: pointwise convergence of the geometric series on (-1,1).

lemma helperForExample_3_5_2_pointwiseConvergence : seriesConverges geometricSeriesTermOnIoo geometricSeriesSumOnIoo SeriesConvergenceMode.pointwise

Lean source

Helper for Example 3.5.2: explicit real value x_N = 1 - 1/2^(N+1).

noncomputable def helperForExample_3_5_2_xNValue (N : ℕ) : ℝ := 1 - 1 / (2 : ℝ) ^ (N + 1)

Lean source

Helper for Example 3.5.2: the point x_N is at least 1/2.

lemma helperForExample_3_5_2_xN_ge_half (N : ℕ) : (1 / 2 : ℝ) ≤ helperForExample_3_5_2_xNValue N

Lean source

Helper for Example 3.5.2: the point x_N lies in (-1,1).

lemma helperForExample_3_5_2_xN_mem (N : ℕ) : helperForExample_3_5_2_xNValue N ∈ Set.Ioo (-1) 1

Lean source

Helper for Example 3.5.2: for each N, some point has error at least 1/2.

lemma helperForExample_3_5_2_counterexample_large_error (N : ℕ) : ∃ x : {x : ℝ // x ∈ Set.Ioo (-1) 1}, (1 / 2 : ℝ) ≤ dist (seriesPartialSum geometricSeriesTermOnIoo N x) (geometricSeriesSumOnIoo x)

Lean source

Helper for Example 3.5.8: bound |x| by r on [-r,r].

lemma helperForExample_3_5_8_abs_coe_le_r {r : ℝ} (x : {x : ℝ // x ∈ Set.Icc (-r) r}) :

Lean source

Helper for Example 3.5.8: bound |x^n| by r^n on [-r,r].

lemma helperForExample_3_5_8_abs_pow_le_r_pow {r : ℝ} (n : ℕ) (x : {x : ℝ // x ∈ Set.Icc (-r) r}) :

Lean source

Helper for Example 3.5.8: compute ‖x ↦ x^n‖∞ on [-r,r].

lemma helperForExample_3_5_8_supNorm_term_eq_r_pow {r : ℝ} (hr0 : 0 < r) (n : ℕ) (h : IsBoundedRealFunction (geometricSeriesTermOnIcc r n)) : supNorm ⟨geometricSeriesTermOnIcc r n, h⟩ = r ^ n

Lean source

Helper for Example 3.5.8: shifted geometric series on |x| < 1.

lemma helperForExample_3_5_8_tsum_pow_succ_eq_div {x : ℝ} (hx : |x| < 1) : (∑' n : ℕ, x ^ (n + 1)) = x / (1 - x)

3.6 — Uniform Convergence and Integration

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Theorem 3.6: Let a < b be real numbers. For each integer n ≥ 1, let f^{(n)} : [a,b] → ℝ be Riemann integrable, and assume that f^{(n)} → f uniformly on [a,b]. Then f is Riemann integrable and lim_{n→∞} ∫_{[a,b]} f^{(n)} = ∫_{[a,b]} f.

open scoped Topology open scoped Interval theorem uniformLimit_intervalIntegral {a b : ℝ} (_hab : a < b) {fseq : ℕ → ℝ → ℝ} {f : ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) (h_unif : TendstoUniformlyOn fseq f Filter.atTop (Set.Icc a b)) : IntervalIntegrable f (μ := MeasureTheory.volume) a b ∧ Filter.Tendsto (fun n => ∫ x in a..b, fseq n x) Filter.atTop (𝓝 (∫ x in a..b, f x))

Lean source

Theorem 3.7: [Interchange of limit and integral under uniform convergence] Let [a,b] be a compact interval in ℝ. If f^{(n)} are Riemann-integrable on [a,b] and converge uniformly to f on [a,b], then f is Riemann-integrable and lim_{n→∞} ∫_a^b f^{(n)} = ∫_a^b f.

open scoped Topology open scoped Interval theorem uniformLimit_intervalIntegral_interchange {a b : ℝ} (_hab : a ≤ b) {fseq : ℕ → ℝ → ℝ} {f : ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) (h_unif : TendstoUniformlyOn fseq f Filter.atTop (Set.Icc a b)) : IntervalIntegrable f (μ := MeasureTheory.volume) a b ∧ Filter.Tendsto (fun n => ∫ x in a..b, fseq n x) Filter.atTop (𝓝 (∫ x in a..b, f x))

Lean source

Theorem 3.8: Let a < b and let f^{(n)} be Riemann-integrable on [a,b]. Assume the series ∑ f^{(n)}(x) converges uniformly on [a,b] to s(x). Then s is Riemann-integrable on [a,b] and ∫_{[a,b]} s = ∑_{n=1}^∞ ∫_{[a,b]} f^{(n)}.

open scoped Topology open scoped Interval theorem uniformSeries_intervalIntegral {a b : ℝ} (hab : a < b) {fseq : ℕ → ℝ → ℝ} {s : ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) (h_unif : TendstoUniformlyOn (fun n x => (Finset.range n).sum (fun i => fseq i x)) s Filter.atTop (Set.Icc a b)) : IntervalIntegrable s (μ := MeasureTheory.volume) a b ∧ HasSum (fun n => ∫ x in a..b, fseq n x) (∫ x in a..b, s x) (L := SummationFilter.conditional ℕ)

Lean source

Example 3.6.3 : For every real number r with 0 < r < 1, the identity -log(1-r) = ∑_{n=0}^∞ r^{n+1}/(n+1) holds.

open scoped Topology open scoped Interval theorem log_one_sub_eq_tsum_power_div {r : ℝ} (hr0 : 0 < r) (hr1 : r < 1) : -Real.log (1 - r) = ∑' n : ℕ, r ^ (n + 1) / (n + 1)

Lean source

Helper for Theorem 3.6: uniform convergence on Set.Icc gives a uniform bound on Set.uIoc.

open scoped Topology open scoped Interval lemma helperForTheorem_3_6_eventually_norm_sub_le_on_uIoc {a b : ℝ} (hab : a < b) {fseq : ℕ → ℝ → ℝ} {f : ℝ → ℝ} (h_unif : TendstoUniformlyOn fseq f Filter.atTop (Set.Icc a b)) : ∀ ε > 0, ∀ᶠ n in Filter.atTop, ∀ x ∈ Set.uIoc a b, ‖fseq n x - f x‖ ≤ ε

Lean source

Helper for Theorem 3.6: almost everywhere pointwise convergence on Set.uIoc.

open scoped Topology open scoped Interval lemma helperForTheorem_3_6_ae_tendsto_on_uIoc {a b : ℝ} (hab : a < b) {fseq : ℕ → ℝ → ℝ} {f : ℝ → ℝ} (h_unif : TendstoUniformlyOn fseq f Filter.atTop (Set.Icc a b)) : ∀ᵐ x ∂(MeasureTheory.volume.restrict (Set.uIoc a b)), Filter.Tendsto (fun n => fseq n x) Filter.atTop (𝓝 (f x))

Lean source

Helper for Theorem 3.6: the uniform limit is interval integrable.

open scoped Topology open scoped Interval lemma helperForTheorem_3_6_intervalIntegrable_limit {a b : ℝ} (hab : a < b) {fseq : ℕ → ℝ → ℝ} {f : ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) (h_unif : TendstoUniformlyOn fseq f Filter.atTop (Set.Icc a b)) : IntervalIntegrable f (μ := MeasureTheory.volume) a b

Lean source

Helper for Theorem 3.6: convergence of interval integrals under uniform convergence.

open scoped Topology open scoped Interval lemma helperForTheorem_3_6_tendsto_intervalIntegral {a b : ℝ} (hab : a < b) {fseq : ℕ → ℝ → ℝ} {f : ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) (h_unif : TendstoUniformlyOn fseq f Filter.atTop (Set.Icc a b)) (hf_int : IntervalIntegrable f (μ := MeasureTheory.volume) a b) : Filter.Tendsto (fun n => ∫ x in a..b, fseq n x) Filter.atTop (𝓝 (∫ x in a..b, f x))

Lean source

Helper for Theorem 3.8: partial sums are interval integrable.

open scoped Topology open scoped Interval lemma helperForTheorem_3_8_intervalIntegrable_partialSums {a b : ℝ} {fseq : ℕ → ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) : ∀ n, IntervalIntegrable (fun x => (Finset.range n).sum (fun i => fseq i x)) (μ := MeasureTheory.volume) a b

Lean source

Helper for Theorem 3.8: interval integral of a partial sum is the sum of integrals.

open scoped Topology open scoped Interval lemma helperForTheorem_3_8_intervalIntegral_partialSums {a b : ℝ} {fseq : ℕ → ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) : ∀ n, (∫ x in a..b, (Finset.range n).sum (fun i => fseq i x)) = (Finset.range n).sum (fun i => ∫ x in a..b, fseq i x)

Lean source

Helper for Theorem 3.8: rewrite Tendsto after identifying two sequences.

open scoped Topology open scoped Interval lemma helperForTheorem_3_8_tendsto_integral_partials {a b : ℝ} {fseq : ℕ → ℝ → ℝ} {s : ℝ → ℝ} {partials : ℕ → ℝ → ℝ} (hrewrite : ∀ n, (∫ x in a..b, partials n x) = (Finset.range n).sum (fun i => ∫ x in a..b, fseq i x)) (htend : Filter.Tendsto (fun n => ∫ x in a..b, partials n x) Filter.atTop (𝓝 (∫ x in a..b, s x))) : Filter.Tendsto (fun n => (Finset.range n).sum (fun i => ∫ x in a..b, fseq i x)) Filter.atTop (𝓝 (∫ x in a..b, s x))

Lean source

Helper for Theorem 3.8: convert Tendsto of range partial sums to conditional HasSum.

open scoped Topology open scoped Interval lemma helperForTheorem_3_8_hasSumConditional_of_tendsto_range {g : ℕ → ℝ} {L : ℝ} (h : Filter.Tendsto (fun n => (Finset.range n).sum g) Filter.atTop (𝓝 L)) : HasSum g L (L := SummationFilter.conditional ℕ)

Lean source

Helper for Theorem 3.8: conditional summation of integrals from uniform convergence.

open scoped Topology open scoped Interval lemma helperForTheorem_3_8_intervalIntegral_hasSumConditional {a b : ℝ} (hab : a < b) {fseq : ℕ → ℝ → ℝ} {s : ℝ → ℝ} (h_integrable : ∀ n, IntervalIntegrable (fseq n) (μ := MeasureTheory.volume) a b) (h_unif : TendstoUniformlyOn (fun n x => (Finset.range n).sum (fun i => fseq i x)) s Filter.atTop (Set.Icc a b)) : IntervalIntegrable s (μ := MeasureTheory.volume) a b ∧ HasSum (fun n => ∫ x in a..b, fseq n x) (∫ x in a..b, s x) (L := SummationFilter.conditional ℕ)

Lean source

Helper for Theorem 3.8: upgrade conditional HasSum to unconditional under unconditional summability.

open scoped Topology open scoped Interval lemma helperForTheorem_3_8_hasSum_of_summable_unconditional {f : ℕ → ℝ} {L : ℝ} (h_cond : HasSum f L (L := SummationFilter.conditional ℕ)) (h_summable : Summable f) : HasSum f L

Lean source

Helper for Example 3.6.3 : the series ∑ r^n / n sums to -log(1-r) for 0 < r < 1.

open scoped Topology open scoped Interval lemma helperForExample_3_6_3_hasSum_power_div {r : ℝ} (hr0 : 0 < r) (hr1 : r < 1) : HasSum (fun n : ℕ ↦ r ^ n / n) (-Real.log (1 - r))

Lean source

Helper for Example 3.6.3 : shift the index in ∑ r^n / n.

open scoped Topology open scoped Interval lemma helperForExample_3_6_3_tsum_shift_pow_div {r : ℝ} (h : Summable (fun n : ℕ ↦ r ^ n / n)) : (∑' n : ℕ, r ^ (n + 1) / (n + 1)) = ∑' n : ℕ, r ^ n / n

3.7 — Uniform Convergence and Derivatives — Part 1

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

The sequence of functions f_n(x) = n^{-1/2} sin(n x) on ℝ.

noncomputable def sinScaledSeq (n : ℕ) (x : ℝ) : ℝ := (Real.sqrt (n : ℝ))⁻¹ * Real.sin ((n : ℝ) * x)

Lean source

The constant zero function on ℝ.

def sinScaledLimit : ℝ → ℝ := fun _ => 0

Lean source

Proposition 3.19: for f_n(x) = n^{-1/2} sin(n x) on [0, 2π] and f(x)=0, (f_n) converges uniformly to f on [0, 2π], but (f_n') does not converge pointwise to f' (hence not uniformly); in particular, d/dx (lim f_n) ≠ lim (d/dx f_n).

theorem proposition_3_19 : TendstoUniformlyOn sinScaledSeq sinScaledLimit Filter.atTop (Set.Icc (0 : ℝ) (2 * Real.pi)) ∧ ¬ (∀ x ∈ Set.Icc (0 : ℝ) (2 * Real.pi), Filter.Tendsto (fun n => deriv (sinScaledSeq n) x) Filter.atTop (nhds (deriv sinScaledLimit x))) ∧ ¬ TendstoUniformlyOn (fun n x => deriv (sinScaledSeq n) x) (fun x => deriv sinScaledLimit x) Filter.atTop (Set.Icc (0 : ℝ) (2 * Real.pi))

Lean source

The sequence of functions f_n(x) = sqrt(1/n^2 + x^2) on ℝ.

noncomputable def sqrtShiftedSeq (n : ℕ) (x : ℝ) : ℝ := Real.sqrt (1 / (n : ℝ) ^ 2 + x ^ 2)

Lean source

The absolute value function on ℝ.

def absFun : ℝ → ℝ := fun x => |x|

Lean source

Proposition 3.20: define f_n(x) = sqrt(1/n^2 + x^2) and f(x)=|x|. Then f_n converges uniformly to f on [-1,1], each f_n (for n ≥ 1) is differentiable on [-1,1], and f is not differentiable at 0; in particular, a uniform limit of differentiable functions need not be differentiable.

theorem proposition_3_20 : TendstoUniformlyOn sqrtShiftedSeq absFun Filter.atTop (Set.Icc (-1 : ℝ) 1) ∧ (∀ n, 1 ≤ n → DifferentiableOn ℝ (sqrtShiftedSeq n) (Set.Icc (-1 : ℝ) 1)) ∧ ¬ DifferentiableAt ℝ absFun 0

Lean source

Theorem 3.9: if f_n : [a,b] → ℝ are differentiable with continuous derivatives, f_n' converges uniformly to g on [a,b], and f_n(x0) converges for some x0 ∈ [a,b], then there is a differentiable f : [a,b] → ℝ with f_n → f uniformly on [a,b] and f' = g on [a,b].

theorem uniformLimit_of_uniformlyConvergentDerivatives {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (g : ℝ → ℝ) (h_diff : ∀ n, 1 ≤ n → DifferentiableOn ℝ (f n) (Set.Icc a b)) (h_diff_cont : ∀ n, 1 ≤ n → ContinuousOn (fun x => deriv (f n) x) (Set.Icc a b)) (h_unif : TendstoUniformlyOn (fun n x => deriv (f n) x) g Filter.atTop (Set.Icc a b)) (hx0 : ∃ x0 ∈ Set.Icc a b, ∃ l, Filter.Tendsto (fun n => f n x0) Filter.atTop (nhds l)) : ∃ f_lim : ℝ → ℝ, DifferentiableOn ℝ f_lim (Set.Icc a b) ∧ TendstoUniformlyOn f f_lim Filter.atTop (Set.Icc a b) ∧ ∀ x ∈ Set.Icc a b, deriv f_lim x = g x

Lean source

The sup norm of a function on a set, defined as the supremum of ‖f x‖ over the set.

noncomputable def supNormOn {α β : Type*} [NormedAddCommGroup β] (s : Set α) (f : α → β) : ℝ := sSup ((fun x => ‖f x‖) '' s)

Lean source

Helper for Proposition 3.19: for any ε>0, eventually 1/√n < ε.

lemma helperForProposition_3_19_eventually_inv_sqrt_lt {ε : ℝ} (hε : 0 < ε) : ∀ᶠ n : ℕ in Filter.atTop, (Real.sqrt (n : ℝ))⁻¹ < ε

Lean source

Helper for Proposition 3.19: uniform bound for the scaled sine sequence.

lemma helperForProposition_3_19_norm_sinScaledSeq_le_inv_sqrt (n : ℕ) (x : ℝ) : ‖sinScaledSeq n x - sinScaledLimit x‖ ≤ (Real.sqrt (n : ℝ))⁻¹

Lean source

Helper for Proposition 3.19: derivative of the scaled sine sequence.

lemma helperForProposition_3_19_deriv_sinScaledSeq (n : ℕ) (x : ℝ) : deriv (sinScaledSeq n) x = (Real.sqrt (n : ℝ))⁻¹ * (Real.cos ((n : ℝ) * x) * (n : ℝ))

Lean source

Helper for Proposition 3.19: the derivatives at 0 do not converge to the derivative of the limit.

lemma helperForProposition_3_19_not_tendsto_deriv_at_zero : ¬ Filter.Tendsto (fun n : ℕ => deriv (sinScaledSeq n) 0) Filter.atTop (nhds (deriv sinScaledLimit 0))

Lean source

Helper for Proposition 3.20: at n = 0, the sequence equals the absolute value.

lemma helperForProposition_3_20_sqrtShiftedSeq_zero_eq_absFun : sqrtShiftedSeq 0 = absFun

Lean source

Helper for Proposition 3.20: absFun is not differentiable at 0.

lemma helperForProposition_3_20_not_differentiableAt_absFun_zero : ¬ DifferentiableAt ℝ absFun 0

Lean source

Helper for Proposition 3.20: Set.Icc (-1) 1 is a neighborhood of 0.

lemma helperForProposition_3_20_Icc_mem_nhds_zero : Set.Icc (-1 : ℝ) 1 ∈ nhds (0 : ℝ)

Lean source

Helper for Proposition 3.20: absFun is not differentiable on [-1,1].

lemma helperForProposition_3_20_not_differentiableOn_absFun_Icc : ¬ DifferentiableOn ℝ absFun (Set.Icc (-1 : ℝ) 1)

Lean source

Helper for Proposition 3.20: the sequence is not differentiable on [-1,1] at n = 0.

lemma helperForProposition_3_20_not_differentiableOn_sqrtShiftedSeq_zero : ¬ DifferentiableOn ℝ (sqrtShiftedSeq 0) (Set.Icc (-1 : ℝ) 1)

Lean source

Helper for Proposition 3.20: the full differentiability claim over all n is false.

lemma helperForProposition_3_20_not_forall_differentiableOn : ¬ (∀ n, DifferentiableOn ℝ (sqrtShiftedSeq n) (Set.Icc (-1 : ℝ) 1))

Lean source

Helper for Proposition 3.20: for any ε>0, eventually 1/n < ε.

lemma helperForProposition_3_20_eventually_inv_lt {ε : ℝ} (hε : 0 < ε) : ∀ᶠ n : ℕ in Filter.atTop, (n : ℝ)⁻¹ < ε

Lean source

Helper for Proposition 3.20: for any ε>0, eventually (n+1)⁻¹ < ε.

lemma helperForProposition_3_20_eventually_inv_succ_lt {ε : ℝ} (hε : 0 < ε) : ∀ᶠ n : ℕ in Filter.atTop, ((n + 1 : ℝ)⁻¹ < ε)

Lean source

Helper for Proposition 3.20: uniform bound for the shifted square-root sequence.

lemma helperForProposition_3_20_norm_sqrtShiftedSeq_sub_absFun_le_inv (n : ℕ) (x : ℝ) : ‖sqrtShiftedSeq n x - absFun x‖ ≤ (n : ℝ)⁻¹

Lean source

Helper for Proposition 3.20: the inner expression is nonzero for n ≥ 1.

lemma helperForProposition_3_20_inner_ne_zero_of_one_le (n : ℕ) (hn : 1 ≤ n) (x : ℝ) : (1 / (n : ℝ) ^ 2 + x ^ 2) ≠ 0

Lean source

Helper for Proposition 3.20: differentiability of sqrtShiftedSeq for n ≥ 1.

lemma helperForProposition_3_20_differentiableAt_sqrtShiftedSeq_of_one_le (n : ℕ) (hn : 1 ≤ n) (x : ℝ) : DifferentiableAt ℝ (sqrtShiftedSeq n) x

Lean source

Helper for Proposition 3.20: differentiability on [-1,1] for n ≥ 1.

lemma helperForProposition_3_20_differentiableOn_sqrtShiftedSeq_of_one_le (n : ℕ) (hn : 1 ≤ n) : DifferentiableOn ℝ (sqrtShiftedSeq n) (Set.Icc (-1 : ℝ) 1)

Lean source

Helper for Proposition 3.20: differentiability on [-1,1] for n + 1.

lemma helperForProposition_3_20_differentiableOn_sqrtShiftedSeq_succ (n : ℕ) : DifferentiableOn ℝ (sqrtShiftedSeq (n + 1)) (Set.Icc (-1 : ℝ) 1)

Lean source

Helper for Theorem 3.9: g is continuous on [a,b] as a uniform limit of continuous derivatives on [a,b].

lemma helperForTheorem_3_9_continuousOn_g_Icc {a b : ℝ} (f : ℕ → ℝ → ℝ) (g : ℝ → ℝ) (h_diff_cont : ∀ n, 1 ≤ n → ContinuousOn (fun x => deriv (f n) x) (Set.Icc a b)) (h_unif : TendstoUniformlyOn (fun n x => deriv (f n) x) g Filter.atTop (Set.Icc a b)) : ContinuousOn g (Set.Icc a b)

Lean source

Helper for Theorem 3.9: any two points of [a,b] are at distance at most b - a.

lemma helperForTheorem_3_9_abs_sub_le_interval_length {a b x x0 : ℝ} (ha : a ≤ b) (hx : x ∈ Set.Icc a b) (hx0 : x0 ∈ Set.Icc a b) :

Lean source

Helper for Theorem 3.9: for n ≥ 1, f_n x - f_n x0 is the integral of f_n' between x0 and x.

lemma helperForTheorem_3_9_sub_eq_integral_deriv {a b : ℝ} (f : ℕ → ℝ → ℝ) (h_diff : ∀ n, 1 ≤ n → DifferentiableOn ℝ (f n) (Set.Icc a b)) (h_diff_cont : ∀ n, 1 ≤ n → ContinuousOn (fun x => deriv (f n) x) (Set.Icc a b)) {n : ℕ} (hn : 1 ≤ n) {x0 x : ℝ} (hx0 : x0 ∈ Set.Icc a b) (hx : x ∈ Set.Icc a b) : f n x - f n x0 = ∫ t in x0..x, deriv (f n) t

Lean source

Helper for Theorem 3.9: uniform derivative bounds on [a,b] control the integral error term uniformly on x ∈ [a,b].

lemma helperForTheorem_3_9_integral_error_bound_on_uIcc {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (g gExt : ℝ → ℝ) {n : ℕ} {x0 x δ : ℝ} (h_gExt_eq : ∀ t ∈ Set.Icc a b, gExt t = g t) (h_bound : ∀ t ∈ Set.Icc a b, ‖deriv (f n) t - g t‖ ≤ δ) (hδ_nonneg : 0 ≤ δ) (hx0 : x0 ∈ Set.Icc a b) (hx : x ∈ Set.Icc a b) : ‖∫ t in x0..x, (deriv (f n) t - gExt t)‖ ≤ δ * (b - a)

Lean source

Helper for Theorem 3.9: the distance from f_n x to the candidate limit value is bounded by the basepoint error and an integral error term.

lemma helperForTheorem_3_9_dist_bound_fn_to_flim {a b : ℝ} (f : ℕ → ℝ → ℝ) (gExt : ℝ → ℝ) (h_diff : ∀ n, 1 ≤ n → DifferentiableOn ℝ (f n) (Set.Icc a b)) (h_diff_cont : ∀ n, 1 ≤ n → ContinuousOn (fun x => deriv (f n) x) (Set.Icc a b)) {n : ℕ} (hn : 1 ≤ n) {x0 x l : ℝ} (hx0 : x0 ∈ Set.Icc a b) (hx : x ∈ Set.Icc a b) (h_int_gExt : IntervalIntegrable gExt MeasureTheory.volume x0 x) : dist (f n x) (l + ∫ t in x0..x, gExt t) ≤ dist (f n x0) l + ‖∫ t in x0..x, (deriv (f n) t - gExt t)‖

Lean source

Helper for Theorem 3.10: a pointwise derivative norm on [a,b] is bounded by the corresponding sup norm.

lemma helperForTheorem_3_10_norm_deriv_le_supNormOn {a b : ℝ} (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (n : ℕ) {x : ℝ} (hx : x ∈ Set.Icc a b) : ‖deriv (f (n + 1)) x‖ ≤ supNormOn (Set.Icc a b) (fun y => deriv (f (n + 1)) y)

Lean source

Helper for Theorem 3.10: derivative partial sums converge uniformly on [a,b] to the termwise derivative series.

lemma helperForTheorem_3_10_tendstoUniformlyOn_derivSeries {a b : ℝ} (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (h_summable : Summable (fun n : ℕ => supNormOn (Set.Icc a b) (fun x => deriv (f (n + 1)) x))) : TendstoUniformlyOn (fun N x => (Finset.range N).sum (fun n => deriv (f (n + 1)) x)) (fun x => tsum (fun n : ℕ => deriv (f (n + 1)) x)) Filter.atTop (Set.Icc a b)

Lean source

Helper for Theorem 3.10: lifted partial sums based at x0, built from an integral of the IccExtend of derivative partial sums.

noncomputable def helperForTheorem_3_10_liftedPartialSum {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (x0 : ℝ) (N : ℕ) : ℝ → ℝ := fun x => (Finset.range N).sum (fun n => f (n + 1) x0) + ∫ t in x0..x, Set.IccExtend ha (fun y : Set.Icc a b => (Finset.range N).sum (fun n => deriv (f (n + 1)) y)) t

Lean source

Helper for Theorem 3.10: continuity of the subtype derivative partial-sum map.

lemma helperForTheorem_3_10_continuous_subtype_derivPartialSum {a b : ℝ} (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (N : ℕ) : Continuous (fun y : Set.Icc a b => (Finset.range N).sum (fun n => deriv (f (n + 1)) y))

Lean source

Helper for Theorem 3.10: the lifted partial sum has derivative equal to the corresponding IccExtend derivative partial sum.

lemma helperForTheorem_3_10_hasDerivAt_liftedPartialSum {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (x0 : ℝ) (N : ℕ) (x : ℝ) : HasDerivAt (helperForTheorem_3_10_liftedPartialSum ha f x0 N) (Set.IccExtend ha (fun y : Set.Icc a b => (Finset.range N).sum (fun n => deriv (f (n + 1)) y)) x) x

Lean source

Helper for Theorem 3.10: explicit formula for the derivative of a lifted partial sum.

lemma helperForTheorem_3_10_deriv_liftedPartialSum {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (x0 : ℝ) (N : ℕ) (x : ℝ) : deriv (helperForTheorem_3_10_liftedPartialSum ha f x0 N) x = Set.IccExtend ha (fun y : Set.Icc a b => (Finset.range N).sum (fun n => deriv (f (n + 1)) y)) x

Lean source

Helper for Theorem 3.10: on [a,b], the derivative of the lifted partial sum equals the raw derivative partial sum.

lemma helperForTheorem_3_10_deriv_liftedPartialSum_on_Icc {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (x0 : ℝ) (N : ℕ) {x : ℝ} (hx : x ∈ Set.Icc a b) : deriv (helperForTheorem_3_10_liftedPartialSum ha f x0 N) x = (Finset.range N).sum (fun n => deriv (f (n + 1)) x)

Lean source

Helper for Theorem 3.10: each lifted partial sum is differentiable on [a,b].

lemma helperForTheorem_3_10_differentiableOn_liftedPartialSum {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (x0 : ℝ) (N : ℕ) : DifferentiableOn ℝ (helperForTheorem_3_10_liftedPartialSum ha f x0 N) (Set.Icc a b)

Lean source

Helper for Theorem 3.10: the derivative of each lifted partial sum is continuous on [a,b].

lemma helperForTheorem_3_10_continuousOn_deriv_liftedPartialSum {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (x0 : ℝ) (N : ℕ) : ContinuousOn (fun x => deriv (helperForTheorem_3_10_liftedPartialSum ha f x0 N) x) (Set.Icc a b)

Lean source

Helper for Theorem 3.10: on [a,b], each lifted partial sum coincides with the corresponding raw partial sum of f.

lemma helperForTheorem_3_10_lifted_eq_rawPartialSum_on_Icc {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (h_diff : ∀ n : ℕ, DifferentiableOn ℝ (f (n + 1)) (Set.Icc a b)) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) {x0 x : ℝ} (hx0 : x0 ∈ Set.Icc a b) (hx : x ∈ Set.Icc a b) (N : ℕ) : helperForTheorem_3_10_liftedPartialSum ha f x0 N x = (Finset.range N).sum (fun n => f (n + 1) x)

3.7 — Uniform Convergence and Derivatives — Part 2

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Theorem 3.10: if f_n : [a,b] → ℝ are differentiable with continuous derivatives, the series ∑ ‖f_n'‖∞ (equation (3.u126)) is convergent, and ∑ f_n(x0) converges for some x0 ∈ [a,b], then the series ∑ f_n converges uniformly on [a,b] to a differentiable function f, and for all x ∈ [a,b] one has equation (3.u127): f'(x) = d/dx (∑ f_n(x)) = ∑ f_n'(x).

theorem uniformLimit_of_summable_deriv_supNorm {a b : ℝ} (ha : a ≤ b) (f : ℕ → ℝ → ℝ) (h_diff : ∀ n : ℕ, DifferentiableOn ℝ (f (n + 1)) (Set.Icc a b)) (h_diff_cont : ∀ n : ℕ, ContinuousOn (fun x => deriv (f (n + 1)) x) (Set.Icc a b)) (h_summable : Summable (fun n : ℕ => supNormOn (Set.Icc a b) (fun x => deriv (f (n + 1)) x))) (hx0 : ∃ x0 ∈ Set.Icc a b, Summable (fun n : ℕ => f (n + 1) x0)) : ∃ f_lim : ℝ → ℝ, DifferentiableOn ℝ f_lim (Set.Icc a b) ∧ TendstoUniformlyOn (fun N x => (Finset.range N).sum (fun n => f (n + 1) x)) f_lim Filter.atTop (Set.Icc a b) ∧ ∀ x ∈ Set.Icc a b, deriv f_lim x = tsum (fun n : ℕ => deriv (f (n + 1)) x)

Lean source

Definition 3.11: the Weierstrass function f : ℝ → ℝ defined by f(x) = ∑_{n=1}^{∞} 4^{-n} cos(32^n π x).

noncomputable def weierstrassFunction (x : ℝ) : ℝ := ∑' n : ℕ, ((4 : ℝ) ^ (n + 1))⁻¹ * Real.cos (((32 : ℝ) ^ (n + 1)) * Real.pi * x)

Lean source

Proposition 3.21: the Weierstrass function f of Definition 3.11 is continuous on ℝ.

theorem proposition_3_21 : Continuous weierstrassFunction

Lean source

Proposition 3.22: the Weierstrass function f of Definition 3.11 is nowhere differentiable on ℝ, i.e., for every x ∈ ℝ the limit lim_{h→0} (f(x+h)-f(x))/h does not exist.

theorem proposition_3_22 : ∀ x : ℝ, ¬ DifferentiableAt ℝ weierstrassFunction x

Lean source

Helper for Proposition 3.21: each Weierstrass summand is continuous.

lemma helperForProposition_3_21_termContinuous (n : ℕ) : Continuous (fun x : ℝ => ((4 : ℝ) ^ (n + 1))⁻¹ * Real.cos (((32 : ℝ) ^ (n + 1)) * Real.pi * x))

Lean source

Helper for Proposition 3.21: rewrite Weierstrass coefficients as geometric powers.

lemma helperForProposition_3_21_coeffRewrite (n : ℕ) : ((4 : ℝ) ^ (n + 1))⁻¹ = (1 / 4 : ℝ) ^ (n + 1)

Lean source

Helper for Proposition 3.21: the geometric majorant for Weierstrass coefficients is summable.

lemma helperForProposition_3_21_majorantSummable : Summable (fun n : ℕ => (1 / 4 : ℝ) ^ (n + 1))

Lean source

Helper for Proposition 3.21: each Weierstrass summand is bounded by the geometric majorant.

lemma helperForProposition_3_21_termNormBound (n : ℕ) (x : ℝ) : ‖((4 : ℝ) ^ (n + 1))⁻¹ * Real.cos (((32 : ℝ) ^ (n + 1)) * Real.pi * x)‖ ≤ (1 / 4 : ℝ) ^ (n + 1)

Lean source

Helper for Proposition 3.22: quarter-turn cosine increments at a phase θ rewrite in terms of sin θ and cos θ.

lemma helperForProposition_3_22_cosQuarterTurns (θ : ℝ) : (Real.cos (θ + Real.pi / 2) - Real.cos θ = -(Real.sin θ + Real.cos θ)) ∧ (Real.cos (θ + 3 * Real.pi / 2) - Real.cos θ = Real.sin θ - Real.cos θ)

Lean source

Helper for Proposition 3.22: for every phase θ, one of the shifts by π/2 or 3π/2 changes cosine by at least 1 in absolute value.

lemma helperForProposition_3_22_phaseChoiceCore (θ : ℝ) : ∃ j ∈ ({1, 3} : Set ℕ), 1 ≤ |Real.cos (θ + (j : ℝ) * Real.pi / 2) - Real.cos θ|

Lean source

Helper for Proposition 3.22: instantiate the phase-choice lemma at Weierstrass scale N.

lemma helperForProposition_3_22_phaseChoice (x : ℝ) (N : ℕ) : ∃ j ∈ ({1, 3} : Set ℕ), 1 ≤

Lean source

Helper for Proposition 3.22: choose a phase index j_N(x) ∈ {1,3} at each scale N.

noncomputable def helperForProposition_3_22_phaseIndex (x : ℝ) (N : ℕ) : ℕ := Classical.choose (helperForProposition_3_22_phaseChoice x N)

Lean source

Helper for Proposition 3.22: the chosen phase index lies in {1,3}.

lemma helperForProposition_3_22_phaseIndex_mem (x : ℝ) (N : ℕ) : helperForProposition_3_22_phaseIndex x N ∈ ({1, 3} : Set ℕ)

Lean source

Helper for Proposition 3.22: the chosen phase index forces a unit-sized cosine increment.

lemma helperForProposition_3_22_phaseIndex_largeCosIncrement (x : ℝ) (N : ℕ) : 1 ≤

Lean source

Helper for Proposition 3.22: the chosen phase index is positive.

lemma helperForProposition_3_22_phaseIndex_pos (x : ℝ) (N : ℕ) : 0 < (helperForProposition_3_22_phaseIndex x N : ℝ)

Lean source

Helper for Proposition 3.22: define the scale h_N(x) = j_N(x)/(2·32^(N+1)).

noncomputable def helperForProposition_3_22_scale (x : ℝ) (N : ℕ) : ℝ := (helperForProposition_3_22_phaseIndex x N : ℝ) / (2 * (32 : ℝ) ^ (N + 1))

Lean source

Helper for Proposition 3.22: all chosen scales are positive.

lemma helperForProposition_3_22_scale_pos (x : ℝ) (N : ℕ) : 0 < helperForProposition_3_22_scale x N

Lean source

Helper for Proposition 3.22: the chosen phase index is either 1 or 3.

lemma helperForProposition_3_22_phaseIndex_eq_one_or_three (x : ℝ) (N : ℕ) : helperForProposition_3_22_phaseIndex x N = 1 ∨ helperForProposition_3_22_phaseIndex x N = 3

Lean source

Helper for Proposition 3.22: the chosen phase index is at most 3.

lemma helperForProposition_3_22_phaseIndex_le_three (x : ℝ) (N : ℕ) : (helperForProposition_3_22_phaseIndex x N : ℝ) ≤ 3

Lean source

Helper for Proposition 3.22: each chosen scale is bounded by 3/(2·32^(N+1)).

lemma helperForProposition_3_22_scale_le_three_div (x : ℝ) (N : ℕ) : helperForProposition_3_22_scale x N ≤ (3 : ℝ) / (2 * (32 : ℝ) ^ (N + 1))

Lean source

Helper for Proposition 3.22: the model upper bound 3/(2·32^(N+1)) tends to 0.

lemma helperForProposition_3_22_threeDivPow_tendsto_zero : Filter.Tendsto (fun N : ℕ => (3 : ℝ) / (2 * (32 : ℝ) ^ (N + 1))) Filter.atTop (nhds (0 : ℝ))

Lean source

Helper for Proposition 3.22: the chosen scales tend to 0.

lemma helperForProposition_3_22_scale_tendsto_zero (x : ℝ) : Filter.Tendsto (fun N : ℕ => helperForProposition_3_22_scale x N) Filter.atTop (nhds (0 : ℝ))

Lean source

Helper for Proposition 3.22: the chosen scales approach 0 through positive values.

lemma helperForProposition_3_22_scale_tendsto_nhdsWithin_zero (x : ℝ) : Filter.Tendsto (fun N : ℕ => helperForProposition_3_22_scale x N) Filter.atTop (nhdsWithin 0 (Set.Ioi 0))

Lean source

Helper for Proposition 3.22: any real sequence with exponential lower bound (8^N ≤ |q_N|) cannot converge to a finite real limit.

lemma helperForProposition_3_22_notTendsto_of_absLowerBound {q : ℕ → ℝ} (hbound : ∀ N : ℕ, (8 : ℝ) ^ N ≤ |q N|) (L : ℝ) : ¬ Filter.Tendsto q Filter.atTop (nhds L)

Lean source

Helper for Proposition 3.22: the basic Weierstrass summand at index n.

noncomputable def helperForProposition_3_22_term (n : ℕ) (x : ℝ) : ℝ := ((4 : ℝ) ^ (n + 1))⁻¹ * Real.cos (((32 : ℝ) ^ (n + 1)) * Real.pi * x)

Lean source

Helper for Proposition 3.22: each Weierstrass term sequence is summable at fixed x.

lemma helperForProposition_3_22_termSummable (x : ℝ) : Summable (fun n : ℕ => helperForProposition_3_22_term n x)

Lean source

Helper for Proposition 3.22: at chosen scale, all modes n > N cancel exactly.

lemma helperForProposition_3_22_tailCosCancellationAtChosenScale (x : ℝ) (N n : ℕ) (hn : N < n) : Real.cos (((32 : ℝ) ^ (n + 1)) * Real.pi * (x + helperForProposition_3_22_scale x N)) = Real.cos (((32 : ℝ) ^ (n + 1)) * Real.pi * x)

Lean source

Helper for Proposition 3.22: ratio identity 32^(N+1)/4^(N+1)=8^(N+1).

lemma helperForProposition_3_22_powRatio (N : ℕ) : ((4 : ℝ) ^ (N + 1))⁻¹ * ((32 : ℝ) ^ (N + 1)) = (8 : ℝ) ^ (N + 1)

Lean source

Helper for Proposition 3.22: a single scaled term-difference quotient is bounded by π·8^(n+1).

lemma helperForProposition_3_22_termDifferenceQuotientBound (n : ℕ) (x h : ℝ) (hh : 0 < h) :

Lean source

Helper for Proposition 3.22: geometric bound for the low-frequency remainder weights.

lemma helperForProposition_3_22_geometricBound (N : ℕ) : (∑ n ∈ Finset.range N, (8 : ℝ) ^ (n + 1)) ≤ (8 / 7 : ℝ) * (8 : ℝ) ^ N

Lean source

Helper for Proposition 3.22: coefficient/scale algebra at phase index j.

lemma helperForProposition_3_22_coeffOverScale (N j : ℕ) (hjpos : 0 < (j : ℝ)) : ((4 : ℝ) ^ (N + 1))⁻¹ / ((j : ℝ) / (2 * (32 : ℝ) ^ (N + 1))) = ((16 : ℝ) / j) * (8 : ℝ) ^ N

Lean source

Helper for Proposition 3.22: split the chosen-scale difference quotient into dominant n = N term and low-frequency remainder (n < N).

lemma helperForProposition_3_22_differenceQuotientSplitAtScale (x : ℝ) (N : ℕ) : let h := helperForProposition_3_22_scale x N ((weierstrassFunction (x + h) - weierstrassFunction x) / h) = (((helperForProposition_3_22_term N (x + h) - helperForProposition_3_22_term N x) / h) + ∑ n ∈ Finset.range N, ((helperForProposition_3_22_term n (x + h) - helperForProposition_3_22_term n x) / h))

Lean source

Helper for Proposition 3.22: the dominant (n = N) increment has size at least (16/3)·8^N at the chosen scale.

lemma helperForProposition_3_22_dominantTermLowerBoundAtScale (x : ℝ) (N : ℕ) : let h := helperForProposition_3_22_scale x N ((16 / 3 : ℝ) * (8 : ℝ) ^ N) ≤

Lean source

Helper for Proposition 3.22: the low-frequency remainder (n < N) is bounded by (8π/7)·8^N at the chosen scale.

lemma helperForProposition_3_22_remainderBoundAtScale (x : ℝ) (N : ℕ) : let h := helperForProposition_3_22_scale x N

Lean source

Helper for Proposition 3.22: the chosen-scale difference quotients have exponential lower bound.

lemma helperForProposition_3_22_differenceQuotientLowerBoundAtChosenScale (x : ℝ) : ∀ N : ℕ, (8 : ℝ) ^ N ≤

Lean source

Helper for Proposition 3.22: chosen-scale difference quotients do not converge to any finite limit.

lemma helperForProposition_3_22_notTendstoAlongChosenScales (x L : ℝ) : ¬ Filter.Tendsto (fun N : ℕ => (weierstrassFunction (x + helperForProposition_3_22_scale x N) - weierstrassFunction x) / helperForProposition_3_22_scale x N) Filter.atTop (nhds L)

Lean source

Helper for Proposition 3.22: differentiability at x implies convergence of chosen-scale difference quotients to some finite real limit.

lemma helperForProposition_3_22_differentiableAt_imp_tendstoAlongChosenScales (x : ℝ) (hx : DifferentiableAt ℝ weierstrassFunction x) : ∃ L : ℝ, Filter.Tendsto (fun N : ℕ => (weierstrassFunction (x + helperForProposition_3_22_scale x N) - weierstrassFunction x) / helperForProposition_3_22_scale x N) Filter.atTop (nhds L)

3.8 — Uniform Approximation by Polynomials

Lean authors: Zichen Wang, Wanli Ma, Zaiwen Wen.

Source header

Definition 3.12: Let a,b ∈ ℝ with a ≤ b. A polynomial on [a,b] is a function f : [a,b] → ℝ for which there exist n ≥ 0 and coefficients c₀, …, cₙ ∈ ℝ such that f(x) = ∑_{i=0}^n cᵢ x^i for all x ∈ [a,b]. If f is a polynomial and n is the largest index with cₙ ≠ 0, then n is called the degree of f.

open scoped Pointwise open Filter def IsPolynomialOn (a b : ℝ) (f : Set.Icc a b → ℝ) : Prop := a ≤ b ∧ ∃ p : Polynomial ℝ, ∀ x : Set.Icc a b, f x = p.eval x.1

Lean source

A natural number n is the degree of f on [a,b] if f agrees on [a,b] with a nonzero real polynomial of natDegree n.

open scoped Pointwise open Filter def IsPolynomialDegreeOn (a b : ℝ) (f : Set.Icc a b → ℝ) (n : ℕ) : Prop := a ≤ b ∧ ∃ p : Polynomial ℝ, (∀ x : Set.Icc a b, f x = p.eval x.1) ∧ p.natDegree = n ∧ p.coeff n ≠ 0

Lean source

The specific function x ↦ 3x^4 + 2x^3 - 4x + 5 on [1,2].

open scoped Pointwise open Filter def examplePolynomialFunctionOnIcc : Set.Icc (1 : ℝ) 2 → ℝ := fun x => 3 * x.1 ^ 4 + 2 * x.1 ^ 3 - 4 * x.1 + 5

Lean source

Example 3.8.2: The function f(x) = 3x^4 + 2x^3 - 4x + 5 on [1,2] is a polynomial of degree 4.

open scoped Pointwise open Filter theorem example_3_8_2 : IsPolynomialDegreeOn (1 : ℝ) 2 examplePolynomialFunctionOnIcc 4

Lean source

The set of bounded continuous functions on [a,b] that are polynomial on [a,b].

open scoped Pointwise open Filter def polynomialFunctionsOnIcc (a b : ℝ) : Set (BoundedContinuousFunction (Set.Icc a b) ℝ) := {f | IsPolynomialOn a b f}

Lean source

Text 3.8.1: (Weierstrass approximation in closure form) For a closed interval [a,b], the set of polynomial functions on [a,b] is dense (with respect to the uniform norm) in the space of continuous functions on [a,b].

open scoped Pointwise open Filter theorem polynomialFunctionsOnIcc_dense (a b : ℝ) (h : a ≤ b) : Dense (polynomialFunctionsOnIcc a b)

Lean source

Text 3.8.2: [Failure of uniform polynomial approximation on ℝ] Continuous functions on ℝ cannot, in general, be uniformly approximated by polynomials. In particular, for f(x)=e^x and for every polynomial p, one has sup_{x∈ℝ} |e^x - p(x)| = +∞; hence there is no sequence of polynomials (p_n) such that p_n → e^x uniformly on ℝ.

open scoped Pointwise open Filter theorem failure_uniform_polynomial_approximation_real_exp : (∀ p : Polynomial ℝ, (⨆ x : ℝ, ((|Real.exp x - p.eval x| : ℝ) : WithTop ℝ)) = ⊤) ∧ ¬ ∃ p : ℕ → Polynomial ℝ, TendstoUniformly (fun n x => (p n).eval x) Real.exp atTop

Lean source

Theorem 3.11 (Weierstrass approximation theorem): Let a < b and let f : [a,b] → ℝ be continuous. For every ε > 0 there exists a real polynomial P such that |P(x) - f(x)| ≤ ε for all x ∈ [a,b]. Equivalently, the closure of the polynomial functions on [a,b] in the uniform metric is the set of all continuous functions on [a,b].

open scoped Pointwise open Filter theorem weierstrassApproximationOnIcc (a b : ℝ) (h : a < b) (f : Set.Icc a b → ℝ) (hf : Continuous f) : ∀ ε > 0, ∃ p : Polynomial ℝ, ∀ x : Set.Icc a b, |p.eval x.1 - f x| ≤ ε

Lean source

A function f : ℝ → ℝ is supported on [a,b] if a ≤ b and f(x) = 0 for all x ∈ ℝ \ [a,b].

open scoped Pointwise open Filter def IsSupportedOnIcc (a b : ℝ) (f : ℝ → ℝ) : Prop := a ≤ b ∧ ∀ x : ℝ, x ∉ Set.Icc a b → f x = 0

Lean source

Theorem 3.12: [Weierstrass approximation theorem I] Let f : ℝ → ℝ be continuous and supported on [0,1], i.e. f(x)=0 for all x ∉ [0,1]. Then for every ε > 0 there exists a polynomial p ∈ ℝ[x] such that |p(x) - f(x)| ≤ ε for all x ∈ [0,1].

open scoped Pointwise open Filter theorem weierstrassApproximation_supportedOnIcc01 (f : ℝ → ℝ) (hf : Continuous f) (hfs : IsSupportedOnIcc 0 1 f) : ∀ ε > 0, ∃ p : Polynomial ℝ, ∀ x : Set.Icc (0 : ℝ) 1,

Lean source

Definition 3.13: [Compactly supported functions] A function f : ℝ → ℝ is supported on a closed interval [a,b] if it vanishes outside [a,b]; it is compactly supported if there exist real numbers a ≤ b such that f is supported on [a,b]. If f is continuous and supported on [a,b], define ∫_{-∞}^{∞} f(x) dx := ∫_a^b f(x) dx.

open scoped Pointwise open Filter def IsCompactlySupported (f : ℝ → ℝ) : Prop := ∃ a b : ℝ, IsSupportedOnIcc a b f

Lean source

The integral over ℝ of a function supported on [a,b], defined as the interval integral over [a,b].

open scoped Pointwise open Filter noncomputable def compactSupportIntegral (a b : ℝ) (f : ℝ → ℝ) : ℝ := ∫ x in a..b, f x

Lean source

Lemma 3.1: If a continuous function is supported on both [a,b] and [c,d] (i.e. it vanishes outside each interval), then the interval integrals agree.

open scoped Pointwise open Filter lemma integral_eq_of_supported_on_two_Icc (f : ℝ → ℝ) (hf : Continuous f) (a b c d : ℝ) (hab : IsSupportedOnIcc a b f) (hcd : IsSupportedOnIcc c d f) : ∫ x in a..b, f x = ∫ x in c..d, f x

Lean source

Definition 3.14: [Approximation to the identity] Let ε > 0 and 0 < δ < 1. A function f : ℝ → ℝ is an (ε,δ)-approximation to the identity if (1) supp f ⊆ [-1,1] and f(x) ≥ 0 for all x, (2) f is continuous on ℝ and ∫_{-∞}^{∞} f(x) dx = 1, and (3) for δ ≤ |x| ≤ 1, one has |f(x)| ≤ ε.

open scoped Pointwise open Filter def IsApproximationToIdentity (ε δ : ℝ) (f : ℝ → ℝ) : Prop := 0 < ε ∧ 0 < δ ∧ δ < 1 ∧ IsSupportedOnIcc (-1) 1 f ∧ (∀ x : ℝ, 0 ≤ f x) ∧ Continuous f ∧ (∫ x, f x) = 1 ∧ ∀ x : ℝ, δ ≤ |x| → |x| ≤ 1 → |f x| ≤ ε

Lean source

Lemma 3.2: [Polynomials can approximate the identity] For every ε > 0 and every δ with 0 < δ < 1, there exists a real polynomial P such that |P(x) - x| ≤ ε for all x ∈ [-1,-δ] ∪ [δ,1]; in particular, such P gives an (ε,δ)-approximation to the identity on [-1,1].

open scoped Pointwise open Filter lemma exists_polynomial_approximate_identity (ε δ : ℝ) (hε : 0 < ε) (hδ : 0 < δ) (hδ' : δ < 1) : ∃ p : Polynomial ℝ, ∀ x : ℝ, x ∈ Set.Icc (-1 : ℝ) (-δ) ∪ Set.Icc δ 1 → |p.eval x - x| ≤ ε

Lean source

Definition 3.15: [Convolution] Let f,g : ℝ → ℝ be continuous with compact support. The convolution f*g is the function x ↦ ∫ y, f y * g (x - y).

open scoped Pointwise open Filter noncomputable def realConvolution (f g : {f : ℝ → ℝ // Continuous f ∧ IsCompactlySupported f}) : ℝ → ℝ := fun x => ∫ y, f.1 y * g.1 (x - y)

Lean source

Convolution of two real functions, defined by (f*g)(x) = ∫ t, f (x - t) * g t.

open scoped Pointwise open Filter noncomputable def realConvolutionFun (f g : ℝ → ℝ) : ℝ → ℝ := fun x => ∫ t, f (x - t) * g t

Lean source

Lemma 3.3: Let f : ℝ → ℝ be continuous with support in [0,1] and let g : ℝ → ℝ be continuous with support in [-1,1]. If there exist n ≥ 0 and real coefficients so that g agrees with a polynomial of degree at most n on [-1,1], then the convolution f*g is a polynomial of degree at most n on [0,1] (in particular, it is a polynomial on [0,1]).

open scoped Pointwise open Filter lemma convolution_polynomial_on_Icc (f g : ℝ → ℝ) (hf : Continuous f) (hg : Continuous g) (hfs : IsSupportedOnIcc 0 1 f) (hgs : IsSupportedOnIcc (-1) 1 g) (hgp : ∃ n : ℕ, ∃ p : Polynomial ℝ, p.natDegree ≤ n ∧ ∀ x ∈ Set.Icc (-1 : ℝ) 1, g x = p.eval x) : ∃ n : ℕ, ∃ q : Polynomial ℝ, q.natDegree ≤ n ∧ ∀ x ∈ Set.Icc (0 : ℝ) 1, realConvolutionFun f g x = q.eval x

Lean source

Lemma 3.4: Let f : ℝ → ℝ be continuous, supported on [0,1], and bounded by M > 0, with |f x| ≤ M for all x. Let ε > 0 and 0 < δ < 1 be such that |f x - f y| < ε whenever |x - y| < δ. Let g satisfy (1) g is integrable and ∫ t, g t = 1, (2) g is nonnegative, and (3) ∫ t in {t | |t| ≥ δ}, |g t| < ε. Then for every x ∈ [0,1], |(f*g)(x) - f(x)| ≤ (1 + 4M) ε.

open scoped Pointwise open Filter lemma convolution_approx_identity_bound (f g : ℝ → ℝ) (hf : Continuous f) (hfs : IsSupportedOnIcc 0 1 f) (M : ℝ) (hM : 0 < M) (hbound : ∀ x : ℝ, |f x| ≤ M) (ε δ : ℝ) (hε : 0 < ε) (hδ : 0 < δ) (hδ' : δ < 1) (hmod : ∀ x y : ℝ, |x - y| < δ → |f x - f y| < ε) (hg_integrable : MeasureTheory.Integrable g) (hg_one : ∫ t, g t = 1) (hg_nonneg : ∀ t : ℝ, 0 ≤ g t) (hg_tail : ∫ t in {t : ℝ | |t| ≥ δ}, |g t| < ε) : ∀ x ∈ Set.Icc (0 : ℝ) 1,

Lean source

Proposition 3.23: (Basic properties of convolution) Let f,g,h : ℝ → ℝ be continuous functions with compact support, and define (f*g)(x) = ∫ t, f (x - t) * g t. Then: (1) f*g is continuous and has compact support; (2) (Commutativity) for all x, (f*g)(x) = (g*f)(x); (3) (Linearity) for all x, (f*(g+h))(x) = (f*g)(x) + (f*h)(x), and for any c and all x, (f*(c g))(x) = ((c f)*g)(x) = c (f*g)(x).

open scoped Pointwise open Filter theorem convolution_basic_properties (f g h : ℝ → ℝ) (hf : Continuous f) (hg : Continuous g) (hh : Continuous h) (hfs : IsCompactlySupported f) (hgs : IsCompactlySupported g) (hhs : IsCompactlySupported h) : (Continuous (realConvolutionFun f g) ∧ IsCompactlySupported (realConvolutionFun f g)) ∧ (∀ x : ℝ, realConvolutionFun f g x = realConvolutionFun g f x) ∧ (∀ x : ℝ, realConvolutionFun f (fun t => g t + h t) x = realConvolutionFun f g x + realConvolutionFun f h x) ∧ (∀ c x : ℝ, realConvolutionFun f (fun t => c * g t) x = realConvolutionFun (fun t => c * f t) g x ∧ realConvolutionFun f (fun t => c * g t) x = c * realConvolutionFun f g x)

Lean source

The convolution of f and g is absolutely convergent at every point.

open scoped Pointwise open Filter def ConvolutionDefined (f g : ℝ → ℝ) : Prop := ∀ x : ℝ, MeasureTheory.Integrable (fun t : ℝ => f (x - t) * g t)

Lean source

A formal Dirac delta distribution, treated as a function for convolution statements.

open scoped Pointwise open Filter noncomputable def diracDelta : ℝ → ℝ := fun x => if x = 0 then 1 else 0

Lean source

diracDelta is equal almost everywhere to 0 for Lebesgue measure on ℝ.

open scoped Pointwise open Filter lemma diagnostic_diracDelta_ae_zero : (fun t : ℝ => diracDelta t) =ᵐ[MeasureTheory.MeasureSpace.volume] fun _ => 0

Lean source

Every translate t ↦ diracDelta (x - t) is equal almost everywhere to 0.

open scoped Pointwise open Filter lemma diagnostic_diracDelta_shift_ae_zero (x : ℝ) : (fun t : ℝ => diracDelta (x - t)) =ᵐ[MeasureTheory.MeasureSpace.volume] fun _ => 0

Lean source

The kernel diracDelta is integrable because it is almost everywhere zero.

open scoped Pointwise open Filter lemma diagnostic_integrable_diracDelta : MeasureTheory.Integrable diracDelta

Lean source

Every translate t ↦ diracDelta (x - t) is integrable.

open scoped Pointwise open Filter lemma diagnostic_integrable_diracDelta_shift (x : ℝ) : MeasureTheory.Integrable (fun t : ℝ => diracDelta (x - t))

Lean source

Convolution of the constant-one function with diracDelta is identically 0.

open scoped Pointwise open Filter lemma diagnostic_realConvolutionFun_constOne_diracDelta_eq_zero (x : ℝ) : realConvolutionFun (fun _ : ℝ => (1 : ℝ)) diracDelta x = 0

Lean source

Convolution of diracDelta with the constant-one function is identically 0.

open scoped Pointwise open Filter lemma diagnostic_realConvolutionFun_diracDelta_constOne_eq_zero (x : ℝ) : realConvolutionFun diracDelta (fun _ : ℝ => (1 : ℝ)) x = 0

Lean source

The identity claim (f*δ)(x) = (δ*f)(x) = f(x) fails for f ≡ 1.

open scoped Pointwise open Filter lemma diagnostic_diracDelta_identity_counterexample : ¬ (∀ x : ℝ, realConvolutionFun (fun _ : ℝ => (1 : ℝ)) diracDelta x = (1 : ℝ) ∧ realConvolutionFun diracDelta (fun _ : ℝ => (1 : ℝ)) x = (1 : ℝ))

Lean source

ConvolutionDefined holds for f ≡ 1 with the formal diracDelta kernel.

open scoped Pointwise open Filter lemma diagnostic_convolutionDefined_constOne_diracDelta : ConvolutionDefined (fun _ : ℝ => (1 : ℝ)) diracDelta

Lean source

ConvolutionDefined holds for diracDelta convolved with f ≡ 1.

open scoped Pointwise open Filter lemma diagnostic_convolutionDefined_diracDelta_constOne : ConvolutionDefined diracDelta (fun _ : ℝ => (1 : ℝ))

Lean source

There are explicit f,g,h satisfying all assumptions while the Dirac identity clause fails.

open scoped Pointwise open Filter lemma diagnostic_counterexample_data_for_convolution_associativity_derivative_identity : ∃ f g h : ℝ → ℝ, ConvolutionDefined f g ∧ ConvolutionDefined g h ∧ ConvolutionDefined (realConvolutionFun f g) h ∧ ConvolutionDefined f (realConvolutionFun g h) ∧ ConvolutionDefined f diracDelta ∧ ConvolutionDefined diracDelta f ∧ ¬ (∀ x : ℝ, realConvolutionFun f diracDelta x = f x ∧ realConvolutionFun diracDelta f x = f x)

Lean source

Proposition 3.24 packaged with explicit analytic assumptions: besides the basic ConvolutionDefined hypotheses, we assume associativity and derivative-commutation as separate premises. Under these assumptions and the present function-level diracDelta, convolution with δ vanishes pointwise.

open scoped Pointwise open Filter theorem convolution_associativity_derivative_identity (f g h : ℝ → ℝ) (hfg : ConvolutionDefined f g) (hgh : ConvolutionDefined g h) (hfg_h : ConvolutionDefined (realConvolutionFun f g) h) (hf_gh : ConvolutionDefined f (realConvolutionFun g h)) (hfd : ConvolutionDefined f diracDelta) (hdf : ConvolutionDefined diracDelta f) (hassoc : ∀ x : ℝ, realConvolutionFun (realConvolutionFun f g) h x = realConvolutionFun f (realConvolutionFun g h) x) (hderiv : (Differentiable ℝ f ∧ Differentiable ℝ g ∧ ConvolutionDefined (deriv f) g ∧ ConvolutionDefined f (deriv g)) → (Differentiable ℝ (realConvolutionFun f g) ∧ (∀ x : ℝ, deriv (realConvolutionFun f g) x = realConvolutionFun (deriv f) g x) ∧ (∀ x : ℝ, deriv (realConvolutionFun f g) x = realConvolutionFun f (deriv g) x))) : (∀ x : ℝ, realConvolutionFun (realConvolutionFun f g) h x = realConvolutionFun f (realConvolutionFun g h) x) ∧ ((Differentiable ℝ f ∧ Differentiable ℝ g ∧ ConvolutionDefined (deriv f) g ∧ ConvolutionDefined f (deriv g)) → (Differentiable ℝ (realConvolutionFun f g) ∧ (∀ x : ℝ, deriv (realConvolutionFun f g) x = realConvolutionFun (deriv f) g x) ∧ (∀ x : ℝ, deriv (realConvolutionFun f g) x = realConvolutionFun f (deriv g) x))) ∧ (∀ x : ℝ, realConvolutionFun f diracDelta x = 0 ∧ realConvolutionFun diracDelta f x = 0)

Lean source

The left endpoint 0 belongs to [0,1] as an element of Set.Icc.

open scoped Pointwise open Filter lemma zero_mem_Icc01 : (0 : ℝ) ∈ Set.Icc (0 : ℝ) 1

Lean source

The right endpoint 1 belongs to [0,1] as an element of Set.Icc.

open scoped Pointwise open Filter lemma one_mem_Icc01 : (1 : ℝ) ∈ Set.Icc (0 : ℝ) 1

Lean source

Lemma 3.5: Let f : [0,1] → ℝ be continuous with f(0)=f(1)=0. Define F : ℝ → ℝ by F(x)=f(x) for x ∈ [0,1] and F(x)=0 for x ∉ [0,1]. Then F is continuous on ℝ.

open scoped Pointwise open Filter lemma continuous_extension_by_zero_Icc01 (f : Set.Icc (0 : ℝ) 1 → ℝ) (hf : Continuous f) (hf0 : f ⟨0, zero_mem_Icc01⟩ = 0) (hf1 : f ⟨1, one_mem_Icc01⟩ = 0) : let F : ℝ → ℝ := fun x => if h : x ∈ Set.Icc (0 : ℝ) 1 then f ⟨x, h⟩ else 0 Continuous F

Lean source

Theorem 3.13: (Weierstrass approximation theorem II) Let f : [0,1] → ℝ be continuous and satisfy f(0)=f(1)=0. Then for every ε > 0 there exists a polynomial P such that sup_{x ∈ [0,1]} |P(x) - f(x)| ≤ ε.

open scoped Pointwise open Filter theorem weierstrassApproximationOnIcc01_zeroEndpoints (f : Set.Icc (0 : ℝ) 1 → ℝ) (hf : Continuous f) (hf0 : f ⟨0, zero_mem_Icc01⟩ = 0) (hf1 : f ⟨1, one_mem_Icc01⟩ = 0) : ∀ ε > 0, ∃ p : Polynomial ℝ, ∀ x : Set.Icc (0 : ℝ) 1,

Lean source

Theorem 3.14: [Weierstrass approximation theorem III] Let f : [0,1] → ℝ be continuous. For every ε > 0 there exists a polynomial P : [0,1] → ℝ such that sup_{x ∈ [0,1]} |P(x) - f(x)| ≤ ε.

open scoped Pointwise open Filter theorem weierstrassApproximationOnIcc01 (f : Set.Icc (0 : ℝ) 1 → ℝ) (hf : Continuous f) : ∀ ε > 0, ∃ p : Polynomial ℝ, ∀ x : Set.Icc (0 : ℝ) 1,

Lean source

Theorem 3.15: [Weierstrass approximation theorem on [a,b]] Let a < b and let f : [a,b] → ℝ be continuous. For every ε > 0 there exists a polynomial P such that sup_{y ∈ [a,b]} |P(y) - f(y)| ≤ ε.

open scoped Pointwise open Filter theorem weierstrassApproximationOnIcc_sup (a b : ℝ) (hab : a < b) (f : Set.Icc a b → ℝ) (hf : Continuous f) : ∀ ε > 0, ∃ p : Polynomial ℝ, ∀ y : Set.Icc a b, |p.eval y.1 - f y| ≤ ε

Lean source

Helper for Example 3.8.2: evaluation of the witness polynomial equals the given function.

open scoped Pointwise open Filter lemma helperForExample_3_8_2_eval_witness (x : Set.Icc (1 : ℝ) 2) : examplePolynomialFunctionOnIcc x = (3 * (Polynomial.X : Polynomial ℝ) ^ 4 + 2 * Polynomial.X ^ 3 - 4 * Polynomial.X + 5).eval x.1

Lean source

Helper for Example 3.8.2: the witness polynomial has natDegree 4.

open scoped Pointwise open Filter lemma helperForExample_3_8_2_natDegree_witness : (3 * (Polynomial.X : Polynomial ℝ) ^ 4 + 2 * Polynomial.X ^ 3 - 4 * Polynomial.X + 5).natDegree = 4

Lean source

Helper for Example 3.8.2: the witness polynomial has nonzero coefficient at index 4.

open scoped Pointwise open Filter lemma helperForExample_3_8_2_coeff4_witness_ne_zero : (3 * (Polynomial.X : Polynomial ℝ) ^ 4 + 2 * Polynomial.X ^ 3 - 4 * Polynomial.X + 5).coeff 4 ≠ 0

Lean source

Helper for Text 3.8.1: a polynomial bundled as a bounded continuous function belongs to polynomialFunctionsOnIcc.

open scoped Pointwise open Filter lemma helperForText_3_8_1_polynomial_bcf_mem (a b : ℝ) (h : a ≤ b) (p : Polynomial ℝ) : BoundedContinuousFunction.mkOfCompact (p.toContinuousMapOn (Set.Icc a b)) ∈ polynomialFunctionsOnIcc a b

Lean source

Helper for Text 3.8.1: a sup-norm estimate in C([a,b], ℝ) transfers to a distance estimate in BoundedContinuousFunction (Set.Icc a b) ℝ.

open scoped Pointwise open Filter lemma helperForText_3_8_1_dist_mkOfCompact_lt (a b ε : ℝ) (f : BoundedContinuousFunction (Set.Icc a b) ℝ) (p : Polynomial ℝ) (hnorm : ‖p.toContinuousMapOn (Set.Icc a b) - f.toContinuousMap‖ < ε) : dist (BoundedContinuousFunction.mkOfCompact (p.toContinuousMapOn (Set.Icc a b))) f < ε

Lean source

Helper for Text 3.8.1: every open ball around a bounded continuous function on [a,b] contains a polynomial function.

open scoped Pointwise open Filter lemma helperForText_3_8_1_exists_polynomial_in_ball (a b : ℝ) (h : a ≤ b) (f : BoundedContinuousFunction (Set.Icc a b) ℝ) (ε : ℝ) (hε : 0 < ε) : ∃ g ∈ polynomialFunctionsOnIcc a b, dist g f < ε

Lean source

Helper for Text 3.8.2: for each polynomial, eventually |exp x - p(x)| is at least exp x / 2.

open scoped Pointwise open Filter lemma helperForText_3_8_2_eventually_halfExp_le_absDiff (p : Polynomial ℝ) : ∀ᶠ x : ℝ in Filter.atTop, Real.exp x / 2 ≤ |Real.exp x - p.eval x|

Lean source

Helper for Text 3.8.2: for each polynomial and each real bound M, eventually |exp x - p(x)| is larger than M.

open scoped Pointwise open Filter lemma helperForText_3_8_2_eventually_gt_anyBound_absDiff (p : Polynomial ℝ) (M : ℝ) : ∀ᶠ x : ℝ in Filter.atTop, M < |Real.exp x - p.eval x|

Lean source

Helper for Text 3.8.2: the WithTop supremum of |exp x - p(x)| over ℝ is ⊤.

open scoped Pointwise open Filter lemma helperForText_3_8_2_iSup_eq_top_absDiff (p : Polynomial ℝ) : (⨆ x : ℝ, ((|Real.exp x - p.eval x| : ℝ) : WithTop ℝ)) = ⊤

Lean source

Helper for Text 3.8.2: uniform convergence of a polynomial sequence to exp forces one polynomial in the sequence to be globally within 1.

open scoped Pointwise open Filter lemma helperForText_3_8_2_uniformly_convergent_sequence_has_global_bound (p : ℕ → Polynomial ℝ) (hConv : TendstoUniformly (fun n x => (p n).eval x) Real.exp atTop) : ∃ N : ℕ, ∀ x : ℝ, |Real.exp x - (p N).eval x| < 1

Lean source

Helper for Theorem 3.11: obtain a polynomial whose bundled map is within ε in sup norm.

open scoped Pointwise open Filter lemma helperForTheorem_3_11_polynomial_near_bundled_map (a b ε : ℝ) (f : Set.Icc a b → ℝ) (hf : Continuous f) (hε : 0 < ε) : ∃ p : Polynomial ℝ, ‖p.toContinuousMapOn (Set.Icc a b) - (⟨f, hf⟩ : C(Set.Icc a b, ℝ))‖ < ε

Lean source

Helper for Theorem 3.11: a sup-norm bound between bundled maps implies pointwise bounds.

open scoped Pointwise open Filter lemma helperForTheorem_3_11_pointwise_lt_of_supnorm_lt (a b ε : ℝ) (F G : C(Set.Icc a b, ℝ)) (hFG : ‖F - G‖ < ε) : ∀ x : Set.Icc a b, |F x - G x| < ε

Lean source

Helper for Theorem 3.11: rewrite evaluation form and weaken < ε to ≤ ε.

open scoped Pointwise open Filter lemma helperForTheorem_3_11_eval_form_and_weakening (a b ε : ℝ) (f : Set.Icc a b → ℝ) (hf : Continuous f) (p : Polynomial ℝ) (hpoint : ∀ x : Set.Icc a b, |(p.toContinuousMapOn (Set.Icc a b) - (⟨f, hf⟩ : C(Set.Icc a b, ℝ)) ) x| < ε) : ∀ x : Set.Icc a b, |p.eval x.1 - f x| ≤ ε

Lean source

Helper for Theorem 3.12: the restriction of a continuous real function to [0,1] is continuous.

open scoped Pointwise open Filter lemma helperForTheorem_3_12_restrict_continuousOnIcc01 (f : ℝ → ℝ) (hf : Continuous f) : Continuous (fun x : Set.Icc (0 : ℝ) 1 => f x.1)

Lean source

Helper for Theorem 3.12: instantiate Weierstrass approximation on [0,1] for the restricted function.

open scoped Pointwise open Filter lemma helperForTheorem_3_12_exists_polynomial_onIcc01 (f : ℝ → ℝ) (hf : Continuous f) : ∀ ε > 0, ∃ p : Polynomial ℝ, ∀ x : Set.Icc (0 : ℝ) 1,

Lean source

Helper for Theorem 3.12: simplify the restricted-function value at a point of [0,1] in the approximation expression.

open scoped Pointwise open Filter lemma helperForTheorem_3_12_rewrite_restricted_value (f : ℝ → ℝ) (p : Polynomial ℝ) (x : Set.Icc (0 : ℝ) 1) :

Lean source

Helper for Lemma 3.1: a continuous function supported on [a,b] vanishes at a.

open scoped Pointwise open Filter lemma helperForLemma_3_1_leftEndpoint_zero_of_supported {f : ℝ → ℝ} (hf : Continuous f) {a b : ℝ} (hab : IsSupportedOnIcc a b f) : f a = 0

Lean source

Helper for Lemma 3.1: a continuous function supported on [a,b] vanishes at b.

open scoped Pointwise open Filter lemma helperForLemma_3_1_rightEndpoint_zero_of_supported {f : ℝ → ℝ} (hf : Continuous f) {a b : ℝ} (hab : IsSupportedOnIcc a b f) : f b = 0

Lean source

Helper for Lemma 3.1: support of a continuous function supported on [a,b] lies in Set.Ioc a b.

open scoped Pointwise open Filter lemma helperForLemma_3_1_support_subset_Ioc_of_supported {f : ℝ → ℝ} (hf : Continuous f) {a b : ℝ} (hab : IsSupportedOnIcc a b f) : Function.support f ⊆ Set.Ioc a b

Lean source

Helper for Proposition 3.23: rewrite realConvolutionFun as a mathlib convolution.

open scoped Pointwise open Filter lemma helperForProposition_3_23_realConvolutionFun_eq_star (u v : ℝ → ℝ) : realConvolutionFun u v = MeasureTheory.convolution u v (ContinuousLinearMap.mul ℝ ℝ) MeasureTheory.MeasureSpace.volume

Lean source

Helper for Proposition 3.23: extract interval support bounds from compact support.

open scoped Pointwise open Filter lemma helperForProposition_3_23_supportSubsetIcc_of_IsCompactlySupported (u : ℝ → ℝ) (hu : IsCompactlySupported u) : ∃ a b : ℝ, a ≤ b ∧ Function.support u ⊆ Set.Icc a b

Lean source

Helper for Proposition 3.23: custom compact support implies HasCompactSupport.

open scoped Pointwise open Filter lemma helperForProposition_3_23_hasCompactSupport_of_IsCompactlySupported (u : ℝ → ℝ) (hu : IsCompactlySupported u) : HasCompactSupport u

Lean source

Helper for Proposition 3.23: convolution of compactly supported functions is compactly supported in the textbook interval-support sense.

open scoped Pointwise open Filter lemma helperForProposition_3_23_isCompactlySupported_convolutionFun (u v : ℝ → ℝ) (hu : IsCompactlySupported u) (hv : IsCompactlySupported v) : IsCompactlySupported (realConvolutionFun u v)

Lean source

Helper for Proposition 3.23: right-additivity of convolution under continuity and compact support hypotheses.

open scoped Pointwise open Filter lemma helperForProposition_3_23_convolution_add_right (u v w : ℝ → ℝ) (hu : Continuous u) (hv : Continuous v) (hw : Continuous w) (hvs : IsCompactlySupported v) (hws : IsCompactlySupported w) : ∀ x : ℝ, realConvolutionFun u (fun t => v t + w t) x = realConvolutionFun u v x + realConvolutionFun u w x

Lean source

Helper for Lemma 3.5: points outside [0,1] satisfy x < 0 ∨ 1 < x.

open scoped Pointwise open Filter lemma helperForLemma_3_5_notMem_Icc01_split {x : ℝ} (hx : x ∉ Set.Icc (0 : ℝ) 1) : x < 0 ∨ 1 < x

Lean source

Helper for Lemma 3.5: the Icc extension is zero outside [0,1] using the endpoint hypotheses.

open scoped Pointwise open Filter lemma helperForLemma_3_5_IccExtend_zero_outside (h01 : (0 : ℝ) ≤ 1) (f : Set.Icc (0 : ℝ) 1 → ℝ) (hf0 : f ⟨0, zero_mem_Icc01⟩ = 0) (hf1 : f ⟨1, one_mem_Icc01⟩ = 0) {x : ℝ} (hx : x ∉ Set.Icc (0 : ℝ) 1) : Set.IccExtend h01 f x = 0

Lean source

Helper for Lemma 3.5: the Icc extension agrees with the if-defined function.

open scoped Pointwise open Filter lemma helperForLemma_3_5_IccExtend_eq_ifExtension (h01 : (0 : ℝ) ≤ 1) (f : Set.Icc (0 : ℝ) 1 → ℝ) (hf0 : f ⟨0, zero_mem_Icc01⟩ = 0) (hf1 : f ⟨1, one_mem_Icc01⟩ = 0) : Set.IccExtend h01 f = (fun x => if h : x ∈ Set.Icc (0 : ℝ) 1 then f ⟨x, h⟩ else 0)

Lean source

Helper for Lemma 3.5: continuity of the clamped extension Set.IccExtend.

open scoped Pointwise open Filter lemma helperForLemma_3_5_continuous_IccExtend (h01 : (0 : ℝ) ≤ 1) (f : Set.Icc (0 : ℝ) 1 → ℝ) (hf : Continuous f) : Continuous (Set.IccExtend h01 f)