Documentation

LeanCert.Engine.TaylorModel.Trig

Taylor Models - Trigonometric Functions #

This file contains Taylor polynomial definitions and remainder bounds for trigonometric functions (sin, cos, sinc), along with function-level Taylor models and their correctness proofs.

Main definitions #

sin Taylor polynomial #

Taylor polynomial coefficients for sin at center c = 0: sin(x) = x - x³/3! + x⁵/5! - ...

Equations
Instances For

    Remainder bound for sin: |sin(x) - T_n(x)| ≤ |x|^{n+1} / (n+1)! since |sin^{(k)}| ≤ 1

    Equations
    Instances For

      Remainder bound for sin is nonnegative

      cos Taylor polynomial #

      Taylor polynomial coefficients for cos at center c = 0: cos(x) = 1 - x²/2! + x⁴/4! - ...

      Equations
      Instances For

        Remainder bound for cos: |cos(x) - T_n(x)| ≤ |x|^{n+1} / (n+1)! since |cos^{(k)}| ≤ 1

        Equations
        Instances For

          Remainder bound for cos is nonnegative

          sinc Taylor polynomial #

          sinc(x) = sin(x)/x for x ≠ 0, sinc(0) = 1 = 1 - x²/6 + x⁴/120 - x⁶/5040 + ... = Σ_{n=0}^∞ (-1)^n x^{2n} / (2n+1)!

          Note: sinc is entire (analytic everywhere), so the series converges for all x.

          Taylor polynomial coefficients for sinc at center 0: sinc(x) = 1 - x²/6 + x⁴/120 - ... = Σ (-1)^k x^{2k} / (2k+1)!

          Equations
          Instances For

            Remainder bound for sinc: uses the fact that |sinc^(n+1)(ξ)| ≤ 1 for all ξ. This follows from |sinc(x)| ≤ 1 and derivatives being bounded. We use a crude but safe exponential bound.

            Equations
            Instances For

              Remainder bound for sinc is nonnegative

              Function-level Taylor models #

              Taylor model for sin z on domain J, centered at 0, degree n. This represents the function z ↦ sin(z) directly.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Taylor model for cos z on domain J, centered at 0, degree n. This represents the function z ↦ cos(z) directly.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Taylor model for sinc z on domain J, centered at 0, degree n. sinc(z) = sin(z)/z for z ≠ 0, sinc(0) = 1.

                  Equations
                  Instances For

                    Helper lemmas for iterated derivatives #

                    iteratedDeriv n sin at 0

                    iteratedDeriv n cos at 0

                    For even n, iteratedDeriv n sin 0 = 0

                    theorem LeanCert.Engine.TaylorModel.iteratedDeriv_sin_zero_odd {n : } (hn : n % 2 = 1) :
                    iteratedDeriv n Real.sin 0 = (-1) ^ ((n - 1) / 2)

                    For odd n, iteratedDeriv n sin 0 = (-1)^((n-1)/2)

                    The sinTaylorCoeffs match the Mathlib Taylor coefficients for sin at 0

                    For even n, iteratedDeriv n cos 0 = (-1)^(n/2)

                    For odd n, iteratedDeriv n cos 0 = 0

                    The cosTaylorCoeffs match the Mathlib Taylor coefficients for cos at 0

                    Polynomial evaluation lemmas #

                    sinTaylorPoly evaluates to the standard Taylor sum for sin at 0. This connects our rational polynomial to Mathlib's Taylor series.

                    cosTaylorPoly evaluates to the standard Taylor sum for cos at 0.

                    Correctness theorems #

                    sin z ∈ (tmSin J n).evalSet z for all z in J. Uses taylor_remainder_bound with f = Real.sin, c = 0, M = 1.

                    cos z ∈ (tmCos J n).evalSet z for all z in J. Uses taylor_remainder_bound with f = Real.cos, c = 0, M = 1.

                    sinc correctness infrastructure #

                    sinc is C^∞ (smooth).

                    Mathematical justification: sinc is analytic everywhere with the series sinc(x) = Σ_{k=0}^∞ (-1)^k x^{2k} / (2k+1)! which converges for all x ∈ ℝ. Being analytic, it is smooth (C^∞).

                    This fact follows from sinc being the dslope of sin at 0, and sin being entire (analytic everywhere). The smoothness can be proven using the series representation or by showing the iterated derivatives exist and are continuous at all points including 0.

                    Technical note: The proof at x = 0 is subtle because we need to show that the limit defining each higher derivative exists. This follows from the Taylor series representation.

                    theorem LeanCert.Engine.TaylorModel.iteratedDeriv_sinc_zero (n : ) :
                    iteratedDeriv n Real.sinc 0 = if n % 2 = 0 then have k := n / 2; (-1) ^ k / ↑(2 * k + 1) else 0

                    The n-th derivative of sinc at 0 follows the pattern:

                    • For odd n: 0 (sinc is even, so odd derivatives at 0 vanish)
                    • For even n = 2k: (-1)^k * (2k)! / (2k+1)! = (-1)^k / (2k+1)

                    This matches the coefficients in sincTaylorCoeffs times n!.

                    The proof uses the recurrence: (n+1) * sinc^{(n)}(0) = sin^{(n+1)}(0), which follows from differentiating x * sinc(x) = sin(x).

                    The sincTaylorCoeffs match the Taylor coefficients for sinc at 0

                    sincTaylorPoly evaluates to the standard Taylor sum for sinc at 0.

                    sinc z ∈ (tmSinc J n).evalSet z for all z in J. Uses the global bound |sinc z| ≤ 1.