Skip to content

Conversation

@jberthold
Copy link
Member

The added simplification lowers a comparison between a #buf(..) expression and null-bytes to an Int comparison when the magnitude of the #buf argument allows.

This simplification is necessary to pass mcd-structured proofs once the HS backend change runtimeverification/haskell-backend#4133 arrives downstream.

@jberthold jberthold marked this pull request as ready for review December 15, 2025 02:45
@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 6fffef3 into master Dec 15, 2025
12 checks passed
@automergerpr-permission-manager automergerpr-permission-manager bot deleted the simplify-mcd-structured-proofs-rebased branch December 15, 2025 10:28
Comment on lines +404 to +409
// #buf simplification comparing to null-bytes: compare as Int
rule #buf(N, X:Int) ==K NULLBYTES => X ==Int 0
requires 0 <=Int X
andBool X <=Int 2 ^Int ( 8 *Int N)
andBool #asInteger(NULLBYTES) ==Int 0
[simplification, concrete(NULLBYTES)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jberthold shouldn't this be X <Int 2 ^Int (8 *Int N), not <=Int?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, should be <Int, sorry for that. I'll make a PR to correct it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, we would also want length(NULLBYTES) ==Int N (and 0 <=Int N but that's implied by the former), as well as preserves-definedness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants