-
Notifications
You must be signed in to change notification settings - Fork 628
feat(RingTheory/PowerSeries/Substitution): add API #26961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mariainesdff
wants to merge
1
commit into
leanprover-community:master
Choose a base branch
from
mariainesdff:substitution_api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,7 +3,7 @@ Copyright (c) 2025 Antoine Chambert-Loir, María Inés de Frutos Fernández. All | |||||
Released under Apache 2.0 license as described in the file LICENSE. | ||||||
Authors: Antoine Chambert-Loir, María Inés de Frutos Fernández | ||||||
-/ | ||||||
|
||||||
import Mathlib.RingTheory.MvPowerSeries.Order | ||||||
import Mathlib.RingTheory.MvPowerSeries.Substitution | ||||||
import Mathlib.RingTheory.PowerSeries.Evaluation | ||||||
|
||||||
|
@@ -146,6 +146,9 @@ noncomputable def subst (a : MvPowerSeries τ S) (f : PowerSeries R) : | |||||
MvPowerSeries τ S := | ||||||
MvPowerSeries.subst (fun _ ↦ a) f | ||||||
|
||||||
lemma subst_def (a : MvPowerSeries τ S) (f : PowerSeries R) : | ||||||
subst a f = MvPowerSeries.subst (fun _ ↦ a) f := rfl | ||||||
|
||||||
variable {a : MvPowerSeries τ S} {b : S⟦X⟧} | ||||||
|
||||||
/-- Substitution of power series into a power series, as an `AlgHom`. -/ | ||||||
|
@@ -284,10 +287,57 @@ theorem subst_comp_subst_apply | |||||
subst b (subst a f) = subst (subst b a) f := | ||||||
congr_fun (subst_comp_subst ha hb) f | ||||||
|
||||||
lemma rescale_eq (r : R) (f : PowerSeries R) : | ||||||
rescale r f = MvPowerSeries.rescale (fun _ ↦ r) f := by | ||||||
ext n | ||||||
rw [coeff_rescale, coeff, MvPowerSeries.coeff_rescale] | ||||||
simp [pow_zero, Finsupp.prod_single_index] | ||||||
|
||||||
lemma rescale_eq_subst (r : R) (f : PowerSeries R) : | ||||||
PowerSeries.rescale r f = PowerSeries.subst (r • X : R⟦X⟧) f := by | ||||||
rw [rescale_eq, MvPowerSeries.rescale_eq_subst, X, subst, Pi.smul_def'] | ||||||
|
||||||
theorem _root_.MvPowerSeries.rescaleUnit (a : R) (f : R⟦X⟧) : | ||||||
MvPowerSeries.rescale (Function.const _ a) f = rescale a f := by | ||||||
ext d | ||||||
rw [coeff_rescale, coeff, MvPowerSeries.coeff_rescale] | ||||||
simp | ||||||
|
||||||
/-- Rescale power series, as an `AlgHom` -/ | ||||||
noncomputable def rescaleAlgHom (r : R) : R⟦X⟧ →ₐ[R] R⟦X⟧ := | ||||||
MvPowerSeries.rescaleAlgHom (fun _ ↦ r) | ||||||
|
||||||
lemma rescaleAlgHom_def (r : R) (f : PowerSeries R) : | ||||||
rescaleAlgHom r f = MvPowerSeries.rescaleAlgHom (fun _ ↦ r) f := by | ||||||
simp only [rescaleAlgHom] | ||||||
|
||||||
theorem rescaleAlgHom_apply (r : R) : | ||||||
(rescaleAlgHom r) = rescale r := by | ||||||
ext f | ||||||
rw [rescale_eq, RingHom.coe_coe, rescaleAlgHom_def, MvPowerSeries.rescaleAlgHom_apply] | ||||||
|
||||||
/-- When `p` is linear, substitution of `p` and then a scalar homothety is substitution of | ||||||
the homothety then `p`. -/ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
lemma subst_linear_subst_scalar_comm (a : R) {σ : Type*} (p : MvPowerSeries σ R) | ||||||
(hp_lin : ∀ d ∈ Function.support p, d.degree = 1) (f : PowerSeries R) : | ||||||
subst p (rescale a f) = MvPowerSeries.rescale (Function.const σ a) (subst p f) := by | ||||||
have hp : PowerSeries.HasSubst p := by | ||||||
apply HasSubst.of_constantCoeff_zero | ||||||
rw [← MvPowerSeries.coeff_zero_eq_constantCoeff_apply] | ||||||
apply MvPowerSeries.IsHomogeneous.coeff_eq_zero (p := 1) _ (by simp) | ||||||
simp only [MvPowerSeries.IsHomogeneous, MvPowerSeries.IsWeightedHomogeneous, ne_eq] | ||||||
intro d hd | ||||||
convert hp_lin d hd using 1 | ||||||
simp [Finsupp.weight, Finsupp.linearCombination, Finsupp.degree] | ||||||
rfl | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||||||
rw [rescale_eq_subst, MvPowerSeries.rescale_eq_subst, | ||||||
subst_comp_subst_apply (HasSubst.smul_X' a) hp] | ||||||
nth_rewrite 3 [subst] | ||||||
rw [MvPowerSeries.subst_comp_subst_apply hp.const (MvPowerSeries.HasSubst.smul_X _), | ||||||
funext_iff] | ||||||
intro _ | ||||||
rw [subst_smul hp, ← Polynomial.coe_X, subst_coe hp, Polynomial.aeval_X, | ||||||
← MvPowerSeries.rescale_eq_subst, MvPowerSeries.rescale_homogeneous_eq_smul hp_lin, | ||||||
subst, pow_one] | ||||||
|
||||||
end PowerSeries |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a better way to distinguish this lemma than the prime suffix?