Documentation

Complexity.Algorithms.WordRAM.ThreeSum.ChanHe.Modulus

Native setup of the two Chan–He prime searches #

The first search uses thresholds 3Λ|Sⱼ|². After saving its selected prime, native counting at that prime provides the second thresholds 3Λ coll Sⱼ p. Both searches use the complete prime scan and collision queries, including explicit positive signed-modulus encoding.

Main definitions #

Main results #

@[reducible, inline]

Collision divisor bound Λ.

Instances For
    @[reducible, inline]

    First selected candidate, or one if none qualifies.

    Instances For
      @[reducible, inline]

      Three times the collision divisor bound.

      Instances For
        @[reducible, inline]

        Unsigned product of the two selections, each defaulting to one.

        Instances For

          Charge all six square/threshold multiplications and the three scalar setup instructions.

          Instances For

            Charge all three second-threshold multiplications and their scalar setup.

            Instances For

              Run both concrete searches and compute their product. The prime table and its count are shared by all nodes and are supplied in the search ABI.

              Instances For

                The exact data after the first setup; memory is unchanged.

                Instances For
                  theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Modulus.exec_firstSetup {w : ℕ} (x : WordRAM.Data 64) (h3 : WordRAM.Fits w 3) (htriple : WordRAM.Fits w (3 * x.regs digits)) (hsq : ∀ (j : Fin 3), WordRAM.Fits w (x.regs (CountCall.length j) ^ 2)) (hcut : ∀ (j : Fin 3), WordRAM.Fits w (3 * x.regs digits * x.regs (CountCall.length j) ^ 2)) :

                  First-search thresholds are computed by nine actual native instructions.

                  The exact data after the second setup; memory is unchanged.

                  Instances For

                    Second-search thresholds are computed by six actual native instructions.

                    One polynomial bound for selector counters, thresholds and memory addresses.

                    Instances For

                      One search with its factor bounded by the largest candidate.

                      Instances For

                        Both searches, a baseline collision count, scalar setup and the final product.

                        Instances For
                          theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Modulus.exec {w : ℕ} (x : WordRAM.Data 64) (values : Fin 3 → ℕ → ℤ) (hm : 2 ≤ x.regs Search.limit) (hmod : GenericRAM.Signed.Fits w ↑(x.regs Search.limit ^ 2)) (hbudget : WordRAM.Fits (w + 2) (budget x)) (hcard : x.regs CollisionTest.card = (x.regs Search.limit).primesLE.card) (hbefore : x.regs Search.primes + (x.regs Search.limit + 1) ≤ x.regs CountCall.scratch) (hbitmap : ∀ q ≤ x.regs Search.limit, x.mem (x.regs Search.primes + q) = if Nat.Prime q then 1 else 0) (hvalues : ∀ (j : Fin 3), ∀ i < x.regs (CountCall.length j), GenericRAM.Signed.Fits w (values j i)) (hsk : ∀ (j : Fin 3), x.regs (CountCall.source j) + x.regs (CountCall.length j) ≤ x.regs CountCall.scratch) (hkd : ∀ (j : Fin 3), x.regs CountCall.scratch + x.regs (CountCall.length j) ≤ x.regs CountCall.histogram) (hinput : ∀ (j : Fin 3), ∀ i < x.regs (CountCall.length j), x.mem (x.regs (CountCall.source j) + i) = WordRAM.Signed.encode (values j i)) (hinj : ∀ (j : Fin 3), Set.InjOn (values j) ↑(Finset.range (x.regs (CountCall.length j)))) :

                          Compute exactly the existing Chan–He modulus with two complete native prime searches. The prime bitmap/count is a shared input built by PrimeTable.program. A single polynomial budget bounds selector counters, thresholds and addresses; input values and the maximum modulus fit the source width. The final halt is excluded.

                          The interface requires m ≥ 2 for a nonempty candidate-prime window. The intended preprocessing caller uses mPar n U = (wPar n U + 1) * (2 * log₂(wPar n U + 1) + 4) ≥ 4. The default-only window m = 1 is outside this interface, although the selector bounds extend to it; m = 0 fails the default-selector upper bound.

                          The finite selector program never reads the word width.