feat(MLDSA): short-secret MLWE model and the exact NMA key-swap hop - #504
Conversation
…image Thread the RO preimage through SelfTargetMSIS.Problem.isValid (now Challenge → Target → HashInput → HashOutput → Response → Bool) and have the experiment pass the cache-consistent hashInput it already looks up. The ML-DSA instance mldsaSTMSIS additionally requires hashInput.2 = w' — the recovered commitment must equal the commitment component of the hashed pair — closing the trivial X = X solution the tailored relation previously admitted. On the accepting path the forger's own returned (msg, w') is the queried preimage, so the extraction proof discharges the binding for free. The characterization mldsaSTMSIS_isValid_eq_true_iff states acceptance as verifier acceptance ∧ the binding conjunct, keeping the self-target requirement visible. The abstract SelfTargetMSIS.Problem type parameters are unchanged, so abstract references elsewhere are unaffected; the diff is confined to the two touched declarations. Claude-Session: https://claude.ai/code/session_01DaNGD9nDo3Grwk58nsjS77
Add the corrected short-secret idealized ML-DSA model and the exact NMA key-swap hop, purely additively on top of the existing seed-based chain. Scheme.lean: validKeyPairShort (+ validKeyPairShort_eq_true_iff), identificationSchemeShort. SecurityNMA.lean: polyVecBounded_zero, sampleShortVec, mem_support_sampleShortVec, keygenShort, keygenShort1, hrShort, keygenShort_generable, nmaGameShort, nmaAdvantageShort, nmaGameShort_eq_keygen_bind, mldsaMLWEShort, mldsaMatrixMLWE, expandAIdealization, distinguisherBShort, matrixLift, advantage_mldsaMLWEShort_le_matrix, and the headline nma_keyswap_hop_short (an exact identity: no statistical slack, no extra axioms). The seed-to-matrix bridge uses the existing generic evalDist_bind_bind_swap. Claude-Session: https://claude.ai/code/session_01DaNGD9nDo3Grwk58nsjS77
🤖 PR SummaryOverviewThis PR adds the short-secret Module-LWE (MLWE) model and an exact NMA key-swap hop for ML-DSA, the second step of a decomposition of the full NMA security proof. It is stacked on #503 (the SelfTargetMSIS binding repair), but the substantive additions are confined to The core mathematical contribution is a corrected information-theoretic model for the MLWE leg of the NMA reduction, replacing the earlier full-ring-uniform Headline Additions
Missing or Incomplete Items
Verification
Files by Nature
Placeholders (
|
| Metric | Count |
|---|---|
| 📝 Files Changed | 2 |
| ✅ Lines Added | 489 |
| ❌ Lines Removed | 0 |
Lean Declarations
✏️ Added: 20 declaration(s)
LatticeCrypto/MLDSA/Scheme.lean (3)
@[simp] theorem validKeyPairShort_eq_true_iff (pk : PublicKey p prims) (sk : SecretKey p) :def identificationSchemeShortnoncomputable def validKeyPairShort (pk : PublicKey p prims) (sk : SecretKey p) : Bool
LatticeCrypto/MLDSA/SecurityNMA.lean (17)
def expandAIdealization (p : Params) (prims : Primitives p)lemma advantage_mldsaMLWEShort_le_matrix {εA : ℝ}lemma mem_support_sampleShortVec {k b : ℕ} [SampleableType (RqVec k)] {v : RqVec k}lemma polyVecBounded_zero (k b : ℕ) : polyVecBounded (0 : RqVec k) bnoncomputable def distinguisherBShortnoncomputable def hrShort :noncomputable def keygenShort : ProbComp (PublicKey p prims × SecretKey p)noncomputable def keygenShort1 : ProbComp (PublicKey p prims × SecretKey p)noncomputable def matrixLiftnoncomputable def mldsaMLWEShort (p : Params) (prims : Primitives p)noncomputable def mldsaMatrixMLWE (p : Params)noncomputable def nmaAdvantageShortnoncomputable def nmaGameShortnoncomputable def sampleShortVec (k b : ℕ) [SampleableType (RqVec k)] : ProbComp (RqVec k)theorem keygenShort_generable :theorem nmaGameShort_eq_keygen_bindtheorem nma_keyswap_hop_short
sorry Tracking
- No
sorrys were added, removed, or affected.
📋 **Additional Analysis**
No findings.
📄 **Per-File Summaries**
- LatticeCrypto/MLDSA/Scheme.lean: Added
validKeyPairShort, a noncomputable decidable predicate that holds when a key pair is built from bounded short vectorss₁, s₂and seedsρ, Kdirectly (the ∃-material analogue of the existing ∃-seedvalidKeyPair), along with a@[simp]equivalence theoremvalidKeyPairShort_eq_true_iff. Also addedidentificationSchemeShort, which reuses the same commit/respond/verify algorithms asidentificationSchemebut is typed under thevalidKeyPairShortkey relation, enabling the short-model security statements to refer to an idealized scheme where keys satisfy the material-based relation rather than the seed-derived one. - LatticeCrypto/MLDSA/SecurityNMA.lean: This diff adds several new definitions, lemmas, and instances to
SecurityNMA.leanthat instantiate the "short-secret" idealized model for ML-DSA's EUF-NMA security. It introduces:
polyVecBounded_zero: a lemma that the zero vector isb-bounded (polyVecBounded).sampleShortVec: a noncomputable probabilistic program that samples uniformly from theη-bounded boxS_η^k.mem_support_sampleShortVec: a lemma that vectors in the support ofsampleShortVecsatisfypolyVecBounded.keygenShortandkeygenShort1: noncomputable idealized key-generation procedures (public keytisExpandA(ρ)·s₁ + s₂vs. uniform, respectively).hrShort: aGenerableRelationovervalidKeyPairShortwhose generator iskeygenShort.keygenShort_generable: a theorem certifying that such aGenerableRelationis inhabited.nmaGameShortandnmaAdvantageShort: the EUF-NMA game and advantage over the short-key scheme (identificationSchemeShort).mldsaMLWEShortandmldsaMatrixMLWE: noncomputable definitions of the seed-based and uniform-matrix short-secret Module-LWE problems for ML-DSA.expandAIdealization: a definition of theExpandAidealization assumption as a property (the pair(ρ, ExpandA(ρ))isεA-indistinguishable from(ρ, A)with uniform independentA).distinguisherBShort: the induced short-model MLWE distinguisher.matrixLift: a function lifting a seed-based short-MLWE adversary to the uniform-matrix problem.advantage_mldsaMLWEShort_le_matrix: a lemma bounding the seed-based short-MLWE advantage by the uniform-matrix advantage plusεAunderexpandAIdealization.nmaGameShort_eq_keygen_bindandnma_keyswap_hop_short: theorems that provide an exact (no statistical slack) monadic rewrite identifying the short-model NMA-game gap with themldsaMLWEShortdistinguishing advantage ofdistinguisherBShort.
No sorry or admit statements are introduced by this diff.
Last updated: 2026-07-28 21:19 UTC.
dtumad
left a comment
There was a problem hiding this comment.
Reviewed the now-clean 489-line slice after #503 landed. The corrected model matches the relevant ML-DSA/Module-LWE semantics: s1 and s2 are sampled from the eta-bounded centered box, rather than using the information-theoretically trivial full-ring-uniform error; keygenShort and keygenShort1 differ only by replacing A·s1+s2 with uniform t; and the NMA game discards the secret key, so the proof correctly strips the independent K draw (and the now-unused short vectors on the uniform branch). The resulting key-swap is an exact game identity.
The seed-to-matrix bridge is also honestly scoped. expandAIdealization states the XOF-as-random-matrix replacement explicitly, and its docstring correctly notes that the unrestricted deterministic-function form is not a small-epsilon fact pending a cost-bounded model. matrixLift ignores the challenged matrix itself but receives its A·s+e target, which is exactly what the comparison requires.
I built LatticeCrypto from the exact post-merge head on Lean 4.32. One optional wording refinement: sampleShortVec k b is uniform over the subtype defined by the centered infinity-norm bound for every b; describing this as each coefficient uniform on the integer interval [-b,b] is literally exact only while b stays within the canonical centered residue range. That includes every intended ML-DSA eta, so it does not affect this model or any theorem. This looks safe to land once the rerun finishes.
Step 2 of the #467 decomposition @dtumad proposed: the corrected short-secret MLWE model and the exact NMA key-swap hop, as a focused, purely additive PR.
Stacked on #503 (the SelfTargetMSIS binding repair) — until #503 lands, its diff shows here too; this PR's own content is the ~489 additive lines in
SecurityNMA.lean+Scheme.lean. The two are independent in content (MLWE leg vs SelfTargetMSIS leg); the stacking is just to keep the decomposition ordered.What this adds
The MLWE leg of the ML-DSA NMA reduction, modelled over the η-bounded box rather than the full ring — fixing the information-theoretically-zero-advantage issue of the earlier full-ring-uniform
mldsaMLWE:sampleShortVec(uniform on the η-box),keygenShort/keygenShort1(idealized key generation sampling ρ, K, and short (s₁, s₂) independently).validKeyPairShort(the ∃-material key relation) +identificationSchemeShort, with the satisfiability certificatekeygenShort_generable(⟨hrShort, rfl⟩) — so the relation/pinning hypotheses these introduce are inhabited, not vacuous.mldsaMLWEShort(seed-based short-secret MLWE) andmldsaMatrixMLWE(the standard uniform-matrix form), withexpandAIdealization(the named XOF-as-random-matrix assumption, computational reading disclosed) and the proven seed→matrix bridgeadvantage_mldsaMLWEShort_le_matrixviamatrixLift.nma_keyswap_hop_short— the headline: the NMA-game gap between the real and uniform-tshort key generators is bounded by themldsaMLWEShortdistinguishing advantage ofdistinguisherBShort, as an exact identity — noidealGap/hSlackstatistical-slack term (the earlierhonestSamplingSlackstopgap is not used).Scope
Purely additive — no existing declaration is modified or removed. The old
mldsaMLWE/nma_securitychain on the base is untouched here; it is retired when the NMA headline moves over (a later step). The SelfTargetMSIS/extraction/headline development (mldsaSTMSISShort,nma_security_short/fips, ...) is not in this PR — it is steps 3–4.Verification
Off current main (v4.32.0).
lake build ToMathlib VCVio LatticeCrypto Extern HashSig Examples VCVioWidgetsgreen.nma_keyswap_hop_short,advantage_mldsaMLWEShort_le_matrix, andkeygenShort_generableall kernel-check[propext, Classical.choice, Quot.sound]. Both touched files CI-lint clean.https://claude.ai/code/session_01DaNGD9nDo3Grwk58nsjS77