This module exists to provide the very basic BitVec
definitions required for
Init.Data.UInt.BasicAux
.
@[match_pattern]
The BitVec
with value i mod 2^n
.
Equations
- BitVec.ofNat n i = { toFin := Fin.ofNat' (2 ^ n) i }
Instances For
Equations
- BitVec.instOfNat = { ofNat := BitVec.ofNat n i }
Addition for bit vectors. This can be interpreted as either signed or unsigned addition
modulo 2^n
.
SMT-Lib name: bvadd
.
Equations
- x.add y = BitVec.ofNat n (x.toNat + y.toNat)
Instances For
Subtraction for bit vectors. This can be interpreted as either signed or unsigned subtraction
modulo 2^n
.
Equations
- x.sub y = BitVec.ofNat n (2 ^ n - y.toNat + x.toNat)