Bitwise proofs #2160
-
|
Hi! First of all thanks for the great project! I'm new to the language and was trying to learn it by verifying one of my libraries, thin-cell. It's a reference counted smart pointer with proof fn test_bitwise(input: u64) -> (output: u64)
requires
input & 1 == 0,
input & !1 == 0,
ensures
output == 0,
{
assert(input == 0) by (bit_vector);
input
}Which gives me: What additional assert/lemma/etc do I need? Any help appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Thanks for giving Verus a try! To answer your question, the bit-vector solver, by default, doesn't inherit the surrounding proof context, so in your example, it doesn't know anything about The bit-vector docs have more details. |
Beta Was this translation helpful? Give feedback.
Thanks for giving Verus a try! To answer your question, the bit-vector solver, by default, doesn't inherit the surrounding proof context, so in your example, it doesn't know anything about
inputexcept that it's a 64-bit unsigned number. This design helps keep the bit-vector solver faster and more deterministic. To provide any necessary context, you can include arequiresclause on yourassert. With that added, it verifies.The bit-vector docs have more details.