Documentation

LeanPool.KrafftSieve.OptimalWeights

Optimal Weights #

This module constructs the truly multidimensional optimal weights $\lambda$ for the Krafft Sieve and explores the properties of the resulting polynomial $P(x)$ and weight $W_\lambda(x)$.

noncomputable def KrafftSieve.basisCos (n : ) (S : Finset (Fin (w n))) (x : ZMod (q n)) :

Define the basis function for a subset of prime indices $S \subseteq \{1, \dots, w\}$. The basis function is the product of the 3rd harmonic cosines for each prime in $S$. $$ B_S(x) = \prod_{i \in S} \cos\left( \frac{6\pi x}{p_i} \right) $$

Equations
Instances For
    noncomputable def KrafftSieve.pMulti (n : ) (lambda : Finset (Fin (w n))) (x : ZMod (q n)) :

    Define the multidimensional polynomial $P(x)$ as a linear combination of the basis functions $B_S(x)$ with coefficients $\lambda_S$. $$ P(x) = \sum_{S \subseteq \{1, \dots, w\}} \lambda_S B_S(x) $$

    Equations
    Instances For
      noncomputable def KrafftSieve.wTrulyMulti (n : ) (lambda : Finset (Fin (w n))) (x : ZMod (q n)) :

      Define the truly multidimensional weight function $W_{\lambda}(x)$ as the square of the polynomial $P(x)$ restricted to the interval $\mathcal{A}_n$. $$ W_{\lambda}(x) = \begin{cases} (P(x))^2 & \text{if } x \in \mathcal{A}_n \\ 0 & \text{otherwise} \end{cases} $$

      Equations
      Instances For
        noncomputable def KrafftSieve.matrix1 (n : ) (S T : Finset (Fin (w n))) :

        Define the matrix $M_1$ corresponding to the first moment $sum1$. $M_1(S, T) = \sum_{x \in \mathcal{A}_n} B_S(x) B_T(x)$

        Equations
        Instances For
          noncomputable def KrafftSieve.matrix2 (n : ) (S T : Finset (Fin (w n))) :

          Define the matrix $M_2$ corresponding to the second moment $sum2$. $M_2(S, T) = \sum_{x \in \mathcal{A}_n} c(x) B_S(x) B_T(x)$

          Equations
          Instances For
            noncomputable def KrafftSieve.q1 (n : ) (lambda : Finset (Fin (w n))) :

            Define the quadratic form $q1(\lambda) = \lambda^T M_1 \lambda$.

            Equations
            Instances For
              noncomputable def KrafftSieve.q2 (n : ) (lambda : Finset (Fin (w n))) :

              Define the quadratic form $q2(\lambda) = \lambda^T M_2 \lambda$.

              Equations
              Instances For
                noncomputable def KrafftSieve.Ratio (n : ) (lambda : Finset (Fin (w n))) :

                Define the Rayleigh quotient $R(\lambda) = \frac{q2(\lambda)}{q1(\lambda)}$. Defined to be $\infty$ if $q1(\lambda) = 0$ (though $q1$ is positive definite on non-zero $\lambda$ if the basis is linearly independent on $evalInterval$).

                Equations
                Instances For
                  theorem KrafftSieve.W_truly_multi_nonneg (n : ) (lambda : Finset (Fin (w n))) (x : ZMod (q n)) :
                  wTrulyMulti n lambda x 0

                  The truly multidimensional weight function is non-negative everywhere.

                  theorem KrafftSieve.W_truly_multi_support (n : ) (lambda : Finset (Fin (w n))) (x : ZMod (q n)) (hx : x.valevalInterval n) :
                  wTrulyMulti n lambda x = 0

                  The truly multidimensional weight function is supported on $\mathcal{A}_n$.

                  theorem KrafftSieve.S_1_eq_Q_1 (n : ) (lambda : Finset (Fin (w n))) :
                  sum1 n (wTrulyMulti n lambda) = q1 n lambda

                  Lemma: The first moment $sum1$ of the truly multidimensional weight is equal to the quadratic form $q1$.

                  theorem KrafftSieve.S_2_eq_Q_2 (n : ) (lambda : Finset (Fin (w n))) :
                  sum2 n (wTrulyMulti n lambda) = q2 n lambda

                  Lemma: The second moment $sum2$ of the truly multidimensional weight is equal to the quadratic form $q2$.

                  theorem KrafftSieve.sufficiency_of_Q (n : ) (lambda : Finset (Fin (w n))) (h : q2 n lambda < q1 n lambda) :

                  Lemma: The existence of coefficients $\lambda$ such that $q2(\lambda) < q1(\lambda)$ is sufficient for Krafft Sufficiency.

                  Define the set of attainable ratios.

                  Equations
                  Instances For
                    noncomputable def KrafftSieve.muMin (n : ) :

                    Define $\mu_{min}(n)$ as the infimum of the attainable ratios.

                    Equations
                    Instances For

                      Theorem: If the minimum attainable ratio $\mu_{min}(n)$ is strictly less than 1, then the Krafft Sufficiency condition holds.

                      @[reducible, inline]
                      abbrev KrafftSieve.Idx (n : ) :

                      Abbreviation for the index set of the coefficients, which is the power set of prime indices.

                      Equations
                      Instances For

                        The kernel of the quadratic form $q1$.

                        Equations
                        Instances For
                          theorem KrafftSieve.Q_1_eq_zero_iff (n : ) (lambda : Idx n) :
                          q1 n lambda = 0 xevalInterval n, pMulti n lambda x = 0

                          Lemma: $q1(\lambda) = 0$ if and only if $P_{multi}(\lambda, x) = 0$ for all $x \in \mathcal{A}_n$.

                          theorem KrafftSieve.Q_1_nonneg (n : ) (lambda : Idx n) :
                          q1 n lambda 0

                          Lemma: $q1$ is non-negative for all $\lambda$.

                          def KrafftSieve.dotProduct (n : ) (u v : Idx n) :

                          Define the standard dot product on the space of coefficients.

                          Equations
                          Instances For

                            The orthogonal complement of the kernel of $q1$ with respect to the standard dot product.

                            Equations
                            Instances For
                              def KrafftSieve.spherePerp (n : ) :
                              Set (Idx n)

                              The unit sphere in the orthogonal complement of the kernel of $q1$.

                              Equations
                              Instances For
                                theorem KrafftSieve.Q_1_pos_on_sphere_perp (n : ) (lambda : Idx n) (h : lambda spherePerp n) :
                                q1 n lambda > 0

                                Lemma: $q1$ is strictly positive on the unit sphere of the orthogonal complement.

                                theorem KrafftSieve.Q_1_not_zero (n : ) :
                                ∃ (lambda : Idx n), q1 n lambda 0

                                Lemma: $q1$ is not identically zero.

                                theorem KrafftSieve.Ratio_scale (n : ) (lambda : Idx n) (c : ) (hc : c 0) :
                                Ratio n (c lambda) = Ratio n lambda

                                Lemma: The Rayleigh quotient is scale-invariant.

                                theorem KrafftSieve.sq_le_dot_product (n : ) (v : Idx n) (i : Idx n) :
                                v i ^ 2 dotProduct n v v

                                Lemma: For any vector $v$, the square of any component is bounded by the dot product.

                                theorem KrafftSieve.decomposition (n : ) (x : Idx n) :
                                ukernelQ1 n, vkernelQ1Perp n, x = u + v

                                Lemma: Any vector can be decomposed into a component in the kernel of $q1$ and a component in the orthogonal complement.

                                theorem KrafftSieve.P_multi_add (n : ) (u v : Idx n) (x : ZMod (q n)) :
                                pMulti n (u + v) x = pMulti n u x + pMulti n v x

                                Lemma: The polynomial $P_{multi}$ is linear in $\lambda$.

                                Lemma: The unit sphere in the orthogonal complement is compact.

                                theorem KrafftSieve.Q_2_add_kernel (n : ) (u v : Idx n) (hu : u kernelQ1 n) :
                                q2 n (u + v) = q2 n v

                                Lemma: If $u \in \text{kernel}(q1)$, then $q2(u + v) = q2(v)$.

                                theorem KrafftSieve.Ratio_add_kernel (n : ) (u v : Idx n) (hu : u kernelQ1 n) :
                                Ratio n (u + v) = Ratio n v

                                Lemma: The Rayleigh quotient is invariant under adding a vector from the kernel of $q1$.

                                theorem KrafftSieve.exists_sphere_perp_ratio_eq (n : ) (lambda : Idx n) (hQ1 : q1 n lambda > 0) :
                                vspherePerp n, Ratio n lambda = Ratio n v

                                Lemma: For any $\lambda$ with $q1(\lambda) > 0$, there exists $v \in \text{sphere\_perp}(n)$ such that $\text{Ratio}(n, \lambda) = \text{Ratio}(n, v)$.

                                Lemma: The set of attainable ratios is the image of the unit sphere in the orthogonal complement under the Rayleigh quotient map.

                                Lemma: The set of attainable ratios is compact.

                                theorem KrafftSieve.exists_minimizer (n : ) :
                                ∃ (lambda : Idx n), q1 n lambda > 0 Ratio n lambda = muMin n

                                Lemma: The minimum attainable ratio is attained by some coefficient vector $\lambda$.

                                noncomputable def KrafftSieve.lambdaOpt (n : ) :
                                Idx n

                                Define the optimal coefficient vector $\lambda_{opt}$ which attains the minimum ratio.

                                Equations
                                Instances For

                                  Properties of the optimal coefficient vector.

                                  noncomputable def KrafftSieve.wOpt (n : ) :
                                  ZMod (q n)

                                  Define the optimal truly multidimensional weight function $W_{opt}$.

                                  Equations
                                  Instances For

                                    Theorem: The optimal weight function satisfies the Krafft Sufficiency condition if and only if $\mu_{min}(n) < 1$.

                                    theorem KrafftSieve.krafft_sieve_guarantee_with_mu_min (n : ) (h : muMin n < 1) :
                                    xevalInterval n, Nat.Prime (6 * x - 1) Nat.Prime (6 * x + 1)

                                    Theorem: The Krafft Sieve Guarantee holds if $\mu_{min}(n) < 1$.