Skip to content

Commit 41e3e2b

Browse files
committed
feat: to_additive for pow_boole (#6535)
1 parent a2f44d1 commit 41e3e2b

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Mathlib/Algebra/BigOperators/Basic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,7 @@ theorem eq_one_of_prod_eq_one {s : Finset α} {f : α → β} {a : α} (hp : ∏
17211721
#align finset.eq_one_of_prod_eq_one Finset.eq_one_of_prod_eq_one
17221722
#align finset.eq_zero_of_sum_eq_zero Finset.eq_zero_of_sum_eq_zero
17231723

1724+
@[to_additive sum_boole_nsmul]
17241725
theorem prod_pow_boole [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
17251726
(∏ x in s, f x ^ ite (a = x) 1 0) = ite (a ∈ s) (f a) 1 := by simp
17261727
#align finset.prod_pow_boole Finset.prod_pow_boole

Mathlib/Algebra/GroupPower/Basic.lean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ section Pow
4848

4949
variable [Pow M ℕ]
5050

51-
@[simp]
51+
@[to_additive (attr := simp) ite_nsmul]
5252
theorem pow_ite (P : Prop) [Decidable P] (a : M) (b c : ℕ) :
5353
(a ^ if P then b else c) = if P then a ^ b else a ^ c := by split_ifs <;> rfl
5454
#align pow_ite pow_ite
5555

56-
@[simp]
56+
@[to_additive (attr := simp) nsmul_ite]
5757
theorem ite_pow (P : Prop) [Decidable P] (a b : M) (c : ℕ) :
5858
(if P then a else b) ^ c = if P then a ^ c else b ^ c := by split_ifs <;> rfl
5959
#align ite_pow ite_pow
@@ -106,9 +106,11 @@ theorem pow_two (a : M) : a ^ 2 = a * a := by rw [pow_succ, pow_one]
106106
alias pow_two ← sq
107107
#align sq sq
108108

109+
@[to_additive three'_nsmul]
109110
theorem pow_three' (a : M) : a ^ 3 = a * a * a := by rw [pow_succ', pow_two]
110111
#align pow_three' pow_three'
111112

113+
@[to_additive three_nsmul]
112114
theorem pow_three (a : M) : a ^ 3 = a * (a * a) := by rw [pow_succ, pow_two]
113115
#align pow_three pow_three
114116

@@ -148,6 +150,7 @@ theorem pow_mul_comm' (a : M) (n : ℕ) : a ^ n * a = a * a ^ n :=
148150
#align pow_mul_comm' pow_mul_comm'
149151
#align nsmul_add_comm' nsmul_add_comm'
150152

153+
@[to_additive boole_nsmul]
151154
theorem pow_boole (P : Prop) [Decidable P] (a : M) :
152155
(a ^ if P then 1 else 0) = if P then a else 1 := by simp
153156
#align pow_boole pow_boole

0 commit comments

Comments
 (0)