Documentation

LeanCert.Core.IntervalRat.Transcendental

Rational Endpoint Intervals - Transcendental Functions #

This file provides noncomputable interval bounds for transcendental functions using floor/ceiling to obtain rational endpoints.

Main definitions #

Main theorems #

Design notes #

All definitions in this file are noncomputable as they use Real.exp, Real.log, etc. For computable versions, see IntervalRat.Taylor.

Rational enclosure of real intervals #

noncomputable def LeanCert.Core.IntervalRat.ofRealEndpoints (lo hi : ) (hle : lo hi) :

Coarse rational enclosure of a real interval using floor/ceil. Given a real interval [lo, hi], returns a rational interval [⌊lo⌋, ⌈hi⌉] that is guaranteed to contain all points in the original interval.

Equations
Instances For
    theorem LeanCert.Core.IntervalRat.mem_ofRealEndpoints {x lo hi : } (hle : lo hi) (hx : lo x x hi) :
    x ofRealEndpoints lo hi hle

    Any point in [lo, hi] is in the rational enclosure [⌊lo⌋, ⌈hi⌉]

    Exponential interval #

    Interval bound for exp on rational intervals. Since exp is strictly increasing, exp([a,b]) ⊆ [⌊exp(a)⌋, ⌈exp(b)⌉]. This uses Real.exp and floor/ceil to get rational bounds.

    Equations
    Instances For

      FTIA for exp: if x ∈ I, then exp(x) ∈ expInterval(I)

      Positive interval check #

      Check if an interval is strictly positive (lo > 0)

      Equations
      Instances For

        An interval that is guaranteed to be strictly positive

        Instances For

          Logarithm interval (for positive intervals) #

          Interval bound for log on positive rational intervals. Since log is strictly increasing on (0, ∞), log([a,b]) ⊆ [⌊log(a)⌋, ⌈log(b)⌉] for a > 0. This uses Real.log and floor/ceil to get rational bounds.

          Equations
          Instances For

            FTIA for log: if x ∈ I with lo > 0, then log(x) ∈ logInterval(I)

            Atanh interval (for intervals in (-1, 1)) #

            An interval strictly contained in (-1, 1), suitable for atanh

            Instances For

              Convert to standard interval

              Equations
              Instances For

                Interval bound for atanh on intervals strictly inside (-1, 1). Since atanh is strictly increasing on (-1, 1), atanh([a,b]) ⊆ [⌊atanh(a)⌋, ⌈atanh(b)⌉].

                Equations
                Instances For

                  FTIA for atanh: if x ∈ I and I ⊂ (-1, 1), then atanh(x) ∈ atanhIntervalComputed(I)

                  Square Root Interval #

                  Integer square root (floor of sqrt). Satisfies: (intSqrtNat n)^2 ≤ n < (intSqrtNat n + 1)^2

                  Equations
                  Instances For

                    Rational lower bound for sqrt. For q ≥ 0 with q = num/den, we compute floor(sqrt(num * den)) / den. This gives: sqrtRatLower q ≤ sqrt(q).

                    The idea: sqrt(num/den) = sqrt(num*den)/den when properly scaled.

                    Equations
                    Instances For

                      Rational upper bound for sqrt. For q ≥ 0, we compute ceil(sqrt(num * den)) / den. This gives: sqrt(q) ≤ sqrtRatUpper q.

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

                        Rational lower bound for sqrt with high precision. For q ≥ 0, we scale by 4^k, compute integer sqrt, and scale back by 2^k. This gives: sqrtRatLowerPrec q ≤ sqrt(q) with precision ~2^(-k).

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

                          Rational upper bound for sqrt with high precision. For q ≥ 0, we scale by 4^k, compute ceil of integer sqrt, and scale back by 2^k. This gives: sqrt(q) ≤ sqrtRatUpperPrec q with precision ~2^(-k).

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

                            Soundness of sqrtRatLower: sqrtRatLower q ≤ Real.sqrt q for q ≥ 0

                            Soundness of sqrtRatUpper: Real.sqrt q ≤ sqrtRatUpper q for q ≥ 0

                            Square root interval with conservative bounds. For a non-negative interval [lo, hi], sqrt is monotone so: sqrt([lo, hi]) ⊆ [0, max(hi, 1)]

                            The lower bound is 0 (always sound for sqrt). The upper bound uses max(hi, 1) which satisfies sqrt(x) ≤ max(x, 1) for x ≥ 0.

                            Equations
                            Instances For

                              Improved square root interval with tight lower bounds. For a non-negative interval [lo, hi] with lo ≥ 0:

                              • Lower bound: sqrtRatLower(lo)
                              • Upper bound: sqrtRatUpper(hi)

                              For intervals crossing zero, we use 0 as lower bound.

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

                                Soundness of sqrtRatLowerPrec: sqrtRatLowerPrec q k ≤ Real.sqrt q for q ≥ 0

                                Soundness of sqrtRatUpperPrec: Real.sqrt q ≤ sqrtRatUpperPrec q k for q ≥ 0

                                High-precision square root interval. For a non-negative interval [lo, hi] with lo ≥ 0:

                                • Lower bound: sqrtRatLowerPrec(lo)
                                • Upper bound: sqrtRatUpperPrec(hi)

                                Uses scaling to achieve ~6 decimal digits of precision.

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

                                  Membership theorem for sqrtIntervalTightPrec

                                  theorem LeanCert.Core.IntervalRat.mem_sqrtInterval {x : } {I : IntervalRat} (hx : x I) (hx_nn : 0 x) :

                                  Soundness of sqrt interval: if x ∈ I and x ≥ 0, then sqrt(x) ∈ sqrtInterval I

                                  General soundness of sqrt interval: works for any x ∈ I (including negative). When x < 0, Real.sqrt x = 0, which is always in [0, max(hi, 1)].

                                  Soundness of tight sqrt interval: if x ∈ I and x ≥ 0, then sqrt(x) ∈ sqrtIntervalTight I

                                  General soundness of tight sqrt interval: works for any x ∈ I (including negative). When x < 0, Real.sqrt x = 0, which is always in the result interval.