Basic Theorems About Bitvectors #
This file contains theorems about bitvectors.
theorem
BitVec.toNat_inj
{w : ℕ}
{x : BitVec w}
{y : BitVec w}
:
BitVec.toNat x = BitVec.toNat y ↔ x = y
theorem
BitVec.toNat_lt_toNat
{w : ℕ}
{x : BitVec w}
{y : BitVec w}
:
BitVec.toNat x < BitVec.toNat y ↔ x < y
x < y
as natural numbers if and only if x < y
as BitVec w
.
@[simp]
theorem
BitVec.extractLsb_eq
{w : ℕ}
(hi : ℕ)
(lo : ℕ)
(a : BitVec w)
:
BitVec.extractLsb hi lo a = BitVec.extractLsb' lo (hi - lo + 1) a
theorem
BitVec.toNat_extractLsb'
{w : ℕ}
{i : ℕ}
{j : ℕ}
{x : BitVec w}
:
BitVec.toNat (BitVec.extractLsb' i j x) = BitVec.toNat x / 2 ^ i % 2 ^ j
theorem
BitVec.addLsb_eq_twice_add_one
{x : ℕ}
{b : Bool}
:
BitVec.addLsb x b = 2 * x + bif b then 1 else 0
theorem
BitVec.ofNat_toNat_of_eq
{w : ℕ}
{v : ℕ}
(x : BitVec w)
(h : w = v)
:
(BitVec.toNat x)#v = BitVec.cast h x
Distributivity of BitVec.ofFin
#
@[simp]
Distributivity of Std.BitVec.toFin
#
Ring #
Equations
- BitVec.instCommSemiringBitVec = Function.Injective.commSemiring BitVec.toFin ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯