Skip to content

Commit 2233275

Browse files
committed
chore: golf proofs in Mathlib/RingTheory/PowerSeries/Substitution.lean (#37821)
This PR golfs three proofs in `Mathlib/RingTheory/PowerSeries/Substitution.lean` by reusing existing lemmas instead of reproving the relevant coefficient computations. Specifically: - `constantCoeff_subst_eq_zero` now uses `MvPowerSeries.constantCoeff_subst_eq_zero`. - `Polynomial.toPowerSeries_toMvPowerSeries` now uses `Polynomial.pUnitAlgEquiv_symm_toPowerSeries`. - `map_subst` now uses `MvPowerSeries.map_subst`. This is a pure proof cleanup; no declarations are changed.
1 parent aff21ab commit 2233275

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

Mathlib/RingTheory/PowerSeries/Substitution.lean

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,9 @@ theorem constantCoeff_subst_X_pow {k : ℕ} (hk : k ≠ 0) (f : PowerSeries R) :
264264

265265
theorem constantCoeff_subst_eq_zero (ha : a.constantCoeff = 0) (f : PowerSeries R)
266266
(hf : f.constantCoeff = 0) : MvPowerSeries.constantCoeff (subst a f) = 0 := by
267-
rw [constantCoeff_subst (HasSubst.of_constantCoeff_zero ha), finsum_eq_zero_of_forall_eq_zero]
268-
intro d
269-
by_cases hd : d = 0
270-
· simp [hd, hf]
271-
· simp [ha, zero_pow hd]
267+
have := MvPowerSeries.constantCoeff_subst_eq_zero
268+
(hasSubst_iff.mp <| HasSubst.of_constantCoeff_zero ha) (fun _ ↦ ha) hf
269+
simpa [hasSubst_iff]
272270

273271
theorem map_algebraMap_eq_subst_X (f : R⟦X⟧) :
274272
map (algebraMap R S) f = subst X f :=
@@ -279,16 +277,9 @@ theorem X_subst (f : R⟦X⟧) : f.subst (X : R⟦X⟧) = f := by
279277
rw [← map_algebraMap_eq_subst_X (S := R), Algebra.algebraMap_self]
280278
exact congr_fun map_id f
281279

282-
theorem _root_.Polynomial.toPowerSeries_toMvPowerSeries (p : Polynomial R) :
283-
(p : PowerSeries R) =
284-
((Polynomial.aeval (MvPolynomial.X ()) p : MvPolynomial Unit R) : MvPowerSeries Unit R) := by
285-
suffices (Polynomial.coeToPowerSeries.algHom R) p =
286-
(MvPolynomial.coeToMvPowerSeries.algHom R)
287-
(Polynomial.aeval (MvPolynomial.X () : MvPolynomial Unit R) p) by simpa
288-
rw [← AlgHom.comp_apply]
289-
apply AlgHom.congr_fun
290-
apply Polynomial.algHom_ext
291-
simp [X]
280+
theorem _root_.Polynomial.toPowerSeries_toMvPowerSeries (p : Polynomial R) : (p : PowerSeries R) =
281+
((Polynomial.aeval (MvPolynomial.X ()) p : MvPolynomial Unit R) : MvPowerSeries Unit R) :=
282+
Polynomial.pUnitAlgEquiv_symm_toPowerSeries
292283

293284
theorem substAlgHom_coe (ha : HasSubst a) (p : Polynomial R) :
294285
substAlgHom ha (p : PowerSeries R) = ↑(Polynomial.aeval a p) := by
@@ -315,13 +306,8 @@ theorem subst_X (ha : HasSubst a) :
315306

316307
omit [Algebra R S] in
317308
theorem map_subst {a : MvPowerSeries τ R} (ha : HasSubst a) {h : R →+* S} (f : PowerSeries R) :
318-
(f.subst a).map h = (f.map h).subst (a.map h) := by
319-
ext n
320-
have {r : R} : h r = h.toAddMonoidHom r := rfl
321-
rw [MvPowerSeries.coeff_map, coeff_subst ha, coeff_subst (IsNilpotent.map ha h), this,
322-
AddMonoidHom.map_finsum _ (coeff_subst_finite ha _ _), finsum_congr]
323-
intro d
324-
simp [← map_pow]
309+
(f.subst a).map h = (f.map h).subst (a.map h) :=
310+
MvPowerSeries.map_subst (HasSubst.const ha) f
325311

326312
section
327313

0 commit comments

Comments
 (0)