Skip to content

Commit

Permalink
Update src/Init/Data/BitVec/Lemmas.lean
Browse files Browse the repository at this point in the history
Co-authored-by: Siddharth <[email protected]>
  • Loading branch information
luisacicolini and bollu authored Nov 13, 2024
1 parent aadfbfc commit 372256c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Init/Data/BitVec/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2638,8 +2638,9 @@ theorem getElem_rotateLeft {x : BitVec w} {r i : Nat} (h : i < w) :
if h' : i < r % w then x[(w - (r % w) + i)] else x[i - (r % w)] := by
simp [← BitVec.getLsbD_eq_getElem, h]

theorem add_mod_eq_add_sub {w : Nat} {a b : Nat} (hab_ge : a + b ≥ w) (hab_lt : a + b < 2 * w) :
(a + b) % w = a + b - w := by
/-- If `w ≤ x < 2 * w`, then `x % w = x - w` -/
private theorem add_mod_eq_add_sub {x w : Nat} (x_le : w ≤ x) (x_lt : x < 2 * w) :
x % w = x - w := by
rw [Nat.mod_eq_sub_mod, Nat.mod_eq_of_lt (by omega)]
omega

Expand Down

0 comments on commit 372256c

Please sign in to comment.