The dataset viewer is not available for this split.
Error code: StreamingRowsError
Exception: CastError
Message: Couldn't cast
version: string
packagesDir: string
packages: list<item: struct<url: string, type: string, subDir: null, scope: string, rev: string, name: string, (... 78 chars omitted)
child 0, item: struct<url: string, type: string, subDir: null, scope: string, rev: string, name: string, manifestFi (... 66 chars omitted)
child 0, url: string
child 1, type: string
child 2, subDir: null
child 3, scope: string
child 4, rev: string
child 5, name: string
child 6, manifestFile: string
child 7, inputRev: string
child 8, inherited: bool
child 9, configFile: string
name: string
lakeDir: string
fixedToolchain: bool
permitted_axioms: list<item: string>
child 0, item: string
challenge_module: string
theorem_names: list<item: string>
child 0, item: string
solution_module: string
enable_nanoda: bool
to
{'challenge_module': Value('string'), 'solution_module': Value('string'), 'theorem_names': List(Value('string')), 'permitted_axioms': List(Value('string')), 'enable_nanoda': Value('bool')}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 151, in get_rows_or_raise
return get_rows(
dataset=dataset,
...<4 lines>...
column_names=column_names,
)
File "/src/libs/libcommon/src/libcommon/utils.py", line 274, in decorator
return func(*args, **kwargs)
File "/src/services/worker/src/worker/utils.py", line 131, in get_rows
rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
File "/src/services/worker/src/worker/utils.py", line 574, in safe_iter
yield from ds.decode(False) if ds.features else ds
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 3074, in __iter__
for key, example in ex_iterable:
^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2578, in __iter__
for key, pa_table in self._iter_arrow():
~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2603, in _iter_arrow
for key, pa_table in self.ex_iterable._iter_arrow():
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 577, in _iter_arrow
for key, pa_table in iterator:
^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 459, in _iter_arrow
for key, pa_table in self.generate_tables_fn(**gen_kwags):
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 373, in _generate_tables
self._cast_table(pa_table, json_field_paths=json_field_paths),
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2394, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2322, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
version: string
packagesDir: string
packages: list<item: struct<url: string, type: string, subDir: null, scope: string, rev: string, name: string, (... 78 chars omitted)
child 0, item: struct<url: string, type: string, subDir: null, scope: string, rev: string, name: string, manifestFi (... 66 chars omitted)
child 0, url: string
child 1, type: string
child 2, subDir: null
child 3, scope: string
child 4, rev: string
child 5, name: string
child 6, manifestFile: string
child 7, inputRev: string
child 8, inherited: bool
child 9, configFile: string
name: string
lakeDir: string
fixedToolchain: bool
permitted_axioms: list<item: string>
child 0, item: string
challenge_module: string
theorem_names: list<item: string>
child 0, item: string
solution_module: string
enable_nanoda: bool
to
{'challenge_module': Value('string'), 'solution_module': Value('string'), 'theorem_names': List(Value('string')), 'permitted_axioms': List(Value('string')), 'enable_nanoda': Value('bool')}
because column names don't matchNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Mirror of
anthropics/formal-math/latticesat commit487d55985d80f85f6b749248c513ec43eae38336, licensed under Apache-2.0 (seeLICENSEandNOTICE). All credit to the original authors.
Four papers on lattices: a Lean 4 formalization
This folder holds four papers on lattice problems and lattice-based cryptography, and a Lean 4 formalization of their results.
The results were discovered by an internal research Claude model. The formalization was written by AI models.
Research artifact. Not maintained and not accepting contributions.
The papers
What is formalized
The main theorems are stated in PaperDefs/, under their printed numbers. They assume no conjecture and no published theorem: the cited results that the proofs use are formalized as well, with their proofs. Algorithms are programs of a quantum word RAM, defined in about 1,000 lines in CryptoDefs/, and time is the number of its steps.
| What | Stated in | Checked by |
|---|---|---|
| The main theorems: 132 statements | PaperDefs/ |
Comparator |
| Intermediate theorems, remarks and detailed forms: 190 statements | PaperDetails/ |
Comparator |
| The machine defines the standard P, BPP, PSPACE and BQP; simulations, oracles, resources: 63 theorems | Challenge/Machine.lean |
Comparator |
| The papers' lemmas, and that explicit programs execute the printed algorithms | proof/QLStatement/, proof/QL/ |
lake build |
A good place to start is PaperDefs/P01/Cases.lean, which states eight results on paper 1 in a few lines each. For example, one quantum program solves search Module-LWE in quasi-polynomial time, for every fixed rank, all large degrees, moduli above a polynomial bound and almost all square matrices:
def ModuleLWETheorem : Prop :=
∃ program : QuantumProgram, ∃ c : ℕ, ∀ rank ≥ (1 : ℕ),
∀ᶠ n : ℕ in largePowersOfTwo, ∀ noise ≥ 1, ∀ q ∈ Set.Icc (11 * rank * noise ^ 2 * n) (2 ^ n),
ForAllButFraction (2 ^ (-(n : ℝ) / (240 * rank))) fun A : Fin rank → Fin rank → Fin n → Fin q =>
program.SolvesEveryInstance (moduleLWE A noise) (told := [n, rank, rank])
(time := 2 ^ (c * rank ^ 8 * n.log2 ^ 2))
The results are asymptotic, and the algorithms are not practical for the parameter sets of ML-KEM and ML-DSA.
Not formalized, or formalized weaker than printed
Running times count steps of the machine, so some bounds differ from the printed ones by logarithmic factors. That a program executes a printed algorithm means that it records the printed values and makes the printed calls and random choices, in order. Where a paper cites a subroutine without giving it, the programs use one of ours. Two remarks, one heuristic and one with open questions, are not formalized, and Remark 7.17 of paper 4 is conditional on an open question, as in the paper. docs/departures.md lists the differences between the Lean statements and the text.
How to check it
With elan installed, in this folder:
lake exe cache get
lake build
lake env lean scripts/PrintAxioms.lean
The build takes a little over an hour on 12 cores, with 12 GB of memory and 21 GB of disk. Only Challenge/ contains sorry. The last command prints the axioms behind each compared theorem: propext, Classical.choice and Quot.sound.
The fuller check is Comparator (bash ../.github/scripts/comparator-check.sh, on Linux). It verifies that Solution/ proves exactly the statements of Challenge/, from these three axioms, and replays the proofs in Lean's kernel and in the independent kernel nanoda. Its three configurations take about 60, 40 and 5 minutes and up to 14 GB of memory.
What a reader has to trust: the statements and the definitions that they use (CryptoDefs/, PaperDefs/, PaperDetails/, ConsistencyDefs/, Mathlib), Challenge/, the configuration files, and the checkers; for the last row of the table above, also the statements in proof/. That the statements say what the papers say is for the reader to judge; AI readers have compared them with the text.
Security. Building downloads the Lean toolchain, Mathlib and Mathlib's compiled files, and compiling Lean code runs its tactics and macros with the rights of your user.
How the files are laid out
| Path | What it holds |
|---|---|
papers/ |
the four papers |
CryptoDefs/ |
the machine, resources and problems |
ConsistencyDefs/ |
Turing machines, circuits and classes, against which Challenge/Machine.lean holds the machine |
PaperDefs/ |
the main theorems |
PaperDetails/ |
the further statements |
Challenge/, comparator-*.json |
one theorem for each statement, with sorry in place of its proof; which theorems Comparator compares |
Solution/ |
one file for each file of Challenge/, which imports the proofs and adds nothing |
proof/Crypto/ |
the library on the machine: a language, its compiler, circuits |
proof/CryptoConsistency/ |
the proofs of the theorems on the machine; end theorems in Theorems/ |
proof/QLStatement/ |
the full statements, with the printed algorithms |
proof/QL/ |
the proofs: mathematics (Tactic/ to Lattice/), computation (Tree/ to Quantum/), Algo/, Crypto/, Cited/, one folder for each paper; Papers/ has nearly all compared theorems, Named/ the theorems on named programs |
proof/CryptoMeta/, proof/QLMeta/ |
tactics and programs on terms that import Lean alone; Lake compiles them to native code (untrusted) |
docs/departures.md |
where the Lean statements differ from the papers |
docs/INDEX.md |
the papers item by item |
scripts/PrintAxioms.lean |
prints the axioms behind the compared theorems |
QL.P04.Corollary_1_4a is Corollary 1.4 (a) of paper 4, and QL.P04.corollary_1_4a says that it holds. docs/INDEX.md leads from a printed number to the Lean declarations. proof/QLStatement/README.md explains the statements on explicit programs, the marks in doc comments and the keys of cited works. In the documents, a path that begins with QL/, QLStatement/, Crypto/ or CryptoConsistency/ is a file of proof/.
License
- Downloads last month
- 91