-
Notifications
You must be signed in to change notification settings - Fork 123
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
:prove command generating wrong smtlib output for right-shift operators #566
Comments
We're wondering whether this is a bug in SBV, since both Cryptol and SAW can trigger it, and they call SBV through different code paths. Do you have any thoughts, @LeventErkok? |
The relevant SBV code is here: https://github.com/LeventErkok/sbv/blob/master/Data/SBV/Core/Operations.hs#L383-L398 My guess would be the signedness of the |
I noticed that other pairs of signed/unsigned operators show the same problem. All of these work with
|
The Cryptol code for doing symbolic signed shift right is here: The important bit is the pattern of using In SBV,
Apparently |
I bet that’s it. Can you put this in a SBV ticket on github? I’ll fix it over the weekend. Good catch! |
Just pushed a fix. Give it a shot! I trust it should solve the problem: LeventErkok/sbv@d4a05c8 |
I tested your patch with Cryptol, and it fixes all of the problematic |
Great! There'll be an 8.1 release sometime this month. Let me know if you need it earlier. |
No need to rush. We'll switch cryptol to sbv-8.1 when it's ready. I'll close this ticket once that happens. |
Cryptol is using SBV version 8.1 since revision 361e052. |
Cryptol has both unsigned (
>>
) and signed (>>$
) right-shift operators. They are different, and we can prove that:Now, if we tweak this predicate slightly by adding a
drop`{0}
(which is an identity function), then:exhaust
can still find a counterexample, but:prove
now says QED!Setting the
:prover
tooffline
sheds some light on the situation. With the original predicate, the smtlib output mentions bothbvashr
(arithmetic, i.e. signed shift right) andbvlshr
(logical, i.e. unsigned shift right).But when we add the
drop
back in, now both shift operators are the signedbvashr
version!Putting a
drop
in a different place causes the smtlib output to havebvlshr
in both places:I'm not sure whether this is a bug in SBV, or whether Cryptol is using SBV improperly. By the way, the same buggy behavior is also present in saw-script.
The text was updated successfully, but these errors were encountered: