Documentation

Mathlib.Data.BitVec

Basic Theorems About Bitvectors #

This file contains theorems about bitvectors which can only be stated in Mathlib or downstream because they refer to other notions defined in Mathlib.

Please do not extend this file further: material about BitVec needed in downstream projects can either be PR'd to Lean, or kept downstream if it also relies on Mathlib.

Injectivity #

Scalar Multiplication and Powers #

Having instance of SMul, SMul and Pow are prerequisites for a CommRing instance

instance BitVec.instSMulNat {w : } :
Equations
  • BitVec.instSMulNat = { smul := fun (x : ) (y : BitVec w) => { toFin := x y.toFin } }
instance BitVec.instSMulInt {w : } :
Equations
  • BitVec.instSMulInt = { smul := fun (x : ) (y : BitVec w) => { toFin := x y.toFin } }
Equations
  • BitVec.instPowNat_mathlib = { pow := fun (x : BitVec w) (n : ) => { toFin := x.toFin ^ n } }
theorem BitVec.toFin_nsmul {w : } (n : ) (x : BitVec w) :
(n x).toFin = n x.toFin
theorem BitVec.toFin_zsmul {w : } (z : ) (x : BitVec w) :
(z x).toFin = z x.toFin
theorem BitVec.toFin_pow {w : } (x : BitVec w) (n : ) :
(x ^ n).toFin = x.toFin ^ n

Ring #

Equations