Skip to content

Commit 64848f6

Browse files
committed
add two to_additive name translations (#10831)
* Remove manual translations that are now guessed correctly * Fix some names that were incorrectly guessed by humans (and in one case fix the multiplicative name). Add deprecations for all name changes. * Remove a couple manually additivized lemmas.
1 parent 3eced18 commit 64848f6

File tree

11 files changed

+137
-123
lines changed

11 files changed

+137
-123
lines changed

Mathlib/Data/Int/Cast/Lemmas.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def zmultiplesHom : α ≃ (ℤ →+ α) where
407407

408408
/-- Monoid homomorphisms from `Multiplicative ℤ` are defined by the image
409409
of `Multiplicative.ofAdd 1`. -/
410-
@[to_additive existing zmultiplesHom]
410+
@[to_additive existing]
411411
def zpowersHom : α ≃ (Multiplicative ℤ →* α) :=
412412
ofMul.trans <| (zmultiplesHom _).trans <| AddMonoidHom.toMultiplicative''
413413
#align zpowers_hom zpowersHom
@@ -418,11 +418,11 @@ lemma zmultiplesHom_apply (x : α) (n : ℤ) : zmultiplesHom α x n = n • x :=
418418
lemma zmultiplesHom_symm_apply (f : ℤ →+ α) : (zmultiplesHom α).symm f = f 1 := rfl
419419
#align zmultiples_hom_symm_apply zmultiplesHom_symm_apply
420420

421-
@[to_additive existing (attr := simp) zmultiplesHom_apply]
422-
lemma zpowersHom_apply (x : α) (n : Multiplicative ℤ) :zpowersHom α x n = x ^ toAdd n := rfl
421+
@[to_additive existing (attr := simp)]
422+
lemma zpowersHom_apply (x : α) (n : Multiplicative ℤ) : zpowersHom α x n = x ^ toAdd n := rfl
423423
#align zpowers_hom_apply zpowersHom_apply
424424

425-
@[to_additive existing (attr := simp) zmultiplesHom_symm_apply]
425+
@[to_additive existing (attr := simp)]
426426
lemma zpowersHom_symm_apply (f : Multiplicative ℤ →* α) :
427427
(zpowersHom α).symm f = f (ofAdd 1) := rfl
428428
#align zpowers_hom_symm_apply zpowersHom_symm_apply

Mathlib/Data/Nat/Cast/Basic.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def multiplesHom : α ≃ (ℕ →+ α) where
235235

236236
/-- Monoid homomorphisms from `Multiplicative ℕ` are defined by the image
237237
of `Multiplicative.ofAdd 1`. -/
238-
@[to_additive existing multiplesHom]
238+
@[to_additive existing]
239239
def powersHom : α ≃ (Multiplicative ℕ →* α) :=
240240
Additive.ofMul.trans <| (multiplesHom _).trans <| AddMonoidHom.toMultiplicative''
241241

@@ -246,15 +246,15 @@ variable {α}
246246
lemma multiplesHom_apply (x : α) (n : ℕ) : multiplesHom α x n = n • x := rfl
247247
#align multiples_hom_apply multiplesHom_apply
248248

249-
@[to_additive existing (attr := simp) multiplesHom_apply]
249+
@[to_additive existing (attr := simp)]
250250
lemma powersHom_apply (x : α) (n : Multiplicative ℕ) :
251251
powersHom α x n = x ^ Multiplicative.toAdd n := rfl
252252
#align powers_hom_apply powersHom_apply
253253

254254
lemma multiplesHom_symm_apply (f : ℕ →+ α) : (multiplesHom α).symm f = f 1 := rfl
255255
#align multiples_hom_symm_apply multiplesHom_symm_apply
256256

257-
@[to_additive existing (attr := simp) multiplesHom_symm_apply]
257+
@[to_additive existing (attr := simp)]
258258
lemma powersHom_symm_apply (f : Multiplicative ℕ →* α) :
259259
(powersHom α).symm f = f (Multiplicative.ofAdd 1) := rfl
260260
#align powers_hom_symm_apply powersHom_symm_apply

Mathlib/Data/ZMod/Quotient.lean

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,17 @@ noncomputable def _root_.AddAction.orbitZMultiplesEquiv {α β : Type*} [AddGrou
144144
(zmultiplesQuotientStabilizerEquiv a b).toEquiv
145145
#align add_action.orbit_zmultiples_equiv AddAction.orbitZMultiplesEquiv
146146

147-
attribute [to_additive existing AddAction.orbitZMultiplesEquiv] orbitZPowersEquiv
147+
attribute [to_additive existing] orbitZPowersEquiv
148148

149-
@[to_additive orbit_zmultiples_equiv_symm_apply]
149+
@[to_additive]
150150
theorem orbitZPowersEquiv_symm_apply (k : ZMod (minimalPeriod (a • ·) b)) :
151151
(orbitZPowersEquiv a b).symm k =
152152
(⟨a, mem_zpowers a⟩ : zpowers a) ^ (cast k : ℤ) • ⟨b, mem_orbit_self b⟩ :=
153153
rfl
154154
#align mul_action.orbit_zpowers_equiv_symm_apply MulAction.orbitZPowersEquiv_symm_apply
155-
#align add_action.orbit_zmultiples_equiv_symm_apply AddAction.orbit_zmultiples_equiv_symm_apply
155+
#align add_action.orbit_zmultiples_equiv_symm_apply AddAction.orbitZMultiplesEquiv_symm_apply
156+
/- 2024-02-21 -/ @[deprecated] alias _root_.AddAction.orbit_zmultiples_equiv_symm_apply :=
157+
orbitZMultiplesEquiv_symm_apply
156158

157159
theorem orbitZPowersEquiv_symm_apply' (k : ℤ) :
158160
(orbitZPowersEquiv a b).symm k =
@@ -165,12 +167,12 @@ theorem _root_.AddAction.orbitZMultiplesEquiv_symm_apply' {α β : Type*} [AddGr
165167
[AddAction α β] (b : β) (k : ℤ) :
166168
(AddAction.orbitZMultiplesEquiv a b).symm k =
167169
k • (⟨a, mem_zmultiples a⟩ : zmultiples a) +ᵥ ⟨b, AddAction.mem_orbit_self b⟩ := by
168-
rw [AddAction.orbit_zmultiples_equiv_symm_apply, ZMod.coe_int_cast]
170+
rw [AddAction.orbitZMultiplesEquiv_symm_apply, ZMod.coe_int_cast]
169171
-- porting note: times out without `a b` explicit
170172
exact Subtype.ext (zsmul_vadd_mod_minimalPeriod a b k)
171173
#align add_action.orbit_zmultiples_equiv_symm_apply' AddAction.orbitZMultiplesEquiv_symm_apply'
172174

173-
attribute [to_additive existing AddAction.orbitZMultiplesEquiv_symm_apply']
175+
attribute [to_additive existing]
174176
orbitZPowersEquiv_symm_apply'
175177

176178
@[to_additive]
@@ -201,7 +203,7 @@ open Subgroup
201203
variable {α : Type*} [Group α] (a : α)
202204

203205
/-- See also `Fintype.card_zpowers`. -/
204-
@[to_additive (attr := simp) Nat.card_zmultiples "See also `Fintype.card_zmultiples`."]
206+
@[to_additive (attr := simp) "See also `Fintype.card_zmultiples`."]
205207
theorem Nat.card_zpowers : Nat.card (zpowers a) = orderOf a := by
206208
have := Nat.card_congr (MulAction.orbitZPowersEquiv a (1 : α))
207209
rwa [Nat.card_zmod, orbit_subgroup_one_eq_self] at this
@@ -210,15 +212,15 @@ theorem Nat.card_zpowers : Nat.card (zpowers a) = orderOf a := by
210212

211213
variable {a}
212214

213-
@[to_additive (attr := simp) finite_zmultiples]
215+
@[to_additive (attr := simp)]
214216
lemma finite_zpowers : (zpowers a : Set α).Finite ↔ IsOfFinOrder a := by
215217
simp only [← orderOf_pos_iff, ← Nat.card_zpowers, Nat.card_pos_iff, ← SetLike.coe_sort_coe,
216218
nonempty_coe_sort, Nat.card_pos_iff, Set.finite_coe_iff, Subgroup.coe_nonempty, true_and]
217219

218-
@[to_additive (attr := simp) infinite_zmultiples]
220+
@[to_additive (attr := simp)]
219221
lemma infinite_zpowers : (zpowers a : Set α).Infinite ↔ ¬IsOfFinOrder a := finite_zpowers.not
220222

221-
@[to_additive IsOfFinAddOrder.finite_zmultiples]
223+
@[to_additive]
222224
protected alias ⟨_, IsOfFinOrder.finite_zpowers⟩ := finite_zpowers
223225
#align is_of_fin_order.finite_zpowers IsOfFinOrder.finite_zpowers
224226
#align is_of_fin_add_order.finite_zmultiples IsOfFinAddOrder.finite_zmultiples

Mathlib/Deprecated/Submonoid.lean

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ theorem isSubmonoid_iUnion_of_directed {ι : Type*} [hι : Nonempty ι] {s : ι
122122
section powers
123123

124124
/-- The set of natural number powers `1, x, x², ...` of an element `x` of a monoid. -/
125-
@[to_additive multiples
125+
@[to_additive
126126
"The set of natural number multiples `0, x, 2x, ...` of an element `x` of an `AddMonoid`."]
127127
def powers (x : M) : Set M :=
128128
{ y | ∃ n : ℕ, x ^ n = y }
@@ -214,14 +214,16 @@ theorem IsSubmonoid.pow_mem {a : M} (hs : IsSubmonoid s) (h : a ∈ s) : ∀ {n
214214
exact hs.mul_mem h (IsSubmonoid.pow_mem hs h)
215215
#align is_submonoid.pow_mem IsSubmonoid.pow_mem
216216

217-
/-- The set of natural number powers of an element of a submonoid is a subset of the submonoid. -/
218-
@[to_additive IsAddSubmonoid.multiples_subset
217+
/-- The set of natural number powers of an element of a `Submonoid` is a subset of the
218+
`Submonoid`. -/
219+
@[to_additive
219220
"The set of natural number multiples of an element of an `AddSubmonoid` is a subset of
220221
the `AddSubmonoid`."]
221-
theorem IsSubmonoid.power_subset {a : M} (hs : IsSubmonoid s) (h : a ∈ s) : powers a ⊆ s :=
222+
theorem IsSubmonoid.powers_subset {a : M} (hs : IsSubmonoid s) (h : a ∈ s) : powers a ⊆ s :=
222223
fun _ ⟨_, hx⟩ => hx ▸ hs.pow_mem h
223-
#align is_submonoid.power_subset IsSubmonoid.power_subset
224+
#align is_submonoid.power_subset IsSubmonoid.powers_subset
224225
#align is_add_submonoid.multiples_subset IsAddSubmonoid.multiples_subset
226+
/- 2024-02-21 -/ @[deprecated] alias IsSubmonoid.power_subset := IsSubmonoid.powers_subset
225227

226228
end powers
227229

@@ -337,7 +339,7 @@ theorem closure_mono {s t : Set M} (h : s ⊆ t) : Closure s ⊆ Closure t :=
337339
theorem closure_singleton {x : M} : Closure ({x} : Set M) = powers x :=
338340
Set.eq_of_subset_of_subset
339341
(closure_subset (powers.isSubmonoid x) <| Set.singleton_subset_iff.2 <| powers.self_mem) <|
340-
IsSubmonoid.power_subset (closure.isSubmonoid _) <|
342+
IsSubmonoid.powers_subset (closure.isSubmonoid _) <|
341343
Set.singleton_subset_iff.1 <| subset_closure
342344
#align monoid.closure_singleton Monoid.closure_singleton
343345
#align add_monoid.closure_singleton AddMonoid.closure_singleton

Mathlib/GroupTheory/Finiteness.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ instance Monoid.fg_range {M' : Type*} [Monoid M'] [Monoid.FG M] (f : M →* M')
187187
#align monoid.fg_range Monoid.fg_range
188188
#align add_monoid.fg_range AddMonoid.fg_range
189189

190-
@[to_additive AddSubmonoid.multiples_fg]
190+
@[to_additive]
191191
theorem Submonoid.powers_fg (r : M) : (Submonoid.powers r).FG :=
192192
⟨{r}, (Finset.coe_singleton r).symm ▸ (Submonoid.powers_eq_closure r).symm⟩
193193
#align submonoid.powers_fg Submonoid.powers_fg
194194
#align add_submonoid.multiples_fg AddSubmonoid.multiples_fg
195195

196-
@[to_additive AddMonoid.multiples_fg]
196+
@[to_additive]
197197
instance Monoid.powers_fg (r : M) : Monoid.FG (Submonoid.powers r) :=
198198
(Monoid.fg_iff_submonoid_fg _).mpr (Submonoid.powers_fg r)
199199
#align monoid.powers_fg Monoid.powers_fg

0 commit comments

Comments
 (0)