Documentation

LeanCert.Core.IntervalRat.TrigReduced

Computable Range Reduction for Trigonometric Functions #

This file implements range reduction for sin and cos to improve Taylor series convergence for intervals far from 0.

Problem #

Standard Taylor series for sin/cos centered at 0 have remainder bounds of |x|^{n+1} / (n+1)!. For intervals far from 0 (e.g., [10, 11]), this remainder is huge even for moderate n.

Solution: Range Reduction #

Use the periodicity of sin/cos:

By choosing k to bring x - 2πk into [-π, π], the Taylor series converges much faster since |x - 2πk| ≤ π ≈ 3.14.

Main definitions #

Rational approximations of π and 2π #

Lower bound for π: 314159265/100000000 < π

Equations
Instances For

    Upper bound for π: π < 355/113

    Equations
    Instances For

      piRatLo < π, proved from Mathlib's decimal π bounds.

      π < piRatHi, proved from Mathlib's decimal π bounds.

      Range reduction #

      Compute the shift amount k such that I.midpoint - k * 2π is approximately in [-π, π].

      Equations
      Instances For

        Shift an interval by subtracting k * 2π (using rational bounds).

        For positive k: subtract k * twoPiRatHi from lo, k * twoPiRatLo from hi For negative k: opposite to maintain containment

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

          Reduce interval to be approximately in [-π, π] by subtracting multiples of 2π.

          Equations
          Instances For

            Correctness of range reduction #

            If x ∈ I (as reals), then x - 2πk ∈ shiftInterval I k (as reals).

            Computable reduced evaluation #

            Computable sin evaluation with range reduction.

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

              Computable cos evaluation with range reduction.

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

                sin x ∈ sinComputableReduced I for all x ∈ I

                cos x ∈ cosComputableReduced I for all x ∈ I