Taylor Models - Core Definitions #
This file contains the core Taylor model abstraction, polynomial helpers, and basic operations with their correctness proofs.
Main definitions #
TaylorModel- A polynomial plus remainder intervalevalSet,evalPoly,polyBoundInterval,bound- Evaluation and boundingconst,identity,add,neg,mul,inv- Basic operationsevalPoly_mem_polyBoundInterval,taylorModel_correct- Core correctness
Design notes #
A Taylor model for f on interval I centered at c is: TM(f) = (P, R) where ∀x ∈ I, f(x) ∈ P(x-c) + R
Operations on Taylor models (add, mul, compose) preserve this property.
Polynomial helpers for Taylor models #
Truncate a polynomial to terms of degree ≤ n by summing coefficients
Equations
- LeanCert.Engine.truncPoly p n = ∑ i ∈ Finset.range (n + 1), Polynomial.C (p.coeff i) * Polynomial.X ^ i
Instances For
The tail of a polynomial (terms with degree > n)
Equations
- LeanCert.Engine.tailPoly p n = p - LeanCert.Engine.truncPoly p n
Instances For
Bound a polynomial over an interval centered at c. Evaluates at shifted argument: P(x - c) for x ∈ domain.
We bound each term: |aᵢ (x-c)ⁱ| ≤ |aᵢ| * r^i where r = radius of domain from c. Then the total bound is ∑ᵢ |aᵢ| * rⁱ
Equations
Instances For
The bound computed by boundPolyAbs is nonnegative
Bernstein Polynomial Bounds #
Bernstein polynomials provide tighter bounds than naive interval arithmetic. For a polynomial P(x) on [a,b], the range is contained in [min bⱼ, max bⱼ] where bⱼ are the Bernstein coefficients.
This avoids the "dependency problem" where naive interval arithmetic gives P(x) = x - x² on [0,1] → [-1, 1] instead of the true [0, 0.25].
Binomial coefficient as rational (for Bernstein conversion)
Equations
- LeanCert.Engine.binomialRat n k = ↑(n.choose k)
Instances For
Transform polynomial P(u) on [α, β] to Q(t) on [0,1] via u = α + t*(β-α). Returns the coefficients of Q as a list.
If P(u) = Σᵢ aᵢuⁱ, then Q(t) = P(α + t*w) where w = β - α. Using binomial expansion: (α + tw)ⁱ = Σⱼ C(i,j) αⁱ⁻ʲ wʲ tʲ So qⱼ = Σᵢ≥ⱼ aᵢ * C(i,j) * αⁱ⁻ʲ * wʲ
Equations
- One or more equations did not get rendered due to their size.
Instances For
Compute Bernstein coefficients for polynomial P evaluated at (x - c) for x ∈ [lo, hi]. The polynomial argument u = x - c ranges over [lo - c, hi - c].
Equations
- LeanCert.Engine.bernsteinCoeffsForDomain p lo hi c = LeanCert.Engine.monomialToBernstein (LeanCert.Engine.transformPolyCoeffs p (lo - c) (hi - c))
Instances For
Find min and max of a non-empty list, returning an interval
Equations
Instances For
The listMinMax function returns lo ≤ hi
Bound polynomial using Bernstein coefficients - gives [min bⱼ, max bⱼ]. This is typically MUCH tighter than the symmetric [-B, B] from boundPolyAbs.
For P(x) = x - x² on [0,1]: boundPolyAbs gives [-2, 2], Bernstein gives [0, 0.5]
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bernstein proof infrastructure #
For the zero polynomial, Bernstein bounds contain zero.
listMinMax bounds #
Elements of a list lie between the listMinMax bounds
The default value lies between the listMinMax bounds
Convex combination bounds #
Combinatorial identity #
Partition of unity for Bernstein basis #
Bernstein representation identity #
The key identity: for a polynomial Q(t) = Σⱼ qⱼ tʲ of degree n, with Bernstein coefficients bₖ = Σⱼ≤k C(k,j)/C(n,j) · qⱼ, we have: Q(t) = Σₖ bₖ · C(n,k) · tᵏ · (1-t)^(n-k)
The proof uses: tʲ = Σₖ≥ⱼ C(n-j,k-j) · tᵏ · (1-t)^(n-k) which follows from tʲ · (t + (1-t))^(n-j) = tʲ (binomial theorem).
The monomial tʲ expanded in Bernstein basis. tʲ · 1 = tʲ · (t + (1-t))^(n-j) = Σₘ C(n-j,m) · t^(m+j) · (1-t)^(n-j-m) = Σₖ≥ⱼ C(n-j,k-j) · tᵏ · (1-t)^(n-k)
The proof follows from the binomial theorem: tʲ · (t + (1-t))^(n-j) = tʲ. Expanding the binomial and reindexing m ↦ k=m+j gives the result.
Main Bernstein enclosure theorem #
Bound the tail of polynomial p (terms with degree > d) when evaluated at (x-c) for x ∈ domain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Taylor Model structure #
A Taylor model: polynomial approximation with remainder interval.
- poly : Polynomial ℚ
The polynomial part (coefficients are rationals)
- remainder : Core.IntervalRat
The remainder interval
- center : ℚ
The center of expansion
- domain : Core.IntervalRat
The domain interval
Instances For
Evaluate polynomial part at a point
Instances For
Interval bound for the polynomial part over the domain (naive symmetric bound).
Equations
- tm.polyBoundInterval = { lo := -LeanCert.Engine.boundPolyAbs tm.poly tm.domain tm.center, hi := LeanCert.Engine.boundPolyAbs tm.poly tm.domain tm.center, le := ⋯ }
Instances For
Interval bound for the polynomial part using BERNSTEIN bounds (tighter!). For P(x) = x - x² on [0,1]: naive gives [-2, 2], Bernstein gives [0, 0.5]
Equations
Instances For
Get bounds on the Taylor model over its domain: polynomial bound + remainder. NOW USES BERNSTEIN BOUNDS for tighter intervals!
Equations
- tm.bound = tm.polyBoundIntervalBernstein.add tm.remainder
Instances For
Get bounds using Bernstein polynomial bounds (tighter than naive bound)
Equations
Instances For
Interval bound for f(center).
Equations
- tm.valueAtCenterInterval = (LeanCert.Core.IntervalRat.singleton (tm.poly.coeff 0)).add tm.remainder
Instances For
Correctness: the true function value at center is in valueAtCenterInterval.
Taylor model operations #
Constant Taylor model
Equations
- LeanCert.Engine.TaylorModel.const q domain = { poly := Polynomial.C q, remainder := LeanCert.Core.IntervalRat.singleton 0, center := domain.midpoint, domain := domain }
Instances For
Identity Taylor model: represents the function x ↦ x
Equations
- One or more equations did not get rendered due to their size.
Instances For
Negate a Taylor model
Equations
Instances For
Subtract Taylor models
Instances For
Invert a Taylor model, assuming its bound does not contain 0.
Equations
Instances For
Multiply Taylor models with truncation and proper remainder handling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Core Correctness Theorems #
Key lemma: polynomial evaluation is bounded by polyBoundInterval.
Local evalSet correctness lemmas #
Constant TM correctness for evalSet: q ∈ const(q).evalSet x.
Identity TM correctness for evalSet: x ∈ identity.evalSet x.
Polynomial helper lemmas for multiplication #
truncPoly + tailPoly = original polynomial
aeval distributes over truncPoly + tailPoly
Tail polynomial evaluation is bounded by boundPolyAbs of tail.
Polynomial bound lemma: |P(y)| ≤ boundPolyAbs P domain c for y = x - c, x ∈ domain
Generic Taylor model algebra lemmas #
These lemmas are pure TM algebra that don't depend on Expr or transcendentals.
If x ∈ bound and bound doesn't contain zero, then x ≠ 0.
FOIL expansion for Taylor model multiplication. (P₁ + r₁)(P₂ + r₂) = trunc(P₁P₂) + [tail(P₁P₂) + P₁r₂ + P₂r₁ + r₁r₂]
Four-term remainder membership: tail + p1r2 + p2r1 + r1r2 ∈ totalRemainder. This extracts the nested interval addition pattern from mul_evalSet_correct.
Multiplication preserves evalSet membership.
Given:
- f₁(x) ∈ tm1.evalSet x (i.e., f₁(x) = P₁(y) + r₁ with r₁ ∈ tm1.remainder)
- f₂(x) ∈ tm2.evalSet x (i.e., f₂(x) = P₂(y) + r₂ with r₂ ∈ tm2.remainder)
Then f₁(x) * f₂(x) ∈ (TaylorModel.mul tm1 tm2 degree).evalSet x.
The expansion is: (P₁ + r₁)(P₂ + r₂) = P₁P₂ + P₁r₂ + P₂r₁ + r₁r₂ = trunc(P₁P₂) + [tail(P₁P₂) + P₁r₂ + P₂r₁ + r₁r₂]
Inversion preserves evalSet membership (conservative construction).
Since TaylorModel.inv uses poly = 0 and remainder = invBound, we show
that if f(x) ∈ tm.evalSet x for all x in domain, then f(x)⁻¹ ∈ (inv tm hnz).evalSet x.