Documentation

Complexity.Algorithms.WordRAM.ThreeSum.ChanHe.NodeLayout

Disjoint memory layout for complete native Chan–He node construction #

Three supplied signed input arrays precede base. The allocated block consists of three count-prefixed heavy arrays (capacities n₀,n₁,n₂), the 4N packed cells, a reusable residue array of capacity n₀+n₁+n₂, and M histogram cells. Empty arrays still have a count cell.

Main definitions #

References #

This memory layout is an original implementation choice.

Runtime sizes and the fresh allocation base for one complete node.

  • base : ℕ

    The input arrays end no later than this address.

  • n : Fin 3 → ℕ

    The three supplied input lengths.

  • N : ℕ

    Common number of groups; the packed output has 4N cells.

  • M : ℕ

    Positive modulus, supplied by the parent prime search.

  • U : ℕ

    Bound on the magnitudes of this node's inputs.

Instances For

    Total input capacity, shared by the reusable residue workspace.

    Instances For

      Count cell immediately preceding a compact heavy array.

      Instances For

        Compact heavy output data starts one cell after its count.

        Instances For

          All three compact output capacities precede the packed array.

          Instances For

            A reusable residue array, after every permanent output.

            Instances For

              A reusable histogram, after the full residue capacity.

              Instances For

                One-past-end address of the complete allocated block.

                Instances For

                  The ordinary one-array tag, 3(2U+1)+1.

                  Instances For

                    Positive tag for the selected packed column.

                    Instances For

                      Polynomial envelope for all addresses, signed values, encodings and histogram counters. Its fixed constant also covers code labels and all setup constants.

                      Instances For

                        Each input fits the reusable residue capacity.

                        All three compact arrays and their count cells are disjoint, with the packed array next.

                        Every descriptor is inside its allocated output prefix.

                        Every descriptor precedes the packed array, including for empty inputs.

                        The allocated endpoint has a linear size formula.

                        Descriptor/capacity blocks end where the next one begins.

                        Every address and padding/tag value is covered by one polynomial envelope.

                        theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.NodePacking.Layout.count_budget_le (L : Layout) (j : Fin 3) (src t : ℕ) (hs : src ≤ L.base) (ht : t ≤ 4 * L.gap) :
                        src + L.scratch + L.hist + L.heavy j + L.packed + L.n j * L.n j + 2 * L.n j + L.M + 4 * L.N + 2 * t + 2 * L.U + 64 ≤ L.budget

                        The complete counting/placement call's budget is derived from the concrete node layout.

                        All three tags are positive, dominate the input magnitude, and fit the common tag bound.