Provedattentionresidual-seriesexternal-review-4
Residual series: finite normalized residual and reward means
For all , and , if , , , , and (given ), then
What the notation means · or point at any symbol
- Type
- Type: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (
Type) - Fintype
- Fintype: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (
Fintype) - f(x)Function application
- Fintype applied to J. Lean writes f x; papers write f(x). (
Fintype J) - ⟹Implies
- If J, then ℝ. (Between types, A → B is the type of functions from A to B.) (
J → ℝ) - x : TVariables
- r, a, b, v range over J → ℝ: the statement must hold for every choice. (
(r a b v : J → ℝ)) - x ∈ TVariables
- B, p, M, o, c range over real numbers: the statement must hold for every choice. (
(B p M o c : ℝ)) - ≠Not equal
- B and 0 are different. (
B ≠ 0) - ∑Summation
- Add up r(j) · b(j) for every j. (
∑ j,r j*b j) - =Equality
- ∑ j, r(j) · b(j) and B are the same. (
∑ j,r j*b j=B) - ∧And
- Both hold: (∑ j, r(j) · ((b(j) − a(j))/B)) = 1 − p/B, and (∑ j, r(j) · (−((b(j) − a(j))/B) · (v(j) − c))) = p/B · (o…. (
(∑ j,r j*((b j-a j)/B))=1-p/B ∧ (∑ j,r …) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - ·Multiplication
- r(j) times b(j). (
r j*b j) - a/bDivision
- b(j) − a(j) divided by B. In Lean, dividing by 0 gives 0. (
(b j-a j)/B) - -Subtraction
- b(j) minus a(j). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
b j-a j) - −xNegation
- The negative of (b(j) − a(j))/B. (
-((b j-a j)/B))
theorem residual-series-reward-mean {J : Type} [Fintype J] (r a b v : J → ℝ) (B p M o c : ℝ) (hB : B ≠ 0) (hb : ∑ j,r j*b j=B) (ha : ∑ j,r j*a j=p) (hM : ∑ j,r j*b j*v j=M) (ho : ∑ j,r j*a j*v j=p*o) (hc : B*c=M) :
(∑ j,r j*((b j-a j)/B))=1-p/B ∧ (∑ j,r j*(-((b j-a j)/B)*(v j-c)))=(p/B)*(o-c)Finite scalar aggregate identity connects h=(b-a)/B and R=-h(v-c) to the original normalized attention discrepancy. This is the attention-specific algebra used by the full finite sampler, not an infinite probability-space theorem.
How it was proved
- Proved
- 6 October 2026
- By
- Ajax
- 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.