Provedbi-cover-lawtraining-attentionclustered-attentionlaw
Two-level proposal: cluster c w.p. ∝ m_c e^{u_c}, then uniform inside, gives key j probability softmax(u_{c(j)})
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. (
ℕ) - x ∈ TVariables
- n, M range over natural numbers: the statement must hold for every choice. (
(n M : ℕ)) - 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 n. Lean writes f x; papers write f(x). (
Fin n) - ⟹Implies
- If Fin(n), then Fin(M). (Between types, A → B is the type of functions from A to B.) (
Fin n → Fin M) - <Less than
- 0 is strictly smaller than card(filter(i ↦ cl(i) = cl(j))). (
0 < ((Finset.univ.filter (fun i => cl i…) - ·Multiplication
- card(filter(i ↦ cl(i) = cl(j))) times exp(u(cl(j))). (
(Finset.univ.filter (fun i => cl i = cl…) - a/bDivision
- card(filter(i ↦ cl(i) = cl(j))) · exp(u(cl(j))) divided by ∑ c, card(filter(i ↦ cl(i) = c)) · exp(u(c)). In Lean, dividing by 0 gives 0. (
(Finset.univ.filter (fun i => cl i = cl…) - (x : T)As real numbers
- card(filter(i ↦ cl(i) = cl(j))) read as an element of real numbers. Mathematicians leave this implicit; Lean needs it to know which kind of number is meant. (
((Finset.univ.filter (fun i => cl i = c…) - |s|Cardinality
- The number of elements of filter(i ↦ cl(i) = cl(j)). (
(Finset.univ.filter (fun i => cl i = cl…) - filter
- Finset.univ.filter: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (
Finset.univ.filter) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - x ↦ f(x)Function (λ-abstraction)
- The function sending i to cl(i) = cl(j). Lean writes fun x => …; papers write x ↦ …. (
fun i => cl i = cl j) - =Equality
- cl(i) and cl(j) are the same. (
cl i = cl j) - eˣExponential function
- e raised to the power u(cl(j)), where e ≈ 2.718. (
Real.exp (u (cl j))) - ∑Summation
- Add up card(filter(i ↦ cl(i) = c)) · exp(u(c)) for every c. (
∑ c, ((Finset.univ.filter (fun i => cl …)
theorem bc-two-level-proposal {n M : ℕ} (cl : Fin n → Fin M) (u : Fin M → ℝ) (j : Fin n) (hm : 0 < ((Finset.univ.filter (fun i => cl i = cl j)).card : ℝ)) :
((Finset.univ.filter (fun i => cl i = cl j)).card * Real.exp (u (cl j)) / ∑ c, ((Finset.univ.filter (fun i => cl i = c)).card : ℝ) * Real.exp (u c)) * (1 / ((Finset.univ.filter (fun i => cl i = cl j)).card : ℝ)) = Real.exp (u (cl j)) / ∑ i, Real.exp (u (cl i))The N_q × M_k centre-to-centre table plus cluster sizes defines, for every query, a proposal that is a softmax over centre scores, i.e. exactly the snapshot form required by the exact rejection lemma. Cost per draw O(1) after an alias table over M_k clusters. Part of 'Bi-Cover Law: exact, unbiased clustered attention for training'.
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
- 19 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.