Native shared tensor encoding #
The two fixed programs use unsigned addresses and counters, and sign-and-magnitude encoded
integer entries. Address 1 holds the depth; the 7^L encoded entries begin at address 2.
The ordinary State.init length header is at address 0. Output and scratch are consecutive
blocks of 10^L cells immediately after the input. Each coordinate transform reads the
previous stage and writes the other buffer. No initialization of unread scratch is needed.
A final charged copy puts the result in the first buffer, also at depth zero.
The coordinate transform is a new iterative implementation of the linear forms in
[AlmanWilliams2026, Section 2.4.1]. The coefficients and mathematical encoding are selectively
adapted from Anthropic's formal-math revision 16a5ce41304fcdaea4e0be7c132e1c361dc26da5,
Step
and Recursion. The source's
recursive machine and execution semantics are not used.
Main definitions #
Encoding.program: fixed native code for either coefficient table.Encoding.input: concrete input forState.init, including the depth header.Encoding.outputBase,Encoding.scratchBase: disjoint output and scratch blocks.
Seven variable digits: the three outer variables, then the four inner variables.
Instances For
Right-variable digits use the same order as the left-variable digits.
Instances For
Row-major order on the nine P terms, followed by P0.
Instances For
Executable flat address digits for the seven left variables. LeftVar.equiv instead
exposes their mathematical sum carrier Fin 3 ⊕ (Fin 2 × Fin 2). This dictionary gives a
single Fin 7 digit for each variable, for the native array layout.
Instances For
Executable flat address digits for the seven right variables. RightVar.equiv instead
exposes their mathematical sum carrier Fin 3 ⊕ (Fin 2 × Fin 2). This dictionary gives a
single Fin 7 digit for each variable, in the same order as leftDigits.
Instances For
Executable flat address digits for all ten terms. Term.equiv instead exposes their
mathematical carrier Option (Fin 3 × Fin 3). The native dictionary uses Fin 10, with
row-major P i j at digit 3*i+j and P0 at digit 9.
Instances For
Every actual coefficient is zero, one or minus one.
The input block ends where the output block begins.
Instances For
The scratch block immediately follows the entire output block.
Instances For
Concrete input: depth header followed by the signed input entries in flat order.
The caller encodes each integer with Signed.encode before passing the list to State.init.
The native unsigned length header is installed by State.init itself.
Instances For
The concrete left-array input, using Mathlib's base-seven string numbering.
Instances For
The concrete right-array input, in exactly the same flat memory layout.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
All thirty-two registers are fixed independently of depth and width. Registers 0–8 are precisely the existing signed-arithmetic workspace.
Instances For
One coefficient in {0, 1, -1} times one array entry. Zero coefficients cause no load.
Nonzero coefficients use the proved native signed addition or subtraction block.
Instances For
A finite unrolling of the seven coefficients. This recursion constructs code; it does not recurse on the input depth.
Instances For
One linear form, including accumulator initialization.
Instances For
A fixed finite dispatch on the ten possible term digits.
Instances For
Decode one flat output index into its mixed-radix coordinates and source group.
Instances For
Store the computed entry and advance the flat index.
Instances For
Divide the suffix stride and compute the next stage size.
Instances For
Alternate the two buffers and advance the prefix and stage counters.
Instances For
Transform the next coordinate, then alternate the output buffers.
Instances For
Load the actual depth header and initialize the power counters.
Instances For
One multiplication by each radix and one counter increment.
Instances For
Compute the concrete buffer addresses from the powers and initialize the first stage.
Instances For
Read the depth and compute both powers in a charged native loop.
Instances For
Reuse the existing seven-register array copy inside the encoder's register file.
Instances For
The seven copy registers are distinct.
A charged copy into the fixed output block, permitting disjoint blocks in either order or identical source and destination.
Instances For
The complete fixed native encoder, excluding its final halt. The returned output
register identifies the first output cell; the capacity register holds its length.
Instances For
The code performs no word-width queries.