LeanFun RevOLVER

3.1 Orthogonal polynomials for a general measure

The recurrence, kernel and zero structure of orthogonal polynomials follow from a general measure and its polynomial inner product. Completeness requires a separate density assumption.

3.1.1 Measures and orthogonality

A degree-graded sequence has one polynomial \(P_n\) of degree \(n\) for each \(n\ge 0\). Orthogonality is a separate condition on the integrals of its products. Squared norms need not be positive until a nondegeneracy hypothesis is imposed.

Definition 3.1.1 Orthogonal polynomial sequence
✓ 🤖
#

For \(P:\operatorname {Polynomial.Sequence}\mathbb {R}\) and a measure \(\mu \), require integrability of each product \(P_mP_n\) and vanishing integrals when \(m\ne n\). This predicate alone imposes no normalisation or positivity of squared norms.

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
inductive Polynomial.Sequence.IsOrthogonal (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) : Prop
Lean definition
/-- A polynomial sequence is orthogonal when its pairwise products are integrable
and distinct elements have zero integral product (DLMF 18.2(i), Szegő, Chapter 3).
Positivity of squared norms is deliberately a separate hypothesis. -/
structure IsOrthogonal (P : Sequence ℝ) (μ : Measure ℝ) : Prop where
  integrable : ∀ m n, Integrable (fun x => (P m).eval x * (P n).eval x) μ
  orthogonal : ∀ m n, m ≠ n → ∫ x, (P m).eval x * (P n).eval x ∂μ = 0
source
Theorem 3.1.2 First-kind Chebyshev sequence is orthogonal
✓ 🤖

The sequence \((T_n)_{n\in \mathbb {N}}\) is an orthogonal polynomial sequence for \(\mu _T\) in the sense of Definition 3.1.1.

Reference: [DLMF, Table 18.3.1].

Lean Formalisation
theorem Polynomial.Chebyshev.isOrthogonal_chebyshevTsequence :
  (Polynomial.Chebyshev.chebyshevTsequence ℝ).IsOrthogonal Polynomial.Chebyshev.classicalMeasureT
Lean proof
/-- Mathlib's first-kind Chebyshev sequence satisfies the general orthogonality
predicate for its standard weight (DLMF Table 18.3.1). -/
theorem isOrthogonal_chebyshevTsequence :
    (chebyshevTsequence ℝ).IsOrthogonal classicalMeasureT where
  integrable m n := integrable_classicalMeasureT (by fun_prop)
  orthogonal m n hmn := by simpa only [chebyshevTsequence, hmn, ite_false] using (classicalMeasureT_orthogonality m n).2
source
Definition 3.1.3 Finite polynomial moments
✓ 🤖
#

A Borel measure \(\mu \) on \(\mathbb {R}\) has finite polynomial moments when \(x\mapsto p(x)^2\) is \(\mu \)-integrable for every \(p\in \mathbb {R}[X]\). No interval-support or connectedness restriction is imposed.

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
def Polynomial.HasFiniteMoments (μ : MeasureTheory.Measure ℝ) : Prop
Lean definition
/-- Finite polynomial moments, expressed as square integrability of all polynomials
(DLMF 18.2(i), Szegő, Chapter 3). -/
def HasFiniteMoments (μ : Measure ℝ) : Prop :=
  ∀ p : ℝ[X], Integrable (fun x => p.eval x ^ 2) μ
source
Definition 3.1.4 Positive-definite polynomial integral
✓ 🤖

Require every polynomial square to be integrable and \(\int p(x)^2\, d\mu (x){\gt}0\) for every nonzero \(p\in \mathbb {R}[X]\).

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
inductive Polynomial.HasPositiveDefiniteIntegral (μ : MeasureTheory.Measure ℝ) : Prop
Lean definition
/-- Strict positivity of the polynomial integral pairing, without a support restriction
(DLMF 18.2(i), Szegő, Chapter 3). -/
structure HasPositiveDefiniteIntegral (μ : Measure ℝ) : Prop where
  /-- Every polynomial square has a classical finite integral. -/
  moments : HasFiniteMoments μ
  /-- Nonzero polynomial squares have strictly positive integrals. -/
  positive : ∀ p : ℝ[X], p ≠ 0 → 0 < ∫ x, p.eval x ^ 2 ∂μ
source
Definition 3.1.5 Integrable polynomial pairs
✓ 🤖

For a Borel measure \(\mu \) on \(\mathbb {R}\), an integrable polynomial pair consists of \(p,q\in \mathbb {R}[X]\) together with the condition \(pq\in L^1(\mu )\). Its pairing is the finite integral \(\langle p,q\rangle _\mu =\int pq\, d\mu \). This pairing is defined only on integrable pairs; no assumption on other polynomial moments is required.

Lean Formalisation
inductive Polynomial.IntegrablePair (μ : MeasureTheory.Measure ℝ) : Type
Lean definition
/-- A polynomial pair whose product has a finite integral (DLMF 18.2(i)).
No moment condition is imposed on other polynomials. -/
structure IntegrablePair (μ : Measure ℝ) where
  left : ℝ[X]
  right : ℝ[X]
  integrable : Integrable (fun x => left.eval x * right.eval x) μ
source

Under the moment and positivity hypotheses, \(\mu \) is finite, every polynomial product is integrable, and \(\langle p,q\rangle _\mu =\int p(x)q(x)\, d\mu (x)\) defines an inner product on \(\mathbb {R}[X]\).

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.HasFiniteMoments.integrable_mul {μ : MeasureTheory.Measure ℝ} (hμ : Polynomial.HasFiniteMoments μ)
  (p q : Polynomial ℝ) : MeasureTheory.Integrable (fun x => Polynomial.eval x p * Polynomial.eval x q) μ
Lean proof
/-- Finite polynomial moments make all polynomial products integrable
(DLMF 18.2(i), Szegő, Chapter 3). -/
@[aesop (rule_sets := [PolynomialIntegrability]) unsafe 80% apply]
theorem HasFiniteMoments.integrable_mul {μ : Measure ℝ} (hμ : HasFiniteMoments μ)
    (p q : ℝ[X]) : Integrable (fun x => p.eval x * q.eval x) μ := by
  have hp : MemLp (fun x => p.eval x) 2 μ :=
    (memLp_two_iff_integrable_sq (by fun_prop)).2 (hμ p)
  have hq : MemLp (fun x => q.eval x) 2 μ :=
    (memLp_two_iff_integrable_sq (by fun_prop)).2 (hμ q)
  exact hp.integrable_mul hq
source
Theorem 3.1.7 Polynomial moments on a finite interval
✓ 🤖

A finite measure on \(\mathbb {R}\) supported almost everywhere on a closed bounded interval has finite polynomial moments.

Lean Formalisation
theorem Polynomial.hasFiniteMoments_of_ae_mem_Icc {μ : MeasureTheory.Measure ℝ} [MeasureTheory.IsFiniteMeasure μ] {a b : ℝ}
  (hx : ∀ᵐ (x : ℝ) ∂μ, x ∈ Set.Icc a b) : Polynomial.HasFiniteMoments μ
Lean proof
/-- Finite interval support supplies every polynomial moment. -/
@[aesop (rule_sets := [PolynomialIntegrability]) unsafe 70% apply]
theorem hasFiniteMoments_of_ae_mem_Icc {μ : Measure ℝ} [IsFiniteMeasure μ]
    {a b : ℝ} (hx : ∀ᵐ x ∂μ, x ∈ Icc a b) : HasFiniteMoments μ := by
  intro p
  have hi := (p.continuous.pow 2).integrableOn_Icc (μ := μ) (a := a) (b := b)
  rwa [IntegrableOn, Measure.restrict_eq_self_of_ae_mem hx] at hi
source
Orthogonality, moments and pairing identities

Every polynomial sequence is orthogonal for the zero measure. If \(P\) is orthogonal for \(\mu \), each \(P_n^2\) is \(\mu \)-integrable. If \(P\) is orthogonal for \(\mu \) and, for every \(n\), \(P_n\) and \(Q_n\) agree \(\mu \)-almost everywhere as functions, then \(Q\) is orthogonal for \(\mu \).

Reference: [DLMF, 18.2(i)].

Lean Formalisation
theorem Polynomial.Sequence.isOrthogonal_zero (P : Polynomial.Sequence ℝ) : P.IsOrthogonal 0
Lean proof
/-- Every polynomial sequence is orthogonal for the zero measure, demonstrating
why uniqueness needs nondegeneracy (DLMF 18.2(i), Szegő, Chapter 3). -/
theorem isOrthogonal_zero (P : Sequence ℝ) : P.IsOrthogonal 0 where
  integrable _ _ := integrable_zero_measure
  orthogonal _ _ _ := integral_zero_measure _
source
Theorem 3.1.9 Characterisation of positive polynomial integrals
✓ 🤖

A positive-definite polynomial integral has all polynomial moments finite. Every nonzero polynomial has strictly positive squared integral.

Lean Formalisation
theorem Polynomial.HasPositiveDefiniteIntegral.hasFiniteMoments {μ : MeasureTheory.Measure ℝ}
  (hpos : Polynomial.HasPositiveDefiniteIntegral μ) : Polynomial.HasFiniteMoments μ
Lean proof
/-- Positive square integrals are genuine finite integrals. -/
@[aesop (rule_sets := [PolynomialIntegrability]) unsafe 80% apply]
theorem HasPositiveDefiniteIntegral.hasFiniteMoments {μ : Measure ℝ}
    (hpos : HasPositiveDefiniteIntegral μ) : HasFiniteMoments μ :=
  hpos.moments
source
Theorem 3.1.10 Characterisation of the integrable pairing
✓ 🤖

The pairing of an integrable pair \((p,q)\) is its integral \(\int pq\, d\mu \). It is symmetric. For an integrable diagonal pair, it equals \(\int p^2\, d\mu \).

Lean Formalisation
theorem Polynomial.integralInner_eq_integral (μ : MeasureTheory.Measure ℝ) (pq : Polynomial.IntegrablePair μ) :
  Polynomial.integralInner μ pq = ∫ (x : ℝ), Polynomial.eval x pq.left * Polynomial.eval x pq.right ∂μ
Lean proof
/-- The pairing is exactly the integral of its integrable product. -/
theorem integralInner_eq_integral (μ : Measure ℝ) (pq : IntegrablePair μ) :
    integralInner μ pq = ∫ x, pq.left.eval x * pq.right.eval x ∂μ := rfl
source
Theorem 3.1.11 Moments supplied by an orthogonal polynomial sequence
✓ 🤖

If a polynomial sequence is orthogonal for \(\mu \), including integrability of all its pairwise products, then \(\mu \) has finite polynomial moments. No positivity assumption is needed.

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.hasFiniteMoments {μ : MeasureTheory.Measure ℝ} {P : Polynomial.Sequence ℝ}
  (hP : P.IsOrthogonal μ) : Polynomial.HasFiniteMoments μ
Lean proof
/-- An orthogonal polynomial sequence supplies all polynomial moments.
This implication does not require positivity (DLMF 18.2(i)). -/
@[aesop (rule_sets := [PolynomialIntegrability]) unsafe 80% apply]
theorem Sequence.IsOrthogonal.hasFiniteMoments {μ : Measure ℝ}
    {P : Sequence ℝ} (hP : P.IsOrthogonal μ) : HasFiniteMoments μ := by
  intro p
  have hm : p ∈ Submodule.span ℝ (Set.range P) := by
    rw [P.span (fun i => P.isUnit_leadingCoeff i)]
    trivial
  have hp : MemLp (fun x => p.eval x) 2 μ := by
    induction hm using Submodule.span_induction with
    | mem q hq =>
      obtain ⟨n, rfl⟩ := hq
      exact (memLp_two_iff_integrable_sq (by fun_prop)).2 (hP.integrable_sq n)
    | zero => simp
    | add p q _ _ hp hq => simpa only [eval_add, Pi.add_def] using hp.add hq
    | smul a p _ hp => simpa only [eval_smul, Pi.smul_def] using hp.const_smul a
  exact (memLp_two_iff_integrable_sq (by fun_prop)).1 hp
source

3.1.2 Existence and polynomial coefficients

The integral inner product gives existence and uniqueness up to scaling. Orthogonality to lower-degree polynomials then identifies expansion coefficients by integration.

Theorem 3.1.12 Existence of an orthogonal sequence
✓ 🤖

If \(\mu \) has finite polynomial moments and a positive definite polynomial pairing, there exists \(P:\operatorname {Polynomial.Sequence}\mathbb {R}\) with \(P.\operatorname {IsOrthogonal}(\mu )\). In particular \(\deg P_n=n\). Measures on unbounded sets or disjoint intervals are included when they satisfy the hypotheses.

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.exists_isOrthogonal (μ : MeasureTheory.Measure ℝ) (hμ : Polynomial.HasFiniteMoments μ)
  (hpos : Polynomial.HasPositiveDefiniteIntegral μ) : ∃ P, P.IsOrthogonal μ
Lean proof
/-- Every measure with finite polynomial moments and positive squared integrals
admits an orthogonal polynomial sequence of exact degrees (DLMF 18.2(i), Szegő, Chapter 3). -/
theorem exists_isOrthogonal (μ : Measure ℝ) (hμ : HasFiniteMoments μ)
    (hpos : HasPositiveDefiniteIntegral μ) : ∃ P : Sequence ℝ, P.IsOrthogonal μ := by
  let core : InnerProductSpace.Core ℝ ℝ[X] := integralInnerProductCore μ hμ hpos
  let : NormedAddCommGroup ℝ[X] := InnerProductSpace.Core.toNormedAddCommGroup (𝕜 := ℝ)
  let : InnerProductSpace ℝ ℝ[X] :=
    InnerProductSpace.ofCore (inferInstance : PreInnerProductSpace.Core ℝ ℝ[X])
  let P : Sequence ℝ := ⟨fun n => X ^ n, fun n => by simp⟩
  have hdegree (n : ℕ) : (gramSchmidt ℝ P n).degree = n := by
    have hunit (i : ℕ) : IsUnit (P i).leadingCoeff :=
      P.isUnit_leadingCoeff i
    have hspan (k : ℕ) : span ℝ (P '' Set.Iio k) = degreeLT ℝ k :=
      P.span_degreeLT (fun i _ => hunit i)
    have hmem : gramSchmidt ℝ P n ∈ span ℝ (P '' Set.Iio (n + 1)) := by
      rw [← span_gramSchmidt_Iio ℝ (P : ℕ → ℝ[X]) (n + 1)]
      exact subset_span ⟨n, Nat.lt_succ_self n, rfl⟩
    rw [hspan, mem_degreeLT] at hmem
    have hnot : ¬ (gramSchmidt ℝ P n).degree < n := by
      intro h
      have hm : gramSchmidt ℝ P n ∈ span ℝ (P '' Set.Iio n) := by
        rw [hspan, mem_degreeLT]; exact h
      rw [← span_gramSchmidt_Iio ℝ (P : ℕ → ℝ[X]) n] at hm
      exact (gramSchmidt_linearIndependent P.linearIndependent).notMem_span_image
        (by simp : n ∉ Set.Iio n) hm
    have hn := gramSchmidt_ne_zero n P.linearIndependent
    rw [degree_eq_natDegree hn] at hmem hnot ⊢
    norm_cast at hmem hnot ⊢
    omega
  let Q : Sequence ℝ := ⟨gramSchmidt ℝ P, hdegree⟩
  refine ⟨Q, ⟨fun m n => hμ.integrable_mul (Q m) (Q n), ?_⟩⟩
  intro m n hmn
  exact gramSchmidt_orthogonal ℝ P hmn
source
Theorem 3.1.13 Uniqueness up to scaling
✓ 🤖

If \(\mu \) has finite polynomial moments and a positive definite polynomial pairing, any two orthogonal sequences \(P,Q\) for the same \(\mu \) satisfy \(Q_n=c_nP_n\), where

\[ c_n=\frac{\operatorname {lc}(Q_n)}{\operatorname {lc}(P_n)}\ne 0. \]

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.eq_leadingCoeff_div_smul {μ : MeasureTheory.Measure ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) (hpos : Polynomial.HasPositiveDefiniteIntegral μ) {P Q : Polynomial.Sequence ℝ}
  (hP : P.IsOrthogonal μ) (hQ : Q.IsOrthogonal μ) (n : ℕ) : ↑Q n = ((↑Q n).leadingCoeff / (↑P n).leadingCoeff) • ↑P n
Lean proof
/-- At each index, two orthogonal sequences differ by the ratio of their leading
coefficients (DLMF 18.2(i), Szegő, Chapter 3). -/
theorem IsOrthogonal.eq_leadingCoeff_div_smul {μ : Measure ℝ}
    (hμ : HasFiniteMoments μ) (hpos : HasPositiveDefiniteIntegral μ)
    {P Q : Sequence ℝ} (hP : P.IsOrthogonal μ) (hQ : Q.IsOrthogonal μ) (n : ℕ) :
    Q n = ((Q n).leadingCoeff / (P n).leadingCoeff) • P n := by
  let c : ℝ := (Q n).leadingCoeff / (P n).leadingCoeff
  have hP0 := leadingCoeff_ne_zero.mpr (P.ne_zero n)
  have hQ0 := leadingCoeff_ne_zero.mpr (Q.ne_zero n)
  have hc : c ≠ 0 := div_ne_zero hQ0 hP0
  have hdeg : (Q n - c • P n).degree < n := by
    have h := degree_sub_lt_left
      (show (Q n).degree = (c • P n).degree by
        simp [degree_smul_of_smul_regular _ (IsSMulRegular.of_ne_zero hc)])
      (Q.ne_zero n) (show (Q n).leadingCoeff = (c • P n).leadingCoeff by
        rw [leadingCoeff_smul_of_smul_regular _ (IsSMulRegular.of_ne_zero hc)]
        simp [c, hP0])
    simpa using h
  have hq := hQ.integralInner_eq_zero_of_degree_lt hμ hdeg
  have hp := hP.integralInner_eq_zero_of_degree_lt hμ hdeg
  have hzero : integralInner μ (IntegrablePair.of μ (Q n - c • P n) (Q n - c • P n)) = 0 := by
    rw [integralInner_sub_left hμ, integralInner_smul_left,
      integralInner_comm μ (Q n), integralInner_comm μ (P n), hq, hp]
    all_goals first | exact hμ.integrable_mul _ _ | ring
  exact sub_eq_zero.mp (hpos.eq_zero_of_integralInner_self_eq_zero hzero)
source

This concerns a fixed measure; it does not assert moment determinacy or \(L^2\) completeness.

Theorem 3.1.14 Orthogonality to lower-degree polynomials
✓ 🤖

If \(P\) is orthogonal for a measure with finite polynomial moments and \(\deg p{\lt}n\), then \(\langle p,P_n\rangle _\mu =0\).

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.integralInner_eq_zero_of_degree_lt {μ : MeasureTheory.Measure ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) {P : Polynomial.Sequence ℝ} (hP : P.IsOrthogonal μ) {p : Polynomial ℝ} {n : ℕ}
  (hp : p.degree < ↑n) : Polynomial.integralInner μ (Polynomial.IntegrablePair.of μ p (↑P n) ⋯) = 0
Lean proof
/-- A sequence element is orthogonal to every polynomial of lower degree
(DLMF 18.2(i), Szegő, Chapter 3). -/
theorem IsOrthogonal.integralInner_eq_zero_of_degree_lt {μ : Measure ℝ}
    (hμ : HasFiniteMoments μ) {P : Sequence ℝ} (hP : P.IsOrthogonal μ)
    {p : ℝ[X]} {n : ℕ} (hp : p.degree < n) : integralInner μ (IntegrablePair.of μ p (P n)) = 0 := by
  have hm : p ∈ span ℝ (P '' Set.Iio n) := by
    rw [P.span_degreeLT (fun i _ =>
      P.isUnit_leadingCoeff i), mem_degreeLT]
    exact hp
  clear hp
  induction hm using Submodule.span_induction with
  | mem q hq =>
    obtain ⟨m, hm, rfl⟩ := hq
    exact hP.orthogonal m n (ne_of_lt hm)
  | zero => exact integralInner_zero_left μ (P n)
  | add p q _ _ hp hq => rw [integralInner_add_left hμ, hp, hq, add_zero]
  | smul a p _ hp =>
    rw [integralInner_smul_left (h := hμ.integrable_mul p (P n)), hp, mul_zero]
source

For an orthogonal sequence \(P\) under the moment and positivity hypotheses, the coefficient of \(P_n\) in a polynomial \(p\) is

\[ \frac{\langle p,P_n\rangle _\mu }{\langle P_n,P_n\rangle _\mu }. \]

References: [DLMF, 18.2(i)], [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.integralInner_eq_basis_repr_mul {μ : MeasureTheory.Measure ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) {P : Polynomial.Sequence ℝ} (hP : P.IsOrthogonal μ)
  (hu : ∀ (i : ℕ), IsUnit (↑P i).leadingCoeff) (p : Polynomial ℝ) (n : ℕ) :
  Polynomial.integralInner μ (Polynomial.IntegrablePair.of μ p (↑P n) ⋯) =
    ((P.basis hu).repr p) n * Polynomial.integralInner μ (Polynomial.IntegrablePair.of μ (↑P n) (↑P n) ⋯)
Lean proof
/-- Coordinates in an orthogonal polynomial basis are integral projections
(DLMF 18.2(i), Szegő, Chapter 3). -/
theorem IsOrthogonal.integralInner_eq_basis_repr_mul {μ : Measure ℝ}
    (hμ : HasFiniteMoments μ) {P : Sequence ℝ} (hP : P.IsOrthogonal μ)
    (hu : ∀ i, IsUnit (P i).leadingCoeff) (p : ℝ[X]) (n : ℕ) :
    integralInner μ (IntegrablePair.of μ p (P n)) = (P.basis hu).repr p n * integralInner μ (IntegrablePair.of μ (P n) (P n)) := by
  classical
  let b := P.basis hu
  have hb (i : ℕ) : b i = P i := P.basis_eq_self hu i
  have hsum : (∑ i ∈ (b.repr p).support, b.repr p i • b i) = p := by
    simpa only [Finsupp.linearCombination_apply, Finsupp.sum] using b.linearCombination_repr p
  have h := congrArg (fun q => integralInner μ (IntegrablePair.of μ q (P n))) hsum
  rw [integralInner_sum_left hμ] at h
  have hsmul (p q : ℝ[X]) (a : ℝ) :=
    integralInner_smul_left μ p q a (h := hμ.integrable_mul p q)
  simp only [hsmul, hb] at h
  have hs : (∑ i ∈ (b.repr p).support,
      b.repr p i * integralInner μ (IntegrablePair.of μ (P i) (P n))) =
      b.repr p n * integralInner μ (IntegrablePair.of μ (P n) (P n)) := by
    apply Finset.sum_eq_single n
    · intro i _ hi
      rw [show integralInner μ (IntegrablePair.of μ (P i) (P n)) = 0 from hP.orthogonal i n hi, mul_zero]
    · intro hn
      rw [Finsupp.notMem_support_iff.mp hn, zero_mul]
  exact h.symm.trans hs
source

3.1.3 Recurrence coefficients and kernels

Write \(h_n\) for the squared integral norm. The recurrence coefficients express multiplication by \(x\) in the polynomial basis; the finite kernel sums the corresponding normalized products.

Definition 3.1.16 Integrable polynomial squares
✓ 🤖

For a measure \(\mu \) on \(\mathbb {R}\), define the square-integrability domain

\[ \mathcal Q_\mu =\{ p\in \mathbb {R}[X]:x\mapsto p(x)^2\text{ is }\mu \text{-integrable}\} . \]

No condition is imposed on other polynomial moments.

Lean Formalisation
inductive Polynomial.Sequence.IntegrableSquare (μ : MeasureTheory.Measure ℝ) (p : Polynomial ℝ) : Prop
Lean definition
/-- Classical square-integrability data for one polynomial (DLMF 18.2.5). -/
structure IntegrableSquare (μ : Measure ℝ) (p : ℝ[X]) where
  integrable : Integrable (fun x ↦ p.eval x * p.eval x) μ
source
Definition 3.1.17 Classical squared polynomial norms
✓ 🤖

For a degree-indexed polynomial sequence \(P\), a measure \(\mu \), an index \(n\), with \(P_n\in \mathcal Q_\mu \), define \(h_n=\int P_n(x)^2\, d\mu (x)\). Zero squared norms are permitted.

Lean Formalisation
def Polynomial.Sequence.squaredNorm (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) (n : ℕ)
  (d : Polynomial.Sequence.IntegrableSquare μ (↑P n)) : ℝ
Lean definition
/-- The squared integral norm on its classical input domain (DLMF 18.2.5). -/
noncomputable def squaredNorm (P : Sequence ℝ) (μ : Measure ℝ) (n : ℕ)
    (d : IntegrableSquare μ (P n)) : ℝ :=
  integralInner μ (IntegrablePair.of μ (P n) (P n) d.integrable)
source

The domain of the diagonal coefficient at \(n\) requires integrability of \(P_n^2\) and \(xP_n^2\), and \(h_n\ne 0\). The domain of the backward coefficient at \(n\) requires integrability of \(P_n^2\) and \(P_{n+1}^2\), and \(h_n\ne 0\). No nonzero condition is imposed on \(h_{n+1}\), and no moments at other indices are required.

Lean Formalisation
inductive Polynomial.Sequence.RecurrenceBInput (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) (n : ℕ) : Prop
Lean definition
/-- The local classical domain of the diagonal recurrence coefficient. -/
structure RecurrenceBInput (P : Sequence ℝ) (μ : Measure ℝ) (n : ℕ) where
  square : IntegrableSquare μ (P n)
  mixed : Integrable (fun x ↦ (X * P n).eval x * (P n).eval x) μ
  norm_ne : P.squaredNorm μ n square ≠ 0
source
Definition 3.1.19 Classical recurrence coefficients
✓ 🤖

Write \(k_n=\operatorname {lc}(P_n)\). For \(B_n\) and \(C_n\), respectively, use the domains of Definition 3.1.18. Define

\[ A_n=\frac{k_n}{k_{n+1}},\quad B_n=\frac{\langle XP_n,P_n\rangle _\mu }{h_n},\quad C_n=A_n\frac{h_{n+1}}{h_n}. \]

References: [DLMF, 18.2(iv)]; [Sze75, Chapter 3].

Lean Formalisation
def Polynomial.Sequence.recurrenceA (P : Polynomial.Sequence ℝ) (n : ℕ) : ℝ
Lean definition
/-- The forward coefficient in multiplication by `X` (DLMF 18.2(iv)). -/
noncomputable def recurrenceA (P : Sequence ℝ) (n : ℕ) : ℝ :=
  (P n).leadingCoeff / (P (n + 1)).leadingCoeff
source

Assume finite polynomial moments, positive definiteness and orthogonality. Then

\[ XP_0=A_0P_1+B_0P_0,\qquad XP_{n+1}=A_{n+1}P_{n+2}+B_{n+1}P_{n+1}+C_nP_n. \]

Moreover, \(h_n{\gt}0\), \(A_n\ne 0\), \(C_n\ne 0\), and \(A_nC_n{\gt}0\). If every \(P_n\) is monic, then \(A_n=1\) and \(C_n{\gt}0\).

Reference: [DLMF, 18.2(iv)].

Lean Formalisation
theorem Polynomial.Sequence.recurrenceA_ne_zero (P : Polynomial.Sequence ℝ) (n : ℕ) : P.recurrenceA n ≠ 0
Lean proof
/-- Forward coefficients never vanish (DLMF 18.2(iv)). -/
theorem recurrenceA_ne_zero (P : Sequence ℝ) (n : ℕ) : P.recurrenceA n ≠ 0 :=
  div_ne_zero (leadingCoeff_ne_zero.mpr (P.ne_zero n))
    (leadingCoeff_ne_zero.mpr (P.ne_zero (n + 1)))
source
Definition 3.1.21 Classical finite kernel inputs
✓ 🤖

For a polynomial sequence \(P\), a measure \(\mu \), and a cutoff \(n\), the finite-kernel domain requires integrability of \(P_j^2\) and \(h_j\ne 0\) for every \(0\le j\le n\). No conditions are imposed on higher indices.

Lean Formalisation
inductive Polynomial.Sequence.KernelInput (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) (n : ℕ) : Prop
Lean definition
/-- The classical finite kernel domain: only the selected polynomial squares
must be integrable with nonzero norm (DLMF 18.2(v)). -/
structure KernelInput (P : Sequence ℝ) (μ : Measure ℝ) (n : ℕ) where
  square : ∀ i : Fin (n + 1), IntegrableSquare μ (P i)
  norm_ne : ∀ i : Fin (n + 1), P.squaredNorm μ i (square i) ≠ 0
source
Definition 3.1.22 Finite polynomial kernel
✓ 🤖
#

For a cutoff \(n\) in the domain of Definition 3.1.21 and arbitrary real \(x,y\), set \(K_n(x,y)=\sum _{j=0}^n P_j(x)P_j(y)/h_j\).

Reference: [DLMF, 18.2.12].

Lean Formalisation
def Polynomial.Sequence.kernel (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) (n : ℕ) (x y : ℝ)
  (d : P.KernelInput μ n) : ℝ
Lean definition
/-- The finite reproducing kernel on its classical input domain (DLMF 18.2.12). -/
noncomputable def kernel (P : Sequence ℝ) (μ : Measure ℝ) (n : ℕ) (x y : ℝ)
    (d : KernelInput P μ n) : ℝ :=
  ∑ i : Fin (n + 1), (P i).eval x * (P i).eval y / P.squaredNorm μ i (d.square i)
source
Theorem 3.1.23 Christoffel–Darboux
✓ 🤖

Let \(P\) be an orthogonal polynomial sequence for a measure \(\mu \) with finite polynomial moments and a positive definite polynomial pairing. For every \(n\ge 0\) and \(x,y\in \mathbb R\),

\[ (x-y)K_n(x,y)=\frac{A_n}{h_n} \bigl(P_{n+1}(x)P_n(y)-P_n(x)P_{n+1}(y)\bigr). \]

The cleared form also holds at \(x=y\).

Reference: [DLMF, 18.2.12].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.christoffelDarboux {μ : MeasureTheory.Measure ℝ} (hμ : Polynomial.HasFiniteMoments μ)
  (hpos : Polynomial.HasPositiveDefiniteIntegral μ) {P : Polynomial.Sequence ℝ} (hP : P.IsOrthogonal μ) (n : ℕ)
  (x y : ℝ) :
  (x - y) * P.kernel μ n x y ⋯ =
    P.recurrenceA n / P.squaredNorm μ n ⋯ *
      (Polynomial.eval x (↑P (n + 1)) * Polynomial.eval y (↑P n) -
        Polynomial.eval x (↑P n) * Polynomial.eval y (↑P (n + 1)))
Lean proof
/-- Christoffel–Darboux with the factor `x-y` cleared (DLMF 18.2.12). -/
theorem IsOrthogonal.christoffelDarboux {μ : Measure ℝ} (hμ : HasFiniteMoments μ)
    (hpos : HasPositiveDefiniteIntegral μ) {P : Sequence ℝ} (hP : P.IsOrthogonal μ)
    (n : ℕ) (x y : ℝ) :
    (x - y) * P.kernel μ n x y (Polynomial.Sequence.KernelInput.of _ _ _) = P.recurrenceA n / P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _) *
      ((P (n + 1)).eval x * (P n).eval y - (P n).eval x * (P (n + 1)).eval y) := by
  induction n with
  | zero =>
    have hx := congrArg (fun p : ℝ[X] => p.eval x) (hP.two_term_zero hμ hpos)
    have hy := congrArg (fun p : ℝ[X] => p.eval y) (hP.two_term_zero hμ hpos)
    simp only [eval_mul, eval_X, eval_add, eval_smul, smul_eq_mul] at hx hy
    have h : (x - y) * (P 0).eval x * (P 0).eval y = P.recurrenceA 0 *
        ((P 1).eval x * (P 0).eval y - (P 0).eval x * (P 1).eval y) := by
      linear_combination (P 0).eval y * hx - (P 0).eval x * hy
    simp only [kernel_of_positive hpos P, Nat.zero_add, Finset.sum_range_one]
    calc
      _ = ((x - y) * (P 0).eval x * (P 0).eval y) / P.squaredNorm μ 0 (Polynomial.Sequence.IntegrableSquare.of _ _) := by ring
      _ = _ := by rw [h]; ring
  | succ n ih =>
    have hx := congrArg (fun p : ℝ[X] => p.eval x) (hP.three_term hμ hpos n)
    have hy := congrArg (fun p : ℝ[X] => p.eval y) (hP.three_term hμ hpos n)
    simp only [eval_mul, eval_X, eval_add, eval_smul, smul_eq_mul] at hx hy
    have h : (x - y) * (P (n + 1)).eval x * (P (n + 1)).eval y =
        P.recurrenceA (n + 1) * ((P (n + 2)).eval x * (P (n + 1)).eval y -
          (P (n + 1)).eval x * (P (n + 2)).eval y) -
        P.recurrenceC μ n (Sequence.RecurrenceCInput.of _ _ _) * ((P (n + 1)).eval x * (P n).eval y -
          (P n).eval x * (P (n + 1)).eval y) := by
      linear_combination (P (n + 1)).eval y * hx - (P (n + 1)).eval x * hy
    have hk : P.kernel μ (n + 1) x y (Polynomial.Sequence.KernelInput.of _ _ _) = P.kernel μ n x y (Polynomial.Sequence.KernelInput.of _ _ _) +
        (P (n + 1)).eval x * (P (n + 1)).eval y / P.squaredNorm μ (n + 1) (Polynomial.Sequence.IntegrableSquare.of _ _) := by
      simp only [kernel_of_positive hpos P]
      exact Finset.sum_range_succ _ _
    rw [hk, mul_add, ih]
    rw [show (x - y) * ((P (n + 1)).eval x * (P (n + 1)).eval y /
      P.squaredNorm μ (n + 1) (Polynomial.Sequence.IntegrableSquare.of _ _)) =
      ((x - y) * (P (n + 1)).eval x * (P (n + 1)).eval y) /
      P.squaredNorm μ (n + 1) (Polynomial.Sequence.IntegrableSquare.of _ _) by ring, h]
    simp only [recurrenceC]
    field_simp [ne_of_gt (squaredNorm_pos hpos P n),
      ne_of_gt (squaredNorm_pos hpos P (n + 1))]
    ring
source

Let \(P\) be an orthogonal polynomial sequence for a measure \(\mu \) with finite polynomial moments and a positive definite polynomial pairing. The diagonal identity is

\[ 0{\lt}K_n(x,x)=\frac{A_n}{h_n} \bigl(P'_{n+1}(x)P_n(x)-P'_n(x)P_{n+1}(x)\bigr). \]

Thus the Wronskian never vanishes, consecutive members have no common real root, and \(P_n(x)=0\) implies \(P'_n(x)\ne 0\).

References: [DLMF, 18.2.13]; [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.christoffelDarboux_diag {μ : MeasureTheory.Measure ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) (hpos : Polynomial.HasPositiveDefiniteIntegral μ) {P : Polynomial.Sequence ℝ}
  (hP : P.IsOrthogonal μ) (n : ℕ) (x : ℝ) :
  P.kernel μ n x x ⋯ =
    P.recurrenceA n / P.squaredNorm μ n ⋯ *
      (Polynomial.eval x (Polynomial.derivative (↑P (n + 1))) * Polynomial.eval x (↑P n) -
        Polynomial.eval x (Polynomial.derivative (↑P n)) * Polynomial.eval x (↑P (n + 1)))
Lean proof
/-- The diagonal Christoffel–Darboux identity (DLMF 18.2.13). -/
theorem IsOrthogonal.christoffelDarboux_diag {μ : Measure ℝ} (hμ : HasFiniteMoments μ)
    (hpos : HasPositiveDefiniteIntegral μ) {P : Sequence ℝ} (hP : P.IsOrthogonal μ)
    (n : ℕ) (x : ℝ) :
    P.kernel μ n x x (Polynomial.Sequence.KernelInput.of _ _ _) = P.recurrenceA n / P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _) *
      ((P (n + 1)).derivative.eval x * (P n).eval x -
        (P n).derivative.eval x * (P (n + 1)).eval x) := by
  have hk : DifferentiableAt ℝ (fun y => P.kernel μ n y x (Polynomial.Sequence.KernelInput.of _ _ _)) x := by
    unfold kernel
    exact DifferentiableAt.fun_sum fun k _ =>
      (((P k).differentiableAt).mul_const ((P k).eval x)).div_const _
  have hid : HasDerivAt (fun y : ℝ => y - x) 1 x := (hasDerivAt_id x).sub_const x
  have hl := hid.mul hk.hasDerivAt
  have hr := ((((P (n + 1)).hasDerivAt x).mul_const ((P n).eval x)).sub
    (((P n).hasDerivAt x).mul_const ((P (n + 1)).eval x))).const_mul
      (P.recurrenceA n / P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _))
  have heq : (fun y => (y - x) * P.kernel μ n y x (Polynomial.Sequence.KernelInput.of _ _ _)) =
      (fun y => P.recurrenceA n / P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _) *
        ((P (n + 1)).eval y * (P n).eval x -
          (P n).eval y * (P (n + 1)).eval x)) :=
    _root_.funext fun y => hP.christoffelDarboux hμ hpos n y x
  change HasDerivAt (fun y => (y - x) * P.kernel μ n y x (Polynomial.Sequence.KernelInput.of _ _ _)) _ x at hl
  rw [heq] at hl
  simpa using hl.unique hr
source
Norm, coefficient and kernel domains
Theorem 3.1.25 Characterisation of square data
✓ 🤖

For \(p\in \mathcal Q_\mu \), the function \(x\mapsto p(x)^2\) is \(\mu \)-integrable.

Lean Formalisation
theorem Polynomial.Sequence.IntegrableSquare.integrable_square {μ : MeasureTheory.Measure ℝ} {p : Polynomial ℝ}
  (d : Polynomial.Sequence.IntegrableSquare μ p) : MeasureTheory.Integrable (fun x => Polynomial.eval x p ^ 2) μ
Lean proof
/-- The bundled square has a classical finite integral. -/
theorem IntegrableSquare.integrable_square {μ : Measure ℝ} {p : ℝ[X]}
    (d : IntegrableSquare μ p) : Integrable (fun x ↦ p.eval x ^ 2) μ := by
  simpa only [pow_two] using d.integrable
source
Theorem 3.1.26 Squared-norm formula and positivity
✓ 🤖

The squared norm equals the integral of \(P_n^2\). Under positive-definite polynomial integration it is strictly positive.

Lean Formalisation
theorem Polynomial.Sequence.squaredNorm_apply (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) (n : ℕ)
  (d : Polynomial.Sequence.IntegrableSquare μ (↑P n)) : P.squaredNorm μ n d = ∫ (x : ℝ), Polynomial.eval x (↑P n) ^ 2 ∂μ
Lean proof
/-- The classical squared-norm integral formula. -/
theorem squaredNorm_apply (P : Sequence ℝ) (μ : Measure ℝ) (n : ℕ)
    (d : IntegrableSquare μ (P n)) :
    P.squaredNorm μ n d = ∫ x, (P n).eval x ^ 2 ∂μ := by
  simp only [squaredNorm, integralInner_self]
source
Theorem 3.1.27 Nonzero recurrence denominators
✓ 🤖

On either recurrence-coefficient domain of Definition 3.1.18, \(h_n=\int P_n(x)^2\, d\mu (x)\) is nonzero.

Lean Formalisation
theorem Polynomial.Sequence.RecurrenceBInput.norm_ne {P : Polynomial.Sequence ℝ} {μ : MeasureTheory.Measure ℝ} {n : ℕ}
  (self : P.RecurrenceBInput μ n) : P.squaredNorm μ n ⋯ ≠ 0
Lean proof
  norm_ne : P.squaredNorm μ n square ≠ 0
source
Theorem 3.1.28 Classical recurrence coefficient formulas
✓ 🤖

On the diagonal and backward coefficient domains of Definition 3.1.18, respectively, \(B_n=\langle XP_n,P_n\rangle _\mu /h_n\) and \(C_n=A_nh_{n+1}/h_n\), with integrable numerators and nonzero denominators.

Lean Formalisation
theorem Polynomial.Sequence.recurrenceB_apply (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) (n : ℕ)
  (d : P.RecurrenceBInput μ n) :
  P.recurrenceB μ n d =
    Polynomial.integralInner μ (Polynomial.IntegrablePair.of μ (Polynomial.X * ↑P n) (↑P n) ⋯) / P.squaredNorm μ n ⋯
Lean proof
/-- Diagonal coefficient formula on its local classical domain. -/
theorem recurrenceB_apply (P : Sequence ℝ) (μ : Measure ℝ) (n : ℕ)
    (d : RecurrenceBInput P μ n) :
    P.recurrenceB μ n d =
      integralInner μ (IntegrablePair.of μ (X * P n) (P n) d.mixed) / P.squaredNorm μ n d.square := rfl
source
Theorem 3.1.29 Characterisation of finite kernel inputs
✓ 🤖

For a cutoff \(n\) in the finite-kernel domain, every \(0\le j\le n\) satisfies \(P_j\in \mathcal Q_\mu \) and \(h_j\ne 0\). If these conditions hold for all \(j\in \mathbb {N}\), every cutoff belongs to this domain.

Lean Formalisation
theorem Polynomial.Sequence.KernelInput.valid {P : Polynomial.Sequence ℝ} {μ : MeasureTheory.Measure ℝ} {n : ℕ}
  (d : P.KernelInput μ n) (i : Fin (n + 1)) :
  MeasureTheory.Integrable (fun x => Polynomial.eval x (↑P ↑i) ^ 2) μ ∧ P.squaredNorm μ ↑i ⋯ ≠ 0
Lean proof
/-- Every selected kernel denominator is nonzero and has an integrable square. -/
theorem KernelInput.valid {P : Sequence ℝ} {μ : Measure ℝ} {n : ℕ}
    (d : KernelInput P μ n) (i : Fin (n + 1)) :
    Integrable (fun x ↦ (P i).eval x ^ 2) μ ∧ P.squaredNorm μ i (d.square i) ≠ 0 :=
  ⟨(d.square i).integrable_square, d.norm_ne i⟩
source
Theorem 3.1.30 Classical finite kernel formula
✓ 🤖
#

For a cutoff \(n\) in the domain of Definition 3.1.21, \(K_n(x,y)=\sum _{j=0}^n P_j(x)P_j(y)/h_j\). Each denominator is a finite nonzero squared integral.

Lean Formalisation
theorem Polynomial.Sequence.kernel_apply (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) (n : ℕ) (x y : ℝ)
  (d : P.KernelInput μ n) :
  P.kernel μ n x y d = ∑ i, Polynomial.eval x (↑P ↑i) * Polynomial.eval y (↑P ↑i) / P.squaredNorm μ ↑i ⋯
Lean proof
/-- The classical finite sum formula for the kernel. -/
theorem kernel_apply (P : Sequence ℝ) (μ : Measure ℝ) (n : ℕ) (x y : ℝ)
    (d : KernelInput P μ n) :
    P.kernel μ n x y d =
      ∑ i : Fin (n + 1), (P i).eval x * (P i).eval y / P.squaredNorm μ i (d.square i) := rfl
source

3.1.4 Zeros and parity

The zeros are real and simple, and consecutive members interlace. These results do not require bounded or connected support.

Let \(P\) be an orthogonal polynomial sequence for a measure \(\mu \) with finite polynomial moments and a positive definite polynomial pairing. Each \(P_n\) splits over \(\mathbb R\), is separable, and has exactly \(n\) distinct real roots. No boundedness or connectedness of the support is required.

References: [DLMF, 18.2(vi)]; [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.natDegree_eq_one_of_mem_normalizedFactors {μ : MeasureTheory.Measure ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) (hpos : Polynomial.HasPositiveDefiniteIntegral μ) {P : Polynomial.Sequence ℝ}
  (hP : P.IsOrthogonal μ) (n : ℕ) {f : Polynomial ℝ} (hf : f ∈ UniqueFactorizationMonoid.normalizedFactors (↑P n)) :
  f.natDegree = 1
Lean proof
/-- Every irreducible monic factor of an orthogonal polynomial is linear
(Szegő, Chapter 3). -/
theorem IsOrthogonal.natDegree_eq_one_of_mem_normalizedFactors {μ : Measure ℝ}
    (hμ : HasFiniteMoments μ) (hpos : HasPositiveDefiniteIntegral μ)
    {P : Sequence ℝ} (hP : P.IsOrthogonal μ) (n : ℕ) {f : ℝ[X]}
    (hf : f ∈ normalizedFactors (P n)) : f.natDegree = 1 := by
  classical
  obtain ⟨hi, hm, q, hpq⟩ := (Polynomial.mem_normalizedFactors_iff (P.ne_zero n)).mp hf
  by_contra hdeg
  have hfpos (x : ℝ) : 0 < f.eval x :=
    zero_lt_eval_of_roots_lt_of_leadingCoeff_nonneg
      (fun _ hr => (hi.not_isRoot_of_natDegree_ne_one hdeg hr).elim)
      (by rw [hm.leadingCoeff]; norm_num)
  have hq : q ≠ 0 := by
    intro h
    exact P.ne_zero n (by rw [hpq, h, mul_zero])
  have hfd : 0 < f.natDegree := by
    exact natDegree_pos_iff_degree_pos.mpr (degree_pos_of_irreducible hi)
  have hqd : q.degree < (n : WithBot ℕ) := by
    rw [degree_eq_natDegree hq, ← P.natDegree_eq n, hpq,
      natDegree_mul hi.ne_zero hq]
    exact_mod_cast (show q.natDegree < f.natDegree + q.natDegree by omega)
  have hzero := hP.integralInner_eq_zero_of_degree_lt hμ hqd
  have hsupp : Function.support (fun x => q.eval x * (P n).eval x) =
      Function.support (fun x => q.eval x ^ 2) := by
    ext x
    simp only [Function.mem_support, hpq, eval_mul, ne_eq, mul_eq_zero]
    simp [ne_of_gt (hfpos x)]
  have hpositive : 0 < integralInner μ (IntegrablePair.of μ q (P n)) := by
    apply (integral_pos_iff_support_of_nonneg ?_ (hμ.integrable_mul q (P n))).mpr
    · rw [hsupp]
      exact (integral_pos_iff_support_of_nonneg (fun x => sq_nonneg (q.eval x))
        (hμ q)).mp (hpos q hq)
    · intro x
      change 0 ≤ q.eval x * (P n).eval x
      rw [hpq, eval_mul]
      nlinarith [mul_nonneg (le_of_lt (hfpos x)) (sq_nonneg (q.eval x))]
  exact (ne_of_gt hpositive) hzero
source

Between any two distinct real zeros of \(P_n\) lies a zero of \(P_{n+1}\), and between any two distinct real zeros of \(P_{n+1}\) lies a zero of \(P_n\). Let \(P\) be an orthogonal polynomial sequence for a measure \(\mu \) with finite polynomial moments and a positive definite polynomial pairing.

References: [DLMF, 18.2(vi)]; [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.exists_eval_eq_zero_between_of_wronskian_ne_zero {p q : Polynomial ℝ}
  (hw :
    ∀ (x : ℝ),
      Polynomial.eval x (Polynomial.derivative p) * Polynomial.eval x q -
          Polynomial.eval x p * Polynomial.eval x (Polynomial.derivative q) ≠
        0)
  {a b : ℝ} (hab : a < b) (ha : Polynomial.eval a p = 0) (hb : Polynomial.eval b p = 0) :
  ∃ c ∈ Set.Ioo a b, Polynomial.eval c q = 0
Lean proof
/-- A nowhere-zero Wronskian forces a zero of the denominator between two zeros
of the numerator. This is the Rolle argument behind the separation theorem
(Szegő, Chapter 3). -/
theorem exists_eval_eq_zero_between_of_wronskian_ne_zero {p q : ℝ[X]}
    (hw : ∀ x : ℝ, p.derivative.eval x * q.eval x - p.eval x * q.derivative.eval x ≠ 0)
    {a b : ℝ} (hab : a < b) (ha : p.eval a = 0) (hb : p.eval b = 0) :
    ∃ c ∈ Ioo a b, q.eval c = 0 := by
  by_contra hno
  push Not at hno
  have hq : ∀ x ∈ Icc a b, q.eval x ≠ 0 := by
    intro x hx
    by_cases hxa : x = a
    · subst x
      intro h
      exact hw a (by rw [ha, h]; ring)
    by_cases hxb : x = b
    · subst x
      intro h
      exact hw b (by rw [hb, h]; ring)
    exact hno x ⟨lt_of_le_of_ne hx.1 (Ne.symm hxa), lt_of_le_of_ne hx.2 hxb⟩
  obtain ⟨c, hc, hd⟩ := exists_hasDerivAt_eq_zero hab
    (p.differentiable.continuous.continuousOn.div
      q.differentiable.continuous.continuousOn hq)
    (show p.eval a / q.eval a = p.eval b / q.eval b by rw [ha, hb]; simp)
    (fun x hx => (p.hasDerivAt x).div (q.hasDerivAt x) (hq x (Ioo_subset_Icc_self hx)))
  exact hw c ((div_eq_zero_iff).mp hd |>.resolve_right
    (pow_ne_zero 2 (hq c (Ioo_subset_Icc_self hc))))
source
Theorem 3.1.33 Outermost roots of consecutive members
✓ 🤖

Under the finite-moment and positive-definite-integral hypotheses, for \(n\ge 1\) there are distinct roots \(a{\lt}b\) of \(P_{n+1}\) such that every root \(x\) of \(P_n\) satisfies \(a{\lt}x{\lt}b\). Thus \(P_{n+1}\) has a root below the smallest root of \(P_n\) and another above its largest root.

References: [Sze75, Chapter 3]; [DLMF, 18.2(vi)].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.exists_outer_roots {μ : MeasureTheory.Measure ℝ} (hμ : Polynomial.HasFiniteMoments μ)
  (hpos : Polynomial.HasPositiveDefiniteIntegral μ) {P : Polynomial.Sequence ℝ} (hP : P.IsOrthogonal μ) {n : ℕ}
  (hn : 1 ≤ n) :
  ∃ a b,
    a < b ∧
      Polynomial.eval a (↑P (n + 1)) = 0 ∧
        Polynomial.eval b (↑P (n + 1)) = 0 ∧ ∀ (x : ℝ), Polynomial.eval x (↑P n) = 0 → a < x ∧ x < b
Lean proof
/-- The degree-`n+1` polynomial has a root strictly below every root of the degree-`n`
polynomial, and a distinct root strictly above every such root (DLMF 18.2(vi)). -/
theorem IsOrthogonal.exists_outer_roots {μ : Measure ℝ}
    (hμ : HasFiniteMoments μ) (hpos : HasPositiveDefiniteIntegral μ)
    {P : Sequence ℝ} (hP : P.IsOrthogonal μ) {n : ℕ} (hn : 1 ≤ n) :
    ∃ a b : ℝ, a < b ∧ (P (n + 1)).eval a = 0 ∧ (P (n + 1)).eval b = 0 ∧
      ∀ x : ℝ, (P n).eval x = 0 → a < x ∧ x < b := by
  classical
  let s := (P n).roots.toFinset
  let t := (P (n + 1)).roots.toFinset
  have hs (x : ℝ) : x ∈ s ↔ (P n).eval x = 0 := by
    simp only [s, Multiset.mem_toFinset, mem_roots (P.ne_zero n), IsRoot]
  have ht (x : ℝ) : x ∈ t ↔ (P (n + 1)).eval x = 0 := by
    simp only [t, Multiset.mem_toFinset, mem_roots (P.ne_zero (n + 1)), IsRoot]
  have hc : s.card < t.card := by
    dsimp [s, t]
    rw [Multiset.toFinset_card_of_nodup (hP.roots_nodup hμ hpos n),
      Multiset.toFinset_card_of_nodup (hP.roots_nodup hμ hpos (n + 1)),
      hP.card_roots hμ hpos n, hP.card_roots hμ hpos (n + 1)]
    omega
  have hsep : ∀ a ∈ t, ∀ b ∈ t, a < b → ∃ c ∈ s, a < c ∧ c < b := by
    intro a ha b hb hab
    obtain ⟨c, hc, hz⟩ := hP.exists_root_between_succ hμ hpos n hab
      ((ht a).mp ha) ((ht b).mp hb)
    exact ⟨c, (hs c).mpr hz, hc⟩
  obtain ⟨a, ha, hal⟩ := exists_mem_lt_all_of_separates s t hc hsep
  obtain ⟨b, hb, hbr⟩ := exists_mem_lt_all_of_separates
    (α := OrderDual ℝ) s t hc (by
      intro u hu v hv hvu
      obtain ⟨c, hc, hvc, hcu⟩ := hsep v hv u hu hvu
      exact ⟨c, hc, hcu, hvc⟩)
  obtain ⟨x, hx⟩ := Multiset.card_pos_iff_exists_mem.mp (show 0 < (P n).roots.card by
    rw [hP.card_roots hμ hpos n]
    omega)
  have hxs : x ∈ s := Multiset.mem_toFinset.mpr hx
  exact ⟨a, b, (hal x hxs).trans (hbr x hxs), (ht a).mp ha, (ht b).mp hb,
    fun x hx ↦ ⟨hal x ((hs x).mpr hx), hbr x ((hs x).mpr hx)⟩⟩
source

A real polynomial measure with finite moments and positive definite polynomial pairing admits a positive-leading orthonormal sequence. If the measure is even, every orthogonal sequence satisfies \(p_n(-x)=(-1)^n p_n(x)\). Even densities preserve reflection invariance.

Reference: [DLMF, 18.2(iii) and 18.2.21].

Lean Formalisation
theorem Polynomial.exists_positive_orthonormal_sequence (μ : MeasureTheory.Measure ℝ) (hμ : Polynomial.HasFiniteMoments μ)
  (hpos : Polynomial.HasPositiveDefiniteIntegral μ) :
  ∃ P,
    P.IsOrthogonal μ ∧ (∀ (n : ℕ), 0 < (↑P n).leadingCoeff) ∧ ∀ (n : ℕ), ∫ (x : ℝ), Polynomial.eval x (↑P n) ^ 2 ∂μ = 1
Lean proof
/-- Positive-leading orthonormal sequences exist for every measure with finite
moments and a strictly positive polynomial pairing. -/
theorem exists_positive_orthonormal_sequence (μ : Measure ℝ) (hμ : HasFiniteMoments μ)
    (hpos : HasPositiveDefiniteIntegral μ) :
    ∃ P : Sequence ℝ, P.IsOrthogonal μ ∧
      (∀ n, 0 < (P n).leadingCoeff) ∧ (∀ n, ∫ x, (P n).eval x ^ 2 ∂μ = 1) := by
  obtain ⟨R, hR⟩ := exists_isOrthogonal μ hμ hpos
  have hr (n : ℕ) : (R n).leadingCoeff ≠ 0 := leadingCoeff_ne_zero.mpr (R.ne_zero n)
  let Q := R.rescale (fun n => (R n).leadingCoeff⁻¹) (fun n => inv_ne_zero (hr n))
  have hQ : Q.IsOrthogonal μ := hR.rescale _ _
  have hlead (n : ℕ) : (Q n).leadingCoeff = 1 := by
    change ((R n).leadingCoeff⁻¹ • R n).leadingCoeff = 1
    rw [leadingCoeff_smul_of_smul_regular _
      (IsSMulRegular.of_ne_zero (inv_ne_zero (hr n))), smul_eq_mul, inv_mul_cancel₀ (hr n)]
  let a (n : ℕ) := Real.sqrt (∫ x, (Q n).eval x ^ 2 ∂μ)
  have ha (n : ℕ) : 0 < a n := Real.sqrt_pos.mpr (hpos (Q n) (Q.ne_zero n))
  let P := Q.rescale (fun n => (a n)⁻¹) (fun n => inv_ne_zero (ha n).ne')
  refine ⟨P, hQ.rescale _ _, ?_, ?_⟩
  · intro n
    change 0 < ((a n)⁻¹ • Q n).leadingCoeff
    rw [leadingCoeff_smul_of_smul_regular _
      (IsSMulRegular.of_ne_zero (inv_ne_zero (ha n).ne')), smul_eq_mul, hlead, mul_one]
    exact inv_pos.mpr (ha n)
  · intro n
    change ∫ x, ((a n)⁻¹ • Q n).eval x ^ 2 ∂μ = 1
    simp only [eval_smul, smul_eq_mul, mul_pow, integral_const_mul]
    have hnorm : a n ^ 2 = ∫ x, (Q n).eval x ^ 2 ∂μ :=
      Real.sq_sqrt (hpos (Q n) (Q.ne_zero n)).le
    rw [← hnorm, ← mul_pow, inv_mul_cancel₀ (ha n).ne', one_pow]
source

3.1.5 Completeness and expansions

Completeness needs polynomial density in \(L^2(\mu )\) in addition to moments and positivity. Compact support supplies that density; the Hilbert-basis theorem also applies whenever it is known by another argument.

Definition 3.1.35 Polynomial classes in general real L2
✓ 🤖

For a real measure \(\mu \) with finite polynomial moments, let \(J_\mu :\mathbb {R}[X]\to L^2(\mu )\) send \(p\) to the class of \(x\mapsto p(x)\).

Lean Formalisation
theorem Polynomial.memLp_eval_of_hasFiniteMoments {μ : MeasureTheory.Measure ℝ} (hμ : Polynomial.HasFiniteMoments μ)
  (p : Polynomial ℝ) : MeasureTheory.MemLp (fun x => Polynomial.eval x p) 2 μ
Lean proof
/-- Finite polynomial moments put every polynomial in L² (DLMF 18.2(viii)). -/
theorem memLp_eval_of_hasFiniteMoments (p : ℝ[X]) : MemLp (fun x ↦ p.eval x) 2 μ := by
  exact (memLp_two_iff_integrable_sq (by fun_prop)).mpr (hμ p)
source
Theorem 3.1.36 Density for compactly supported measures
✓ 🤖

If additionally \(x\in [a,b]\) for \(\mu \)-almost every \(x\), then \(J_\mu \) has dense range. No positivity or connected-support hypothesis is required.

Reference: [DLMF, 18.2(viii)].

Lean Formalisation
theorem Polynomial.polynomialToL2_denseRange {μ : MeasureTheory.Measure ℝ} (hμ : Polynomial.HasFiniteMoments μ) (a b : ℝ)
  (hsupp : ∀ᵐ (x : ℝ) ∂μ, x ∈ Set.Icc a b) : DenseRange ⇑(Polynomial.polynomialToL2 hμ)
Lean proof
/-- Weierstrass approximation gives dense polynomial classes in weighted L² (ATAP, Chapter 1). -/
theorem polynomialToL2_denseRange (a b : ℝ)
    (hsupp : ∀ᵐ x ∂μ, x ∈ Set.Icc a b) : DenseRange (polynomialToL2 hμ) := by
  let _ := hμ.isFiniteMeasure
  have hd := BoundedContinuousFunction.toLp_denseRange ℝ μ ℝ
    (by norm_num : (2 : ℝ≥0∞) ≠ ∞)
  apply Dense.of_closure (hd.mono ?_)
  rintro _ ⟨f, rfl⟩
  rw [Metric.mem_closure_iff]
  intro ε hε
  let K : ℝ := (measureUnivNNReal μ : ℝ) ^ (2 : ℝ≥0∞).toReal⁻¹
  have hK : 0 ≤ K := by positivity
  let δ := ε / (K + 1)
  have hδ : 0 < δ := div_pos hε (by positivity)
  obtain ⟨p, hp⟩ := exists_polynomial_near_of_continuousOn a b f
    f.continuous.continuousOn δ hδ
  refine ⟨polynomialToL2 hμ p, ⟨p, rfl⟩, ?_⟩
  rw [dist_eq_norm, norm_sub_rev]
  have hb : ‖polynomialToL2 hμ p - BoundedContinuousFunction.toLp 2 μ ℝ f‖ ≤ K * δ := by
    apply Lp.norm_le_of_ae_bound hδ.le
    filter_upwards [hsupp, coe_polynomialToL2 hμ p,
      f.coeFn_toLp 2 μ ℝ,
      Lp.coeFn_sub (polynomialToL2 hμ p) (BoundedContinuousFunction.toLp 2 μ ℝ f)]
      with x hx hpx hfx hsub
    rw [hsub]
    simp only [Pi.sub_apply, hpx, hfx, Real.norm_eq_abs]
    exact (hp x hx).le
  apply hb.trans_lt
  dsimp [δ]
  rw [← mul_div_assoc]
  apply (div_lt_iff₀ (by positivity : 0 < K + 1)).mpr
  nlinarith
source

For \(\mathbb K=\mathbb {R}\) or \(\mathbb {C}\), a real polynomial \(p\) and a measure \(\mu \), define

\[ \mathcal A_{\mu ,p}^{\mathbb K} =\{ f:\mathbb {R}\to \mathbb K: p^2,fp\text{ are }\mu \text{-integrable and } \int p^2\, d\mu {\gt}0\} . \]

Functions retain their pointwise representatives. These conditions concern only \(p\), not other polynomial moments. Reference: [DLMF, 18.2(viii)].

Lean Formalisation
inductive Polynomial.IntegralCoefficientInput.{u_1} (𝕂 : Type u_1) [RCLike 𝕂] (μ : MeasureTheory.Measure ℝ) (p : Polynomial ℝ) :
  Type u_1
Lean definition
/-- Data with an integrable coefficient product and finite positive normalization
for a specified polynomial (DLMF 18.2(viii)). -/
structure IntegralCoefficientInput (𝕂 : Type*) [RCLike 𝕂] (μ : Measure ℝ) (p : ℝ[X]) where
  val : ℝ → 𝕂
  square_integrable : Integrable (fun x ↦ p.eval x ^ 2) μ
  norm_pos : 0 < ∫ x, p.eval x ^ 2 ∂μ
  integrable : Integrable (fun x ↦ val x * ((p.eval x : ℝ) : 𝕂)) μ
source
Definition 3.1.38 Normalised polynomial classes
✓ 🤖

For a degree-indexed sequence \(P\) and a measure with finite polynomial moments, a normalization index is a natural number \(n\) together with \(h_n{\gt}0\); define \(e_n=h_n^{-1/2}J_\mu P_n\) on this domain. For \(f\in \mathcal A_{\mu ,P_n}^{\mathbb {R}}\), define the original-normalisation coefficient by \(a_n(f)=h_n^{-1}\int fP_n\, d\mu \).

Reference: [DLMF, 18.2(viii)].

Lean Formalisation
def Polynomial.Sequence.normalizedToL2 {μ : MeasureTheory.Measure ℝ} (P : Polynomial.Sequence ℝ)
  (hμ : Polynomial.HasFiniteMoments μ) (n : { n // 0 < P.squaredNorm μ n ⋯ }) : ↥(MeasureTheory.Lp ℝ 2 μ)
Lean definition
/-- Normalised polynomial classes in weighted L² (DLMF 18.2(viii)). -/
@[expose] noncomputable def normalizedToL2 (n : {n : ℕ // 0 < P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)}) : Lp ℝ 2 μ :=
  (√(P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)))⁻¹ • polynomialToL2 hμ (P n)
source

Assume finite polynomial moments, positive definiteness, and orthogonality of \(P\). If polynomial classes have dense range in \(L^2(\mu )\), the normalised family is orthonormal with dense span and defines a Hilbert basis. No support restriction is required here.

Reference: [DLMF, 18.2(viii)].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.orthonormal_normalizedToL2 {μ : MeasureTheory.Measure ℝ} {P : Polynomial.Sequence ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) (hP : P.IsOrthogonal μ) (hpos : Polynomial.HasPositiveDefiniteIntegral μ) :
  Orthonormal ℝ fun n => P.normalizedToL2 hμ ⟨n, ⋯⟩
Lean proof
/-- Normalising an orthogonal sequence gives an orthonormal family (DLMF 18.2(viii)). -/
theorem IsOrthogonal.orthonormal_normalizedToL2 (hP : P.IsOrthogonal μ)
    (hpos : HasPositiveDefiniteIntegral μ) : Orthonormal ℝ (fun n ↦ P.normalizedToL2 hμ ⟨n, squaredNorm_pos hpos P n⟩) := by
  rw [orthonormal_iff_ite]
  intro n m
  simp only [normalizedToL2, inner_smul_left, inner_smul_right, conj_trivial,
    inner_polynomialToL2]
  by_cases h : n = m
  · subst m
    simp only [↓reduceIte]
    have hp := squaredNorm_pos hpos P n
    have hn : (∫ x, (P n).eval x * (P n).eval x ∂μ) = P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _) := rfl
    rw [hn]
    calc
      _ = ((√(P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)))⁻¹ * (√(P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)))⁻¹) * P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _) := by ring
      _ = 1 := by rw [← mul_inv, Real.mul_self_sqrt hp.le, inv_mul_cancel₀ hp.ne']
  · rw [hP.orthogonal n m h]
    simp [h]
source
Theorem 3.1.40 General polynomial L2 expansion
✓ 🤖

Let \(P\) be orthogonal for \(\mu \), assume finite polynomial moments and a positive definite polynomial pairing, and suppose polynomial classes are dense in \(L^2(\mu ;\mathbb {R})\). Then the Hilbert-coordinate summands are \(a_n(f)J_\mu P_n\), and their series sums to every \(f\in L^2(\mu )\).

Reference: [DLMF, 18.2(viii)].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.hilbertBasis_repr_smul {μ : MeasureTheory.Measure ℝ} {P : Polynomial.Sequence ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) (hP : P.IsOrthogonal μ) (hpos : Polynomial.HasPositiveDefiniteIntegral μ)
  (hdense : DenseRange ⇑(Polynomial.polynomialToL2 hμ)) (f : ↥(MeasureTheory.Lp ℝ 2 μ)) (n : ℕ) :
  ↑((Polynomial.Sequence.IsOrthogonal.hilbertBasis hμ hP hpos hdense).repr f) n •
      (Polynomial.Sequence.IsOrthogonal.hilbertBasis hμ hP hpos hdense) n =
    P.integralCoefficient μ (Polynomial.IntegralCoefficientInput.ofL2 hμ hpos (↑P n) ⋯ f) •
      (Polynomial.polynomialToL2 hμ) (↑P n)
Lean proof
/-- Hilbert-coordinate terms equal the integral-coefficient terms (DLMF 18.2(viii)). -/
theorem IsOrthogonal.hilbertBasis_repr_smul (hP : P.IsOrthogonal μ)
    (hpos : HasPositiveDefiniteIntegral μ) (hdense : DenseRange (polynomialToL2 hμ))
    (f : Lp ℝ 2 μ) (n : ℕ) :
    (hP.hilbertBasis hμ hpos hdense).repr f n • hP.hilbertBasis hμ hpos hdense n =
      P.integralCoefficient μ (IntegralCoefficientInput.ofL2 hμ hpos (P n) (P.ne_zero n) f) • polynomialToL2 hμ (P n) := by
  rw [HilbertBasis.repr_apply_apply, IsOrthogonal.hilbertBasis_apply, normalizedToL2,
    inner_smul_left, inner_polynomialToL2_left]
  simp only [conj_trivial, smul_smul]
  congr 1
  calc
    _ = ((√(P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)))⁻¹ * (√(P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)))⁻¹) *
        (∫ x, f x * (P n).eval x ∂μ) := by ring
    _ = _ := by rw [← mul_inv, Real.mul_self_sqrt (squaredNorm_pos hpos P n).le]; rfl
source
Coefficient domains, normalization and multiplication proofs
Theorem 3.1.41 Polynomials in general weighted L2
✓ 🤖

If \(\mu \) has finite polynomial moments, every real polynomial is square integrable for \(\mu \), and \(J_\mu p\) agrees \(\mu \)-almost everywhere with \(x\mapsto p(x)\). Moreover \(\langle J_\mu p,J_\mu q\rangle =\int pq\, d\mu \) and \(\langle J_\mu p,f\rangle =\int fp\, d\mu \) for every \(f\in L^2(\mu )\). The map is linear.

Lean Formalisation
theorem Polynomial.coe_polynomialToL2 {μ : MeasureTheory.Measure ℝ} (hμ : Polynomial.HasFiniteMoments μ) (p : Polynomial ℝ) :
  ↑↑((Polynomial.polynomialToL2 hμ) p) =ᵐ[μ] fun x => Polynomial.eval x p
Lean proof
/-- An almost-everywhere representative of polynomial evaluation (DLMF 18.2(viii)). -/
theorem coe_polynomialToL2 (p : ℝ[X]) : polynomialToL2 hμ p =ᵐ[μ] fun x ↦ p.eval x :=
  (memLp_eval_of_hasFiniteMoments hμ p).coeFn_toLp
source
Theorem 3.1.42 Integrability of polynomial products with square-integrable functions
✓ 🤖
#

If \(\mu \) has all polynomial moments finite, \(p\) is a real polynomial, and \(f\in L^2(\mu ;\mathbb K)\) with \(\mathbb K=\mathbb {R}\) or \(\mathbb {C}\), then \(fp\) is integrable.

Lean Formalisation
theorem Polynomial.integrable_L2_mul_eval.{u_1} {𝕂 : Type u_1} [RCLike 𝕂] {μ : MeasureTheory.Measure ℝ}
  (hμ : Polynomial.HasFiniteMoments μ) (p : Polynomial ℝ) (f : ↥(MeasureTheory.Lp 𝕂 2 μ)) :
  MeasureTheory.Integrable (fun x => ↑↑f x * ↑(Polynomial.eval x p)) μ
Lean proof
/-- L2 inputs give classical coefficient products for every polynomial when
all moments are finite (DLMF 18.2(viii)). -/
theorem integrable_L2_mul_eval {𝕂 : Type*} [RCLike 𝕂] {μ : Measure ℝ}
    (hμ : HasFiniteMoments μ) (p : ℝ[X]) (f : Lp 𝕂 2 μ) :
    Integrable (fun x ↦ f x * ((p.eval x : ℝ) : 𝕂)) μ := by
  have hp : MemLp (fun x ↦ ((p.eval x : ℝ) : 𝕂)) 2 μ :=
    (memLp_eval_of_hasFiniteMoments hμ p).ofReal
  exact (Lp.memLp f).integrable_mul hp
source

Let \(\mathbb K=\mathbb R\) or \(\mathbb C\). For \(f\in \mathcal A_{\mu ,p}^{\mathbb K}\), the product \(fp\) is integrable and \(\int p^2\, d\mu \) is finite and positive. If \(\mu \) has finite polynomial moments, every \(L^2(\mu ;\mathbb K)\) function has an integrable product with each real polynomial \(p\). If the polynomial pairing is also positive definite and \(p\ne 0\), every such \(L^2\) function belongs to \(\mathcal A_{\mu ,p}^{\mathbb K}\); real polynomials do as well. These identifications retain the pointwise representatives. Scalar inclusion sends \(\mathcal A_{\mu ,p}^{\mathbb {R}}\) into \(\mathcal A_{\mu ,p}^{\mathbb {C}}\) by \(f(x)\mapsto f(x)+0i\).

Lean Formalisation
theorem Polynomial.IntegralCoefficientInput.normalization.{u_1} {𝕂 : Type u_1} [RCLike 𝕂] {μ : MeasureTheory.Measure ℝ}
  {p : Polynomial ℝ} (f : Polynomial.IntegralCoefficientInput 𝕂 μ p) :
  MeasureTheory.Integrable (fun x => Polynomial.eval x p ^ 2) μ ∧ 0 < ∫ (x : ℝ), Polynomial.eval x p ^ 2 ∂μ
Lean proof
/-- The normalization is a genuine finite positive integral. -/
theorem IntegralCoefficientInput.normalization {𝕂 : Type*} [RCLike 𝕂]
    {μ : Measure ℝ} {p : ℝ[X]} (f : IntegralCoefficientInput 𝕂 μ p) :
    Integrable (fun x ↦ p.eval x ^ 2) μ ∧ 0 < ∫ x, p.eval x ^ 2 ∂μ :=
  ⟨f.square_integrable, f.norm_pos⟩
source
Definition 3.1.44 Finite classical coefficient families
✓ 🤖

For a polynomial family \(P\), a cutoff \(N\), and \(\mathbb K=\mathbb {R}\) or \(\mathbb {C}\), define the simultaneous coefficient domain

\[ \mathcal A_{\mu ,P,\le N}^{\mathbb K} =\bigcap _{n=0}^N\mathcal A_{\mu ,P_n}^{\mathbb K}. \]

Thus a member is one pointwise function \(f:\mathbb {R}\to \mathbb K\) for which each \(P_n^2\) and \(fP_n\) is integrable and \(\int P_n^2\, d\mu {\gt}0\), for \(0\le n\le N\). No condition is imposed at higher indices.

Lean Formalisation
inductive Polynomial.IntegralCoefficientFamilyInput.{u_1} (𝕂 : Type u_1) [RCLike 𝕂] (μ : MeasureTheory.Measure ℝ)
  (P : ℕ → Polynomial ℝ) (N : ℕ) : Type u_1
Lean definition
/-- One common function with classical coefficient data through a finite cutoff.
No conditions are imposed on higher indices (DLMF 18.2(viii)). -/
structure IntegralCoefficientFamilyInput (𝕂 : Type*) [RCLike 𝕂] (μ : Measure ℝ)
    (P : ℕ → ℝ[X]) (N : ℕ) where
  val : ℝ → 𝕂
  square_integrable : ∀ i : Fin (N + 1), Integrable (fun x ↦ (P i).eval x ^ 2) μ
  norm_pos : ∀ i : Fin (N + 1), 0 < ∫ x, (P i).eval x ^ 2 ∂μ
  integrable : ∀ i : Fin (N + 1), Integrable (fun x ↦ val x * (((P i).eval x : ℝ) : 𝕂)) μ
source

Let \(\mathbb K=\mathbb R\) or \(\mathbb C\). For \(f\in \mathcal A_{\mu ,P,\le N}^{\mathbb K}\) and \(n\le N\), its membership in \(\mathcal A_{\mu ,P_n}^{\mathbb K}\) uses the same function \(f\). Under finite moments and positive definiteness, every \(L^2(\mu ;\mathbb K)\) function belongs to this simultaneous domain for a degree-indexed polynomial sequence \(P\). Its representative at each index is the representative used for the individual coefficient domain.

Lean Formalisation
theorem Polynomial.IntegralCoefficientFamilyInput.at_val.{u_1} {𝕂 : Type u_1} [RCLike 𝕂] {μ : MeasureTheory.Measure ℝ}
  {P : ℕ → Polynomial ℝ} {N : ℕ} (f : Polynomial.IntegralCoefficientFamilyInput 𝕂 μ P N) (i : Fin (N + 1)) :
  (f.at i).val = f.val
Lean proof
/-- Every selected coefficient uses the same pointwise function. -/
@[simp] theorem IntegralCoefficientFamilyInput.at_val {𝕂 : Type*} [RCLike 𝕂]
    {μ : Measure ℝ} {P : ℕ → ℝ[X]} {N : ℕ}
    (f : IntegralCoefficientFamilyInput 𝕂 μ P N) (i : Fin (N + 1)) :
    (f.at i).val = f.val := rfl
source
Theorem 3.1.46 Positive-norm normalization formula
✓ 🤖

For a positive-norm index, \(e_n=h_n^{-1/2}J_\mu P_n\). The square root and inverse are taken at a strictly positive squared norm.

Lean Formalisation
theorem Polynomial.Sequence.normalizedToL2_apply {μ : MeasureTheory.Measure ℝ} (P : Polynomial.Sequence ℝ)
  (hμ : Polynomial.HasFiniteMoments μ) (n : { n // 0 < P.squaredNorm μ n ⋯ }) :
  P.normalizedToL2 hμ n = (√(P.squaredNorm μ ↑n ⋯))⁻¹ • (Polynomial.polynomialToL2 hμ) (↑P ↑n)
Lean proof
/-- Classical positive-norm normalization formula (DLMF 18.2(viii)). -/
theorem normalizedToL2_apply (n : {n : ℕ // 0 < P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)}) :
    P.normalizedToL2 hμ n =
      (√(P.squaredNorm μ n (Polynomial.Sequence.IntegrableSquare.of _ _)))⁻¹ • polynomialToL2 hμ (P n) := rfl
source
Theorem 3.1.47 Classical integral coefficient formula
✓ 🤖

For \(f\in \mathcal A_{\mu ,P_n}^{\mathbb {R}}\), \(a_n(f)=(\int P_n^2\, d\mu )^{-1}\int fP_n\, d\mu \). The numerator is integrable and the denominator is finite and positive.

Lean Formalisation
theorem Polynomial.Sequence.integralCoefficient_apply (P : Polynomial.Sequence ℝ) (μ : MeasureTheory.Measure ℝ) {n : ℕ}
  (f : Polynomial.IntegralCoefficientInput ℝ μ (↑P n)) :
  P.integralCoefficient μ f =
    (∫ (x : ℝ), Polynomial.eval x (↑P n) ^ 2 ∂μ)⁻¹ * ∫ (x : ℝ), f.val x * Polynomial.eval x (↑P n) ∂μ
Lean proof
/-- The normalized integral formula on its classical input domain (DLMF 18.2(viii)). -/
theorem integralCoefficient_apply (μ : Measure ℝ) {n : ℕ}
    (f : IntegralCoefficientInput ℝ μ (P n)) :
    P.integralCoefficient μ f = (∫ x, (P n).eval x ^ 2 ∂μ)⁻¹ *
      ∫ x, f.val x * (P n).eval x ∂μ := by
  simp only [integralCoefficient, squaredNorm, integralInner_self]
source

For an orthogonal sequence under the moment and positivity hypotheses, the coefficient of \(P_m\) in \(XP_n\) is zero if \(n+1{\lt}m\) or \(m+1{\lt}n\). The integral identity \(\langle XP_n,P_m\rangle _\mu =0\) needs only finite moments and orthogonality under the same index condition.

References: [DLMF, 18.2(iv)], [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.integralInner_X_mul (μ : MeasureTheory.Measure ℝ) (p q : Polynomial ℝ)
  {h : MeasureTheory.Integrable (fun x => Polynomial.eval x (Polynomial.X * p) * Polynomial.eval x q) μ} :
  Polynomial.integralInner μ (Polynomial.IntegrablePair.of μ (Polynomial.X * p) q h) =
    Polynomial.integralInner μ (Polynomial.IntegrablePair.of μ p (Polynomial.X * q) ⋯)
Lean proof
/-- Multiplication by the variable is symmetric for the polynomial integral pairing
(DLMF 18.2(iv), Szegő, Chapter 3). -/
theorem integralInner_X_mul (μ : Measure ℝ) (p q : ℝ[X])
    {h : Integrable (fun x => (X * p).eval x * q.eval x) μ} :
    integralInner μ (IntegrablePair.of μ (X * p) q) = integralInner μ (IntegrablePair.of μ p (X * q) (h := by
      convert h using 1
      ext x
      simp only [eval_mul, eval_X]
      ring)) := by
  unfold integralInner
  apply integral_congr_ae
  filter_upwards [] with x
  simp only [eval_mul, eval_X]
  ring
source
Theorem 3.1.49 Three-term multiplication expansion
✓ 🤖

For each \(n\ge 0\), there are real \(a,b,c\) with

\[ XP_{n+1}=aP_{n+2}+bP_{n+1}+cP_n. \]

At index zero there are real \(a,b\) with \(XP_0=aP_1+bP_0\). The hypotheses are finite polynomial moments, positive definiteness, and orthogonality.

References: [DLMF, 18.2(iv)], [Sze75, Chapter 3].

Lean Formalisation
theorem Polynomial.Sequence.IsOrthogonal.exists_three_term {μ : MeasureTheory.Measure ℝ} (hμ : Polynomial.HasFiniteMoments μ)
  (hpos : Polynomial.HasPositiveDefiniteIntegral μ) {P : Polynomial.Sequence ℝ} (hP : P.IsOrthogonal μ) (n : ℕ) :
  ∃ a b c, Polynomial.X * ↑P (n + 1) = a • ↑P (n + 2) + b • ↑P (n + 1) + c • ↑P n
Lean proof
/-- Every positive-index multiplication has a three-term expansion
(DLMF 18.2(iv), Szegő, Chapter 3). -/
theorem IsOrthogonal.exists_three_term {μ : Measure ℝ}
    (hμ : HasFiniteMoments μ) (hpos : HasPositiveDefiniteIntegral μ)
    {P : Sequence ℝ} (hP : P.IsOrthogonal μ) (n : ℕ) :
    ∃ a b c : ℝ, X * P (n + 1) = a • P (n + 2) + b • P (n + 1) + c • P n := by
  classical
  let hu (i : ℕ) : IsUnit (P i).leadingCoeff :=
    P.isUnit_leadingCoeff i
  let B := P.basis hu
  have hb (i : ℕ) : B i = P i := P.basis_eq_self hu i
  refine ⟨B.repr (X * P (n + 1)) (n + 2), B.repr (X * P (n + 1)) (n + 1),
    B.repr (X * P (n + 1)) n, ?_⟩
  rw [← hb (n + 2), ← hb (n + 1), ← hb n]
  apply B.repr.injective
  ext k
  by_cases h2 : k = n + 2
  · subst k; simp
  by_cases h1 : k = n + 1
  · subst k; simp
  by_cases h0 : k = n
  · subst k; simp
  have hz : B.repr (X * B (n + 1)) k = 0 := by
    rw [hb]
    exact hP.basis_repr_X_mul_eq_zero hμ hpos hu (by omega)
  simp [h0, h1, h2, hz]
source