Skip to content

Commit

Permalink
toInt_shiftLeft
Browse files Browse the repository at this point in the history
  • Loading branch information
mhk119 committed Dec 9, 2024
1 parent 520d4b6 commit fe481dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Init/Data/BitVec/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,11 @@ theorem not_eq_comm {x y : BitVec w} : ~~~ x = y ↔ x = ~~~ y := by
BitVec.toNat (x <<< n) = BitVec.toNat x <<< n % 2^v :=
BitVec.toNat_ofNat _ _

@[simp] theorem toInt_shiftLeft {x : BitVec w} :
BitVec.toInt (x <<< n) = Int.bmod (x.toNat <<< n) (2^w) := by
rw [toInt_eq_toNat_bmod, toNat_shiftLeft, Nat.shiftLeft_eq]
simp

@[simp] theorem toFin_shiftLeft {n : Nat} (x : BitVec w) :
BitVec.toFin (x <<< n) = Fin.ofNat' (2^w) (x.toNat <<< n) := rfl

Expand Down

0 comments on commit fe481dc

Please sign in to comment.