proofs
Provedalphabaguettenoether-checksumreview-2

Randomizable pairing: Σᵢ⟨dQᵢ, M·qᵢ⟩ = Σⱼ⟨dKⱼ, Mᵀ·kⱼ⟩ for EVERY D×D matrix M

For all T,D∈N\htmlData{mx=1}{T, D \in \htmlData{mx=0}{\mathbb{N}}}, R:Fin⁡ T→Fin⁡ T→R\htmlData{mx=9}{R : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{T}} \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=5}{\htmlData{mx=3}{\operatorname{Fin}}\,\htmlData{mx=4}{T}} \mathrel{\htmlData{mx=7}{\to}} \htmlData{mx=6}{\mathbb{R}}}, q,k:Fin⁡ T→Fin⁡ D→R\htmlData{mx=9}{q, k : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{T}} \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=5}{\htmlData{mx=3}{\operatorname{Fin}}\,\htmlData{mx=4}{D}} \mathrel{\htmlData{mx=7}{\to}} \htmlData{mx=6}{\mathbb{R}}}, M:Fin⁡ D→Fin⁡ D→R\htmlData{mx=9}{M : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{D}} \mathrel{\htmlData{mx=8}{\to}} \htmlData{mx=5}{\htmlData{mx=3}{\operatorname{Fin}}\,\htmlData{mx=4}{D}} \mathrel{\htmlData{mx=7}{\to}} \htmlData{mx=6}{\mathbb{R}}} and scale∈R\htmlData{mx=1}{\mathit{scale} \in \htmlData{mx=0}{\mathbb{R}}}:

∑i∑ascale⋅∑jR(i,j)⋅k(j,a)⋅(∑bM(a,b)⋅q(i,b))=∑j∑bscale⋅∑iR(i,j)⋅q(i,b)⋅(∑aM(a,b)⋅k(j,a))\begin{aligned} & \htmlData{mx=25}{\sum_{i} \htmlData{mx=24}{\sum_{a} \htmlData{mx=23}{\htmlData{mx=12}{\htmlData{mx=1}{\mathit{scale}} \cdot \htmlData{mx=11}{\sum_{j} \htmlData{mx=10}{\htmlData{mx=5}{\htmlData{mx=2}{R}(\htmlData{mx=3}{i}, \htmlData{mx=4}{j})} \cdot \htmlData{mx=9}{\htmlData{mx=6}{k}(\htmlData{mx=7}{j}, \htmlData{mx=8}{a})}}}} \cdot \left(\htmlData{mx=22}{\sum_{b} \htmlData{mx=21}{\htmlData{mx=16}{\htmlData{mx=13}{M}(\htmlData{mx=14}{a}, \htmlData{mx=15}{b})} \cdot \htmlData{mx=20}{\htmlData{mx=17}{q}(\htmlData{mx=18}{i}, \htmlData{mx=19}{b})}}}\right)}}} \\ & \quad \htmlData{mx=0}{=} \htmlData{mx=50}{\sum_{j} \htmlData{mx=49}{\sum_{b} \htmlData{mx=48}{\htmlData{mx=37}{\htmlData{mx=26}{\mathit{scale}} \cdot \htmlData{mx=36}{\sum_{i} \htmlData{mx=35}{\htmlData{mx=30}{\htmlData{mx=27}{R}(\htmlData{mx=28}{i}, \htmlData{mx=29}{j})} \cdot \htmlData{mx=34}{\htmlData{mx=31}{q}(\htmlData{mx=32}{i}, \htmlData{mx=33}{b})}}}} \cdot \left(\htmlData{mx=47}{\sum_{a} \htmlData{mx=46}{\htmlData{mx=41}{\htmlData{mx=38}{M}(\htmlData{mx=39}{a}, \htmlData{mx=40}{b})} \cdot \htmlData{mx=45}{\htmlData{mx=42}{k}(\htmlData{mx=43}{j}, \htmlData{mx=44}{a})}}}\right)}}} \end{aligned}
What the notation means · or point at any symbol
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (ℕ)
x ∈ TVariables
T, D range over natural numbers: the statement must hold for every choice. ((T D : ℕ))
Fin
Fin: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Fin)
f(x)Function application
Fin applied to T. Lean writes f x; papers write f(x). (Fin T)
x : TVariables
q, k range over Fin T → Fin D → ℝ: the statement must hold for every choice. ((q k : Fin T → Fin D → ℝ))
=Equality
∑ i, ∑ a, scale · (∑ j, R(i, j) · k(j, a)) · (∑ b, M(a, b)… and ∑ j, ∑ b, scale · (∑ i, R(i, j) · q(i, b)) · (∑ a, M(a, b)… are the same. (∑ i, ∑ a, (scale * ∑ j, R i j * k j a) …)
⟹Implies
If Fin(T), then ℝ. (Between types, A → B is the type of functions from A to B.) (Fin T → ℝ)
RReal numbers
The real numbers: every point on the number line. (ℝ)
∑Summation
Add up R(i, j) · k(j, a) for every j. (∑ j, R i j * k j a)
·Multiplication
R(i, j) times k(j, a). (R i j * k j a)

Generalizes C3 (M = identity) to a whole family of checks. For any R and any M, both sides equal scale·Σᵢⱼ Rᵢⱼ⟨kⱼ, M qᵢ⟩. Drawing M at random per step makes the check unpredictable to a structured bug; computing M·q is one 64×64 GEMM per head. Part of 'Noether checksums for Baguette's backward kernels' (review pass 2).

How it was proved

Proved
4 October 2026
By
Ajax, with the agent “Baguette math & proofs (Claude Code, 2026-10-03)”
Checked by
Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
Axioms
Classical.choice, Quot.sound, propext
Proof
32 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements