Documentation

LeanPool.DeadEnds.Counting

Finite-prime counting bounds and comparison with the Euler product density.

theorem LeanPool.DeadEnds.count_upper_bound (b : ) (T : Finset ) (S : Finset Nat.Primes) (X : ) :
have M := primeSquareProduct S; have A := validResiduesMod b T S; have count := {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}.card; count (X / M + 1) * A.card
theorem LeanPool.DeadEnds.count_bounds (b : ) (T : Finset ) (S : Finset Nat.Primes) (X : ) :
have M := primeSquareProduct S; have A := validResiduesMod b T S; have count := {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}.card; X / M * A.card count count (X / M + 1) * A.card

Helper: localDensityProduct is non-negative (product of non-negative factors).

theorem LeanPool.DeadEnds.interval_bound {a b lo hi d : } (ha_lo : lo a) (ha_hi : a hi) (hb_lo : lo b) (hb_hi : b hi) (hd : hi - lo d) :
|a - b| d
theorem LeanPool.DeadEnds.floor_div_bounds (X M : ) (hM : 0 < M) :
X / M * M X X < (X / M + 1) * M
theorem LeanPool.DeadEnds.count_real_bounds (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) :
have M := primeSquareProduct S; have L := localDensityProduct b T S; have q := X / M; have count := {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}.card; q * M * L count count (q + 1) * M * L

Helper: From count_bounds + validResidues_card_eq_mul, get the real-valued bounds.

theorem LeanPool.DeadEnds.xL_real_bounds (X M : ) (L : ) (hL : 0 L) (hM : 0 < M) :
have q := X / M; q * M * L X * L X * L (q + 1) * M * L
theorem LeanPool.DeadEnds.final_error_bound {count X M : } {L : } {q : } (hcount_lo : q * M * L count) (hcount_hi : count (q + 1) * M * L) (hxL_lo : q * M * L X * L) (hxL_hi : X * L (q + 1) * M * L) (_hL_nonneg : 0 L) (hL_le_one : L 1) :
|count - X * L| M
theorem LeanPool.DeadEnds.error_bound_empty_case (b : ) (_hb : 2 b) (T : Finset ) (_hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) (hM : primeSquareProduct S = 0) :
have M := primeSquareProduct S; have L := localDensityProduct b T S; have count := {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}.card; |count - X * L| M
theorem LeanPool.DeadEnds.error_bound (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) :
have M := primeSquareProduct S; have L := localDensityProduct b T S; have count := {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}.card; |count - X * L| M

Finite-prime counts differ from the expected local-density main term by at most the modulus.

theorem LeanPool.DeadEnds.count_finite_prime_approx (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) :
|{NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}.card - X * pS, localDensityFactor (↑p) b T| pS, p ^ 2
theorem LeanPool.DeadEnds.hasProd_implies_finite_approx (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (ε : ) ( : 0 < ε) :
∃ (A : Finset Nat.Primes), ∀ (S : Finset Nat.Primes), A S|pS, localDensityFactor (↑p) b T - jointSquarefreeDensity b T| < ε
theorem LeanPool.DeadEnds.finite_product_converges_to_density (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (ε : ) ( : 0 < ε) :
∃ (y : ), ∀ (S : Finset Nat.Primes), (∀ (p : Nat.Primes), p yp S)|pS, localDensityFactor (↑p) b T - jointSquarefreeDensity b T| < ε

For any ε > 0, the tail contribution from primes p > y to the joint density (measuring how much the finite product differs from the infinite product) can be made arbitrarily small by choosing y large enough. Uses jointSquarefreeDensity_multipliable to ensure convergence.

theorem LeanPool.DeadEnds.count_upper_bound_via_finite (b : ) (_hb : 2 b) (T : Finset ) (_hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) :
(countJointSquarefree b T X) {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}.card

Upper bound: For any S, C(X) ≤ #{N ≤ X : N satisfies S-conditions} since C(X) imposes more constraints. Combined with count_finite_prime_approx, this gives limsup C(X)/X ≤ D(b,T).

noncomputable def LeanPool.DeadEnds.countFinitePrime (b : ) (T : Finset ) (S : Finset Nat.Primes) (X : ) :

The number of N ∈ [1, X] such that for every p ∈ S we have p² ∤ N and p² ∤ b * N + d for all dT (i.e. the square-free conditions checked only at the primes in S).

Equations
Instances For

    The primes p ≤ n, packaged as a Finset Nat.Primes.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem LeanPool.DeadEnds.crt_error_bound (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) :
      theorem LeanPool.DeadEnds.count_finite_lower (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) :
      theorem LeanPool.DeadEnds.jointSquarefree_subset_finitePrime (b : ) (T : Finset ) (S : Finset Nat.Primes) (X : ) :
      {NFinset.Icc 1 X | Squarefree N dT, Squarefree (b * N + d)} {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d}
      theorem LeanPool.DeadEnds.sdiff_subset_violations (b : ) (T : Finset ) (S : Finset Nat.Primes) (X : ) :
      {NFinset.Icc 1 X | pS, ¬p ^ 2 N dT, ¬p ^ 2 b * N + d} \ {NFinset.Icc 1 X | Squarefree N dT, Squarefree (b * N + d)} {NFinset.Icc 1 X | qS, q ^ 2 N dT, q ^ 2 b * N + d}
      theorem LeanPool.DeadEnds.count_ge_finite_minus_violations (b : ) (_hb : 2 b) (T : Finset ) (_hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) :
      (countJointSquarefree b T X) (countFinitePrime b T S X) - {NFinset.Icc 1 X | qS, q ^ 2 N dT, q ^ 2 b * N + d}.card
      theorem LeanPool.DeadEnds.combine_bounds_lower (b : ) (hb : 2 b) (T : Finset ) (hT : T Finset.range b) (S : Finset Nat.Primes) (X : ) (hX : 0 < X) (δ₁ δ₂ : ) (hδ₁ : {NFinset.Icc 1 X | qS, q ^ 2 N dT, q ^ 2 b * N + d}.card / X < δ₁) (hδ₂ : (primeSquareProduct S) / X < δ₂) :
      (countJointSquarefree b T X) / X jointSquarefreeDensity b T - δ₁ - δ₂