Documentation

LeanPool.LongGapsBetweenPrimes.Main

Improved Long Gaps Between Primes #

We prove that, for all sufficiently large X, G(X) >> log(X) * log(log(X))^2 * log(log(log(log(X)))) / log(log(log(X)))^2, where G(X) is the largest gap between consecutive primes not exceeding X. Here, log denotes the natural logarithm and >> denotes a lower bound up to a positive multiplicative constant independent of X.

The main results are short_translates (Proposition 1.2) and long_gap_theorem (Theorem 1.1). The proof uses weak Mertens estimates, κ = 1/8, and a larger fixed constant in the auxiliary smoothness cutoff.

noncomputable def LongGapsBetweenPrimes.iteratedLog (j : ) (x : ) :

The j-fold natural logarithm used in the statement of Theorem 1.1.

Equations
Instances For
    noncomputable def LongGapsBetweenPrimes.gapScale (x : ) :

    The function on the right hand side of Theorem 1.1, without its constant.

    Equations
    Instances For

      Consecutive primes, specified without choosing an enumeration.

      Equations
      Instances For

        The precise conclusion to be proved.

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

          The short-translate assertion of Proposition 1.2.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            noncomputable def LongGapsBetweenPrimes.normalizer (P : ) :

            The normalization B in (3.1).

            Equations
            Instances For
              noncomputable def LongGapsBetweenPrimes.coefficient (P d : ) :

              The coefficient a(d) in (3.1).

              Equations
              Instances For

                A divisor other than one is greater than one.

                theorem LongGapsBetweenPrimes.normalizer_pos {P : } (hP : 1 < P) :

                The normalizer is positive when P > 1.

                theorem LongGapsBetweenPrimes.coefficient_neg {P d : } (hP : 1 < P) (hd : 1 < d) :

                For P > 1, coefficients at d > 1 are negative.

                theorem LongGapsBetweenPrimes.coefficient_cancellation {P : } (hP : 1 < P) :
                dP.divisors, coefficient P d / d.totient = 0

                Exact cancellation, equations (3.2) and (3.5).

                theorem LongGapsBetweenPrimes.partial_cancellation {P : } (hP : 1 < P) (E : Finset ) (hE : EP.divisors) (h1 : 1 E) :
                dE, coefficient P d / d.totient = dP.divisors \ E, |coefficient P d| / d.totient

                The omitted terms in (3.11) have positive total mass.

                theorem LongGapsBetweenPrimes.partial_cancellation_nonneg {P : } (hP : 1 < P) (E : Finset ) (hE : EP.divisors) (h1 : 1 E) :
                0 dE, coefficient P d / d.totient

                A divisor subsum containing one has nonnegative weighted coefficient sum.

                noncomputable def LongGapsBetweenPrimes.residueFactor {p : } (a t : Fin p) :

                The local factor as a function of a residue class with specified root.

                Equations
                Instances For
                  theorem LongGapsBetweenPrimes.sum_one_exception {p : } (a : Fin p) (c d : ) :
                  (∑ t : Fin p, if t = a then c else d) = c + (p - 1) * d

                  Sum a constant function with one exceptional value.

                  theorem LongGapsBetweenPrimes.sum_residueFactor {p : } (hp : 1 < p) (a : Fin p) :
                  t : Fin p, residueFactor a t = 0

                  The local mean is zero (Section 3.1).

                  theorem LongGapsBetweenPrimes.sum_residueFactor_sq {p : } (hp : 1 < p) (a : Fin p) :
                  t : Fin p, residueFactor a t ^ 2 = p / (p - 1)

                  The local square mean is 1/(p-1), before dividing the sum by p.

                  theorem LongGapsBetweenPrimes.sum_residueFactor_mul {p : } (hp : 1 < p) (a b : Fin p) (hab : a b) :
                  t : Fin p, residueFactor a t * residueFactor b t = -p / (p - 1) ^ 2

                  Distinct roots have negative covariance, as used in (3.9).

                  For squarefree d, its totient is the product of p - 1 over its prime factors.

                  noncomputable def LongGapsBetweenPrimes.coefficientMoment (P : ) (γ : ) :

                  A_gamma in Lemma 3.1; A is its value at gamma = 0.

                  Equations
                  Instances For
                    noncomputable def LongGapsBetweenPrimes.coefficientAbsMoment (P : ) (γ : ) :

                    The absolute coefficient moment over nontrivial divisors.

                    Equations
                    Instances For

                      Expand the coefficient moment at exponent zero.

                      The divisor one gives a lower bound of one for the coefficient moment.

                      The exponential increment is at most x * exp x.

                      theorem LongGapsBetweenPrimes.rpow_sub_one_le {v γ : } (hv : 0 < v) :
                      v ^ γ - 1 γ * v ^ γ * Real.log v

                      The power increment is at most γ * v ^ γ * log v.

                      theorem LongGapsBetweenPrimes.coefficient_sq_mul_log {P d : } (hP : 1 < P) (hd : 1 < d) :

                      A squared coefficient times log d equals its normalized absolute value.

                      Control the change in the squared moment by the absolute moment.

                      theorem LongGapsBetweenPrimes.moment_tail_le {α : Type u_1} (s : Finset α) (f v : α) (D β : ) (hD : 0 < D) ( : 0 β) (hf : as, 0 f a) (hv : as, 0 v a) :
                      as with D < v a, f a D ^ (-β) * as, f a * v a ^ β

                      Rankin's tail estimate, in the finite form needed for (3.10).

                      @[reducible, inline]

                      Divisors regarded as a finite index type.

                      Equations
                      Instances For
                        @[reducible, inline]

                        Tuples of k divisors of P.

                        Equations
                        Instances For

                          The product of the divisors in a tuple.

                          Equations
                          Instances For
                            noncomputable def LongGapsBetweenPrimes.tupleRegion (P k : ) (D : ) :

                            The common truncated region R_k of (3.3).

                            Equations
                            Instances For
                              noncomputable def LongGapsBetweenPrimes.tupleMass {P k : } (r : DivisorTuple P k) :

                              The diagonal mass attached to one tuple in (3.9).

                              Equations
                              Instances For

                                The diagonal mass of a divisor tuple is nonnegative.

                                theorem LongGapsBetweenPrimes.sum_divisorIndex (P : ) (f : ) :
                                d : DivisorIndex P, f d = dP.divisors, f d

                                Rewrite a sum over divisor indices as a sum over the divisor finset.

                                The total tuple mass is the kth power of the zero coefficient moment.

                                The tilted tuple mass factors as a power of the coefficient moment.

                                theorem LongGapsBetweenPrimes.diagonal_tail_le (P k : ) {D β : } (hD : 0 < D) ( : 0 β) :
                                r : DivisorTuple P k with D < (tupleProduct r), tupleMass r D ^ (-β) * coefficientMoment P β ^ k

                                The first inequality in (3.10), with no asymptotic assumptions.

                                theorem LongGapsBetweenPrimes.pow_le_mul_exp {A B t : } (hA : 1 A) (hB : 0 B) (ht : 0 t) (hBA : B A + t) (k : ) :
                                B ^ k A ^ k * Real.exp (k * t)

                                Convert an additive bound into an exponential bound on powers.

                                theorem LongGapsBetweenPrimes.coefficientMoment_pow_le {P : } (hP : 1 < P) {C γ : } (hC : 0 C) ( : 0 γ) (hM : coefficientAbsMoment P γ C * normalizer P) (k : ) :

                                Bound powers of a tilted coefficient moment relative to the zero moment.

                                theorem LongGapsBetweenPrimes.consecutivePrimes_of_composite_interval {N H : } (hN : 2 N) (hcomposite : ∀ (n : ), N < nn N + H¬Nat.Prime n) :
                                ∃ (p : ) (q : ), ConsecutivePrimes p q p N N + H < q q 2 * N H < q - p

                                The elementary passage from a prime-free interval to consecutive primes. Bertrand's postulate supplies the upper endpoint bound used in Section 2.

                                theorem LongGapsBetweenPrimes.prime_or_smooth_of_survives {n H : } {x w z : } (hn : 1 n) (hnH : n H) (hx : 0 < x) (hsmall : 2 * H < x * w) (hsurvives : ∀ (p : ), Nat.Prime pp w z < p p x / 2¬p n) :
                                Nat.Prime n ∀ (p : ), Nat.Prime pp np z

                                The initial zero-residue sieve leaves only primes and z-smooth integers.

                                Elements of S avoiding the selected residue classes.

                                Equations
                                Instances For
                                  theorem LongGapsBetweenPrimes.greedy_residue_classes (S ps : Finset ) (hpos : pps, 0 < p) :
                                  ∃ (a : ), (∀ pps, a p < p) (survivors S ps a).card S.card * pps, (1 - 1 / p)

                                  The greedy product bound in (2.1), before applying Mertens' estimate.

                                  theorem LongGapsBetweenPrimes.abs_quadratic_form_le_rows {ι : Type u_1} [Fintype ι] (c : ι) (K : ιι) (hK : ∀ (i j : ι), |K i j| = |K j i|) :
                                  |i : ι, j : ι, c i * c j * K i j| i : ι, c i ^ 2 * j : ι, |K i j|

                                  A symmetric matrix is controlled by its absolute row sums. This is the 2|ab| ≤ a²+b² argument invoked in the proof of (3.9).

                                  theorem LongGapsBetweenPrimes.quadratic_form_near_diagonal {ι : Type u_1} [Fintype ι] [DecidableEq ι] (c : ι) (K : ιι) (ε : ) (hsym : ∀ (i j : ι), K i j = K j i) (hdiag : ∀ (i : ι), K i i = 1) (hrow : ∀ (i : ι), (∑ j : ι, if j = i then 0 else |K i j|) ε) :
                                  |i : ι, j : ι, c i * c j * K i j - i : ι, c i ^ 2| ε * i : ι, c i ^ 2

                                  Row sums away from the diagonal bound the quadratic error from the identity.

                                  def LongGapsBetweenPrimes.productBasis {α : Type u_1} [Fintype α] {Ω : αType u_2} {J : αType u_3} (f : (p : α) → J pΩ p) (σ : (p : α) → J p) (t : (p : α) → Ω p) :

                                  The product of selected local basis functions over all coordinates.

                                  Equations
                                  Instances For

                                    The residue factor has mean zero.

                                    theorem LongGapsBetweenPrimes.average_residueFactor_sq {p : } (hp : 1 < p) (a : Fin p) :
                                    (Finset.univ.expect fun (t : Fin p) => residueFactor a t ^ 2) = 1 / (p - 1)

                                    The residue factor has second moment 1 / (p - 1).

                                    theorem LongGapsBetweenPrimes.average_residueFactor_mul {p : } (hp : 1 < p) (a b : Fin p) (hab : a b) :
                                    (Finset.univ.expect fun (t : Fin p) => residueFactor a t * residueFactor b t) = -1 / (p - 1) ^ 2

                                    Distinct residue factors have covariance -1 / (p - 1)^2.

                                    noncomputable def LongGapsBetweenPrimes.localBasis {p k : } (root : Fin kFin p) (i : Option (Fin k)) (t : Fin p) :

                                    The constant function and residue factors scaled to have variance one.

                                    Equations
                                    Instances For
                                      noncomputable def LongGapsBetweenPrimes.localKernel (p : ) {k : } (i j : Option (Fin k)) :

                                      The Gram kernel for the normalized local basis.

                                      Equations
                                      Instances For
                                        theorem LongGapsBetweenPrimes.average_localBasis_mul {p k : } (hp : 1 < p) (root : Fin kFin p) (hroot : Function.Injective root) (i j : Option (Fin k)) :
                                        (Finset.univ.expect fun (t : Fin p) => localBasis root i t * localBasis root j t) = localKernel p i j

                                        The local Gram matrix, with the nonconstant factors normalized to variance one.

                                        noncomputable def LongGapsBetweenPrimes.localRow (p k : ) (i : Option (Fin k)) :

                                        The absolute row sum of the local Gram kernel.

                                        Equations
                                        Instances For
                                          theorem LongGapsBetweenPrimes.localKernel_symm (p : ) {k : } (i j : Option (Fin k)) :

                                          The local Gram kernel is symmetric.

                                          theorem LongGapsBetweenPrimes.localKernel_diag (p : ) {k : } (i : Option (Fin k)) :
                                          localKernel p i i = 1

                                          The local Gram kernel has diagonal entries equal to one.

                                          theorem LongGapsBetweenPrimes.sum_abs_localKernel {p k : } (hp : 1 < p) (i : Option (Fin k)) :
                                          j : Option (Fin k), |localKernel p i j| = localRow p k i

                                          Summing the absolute local kernel entries gives localRow.

                                          noncomputable def LongGapsBetweenPrimes.productKernel {α : Type u_1} [Fintype α] (size : α) {k : } (σ τ : αOption (Fin k)) :

                                          The product of local Gram kernels over all coordinates.

                                          Equations
                                          Instances For
                                            theorem LongGapsBetweenPrimes.productKernel_symm {α : Type u_1} [Fintype α] (size : α) {k : } (σ τ : αOption (Fin k)) :
                                            productKernel size σ τ = productKernel size τ σ

                                            The product Gram kernel is symmetric.

                                            theorem LongGapsBetweenPrimes.productKernel_diag {α : Type u_1} [Fintype α] (size : α) {k : } (σ : αOption (Fin k)) :
                                            productKernel size σ σ = 1

                                            The product Gram kernel has diagonal entries equal to one.

                                            theorem LongGapsBetweenPrimes.sum_abs_productKernel {α : Type u_1} [Fintype α] [DecidableEq α] (size : α) (hsize : ∀ (p : α), 1 < size p) {k : } (σ : αOption (Fin k)) :
                                            τ : αOption (Fin k), |productKernel size σ τ| = p : α, localRow (size p) k (σ p)

                                            The product of local row sums from the proof of (3.9).

                                            theorem LongGapsBetweenPrimes.average_productBasis_localBasis {α : Type u_1} [Fintype α] [DecidableEq α] (size : α) (hsize : ∀ (p : α), 1 < size p) {k : } (root : (p : α) → Fin kFin (size p)) (hroot : ∀ (p : α), Function.Injective (root p)) (σ τ : αOption (Fin k)) :
                                            (Finset.univ.expect fun (t : (p : α) → Fin (size p)) => productBasis (fun (p : α) => localBasis (root p)) σ t * productBasis (fun (p : α) => localBasis (root p)) τ t) = productKernel size σ τ

                                            Products of local basis functions have Gram kernel productKernel.

                                            def LongGapsBetweenPrimes.assignmentSupport {α : Type u_1} [Fintype α] {k : } (σ : αOption (Fin k)) :

                                            Coordinates assigned to a nonconstant local basis function.

                                            Equations
                                            Instances For
                                              def LongGapsBetweenPrimes.assignmentProduct {α : Type u_1} [Fintype α] (size : α) {k : } (σ : αOption (Fin k)) :

                                              The product of coordinate sizes on an assignment's support.

                                              Equations
                                              Instances For
                                                theorem LongGapsBetweenPrimes.assignment_row_bound {α : Type u_1} [Fintype α] (size : α) {k : } (hk : 1 k) (σ : αOption (Fin k)) {z D : } (hz : 1 < z) (hsize : ∀ (p : α), z (size p)) (hcut : (assignmentProduct size σ) D) :
                                                p : α, localRow (size p) k (σ p) Real.exp (k * Real.log D / ((z - 1) * Real.log z))

                                                The cutoff controls the row sums uniformly, independently of the number of auxiliary primes in P.

                                                The indicator of the residue class a modulo m.

                                                Equations
                                                Instances For
                                                  theorem LongGapsBetweenPrimes.residue_count_error_le_one {m a : } (ha : a < m) (T : ) :
                                                  |nFinset.range T, residueIndicator m a n - T / m| 1

                                                  The error of counting one congruence class is at most one.

                                                  theorem LongGapsBetweenPrimes.residue_average_error {m a T : } (ha : a < m) (hT : 0 < T) :
                                                  |(∑ nFinset.range T, residueIndicator m a n) / T - 1 / m| 1 / T

                                                  A residue class has frequency error at most 1 / T on an interval of length T.

                                                  theorem LongGapsBetweenPrimes.weighted_union_bound {Ω : Type u_1} {ι : Type u_2} [Fintype Ω] [Fintype ι] (w : Ω) (event : ιΩProp) [(i : ι) → DecidablePred (event i)] (hw : ∀ (t : Ω), 0 w t) :
                                                  (∑ t : Ω, w t * if ∃ (i : ι), event i t then 1 else 0) i : ι, t : Ω, w t * if event i t then 1 else 0

                                                  A weighted union bound, stated without a probability-space interface.

                                                  theorem LongGapsBetweenPrimes.sum_pair_marked_product {ι : Type u_1} {Ω : Type u_2} [Fintype ι] [DecidableEq ι] [Fintype Ω] (w : Ω) (hw : d : Ω, w d = 1) (mark : ΩProp) [DecidablePred mark] (i j : ι) (hij : i j) :
                                                  (∑ r : ιΩ, (∏ : ι, w (r )) * if mark (r i) mark (r j) then 1 else 0) = (∑ d : Ω, w d * if mark d then 1 else 0) ^ 2

                                                  Independence of two marked coordinates under a product of normalized masses.

                                                  theorem LongGapsBetweenPrimes.product_collision_bound {α : Type u_1} {Ω : Type u_2} [Fintype α] [Fintype Ω] (w : Ω) (hw : ∀ (d : Ω), 0 w d) (hsum : d : Ω, w d = 1) (mark : αΩProp) [(p : α) → DecidablePred (mark p)] (k : ) :
                                                  (∑ r : Fin kΩ, (∏ i : Fin k, w (r i)) * if ∃ (p : α) (i : Fin k) (j : Fin k), i j mark p (r i) mark p (r j) then 1 else 0) k ^ 2 * p : α, (∑ d : Ω, w d * if mark p d then 1 else 0) ^ 2

                                                  The collision estimate for independently chosen divisors: a common mark in two coordinates costs at most the square of its one-coordinate mass.

                                                  theorem LongGapsBetweenPrimes.sum_divisors_dvd_eq {P p : } (hP : P 0) (hp : 0 < p) (hpP : p P) (f : ) :
                                                  dP.divisors with p d, f d = e(P / p).divisors, f (p * e)

                                                  Divisors divisible by p are parametrized by the divisors of P/p.

                                                  theorem LongGapsBetweenPrimes.abs_coefficient_mul_le {P p e : } (hP : 1 < P) (hp : 1 p) (he : 1 < e) :

                                                  Multiplying a nontrivial divisor by a prime decreases the absolute coefficient.

                                                  The absolute coefficient moment at exponent zero equals one.

                                                  The sum of absolute coefficients divided by totients equals two.

                                                  theorem LongGapsBetweenPrimes.coefficient_prime_incidence {P p : } (hP : 1 < P) (hsq : Squarefree P) (hp : Nat.Prime p) (hpP : p P) (hcoeff : |coefficient P p| 1) :
                                                  dP.divisors with p d, |coefficient P d| / d.totient 4 / p

                                                  The incidence bound (3.7), with an explicit constant once |a(p)| ≤ 1.

                                                  theorem LongGapsBetweenPrimes.sum_log_prime_divisors_le_log {n N : } (hn : 0 < n) (hnN : n N) :
                                                  (∑ pN.primesLE, if p n then Real.log p else 0) Real.log n

                                                  The logarithms of distinct prime divisors sum to at most log n.

                                                  theorem LongGapsBetweenPrimes.sum_prime_log_div_le {N : } (hN : 1 N) :
                                                  pN.primesLE, Real.log p / p Real.log N + Real.log 4

                                                  An elementary upper bound for the logarithmically weighted prime harmonic sum.

                                                  noncomputable def LongGapsBetweenPrimes.eulerProduct (N : ) (σ : ) :

                                                  The finite Euler product over primes at most N.

                                                  Equations
                                                  Instances For

                                                    The multiplicative weight n ↦ n ^ (-σ).

                                                    Equations
                                                    Instances For
                                                      theorem LongGapsBetweenPrimes.sum_smooth_le_eulerProduct {N : } {σ : } ( : 0 < σ) (S : Finset ) (hS : nS, n (N + 1).smoothNumbers) :
                                                      nS, n ^ (-σ) eulerProduct N σ

                                                      The weighted sum over smooth numbers is bounded by the finite Euler product.

                                                      The lower half of the weak Mertens product estimate.

                                                      theorem LongGapsBetweenPrimes.tsum_succ_rpow_le {σ : } ( : 1 < σ) :
                                                      ∑' (n : ), (n + 1) ^ (-σ) 1 + 1 / (σ - 1)

                                                      The elementary zeta-function bound obtained by integrating t^(-σ).

                                                      theorem LongGapsBetweenPrimes.eulerProduct_le_zeta_bound {σ : } ( : 1 < σ) (N : ) :
                                                      eulerProduct N σ 1 + 1 / (σ - 1)

                                                      For σ > 1, the finite Euler product is at most 1 + 1 / (σ - 1).

                                                      theorem LongGapsBetweenPrimes.euler_factor_comparison {p r : } (hp : 2 p) (hr : 0 r) :
                                                      (1 - p ^ (-1))⁻¹ (1 - p ^ (-(1 + r)))⁻¹ * Real.exp (2 * r * Real.log p / p)

                                                      Compare an Euler factor at exponent one with its shift by r.

                                                      theorem LongGapsBetweenPrimes.eulerProduct_comparison (N : ) {r : } (hr : 0 r) :
                                                      eulerProduct N 1 eulerProduct N (1 + r) * Real.exp (2 * r * pN.primesLE, Real.log p / p)

                                                      Moving the Euler product to the right of its pole has bounded cost.

                                                      An explicit weak Mertens upper bound, sufficient throughout the proof.

                                                      noncomputable def LongGapsBetweenPrimes.divisorEulerMoment (P : ) (γ : ) :

                                                      The power moment of divisors weighted by reciprocal totients.

                                                      Equations
                                                      Instances For
                                                        theorem LongGapsBetweenPrimes.divisorEulerMoment_primeProduct (ps : Finset ) (hps : pps, Nat.Prime p) (γ : ) :
                                                        divisorEulerMoment (∏ pps, p) γ = pps, (1 + p ^ γ / (p - 1))

                                                        Factor the divisor Euler moment of a product of distinct primes.

                                                        theorem LongGapsBetweenPrimes.eulerProduct_pos (N : ) {σ : } ( : 0 < σ) :

                                                        The finite Euler product is positive at every positive exponent.

                                                        theorem LongGapsBetweenPrimes.eulerProduct_antitone (N : ) {σ τ : } ( : 0 < σ) (hστ : σ τ) :

                                                        The finite Euler product decreases as its positive exponent increases.

                                                        Primes in the interval (Z, Y].

                                                        Equations
                                                        Instances For

                                                          The product of primes in the interval (Z, Y].

                                                          Equations
                                                          Instances For

                                                            Every auxiliary prime is prime.

                                                            Membership in the auxiliary primes means primality and Z < p ≤ Y.

                                                            The auxiliary prime product is squarefree.

                                                            The auxiliary prime product is positive.

                                                            theorem LongGapsBetweenPrimes.auxiliary_euler_factorization {Z Y : } (hZY : Z Y) (σ : ) :
                                                            (∏ pauxiliaryPrimes Z Y, (1 - p ^ (-σ))⁻¹) * eulerProduct Z σ = eulerProduct Y σ

                                                            Split the Euler product at the lower cutoff Z.

                                                            theorem LongGapsBetweenPrimes.squarefree_euler_factor_ge {p t : } (hp : 1 < p) (ht : 0 < t) :
                                                            (1 - p ^ (-(1 + t)))⁻¹ 1 + p ^ (-t) / (p - 1)

                                                            A squarefree Euler factor dominates the corresponding shifted geometric factor.

                                                            A lower bound for the squarefree-divisor Euler product by a usual Euler product.

                                                            theorem LongGapsBetweenPrimes.eulerProduct_ge_power_integral (Y : ) {t : } (ht : 0 < t) :
                                                            (1 - (Y + 1) ^ (-t)) / t eulerProduct Y (1 + t)

                                                            Bound the Euler product below by an integral of a negative power.

                                                            theorem LongGapsBetweenPrimes.eulerProduct_ge_one_div_two_mul (Y : ) {t : } (ht : 0 < t) (hscale : 1 t * Real.log (Y + 1)) :
                                                            1 / (2 * t) eulerProduct Y (1 + t)

                                                            The Euler product at 1 + t is at least 1 / (2 * t) when t * log (Y + 1) ≥ 1.

                                                            The divisor Euler moment is nonnegative.

                                                            theorem LongGapsBetweenPrimes.divisorEulerMoment_lower {Z Y : } (hZY : Z Y) {t A : } (ht : 0 < t) (hA : 0 < A) (hZA : eulerProduct Z 1 A) (hscale : 1 t * Real.log (Y + 1)) :

                                                            The lower bound whose integral supplies a positive normalization B.

                                                            The negatively tilted divisor Euler moment is continuous.

                                                            theorem LongGapsBetweenPrimes.integral_exp_decay_le {L a : } (hL : 0 < L) (ha : 0 a) (b : ) :
                                                            (t : ) in a..b, Real.exp (-L * t) 1 / L

                                                            An exponential decay integral starting at a nonnegative point is at most 1 / L.

                                                            theorem LongGapsBetweenPrimes.normalizer_integral_le {P : } (hP : P 0) {a : } (ha : 0 a) (b : ) :

                                                            The normalizer dominates every positive-half-line integral of U_(-t)-1.

                                                            theorem LongGapsBetweenPrimes.normalizer_lower_integral {Z Y : } (hZY : Z Y) {A a b : } (hA : 0 < A) (ha : 0 < a) (hab : a b) (hZA : eulerProduct Z 1 A) (hscale : 1 a * Real.log (Y + 1)) :

                                                            Integrating the lower Euler-product bound gives a completely finite lower bound for B; no sieve asymptotic is assumed.

                                                            theorem LongGapsBetweenPrimes.normalizer_lower_bound {Z Y : } (hZY : Z Y) {A : } (hA : 0 < A) (hZA : eulerProduct Z 1 A) (hAY : A Real.log (Y + 1)) :

                                                            A logarithmic lower bound for the auxiliary normalizer.

                                                            theorem LongGapsBetweenPrimes.abs_coefficient_eq {P d : } (hP : 1 < P) (hd : 1 < d) :

                                                            A nontrivial coefficient has absolute value 1 / (normalizer P * log d).

                                                            theorem LongGapsBetweenPrimes.coefficientAbsMoment_le {P Y : } (hP : 1 < P) (hY : 1 < Y) {γ E : } ( : 0 γ) (hYE : Y ^ γ E) :

                                                            Splitting at Y gives the tilted absolute-moment bound in (3.6).

                                                            At exponent zero, the auxiliary divisor moment is an Euler-product ratio.

                                                            Bound the auxiliary zero moment by a ratio of logarithms.

                                                            theorem LongGapsBetweenPrimes.squarefree_euler_factor_tilt {p γ E : } (hp : 1 < p) ( : 0 γ) (hpE : p ^ γ E) :
                                                            1 + p ^ γ / (p - 1) (1 + 1 / (p - 1)) * Real.exp (E * γ * Real.log p / p)

                                                            An exponential bound for tilting a squarefree Euler factor.

                                                            theorem LongGapsBetweenPrimes.divisorEulerMoment_tilt (ps : Finset ) (hps : pps, Nat.Prime p) {γ E : } ( : 0 γ) (hE : pps, p ^ γ E) :
                                                            divisorEulerMoment (∏ pps, p) γ divisorEulerMoment (∏ pps, p) 0 * Real.exp (E * γ * pps, Real.log p / p)

                                                            Tilting a squarefree divisor moment costs an exponential factor.

                                                            Uniformly bound the cost of tilting the auxiliary divisor moment.

                                                            Every prime divisor of the auxiliary product is an auxiliary prime.

                                                            Every nontrivial auxiliary divisor exceeds the lower cutoff Z.

                                                            A normalizer lower bound makes every auxiliary coefficient at most one in magnitude.

                                                            An explicit absolute moment bound from a lower bound on the normalizer.

                                                            Equations
                                                            Instances For

                                                              The absolute moment bound divided by the normalizer lower bound.

                                                              Equations
                                                              Instances For

                                                                The absolute moment bound is positive for positive b.

                                                                The coefficient control constant is positive for positive b.

                                                                theorem LongGapsBetweenPrimes.auxiliary_coefficientAbsMoment_le {Z Y : } (hZY : Z Y) (hZ : 2 Z) (hlogZ : 1 Real.log Z) (hP : 1 < auxiliaryProduct Z Y) {b γ : } (hb : 0 < b) (hB : b normalizer (auxiliaryProduct Z Y)) ( : 0 γ) (hscale : γ * Real.log Y 2) :

                                                                Bound the auxiliary absolute moment by absoluteMomentBound.

                                                                theorem LongGapsBetweenPrimes.auxiliary_coefficientAbsMoment_control {Z Y : } (hZY : Z Y) (hZ : 2 Z) (hlogZ : 1 Real.log Z) (hP : 1 < auxiliaryProduct Z Y) {b γ : } (hb : 0 < b) (hB : b normalizer (auxiliaryProduct Z Y)) ( : 0 γ) (hscale : γ * Real.log Y 2) :

                                                                Bound the auxiliary absolute moment by a constant times the normalizer.

                                                                noncomputable def LongGapsBetweenPrimes.sieveZ (x : ) :

                                                                The auxiliary prime ranges of Section 3.1, with integral endpoints.

                                                                Equations
                                                                Instances For

                                                                  The logarithmic upper cutoff x / (log x)^5 for the sieve primes.

                                                                  Equations
                                                                  Instances For
                                                                    noncomputable def LongGapsBetweenPrimes.sieveY (x : ) :

                                                                    The upper sieve cutoff, rounded down to an integer.

                                                                    Equations
                                                                    Instances For
                                                                      noncomputable def LongGapsBetweenPrimes.sieveP (x : ) :

                                                                      The product of primes between the two sieve cutoffs.

                                                                      Equations
                                                                      Instances For

                                                                        A fixed positive lower bound used for the sieve normalizer.

                                                                        Equations
                                                                        Instances For

                                                                          The fixed normalizer lower bound is positive.

                                                                          theorem LongGapsBetweenPrimes.sieve_normalizer_lower_of_bounds {x : } (hx : 0 < x) (hlx : 1 Real.log x) (hZ : 2 sieveZ x) (hlarge : 7 * Real.exp 6 * Real.log x ^ 6 x) (hsmall : 6 * Real.log (Real.log x) + Real.log 7 + 8 Real.log x / 2) :

                                                                          Explicit size bounds ensure ordered cutoffs and a uniform normalizer lower bound.

                                                                          The logarithm of the lower sieve cutoff tends to infinity.

                                                                          The unconditional positive lower bound for B for the paper's parameters.

                                                                          noncomputable def LongGapsBetweenPrimes.sieveBeta (x : ) :

                                                                          The tilt scale reciprocal to the logarithmic upper sieve cutoff.

                                                                          Equations
                                                                          Instances For

                                                                            A common constant controlling the coefficient moments.

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

                                                                              The common coefficient constant exceeds one.

                                                                              The coefficient estimates needed by the finite weighted sieve argument.

                                                                              Instances For

                                                                                The sieve coefficients eventually satisfy all required uniform estimates.

                                                                                Squared coefficient mass normalized to a probability on divisors.

                                                                                Equations
                                                                                Instances For

                                                                                  The normalized divisor mass is nonnegative.

                                                                                  The normalized divisor masses sum to one.

                                                                                  Tuple mass is a fixed scale times the product of the divisor probabilities.

                                                                                  theorem LongGapsBetweenPrimes.divisorProbability_prime_incidence {P p : } {β C : } (h : CoefficientEstimates P β C) (hp : Nat.Prime p) (hpP : p P) :
                                                                                  (∑ d : DivisorIndex P, divisorProbability P d * if p d then 1 else 0) 4 / p

                                                                                  A prime divides a random divisor with probability at most 4 / p.

                                                                                  theorem LongGapsBetweenPrimes.noncoprime_pair_iff_common_prime {P k : } (hP : P 0) (r : DivisorTuple P k) :
                                                                                  (¬∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) ∃ (p : P.primeFactors) (i : Fin k) (j : Fin k), i j p (r i) p (r j)

                                                                                  Failure of pairwise coprimality is witnessed by a shared prime factor.

                                                                                  theorem LongGapsBetweenPrimes.diagonal_collision_le {P M k : } {β C : } (h : CoefficientEstimates P β C) (hM : 0 < M) (hmin : pP.primeFactors, M < p) :
                                                                                  (∑ r : DivisorTuple P k, tupleMass r * if ¬∀ (i j : Fin k), i j(↑(r i)).Coprime (r j) then 1 else 0) 16 * k ^ 2 / M * coefficientMoment P 0 ^ k

                                                                                  The discarded mass from tuples sharing a prime, with an explicit constant.

                                                                                  noncomputable def LongGapsBetweenPrimes.diagonalMass (P k : ) (D : ) :

                                                                                  The total diagonal mass over the truncated tuple region.

                                                                                  Equations
                                                                                  Instances For

                                                                                    The total diagonal mass is nonnegative.

                                                                                    theorem LongGapsBetweenPrimes.diagonalMass_tail_collision {P M k : } {β C D : } (h : CoefficientEstimates P β C) (hM : 0 < M) (hmin : pP.primeFactors, M < p) (hD : 0 < D) ( : 0 β) :
                                                                                    coefficientMoment P 0 ^ k - diagonalMass P k D D ^ (-β) * coefficientMoment P β ^ k + 16 * k ^ 2 / M * coefficientMoment P 0 ^ k

                                                                                    The only losses in the diagonal are the product cutoff and shared primes.

                                                                                    theorem LongGapsBetweenPrimes.indexed_offdiag_sum_le {ι : Type u_1} {Λ : Type u_2} [Fintype ι] [Fintype Λ] [DecidableEq ι] (σ : ιΛ) ( : Function.Injective σ) (K : ΛΛ) (hdiag : ∀ (j : Λ), K j j = 1) (i : ι) :
                                                                                    (∑ j : ι, if j = i then 0 else |K (σ i) (σ j)|) τ : Λ, |K (σ i) τ| - 1

                                                                                    Injective indexing bounds the row sum away from the diagonal by the full sum minus one.

                                                                                    theorem LongGapsBetweenPrimes.indexed_product_second_moment {α : Type u_1} {ι : Type u_2} [Fintype α] [DecidableEq α] [Fintype ι] (size : α) (hsize : ∀ (p : α), 1 < size p) {k : } (root : (p : α) → Fin kFin (size p)) (hroot : ∀ (p : α), Function.Injective (root p)) (σ : ιαOption (Fin k)) ( : Function.Injective σ) (c : ι) (ε : ) (hbound : ∀ (i : ι), p : α, localRow (size p) k (σ i p) - 1 ε) :
                                                                                    |(Finset.univ.expect fun (t : (p : α) → Fin (size p)) => (∑ i : ι, c i * productBasis (fun (p : α) => localBasis (root p)) (σ i) t) ^ 2) - i : ι, c i ^ 2| ε * i : ι, c i ^ 2

                                                                                    Row bounds control the second moment of an indexed sum of product basis functions.

                                                                                    @[reducible, inline]

                                                                                    Prime divisors of P regarded as a finite index type.

                                                                                    Equations
                                                                                    Instances For
                                                                                      noncomputable def LongGapsBetweenPrimes.tupleAssignment {P k : } (r : DivisorTuple P k) :

                                                                                      Assign each used prime to a tuple coordinate containing it.

                                                                                      Equations
                                                                                      Instances For
                                                                                        theorem LongGapsBetweenPrimes.prime_coordinate_unique {P k p : } (hp : Nat.Prime p) (r : DivisorTuple P k) (hpair : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) {i j : Fin k} (hi : p (r i)) (hj : p (r j)) :
                                                                                        i = j

                                                                                        A prime divides at most one coordinate of a pairwise coprime tuple.

                                                                                        theorem LongGapsBetweenPrimes.tupleAssignment_eq_some {P k : } (r : DivisorTuple P k) (hpair : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) (p : PrimeIndex P) (i : Fin k) :
                                                                                        tupleAssignment r p = some i p (r i)

                                                                                        In a pairwise coprime tuple, a prime is assigned exactly to the coordinate it divides.

                                                                                        A truncated tuple is determined by its prime assignment when P is squarefree.

                                                                                        theorem LongGapsBetweenPrimes.tupleAssignment_prod {P k : } {M : Type u_1} [CommMonoid M] (r : DivisorTuple P k) (hpair : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) (f : PrimeIndex PFin kM) :
                                                                                        (∏ p : PrimeIndex P, match tupleAssignment r p with | none => 1 | some i => f p i) = i : Fin k, p : PrimeIndex P, if p (r i) then f p i else 1

                                                                                        Regroup a product over assigned primes by tuple coordinates.

                                                                                        theorem LongGapsBetweenPrimes.prod_primeIndex_dvd {P d : } (hP : P 0) (hd : d P) {M : Type u_1} [CommMonoid M] (f : M) :
                                                                                        (∏ p : PrimeIndex P, if p d then f p else 1) = pd.primeFactors, f p

                                                                                        Restrict a product over primes dividing P to those dividing d.

                                                                                        theorem LongGapsBetweenPrimes.tupleProduct_dvd {P k : } (r : DivisorTuple P k) (hpair : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) :

                                                                                        The product of pairwise coprime divisors of P divides P.

                                                                                        A prime is assigned precisely when it divides the tuple product.

                                                                                        theorem LongGapsBetweenPrimes.assignmentProduct_tupleAssignment {P k : } (hP : Squarefree P) (r : DivisorTuple P k) (hpair : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) :

                                                                                        The product of assigned primes equals the tuple product for squarefree P.

                                                                                        noncomputable def LongGapsBetweenPrimes.rawLocalBasis {p k : } (root : Fin kFin p) (i : Option (Fin k)) (t : Fin p) :

                                                                                        The constant function and unnormalized residue factors.

                                                                                        Equations
                                                                                        Instances For
                                                                                          noncomputable def LongGapsBetweenPrimes.assignmentNormalizer {α : Type u_1} [Fintype α] (size : α) {k : } (σ : αOption (Fin k)) :

                                                                                          The factor converting normalized product basis functions to unnormalized ones.

                                                                                          Equations
                                                                                          Instances For
                                                                                            noncomputable def LongGapsBetweenPrimes.assignmentVariance {α : Type u_1} [Fintype α] (size : α) {k : } (σ : αOption (Fin k)) :

                                                                                            The product of local variances on an assignment's support.

                                                                                            Equations
                                                                                            Instances For
                                                                                              theorem LongGapsBetweenPrimes.assignmentNormalizer_sq {α : Type u_1} [Fintype α] (size : α) (hsize : ∀ (p : α), 1 < size p) {k : } (σ : αOption (Fin k)) :

                                                                                              The square of the assignment normalizer equals the assignment variance.

                                                                                              theorem LongGapsBetweenPrimes.assignmentNormalizer_mul_basis {α : Type u_1} [Fintype α] (size : α) (hsize : ∀ (p : α), 1 < size p) {k : } (root : (p : α) → Fin kFin (size p)) (σ : αOption (Fin k)) (t : (p : α) → Fin (size p)) :
                                                                                              assignmentNormalizer size σ * productBasis (fun (p : α) => localBasis (root p)) σ t = productBasis (fun (p : α) => rawLocalBasis (root p)) σ t

                                                                                              Multiplying by the assignment normalizer removes the local basis normalization.

                                                                                              theorem LongGapsBetweenPrimes.prod_primeFactors_inv_sub_one {d : } (hd : Squarefree d) :
                                                                                              pd.primeFactors, 1 / (p - 1) = 1 / d.totient

                                                                                              For squarefree d, the product of 1 / (p - 1) equals 1 / φ(d).

                                                                                              theorem LongGapsBetweenPrimes.assignmentVariance_tuple {P k : } (hP : Squarefree P) (r : DivisorTuple P k) (hpair : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) :
                                                                                              assignmentVariance (fun (p : PrimeIndex P) => p) (tupleAssignment r) = i : Fin k, 1 / (↑(r i)).totient

                                                                                              A tuple's assignment variance is the product of its reciprocal totients.

                                                                                              noncomputable def LongGapsBetweenPrimes.tupleAmplitude {P k : } (r : DivisorTuple P k) :

                                                                                              The product of coefficients attached to a divisor tuple.

                                                                                              Equations
                                                                                              Instances For

                                                                                                The tuple amplitude rescaled for expansion in the normalized basis.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For
                                                                                                  theorem LongGapsBetweenPrimes.tupleNormalizedCoefficient_sq {P k : } (hP : Squarefree P) (r : DivisorTuple P k) (hpair : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) :

                                                                                                  A normalized tuple coefficient has square equal to its diagonal mass.

                                                                                                  noncomputable def LongGapsBetweenPrimes.residueWeight (P k : ) (D : ) (root : (p : PrimeIndex P) → Fin kFin p) (t : (p : PrimeIndex P) → Fin p) :

                                                                                                  The truncated divisor sum weighted by coefficients and local residue factors.

                                                                                                  Equations
                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                  Instances For
                                                                                                    theorem LongGapsBetweenPrimes.residueWeight_second_moment {P k : } (hP : Squarefree P) (D : ) (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (ε : ) (hbound : ∀ (r : (tupleRegion P k D)), p : PrimeIndex P, localRow (↑p) k (tupleAssignment (↑r) p) - 1 ε) :
                                                                                                    |(Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => residueWeight P k D root t ^ 2) - diagonalMass P k D| ε * diagonalMass P k D

                                                                                                    The tuple weight has the diagonal second moment claimed in (3.9).

                                                                                                    theorem LongGapsBetweenPrimes.residueWeight_second_moment_bound {P k : } (hP : Squarefree P) (hk : 1 k) {M D : } (hM : 1 < M) (hmin : pP.primeFactors, M p) (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) :
                                                                                                    |(Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => residueWeight P k D root t ^ 2) - diagonalMass P k D| (Real.exp (k * Real.log D / ((M - 1) * Real.log M)) - 1) * diagonalMass P k D

                                                                                                    An explicit exponential bound for the second moment's deviation from the diagonal mass.

                                                                                                    noncomputable def LongGapsBetweenPrimes.integerAverage (T : ) (f : ) :

                                                                                                    The average of f over the integers in [0, T).

                                                                                                    Equations
                                                                                                    Instances For
                                                                                                      theorem LongGapsBetweenPrimes.residue_expansion {m : } (hm : 0 < m) (g : Fin m) (n : ) :
                                                                                                      g n % m, = a : Fin m, g a * residueIndicator m (↑a) n

                                                                                                      Expand a function of residues as a sum of residue indicators.

                                                                                                      theorem LongGapsBetweenPrimes.integerAverage_residue_expansion {m : } (hm : 0 < m) (g : Fin m) (T : ) :
                                                                                                      (integerAverage T fun (n : ) => g n % m, ) = a : Fin m, g a * ((∑ nFinset.range T, residueIndicator m (↑a) n) / T)

                                                                                                      Express a periodic average using the frequencies of its residue classes.

                                                                                                      theorem LongGapsBetweenPrimes.residue_average_bounded_error {m T : } (hm : 0 < m) (hT : 0 < T) (g : Fin m) (hg : ∀ (a : Fin m), |g a| 1) :
                                                                                                      |(integerAverage T fun (n : ) => g n % m, ) - Finset.univ.expect g| m / T

                                                                                                      A bounded function of one residue class has interval-average error at most m/T.

                                                                                                      theorem LongGapsBetweenPrimes.integerAverage_complete_residues {m q : } (hm : 0 < m) (hq : 0 < q) (hmq : m q) (g : Fin m) :
                                                                                                      (integerAverage q fun (n : ) => g n % m, ) = Finset.univ.expect g

                                                                                                      Averaging over complete periods equals the uniform average over residues.

                                                                                                      theorem LongGapsBetweenPrimes.integerAverage_period_error {m q T : } (hm : 0 < m) (hq : 0 < q) (hT : 0 < T) (hmq : m q) (f : ) (hperiod : ∀ (n : ), f (n % m) = f n) (hf : ∀ (n : ), |f n| 1) :

                                                                                                      The interval average of a bounded periodic function has error at most m / T.

                                                                                                      theorem LongGapsBetweenPrimes.integerAverage_weight_sq {ι : Type u_1} [Fintype ι] (T : ) (c : ι) (f : ι) :
                                                                                                      (integerAverage T fun (n : ) => (∑ i : ι, c i * f i n) ^ 2) = i : ι, j : ι, c i * c j * integerAverage T fun (n : ) => f i n * f j n

                                                                                                      Expand the average of a squared weighted sum into pairwise averages.

                                                                                                      theorem LongGapsBetweenPrimes.integerAverage_weight_error {ι : Type u_1} [Fintype ι] (q T : ) (c : ι) (hc : ∀ (i : ι), |c i| 1) (f : ι) (E : ) (hpair : ∀ (i j : ι), |(integerAverage T fun (n : ) => f i n * f j n) - integerAverage q fun (n : ) => f i n * f j n| E) :
                                                                                                      |(integerAverage T fun (n : ) => (∑ i : ι, c i * f i n) ^ 2) - integerAverage q fun (n : ) => (∑ i : ι, c i * f i n) ^ 2| (Fintype.card ι) ^ 2 * E

                                                                                                      Pairwise average errors give a quadratic error bound for a squared weighted sum.

                                                                                                      Every assigned prime divides P.

                                                                                                      A prime belongs to the assigned set exactly when its assignment is nonempty.

                                                                                                      Every element of the assigned prime set is prime.

                                                                                                      theorem LongGapsBetweenPrimes.assignmentPrimes_product {P k : } (σ : PrimeIndex POption (Fin k)) :
                                                                                                      passignmentPrimes σ, p = assignmentProduct (fun (p : PrimeIndex P) => p) σ

                                                                                                      The product of the assigned primes equals the assignment product.

                                                                                                      theorem LongGapsBetweenPrimes.assignmentProduct_pos {P k : } (σ : PrimeIndex POption (Fin k)) :
                                                                                                      0 < assignmentProduct (fun (p : PrimeIndex P) => p) σ

                                                                                                      The product of the assigned primes is positive.

                                                                                                      theorem LongGapsBetweenPrimes.assignmentProduct_dvd {P k : } (σ : PrimeIndex POption (Fin k)) :
                                                                                                      assignmentProduct (fun (p : PrimeIndex P) => p) σ P

                                                                                                      The product of the assigned primes divides P.

                                                                                                      The prime factors of the assignment product are exactly the assigned primes.

                                                                                                      def LongGapsBetweenPrimes.assignedRoot {P k : } (root : (p : PrimeIndex P) → Fin kFin p) (σ : PrimeIndex POption (Fin k)) (p : PrimeIndex P) :
                                                                                                      Fin p

                                                                                                      The root selected by an assignment, with zero at unused primes.

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        theorem LongGapsBetweenPrimes.exists_assignment_residue {P k : } (root : (p : PrimeIndex P) → Fin kFin p) (σ : PrimeIndex POption (Fin k)) :
                                                                                                        a < assignmentProduct (fun (p : PrimeIndex P) => p) σ, ∀ (p : PrimeIndex P), (σ p).isSome = truea % p = (assignedRoot root σ p)

                                                                                                        The Chinese remainder theorem realizes all assigned roots in one residue.

                                                                                                        noncomputable def LongGapsBetweenPrimes.assignmentCode {P k : } (root : (p : PrimeIndex P) → Fin kFin p) (σ : PrimeIndex POption (Fin k)) :

                                                                                                        A residue encoding the roots selected by an assignment.

                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          theorem LongGapsBetweenPrimes.assignmentCode_lt {P k : } (root : (p : PrimeIndex P) → Fin kFin p) (σ : PrimeIndex POption (Fin k)) :
                                                                                                          assignmentCode root σ < assignmentProduct (fun (p : PrimeIndex P) => p) σ

                                                                                                          The assignment code is smaller than its modulus.

                                                                                                          theorem LongGapsBetweenPrimes.assignmentCode_mod {P k : } (root : (p : PrimeIndex P) → Fin kFin p) (σ : PrimeIndex POption (Fin k)) (p : PrimeIndex P) (hp : (σ p).isSome = true) :
                                                                                                          assignmentCode root σ % p = (assignedRoot root σ p)

                                                                                                          The assignment code has the prescribed residue at each assigned prime.

                                                                                                          theorem LongGapsBetweenPrimes.assignmentCode_determines {P k : } (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (σ τ : PrimeIndex POption (Fin k)) (hn : assignmentProduct (fun (p : PrimeIndex P) => p) σ = assignmentProduct (fun (p : PrimeIndex P) => p) τ) (ha : assignmentCode root σ = assignmentCode root τ) :
                                                                                                          σ = τ

                                                                                                          Distinct local roots make the modulus and residue code determine the assignment.

                                                                                                          theorem LongGapsBetweenPrimes.card_assignment_family_le {P k : } {ι : Type u_1} [Fintype ι] (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (σ : ιPrimeIndex POption (Fin k)) ( : Function.Injective σ) {D : } (hD : 1 D) (hcut : ∀ (i : ι), (assignmentProduct (fun (p : PrimeIndex P) => p) (σ i)) D) :
                                                                                                          (Fintype.card ι) 4 * D ^ 2

                                                                                                          Encoding an assignment by its modulus and one CRT residue bounds its count.

                                                                                                          theorem LongGapsBetweenPrimes.tupleRegion_card_le {P k : } (hP : Squarefree P) {D : } (hD : 1 D) (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) :
                                                                                                          (Fintype.card (tupleRegion P k D)) 4 * D ^ 2

                                                                                                          The truncated tuple region has at most 4 * D ^ 2 elements.

                                                                                                          theorem LongGapsBetweenPrimes.mod_invariant_of_dvd {m n : } (hmn : m n) (f : ) (hf : ∀ (a : ), f (a % m) = f a) (a : ) :
                                                                                                          f (a % n) = f a

                                                                                                          Invariance modulo m implies invariance modulo every multiple of m.

                                                                                                          theorem LongGapsBetweenPrimes.integerAverage_bounded_periodic_weight {ι : Type u_1} [Fintype ι] {q T : } (hq : 0 < q) (hT : 0 < T) {D : } (hD : 0 D) (period : ι) (hperiod_pos : ∀ (i : ι), 0 < period i) (hperiod_q : ∀ (i : ι), period i q) (hperiod_D : ∀ (i : ι), (period i) D) (c : ι) (hc : ∀ (i : ι), |c i| 1) (f : ι) (hf : ∀ (i : ι) (n : ), |f i n| 1) (hmod : ∀ (i : ι) (n : ), f i (n % period i) = f i n) :
                                                                                                          |(integerAverage T fun (n : ) => (∑ i : ι, c i * f i n) ^ 2) - integerAverage q fun (n : ) => (∑ i : ι, c i * f i n) ^ 2| (Fintype.card ι) ^ 2 * (D ^ 2 / T)

                                                                                                          Bound the second-moment averaging error using the periods and number of summands.

                                                                                                          The residues of n modulo the prime divisors of P.

                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            theorem LongGapsBetweenPrimes.integerAverage_residues {P : } (hP : Squarefree P) (f : ((p : PrimeIndex P) → Fin p)) :
                                                                                                            (integerAverage P fun (n : ) => f (residueVector P n)) = Finset.univ.expect f

                                                                                                            The Chinese remainder theorem identifies a full-period average with a product average.

                                                                                                            Every residue factor has absolute value at most one.

                                                                                                            theorem LongGapsBetweenPrimes.abs_rawLocalBasis_le_one {p k : } (hp : 1 < p) (root : Fin kFin p) (i : Option (Fin k)) (t : Fin p) :
                                                                                                            |rawLocalBasis root i t| 1

                                                                                                            Every unnormalized local basis value has absolute value at most one.

                                                                                                            theorem LongGapsBetweenPrimes.abs_productBasis_le_one {α : Type u_1} [Fintype α] {Ω : αType u_2} {J : αType u_3} (f : (p : α) → J pΩ p) (hf : ∀ (p : α) (i : J p) (t : Ω p), |f p i t| 1) (σ : (p : α) → J p) (t : (p : α) → Ω p) :

                                                                                                            A product of local basis values bounded by one is bounded by one.

                                                                                                            Coefficients bounded by one give tuple amplitudes bounded by one.

                                                                                                            theorem LongGapsBetweenPrimes.prime_dvd_assignmentProduct {P k : } (σ : PrimeIndex POption (Fin k)) (p : PrimeIndex P) (hp : (σ p).isSome = true) :
                                                                                                            p assignmentProduct (fun (p : PrimeIndex P) => p) σ

                                                                                                            Every assigned prime divides the assignment product.

                                                                                                            theorem LongGapsBetweenPrimes.basisProduct_mod_invariant {P k : } (f : (p : PrimeIndex P) → Option (Fin k)Fin p) (hf : ∀ (p : PrimeIndex P) (t : Fin p), f p none t = 1) (σ : PrimeIndex POption (Fin k)) (n : ) :
                                                                                                            productBasis f σ (residueVector P (n % assignmentProduct (fun (p : PrimeIndex P) => p) σ)) = productBasis f σ (residueVector P n)

                                                                                                            A product basis function depends only on the residue modulo its assignment product.

                                                                                                            noncomputable def LongGapsBetweenPrimes.basisWeight (P k : ) (D : ) (f : (p : PrimeIndex P) → Option (Fin k)Fin p) (t : (p : PrimeIndex P) → Fin p) :

                                                                                                            The truncated tuple sum formed from an arbitrary family of local basis functions.

                                                                                                            Equations
                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                            Instances For
                                                                                                              theorem LongGapsBetweenPrimes.basisWeight_interval_error {P k T : } (hP : Squarefree P) (hT : 0 < T) {D : } (hD : 1 D) (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (hcoeff : dP.divisors, |coefficient P d| 1) (f : (p : PrimeIndex P) → Option (Fin k)Fin p) (hfnone : ∀ (p : PrimeIndex P) (t : Fin p), f p none t = 1) (hf : ∀ (p : PrimeIndex P) (i : Option (Fin k)) (t : Fin p), |f p i t| 1) :
                                                                                                              |(integerAverage T fun (n : ) => basisWeight P k D f (residueVector P n) ^ 2) - Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => basisWeight P k D f t ^ 2| 16 * D ^ 6 / T

                                                                                                              A D^6/T error is sufficient after taking κ = 1/8 in the final parameter choice.

                                                                                                              theorem LongGapsBetweenPrimes.residueWeight_interval_error {P k T : } (hP : Squarefree P) (hT : 0 < T) {D : } (hD : 1 D) (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (hcoeff : dP.divisors, |coefficient P d| 1) :
                                                                                                              |(integerAverage T fun (n : ) => residueWeight P k D root (residueVector P n) ^ 2) - Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => residueWeight P k D root t ^ 2| 16 * D ^ 6 / T

                                                                                                              The residue weight's second-moment averaging error is at most 16 * D ^ 6 / T.

                                                                                                              Every divisor tuple has positive product.

                                                                                                              Inserting a divisor multiplies the tuple product by that divisor.

                                                                                                              theorem LongGapsBetweenPrimes.tuplePairwise_insertNth {P k : } (i : Fin (k + 1)) (d : DivisorIndex P) (r : DivisorTuple P k) :
                                                                                                              (∀ (j l : Fin (k + 1)), j l(↑(i.insertNth d r j)).Coprime (i.insertNth d r l)) (∀ (j l : Fin k), j l(↑(r j)).Coprime (r l)) (↑d).Coprime (tupleProduct r)

                                                                                                              Insertion preserves pairwise coprimality iff the new divisor is coprime to the rest.

                                                                                                              theorem LongGapsBetweenPrimes.tupleRegion_insertNth {P k : } (i : Fin (k + 1)) (d : DivisorIndex P) (r : DivisorTuple P k) (D : ) :
                                                                                                              i.insertNth d r tupleRegion P (k + 1) D r tupleRegion P k D d D / (tupleProduct r) (↑d).Coprime (tupleProduct r)

                                                                                                              Characterize truncated-region membership after inserting one divisor.

                                                                                                              theorem LongGapsBetweenPrimes.tupleSum_split {P k : } (i : Fin (k + 1)) (D : ) (G : Fin (k + 1)DivisorIndex P) :
                                                                                                              rtupleRegion P (k + 1) D, j : Fin (k + 1), G j (r j) = rtupleRegion P k D, (∑ d : DivisorIndex P, if d D / (tupleProduct r) (↑d).Coprime (tupleProduct r) then G i d else 0) * j : Fin k, G (i.succAbove j) (r j)

                                                                                                              Split a truncated tuple sum by one coordinate.

                                                                                                              noncomputable def LongGapsBetweenPrimes.coefficientRemainder (P m : ) (D : ) :

                                                                                                              The partial coefficient sum over small divisors coprime to m.

                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                theorem LongGapsBetweenPrimes.coefficientRemainder_eq_sum (P m : ) (D : ) :
                                                                                                                coefficientRemainder P m D = d : DivisorIndex P, if d D / m (↑d).Coprime m then coefficient P d / (↑d).totient else 0

                                                                                                                Express the coefficient remainder as a sum over divisor indices.

                                                                                                                def LongGapsBetweenPrimes.coordinateBasis {P k : } (f : (p : PrimeIndex P) → Option (Fin k)Fin p) (d : DivisorIndex P) (i : Fin k) (t : (p : PrimeIndex P) → Fin p) :

                                                                                                                The local basis product for one divisor and tuple coordinate.

                                                                                                                Equations
                                                                                                                Instances For
                                                                                                                  theorem LongGapsBetweenPrimes.productBasis_tupleAssignment {P k : } (f : (p : PrimeIndex P) → Option (Fin k)Fin p) (hf : ∀ (p : PrimeIndex P) (t : Fin p), f p none t = 1) (r : DivisorTuple P k) (hr : ∀ (i j : Fin k), i j(↑(r i)).Coprime (r j)) (t : (p : PrimeIndex P) → Fin p) :
                                                                                                                  productBasis f (tupleAssignment r) t = i : Fin k, coordinateBasis f (r i) i t

                                                                                                                  Factor a tuple's product basis function over its coordinates.

                                                                                                                  theorem LongGapsBetweenPrimes.basisWeight_eq_tupleSum {P k : } (D : ) (f : (p : PrimeIndex P) → Option (Fin k)Fin p) (hf : ∀ (p : PrimeIndex P) (t : Fin p), f p none t = 1) (t : (p : PrimeIndex P) → Fin p) :
                                                                                                                  basisWeight P k D f t = rtupleRegion P k D, i : Fin k, coefficient P (r i) * coordinateBasis f (r i) i t

                                                                                                                  Expand a basis weight as a sum of products over tuple coordinates.

                                                                                                                  noncomputable def LongGapsBetweenPrimes.replacedLocalBasis {p k : } (root : Fin kFin p) (i : Fin k) (j : Option (Fin k)) (t : Fin p) :

                                                                                                                  The local basis with coordinate i replaced by the constant 1 / (p - 1).

                                                                                                                  Equations
                                                                                                                  Instances For
                                                                                                                    theorem LongGapsBetweenPrimes.coordinateBasis_replaced {P k : } (hP : Squarefree P) (root : (p : PrimeIndex P) → Fin kFin p) (i j : Fin k) (d : DivisorIndex P) (t : (p : PrimeIndex P) → Fin p) :
                                                                                                                    coordinateBasis (fun (p : PrimeIndex P) => replacedLocalBasis (root p) i) d j t = if j = i then 1 / (↑d).totient else coordinateBasis (fun (p : PrimeIndex P) => rawLocalBasis (root p)) d j t

                                                                                                                    Replacing a coordinate reduces its divisor basis factor to the reciprocal totient.

                                                                                                                    noncomputable def LongGapsBetweenPrimes.replacedResidueWeight (P k : ) (D : ) (root : (p : PrimeIndex P) → Fin kFin p) (i : Fin k) (t : (p : PrimeIndex P) → Fin p) :

                                                                                                                    The residue weight with one marked coordinate replaced by constants.

                                                                                                                    Equations
                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                    Instances For
                                                                                                                      theorem LongGapsBetweenPrimes.replacedResidueWeight_split {P k : } (hP : Squarefree P) (D : ) (root : (p : PrimeIndex P) → Fin (k + 1)Fin p) (i : Fin (k + 1)) (t : (p : PrimeIndex P) → Fin p) :
                                                                                                                      replacedResidueWeight P (k + 1) D root i t = rtupleRegion P k D, coefficientRemainder P (tupleProduct r) D * j : Fin k, coefficient P (r j) * coordinateBasis (fun (p : PrimeIndex P) => rawLocalBasis fun (j : Fin k) => root p (i.succAbove j)) (r j) j t

                                                                                                                      Split the replaced weight into smaller tuples and coefficient remainders.

                                                                                                                      theorem LongGapsBetweenPrimes.coefficient_noncoprime_le {P m : } (hP : 1 < P) (hsq : Squarefree P) (hm : m P) (hcoeff : dP.divisors, |coefficient P d| 1) :
                                                                                                                      dP.divisors with ¬d.Coprime m, |coefficient P d| / d.totient pm.primeFactors, 4 / p

                                                                                                                      Bound the coefficient mass of divisors sharing a prime with m by a prime sum.

                                                                                                                      theorem LongGapsBetweenPrimes.sum_primeFactors_inv_le {P m : } (hP : Squarefree P) (hm : m P) {M : } (hM : 0 < M) (hmin : pP.primeFactors, M p) :
                                                                                                                      pm.primeFactors, 4 / p 4 * Real.log m / (M * Real.log 2)

                                                                                                                      A lower bound on prime factors controls their reciprocal sum using log m.

                                                                                                                      theorem LongGapsBetweenPrimes.coefficientRemainder_nonneg {P m : } (hP : 1 < P) (hm : 0 < m) {D : } (hcut : m D) :

                                                                                                                      The coefficient remainder is nonnegative when its cutoff includes one.

                                                                                                                      theorem LongGapsBetweenPrimes.coefficient_tail_le {P : } {v β : } (hv : 1 v) ( : 0 β) :
                                                                                                                      dP.divisors with v < d, |coefficient P d| / d.totient v ^ (-β) * coefficientAbsMoment P β

                                                                                                                      Rankin's bound for the absolute coefficient tail.

                                                                                                                      theorem LongGapsBetweenPrimes.coefficientRemainder_le_tail_add_overlap {P m : } (hP : 1 < P) (hm : 0 < m) {D : } (hcut : m D) :
                                                                                                                      coefficientRemainder P m D dP.divisors with D / m < d, |coefficient P d| / d.totient + dP.divisors with ¬d.Coprime m, |coefficient P d| / d.totient

                                                                                                                      Bound the coefficient remainder by the discarded tail and noncoprime mass.

                                                                                                                      theorem LongGapsBetweenPrimes.coefficientRemainder_le {P m : } {β C D M : } (h : CoefficientEstimates P β C) ( : 0 β) (hm : m P) (hcut : m D) (hM : 0 < M) (hmin : pP.primeFactors, M p) :
                                                                                                                      coefficientRemainder P m D C * (m / D) ^ β + 4 * Real.log D / (M * Real.log 2)

                                                                                                                      Bound the coefficient remainder by a power tail and an error from shared primes.

                                                                                                                      theorem LongGapsBetweenPrimes.assignment_row_bound_all {α : Type u_1} [Fintype α] (size : α) {k : } (σ : αOption (Fin k)) {M D : } (hM : 1 < M) (hsize : ∀ (p : α), M (size p)) (hcut : (assignmentProduct size σ) D) :
                                                                                                                      p : α, localRow (size p) k (σ p) Real.exp (k * Real.log D / ((M - 1) * Real.log M))

                                                                                                                      An exponential assignment row bound valid for every tuple length.

                                                                                                                      noncomputable def LongGapsBetweenPrimes.weightedResidueWeight (P k : ) (D : ) (root : (p : PrimeIndex P) → Fin kFin p) (b : DivisorTuple P k) (t : (p : PrimeIndex P) → Fin p) :

                                                                                                                      The residue weight with an additional weight on each divisor tuple.

                                                                                                                      Equations
                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                      Instances For
                                                                                                                        theorem LongGapsBetweenPrimes.weightedResidueWeight_eq_sum {P k : } (D : ) (root : (p : PrimeIndex P) → Fin kFin p) (b : DivisorTuple P k) (t : (p : PrimeIndex P) → Fin p) :
                                                                                                                        weightedResidueWeight P k D root b t = rtupleRegion P k D, b r * i : Fin k, coefficient P (r i) * coordinateBasis (fun (p : PrimeIndex P) => rawLocalBasis (root p)) (r i) i t

                                                                                                                        Expand the weighted residue sum as a product over tuple coordinates.

                                                                                                                        theorem LongGapsBetweenPrimes.weightedResidueWeight_second_moment_le {P k : } (hP : Squarefree P) {D M : } (hM : 1 < M) (hmin : pP.primeFactors, M p) (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (b : DivisorTuple P k) :
                                                                                                                        (Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => weightedResidueWeight P k D root b t ^ 2) Real.exp (k * Real.log D / ((M - 1) * Real.log M)) * rtupleRegion P k D, tupleMass r * b r ^ 2

                                                                                                                        Bound the weighted second moment by the Gram factor times its diagonal mass.

                                                                                                                        theorem LongGapsBetweenPrimes.replacedResidueWeight_eq_weighted {P k : } (hP : Squarefree P) (D : ) (root : (p : PrimeIndex P) → Fin (k + 1)Fin p) (i : Fin (k + 1)) (t : (p : PrimeIndex P) → Fin p) :
                                                                                                                        replacedResidueWeight P (k + 1) D root i t = weightedResidueWeight P k D (fun (p : PrimeIndex P) (j : Fin k) => root p (i.succAbove j)) (fun (r : DivisorTuple P k) => coefficientRemainder P (tupleProduct r) D) t

                                                                                                                        A replaced weight is a weight on smaller tuples with coefficient-remainder factors.

                                                                                                                        theorem LongGapsBetweenPrimes.weighted_diagonal_le {P k : } {D a b γ : } (ha : 0 a) (hb : 0 b) (v : DivisorTuple P k) (hv : rtupleRegion P k D, v r ^ 2 a * (tupleProduct r) ^ γ + b) :
                                                                                                                        rtupleRegion P k D, tupleMass r * v r ^ 2 a * coefficientMoment P γ ^ k + b * coefficientMoment P 0 ^ k

                                                                                                                        Control weighted diagonal mass by tilted and zero coefficient moments.

                                                                                                                        theorem LongGapsBetweenPrimes.coefficientRemainder_square_le {P m : } {β C D M : } (h : CoefficientEstimates P β C) ( : 0 β) (hm : m P) (hcut : m D) (hM : 0 < M) (hmin : pP.primeFactors, M p) :
                                                                                                                        coefficientRemainder P m D ^ 2 2 * C ^ 2 * D ^ (-(2 * β)) * m ^ (2 * β) + 2 * (4 * Real.log D / (M * Real.log 2)) ^ 2

                                                                                                                        Bound the squared coefficient remainder by its tail and overlap contributions.

                                                                                                                        theorem LongGapsBetweenPrimes.replacedResidueWeight_second_moment_le {P k : } {β C D M : } (h : CoefficientEstimates P β C) ( : 0 β) (hD : 0 < D) (hM : 1 < M) (hmin : pP.primeFactors, M p) (root : (p : PrimeIndex P) → Fin (k + 1)Fin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (i : Fin (k + 1)) :
                                                                                                                        (Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => replacedResidueWeight P (k + 1) D root i t ^ 2) Real.exp (k * Real.log D / ((M - 1) * Real.log M)) * (2 * C ^ 2 * D ^ (-(2 * β)) * coefficientMoment P (2 * β) ^ k + 2 * (4 * Real.log D / (M * Real.log 2)) ^ 2 * coefficientMoment P 0 ^ k)

                                                                                                                        Bound a replaced weight's second moment using tilted and zero coefficient moments.

                                                                                                                        theorem LongGapsBetweenPrimes.residueWeight_eq_replaced_of_uncovered {P k : } (D : ) (root : (p : PrimeIndex P) → Fin kFin p) (i : Fin k) (t : (p : PrimeIndex P) → Fin p) (hi : ∀ (p : PrimeIndex P), t p root p i) :
                                                                                                                        residueWeight P k D root t = replacedResidueWeight P k D root i t

                                                                                                                        Avoiding one coordinate's roots makes the original and replaced weights equal.

                                                                                                                        theorem LongGapsBetweenPrimes.abs_replacedLocalBasis_le_one {p k : } (hp : 1 < p) (root : Fin kFin p) (i : Fin k) (j : Option (Fin k)) (t : Fin p) :

                                                                                                                        Every replaced local basis value has absolute value at most one.

                                                                                                                        theorem LongGapsBetweenPrimes.replacedResidueWeight_interval_error {P k T : } (hP : Squarefree P) (hT : 0 < T) {D : } (hD : 1 D) (root : (p : PrimeIndex P) → Fin kFin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (hcoeff : dP.divisors, |coefficient P d| 1) (i : Fin k) :
                                                                                                                        |(integerAverage T fun (n : ) => replacedResidueWeight P k D root i (residueVector P n) ^ 2) - Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => replacedResidueWeight P k D root i t ^ 2| 16 * D ^ 6 / T

                                                                                                                        The replaced weight's second-moment averaging error is at most 16 * D ^ 6 / T.

                                                                                                                        theorem LongGapsBetweenPrimes.exists_simultaneous_root_of_moments {P k T : } {D L U : } (root : (p : PrimeIndex P) → Fin kFin p) (hlower : L integerAverage T fun (n : ) => residueWeight P k D root (residueVector P n) ^ 2) (hupper : ∀ (i : Fin k), (integerAverage T fun (n : ) => replacedResidueWeight P k D root i (residueVector P n) ^ 2) U) (hgap : k * U < L) :
                                                                                                                        n < T, ∀ (i : Fin k), ∃ (p : PrimeIndex P), residueVector P n p = root p i

                                                                                                                        A second-moment gap yields an integer meeting a root in every coordinate.

                                                                                                                        Any coefficient-estimate constant is at least one.

                                                                                                                        noncomputable def LongGapsBetweenPrimes.gramBound (k : ) (M D : ) :

                                                                                                                        The exponential factor controlling Gram matrix row sums.

                                                                                                                        Equations
                                                                                                                        Instances For
                                                                                                                          noncomputable def LongGapsBetweenPrimes.uncoveredBound (k : ) (β C M D : ) :

                                                                                                                          A normalized second-moment bound for a replaced residue weight.

                                                                                                                          Equations
                                                                                                                          Instances For
                                                                                                                            theorem LongGapsBetweenPrimes.uncoveredBound_nonneg (k : ) (β C M : ) {D : } (hD : 0 D) :
                                                                                                                            0 uncoveredBound k β C M D

                                                                                                                            The normalized uncovered bound is nonnegative.

                                                                                                                            theorem LongGapsBetweenPrimes.replacedResidueWeight_normalized_bound {P k : } {β C D M : } (h : CoefficientEstimates P β C) ( : 0 β) (hD : 0 < D) (hM : 1 < M) (hmin : pP.primeFactors, M p) (root : (p : PrimeIndex P) → Fin (k + 1)Fin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (i : Fin (k + 1)) :
                                                                                                                            (Finset.univ.expect fun (t : (p : PrimeIndex P) → Fin p) => replacedResidueWeight P (k + 1) D root i t ^ 2) uncoveredBound k β C M D * coefficientMoment P 0 ^ k

                                                                                                                            Bound a replaced weight's second moment by uncoveredBound times the zero moment.

                                                                                                                            theorem LongGapsBetweenPrimes.diagonalMass_normalized_lower {P M k : } {β C D : } (h : CoefficientEstimates P β C) ( : 0 β) (hD : 0 < D) (hM : 0 < M) (hmin : pP.primeFactors, M < p) :
                                                                                                                            (1 - (D ^ (-β) * Real.exp (k * C * β) + 16 * k ^ 2 / M)) * coefficientMoment P 0 ^ k diagonalMass P k D

                                                                                                                            The normalized diagonal mass loses only a power tail and prime collisions.

                                                                                                                            theorem LongGapsBetweenPrimes.finite_simultaneous_roots {P M k T : } {β C D : } (h : CoefficientEstimates P β C) ( : 0 β) (hD : 1 D) (hM : 1 < M) (hT : 0 < T) (hmin : pP.primeFactors, M < p) (root : (p : PrimeIndex P) → Fin (k + 1)Fin p) (hroot : ∀ (p : PrimeIndex P), Function.Injective (root p)) (htail : D ^ (-β) * Real.exp (↑(k + 1) * C * β) + 16 * ↑(k + 1) ^ 2 / M 1 / 2) (hgram : gramBound (k + 1) (↑M) D 5 / 4) (herr : 16 * D ^ 6 / T 1 / 8) (hbad : ↑(k + 1) * (uncoveredBound k β C (↑M) D + 16 * D ^ 6 / T) < 1 / 4) :
                                                                                                                            n < T, ∀ (i : Fin (k + 1)), ∃ (p : PrimeIndex P), residueVector P n p = root p i

                                                                                                                            The finite weighted sieve, with every numerical loss displayed explicitly.

                                                                                                                            noncomputable def LongGapsBetweenPrimes.sieveD (x : ) :

                                                                                                                            The divisor-product cutoff exp (x / 8).

                                                                                                                            Equations
                                                                                                                            Instances For
                                                                                                                              noncomputable def LongGapsBetweenPrimes.sieveT (x : ) :

                                                                                                                              The averaging interval length, given by the integer part of exp x.

                                                                                                                              Equations
                                                                                                                              Instances For
                                                                                                                                theorem LongGapsBetweenPrimes.exp_neg_nat_mul_log {x : } (hx : 0 < x) (n : ) :
                                                                                                                                Real.exp (-n * Real.log x) = 1 / x ^ n

                                                                                                                                Rewrite exp (-n * log x) as 1 / x ^ n.

                                                                                                                                theorem LongGapsBetweenPrimes.truncated_exponential_le {n : } {x β C : } (hx : 0 < x) ( : 0 β) (hsize : n * C x / 16) (hlog : 48 * Real.log x x * β) :
                                                                                                                                sieveD x ^ (-β) * Real.exp (n * C * β) 1 / x ^ 3

                                                                                                                                The truncation tail is at most 1 / x ^ 3 under the sieve size bounds.

                                                                                                                                theorem LongGapsBetweenPrimes.truncated_double_exponential_le {n : } {x β C : } (hx : 0 < x) ( : 0 β) (hsize : n * C x / 16) (hlog : 48 * Real.log x x * β) :
                                                                                                                                sieveD x ^ (-(2 * β)) * Real.exp (n * C * (2 * β)) 1 / x ^ 6

                                                                                                                                The truncation tail with doubled exponent is at most 1 / x ^ 6.

                                                                                                                                theorem LongGapsBetweenPrimes.gramBound_le_simple {n : } {M x : } (hx : 1 x) (hn : n x) (hM : x ^ 4 M - 1) (hlog : 1 Real.log M) :
                                                                                                                                gramBound n M (sieveD x) Real.exp (1 / x ^ 2)

                                                                                                                                Bound the Gram factor by exp (1 / x ^ 2).

                                                                                                                                theorem LongGapsBetweenPrimes.collisionBound_le_simple {n : } {M x : } (hx : 0 < x) (hn : n x) (hM : x ^ 4 M) :
                                                                                                                                16 * n ^ 2 / M 16 / x ^ 2

                                                                                                                                The collision contribution is at most 16 / x ^ 2.

                                                                                                                                theorem LongGapsBetweenPrimes.overlapBound_le_simple {M x : } (hx : 0 < x) (hM : x ^ 4 M) :
                                                                                                                                4 * Real.log (sieveD x) / (M * Real.log 2) 1 / (Real.log 2 * x ^ 3)

                                                                                                                                The overlap contribution is at most 1 / (log 2 * x ^ 3).

                                                                                                                                theorem LongGapsBetweenPrimes.uncoveredBound_le_simple {n : } {M x β C : } (hx : 1 x) ( : 0 β) (hn : n x) (hsize : n * C x / 16) (hlog : 48 * Real.log x x * β) (hM : x ^ 4 M - 1) (hlogM : 1 Real.log M) (hgram : Real.exp (1 / x ^ 2) 5 / 4) :
                                                                                                                                uncoveredBound n β C M (sieveD x) 5 / 4 * (2 * C ^ 2 + 2 / Real.log 2 ^ 2) / x ^ 6

                                                                                                                                Bound the normalized uncovered contribution by an explicit multiple of 1 / x ^ 6.

                                                                                                                                theorem LongGapsBetweenPrimes.sieveZ_lower {x : } (hx : 2 x) :
                                                                                                                                x ^ 4 (sieveZ x) - 1

                                                                                                                                For x ≥ 2, the lower sieve cutoff exceeds x ^ 4 by at least one.

                                                                                                                                theorem LongGapsBetweenPrimes.sieveT_lower {x : } (hx : 2 x) :
                                                                                                                                Real.exp x / 2 (sieveT x)

                                                                                                                                The integer averaging length is at least half of exp x.

                                                                                                                                theorem LongGapsBetweenPrimes.intervalError_le_simple {x : } (hx : 2 x) (hlog : 12 * Real.log x x) :
                                                                                                                                16 * sieveD x ^ 6 / (sieveT x) 32 / x ^ 3

                                                                                                                                The interval averaging error is at most 32 / x ^ 3.

                                                                                                                                The sieve tilt eventually satisfies 48 * log xx * sieveBeta x.

                                                                                                                                theorem LongGapsBetweenPrimes.eventually_simple_sieve_bounds (C : ) :
                                                                                                                                ∀ᶠ (x : ) in Filter.atTop, Real.exp (1 / x ^ 2) 5 / 4 1 / x ^ 3 + 16 / x ^ 2 1 / 2 32 / x ^ 3 1 / 8 5 / 4 * (2 * C ^ 2 + 2 / Real.log 2 ^ 2) / x ^ 5 + 32 / x ^ 2 < 1 / 4

                                                                                                                                The numerical sieve error bounds hold for all sufficiently large x.

                                                                                                                                The density threshold for simultaneously hitting all root families.

                                                                                                                                Equations
                                                                                                                                Instances For

                                                                                                                                  The simultaneous-root density threshold is positive.

                                                                                                                                  The simultaneous-root density threshold is less than one half.

                                                                                                                                  theorem LongGapsBetweenPrimes.eventually_simultaneous_roots :
                                                                                                                                  ∀ᶠ (x : ) in Filter.atTop, ∀ (k : ), ↑(k + 1) sieveDelta * x∀ (root : (p : PrimeIndex (sieveP x)) → Fin (k + 1)Fin p), (∀ (p : PrimeIndex (sieveP x)), Function.Injective (root p))n < sieveT x, ∀ (i : Fin (k + 1)), ∃ (p : PrimeIndex (sieveP x)), residueVector (sieveP x) n p = root p i

                                                                                                                                  For large x, sufficiently small families of distinct roots can be hit simultaneously.

                                                                                                                                  The upper sieve cutoff is eventually below the primorial up to x.

                                                                                                                                  theorem LongGapsBetweenPrimes.exists_linear_roots {p k Q b : } (hp : Nat.Prime p) (hQ : Q.Coprime p) (s : Fin k) (hs : Function.Injective s) (hsmall : ∀ (i : Fin k), s i < p) :
                                                                                                                                  ∃ (root : Fin kFin p), Function.Injective root ∀ (n : ) (i : Fin k), n % p = (root i)p b + Q * (n + 1) + s i

                                                                                                                                  Construct distinct modular roots forcing divisibility of the translated linear forms.

                                                                                                                                  theorem LongGapsBetweenPrimes.short_translates_with_sieveDelta :
                                                                                                                                  ∀ᶠ (x : ) in Filter.atTop, ∀ (H : ), x < HH x * Real.log x ^ 2SFinset.Icc 1 H, S.card sieveDelta * xb < primorial x⌋₊, ∃ (t : ), 1 t t Real.exp x sS, ¬Nat.Prime (b + primorial x⌋₊ * t + s)

                                                                                                                                  Proposition 1.2, proved with the explicit coefficient construction above.

                                                                                                                                  The sparse-set translation bound of Proposition 1.2.

                                                                                                                                  A uniform geometric factor for the smooth-number estimate.

                                                                                                                                  Equations
                                                                                                                                  Instances For

                                                                                                                                    The smooth Euler constant is positive.

                                                                                                                                    The scale constant used to choose the smoothness cutoff and tilt.

                                                                                                                                    Equations
                                                                                                                                    Instances For

                                                                                                                                      The smoothness scale constant is positive.

                                                                                                                                      theorem LongGapsBetweenPrimes.euler_factor_left_comparison {p t : } (hp : 2 p) (ht : 0 t) (ht' : t 1 / 2) :
                                                                                                                                      (1 - p ^ (-(1 - t)))⁻¹ (1 - p ^ (-1))⁻¹ * Real.exp (smoothEulerConstant * (p ^ t - 1) / p)

                                                                                                                                      Bound the cost of shifting an Euler factor to exponent 1 - t.

                                                                                                                                      theorem LongGapsBetweenPrimes.eulerProduct_left_comparison (N : ) {t : } (ht : 0 t) (ht' : t 1 / 2) :
                                                                                                                                      eulerProduct N (1 - t) eulerProduct N 1 * Real.exp (smoothEulerConstant * pN.primesLE, (p ^ t - 1) / p)

                                                                                                                                      Bound the cost of shifting the Euler product to exponent 1 - t.

                                                                                                                                      theorem LongGapsBetweenPrimes.rpow_secant_log {p z t : } (hp : 1 p) (hpz : p z) (hz : 1 < z) (ht : 0 t) :
                                                                                                                                      p ^ t - 1 Real.log p / Real.log z * (Real.exp (t * Real.log z) - 1)

                                                                                                                                      A secant bound controls p ^ t - 1 using the ratio log p / log z.

                                                                                                                                      theorem LongGapsBetweenPrimes.eulerProduct_left_bound {N : } {z t : } (hN : 2 N) (hNz : N z) (ht : 0 t) (ht' : t 1 / 2) :

                                                                                                                                      Bound the shifted Euler product using the tilt and the largest prime cutoff.

                                                                                                                                      theorem LongGapsBetweenPrimes.smooth_count_rankin {N H : } {σ : } ( : 0 < σ) (S : Finset ) (hS : SFinset.Icc 1 H) (hsmooth : nS, n (N + 1).smoothNumbers) :
                                                                                                                                      S.card H ^ σ * eulerProduct N σ

                                                                                                                                      A finite Euler-product bound for the count of smooth integers up to H.

                                                                                                                                      noncomputable def LongGapsBetweenPrimes.coverLogZ (x : ) :

                                                                                                                                      The logarithmic smoothness cutoff in the covering construction.

                                                                                                                                      Equations
                                                                                                                                      Instances For
                                                                                                                                        noncomputable def LongGapsBetweenPrimes.coverZ (x : ) :

                                                                                                                                        The smoothness cutoff in the covering construction, rounded down to an integer.

                                                                                                                                        Equations
                                                                                                                                        Instances For
                                                                                                                                          noncomputable def LongGapsBetweenPrimes.coverW (x : ) :

                                                                                                                                          The small-prime cutoff, given by the integer part of (log x)^4.

                                                                                                                                          Equations
                                                                                                                                          Instances For
                                                                                                                                            noncomputable def LongGapsBetweenPrimes.coverTilt (x : ) :

                                                                                                                                            The Rankin tilt used to count smooth integers.

                                                                                                                                            Equations
                                                                                                                                            Instances For
                                                                                                                                              noncomputable def LongGapsBetweenPrimes.coverLength (η x : ) :

                                                                                                                                              The integer interval length targeted by the covering argument.

                                                                                                                                              Equations
                                                                                                                                              Instances For

                                                                                                                                                The smoothness scale constant exceeds ten.

                                                                                                                                                The covering tilt times the logarithmic cutoff equals the third iterated logarithm.

                                                                                                                                                The size, ordering, and tilt bounds for the covering parameters hold eventually.

                                                                                                                                                The small-prime cutoff does not exceed the smoothness cutoff.

                                                                                                                                                The smoothness cutoff is at most the integer part of x.

                                                                                                                                                The small-prime cutoff is at least two when log x ≥ 2.

                                                                                                                                                theorem LongGapsBetweenPrimes.eventually_smooth_count :
                                                                                                                                                ∀ᶠ (x : ) in Filter.atTop, ∀ (H : ), x HSFinset.Icc 1 H, (∀ nS, ∀ (p : ), Nat.Prime pp np coverZ x)S.card H / Real.log x ^ 3

                                                                                                                                                Eventually, at most H / (log x)^3 integers up to H are coverZ x-smooth.

                                                                                                                                                theorem LongGapsBetweenPrimes.greedy_product_le {W Z : } (hW : 2 W) (hWZ : W Z) :
                                                                                                                                                pauxiliaryPrimes W Z, (1 - 1 / p) Real.exp 6 * (1 + Real.log W) / Real.log Z

                                                                                                                                                A logarithmic upper bound for the product of greedy survival factors.

                                                                                                                                                The chosen cutoffs give an explicit bound for the greedy survival product.

                                                                                                                                                Primes assigned residue zero before the greedy covering step.

                                                                                                                                                Equations
                                                                                                                                                Instances For
                                                                                                                                                  noncomputable def LongGapsBetweenPrimes.zeroSurvivors (x : ) (H : ) :

                                                                                                                                                  Integers in [1, H] surviving the initial zero-residue sieve.

                                                                                                                                                  Equations
                                                                                                                                                  Instances For
                                                                                                                                                    theorem LongGapsBetweenPrimes.combine_greedy_residues (S ps₀ ps₁ ps : Finset ) (h₀ : ps₀ps) (h₁ : ps₁ps) (hdisj : Disjoint ps₀ ps₁) (hpos : pps, 0 < p) :
                                                                                                                                                    ∃ (a : ), (∀ pps, a p < p) (survivors S ps a).card (survivors S ps₀ fun (x : ) => 0).card * pps₁, (1 - 1 / p)

                                                                                                                                                    Combine a zero-residue sieve with greedy choices on a disjoint set of moduli.

                                                                                                                                                    theorem LongGapsBetweenPrimes.zeroSurvivors_prime_or_smooth {x : } {H n : } (hx : 0 < x) (hsmall : 2 * H < x * (coverW x)) (hn : n zeroSurvivors x H) :
                                                                                                                                                    Nat.Prime n ∀ (p : ), Nat.Prime pp np coverZ x

                                                                                                                                                    A zero-sieve survivor is prime or has all prime factors at most the smoothness cutoff.

                                                                                                                                                    theorem LongGapsBetweenPrimes.coverW_large {x : } (hL : 2 Real.log x) :
                                                                                                                                                    2 * Real.log x ^ 2 < (coverW x)

                                                                                                                                                    The small-prime cutoff exceeds 2 * (log x)^2.

                                                                                                                                                    theorem LongGapsBetweenPrimes.eventually_zeroSurvivors_bound :
                                                                                                                                                    ∀ᶠ (x : ) in Filter.atTop, ∀ (H : ), x HH x * Real.log x ^ 2(zeroSurvivors x H).card (Real.log 4 + 2) * H / Real.log x

                                                                                                                                                    An explicit H / log x bound for the initial sieve's survivors.

                                                                                                                                                    noncomputable def LongGapsBetweenPrimes.coverScale (x : ) :

                                                                                                                                                    The real scale of the interval covered by the sieve.

                                                                                                                                                    Equations
                                                                                                                                                    Instances For

                                                                                                                                                      The covering length is the integer part of η * coverScale x.

                                                                                                                                                      The constant combining the initial sieve and greedy survival bounds.

                                                                                                                                                      Equations
                                                                                                                                                      Instances For

                                                                                                                                                        The combined covering constant is positive.

                                                                                                                                                        A covering scale small enough to meet the short-translate density threshold.

                                                                                                                                                        Equations
                                                                                                                                                        Instances For

                                                                                                                                                          The chosen covering scale is positive.

                                                                                                                                                          The chosen covering scale is at most one.

                                                                                                                                                          The combined covering bound fits within the sieve density threshold.

                                                                                                                                                          theorem LongGapsBetweenPrimes.eventually_coverLength_bounds {η : } ( : 0 < η) (hη1 : η 1) :
                                                                                                                                                          ∀ᶠ (x : ) in Filter.atTop, x < (coverLength η x) (coverLength η x) x * Real.log x ^ 2 η / 2 * coverScale x (coverLength η x)

                                                                                                                                                          Eventually, the rounded covering length has the required size and retains half its scale.

                                                                                                                                                          Every prime in the zero-residue sieve is at most x.

                                                                                                                                                          The zero-residue and greedy prime sets are disjoint.

                                                                                                                                                          For large x, residue classes leave at most sieveDelta * x integers uncovered.

                                                                                                                                                          Combining the covering with Proposition 1.2 produces the long prime gaps.

                                                                                                                                                          theorem LongGapsBetweenPrimes.half_log_le_log_div {u c : } (hu : 0 < u) (hc : 0 < c) (h : 2 * Real.log c Real.log u) :
                                                                                                                                                          Real.log u / 2 Real.log (u / c)

                                                                                                                                                          Dividing by c preserves at least half of log u when log u ≥ 2 * log c.

                                                                                                                                                          Rescaling by one eighth reduces coverScale by at most a factor of 64 eventually.

                                                                                                                                                          The prime-gap scale is the covering scale evaluated at log X.

                                                                                                                                                          Theorem 1.1: the unconditional long-gap bound in the paper.

                                                                                                                                                          Consecutive primes occur at adjacent indices in the prime enumeration.

                                                                                                                                                          theorem LongGapsBetweenPrimes.long_prime_gaps :
                                                                                                                                                          ∃ (c : ) (X₀ : ), 0 < c ∀ (X : ), X₀ X∃ (n : ), (Nat.nth Nat.Prime (n + 1)) < X c * (Real.log X * Real.log (Real.log X) ^ 2 * Real.log (Real.log (Real.log (Real.log X))) / Real.log (Real.log (Real.log X)) ^ 2) < (Nat.nth Nat.Prime (n + 1)) - (Nat.nth Nat.Prime n)

                                                                                                                                                          The long-prime-gap statement in the indexed form of Challenge.lean.