Skip to content
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

fix(BV): Do not lose explanations in bvmul #1170

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

bclement-ocp
Copy link
Collaborator

The implementation of bvmul from #1144 introduced a soundness bug: when we do not know anything about the result, the explanation is dropped.

This is because the implementation was performing mixing bitlist computation and creation of raw bitlist values. This patch fixes the implementation by performing all computations in [Z] and only adding the explanation at the end.

The implementation of bvmul from OCamlPro#1144 introduced a soundness bug: when
we do not know anything about the result, the explanation is dropped.

This is because the implementation was performing mixing bitlist
computation and creation of raw bitlist values. This patch fixes the
implementation by performing all computations in [Z] and only adding the
explanation at the end.
Copy link
Collaborator

@Halbaroth Halbaroth left a comment

Choose a reason for hiding this comment

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

Looks good to me. Please don't merge before #1169

@Halbaroth
Copy link
Collaborator

Can you add a test that caught the soundness bug in the previous code?

@bclement-ocp
Copy link
Collaborator Author

Yes and no — I don't have a reproducer on next. I have one on #1152 where it was found, but the propagators run in a different order on next and #1152

I can add the reproducer that breaks on #1152 even though i don't think it is very robust to changes in propagation strategy. Now that I understand the issue I will see if I can make a more robust test

@Halbaroth
Copy link
Collaborator

Sure, if the test is not robust we shouldn't add it.

@bclement-ocp
Copy link
Collaborator Author

Thinking about it more, I think the test is actually fairly robust but very hard to trigger on next due to a combination of us being over-conservative in adding explanations to constraints (whenever a substitution is performed on an argument of the constraint, the corresponding explanation is added to the whole constraint) and transforming bit-level information into Shostak equations. Without this specific combination the test would trigger.

I have added the test.

@Halbaroth Halbaroth merged commit c2e419f into OCamlPro:next Jul 22, 2024
14 checks passed
Halbaroth pushed a commit to Halbaroth/alt-ergo that referenced this pull request Jul 24, 2024
* fix(BV): Do not lose explanations in bvmul

The implementation of bvmul from OCamlPro#1144 introduced a soundness bug: when
we do not know anything about the result, the explanation is dropped.

This is because the implementation was performing mixing bitlist
computation and creation of raw bitlist values. This patch fixes the
implementation by performing all computations in [Z] and only adding the
explanation at the end.

* Add a test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants