Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

LEMMA 2 — Pr[X_i = R_j and X_i′ = R_j′] = n_ij·n_i′j′/q² for i ≠ i′

Proved
LubyMIS.Derandomized.lemma2

by mikedeng1 · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

derandomizationp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1pairwise-independence

Let qqq be a prime with n≤qn \le qn≤q and let AAA be an n×qn \times qn×q matrix with entries in a set RRR. On the sample space {(x,y):0≤x,y≤q−1}\{(x,y) : 0 \le x, y \le q-1\}{(x,y):0≤x,y≤q−1} with the uniform law, let Xi(x,y)=Ai,(x+y⋅i) mod qX_i(x,y) = A_{i,(x + y\cdot i) \bmod q}Xi​(x,y)=Ai,(x+y⋅i)modq​. For distinct rows i≠i′i \ne i'i=i′ and values Rj,Rj′R_j, R_{j'}Rj​,Rj′​,

Pr⁡[Xi=Rj and Xi′=Rj′]=nij ni′j′q2.\Pr[X_i = R_j \text{ and } X_{i'} = R_{j'}] = \frac{n_{ij}\, n_{i'j'}}{q^2}.Pr[Xi​=Rj​ and Xi′​=Rj′​]=q2nij​ni′j′​​.

Together with Lemma 1 this says that X0,…,Xn−1X_0, \dots, X_{n-1}X0​,…,Xn−1​ are pairwise independent on a sample space of only q2q^2q2 points.

Formalization Note The page does not state i≠i′i \ne i'i=i′, but the identity is false for i=i′i = i'i=i′ and Rj≠Rj′R_j \ne R_{j'}Rj​=Rj′​ (the left side is 000), and the page's proof uses that i≢i′(modq)i \not\equiv i' \pmod qi≡i′(modq); the hypothesis i≠i′i \ne i'i=i′ is added. Since 0≤i,i′≤n−1<q0 \le i, i' \le n - 1 < q0≤i,i′≤n−1<q when n≤qn \le qn≤q, distinct rows have distinct residues mod qqq.

Preamble
import Mathlib
import Definitions.Def_LubyMIS_Derandomized_SampleSpace
Formal statement
namespace LubyMIS.Derandomized

/-- LEMMA 2 (Luby 1986, §4.2, p. 1045). On the `q²`-point sample space of §4.2, with the uniform law,
for distinct vertices `i ≠ i′`: `Pr[X_i = R_j and X_{i′} = R_{j′}] = n_{ij} n_{i′j′} / q²`. -/
theorem lemma2 (q : ℕ) [Fact q.Prime] (n : ℕ) (hnq : n ≤ q) {R : Type*} [DecidableEq R]
    (A : Fin n → ZMod q → R) (i i' : Fin n) (hii' : i ≠ i') (r r' : R) :
    ((Finset.univ.filter (fun p : ZMod q × ZMod q => Xrv A i p = r ∧ Xrv A i' p = r')).card : ℝ) /
        (q : ℝ) ^ 2 =
      ((nCount A i r : ℝ) * (nCount A i' r' : ℝ)) / (q : ℝ) ^ 2 := by sorry

end LubyMIS.Derandomized
Source
Luby, A Simple Parallel Algorithm for the Maximal Independent Set Problem, SIAM J. Comput. 15(4), 1986, p. 1045, LEMMA 2
Read-back

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

Let qqq be a prime and n≤qn \le qn≤q a natural number. Let RRR be any type with decidable equality, and let Ai:Z/qZ→RA_i : \mathbb{Z}/q\mathbb{Z} \to RAi​:Z/qZ→R be rows for i∈{0,…,n−1}i \in \{0, \dots, n-1\}i∈{0,…,n−1}. Take two distinct labels i≠i′i \ne i'i=i′ and values r,r′∈Rr, r' \in Rr,r′∈R.

The statement asserts

#{ (x,y)∈(Z/qZ)2:Ai(x+yiˉ)=r and Ai′(x+yi′ˉ)=r′ }q2=ni,r  ni′,r′q2,\frac{\#\{\, (x,y) \in (\mathbb{Z}/q\mathbb{Z})^2 : A_i(x + y\bar{i}) = r \ \text{and}\ A_{i'}(x + y\bar{i'}) = r' \,\}}{q^2} = \frac{n_{i,r}\; n_{i',r'}}{q^2},q2#{(x,y)∈(Z/qZ)2:Ai​(x+yiˉ)=r and Ai′​(x+yi′ˉ)=r′}​=q2ni,r​ni′,r′​​,

where ⋅ˉ\bar{\cdot}⋅ˉ is reduction mod qqq and ni,r=#{ l:Ai(l)=r }n_{i,r} = \#\{\, l : A_i(l) = r \,\}ni,r​=#{l:Ai​(l)=r}. Because both sides have the same denominator q2≠0q^2 \neq 0q2=0, this is equivalent to the count identity

#{ ⋯ }=ni,r ni′,r′.\#\{\,\cdots\,\} = n_{i,r}\, n_{i',r'}.#{⋯}=ni,r​ni′,r′​.

Degenerate cases:

  • If n≤1n \le 1n≤1, no two distinct labels exist and the statement is vacuous.
  • r=r′r = r'r=r′ is allowed.
  • If either value is absent from its row, both sides are 000.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 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