Documentation

CslibFrontier.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.

@[reducible, inline]

Original tensor depth, loaded from the ordinary input header.

@[reducible, inline]

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

@[reducible, inline]

Pointer to the left canonical signed encoding array.

@[reducible, inline]

Pointer to the right canonical signed encoding array.

@[reducible, inline]

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

@[reducible, inline]

Number of supplied queries, before native deduplication.

@[reducible, inline]

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

@[reducible, inline]

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

@[reducible, inline]

Current timestamp generation for native query deduplication.

@[reducible, inline]

Pointer to the first four-word stack frame.

@[reducible, inline]

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

@[reducible, inline]

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

@[reducible, inline]

Pointer to the shared query-membership timestamp directory.

@[reducible, inline]

Current stack depth, with zero denoting the root.

@[reducible, inline]

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

@[reducible, inline]

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

@[reducible, inline]

Raw unsigned constant one for counters and offsets.

@[reducible, inline]

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

@[reducible, inline]

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

@[reducible, inline]

Raw unsigned width of a stack frame: four words.

@[reducible, inline]

Address of the currently loaded stack frame.

@[reducible, inline]

Number of distinct requests stored in the current frame.

@[reducible, inline]

Processed least-significant leaf digits of the current node.

@[reducible, inline]

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

@[reducible, inline]

Next term number to dispatch or accumulate.

@[reducible, inline]

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

@[reducible, inline]

Distinct child count computed by the actual timestamp scan.

@[reducible, inline]

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

@[reducible, inline]

First output digit computed by remainder modulo ten.

@[reducible, inline]

Remaining output digits computed by division by ten.

@[reducible, inline]

Scratch address used by native indexed loads and stores.

@[reducible, inline]

Scratch word for arithmetic, branch fallbacks and loaded values.

@[reducible, inline]

Scratch word for row-size and address products.

@[reducible, inline]

Timestamp loaded from the membership directory.

@[reducible, inline]

Address of the current depth's request row.

@[reducible, inline]

Address of the current depth's accumulator row.

@[reducible, inline]

Address of the next depth's computed request row.

@[reducible, inline]

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

@[reducible, inline]

Computed address of the frame about to be pushed.

@[reducible, inline]

Computed leaf prefix of the child about to be pushed.

@[reducible, inline]

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

@[reducible, inline]

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

Embed the five-register native power routine into the pruned-query register bank.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.