Provedalphabaguettermsnormdeferred-normalization
Deferred RMSNorm: the pre-scale inner product ⟨dy, u⟩ is ⟨dy, r·u⟩ / r
For all , and , if , then
What the notation means · or point at any symbol
- NNatural numbers
- The natural numbers 0, 1, 2, …. In Lean they start at 0. (
ℕ) - 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 m. Lean writes f x; papers write f(x). (
Fin m) - ⟹Implies
- If Fin(m), then ℝ. (Between types, A → B is the type of functions from A to B.) (
Fin m → ℝ) - x : TVariables
- dy, u range over Fin m → ℝ: the statement must hold for every choice. (
(dy u : Fin m → ℝ)) - ≠Not equal
- r and 0 are different. (
r ≠ 0) - ∑Summation
- Add up dy(i) · u(i) for every i. (
∑ i, dy i * u i) - =Equality
- ∑ i, dy(i) · u(i) and (∑ i, dy(i) · (r · u(i)))/r are the same. (
∑ i, dy i * u i = (∑ i, dy i * (r * u i…) - ·Multiplication
- dy(i) times u(i). (
dy i * u i) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - a/bDivision
- ∑ i, dy(i) · (r · u(i)) divided by r. In Lean, dividing by 0 gives 0. (
(∑ i, dy i * (r * u i)) / r)
theorem drn-row-scalar {m : ℕ} (dy u : Fin m → ℝ) (r : ℝ) (hr : r ≠ 0) :
∑ i, dy i * u i = (∑ i, dy i * (r * u i)) / rThe deferred backward needs ⟨dy, u⟩ for the unscaled projection output u. It is recoverable from the saved, scaled output y = r·u (r ≠ 0) as ⟨dy, y⟩/r, so u never has to be stored. Part of the idea 'Deferred RMS normalization for Baguette'.
How it was proved
- Proved
- 3 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
- 12 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.