Skip to content

Commit

Permalink
chore: move to getLsbD again
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasgrosser committed Sep 16, 2024
1 parent 59f49c9 commit 5d00da8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Init/Data/BitVec/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,12 @@ theorem getElem?_zeroExtend (m : Nat) (x : BitVec n) (i : Nat) :
<;> omega

@[simp]
theorem getElem_truncate (m : Nat) (x : BitVec n) (i : Nat) (hi : i < m) (h : i < n) :
(truncate m x)[i] = x[i] := by
theorem getElem_truncate (m : Nat) (x : BitVec n) (i : Nat) (hi : i < m) :
(truncate m x)[i] = x.getLsbD i := by
simp only [getElem_zeroExtend]
rw [getLsbD_eq_getElem (by omega)]

theorem getElem?_truncate (m : Nat) (x : BitVec n) (i : Nat) (h : i < n) :
(truncate m x)[i]? = if i < m then some x[i] else none :=
theorem getElem?_truncate (m : Nat) (x : BitVec n) (i : Nat) :
(truncate m x)[i]? = if i < m then some (x.getLsbD i) else none :=
getElem?_zeroExtend m x i

theorem getLsbD_truncate (m : Nat) (x : BitVec n) (i : Nat) :
Expand Down

0 comments on commit 5d00da8

Please sign in to comment.