10.8. Certified Integration
10.8.1. Certified Quadrature
A quadrature certificate bounds the difference between a proposed value and the integral. Exactness on polynomials and bounds on derivatives control the analytic error; interval evaluation controls the error in computing the finite weighted sum. These two errors add.
A quadrature certificate stores a proposed value of a Bochner interval integral, an explicit error budget, and a proof of the corresponding norm estimate. The certificate is indexed by the ordinary Lean integrand and endpoints, so no symbolic expression type appears in theorem statements.
Its trusted field is
q.\mathrm{sound}:\qquad
\left\|\int_a^b f(x)\,dx-q.\mathrm{value}\right\|
\leq q.\mathrm{error}.
Lean code for Definition10.83●1 definitionAssociated Lean declarationsCAS.Continuum.QuadratureCert[complete]
CAS.Continuum.QuadratureCert[complete]
- structuredefined in CAS/Certificate/Quadrature.leancomplete
structure CAS.Continuum.QuadratureCert.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] (f : ℝ → E) (a b : ℝ) : Type u_1
structure CAS.Continuum.QuadratureCert.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] (f : ℝ → E) (a b : ℝ) : Type u_1
A checked approximation to Mathlib's totalized interval integral of
ffromatob.The value is an element of
E. A decoded floating-point result may be used as the value once its distance to an exact value is bounded, as inreplaceValue.Fields
value : E
Proposed value of the interval integral.
error : ℝ
Certified upper bound for the norm error.
sound : ‖(∫ (x : ℝ) in a..b, f x) - self.value‖ ≤ self.error
The error bound for Mathlib's total interval integral.
A complete certificate: Simpson on x^2.
Take f(x)=x^2 on [0,1]. One Simpson panel uses the values at
0, 1/2, and 1, so its exact-real value is
\frac16 f(0)+\frac46 f\left(\frac12\right)+\frac16 f(1)
=\frac13.
Because Simpson's rule is exact for every polynomial of degree at most three, its quadrature certificate has:
the stored value is
1/3;the stored error is
0;soundness proves
\left|\int_0^1x^2\,dx-\frac13\right|\leq0.
The third field is the mathematical content. The first two fields are data
that later planners can inspect and combine. Since the integrand is a
continuous polynomial, it is also interval integrable; that fact is separate
because QuadratureCert itself is stated for Mathlib's totalized interval
integral.
For a nonpolynomial integrand, the shape of the object is unchanged. A
Simpson or Gauss–Legendre theorem supplies a positive analytic error, and a
verified numerical backend may replace the exact-real weighted sum with a
computed value by adding a separately proved roundoff error. The final
sound field always states one inequality about the original integral.
The first polynomial beyond Simpson's exactness range shows what the error
constant measures. For f(x)=x^4 on [0,1],
S(f)=\frac46\frac1{16}+\frac16=\frac5{24},
\qquad
\int_0^1x^4\,dx=\frac15,
\qquad
S(f)-\int_0^1f=\frac1{120}.
Here f^{(4)}=24, so the sharp Simpson bound is
24/2880=1/120, exactly the observed error. The fourth derivative
measures the first behavior that the degree-three exactness does not
reproduce.
If both functions are interval integrable, uniform approximation on
[[a,b]] transports through interval integration with error
\varepsilon |b-a|. Consequently a quadrature certificate for a
finite or symbolic model becomes a certificate for the original integrand,
with model and quadrature errors added explicitly.
Lean code for Theorem10.84●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Certificate/Quadrature.leancomplete
theorem CAS.Continuum.QuadratureCert.norm_intervalIntegral_sub_le.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {a b : ℝ} (c : CAS.Certificate.ApproxCert ℝ E (Set.uIcc a b)) (hlhs : IntervalIntegrable c.lhs MeasureTheory.volume a b) (hrhs : IntervalIntegrable c.rhs MeasureTheory.volume a b) : ‖(∫ (x : ℝ) in a..b, c.lhs x) - ∫ (x : ℝ) in a..b, c.rhs x‖ ≤ c.eps * |b - a|
theorem CAS.Continuum.QuadratureCert.norm_intervalIntegral_sub_le.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {a b : ℝ} (c : CAS.Certificate.ApproxCert ℝ E (Set.uIcc a b)) (hlhs : IntervalIntegrable c.lhs MeasureTheory.volume a b) (hrhs : IntervalIntegrable c.rhs MeasureTheory.volume a b) : ‖(∫ (x : ℝ) in a..b, c.lhs x) - ∫ (x : ℝ) in a..b, c.rhs x‖ ≤ c.eps * |b - a|
Uniform approximation on the unoriented interval controls the difference of the corresponding interval integrals.
The
IntervalIntegrablehypotheses are needed only to rewrite the integral of the pointwise difference as the difference of the integrals. The estimate itself is the standard Bochner-integral norm bound. - defdefined in CAS/Certificate/Quadrature.leancomplete
def CAS.Continuum.QuadratureCert.transportApprox.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {a b : ℝ} (c : CAS.Certificate.ApproxCert ℝ E (Set.uIcc a b)) (q : CAS.Continuum.QuadratureCert c.rhs a b) (hlhs : IntervalIntegrable c.lhs MeasureTheory.volume a b) (hrhs : IntervalIntegrable c.rhs MeasureTheory.volume a b) : CAS.Continuum.QuadratureCert c.lhs a b
def CAS.Continuum.QuadratureCert.transportApprox.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {a b : ℝ} (c : CAS.Certificate.ApproxCert ℝ E (Set.uIcc a b)) (q : CAS.Continuum.QuadratureCert c.rhs a b) (hlhs : IntervalIntegrable c.lhs MeasureTheory.volume a b) (hrhs : IntervalIntegrable c.rhs MeasureTheory.volume a b) : CAS.Continuum.QuadratureCert c.lhs a b
Transport a quadrature certificate across a uniformly certified integrand approximation.
If
lhsis uniformly withinεofrhson[[a,b]], andrhshas a quadrature certificate with errorδ, then the same proposed value approximates the integral oflhswith errorε |b-a| + δ.
Integrate the pointwise difference and apply the norm bound for an interval
integral. Uniform approximation bounds the integrand norm by
\varepsilon, while the integral of that constant over the oriented
interval contributes |b-a|. A final triangle inequality adds this model
error to the existing quadrature error.
If the scalar integrand is interval integrable and one backend interval contains every value on
[[a,b]], its midpoint defines a constant integral model and its radius gives
the uniform pointwise error. The resulting certificate has value
(b-a)c and error r|b-a|, with no endpoint-order assumption and no
backend-specific integration theorem. Exact rational ranges, directed
floating-point ranges, Taylor enclosures, and adaptive local ranges therefore
share the same analytic bridge.
Lean code for Theorem10.85●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Certificate/Quadrature.leancomplete
theorem CAS.Continuum.QuadratureCert.integral_mem_Icc {f : ℝ → ℝ} {a b : ℝ} (q : CAS.Continuum.QuadratureCert f a b) : ∫ (x : ℝ) in a..b, f x ∈ Set.Icc (q.value - q.error) (q.value + q.error)
theorem CAS.Continuum.QuadratureCert.integral_mem_Icc {f : ℝ → ℝ} {a b : ℝ} (q : CAS.Continuum.QuadratureCert f a b) : ∫ (x : ℝ) in a..b, f x ∈ Set.Icc (q.value - q.error) (q.value + q.error)
For scalar integrands, enclose the totalized interval integral in a conventional closed interval around the proposed value.
- defdefined in CAS/Continuum/Quadrature/IntervalRange.leancomplete
def CAS.Continuum.QuadratureCert.ofIntervalRange.{u_1} {ι : Type u_1} [CAS.Continuum.RealIntervalBackend ι] {f : ℝ → ℝ} {a b : ℝ} (I : ι) (hf : IntervalIntegrable f MeasureTheory.volume a b) (hencloses : ∀ x ∈ Set.uIcc a b, CAS.Continuum.RealIntervalBackend.MemReal I (f x)) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.QuadratureCert.ofIntervalRange.{u_1} {ι : Type u_1} [CAS.Continuum.RealIntervalBackend ι] {f : ℝ → ℝ} {a b : ℝ} (I : ι) (hf : IntervalIntegrable f MeasureTheory.volume a b) (hencloses : ∀ x ∈ Set.uIcc a b, CAS.Continuum.RealIntervalBackend.MemReal I (f x)) : CAS.Continuum.QuadratureCert f a b
Turn a uniform backend interval enclosure of an interval integrable scalar integrand into a quadrature certificate.
The proposed value is the interval midpoint multiplied by the oriented interval length. The error uses the unoriented length, so the result is valid for either endpoint order.
Write the enclosure as center c and radius r. Interval membership gives
|f(x)-c|\leq r uniformly, so integration stability compares f with the
constant function c. The constant integral is (b-a)c, and its
transported error is r|b-a|.
How the error budget is assembled.
A certificate constructor assembles the error budget in five steps:
prove exactness on a polynomial model or prove a Peano-kernel remainder;
obtain any required derivative bound as an ordinary theorem;
sum local analytic errors when the interval is subdivided;
enclose the finite weighted sum if it is evaluated numerically;
add the proved roundoff radius to the analytic budget.
The quadrature rule chooses nodes and weights. The derivative theorem controls truncation. The numerical backend controls finite evaluation. Keeping those proofs separate makes it possible to replace one backend or one subdivision policy without changing the statement about the integral.
Quadrature rules implemented.
The certificate constructors use four normalized rules, each stored as an
exact list of (weight, node) pairs on [0,1]. Each error formula assumes
the stated derivative bound and the corresponding C^2 or C^4
regularity on an ordered interval [a,b].
Trapezoidal rule: two nodes at
\{0, 1\}with weights\{1/2, 1/2\}. Exact for polynomials of degree at most 1. Error on[a,b]:\zeta(b-a)^3/12where\zetabounds|f''|.Midpoint rule: one node at
1/2with weight1. Exact for polynomials of degree at most 1. Error on[a,b]:\zeta(b-a)^3/24, half the trapezoid constant.Simpson's rule: three nodes at
\{0, 1/2, 1\}with weights\{1/6, 4/6, 1/6\}. Exact for polynomials of degree at most 3. The sharp Peano-kernel error on[a,b]:C(b-a)^5/2880whereCbounds|f^{(4)}|.Two-point Gauss–Legendre: two nodes at
\{1/2 - 1/(2\sqrt{3}), 1/2 + 1/(2\sqrt{3})\}with weights\{1/2, 1/2\}. With only two nodes it is exact for polynomials of degree at most 3, like Simpson's three-node rule. The sharp Peano-kernel error:C(b-a)^5/4320, which is2/3of Simpson's error constant.
The Gauss–Legendre rule has irrational nodes (1/2 \pm \sqrt{3}/6), which
are represented exactly in the real-valued QuadratureRule. Numerical
evaluation encloses the exact weighted terms by proved intervals. A
RationalQuadratureRule, by contrast, has rational nodes.
The Peano kernel approach.
The sharp error constants (1/2880 for Simpson, 1/4320 for Gauss–Legendre) come
from the Peano kernel method. For a rule Q that is exact on polynomials of
degree at most d and an integrand f \in C^{d+1}[a,b], the integration
error equals
\int_a^b f(x)\,dx - Q(f) = \int_a^b K_{d+1}(t) f^{(d+1)}(t)\,dt,
where K_{d+1} is the Peano kernel of order d+1: the functional
f \mapsto \int f - Q(f) applied to the truncated power
(x-t)_+^d / d!. If K_{d+1} has constant sign, the integral is bounded
by \|f^{(d+1)}\|_\infty \cdot \int |K_{d+1}|.
Example: composite Simpson on \int_0^1 e^x\,dx.
First plan the exact-real composite value to analytic tolerance
\tau = 10^{-8}. A computed replacement must also fit its evaluation error
within the remaining budget before claiming this same total tolerance.
Derivative bound. On
[0,1],f^{(4)}(x) = e^x \leq e < 3. SetC = 3.Error constant.
B = C(b-a)^5/2880 = 3/2880 = 1/960.Panel planning. Solve
B/N^4 \leq \tau:N \geq (B/\tau)^{1/4} = (10^8/960)^{1/4} \approx 17.97. The planner rounds up toN = 18: exactly,960\cdot17^4<10^8\leq960\cdot18^4.Certificate construction. Build 18 Simpson panels of width
1/18. Summing their sharp errors gives1/(960\cdot18^4)\approx9.923\times10^{-9}<10^{-8}.Value computation. The panel-major schedule contains 54 weighted samples, with
2\cdot18+1=37distinct nodes because adjacent endpoints coincide. A numerical backend must provide enclosures for those samples and their weighted sum; the analytic panel count alone supplies no evaluation precision.Final certificate. The
QuadratureCertstores:value: the midpoint of the weighted-sum enclosure,
error: the analytic Simpson error plus the weighted-sum roundoff radius,
sound: the proof that
|\int_0^1 e^x\,dx - \text{value}| \leq \text{error}.
This final error is at most 10^{-8} only if the certified evaluation radius
is at most 10^{-8}-1/(960\cdot18^4). Otherwise, refine the evaluation or
replan the analytic mesh with a smaller reserved budget.
Adaptive quadrature and the tree structure.
Composite rules use a fixed number of equal panels, which may be inefficient
for integrands with localized difficulty (near-singularities, rapid
oscillation). The adaptive framework addresses this with a binary
QuadratureTree whose leaves are local certificates and whose branches split
an interval at a point. Because soundness depends only on the leaf
certificates and their composition, an adaptive algorithm may choose the
subdivision by any heuristic, including Richardson extrapolation, derivative
estimates, or a priori knowledge of integrand behavior.
A normalized quadrature rule is an ordered list of exact-real weights and
nodes in [0,1]. The order remains explicit for verified finite-precision
evaluation. Generic definitions transport the rule affinely to any oriented
interval, while moment identities characterize exactness independently of a
particular numerical backend.
Lean code for Definition10.86●1 definitionAssociated Lean declarationsCAS.Continuum.QuadratureRule[complete]
CAS.Continuum.QuadratureRule[complete]
- abbrevdefined in CAS/Continuum/Quadrature/Rule.leancomplete
abbrev CAS.Continuum.QuadratureRule : Type
abbrev CAS.Continuum.QuadratureRule : Type
Exact-real normalized quadrature rule used by the analytic semantics.
The rational algebraic fragment of the shared expression language has a
fail-closed exact evaluator. Every successful result is proved equal to the
existing real expression semantics. A quadrature rule with rational weights
and nodes can therefore sample a symbolic integrand exactly, preserve the
ordered rule schedule, and cast term-for-term to the existing transported
QuadratureRule. Transcendental nodes, malformed literals, and sampled zero
denominators are rejected. Optional
finite-precision backends consume the exact table through the same interval
and weighted-sum interfaces.
At the expression boundary,
\operatorname{evalRat?}(e,\rho)=\operatorname{some}(q)
\quad\Longrightarrow\quad
\operatorname{eval}(e,\rho_{\mathbb R})=(q:\mathbb R).
For a successfully compiled rule, casting every rational term preserves the analytic schedule and value:
\operatorname{cast}\!\left(\sum_j w_j e(x_j)\right)
=\sum_j (w_j:\mathbb R)\,
\operatorname{eval}(e,(x_j:\mathbb R)).
Lean code for Theorem10.87●3 theoremsAssociated Lean declarations
- theoremdefined in CAS/Expr/RationalEvaluation.leancomplete
theorem CAS.Verified.Expr.evalRat?_sound.{u_1} {ι : Type u_1} (ρ : ι → ℚ) {expr : CAS.Verified.Expr ι} {q : ℚ} (h : CAS.Verified.Expr.evalRat? ρ expr = some q) : CAS.Verified.Expr.eval (fun i ↦ ↑(ρ i)) expr = ↑q
theorem CAS.Verified.Expr.evalRat?_sound.{u_1} {ι : Type u_1} (ρ : ι → ℚ) {expr : CAS.Verified.Expr ι} {q : ℚ} (h : CAS.Verified.Expr.evalRat? ρ expr = some q) : CAS.Verified.Expr.eval (fun i ↦ ↑(ρ i)) expr = ↑q
If
evalRat? ρ expr = some q, thenexprevaluates toqin the real environmentfun i ↦ (ρ i : ℝ). - theoremdefined in CAS/Continuum/Quadrature/RationalRule.leancomplete
theorem CAS.Continuum.RationalQuadratureRule.symbolicTermsOn?_sound.{u_1} {ι : Type u_1} [DecidableEq ι] (rule : CAS.Continuum.RationalQuadratureRule) (expr : CAS.Verified.Expr ι) (coordinate : ι) (ρ : ι → ℚ) (a b : ℚ) {terms : List (ℚ × ℚ)} (hterms : rule.symbolicTermsOn? expr coordinate ρ a b = some terms) : List.map CAS.Continuum.rationalPairToReal terms = rule.toQuadratureRule.termsOn (fun x ↦ CAS.Verified.Expr.eval (Function.update (fun i ↦ ↑(ρ i)) coordinate x) expr) ↑a ↑b
theorem CAS.Continuum.RationalQuadratureRule.symbolicTermsOn?_sound.{u_1} {ι : Type u_1} [DecidableEq ι] (rule : CAS.Continuum.RationalQuadratureRule) (expr : CAS.Verified.Expr ι) (coordinate : ι) (ρ : ι → ℚ) (a b : ℚ) {terms : List (ℚ × ℚ)} (hterms : rule.symbolicTermsOn? expr coordinate ρ a b = some terms) : List.map CAS.Continuum.rationalPairToReal terms = rule.toQuadratureRule.termsOn (fun x ↦ CAS.Verified.Expr.eval (Function.update (fun i ↦ ↑(ρ i)) coordinate x) expr) ↑a ↑b
Successful symbolic compilation produces exactly the real quadrature table for the expression's real denotation.
- theoremdefined in CAS/Continuum/Quadrature/RationalRule.leancomplete
theorem CAS.Continuum.RationalQuadratureRule.cast_valueOn (rule : CAS.Continuum.RationalQuadratureRule) (f : ℚ → ℚ) (g : ℝ → ℝ) (a b : ℚ) (hf : ∀ (x : ℚ), g ↑x = ↑(f x)) : ↑(rule.valueOn f a b) = rule.toQuadratureRule.valueOn g ↑a ↑b
theorem CAS.Continuum.RationalQuadratureRule.cast_valueOn (rule : CAS.Continuum.RationalQuadratureRule) (f : ℚ → ℚ) (g : ℝ → ℝ) (a b : ℚ) (hf : ∀ (x : ℚ), g ↑x = ↑(f x)) : ↑(rule.valueOn f a b) = rule.toQuadratureRule.valueOn g ↑a ↑b
Exact rational rule evaluation casts to
QuadratureRule.valueOnof a real functiongthat agrees with the rational callbackfat every rational point.
Prove the rational evaluator correct by structural induction on the algebraic expression, rejecting precisely the division cases with zero denominator. Apply that equality at each rational quadrature node. Casting commutes with the finite products and sum, so the compiled ordered table has the same real weighted value as the analytic rule.
If a normalized rule has the exact moments through degree d, it exactly
integrates every real polynomial of degree at most d. Affine transport
preserves this conclusion on arbitrary oriented intervals. Both the three-node
Simpson rule and the two-point Gauss–Legendre rule have the exact moments
through degree three, hence exactly integrate every cubic and generate
zero-error QuadratureCerts.
Lean code for Theorem10.88●3 theoremsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/Rule.leancomplete
theorem CAS.Continuum.QuadratureRule.exactFor_polynomial {rule : CAS.Continuum.QuadratureRule} {d : ℕ} (hexact : rule.ExactUpTo d) (p : Polynomial ℝ) (hdegree : p.natDegree ≤ d) : rule.ExactFor fun x ↦ Polynomial.eval x p
theorem CAS.Continuum.QuadratureRule.exactFor_polynomial {rule : CAS.Continuum.QuadratureRule} {d : ℕ} (hexact : rule.ExactUpTo d) (p : Polynomial ℝ) (hdegree : p.natDegree ≤ d) : rule.ExactFor fun x ↦ Polynomial.eval x p
Exact moments through
dimply exactness for every polynomial of degree at mostd. - theoremdefined in CAS/Continuum/Quadrature/Simpson.leancomplete
theorem CAS.Continuum.simpsonRule.exactUpTo_three : CAS.Continuum.simpsonRule.ExactUpTo 3
theorem CAS.Continuum.simpsonRule.exactUpTo_three : CAS.Continuum.simpsonRule.ExactUpTo 3
Simpson's rule has the exact normalized moments of degrees zero through three.
- theoremdefined in CAS/Continuum/Quadrature/GaussLegendre.leancomplete
theorem CAS.Continuum.gaussLegendreTwoRule.exactUpTo_three : CAS.Continuum.gaussLegendreTwoRule.ExactUpTo 3
theorem CAS.Continuum.gaussLegendreTwoRule.exactUpTo_three : CAS.Continuum.gaussLegendreTwoRule.ExactUpTo 3
The two-point Gauss rule has the exact moments of degrees zero through three.
Expand a polynomial of degree at most d in the monomial basis. Linearity of
both integration and the weighted rule reduces exactness to each monomial,
where it is exactly the assumed moment identity. Affine substitution
transports the normalized-interval result to any oriented interval.
If two scalar integrands differ uniformly by \varepsilon on
[[a,b]], their values under a normalized rule differ by at most
|b-a|\,V\varepsilon, where V is the sum of the absolute rule weights.
This estimate lets a rule that is exact on a nearby model be evaluated on the
original integrand while accounting separately for integral-model error and
sample-value perturbation.
Lean code for Theorem10.89●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/Approximation.leancomplete
theorem CAS.Continuum.QuadratureRule.abs_valueOn_sub_le (rule : CAS.Continuum.QuadratureRule) {f g : ℝ → ℝ} {a b eps : ℝ} (happrox : CAS.Certificate.ApproxOn f g (Set.uIcc a b) eps) : |rule.valueOn f a b - rule.valueOn g a b| ≤ |b - a| * (rule.weightVariation * eps)
theorem CAS.Continuum.QuadratureRule.abs_valueOn_sub_le (rule : CAS.Continuum.QuadratureRule) {f g : ℝ → ℝ} {a b eps : ℝ} (happrox : CAS.Certificate.ApproxOn f g (Set.uIcc a b) eps) : |rule.valueOn f a b - rule.valueOn g a b| ≤ |b - a| * (rule.weightVariation * eps)
On an arbitrary oriented interval, perturbing the integrand uniformly by
epsperturbs the transported rule value by at most|b-a| * weightVariation * eps. - defdefined in CAS/Continuum/Quadrature/Approximation.leancomplete
def CAS.Continuum.QuadratureRule.certOfApproxEvaluated (rule : CAS.Continuum.QuadratureRule) {a b : ℝ} (approx : CAS.Certificate.ApproxCert ℝ ℝ (Set.uIcc a b)) (hexact : rule.ExactFor fun x ↦ approx.rhs (a + x * (b - a))) (hlhs : IntervalIntegrable approx.lhs MeasureTheory.volume a b) (hrhs : IntervalIntegrable approx.rhs MeasureTheory.volume a b) : CAS.Continuum.QuadratureCert approx.lhs a b
def CAS.Continuum.QuadratureRule.certOfApproxEvaluated (rule : CAS.Continuum.QuadratureRule) {a b : ℝ} (approx : CAS.Certificate.ApproxCert ℝ ℝ (Set.uIcc a b)) (hexact : rule.ExactFor fun x ↦ approx.rhs (a + x * (b - a))) (hlhs : IntervalIntegrable approx.lhs MeasureTheory.volume a b) (hrhs : IntervalIntegrable approx.rhs MeasureTheory.volume a b) : CAS.Continuum.QuadratureCert approx.lhs a b
Evaluate a quadrature rule on the original integrand while using an exactly integrated nearby model to prove the analytic error.
The first error term controls the difference of the two interval integrals. The second controls the difference between rule evaluations at their sampled nodes. A backend may then replace this exact-real sampled value with the midpoint of an enclosing interval through
QuadratureCert.replaceValue(orQuadratureCert.replaceValueOfIntervalinCore).
At every node, the sample difference is at most \varepsilon. Apply the
triangle inequality to the weighted sum, bound each term by
|w_j|\varepsilon, and sum to obtain V\varepsilon on the normalized
interval. Affine transport contributes the factor |b-a|.
10.8.1.1. Nodes, weights, and degree of exactness
A normalized rule lives on [0,1] and is moved to [a,b] affinely. For
the general theory it is simpler to let the nodes sit anywhere on the real
line and to integrate against a weight function. A NodalRule is just that:
m real nodes x_i and m real weights w_i, with value
Q(f)=\sum_i w_i f(x_i). It carries no interval and no weight function of
its own. Exactness is a property relative to an interval and a weight, which
is what lets one rule be read against several weights, and it is stated with
Mathlib's interval integral, so exactness does not assert integrability.
The central number attached to a rule is its degree of exactness, the largest
d such that Q(p)=\int_a^b p\,w for every polynomial of degree at most
d. The trapezoid and midpoint rules have degree one, Simpson's rule three,
and a Gauss rule with n nodes 2n-1. A high degree of exactness is what
turns smoothness of f into a small error: if f is close to some
polynomial of degree d, a rule exact to degree d can only see the
difference.
CAS.Continuum.NodalRule[complete]CAS.Continuum.NodalRule.eval[complete]CAS.Continuum.NodalRule.ExactToDegree[complete]CAS.Continuum.NodalRule.Positive[complete]CAS.Continuum.NodalRule.NodesIn[complete]CAS.Continuum.QuadratureRule.toNodalRule[complete]
A nodal rule consists of a size m, nodes x_0,\dots,x_{m-1}\in\mathbb R,
and weights w_0,\dots,w_{m-1}\in\mathbb R. It is exact to degree d
for the weight w on a..b when
\sum_{i<m} w_i\,p(x_i)=\int_a^b p(x)\,w(x)\,dx
\qquad\text{for every real polynomial }p\text{ with }\deg p\le d.
It is positive when every w_i\ge0, and its nodes lie in s when every
x_i\in s. A normalized QuadratureRule becomes a nodal rule on
[a,b] with nodes a+t_i(b-a) and weights (b-a)w_i.
Lean code for Definition10.90●6 definitionsAssociated Lean declarationsCAS.Continuum.NodalRule[complete]CAS.Continuum.NodalRule.eval[complete]CAS.Continuum.NodalRule.ExactToDegree[complete]CAS.Continuum.NodalRule.Positive[complete]CAS.Continuum.NodalRule.NodesIn[complete]CAS.Continuum.QuadratureRule.toNodalRule[complete]
CAS.Continuum.NodalRule[complete]CAS.Continuum.NodalRule.eval[complete]CAS.Continuum.NodalRule.ExactToDegree[complete]CAS.Continuum.NodalRule.Positive[complete]CAS.Continuum.NodalRule.NodesIn[complete]CAS.Continuum.QuadratureRule.toNodalRule[complete]
- structuredefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
structure CAS.Continuum.NodalRule : Type
structure CAS.Continuum.NodalRule : Type
A quadrature rule given by finitely many real nodes and weights.
Fields
size : ℕ
The number of nodes.
node : Fin self.size → ℝ
The nodes
xᵢ.weight : Fin self.size → ℝ
The weights
wᵢ. - defdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
def CAS.Continuum.NodalRule.eval (Q : CAS.Continuum.NodalRule) (f : ℝ → ℝ) : ℝ
def CAS.Continuum.NodalRule.eval (Q : CAS.Continuum.NodalRule) (f : ℝ → ℝ) : ℝ
The value
∑ wᵢ f(xᵢ)of the rule onf. - defdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
def CAS.Continuum.NodalRule.ExactToDegree (Q : CAS.Continuum.NodalRule) (a b : ℝ) (w : ℝ → ℝ) (d : ℕ) : Prop
def CAS.Continuum.NodalRule.ExactToDegree (Q : CAS.Continuum.NodalRule) (a b : ℝ) (w : ℝ → ℝ) (d : ℕ) : Prop
The rule integrates every polynomial of degree at most
dexactly againstwona..b. - defdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
def CAS.Continuum.NodalRule.Positive (Q : CAS.Continuum.NodalRule) : Prop
def CAS.Continuum.NodalRule.Positive (Q : CAS.Continuum.NodalRule) : Prop
All weights are nonnegative. Such rules are called positive quadrature rules.
- defdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
def CAS.Continuum.NodalRule.NodesIn (Q : CAS.Continuum.NodalRule) (s : Set ℝ) : Prop
def CAS.Continuum.NodalRule.NodesIn (Q : CAS.Continuum.NodalRule) (s : Set ℝ) : Prop
All nodes lie in
s. - defdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
def CAS.Continuum.QuadratureRule.toNodalRule (rule : CAS.Continuum.QuadratureRule) (a b : ℝ) : CAS.Continuum.NodalRule
def CAS.Continuum.QuadratureRule.toNodalRule (rule : CAS.Continuum.QuadratureRule) (a b : ℝ) : CAS.Continuum.NodalRule
The normalized rule transported to
[a,b], as a nodal rule with nodesa + tᵢ (b - a)and weights(b - a) wᵢ.
For a weight continuous on [[a,b]], a nodal rule is exact to degree d
exactly when it integrates the monomials 1,x,\dots,x^d. Exactness moves
with the rule under the affine map sending a,b to c,d: if Q is exact
to degree n on [a,b] for the pulled-back weight, the transported rule,
with nodes mapped and weights scaled by (d-c)/(b-a), is exact to degree
n on [c,d] for the original weight. A normalized rule with the moments
through degree d is exact to degree d on every interval for the unit
weight, and a normalized rule with nonnegative weights is positive on every
ordered interval.
Lean code for Theorem10.91●4 theoremsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
theorem CAS.Continuum.NodalRule.exactToDegree_iff_monomial {Q : CAS.Continuum.NodalRule} {a b : ℝ} {w : ℝ → ℝ} (hw : ContinuousOn w (Set.uIcc a b)) (d : ℕ) : Q.ExactToDegree a b w d ↔ ∀ k ≤ d, Q.ExactFor a b w fun x ↦ x ^ k
theorem CAS.Continuum.NodalRule.exactToDegree_iff_monomial {Q : CAS.Continuum.NodalRule} {a b : ℝ} {w : ℝ → ℝ} (hw : ContinuousOn w (Set.uIcc a b)) (d : ℕ) : Q.ExactToDegree a b w d ↔ ∀ k ≤ d, Q.ExactFor a b w fun x ↦ x ^ k
For a continuous weight, exactness to degree
dis exactness on the monomials1, x, …, x^d. - theoremdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
theorem CAS.Continuum.NodalRule.ExactToDegree.transport {Q : CAS.Continuum.NodalRule} {a b c d : ℝ} (hab : a ≠ b) {v : ℝ → ℝ} {n : ℕ} (h : Q.ExactToDegree a b (fun x ↦ v (CAS.Continuum.NodalRule.transportMap a b c d x)) n) : (Q.transport a b c d).ExactToDegree c d v n
theorem CAS.Continuum.NodalRule.ExactToDegree.transport {Q : CAS.Continuum.NodalRule} {a b c d : ℝ} (hab : a ≠ b) {v : ℝ → ℝ} {n : ℕ} (h : Q.ExactToDegree a b (fun x ↦ v (CAS.Continuum.NodalRule.transportMap a b c d x)) n) : (Q.transport a b c d).ExactToDegree c d v n
For
a ≠ b, affine transport preserves the degree of exactness, with the weight pulled back along the affine map. - theoremdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
theorem CAS.Continuum.QuadratureRule.toNodalRule_exactToDegree {rule : CAS.Continuum.QuadratureRule} {d : ℕ} (hexact : rule.ExactUpTo d) (a b : ℝ) : (rule.toNodalRule a b).ExactToDegree a b (fun x ↦ 1) d
theorem CAS.Continuum.QuadratureRule.toNodalRule_exactToDegree {rule : CAS.Continuum.QuadratureRule} {d : ℕ} (hexact : rule.ExactUpTo d) (a b : ℝ) : (rule.toNodalRule a b).ExactToDegree a b (fun x ↦ 1) d
Moment exactness through degree
dis degree of exactnessdof the transported rule for the unit weight. - theoremdefined in CAS/Continuum/Quadrature/NodalRule.leancomplete
theorem CAS.Continuum.QuadratureRule.toNodalRule_positive {rule : CAS.Continuum.QuadratureRule} {a b : ℝ} (hab : a ≤ b) (hpositive : ∀ term ∈ rule.terms, 0 ≤ term.1) : (rule.toNodalRule a b).Positive
theorem CAS.Continuum.QuadratureRule.toNodalRule_positive {rule : CAS.Continuum.QuadratureRule} {a b : ℝ} (hab : a ≤ b) (hpositive : ∀ term ∈ rule.terms, 0 ≤ term.1) : (rule.toNodalRule a b).Positive
A rule with nonnegative normalized weights is positive on an ordered interval.
Both sides of the exactness identity are linear in the integrand, so a
polynomial written in the monomial basis reduces to its monomials. The
continuity of w supplies the integrability that splitting the integral
needs. For transport, substitute x=c+(t-a)(d-c)/(b-a): the change of
variables formula turns \int_c^d f\,v into (d-c)/(b-a) times an
integral over [a,b], and composing a polynomial with an affine map does not
raise its degree.
The most direct way to obtain exactness is to integrate an interpolant. Given
m distinct nodes, let \ell_i be the Lagrange basis polynomial that is
1 at x_i and 0 at the other nodes, and put
w_i=\int_a^b\ell_i\,w. A polynomial p of degree below m equals its
interpolant \sum_i p(x_i)\ell_i, so integrating gives Q(p)=\int_a^b p\,w.
With equally spaced nodes including both endpoints this is the closed
Newton–Cotes family: two points give the trapezoid rule and three give
Simpson's rule.
CAS.Continuum.NodalRule.interpolatory_exactToDegree[complete]CAS.Continuum.newtonCotes_exactToDegree[complete]CAS.Continuum.newtonCotes_two_eval[complete]CAS.Continuum.newtonCotes_nodesIn[complete]CAS.Continuum.NodalRule.interpolatory[complete]CAS.Continuum.newtonCotes[complete]
Let w be continuous on [[a,b]] and let x_0,\dots,x_{m-1} be
m\ge1 distinct nodes. The interpolatory rule with weights
w_i=\int_a^b\ell_i\,w is exact to degree m-1. For n\ge2 and
a\ne b, the closed Newton–Cotes rule on the nodes
a+i(b-a)/(n-1), i=0,\dots,n-1, is exact to degree n-1 for the
unit weight; its nodes lie in [a,b] when a\le b, and for n=2 its
value is \frac{b-a}2\bigl(f(a)+f(b)\bigr).
Lean code for Theorem10.92●6 declarationsAssociated Lean declarationsCAS.Continuum.NodalRule.interpolatory_exactToDegree[complete]CAS.Continuum.newtonCotes_exactToDegree[complete]CAS.Continuum.newtonCotes_two_eval[complete]CAS.Continuum.newtonCotes_nodesIn[complete]CAS.Continuum.NodalRule.interpolatory[complete]CAS.Continuum.newtonCotes[complete]
CAS.Continuum.NodalRule.interpolatory_exactToDegree[complete]CAS.Continuum.newtonCotes_exactToDegree[complete]CAS.Continuum.newtonCotes_two_eval[complete]CAS.Continuum.newtonCotes_nodesIn[complete]CAS.Continuum.NodalRule.interpolatory[complete]CAS.Continuum.newtonCotes[complete]
- theoremdefined in CAS/Continuum/Quadrature/NewtonCotes.leancomplete
theorem CAS.Continuum.NodalRule.interpolatory_exactToDegree {a b : ℝ} {w : ℝ → ℝ} (hw : ContinuousOn w (Set.uIcc a b)) {m : ℕ} (hm : 0 < m) {x : Fin m → ℝ} (hx : Function.Injective x) : (CAS.Continuum.NodalRule.interpolatory a b w hw x).ExactToDegree a b w (m - 1)
theorem CAS.Continuum.NodalRule.interpolatory_exactToDegree {a b : ℝ} {w : ℝ → ℝ} (hw : ContinuousOn w (Set.uIcc a b)) {m : ℕ} (hm : 0 < m) {x : Fin m → ℝ} (hx : Function.Injective x) : (CAS.Continuum.NodalRule.interpolatory a b w hw x).ExactToDegree a b w (m - 1)
An interpolatory rule on
m ≥ 1distinct nodes has degree of exactness at leastm - 1. - theoremdefined in CAS/Continuum/Quadrature/NewtonCotes.leancomplete
theorem CAS.Continuum.newtonCotes_exactToDegree {a b : ℝ} {n : ℕ} (hn : 2 ≤ n) : (CAS.Continuum.newtonCotes a b n).ExactToDegree a b (fun x ↦ 1) (n - 1)
theorem CAS.Continuum.newtonCotes_exactToDegree {a b : ℝ} {n : ℕ} (hn : 2 ≤ n) : (CAS.Continuum.newtonCotes a b n).ExactToDegree a b (fun x ↦ 1) (n - 1)
The
n-point closed Newton-Cotes rule,n ≥ 2, integrates every polynomial of degree at mostn - 1exactly on[a,b]. On a degenerate intervala = bevery weight and every integral is0. - theoremdefined in CAS/Continuum/Quadrature/NewtonCotes.leancomplete
theorem CAS.Continuum.newtonCotes_two_eval {a b : ℝ} (f : ℝ → ℝ) : (CAS.Continuum.newtonCotes a b 2).eval f = CAS.Continuum.trapezoidRule.valueOn f a b
theorem CAS.Continuum.newtonCotes_two_eval {a b : ℝ} (f : ℝ → ℝ) : (CAS.Continuum.newtonCotes a b 2).eval f = CAS.Continuum.trapezoidRule.valueOn f a b
The two-point closed Newton-Cotes rule is the trapezoidal rule.
- theoremdefined in CAS/Continuum/Quadrature/NewtonCotes.leancomplete
theorem CAS.Continuum.newtonCotes_nodesIn {a b : ℝ} (hab : a ≤ b) {n : ℕ} (hn : 2 ≤ n) : (CAS.Continuum.newtonCotes a b n).NodesIn (Set.Icc a b)
theorem CAS.Continuum.newtonCotes_nodesIn {a b : ℝ} (hab : a ≤ b) {n : ℕ} (hn : 2 ≤ n) : (CAS.Continuum.newtonCotes a b n).NodesIn (Set.Icc a b)
For
a ≤ bandn ≥ 2the equispaced nodes lie in[a,b]. - defdefined in CAS/Continuum/Quadrature/NewtonCotes.leancomplete
def CAS.Continuum.NodalRule.interpolatory (a b : ℝ) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) {m : ℕ} (x : Fin m → ℝ) : CAS.Continuum.NodalRule
def CAS.Continuum.NodalRule.interpolatory (a b : ℝ) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) {m : ℕ} (x : Fin m → ℝ) : CAS.Continuum.NodalRule
The interpolatory rule on the nodes
xfor the weightwona..b: the weight atxᵢis the integral of thei-th Lagrange basis polynomial againstw. - defdefined in CAS/Continuum/Quadrature/NewtonCotes.leancomplete
def CAS.Continuum.newtonCotes (a b : ℝ) (n : ℕ) : CAS.Continuum.NodalRule
def CAS.Continuum.newtonCotes (a b : ℝ) (n : ℕ) : CAS.Continuum.NodalRule
The interpolatory rule on
newtonCotesNodesfor the unit weight; forn ≥ 2these are the closed Newton-Cotes nodes on[a,b].
A polynomial of degree below m coincides with its Lagrange interpolant on
the m nodes, and the rule applied to it is the integral of that
interpolant against w. The Newton–Cotes nodes are distinct because the
spacing (b-a)/(n-1) is nonzero. For two nodes the Lagrange basis
polynomials are linear and each integrates to (b-a)/2.
Interpolation fixes m weights from m nodes, and the resulting degree
m-1 is all that can be said for a general choice of nodes. Simpson's rule
does better than its three nodes promise, reaching degree three, because its
middle node sits at the symmetric point. Gaussian quadrature asks how far
this can go when all the nodes are free.
10.8.1.2. Orthogonal polynomials
Fix a weight w that is continuous and strictly positive on [a,b],
a<b. The pairing
\langle p,q\rangle=\int_a^b p(x)\,q(x)\,w(x)\,dx
is an inner product on real polynomials: it is bilinear and symmetric, and
\langle p,p\rangle>0 for p\ne0, because a nonzero polynomial has only
finitely many zeros, so p^2w is positive on some open subinterval.
Orthogonalizing 1,x,x^2,\dots gives one monic polynomial p_n of each
degree, orthogonal to every polynomial of lower degree. For the unit weight on
[-1,1] these are the monic Legendre polynomials
p_1=x,\qquad p_2=x^2-\tfrac13,\qquad p_3=x^3-\tfrac35x,\qquad
p_4=x^4-\tfrac67x^2+\tfrac3{35}.
More generally, a linear functional L on \mathbb R[X] that is
positive on nonzero squares defines the inner product
\langle p,q\rangle=L(pq). Subtracting the orthogonal projection of
X^n onto polynomials of degree below n constructs p_n.
Integration against a positive weight is one instance.
CAS.Continuum.orthogonalPolynomial[complete]CAS.Continuum.integralOrthogonalPolynomial[complete]CAS.Continuum.orthogonalPolynomial_orthogonal[complete]CAS.Continuum.orthogonalPolynomial_unique[complete]CAS.Continuum.exists_monic_orthogonal[complete]CAS.Continuum.polynomialIntegral_square_pos[complete]CAS.Continuum.momentInnerCore[complete]
Let L:\mathbb R[X]\to\mathbb R be linear with L(q^2)>0 for every
q\ne0. The monic orthogonal polynomial p_n of L is monic of degree
n and satisfies L(p_nq)=0 for every q with \deg q<n. It is
unique: any monic polynomial of degree n with this property equals
p_n. For a weight w continuous on [[a,b]] and strictly positive on
[a,b], a<b, the functional p\mapsto\int_a^b p\,w is positive on
nonzero squares, and its orthogonal polynomials are the ones used for Gaussian
quadrature.
Lean code for Definition10.93●7 declarationsAssociated Lean declarationsCAS.Continuum.orthogonalPolynomial[complete]CAS.Continuum.integralOrthogonalPolynomial[complete]CAS.Continuum.orthogonalPolynomial_orthogonal[complete]CAS.Continuum.orthogonalPolynomial_unique[complete]CAS.Continuum.exists_monic_orthogonal[complete]CAS.Continuum.polynomialIntegral_square_pos[complete]CAS.Continuum.momentInnerCore[complete]
CAS.Continuum.orthogonalPolynomial[complete]CAS.Continuum.integralOrthogonalPolynomial[complete]CAS.Continuum.orthogonalPolynomial_orthogonal[complete]CAS.Continuum.orthogonalPolynomial_unique[complete]CAS.Continuum.exists_monic_orthogonal[complete]CAS.Continuum.polynomialIntegral_square_pos[complete]CAS.Continuum.momentInnerCore[complete]
- defdefined in CAS/Continuum/Quadrature/Gaussian/Orthogonal.leancomplete
def CAS.Continuum.orthogonalPolynomial (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) : Polynomial ℝ
def CAS.Continuum.orthogonalPolynomial (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) : Polynomial ℝ
The monic orthogonal polynomial
p_nofL: the monic polynomial of degreenorthogonal to all polynomials of lower degree, chosen fromexists_monic_orthogonal. - defdefined in CAS/Continuum/Quadrature/Gaussian/Orthogonal.leancomplete
def CAS.Continuum.integralOrthogonalPolynomial (a b : ℝ) (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hpositive : ∀ x ∈ Set.Icc a b, 0 < w x) (n : ℕ) : Polynomial ℝ
def CAS.Continuum.integralOrthogonalPolynomial (a b : ℝ) (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hpositive : ∀ x ∈ Set.Icc a b, 0 < w x) (n : ℕ) : Polynomial ℝ
The monic orthogonal polynomial of degree
nfor the functionalp ↦ ∫_a^b p w, withwcontinuous and strictly positive on[a, b]anda < b. Forw = 1on[-1, 1]this is the monic Legendre polynomial. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Orthogonal.leancomplete
theorem CAS.Continuum.orthogonalPolynomial_orthogonal (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) (q : Polynomial ℝ) (hq : q.degree < ↑n) : L (CAS.Continuum.orthogonalPolynomial L hpositive n * q) = 0
theorem CAS.Continuum.orthogonalPolynomial_orthogonal (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) (q : Polynomial ℝ) (hq : q.degree < ↑n) : L (CAS.Continuum.orthogonalPolynomial L hpositive n * q) = 0
L (p_n * q) = 0for every polynomialqof degree belown. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Orthogonal.leancomplete
theorem CAS.Continuum.orthogonalPolynomial_unique (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) (p : Polynomial ℝ) (hp : p.Monic) (hdegree : p.degree = ↑n) (horth : ∀ (q : Polynomial ℝ), q.degree < ↑n → L (p * q) = 0) : p = CAS.Continuum.orthogonalPolynomial L hpositive n
theorem CAS.Continuum.orthogonalPolynomial_unique (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) (p : Polynomial ℝ) (hp : p.Monic) (hdegree : p.degree = ↑n) (horth : ∀ (q : Polynomial ℝ), q.degree < ↑n → L (p * q) = 0) : p = CAS.Continuum.orthogonalPolynomial L hpositive n
A monic polynomial of degree
northogonal to every polynomial of degree belownequalsp_n. The difference has degree belownand is orthogonal to itself, so its square hasL-value zero and it vanishes by positivity. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Orthogonal.leancomplete
theorem CAS.Continuum.exists_monic_orthogonal (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) : ∃ p, p.Monic ∧ p.degree = ↑n ∧ ∀ (q : Polynomial ℝ), q.degree < ↑n → L (p * q) = 0
theorem CAS.Continuum.exists_monic_orthogonal (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (n : ℕ) : ∃ p, p.Monic ∧ p.degree = ↑n ∧ ∀ (q : Polynomial ℝ), q.degree < ↑n → L (p * q) = 0
For every
nthere is a monic polynomial of degreenwithL (p * q) = 0for everyqof degree belown. TakeX ^ nminus its orthogonal projection onto the polynomials of degree belown: the difference is monic and orthogonal to every polynomial of degree belown. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Integral.leancomplete
theorem CAS.Continuum.polynomialIntegral_square_pos {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) : 0 < (CAS.Continuum.polynomialIntegral a b w hw) (p ^ 2)
theorem CAS.Continuum.polynomialIntegral_square_pos {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) : 0 < (CAS.Continuum.polynomialIntegral a b w hw) (p ^ 2)
The integral of
p ^ 2againstwover[a, b]is strictly positive whena < b,wis continuous and strictly positive on[a, b], andp ≠ 0. - defdefined in CAS/Continuum/Quadrature/Gaussian/Orthogonal.leancomplete
def CAS.Continuum.momentInnerCore (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) : InnerProductSpace.Core ℝ (Polynomial ℝ)
def CAS.Continuum.momentInnerCore (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) : InnerProductSpace.Core ℝ (Polynomial ℝ)
The pairing
⟪p, q⟫ = L (p * q)is an inner product onℝ[X]whenLis positive on nonzero squares.
Uniqueness is short and gets used repeatedly. If p and p_n are both monic
of degree n and orthogonal to lower degrees, their difference r has
degree below n, so L(r^2)=L(pr)-L(p_nr)=0, and positivity forces
r=0. Every identification of a concrete polynomial with p_n goes
through this argument.
Orthogonal polynomials satisfy a three-term recurrence. Since
xp_{n+1} is monic of degree n+2, the difference
xp_{n+1}-p_{n+2} has degree at most n+1, and its expansion in
p_0,\dots,p_{n+1} has only two nonzero coefficients: for k<n the
coefficient of p_k is proportional to L(xp_{n+1}p_k)=L(p_{n+1}\cdot xp_k),
which vanishes because xp_k has degree below n+1.
CAS.Continuum.orthogonalPolynomial_recurrence[complete]CAS.Continuum.recurrenceBeta_eq_norm_ratio[complete]CAS.Continuum.recurrenceBeta_pos[complete]CAS.Continuum.orthogonalPolynomial_zero[complete]CAS.Continuum.orthogonalPolynomial_one[complete]CAS.Continuum.recurrenceAlpha[complete]CAS.Continuum.recurrenceBeta[complete]
With \alpha_n=L(xp_n^2)/L(p_n^2) and
\beta_n=L(xp_{n+1}p_n)/L(p_n^2), the monic orthogonal polynomials of L
satisfy p_0=1, p_1=x-\alpha_0, and
p_{n+2}=(x-\alpha_{n+1})\,p_{n+1}-\beta_n\,p_n\qquad(n\ge0).
Moreover \beta_n=L(p_{n+1}^2)/L(p_n^2), so \beta_n>0.
Lean code for Theorem10.94●7 declarationsAssociated Lean declarationsCAS.Continuum.orthogonalPolynomial_recurrence[complete]CAS.Continuum.recurrenceBeta_eq_norm_ratio[complete]CAS.Continuum.recurrenceBeta_pos[complete]CAS.Continuum.orthogonalPolynomial_zero[complete]CAS.Continuum.orthogonalPolynomial_one[complete]CAS.Continuum.recurrenceAlpha[complete]CAS.Continuum.recurrenceBeta[complete]
CAS.Continuum.orthogonalPolynomial_recurrence[complete]CAS.Continuum.recurrenceBeta_eq_norm_ratio[complete]CAS.Continuum.recurrenceBeta_pos[complete]CAS.Continuum.orthogonalPolynomial_zero[complete]CAS.Continuum.orthogonalPolynomial_one[complete]CAS.Continuum.recurrenceAlpha[complete]CAS.Continuum.recurrenceBeta[complete]
- theoremdefined in CAS/Continuum/Quadrature/Gaussian/Recurrence.leancomplete
theorem CAS.Continuum.orthogonalPolynomial_recurrence (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : CAS.Continuum.orthogonalPolynomial L hpositive (n + 2) = Polynomial.X * CAS.Continuum.orthogonalPolynomial L hpositive (n + 1) - Polynomial.C (CAS.Continuum.recurrenceAlpha L hpositive (n + 1)) * CAS.Continuum.orthogonalPolynomial L hpositive (n + 1) - Polynomial.C (CAS.Continuum.recurrenceBeta L hpositive n) * CAS.Continuum.orthogonalPolynomial L hpositive n
theorem CAS.Continuum.orthogonalPolynomial_recurrence (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : CAS.Continuum.orthogonalPolynomial L hpositive (n + 2) = Polynomial.X * CAS.Continuum.orthogonalPolynomial L hpositive (n + 1) - Polynomial.C (CAS.Continuum.recurrenceAlpha L hpositive (n + 1)) * CAS.Continuum.orthogonalPolynomial L hpositive (n + 1) - Polynomial.C (CAS.Continuum.recurrenceBeta L hpositive n) * CAS.Continuum.orthogonalPolynomial L hpositive n
p_{n+2} = (X - α_{n+1}) p_{n+1} - β_n p_n. The right side is monic of degreen + 2and orthogonal top_{n+1}, top_nand to every polynomial of degree belown, soorthogonalPolynomial_uniqueapplies. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Recurrence.leancomplete
theorem CAS.Continuum.recurrenceBeta_eq_norm_ratio (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : CAS.Continuum.recurrenceBeta L hpositive n = L (CAS.Continuum.orthogonalPolynomial L hpositive (n + 1) ^ 2) / L (CAS.Continuum.orthogonalPolynomial L hpositive n ^ 2)
theorem CAS.Continuum.recurrenceBeta_eq_norm_ratio (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : CAS.Continuum.recurrenceBeta L hpositive n = L (CAS.Continuum.orthogonalPolynomial L hpositive (n + 1) ^ 2) / L (CAS.Continuum.orthogonalPolynomial L hpositive n ^ 2)
β_n = L (p_{n+1} ^ 2) / L (p_n ^ 2). SinceX p_n - p_{n+1}has degree belown + 1, orthogonality ofp_{n+1}givesL (X p_{n+1} p_n) = L (p_{n+1} ^ 2). - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Recurrence.leancomplete
theorem CAS.Continuum.recurrenceBeta_pos (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : 0 < CAS.Continuum.recurrenceBeta L hpositive n
theorem CAS.Continuum.recurrenceBeta_pos (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : 0 < CAS.Continuum.recurrenceBeta L hpositive n
β_n > 0, being a ratio of values ofLon two nonzero squares. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Recurrence.leancomplete
theorem CAS.Continuum.orthogonalPolynomial_zero (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) : CAS.Continuum.orthogonalPolynomial L hpositive 0 = 1
theorem CAS.Continuum.orthogonalPolynomial_zero (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) : CAS.Continuum.orthogonalPolynomial L hpositive 0 = 1
The monic orthogonal polynomial of degree zero is the constant
1. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Recurrence.leancomplete
theorem CAS.Continuum.orthogonalPolynomial_one (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) : CAS.Continuum.orthogonalPolynomial L hpositive 1 = Polynomial.X - Polynomial.C (CAS.Continuum.recurrenceAlpha L hpositive 0)
theorem CAS.Continuum.orthogonalPolynomial_one (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) : CAS.Continuum.orthogonalPolynomial L hpositive 1 = Polynomial.X - Polynomial.C (CAS.Continuum.recurrenceAlpha L hpositive 0)
p_1 = X - α_0, whereα_0 = L X / L 1is the mean ofXfor the functionalL. - defdefined in CAS/Continuum/Quadrature/Gaussian/Recurrence.leancomplete
def CAS.Continuum.recurrenceAlpha (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : ℝ
def CAS.Continuum.recurrenceAlpha (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : ℝ
The diagonal recurrence coefficient
α_n = L (X p_n ^ 2) / L (p_n ^ 2). - defdefined in CAS/Continuum/Quadrature/Gaussian/Recurrence.leancomplete
def CAS.Continuum.recurrenceBeta (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : ℝ
def CAS.Continuum.recurrenceBeta (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (n : ℕ) : ℝ
The off-diagonal recurrence coefficient
β_n = L (X p_{n+1} p_n) / L (p_n ^ 2).
The right side is monic of degree n+2. It is orthogonal to p_{n+1} by
the choice of \alpha_{n+1}, to p_n by the choice of \beta_n, and to
every polynomial of degree below n because L(xp_{n+1}p_k)=0 for k<n.
Uniqueness
identifies it with p_{n+2}. For the second formula, xp_n-p_{n+1} has
degree at most n, so orthogonality of p_{n+1} gives
L(xp_{n+1}p_n)=L(p_{n+1}^2).
For the unit weight on [-1,1] the symmetry x\mapsto-x makes every
\alpha_n vanish. From L(1)=2 and L(p_1^2)=\tfrac23 one gets
\beta_0=\tfrac13 and p_2=x^2-\tfrac13; then
L(p_2^2)=\tfrac8{45}, \beta_1=\tfrac4{15}, and
p_3=x\,p_2-\tfrac4{15}x=x^3-\tfrac35x, as in the Legendre list.
The roots of p_n are the nodes of the Gauss rule, and three facts about
them are needed: they are real, simple, and inside (a,b). All three come
from one observation. Suppose q divides p_n, say p_n=qr with
\deg r<n. Orthogonality gives \int_a^b q\,r^2w=\int_a^b p_n\,r\,w=0.
If q had no zero on [a,b] it would have constant sign there, and so
would qr^2w, which is not identically zero; the integral could not
vanish. So every nonconstant factor of p_n has a root in [a,b].
CAS.Continuum.orthogonal_root_mem_Ioo[complete]CAS.Continuum.orthogonal_factor_has_root[complete]CAS.Continuum.orthogonal_squarefree[complete]CAS.Continuum.orthogonal_splits[complete]CAS.Continuum.exists_nodes_of_monic_splits_squarefree[complete]
Let w be continuous on [[a,b]] and strictly positive on [a,b],
a<b, and let p\ne0 be orthogonal against w to every polynomial of
lower degree. Then every nonconstant divisor of p has a root in
[a,b], p is squarefree and splits over \mathbb R, and every root of
p lies in the open interval (a,b). Consequently the monic orthogonal
polynomial p_n has exactly n distinct real roots, all in (a,b),
and they can be listed as x_0,\dots,x_{n-1} so that the nodal polynomial
\prod_i(x-x_i) equals p_n.
Lean code for Theorem10.95●5 theoremsAssociated Lean declarationsCAS.Continuum.orthogonal_root_mem_Ioo[complete]CAS.Continuum.orthogonal_factor_has_root[complete]CAS.Continuum.orthogonal_squarefree[complete]CAS.Continuum.orthogonal_splits[complete]CAS.Continuum.exists_nodes_of_monic_splits_squarefree[complete]
CAS.Continuum.orthogonal_root_mem_Ioo[complete]CAS.Continuum.orthogonal_factor_has_root[complete]CAS.Continuum.orthogonal_squarefree[complete]CAS.Continuum.orthogonal_splits[complete]CAS.Continuum.exists_nodes_of_monic_splits_squarefree[complete]
- theoremdefined in CAS/Continuum/Quadrature/Gaussian/Roots.leancomplete
theorem CAS.Continuum.orthogonal_root_mem_Ioo {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → (CAS.Continuum.polynomialIntegral a b w hw) (p * r) = 0) {x : ℝ} (hx : p.IsRoot x) : x ∈ Set.Ioo a b
theorem CAS.Continuum.orthogonal_root_mem_Ioo {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → (CAS.Continuum.polynomialIntegral a b w hw) (p * r) = 0) {x : ℝ} (hx : p.IsRoot x) : x ∈ Set.Ioo a b
Every root of an orthogonal polynomial for a continuous positive weight lies in the open interval
(a, b). A root atawould givep = (X - a) * rwith∫ (x - a) r² w = 0, but(x - a) w xis a weight positive on the interior, so this integral is positive. The endpointbis symmetric. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Roots.leancomplete
theorem CAS.Continuum.orthogonal_factor_has_root {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → (CAS.Continuum.polynomialIntegral a b w hw) (p * r) = 0) (q : Polynomial ℝ) (hq : 0 < q.natDegree) (hqp : q ∣ p) : ∃ x ∈ Set.Icc a b, Polynomial.eval x q = 0
theorem CAS.Continuum.orthogonal_factor_has_root {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → (CAS.Continuum.polynomialIntegral a b w hw) (p * r) = 0) (q : Polynomial ℝ) (hq : 0 < q.natDegree) (hqp : q ∣ p) : ∃ x ∈ Set.Icc a b, Polynomial.eval x q = 0
Every nonconstant divisor
qof an orthogonal polynomialphas a root in[a, b]. Writep = q * r, sodeg r < deg pand orthogonality gives∫ p r w = ∫ q r² w = 0, whichpolynomialIntegral_mul_square_ne_zeroforbids ifqhas no zero. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Roots.leancomplete
theorem CAS.Continuum.orthogonal_squarefree (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → L (p * r) = 0) : Squarefree p
theorem CAS.Continuum.orthogonal_squarefree (L : Polynomial ℝ →ₗ[ℝ] ℝ) (hpositive : ∀ (q : Polynomial ℝ), q ≠ 0 → 0 < L (q ^ 2)) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → L (p * r) = 0) : Squarefree p
A polynomial
p ≠ 0orthogonal to all polynomials of lower degree, for a functional positive on nonzero squares, is squarefree. Ifp = q ^ 2 * rwithqnonconstant thenL ((q * r) ^ 2) = L (p * r) = 0, contradicting positivity. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Roots.leancomplete
theorem CAS.Continuum.orthogonal_splits {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → (CAS.Continuum.polynomialIntegral a b w hw) (p * r) = 0) : p.Splits
theorem CAS.Continuum.orthogonal_splits {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (p : Polynomial ℝ) (hp : p ≠ 0) (horth : ∀ (r : Polynomial ℝ), r.degree < p.degree → (CAS.Continuum.polynomialIntegral a b w hw) (p * r) = 0) : p.Splits
An orthogonal polynomial for a continuous positive weight on
[a, b]splits overℝ. Every irreducible factor has a root in[a, b]byorthogonal_factor_has_root, hence has degree one. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Gaussian.leancomplete
theorem CAS.Continuum.exists_nodes_of_monic_splits_squarefree (p : Polynomial ℝ) (hp : p.Monic) (hsplit : p.Splits) (hsquare : Squarefree p) (n : ℕ) (hdegree : p.natDegree = n) : ∃ nodes, Function.Injective nodes ∧ (∀ (i : Fin n), p.IsRoot (nodes i)) ∧ Lagrange.nodal Finset.univ nodes = p
theorem CAS.Continuum.exists_nodes_of_monic_splits_squarefree (p : Polynomial ℝ) (hp : p.Monic) (hsplit : p.Splits) (hsquare : Squarefree p) (n : ℕ) (hdegree : p.natDegree = n) : ∃ nodes, Function.Injective nodes ∧ (∀ (i : Fin n), p.IsRoot (nodes i)) ∧ Lagrange.nodal Finset.univ nodes = p
A monic polynomial
pof degreenthat splits overℝand is squarefree hasndistinct roots: some injectivenodes : Fin n → ℝconsists of roots ofpand has nodal polynomial equal topitself.
The divisor statement is the sign argument for \int_a^b q\,r^2w. An
irreducible real factor
of degree two has no real root, so it cannot divide p, and p splits.
If q^2 divides p with q nonconstant, write p=q^2r; then
L((qr)^2)=L(p\,r)=0, contradicting positivity, so p is squarefree. A
root at the endpoint a would give p=(x-a)r with
\int_a^b(x-a)\,r^2w=0, but (x-a)w is a weight that is positive on
the interior; the endpoint b is symmetric. A monic squarefree polynomial
that splits is the product of x-x_i over its distinct roots.
The figure lists the roots of p_n for the Legendre weight, n=1 to
8, and draws P_n, the Legendre polynomial rescaled so that
P_n(1)=1, for the highlighted row. The roots stay strictly inside
(-1,1), as the theorem requires, and they crowd toward the endpoints as
n grows. The disc areas are the Gauss weights constructed next.
10.8.1.3. Gaussian quadrature
The degree of exactness of a rule with n nodes can never reach 2n.
The nodal polynomial \omega(x)=\prod_i(x-x_i) has degree n, so
\omega^2 has degree 2n; the rule returns \sum_iw_i\omega(x_i)^2=0,
while \int_a^b\omega^2w>0. Gauss's theorem says that degree 2n-1 is
reached, for one choice of nodes only.
Why must the nodes be the roots of p_n? Suppose a rule with nodes
x_i is exact to degree 2n-1. For any q of degree below n the
product \omega q has degree below 2n, and it vanishes at every node,
so
\int_a^b\omega\,q\,w=Q(\omega q)=\sum_i w_i\,\omega(x_i)\,q(x_i)=0.
Thus \omega is monic of degree n and orthogonal to all lower degrees,
and uniqueness forces \omega=p_n. Conversely, take the nodes to be the
roots of p_n and the weights interpolatory. Any p of degree below
2n divides as p=p_nq+r with \deg q,\deg r<n. The rule sees only
r, since p_n vanishes at the nodes, and it integrates r exactly;
the integral sees only r as well, since \int p_nq\,w=0. So
Q(p)=\int_a^b p\,w.
CAS.Continuum.exists_gaussian_quadrature[complete]CAS.Continuum.exists_nodalRule_gaussian[complete]CAS.Continuum.gaussian_exact[complete]CAS.Continuum.gaussian_weight_pos[complete]CAS.Continuum.interpolatory_exact[complete]
Let w be continuous on [[a,b]] and strictly positive on [a,b],
a<b, and let n\ge1. There are n distinct nodes in (a,b) whose
interpolatory weights w_i=\int_a^b\ell_i\,w are all strictly positive and
for which
\sum_{i<n}w_i\,p(x_i)=\int_a^b p(x)\,w(x)\,dx\qquad\text{whenever }\deg p<2n.
As a NodalRule, the rule is positive, has its nodes in [a,b], and is
exact to degree 2n-1.
Lean code for Theorem10.96●5 theoremsAssociated Lean declarationsCAS.Continuum.exists_gaussian_quadrature[complete]CAS.Continuum.exists_nodalRule_gaussian[complete]CAS.Continuum.gaussian_exact[complete]CAS.Continuum.gaussian_weight_pos[complete]CAS.Continuum.interpolatory_exact[complete]
CAS.Continuum.exists_gaussian_quadrature[complete]CAS.Continuum.exists_nodalRule_gaussian[complete]CAS.Continuum.gaussian_exact[complete]CAS.Continuum.gaussian_weight_pos[complete]CAS.Continuum.interpolatory_exact[complete]
- theoremdefined in CAS/Continuum/Quadrature/Gaussian/Gaussian.leancomplete
theorem CAS.Continuum.exists_gaussian_quadrature {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (n : ℕ) (hn : 0 < n) : ∃ nodes, Function.Injective nodes ∧ (∀ (i : Fin n), nodes i ∈ Set.Ioo a b) ∧ (∀ (i : Fin n), 0 < CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral a b w hw) nodes i) ∧ ∀ (p : Polynomial ℝ), p.natDegree < 2 * n → CAS.Continuum.interpolatoryValue (CAS.Continuum.polynomialIntegral a b w hw) nodes p = (CAS.Continuum.polynomialIntegral a b w hw) p
theorem CAS.Continuum.exists_gaussian_quadrature {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (n : ℕ) (hn : 0 < n) : ∃ nodes, Function.Injective nodes ∧ (∀ (i : Fin n), nodes i ∈ Set.Ioo a b) ∧ (∀ (i : Fin n), 0 < CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral a b w hw) nodes i) ∧ ∀ (p : Polynomial ℝ), p.natDegree < 2 * n → CAS.Continuum.interpolatoryValue (CAS.Continuum.polynomialIntegral a b w hw) nodes p = (CAS.Continuum.polynomialIntegral a b w hw) p
Gaussian quadrature with
n > 0nodes exists for every continuous strictly positive weight on[a, b],a < b:ndistinct nodes in(a, b), positive weights, and exactness againstwfor every polynomial of degree below2n. The nodes are the roots of the monic orthogonal polynomialp_nand the weights the Christoffel numbers. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Nodal.leancomplete
theorem CAS.Continuum.exists_nodalRule_gaussian {a b : ℝ} (hab : a < b) {w : ℝ → ℝ} (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) : ∃ Q, Q.size = n ∧ Q.Positive ∧ Q.NodesIn (Set.Ioo a b) ∧ Q.ExactToDegree a b w (2 * n - 1)
theorem CAS.Continuum.exists_nodalRule_gaussian {a b : ℝ} (hab : a < b) {w : ℝ → ℝ} (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) : ∃ Q, Q.size = n ∧ Q.Positive ∧ Q.NodesIn (Set.Ioo a b) ∧ Q.ExactToDegree a b w (2 * n - 1)
Gaussian quadrature. For a continuous positive weight
won[a,b],a < b, andn ≥ 1, there is a positive rule withnnodes, all in(a,b), that integrates every polynomial of degree at most2n - 1exactly againstw. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Algebra.leancomplete
theorem CAS.Continuum.gaussian_exact {n : ℕ} (L : Polynomial ℝ →ₗ[ℝ] ℝ) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (horth : ∀ (q : Polynomial ℝ), q.natDegree < n → L (Lagrange.nodal Finset.univ nodes * q) = 0) (p : Polynomial ℝ) (hp : p.natDegree < 2 * n) : CAS.Continuum.interpolatoryValue L nodes p = L p
theorem CAS.Continuum.gaussian_exact {n : ℕ} (L : Polynomial ℝ →ₗ[ℝ] ℝ) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (horth : ∀ (q : Polynomial ℝ), q.natDegree < n → L (Lagrange.nodal Finset.univ nodes * q) = 0) (p : Polynomial ℝ) (hp : p.natDegree < 2 * n) : CAS.Continuum.interpolatoryValue L nodes p = L p
If
Lvanishes on the nodal polynomial times every polynomial of degree belown, the interpolatory rule is exact forp.natDegree < 2n(through degree2n - 1whenn > 0). Dividepby the nodal polynomial: the quotient term is killed byLand by the rule, andinterpolatory_exacthandles the remainder. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Algebra.leancomplete
theorem CAS.Continuum.gaussian_weight_pos {n : ℕ} (hn : 0 < n) (L : Polynomial ℝ →ₗ[ℝ] ℝ) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (horth : ∀ (q : Polynomial ℝ), q.natDegree < n → L (Lagrange.nodal Finset.univ nodes * q) = 0) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (i : Fin n) : 0 < CAS.Continuum.interpolatoryWeight L nodes i
theorem CAS.Continuum.gaussian_weight_pos {n : ℕ} (hn : 0 < n) (L : Polynomial ℝ →ₗ[ℝ] ℝ) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (horth : ∀ (q : Polynomial ℝ), q.natDegree < n → L (Lagrange.nodal Finset.univ nodes * q) = 0) (hpositive : ∀ (p : Polynomial ℝ), p ≠ 0 → 0 < L (p ^ 2)) (i : Fin n) : 0 < CAS.Continuum.interpolatoryWeight L nodes i
Under the orthogonality hypothesis of
gaussian_exact, ifL (p ^ 2) > 0for everyp ≠ 0then every interpolatory weight is strictly positive. Apply exactness to the square of theith cardinal polynomial, which has degree2n - 2and picks out the weighti. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Algebra.leancomplete
theorem CAS.Continuum.interpolatory_exact {n : ℕ} (L : Polynomial ℝ →ₗ[ℝ] ℝ) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (p : Polynomial ℝ) (hp : p.degree < ↑n) : CAS.Continuum.interpolatoryValue L nodes p = L p
theorem CAS.Continuum.interpolatory_exact {n : ℕ} (L : Polynomial ℝ →ₗ[ℝ] ℝ) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (p : Polynomial ℝ) (hp : p.degree < ↑n) : CAS.Continuum.interpolatoryValue L nodes p = L p
For
ndistinct nodes the interpolatory rule reproducesL pwheneverdeg p < n. Such apequals its own Lagrange interpolant.
Take the nodes to be the roots of p_n. The interpolatory rule on n
distinct nodes reproduces every polynomial of degree below n. For
\deg p<2n, divide by the monic nodal polynomial: the quotient term is
annihilated by the rule, because the nodal polynomial vanishes at the nodes,
and by the integral, by orthogonality; the remainder has degree below
n. For the weights, apply exactness to \ell_i^2, which has degree
2n-2: the rule returns w_i, and the integral
\int_a^b\ell_i^2w is positive.
The nodes determine the weights, and the weights are positive. This positivity will give convergence for continuous integrands.
CAS.Continuum.GaussianRule[complete]CAS.Continuum.GaussianRule.value[complete]
A Gaussian rule with n nodes for the weight w on [a,b] is a
structure GaussianRule a b w hw n, where hw records that w is
continuous on [[a,b]]. It holds nodes x_0,\dots,x_{n-1}, weights
w_0,\dots,w_{n-1}, and four facts: the nodes are pairwise distinct, they lie
in the open interval (a,b), the weights are strictly positive, and
\sum_{i<n}w_i\,p(x_i)=\int_a^b p(x)\,w(x)\,dx\qquad\text{whenever }\deg p<2n.
Its value on a function f is \sum_iw_if(x_i). For n=0 the rule is
empty and the exactness field says nothing, so the theorems about Gaussian
rules assume n>0.
Lean code for Definition10.97●2 definitionsAssociated Lean declarationsCAS.Continuum.GaussianRule[complete]CAS.Continuum.GaussianRule.value[complete]
CAS.Continuum.GaussianRule[complete]CAS.Continuum.GaussianRule.value[complete]
- structuredefined in CAS/Continuum/Quadrature/Gaussian/Weighted.leancomplete
structure CAS.Continuum.GaussianRule (a b : ℝ) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (n : ℕ) : Type
structure CAS.Continuum.GaussianRule (a b : ℝ) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (n : ℕ) : Type
A Gaussian rule on
[a, b]for the weightw:ndistinct nodes in(a, b), positive weights, and exactness againstwfor every polynomial of degree below2n.Fields
nodes : Fin n → ℝ
The points where the rule evaluates its integrand.
weights : Fin n → ℝ
The coefficient multiplying the integrand at each node.
injective : Function.Injective self.nodes
The nodes are pairwise distinct, so the Lagrange basis and the Hermite interpolant on them exist.
interior : ∀ (i : Fin n), self.nodes i ∈ Set.Ioo a b
Every node lies in the open interval
(a, b), where the integrand is sampled.positive : ∀ (i : Fin n), 0 < self.weights i
Every weight is strictly positive, which makes the rule stable under uniform perturbation of the integrand.
exact : ∀ (p : Polynomial ℝ), p.natDegree < 2 * n → ∑ i, self.weights i * Polynomial.eval (self.nodes i) p = (CAS.Continuum.polynomialIntegral a b w hw) p
The rule integrates every polynomial of degree below
2nexactly againstw:∑ i, weights i * p (nodes i) = ∫_a^b p w. - defdefined in CAS/Continuum/Quadrature/Gaussian/Weighted.leancomplete
def CAS.Continuum.GaussianRule.value {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (f : ℝ → ℝ) : ℝ
def CAS.Continuum.GaussianRule.value {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (f : ℝ → ℝ) : ℝ
The rule applied to a real function
f: the sum over the nodes of the weight times the value offat that node.
Distinct nodes give the Lagrange and Hermite interpolants behind the
characterization and the remainder formula. Interior nodes let a bound
that holds on [a,b] be applied at every node, and positive weights turn such
a bound into the stability and convergence estimates.
CAS.Continuum.gaussianRule[complete]CAS.Continuum.GaussianRule.toNodalRule[complete]CAS.Continuum.GaussianRule.sum_weights[complete]CAS.Continuum.GaussianRule.weight_le_mass[complete]
For a<b, a weight that is strictly positive on [a,b], and n>0,
gaussianRule is the Gaussian rule of the existence theorem, with nodes at the
roots of p_n and interpolatory weights. Every Gaussian rule with n>0 is a
positive NodalRule exact to degree 2n-1. Exactness on the constant 1
makes its weights add up to \int_a^b w, so each weight is at most
\int_a^b w.
Lean code for Definition10.98●4 declarationsAssociated Lean declarationsCAS.Continuum.gaussianRule[complete]CAS.Continuum.GaussianRule.toNodalRule[complete]CAS.Continuum.GaussianRule.sum_weights[complete]CAS.Continuum.GaussianRule.weight_le_mass[complete]
CAS.Continuum.gaussianRule[complete]CAS.Continuum.GaussianRule.toNodalRule[complete]CAS.Continuum.GaussianRule.sum_weights[complete]CAS.Continuum.GaussianRule.weight_le_mass[complete]
- defdefined in CAS/Continuum/Quadrature/Gaussian/Weighted.leancomplete
def CAS.Continuum.gaussianRule {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (n : ℕ) (hn : 0 < n) : CAS.Continuum.GaussianRule a b w hw n
def CAS.Continuum.gaussianRule {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) (n : ℕ) (hn : 0 < n) : CAS.Continuum.GaussianRule a b w hw n
The Gaussian rule supplied by
exists_gaussian_quadrature: nodes at the roots of the monic orthogonal polynomialp_n, weights the Christoffel numbers. - defdefined in CAS/Continuum/Quadrature/Gaussian/Nodal.leancomplete
def CAS.Continuum.GaussianRule.toNodalRule {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) : CAS.Continuum.NodalRule
def CAS.Continuum.GaussianRule.toNodalRule {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) : CAS.Continuum.NodalRule
A Gaussian rule as a nodal rule.
- theoremdefined in CAS/Continuum/Quadrature/Gaussian/Weighted.leancomplete
theorem CAS.Continuum.GaussianRule.sum_weights {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (hn : 0 < n) : ∑ i, rule.weights i = (CAS.Continuum.polynomialIntegral a b w hw) 1
theorem CAS.Continuum.GaussianRule.sum_weights {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (hn : 0 < n) : ∑ i, rule.weights i = (CAS.Continuum.polynomialIntegral a b w hw) 1
The weights of a Gaussian rule with
n > 0nodes sum to∫_a^b w, since the rule is exact on the constant1. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Weighted.leancomplete
theorem CAS.Continuum.GaussianRule.weight_le_mass {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (i : Fin n) : rule.weights i ≤ (CAS.Continuum.polynomialIntegral a b w hw) 1
theorem CAS.Continuum.GaussianRule.weight_le_mass {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (i : Fin n) : rule.weights i ≤ (CAS.Continuum.polynomialIntegral a b w hw) 1
Each weight of a Gaussian rule is at most
∫_a^b w, the sum of all the positive weights.
For every Gaussian rule with n nodes for a continuous weight that is
strictly positive on [a,b], the nodal polynomial \prod_i(x-x_i) is the
monic orthogonal polynomial p_n of w, and the weight at x_i is the
interpolatory weight \int_a^b\ell_i\,w, the Christoffel number. A Gaussian
rule is therefore unique up to the order of its nodes.
Lean code for Theorem10.99●3 theoremsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/Gaussian/Characterization.leancomplete
theorem CAS.Continuum.GaussianRule.nodal_eq_integralOrthogonalPolynomial {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (hab : a < b) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) : Lagrange.nodal Finset.univ rule.nodes = CAS.Continuum.integralOrthogonalPolynomial a b hab w hw hwpos n
theorem CAS.Continuum.GaussianRule.nodal_eq_integralOrthogonalPolynomial {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (hab : a < b) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) : Lagrange.nodal Finset.univ rule.nodes = CAS.Continuum.integralOrthogonalPolynomial a b hab w hw hwpos n
The nodal polynomial of any Gaussian rule with
nnodes for a continuous positive weight is the monic orthogonal polynomial of degreen, byorthogonalPolynomial_unique. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Characterization.leancomplete
theorem CAS.Continuum.GaussianRule.nodal_orthogonal {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (q : Polynomial ℝ) (hq : q.degree < ↑n) : (CAS.Continuum.polynomialIntegral a b w hw) (Lagrange.nodal Finset.univ rule.nodes * q) = 0
theorem CAS.Continuum.GaussianRule.nodal_orthogonal {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (q : Polynomial ℝ) (hq : q.degree < ↑n) : (CAS.Continuum.polynomialIntegral a b w hw) (Lagrange.nodal Finset.univ rule.nodes * q) = 0
The nodal polynomial of a Gaussian rule is orthogonal to every polynomial
qof degree belown. The product has degree below2nand vanishes at every node, so its rule value, and hence its integral, is zero. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Characterization.leancomplete
theorem CAS.Continuum.GaussianRule.weights_eq_interpolatoryWeight {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (hn : 0 < n) (i : Fin n) : rule.weights i = CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral a b w hw) rule.nodes i
theorem CAS.Continuum.GaussianRule.weights_eq_interpolatoryWeight {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} {n : ℕ} (rule : CAS.Continuum.GaussianRule a b w hw n) (hn : 0 < n) (i : Fin n) : rule.weights i = CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral a b w hw) rule.nodes i
The weight of a Gaussian rule at node
iis the Christoffel number, the integral of theith cardinal polynomial. Apply exactness to that cardinal polynomial, of degreen - 1.
The nodal polynomial times any q of degree below n has degree below
2n and vanishes at every node, so its integral is its rule value, zero.
Uniqueness of the monic orthogonal polynomial identifies the nodal
polynomial. For the weights, apply exactness to \ell_i, which has degree
n-1 and takes the value 1 at x_i and 0 at the other nodes.
The figure shows both halves of the argument for n=3 and the Legendre
weight. On the left, p_3(x)\,x has degree four; the rule returns zero,
and orthogonality makes the integral zero too. On the right, p_3^2 has
degree six; the rule still returns zero, but the integral is
\tfrac8{175}. That positive number reappears as the constant in the
error formula.
The error of a Gauss rule is found by comparing f with its Hermite
interpolant H, the polynomial of degree below 2n that matches f and
f' at the n nodes. The rule is exact on H and cannot tell f
from H, so the error is \int_a^b(f-H)\,w. The pointwise remainder is
the familiar one for interpolation, with every node counted twice:
f(x)-H(x)=\frac{f^{(2n)}(\eta_x)}{(2n)!}\,\omega(x)^2
\qquad\text{for some }\eta_x\in[a,b].
Because \omega^2w\ge0, a mean-value argument for the integral pulls the
derivative out at a single point.
CAS.Continuum.GaussianRule.remainder_orthogonal[complete]CAS.Continuum.GaussianRule.remainder[complete]CAS.Continuum.GaussianRule.abs_error_le[complete]CAS.Continuum.hermite_remainder[complete]CAS.Continuum.hermiteInterpolant[complete]CAS.Continuum.exists_derivative_chain_zero_of_double_zeros[complete]CAS.Continuum.integral_eq_value_mul_of_pointwise_image[complete]
Let w be continuous on [[a,b]] and strictly positive on [a,b],
a<b, let Q be a Gaussian rule with n\ge1 nodes, and let
f\in C^{2n} on [a,b]. There is \xi\in[a,b] with
\int_a^b f(x)\,w(x)\,dx-Q(f)
=\frac{f^{(2n)}(\xi)}{(2n)!}\int_a^b \omega(x)^2\,w(x)\,dx,
where \omega=\prod_i(x-x_i) is the nodal polynomial, equal to p_n by the
characterization. Here f^{(2n)} is the iterated derivative within [a,b], so smoothness
is needed only on the closed interval. If |f^{(2n)}|\le M on [a,b],
the error is at most M/(2n)!\,\int_a^bp_n^2w.
Lean code for Theorem10.100●7 declarationsAssociated Lean declarationsCAS.Continuum.GaussianRule.remainder_orthogonal[complete]CAS.Continuum.GaussianRule.remainder[complete]CAS.Continuum.GaussianRule.abs_error_le[complete]CAS.Continuum.hermite_remainder[complete]CAS.Continuum.hermiteInterpolant[complete]CAS.Continuum.exists_derivative_chain_zero_of_double_zeros[complete]CAS.Continuum.integral_eq_value_mul_of_pointwise_image[complete]
CAS.Continuum.GaussianRule.remainder_orthogonal[complete]CAS.Continuum.GaussianRule.remainder[complete]CAS.Continuum.GaussianRule.abs_error_le[complete]CAS.Continuum.hermite_remainder[complete]CAS.Continuum.hermiteInterpolant[complete]CAS.Continuum.exists_derivative_chain_zero_of_double_zeros[complete]CAS.Continuum.integral_eq_value_mul_of_pointwise_image[complete]
- theoremdefined in CAS/Continuum/Quadrature/Gaussian/Nodal.leancomplete
theorem CAS.Continuum.GaussianRule.remainder_orthogonal {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hab : a < b) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) (rule : CAS.Continuum.GaussianRule a b w hw n) {f : ℝ → ℝ} (hf : ContDiffOn ℝ (2 * ↑n) f (Set.Icc a b)) : ∃ ξ ∈ Set.Icc a b, (∫ (x : ℝ) in a..b, f x * w x) - rule.value f = iteratedDerivWithin (2 * n) f (Set.Icc a b) ξ / ↑(2 * n).factorial * (CAS.Continuum.polynomialIntegral a b w hw) (CAS.Continuum.integralOrthogonalPolynomial a b hab w hw hwpos n ^ 2)
theorem CAS.Continuum.GaussianRule.remainder_orthogonal {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hab : a < b) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) (rule : CAS.Continuum.GaussianRule a b w hw n) {f : ℝ → ℝ} (hf : ContDiffOn ℝ (2 * ↑n) f (Set.Icc a b)) : ∃ ξ ∈ Set.Icc a b, (∫ (x : ℝ) in a..b, f x * w x) - rule.value f = iteratedDerivWithin (2 * n) f (Set.Icc a b) ξ / ↑(2 * n).factorial * (CAS.Continuum.polynomialIntegral a b w hw) (CAS.Continuum.integralOrthogonalPolynomial a b hab w hw hwpos n ^ 2)
The Gaussian remainder with the monic orthogonal polynomial
pₙofw: fora < b,wstrictly positive on[a,b], a Gaussian ruleQwithn > 0nodes andf ∈ C^{2n}[a,b]there isξ ∈ [a,b]with∫ f w - Q f = f^(2n)(ξ) / (2n)! * ∫ pₙ² w. This isGaussianRule.remainderwith the nodal polynomial rewritten aspₙbyGaussianRule.nodal_eq_integralOrthogonalPolynomial. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Remainder.leancomplete
theorem CAS.Continuum.GaussianRule.remainder {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) (rule : CAS.Continuum.GaussianRule a b w hw n) {f : ℝ → ℝ} (hf : ContDiffOn ℝ (2 * ↑n) f (Set.Icc a b)) : ∃ ξ ∈ Set.Icc a b, (∫ (x : ℝ) in a..b, f x * w x) - rule.value f = iteratedDerivWithin (2 * n) f (Set.Icc a b) ξ / ↑(2 * n).factorial * (CAS.Continuum.polynomialIntegral a b w hw) (Lagrange.nodal Finset.univ rule.nodes ^ 2)
theorem CAS.Continuum.GaussianRule.remainder {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) (rule : CAS.Continuum.GaussianRule a b w hw n) {f : ℝ → ℝ} (hf : ContDiffOn ℝ (2 * ↑n) f (Set.Icc a b)) : ∃ ξ ∈ Set.Icc a b, (∫ (x : ℝ) in a..b, f x * w x) - rule.value f = iteratedDerivWithin (2 * n) f (Set.Icc a b) ξ / ↑(2 * n).factorial * (CAS.Continuum.polynomialIntegral a b w hw) (Lagrange.nodal Finset.univ rule.nodes ^ 2)
The Gaussian error formula: for a weight strictly positive on
[a, b], a Gaussian ruleQwithn > 0nodes andf ∈ C^{2n}[a, b]there isξ ∈ [a, b]with∫ f w - Q f = f^(2n)(ξ) / (2n)! * ∫ P ^ 2 w, wheref^(2n)isiteratedDerivWithin (2n) f (Icc a b)andPthe nodal polynomial. Only smoothness on the closed interval is needed. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Remainder.leancomplete
theorem CAS.Continuum.GaussianRule.abs_error_le {a b : ℝ} (hab : a < b) {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) (rule : CAS.Continuum.GaussianRule a b w hw n) {f : ℝ → ℝ} (hf : ContDiffOn ℝ (2 * ↑n) f (Set.Icc a b)) {M : ℝ} (hM : ∀ x ∈ Set.Icc a b, |iteratedDerivWithin (2 * n) f (Set.Icc a b) x| ≤ M) : |(∫ (x : ℝ) in a..b, f x * w x) - rule.value f| ≤ M / ↑(2 * n).factorial * (CAS.Continuum.polynomialIntegral a b w hw) (Lagrange.nodal Finset.univ rule.nodes ^ 2)
theorem CAS.Continuum.GaussianRule.abs_error_le {a b : ℝ} (hab : a < b) {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {n : ℕ} (hn : 0 < n) (rule : CAS.Continuum.GaussianRule a b w hw n) {f : ℝ → ℝ} (hf : ContDiffOn ℝ (2 * ↑n) f (Set.Icc a b)) {M : ℝ} (hM : ∀ x ∈ Set.Icc a b, |iteratedDerivWithin (2 * n) f (Set.Icc a b) x| ≤ M) : |(∫ (x : ℝ) in a..b, f x * w x) - rule.value f| ≤ M / ↑(2 * n).factorial * (CAS.Continuum.polynomialIntegral a b w hw) (Lagrange.nodal Finset.univ rule.nodes ^ 2)
If
|f^(2n)| ≤ Mon[a, b]then|∫ f w - Q f| ≤ M / (2n)! * ∫ P ^ 2 w, immediately fromremainder. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Remainder.leancomplete
theorem CAS.Continuum.hermite_remainder {a b : ℝ} (hab : a < b) {n : ℕ} (hn : 0 < n) (F : ℕ → ℝ → ℝ) (hcontinuous : ∀ k < 2 * n, ContinuousOn (F k) (Set.Icc a b)) (hderiv : ∀ k < 2 * n, ∀ z ∈ Set.Ioo a b, HasDerivAt (F k) (F (k + 1) z) z) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (hmem : ∀ (i : Fin n), nodes i ∈ Set.Icc a b) (x : ℝ) (hx : x ∈ Set.Icc a b) : ∃ ξ ∈ Set.Icc a b, F 0 x - Polynomial.eval x (CAS.Continuum.hermiteInterpolant nodes (fun i ↦ F 0 (nodes i)) fun i ↦ F 1 (nodes i)) = F (2 * n) ξ / ↑(2 * n).factorial * Polynomial.eval x (Lagrange.nodal Finset.univ nodes) ^ 2
theorem CAS.Continuum.hermite_remainder {a b : ℝ} (hab : a < b) {n : ℕ} (hn : 0 < n) (F : ℕ → ℝ → ℝ) (hcontinuous : ∀ k < 2 * n, ContinuousOn (F k) (Set.Icc a b)) (hderiv : ∀ k < 2 * n, ∀ z ∈ Set.Ioo a b, HasDerivAt (F k) (F (k + 1) z) z) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (hmem : ∀ (i : Fin n), nodes i ∈ Set.Icc a b) (x : ℝ) (hx : x ∈ Set.Icc a b) : ∃ ξ ∈ Set.Icc a b, F 0 x - Polynomial.eval x (CAS.Continuum.hermiteInterpolant nodes (fun i ↦ F 0 (nodes i)) fun i ↦ F 1 (nodes i)) = F (2 * n) ξ / ↑(2 * n).factorial * Polynomial.eval x (Lagrange.nodal Finset.univ nodes) ^ 2
Pointwise Hermite remainder for a derivative chain
Fon[a, b]andndistinct nodes there. At everyx ∈ [a, b]someξ ∈ [a, b]satisfiesF 0 x - H x = F (2n) ξ / (2n)! * P x ^ 2, withHthe Hermite interpolant ofF 0,F 1at the nodes andPthe nodal polynomial. At a node both sides vanish. OtherwiseG = F 0 - H - c P ^ 2withc = (F 0 x - H x) / P x ^ 2has double zeros at the nodes and a zero atx, soexists_derivative_chain_zero_of_double_zerosgivesξwithG^(2n) ξ = 0, andH^(2n) = 0,(P ^ 2)^(2n) = (2n)!unwind this to the claim. - defdefined in CAS/Continuum/Quadrature/Gaussian/Hermite.leancomplete
def CAS.Continuum.hermiteInterpolant {n : ℕ} (nodes values slopes : Fin n → ℝ) : Polynomial ℝ
def CAS.Continuum.hermiteInterpolant {n : ℕ} (nodes values slopes : Fin n → ℝ) : Polynomial ℝ
The Hermite interpolant: the polynomial of degree below
2nwith prescribed values and first derivatives atndistinct nodes. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Rolle.leancomplete
theorem CAS.Continuum.exists_derivative_chain_zero_of_double_zeros {a b : ℝ} (n : ℕ) (F : ℕ → ℝ → ℝ) (hcontinuous : ∀ k < 2 * n, ContinuousOn (F k) (Set.Icc a b)) (hderiv : ∀ k < 2 * n, ∀ z ∈ Set.Ioo a b, HasDerivAt (F k) (F (k + 1) z) z) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (hmem : ∀ (i : Fin n), nodes i ∈ Set.Icc a b) (hzero : ∀ (i : Fin n), F 0 (nodes i) = 0 ∧ F 1 (nodes i) = 0) (x : ℝ) (hx : x ∈ Set.Icc a b) (hxne : ∀ (i : Fin n), x ≠ nodes i) (hxzero : F 0 x = 0) : ∃ z ∈ Set.Icc a b, F (2 * n) z = 0
theorem CAS.Continuum.exists_derivative_chain_zero_of_double_zeros {a b : ℝ} (n : ℕ) (F : ℕ → ℝ → ℝ) (hcontinuous : ∀ k < 2 * n, ContinuousOn (F k) (Set.Icc a b)) (hderiv : ∀ k < 2 * n, ∀ z ∈ Set.Ioo a b, HasDerivAt (F k) (F (k + 1) z) z) (nodes : Fin n → ℝ) (hnodes : Function.Injective nodes) (hmem : ∀ (i : Fin n), nodes i ∈ Set.Icc a b) (hzero : ∀ (i : Fin n), F 0 (nodes i) = 0 ∧ F 1 (nodes i) = 0) (x : ℝ) (hx : x ∈ Set.Icc a b) (hxne : ∀ (i : Fin n), x ≠ nodes i) (hxzero : F 0 x = 0) : ∃ z ∈ Set.Icc a b, F (2 * n) z = 0
If
F 0andF 1vanish atndistinct nodes in[a, b]andF 0vanishes at one further pointx, thenF (2n)has a zero in[a, b]. This is the multiset case with each node of multiplicity two andxof multiplicity one,2n + 1zeros in all. It is the form used for the Gaussian remainder. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/IntegralMeanValue.leancomplete
theorem CAS.Continuum.integral_eq_value_mul_of_pointwise_image {a b : ℝ} (hab : a < b) {r φ d : ℝ → ℝ} (hr : IntervalIntegrable r MeasureTheory.volume a b) (hφ : IntervalIntegrable φ MeasureTheory.volume a b) (hd : ContinuousOn d (Set.Icc a b)) (hφnonneg : ∀ x ∈ Set.Icc a b, 0 ≤ φ x) (hφpos : 0 < ∫ (x : ℝ) in a..b, φ x) (himage : ∀ x ∈ Set.Icc a b, ∃ y ∈ Set.Icc a b, r x = d y * φ x) : ∃ ξ ∈ Set.Icc a b, ∫ (x : ℝ) in a..b, r x = d ξ * ∫ (x : ℝ) in a..b, φ x
theorem CAS.Continuum.integral_eq_value_mul_of_pointwise_image {a b : ℝ} (hab : a < b) {r φ d : ℝ → ℝ} (hr : IntervalIntegrable r MeasureTheory.volume a b) (hφ : IntervalIntegrable φ MeasureTheory.volume a b) (hd : ContinuousOn d (Set.Icc a b)) (hφnonneg : ∀ x ∈ Set.Icc a b, 0 ≤ φ x) (hφpos : 0 < ∫ (x : ℝ) in a..b, φ x) (himage : ∀ x ∈ Set.Icc a b, ∃ y ∈ Set.Icc a b, r x = d y * φ x) : ∃ ξ ∈ Set.Icc a b, ∫ (x : ℝ) in a..b, r x = d ξ * ∫ (x : ℝ) in a..b, φ x
If at each
x ∈ [a, b]there isy ∈ [a, b]withr x = d y * φ x, then∫ r = d ξ * ∫ φfor a singleξ ∈ [a, b]. Requiresa < b,randφintegrable on[a, b],dcontinuous on[a, b],φ ≥ 0there and∫ φ > 0. The extrema ofdbound∫ r / ∫ φ, and the intermediate value theorem picksξ.
Fix x away from the nodes and choose c so that
G=f-H-c\,\omega^2 vanishes at x. Then G has double zeros at the n
nodes and a simple zero at x, 2n+1 zeros counted with multiplicity. A
generalized Rolle theorem, proved for a chain of functions each the
derivative of the previous one on the open interval, gives a zero \eta_x
of G^{(2n)}. Since H^{(2n)}=0 and (\omega^2)^{(2n)}=(2n)!, this is
the pointwise remainder. Multiply by w and integrate. The continuous
function f^{(2n)} takes values between its minimum and maximum on
[a,b], so the integral of (f-H)w lies between those extremes times
\int\omega^2w, and the intermediate value theorem produces \xi.
Finally \omega=p_n by the characterization.
For n=2 and the Legendre weight the constant is
\int_{-1}^1p_2^2=\tfrac8{45}. Rescaled to an interval of length h,
where \int p_2^2 scales by (h/2)^5, the formula gives error
f^{(4)}(\xi)\,h^5/4320, the same constant as the sharp two-point
Gauss–Legendre certificate, which is proved by a Peano kernel. For n=3 the
constant on
[-1,1] is \tfrac8{175}/6!=\tfrac1{15750}.
The first four Gauss–Legendre rules have closed forms in radicals. On
[-1,1] the one-point rule is the midpoint rule with weight 2, the
two-point rule has nodes \pm1/\sqrt3 and weights 1, the three-point rule
has nodes 0,\pm\sqrt{3/5} and weights \tfrac89,\tfrac59, and the
four-point rule has nodes \pm\sqrt{(15\mp2\sqrt{30})/35} with weights
(18\pm\sqrt{30})/36, the larger weight at the inner pair. The library stores
them in the normalized convention on [0,1], checks the moments degree by
degree, and then identifies each with the orthogonal-polynomial
construction.
CAS.Continuum.Legendre.four_nodal_eq[complete]CAS.Continuum.Legendre.three_nodal_eq[complete]CAS.Continuum.Legendre.two_nodal_eq[complete]CAS.Continuum.Legendre.one_nodal_eq[complete]CAS.Continuum.Legendre.three_exact[complete]CAS.Continuum.Legendre.four_exact[complete]CAS.Continuum.Legendre.monicPolynomial[complete]CAS.Continuum.Legendre.threeGaussian[complete]CAS.Continuum.Legendre.fourGaussian[complete]CAS.Continuum.GaussianRule.value_eq_gaussLegendreTwoRule_valueOn[complete]CAS.Continuum.GaussianRule.nodes_eq_gaussLegendreTwo[complete]
The normalized three- and four-point Gauss–Legendre rules, written in
radicals, are exact through degrees five and seven. Transported to
[-1,1], the midpoint rule, the two-point rule, and these two rules are
Gaussian rules for the unit weight, and the nodal polynomial of the
n-point rule is the monic Legendre polynomial of degree n, defined as
the monic orthogonal polynomial of that weight, for n=1,2,3,4. For
n=2 and any a<b, every Gaussian rule for the unit weight on [a,b]
has the transported two-point nodes and weights and the same value as the
two-point QuadratureRule.
Lean code for Theorem10.101●11 declarationsAssociated Lean declarationsCAS.Continuum.Legendre.four_nodal_eq[complete]CAS.Continuum.Legendre.three_nodal_eq[complete]CAS.Continuum.Legendre.two_nodal_eq[complete]CAS.Continuum.Legendre.one_nodal_eq[complete]CAS.Continuum.Legendre.three_exact[complete]CAS.Continuum.Legendre.four_exact[complete]CAS.Continuum.Legendre.monicPolynomial[complete]CAS.Continuum.Legendre.threeGaussian[complete]CAS.Continuum.Legendre.fourGaussian[complete]CAS.Continuum.GaussianRule.value_eq_gaussLegendreTwoRule_valueOn[complete]CAS.Continuum.GaussianRule.nodes_eq_gaussLegendreTwo[complete]
CAS.Continuum.Legendre.four_nodal_eq[complete]CAS.Continuum.Legendre.three_nodal_eq[complete]CAS.Continuum.Legendre.two_nodal_eq[complete]CAS.Continuum.Legendre.one_nodal_eq[complete]CAS.Continuum.Legendre.three_exact[complete]CAS.Continuum.Legendre.four_exact[complete]CAS.Continuum.Legendre.monicPolynomial[complete]CAS.Continuum.Legendre.threeGaussian[complete]CAS.Continuum.Legendre.fourGaussian[complete]CAS.Continuum.GaussianRule.value_eq_gaussLegendreTwoRule_valueOn[complete]CAS.Continuum.GaussianRule.nodes_eq_gaussLegendreTwo[complete]
- theoremdefined in CAS/Continuum/Quadrature/Legendre/Identification.leancomplete
theorem CAS.Continuum.Legendre.four_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.fourGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 4
theorem CAS.Continuum.Legendre.four_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.fourGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 4
The nodal polynomial of
fourGaussianis the monic Legendre polynomial of degree four. - theoremdefined in CAS/Continuum/Quadrature/Legendre/Identification.leancomplete
theorem CAS.Continuum.Legendre.three_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.threeGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 3
theorem CAS.Continuum.Legendre.three_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.threeGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 3
The nodal polynomial of
threeGaussianis the monic Legendre polynomial of degree three. - theoremdefined in CAS/Continuum/Quadrature/Legendre/Identification.leancomplete
theorem CAS.Continuum.Legendre.two_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.twoGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 2
theorem CAS.Continuum.Legendre.two_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.twoGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 2
The nodal polynomial of
twoGaussianis the monic Legendre polynomial of degree two. - theoremdefined in CAS/Continuum/Quadrature/Legendre/Identification.leancomplete
theorem CAS.Continuum.Legendre.one_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.oneGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 1
theorem CAS.Continuum.Legendre.one_nodal_eq : Lagrange.nodal Finset.univ CAS.Continuum.Legendre.oneGaussian.nodes = CAS.Continuum.Legendre.monicPolynomial 1
The nodal polynomial of
oneGaussianis the monic Legendre polynomial of degree one. - theoremdefined in CAS/Continuum/Quadrature/Legendre/Basic.leancomplete
theorem CAS.Continuum.Legendre.three_exact : CAS.Continuum.Legendre.three.ExactUpTo 5
theorem CAS.Continuum.Legendre.three_exact : CAS.Continuum.Legendre.three.ExactUpTo 5
The three-point rule is exact through degree five.
- theoremdefined in CAS/Continuum/Quadrature/Legendre/Basic.leancomplete
theorem CAS.Continuum.Legendre.four_exact : CAS.Continuum.Legendre.four.ExactUpTo 7
theorem CAS.Continuum.Legendre.four_exact : CAS.Continuum.Legendre.four.ExactUpTo 7
The four-point rule is exact through degree seven.
- defdefined in CAS/Continuum/Quadrature/Legendre/Identification.leancomplete
def CAS.Continuum.Legendre.monicPolynomial (n : ℕ) : Polynomial ℝ
def CAS.Continuum.Legendre.monicPolynomial (n : ℕ) : Polynomial ℝ
The monic Legendre polynomial of degree
n, defined as the monic orthogonal polynomial for the constant weight on[-1, 1]. - defdefined in CAS/Continuum/Quadrature/Legendre/Identification.leancomplete
def CAS.Continuum.Legendre.threeGaussian : CAS.Continuum.Legendre.Rule 3
def CAS.Continuum.Legendre.threeGaussian : CAS.Continuum.Legendre.Rule 3
The three-point Gauss-Legendre rule on
[-1, 1]: nodes-√(3/5),0,√(3/5)with weights5/9,8/9,5/9. - defdefined in CAS/Continuum/Quadrature/Legendre/Identification.leancomplete
def CAS.Continuum.Legendre.fourGaussian : CAS.Continuum.Legendre.Rule 4
def CAS.Continuum.Legendre.fourGaussian : CAS.Continuum.Legendre.Rule 4
The four-point Gauss-Legendre rule on
[-1, 1]: nodes±fourOuter,±fourInnerwith weights(18 - √30)/36on the outer pair and(18 + √30)/36on the inner pair. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/GaussLegendreTwo.leancomplete
theorem CAS.Continuum.GaussianRule.value_eq_gaussLegendreTwoRule_valueOn {a b : ℝ} {hw : ContinuousOn (fun x ↦ 1) (Set.uIcc a b)} (rule : CAS.Continuum.GaussianRule a b (fun x ↦ 1) hw 2) (f : ℝ → ℝ) : rule.value f = CAS.Continuum.gaussLegendreTwoRule.valueOn f a b
theorem CAS.Continuum.GaussianRule.value_eq_gaussLegendreTwoRule_valueOn {a b : ℝ} {hw : ContinuousOn (fun x ↦ 1) (Set.uIcc a b)} (rule : CAS.Continuum.GaussianRule a b (fun x ↦ 1) hw 2) (f : ℝ → ℝ) : rule.value f = CAS.Continuum.gaussLegendreTwoRule.valueOn f a b
A two-node Gaussian rule for the unit weight on
[a,b]is the transported two-point Gauss-Legendre rule. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/GaussLegendreTwo.leancomplete
theorem CAS.Continuum.GaussianRule.nodes_eq_gaussLegendreTwo {a b : ℝ} {hw : ContinuousOn (fun x ↦ 1) (Set.uIcc a b)} (rule : CAS.Continuum.GaussianRule a b (fun x ↦ 1) hw 2) (i : Fin 2) : rule.nodes i = CAS.Continuum.gaussLegendreTwoLeftPoint a b ∨ rule.nodes i = CAS.Continuum.gaussLegendreTwoRightPoint a b
theorem CAS.Continuum.GaussianRule.nodes_eq_gaussLegendreTwo {a b : ℝ} {hw : ContinuousOn (fun x ↦ 1) (Set.uIcc a b)} (rule : CAS.Continuum.GaussianRule a b (fun x ↦ 1) hw 2) (i : Fin 2) : rule.nodes i = CAS.Continuum.gaussLegendreTwoLeftPoint a b ∨ rule.nodes i = CAS.Continuum.gaussLegendreTwoRightPoint a b
Every node of a two-node Gaussian rule for the unit weight on
[a,b]is one of the two Gauss-Legendre pointsa + (3 ∓ √3)(b - a)/6.
Exactness through degree 2n-1 is a finite list of moment identities, each
checked by normal-form arithmetic using (\sqrt{3/5})^2=\tfrac35 or the
squares of the four-point radicals. Positivity of the weights and the ordering
of the nodes are inequalities between radicals. The characterization theorem
then identifies each nodal polynomial with the monic Legendre polynomial,
and for n=2 it pins down the nodes, whose weights are then fixed by
exactness.
Beyond four points the nodes are no longer convenient radicals, and the
library certifies them instead. A sparse rational polynomial p with
\int_{-1}^1p\,x^k\,dx=0 for k<n, a condition checked in rational
arithmetic from the moments of x^k, is the monic Legendre polynomial of
degree n as soon as it is monic of degree n. Its roots are isolated by
certified brackets (root brackets): a rational
interval with a sign change at the ends and a derivative enclosure of fixed
sign, so exactly one root lies inside. Ordered disjoint brackets inside
(-1,1) then define a Gaussian rule at any order n, with no stored table
of nodes.
CAS.Continuum.Legendre.RootCertificates.nodal_eq[complete]CAS.Continuum.Legendre.RootCertificates.orthogonal_of_shiftedMoments[complete]CAS.Continuum.Legendre.RootCertificates.nodes_mem[complete]CAS.Continuum.Legendre.RootCertificates.nodes_strictMono[complete]CAS.Continuum.Legendre.RootCertificates.rule[complete]CAS.Continuum.Legendre.RootCertificates.shiftedMoment[complete]
Let p be a sparse rational polynomial and let n valid root brackets for
p be ordered, each strictly to the left of the next. The bracketed roots
are strictly increasing and lie in their brackets. If p is monic of degree
n over \mathbb R, its nodal polynomial on these roots is p itself.
If moreover the brackets lie inside (-1,1) and the rational moments
\int_{-1}^1p(x)x^k\,dx vanish for k<n, the roots are the nodes of a
Gaussian rule for the unit weight on [-1,1], with the interpolatory
weights.
Lean code for Theorem10.102●6 declarationsAssociated Lean declarationsCAS.Continuum.Legendre.RootCertificates.nodal_eq[complete]CAS.Continuum.Legendre.RootCertificates.orthogonal_of_shiftedMoments[complete]CAS.Continuum.Legendre.RootCertificates.nodes_mem[complete]CAS.Continuum.Legendre.RootCertificates.nodes_strictMono[complete]CAS.Continuum.Legendre.RootCertificates.rule[complete]CAS.Continuum.Legendre.RootCertificates.shiftedMoment[complete]
CAS.Continuum.Legendre.RootCertificates.nodal_eq[complete]CAS.Continuum.Legendre.RootCertificates.orthogonal_of_shiftedMoments[complete]CAS.Continuum.Legendre.RootCertificates.nodes_mem[complete]CAS.Continuum.Legendre.RootCertificates.nodes_strictMono[complete]CAS.Continuum.Legendre.RootCertificates.rule[complete]CAS.Continuum.Legendre.RootCertificates.shiftedMoment[complete]
- theoremdefined in CAS/Continuum/Quadrature/Legendre/RootCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.nodal_eq {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) (hmonic : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).Monic) (hdegree : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).natDegree = n) : Lagrange.nodal Finset.univ (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid) = CAS.Continuum.Legendre.RootCertificates.realPolynomial p
theorem CAS.Continuum.Legendre.RootCertificates.nodal_eq {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) (hmonic : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).Monic) (hdegree : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).natDegree = n) : Lagrange.nodal Finset.univ (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid) = CAS.Continuum.Legendre.RootCertificates.realPolynomial p
For
ndisjoint ordered certified brackets of a monicpof degreen, the nodal polynomial of the nodes isrealPolynomial p. Both are monic of degreenand agree at thendistinct nodes. - theoremdefined in CAS/Continuum/Quadrature/Legendre/RootCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.orthogonal_of_shiftedMoments (p : CAS.Polynomial.Sparse.Univariate) (n : ℕ) (hmoments : ∀ k < n, CAS.Continuum.Legendre.RootCertificates.shiftedMoment p k = 0) (q : Polynomial ℝ) (hq : q.natDegree < n) : (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) (CAS.Continuum.Legendre.RootCertificates.realPolynomial p * q) = 0
theorem CAS.Continuum.Legendre.RootCertificates.orthogonal_of_shiftedMoments (p : CAS.Polynomial.Sparse.Univariate) (n : ℕ) (hmoments : ∀ k < n, CAS.Continuum.Legendre.RootCertificates.shiftedMoment p k = 0) (q : Polynomial ℝ) (hq : q.natDegree < n) : (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) (CAS.Continuum.Legendre.RootCertificates.realPolynomial p * q) = 0
If
shiftedMoment p k = 0for allk < nthenrealPolynomial pis orthogonal on[-1, 1]to every polynomial of degree belown. Expandqin monomials. - theoremdefined in CAS/Continuum/Quadrature/Legendre/RootCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.nodes_mem {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (i : Fin n) : (brackets i).interval.MemReal (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid i)
theorem CAS.Continuum.Legendre.RootCertificates.nodes_mem {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (i : Fin n) : (brackets i).interval.MemReal (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid i)
Each node lies in its bracket.
- theoremdefined in CAS/Continuum/Quadrature/Legendre/RootCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.nodes_strictMono {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) : StrictMono (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid)
theorem CAS.Continuum.Legendre.RootCertificates.nodes_strictMono {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) : StrictMono (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid)
If the brackets are pairwise disjoint and listed in increasing order, the nodes are strictly increasing.
- defdefined in CAS/Continuum/Quadrature/Legendre/RootCertificates.leancomplete
def CAS.Continuum.Legendre.RootCertificates.rule {n : ℕ} (hn : 0 < n) (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) (hinterior : ∀ (i : Fin n), -1 < (brackets i).interval.lo ∧ (brackets i).interval.hi < 1) (hmonic : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).Monic) (hdegree : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).natDegree = n) (hmoments : ∀ k < n, CAS.Continuum.Legendre.RootCertificates.shiftedMoment p k = 0) : CAS.Continuum.Legendre.Rule n
def CAS.Continuum.Legendre.RootCertificates.rule {n : ℕ} (hn : 0 < n) (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) (hinterior : ∀ (i : Fin n), -1 < (brackets i).interval.lo ∧ (brackets i).interval.hi < 1) (hmonic : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).Monic) (hdegree : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).natDegree = n) (hmoments : ∀ k < n, CAS.Continuum.Legendre.RootCertificates.shiftedMoment p k = 0) : CAS.Continuum.Legendre.Rule n
The Gaussian rule on
[-1, 1]with nodes at the certified roots and weights the Christoffel numbers. Needsn > 0, valid brackets that are disjoint, listed in increasing order and inside(-1, 1),pmonic of degreen, and the vanishing momentsshiftedMoment p k = 0fork < n, which give orthogonality of the nodal polynomial and hence positivity of the weights and exactness through degree2n - 1. - defdefined in CAS/Continuum/Quadrature/Legendre/RootCertificates.leancomplete
def CAS.Continuum.Legendre.RootCertificates.shiftedMoment : CAS.Polynomial.Sparse.Univariate → ℕ → ℚ
def CAS.Continuum.Legendre.RootCertificates.shiftedMoment : CAS.Polynomial.Sparse.Univariate → ℕ → ℚ
The rational value of
∫_{-1}^1 p x * x^kfor a sparse polynomialp, computed term by term frommoment.
Each valid bracket contains a unique root, and the ordering of the brackets
orders the roots. A monic polynomial of degree n with n distinct roots
is the product of the corresponding linear factors. The vanishing moments,
extended linearly to every q of degree below n, make the nodal
polynomial orthogonal to lower degrees; the Gaussian exactness and weight
positivity arguments then apply without change.
The weights of a certified rule are enclosed from the same brackets. At a
simple root r of p the Lagrange basis polynomial is
p(x)/\bigl((x-r)\,p'(r)\bigr), so the Christoffel number is
w_r=\frac{1}{p'(r)}\int_{-1}^1\frac{p(x)}{x-r}\,dx.
Synthetic division writes the integral as a polynomial in r with
rational coefficients, so the weight is a rational function of the single
root r, and interval evaluation over the bracket encloses it.
CAS.Continuum.Legendre.RootCertificates.weight_mem[complete]CAS.Continuum.Legendre.RootCertificates.interpolatoryWeight_eq_quotient[complete]CAS.Continuum.Legendre.RootCertificates.weightInterval_sound[complete]CAS.Continuum.Legendre.RootCertificates.integral_quotient[complete]CAS.Continuum.Legendre.RootCertificates.weightInterval[complete]
If the nodal polynomial of a family of nodes is p and r_i is a root,
the interpolatory weight at r_i is \tilde p(r_i)/p'(r_i), where
\tilde p is the rational polynomial integratedQuotient p with
\tilde p(r)=\int_{-1}^1p(x)/(x-r)\,dx. For a valid bracket the rational
interval weightInterval p bracket contains this quotient at the bracketed
root, and each Christoffel number of the certified rule lies in the interval
computed from its own bracket.
Lean code for Theorem10.103●5 declarationsAssociated Lean declarationsCAS.Continuum.Legendre.RootCertificates.weight_mem[complete]CAS.Continuum.Legendre.RootCertificates.interpolatoryWeight_eq_quotient[complete]CAS.Continuum.Legendre.RootCertificates.weightInterval_sound[complete]CAS.Continuum.Legendre.RootCertificates.integral_quotient[complete]CAS.Continuum.Legendre.RootCertificates.weightInterval[complete]
CAS.Continuum.Legendre.RootCertificates.weight_mem[complete]CAS.Continuum.Legendre.RootCertificates.interpolatoryWeight_eq_quotient[complete]CAS.Continuum.Legendre.RootCertificates.weightInterval_sound[complete]CAS.Continuum.Legendre.RootCertificates.integral_quotient[complete]CAS.Continuum.Legendre.RootCertificates.weightInterval[complete]
- theoremdefined in CAS/Continuum/Quadrature/Legendre/WeightCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.weight_mem {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) (hdegree : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).natDegree = n) (i : Fin n) : (CAS.Continuum.Legendre.RootCertificates.weightInterval p (brackets i)).MemReal (CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid) i)
theorem CAS.Continuum.Legendre.RootCertificates.weight_mem {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (brackets : Fin n → CAS.Polynomial.RealRoot.RootBracket) (hvalid : ∀ (i : Fin n), CAS.Polynomial.RealRoot.RootBracket.valid p (brackets i) = true) (hordered : ∀ (i j : Fin n), i < j → (brackets i).interval.hi < (brackets j).interval.lo) (hdegree : (CAS.Continuum.Legendre.RootCertificates.realPolynomial p).natDegree = n) (i : Fin n) : (CAS.Continuum.Legendre.RootCertificates.weightInterval p (brackets i)).MemReal (CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) (CAS.Continuum.Legendre.RootCertificates.nodes p brackets hvalid) i)
Each Christoffel number of the rule built from certified brackets lies in
weightInterval p (brackets i). - theoremdefined in CAS/Continuum/Quadrature/Legendre/WeightCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.interpolatoryWeight_eq_quotient {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (r : Fin n → ℝ) (hnodal : Lagrange.nodal Finset.univ r = CAS.Continuum.Legendre.RootCertificates.realPolynomial p) (i : Fin n) : CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) r i = CAS.Polynomial.Sparse.evalReal (CAS.Continuum.Legendre.RootCertificates.integratedQuotient p) (r i) / CAS.Polynomial.Sparse.evalReal (CAS.Polynomial.Sparse.derivativeRaw p) (r i)
theorem CAS.Continuum.Legendre.RootCertificates.interpolatoryWeight_eq_quotient {n : ℕ} (p : CAS.Polynomial.Sparse.Univariate) (r : Fin n → ℝ) (hnodal : Lagrange.nodal Finset.univ r = CAS.Continuum.Legendre.RootCertificates.realPolynomial p) (i : Fin n) : CAS.Continuum.interpolatoryWeight (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) r i = CAS.Polynomial.Sparse.evalReal (CAS.Continuum.Legendre.RootCertificates.integratedQuotient p) (r i) / CAS.Polynomial.Sparse.evalReal (CAS.Polynomial.Sparse.derivativeRaw p) (r i)
When the nodal polynomial is
realPolynomial p, the Christoffel number at nodeiis(integratedQuotient p)(rᵢ) / p'(rᵢ), a rational function of the single noderᵢ. - theoremdefined in CAS/Continuum/Quadrature/Legendre/WeightCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.weightInterval_sound (p : CAS.Polynomial.Sparse.Univariate) (bracket : CAS.Polynomial.RealRoot.RootBracket) (hvalid : CAS.Polynomial.RealRoot.RootBracket.valid p bracket = true) {r : ℝ} (hr : bracket.interval.MemReal r) : (CAS.Continuum.Legendre.RootCertificates.weightInterval p bracket).MemReal (CAS.Polynomial.Sparse.evalReal (CAS.Continuum.Legendre.RootCertificates.integratedQuotient p) r / CAS.Polynomial.Sparse.evalReal (CAS.Polynomial.Sparse.derivativeRaw p) r)
theorem CAS.Continuum.Legendre.RootCertificates.weightInterval_sound (p : CAS.Polynomial.Sparse.Univariate) (bracket : CAS.Polynomial.RealRoot.RootBracket) (hvalid : CAS.Polynomial.RealRoot.RootBracket.valid p bracket = true) {r : ℝ} (hr : bracket.interval.MemReal r) : (CAS.Continuum.Legendre.RootCertificates.weightInterval p bracket).MemReal (CAS.Polynomial.Sparse.evalReal (CAS.Continuum.Legendre.RootCertificates.integratedQuotient p) r / CAS.Polynomial.Sparse.evalReal (CAS.Polynomial.Sparse.derivativeRaw p) r)
For a valid bracket containing
r,weightInterval p bracketcontains(integratedQuotient p)(r) / p'(r). - theoremdefined in CAS/Continuum/Quadrature/Legendre/WeightCertificates.leancomplete
theorem CAS.Continuum.Legendre.RootCertificates.integral_quotient (p : CAS.Polynomial.Sparse.Univariate) (r : ℝ) : (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) (CAS.Continuum.Legendre.RootCertificates.quotient p r) = CAS.Polynomial.Sparse.evalReal (CAS.Continuum.Legendre.RootCertificates.integratedQuotient p) r
theorem CAS.Continuum.Legendre.RootCertificates.integral_quotient (p : CAS.Polynomial.Sparse.Univariate) (r : ℝ) : (CAS.Continuum.polynomialIntegral (-1) 1 (fun x ↦ 1) ⋯) (CAS.Continuum.Legendre.RootCertificates.quotient p r) = CAS.Polynomial.Sparse.evalReal (CAS.Continuum.Legendre.RootCertificates.integratedQuotient p) r
∫_{-1}^1 quotient p requalsintegratedQuotient pevaluated atr. - complete
def CAS.Continuum.Legendre.RootCertificates.weightInterval (p : CAS.Polynomial.Sparse.Univariate) (bracket : CAS.Polynomial.RealRoot.RootBracket) : CAS.Continuum.RationalInterval
def CAS.Continuum.Legendre.RootCertificates.weightInterval (p : CAS.Polynomial.Sparse.Univariate) (bracket : CAS.Polynomial.RealRoot.RootBracket) : CAS.Continuum.RationalInterval
A rational interval enclosing the weight: the interval quotient of the enclosures of
integratedQuotient pand ofp'over the bracket, with the sign ofp'read from the bracket's direction. The fallbackRationalInterval.const 0is never reached for a valid bracket.
The Lagrange basis polynomial at a node is the nodal polynomial divided by
x-r_i and by the nodal weight, which equals p'(r_i) for a simple root.
The division by x-r is carried out monomial by monomial through
(x^k-r^k)/(x-r)=\sum_{j<k}x^jr^{k-1-j}, and integrating the result term
by term gives \tilde p. The bracket's direction fixes the sign of
p' on it, so dividing the numerator enclosure by the derivative enclosure
is sound.
10.8.1.4. Convergence of positive rules
The error formula needs 2n derivatives, and the constant
M_{2n}/(2n)! need not stay small for a function that is merely
continuous. A different argument gives convergence for every continuous
f, and it uses exactly one property beyond exactness: positive weights.
Let w be continuous on [a,b] and let Q_n be rules with nonnegative
weights and nodes in [a,b], where Q_n integrates every polynomial of
degree at most d_n exactly against w and d_n\to\infty. Then
Q_n(f)\to\int_a^b f\,w for every f continuous on [a,b]. This is the
theorem of Pólya and Steklov. The same statement holds for normalized rules
with nonnegative weights transported to [a,b].
Lean code for Theorem10.104●3 theoremsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/PositiveRule.leancomplete
theorem CAS.Continuum.NodalRule.tendsto_eval_of_positive {Q : ℕ → CAS.Continuum.NodalRule} {deg : ℕ → ℕ} {a b : ℝ} {w f : ℝ → ℝ} (hab : a ≤ b) (hw : ContinuousOn w (Set.Icc a b)) (hpos : ∀ (n : ℕ), (Q n).Positive) (hnodes : ∀ (n : ℕ), (Q n).NodesIn (Set.Icc a b)) (hexact : ∀ (n : ℕ), (Q n).ExactToDegree a b w (deg n)) (hdeg : Filter.Tendsto deg Filter.atTop Filter.atTop) (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (Q n).eval f) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x * w x))
theorem CAS.Continuum.NodalRule.tendsto_eval_of_positive {Q : ℕ → CAS.Continuum.NodalRule} {deg : ℕ → ℕ} {a b : ℝ} {w f : ℝ → ℝ} (hab : a ≤ b) (hw : ContinuousOn w (Set.Icc a b)) (hpos : ∀ (n : ℕ), (Q n).Positive) (hnodes : ∀ (n : ℕ), (Q n).NodesIn (Set.Icc a b)) (hexact : ∀ (n : ℕ), (Q n).ExactToDegree a b w (deg n)) (hdeg : Filter.Tendsto deg Filter.atTop Filter.atTop) (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (Q n).eval f) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x * w x))
Pólya-Steklov theorem. Let
wbe continuous on[a,b]and letQₙbe positive rules with nodes in[a,b], then-th exact to degreedₙagainstw, withdₙ → ∞. ThenQₙ(f) → ∫ₐᵇ f wfor everyfcontinuous on[a,b]. - theoremdefined in CAS/Continuum/Quadrature/PositiveRule.leancomplete
theorem CAS.Continuum.NodalRule.abs_eval_sub_integral_le_of_polynomial_approx {Q : CAS.Continuum.NodalRule} {a b : ℝ} (hab : a ≤ b) {w : ℝ → ℝ} (hw : ContinuousOn w (Set.Icc a b)) (hpos : Q.Positive) (hnodes : Q.NodesIn (Set.Icc a b)) {d : ℕ} (hexact : Q.ExactToDegree a b w d) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) (p : Polynomial ℝ) (hp : p.natDegree ≤ d) {δ : ℝ} (happrox : ∀ x ∈ Set.Icc a b, |Polynomial.eval x p - f x| ≤ δ) : |Q.eval f - ∫ (x : ℝ) in a..b, f x * w x| ≤ δ * ((∫ (x : ℝ) in a..b, w x) + ∫ (x : ℝ) in a..b, |w x|)
theorem CAS.Continuum.NodalRule.abs_eval_sub_integral_le_of_polynomial_approx {Q : CAS.Continuum.NodalRule} {a b : ℝ} (hab : a ≤ b) {w : ℝ → ℝ} (hw : ContinuousOn w (Set.Icc a b)) (hpos : Q.Positive) (hnodes : Q.NodesIn (Set.Icc a b)) {d : ℕ} (hexact : Q.ExactToDegree a b w d) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) (p : Polynomial ℝ) (hp : p.natDegree ≤ d) {δ : ℝ} (happrox : ∀ x ∈ Set.Icc a b, |Polynomial.eval x p - f x| ≤ δ) : |Q.eval f - ∫ (x : ℝ) in a..b, f x * w x| ≤ δ * ((∫ (x : ℝ) in a..b, w x) + ∫ (x : ℝ) in a..b, |w x|)
Error of a positive rule from uniform polynomial approximation.
If the rule is exact to degree
dagainst a continuous weightw, its nodes lie in[a,b],fis continuous on[a,b], and a polynomial of degree at mostdis withinδoffon[a,b], then the error onfis at mostδ (∫ₐᵇ w + ∫ₐᵇ |w|). - theoremdefined in CAS/Continuum/Quadrature/PositiveRule.leancomplete
theorem CAS.Continuum.QuadratureRule.tendsto_valueOn_of_nonneg (rules : ℕ → CAS.Continuum.QuadratureRule) {deg : ℕ → ℕ} (hpositive : ∀ (n : ℕ), ∀ term ∈ (rules n).terms, 0 ≤ term.1) (hexact : ∀ (n : ℕ), (rules n).ExactUpTo (deg n)) (hdeg : Filter.Tendsto deg Filter.atTop Filter.atTop) {a b : ℝ} (hab : a ≤ b) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (rules n).valueOn f a b) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x))
theorem CAS.Continuum.QuadratureRule.tendsto_valueOn_of_nonneg (rules : ℕ → CAS.Continuum.QuadratureRule) {deg : ℕ → ℕ} (hpositive : ∀ (n : ℕ), ∀ term ∈ (rules n).terms, 0 ≤ term.1) (hexact : ∀ (n : ℕ), (rules n).ExactUpTo (deg n)) (hdeg : Filter.Tendsto deg Filter.atTop Filter.atTop) {a b : ℝ} (hab : a ≤ b) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (rules n).valueOn f a b) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x))
Pólya-Steklov theorem for normalized rules. Rules with nonnegative weights on
[0,1], then-th exact through degreedₙwithdₙ → ∞, converge on every ordered interval to∫ₐᵇ ffor every continuousf. This isNodalRule.tendsto_eval_of_positivefor the unit weight.
Exactness on constants makes the weights of Q_n sum to \int_a^b w. If a
polynomial p of degree at most d_n is within \delta of f on
[a,b], positivity bounds |Q_n(f)-Q_n(p)| by \delta\int_a^b w, and
|\int_a^b (p-f)w| is at most \delta\int_a^b|w|. Since Q_n(p) is the
integral of p w, the error on f is at most
\delta(\int_a^b w+\int_a^b|w|), a bound independent of n. The
Weierstrass theorem supplies p for every \delta>0, and d_n\to\infty
makes p admissible for all large n.
A Gauss rule with n+1 nodes is positive, has its nodes in [a,b], and
has degree 2n+1, so the theorem applies directly.
CAS.Continuum.gaussian_rules_converge[complete]CAS.Continuum.GaussianRule.tendsto_value[complete]
Let w be continuous on [[a,b]] with a\le b, and for each n let
Q_n be a Gaussian rule with n+1 nodes for w. Then
Q_n(f)\to\int_a^b f\,w for every f continuous on [a,b]. In
particular the rules of the existence theorem converge whenever w is
strictly positive and a<b.
Lean code for Theorem10.105●2 theoremsAssociated Lean declarationsCAS.Continuum.gaussian_rules_converge[complete]CAS.Continuum.GaussianRule.tendsto_value[complete]
CAS.Continuum.gaussian_rules_converge[complete]CAS.Continuum.GaussianRule.tendsto_value[complete]
- theoremdefined in CAS/Continuum/Quadrature/Gaussian/Nodal.leancomplete
theorem CAS.Continuum.gaussian_rules_converge {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (CAS.Continuum.gaussianRule hab w hw hwpos (n + 1) ⋯).value f) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x * w x))
theorem CAS.Continuum.gaussian_rules_converge {a b : ℝ} (hab : a < b) (w : ℝ → ℝ) (hw : ContinuousOn w (Set.uIcc a b)) (hwpos : ∀ x ∈ Set.Icc a b, 0 < w x) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (CAS.Continuum.gaussianRule hab w hw hwpos (n + 1) ⋯).value f) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x * w x))
For continuous
fand a continuous strictly positive weight on[a, b],a < b, the Gaussian rulesgaussianRulewithn + 1nodes converge to∫ f wasn → ∞. - theoremdefined in CAS/Continuum/Quadrature/Gaussian/Nodal.leancomplete
theorem CAS.Continuum.GaussianRule.tendsto_value {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hab : a ≤ b) (rules : (n : ℕ) → CAS.Continuum.GaussianRule a b w hw (n + 1)) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (rules n).value f) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x * w x))
theorem CAS.Continuum.GaussianRule.tendsto_value {a b : ℝ} {w : ℝ → ℝ} {hw : ContinuousOn w (Set.uIcc a b)} (hab : a ≤ b) (rules : (n : ℕ) → CAS.Continuum.GaussianRule a b w hw (n + 1)) {f : ℝ → ℝ} (hf : ContinuousOn f (Set.Icc a b)) : Filter.Tendsto (fun n ↦ (rules n).value f) Filter.atTop (nhds (∫ (x : ℝ) in a..b, f x * w x))
Every sequence of Gaussian rules for a continuous weight on
[a,b], then-th withn + 1nodes, converges to∫ₐᵇ f wforfcontinuous on[a,b]. The rules are positive and then-th is exact to degree2n + 1, so this is the Pólya-Steklov theoremNodalRule.tendsto_eval_of_positive.
The rules are positive with nodes in [a,b] and are exact to degree
2(n+1)-1, which tends to infinity. Apply the Pólya–Steklov theorem.
Positivity is not a technicality. The figure integrates the Runge function
1/(1+25x^2) over [-1,1] with the closed Newton–Cotes rule and the
Gauss–Legendre rule, n=2,\dots,24 points. Both are exact to degree at
least n-1, so both would converge if only exactness mattered. Newton–Cotes
weights become negative at nine points and from eleven points on, the sum
\sum_i|w_i| grows geometrically, and the error grows with it. The
Gauss weights stay positive, their absolute sum is always 2, and the error
decreases steadily. The divergence of Newton–Cotes is a classical
computation shown here for contrast; the library proves the positive side.
10.8.1.5. Panel rules of any order
For a smooth integrand the practical way to reduce error is to cut the
interval into N equal panels and apply a low-order rule on each. The only
information the composite construction needs about the local rule is a
one-panel bound of the form
\left\|\int_a^b f-Q(f)\right\|\le\frac{M\,(b-a)^{m+1}}{D}
\qquad\text{whenever }\|f^{(m)}\|\le M\text{ on }[a,b].
Summing N such bounds over panels of length (b-a)/N gives
C(b-a)^{m+1}/(DN^m). The library records the pair (rule, D) with the
proof of the one-panel bound as a PanelRule m, and builds composite
certificates, tolerance planning, and adaptive bisection once for every
order m.
CAS.Continuum.PanelRule[complete]CAS.Continuum.PanelRule.composite[complete]CAS.Continuum.PanelRule.composite_error[complete]CAS.Continuum.PanelRule.search[complete]CAS.Continuum.simpsonRule.fourthOrder[complete]CAS.Continuum.gaussLegendreTwoRule.fourthOrder[complete]
A panel rule of order m is a normalized rule Q with a positive
constant D and a proof that, on every ordered interval [a,b], every
f\in C^m[a,b] with \|f^{(m)}\|\le M there satisfies
\|\int_a^b f-Q(f)\|\le M(b-a)^{m+1}/D. Its composite certificate on N>0 equal panels, given a
panelwise derivative bounder with common bound C, has error budget
C(b-a)^{m+1}/(DN^m). Simpson's rule and the two-point Gauss–Legendre rule
are panel rules of order four.
Lean code for Definition10.106●6 declarationsAssociated Lean declarationsCAS.Continuum.PanelRule[complete]CAS.Continuum.PanelRule.composite[complete]CAS.Continuum.PanelRule.composite_error[complete]CAS.Continuum.PanelRule.search[complete]CAS.Continuum.simpsonRule.fourthOrder[complete]CAS.Continuum.gaussLegendreTwoRule.fourthOrder[complete]
CAS.Continuum.PanelRule[complete]CAS.Continuum.PanelRule.composite[complete]CAS.Continuum.PanelRule.composite_error[complete]CAS.Continuum.PanelRule.search[complete]CAS.Continuum.simpsonRule.fourthOrder[complete]CAS.Continuum.gaussLegendreTwoRule.fourthOrder[complete]
- structuredefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
structure CAS.Continuum.PanelRule (m : ℕ) : Type
structure CAS.Continuum.PanelRule (m : ℕ) : Type
A normalized quadrature rule with a one-panel error estimate of order
m: the error on[a,b]is at mostM (b-a)^(m+1) / Dwhenever‖f⁽ᵐ⁾‖ ≤ Mthere.Fields
rule : CAS.Continuum.QuadratureRule
The rule on the reference interval
[0,1].denominator : ℝ
The denominator
Din the one-panel errorM (b-a)^(m+1) / D.denominator_pos : 0 < self.denominator
The denominator is positive.
norm_integral_sub_valueOn_le : ∀ {f : ℝ → ℝ} {a b M : ℝ}, a < b → ContDiffOn ℝ (↑m) f (Set.Icc a b) → (∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin m f (Set.Icc a b) x‖ ≤ M) → ‖(∫ (x : ℝ) in a..b, f x) - self.rule.valueOn f a b‖ ≤ M * (b - a) ^ (m + 1) / self.denominator
The one-panel estimate on every ordered interval.
- defdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
def CAS.Continuum.PanelRule.composite {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.PanelRule.composite {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
Composite certificate on
Nequal panels, with errorC (b-a)^(m+1) / (D N^m)whenCdominates every per-panel bound for‖f⁽ᵐ⁾‖. - theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelRule.composite_error {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : (R.composite hab hN hf bounder ⋯).error = C * (b - a) ^ (m + 1) / (R.denominator * ↑N ^ m)
theorem CAS.Continuum.PanelRule.composite_error {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : (R.composite hab hN hf bounder ⋯).error = C * (b - a) ^ (m + 1) / (R.denominator * ↑N ^ m)
The composite error budget is
C (b-a)^(m+1) / (D N^m). - defdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
def CAS.Continuum.PanelRule.search {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {s : Set ℝ} (hf : ContDiffOn ℝ (↑m) f s) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f s) (depth : ℕ) (a b : ℝ) (hab : a < b) : Set.Icc a b ⊆ s → (tolerance : ℝ) → Option (CAS.Continuum.QuadratureTree.WithErrorAtMost f a b tolerance)
def CAS.Continuum.PanelRule.search {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {s : Set ℝ} (hf : ContDiffOn ℝ (↑m) f s) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f s) (depth : ℕ) (a b : ℝ) (hab : a < b) : Set.Icc a b ⊆ s → (tolerance : ℝ) → Option (CAS.Continuum.QuadratureTree.WithErrorAtMost f a b tolerance)
Depth-bounded adaptive search with the rule's panels as leaves.
At depth zero the current panel must already meet the tolerance. At positive depth, a rejected panel is bisected and each child is checked against half the parent tolerance. Exhausting the depth budget returns
none. - defdefined in CAS/Continuum/Quadrature/CompositeSimpson.leancomplete
def CAS.Continuum.simpsonRule.fourthOrder : CAS.Continuum.PanelRule 4
def CAS.Continuum.simpsonRule.fourthOrder : CAS.Continuum.PanelRule 4
Simpson's rule as a panel rule of order
4, with its sharp one-panel constant2880. - defdefined in CAS/Continuum/Quadrature/CompositeGaussLegendre.leancomplete
def CAS.Continuum.gaussLegendreTwoRule.fourthOrder : CAS.Continuum.PanelRule 4
def CAS.Continuum.gaussLegendreTwoRule.fourthOrder : CAS.Continuum.PanelRule 4
The two-point Gauss-Legendre rule as a panel rule of order
4, with its sharp one-panel constant4320.
CAS.Continuum.norm_integral_sub_trapezoidRule_valueOn_le[complete]CAS.Continuum.norm_integral_sub_midpointRule_valueOn_le[complete]CAS.Continuum.trapezoidRule.secondOrder[complete]CAS.Continuum.midpointRule.secondOrder[complete]CAS.Continuum.trapezoidRule.exactUpTo_one[complete]CAS.Continuum.midpointRule.exactUpTo_one[complete]
On an ordered interval, for f\in C^2[a,b] with
\|f''\|\le C there,
\left\|\int_a^bf-\frac{b-a}2\bigl(f(a)+f(b)\bigr)\right\|
\le\frac{C(b-a)^3}{12},\qquad
\left\|\int_a^bf-(b-a)f\!\left(\tfrac{a+b}2\right)\right\|
\le\frac{C(b-a)^3}{24}.
Both rules are exact through degree one, and they are panel rules of order
two with D=12 and D=24.
Lean code for Theorem10.107●6 declarationsAssociated Lean declarationsCAS.Continuum.norm_integral_sub_trapezoidRule_valueOn_le[complete]CAS.Continuum.norm_integral_sub_midpointRule_valueOn_le[complete]CAS.Continuum.trapezoidRule.secondOrder[complete]CAS.Continuum.midpointRule.secondOrder[complete]CAS.Continuum.trapezoidRule.exactUpTo_one[complete]CAS.Continuum.midpointRule.exactUpTo_one[complete]
CAS.Continuum.norm_integral_sub_trapezoidRule_valueOn_le[complete]CAS.Continuum.norm_integral_sub_midpointRule_valueOn_le[complete]CAS.Continuum.trapezoidRule.secondOrder[complete]CAS.Continuum.midpointRule.secondOrder[complete]CAS.Continuum.trapezoidRule.exactUpTo_one[complete]CAS.Continuum.midpointRule.exactUpTo_one[complete]
- theoremdefined in CAS/Continuum/Quadrature/SecondOrder.leancomplete
theorem CAS.Continuum.norm_integral_sub_trapezoidRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 2 f (Set.Icc a b)) (hsecond : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 2 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.trapezoidRule.valueOn f a b‖ ≤ C * (b - a) ^ 3 / 12
theorem CAS.Continuum.norm_integral_sub_trapezoidRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 2 f (Set.Icc a b)) (hsecond : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 2 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.trapezoidRule.valueOn f a b‖ ≤ C * (b - a) ^ 3 / 12
Sharp one-panel trapezoid estimate on an ordered interval.
A bound
Cfor the second within-derivative yields the classical errorC (b-a)³ / 12. - theoremdefined in CAS/Continuum/Quadrature/SecondOrder.leancomplete
theorem CAS.Continuum.norm_integral_sub_midpointRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 2 f (Set.Icc a b)) (hsecond : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 2 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.midpointRule.valueOn f a b‖ ≤ C * (b - a) ^ 3 / 24
theorem CAS.Continuum.norm_integral_sub_midpointRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 2 f (Set.Icc a b)) (hsecond : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 2 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.midpointRule.valueOn f a b‖ ≤ C * (b - a) ^ 3 / 24
Sharp one-panel midpoint estimate on an ordered interval.
A bound
Cfor the second within-derivative yields the classical errorC (b-a)³ / 24. - defdefined in CAS/Continuum/Quadrature/SecondOrder.leancomplete
def CAS.Continuum.trapezoidRule.secondOrder : CAS.Continuum.PanelRule 2
def CAS.Continuum.trapezoidRule.secondOrder : CAS.Continuum.PanelRule 2
The trapezoidal rule with its sharp one-panel constant
12. - defdefined in CAS/Continuum/Quadrature/SecondOrder.leancomplete
def CAS.Continuum.midpointRule.secondOrder : CAS.Continuum.PanelRule 2
def CAS.Continuum.midpointRule.secondOrder : CAS.Continuum.PanelRule 2
The midpoint rule with its sharp one-panel constant
24. - theoremdefined in CAS/Continuum/Quadrature/SecondOrder.leancomplete
theorem CAS.Continuum.trapezoidRule.exactUpTo_one : CAS.Continuum.trapezoidRule.ExactUpTo 1
theorem CAS.Continuum.trapezoidRule.exactUpTo_one : CAS.Continuum.trapezoidRule.ExactUpTo 1
The trapezoid rule has the exact normalized moments of degrees zero and one.
- theoremdefined in CAS/Continuum/Quadrature/SecondOrder.leancomplete
theorem CAS.Continuum.midpointRule.exactUpTo_one : CAS.Continuum.midpointRule.ExactUpTo 1
theorem CAS.Continuum.midpointRule.exactUpTo_one : CAS.Continuum.midpointRule.ExactUpTo 1
The midpoint rule has the exact normalized moments of degrees zero and one.
Two integrations by parts write each error as \int_a^bK(t)f''(t)\,dt.
For the trapezoid rule the kernel is (t-a)(b-t)/2\ge0, of mass
(b-a)^3/12. For the midpoint rule it is (t-a)^2/2 on the left half and
(b-t)^2/2 on the right, of mass (b-a)^3/24. Bound f'' by C.
The figure measures the composite error for \int_0^1e^x\,dx against the
panel count on logarithmic axes. On the left are the two second-order rules,
on the right Simpson's rule and the two-point Gauss rule. Each measured error
sits below its dashed proved bound e/(DN^m), and each curve has slope
-m, so halving the panel width divides the error by 4 or by 16. The
constants fall in the order the denominators 12, 24, 2880, 4320
predict: at every panel count the midpoint error is about half the trapezoid
error, and the Gauss error about two thirds of Simpson's.
Because the budget is an explicit function of N, the number of panels
needed for a tolerance \varepsilon can be computed in advance. The planner
never evaluates the integrand; it needs only the derivative bound C.
CAS.Continuum.PanelRule.compositeToTolerance_sound_le[complete]CAS.Continuum.PanelRule.compositeToTolerance_error_le[complete]CAS.Continuum.PanelPlan.uniformCompositeError_le[complete]CAS.Continuum.PanelPlan.errorConstant_div_requiredPanels_pow_le[complete]CAS.Continuum.PanelPlan.requiredPanels[complete]CAS.Continuum.PanelRule.compositeToTolerance[complete]
Let m\ne0, D>0, a\le b, C\ge0 and \varepsilon>0, put
B=C(b-a)^{m+1}/D, and let
N=\max(1,\lceil(B/\varepsilon)^{1/m}\rceil). Then
B/N^m\le\varepsilon. Consequently, for a panel rule of
order m, an integrand in C^m[a,b], a<b, and a derivative bounder whose
bound on every subinterval is at most C, the composite certificate on the
planned mesh has error budget at most \varepsilon, and its value is within
\varepsilon of \int_a^bf.
Lean code for Theorem10.108●6 declarationsAssociated Lean declarationsCAS.Continuum.PanelRule.compositeToTolerance_sound_le[complete]CAS.Continuum.PanelRule.compositeToTolerance_error_le[complete]CAS.Continuum.PanelPlan.uniformCompositeError_le[complete]CAS.Continuum.PanelPlan.errorConstant_div_requiredPanels_pow_le[complete]CAS.Continuum.PanelPlan.requiredPanels[complete]CAS.Continuum.PanelRule.compositeToTolerance[complete]
CAS.Continuum.PanelRule.compositeToTolerance_sound_le[complete]CAS.Continuum.PanelRule.compositeToTolerance_error_le[complete]CAS.Continuum.PanelPlan.uniformCompositeError_le[complete]CAS.Continuum.PanelPlan.errorConstant_div_requiredPanels_pow_le[complete]CAS.Continuum.PanelPlan.requiredPanels[complete]CAS.Continuum.PanelRule.compositeToTolerance[complete]
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelRule.compositeToTolerance_sound_le {m : ℕ} (R : CAS.Continuum.PanelRule m) (hm : m ≠ 0) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (htolerance : 0 < tolerance) : ‖(∫ (x : ℝ) in a..b, f x) - (R.compositeToTolerance hab hf bounder ⋯).value‖ ≤ tolerance
theorem CAS.Continuum.PanelRule.compositeToTolerance_sound_le {m : ℕ} (R : CAS.Continuum.PanelRule m) (hm : m ≠ 0) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (htolerance : 0 < tolerance) : ‖(∫ (x : ℝ) in a..b, f x) - (R.compositeToTolerance hab hf bounder ⋯).value‖ ≤ tolerance
For a positive order and a positive tolerance, the planned composite value approximates the integral within the tolerance.
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelRule.compositeToTolerance_error_le {m : ℕ} (R : CAS.Continuum.PanelRule m) (hm : m ≠ 0) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (htolerance : 0 < tolerance) : (R.compositeToTolerance hab hf bounder ⋯).error ≤ tolerance
theorem CAS.Continuum.PanelRule.compositeToTolerance_error_le {m : ℕ} (R : CAS.Continuum.PanelRule m) (hm : m ≠ 0) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (htolerance : 0 < tolerance) : (R.compositeToTolerance hab hf bounder ⋯).error ≤ tolerance
For a positive order and a positive tolerance, the planned composite certificate has error budget at most the tolerance.
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelPlan.uniformCompositeError_le {m : ℕ} (hm : m ≠ 0) {denominator a b C tolerance : ℝ} (htolerance : 0 < tolerance) : C * (b - a) ^ (m + 1) / (denominator * ↑(CAS.Continuum.PanelPlan.requiredPanels m denominator a b C tolerance) ^ m) ≤ tolerance
theorem CAS.Continuum.PanelPlan.uniformCompositeError_le {m : ℕ} (hm : m ≠ 0) {denominator a b C tolerance : ℝ} (htolerance : 0 < tolerance) : C * (b - a) ^ (m + 1) / (denominator * ↑(CAS.Continuum.PanelPlan.requiredPanels m denominator a b C tolerance) ^ m) ≤ tolerance
For
m > 0andε > 0, the planned mesh meets the tolerance in the unfolded form produced byQuadratureCert.uniformCompositeOfOrder:C (b-a)^(m+1) / (D N^m) ≤ ε. - theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelPlan.errorConstant_div_requiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {denominator a b C tolerance : ℝ} (htolerance : 0 < tolerance) : CAS.Continuum.PanelPlan.errorConstant m denominator a b C / ↑(CAS.Continuum.PanelPlan.requiredPanels m denominator a b C tolerance) ^ m ≤ tolerance
theorem CAS.Continuum.PanelPlan.errorConstant_div_requiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {denominator a b C tolerance : ℝ} (htolerance : 0 < tolerance) : CAS.Continuum.PanelPlan.errorConstant m denominator a b C / ↑(CAS.Continuum.PanelPlan.requiredPanels m denominator a b C tolerance) ^ m ≤ tolerance
For a positive order
mand a positive tolerance, the planned panel count reduces the error modelB / N^mto at most the tolerance. - defdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
def CAS.Continuum.PanelPlan.requiredPanels (m : ℕ) (denominator a b C tolerance : ℝ) : ℕ
def CAS.Continuum.PanelPlan.requiredPanels (m : ℕ) (denominator a b C tolerance : ℝ) : ℕ
Panel count
max 1 ⌈(B / ε)^(1/m)⌉₊for an order-merror model with numeratorB = errorConstant m D a b Cand toleranceε. Sufficiency requiresm > 0and a positive tolerance; a negative numerator is below the tolerance for every panel count. - defdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
def CAS.Continuum.PanelRule.compositeToTolerance {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.PanelRule.compositeToTolerance {m : ℕ} (R : CAS.Continuum.PanelRule m) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
Composite certificate whose panel count is chosen by
PanelPlan.requiredPanels.
The ceiling gives N\ge(B/\varepsilon)^{1/m}, and raising both sides to the
power m gives N^m\ge B/\varepsilon. The composite budget is
B/N^m, and certificate soundness bounds the actual error by the budget.
For m=4 we use the classical one-panel constants for Simpson's rule and the
two-point Gauss rule. We prove their composite bounds and choose meshes with
planners in exact rational arithmetic that run inside Lean.
For an ordered interval [a,b], a C^4 scalar integrand, and a bound C
on its fourth within-derivative, the Peano-kernel argument gives the classical
one-panel Simpson estimate
\lVert\int_a^b f-S(f)\rVert\le C(b-a)^5/2880, returned as a
QuadratureCert.
Lean code for Theorem10.109●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/SimpsonPeano.leancomplete
theorem CAS.Continuum.norm_integral_sub_simpsonRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.simpsonRule.valueOn f a b‖ ≤ C * (b - a) ^ 5 / 2880
theorem CAS.Continuum.norm_integral_sub_simpsonRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.simpsonRule.valueOn f a b‖ ≤ C * (b - a) ^ 5 / 2880
Sharp one-panel Simpson estimate on an ordered interval.
The fourth within-derivative bound
Cyields the classical errorC * (b-a)^5 / 2880. - defdefined in CAS/Continuum/Quadrature/SimpsonPeano.leancomplete
def CAS.Continuum.simpsonRule.fourthOrderCert {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.simpsonRule.fourthOrderCert {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : CAS.Continuum.QuadratureCert f a b
Sharp one-panel Simpson certificate on an ordered interval.
Represent the Simpson error as the integral of the fourth derivative against
its Peano kernel, whose two polynomial pieces live on [a,(a+b)/2] and
[(a+b)/2,b]; four integrations by parts produce it, and cubic exactness
cancels all boundary polynomial terms. The kernel has fixed sign and exact
mass (b-a)^5/2880. Bounding the fourth derivative by C gives the stated
norm estimate.
For an ordered interval [a,b], a C^4 scalar integrand, and a bound C
on its fourth within-derivative, the two-point Gauss–Legendre Peano kernel is
nonnegative and has mass (b-a)^5/4320. Consequently
\lVert\int_a^b f-G_2(f)\rVert\le C(b-a)^5/4320, with the irrational
nodes treated exactly; the estimate is returned as a QuadratureCert.
Lean code for Theorem10.110●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/GaussLegendrePeano.leancomplete
theorem CAS.Continuum.norm_integral_sub_gaussLegendreTwoRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.gaussLegendreTwoRule.valueOn f a b‖ ≤ C * (b - a) ^ 5 / 4320
theorem CAS.Continuum.norm_integral_sub_gaussLegendreTwoRule_valueOn_le {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : ‖(∫ (x : ℝ) in a..b, f x) - CAS.Continuum.gaussLegendreTwoRule.valueOn f a b‖ ≤ C * (b - a) ^ 5 / 4320
Sharp two-point Gauss-Legendre estimate on an ordered interval.
The fourth within-derivative bound
Cyields the classical errorC * (b-a)^5 / 4320. This proof combines the three nonnegative-kernel bounds with the exact total-mass theorem above. - defdefined in CAS/Continuum/Quadrature/GaussLegendrePeano.leancomplete
def CAS.Continuum.gaussLegendreTwoRule.fourthOrderCert {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.gaussLegendreTwoRule.fourthOrderCert {f : ℝ → ℝ} {a b C : ℝ} (hab : a < b) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (hfourth : ∀ x ∈ Set.Icc a b, ‖iteratedDerivWithin 4 f (Set.Icc a b) x‖ ≤ C) : CAS.Continuum.QuadratureCert f a b
Sharp two-point Gauss-Legendre certificate on an ordered interval.
Use cubic exactness to express the rule error through the fourth-order Peano
kernel. The exact two Gauss nodes make the boundary terms vanish, and the
kernel is nonnegative with mass (b-a)^5/4320. The uniform fourth-derivative
bound therefore yields the claimed certificate.
Any local quadrature constructor with certified error
C(v-u)^5/D can be accumulated over N>0 equal panels. The generic theorem
produces error C(b-a)^5/(DN^4) and a canonical flattened ordered term list
whose exact weighted sum equals the composite value. Smoothness is assumed
only on the root interval, and one IteratedDerivativeBounderOn supplies each
panel's within-derivative bound together with a common upper bound C.
Analytic composition and finite-precision execution therefore share one
rule-independent boundary.
Lean code for Theorem10.111●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/UniformComposite.leancomplete
theorem CAS.Continuum.weightedSum_uniformCompositeTerms (rule : CAS.Continuum.QuadratureRule) (f : ℝ → ℝ) (N : ℕ) (a b : ℝ) : CAS.Continuum.weightedSum (CAS.Continuum.uniformCompositeTerms rule f N a b) = CAS.Continuum.uniformCompositeValue rule f N a b
theorem CAS.Continuum.weightedSum_uniformCompositeTerms (rule : CAS.Continuum.QuadratureRule) (f : ℝ → ℝ) (N : ℕ) (a b : ℝ) : CAS.Continuum.weightedSum (CAS.Continuum.uniformCompositeTerms rule f N a b) = CAS.Continuum.uniformCompositeValue rule f N a b
Flattened terms denote exactly the corresponding composite-rule value.
- defdefined in CAS/Continuum/Quadrature/UniformComposite.leancomplete
def CAS.Continuum.QuadratureCert.uniformCompositeFourthOrder (rule : CAS.Continuum.QuadratureRule) (denominator : ℝ) {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (onePanel : ∀ {l r : ℝ}, l < r → ContDiffOn ℝ 4 f (Set.Icc l r) → (∀ x ∈ Set.Icc l r, ‖iteratedDerivWithin 4 f (Set.Icc l r) x‖ ≤ C) → ‖(∫ (x : ℝ) in l..r, f x) - rule.valueOn f l r‖ ≤ C * (r - l) ^ 5 / denominator) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.QuadratureCert.uniformCompositeFourthOrder (rule : CAS.Continuum.QuadratureRule) (denominator : ℝ) {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (onePanel : ∀ {l r : ℝ}, l < r → ContDiffOn ℝ 4 f (Set.Icc l r) → (∀ x ∈ Set.Icc l r, ‖iteratedDerivWithin 4 f (Set.Icc l r) x‖ ≤ C) → ‖(∫ (x : ℝ) in l..r, f x) - rule.valueOn f l r‖ ≤ C * (r - l) ^ 5 / denominator) : CAS.Continuum.QuadratureCert f a b
Accumulate a fourth-order one-panel theorem over a uniform mesh.
onePanelis the complete rule-specific analytic input. This is them = 4case ofuniformCompositeOfOrder.
Split the interval into N equal panels and add the local integral
identities. The triangle inequality sums the local errors. Since each panel
has length (b-a)/N, the sum of N terms
C((b-a)/N)^5/D simplifies to C(b-a)^5/(DN^4). Flattening the panel
term lists preserves the same finite weighted sum.
For N>0 equal Simpson panels, an integrand that is C^4 on [a,b],
and certified panelwise fourth within-derivative bounds at most C, summing
the sharp local certificates gives
\lVert\int_a^b f-S_N(f)\rVert\le C(b-a)^5/(2880N^4).
Each panel consists of the usual two half-subintervals.
Lean code for Theorem10.112●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/CompositeSimpson.leancomplete
theorem CAS.Continuum.QuadratureCert.compositeSimpson_error {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : (CAS.Continuum.QuadratureCert.compositeSimpson hab hN hf bounder ⋯).error = C * (b - a) ^ 5 / (2880 * ↑N ^ 4)
theorem CAS.Continuum.QuadratureCert.compositeSimpson_error {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : (CAS.Continuum.QuadratureCert.compositeSimpson hab hN hf bounder ⋯).error = C * (b - a) ^ 5 / (2880 * ↑N ^ 4)
The composite Simpson certificate records its accumulated fourth-order error bound.
- defdefined in CAS/Continuum/Quadrature/CompositeSimpson.leancomplete
def CAS.Continuum.QuadratureCert.compositeSimpson {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.QuadratureCert.compositeSimpson {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
Composite Simpson quadrature with its sharp accumulated analytic error.
Instantiate the generic composite theorem with the sharp one-panel Simpson
certificate and denominator 2880. The common fourth-derivative bound
dominates every panel certificate, and the generic error calculation gives
the displayed N^{-4} estimate.
For N>0 equal two-point Gauss–Legendre panels and the same root-local
smoothness and panelwise derivative-bound hypotheses, the composite certificate has error
C(b-a)^5/(4320N^4). Its ordered term list retains the two exact irrational
nodes on every panel and is proved equal to the analytic composite value.
Lean code for Theorem10.113●2 declarationsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/CompositeGaussLegendre.leancomplete
theorem CAS.Continuum.QuadratureCert.compositeGaussLegendreTwo_error {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : (CAS.Continuum.QuadratureCert.compositeGaussLegendreTwo hab hN hf bounder ⋯).error = C * (b - a) ^ 5 / (4320 * ↑N ^ 4)
theorem CAS.Continuum.QuadratureCert.compositeGaussLegendreTwo_error {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : (CAS.Continuum.QuadratureCert.compositeGaussLegendreTwo hab hN hf bounder ⋯).error = C * (b - a) ^ 5 / (4320 * ↑N ^ 4)
The composite Gauss-Legendre certificate records its accumulated fourth-order error bound.
- defdefined in CAS/Continuum/Quadrature/CompositeGaussLegendre.leancomplete
def CAS.Continuum.QuadratureCert.compositeGaussLegendreTwo {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.QuadratureCert.compositeGaussLegendreTwo {f : ℝ → ℝ} {a b C : ℝ} {N : ℕ} (hab : a < b) (hN : 0 < N) (hf : ContDiffOn ℝ 4 f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn 4 f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) : CAS.Continuum.QuadratureCert f a b
Composite two-point Gauss-Legendre certificate with sharp analytic error.
Instantiate the uniform composite construction with the sharp two-point
Gauss–Legendre certificate and denominator 4320. Summing the panel
certificates gives the global error, while the generic flattening theorem
retains the exact ordered nodes and weights.
The composite rule has a canonical flattened list of ordered weighted terms. Its exact-real weighted sum is proved equal to the analytic composite Simpson value. Verified rational, interval, or floating-point evaluators can therefore evaluate the same term list.
For the canonical panel-major list T_N(f,a,b),
\operatorname{weightedSum}\!\left(T_N(f,a,b)\right)
=S_N(f;[a,b]).
The canonical term list fixes the nodes and accumulation order; this equality certifies its exact-real value. Equality of sums alone would not fix an order.
Lean code for Theorem10.114●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/CompositeSimpson.leancomplete
theorem CAS.Continuum.weightedSum_compositeSimpsonTerms (f : ℝ → ℝ) (N : ℕ) (a b : ℝ) : CAS.Continuum.weightedSum (CAS.Continuum.compositeSimpsonTerms f N a b) = CAS.Continuum.compositeSimpsonValue f N a b
theorem CAS.Continuum.weightedSum_compositeSimpsonTerms (f : ℝ → ℝ) (N : ℕ) (a b : ℝ) : CAS.Continuum.weightedSum (CAS.Continuum.compositeSimpsonTerms f N a b) = CAS.Continuum.compositeSimpsonValue f N a b
Flattened composite Simpson terms have exactly the exact-real value.
Unfold the uniform composite rule panel by panel. On each panel the three listed weighted terms are definitionally the transported Simpson value. Induction over the panel list shows that flattening and then taking the weighted sum equals the sum of the analytic panel values.
Every normalized exact-rational rule compiles uniformly to N > 0 panels by
mapping a source term (w,\xi) on panel k to
(w/N,(k+\xi)/N). The cast rule is proved equal term-for-term to the
canonical analytic uniform-composite list. This preserves both the exact-real
value and the panel-major accumulation schedule used by verified numerical
backends.
Lean code for Theorem10.115●2 theoremsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/RationalComposite.leancomplete
theorem CAS.Continuum.RationalQuadratureRule.uniformComposite_toQuadratureRule_termsOn (rule : CAS.Continuum.RationalQuadratureRule) (N : ℕ) (hN : 0 < N) (f : ℝ → ℝ) (a b : ℝ) : (rule.uniformComposite N hN).toQuadratureRule.termsOn f a b = CAS.Continuum.uniformCompositeTerms rule.toQuadratureRule f N a b
theorem CAS.Continuum.RationalQuadratureRule.uniformComposite_toQuadratureRule_termsOn (rule : CAS.Continuum.RationalQuadratureRule) (N : ℕ) (hN : 0 < N) (f : ℝ → ℝ) (a b : ℝ) : (rule.uniformComposite N hN).toQuadratureRule.termsOn f a b = CAS.Continuum.uniformCompositeTerms rule.toQuadratureRule f N a b
The exact-rational composite rule produces precisely the ordered real term list for uniform panel composition.
This is stronger than equality of quadrature values: both lists add the terms in the same panel-major order.
- theoremdefined in CAS/Continuum/Quadrature/RationalComposite.leancomplete
theorem CAS.Continuum.RationalQuadratureRule.uniformComposite_toQuadratureRule_valueOn (rule : CAS.Continuum.RationalQuadratureRule) (N : ℕ) (hN : 0 < N) (f : ℝ → ℝ) (a b : ℝ) : (rule.uniformComposite N hN).toQuadratureRule.valueOn f a b = CAS.Continuum.uniformCompositeValue rule.toQuadratureRule f N a b
theorem CAS.Continuum.RationalQuadratureRule.uniformComposite_toQuadratureRule_valueOn (rule : CAS.Continuum.RationalQuadratureRule) (N : ℕ) (hN : 0 < N) (f : ℝ → ℝ) (a b : ℝ) : (rule.uniformComposite N hN).toQuadratureRule.valueOn f a b = CAS.Continuum.uniformCompositeValue rule.toQuadratureRule f N a b
Exact-rational uniform composition denotes the canonical exact-real uniform composite value on every real interval.
Map every rational source node and weight by the affine panel formula and cast the result to the reals. Field identities show term by term that the cast node and weight equal those of the analytic transported rule. Mapping this equality over panels and flattening proves equality of both schedules and values.
Let B=C(b-a)^5/D. For a positive tolerance, choosing
N=\max(1,\lceil(B/\mathrm{tolerance})^{1/4}\rceil) proves
B/N^4\leq\mathrm{tolerance}. This is the case m=4 of the planner for an
error model B/N^m of any order m>0, and it is the rule-independent
planner behind every fourth-order uniform composite rule.
Lean code for Theorem10.116●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelPlan.errorConstant_div_requiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {denominator a b C tolerance : ℝ} (htolerance : 0 < tolerance) : CAS.Continuum.PanelPlan.errorConstant m denominator a b C / ↑(CAS.Continuum.PanelPlan.requiredPanels m denominator a b C tolerance) ^ m ≤ tolerance
theorem CAS.Continuum.PanelPlan.errorConstant_div_requiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {denominator a b C tolerance : ℝ} (htolerance : 0 < tolerance) : CAS.Continuum.PanelPlan.errorConstant m denominator a b C / ↑(CAS.Continuum.PanelPlan.requiredPanels m denominator a b C tolerance) ^ m ≤ tolerance
For a positive order
mand a positive tolerance, the planned panel count reduces the error modelB / N^mto at most the tolerance.
If B<0 the bound holds for every N. Otherwise the ceiling construction gives
N\geq(B/\tau)^{1/4} and N\geq1. Positivity permits raising the first
inequality to the fourth power, yielding N^4\geq B/\tau. Rearranging with
\tau>0 proves B/N^4\leq\tau.
For exact rational error data, the executable planner rounds
B/\mathrm{tolerance} upward and takes one more than the integer fourth root
of the result (Mathlib's Nat.nthRoot 4). The resulting positive natural panel
count satisfies the same fourth-order inequality without evaluating a
noncomputable real root.
Lean code for Theorem10.117●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelPlan.div_ratRequiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {errorConstant tolerance : ℚ} (htolerance : 0 < tolerance) : errorConstant / ↑(CAS.Continuum.PanelPlan.ratRequiredPanels m errorConstant tolerance) ^ m ≤ tolerance
theorem CAS.Continuum.PanelPlan.div_ratRequiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {errorConstant tolerance : ℚ} (htolerance : 0 < tolerance) : errorConstant / ↑(CAS.Continuum.PanelPlan.ratRequiredPanels m errorConstant tolerance) ^ m ≤ tolerance
For a positive order
mand a positive tolerance, the executable panel count reduces the error modelB / N^mbelow the tolerance, for every rationalB.
Mathlib's Nat.lt_pow_nthRoot_add_one says that one more than the integer
fourth root of \lceil B/\tau\rceil has fourth power above it, so the chosen
natural's fourth power is at least the exact rational ratio. Rearranging with
\tau>0 gives the same tolerance estimate as the real planner.
Substituting the sharp Simpson denominator D=2880 into the executable
rational planner produces a panel count whose composite error bound
C(b-a)^5/(2880N^4) is at most the requested rational tolerance.
Lean code for Theorem10.118●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelPlan.div_ratRequiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {errorConstant tolerance : ℚ} (htolerance : 0 < tolerance) : errorConstant / ↑(CAS.Continuum.PanelPlan.ratRequiredPanels m errorConstant tolerance) ^ m ≤ tolerance
theorem CAS.Continuum.PanelPlan.div_ratRequiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {errorConstant tolerance : ℚ} (htolerance : 0 < tolerance) : errorConstant / ↑(CAS.Continuum.PanelPlan.ratRequiredPanels m errorConstant tolerance) ^ m ≤ tolerance
For a positive order
mand a positive tolerance, the executable panel count reduces the error modelB / N^mbelow the tolerance, for every rationalB.
Apply the rational fourth-order planner with denominator 2880, the error
constant B=C(b-a)^5/2880 of the composite Simpson theorem: its panel count
N satisfies B/N^4\leq\tau in exact rational arithmetic.
Substituting the two-point Gauss–Legendre denominator D=4320 gives the
corresponding executable panel count, whose composite error bound
C(b-a)^5/(4320N^4) is at most the requested rational tolerance.
Lean code for Theorem10.119●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelPlan.div_ratRequiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {errorConstant tolerance : ℚ} (htolerance : 0 < tolerance) : errorConstant / ↑(CAS.Continuum.PanelPlan.ratRequiredPanels m errorConstant tolerance) ^ m ≤ tolerance
theorem CAS.Continuum.PanelPlan.div_ratRequiredPanels_pow_le {m : ℕ} (hm : m ≠ 0) {errorConstant tolerance : ℚ} (htolerance : 0 < tolerance) : errorConstant / ↑(CAS.Continuum.PanelPlan.ratRequiredPanels m errorConstant tolerance) ^ m ≤ tolerance
For a positive order
mand a positive tolerance, the executable panel count reduces the error modelB / N^mbelow the tolerance, for every rationalB.
Apply the same executable fourth-order planner with denominator 4320, the
error constant of the composite two-point Gauss–Legendre theorem: its panel
count N satisfies C(b-a)^5/(4320N^4)\leq\tau in exact rational arithmetic.
Given root-interval smoothness and certified panelwise fourth-derivative
bounds, the planned Simpson and two-point Gauss–Legendre constructors return
ordinary QuadratureCerts whose semantic error is at most the user's positive
tolerance. The public conclusion refers only to the integral, computed rule
value, and tolerance; panel selection remains an internal construction.
For either planned fourth-order rule Q_{N(\tau)},
\left|\int_a^b f(x)\,dx-Q_{N(\tau)}(f)\right|
\leq\tau.
Lean code for Theorem10.120●3 declarationsAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/PanelRule.leancomplete
theorem CAS.Continuum.PanelRule.compositeToTolerance_sound_le {m : ℕ} (R : CAS.Continuum.PanelRule m) (hm : m ≠ 0) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (htolerance : 0 < tolerance) : ‖(∫ (x : ℝ) in a..b, f x) - (R.compositeToTolerance hab hf bounder ⋯).value‖ ≤ tolerance
theorem CAS.Continuum.PanelRule.compositeToTolerance_sound_le {m : ℕ} (R : CAS.Continuum.PanelRule m) (hm : m ≠ 0) {f : ℝ → ℝ} {a b C tolerance : ℝ} (hab : a < b) (hf : ContDiffOn ℝ (↑m) f (Set.Icc a b)) (bounder : CAS.Continuum.IteratedDerivativeBounderOn m f (Set.Icc a b)) (hbound : ∀ {l r : ℝ} (hlr : l < r) (hsub : Set.Icc l r ⊆ Set.Icc a b), bounder.bound hlr hsub ≤ C) (htolerance : 0 < tolerance) : ‖(∫ (x : ℝ) in a..b, f x) - (R.compositeToTolerance hab hf bounder ⋯).value‖ ≤ tolerance
For a positive order and a positive tolerance, the planned composite value approximates the integral within the tolerance.
- defdefined in CAS/Continuum/Quadrature/CompositeSimpson.leancomplete
def CAS.Continuum.simpsonRule.fourthOrder : CAS.Continuum.PanelRule 4
def CAS.Continuum.simpsonRule.fourthOrder : CAS.Continuum.PanelRule 4
Simpson's rule as a panel rule of order
4, with its sharp one-panel constant2880. - defdefined in CAS/Continuum/Quadrature/CompositeGaussLegendre.leancomplete
def CAS.Continuum.gaussLegendreTwoRule.fourthOrder : CAS.Continuum.PanelRule 4
def CAS.Continuum.gaussLegendreTwoRule.fourthOrder : CAS.Continuum.PanelRule 4
The two-point Gauss-Legendre rule as a panel rule of order
4, with its sharp one-panel constant4320.
The planner chooses a positive panel count whose formula is below
\tau. Build the corresponding composite Simpson or Gauss–Legendre
certificate from the supplied smoothness and derivative bounds, then compose
its analytic error estimate with the planner inequality.
Mathlib's composite trapezoidal rule is exposed through the common certificate
interface. Assume f is C^2 on S=[\min(a,b),\max(a,b)] and
|D^2_S f(x)|\leq\zeta for every real x, where D^2_S denotes the
second iterated within-derivative. For N>0 subintervals the error is at most
|b-a|^3\zeta/(12N^2).
Lean code for Definition10.121●1 definitionAssociated Lean declarationsCAS.Continuum.QuadratureCert.trapezoidal[complete]
CAS.Continuum.QuadratureCert.trapezoidal[complete]
- defdefined in CAS/Continuum/Quadrature/Trapezoidal.leancomplete
def CAS.Continuum.QuadratureCert.trapezoidal {f : ℝ → ℝ} {a b ζ : ℝ} {N : ℕ} (hf : ContDiffOn ℝ 2 f (Set.uIcc a b)) (hsecond : ∀ (x : ℝ), |iteratedDerivWithin 2 f (Set.uIcc a b) x| ≤ ζ) (hN : 0 < N) : CAS.Continuum.QuadratureCert f a b
def CAS.Continuum.QuadratureCert.trapezoidal {f : ℝ → ℝ} {a b ζ : ℝ} {N : ℕ} (hf : ContDiffOn ℝ 2 f (Set.uIcc a b)) (hsecond : ∀ (x : ℝ), |iteratedDerivWithin 2 f (Set.uIcc a b) x| ≤ ζ) (hN : 0 < N) : CAS.Continuum.QuadratureCert f a b
The composite trapezoidal rule as a quadrature certificate.
The rule uses
Nsubintervals and thereforeN + 1function evaluations. The error budget is|b-a|^3 * ζ / (12 * N^2),where
ζbounds the absolute value ofiteratedDerivWithin 2 f [[a,b]]at every real point, as required by the underlying mathlib theorem.
Under these same regularity and derivative-bound hypotheses, for a positive
tolerance the checked planner chooses
N=\max(1,\lceil\sqrt{B/\mathrm{tolerance}}\rceil) with
B=|b-a|^3\zeta/12. The bound forces \zeta\ge 0, and the resulting composite trapezoidal
certificate has error at most the requested tolerance. The square-root choice
retains the standard O(\mathrm{tolerance}^{-1/2}) mesh scaling.
Lean code for Theorem10.122●1 theoremAssociated Lean declarations
- theoremdefined in CAS/Continuum/Quadrature/Planning.leancomplete
theorem CAS.Continuum.QuadratureCert.trapezoidalToTolerance_sound_le {f : ℝ → ℝ} {a b ζ tolerance : ℝ} (hf : ContDiffOn ℝ 2 f (Set.uIcc a b)) (hsecond : ∀ (x : ℝ), |iteratedDerivWithin 2 f (Set.uIcc a b) x| ≤ ζ) (htolerance : 0 < tolerance) : ‖(∫ (x : ℝ) in a..b, f x) - (CAS.Continuum.QuadratureCert.trapezoidalToTolerance hf hsecond).value‖ ≤ tolerance
theorem CAS.Continuum.QuadratureCert.trapezoidalToTolerance_sound_le {f : ℝ → ℝ} {a b ζ tolerance : ℝ} (hf : ContDiffOn ℝ 2 f (Set.uIcc a b)) (hsecond : ∀ (x : ℝ), |iteratedDerivWithin 2 f (Set.uIcc a b) x| ≤ ζ) (htolerance : 0 < tolerance) : ‖(∫ (x : ℝ) in a..b, f x) - (CAS.Continuum.QuadratureCert.trapezoidalToTolerance hf hsecond).value‖ ≤ tolerance
For a
C²functionfon[[a, b]]with|f''| ≤ ζand a positive tolerance, the planned composite trapezoidal value is within the tolerance of∫ₐᵇ f.
The ceiling square-root choice ensures N^2\geq B/\tau and N>0.
Rearranging gives B/N^2\leq\tau; substituting the trapezoidal error
constant B=|b-a|^3\zeta/12 into the composite trapezoidal certificate
proves the result.
A QuadratureTree records a rule-independent binary subdivision. Each leaf
contains an ordinary local quadrature certificate and integrability evidence;
adjacent children compose by interval-integral additivity. The root therefore
certifies the sum of all leaf values with the sum of their error budgets. An
adaptive tactic or external checker may choose the tree; soundness does not
depend on that choice.
If \mathcal L(T) is the set of leaves, then the root certificate states
\left\|\int_a^b f(x)\,dx
-\sum_{\ell\in\mathcal L(T)}Q_\ell\right\|
\leq\sum_{\ell\in\mathcal L(T)}E_\ell.
Lean code for Theorem10.123●1 theoremAssociated Lean declarationsCAS.Continuum.QuadratureTree.sound[complete]
CAS.Continuum.QuadratureTree.sound[complete]
- theoremdefined in CAS/Continuum/Quadrature/Subdivision.leancomplete
theorem CAS.Continuum.QuadratureTree.sound.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : ℝ → E} {a b : ℝ} (tree : CAS.Continuum.QuadratureTree f a b) : ‖(∫ (x : ℝ) in a..b, f x) - tree.toCert.value‖ ≤ tree.toCert.error
theorem CAS.Continuum.QuadratureTree.sound.{u_1} {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : ℝ → E} {a b : ℝ} (tree : CAS.Continuum.QuadratureTree f a b) : ‖(∫ (x : ℝ) in a..b, f x) - tree.toCert.value‖ ≤ tree.toCert.error
The root certificate carries the tree's full integral error theorem.
Induct on the binary tree. A leaf is exactly its stored local certificate. At a branch, interval-integral additivity splits the root integral across the two adjacent children; apply the two inductive estimates and the triangle inequality. Their values and budgets add, giving the recursively stored root certificate.

