Finite Goldreich–Levin decoding #
The decoder samples k uniform base masks, forms their nonempty subset sums, and enumerates
the 2 ^ k guesses for their inner products with the unknown string. Each guess gives one
candidate, by correcting the predictor's answers and taking a majority for each coordinate.
The bitstrings are CSLib's Fin n → Bool. Mathlib's Boolean ring uses XOR for addition
and AND for multiplication, so its ordinary dot product x ⬝ᵥ r is the required parity.
Bilinearity, pairwise independence of subset sums, and Chebyshev's inequality give an explicit
failure bound of n / (4 * ε ^ 2 * (2 ^ k - 1)) for a predictor of agreement at least
1 / 2 + ε. Taking 2 ^ k - 1 ≥ n / (2 * ε ^ 2) makes the failure probability at most one half.
This direct-coordinate variant has a larger candidate list than the sharper decoder in the
reference, but the list remains polynomial in n and 1 / ε when k is chosen accordingly.
It avoids a separate high-agreement decoder.
These theorems concern a deterministic predictor and finite probability distributions. The
uniform PPT implementation and the hard-core reduction are separate steps. This module is
adapted from the cslib crypto branch at 5ff69ca.
Main definitions #
nonemptySubsets,candidate,candidates: subset masks and candidate generation.agreement: the predictor's agreement with a parity function.decode: the finite distribution of candidate sets.
Main results #
decode_failure_le: the quantitative decoding guarantee.decode_failure_le_half: sufficient mask count gives success probability at least one half.candidate_parity: a perfect parity predictor recovers the target for every choice of masks.card_le_of_mem_support_decode: the candidate list has at most2 ^ kelements.
References #
- O. Goldreich, L. Levin, A Hard-Core Predicate for All One-Way Functions
- L. Trevisan, CS276 Lecture 12: Goldreich–Levin. We use the subset-sum construction and pairwise-independent majority estimate, adapting recovery to each coordinate.
Every voting subset is nonempty.
There are 2 ^ k - 1 voting subsets of k base masks.
With the true base-mask parities, a corrected vote is right exactly when the predictor is right on the shifted query. This is bilinearity of the Boolean dot product.
The decoder misses a parity correlated with its predictor with probability at most
n / (4 * ε ^ 2 * (2 ^ k - 1)). A union bound suffices across coordinates.
With sufficiently many subset masks, the candidate list contains the target with probability at least one half.
Agreement is exactly the success probability of predicting the Boolean inner product.