Skip to content

Commit

Permalink
chore: remove ugly suffices
Browse files Browse the repository at this point in the history
  • Loading branch information
luisacicolini committed Jan 14, 2025
1 parent 79ba4ba commit 340e8d6
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Init/Data/Nat/Bitwise/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,7 @@ theorem testBit_mul_two_pow_gt {x i n : Nat} (h : i < n) :
rw [hk, Nat.shiftLeft_add, Nat.shiftLeft_shiftRight, shiftLeft_eq]
have hx : 2 * (x * 2 ^ k / 2 ^ 1) = x * 2 ^ k := by
rw [Nat.mul_div_assoc, Nat.pow_div (by omega) (by omega), Nat.mul_comm, Nat.mul_assoc, ← Nat.pow_one (a := 2), ← Nat.pow_add, Nat.sub_add_cancel (by omega)]
suffices hs : 2 * (2 ^ (k - 1)) = 2 ^ k by
exact ⟨_, hs.symm⟩
let j := k - 1
have hj : 2 * 2 ^ (k - 1) = 2 * 2 ^ (j) := by simp only [j, k]
have hj' : 2 ^ k = 2 ^ (j + 1) := by simp only [j]; rw [Nat.sub_add_cancel (by omega)]
rw [hj, hj', Nat.pow_succ, Nat.mul_comm]
simp only [Nat.pow_one, Nat.pow_dvd_pow (m := 1) (n := k) (a := 2) (by omega), k]
omega

theorem testBit_mul_two_pow (x i n : Nat) :
Expand Down

0 comments on commit 340e8d6

Please sign in to comment.