The lattice stack is split into four layers:
LatticeCrypto/: generic lattice algebra, hardness assumptions, scheme specs, security theorems, and executable concrete implementations.LatticeCryptoTest/: ACVP vectors, randomized regression tests, and differential checks against native reference code.csrc/: small C shims that expose the native ML-DSA, ML-KEM, and Falcon implementations to Lean.third_party/: vendored native backends used by the FFI and test harnesses.
Use VCVio/ when you are changing framework abstractions such as SignatureAlg, IdenSchemeWithAbort, GPVHashAndSign, or FujisakiOkamoto. Use LatticeCrypto/ when you are instantiating those abstractions for a lattice scheme.
LatticeCrypto/Ring/Core.lean:PolyBackend,PolyVec,PolyMatrix,NegacyclicQuotient.LatticeCrypto/Ring/Kernel.lean:PolyKernel,NegacyclicRing,NegacyclicRingSemantics, schoolbook multiplication.LatticeCrypto/Ring/VectorBackend.lean: canonical vector-backed instantiation.LatticeCrypto/Ring/Transform.lean:TransformPoly,TransformOps, and transform laws.LatticeCrypto/Ring/Norms.lean: centered representatives,NormOps, and generic norm infrastructure.LatticeCrypto/Ring/Rounding.lean: abstractRoundingOpsandPower2RoundOpsused by ML-DSA.LatticeCrypto/Ring/IntegralLift.lean:IntegralLiftfor Falcon integer-polynomial arithmetic.LatticeCrypto/Ring/NTTCert.lean: shared matrix certification scaffolding for concrete NTTs.LatticeCrypto/DiscreteGaussian.lean: generic discrete Gaussian support used by Falcon.
LatticeCrypto/HardnessAssumptions/LearningWithErrors.lean: the generic LWE / MLWE problem surfaces used by ML-KEM.LatticeCrypto/HardnessAssumptions/ShortIntegerSolution.lean: SIS and self-target variants used by ML-DSA and Falcon-style arguments.
LatticeCrypto/MLDSA/Params.lean: parameter sets and byte sizes.LatticeCrypto/MLDSA/Arithmetic.lean: ML-DSA-specific arithmetic assembly, vectors, and NTT-facing types.LatticeCrypto/MLDSA/Primitives.lean: abstract hashing, sampling, rounding, and encoding-facing operations.LatticeCrypto/MLDSA/Scheme.lean: proof-level identification scheme with aborts.LatticeCrypto/MLDSA/Signature.lean: FIPS-style signing and verification layer built on the proof-level scheme.LatticeCrypto/MLDSA/Security.lean: reduction statements from the signature / IDS surfaces to underlying assumptions.LatticeCrypto/MLDSA/Concrete/: executable implementations of NTT, sampling, rounding, encoding, and FFI-backed instances.
LatticeCrypto/MLKEM/Params.lean: parameter sets and ciphertext / key dimensions.LatticeCrypto/MLKEM/Arithmetic.lean: ML-KEM arithmetic assembly and vector types.LatticeCrypto/MLKEM/Primitives.lean: abstract sampling, hashing, and encoding-facing operations.LatticeCrypto/MLKEM/KPKE.lean: public-key encryption layer.LatticeCrypto/MLKEM/Internal.lean: deterministic internal algorithms following the FIPS decomposition.LatticeCrypto/MLKEM/KEM.lean: top-level checked KEM interface.LatticeCrypto/MLKEM/Security.lean: IND-CPA and IND-CCA theorem surfaces.LatticeCrypto/MLKEM/Concrete/: executable CBD, encoding, NTT, FFI, and instance wiring.
LatticeCrypto/Falcon/Params.lean: scheme constants.LatticeCrypto/Falcon/Arithmetic.lean: Falcon arithmetic assembly and integer-polynomial infrastructure.LatticeCrypto/Falcon/Primitives.lean: abstract primitive operations such as sampling, hashing, and compression.LatticeCrypto/Falcon/Scheme.lean: scheme semantics and the GPV bridge.LatticeCrypto/Falcon/Security.lean: high-level security statements.LatticeCrypto/Falcon/Concrete/: executable FFT, NTT, floating-point emulation, keygen, sampling, signing, and FFI support.
The lattice schemes are not standalone frameworks. They reuse the generic cryptographic interfaces in VCVio/CryptoFoundations:
- ML-DSA instantiates
IdenSchemeWithAbortandFiatShamirWithAbort. - Falcon instantiates
GPVHashAndSignandGenerableRelation. - ML-KEM uses the generic
AsymmEncAlg,KEMScheme, and Fujisaki-Okamoto security surfaces.
If a change affects both the generic abstraction and a lattice instantiation, update both sides in one pass. Do not leave compatibility shims behind.
When the task is about:
- proof-level semantics or reduction statements: start in
Scheme.leanorSecurity.lean - FIPS algorithm structure: start in
Signature.lean,KEM.lean, orInternal.lean - executable arithmetic or codec behavior: start in
Concrete/ - native differential tests or vector failures: start in
LatticeCryptoTest/and then follow the import chain intoConcrete/orcsrc/ - generic security-game surfaces: start in
VCVio/CryptoFoundations/
- Keep the proof-level and executable layers distinct.
Scheme.leanis usually the semantic model;Concrete/files are the executable realization. - ML-DSA has both an identification-scheme layer and a FIPS signing layer. Changes to challenge formation, abort conditions, or rounding often need updates in both
Scheme.leanandSignature.lean. - ML-KEM separates K-PKE, deterministic internal algorithms, and the top-level checked KEM wrapper. Put changes at the lowest layer that matches the semantics you need.
- Falcon uses GPV-style abstractions at the proof layer and FFT / FPR machinery at the executable layer. Do not mix those concerns unless you are explicitly proving the bridge.
- Differential tests rely on
csrc/andthird_party/. If a pure Lean change breaks only those tests, check for serialization, endian, or fixed-size input mismatches before touching the mathematical layer.