Documentation

Complexity.Algorithms.WordRAM.ThreeSum.ChanHe.TraversalProgram

Fixed native controller for one Chan–He recursion tree #

The controller pops actual seven-word records, skips zero fuel or empty inputs, computes the modulus, constructs the complete heavy and packed outputs, records the packed pointer, and pushes the three children. Children are pushed third, second, first so the existing native stack visits them in the mathematical preorder. Fresh allocations follow every live node; all earlier arrays, the prime bitmap, stack reservation and output table precede the heap.

This module defines executable code. Its correctness and resource proofs belong to the traversal development; these definitions alone do not certify a native preprocessing bound. The frontend and initialized-input composition remain separate.

Main definitions #

The native code is original and reuses the existing finite Chan–He construction.

The complete node kernels occupy registers 0–63.

Instances For
    @[reducible, inline]

    The supplied candidate-prime bound.

    Instances For
      @[reducible, inline]

      The supplied label-bit parameter.

      Instances For
        @[reducible, inline]

        The common input-magnitude bound of the tree.

        Instances For
          @[reducible, inline]

          The common number of packed four-cell groups.

          Instances For
            @[reducible, inline]

            The prime bitmap, retained below the heap.

            Instances For
              @[reducible, inline]

              The exact number of candidate primes.

              Instances For
                @[reducible, inline]

                The current fresh allocation base.

                Instances For
                  @[reducible, inline]

                  The reserved output-pointer table.

                  Instances For
                    @[reducible, inline]

                    Accumulated output count; this is not reset between roots.

                    Instances For
                      @[reducible, inline]

                      The reserved word-stack base.

                      Instances For
                        @[reducible, inline]

                        The reserved word-stack capacity, used by the safety specification.

                        Instances For
                          @[reducible, inline]

                          Controller constant zero.

                          Instances For
                            @[reducible, inline]

                            Controller constant one.

                            Instances For
                              @[reducible, inline]

                              Controller address temporary.

                              Instances For
                                @[reducible, inline]

                                The computed unsigned modulus.

                                Instances For

                                  The three computed heavy lengths.

                                  Instances For

                                    The three computed heavy bases.

                                    Instances For
                                      @[reducible, inline]

                                      Current packed-array base.

                                      Instances For
                                        @[reducible, inline]

                                        One-past-end of the current node allocation.

                                        Instances For

                                          Saved original descriptor words, outside both kernels and the stack dispatcher.

                                          Instances For

                                            Fourteen actual instructions deliver the modulus program's complete caller ABI.

                                            Instances For

                                              Ten actual copies deliver the complete node builder's caller ABI.

                                              Instances For

                                                Read the three actual count cells, record the packed pointer, and advance the fresh heap.

                                                Instances For

                                                  Complete actual native calls, with argument preparation, modulus copy and output delivery.

                                                  Instances For

                                                    Decrease fuel, retain both descriptors needed for restoration, and prepare the third child.

                                                    Instances For

                                                      Restore the third original descriptor and prepare the second child.

                                                      Instances For

                                                        Restore the second original descriptor and prepare the first child.

                                                        Instances For

                                                          Push third, second, first. Every child retains the two other original set descriptors.

                                                          Instances For

                                                            A popped record either skips exactly the mathematical guard or executes the complete node.

                                                            Instances For

                                                              The actual pending-word stack, including zero-fuel and empty entries, controls the loop.

                                                              Instances For

                                                                The complete finite native controller for one supplied root. It appends to the caller's output table, retaining the accumulated count and advancing the fresh allocation base.

                                                                Instances For

                                                                  The same finite controller is used at every admitted word width.

                                                                  The native controller has a fixed finite instruction list, independent of recursion fuel.

                                                                  Registers 109–127 are retained for the outer frontend-forest controller.