Documentation

Cayley.Checker.KPack

Kronecker-packed kernel checker #

A polynomial in t₀, …, t₄ with every exponent ≤ 2 is stored as the integer obtained by evaluating it at tᵢ = 2^(W·3ⁱ). This is a ring homomorphism, so polynomial arithmetic is a handful of big-integer operations, which the kernel evaluates with GMP. Coefficient statistics (constant term, sums of absolute values over a set of monomials) are read off with masks: after adding the offset 2^(W-1) to every slot, slot j holds coeff_j + 2^(W-1), its top bit is the sign, and a horizontal sum of slots is a remainder modulo 2^W - 1.

Slot width in bits.

Equations
Instances For

    2^PW - 1.

    Equations
    Instances For

      Layouts #

      Layout L3: tᵢ = 2^(PW·3ⁱ) (243 slots, exponents ≤ 2). Layout L5: t₀ = 2^PW, t₁ = 2^(5PW), t₂, t₃, t₄ = 2^(25PW), 2^(75PW), 2^(225PW) (675 slots, exponents ≤ 4 in t₀, t₁ and ≤ 2 in the others).

      def Cayley.K.pX (i : Nat) :

      The variable tᵢ of layout L3.

      Equations
      Instances For
        def Cayley.K.qX (i : Nat) :

        The variable tᵢ of layout L5.

        Equations
        Instances For
          def Cayley.K.geo3 (y : Nat) :

          1 + y + y² and 1 + y².

          Equations
          Instances For
            def Cayley.K.ev3 (y : Nat) :
            Equations
            Instances For
              def Cayley.K.geo5 (y : Nat) :

              1 + y + y² + y³ + y⁴ and 1 + y² + y⁴.

              Equations
              Instances For
                def Cayley.K.ev5 (y : Nat) :
                Equations
                Instances For

                  Slot indicators (Σ 2^(PW j) over all slots, and over the all-even monomials).

                  Instances For
                    Instances For
                      Instances For
                        Instances For

                          Statistics of a packed polynomial P: constant term, slack with P ≥ c0 − slack on [-1,1]⁵ (even monomials only count when negative), and abs with |P − c0| ≤ abs.

                          Instances For
                            @[inline]
                            def Cayley.K.pParts (ones N : Nat) :

                            Positive and negative parts of the slots of N = P + offset.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              def Cayley.K.pStatsL (ones evens : Nat) (P : Int) :
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Cayley.K.pLowerL (ones evens : Nat) (P : Int) :

                                Lower bound of a packed polynomial on [-1,1]⁵.

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

                                  Bernstein coefficients (layout L3) #

                                  On [-1,1] the quadratic Bernstein coefficients of a₀ + a₁t + a₂t² are (a₀ − a₁ + a₂, a₀ − a₂, a₀ + a₁ + a₂); baxis i applies this along variable i to every slot, and a polynomial is at least its least Bernstein coefficient. The transform works on the offset encoding (every slot holds coeff + 2^(PW-1)) in Nat arithmetic only, which the kernel evaluates much faster than Int.

                                  def Cayley.K.zL3 (i : Nat) :

                                  Slot indicator of the slots whose digit i is 0.

                                  Equations
                                  Instances For
                                    def Cayley.K.baxis (i N : Nat) :

                                    The Bernstein transform along variable i of an offset-encoded packed polynomial.

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

                                      The Bernstein coefficients of an offset-encoded packed polynomial.

                                      Equations
                                      Instances For
                                        def Cayley.K.bernGE (P m : Int) :

                                        Every Bernstein coefficient of the packed polynomial P is at least m.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          structure Cayley.K.GData (R : Type) :

                                          The per-box polynomials of a gap leaf, over any arithmetic: α₀, α₁, α₂ (outer rows, weighted by w), β = M N(r) S, κD, and the paired inner vector L (blown-up charts).

                                          • a0 : R
                                          • a1 : R
                                          • a2 : R
                                          • b0 : R
                                          • b1 : R
                                          • b2 : R
                                          • kd : R
                                          • l0 : R
                                          • l1 : R
                                          • l2 : R
                                          Instances For
                                            def Cayley.K.gChart {R : Type} (sub mul : R → R → R) (c : Int → R) (add : R → R → R) (chart : Nat) (y0 y1 y2 : R) :
                                            R × R × R

                                            M_j v; the Klein charts are sign flips.

                                            Equations
                                            Instances For
                                              def Cayley.K.gFace {R : Type} (face : Nat) (sg s0 s1 : R) :
                                              R × R × R

                                              The blow-up direction on cube face face, with sign entry sg.

                                              Equations
                                              Instances For
                                                def Cayley.K.gapCore {R : Type} (add sub mul : R → R → R) (c : Int → R) (x : Fin 5 → R) (chart face : Nat) (U : R) (cc hh : Nat → R) (sx sy sz w0 w1 : R) :

                                                The gap-leaf polynomials, generic in the arithmetic (x i is the variable tᵢ), with the box data (scale U, centres cc, radii hh), the inner vertex and the direction as inputs.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  def Cayley.K.gapGen {R : Type} (add sub mul : R → R → R) (c : Int → R) (x : Fin 5 → R) (b : KBox) (S : Int × Int × Int) (w0 w1 : Int) :

                                                  The gap-leaf polynomials of box b, inner vertex S and direction (w0, w1).

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    def Cayley.K.pGapData (b : KBox) (S : Int × Int × Int) (w0 w1 : Int) :

                                                    The gap-leaf data in packed integers.

                                                    Equations
                                                    Instances For
                                                      def Cayley.K.nrmOK (b : KBox) (w0 w1 : Int) :

                                                      The norm guard of a gap leaf: the box scale and the direction are small enough that the coefficient norms of every polynomial the leaf decodes stay below 2^390 (proved once, on the worst box, in Cayley.Pack.gapNrmOK_worst).

                                                      Equations
                                                      Instances For

                                                        Scale exponents of A and of L beyond 2^160.

                                                        Equations
                                                        Instances For
                                                          Equations
                                                          Instances For

                                                            The gap leaf #

                                                            def Cayley.K.gErr (b : KBox) (w0 w1 : Int) :

                                                            The error allowance of a gap leaf (for A) and of the paired test (for L).

                                                            Equations
                                                            Instances For
                                                              def Cayley.K.gErrL (b : KBox) (w0 w1 : Int) :
                                                              Equations
                                                              Instances For

                                                                A = Σ αₖ βₖ, L = Σ αₖ Lₖ, Eₖ = αₖ κD, F_T = A − (Σ Tₖ αₖ) κD.

                                                                Equations
                                                                Instances For
                                                                  Equations
                                                                  Instances For
                                                                    def Cayley.K.gF (g : GData Int) (tx ty tz : Int) :
                                                                    Equations
                                                                    Instances For
                                                                      def Cayley.K.fullOK (b : KBox) (S : Int × Int × Int) (w0 w1 tx ty tz : Int) :

                                                                      The exact test against outer vertex T, and the paired test.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        def Cayley.K.pairOK (b : KBox) (S : Int × Int × Int) (w0 w1 : Int) :
                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          def Cayley.K.gPair (b : KBox) (s : Nat) :

                                                                          The paired vertex of inner vertex s (blown-up charts).

                                                                          Equations
                                                                          Instances For
                                                                            def Cayley.K.vtestG (b : KBox) (s : Nat) (S : Int × Int × Int) (w0 w1 : Int) (t : Nat) (tx ty tz : Int) :

                                                                            The test of outer vertex t after the packed quick test (S is inner vertex s).

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

                                                                              Vertex s, read from the packed tables (cheaper in the kernel than indexing vtxI).

                                                                              Equations
                                                                              Instances For
                                                                                def Cayley.K.quickQ (b : KBox) (S : Int × Int × Int) (w0 w1 : Int) :

                                                                                The quick test's constant part c₀(A) − slack(A) − err, and the statistics of Eₖ.

                                                                                Equations
                                                                                Instances For
                                                                                  def Cayley.K.quickE (b : KBox) (S : Int × Int × Int) (w0 w1 : Int) :
                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    def Cayley.K.quickV (C e00 e01 e02 : Int) (n0 n1 n2 : Nat) :

                                                                                    The packed quick-test number: slot t is 2^639 + quick_T when the packing bounds hold.

                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      def Cayley.K.pGapOK (b : KBox) (s : Nat) (w0 w1 : Int) :

                                                                                      Packed kernel gap leaf.

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

                                                                                        Domain leaves #

                                                                                        @[reducible, inline]
                                                                                        Equations
                                                                                        Instances For
                                                                                          structure Cayley.K.NM (R : Type) :

                                                                                          A 3×3 matrix of polynomials and a scalar.

                                                                                          • n00 : R
                                                                                          • n01 : R
                                                                                          • n02 : R
                                                                                          • n10 : R
                                                                                          • n11 : R
                                                                                          • n12 : R
                                                                                          • n20 : R
                                                                                          • n21 : R
                                                                                          • n22 : R
                                                                                          • d : R
                                                                                          Instances For
                                                                                            def Cayley.K.numGen {R : Type} (add sub mul : R → R → R) (c : Int → R) (x : Fin 5 → R) (b : KBox) :
                                                                                            NM R

                                                                                            The Cayley numerator N(r) and the denominator D of a box, generic in the arithmetic.

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

                                                                                              The scale R² of N (U⁴ blown up, U² plain).

                                                                                              Equations
                                                                                              Instances For
                                                                                                def Cayley.K.trGen {R : Type} (add mul : R → R → R) (c : Int → R) (X : I9) (N : NM R) :
                                                                                                R

                                                                                                tr(Xᵀ N) = Σ X_ab N_ab for an integer matrix X.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For
                                                                                                  def Cayley.K.chartGen {R : Type} (add sub mul : R → R → R) (c : Int → R) (x : Fin 5 → R) (b : KBox) (k : Nat) :
                                                                                                  R

                                                                                                  The chart-test polynomial κⱼ tr((Mⱼᵀ M_k)ᵀ N) − κ_k tr((Mⱼᵀ Mⱼ)ᵀ N).

                                                                                                  Equations
                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                  Instances For
                                                                                                    def Cayley.K.orbC (g a : Nat) :

                                                                                                    C = M_a · 2^80 R̂z(g)ᵀ (integer).

                                                                                                    Equations
                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                    Instances For
                                                                                                      def Cayley.K.m3 {R : Type} (add mul : R → R → R) (c : Int → R) (M : I9) (N : NM R) :
                                                                                                      NM R

                                                                                                      M N for an integer matrix M (the scalar is kept).

                                                                                                      Equations
                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                      Instances For
                                                                                                        def Cayley.K.m3t {R : Type} (N : NM R) :
                                                                                                        NM R

                                                                                                        Transpose.

                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          def Cayley.K.frob {R : Type} (add mul : R → R → R) (H W : NM R) :
                                                                                                          R

                                                                                                          Σ_ab H_ab W_ab.

                                                                                                          Equations
                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                          Instances For
                                                                                                            def Cayley.K.hGen {R : Type} (add sub mul : R → R → R) (c : Int → R) (u v U : R) :
                                                                                                            NM R

                                                                                                            H = N_oᵀ diag(-1,-1,1) N_o for the outer numerator N_o = N(v, -u, 0)·U².

                                                                                                            Equations
                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                            Instances For
                                                                                                              def Cayley.K.orbGen {R : Type} (add sub mul : R → R → R) (c : Int → R) (x : Fin 5 → R) (b : KBox) (e g a : Nat) :
                                                                                                              R × R

                                                                                                              The two orbit-test polynomials (score of the orbit element minus the scores of Q).

                                                                                                              Equations
                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                              Instances For
                                                                                                                def Cayley.K.qXv (i : Fin 5) :

                                                                                                                The variables of layout L5.

                                                                                                                Equations
                                                                                                                Instances For
                                                                                                                  def Cayley.K.chartNrmOK (b : KBox) (k : Nat) :

                                                                                                                  The norm guard of a domain polynomial (the Nat instance).

                                                                                                                  Equations
                                                                                                                  Instances For
                                                                                                                    def Cayley.K.orbNrmOK (b : KBox) (e g a : Nat) :
                                                                                                                    Equations
                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                    Instances For
                                                                                                                      def Cayley.K.pChartOK (b : KBox) (k : Nat) :

                                                                                                                      Kernel chart test: chart k beats the box's chart j on the whole box.

                                                                                                                      Equations
                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                      Instances For
                                                                                                                        def Cayley.K.orbErr (b : KBox) (e : Nat) :

                                                                                                                        The orbit-test error allowance.

                                                                                                                        Equations
                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                        Instances For
                                                                                                                          def Cayley.K.pOrbitOK (b : KBox) (e g a : Nat) :

                                                                                                                          Kernel orbit test: the orbit element H^e Q ĝ_g (score base a) beats Q.

                                                                                                                          Equations
                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                          Instances For
                                                                                                                            def Cayley.K.pDomOK (b : KBox) (code : Nat) :

                                                                                                                            Packed kernel domain leaf.

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