This PR ensure that `bv_decide` can handle the simp normal form of a shift. Consider: ```lean theorem test1 (b s : BitVec 5) (hb : b = 0) (hs : s ≠ 0) : b <<< s = 0 := by bv_decide ``` This works out, however: ```lean theorem test2 (b s : BitVec 5) (hb : b = 0) (hs : s ≠ 0) : b <<< s = 0 := by simp bv_decide ``` this fails because the `simp` normal form adds `toNat` to the right hand argument of the `<<<` and `bv_decide` cannot deal with shifts by non-constant `Nat`. Discovered by @spdskatr
21 lines
590 B
Text
21 lines
590 B
Text
import Std.Tactic.BVDecide
|
|
|
|
theorem test2 (b s : BitVec 5) (hb : b = 0) (hs : s ≠ 0) :
|
|
b <<< s.toNat = 0 := by
|
|
bv_decide
|
|
|
|
theorem test2' (b s : BitVec 5) (hb : b = 0) (hs : s ≠ 0) :
|
|
b >>> s.toNat = 0 := by
|
|
bv_decide
|
|
|
|
theorem test2'' (b s : BitVec 5) (hb : b = 0) (hs : s ≠ 0) :
|
|
BitVec.sshiftRight b s.toNat = 0 := by
|
|
bv_decide
|
|
|
|
theorem test2''' (b s : BitVec 5) (hb : b = 0) (hs : s ≠ 0) :
|
|
BitVec.shiftLeft b s.toNat = 0 := by
|
|
bv_decide
|
|
|
|
theorem test2'''' (b s : BitVec 5) (hb : b = 0) (hs : s ≠ 0) :
|
|
BitVec.ushiftRight b s.toNat = 0 := by
|
|
bv_decide
|