Documentation

LeanCert.Engine.Chebyshev.Theta

Certified Chebyshev theta(N) Bounds #

This module provides computable upper and lower bounds on the first Chebyshev function theta(N) = sum_{p prime, p in Ioc 0 N} log p.

Main definitions #

Design notes #

The structure mirrors ChebyshevPsi almost exactly. The difference is that summands are log p (only primes) instead of vonMangoldt n (prime powers). For the absolute-error checker we need both an upper and a lower bound on theta; the lower bound uses logPrimeLB (the .lo endpoint of the interval enclosure).

Computable upper and lower bounds on the theta summand #

Computable upper bound on the theta summand at n. Returns (logPointComputable n depth).hi when n is prime, 0 otherwise.

Equations
Instances For

    Computable lower bound on the theta summand at n. Returns (logPointComputable n depth).lo when n is prime, 0 otherwise.

    Equations
    Instances For

      Computable upper bound on theta(N): thetaUB N depth = sum n in Ioc 0 N, logPrimeUB n depth.

      Equations
      Instances For

        Computable lower bound on theta(N): thetaLB N depth = sum n in Ioc 0 N, logPrimeLB n depth.

        Equations
        Instances For

          Correctness theorems #

          The theta summand log p is bounded above by our computable bound for primes, and is zero (hence bounded) for non-primes.

          The theta summand is bounded below by our computable bound.

          theta(N) is bounded above by thetaUB(N).

          theta(N) is bounded below by thetaLB(N).

          Decidable comparison infrastructure #

          theorem LeanCert.Engine.ChebyshevTheta.theta_le_of_thetaUB_le (N depth : ) (slope : ) (h : decide (thetaUB N depth slope) = true) :
          Chebyshev.theta N slope

          If thetaUB(N, depth) <= slope computationally, then theta(N) <= slope.

          Generic slope checker: theta(N) <= slope * N #

          Computable check: does thetaUB(N) <= slope * N hold?

          Equations
          Instances For
            theorem LeanCert.Engine.ChebyshevTheta.theta_le_of_checkThetaLeMulWith (N depth : ) (slope : ) (h : checkThetaLeMulWith N slope depth = true) :
            Chebyshev.theta N slope * N

            If checkThetaLeMulWith N slope depth holds, then theta(N) <= slope * N.

            Absolute error checker: |theta(N) - N| <= bound #

            Computable check for |theta(N) - N| <= bound. Checks both thetaUB(N) - N <= bound and N - thetaLB(N) <= bound.

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

              If checkThetaAbsError N bound depth holds, then |theta(N) - N| <= bound.

              Efficient incremental checkers (O(N) for native_decide) #

              Helper: thetaUB for the prefix 1..n-1.

              Equations
              Instances For
                def LeanCert.Engine.ChebyshevTheta.checkAllThetaLeMulWith (bound : ) (slope : ) (depth : := 20) :

                Efficient O(N) incremental checker for thetaUB(N) <= slope * N for all N = 1..bound.

                Equations
                Instances For
                  @[irreducible]
                  def LeanCert.Engine.ChebyshevTheta.checkAllThetaLeMulWith.go (bound : ) (slope : ) (depth n : ) (acc : ) :
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Bridge: checkAllThetaLeMulWith.go → checkThetaLeMulWith #

                    theorem LeanCert.Engine.ChebyshevTheta.checkAllThetaLeMulWith_implies_checkThetaLeMulWith (bound : ) (slope : ) (depth : ) (h : checkAllThetaLeMulWith bound slope depth = true) (N : ) (hN : 0 < N) (hNb : N bound) :
                    checkThetaLeMulWith N slope depth = true

                    If checkAllThetaLeMulWith bound slope depth returns true, then checkThetaLeMulWith N slope depth is true for all N in {1, ..., bound}.

                    Efficient incremental absolute-error checker #

                    def LeanCert.Engine.ChebyshevTheta.checkAllThetaAbsError (limit : ) (bound : ) (depth : := 20) :

                    Efficient O(N) incremental checker for |theta(N) - N| <= bound for all N = 1..limit. Maintains both an upper-bound and a lower-bound accumulator.

                    Equations
                    Instances For
                      @[irreducible]
                      def LeanCert.Engine.ChebyshevTheta.checkAllThetaAbsError.go (limit : ) (bound : ) (depth n : ) (accUB accLB : ) :
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Bridge: checkAllThetaAbsError.go → checkThetaAbsError #

                        theorem LeanCert.Engine.ChebyshevTheta.checkAllThetaAbsError_implies_checkThetaAbsError (limit : ) (bound : ) (depth : ) (h : checkAllThetaAbsError limit bound depth = true) (N : ) (hN : 0 < N) (hNb : N limit) :
                        checkThetaAbsError N bound depth = true

                        If checkAllThetaAbsError limit bound depth returns true, then checkThetaAbsError N bound depth is true for all N in {1, ..., limit}.

                        Relative error checker: |theta(N) - N| / N <= bound, i.e. |theta(N) - N| <= bound * N #

                        This is what Eθ(x) ≤ bound means in the PNT+ blueprint (Definition 2.0.7).

                        Computable check for |theta(N) - N| <= bound * N. Checks thetaUB(N) <= (1 + bound) * N and thetaLB(N) >= (1 - bound) * N.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem LeanCert.Engine.ChebyshevTheta.abs_theta_sub_le_mul_of_checkThetaRelError (N depth : ) (bound : ) (h : checkThetaRelError N bound depth = true) :
                          |Chebyshev.theta N - N| bound * N

                          If checkThetaRelError N bound depth holds, then |theta(N) - N| <= bound * N.

                          def LeanCert.Engine.ChebyshevTheta.checkAllThetaRelError (start limit : ) (bound : ) (depth : := 20) :

                          Efficient O(N) incremental checker for |theta(N) - N| <= bound * N for all N = start..limit. The start parameter allows skipping small N (e.g. start=3 for the range 2 < x ≤ 599).

                          Equations
                          Instances For
                            @[irreducible]
                            def LeanCert.Engine.ChebyshevTheta.checkAllThetaRelError.go (start limit : ) (bound : ) (depth n : ) (accUB accLB : ) :
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Bridge: checkAllThetaRelError.go → checkThetaRelError #

                              theorem LeanCert.Engine.ChebyshevTheta.checkAllThetaRelError_implies_checkThetaRelError (start limit : ) (bound : ) (depth : ) (h : checkAllThetaRelError start limit bound depth = true) (N : ) (hN : 0 < N) (hN_start : start N) (hNb : N limit) :
                              checkThetaRelError N bound depth = true

                              If checkAllThetaRelError start limit bound depth returns true, then checkThetaRelError N bound depth holds for all N in {start, ..., limit}.

                              Strengthened checker for real-valued Eθ #

                              For real x ∈ [N, N+1), θ(x) = θ(N) but x can be as large as N+1-ε. The upper-bound direction still works from the integer check (worst at x = N), but the lower bound requires the strengthened condition θ(N) ≥ (1-a)·(N+1).

                              At the last integer N = limit we only need the regular check (x ≤ limit).

                              Strengthened check for one integer N, covering all real x ∈ [N, N+1):

                              • upper: thetaUB(N) ≤ (1 + bound) * N
                              • lower: thetaLB(N) ≥ (1 - bound) * (N + 1)
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem LeanCert.Engine.ChebyshevTheta.abs_theta_sub_le_mul_of_checkThetaRelErrorReal (N depth : ) (bound : ) (hbound : 0 bound) (hbound1 : bound 1) (h : checkThetaRelErrorReal N bound depth = true) (x : ) (hxlo : N x) (hxhi : x < N + 1) :
                                |Chebyshev.theta x - x| bound * x

                                If checkThetaRelErrorReal N bound depth holds, then for all real x ∈ [N, N+1), |θ(x) - x| ≤ bound * x.

                                def LeanCert.Engine.ChebyshevTheta.checkAllThetaRelErrorReal (start limit : ) (bound : ) (depth : := 20) :

                                Efficient O(N) incremental checker for the strengthened real-valued condition. For N = start .. limit-1: checks checkThetaRelErrorReal N bound depth (covers x ∈ [N, N+1)) For N = limit: checks checkThetaRelError N bound depth (covers only x = limit)

                                Equations
                                Instances For
                                  @[irreducible]
                                  def LeanCert.Engine.ChebyshevTheta.checkAllThetaRelErrorReal.go (start limit : ) (bound : ) (depth n : ) (accUB accLB : ) :
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Bridge: checkAllThetaRelErrorReal → pointwise #

                                    theorem LeanCert.Engine.ChebyshevTheta.checkAllThetaRelErrorReal_implies (start limit : ) (bound : ) (depth : ) (h : checkAllThetaRelErrorReal start limit bound depth = true) (N : ) (hN : 0 < N) (hN_start : start N) (hNb : N limit) :
                                    (if N < limit then checkThetaRelErrorReal N bound depth else checkThetaRelError N bound depth) = true

                                    If checkAllThetaRelErrorReal start limit bound depth returns true, then: