Add Basic hax extraction setup#1
Merged
kraemv merged 3 commits intokraemv:feature/kmacfrom Jan 22, 2026
Merged
Conversation
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.
Hi,
I think I can't push to your PR branch directly so I'm making a PR for your fork instead.
This PR adds a minimal setup for running
haxrelease 0.3.6 on thekmaccrate to extract everything to F*.After you've installed hax (let me know if you need help in setting up hax), you can run
to extract the
kmacRust source to F*. Once you've done that, you can run the F* typechecker on the extracted code withIf that succeeds without errors then you've shown that the code you extracted does not panic. As it is now, the extraction will work (I commented out two unsupported
constblocks), but F* typechecking will fail. There can be different reasons for the typechecking step to fail, most often the following:Identifier not foundor similar in the output of./hax.py prove. In this case you can either try to write thing you want to do in a different way on the Rust side, or get in touch about if/how we can extend the hax F* lib.but you don't state bounds for
aandbthat let F* determine that their sum would not overflowu32which would lead to a panic.You can add a sufficient pre-condition like so
Afterwards you have to run
./hax.py extractand then you can try your luck again with./hax.py prove.There are more things to consider, such as which parts of your code you really want to be extracted to F* and which parts should be excluded, but we can look into that once you feel somewhat comfortable with the basic setup.