Documentation

Mathlib.Data.Bitvec.Lemmas

Basic Theorems About Bitvectors #

This file contains theorems about bitvectors and their coercions to Nat and Fin.

theorem Bitvec.toNat_append {m : } (xs : Bitvec m) (b : Bool) :
Bitvec.toNat (Vector.append xs (b ::ᵥ Vector.nil)) = Bitvec.toNat xs * 2 + Bitvec.toNat (b ::ᵥ Vector.nil)
theorem Bitvec.bits_toNat_decide (n : ) :
Bitvec.toNat (decide (n % 2 = 1) ::ᵥ Vector.nil) = n % 2
theorem Bitvec.ofNat_succ {k : } {n : } :
Bitvec.ofNat (Nat.succ k) n = Vector.append (Bitvec.ofNat k (n / 2)) (decide (n % 2 = 1) ::ᵥ Vector.nil)
theorem Bitvec.toNat_ofNat {k : } {n : } :
theorem Bitvec.ofFin_val {n : } (i : Fin (2 ^ n)) :
theorem Bitvec.addLsb_eq_twice_add_one {x : } {b : Bool} :
Bitvec.addLsb x b = 2 * x + bif b then 1 else 0
theorem Bitvec.toNat_lt {n : } (v : Bitvec n) :
theorem Bitvec.addLsb_div_two {x : } {b : Bool} :
Bitvec.addLsb x b / 2 = x
theorem Bitvec.toFin_le_toFin_of_le {n : } {v₀ : Bitvec n} {v₁ : Bitvec n} (h : v₀ v₁) :
theorem Bitvec.ofFin_le_ofFin_of_le {n : } {i : Fin (2 ^ n)} {j : Fin (2 ^ n)} (h : i j) :
theorem Bitvec.toFin_ofFin {n : } (i : Fin (2 ^ n)) :