Skip to content

Commit

Permalink
chore: inline redundant omega
Browse files Browse the repository at this point in the history
  • Loading branch information
luisacicolini committed Jan 13, 2025
1 parent 43f82c4 commit 17f1531
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Init/Data/Nat/Bitwise/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ theorem testBit_mul_two_pow_le {x i n : Nat} (h : n ≤ i) :

theorem testBit_mul_two_pow_gt {x i n : Nat} (h : i < n) :
testBit (x * 2 ^ n) i = false := by
simp only [testBit, one_and_eq_mod_two, mod_two_bne_zero, beq_eq_false_iff_ne, ne_eq, ← shiftLeft_eq]
simp only [testBit, ← shiftLeft_eq, one_and_eq_mod_two, mod_two_bne_zero, beq_eq_false_iff_ne,
ne_eq]
let k := n - i
have hk : x <<< n >>> i = x <<< (k + i) >>> i := by simp only [k]; rw [Nat.sub_add_cancel]; omega
rw [hk, Nat.shiftLeft_add, Nat.shiftLeft_shiftRight, shiftLeft_eq]
have hx : 2 * (x * 2 ^ k / 2) = x * 2 ^ k := by
rw [Nat.mul_comm, Nat.div_mul_cancel]
suffices hs : 2 * (x * 2 ^ (k - 1)) = x * 2 ^ k by
exact ⟨_, hs.symm⟩
rw [Nat.mul_comm, Nat.mul_assoc, ← Nat.pow_one (a := 2), ← Nat.pow_add, Nat.sub_add_cancel]
omega
rw [Nat.mul_comm, Nat.mul_assoc, ← Nat.pow_one (a := 2), ← Nat.pow_add, Nat.sub_add_cancel (by omega)]
omega

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

0 comments on commit 17f1531

Please sign in to comment.