Taylor Models - Exponential and Logarithmic Functions #
This file contains Taylor polynomial definitions and remainder bounds for exp and log functions, along with function-level Taylor models and their correctness proofs.
Main definitions #
expTaylorPoly,logTaylorPolyAtCenter- Taylor polynomialsexpRemainderBound,logRemainderBound- Remainder boundstmExp,tmLog- Function-level Taylor modelstmExp_correct,tmLog_correct- Correctness theorems
exp Taylor polynomial #
Taylor polynomial for exp of degree n: ∑_{i=0}^n x^i / i!
Equations
- LeanCert.Engine.TaylorModel.expTaylorPoly n = ∑ i ∈ Finset.range (n + 1), Polynomial.C (1 / ↑i.factorial) * Polynomial.X ^ i
Instances For
Remainder bound for exp Taylor series. The Lagrange remainder is exp(ξ) * x^{n+1} / (n+1)! where ξ is between 0 and x. We use e < 3, so e^r ≤ 3^(⌈r⌉+1) as a conservative bound.
Equations
Instances For
Remainder bound for exp is nonnegative
Taylor model for exp z on domain J, centered at 0, degree n. This represents the function z ↦ exp(z) directly.
Equations
- One or more equations did not get rendered due to their size.
Instances For
log Taylor polynomial #
log(x) at center c > 0: log(x) = log(c) + Σ_{k=1}^n [(-1)^(k+1) / (k * c^k)] * (x - c)^k + R_n(x)
The constant term log(c) is transcendental, so we:
- Approximate log(c) with a rational q using interval bounds
- Add the approximation error to the remainder
The Lagrange remainder is: R_n(x) = (-1)^n / [(n+1) * ξ^(n+1)] * (x-c)^(n+1) where ξ is between x and c. For positive domain, |R_n| ≤ r^(n+1) / [(n+1) * min_domain^(n+1)].
Taylor polynomial coefficients for log at center c > 0: log(x) = log(c) + (1/c)(x-c) - (1/2c²)(x-c)² + (1/3c³)(x-c)³ - ... For k ≥ 1: coeff_k = (-1)^(k+1) / (k * c^k) For k = 0: we handle the transcendental log(c) separately in tmLog.
Equations
Instances For
Taylor polynomial for log at center c > 0 (without the log(c) constant term). The constant term is added as a rational approximation in tmLog.
Equations
- LeanCert.Engine.TaylorModel.logTaylorPolyAtCenter c n = ∑ i ∈ Finset.range (n + 1), Polynomial.C (LeanCert.Engine.TaylorModel.logTaylorCoeffs c n i) * Polynomial.X ^ i
Instances For
Lagrange remainder bound for log at center c > 0. |R_n(x)| ≤ r^(n+1) / [(n+1) * min_ξ^(n+1)] where r = max(|lo - c|, |hi - c|) and min_ξ = min(lo, c) for positive domain. Since domain ⊂ (0, ∞) and c is the midpoint, we use domain.lo as min_ξ.
Equations
Instances For
Total remainder bound for log: Lagrange remainder + approximation error for log(c).
Equations
- LeanCert.Engine.TaylorModel.logRemainderBound domain c n logc_error = LeanCert.Engine.TaylorModel.logLagrangeRemainder domain c n + logc_error
Instances For
Remainder bound for log is nonnegative (when domain is positive).
Taylor model for log z on domain J, centered at c = midpoint. Returns None if the domain is not strictly positive.
This handles the transcendental log(c) by:
- Computing rational bounds [lo, hi] for log(c)
- Using midpoint = (lo + hi) / 2 as the polynomial constant
- Adding error = (hi - lo) / 2 to the remainder
Equations
- One or more equations did not get rendered due to their size.
Instances For
Helper lemmas #
Correctness theorems #
expTaylorPoly evaluates to the standard Taylor sum for exp at 0. This connects our rational polynomial to Mathlib's Taylor series.
exp z ∈ (tmExp J n).evalSet z for all z in J. Uses taylor_remainder_bound with f = Real.exp, M = exp(max of interval).
Helper lemma: log(c) is within logc_error of logc_approx when logc_interval is computed from logInterval applied to a singleton interval containing c.
The Taylor remainder for log at center c is bounded by the Lagrange form.
log z ∈ (tmLog J n).evalSet z for all z in J when J.lo > 0.