Documentation

Complexity.Algorithms.WordRAM.MatrixMultiplication.Schonhage.Pruned.Program

Fixed native code for pruned tensor queries #

The controller uses an explicit depth-first stack. Query and value directories have one row per depth. A shared timestamp directory deduplicates child suffixes without clearing a dense array at every node. Encoded products and sums use the existing native signed kernels.

Main definitions #

Client execution interfaces are exec_kernel in Pruned.Kernel, runs and runs_bilinear in Pruned.Flat, and runs_wide in Pruned.Width. Other stage exec_* lemmas and controller invariants under Pruned/ are internal implementation APIs. They are public to compose proofs across the stage modules, rather than intended as independent caller contracts.

References #

The query-set recursion is from [AlmanWilliams2026, Section 2.4.2], selectively adapted from Anthropic's formal-math revision 16a5ce41304fcdaea4e0be7c132e1c361dc26da5, pinned source. The explicit iterative stack and timestamp implementation are new native code; the source machine is not imported.

@[reducible, inline]

The program has a fixed register bank, including nine signed-arithmetic scratch registers.

Instances For
    @[reducible, inline]

    Original tensor depth, loaded from the ordinary input header.

    Instances For
      @[reducible, inline]

      Computed encoding-array length and per-depth directory capacity, 10^L.

      Instances For
        @[reducible, inline]

        Pointer to the left canonical signed encoding array.

        Instances For
          @[reducible, inline]

          Pointer to the right canonical signed encoding array.

          Instances For
            @[reducible, inline]

            Pointer to the original unsigned query-code list, including repeats.

            Instances For
              @[reducible, inline]

              Number of supplied queries, before native deduplication.

              Instances For
                @[reducible, inline]

                Pointer to the answer list, in the original query order.

                Instances For
                  @[reducible, inline]

                  Caller-supplied start of the explicit stack and directory workspace.

                  Instances For
                    @[reducible, inline]

                    Current timestamp generation for native query deduplication.

                    Instances For
                      @[reducible, inline]

                      Pointer to the first four-word stack frame.

                      Instances For
                        @[reducible, inline]

                        Pointer to the first per-depth distinct-query row.

                        Instances For
                          @[reducible, inline]

                          Pointer to the first per-depth signed-value row.

                          Instances For
                            @[reducible, inline]

                            Pointer to the shared query-membership timestamp directory.

                            Instances For
                              @[reducible, inline]

                              Current stack depth, with zero denoting the root.

                              Instances For
                                @[reducible, inline]

                                Controller phase: zero for entry, one for dispatch, two for returned-child accumulation.

                                Instances For
                                  @[reducible, inline]

                                  Traversal flag; returning from the root sets this to zero.

                                  Instances For
                                    @[reducible, inline]

                                    Raw unsigned constant one for counters and offsets.

                                    Instances For
                                      @[reducible, inline]

                                      Raw unsigned radix ten for the fixed term and query dictionaries.

                                      Instances For
                                        @[reducible, inline]

                                        Inner-output wildcard digit, in the existing term numbering.

                                        Instances For
                                          @[reducible, inline]

                                          Raw unsigned width of a stack frame: four words.

                                          Instances For
                                            @[reducible, inline]

                                            Address of the currently loaded stack frame.

                                            Instances For
                                              @[reducible, inline]

                                              Number of distinct requests stored in the current frame.

                                              Instances For
                                                @[reducible, inline]

                                                Processed least-significant leaf digits of the current node.

                                                Instances For
                                                  @[reducible, inline]

                                                  Place value of the next leaf digit, 10^level.

                                                  Instances For
                                                    @[reducible, inline]

                                                    Next term number to dispatch or accumulate.

                                                    Instances For
                                                      @[reducible, inline]

                                                      Loop counter for powers, scans, clearing, accumulation and reporting.

                                                      Instances For
                                                        @[reducible, inline]

                                                        Distinct child count computed by the actual timestamp scan.

                                                        Instances For
                                                          @[reducible, inline]

                                                          Current numerical output-string code loaded from a query list.

                                                          Instances For
                                                            @[reducible, inline]

                                                            First output digit computed by remainder modulo ten.

                                                            Instances For
                                                              @[reducible, inline]

                                                              Remaining output digits computed by division by ten.

                                                              Instances For
                                                                @[reducible, inline]

                                                                Scratch address used by native indexed loads and stores.

                                                                Instances For
                                                                  @[reducible, inline]

                                                                  Scratch word for arithmetic, branch fallbacks and loaded values.

                                                                  Instances For
                                                                    @[reducible, inline]

                                                                    Scratch word for row-size and address products.

                                                                    Instances For
                                                                      @[reducible, inline]

                                                                      Timestamp loaded from the membership directory.

                                                                      Instances For
                                                                        @[reducible, inline]

                                                                        Address of the current depth's request row.

                                                                        Instances For
                                                                          @[reducible, inline]

                                                                          Address of the current depth's accumulator row.

                                                                          Instances For
                                                                            @[reducible, inline]

                                                                            Address of the next depth's computed request row.

                                                                            Instances For
                                                                              @[reducible, inline]

                                                                              Address of the next depth's returned-value row.

                                                                              Instances For
                                                                                @[reducible, inline]

                                                                                Computed child stack depth.

                                                                                Instances For
                                                                                  @[reducible, inline]

                                                                                  Computed address of the frame about to be pushed.

                                                                                  Instances For
                                                                                    @[reducible, inline]

                                                                                    Computed leaf prefix of the child about to be pushed.

                                                                                    Instances For
                                                                                      @[reducible, inline]

                                                                                      Computed leaf place value for the child about to be pushed.

                                                                                      Instances For
                                                                                        @[reducible, inline]

                                                                                        Raw unsigned constant zero.

                                                                                        Instances For
                                                                                          @[reducible, inline]

                                                                                          Raw unsigned constant two, initialized with the fixed scalar constants.

                                                                                          Instances For

                                                                                            Constant initialization, before the depth-controlled power loop.

                                                                                            Instances For

                                                                                              Initialize constants and compute the actual encoding-array length 10^L.

                                                                                              Instances For

                                                                                                Separate stack frames, query lists, value directories and membership timestamps.

                                                                                                Instances For

                                                                                                  Append one previously unseen suffix and mark it with the current epoch.

                                                                                                  Instances For

                                                                                                    The two fixed suffix kernels either divide a selected child query or copy a root query.

                                                                                                    Instances For

                                                                                                      A selected child suffix is computed by an actual unsigned division.

                                                                                                      Instances For

                                                                                                        Load the next supplied query and compute its actual first digit.

                                                                                                        Instances For

                                                                                                          Root queries are copied directly; child queries are filtered by the native digit tests.

                                                                                                          Instances For

                                                                                                            One deduplicating scan step, including input indexing, dispatch and counter increment.

                                                                                                            Instances For

                                                                                                              Point the deduplicating root scan at the actual supplied query list.

                                                                                                              Instances For

                                                                                                                Store the four actual root-frame words and enter its first controller phase.

                                                                                                                Instances For

                                                                                                                  Deduplicate supplied queries into the root list; the original list remains read-only.

                                                                                                                  Instances For

                                                                                                                    Load the current frame and compute its depth-specific list/value addresses.

                                                                                                                    Instances For

                                                                                                                      Return to the parent's accumulation phase, or finish the root.

                                                                                                                      Instances For

                                                                                                                        One requested leaf product, using the existing native signed multiplication kernel.

                                                                                                                        Instances For

                                                                                                                          Evaluate a requested leaf from the actual two encoded words.

                                                                                                                          Instances For

                                                                                                                            Clear exactly the requested parent values, not the full dense directory.

                                                                                                                            Instances For

                                                                                                                              Store the actual next-term counter and enter the frame's dispatch phase.

                                                                                                                              Instances For

                                                                                                                                Initialize the stored next-term counter after sparse accumulator clearing.

                                                                                                                                Instances For

                                                                                                                                  Entry phase: multiply at a leaf; otherwise initialize the requested accumulators.

                                                                                                                                  Instances For

                                                                                                                                    Form and deduplicate a child request set using actual tests, loads and stores.

                                                                                                                                    Instances For

                                                                                                                                      Advance the parent's term after an empty child or after accumulating its returned values.

                                                                                                                                      Instances For

                                                                                                                                        Push a nonempty child, with the exact least-significant-first leaf leafPrefix.

                                                                                                                                        Instances For

                                                                                                                                          Dispatch the next of the ten actual terms, recursing only on nonempty computed sets.

                                                                                                                                          Instances For

                                                                                                                                            Load the two encoded operands at the actual parent query and child suffix addresses.

                                                                                                                                            Instances For

                                                                                                                                              Add one returned child value to its parent's actual signed accumulator.

                                                                                                                                              Instances For

                                                                                                                                                Select the returned child by the same two real digit comparisons as child construction.

                                                                                                                                                Instances For

                                                                                                                                                  Consume a returned child's values at the explicitly listed contributing parent queries.

                                                                                                                                                  Instances For

                                                                                                                                                    Traverse the parent requests once, then advance the stored term counter.

                                                                                                                                                    Instances For

                                                                                                                                                      One explicit-stack controller step. Every branch and frame address is native work.

                                                                                                                                                      Instances For

                                                                                                                                                        One actual lookup and indexed output store, including the reporting counter.

                                                                                                                                                        Instances For

                                                                                                                                                          Report results in the original input query order, including repeated queries.

                                                                                                                                                          Instances For

                                                                                                                                                            The common stack evaluator after powers and caller parameters have been initialized.

                                                                                                                                                            Instances For

                                                                                                                                                              Evaluate the computed root, then report the original query list.

                                                                                                                                                              Instances For

                                                                                                                                                                Generic native evaluator with explicit pointer arguments and a fresh timestamp epoch.

                                                                                                                                                                Instances For

                                                                                                                                                                  Compute all initial array/output/scratch pointers from the actual array and query lengths.

                                                                                                                                                                  Instances For

                                                                                                                                                                    One finite program reading the header and encoded arrays from ordinary initialized memory.

                                                                                                                                                                    Instances For

                                                                                                                                                                      The same program is used at every word width; it never reads the physical word size.

                                                                                                                                                                      A fixed bound on both control code and all arithmetic blocks, including the final halt.