[SHA3] Lean verification proof#161
Open
abentkamp wants to merge 2 commits into
Open
Conversation
Closed
62b87e5 to
f0328b1
Compare
ade135e to
205eebf
Compare
205eebf to
8ea00e8
Compare
abentkamp
pushed a commit
to abentkamp/libcrux-iot-for-claude
that referenced
this pull request
Jun 10, 2026
…dels Ports the working proofs from `cryspen/libcrux-iot` PR cryspen#161 (`libcrux-iot/sha3/proofs/aeneas-lean/LibcruxIotSha3/{Composition/HacspecBridge, Foundation/I32LoopSpec}.lean`) to the ml-kem tree. The toolchain bump to Lean v4.30.0-rc2 brought a new `CoreModels.core.iter.range.IteratorRange.next` body that uses `cloneCloneInst` / `corecmpPartialOrdInst` field names (was `cloneInst` / `partialOrdInst`) and threads `partial_cmp`'s output through `Result` (was a plain `Option Ordering`). The two `IteratorRange_next_spec_*` theorems we hand-wrote previously no longer typecheck, so they were sorry'd in 1813afc. New proof strategy mirrors PR cryspen#161: split on `i.val < e.val`, derive an `h_eq` equation showing `IteratorRange.next … = .ok (…)` by unfolding the partial_cmp + clone + forward_checked components, then close the Hoare triple with `simp [Triple, WP.wp, PredTrans.apply]` and either `exact h_lt …` or `exact h_ge …`. Net delta: -2 sorries in `LibcruxIotMlKem/Util/LoopSpecs.lean`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR provides a Lean equivalence proof connecting the hacspec-style sha3 specification to the libcrux-iot implementation. The implementations are proved equivalent up to the top-level SHA-3 and SHAKE functions (sha256_ema, etc.). The incremental API is not verified.
Most of the code has been generated by Claude.
The Readme at libcrux-iot/sha3/proofs/aeneas-lean/LibcruxIotSha3/README.md contains more information about the Lean verification.
One issue that I don't have a good solution for yet: The extraction works only with hax-evit, which must be reviewed by Evit before we are allowed to publish it. It will probably be public in 2-3 weeks.