-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pick uniform convention for inclusive vs.exclusive bounds in runtime and CBMC bounds checking macros #324
Comments
@rod-chapman Can you work on this? I lean towards following the inclusive bound convention from our CBMC macros, which would mean merely changing the few runtime assertions. |
Agree - this should be consistent. |
I've been thinking a bit on this one. Writing assertions and contracts, I always tend to use inclusive bounds, but I've been trying to work out why... observations:
then I can ask the tool to prove something like
with reasonably confidence that I haven't screwed it up. I always seem to get it wrong where "<" and ">" are involved.
feel more natural to me with inclusive relations. Does any of that make sense? |
Not sure I can follow the transitivity argument. Doesn't I have no strong opinion on using inclusive or exclusive bounds - but I'd like it to be consistent. |
Yeah... the transitivity rules work with ">" of course, but I just find it easier to think about them if they all of the same "sense". |
We have debug-build runtime checks (e.g.
POLY_BOUND(...)
) as well as CBMC assertionsARRAY_IN_BOUND(...)
both expressing bounds on an int16_t array. However, the runtime assertions use exclusive bounds, while the CBMC assertions use inclusive bounds. This is confusing and was close to leading to a poor spec in #https://github.com/pq-code-package/mlkem-c-aarch64/pull/313.The text was updated successfully, but these errors were encountered: