Documentation

Complexity.Algorithms.WordRAM.ThreeSum.ChanHe.Parameters

Native parameters for Chan–He preprocessing #

Original native programs and proofs. The parameter meanings are the existing finite mathematical Chan–He definitions, with magnitude bound 2U after the distinct-position frontend. All loops and arithmetic are instructions; the program is fixed for each exponent κ.

Main definitions #

Main results #

References #

A bound covering arithmetic, unsuccessful loop tests, and all output words.

Instances For
    @[reducible, inline]

    Unsigned input length.

    Instances For
      @[reducible, inline]

      Original magnitude bound U.

      Instances For
        @[reducible, inline]

        Label bits for magnitude bound 2U.

        Instances For
          @[reducible, inline]

          Recursion height.

          Instances For
            @[reducible, inline]

            Recursion fuel.

            Instances For
              @[reducible, inline]

              Number of desired primes.

              Instances For
                @[reducible, inline]

                Upper bound on candidate primes.

                Instances For
                  @[reducible, inline]

                  Common packed convolution length, 8m².

                  Instances For
                    @[reducible, inline]

                    Magnitude of the padding for the doubled frontend bound, 4U+1.

                    Instances For
                      @[reducible, inline]

                      Constant one.

                      Instances For
                        @[reducible, inline]

                        Constant two.

                        Instances For
                          @[reducible, inline]

                          Constant three.

                          Instances For
                            @[reducible, inline]

                            Constant four.

                            Instances For
                              @[reducible, inline]

                              Constant five.

                              Instances For
                                @[reducible, inline]

                                Constant eight.

                                Instances For
                                  @[reducible, inline]

                                  Input length plus two.

                                  Instances For
                                    @[reducible, inline]

                                    Consumed logarithm argument.

                                    Instances For
                                      @[reducible, inline]

                                      Floor logarithm of input length.

                                      Instances For
                                        @[reducible, inline]

                                        Integer square root of input length.

                                        Instances For
                                          @[reducible, inline]

                                          Number of desired primes plus one.

                                          Instances For
                                            @[reducible, inline]

                                            Arithmetic scratch.

                                            Instances For
                                              @[reducible, inline]

                                              Successor square-root counter.

                                              Instances For
                                                @[reducible, inline]

                                                Square of that counter.

                                                Instances For
                                                  @[reducible, inline]

                                                  Square-root test bound.

                                                  Instances For

                                                    Exact mathematical outputs; every output is an ordinary unsigned word.

                                                    Instances For

                                                      One header load, constants, and the polynomial base.

                                                      Instances For

                                                        Unroll only the fixed exponent, never the input length or word width.

                                                        Instances For

                                                          Register selection for a floor/ceiling logarithm with output dst.

                                                          Instances For

                                                            Register selection for successive squares.

                                                            Instances For

                                                              The instruction sequence after the power computation.

                                                              Instances For

                                                                Fixed 24-register native code for each fixed polynomial magnitude exponent.

                                                                Instances For

                                                                  An explicit charged bound, including all header reads, copies and setup. Halt adds one.

                                                                  Instances For
                                                                    theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Parameters.exec {w : ℕ} (κ : ℕ) (x : WordRAM.Data 24) (hfit : WordRAM.Fits w (Math.budget (x.mem 0) ((x.mem 0 + 2) ^ κ))) :
                                                                    ∃ (y : WordRAM.Data 24), WordRAM.ExecWithin w (program κ) x y (time κ (x.mem 0) ((x.mem 0 + 2) ^ κ)) ∧ Output (x.mem 0) ((x.mem 0 + 2) ^ κ) y ∧ y.mem = x.mem

                                                                    Read the native unsigned header and compute all parameters, preserving every memory cell. This local theorem is discharged from a logarithmic width in runs_input.

                                                                    A polynomial scale for bounding every parameter intermediate.

                                                                    Instances For

                                                                      A coarse polynomial bound; it also covers final unsuccessful root/log iterations.

                                                                      A single polynomial bound, with exponent affine in the fixed magnitude exponent.

                                                                      Positive logarithmic word-width threshold for the complete parameter computation.

                                                                      Instances For

                                                                        The width requirement is satisfiable even at empty input and exponent zero.

                                                                        Every local fit premise follows from the positive logarithmic width.

                                                                        theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Parameters.inputFits {κ w : ℕ} (input : List ℤ) (hw : width κ input.length ≤ w) (hvalues : ∀ z ∈ input, |z| ≤ ↑((input.length + 2) ^ κ)) :

                                                                        Signed-encoded inputs and the unsigned length header fit at the same width.

                                                                        theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Parameters.time_bound (κ n : ℕ) :
                                                                        time κ n ((n + 2) ^ κ) ≤ 5 * n.sqrt + (400 * κ + 3000) * Nat.clog 2 (n + 2)

                                                                        Explicit Oκ(√n + log(n+2)) instruction bound, valid also at n = 0,1,2.

                                                                        theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Parameters.runs_input {κ w : ℕ} (input : List ℤ) (hw : width κ input.length ≤ w) (hvalues : ∀ z ∈ input, |z| ≤ ↑((input.length + 2) ^ κ)) :
                                                                        ∃ (y : WordRAM.Data 24), ∃ t ≤ 5 * input.length.sqrt + (400 * κ + 3000) * Nat.clog 2 (input.length + 2), WordRAM.Runs w ((program κ).program packedLen) (WordRAM.State.init (List.map WordRAM.Signed.encode input)) { pc := (program κ).size, data := y } t ∧ Output input.length ((input.length + 2) ^ κ) y ∧ y.mem = (WordRAM.Data.init (List.map WordRAM.Signed.encode input)).mem ∧ WordRAM.Data.Bounded w y

                                                                        Native run from actual signed input initialization. No parameters or arithmetic routines are supplied as advice. The returned state identifies all outputs and keeps all input memory. The flat program has 24 registers and depends only on κ; halting adds one instruction.

                                                                        The number of native instructions in the finite structured code is affine in κ.

                                                                        The code is the same at every word width.

                                                                        theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Parameters.intermediates_polynomial {κ : ℕ} (input : List ℤ) (hvalues : ∀ z ∈ input, |z| ≤ ↑((input.length + 2) ^ κ)) {s : WordRAM.State 24} {t : ℕ} (hr : WordRAM.Runs (width κ input.length) ((program κ).program packedLen) (WordRAM.State.init (List.map WordRAM.Signed.encode input)) s t) :
                                                                        (∀ (i : Fin 24), s.data.regs i < (input.length + 2) ^ (40 * κ + 242)) ∧ ∀ (a : ℕ), s.data.mem a < (input.length + 2) ^ (40 * κ + 242)

                                                                        Canonical-width executions use only polynomially bounded integers, including memory addresses, loop counters, and final unsuccessful tests.