The corrected sieve and the Pan counting bridge #
Corrected candidate carriers, Selberg main terms, forbidden-prime products, and Möbius/CRT identities connect finite arithmetic-progression counts to the weighted Pan remainder. Support and truncation hypotheses remain explicit.
All declarations retain the MathlibNt.SieveTheory.SwitchingPrinciple namespace.
Corrected upper switching cutoff. Using a ceiling makes the intended cube-scale coverage an explicit parameter condition rather than a rounding accident.
Equations
- MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenY N = ⌈↑N ^ (1 / 3)⌉₊
Instances For
The base candidates for a replacement switching argument. Unlike the historical W-candidates, the unit fibre is excluded at the definition level. The future analytic lower bound must be proved anew for this object.
Equations
- MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenCandidates N = {p ∈ Finset.range N | Nat.Prime p ∧ 2 ≤ N - p ∧ ∀ (r : ℕ), Nat.Prime r → r < MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenZ N → ¬r ∣ N - p}
Instances For
Complements used before the corrected sieve removes small primes not
already forced away by parity or by a prime factor of N.
Equations
Instances For
Product of the small primes which remain to be sieved from the corrected complement support.
Equations
Instances For
The corrected sifting product is squarefree because its factors are distinct primes.
Goldbach local density for the corrected sieve: the reusable AnalyticNumberTheory density
ν(d) = ∏_{p | d} 1/(p-1) (AnalyticNumberTheory.Sieve.goldbachNu).
Equations
Instances For
The prime factors of a product of distinct primes are exactly the set of those primes.
The corrected sifting product is nonzero: it is a product of primes.
The prime divisors of the corrected sifting product are exactly its
factor primes: 2 < r < z with r ∤ N.
A prime divides the corrected sifting product exactly when it is one of
the sieved primes: 2 < p < z and p ∤ N.
The corrected Chen sieve as a mathlib BoundingSieve record: the
unsifted complements as support, the surviving small-prime product as
prodPrimes, unit weights, and the Goldbach local density
ν(p) = 1/(p-1).
The total mass is the analytic main term N / log N. With the density
identification ν(d) = 1/φ(d) for squarefree d, the remainder
rem d = multSum d − ν(d)·N/log N is exactly the congruence-count error that
the averaged Pan-type distribution condition (CorrectedChenDistributionCondition)
controls; the difference between N/log N and the true support cardinality is
absorbed by the main-term constants of the analytic workline, not by the
errSum.
Equations
- MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenBoundingSieve N = { support := MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenUnsiftedComplements N, prodPrimes := MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenSiftingProduct N, prodPrimes_squarefree := ⋯, weights := fun (x : ℕ) => 1, weights_nonneg := MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenBoundingSieve._proof_1, totalMass := ↑N / Real.log ↑N, nu := MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenNu, nu_mult := AnalyticNumberTheory.Sieve.goldbachNu_isMultiplicative, nu_pos_of_prime := ⋯, nu_lt_one_of_prime := ⋯ }
Instances For
The corrected sieve total mass is the analytic main term N / log N.
Optimal Selberg upper bound and the main-term identities #
Apply AnalyticNumberTheory.Sieve.selberg_upper_bound_optimal:
the sifted sum of the corrected sieve is bounded by totalMass·(Σ selbergTerms)⁻¹ + errSum(Λ²w*).
This is an unconditional instance of the classical Selberg upper-bound sieve
S ≤ X/G(z) + R for correctedChenBoundingSieve.
Apply selbergMainTerm_eq_prod_one_sub_nu: the Selberg main term equals the sieve product
∏_{p | P(N)} (1 − ν(p)).
The main-term sieve product equals MertensTheorem.goldbachSieveProduct N z.
For even N, the factor at p = 2 is excluded on both sides by p ∤ N.
Main-term identity: totalMass·(Σ selbergTerms)⁻¹ = (N/log N)·primeProduct(z−1)·𝔖_trunc(N, z−1), the exact application
of sieveProduct_identity to the Selberg main term.
An element is coprime to the corrected sifting product exactly when no
sieved prime (that is, no prime 2 < r < z with r ∤ N) divides it.
The small-prime sieve leaves exactly the corrected candidates: an unsifted complement survives the sieve precisely when its prime partner lies in the corrected candidate set.
The number of unsifted complements that survive the corrected sieve is exactly the number of corrected candidates.
The BoundingSieve sifted sum for the corrected Chen sieve is exactly the
corrected candidate count.
The prime support of the unsifted complements: primes p < N whose
complement is at least two and carries no r ≤ 2 or r | N prime divisor
below z. It is the preimage of the sieve support under p ↦ N - p.
Equations
Instances For
Forbidden-prime product for the Pan bridge: F(N) = ∏_{r < z, r prime, r ≤ 2 ∨ r | N} r.
The support condition ∀ r < z: (r ≤ 2 ∨ r | N) → ¬ r | N−p is exactly
(N−p, F(N)) = 1.
Equations
Instances For
The forbidden-prime product is squarefree, being a product of distinct primes.
The forbidden-prime product is nonzero.
Its set of prime factors is exactly the filtered set of primes.
Characterization of r | F(N): r is prime, r < z, and (r ≤ 2 ∨ r | N).
Coprimality characterization of support for the Pan bridge: p ∈ support ⟺ p.Prime ∧ 2 ≤ N−p ∧ ∀ prime r | F(N): ¬ r | N−p.
Möbius coprimality indicator for the Pan bridge: Σ_{e | F(N), e | m} μ(e) = 1_{∀ prime r | F(N): ¬ r | m}.
Möbius decomposition of the support AP count for the Pan bridge: the inner count
in Chen's distribution condition expands as a Möbius-weighted sum of prime-AP base counts over
forbidden-prime divisors. Each base count is then linked to primesInAPBelow/panDistributionError.
The Pan bridge: lcm merging and compatibility of congruences #
Merging congruences (the compatible CRT case): for p < N,
p ≡ N [MOD d] and e ∣ N-p hold exactly when p ≡ N [MOD lcm d e]. This justifies
replacing the inner condition of unsiftedPrimeSupport_AP_count_eq_moebiusSum,
p ≡ N [MOD d] ∧ e | N-p, by the single modulus lcm(d,e):
e | N-p is equivalent to p ≡ N [MOD e] by prime_dvd_complement_iff_modEq.
The congruences have the same residue N, so they are automatically compatible; coprimality of d,e is unnecessary.
Counting form of lcm merging: the inner count in the Möbius decomposition,
#{p < N : p ≡ N [MOD d] ∧ e | N-p}, becomes #{p < N : p ≡ N [MOD lcm(d,e)]}.
lcm form of the Möbius decomposition: as in unsiftedPrimeSupport_AP_count_eq_moebiusSum,
but with each inner base count merged using lcm(d,e). The count
#{p < N : p ≡ N [MOD lcm(d,e)]} is exactly the input to the a=1 Pan distribution error
via primesInAPBelow_one/panDistributionError_one.
The unsifted complement support is definitionally the image of the prime
support under p ↦ N - p.
The corrected sieve multSum is the number of support elements divisible
by d.
Counting the multiples of d in the sieve support is the same as
counting the prime-support partners with d ∣ N - p.
The corrected sieve distribution count is the number of prime-support
partners congruent to N modulo d. This is the finite seam at which a
Bombieri--Vinogradov/Pan input bounds multSum and hence errSum.
The corrected sieve remainder at d is the prime-support congruence
count minus the density main term.
The corrected sieve errSum is the sum over sieve divisors of the
absolute congruence-count error. This is the exact finite form that a
uniform distribution estimate must bound.
The uniform Bombieri--Vinogradov-style distribution condition required by
the corrected sieve: for every A > 0 there is a uniform C such that the
3^{ω(d)}-weighted sum over sieve divisors of the congruence-count errors is
at most C · N/log^A N, uniformly for all sufficiently large even N.
This is the averaged Pan form, not a per-modulus bound: the individual
errors do not sum to a log^{-A} bound because the divisor count of the
sifting product is exponential in z. The local bombieri_vinogradov
interface in BombieriVinogradov.lean is only its fixed-parameter remainder
form; this averaged target is what actually bounds the corrected sieve's
errSum (see correctedChenErrSum_le_panWeighted).
Equations
- MathlibNt.SieveTheory.SwitchingPrinciple.CorrectedChenDistributionCondition = ∀ (A : ℝ), 0 < A → ∃ (C : ℝ), 0 < C ∧ ∀ (N : ℕ), 1000 ≤ N → Even N → ∑ d ∈ (MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenSiftingProduct N).divisors, 3 ^ d.primeFactors.card * |↑{p ∈ MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenUnsiftedPrimeSupport N | p ≡ N [MOD d]}.card - MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenNu d * (↑N / Real.log ↑N)| ≤ C * ↑N / Real.log ↑N ^ A
Instances For
The counting-sieve errSum is bounded by the 3^{ω(d)}-weighted
congruence-error sum controlled by CorrectedChenDistributionCondition.
Given the averaged Pan-type distribution condition, the counting-sieve
errSum of the corrected sieve is uniformly O(N / log^A N). This closes
the errSum line conditionally on the single analytic input
CorrectedChenDistributionCondition.
Applying the weighted Pan--Bombieri--Vinogradov input #
The reusable AnalyticNumberTheory weighted Pan-BV input
(AnalyticNumberTheory.Sieve.WeightedPanCondition) instantiated at the
corrected Chen sieve: x N = N, S N = correctedChenBoundingSieve N,
w d = 3^{ω(d)}. This is exactly the input formalized in
analytic-number-theory-lean, issue #7.
Equations
Instances For
The corrected sieve's weighted Pan sum is weightedPanRemainder:
the congruence-count error at d is exactly the BoundingSieve remainder
rem d = multSum d − ν(d)·N/log N.
Applying the weighted Pan-BV input: the corrected sieve's
distribution condition is exactly WeightedPanCondition
instance.
The counting-sieve errSum is bounded by the weighted Pan remainder:
apply the reusable errSum_le_threeOmegaWeightedPanRemainder at the
corrected Chen instance.
Given the weighted Pan-BV input, the corrected sieve's errSum is
uniformly O(N / log^A N), the remainder bound formulated in
analytic-number-theory-lean, issue #7.
Completing the Pan bridge: PanMeanValueUniform ⇒ ChenWeightedPanInput #
This section proves only the finite bridge from the a = 1 base count to correctedChenBoundingSieve.rem.
It does not represent the general p₁p₂ weights in Liu's eqn-adef, and therefore does not treat
the noncoprime R₁ in eqn-r0. At the end, the source-faithful signed API is used to assemble
PanMeanValueUniform; the paper's R₁ and the signed main-term bound remain explicit analytic inputs.
The a=1 weight for the Pan bridge: f(1) = 1 and zero elsewhere, reducing panDistributionSum
to the a = 1 distribution error Δ(y; 1, q, l).
Instances For
Base count = the a=1 Pan scaled count: #{p < N : p prime, 2 ≤ N-p, p ≡ N [MOD q]}
is exactly primesInAPBelow (N-2) 1 q (N % q), the a = 1 case of Liu 2022 §II,
and the input side of primesInAPBelow_one.
The distribution error of the base count equals the a=1 Pan distribution error:
(baseCount q) − li(N−2)/φ(q) = panDistributionError (N−2) 1 q (N % q),
namely Δ(N-2; 1, q, N mod q) = π(N-2; q, N mod q) - li(N-2)/φ(q).
Exact remainder under Möbius decomposition (factor-by-factor decomposition): for d | P(N),
rem d = Σ_{e | F(N)} μ(e)·baseCount(lcm(d,e)) − li(N)/φ(d),
where baseCount(q) = #{p < N : p prime, 2 ≤ N-p, p ≡ N [MOD q]} is the prime-AP base count.
On the main-term side, ν(d) = 1/φ(d) for squarefree d | P, and totalMass = N/log N = li(N).
For the a=1 weight, panDistributionSum reduces to panDistributionError.
The delta weight has no non-coprime contribution. This proves why the
a = 1 bridge bypasses, rather than estimates, Liu's general-f R₁.
The entire finite non-coprime lane vanishes for chenPanWeightOne.
The unrestricted finite sum also collapses to the a = 1 base-count
error. Together with the preceding theorem, this is the exact scope of the
delta-weight bridge.
The sifting product is coprime to N: each prime factor of P(N) satisfies r ∤ N.
For a squarefree modulus, μ(d)² = 1, since μ(d) = ±1.
panMaxL is nonnegative: it is a maximum of absolute values, or zero.
panMaxY is nonnegative.
The delta-one distribution error at any reduced residue is bounded by Pan's two nested maxima.
Pan control of the distribution error: for d | P(N),
|Δ(N-2; 1, d, N mod d)| ≤ panMaxY N d N (a=1 weight).
The modulus d is coprime to N, since its prime factors divide P and do not divide N.
Thus (N mod d, d) = 1 places the residue in unitResidues d, the range of the panMaxL maximum.
This statement also covers d = 1, whose unique canonical residue is 0.
Support/truncation input: the part of Chen's remainder not covered by the modulus sum
q ≤ x^{1/2}/log^B x in the weighted Pan mean-value theorem consists of the errors
|Δ'(d)| for large moduli d > D and for d = 1, together with |rem d - Δ'(d)|.
The latter includes the Möbius correction Σ_{1≠e|F} μ(e)·baseCount(lcm(d,e)) and the main-term difference (li(N)-li(N-2))/φ(d).
These are uniformly bounded by C·N/log^A N. Classical sources: the support truncation in Pan 1963 / Halberstam--Richert
Ch. 10. This is the Möbius support correction for the a = 1 base count, not
the R₁ for general p₁p₂ weights in Liu 2022 eqn-r0; the latter remains a separate open input.
Its proof, involving Titchmarsh-type averages and prime-AP counts for large moduli, is a research-level input.
Equations
- MathlibNt.SieveTheory.SwitchingPrinciple.CorrectedChenPanTruncationInput = ∀ (A : ℝ), 0 < A → ∀ (B : ℝ), ∃ (C : ℝ), 0 < C ∧ ∃ (x₀ : ℕ), ∀ (N : ℕ), x₀ ≤ N → Even N → ∑ d ∈ (MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenSiftingProduct N).divisors, 3 ^ d.primeFactors.card * |BoundingSieve.rem d - AnalyticNumberTheory.Sieve.panDistributionError (N - 2) 1 d (N % d)| + ∑ d ∈ (MathlibNt.SieveTheory.SwitchingPrinciple.correctedChenSiftingProduct N).divisors with ¬(2 ≤ d ∧ d ≤ ⌊↑N ^ (1 / 2) / Real.log ↑N ^ B⌋₊), 3 ^ d.primeFactors.card * |AnalyticNumberTheory.Sieve.panDistributionError (N - 2) 1 d (N % d)| ≤ C * ↑N / Real.log ↑N ^ A
Instances For
Reduction of Chen's weighted remainder sum: for N ≥ 1000 and any B,
Σ_{d | P(N)} 3^{ω(d)}·|rem d| ≤ PanSum(N,B) + Trunc(N,B),
where PanSum is the panMaxY-weighted modulus sum in PanMeanValueUniform, controlled by hpan,
and Trunc comprises the two remainder terms controlled by CorrectedChenPanTruncationInput:
|rem d - Δ'(d)| and |Δ'(d)| for uncovered moduli.
Trivial remainder bound: for d | P(N) and N ≥ 1000,
|rem d| ≤ (1 + 1/log 1000)·N, using support cardinality ≤ N and ν(d) = 1/φ(d) ≤ 1,
N/logN ≤ N/log 1000).
Divisor sum: for squarefree P, Σ_{d | P} 3^{ω(d)} ≤ 6^{ω(P)}.
Weighted divisor sum for the sifting product: Σ_{d | P(N)} 3^{ω(d)} ≤ 6^{z(N)}.
z(N) ≤ z(x₀) for N ≤ x₀, by monotonicity of the real power and the floor.
Trivial remainder-sum bound on the small-N interval 1000 ≤ N < x₀:
Σ_{d | P(N)} 3^{ω(d)}·|rem d| ≤ 6^{z(x₀)}·(1 + 1/log 1000)·N.
The a = 1 base-count bridge: the delta-weight instance of the classical weighted Pan
mean-value theorem, together with the support/truncation input, implies ChenWeightedPanInput for the current sieve.
This theorem does not identify this remainder with Liu's general-f paper R.
The reduction correctedChenPanSum_reduction gives Chen's remainder sum
Σ_d 3^{ω(d)}|rem d| ≤ PanSum + Trunc. The term PanSum is controlled by hpan
(PanMeanValueUniform), while Trunc is controlled by htrunc
(CorrectedChenPanTruncationInput); the finite range N < x₀ is absorbed using the trivial bound.
The source-faithful assembly is
PanMeanValueUniform.of_sourceFaithfulSignedInputs, which explicitly takes
PanSourceFaithfulSignedMainBound; the exact signed pointwise decomposition is already proved in AnalyticNumberTheory.
Here only the statement PanMeanValueUniform is used directly.
Source-faithful Pan wrapper:
PanMeanValueUniform.of_sourceFaithfulSignedInputs combines two character mean-value bounds,
the signed-main inverse-log bound with explicit u,v, the proved logarithmic growth estimate,
and δ₁(0)=0 into PanMeanValueUniform. Adding support truncation yields ChenWeightedPanInput.
The exact signed pointwise decomposition is an internal theorem of AnalyticNumberTheory, not a hypothesis;
the paper's R₁ and PanSourceFaithfulSignedMainBound remain open inputs.
The corrected candidate count is at least the lower-sieve main term minus
the explicit errSum: the finite seam through which a uniform
Jurkat--Richert lower bound for mainSum μ⁻ (with the closed N / log N
total mass) proves CorrectedChenAnalyticPositivity.