Micciancio–Peikert gadget-based lattice trapdoors (GenTrap, syndrome lifting, LWE inversion) #
This module formalizes the gadget-based trapdoor construction of
Micciancio and Peikert, Section 5 over ZMod (2 ^ w), building on the
primitive gadget matrix G = gadgetMatrix w and short kernel matrix S = gadgetBasis w from
CslibFrontier.Crypto.Computational.LWE.Trapdoor.Gadget:
- Tagged parity-check matrices and
H-tag trapdoors (Definition 5.2, Algorithm 1): GivenAbar : Matrix ι μ (ZMod (2 ^ w)), a short integer matrixR : Matrix μ (ι × Fin w) ℤ, and a tagH : Matrix ι ι (ZMod (2 ^ w)),taggedMatrix w Abar R H = [Abar | H * G - Abar * R](Matrix.fromCols) andtrapdoorTransform R = [R; I](Matrix.fromRows) satisfy the unrestricted tag equationA * [R; I] = H * G(taggedMatrix_mul_trapdoorTransform). WhenHis invertible (IsUnit H),Ris anH-tagG-trapdoor forAin the sense of Definition 5.2 (IsHTagTrapdoor,isHTagTrapdoor_taggedMatrix,isHTagTrapdoor_untaggedMatrix). - Syndrome lifting (
f_A⁻¹) and lifted kernel vectors inΛ^⊥(A)(Section 5.1): Applying[R; I]lifts any gadget preimagezofH⁻¹ uto a short preimagex = [R z; z]satisfyingA x = u(taggedMatrix_mulVec_invertSyndrome), so any matrix admitting anH-tagG-trapdoor is primitive (IsHTagTrapdoor.surjective,taggedMatrix_surjective; the remark after Definition 5.2). Thewcolumns of[R; I] * S = [R S; S]lie inΛ^⊥(A)(taggedMatrix_mul_extendedGadgetBasis,extendedGadgetBasis_col_inKernelLattice), with entrywise bounds (natAbs_extendedGadgetBasis_inl_le,natAbs_extendedGadgetBasis_inr_le). These are the right-handwcolumns of the basisS_Aof Lemma 5.3; the left-hand block (built from a solutionWofG W = -H⁻¹ A [I | 0]ᵀ), the claim thatS_AgeneratesΛ^⊥(A), and the Gram–Schmidt bound of Lemma 5.3 are not formalized. - Deterministic trapdoor LWE inversion (
g_A⁻¹, Section 5.3, Algorithm 2 / Theorem 5.4): Givenbᵀ = sᵀ A + eᵀ mod 2 ^ w, right-multiplying by[R; I]yieldsbᵀ [R; I] = (sᵀ H) G + (e_1ᵀ R + e_2ᵀ)(trapdoorLWE_vecMul_trapdoorTransform). ApplyinginvertGadget wfollowed byH⁻¹recoversswhenever every coordinate of the projected errore_1ᵀ R + e_2ᵀsatisfies4 * |projectedError R e p| < 2 ^ w(invertLWESecret_trapdoorLWE), and centered lifting (ZMod.valMinAbs) recovers the full pair(s, e)when in addition every original error coordinate satisfies2 * |e k| < 2 ^ w(invertLWE_trapdoorLWE), both of which follow from the combined entrywise norm bound4 * (1 + |μ| * B_R) * B_e < 2 ^ w(invertLWE_trapdoorLWE_of_norm_bound). This is the deterministic part of Theorem 5.4 with the oracleOinstantiated byinvertGadgetand with coordinatewise (infinity-norm) hypotheses in place of the paper's Euclidean bound‖e‖ < q / (2 ‖B‖ s); the second claim of Theorem 5.4 (success with overwhelming probability for Gaussian errors) is not formalized. - Probabilistic trapdoor generation
GenTrapand an idealized hybrid (Section 5.2, Algorithm 1):genTrapsamplesAbaruniformly viaLWE.sampleMatrixandRwith centered-binomial entries in[-η, η](sampleTrapdoorMatrix; the paper allows any distributionD), returning(taggedMatrix w Abar R H, R)(mem_support_genTrap). In the idealized hybridgenTrapIdeal, whereAbar * Ris replaced by an independent uniform block, the public matrix is exactly uniform for every tagH(eval_genTrapIdeal_eq_uniform,eval_genTrapIdeal_eq_of_tags).
Not formalized here: the step from genTrap to genTrapIdeal, that is, the statistical
instantiation (regularity of [Abar | Abar R]) and the computational instantiation (decision-LWE)
of Section 5.2, so neither the statistical closeness of A to uniform claimed in Theorem 5.1 nor
its pseudorandomness is proved; the trapdoor quality s_1(R); discrete-Gaussian preimage sampling
(SampleD, Section 5.4); and trapdoor delegation (Section 5.5).
Main definitions #
Cslib.Crypto.LWE.Trapdoor.taggedRightBlock,Cslib.Crypto.LWE.Trapdoor.taggedMatrix,Cslib.Crypto.LWE.Trapdoor.untaggedMatrix,Cslib.Crypto.LWE.Trapdoor.trapdoorTransform,Cslib.Crypto.LWE.Trapdoor.IsHTagTrapdoor: the tagged matrix[Abar | H G - Abar R], transformation[R; I], andH-tag trapdoor predicate.Cslib.Crypto.LWE.Trapdoor.liftPreimage,Cslib.Crypto.LWE.Trapdoor.invertSyndrome,Cslib.Crypto.LWE.Trapdoor.extendedGadgetBasis: preimage lifting, deterministic syndrome inversionf_A⁻¹, and the lifted kernel vectors[R; I] * S.Cslib.Crypto.LWE.Trapdoor.trapdoorLWE,Cslib.Crypto.LWE.Trapdoor.projectedError,Cslib.Crypto.LWE.Trapdoor.invertLWESecret,Cslib.Crypto.LWE.Trapdoor.invertLWE: trapdoor LWE evaluation and Algorithm 2 (Invert).Cslib.Crypto.LWE.Trapdoor.sampleTrapdoorRow,Cslib.Crypto.LWE.Trapdoor.sampleTrapdoorMatrix,Cslib.Crypto.LWE.Trapdoor.genTrap,Cslib.Crypto.LWE.Trapdoor.genTrapIdeal: probabilistic trapdoor generation (GenTrap, Algorithm 1) and its idealized uniform hybrid.
Main results #
Cslib.Crypto.LWE.Trapdoor.taggedMatrix_mul_trapdoorTransform,Cslib.Crypto.LWE.Trapdoor.isHTagTrapdoor_taggedMatrix: the unrestricted tag identity[Abar | H G - Abar R] * [R; I] = H Gand theH-tagG-trapdoor property for invertibleH.Cslib.Crypto.LWE.Trapdoor.taggedMatrix_mul_extendedGadgetBasis,Cslib.Crypto.LWE.Trapdoor.natAbs_extendedGadgetBasis_inl_le,Cslib.Crypto.LWE.Trapdoor.natAbs_extendedGadgetBasis_inr_le: kernel membership and entry bounds for the lifted vectors[R; I] * S(the right-hand block ofS_Ain Lemma 5.3).Cslib.Crypto.LWE.Trapdoor.taggedMatrix_mulVec_invertSyndrome,Cslib.Crypto.LWE.Trapdoor.IsHTagTrapdoor.surjective,Cslib.Crypto.LWE.Trapdoor.taggedMatrix_surjective,Cslib.Crypto.LWE.Trapdoor.natAbs_invertSyndrome_inl_le: deterministic syndrome inversion and primitivity of matrices admitting anH-tagG-trapdoor.Cslib.Crypto.LWE.Trapdoor.trapdoorLWE_vecMul_trapdoorTransform,Cslib.Crypto.LWE.Trapdoor.invertLWESecret_trapdoorLWE,Cslib.Crypto.LWE.Trapdoor.invertLWE_trapdoorLWE,Cslib.Crypto.LWE.Trapdoor.invertLWE_trapdoorLWE_of_norm_bound: exact LWE inversion via a gadget trapdoor (Algorithm 2, deterministic part of Theorem 5.4).Cslib.Crypto.LWE.Trapdoor.mem_support_genTrap,Cslib.Crypto.LWE.Trapdoor.eval_genTrapIdeal_eq_uniform,Cslib.Crypto.LWE.Trapdoor.eval_genTrapIdeal_eq_of_tags: support guarantees forgenTrapand exact uniformity / tag-independence of the idealized hybridgenTrapIdeal.
References #
- D. Micciancio and C. Peikert, Trapdoors for Lattices: Simpler, Tighter, Faster, Smaller, Section 5; numbering follows IACR ePrint 2011/501.
Tagged parity-check matrices and H-tag trapdoors (Definition 5.2, Algorithm 1) #
The right block A_1 = H * G - Abar * R of a Micciancio–Peikert tagged parity-check matrix
([MP12], Section 5.2, Algorithm 1, step 2).
The Micciancio–Peikert tagged parity-check matrix A = [Abar | H * G - Abar * R]
([MP12], Section 5.2, Algorithm 1, step 2).
The untagged parity-check matrix A = [Abar | G - Abar * R] corresponding to H = I, the
default tag of [MP12], Algorithm 1.
R is a G-trapdoor for A with tag H ([MP12], Definition 5.2):
A * [R; I] = H * G modulo 2 ^ w and the tag H is invertible (IsUnit H).
Unrestricted tag equation: [Abar | H * G - Abar * R] * [R; I] = H * G modulo 2 ^ w for any
Abar, R, and H ([MP12], Section 5.2, Algorithm 1).
When H is invertible (IsUnit H), R is an H-tag G-trapdoor for
taggedMatrix w Abar R H ([MP12], Definition 5.2).
R is an I-tag G-trapdoor for untaggedMatrix w Abar R
([MP12], Definition 5.2 and Algorithm 1).
Tag-shift identity: subtracting (H - H') * G from the right block of an H-tagged matrix
yields the H'-tagged matrix for the same (Abar, R).
When the tag vanishes (H = 0, which is not an invertible tag), the trapdoor
transformation maps into the kernel of A: taggedMatrix w Abar R 0 * [R; I] = 0.
Syndrome lifting (f_A⁻¹) and lifted kernel vectors in Λ^⊥(A) (Section 5.1) #
Every short integer solution in the sense of Cslib.Crypto.SIS.IsSolution lies in the
q-ary kernel lattice Λ^⊥(A).
Action of taggedMatrix w Abar R H on a lifted vector [R z; z]:
A *ᵥ [R z; z] = H *ᵥ (G *ᵥ z) modulo 2 ^ w.
Lifting any kernel vector z ∈ Λ^⊥(G) yields a kernel vector [R z; z] ∈ Λ^⊥(A).
The w lifted kernel vectors [R; I] * S = [R S; S] obtained from the gadget basis
S = gadgetBasis w. These are the right-hand w columns of the basis S_A of
[MP12], Lemma 5.3; they alone do not span Λ^⊥(A), and the left-hand block of
S_A is not formalized.
Every column of extendedGadgetBasis w R lies in Λ^⊥(A):
taggedMatrix w Abar R H * ([R; I] * S) ≡ 0 (mod 2 ^ w).
Top-block entry bound for extendedGadgetBasis w R: if every entry of row j of R has
magnitude at most B, then |(R * S) j q| ≤ 2 * (|ι| * w) * B.
Bottom-block entry bound for extendedGadgetBasis w R: every entry has magnitude at most 2.
Deterministic syndrome inversion f_A⁻¹ using the trapdoor R and inverse tag Hinv:
given u : ι → ZMod (2 ^ w), decompose Hinv *ᵥ u into {0, 1} digits via gadgetDecomp w and
lift via [R; I]. This is a deterministic analogue of the preimage sampler of
[MP12], Section 5.4: it returns a short preimage, not a Gaussian sample.
Correctness of deterministic syndrome inversion: if H * Hinv = 1, then
A *ᵥ invertSyndrome w Hinv R u = u modulo 2 ^ w.
Any parity-check matrix A admitting an H-tag G-trapdoor R is primitive: its integer
column combinations span (ZMod (2 ^ w)) ^ ι (the remark after [MP12],
Definition 5.2).
Any tagged matrix with an invertible tag H (H * Hinv = 1) is primitive: its integer
column combinations span (ZMod (2 ^ w)) ^ ι (the remark after [MP12],
Definition 5.2).
Top-block infinity-norm bound for invertSyndrome: if every entry in row j of R has
magnitude at most B, then |invertSyndrome w Hinv R u (Sum.inl j)| ≤ (|ι| * w) * B.
Bottom-block infinity-norm bound for invertSyndrome: every bottom coordinate lies in
{0, 1}, hence has magnitude at most 1.
Deterministic trapdoor LWE inversion (Section 5.3, Algorithm 2, Theorem 5.4) #
The LWE evaluation g_A(s, e) = sᵀ A + eᵀ mod 2 ^ w associated with a parity-check matrix A
([MP12], Section 5.3; LWE itself is recalled in Section 2.2).
Fundamental reduction of g_A to g_G via [R; I]: right-multiplying
bᵀ = sᵀ A + eᵀ mod 2 ^ w by [R; I] produces g_G(Hᵀ s, eᵀ [R; I])
([MP12], Section 5.3, Algorithm 2, step 1).
Infinity-norm bound on the projected error eᵀ [R; I]:
if |R j p| ≤ B_R for all j and |e k| ≤ B_e for all k, then
|projectedError R e p| ≤ (1 + |μ| * B_R) * B_e. This is an infinity-norm substitute for the
Cauchy–Schwarz step in the proof of [MP12], Theorem 5.4.
Recover the LWE secret s from bᵀ = sᵀ A + eᵀ mod 2 ^ w using the trapdoor R and inverse
tag Hinv ([MP12], Section 5.3, Algorithm 2, steps 1–3, with the oracle O
instantiated by invertGadget w): compute bhat = b ᵥ* [R; I], invert g_G, and multiply by
Hinv.
Full LWE inversion algorithm Invert(R, A, b) ([MP12], Algorithm 2):
recover s = invertLWESecret w Hinv R b and lift b - s ᵥ* A to its unique short integer
representative via ZMod.valMinAbs.
Secret recovery for Algorithm 2 (deterministic part of [MP12],
Theorem 5.4): if H * Hinv = 1 and 4 * |projectedError R e p| < 2 ^ w for all
p : ι × Fin w, then invertLWESecret recovers s from
trapdoorLWE w (taggedMatrix w Abar R H) s e. The hypothesis is the coordinatewise condition
R̄ e ∈ P_{1/2}(q · B⁻ᵗ) from the proof of Theorem 5.4 with B = 2 I (slightly strict at the
endpoint -q / 4), not the paper's Euclidean bound on e.
Full LWE inversion correctness (Invert, [MP12], Algorithm 2,
deterministic part of Theorem 5.4): under H * Hinv = 1, 4 * |projectedError R e p| < 2 ^ w,
and 2 * |e k| < 2 ^ w, invertLWE recovers the exact pair (s, e).
Infinity-norm analogue of the first claim of [MP12], Theorem 5.4:
if |R j p| ≤ B_R, |e k| ≤ B_e, and 4 * (1 + |μ| * B_R) * B_e < 2 ^ w, then invertLWE
recovers (s, e) from g_A(s, e). The paper's version bounds ‖e‖ in terms of s_1(R); the
probabilistic claim for Gaussian errors is not formalized.
Probabilistic GenTrap algorithm and idealized hybrid (Section 5.2, Algorithm 1) #
Sample a row of a short integer trapdoor matrix R with independent centered-binomial
entries in [-η, η] (one admissible choice of the distribution D in
[MP12], Algorithm 1; the paper's instantiations use subgaussian or discrete
Gaussian D).
Support characterization of sampleTrapdoorMatrix: a matrix R is in the support iff every
entry has magnitude at most η.
Probabilistic trapdoor key generation GenTrap_D(Abar, H) with uniform Abar
([MP12], Section 5.2, Algorithm 1):
sample a uniform matrix Abar ← sampleMatrix n mbar w and a short trapdoor matrix
R ← sampleTrapdoorMatrix mbar n w η, and output (taggedMatrix w Abar R H, R).
For any invertible tag H (IsUnit H), every pair (A, R) in the support of
genTrap n mbar w η H satisfies IsHTagTrapdoor w A R H, the entrywise bound |R j p| ≤ η, and
A = taggedMatrix w Abar R H for some Abar
([MP12], Algorithm 1, "whose correctness is immediate").
Idealized hybrid of GenTrap: replacing Abar * R by an independent uniform matrix U
yields [Abar | H * G - U]. [MP12], Section 5.2, argues that A is close to
uniform "as long as the distribution of [Abar | -Abar R] is"; both the statistical and the
computational instantiation justify exactly this replacement. Neither justification is
formalized here, so no statement relates genTrap to genTrapIdeal.
In the ideal LWE hybrid of GenTrap, the public matrix [Abar | H * G - U] is identically
uniform over Matrix (Fin n) (Fin mbar ⊕ (Fin n × Fin w)) (ZMod (2 ^ w)) for every tag H.
In particular, its distribution is independent of H.
Tag-independence of genTrapIdeal: any two tags H and H' induce the exact same public
matrix distribution.