Documentation

CslibFrontier.Probability.BitString.AffineHash.Word

Word-level Boolean affine hashes and zero tests #

An affine hash x ↦ A x + b to k bits of n-bit strings (Cslib.BitString.LinearHash.affineHash) has a (k * n + k)-bit seed: the k rows of the matrix A, followed by the k-bit offset b. packAffineSeed and unpackAffineSeed convert between (Fin k → BitString n) × BitString k and words (List Bool), padding missing seed bits with false and ignoring extra trailing bits; on fixed-length bit strings they induce the equivalence affineSeedEquiv.

wordAffineHash evaluates x ↦ A x + b on words, agreeing with affineHash on List.ofFn inputs (wordAffineHash_eq_ofFn). hashZero decides whether the affine hash sends the n-bit view of a word to zero (hashZero_eq_true_iff, hashZero_ofFn), providing Arthur's hash test in the set lower bound protocol of Goldwasser and Sipser [GS86] Arora and Barak, Section 8.2 (Cslib.Complexity.SetLowerBound.verifier) and in the public-coin emulation of private coins (Cslib.Complexity.Emulation.check). Plain polynomial-time certificates for wordAffineHash and hashZero are proved in CslibFrontier.Computability.Probabilistic.AffineHash.

Main definitions #

Main results #

References #

Pack an affine seed (A, b) : (Fin k → BitString n) × BitString k as a (k * n + k)-bit word: the k rows of A, then the offset b.

Unpack a word into an affine seed (A, b) : (Fin k → BitString n) × BitString k, padding missing bits with false and ignoring extra trailing bits.

Packing an affine seed (A, b) concatenates the k row words of A followed by b.

theorem Cslib.BitString.LinearHash.ofFn_unpackAffineSeed_fst {k n : ℕ} (seed : List Bool) (i : Fin k) :
List.ofFn ((unpackAffineSeed k n seed).1 i) = listRow n (↑i) (List.take (k * n) seed)

Row i of unpackAffineSeed k n seed is row i of width n of the matrix prefix.

The offset of unpackAffineSeed k n seed is the k-bit prefix after the k * n matrix bits.

The seed of an affine hash to k bits of n-bit strings, read from k * n + k bits: the k rows of the matrix, then the offset.

Word-level Boolean affine hash x ↦ A x + b, reading k * input.length matrix bits followed by k shift bits.

@[simp]

On a fixed-width input, wordAffineHash computes affineHash on the unpacked seed.

Whether the affine hash to k bits of n-bit strings with seed seed sends the n-bit view of x to zero, padding missing bits with false and ignoring extra trailing bits.

On arbitrary words, hashZero decides whether the unpacked affine hash sends the n-bit view of x to zero.

On strings of the right lengths, hashZero decides whether the affine hash given by the seed sends the string to zero.