@@ -90,7 +90,7 @@ lemma div2_succ (n : ℕ) : div2 (n + 1) = cond (bodd n) (succ (div2 n)) (div2 n
9090 simp only [bodd, boddDiv2, div2]
9191 rcases boddDiv2 n with ⟨_ |_, _⟩ <;> simp
9292
93- attribute [local simp] Nat.add_comm Nat.add_assoc Nat.add_left_comm Nat. mul_comm Nat.mul_assoc
93+ attribute [local simp] Nat.add_comm Nat.mul_comm
9494
9595lemma bodd_add_div2 : ∀ n, (bodd n).toNat + 2 * div2 n = n
9696 | 0 => rfl
@@ -106,12 +106,19 @@ lemma div2_val (n) : div2 n = n / 2 := by
106106 (Nat.add_left_cancel (Eq.trans ?_ (Nat.mod_add_div n 2 ).symm))
107107 rw [mod_two_of_bodd, bodd_add_div2]
108108
109- lemma bit_decomp (n : Nat) : bit (bodd n) (div2 n) = n :=
109+ @[simp, grind =]
110+ lemma bit_bodd_div2 (n : Nat) : bit (bodd n) (div2 n) = n :=
110111 (bit_val _ _).trans <| (Nat.add_comm _ _).trans <| bodd_add_div2 _
111112
112- lemma bit_zero : bit false 0 = 0 :=
113+ @[deprecated (since := "2025-09-24")]
114+ alias bit_decomp := bit_bodd_div2
115+
116+ lemma bit_false_zero : bit false 0 = 0 :=
113117 rfl
114118
119+ @[deprecated (since := "2025-09-24")]
120+ alias bit_zero := bit_false_zero
121+
115122/-- `shiftLeft' b m n` performs a left shift of `m` `n` times
116123and adds the bit `b` as the least significant bit each time.
117124Returns the corresponding natural number -/
@@ -156,12 +163,14 @@ def ldiff : ℕ → ℕ → ℕ :=
156163
157164/-! bitwise ops -/
158165
166+ @[simp, grind =]
159167lemma bodd_bit (b n) : bodd (bit b n) = b := by
160168 rw [bit_val]
161169 simp only [Nat.mul_comm, Nat.add_comm, bodd_add, bodd_mul, bodd_succ, bodd_zero, Bool.not_false,
162170 Bool.not_true, Bool.and_false, Bool.xor_false]
163171 cases b <;> cases bodd n <;> rfl
164172
173+ @[simp, grind =]
165174lemma div2_bit (b n) : div2 (bit b n) = n := by
166175 rw [bit_val, div2_val, Nat.add_comm, add_mul_div_left, div_eq_of_lt, Nat.zero_add]
167176 <;> cases b
@@ -197,7 +206,7 @@ lemma testBit_bit_succ (m b n) : testBit (bit b n) (succ m) = testBit n m := by
197206/-! ### `boddDiv2_eq` and `bodd` -/
198207
199208
200- @[simp]
209+ @[simp, grind = ]
201210theorem boddDiv2_eq (n : ℕ) : boddDiv2 n = (bodd n, div2 n) := rfl
202211
203212@[simp]
0 commit comments