The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Data.BitVec

12 declarations. Mathlib docs · Source

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

Ring

theorem BitVec.ofFin_intCast E1 #

∀ {w : ℕ} (z : ℤ), { toFin := ↑z } = ↑z

theorem BitVec.toFin_intCast E0 #

∀ {w : ℕ} (z : ℤ), (↑z).toFin = ↑z

theorem BitVec.toNat_injective E1 #

∀ {n : ℕ}, Function.Injective BitVec.toNat

theorem BitVec.toFin_injective E1 #

∀ {n : ℕ}, Function.Injective BitVec.toFin

theorem BitVec.toFin_nsmul E1 #

∀ {w : ℕ} (n : ℕ) (x : BitVec w), (n • x).toFin = n • x.toFin

theorem BitVec.toFin_zsmul E1 #

∀ {w : ℕ} (z : ℤ) (x : BitVec w), (z • x).toFin = z • x.toFin

theorem BitVec.toFin_pow E1 #

∀ {w : ℕ} (x : BitVec w) (n : ℕ), (x ^ n).toFin = x.toFin ^ n

instance BitVec.instCommSemiring E0 #

{w : ℕ} → CommSemiring (BitVec w)

instance BitVec.instCommRing E0 #

{w : ℕ} → CommRing (BitVec w)

def BitVec.equivFin E1 #

{m : ℕ} → BitVec m ≃+* Fin (2 ^ m)

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

theorem BitVec.equivFin_symm_apply_toFin E0 #

∀ {m : ℕ} (a : Fin (2 ^ m)), (BitVec.equivFin.symm a).toFin = a

theorem BitVec.equivFin_apply E0 #

∀ {m : ℕ} (a : BitVec m), BitVec.equivFin a = a.toFin