Skip to content

Commit

Permalink
feat(RingTheory/PowerSeries/Basic): Polynomial.coe_sub and `Polynom…
Browse files Browse the repository at this point in the history
…ial.coe_neg` (#19339)

These are analogous to the existing `Polynomial.coe_add` and `Polynomial.coe_zero`, about the coercion from `Polynomial` to `PowerSeries`.

[Zulip thread](https://leanprover.zulipchat.com/#narrow/channel/217875-Is-there-code-for-X.3F/topic/.60.281.20-.20X.20.3A.20.E2.84.A4.5BX.5D.29.2EtoPowerSeries.20.3D.201.20-.20.28PowerSeries.2EX.20.3A.20.E2.84.A4.E2.9F.A6X.E2.9F.A7.29.60/near/483708229).
  • Loading branch information
FMLJohn committed Nov 22, 2024
1 parent e03117d commit 178af37
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Mathlib/RingTheory/LaurentSeries.lean
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ theorem exists_ratFunc_val_lt (f : K⸨X⸩) (γ : ℤₘ₀ˣ) :
· erw [hs, ← F_mul, PowerSeries.coe_pow, PowerSeries.coe_X, RatFunc.coe_mul, zpow_neg,
zpow_ofNat, inv_eq_one_div (RatFunc.X ^ s), RatFunc.coe_div, RatFunc.coe_pow, RatFunc.coe_X,
RatFunc.coe_one, ← inv_eq_one_div, ← mul_sub, map_mul, map_inv₀, ← PowerSeries.coe_X,
valuation_X_pow, ← hs, ← RatFunc.coe_coe, ← coe_sub, ← coe_algebraMap,
valuation_X_pow, ← hs, ← RatFunc.coe_coe, ← PowerSeries.coe_sub, ← coe_algebraMap,
valuation_of_algebraMap, ← Units.val_mk0
(a := ((Multiplicative.ofAdd f.order : Multiplicative ℤ) : ℤₘ₀)), ← hη]
apply inv_mul_lt_of_lt_mul₀
Expand All @@ -943,8 +943,8 @@ theorem exists_ratFunc_val_lt (f : K⸨X⸩) (γ : ℤₘ₀ˣ) :
· obtain ⟨s, hs⟩ := Int.exists_eq_neg_ofNat (Int.neg_nonpos_of_nonneg (not_lt.mp ord_nonpos))
obtain ⟨P, hP⟩ := exists_Polynomial_intValuation_lt (PowerSeries.X ^ s * F) γ
use P
erw [← X_order_mul_powerSeriesPart (neg_inj.1 hs).symm, ← RatFunc.coe_coe, ← coe_sub,
← coe_algebraMap, valuation_of_algebraMap]
erw [← X_order_mul_powerSeriesPart (neg_inj.1 hs).symm, ← RatFunc.coe_coe,
PowerSeries.coe_sub, ← coe_algebraMap, valuation_of_algebraMap]
exact hP

theorem coe_range_dense : DenseRange ((↑) : RatFunc K → K⸨X⸩) := by
Expand Down Expand Up @@ -981,7 +981,7 @@ theorem inducing_coe : IsUniformInducing ((↑) : RatFunc K → K⸨X⸩) := by
refine ⟨⟨d, by rfl⟩, subset_trans (fun _ _ ↦ pre_R ?_) pre_T⟩
apply hd
simp only [sub_zero, Set.mem_setOf_eq]
erw [← coe_sub, ← valuation_eq_LaurentSeries_valuation]
erw [← RatFunc.coe_sub, ← valuation_eq_LaurentSeries_valuation]
assumption
· rintro ⟨_, ⟨hT, pre_T⟩⟩
obtain ⟨d, hd⟩ := Valued.mem_nhds.mp hT
Expand All @@ -993,7 +993,7 @@ theorem inducing_coe : IsUniformInducing ((↑) : RatFunc K → K⸨X⸩) := by
· refine subset_trans (fun _ _ ↦ ?_) pre_T
apply hd
erw [Set.mem_setOf_eq, sub_zero, valuation_eq_LaurentSeries_valuation,
coe_sub]
RatFunc.coe_sub]
assumption

theorem continuous_coe : Continuous ((↑) : RatFunc K → K⸨X⸩) :=
Expand Down
16 changes: 16 additions & 0 deletions Mathlib/RingTheory/PowerSeries/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ namespace Polynomial

open Finsupp Polynomial

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

-- Porting note: added so we can add the `@[coe]` attribute
Expand Down Expand Up @@ -877,6 +878,21 @@ theorem coeToPowerSeries.algHom_apply :
coeToPowerSeries.algHom A φ = PowerSeries.map (algebraMap R A) ↑φ :=
rfl

end CommSemiring

section CommRing
variable {R : Type*} [CommRing R]

@[simp, norm_cast]
lemma coe_neg (p : R[X]) : ((- p : R[X]) : PowerSeries R) = - p :=
coeToPowerSeries.ringHom.map_neg p

@[simp, norm_cast]
lemma coe_sub (p q : R[X]) : ((p - q : R[X]) : PowerSeries R) = p - q :=
coeToPowerSeries.ringHom.map_sub p q

end CommRing

end Polynomial

namespace PowerSeries
Expand Down

0 comments on commit 178af37

Please sign in to comment.