Skip to content

Commit

Permalink
feat: BitVec.toFin_ofNat lemma (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkeizer authored Feb 18, 2024
1 parent 385d324 commit 0742535
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Std/Data/BitVec/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ theorem ofBool_eq_iff_eq : ∀(b b' : Bool), BitVec.ofBool b = BitVec.ofBool b'
@[simp] theorem toNat_ofNat (x w : Nat) : (x#w).toNat = x % 2^w := by
simp [BitVec.toNat, BitVec.ofNat, Fin.ofNat']

@[simp] theorem toFin_ofNat (w x : Nat) : (x#w).toFin = Fin.ofNat' x (Nat.two_pow_pos _) := rfl

@[simp] theorem getLsb_ofNat (n : Nat) (x : Nat) (i : Nat) :
getLsb (x#n) i = (i < n && x.testBit i) := by
simp [getLsb, BitVec.ofNat, Fin.val_ofNat']
Expand Down

0 comments on commit 0742535

Please sign in to comment.