Alphabeta Math
LemmaStatement: Literature-sourcedProof: AI-adaptedPipeline-generatedprecheck pass
How statement and proof provenance work

The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.

  • Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
  • AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
  • AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.

These labels describe origin, not correctness: citations and verification chips remain separate evidence.

Two-head fixed-width Transformers implement finite-grid lookups

Statement

Let d≥1, n≥2, m≥2 be integers, set δ=1/m and q=δ−d, and assume n≤q. Define Gδ={0,δ,…,1−δ}d×n,Gδ+={−δ−nd,0,δ,…,1−δ}d×n. Let G^δ consist of those L∈Gδ whose columns are pairwise distinct. For column-token matrices Z∈Rd×n, consider finite compositions of residual attention updates Z⟼Z+∑h=12oh(vhTZ) hmax⁡ ⁣((khTZ)T(rhTZ+bh1nT)) and residual tokenwise updates

Z⟼Z+w ϕ(vTZ+b1nT),

where all displayed vectors and scalars are fixed across columns, hmax⁡ assigns equal weights to all maximizing entries in each column, and each scalar ϕ is piecewise affine on at most three intervals with at least one constant piece. If A:G^δ→Rd×n satisfies A(LP)=A(L)P for every column-permutation matrix P, then such a composition maps each L∈G^δ to A(L) and each L∈Gδ+∖G^δ to 0.

There is also a position-tagged version. For each j=1,…,n, let Jj={j−1,j−1+δ,…,j−δ}d,Gδ,pos=J1×⋯×Jn, where the jth factor specifies column j. For every function A:Gδ,pos→Rd×n, with no permutation condition, a finite composition of the same updates maps each L∈Gδ,pos to A(L).

Facts & Assumptions

Given: The integer grids and finite tables in the Statement.

[F1]

The Yun expressivity block has two heads of size one, shared query/key/value and output maps, a shared scalar query bias, residual attention, and a tokenwise ReLU feedforward sublayer of width four; it has no layer normalization (Transformer encoder, decoder, and fixed-width expressivity blocks).

[F2]

Every finite composition of the unmasked Yun attention and shared tokenwise maps is permutation equivariant (Position-free unmasked self-attention is permutation equivariant).

[F3]

Positional encodings are added columnwise to the token matrix before the position-aware stack (Positional encodings and causal masks).

Proof

For the unpositioned equivariance used below, let P be any column-permutation matrix. In a shared Yun head, vTZP=(vTZ)P and the query and key projections transform the same way, so its score matrix satisfies S(ZP)=PTS(Z)P. Equal-weight hardmax acts columnwise and commutes with row and column permutations, giving hmax⁡(S(ZP))=PThmax⁡(S(Z))P. Multiplication by the permuted value row then gives the permuted attention output, and residual addition preserves this identity. A shared tokenwise update also commutes with column permutations because 1nTP=1nT and its coordinatewise activation is applied identically in every column. Thus every modified Yun attention or tokenwise update, and every finite composition of them, is permutation equivariant. This is the unnormalized, hardmax version of the supplier calculation in [thm-transformer-permutation-equivariance-without-position].

1.1givenalgebra

Put u=(1,δ−1,…,δ−d+1). For a grid column x=(a1δ,…,adδ), where ai∈{0,…,m−1}, its scalar code is ℓ(x)=uTx,ℓ(x)/δ=a1+a2m+⋯+admd−1. Thus the valid column codes are distinct multiples of δ in [0,B], where B=δ(q−1). If a column has a sentinel coordinate −δ−nd, the sum of all its other coordinate contributions is at most δ−d+1−1, so its code is at most −δ−nd+δ−d+1−1<0.

1.2givenF1algebra

For a scalar threshold b, the single-head update ψ(Z;b)=e1(uTZ)hmax⁡ ⁣((uTZ)T(uTZ−b1nT)) is an allowed attention update contribution: its key and value projections are u, its query projection is u with bias −b, and its output vector is e1. In query column j, if ℓj>b it returns the largest current scalar code, and if ℓj<b it returns the smallest. If ℓj=b, all query scores are zero and equal-weight hardmax returns the mean ℓˉ=n−1∑kℓk. Thus, writing ℓmax⁡=max⁡kℓk and ℓmin⁡=min⁡kℓk, the contribution ψ(Z;b)−ψ(Z;b′) for b<b′ is ℓmax⁡−ℓmin⁡ in the first coordinate when b<ℓj<b′, ℓˉ−ℓmin⁡ when ℓj=b, ℓmax⁡−ℓˉ when ℓj=b′, and zero when ℓj<b or ℓj>b′. In particular, if no current code equals either threshold, it shifts exactly the columns strictly between them by ℓmax⁡−ℓmin⁡.

2.1step 1.1step 1.2constructalgebra

Sweep the valid scalar codes 0,δ,…,B in increasing order, using the two-head update   Z↦Z+q(ψ(Z;ℓ−δ/2)−ψ(Z;ℓ+δ/2))   at code ℓ. All initial codes, including sentinel codes, are multiples of δ: every grid coordinate lies in δZ and every entry of u is an integer. Since q=md is an integer, each strict selective shift preserves this lattice; inductively no current code can equal any half-grid threshold ℓ±δ/2. This also applies to duplicate-column inputs and to the position-tagged lattice. For L∈G^δ, order its distinct column codes as ℓ1<⋯<ℓn. The first sweep shifts only ℓ1 to ℓ~1=ℓ1+q(ℓn−ℓ1)>B, since ℓn−ℓ1≥δ and qδ=B+δ. Each later sweep shifts the next unmodified code and gives ℓ~j=ℓj+q(ℓ~j−1−ℓj)>ℓ~j−1(2≤j≤n). Thus shifted columns leave all later threshold intervals, and the final scalar codes satisfy 0<ℓ~1<⋯<ℓ~n.

3.1step 2.1algebra

Write gj=ℓj+1−ℓj≥δ. Unrolling the recurrence in step 2.1 gives t:=ℓ~n=ℓn+∑j=1n−1(qn−qn−j)gj. Consequently δqn−1(q−1)≤t≤δqn(q−1)−δ(q−1)2. The lower bound follows from the j=1 term; the upper bound follows from ℓn≤B and ∑jgj≤B. The map (ℓ1,…,ℓn)↦t is injective: if two ordered tuples give the same t, put aj=(ℓj−ℓj′)/δ∈Z, so ∣aj∣≤q−1. The difference equation is an+q(an−1−an)+⋯+qn−1(a1−a2)+qn(an−a1)=0. Reduction modulo q first gives an=0; division by q and repeated reduction modulo q then gives an−1=0,…,a1=0. Hence distinct unordered column multisets have distinct t values, separated by at least δ.

4.1step 2.1step 3.1F2choosealgebra

Apply one final single-head update Z↦Z+Kψ(Z;0), with a positive integer K. For valid L, all ℓ~j>0, so it adds Kt to every first coordinate and changes the scalar codes to cL,j=Kt+ℓ~j. For different column multisets, their t values differ by at least δ, while 0<ℓ~j≤t. Choose K so that Kδ>max⁡t over the finite valid grid. The intervals [Kt,Kt+t] for different multisets are disjoint, and codes within one multiset are distinct by step 2.1. All resulting codes are multiples of δ, hence distinct codes are at least δ apart.

5.1step 1.1step 3.1step 4.1algebrachoose

If L has duplicate columns but no sentinel, its scalar codes have only r<n distinct levels. The same sweep shifts these r levels, and its largest value is at most δqr(q−1)−δ(q−1)2≤δqn−1(q−1)−δ(q−1)2, strictly below the lower bound for valid t in step 3.1. A sentinel column has a negative code by step 1.1 and remains the minimum throughout the sweep. If all codes are negative, the final update in step 4.1 shifts every code further negative. If some codes are nonnegative, the first nonnegative code is shifted by at least q(qn−B)>δqn+1; the later positive codes are shifted by still larger amounts. This exceeds every valid t in step 3.1. Thus, after the final update, each invalid scalar code has one of three forms: below every valid code, above every valid code, or negative. Since there are finitely many grid inputs and all codes are multiples of δ, choose K large enough that every invalid code lies at least δ outside the interval from the least to the greatest valid code.

6.1step 4.1step 5.1F2constructchoosealgebra

The preceding construction gives a finite scalar code for each token of each valid context; these codes are all distinct, and column permutations carry each code and its token to the corresponding permuted token by [F2]. Let λ− and λ+ be the least and greatest valid codes. Because the table A and grid are finite, enlarge K so that ∣uTA(L):,j∣<λ−−δ/3 for every valid L,j. A three-piece constant activation that is zero on [λ−−δ/3,λ++δ/3] and one outside this interval detects exactly the invalid codes. Subtracting a constant larger than the maximum absolute coordinate of every encoded grid state makes every invalid state strictly negative; for each coordinate r, the allowed residual update Z↦Z+erReLU⁡(−erTZ) replaces that coordinate by zr+max⁡(0,−zr)=max⁡(0,zr). These d updates send every invalid state to zero and leave every valid, coordinatewise nonnegative state unchanged. For each valid code cL,j, a three-piece pulse equal to one on [−δ/3,δ/3] and zero outside, applied to uTZ−cL,j, selects exactly its token. Add the vector A(L):,j−Z:,j at that token. The updated token has scalar value uTA(L):,j below every code, so later pulses cannot select it; the remaining tokens retain their codes until selected. Equivariance of A makes each update correct for every permutation of L. This yields A(L) on G^δ and zero on every other point of Gδ+.

7.1givenstep 1.2step 2.1step 3.1step 6.1F3choosealgebra

For the position-tagged grid, the scalar code of column j has the form ℓj=(j−1)S+rj,S=∑k=0d−1δ−k,0≤rj≤B,rj∈δZ. Since S−B≥δ, codes in a matrix satisfy ℓ1<⋯<ℓn and each individual code identifies its column vector. Choose an integer Q≥q with Qδ>(n−1)S+B. Sweep all possible position-tagged scalar codes in increasing order, replacing the shift multiplier q in step 2.1 by Q. All codes remain in δZ, so none equals a half-grid threshold. Since distinct initial codes differ by at least δ, the first shifted code exceeds the largest possible initial code, and each subsequent shifted code exceeds its predecessor. Thus the recurrence of step 2.1 holds with Q in place of q, and different matrices give different ordered tuples (ℓ1,…,ℓn). The divisibility argument in step 3.1 applies modulo Q: for each fixed position, the offsets (j−1)S cancel and the difference of two rj values divided by δ has magnitude at most q−1<Q. Thus the final maxima t distinguish all position-tagged matrices, and the codes Kt+ℓ~j distinguish every token in every matrix when Kδ>max⁡t. Choose K still larger so these positive codes exceed all finitely many target values ∣uTA(L):,j∣+δ/3. The pulse layers of step 6.1 then implement the arbitrary table A; no permutation condition is needed because the position offsets distinguish columns.

8.1step 1.2step 6.1step 7.1F1algebra∎

Each update used above is either a two-head attention update, a single-head attention update with the second head set to zero, or a tokenwise scalar piecewise-affine update; an unused attention or feedforward sublayer is made the identity by setting its output weights to zero. Therefore the finite constructions are compositions of the modified Yun blocks specified in the Statement, proving both lookup assertions.

Depends on

Used by

Dependency tree · two levels

5 results within two dependency steps of this one, each drawn at its shortest distance from it. An arrow runs from a result to what uses it, so the chart reads left to right and ends at this result, which carries a heavier outline. Every node is a link to that result. Click elsewhere on the chart to enlarge it.

Sources