LeanFun RevOLVER

4.3 Linear differential equations as almost-banded systems

To solve \(\sum _k a_k(x)u^{(k)}=f\) with boundary conditions, the ultraspherical spectral method [OT13], as implemented in ApproxFun [AF], represents \(u\) in \(T\) and the residual in \(C^{(N)}\). Each term \(a_kD^k\) becomes multiplication composed with differentiation and conversion, so the residual matrix is banded with bandwidths fixed by \(\deg a_k\) and \(N\). Boundary conditions add a few dense rows. This chapter proves the exact algebra of that assembly and the truncation errors for analytic data. Solver convergence is separate: Chapter 4.4 treats first-order problems with polynomial coefficients, assuming invertibility of the infinite preconditioned operator.

Definition 4.3.1 Polynomial differential operator
✓ 🤖
#

For polynomial coefficients \(a_k\) over a commutative ring, assemble the endomorphism \(L=\sum _{k=0}^N M[a_k]D^k\) on the polynomial module, where \(D\) is polynomial differentiation.

Reference: [OT13, Section 3].

Lean Formalisation
def Polynomial.differentialOperator.{u_1} {R : Type u_1} [CommRing R] (a : ℕ → Polynomial R) (N : ℕ) :
  Module.End R (Polynomial R)
Lean definition
/-- Assemble `∑ k ≤ N, a_k D^k` on the polynomial module (Olver--Townsend, Section 3). -/
noncomputable def differentialOperator (a : ℕ → R[X]) (N : ℕ) : Module.End R R[X] :=
  ∑ k ∈ Finset.range (N + 1), (LinearMap.mulLeft R (a k)).comp (derivative ^ k)
source

The assembled operator satisfies \(Lp=\sum _{k=0}^Na_kD^kp\) for every polynomial \(p\). Its coefficient map between any source and target polynomial bases reconstructs that exact residual. If each summand has bandwidths bounded by \((\ell ,u)\) in those common bases, then their sum has bandwidths \((\ell ,u)\). This is an algebraic assembly theorem with explicit term-bandwidth hypotheses, not a general all-order ultraspherical bandwidth or ODE solvability theorem.

Reference: [OT13, Section 3].

Lean Formalisation
theorem Polynomial.differentialOperator_apply.{u_1} {R : Type u_1} [CommRing R] (a : ℕ → Polynomial R) (N : ℕ)
  (p : Polynomial R) :
  (Polynomial.differentialOperator a N) p = ∑ k ∈ Finset.range (N + 1), a k * (⇑Polynomial.derivative)^[k] p
Lean proof
/-- Polynomial operator assembly has exactly the expected differential action. -/
theorem differentialOperator_apply (a : ℕ → R[X]) (N : ℕ) (p : R[X]) :
    differentialOperator a N p = ∑ k ∈ Finset.range (N + 1), a k * derivative^[k] p := by
  simp [differentialOperator, LinearMap.mulLeft_apply, Module.End.pow_apply]
source

Let \(N\ge 1\) and \(L=\sum _{k=0}^N a_kD^k\), with real polynomial coefficients and \(d_k=\operatorname {natDegree}a_k\). In Chebyshev input and \(B_N\) output, each term has bandwidths \((d_k,d_k+2N-k)\). Hence \(L\) has bandwidths \((\ell ,u)\) whenever \(d_k\le \ell \) and \(d_k+2N-k\le u\) for every \(k\le N\). A common degree bound \(d\) gives \((d,d+2N)\). For input supported on the first \(m\) coefficients, all residual coefficients at indices \(i\ge m+d\) vanish. These are exact polynomial statements.

Reference: [OT13, Section 3].

Lean Formalisation
theorem Polynomial.ultrasphericalBasis_mul_isBanded {N : ℕ} (hN : 1 ≤ N) (p : Polynomial ℝ) :
  ((Polynomial.ultrasphericalBasis N).toMatrix fun j => p * (Polynomial.ultrasphericalBasis N) j).IsBanded p.natDegree
    p.natDegree
Lean proof
/-- Polynomial multiplication has symmetric degree bandwidth at every positive level. -/
theorem ultrasphericalBasis_mul_isBanded {N : ℕ} (hN : 1 ≤ N) (p : ℝ[X]) :
    ((ultrasphericalBasis N).toMatrix (fun j ↦ p * ultrasphericalBasis N j)).IsBanded
      p.natDegree p.natDegree := by
  obtain ⟨k, rfl⟩ : ∃ k, N = k + 1 := ⟨N - 1, by omega⟩
  exact gegenbauerBasis_polynomial_mul_isBanded _ _ p
source

For a finite expansion \(p=\sum _jv_jT_j\), the four boundary rows are

\[ p(1)=\sum _jv_j,\quad p(-1)=\sum _j(-1)^jv_j,\quad p'(1)=\sum _jj^2v_j,\quad p'(-1)=\sum _j(-1)^{j+1}j^2v_j. \]

All sums are over the finite support. More generally, any real linear functional acts by the row of its values on the basis polynomials.

Reference: [OT13, Sections 2.4 and 3.2].

Lean Formalisation
theorem Polynomial.chebyshevBasis_functional_apply (L : Polynomial ℝ →ₗ[ℝ] ℝ) (v : ℕ →₀ ℝ) :
  L (Polynomial.chebyshevBasis.repr.symm v) = ∑ j ∈ v.support, v j * L (Polynomial.chebyshevBasis j)
Lean proof
/-- A scalar linear functional acts on finite Chebyshev coefficients by its row
of values on basis polynomials (Olver--Townsend 2013, §2). -/
theorem chebyshevBasis_functional_apply (L : ℝ[X] →ₗ[ℝ] ℝ) (v : ℕ →₀ ℝ) :
    L (chebyshevBasis.repr.symm v) =
      ∑ j ∈ v.support, v j * L (chebyshevBasis j) := by
  classical
  conv_lhs => rw [← v.sum_single]
  simp [Finsupp.sum, map_smul, smul_eq_mul]
source
Definition 4.3.5 Boundary-bordered coefficient map
✓ 🤖
#

For source and target bases \(b,c\), a linear residual map \(L\) and a linear map \(B\) of \(q\) boundary constraints, the bordered coefficient map sends finite coefficients \(v\) to \((Bp,\operatorname {repr}_c(Lp))\), where \(p=\operatorname {repr}_b^{-1}v\).

Reference: [OT13, Sections 2.4 and 3.2].

Lean Formalisation
def Module.Basis.borderedCoefficientMap.{u_1, u_2, u_3, u_4, u_5} {R : Type u_1} {M : Type u_2} {N : Type u_3}
  {ι : Type u_4} {κ : Type u_5} [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]
  (b : Module.Basis ι R M) (c : Module.Basis κ R N) {q : ℕ} (B : M →ₗ[R] Fin q → R) (L : M →ₗ[R] N) :
  (ι →₀ R) →ₗ[R] (Fin q → R) × (κ →₀ R)
Lean definition
/-- Attach finitely many boundary rows to a residual coefficient map
(Olver--Townsend 2013, §2). -/
noncomputable def borderedCoefficientMap (b : Basis ι R M) (c : Basis κ R N)
    {q : ℕ} (B : M →ₗ[R] (Fin q → R)) (L : M →ₗ[R] N) :
    (ι →₀ R) →ₗ[R] ((Fin q → R) × (κ →₀ R)) :=
  (B.comp b.repr.symm.toLinearMap).prod (b.coefficientMap c L)
source
Theorem 4.3.6 Exact boundary and residual assembly
✓ 🤖

The bordered equation with right-hand side \((\beta ,\operatorname {repr}_c f)\) is equivalent to \(Bp=\beta \) and \(Lp=f\) for the reconstructed finite expansion. This holds for module bases over a commutative semiring. In particular it applies to polynomial differential operators and their boundary functionals. It asserts neither invertibility nor convergence of a truncated ODE solver.

Reference: [OT13, Sections 2.4 and 3.2].

Lean Formalisation
theorem Module.Basis.borderedCoefficientMap_apply.{u_1, u_2, u_3, u_4, u_5} {R : Type u_1} {M : Type u_2} {N : Type u_3}
  {ι : Type u_4} {κ : Type u_5} [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]
  (b : Module.Basis ι R M) (c : Module.Basis κ R N) {q : ℕ} (B : M →ₗ[R] Fin q → R) (L : M →ₗ[R] N) (v : ι →₀ R) :
  (b.borderedCoefficientMap c B L) v = (B (b.repr.symm v), c.repr (L (b.repr.symm v)))
Lean proof
/-- Bordering computes precisely the boundary data and residual of the
reconstructed finite expansion. -/
theorem borderedCoefficientMap_apply (b : Basis ι R M) (c : Basis κ R N)
    {q : ℕ} (B : M →ₗ[R] (Fin q → R)) (L : M →ₗ[R] N) (v : ι →₀ R) :
    b.borderedCoefficientMap c B L v =
      (B (b.repr.symm v), c.repr (L (b.repr.symm v))) := rfl
source

Example (Julia).

Solve \(u'+xu=0\), \(u(-1)=1\), whose solution is \(e^{(1-x^2)/2}\). Each matrix below is one stated in Chapter 4.2: differentiation \(T\to U\), conversion \(T\to U\), and multiplication by \(x\) in the \(U\) basis. The residual block is banded, and the boundary row is \(u(-1)=\sum _j(-1)^jv_j\).

N = 30
D = zeros(N+1, N); for n in 1:N-1; D[n, n+1] = n; end   # T_n' = n U_{n-1}
S = zeros(N+1, N); S[1,1] = 1; S[2,2] = 1/2            # T -> U
for n in 0:N-3; S[n+3, n+3] += 1/2; S[n+1, n+3] -= 1/2; end
M = zeros(N+1, N+1)                     # x U_n = (U_{n+1}+U_{n-1})/2
for i in 1:N; M[i+1, i] = 1/2; M[i, i+1] = 1/2; end
L = D + M*S
v = [[(-1)^j for j in 0:N-1]'; L[1:N-1, :]] \ [1.0; zeros(N-1)]
u(x) = sum(v[j+1]*cos(j*acos(x)) for j in 0:N-1)
err(x) = abs(u(x) - exp((1 - x^2)/2))
maximum(err, range(-1, 1, length=201))          # about 1e-15

The residual block L[1:N-1,:] has 84 nonzeros out of 870. Exactness of the assembled operator on polynomials is established by the preceding results. The numerical error illustrates the solve; it is not a floating-point error bound.

For analytic solutions the same matrices act on the full coefficient sequence. Higher derivatives of Chebyshev series land in \(C^{(k)}\) with geometric errors, and truncating a represented solution leaves geometrically small residual and boundary defects.

Reference details: Classical derivatives of normally convergent polynomial series and related results
Theorem 4.3.7 Classical derivatives of normally convergent polynomial series
✓ 🤖

On an open \(U\subseteq \mathbb C\), suppose \(\sum _nu_n{\lt}\infty \) and \(|a_nP_n(z)|\le u_n\) for every \(n\) and \(z\in U\). Every function \(f:U\to \mathbb C\) represented by this series is analytic. For every \(m\ge 0\), the sum belongs to \(\mathcal D^m(U)\): it admits an order-\(m\) derivative chain on \(U\), with initial function \(z\mapsto \sum _n a_nP_n(z)\).

Lean Formalisation
theorem Polynomial.analyticOnOpen_of_hasSum_polynomial {P : ℕ → Polynomial ℂ} {a : ℕ → ℂ} {u : ℕ → ℝ}
  {U : TopologicalSpace.Opens ℂ} (hu : Summable u) (hb : ∀ (n : ℕ), ∀ z ∈ U, ‖a n * Polynomial.eval z (P n)‖ ≤ u n)
  {f : ↥U → ℂ} (hf : ∀ (z : ↥U), HasSum (fun n => a n * Polynomial.eval (↑z) (P n)) (f z)) : AnalyticOnOpen U f
Lean proof
/-- A normally convergent polynomial expansion is analytic on its typed domain. -/
theorem analyticOnOpen_of_hasSum_polynomial {P : ℕ → ℂ[X]} {a : ℕ → ℂ}
    {u : ℕ → ℝ} {U : TopologicalSpace.Opens ℂ} (hu : Summable u)
    (hb : ∀ n z, z ∈ U → ‖a n * (P n).eval z‖ ≤ u n)
    {f : U → ℂ} (hf : ∀ z : U, HasSum (fun n ↦ a n * (P n).eval z.val) (f z)) :
    AnalyticOnOpen U f :=
  (analyticOnOpen_iff U f (fun z ↦ ∑' n, a n * (P n).eval z)
    (fun z ↦ (hf z).tsum_eq)).2 (analyticOnNhd_polynomial_tsum hu hb)
source
Definition 4.3.8 Differential action on complex functions
✓ 🤖

Let \(U\subseteq \mathbb C\) be open and \(f:U\to \mathbb C\). For complex polynomial coefficients \(A_0,\ldots ,A_m\) and a point \(z\in U\) at which all derivatives of orders \(0,\ldots ,m\) exist in the sense of Definition 1.1.19, define \(\mathcal Lf(z)=\sum _{k=0}^m A_k(z)J_kf(z)\). The highest derivative need only exist at \(z\); no value is assigned at points without the required jet.

Reference: [OT13, Section 3].

Lean Formalisation
def Polynomial.differentialOperatorOnFunctions (A : ℕ → Polynomial ℂ) (m : ℕ) {U : TopologicalSpace.Opens ℂ} (f : ↥U → ℂ)
  (z : DerivativeJetPoint U m f) : ℂ
Lean definition
/-- A finite differential expression, only at points possessing its derivative jet. -/
noncomputable def differentialOperatorOnFunctions (A : ℕ → ℂ[X]) (m : ℕ)
    {U : TopologicalSpace.Opens ℂ} (f : U → ℂ) (z : DerivativeJetPoint U m f) : ℂ :=
  ∑ k : Fin (m + 1), (A k.val).eval z.val.val * derivativeJet z k
source

For \(f\in \mathcal D^m(U)\), the action equals \(\sum _{k=0}^m A_k(z)D_U^kf(z)\), where \(D_U^kf\) is obtained from the order-\(k\) truncation of the derivative chain of \(f\). Every polynomial \(p\) restricted to \(U\) belongs to \(\mathcal D^m(U)\), and \(\mathcal Lp(z)=(Lp)(z)\), where \(L\) is polynomial differential assembly.

Lean Formalisation
theorem Polynomial.differentialOperatorOnFunctions_ofIterated (A : ℕ → Polynomial ℂ) (m : ℕ) {U : TopologicalSpace.Opens ℂ}
  (f : IteratedDerivInput U m) (z : ↥U) :
  Polynomial.differentialOperatorOnFunctions A m (↑f) (DerivativeJetPoint.ofIterated f z) =
    ∑ k, Polynomial.eval (↑z) (A ↑k) * iteratedDerivOnOpen (f.truncate ⋯) z
Lean proof
/-- Actual derivative chains supply the pointwise differential action. -/
theorem differentialOperatorOnFunctions_ofIterated
    (A : ℕ → ℂ[X]) (m : ℕ) {U : TopologicalSpace.Opens ℂ}
    (f : IteratedDerivInput U m) (z : U) :
    differentialOperatorOnFunctions A m f.val (.ofIterated f z) =
      ∑ k : Fin (m + 1), (A k.val).eval z.val *
        iteratedDerivOnOpen (f.truncate (Nat.le_of_lt_succ k.isLt)) z := by
  unfold differentialOperatorOnFunctions
  apply Finset.sum_congr rfl
  intro k _
  change (A k.val).eval z.val * derivativeJet (DerivativeJetPoint.ofIterated f z) k = _
  rw [derivativeJet_ofIterated]
source

The polynomial and function actions agree on polynomials, and polynomial assembly commutes with changing the coefficient ring. If \(U\subset \mathbb {C}\) is open and \(|a_nP_n(z)|\le u_n\) on \(U\) with \(\sum _n u_n{\lt}\infty \), then \(\mathcal LS=\sum _n a_n LP_n\) on \(U\). If the coefficient matrix reconstruction is absolutely convergent at \(z\), its weighted contribution series represents \(\mathcal LS(z)\). If each coefficient row converges, this is also the coefficient-times-mode series. This includes bases over a ring \(R\) evaluated through \(\sigma :R\to \mathbb C\).

Lean Formalisation
theorem Polynomial.differentialOperator_map.{u_1, u_2} {R : Type u_1} [CommRing R] {S : Type u_2} [CommRing S] (σ : R →+* S)
  (A : ℕ → Polynomial R) (m : ℕ) (p : Polynomial R) :
  Polynomial.map σ ((Polynomial.differentialOperator A m) p) =
    (Polynomial.differentialOperator (fun k => Polynomial.map σ (A k)) m) (Polynomial.map σ p)
Lean proof
/-- Polynomial differential assembly commutes with changing the coefficient ring. -/
theorem differentialOperator_map {S : Type*} [CommRing S] (σ : R →+* S)
    (A : ℕ → R[X]) (m : ℕ) (p : R[X]) :
    (differentialOperator A m p).map σ =
      differentialOperator (fun k ↦ (A k).map σ) m (p.map σ) := by
  simp only [differentialOperator_apply, Polynomial.map_sum, Polynomial.map_mul,
    iterate_derivative_map]
source

No ODE solvability assertion is made.

Reference details: Higher Chebyshev derivatives in ultraspherical bases and related results

If \(\rho {\gt}1\) and \(|a_n|\le C\rho ^{-n}\), the complex Chebyshev sum \(S_a=\sum _n a_nT_n\) can be differentiated termwise to every order on \(E_\rho \). For \(k\ge 0\) its positive-order derivative is

\[ S_a^{(k+1)}(z)=\sum _{n\ge 0}a_{n+k+1}2^k k!(n+k+1)C_n^{(k+1)}(z). \]

Reference: [OT13, Section 3].

Lean Formalisation
theorem Polynomial.Chebyshev.norm_chebyshev_term_le_geometric {a : ℕ → ℂ} {C ρ r : ℝ} (hρ : 1 < ρ) (hr : 1 < r)
  (ha : ∀ (n : ℕ), ‖a n‖ ≤ C / ρ ^ n) (n : ℕ) (z : ℂ) (hz : z ∈ Complex.bernsteinEllipse ⟨r, hr⟩) :
  ‖a n * Polynomial.eval z (Polynomial.Chebyshev.T ℂ ↑n)‖ ≤ C * (r / ρ) ^ n
Lean proof
/-- Geometric coefficients give a uniform majorant on each smaller ellipse. -/
theorem norm_chebyshev_term_le_geometric {a : ℕ → ℂ} {C ρ r : ℝ} (hρ : 1 < ρ) (hr : 1 < r)
    (ha : ∀ n, ‖a n‖ ≤ C / ρ ^ n) (n : ℕ) (z : ℂ) (hz : z ∈ bernsteinEllipse ⟨r, hr⟩) :
    ‖a n * (T ℂ n).eval z‖ ≤ C * (r / ρ) ^ n := by
  have hC : 0 ≤ C := (norm_nonneg (a 0)).trans (by simpa using ha 0)
  rw [norm_mul]
  calc
    _ ≤ (C / ρ ^ n) * r ^ n := mul_le_mul (ha n)
      (norm_eval_T_le_on_bernsteinEllipse hr hz n) (norm_nonneg _) (by positivity)
    _ = _ := by rw [div_pow]; ring
source

Assume \(\rho {\gt}1\) and \(|a_n|\le C\rho ^{-n}\) for every \(n\); choose \(1{\lt}r{\lt}\rho \), \(z\in E_r\), and \(\delta {\gt}0\) with its circle about \(z\) contained in \(E_r\). Then

\[ \left|S_a^{(k)}(z)-\sum _{n{\lt}N}a_nT_n^{(k)}(z)\right| \le \frac{k!}{\delta ^k}\frac{C(r/\rho )^N}{1-r/\rho }. \]

For every compact \(K\subset E_r\) a single positive \(\delta \) works for all \(z\in K\), all derivative orders \(k\), and all cutoffs \(N\).

Reference: [ATAP, Theorem 21.1].

Lean Formalisation
theorem Polynomial.Chebyshev.norm_iterated_derivative_complexChebyshevSeries_sub_sum_le {a : ℕ → ℂ} {C ρ r δ : ℝ} (hρ : 1 < ρ)
  (hr : 1 < r) (hrρ : r < ρ) (ha : ∀ (n : ℕ), ‖a n‖ ≤ C / ρ ^ n) (k : ℕ) (z : ↑(Complex.bernsteinEllipse ⟨ρ, hρ⟩))
  (hz : ↑z ∈ Complex.bernsteinEllipse ⟨r, hr⟩) (hδ : 0 < δ)
  (hball : Metric.sphere (↑z) δ ⊆ Complex.bernsteinEllipse ⟨r, hr⟩) (N : ℕ) :
  ‖iteratedDerivOnOpen (Polynomial.Chebyshev.complexChebyshevSeriesDerivInput hρ ha k) z -
        ∑ n ∈ Finset.range N, a n * Polynomial.eval (↑z) ((⇑Polynomial.derivative)^[k] (Polynomial.Chebyshev.T ℂ ↑n))‖ ≤
    ↑k.factorial * (C * (r / ρ) ^ N / (1 - r / ρ)) / δ ^ k
Lean proof
/-- All-order truncation bounds for the classical derivative values. -/
theorem norm_iterated_derivative_complexChebyshevSeries_sub_sum_le {a : ℕ → ℂ}
    {C ρ r δ : ℝ} (hρ : 1 < ρ) (hr : 1 < r) (hrρ : r < ρ)
    (ha : ∀ n, ‖a n‖ ≤ C / ρ ^ n) (k : ℕ) (z : bernsteinEllipse ⟨ρ, hρ⟩)
    (hz : z.val ∈ bernsteinEllipse ⟨r, hr⟩) (hδ : 0 < δ)
    (hball : Metric.sphere z.val δ ⊆ bernsteinEllipse ⟨r, hr⟩) (N : ℕ) :
    ‖iteratedDerivOnOpen (complexChebyshevSeriesDerivInput hρ ha k) z -
      ∑ n ∈ Finset.range N, a n * (derivative^[k] (T ℂ n)).eval z.val‖ ≤
      k.factorial * (C * (r / ρ) ^ N / (1 - r / ρ)) / δ ^ k := by
  rw [iteratedDeriv_complexChebyshevSeries_eq]
  have hq0 : 0 ≤ r / ρ := by positivity
  have hq1 : r / ρ < 1 := (div_lt_one (by linarith : 0 < ρ)).2 hrρ
  have h := norm_iterated_derivative_series_sub_sum_le (P := fun n ↦ T ℂ n) (a := a)
    (isOpen_bernsteinEllipse ⟨r, hr⟩) ((summable_geometric_of_lt_one hq0 hq1).mul_left C)
    (norm_chebyshev_term_le_geometric hρ hr ha) k hz hδ hball N
  simpa only [tsum_geometric_majorant_tail hq0 hq1 N] using h
source

Polynomial multiplication in the Chebyshev basis has finite bandwidth. For every \(m\ge 0\) and real polynomial coefficients \(A_k\), the matrix from \(T\) to \(B_m\) for \(\sum _{k=0}^mA_kD^k\) has finite bandwidth. Thus for every complex coefficient sequence \(a\), each row series \(\sum _j M_{ij}a_j\) has only finitely many nonzero terms and converges, including for the order-zero multiplication operator.

Lean Formalisation
theorem Polynomial.exists_isBanded_chebyshev_mul (p : Polynomial ℝ) :
  ∃ d, (Polynomial.chebyshevBasis.toMatrix fun j => p * Polynomial.chebyshevBasis j).IsBanded d d
Lean proof
theorem exists_isBanded_chebyshev_mul (p : ℝ[X]) :
    ∃ d, (chebyshevBasis.toMatrix (fun j ↦ p * chebyshevBasis j)).IsBanded d d := by
  classical
  let d := (chebyshevBasis.repr p).support.sup id
  refine ⟨d, ?_⟩
  intro i j hij
  change chebyshevBasis.repr (p * chebyshevBasis j) i = 0
  have hp : ∑ k ∈ (chebyshevBasis.repr p).support,
      (chebyshevBasis.repr p k) • chebyshevBasis k = p := by
    simpa only [Finsupp.linearCombination_apply, Finsupp.sum] using
      chebyshevBasis.linearCombination_repr p
  rw [← hp, Finset.sum_mul, map_sum, Finsupp.finsetSum_apply]
  apply Finset.sum_eq_zero
  intro k hk
  simp only [smul_mul_assoc, map_smul, Finsupp.smul_apply, smul_eq_mul]
  have hk' : k ≤ d := Finset.le_sup (f := id) hk
  have hdiff : ((k : ℤ) - j).natAbs = if j ≤ k then k - j else j - k := by
    split_ifs with h
    · exact Int.natAbs_natCast_sub_natCast_of_ge h
    · exact Int.natAbs_natCast_sub_natCast_of_le (by omega)
  have h1 : i ≠ k + j := by rcases hij with h | h <;> omega
  have h2 : i ≠ ((k : ℤ) - j).natAbs := by
    rw [hdiff]
    split_ifs <;> rcases hij with h | h <;> omega
  have he := two_mul_chebyshevBasis_repr_mul k j i
  simp only [ite_eq_right h1, ite_eq_right h2, add_zero] at he
  have hz : chebyshevBasis.repr (chebyshevBasis k * chebyshevBasis j) i = 0 := by linarith
  rw [hz, mul_zero]
source
Theorem 4.3.14 Analytic ultraspherical residual assembly
✓ 🤖

Let \(L=\sum _{k=0}^m A_kD^k\) have real polynomial coefficients. On a normally convergent complex Chebyshev expansion, the existing matrix from \(T\) to \(B_m\), under the weighted reconstruction condition of Theorem 4.3.10, represents the analytic differential expression \(\mathcal LS\). For \(m\ge 1\) and \(\operatorname {natDegree} A_k\le d\), each output coefficient uses only indices \(j{\lt}i+d+2m+1\). This is the same matrix as finite polynomial assembly, without introducing a second complex basis definition.

Lean Formalisation
theorem Polynomial.ultraspherical_series_differentialOperator_eq_sum (A : ℕ → Polynomial ℝ) {m d : ℕ} (hm : 1 ≤ m)
  (hd : ∀ k ≤ m, (A k).natDegree ≤ d) (a : ℕ → ℂ) (i : ℕ) :
  Polynomial.chebyshevBasis.seriesCoefficientMap (Polynomial.ultrasphericalBasis m)
      (Polynomial.differentialOperator A m) Complex.ofRealHom
      (Polynomial.ultrasphericalDifferentialSeriesInput A m a i) =
    ∑ j ∈ Finset.range (i + (d + 2 * m) + 1),
      a j *
        ↑(((Polynomial.ultrasphericalBasis m).repr
              ((Polynomial.differentialOperator A m) (Polynomial.chebyshevBasis j)))
            i)
Lean proof
/-- Infinite residual assembly uses the proven finite row window. -/
theorem ultraspherical_series_differentialOperator_eq_sum
    (A : ℕ → ℝ[X]) {m d : ℕ} (hm : 1 ≤ m)
    (hd : ∀ k ≤ m, (A k).natDegree ≤ d) (a : ℕ → ℂ) (i : ℕ) :
    chebyshevBasis.seriesCoefficientMap (ultrasphericalBasis m)
      (differentialOperator A m) ofRealHom (ultrasphericalDifferentialSeriesInput A m a i) =
      ∑ j ∈ Finset.range (i + (d + 2 * m) + 1),
        a j * ((ultrasphericalBasis m).repr (differentialOperator A m (chebyshevBasis j)) i : ℂ) := by
  have he : ultrasphericalDifferentialSeriesInput A m a i =
      Module.Basis.SeriesCoefficientInput.ofBanded _ _ _ _ a
        (ultraspherical_differentialOperator_isBanded_of_degree_le A hm hd) i :=
    Subtype.ext rfl
  rw [he]
  exact chebyshevBasis.seriesCoefficientMap_eq_sum_of_isBanded (ultrasphericalBasis m)
    (differentialOperator A m) ofRealHom a
    (ultraspherical_differentialOperator_isBanded_of_degree_le A hm hd) i
source

For \(\rho {\gt}1\), \(|a_n|\le C\rho ^{-n}\) and \(1{\lt}r{\lt}\rho \), the residual and boundary inequalities of Theorem 4.3.17 hold for the Chebyshev truncations with

\[ t_N=\frac{C(r/\rho )^N}{1-r/\rho }, \]

provided the evaluation points and the specified positive-radius circles lie in \(E_r\).

Lean Formalisation
theorem Polynomial.Chebyshev.norm_differentialOperator_complexChebyshevSeries_sub_sum_le {a : ℕ → ℂ} {C ρ r δ : ℝ} (hρ : 1 < ρ)
  (hr : 1 < r) (hrρ : r < ρ) (ha : ∀ (n : ℕ), ‖a n‖ ≤ C / ρ ^ n) (A : ℕ → Polynomial ℂ) (m : ℕ)
  (z : ↑(Complex.bernsteinEllipse ⟨ρ, hρ⟩)) (hz : ↑z ∈ Complex.bernsteinEllipse ⟨r, hr⟩) (hδ : 0 < δ)
  (hball : Metric.sphere (↑z) δ ⊆ Complex.bernsteinEllipse ⟨r, hr⟩) (N : ℕ) :
  ‖Polynomial.differentialOperatorOnFunctions A m (↑(Polynomial.Chebyshev.complexChebyshevSeriesDerivInput hρ ha m))
          (DerivativeJetPoint.ofIterated (Polynomial.Chebyshev.complexChebyshevSeriesDerivInput hρ ha m) z) -
        Polynomial.eval (↑z)
          ((Polynomial.differentialOperator A m) (∑ n ∈ Finset.range N, a n • Polynomial.Chebyshev.T ℂ ↑n))‖ ≤
    (∑ k ∈ Finset.range (m + 1), ‖Polynomial.eval (↑z) (A k)‖ * ↑k.factorial / δ ^ k) * (C * (r / ρ) ^ N / (1 - r / ρ))
Lean proof
/-- Residual errors are bounded on the actual geometric derivative domain. -/
theorem norm_differentialOperator_complexChebyshevSeries_sub_sum_le
    {a : ℕ → ℂ} {C ρ r δ : ℝ} (hρ : 1 < ρ) (hr : 1 < r) (hrρ : r < ρ)
    (ha : ∀ n, ‖a n‖ ≤ C / ρ ^ n) (A : ℕ → ℂ[X]) (m : ℕ)
    (z : bernsteinEllipse ⟨ρ, hρ⟩) (hz : z.val ∈ bernsteinEllipse ⟨r, hr⟩) (hδ : 0 < δ)
    (hball : Metric.sphere z.val δ ⊆ bernsteinEllipse ⟨r, hr⟩) (N : ℕ) :
    ‖differentialOperatorOnFunctions A m (complexChebyshevSeriesDerivInput hρ ha m).val
        (.ofIterated (complexChebyshevSeriesDerivInput hρ ha m) z) -
      (differentialOperator A m (∑ n ∈ Finset.range N, a n • T ℂ n)).eval z.val‖ ≤
      (∑ k ∈ Finset.range (m + 1), ‖(A k).eval z.val‖ * k.factorial / δ ^ k) *
        (C * (r / ρ) ^ N / (1 - r / ρ)) := by
  have h := norm_boundary_complexChebyshevSeries_sub_sum_le hρ hr hrρ ha
    (Finset.range (m + 1)) (fun k ↦ (A k).eval z.val) id (fun _ ↦ z.val) (fun _ ↦ δ)
    (fun _ _ ↦ hz) (fun _ _ ↦ hδ) (fun _ _ ↦ hball) N
  have he : ∀ w : bernsteinEllipse ⟨ρ, hρ⟩,
      (∑' n, a n * (T ℂ n).eval w.val) = (complexChebyshevSeriesDerivInput hρ ha m).val w := by
    intro w
    exact (complexChebyshevSeries_eq_tsum (ComplexChebyshevSeriesPoint.ofGeometric hρ ha w)
      (summable_chebyshevSeries_of_geometric hρ ha w.property)).symm
  rw [differentialOperatorOnFunctions_eq_extension A m (complexChebyshevSeriesDerivInput hρ ha m)
    _ (analyticOnNhd_chebyshev_tsum hρ ha) he]
  simp_rw [iteratedDeriv_complexChebyshevSeries_eq] at h
  simp only [id_eq] at h
  rw [(Finset.range (m + 1)).sum_coe_sort
    (fun k ↦ (A k).eval z.val * iteratedDeriv k (fun w ↦ ∑' n, a n * (T ℂ n).eval w) z.val)] at h
  simpa only [differentialOperator_apply, iterate_derivative_sum, iterate_derivative_smul,
    eval_finsetSum, eval_mul, eval_smul, smul_eq_mul, id_eq] using h
source

These estimates concern truncation of a represented function, not convergence or invertibility of a numerical ODE solver.

Both real endpoints can be used with sufficiently small radii, since \(\pm 1\in E_r\) and \(E_r\) is open; this step is not formalised.

Supporting results: all-order series differentiation, generic residual bounds

Let \(U\subset \mathbb C\) be open and \(P_n\in \mathbb C[x]\). Suppose \(\sum _n u_n{\lt}\infty \) and \(|a_nP_n(z)|\le u_n\) for every \(z\in U\). Then \(S=\sum _n a_nP_n\) satisfies, for every integer \(k\ge 0\),

\[ S^{(k)}(z)=\sum _n a_n P_n^{(k)}(z), \]

with locally uniform convergence of the differentiated finite sums, hence uniform convergence on every compact subset of \(U\). If \(z\in U\), \(\delta {\gt}0\), and the circle of radius \(\delta \) about \(z\) lies in \(U\), then

\[ \left|S^{(k)}(z)-\sum _{n{\lt}N}a_nP_n^{(k)}(z)\right| \le \frac{k!}{\delta ^k}\sum _{n\ge N}u_n. \]

No new majorant for each derivative order is assumed.

Reference: Weierstrass’s theorem on locally uniform limits of analytic functions.

Lean Formalisation
theorem Polynomial.iteratedDeriv_eval (p : Polynomial ℂ) (k : ℕ) :
  (iteratedDeriv k fun z => Polynomial.eval z p) = fun z => Polynomial.eval z ((⇑Polynomial.derivative)^[k] p)
Lean proof
/-- Analytic iterated derivatives agree with iterates of polynomial differentiation. -/
theorem iteratedDeriv_eval (p : ℂ[X]) (k : ℕ) :
    iteratedDeriv k (fun z ↦ p.eval z) = fun z ↦ (derivative^[k] p).eval z := by
  induction k with
  | zero => rfl
  | succ k ih =>
    funext z
    rw [iteratedDeriv_succ, ih, Polynomial.deriv]
    simp only [Function.iterate_succ_apply']
source
Theorem 4.3.17 Residual and boundary truncation errors
✓ 🤖

Let \(p_N=\sum _{n{\lt}N}a_nP_n\) and \(t_N=\sum _{n\ge N}u_n\). For \(z\in U\) and a radius-\(\delta \) circle contained in \(U\), with \(\delta {\gt}0\),

\[ |\mathcal LS(z)-(Lp_N)(z)|\le \left(\sum _{k=0}^m |A_k(z)|\frac{k!}{\delta ^k}\right)t_N. \]

For a finite boundary functional \(Bf=\sum _i c_i f^{(k_i)}(z_i)\), where \(z_i\in U\) and positive radii \(\delta _i\) have their circles in \(U\),

\[ |BS-Bp_N|\le \left(\sum _i|c_i|\frac{k_i!}{\delta _i^{k_i}}\right)t_N. \]

This includes value, derivative, and Robin conditions.

Lean Formalisation
theorem Polynomial.norm_differentialOperator_series_sub_sum_le {P : ℕ → Polynomial ℂ} {a : ℕ → ℂ} {u : ℕ → ℝ}
  {U : TopologicalSpace.Opens ℂ} (hu : Summable u) (hb : ∀ (n : ℕ), ∀ z ∈ U, ‖a n * Polynomial.eval z (P n)‖ ≤ u n)
  (A : ℕ → Polynomial ℂ) (m : ℕ) (f : IteratedDerivInput U m)
  (hf : ∀ (z : ↥U), HasSum (fun n => a n * Polynomial.eval (↑z) (P n)) (↑f z)) (z : ↥U) {δ : ℝ} (hδ : 0 < δ)
  (hball : Metric.sphere (↑z) δ ⊆ ↑U) (N : ℕ) :
  ‖Polynomial.differentialOperatorOnFunctions A m (↑f) (DerivativeJetPoint.ofIterated f z) -
        Polynomial.eval (↑z) ((Polynomial.differentialOperator A m) (∑ n ∈ Finset.range N, a n • P n))‖ ≤
    (∑ k ∈ Finset.range (m + 1), ‖Polynomial.eval (↑z) (A k)‖ * ↑k.factorial / δ ^ k) * ∑' (n : ℕ), u (n + N)
Lean proof
/-- Differential residual error on the genuine derivative domain. -/
theorem norm_differentialOperator_series_sub_sum_le {P : ℕ → ℂ[X]} {a : ℕ → ℂ}
    {u : ℕ → ℝ} {U : TopologicalSpace.Opens ℂ} (hu : Summable u)
    (hb : ∀ n z, z ∈ U → ‖a n * (P n).eval z‖ ≤ u n)
    (A : ℕ → ℂ[X]) (m : ℕ) (f : IteratedDerivInput U m)
    (hf : ∀ z : U, HasSum (fun n ↦ a n * (P n).eval z.val) (f.val z))
    (z : U) {δ : ℝ} (hδ : 0 < δ) (hball : Metric.sphere z.val δ ⊆ U) (N : ℕ) :
    ‖differentialOperatorOnFunctions A m f.val (.ofIterated f z) -
      (differentialOperator A m (∑ n ∈ Finset.range N, a n • P n)).eval z.val‖ ≤
      (∑ k ∈ Finset.range (m + 1), ‖(A k).eval z.val‖ * k.factorial / δ ^ k) *
        (∑' n, u (n + N)) := by
  rw [differentialOperatorOnFunctions_eq_extension A m f
    (fun z ↦ ∑' n, a n * (P n).eval z) (analyticOnNhd_polynomial_tsum hu hb)
    (fun z ↦ (hf z).tsum_eq)]
  exact norm_differentialOperator_series_sub_sum_le_tsum U.isOpen hu hb A m z.property hδ hball N
source