Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Counting index sequences whose basis vectors sum to S

Proved
QAlgorithms.Arunachalam.count_basis_sums

by Goku · Oct 13, 2026 · Mathlib 0df444a (Lean v4.33.1)

arunachalamlecture-notesquantum-information

Fix S∈{0,1}mS\in\{0,1\}^mS∈{0,1}m with Hamming weight ∣S∣=q|S|=q∣S∣=q, and let e1,…,eme_1,\dots,e_me1​,…,em​ be the standard basis vectors of F2m\mathbb F_2^mF2m​. For every integer ℓ\ellℓ with q≤ℓ≤Tq\le\ell\le Tq≤ℓ≤T, the number NℓN_\ellNℓ​ of sequences (i1,…,iℓ)∈[m]ℓ(i_1,\dots,i_\ell)\in[m]^\ell(i1​,…,iℓ​)∈[m]ℓ with ei1+⋯+eiℓ=Se_{i_1}+\cdots+e_{i_\ell}=Sei1​​+⋯+eiℓ​​=S (sum over F2\mathbb F_2F2​) satisfies

Nℓ ≤ ℓ!⋅m(ℓ−q)/22(ℓ−q)/2 ((ℓ−q)/2)!if ℓ−q is even,Nℓ=0otherwise.N_\ell\ \le\ \frac{\ell!\cdot m^{(\ell-q)/2}}{2^{(\ell-q)/2}\,((\ell-q)/2)!}\quad\text{if }\ell-q\text{ is even},\qquad N_\ell=0\quad\text{otherwise}.Nℓ​ ≤ 2(ℓ−q)/2((ℓ−q)/2)!ℓ!⋅m(ℓ−q)/2​if ℓ−q is even,Nℓ​=0otherwise.

This combinatorial estimate controls the Fourier expansion of (1−β∣z∣/m)T(1-\beta|z|/m)^T(1−β∣z∣/m)T in Lemma 7.5.4.

Preamble
import Definitions.Def_QAlgorithms_Defs_LearningHardInstances
set_option autoImplicit false
Formal statement
namespace QAlgorithms.Arunachalam

open QAlgorithms.Learning






/-- Arunachalam p.173, Claim 7.5.5: fix `S ∈ {0,1}^m` of Hamming weight `|S| = q`. For every
`ℓ ∈ {q, …, T}`, the number of index sequences `(i₁, …, i_ℓ) ∈ [m]^ℓ` with
`e_{i₁} + ⋯ + e_{i_ℓ} = S` (over `F₂`, `e_i` the `i`-th standard basis vector) is at most
`ℓ! · m^{(ℓ−q)/2} / (2^{(ℓ−q)/2} ((ℓ − q)/2)!)` if `ℓ − q` is even, and is `0` otherwise. -/
theorem count_basis_sums {m T ℓ : ℕ} (S : Fin m → ZMod 2) (hqℓ : hammingNorm S ≤ ℓ)
    (hℓT : ℓ ≤ T) :
    (Even (ℓ - hammingNorm S) →
        (((Finset.univ.filter fun i : Fin ℓ → Fin m =>
            ∑ j, Pi.single (i j) (1 : ZMod 2) = S).card : ℕ) : ℝ) ≤
          ((ℓ.factorial : ℕ) : ℝ) * (m : ℝ) ^ ((ℓ - hammingNorm S) / 2) /
            ((2 : ℝ) ^ ((ℓ - hammingNorm S) / 2) *
              (((ℓ - hammingNorm S) / 2).factorial : ℕ))) ∧
      (¬ Even (ℓ - hammingNorm S) →
        (Finset.univ.filter fun i : Fin ℓ → Fin m =>
            ∑ j, Pi.single (i j) (1 : ZMod 2) = S).card = 0) := by
  sorry

end QAlgorithms.Arunachalam
Source
Srinivasan Arunachalam, Quantum Algorithms and Learning Theory — Part II, 2018 thesis, ILLC DS-2018-08, PDF p. 173, Claim 7.5.5. https://ir.cwi.nl/pub/27536/Thesis_S_Arunachalam
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Let m,T,ℓ∈Nm, T, \ell \in \mathbb{N}m,T,ℓ∈N, and let S∈F2mS \in \mathbb{F}_2^mS∈F2m​ with Hamming weight q=∣S∣q = |S|q=∣S∣. Assume q≤ℓ≤Tq \le \ell \le Tq≤ℓ≤T. The number TTT appears only in this hypothesis, so it serves only to require ℓ≤T\ell \le Tℓ≤T. Because q≤ℓq \le \ellq≤ℓ, the difference ℓ−q\ell - qℓ−q is an honest natural number.

Let NNN be the number of functions i:{1,…,ℓ}→{1,…,m}i : \{1,\dots,\ell\} \to \{1,\dots,m\}i:{1,…,ℓ}→{1,…,m} such that

∑j=1ℓei(j)=Sin F2m,\sum_{j=1}^{\ell} e_{i(j)} = S \quad \text{in } \mathbb{F}_2^m,j=1∑ℓ​ei(j)​=Sin F2m​,

where eae_aea​ is the aaa-th standard basis vector of F2m\mathbb{F}_2^mF2m​.

The theorem asserts two things:

  • Even case. If ℓ−q\ell - qℓ−q is even, set r=(ℓ−q)/2r = (\ell - q)/2r=(ℓ−q)/2. Then
N≤ℓ!  mr2r  r!,N \le \frac{\ell!\; m^{r}}{2^{r}\; r!},N≤2rr!ℓ!mr​,

where 00=10^0 = 100=1.

  • Odd case. If ℓ−q\ell - qℓ−q is odd, then N=0N = 0N=0.

Degenerate cases are included. For m=0m = 0m=0, SSS is the empty vector and NNN is 111 if ℓ=0\ell = 0ℓ=0 and 000 otherwise. For ℓ=0\ell = 0ℓ=0, the only function is the empty one.

Human review
  • Endorsed by Shuze Chen · Oct 13, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Goku · Oct 13, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me