Alphabeta Math
TheoremStatement: AI-adaptedProof: 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.

Position-free unmasked self-attention is permutation equivariant

Statement

Let X∈Rn×d be a sequence matrix whose rows are token representations, and let P be any n×n permutation matrix. Every finite composition T of position-shared encoder layers built from unmasked multi-head self-attention, residual additions, rowwise layer normalization, and a shared positionwise feedforward map, with no positional encoding, satisfies

T(PX)=P T(X).

For a fixed attention mask M, the corresponding layer satisfies Layer⁡PMPT(PX)=PLayer⁡M(X). Hence every permutation that leaves a fixed mask M unchanged is an equivariance of the corresponding layer. The standard causal mask Mij=0 for j≤i and Mij=−∞ for j>i is preserved only by the identity permutation.

Facts & Assumptions

Given: A sequence matrix X, a permutation matrix P, shared projections and positionwise maps, and—when a mask is present—a mask transformed together with the token indices.

[F1]

Each multi-head self-attention head forms query, key, and value rows by applying the same matrices to every token; its output is scaled-dot-product attention followed by a shared output projection (Multi-head attention and self-attention).

[F2]

Residual addition, rowwise layer normalization, and a positionwise feedforward map apply the same vector function at every position (Transformer encoder, decoder, and fixed-width expressivity blocks).

Proof

1.1givenF1algebra

For one head, write Q=XWQ, K=XWK, and V=XWV. On input PX, the projections are PQ, PK, and PV. The unmasked score matrix therefore becomes (PQ)(PK)T=P(QKT)PT.

2.1step 1.1F1algebra

Row softmax commutes with simultaneous row and column permutation: every row's logits are merely reordered, so its normalized entries are reordered by the same permutation. Thus softmax⁡row(PSPT)=Psoftmax⁡row(S)PT; multiplying by PV gives Psoftmax⁡row(S)V. Concatenation and the shared output projection preserve this identity, and so does the residual addition.

3.1step 2.1F2induction

A shared positionwise map applies the same function to each row, hence maps PX to the permutation of its outputs. Rowwise layer normalization has the same property because each row's mean and variance are unchanged by reordering rows. Combining these identities with the attention and residual identity in step 2.1 shows that one encoder layer is equivariant; induction over the finite stack gives T(PX)=PT(X).

4.1step 1.1step 2.1givenalgebrainduction∎

For a masked head, transforming the mask to PMPT gives the same score-and-weight calculation as steps 1.1–2.1, proving the stated mask identity. A permutation preserving the causal mask must preserve the relation j≤i on the finite chain 1<⋯<n; its unique least element must map to itself, and then induction on the remaining ordered positions makes every position fixed. Therefore only the identity preserves the standard causal mask.

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