Full tensor recursion and shared encodings #
The recursion works on mathematical arrays indexed by finite strings. Its multiplication record identifies the two encoded integers at each leaf. The returned array equals the bilinear tensor expansion. These recursive values and combinatorial counts carry no native instruction-cost interpretation.
Main definitions #
Full.run,Full.result,Full.multipliedAt: full evaluation and leaf operands.encodeLeft,encodeRight,encodingL,encodingR: shared leaf encodings.bilinearProduct,coefficient,leaves: the tensor expansion and contributing leaves.
Main results #
full_spec: full evaluation returns the bilinear product and uses the stated encodings.tensor_expansion: expansion into products of the one-level tensor coefficients.abs_phi_le_one,abs_psi_le_one: bounded encoding coefficients.
References #
Part of [AlmanWilliams2026, Section 2]. Direct mathematical adaptation of
Anthropic's pinned formal source.
Definitions are selectively extracted from that pin's PaperStatements.lean; no machine
semantics or running-time statement is imported. The docstrings below explain the local
declarations in our own words.
Fix the first coordinate of a tuple-indexed array and retain the shorter tuple as its argument. The construction works for any coordinate alphabet and value type.
Instances For
Evaluate the two arrays and retain the operands used at each leaf. At depth zero, multiply their unique entries. At positive depth, apply each term’s left and right coefficient forms, recurse, and decode the child results into an output array. The second component maps each term string to its pair of encoded input values. This is a finite integer recursion, with no instruction counter.
Instances For
2.3.2 Unraveling the recursion computation #
Counting length-L left tuples gives 7^L.
Counting length-L right tuples gives 7^L.
A depth-k label sequence has ten independent choices at each position.
Which leaves contribute to an output string #
A sum over the leaves contributing to w, split by the first term of the leaf.
The relevant-leaf filter is a product of the allowed label sets at individual coordinates.
Membership in leaves(U).
The two encodings at once #
Encoding for an arbitrary coefficient family: weight each array entry by the product of coefficients selected by the leaf. This specializes to both input encodings.
Instances For
Process the first label of an encoding by combining the first-coordinate slices, then encode the resulting shorter array.
Lemma 7 #
The left encoding at a cons leaf is the tail encoding of the array produced by encodeStepL.
The right encoding at a cons leaf is the tail encoding of the array produced by
encodeStepR.
The operand record of full evaluation agrees with encodeLeft and encodeRight at every
leaf.
Unfold full evaluation once and express decoding as a sum over labels relevant to the leading output coordinate.
The bilinear product obeys the same first-coordinate decoding recurrence as full evaluation.
Full evaluation computes the bilinear tensor expansion bilinearProduct.
The complete value specification of full evaluation: its result is bilinearProduct, and each
leaf’s operands are the corresponding left and right encodings.
Lemma 8 #
Expand the product of one-coordinate coefficients as a sum of coefficient products indexed by relevant leaves.
Expand bilinearProduct as a double sum of input-entry products. The coefficient of each pair
is the product, over string positions, of the one-level coefficients.