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 #
logPrimeUB n depth/logPrimeLB n depth— upper/lower bounds on then-th summand of theta.thetaUB N depth/thetaLB N depth— upper/lower bounds on theta(N).checkThetaLeMulWith/checkAllThetaLeMulWith— decidethetaUB(N) ≤ slope * N.checkThetaAbsError/checkAllThetaAbsError— decide|theta(N) - N| ≤ bound(both directions).
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
- LeanCert.Engine.ChebyshevTheta.logPrimeUB n depth = if Nat.Prime n then (LeanCert.Core.IntervalRat.logPointComputable (↑n) depth).hi else 0
Instances For
Computable lower bound on the theta summand at n.
Returns (logPointComputable n depth).lo when n is prime, 0 otherwise.
Equations
- LeanCert.Engine.ChebyshevTheta.logPrimeLB n depth = if Nat.Prime n then (LeanCert.Core.IntervalRat.logPointComputable (↑n) depth).lo else 0
Instances For
Computable upper bound on theta(N):
thetaUB N depth = sum n in Ioc 0 N, logPrimeUB n depth.
Equations
- LeanCert.Engine.ChebyshevTheta.thetaUB N depth = ∑ n ∈ Finset.Ioc 0 N, LeanCert.Engine.ChebyshevTheta.logPrimeUB n depth
Instances For
Computable lower bound on theta(N):
thetaLB N depth = sum n in Ioc 0 N, logPrimeLB n depth.
Equations
- LeanCert.Engine.ChebyshevTheta.thetaLB N depth = ∑ n ∈ Finset.Ioc 0 N, LeanCert.Engine.ChebyshevTheta.logPrimeLB n depth
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 #
Generic slope checker: theta(N) <= slope * N #
Computable check: does thetaUB(N) <= slope * N hold?
Equations
- LeanCert.Engine.ChebyshevTheta.checkThetaLeMulWith N slope depth = decide (LeanCert.Engine.ChebyshevTheta.thetaUB N depth ≤ slope * ↑N)
Instances For
If checkThetaLeMulWith N slope depth holds, then theta(N) <= slope * N.
Absolute error checker: |theta(N) - N| <= bound #
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
- LeanCert.Engine.ChebyshevTheta.thetaUBPrefix n depth = ∑ i ∈ Finset.Ioc 0 (n - 1), LeanCert.Engine.ChebyshevTheta.logPrimeUB i depth
Instances For
Efficient O(N) incremental checker for thetaUB(N) <= slope * N
for all N = 1..bound.
Equations
- LeanCert.Engine.ChebyshevTheta.checkAllThetaLeMulWith bound slope depth = LeanCert.Engine.ChebyshevTheta.checkAllThetaLeMulWith.go bound slope depth 1 0
Instances For
Bridge: checkAllThetaLeMulWith.go → checkThetaLeMulWith #
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 #
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
- LeanCert.Engine.ChebyshevTheta.checkAllThetaAbsError limit bound depth = LeanCert.Engine.ChebyshevTheta.checkAllThetaAbsError.go limit bound depth 1 0 0
Instances For
Bridge: checkAllThetaAbsError.go → checkThetaAbsError #
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
If checkThetaRelError N bound depth holds, then |theta(N) - N| <= bound * N.
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
- LeanCert.Engine.ChebyshevTheta.checkAllThetaRelError start limit bound depth = LeanCert.Engine.ChebyshevTheta.checkAllThetaRelError.go start limit bound depth 1 0 0
Instances For
Bridge: checkAllThetaRelError.go → checkThetaRelError #
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
If checkThetaRelErrorReal N bound depth holds, then for all real x ∈ [N, N+1),
|θ(x) - x| ≤ bound * x.
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
- LeanCert.Engine.ChebyshevTheta.checkAllThetaRelErrorReal start limit bound depth = LeanCert.Engine.ChebyshevTheta.checkAllThetaRelErrorReal.go start limit bound depth 1 0 0
Instances For
Bridge: checkAllThetaRelErrorReal → pointwise #
If checkAllThetaRelErrorReal start limit bound depth returns true, then:
- for
N ∈ {start, ..., limit-1}:checkThetaRelErrorReal N bound depthholds - for
N = limit:checkThetaRelError N bound depthholds