Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proof of Claim 5.3, p. 34:36 — Σ_h P_g(h)² = Pr_{b,b′}[Σb_ig_i = Σb′_ig_i] ≤ 1/2^l + Pr[· | b ≠ b′]

Proved
RegevLWE.SubsetSum.l2_norm_collision

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

collision-probabilityfinite-abelian-groupleftover-hash-lemmap2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let GGG be a finite abelian group, l≥0l \ge 0l≥0, and g=(g1,…,gl)∈Glg = (g_1, \dots, g_l) \in G^lg=(g1​,…,gl​)∈Gl. Let Pg(h)=2−l∣{b∈{0,1}l∣∑ibigi=h}∣P_g(h) = 2^{-l}|\{b \in \{0,1\}^l \mid \sum_i b_i g_i = h\}|Pg​(h)=2−l∣{b∈{0,1}l∣∑i​bi​gi​=h}∣ be the distribution of the sum of a uniformly random subset of g1,…,glg_1, \dots, g_lg1​,…,gl​, and let b,b′b, b'b,b′ be independent and uniform in {0,1}l\{0,1\}^l{0,1}l. Then the ℓ2\ell_2ℓ2​ norm of PgP_gPg​ is the collision probability of the two subset sums, and is bounded by the probability that b=b′b = b'b=b′ plus the conditional collision probability given b≠b′b \neq b'b=b′:

∑h∈GPg(h)2=Pr⁡b,b′[∑ibigi=∑ibi′gi]≤12l+Pr⁡b,b′[∑ibigi=∑ibi′gi∣b≠b′].\sum_{h \in G} P_g(h)^2 = \Pr_{b,b'}\Bigl[\sum_i b_i g_i = \sum_i b'_i g_i\Bigr] \le \frac{1}{2^l} + \Pr_{b,b'}\Bigl[\sum_i b_i g_i = \sum_i b'_i g_i \Bigm| b \neq b'\Bigr].h∈G∑​Pg​(h)2=b,b′Pr​[i∑​bi​gi​=i∑​bi′​gi​]≤2l1​+b,b′Pr​[i∑​bi​gi​=i∑​bi′​gi​​b=b′].

This is the first step of the proof of Claim 5.3: it turns the ℓ2\ell_2ℓ2​ norm of PgP_gPg​ into a count over pairs of subsets, which can then be averaged over ggg.

Formalization Note The probabilities are counts over the (2l)2(2^l)^2(2l)2 pairs (b,b′)(b, b')(b,b′): the unconditional probability divides the number of colliding pairs by (2l)2(2^l)^2(2l)2, and the conditional one divides the number of colliding pairs with b≠b′b \neq b'b=b′ by the number (2l)2−2l(2^l)^2 - 2^l(2l)2−2l of pairs with b≠b′b \neq b'b=b′. For l=0l = 0l=0 there is no pair with b≠b′b \neq b'b=b′; the conditional probability is then undefined in the paper and Lean's division gives 0/0=00/0 = 00/0=0, and the inequality reads 1≤1+01 \le 1 + 01≤1+0, which holds.

Preamble
import Mathlib
import Definitions.Def_RegevLWE_SubsetSum_Basic

open Finset
Formal statement
namespace RegevLWE.SubsetSum

/-- Proof of Claim 5.3 (Regev, J. ACM 2009, p. 34:36, last display): the `ℓ₂` norm of `P_g` is the
collision probability of two independent uniform `b, b' ∈ {0,1}^l`,
`∑_h P_g(h)² = Pr_{b,b'}[∑ bᵢgᵢ = ∑ b'ᵢgᵢ] ≤ 1/2^l + Pr_{b,b'}[∑ bᵢgᵢ = ∑ b'ᵢgᵢ | b ≠ b']`.
Probabilities over `(b, b')` are counts over the `(2^l)²` pairs; the conditional probability is the
count of colliding pairs with `b ≠ b'` divided by the number `(2^l)² − 2^l` of pairs with `b ≠ b'`. -/
theorem l2_norm_collision {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] {l : ℕ}
    (g : Fin l → G) :
    ∑ h, P g h ^ 2 =
        ((univ.filter fun bb : (Fin l → Bool) × (Fin l → Bool) =>
            subsetSum g bb.1 = subsetSum g bb.2).card : ℝ) / ((2 : ℝ) ^ l) ^ 2 ∧
      ((univ.filter fun bb : (Fin l → Bool) × (Fin l → Bool) =>
            subsetSum g bb.1 = subsetSum g bb.2).card : ℝ) / ((2 : ℝ) ^ l) ^ 2 ≤
        1 / (2 : ℝ) ^ l +
          ((univ.filter fun bb : (Fin l → Bool) × (Fin l → Bool) =>
              bb.1 ≠ bb.2 ∧ subsetSum g bb.1 = subsetSum g bb.2).card : ℝ) /
            (((2 : ℝ) ^ l) ^ 2 - (2 : ℝ) ^ l) := by sorry

end RegevLWE.SubsetSum
Source
Regev, On Lattices, Learning with Errors, Random Linear Codes, and Cryptography, J. ACM 56(6) (2009), Article 34, p. 34:36, proof of Claim 5.3, last display
Human review
  • Endorsed by Shuze Chen · Oct 7, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 7, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me