Provedalphabaguetteropeattention
RoPE pair rotation: the q·k score depends only on the position difference, and norms are preserved
For all :
What the notation means · or point at any symbol
- RReal numbers
- The real numbers: every point on the number line. (
ℝ) - x ∈ TVariables
- θ, a, b, u₁, u₂, v₁, v₂ range over real numbers: the statement must hold for every choice. (
(θ a b u₁ u₂ v₁ v₂ : ℝ)) - =Equality
- (u₁ · cos(a · θ) − u₂ · sin(a · θ)) · (v₁ · cos(b · θ) − v… and u₁ · (v₁ · cos((b − a) · θ) − v₂ · sin((b − a) · θ)) + u₂ … are the same. (
(u₁ * Real.cos (a * θ) - u₂ * Real.sin …) - ∧And
- Both hold: (u₁ · cos(a · θ) − u₂ · sin(a · θ)) · (v₁ · cos(b · θ) − v…, and (u₁ · cos(a · θ) − u₂ · sin(a · θ))^2 + (u₁ · sin(a · θ) +…. (
(u₁ * Real.cos (a * θ) - u₂ * Real.sin …) - -Subtraction
- u₁ · cos(a · θ) minus u₂ · sin(a · θ). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
u₁ * Real.cos (a * θ) - u₂ * Real.sin (…) - cosCosine
- The cosine of a · θ (radians). (
Real.cos (a * θ)) - ·Multiplication
- a times θ. (
a * θ) - sinSine
- The sine of a · θ (radians). (
Real.sin (a * θ)) - +Addition
- u₁ · sin(a · θ) plus u₂ · cos(a · θ). (
u₁ * Real.sin (a * θ) + u₂ * Real.cos (…) - aᵇPower
- u₁ · cos(a · θ) − u₂ · sin(a · θ) raised to the power 2. (
(u₁ * Real.cos (a * θ) - u₂ * Real.sin …)
theorem rope-relative-position-and-norm (θ a b u₁ u₂ v₁ v₂ : ℝ) :
(u₁ * Real.cos (a * θ) - u₂ * Real.sin (a * θ)) * (v₁ * Real.cos (b * θ) - v₂ * Real.sin (b * θ)) + (u₁ * Real.sin (a * θ) + u₂ * Real.cos (a * θ)) * (v₁ * Real.sin (b * θ) + v₂ * Real.cos (b * θ)) = u₁ * (v₁ * Real.cos ((b - a) * θ) - v₂ * Real.sin ((b - a) * θ)) + u₂ * (v₁ * Real.sin ((b - a) * θ) + v₂ * Real.cos ((b - a) * θ)) ∧ (u₁ * Real.cos (a * θ) - u₂ * Real.sin (a * θ)) ^ 2 + (u₁ * Real.sin (a * θ) + u₂ * Real.cos (a * θ)) ^ 2 = u₁ ^ 2 + u₂ ^ 2Baguette rotates each of its 32 feature pairs per head by angle position·θ_j, with θ_j = 10000^(−2j/64) (groupedDecoderRotaryBase, rotary tables in Build/Graph.alpha). For one pair, a query rotated by position a and a key rotated by position b have the same dot product as the unrotated query against the key rotated by b − a. Rotation also preserves the pair's squared norm. Summed over pairs, attention scores are translation-invariant in position. In the same-position case, inner products such as ⟨dQ, Q⟩ are rotation-invariant, which the deferred-normalization idea uses.
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
- 15 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.