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.

theorem BitVec.ofFin_intCast {w : } (z : ) :
{ toFin := z } = z
@[simp]
theorem BitVec.toFin_intCast {w : } (z : ) :
(↑z).toFin = z

Injectivity #

Scalar Multiplication and Powers #

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
def BitVec.equivFin {m : } :
BitVec m ≃+* Fin (2 ^ m)

The ring BitVec m is isomorphic to Fin (2 ^ m).

Equations
  • BitVec.equivFin = { toFun := fun (a : BitVec m) => a.toFin, invFun := fun (a : Fin (2 ^ m)) => { toFin := a }, left_inv := , right_inv := , map_mul' := , map_add' := }
Instances For
    @[simp]
    theorem BitVec.equivFin_apply {m : } (a : BitVec m) :
    @[simp]
    theorem BitVec.equivFin_symm_apply_toFin {m : } (a : Fin (2 ^ m)) :