Skip to content

Commit e960b84

Browse files
committed
chore(PowerSeries): remove duplicate instances (#37289)
Since `PowerSeries` is an abbrev for `MvPowerSeries`, all instances are inherited automatically. This PR removes the duplicate instances. There is a bunch of material duplicated in `PowerSeries/Inverse.lean` which is already proved in `MvPowerSeries/Inverse.lean`. That may be removed in a future PR.
1 parent be85740 commit e960b84

File tree

2 files changed

+2
-100
lines changed

2 files changed

+2
-100
lines changed

Mathlib/RingTheory/PowerSeries/Basic.lean

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -64,74 +64,12 @@ open Finsupp (single)
6464

6565
variable {R : Type*}
6666

67-
section
68-
6967
/--
7068
`R⟦X⟧` is notation for `PowerSeries R`,
7169
the semiring of formal power series in one variable over a semiring `R`.
7270
-/
7371
scoped notation:9000 R "⟦X⟧" => PowerSeries R
7472

75-
instance [Inhabited R] : Inhabited R⟦X⟧ := by
76-
dsimp only [PowerSeries]
77-
infer_instance
78-
79-
instance [Zero R] : Zero R⟦X⟧ := by
80-
dsimp only [PowerSeries]
81-
infer_instance
82-
83-
instance [AddMonoid R] : AddMonoid R⟦X⟧ := by
84-
dsimp only [PowerSeries]
85-
infer_instance
86-
87-
instance [AddGroup R] : AddGroup R⟦X⟧ := by
88-
dsimp only [PowerSeries]
89-
infer_instance
90-
91-
instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by
92-
dsimp only [PowerSeries]
93-
infer_instance
94-
95-
instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by
96-
dsimp only [PowerSeries]
97-
infer_instance
98-
99-
instance [Semiring R] : Semiring R⟦X⟧ := by
100-
dsimp only [PowerSeries]
101-
infer_instance
102-
103-
instance [CommSemiring R] : CommSemiring R⟦X⟧ := by
104-
dsimp only [PowerSeries]
105-
infer_instance
106-
107-
instance [Ring R] : Ring R⟦X⟧ := by
108-
dsimp only [PowerSeries]
109-
infer_instance
110-
111-
instance [CommRing R] : CommRing R⟦X⟧ := by
112-
dsimp only [PowerSeries]
113-
infer_instance
114-
115-
instance [Nontrivial R] : Nontrivial R⟦X⟧ := by
116-
dsimp only [PowerSeries]
117-
infer_instance
118-
119-
set_option backward.isDefEq.respectTransparency false in
120-
instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by
121-
dsimp only [PowerSeries]
122-
infer_instance
123-
124-
instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S]
125-
[IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ :=
126-
Pi.isScalarTower
127-
128-
set_option backward.isDefEq.respectTransparency false in
129-
instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by
130-
dsimp only [PowerSeries]
131-
infer_instance
132-
133-
end
134-
13573
section Semiring
13674

13775
variable [Semiring R]
@@ -229,7 +167,6 @@ theorem coeff_zero_eq_constantCoeff : ⇑(coeff (R := R) 0) = constantCoeff := b
229167
theorem coeff_zero_eq_constantCoeff_apply (φ : R⟦X⟧) : coeff 0 φ = constantCoeff φ := by
230168
rw [coeff_zero_eq_constantCoeff]
231169

232-
set_option backward.isDefEq.respectTransparency false in
233170
@[simp]
234171
theorem monomial_zero_eq_C : ⇑(monomial (R := R) 0) = C := by
235172
-- This used to be `rw`, but we need `rw; rfl` after https://github.com/leanprover/lean4/pull/2644
@@ -268,7 +205,6 @@ theorem X_eq : (X : R⟦X⟧) = monomial 1 1 :=
268205
theorem coeff_X (n : ℕ) : coeff n (X : R⟦X⟧) = if n = 1 then 1 else 0 := by
269206
rw [X_eq, coeff_monomial]
270207

271-
set_option backward.isDefEq.respectTransparency false in
272208
@[simp]
273209
theorem coeff_zero_X : coeff 0 (X : R⟦X⟧) = 0 := by
274210
rw [coeff, Finsupp.single_zero, X, MvPowerSeries.coeff_zero_X]
@@ -326,14 +262,12 @@ theorem smul_eq_C_mul (f : R⟦X⟧) (a : R) : a • f = C a * f := by
326262
ext
327263
simp
328264

329-
set_option backward.isDefEq.respectTransparency false in
330265
@[simp]
331266
theorem coeff_succ_mul_X (n : ℕ) (φ : R⟦X⟧) : coeff (n + 1) (φ * X) = coeff n φ := by
332267
simp only [coeff, Finsupp.single_add]
333268
convert φ.coeff_add_mul_monomial (single () n) (single () 1) _
334269
rw [mul_one]
335270

336-
set_option backward.isDefEq.respectTransparency false in
337271
@[simp]
338272
theorem coeff_succ_X_mul (n : ℕ) (φ : R⟦X⟧) : coeff (n + 1) (X * φ) = coeff n φ := by
339273
simp only [coeff, Finsupp.single_add, add_comm n 1]
@@ -592,7 +526,6 @@ variable [CommSemiring R]
592526

593527
open Finset Nat
594528

595-
set_option backward.isDefEq.respectTransparency false in
596529
/-- The ring homomorphism taking a power series `f(X)` to `f(aX)`. -/
597530
noncomputable def rescale (a : R) : R⟦X⟧ →+* R⟦X⟧ where
598531
toFun f := PowerSeries.mk fun n => a ^ n * PowerSeries.coeff n f
@@ -670,7 +603,6 @@ open Finset.HasAntidiagonal Finset
670603

671604
variable {R : Type*} [CommSemiring R] {ι : Type*}
672605

673-
set_option backward.isDefEq.respectTransparency false in
674606
/-- Coefficients of a product of power series -/
675607
theorem coeff_prod [DecidableEq ι] (f : ι → PowerSeries R) (d : ℕ) (s : Finset ι) :
676608
coeff d (∏ j ∈ s, f j) = ∑ l ∈ finsuppAntidiag s d, ∏ i ∈ s, coeff (l i) (f i) := by
@@ -710,7 +642,6 @@ lemma coeff_one_mul (φ ψ : R⟦X⟧) : coeff 1 (φ * ψ) =
710642
mul_comm, add_comm]
711643
simp
712644

713-
set_option backward.isDefEq.respectTransparency false in
714645
/-- First coefficient of the `n`-th power of a power series. -/
715646
lemma coeff_one_pow (n : ℕ) (φ : R⟦X⟧) :
716647
coeff 1 (φ ^ n) = n * coeff 1 φ * (constantCoeff φ) ^ (n - 1) := by
@@ -747,7 +678,6 @@ section CommRing
747678

748679
variable {A : Type*} [CommRing A]
749680

750-
set_option backward.isDefEq.respectTransparency false in
751681
theorem not_isField : ¬IsField A⟦X⟧ := by
752682
by_cases hA : Subsingleton A
753683
· exact not_isField_of_subsingleton _
@@ -767,7 +697,6 @@ theorem rescale_X (a : A) : rescale a X = C a * X := by
767697
simp only [coeff_rescale, coeff_C_mul, coeff_X]
768698
split_ifs with h <;> simp [h]
769699

770-
set_option backward.isDefEq.respectTransparency false in
771700
theorem rescale_neg_one_X : rescale (-1 : A) X = -X := by
772701
rw [rescale_X, map_neg, map_one, neg_one_mul]
773702

@@ -791,7 +720,6 @@ theorem C_eq_algebraMap {r : R} : C r = (algebraMap R R⟦X⟧) r :=
791720
theorem algebraMap_apply {r : R} : algebraMap R A⟦X⟧ r = C (algebraMap R A r) :=
792721
MvPowerSeries.algebraMap_apply
793722

794-
set_option backward.isDefEq.respectTransparency false in
795723
instance [Nontrivial R] : Nontrivial (Subalgebra R R⟦X⟧) :=
796724
{ (inferInstance : Nontrivial <| Subalgebra R <| MvPowerSeries Unit R) with }
797725

@@ -914,7 +842,6 @@ theorem coeToPowerSeries.ringHom_apply : coeToPowerSeries.ringHom φ = φ :=
914842
theorem coe_pow (n : ℕ) : ((φ ^ n : R[X]) : PowerSeries R) = (φ : PowerSeries R) ^ n :=
915843
coeToPowerSeries.ringHom.map_pow _ _
916844

917-
set_option backward.isDefEq.respectTransparency false in
918845
theorem eval₂_C_X_eq_coe : φ.eval₂ PowerSeries.C PowerSeries.X = ↑φ := by
919846
nth_rw 2 [← eval₂_C_X (p := φ)]
920847
rw [← coeToPowerSeries.ringHom_apply, eval₂_eq_sum_range, eval₂_eq_sum_range, map_sum]
@@ -929,7 +856,6 @@ section CommSemiring
929856

930857
variable {R : Type*} [CommSemiring R] (φ ψ : R[X])
931858

932-
set_option backward.isDefEq.respectTransparency false in
933859
theorem _root_.MvPolynomial.toMvPowerSeries_pUnitAlgEquiv {f : MvPolynomial PUnit R} :
934860
(f.toMvPowerSeries : PowerSeries R) = (f.pUnitAlgEquiv R).toPowerSeries := by
935861
induction f using MvPolynomial.induction_on' with

Mathlib/RingTheory/PowerSeries/Inverse.lean

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ variable [Ring R]
5252
protected def inv.aux : R → R⟦X⟧ → R⟦X⟧ :=
5353
MvPowerSeries.inv.aux
5454

55-
set_option backward.isDefEq.respectTransparency false in
5655
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
5756
coeff n (inv.aux a φ) =
5857
if n = 0 then a
@@ -129,11 +128,9 @@ section Field
129128
variable {k : Type*} [Field k]
130129

131130
/-- The inverse 1/f of a power series f defined over a field -/
132-
protected def inv : k⟦X⟧ → k⟦X⟧ :=
131+
protected abbrev inv : k⟦X⟧ → k⟦X⟧ :=
133132
MvPowerSeries.inv
134133

135-
instance : Inv k⟦X⟧ := ⟨PowerSeries.inv⟩
136-
137134
theorem inv_eq_inv_aux (φ : k⟦X⟧) : φ⁻¹ = inv.aux (constantCoeff φ)⁻¹ φ :=
138135
rfl
139136

@@ -189,9 +186,6 @@ theorem inv_eq_iff_mul_eq_one {φ ψ : k⟦X⟧} (h : constantCoeff ψ ≠ 0) :
189186
protected theorem mul_inv_rev (φ ψ : k⟦X⟧) : (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ :=
190187
MvPowerSeries.mul_inv_rev _ _
191188

192-
instance : InvOneClass k⟦X⟧ :=
193-
{ (inferInstance : InvOneClass <| MvPowerSeries Unit k) with }
194-
195189
@[simp]
196190
theorem C_inv (r : k) : (C r)⁻¹ = C r⁻¹ :=
197191
MvPowerSeries.C_inv _
@@ -222,7 +216,6 @@ theorem Inv_divided_by_X_pow_order_rightInv {f : k⟦X⟧} (hf : f ≠ 0) :
222216
divXPowOrder f * Inv_divided_by_X_pow_order hf = 1 :=
223217
mul_invOfUnit (divXPowOrder f) (firstUnitCoeff hf) rfl
224218

225-
set_option backward.isDefEq.respectTransparency false in
226219
@[simp]
227220
theorem Inv_divided_by_X_pow_order_leftInv {f : k⟦X⟧} (hf : f ≠ 0) :
228221
Inv_divided_by_X_pow_order hf * divXPowOrder f = 1 := by
@@ -253,7 +246,6 @@ theorem Unit_of_divided_by_X_pow_order_nonzero {f : k⟦X⟧} (hf : f ≠ 0) :
253246
theorem Unit_of_divided_by_X_pow_order_zero : Unit_of_divided_by_X_pow_order (0 : k⟦X⟧) = 1 := by
254247
simp only [Unit_of_divided_by_X_pow_order, dif_pos]
255248

256-
set_option backward.isDefEq.respectTransparency false in
257249
theorem eq_divided_by_X_pow_order_Iff_Unit {f : k⟦X⟧} (hf : f ≠ 0) :
258250
f = divXPowOrder f ↔ IsUnit f :=
259251
fun h ↦ by rw [h]; exact isUnit_divided_by_X_pow_order hf, fun h ↦ by
@@ -274,11 +266,6 @@ theorem map.isLocalHom : IsLocalHom (map f) :=
274266

275267
variable [IsLocalRing R]
276268

277-
set_option backward.isDefEq.respectTransparency false in
278-
instance : IsLocalRing R⟦X⟧ :=
279-
{ (inferInstance : IsLocalRing <| MvPowerSeries Unit R) with }
280-
281-
282269
end IsLocalRing
283270

284271
section IsDiscreteValuationRing
@@ -297,19 +284,14 @@ theorem hasUnitMulPowIrreducibleFactorization :
297284
simp only [Unit_of_divided_by_X_pow_order_nonzero hf]
298285
exact X_pow_order_mul_divXPowOrder)⟩
299286

300-
set_option backward.isDefEq.respectTransparency false in
301287
instance : UniqueFactorizationMonoid k⟦X⟧ :=
302288
hasUnitMulPowIrreducibleFactorization.toUniqueFactorizationMonoid
303289

304-
set_option backward.isDefEq.respectTransparency false in
305290
instance : IsDiscreteValuationRing k⟦X⟧ :=
306291
ofHasUnitMulPowIrreducibleFactorization hasUnitMulPowIrreducibleFactorization
307292

308-
set_option backward.isDefEq.respectTransparency false in
309-
instance isNoetherianRing : IsNoetherianRing k⟦X⟧ :=
310-
PrincipalIdealRing.isNoetherianRing
293+
example : IsNoetherianRing k⟦X⟧ := inferInstance
311294

312-
set_option backward.isDefEq.respectTransparency false in
313295
/-- The maximal ideal of `k⟦X⟧` is generated by `X`. -/
314296
theorem maximalIdeal_eq_span_X : IsLocalRing.maximalIdeal (k⟦X⟧) = Ideal.span {X} := by
315297
have hX : (Ideal.span {(X : k⟦X⟧)}).IsMaximal := by
@@ -331,7 +313,6 @@ theorem maximalIdeal_eq_span_X : IsLocalRing.maximalIdeal (k⟦X⟧) = Ideal.spa
331313
apply Ideal.eq_top_of_isUnit_mem I hfI0 (IsUnit.map C (Ne.isUnit hfX))
332314
rw [IsLocalRing.eq_maximalIdeal hX]
333315

334-
set_option backward.isDefEq.respectTransparency false in
335316
set_option linter.style.whitespace false in -- manual alignment is not recognised
336317
instance : NormalizationMonoid k⟦X⟧ where
337318
normUnit f := (Unit_of_divided_by_X_pow_order f)⁻¹
@@ -348,17 +329,14 @@ instance : NormalizationMonoid k⟦X⟧ where
348329
rw [inv_inj, Units.ext_iff, ← hu, Unit_of_divided_by_X_pow_order_nonzero h₀.ne_zero]
349330
exact ((eq_divided_by_X_pow_order_Iff_Unit h₀.ne_zero).mpr h₀).symm
350331

351-
set_option backward.isDefEq.respectTransparency false in
352332
theorem normUnit_X : normUnit (X : k⟦X⟧) = 1 := by
353333
simp [normUnit, ← Units.val_eq_one, Unit_of_divided_by_X_pow_order_nonzero]
354334

355-
set_option backward.isDefEq.respectTransparency false in
356335
theorem X_eq_normalizeX : (X : k⟦X⟧) = normalize X := by
357336
simp only [normalize_apply, normUnit_X, Units.val_one, mul_one]
358337

359338
open UniqueFactorizationMonoid
360339

361-
set_option backward.isDefEq.respectTransparency false in
362340
open scoped Classical in
363341
theorem normalized_count_X_eq_of_coe {P : k[X]} (hP : P ≠ 0) :
364342
Multiset.count PowerSeries.X (normalizedFactors (P : k⟦X⟧)) =
@@ -373,12 +351,10 @@ theorem normalized_count_X_eq_of_coe {P : k[X]} (hP : P ≠ 0) :
373351

374352
open IsLocalRing
375353

376-
set_option backward.isDefEq.respectTransparency false in
377354
theorem ker_coeff_eq_max_ideal : RingHom.ker (constantCoeff (R := k)) = maximalIdeal _ :=
378355
Ideal.ext fun _ ↦ by
379356
rw [RingHom.mem_ker, maximalIdeal_eq_span_X, Ideal.mem_span_singleton, X_dvd_iff]
380357

381-
set_option backward.isDefEq.respectTransparency false in
382358
/-- The ring isomorphism between the residue field of the ring of power series valued in a field `K`
383359
and `K` itself. -/
384360
def residueFieldOfPowerSeries : ResidueField k⟦X⟧ ≃+* k :=

0 commit comments

Comments
 (0)