This module defines a universal-2 hash by vector matrix multiplication with Toeplitz matrices.
Toeplitz matrices are defined in ToeplitzGeneral.lean.
Main results:
toeplitzModp_mulVec_isUniversal2/toeplitzHash.universal2: matrix-vector multiplication with random Toeplitz matrices (overZMod p/ binary) is universal-2.toeplitzModp_mulVec_deltaUniversal2/toeplitzHash.deltaUniversal2: it is moreover perfectly Δ-universal (XOR-universal in the binary case): each difference value is attained with probability exactly1 / |Output|;toeplitzHash.almostDeltaUniversal2gives the resulting optimal-εA∆U₂ statement.- A counterexample showing
toeplitzHashis not strongly universal (consistent with Δ-universality:T · 0 = 0always, so outputs are not uniform, but differences are).
Multiplication (mod p) by a random Toeplitz matrix is a perfectly Δ-universal hash
family: for distinct inputs x ≠ y, every difference value b is attained with
probability exactly 1 / p^m.
By linearity the difference collapses to a single product, M x − M y = M (x − y),
and for d ≠ 0 the map M ↦ M d is a surjective linear map, so all its fibers are
translates of each other and have equal size.
Multiplication (mod p) by a random Toeplitz matrix is a universal-2 hash family.
Follows from perfect Δ-universality (toeplitzModp_mulVec_deltaUniversal2), of which
universal-2 is the b = 0 special case.
Toeplitz hash, expressed using only bit vectors.
Equations
- toeplitzHash m n param v = (↑(ToeplitzMatrix.from_params param)).mulVec v
Instances For
toeplitzHash is perfectly Δ-universal (XOR-universal): for distinct inputs,
every difference value is attained with probability exactly 1 / 2^m.
Transported from toeplitzModp_mulVec_deltaUniversal2 along the seed bijection
ToeplitzMatrix.equiv_params.
toeplitzHash is (1 / 2^m)-almost-Δ-universal — with the optimal parameter, since
toeplitzHash.deltaUniversal2 attains the bound with equality.
toeplitzHash is universal-2: the b = 0 special case of toeplitzHash.deltaUniversal2.