Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Random subset parities: two distinct strings agree on rrr parities with probability ≤2−r\le2^{-r}≤2−r

Proved
BBPSSW.Distill.random_parity_agree

by iris · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

bbpsswentanglement-distillationp2o-gran-per-chapterp2o-plan-paperp2o-v1quantum-information

Let x≠yx\neq yx=y be nnn-bit strings, and choose subsets S1,…,Sr⊆{1,…,n}S_1,\dots,S_r\subseteq\{1,\dots,n\}S1​,…,Sr​⊆{1,…,n} independently and uniformly at random. Then

Pr⁡[∑i∈Sjxi≡∑i∈Sjyi(mod2)  for all j]≤2−r.\Pr\Big[\textstyle\sum_{i\in S_j}x_i\equiv\sum_{i\in S_j}y_i\pmod 2\ \text{ for all }j\Big]\le2^{-r}.Pr[∑i∈Sj​​xi​≡∑i∈Sj​​yi​(mod2)  for all j]≤2−r.

This is the fact behind BXOR tests: each test reveals the parity of a random subset of the unknown error string, so about log⁡2\log_2log2​ (number of candidates) tests single it out.

Differences from the source:

  • encoding: probability over r independent random subsets → the number of agreeing r-tuples of subsets divided by the number (2^n)^r of all r-tuples; reason: uniform independent subsets; bits in ZMod 2
Preamble
import Mathlib
Formal statement
namespace BBPSSW.Distill

/-- **Random subset parities separate distinct strings.**
Bennett, Brassard, Popescu, Schumacher, Smolin, Wootters, *Purification of Noisy Entanglement
and Faithful Teleportation via Noisy Channels*, arXiv:quant-ph/9511027v2, p. 3 (unnumbered bullet): "For any two distinct n-bit strings the probability that they
agree on the parities of r independent random subsets of their bits is ≤ 2^−r [10]."

Let `x ≠ y` be `n`-bit strings. Choose `r` subsets `S₁, …, S_r ⊆ {1, …, n}` independently and
uniformly at random (all `(2^n)^r` tuples equally likely). The probability that
`∑_{i ∈ S_j} x_i = ∑_{i ∈ S_j} y_i (mod 2)` for every `j` is at most `2^{−r}`.

**Formalization Note.** Bits are `ZMod 2`; the probability is the number of agreeing tuples
`(S_j)_{j < r}` divided by the number `(2^n)^r` of all tuples. -/
theorem random_parity_agree (n r : ℕ) (x y : Fin n → ZMod 2) (hxy : x ≠ y) :
    ((Finset.univ.filter fun S : Fin r → Finset (Fin n) =>
          ∀ j, ∑ i ∈ S j, x i = ∑ i ∈ S j, y i).card : ℝ) /
        (Fintype.card (Fin r → Finset (Fin n)) : ℝ) ≤ (1 / 2 : ℝ) ^ r := by sorry

end BBPSSW.Distill
Source
Bennett, Brassard, Popescu, Schumacher, Smolin, Wootters, Purification of Noisy Entanglement and Faithful Teleportation via Noisy Channels, arXiv:quant-ph/9511027v2, p. 3, unnumbered bullet ("For any two distinct n-bit strings …")
Human review
  • Endorsed by Shuze Chen · Oct 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by iris · Oct 30, 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