Skip to content

Commit 18ef4ef

Browse files
committed
feat(RingTheory/MvPowerSeries): some theorems about expand (leanprover-community#33885)
Co-authored-by: WenrongZou <wenrongzou@outlook.com>
1 parent 277a145 commit 18ef4ef

4 files changed

Lines changed: 83 additions & 5 deletions

File tree

Mathlib/RingTheory/MvPowerSeries/Expand.lean

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ theorem expand_substAlgHom {f : σ → MvPowerSeries τ S} (hf : HasSubst f) {φ
7878
expand p hp (substAlgHom hf φ) = substAlgHom (HasSubst.expand p hp hf) φ := by
7979
rw [← AlgHom.comp_apply, expand_comp_substAlgHom]
8080

81+
theorem expand_subst {f : σ → MvPowerSeries τ R} (hf : HasSubst f) {φ : MvPowerSeries σ R} :
82+
expand p hp (subst f φ) = subst (fun i ↦ (f i).expand p hp) φ := by
83+
rw [← substAlgHom_apply hf, expand_substAlgHom, substAlgHom_apply]
84+
8185
end
8286

8387
/- TODO : In the original file of multi variate polynomial, there are two theorem about rename
@@ -109,6 +113,12 @@ theorem coeff_expand_smul (φ : MvPowerSeries σ R) (m : σ →₀ ℕ) :
109113
rw [this, coeff_monomial, if_neg _, mul_zero]
110114
simp [nsmul_right_inj hp, hd.symm]
111115

116+
@[simp]
117+
theorem constantCoeff_expand (φ : MvPowerSeries σ R) :
118+
(φ.expand p hp).constantCoeff = φ.constantCoeff := by
119+
conv_lhs => rw [← coeff_zero_eq_constantCoeff, ← smul_zero p, coeff_expand_smul]
120+
simp
121+
112122
theorem coeff_expand_of_not_dvd (φ : MvPowerSeries σ R) {m : σ →₀ ℕ} {i : σ} (h : ¬ p ∣ m i) :
113123
(expand p hp φ).coeff m = 0 := by
114124
classical
@@ -148,6 +158,26 @@ theorem support_expand (φ : MvPowerSeries σ R) :
148158
rw [Function.mem_support, ← coeff_apply φ, ← coeff_expand_smul p hp, coeff_apply, hc] at hn₁
149159
contradiction
150160

161+
@[simp]
162+
theorem order_expand (φ : MvPowerSeries σ R) :
163+
(φ.expand p hp).order = p • φ.order := by
164+
by_cases! hφ : φ = 0
165+
· simpa [hφ] using (ENat.mul_top (by norm_cast)).symm
166+
· apply eq_of_le_of_ge
167+
· obtain ⟨d, hd₁, hd₂⟩ := exists_coeff_ne_zero_and_order (ne_zero_iff_order_finite.mp hφ)
168+
have : p • φ.order = (p • d).degree := by simp [← hd₂]
169+
rw [this]
170+
exact order_le <| (coeff_expand_smul p hp φ _) ▸ hd₁
171+
· refine MvPowerSeries.le_order fun d hd => by
172+
by_cases! h : ∀ i, p ∣ d i
173+
· obtain ⟨m, hm⟩ : ∃ m, d = p • m := ⟨Finsupp.equivFunOnFinite.symm fun i => d i / p,
174+
by ext i; simp [(Nat.mul_div_cancel' (h i))]⟩
175+
rw [hm, coeff_expand_smul, coeff_of_lt_order]
176+
simp only [hm, map_nsmul, smul_eq_mul, Nat.cast_mul, nsmul_eq_mul] at hd
177+
exact lt_of_mul_lt_mul_left' hd
178+
· obtain ⟨i, hi⟩ := h
179+
exact coeff_expand_of_not_dvd p hp φ hi
180+
151181
section MvPolynomial
152182

153183
/-- For any multivariate polynomial `φ`, then `MvPolynomial.expand p φ` and

Mathlib/RingTheory/MvPowerSeries/Substitution.lean

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,21 @@ theorem constantCoeff_subst (ha : HasSubst a) (f : MvPowerSeries σ R) :
283283
finsum (fun d ↦ coeff d f • (constantCoeff (d.prod fun s e => (a s) ^ e))) := by
284284
simp only [← coeff_zero_eq_constantCoeff_apply, coeff_subst ha f 0]
285285

286+
theorem constantCoeff_subst_eq_zero (ha : HasSubst a) (ha' : ∀ i, (a i).constantCoeff = 0)
287+
{f : MvPowerSeries σ R} (hf : f.constantCoeff = 0) :
288+
MvPowerSeries.constantCoeff (subst a f) = 0 := by
289+
rw [constantCoeff_subst ha, finsum_eq_zero_of_forall_eq_zero]
290+
intro d
291+
by_cases hd : d = 0
292+
· simp [hd, hf]
293+
· have : constantCoeff (d.prod fun s e ↦ a s ^ e) = 0 := by
294+
obtain ⟨i, hi⟩ : ∃ i : σ, d i ≠ 0 := by
295+
by_contra! hc
296+
exact hd <| Finsupp.ext hc
297+
simpa [map_finsuppProd, ha'] using
298+
Finset.prod_eq_zero (i := i) (by simp [hi]) (by simp [zero_pow hi])
299+
rw [this, smul_zero]
300+
286301
theorem map_algebraMap_eq_subst_X (f : MvPowerSeries σ R) :
287302
map (algebraMap R S) f = subst X f := by
288303
ext e

Mathlib/RingTheory/PowerSeries/Expand.lean

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ theorem expand_mul (q : ℕ) (hq : q ≠ 0) (φ : PowerSeries R) :
4848
φ.expand (p * q) (p.mul_ne_zero hp hq) = (φ.expand q hq).expand p hp :=
4949
DFunLike.congr_fun (expand_mul_eq_comp p hp q hq) φ
5050

51+
theorem expand_smul (a : R) (φ : PowerSeries R) :
52+
expand p hp (a • φ) = a • φ.expand p hp := AlgHom.map_smul_of_tower _ _ _
53+
5154
@[simp]
5255
theorem expand_X : expand p hp (X (R := R)) = X ^ p :=
5356
substAlgHom_X (HasSubst.X_pow hp)
@@ -68,28 +71,50 @@ theorem map_expand (f : R →+* S) (φ : PowerSeries R) :
6871
map f (expand p hp φ) = expand p hp (map f φ) := by
6972
simp [map, expand, MvPowerSeries.map_expand]
7073

74+
theorem expand_subst {f : MvPowerSeries τ S} [Finite τ] (hf : HasSubst f) (φ : PowerSeries S) :
75+
(subst f φ).expand p hp = subst (f.expand p hp) φ := by
76+
rw [PowerSeries.subst, MvPowerSeries.expand_subst _ hp (HasSubst.const hf) (φ := φ)]
77+
rfl
78+
7179
/- TODO : In the original file of multi variate polynomial, there are two theorem about rename
7280
here, but we don't have rename for multi variate power series. And for `eval₂Hom`, `eval₂`
7381
and `aevel`, the expression does't look good. -/
7482

75-
variable (q : ℕ) (hq : 0 < q)
83+
variable (φ : PowerSeries R) (q : ℕ) (hq : 0 < q)
7684

7785
@[simp]
78-
theorem coeff_expand_mul (φ : PowerSeries R) (m : ℕ) :
86+
theorem coeff_expand_mul (m : ℕ) :
7987
(expand p hp φ).coeff (p * m) = φ.coeff m := by
8088
rw [coeff, coeff, expand, ← smul_eq_mul, ← Finsupp.smul_single, MvPowerSeries.coeff_expand_smul]
8189

82-
theorem coeff_expand_of_not_dvd (φ : PowerSeries R) {m : ℕ} (h : ¬ p ∣ m) :
90+
@[simp]
91+
theorem constantCoeff_expand (φ : PowerSeries R) :
92+
(φ.expand p hp).constantCoeff = φ.constantCoeff := by
93+
conv_lhs => rw [← coeff_zero_eq_constantCoeff, ← mul_zero p, coeff_expand_mul]
94+
simp
95+
96+
theorem coeff_expand_of_not_dvd {m : ℕ} (h : ¬ p ∣ m) :
8397
(expand p hp φ).coeff m = 0 := by
8498
rw [coeff, expand, MvPowerSeries.coeff_expand_of_not_dvd (i := ())]
8599
simpa
86100

87-
theorem support_expand_subset (φ : PowerSeries R) :
101+
theorem support_expand_subset :
88102
(expand p hp φ).support ⊆ φ.support.image (p • ·) := by
89103
rw [expand, MvPowerSeries.support_expand]
90104

91-
theorem support_expand (φ : PowerSeries R) :
105+
theorem support_expand :
92106
(expand p hp φ).support = φ.support.image (p • ·) := by
93107
rw [expand, MvPowerSeries.support_expand]
94108

109+
theorem coeff_expand {n : ℕ} :
110+
(φ.expand p hp).coeff n = if p ∣ n then φ.coeff (n / p) else 0 := by
111+
split_ifs with h
112+
· obtain ⟨q, hq⟩ := h
113+
rw [hq, coeff_expand_mul, Nat.mul_div_cancel_left _ (p.pos_of_ne_zero hp)]
114+
exact coeff_expand_of_not_dvd p hp _ h
115+
116+
@[simp]
117+
theorem order_expand : (φ.expand p hp).order = p • φ.order := by
118+
simp_rw [expand, order_eq_order, MvPowerSeries.order_expand p hp φ]
119+
95120
end PowerSeries

Mathlib/RingTheory/PowerSeries/Substitution.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ theorem constantCoeff_subst (ha : HasSubst a) (f : PowerSeries R) :
222222
finsum (fun d ↦ coeff d f • MvPowerSeries.constantCoeff (a ^ d)) := by
223223
simp only [← MvPowerSeries.coeff_zero_eq_constantCoeff_apply, coeff_subst ha f 0]
224224

225+
theorem constantCoeff_subst_eq_zero (ha : a.constantCoeff = 0) (f : PowerSeries R)
226+
(hf : f.constantCoeff = 0) : MvPowerSeries.constantCoeff (subst a f) = 0 := by
227+
rw [constantCoeff_subst (HasSubst.of_constantCoeff_zero ha), finsum_eq_zero_of_forall_eq_zero]
228+
intro d
229+
by_cases hd : d = 0
230+
· simp [hd, hf]
231+
· simp [ha, zero_pow hd]
232+
225233
theorem map_algebraMap_eq_subst_X (f : R⟦X⟧) :
226234
map (algebraMap R S) f = subst X f :=
227235
MvPowerSeries.map_algebraMap_eq_subst_X f

0 commit comments

Comments
 (0)