This project formalizes fundamental worst-case-to-average-case reductions in lattice-based cryptography using Lean4. Along the way, we aim to build a library of formalized mathematical tools for verifying future lattice-based algorithms.
All definitions and theorem statements are written by humans, but most proofs are generated by LLMs. As a result, some Lean proofs may look more complicated than necessary; this usually means they were “vibe‑proved” by an LLM. What matters is the statement of each theorem. As long as the statement is correct, we are good.
LLMs used in this project include GPT-5.2-Codex, Claude Sonnet 4.5, and Aristotle from Harmonic. We also credit the lean-lsp-mcp project, which is the key tool enabling agentic proof generation.
To add LatticeCrypto as a dependency to your Lean project, add the following to your lakefile.toml:
[[require]]
name = "LatticeCrypto"
scope = "xyguo"
rev = "main"- Module:
LatticeCrypto.Foundations.Lattice - Lattice definition and properties
- Basis representation and linear independence
- Lattice operations (shift, scaling)
- Related structures (coset, dual lattice)
- Fundamental lattice parameters (fundamental domain, determinant)
- Successive minima and Minkowski’s First and Second Theorems
- Module:
LatticeCrypto.Foundations.Lattice - Discrete Gaussian
- Probability: common distributions, expectation, concentration inequalities (Markov/Chebyshev/Chernoff)
- Fourier transform, FFT, Poisson's Summation Formula
- Banasczyk's transference theorem
- Smoothing parameter
- Module:
LatticeCrypto.Foundations.Algorithms -
Gram-Schmidt orthogonalization(using Mathlib version) - The LLL (Lenstra-Lenstra-Lovász) basis reduction algorithm
- Babai's Nearest Plane algorithm
- Discrete Gaussian sampling
- The BKZ (Block Korkine-Zolotarev) algorithm
- Module:
LatticeCrypto.Foundations.Hardness - Computational complexity: asymptotics, reductions, query complexity
- Definition of hard lattice problems (SVP, CVP, GapSVP, GapCVP, SIVP)
- Reduction between problems (?)
- Formal statements of hardness assumptions (?)
- Module:
LatticeCrypto.Primitives.SIS - SIS problem definition
- CRHF from SIS
- Module:
LatticeCrypto.Primitives.LWE - LWE problem definition and variants
- Error distribution (discrete Gaussian)
- PKE from LWE
- Module:
LatticeCrypto.Primitives.RingLWE,LatticeCrypto.Primitives.ModuleLWE,LatticeCrypto.Primitives.RingSIS,LatticeCrypto.Primitives.ModuleSIS - Polynomial rings and ideals
- Ring-LWE/SIS problem definition
- Module-LWE/SIS generalization