LeanFun RevOLVER

2.3 Smoothness and algebraic decay

The decay of Chebyshev coefficients controls truncation error. Finite smoothness gives algebraic rates, with the last derivative allowed to have bounded variation.

2.3.1 From smoothness to coefficient decay

Total variation measures the sum of absolute increments over partitions. The derivative relation below can be iterated when the intermediate functions are absolutely continuous; the final derivative may have jumps.

Suppose \(f\) is absolutely continuous on \([-1,1]\) with derivative representative \(g\) almost everywhere, and \(\theta \mapsto g(\cos \theta )\) is integrable on \([0,\pi ]\). Then \(f(\cos \theta )\) is absolutely continuous, with derivative \(-g(\cos \theta )\sin \theta \) almost everywhere. For \(n\ge 2\),

\[ a_n(f)=\frac{a_{n-1}(g)-a_{n+1}(g)}{2n}. \]

The exceptional first-degree case is \(a_1(f)=a_0(g)-a_2(g)/2\), with the full constant coefficient convention. The integrability assumption holds in particular when \(g\) has bounded variation.

Reference: the repeated-integration step in [ATAP, Chapter 7].

Lean Formalisation
theorem Polynomial.Chebyshev.absolutelyContinuous_cosine_pullback {f g : ℝ → ℝ} (hf : AbsolutelyContinuousOnInterval f (-1) 1)
  (hd : ∀ᵐ (x : ℝ), x ∈ Set.Icc (-1) 1 → HasDerivAt f (g x) x)
  (hg : IntervalIntegrable (fun θ => g (Real.cos θ)) MeasureTheory.volume 0 Real.pi) :
  AbsolutelyContinuousOnInterval (fun θ => f (Real.cos θ)) 0 Real.pi ∧
    ∀ᵐ (θ : ℝ), θ ∈ Set.Icc 0 Real.pi → HasDerivAt (fun θ => f (Real.cos θ)) (g (Real.cos θ) * -Real.sin θ) θ
Lean proof
/-- The cosine pullback of an absolutely continuous function is absolutely
continuous when the supplied derivative representative has an integrable cosine
pullback. The derivative identity is retained almost everywhere. -/
theorem absolutelyContinuous_cosine_pullback {f g : ℝ → ℝ}
    (hf : AbsolutelyContinuousOnInterval f (-1) 1)
    (hd : ∀ᵐ x ∂volume, x ∈ Icc (-1) 1 → HasDerivAt f (g x) x)
    (hg : IntervalIntegrable (fun θ ↦ g (cos θ)) volume 0 π) :
    AbsolutelyContinuousOnInterval (fun θ ↦ f (cos θ)) 0 π ∧
      ∀ᵐ θ ∂volume, θ ∈ Icc 0 π →
        HasDerivAt (fun θ ↦ f (cos θ)) (g (cos θ) * (-sin θ)) θ := by
  let H : ℝ → ℝ := fun θ ↦ g (cos θ) * (-sin θ)
  have hH : IntervalIntegrable H volume 0 π := hg.mul_continuousOn (by fun_prop)
  let J : ℝ → ℝ := (uIcc 0 π).indicator H
  have hJ : Integrable J := (integrable_indicator_iff measurableSet_uIcc).mpr
    ((intervalIntegrable_iff').mp hH)
  have heq : EqOn (fun θ ↦ f 1 + ∫ t in 0..θ, J t) (fun θ ↦ f (cos θ)) (Icc 0 π) := by
    intro θ hθ
    have he : (∫ t in 0..θ, J t) = ∫ t in 0..θ, H t := by
      apply intervalIntegral.integral_congr
      intro t ht
      have hm : t ∈ uIcc 0 π := by
        rw [uIcc_of_le pi_pos.le]
        rw [uIcc_of_le hθ.1] at ht
        exact ⟨ht.1, ht.2.trans hθ.2⟩
      exact Set.indicator_of_mem hm H
    change f 1 + (∫ t in 0..θ, J t) = f (cos θ)
    rw [he]
    exact (cosine_pullback_eq_integral hf hd hθ).symm
  have hac := hJ.intervalIntegrable.absolutelyContinuousOnInterval_intervalIntegral
    (a := 0) (b := π) (c := 0) (by simp)
  have hc : AbsolutelyContinuousOnInterval (fun _ : ℝ ↦ f 1) 0 π :=
    (show ContDiff ℝ 1 (fun _ : ℝ ↦ f 1) by fun_prop).contDiffOn.absolutelyContinuousOnInterval
  constructor
  · exact (hc.fun_add hac).congr (by simpa only [uIcc_of_le pi_pos.le] using heq)
  · filter_upwards [(hJ.intervalIntegrable (a := 0) (b := π)).ae_hasDerivAt_integral,
      (countable_singleton (0 : ℝ)).ae_notMem volume,
      (countable_singleton π).ae_notMem volume] with θ hθ hzero hpi hmem
    have hθ' : θ ∈ Ioo 0 π := by simpa using (show 0 < θ ∧ θ < π by grind)
    have hder := (hθ (by simpa only [uIcc_of_le pi_pos.le] using hmem) 0 (by simp)).const_add (f 1)
    have hm : θ ∈ uIcc 0 π := by simpa only [uIcc_of_le pi_pos.le] using hmem
    simp only [J, Set.indicator_of_mem hm] at hder
    apply hder.congr_of_eventuallyEq
    filter_upwards [Ioo_mem_nhds hθ'.1 hθ'.2] with t ht
    exact (heq (Ioo_subset_Icc_self ht)).symm
source

If \(f\) has bounded variation on \([-1,1]\), then for \(n\ge 1\),

\[ |a_n(f)|\le \frac{2\operatorname {Var}_{[-1,1]}(f)}{\pi n}. \]

In particular, if the variation is at most \(V\ge 0\), then \(|a_n(f)|\le 2V/(\pi n)\). Continuity is not assumed.

Reference: [ATAP, Theorem 7.1], case \(\nu =0\).

Lean Formalisation
theorem Polynomial.Chebyshev.abs_coefficient_le_of_boundedVariation {f : ℝ → ℝ} (hf : BoundedVariationOn f (Set.Icc (-1) 1))
  {n : ℕ} (hn : n ≠ 0) :
  |Polynomial.Chebyshev.coefficient ⟨f, ⋯⟩| ≤ 2 * (eVariationOn f (Set.Icc (-1) 1)).toReal / (Real.pi * ↑n)
Lean proof
/-- A function of bounded variation has Chebyshev coefficients bounded by
`2 Var(f) / (π n)` for positive indices. No continuity is required (ATAP 7.1). -/
theorem abs_coefficient_le_of_boundedVariation {f : ℝ → ℝ}
    (hf : BoundedVariationOn f (Icc (-1) 1)) {n : ℕ} (hn : n ≠ 0) :
    |(coefficient (n := n) ⟨f, coefficientInput_integrable_boundedVariation hf n⟩)| ≤ 2 * (eVariationOn f (Icc (-1) 1)).toReal / (π * n) := by
  have hnpos : (0 : ℝ) < n := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)
  have hvar : eVariationOn (fun θ ↦ f (cos θ)) (Icc 0 π) ≤
      eVariationOn f (Icc (-1) 1) :=
    eVariationOn.comp_le_of_antitoneOn f cos antitoneOn_cos
      (fun θ _ ↦ ⟨neg_one_le_cos θ, cos_le_one θ⟩)
  have hfc : BoundedVariationOn (fun θ ↦ f (cos θ)) (Icc 0 π) :=
    ne_top_of_le_ne_top hf hvar
  have hmul : LipschitzWith (n : ℝ≥0) (fun θ : ℝ ↦ (n : ℝ) * θ) := by
    apply LipschitzWith.of_dist_le_mul
    intro x y
    simp only [Real.dist_eq, ← mul_sub, abs_mul, abs_of_nonneg hnpos.le, NNReal.coe_natCast]
    exact le_rfl
  have hsin := lipschitzWith_sin.comp hmul
  have hd (θ : ℝ) : HasDerivAt (fun θ : ℝ ↦ sin (n * θ))
      ((n : ℝ) * cos (n * θ)) θ := by
    convert ((hasDerivAt_id θ).const_mul (n : ℝ)).sin using 1 <;> simp [mul_comm]
  have hint : IntervalIntegrable (fun θ : ℝ ↦ (n : ℝ) * cos (n * θ)) volume 0 π :=
    (by fun_prop : Continuous (fun θ : ℝ ↦ (n : ℝ) * cos (n * θ))).intervalIntegrable 0 π
  have hi := hfc.abs_integral_mul_le_of_lipschitz_primitive pi_pos.le hsin
    (fun θ _ ↦ hd θ) hint (by simp) (sin_nat_mul_pi n) zero_le_one
    (fun θ _ ↦ abs_sin_le_one (n * θ))
  have heq : (∫ θ in 0..π, (n : ℝ) * cos (n * θ) * f (cos θ)) =
      n * ∫ θ in 0..π, f (cos θ) * cos (n * θ) := by
    rw [← intervalIntegral.integral_const_mul]
    apply intervalIntegral.integral_congr
    intro θ _
    ring
  rw [heq, abs_mul, abs_of_pos hnpos, one_mul] at hi
  have hV := ENNReal.toReal_mono hf hvar
  rw [coefficient_eq_integral_cos, ite_eq_right hn, abs_mul, abs_of_nonneg (by positivity : (0 : ℝ) ≤ 2 / π)]
  apply (le_div_iff₀ (mul_pos pi_pos hnpos)).2
  have hpi : π ≠ 0 := pi_pos.ne'
  field_simp
  nlinarith [hi.trans hV]
source

Let \(\nu \ge 0\). Let \(f_0=f,f_1,\ldots ,f_\nu \) be real functions on \([-1,1]\). For \(j{\lt}\nu \), assume \(f_j\) is absolutely continuous with derivative \(f_{j+1}\) almost everywhere. Assume \(f_\nu \) has total variation at most \(V\), where \(V\ge 0\). For \(k\ge \nu +1\),

\[ |a_k(f)|\le \frac{2V}{\pi k(k-1)\cdots (k-\nu )} \le \frac{2V}{\pi (k-\nu )^{\nu +1}}. \]

The derivative chain specifies representatives at jumps without requiring classical differentiability there. For \(\nu =0\), only bounded variation of \(f\) is assumed.

Reference: [ATAP, Theorem 7.1].

Lean Formalisation
theorem Polynomial.Chebyshev.abs_coefficient_le_descFactorial_of_derivative_chain {ν : ℕ} {F : ℕ → ℝ → ℝ} {V : ℝ} (hV : 0 ≤ V)
  (hAC : ∀ j < ν, AbsolutelyContinuousOnInterval (F j) (-1) 1)
  (hd : ∀ j < ν, ∀ᵐ (x : ℝ), x ∈ Set.Icc (-1) 1 → HasDerivAt (F j) (F (j + 1) x) x)
  (hvar : eVariationOn (F ν) (Set.Icc (-1) 1) ≤ ENNReal.ofReal V) {k : ℕ} (hk : ν + 1 ≤ k) :
  |Polynomial.Chebyshev.coefficient ⟨F 0, ⋯⟩| ≤ 2 * V / (Real.pi * ↑(k.descFactorial (ν + 1)))
Lean proof
/-- The falling-factorial coefficient bound of ATAP, Theorem 7.1.
The derivative chain is interpreted almost everywhere, with no continuity
assumption on its last member. -/
theorem abs_coefficient_le_descFactorial_of_derivative_chain
    {ν : ℕ} {F : ℕ → ℝ → ℝ} {V : ℝ}
    (hV : 0 ≤ V)
    (hAC : ∀ j < ν, AbsolutelyContinuousOnInterval (F j) (-1) 1)
    (hd : ∀ j < ν, ∀ᵐ x ∂volume, x ∈ Icc (-1) 1 → HasDerivAt (F j) (F (j + 1) x) x)
    (hvar : eVariationOn (F ν) (Icc (-1) 1) ≤ ENNReal.ofReal V)
    {k : ℕ} (hk : ν + 1 ≤ k) :
    |(coefficient (n := k) ⟨(F 0), coefficientInput_integrable_derivative_chain hAC hvar _⟩)| ≤ 2 * V / (π * (k.descFactorial (ν + 1) : ℝ)) := by
  induction ν generalizing F k with
  | zero =>
    simpa using abs_coefficient_le_of_eVariationOn_le hV hvar (show k ≠ 0 by omega)
  | succ ν ih =>
    obtain ⟨n, rfl⟩ : ∃ n : ℕ, k = n + 2 := ⟨k - 2, by omega⟩
    have hAC' : ∀ j < ν, AbsolutelyContinuousOnInterval ((fun j ↦ F (j + 1)) j) (-1) 1 :=
      fun j hj ↦ hAC (j + 1) (by omega)
    have hd' : ∀ j < ν, ∀ᵐ x ∂volume, x ∈ Icc (-1) 1 →
        HasDerivAt ((fun j ↦ F (j + 1)) j) ((fun j ↦ F (j + 1)) (j + 1) x) x :=
      fun j hj ↦ hd (j + 1) (by omega)
    have hlo := ih hAC' hd' hvar (k := n + 1) (by omega)
    have hhi := ih hAC' hd' hvar (k := n + 3) (by omega)
    have hBV : BoundedVariationOn (F 1) (Icc (-1) 1) := by
      by_cases hν : ν = 0
      · subst ν
        exact ne_top_of_le_ne_top ENNReal.ofReal_ne_top hvar
      · simpa only [uIcc_of_le (by norm_num : (-1 : ℝ) ≤ 1)] using
          (hAC 1 (by omega)).boundedVariationOn
    have hcos : BoundedVariationOn (fun θ ↦ F 1 (cos θ)) (Icc 0 π) :=
      ne_top_of_le_ne_top hBV (eVariationOn.comp_le_of_antitoneOn (F 1) cos antitoneOn_cos
        (fun θ _ ↦ ⟨neg_one_le_cos θ, cos_le_one θ⟩))
    have hint : IntervalIntegrable (fun θ ↦ F 1 (cos θ)) volume 0 π :=
      hcos.intervalIntegrable (by rw [uIcc_of_le pi_pos.le])
    rw [coefficient_eq_sub_derivative_coefficients (hAC 0 (by omega)) (hd 0 (by omega)) hint n,
      abs_div, abs_of_pos (by positivity : (0 : ℝ) < 2 * (n + 2 : ℕ))]
    have hD : (0 : ℝ) < (n + 1).descFactorial (ν + 1) := by
      exact_mod_cast Nat.descFactorial_pos.mpr (show ν + 1 ≤ n + 1 by omega)
    have hmono : ((n + 1).descFactorial (ν + 1) : ℝ) ≤ (n + 3).descFactorial (ν + 1) := by
      exact_mod_cast Nat.descFactorial_le (ν + 1) (show n + 1 ≤ n + 3 by omega)
    have hhi' : |(coefficient (n := (n + 3)) ⟨(F 1), coefficientInput_integrable_boundedVariation hBV _⟩)| ≤
        2 * V / (π * ((n + 1).descFactorial (ν + 1) : ℝ)) :=
      hhi.trans (div_le_div_of_nonneg_left (by positivity) (mul_pos pi_pos hD)
        (mul_le_mul_of_nonneg_left hmono pi_pos.le))
    calc
      _ ≤ (2 * V / (π * ((n + 1).descFactorial (ν + 1) : ℝ)) +
          2 * V / (π * ((n + 1).descFactorial (ν + 1) : ℝ))) / (2 * (n + 2 : ℕ)) := by
        apply div_le_div_of_nonneg_right _ (by positivity)
        exact (abs_sub _ _).trans (add_le_add hlo hhi')
      _ = _ := by
        rw [Nat.succ_descFactorial_succ (n + 1) (ν + 1)]
        push_cast
        field_simp
        ring
source

2.3.2 From coefficient decay to approximation error

First establish that the coefficient series represents \(f\). Its tail then bounds the truncation error.

Theorem 2.3.4 Representation by an absolutely summable Chebyshev series
✓ 🤖

If \(f\) is continuous on \([-1,1]\) and \(\sum _{n\ge 0}|a_n(f)|{\lt}\infty \), then

\[ f(x)=\sum _{n\ge 0}a_n(f)T_n(x)\qquad (x\in [-1,1]). \]

The endpoints are included.

Reference: [ATAP, Chapters 4 and 7].

Lean Formalisation
theorem Polynomial.Chebyshev.hasSum_coefficient_mul_eval_T {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc (-1) 1))
  (ha : Summable fun n => |Polynomial.Chebyshev.coefficient ⟨f, ⋯⟩|) {x : ℝ} (hx : x ∈ Set.Icc (-1) 1) :
  HasSum (fun n => Polynomial.Chebyshev.coefficient ⟨f, ⋯⟩ * Polynomial.eval x (Polynomial.Chebyshev.T ℝ ↑n)) (f x)
Lean proof
/-- If the Chebyshev coefficients of a continuous function are absolutely summable,
its Chebyshev series represents it at every point of `[-1,1]` (ATAP, Chapter 4). -/
theorem hasSum_coefficient_mul_eval_T {f : ℝ → ℝ} (hf : ContinuousOn f (Icc (-1) 1))
    (ha : Summable (fun n ↦ |(coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩)|)) {x : ℝ} (hx : x ∈ Icc (-1) 1) :
    HasSum (fun n : ℕ ↦ (coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩) * (T ℝ n).eval x) (f x) := by
  let F := extendContinuous f hf
  let P (n : ℕ) : ℝ →ᵇ ℝ := extendContinuous (fun x ↦ (T ℝ n).eval x) (by fun_prop)
  let L : (ℝ →ᵇ ℝ) →L[ℝ] Lp ℝ 2 classicalMeasureT := BoundedContinuousFunction.toLp 2 classicalMeasureT ℝ
  have hP (n : ℕ) : ‖P n‖ ≤ 1 := by
    apply (BoundedContinuousFunction.norm_le zero_le_one).2
    intro y
    change ‖(T ℝ n).eval (projIcc (-1) 1 (by norm_num) y : ℝ)‖ ≤ 1
    rw [Real.norm_eq_abs]
    exact abs_eval_T_real_le_one _ (abs_le.mpr (projIcc (-1) 1 (by norm_num) y).property)
  have hLP (n : ℕ) : L (P n) = polynomialToL2 (T ℝ n) := by
    apply Lp.ext
    filter_upwards [(P n).coeFn_toLp 2 classicalMeasureT ℝ, coe_polynomialToL2 (T ℝ n),
      ae_mem_Icc_measureT] with y hy hp hyI
    rw [hy, hp]
    exact extendContinuous_apply _ _ hyI
  have hLF : ∀ n, (coefficient (n := n) ⟨(L F), coefficientInput_integrable_L2 (L F) n⟩) = (coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩) := by
    intro n
    apply coefficient_congr_ae
    change (fun y ↦ (L F) y) =ᵐ[classicalMeasureT] f
    filter_upwards [F.coeFn_toLp 2 classicalMeasureT ℝ, ae_mem_Icc_measureT] with y hy hyI
    rw [hy]
    exact extendContinuous_apply _ _ hyI
  have hs : Summable (fun n : ℕ ↦ (coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩) • P n) := by
    apply ha.of_norm_bounded
    intro n
    rw [norm_smul, Real.norm_eq_abs]
    exact mul_le_of_le_one_right (abs_nonneg _) (hP n)
  let G : ℝ →ᵇ ℝ := ∑' n : ℕ, (coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩) • P n
  have hsum : HasSum (fun n : ℕ ↦ (coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩) • polynomialToL2 (T ℝ n)) (L G) := by
    simpa only [map_smul, hLP] using L.hasSum hs.hasSum
  have hsumF : HasSum (fun n : ℕ ↦ (coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩) • polynomialToL2 (T ℝ n)) (L F) := by
    simpa only [hLF] using hasSum_coefficient_polynomialToL2 (L F)
  have heqL : L G = L F := hsum.unique hsumF
  have heq : EqOn G F (Icc (-1) 1) := by
    apply eqOn_of_ae_eq_measureT G.continuous F.continuous
    filter_upwards [G.coeFn_toLp 2 classicalMeasureT ℝ, F.coeFn_toLp 2 classicalMeasureT ℝ] with y hyG hyF
    exact hyG.symm.trans ((congrArg (fun h : Lp ℝ 2 classicalMeasureT ↦ h y) heqL).trans hyF)
  have hpoint := (BoundedContinuousFunction.evalCLM ℝ x).hasSum hs.hasSum
  have hPx (n : ℕ) : P n x = (T ℝ n).eval x := extendContinuous_apply _ _ hx
  change HasSum (fun n : ℕ ↦ (coefficient (n := n) ⟨f, by first | assumption | apply integrable_classicalMeasureT; fun_prop⟩) * P n x) (G x) at hpoint
  have hFx : F x = f x := extendContinuous_apply f hf hx
  simpa only [hPx, heq hx, hFx] using hpoint
source

For real or complex coefficients, if \(\sum _{k\ge 0}|a_k|{\lt}\infty \) and \(f(x)=\sum _{k\ge 0}a_kT_k(x)\) on \([-1,1]\), then

\[ |f(x)-\sum _{k=0}^N a_kT_k(x)|\le \sum _{k{\gt}N}|a_k|\quad (x\in [-1,1]). \]

For real coefficients, if \(|a_k|\le Cq^k\) with \(0\le q{\lt}1\), this is at most \(Cq^{N+1}/(1-q)\).

Reference: [ATAP, equation 4.8 and Theorems 7.2 and 8.2].

Lean Formalisation
theorem Polynomial.Chebyshev.norm_sub_sum_smul_le_tsum_tail.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E]
  [CompleteSpace E] {a : ℕ → E} {f : ℝ → E} (ha : Summable fun n => ‖a n‖) {x : ℝ} (hx : x ∈ Set.Icc (-1) 1)
  (hf : HasSum (fun n => Polynomial.eval x (Polynomial.Chebyshev.T ℝ ↑n) • a n) (f x)) (N : ℕ) :
  ‖f x - ∑ n ∈ Finset.range (N + 1), Polynomial.eval x (Polynomial.Chebyshev.T ℝ ↑n) • a n‖ ≤
    ∑' (k : ℕ), ‖a (k + (N + 1))‖
Lean proof
/-- The absolute-tail estimate also holds for vector-valued coefficients, in
particular for complex coefficients (ATAP, equation 4.8). -/
theorem norm_sub_sum_smul_le_tsum_tail {E : Type*} [NormedAddCommGroup E]
    [NormedSpace ℝ E] [CompleteSpace E] {a : ℕ → E} {f : ℝ → E}
    (ha : Summable (fun n ↦ ‖a n‖)) {x : ℝ} (hx : x ∈ Set.Icc (-1) 1)
    (hf : HasSum (fun n : ℕ ↦ (T ℝ n).eval x • a n) (f x)) (N : ℕ) :
    ‖f x - ∑ n ∈ Finset.range (N + 1), (T ℝ n).eval x • a n‖ ≤
      ∑' k, ‖a (k + (N + 1))‖ := by
  have hb (n : ℕ) : ‖(T ℝ n).eval x • a n‖ ≤ ‖a n‖ := by
    rw [norm_smul, Real.norm_eq_abs]
    exact mul_le_of_le_one_left (norm_nonneg _) (abs_eval_T_real_le_one _ (abs_le.mpr hx))
  have hs := ha.of_norm_bounded hb
  have ht := (summable_nat_add_iff (N + 1)).2 ha
  have hn : Summable (fun k ↦ ‖(T ℝ (k + (N + 1) : ℕ)).eval x • a (k + (N + 1))‖) :=
    ht.of_norm_bounded (fun k ↦ by simpa only [norm_norm] using hb (k + (N + 1)))
  have he := hs.sum_add_tsum_nat_add (N + 1)
  rw [hf.tsum_eq] at he
  rw [← he, add_sub_cancel_left]
  exact (norm_tsum_le_tsum_norm hn).trans (hn.tsum_le_tsum (fun k ↦ hb _) ht)
source

Under the hypotheses of Theorem 2.3.3, with \(\nu \ge 1\) and \(N{\gt}\nu \), the degree-\(N\) Chebyshev projection satisfies

\[ \sup _{x\in [-1,1]}|f(x)-\sum _{k=0}^N a_k(f)T_k(x)| \le \frac{2V}{\pi \nu (N-\nu )^\nu }. \]

The coefficients are absolutely summable.

Reference: [ATAP, Theorem 7.2].

Lean Formalisation
theorem Polynomial.Chebyshev.summable_abs_coefficient_of_derivative_chain {ν : ℕ} {F : ℕ → ℝ → ℝ} {V : ℝ} (hν : 1 ≤ ν)
  (hV : 0 ≤ V) (hAC : ∀ j < ν, AbsolutelyContinuousOnInterval (F j) (-1) 1)
  (hd : ∀ j < ν, ∀ᵐ (x : ℝ), x ∈ Set.Icc (-1) 1 → HasDerivAt (F j) (F (j + 1) x) x)
  (hvar : eVariationOn (F ν) (Set.Icc (-1) 1) ≤ ENNReal.ofReal V) :
  Summable fun n => |Polynomial.Chebyshev.coefficient ⟨F 0, ⋯⟩|
Lean proof
/-- Positive smoothness and bounded variation of the last derivative imply
absolute summability of the Chebyshev coefficients (ATAP, Chapter 7). -/
theorem summable_abs_coefficient_of_derivative_chain
    {ν : ℕ} {F : ℕ → ℝ → ℝ} {V : ℝ} (hν : 1 ≤ ν) (hV : 0 ≤ V)
    (hAC : ∀ j < ν, AbsolutelyContinuousOnInterval (F j) (-1) 1)
    (hd : ∀ j < ν, ∀ᵐ x ∂volume, x ∈ Icc (-1) 1 → HasDerivAt (F j) (F (j + 1) x) x)
    (hvar : eVariationOn (F ν) (Icc (-1) 1) ≤ ENNReal.ofReal V) :
    Summable (fun n ↦ |(coefficient (n := n) ⟨(F 0), coefficientInput_integrable_derivative_chain hAC hvar _⟩)|) := by
  have hp : Summable (fun n : ℕ ↦ 1 / (n : ℝ) ^ (ν + 1)) :=
    summable_one_div_nat_pow.mpr (by omega)
  have hs := ((summable_nat_add_iff 1).2 hp).mul_left (2 * V / π)
  rw [← summable_nat_add_iff (ν + 1)]
  apply hs.of_norm_bounded
  intro k
  rw [Real.norm_eq_abs, abs_abs]
  have hb := abs_coefficient_le_pow_of_derivative_chain hV hAC hd hvar
    (k := k + (ν + 1)) (by omega)
  have he : ((k + (ν + 1) : ℕ) : ℝ) - ν = (k + 1 : ℕ) := by push_cast; ring
  rw [he] at hb
  convert hb using 1
  ring
source
Integration by parts and tail estimates

Put \(g(\theta )=f(\cos \theta )\). If \(g\) is absolutely continuous on \([0,\pi ]\), let \(h\) be any integrable derivative representative on that interval. For \(n{\gt}0\),

\[ a_n(f)=-\frac{2}{\pi n}\int _0^\pi h(\theta )\sin (n\theta )\, d\theta . \]

Such representatives exist, and the formula is independent of their choice. For continuous \(g\) differentiable on \((0,\pi )\) with integrable derivative, we also have \(|a_n(f)|\le 2\| g'\| _{L^1(0,\pi )}/(\pi n)\).

Reference: [ATAP, Chapter 7].

Lean Formalisation
theorem Polynomial.Chebyshev.coefficient_eq_integral_sin {f g' : ℝ → ℝ}
  (hf : ContinuousOn (fun θ => f (Real.cos θ)) (Set.Icc 0 Real.pi))
  (hd : ∀ θ ∈ Set.Ioo 0 Real.pi, HasDerivAt (fun θ => f (Real.cos θ)) (g' θ) θ)
  (hg : IntervalIntegrable g' MeasureTheory.volume 0 Real.pi) {n : ℕ} (hn : n ≠ 0) :
  Polynomial.Chebyshev.coefficient ⟨f, ⋯⟩ = -(2 / (Real.pi * ↑n)) * ∫ (θ : ℝ) in 0..Real.pi, g' θ * Real.sin (↑n * θ)
Lean proof
/-- Integration by parts for the cosine pullback of a function (ATAP, Chapter 7).
The derivative is supplied explicitly to allow subsequent almost-everywhere APIs. -/
theorem coefficient_eq_integral_sin {f g' : ℝ → ℝ}
    (hf : ContinuousOn (fun θ ↦ f (cos θ)) (Icc 0 π))
    (hd : ∀ θ ∈ Ioo 0 π, HasDerivAt (fun θ ↦ f (cos θ)) (g' θ) θ)
    (hg : IntervalIntegrable g' volume 0 π) {n : ℕ} (hn : n ≠ 0) :
    (coefficient (n := n) ⟨f, by
      apply integrable_classicalMeasureT_mul_T ⟨_, ?_⟩ n
      apply integrable_classicalMeasureT_of_continuous_cos
      exact hf⟩) = -(2 / (π * n)) * ∫ θ in 0..π, g' θ * sin (n * θ) := by
  have hn' : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn
  have hb := integral_mul_deriv_eq_deriv_mul_of_hasDerivAt
    (a := 0) (b := π)
    (u := fun θ ↦ f (cos θ)) (v := fun θ ↦ sin (n * θ))
    (u' := g') (v' := fun θ ↦ (n : ℝ) * cos (n * θ))
    (by simpa only [uIcc_of_le pi_pos.le] using hf)
    (by fun_prop)
    (by simpa only [min_eq_left pi_pos.le, max_eq_right pi_pos.le] using hd)
    (fun θ _ ↦ by
      simpa only [Function.comp_def, mul_one, mul_comm] using
        (hasDerivAt_sin ((n : ℝ) * θ)).comp θ
          ((hasDerivAt_id θ).const_mul (n : ℝ)))
    hg (by apply Continuous.intervalIntegrable; fun_prop)
  simp only [mul_zero, sin_zero, mul_zero, sin_nat_mul_pi, sub_zero, zero_sub] at hb
  have hi : (n : ℝ) * (∫ θ in 0..π, f (cos θ) * cos (n * θ)) =
      -(∫ θ in 0..π, g' θ * sin (n * θ)) := by
    rw [← intervalIntegral.integral_const_mul]
    convert hb using 1
    congr 1
    funext θ
    ring
  rw [coefficient_eq_integral_cos, ite_eq_right hn]
  apply (mul_left_cancel₀ hn')
  calc
    _ = (2 / π) * ((n : ℝ) * ∫ θ in 0..π, f (cos θ) * cos (n * θ)) := by ring
    _ = _ := by rw [hi]; field_simp
source
Theorem 2.3.8 Integration against a signed density
✓ 🤖

Let \(\mu \) be a measure, \(h\in L^1(\mu )\) real-valued, and \(u\) an almost-everywhere strongly measurable, essentially bounded function with values in a real normed vector space. Integrating \(u\) against the signed measure with density \(h\) agrees with \(\int h u\, d\mu \). The same identity holds after restriction to a measurable set.

Lean Formalisation
theorem MeasureTheory.VectorMeasure.integral_withDensityᵥ_of_bound.{u_1, u_2} {X : Type u_1} {E : Type u_2} [MeasurableSpace X]
  [NormedAddCommGroup E] [NormedSpace ℝ E] {μ : MeasureTheory.Measure X} {f : X → ℝ} {g : X → E}
  (hf : MeasureTheory.Integrable f μ) (hg : MeasureTheory.AEStronglyMeasurable g μ) {C : ℝ}
  (hC : ∀ᵐ (x : X) ∂μ, ‖g x‖ ≤ C) : ∫ᵛ (x : X), g x ∂<•μ.withDensityᵥ f = ∫ (x : X), f x • g x ∂μ
Lean proof
/-- Integrating a bounded function against an integrable real density agrees with
integrating its scalar product with that density. -/
theorem integral_withDensityᵥ_of_bound {f : X → ℝ} {g : X → E}
    (hf : Integrable f μ) (hg : AEStronglyMeasurable g μ)
    {C : ℝ} (hC : ∀ᵐ x ∂μ, ‖g x‖ ≤ C) :
    ∫ᵛ x, g x ∂<•(μ.withDensityᵥ f) = ∫ x, f x • g x ∂μ := by
  let := isFiniteMeasure_withDensity_ofReal hf.2
  let := isFiniteMeasure_withDensity_ofReal hf.neg.2
  have hp : Integrable (fun x ↦ (ENNReal.ofReal (f x)).toReal • g x) μ := by
    simp only [ENNReal.toReal_ofReal']
    exact hf.pos_part.smul_bdd C hg hC
  have hn : Integrable (fun x ↦ (ENNReal.ofReal (-f x)).toReal • g x) μ := by
    simp only [ENNReal.toReal_ofReal']
    exact hf.neg_part.smul_bdd C hg hC
  have hp' : (μ.withDensity (fun x ↦ ENNReal.ofReal (f x))).toSignedMeasure.Integrable g := by
    change Integrable g _
    rw [Measure.variation_toSignedMeasure]
    exact (integrable_withDensity_iff_integrable_smul₀' hf.aestronglyMeasurable.aemeasurable.ennreal_ofReal
      (Filter.Eventually.of_forall fun _ ↦ ENNReal.ofReal_lt_top)).2 hp
  have hn' : (μ.withDensity (fun x ↦ ENNReal.ofReal (-f x))).toSignedMeasure.Integrable g := by
    change Integrable g _
    rw [Measure.variation_toSignedMeasure]
    exact (integrable_withDensity_iff_integrable_smul₀' hf.aestronglyMeasurable.aemeasurable.neg.ennreal_ofReal
      (Filter.Eventually.of_forall fun _ ↦ ENNReal.ofReal_lt_top)).2 hn
  rw [withDensityᵥ_eq_withDensity_pos_part_sub_withDensity_neg_part hf,
    integral_sub_vectorMeasure hp' hn', integral_toSignedMeasure, integral_toSignedMeasure,
    integral_withDensity_eq_integral_toReal_smul₀ hf.aestronglyMeasurable.aemeasurable.ennreal_ofReal
      (Filter.Eventually.of_forall fun _ ↦ ENNReal.ofReal_lt_top),
    integral_withDensity_eq_integral_toReal_smul₀ (f := fun x ↦ ENNReal.ofReal (-f x))
      hf.aestronglyMeasurable.aemeasurable.neg.ennreal_ofReal
      (Filter.Eventually.of_forall fun _ ↦ ENNReal.ofReal_lt_top), ← MeasureTheory.integral_sub hp hn]
  apply MeasureTheory.integral_congr_ae
  exact Filter.Eventually.of_forall fun x ↦ by
    simp only [ENNReal.toReal_ofReal']
    exact (sub_smul (max (f x) 0) (max (-f x) 0) (g x)).symm.trans
      (congrArg (fun r : ℝ ↦ r • g x) (by grind))
source

Let \(f,g:\mathbb R\to \mathbb R\) have bounded variation on \(\mathbb R\), with \(g\) continuous. Suppose \(h\in L^1(\mathbb R)\) and \(g(v)-g(u)=\int _u^v h(x)\, dx\) for every \(u\le v\). Then \(dg=h\, dx\), and, for \(a\le b\),

\[ \int _a^b h(x)f(x)\, dx =g(b)f(b+)-g(a)f(a-)-\int _{[a,b]}g\, df. \]

In particular, if \(g(a)=g(b)=0\) and \(|g|\le C\) on \([a,b]\), with \(C\ge 0\), then

\[ \left|\int _a^b h(x)f(x)\, dx\right| \le C\operatorname {Var}_{\mathbb R}(f). \]

The density identification also holds for a continuous, locally absolutely continuous function \(g\) of bounded variation and any global integrable derivative representative \(h\in \mathcal D_{dx}(g)\). Jumps of \(f\) are allowed.

Reference: the integration-by-parts step in [ATAP, Chapter 7].

Lean Formalisation
theorem BoundedVariationOn.vectorMeasure_eq_withDensityᵥ_of_integral_eq_sub {f g : ℝ → ℝ} (hf : BoundedVariationOn f Set.univ)
  (hc : Continuous f) (hg : MeasureTheory.Integrable g MeasureTheory.volume)
  (hFTC : ∀ (a b : ℝ), a ≤ b → ∫ (x : ℝ) in a..b, g x = f b - f a) :
  hf.vectorMeasure = MeasureTheory.volume.withDensityᵥ g
Lean proof
/-- A continuous bounded-variation function whose increments are integrals of `g`
has Stieltjes measure with density `g`. -/
theorem vectorMeasure_eq_withDensityᵥ_of_integral_eq_sub {f g : ℝ → ℝ}
    (hf : BoundedVariationOn f univ) (hc : Continuous f) (hg : Integrable g)
    (hFTC : ∀ a b : ℝ, a ≤ b → ∫ x in a..b, g x = f b - f a) :
    hf.vectorMeasure = volume.withDensityᵥ g := by
  apply VectorMeasure.ext_of_Icc _ _
  intro a b hab
  rw [hf.vectorMeasure_Icc hab, hc.continuousAt.continuousWithinAt.rightLim_eq,
    hc.continuousAt.continuousWithinAt.leftLim_eq,
    withDensityᵥ_apply hg measurableSet_Icc, integral_Icc_eq_integral_Ioc,
    ← intervalIntegral.integral_of_le hab, hFTC a b hab]
source

Let \(a\le b\), let \(f\) have bounded variation on \([a,b]\), and let \(g:\mathbb R\to \mathbb R\) be Lipschitz. Suppose \(g'=h\) on \((a,b)\), \(h\) is integrable on \([a,b]\), \(g(a)=g(b)=0\), and \(|g|\le C\) there, with \(C\ge 0\). Then

\[ \left|\int _a^b h(x)f(x)\, dx\right| \le C\operatorname {Var}_{[a,b]}(f). \]

Reference: the bounded-variation integration step in [ATAP, Chapter 7].

Lean Formalisation
theorem BoundedVariationOn.eVariationOn_comp_projIcc_le {f : ℝ → ℝ} {a b : ℝ} (hab : a ≤ b) :
  eVariationOn (fun x => f ↑(Set.projIcc a b hab x)) Set.univ ≤ eVariationOn f (Set.Icc a b)
Lean proof
/-- Constant extension does not increase variation. -/
theorem eVariationOn_comp_projIcc_le {f : ℝ → ℝ} {a b : ℝ} (hab : a ≤ b) :
    eVariationOn (fun x ↦ f (projIcc a b hab x)) univ ≤ eVariationOn f (Icc a b) := by
  exact eVariationOn.comp_le_of_monotoneOn f (fun x ↦ (projIcc a b hab x : ℝ))
    (fun x _ y _ hxy ↦ monotone_projIcc hab hxy) (fun x _ ↦ (projIcc a b hab x).property)
source
Theorem 2.3.11 \(p\)-series tail estimate
✓ 🤖
#

For integers \(\nu ,M\ge 1\),

\[ \sum _{k=M+1}^{\infty }\frac{1}{k^{\nu +1}} \le \frac{1}{\nu M^\nu }. \]

Reference: the integral-test estimate in [ATAP, Theorem 7.2].

Lean Formalisation
theorem Real.tsum_one_div_nat_add_pow_le {ν M : ℕ} (hν : 1 ≤ ν) (hM : 0 < M) :
  ∑' (k : ℕ), 1 / ↑(k + (M + 1)) ^ (ν + 1) ≤ 1 / (↑ν * ↑M ^ ν)
Lean proof
/-- The tail of the `(ν + 1)`-power series is bounded by its integral,
`1 / (ν M^ν)`, when both natural numbers `ν` and `M` are positive. -/
theorem tsum_one_div_nat_add_pow_le {ν M : ℕ} (hν : 1 ≤ ν) (hM : 0 < M) :
    (∑' k : ℕ, 1 / ((k + (M + 1) : ℕ) : ℝ) ^ (ν + 1)) ≤
      1 / ((ν : ℝ) * (M : ℝ) ^ ν) := by
  have hν' : (0 : ℝ) < ν := by exact_mod_cast (show 0 < ν by omega)
  have hM' : (0 : ℝ) < M := by exact_mod_cast hM
  have hexp : -((ν + 1 : ℕ) : ℝ) < -1 := by push_cast; linarith
  have hanti : AntitoneOn (fun x : ℝ ↦ x ^ (-((ν + 1 : ℕ) : ℝ))) (Ici (M : ℝ)) := by
    intro x hx y hy hxy
    exact rpow_le_rpow_of_nonpos (hM'.trans_le hx) hxy (le_of_lt (hexp.trans (by norm_num)))
  have hi := hanti.tsum_comp_add_le_integral M (integrableOn_Ioi_rpow_of_lt hexp hM')
    (fun x hx ↦ rpow_nonneg (hM'.trans hx).le _)
  have hterm (k : ℕ) : ((k + M + 1 : ℕ) : ℝ) ^ (-((ν + 1 : ℕ) : ℝ)) =
      1 / ((k + (M + 1) : ℕ) : ℝ) ^ (ν + 1) := by
    rw [rpow_neg (by positivity), rpow_natCast]
    simp only [Nat.add_assoc, one_div]
  simp_rw [hterm] at hi
  rw [integral_Ioi_rpow_of_lt hexp hM'] at hi
  have he : -((ν + 1 : ℕ) : ℝ) + 1 = -(ν : ℝ) := by push_cast; ring
  rw [he, rpow_neg hM'.le, rpow_natCast] at hi
  convert hi using 1
  field_simp
source