eBPF-based security platform
Lean 4 proofs
Add a model
- Write
testing/proofs/lean4/Shirudo/<Name>.lean, with the SPDX and copyright lines oftesting/proofs/lean4/Shirudo.lean, following the C as "Rules" below says. - Import it from
testing/proofs/lean4/Shirudo.lean. - Run
make proofs-lean4: it builds every module with warnings as errors, then checks each proof again withleancheckerand nanoda. - Link the model to the C with a CBMC proof where one is cheap, as
string-number-modeldoes; otherwise the coverage page says it follows the C by review. - Add its row to the "Lean 4 proofs" table of
Documentation/contribute/testing/proof-coverage.rst: the module and the C it models, the theorems, the assumptions each rests on, and how it follows the C.
Rules
- A model goes in
testing/proofs/lean4/Shirudo/<Name>.lean, imported fromShirudo.lean, and follows the C step by step, with the values the C can hold (2^64 for a__u64). - What the C cannot show, such as a hash being collision resistant, is an explicit hypothesis of the theorem, never an axiom.
- Core Lean only, no Mathlib:
omega,simp,decideand induction carry these proofs. A lemma Mathlib has, such asList.map_injective_iff, is proved in the file. - The lakefile builds every module under
Shirudo/, imported or not, and makes every warning an error, so asorry, a deprecated name or an unusedsimpargument fails the build. run.shthen checks every proof again, with Lean's kernel (leanchecker) and with nanoda, a kernel written apart from Lean, which admits only the axiomsnanoda.jsonpermits:propext,Classical.choiceandQuot.sound. Anative_decide, which rests on the compiler, or anaxiomof our own stops nanoda withdeclaration not foundand the name. Prove withdecide,omegaorsimpinstead, and keepnanoda.json's list as it is.- A model proves the algorithm, not the C. Link the two with a CBMC
proof where one is cheap, as
string-number-model.cchecksparse_u64()againstNumber.leanup to 4 bytes andbpm-tree-sync-model.cruns the tree sync againstTreeSync.lean's steps; the coverage page says which models follow the C by review. - The toolchain is the one
lean-toolchainnames; elan installs it.