Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: BitVec.toNat BitVec.signExtend (#6155)
This PR adds `toNat` theorems for `BitVec.signExtend.` Sign extending to a larger bitwidth depends on the msb. If the msb is false, then the result equals the original value. If the msb is true, then we add a value of `(2^v - 2^w)`, which arises from the sign extension. ```lean theorem toNat_signExtend (x : BitVec w) {v : Nat} : (x.signExtend v).toNat = (x.setWidth v).toNat + if x.msb then 2^v - 2^w else 0 ``` Co-authored-by: Harun Khan <[email protected]>
- Loading branch information