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

bv_decide failure #5325

Closed
leodemoura opened this issue Sep 13, 2024 · 1 comment
Closed

bv_decide failure #5325

leodemoura opened this issue Sep 13, 2024 · 1 comment
Labels
bug Something isn't working P-high We will work on this issue

Comments

@leodemoura
Copy link
Member

The following example fails, but it should work.

import Std.Tactic.BVDecide

theorem bv_decide_split_if_example (x0 : BitVec 64) :
 BitVec.zeroExtend 32
      (BitVec.zeroExtend 33 (BitVec.zeroExtend 32 x0) +
        (BitVec.zeroExtend 33 (BitVec.replicate 32 (BitVec.extractLsb 31 31 (BitVec.zeroExtend 32 x0))) &&&
            0xfffffffe#33 |||
          BitVec.zeroExtend 33 ((BitVec.zeroExtend 32 x0).rotateRight 31) &&& 0xffffffff#33 &&& 0x1#33)) ^^^
    (BitVec.replicate 32 (BitVec.extractLsb 31 31 (BitVec.zeroExtend 32 x0)) &&& 0xfffffffe#32 |||
      (BitVec.zeroExtend 32 x0).rotateRight 31 &&& 0xffffffff#32 &&& 0x1#32) =
  if (BitVec.extractLsb 31 31 (BitVec.zeroExtend 32 x0) == 0x0#1) = true then BitVec.zeroExtend 32 x0
  else 0x0#32 - BitVec.zeroExtend 32 x0 := by
  bv_decide

Users are forced to manually split the if-then-else. That is, the following one works.

import Std.Tactic.BVDecide

theorem bv_decide_split_if_example (x0 : BitVec 64) :
 BitVec.zeroExtend 32
      (BitVec.zeroExtend 33 (BitVec.zeroExtend 32 x0) +
        (BitVec.zeroExtend 33 (BitVec.replicate 32 (BitVec.extractLsb 31 31 (BitVec.zeroExtend 32 x0))) &&&
            0xfffffffe#33 |||
          BitVec.zeroExtend 33 ((BitVec.zeroExtend 32 x0).rotateRight 31) &&& 0xffffffff#33 &&& 0x1#33)) ^^^
    (BitVec.replicate 32 (BitVec.extractLsb 31 31 (BitVec.zeroExtend 32 x0)) &&& 0xfffffffe#32 |||
      (BitVec.zeroExtend 32 x0).rotateRight 31 &&& 0xffffffff#32 &&& 0x1#32) =
  if (BitVec.extractLsb 31 31 (BitVec.zeroExtend 32 x0) == 0x0#1) = true then BitVec.zeroExtend 32 x0
  else 0x0#32 - BitVec.zeroExtend 32 x0 := by
  split <;> bv_decide
@leodemoura leodemoura added the bug Something isn't working label Sep 13, 2024
@leanprover-bot leanprover-bot added the P-high We will work on this issue label Sep 13, 2024
@hargoniX
Copy link
Contributor

Totally forgot about this particular issue, this feature has been implemented a while back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-high We will work on this issue
Projects
None yet
Development

No branches or pull requests

3 participants