Skip to content

Commit 9302f15

Browse files
feat(RingTheory/MvPowerSeries/Trunc): define variant of truncation (#20958)
`MvPowerSeries.trunc` truncates a multivariate power series strictly below some exponent (using `Finset.Iio`). Define analogously `MvPowerSeries.trunc'` that truncates using `Finset.Iic`.
1 parent b3d8bda commit 9302f15

File tree

1 file changed

+129
-11
lines changed

1 file changed

+129
-11
lines changed

Mathlib/RingTheory/MvPowerSeries/Trunc.lean

Lines changed: 129 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,41 @@ import Mathlib.Algebra.MvPolynomial.Eval
1212
1313
# Formal (multivariate) power series - Truncation
1414
15-
`MvPowerSeries.trunc n φ` truncates a formal multivariate power series
15+
* `MvPowerSeries.trunc n φ` truncates a formal multivariate power series
1616
to the multivariate polynomial that has the same coefficients as `φ`,
1717
for all `m < n`, and `0` otherwise.
1818
1919
Note that here, `m` and `n` have types `σ →₀ ℕ`,
2020
so that `m < n` means that `m ≠ n` and `m s ≤ n s` for all `s : σ`.
2121
22+
* `MvPowerSeries.trunc_one` : truncation of the unit power series
23+
24+
* `MvPowerSeries.trunc_C` : truncation of a constant
25+
26+
* `MvPowerSeries.trunc_C_mul` : truncation of constant multiple.
27+
28+
* `MvPowerSeries.trunc' n φ` truncates a formal multivariate power series
29+
to the multivariate polynomial that has the same coefficients as `φ`,
30+
for all `m ≤ n`, and `0` otherwise.
31+
32+
Here, `m` and `n` have types `σ →₀ ℕ` so that `m ≤ n` means that `m s ≤ n s` for all `s : σ`.
33+
34+
35+
* `MvPowerSeries.coeff_mul_eq_coeff_trunc'_mul_trunc'` : compares the coefficients
36+
of a product with those of the product of truncations.
37+
38+
* `MvPowerSeries.trunc'_one` : truncation of a the unit power series.
39+
40+
* `MvPowerSeries.trunc'_C` : truncation of a constant.
41+
42+
* `MvPowerSeries.trunc'_C_mul` : truncation of a constant multiple.
43+
44+
* `MvPowerSeries.trunc'_map` : image of a truncation under a change of rings
45+
46+
## TODO
47+
48+
* Unify both versions using a general purpose API
49+
2250
-/
2351

2452

@@ -32,7 +60,7 @@ open Finsupp
3260

3361
variable {σ R S : Type*}
3462

35-
section Trunc
63+
section TruncLT
3664

3765
variable [CommSemiring R] (n : σ →₀ ℕ)
3866

@@ -47,7 +75,12 @@ theorem coeff_truncFun (m : σ →₀ ℕ) (φ : MvPowerSeries σ R) :
4775

4876
variable (R)
4977

50-
/-- The `n`th truncation of a multivariate formal power series to a multivariate polynomial -/
78+
/-- The `n`th truncation of a multivariate formal power series to a multivariate polynomial
79+
80+
If `f : MvPowerSeries σ R` and `n : σ →₀ ℕ` is a (finitely-supported) function from `σ`
81+
to the naturals, then `trunc' R n f` is the multivariable power series obtained from `f`
82+
by keeping only the monomials $c\prod_i X_i^{a_i}$ where `a i ≤ n i` for all `i`
83+
and $a i < n i` for some `i`. -/
5184
def trunc : MvPowerSeries σ R →+ MvPolynomial σ R where
5285
toFun := truncFun n
5386
map_zero' := by
@@ -58,10 +91,7 @@ def trunc : MvPowerSeries σ R →+ MvPolynomial σ R where
5891
classical
5992
intros x y
6093
ext m
61-
simp only [coeff_truncFun, MvPolynomial.coeff_add]
62-
split_ifs
63-
· rw [map_add]
64-
· rw [zero_add]
94+
simp only [coeff_truncFun, MvPolynomial.coeff_add, ite_add_ite, ← map_add, add_zero]
6595

6696
variable {R}
6797

@@ -71,7 +101,7 @@ theorem coeff_trunc (m : σ →₀ ℕ) (φ : MvPowerSeries σ R) :
71101

72102
@[simp]
73103
theorem trunc_one (n : σ →₀ ℕ) (hnn : n ≠ 0) : trunc R n 1 = 1 :=
74-
MvPolynomial.ext _ _ fun m => by
104+
MvPolynomial.ext _ _ fun m by
75105
classical
76106
rw [coeff_trunc, coeff_one]
77107
split_ifs with H H'
@@ -88,8 +118,8 @@ theorem trunc_one (n : σ →₀ ℕ) (hnn : n ≠ 0) : trunc R n 1 = 1 :=
88118
exact Ne.bot_lt hnn
89119

90120
@[simp]
91-
theorem trunc_c (n : σ →₀ ℕ) (hnn : n ≠ 0) (a : R) : trunc R n (C σ R a) = MvPolynomial.C a :=
92-
MvPolynomial.ext _ _ fun m => by
121+
theorem trunc_C (n : σ →₀ ℕ) (hnn : n ≠ 0) (a : R) : trunc R n (C σ R a) = MvPolynomial.C a :=
122+
MvPolynomial.ext _ _ fun m by
93123
classical
94124
rw [coeff_trunc, coeff_C, MvPolynomial.coeff_C]
95125
split_ifs with H <;> first |rfl|try simp_all only [ne_eq, not_true_eq_false]
@@ -105,7 +135,95 @@ theorem trunc_map [CommSemiring S] (n : σ →₀ ℕ) (f : R →+* S) (p : MvPo
105135
trunc S n (map σ f p) = MvPolynomial.map f (trunc R n p) := by
106136
ext m; simp [coeff_trunc, MvPolynomial.coeff_map, apply_ite f]
107137

108-
end Trunc
138+
end TruncLT
139+
140+
section TruncLE
141+
142+
variable [CommSemiring R] (n : σ →₀ ℕ)
143+
144+
/-- Auxiliary definition for the truncation function. -/
145+
def truncFun' (φ : MvPowerSeries σ R) : MvPolynomial σ R :=
146+
∑ m ∈ Finset.Iic n, MvPolynomial.monomial m (coeff R m φ)
147+
148+
/-- Coefficients of the truncated function. -/
149+
theorem coeff_truncFun' (m : σ →₀ ℕ) (φ : MvPowerSeries σ R) :
150+
(truncFun' n φ).coeff m = if m ≤ n then coeff R m φ else 0 := by
151+
classical
152+
simp [truncFun', MvPolynomial.coeff_sum]
153+
154+
variable (R)
155+
156+
/--
157+
The `n`th truncation of a multivariate formal power series to a multivariate polynomial.
158+
159+
If `f : MvPowerSeries σ R` and `n : σ →₀ ℕ` is a (finitely-supported) function from `σ`
160+
to the naturals, then `trunc' R n f` is the multivariable power series obtained from `f`
161+
by keeping only the monomials $c\prod_i X_i^{a_i}$ where `a i ≤ n i` for all `i`. -/
162+
def trunc' : MvPowerSeries σ R →+ MvPolynomial σ R where
163+
toFun := truncFun' n
164+
map_zero' := by
165+
ext
166+
simp only [coeff_truncFun', map_zero, ite_self, MvPolynomial.coeff_zero]
167+
map_add' x y := by
168+
ext m
169+
simp only [coeff_truncFun', MvPolynomial.coeff_add]
170+
rw [ite_add_ite, ← map_add, zero_add]
171+
172+
variable {R}
173+
174+
/-- Coefficients of the truncation of a multivariate power series. -/
175+
theorem coeff_trunc' (m : σ →₀ ℕ) (φ : MvPowerSeries σ R) :
176+
(trunc' R n φ).coeff m = if m ≤ n then coeff R m φ else 0 :=
177+
coeff_truncFun' n m φ
178+
179+
/-- Truncation of the multivariate power series `1` -/
180+
@[simp]
181+
theorem trunc'_one (n : σ →₀ ℕ) : trunc' R n 1 = 1 :=
182+
MvPolynomial.ext _ _ fun m ↦ by
183+
classical
184+
rw [coeff_trunc', coeff_one]
185+
split_ifs with H H'
186+
· subst m; simp only [MvPolynomial.coeff_zero_one]
187+
· rw [MvPolynomial.coeff_one, if_neg (Ne.symm H')]
188+
· rw [MvPolynomial.coeff_one, if_neg ?_]
189+
rintro rfl
190+
exact H (zero_le n)
191+
192+
@[simp]
193+
theorem trunc'_C (n : σ →₀ ℕ) (a : R) :
194+
trunc' R n (C σ R a) = MvPolynomial.C a :=
195+
MvPolynomial.ext _ _ fun m ↦ by
196+
classical
197+
rw [coeff_trunc', coeff_C, MvPolynomial.coeff_C]
198+
split_ifs with H <;> first |rfl|try simp_all
199+
exfalso; apply H; subst m; exact orderBot.proof_1 n
200+
201+
/-- Coefficients of the truncation of a product of two multivariate power series -/
202+
theorem coeff_mul_eq_coeff_trunc'_mul_trunc' (n : σ →₀ ℕ)
203+
(f g : MvPowerSeries σ R) {m : σ →₀ ℕ} (h : m ≤ n) :
204+
coeff R m (f * g) = ((trunc' R n f) * (trunc' R n g)).coeff m := by
205+
classical
206+
simp only [MvPowerSeries.coeff_mul, MvPolynomial.coeff_mul]
207+
apply Finset.sum_congr rfl
208+
rintro ⟨i, j⟩ hij
209+
simp only [mem_antidiagonal] at hij
210+
rw [← hij] at h
211+
simp only
212+
apply congr_arg₂
213+
· rw [coeff_trunc', if_pos (le_trans le_self_add h)]
214+
· rw [coeff_trunc', if_pos (le_trans le_add_self h)]
215+
216+
@[simp]
217+
theorem trunc'_C_mul (n : σ →₀ ℕ) (a : R) (p : MvPowerSeries σ R) :
218+
trunc' R n (C σ R a * p) = MvPolynomial.C a * trunc' R n p := by
219+
ext m; simp [coeff_trunc']
220+
221+
@[simp]
222+
theorem trunc'_map [CommSemiring S] (n : σ →₀ ℕ) (f : R →+* S) (p : MvPowerSeries σ R) :
223+
trunc' S n (map σ f p) = MvPolynomial.map f (trunc' R n p) := by
224+
ext m; simp [coeff_trunc', MvPolynomial.coeff_map, apply_ite f]
225+
226+
end TruncLE
109227

110228
end MvPowerSeries
111229

0 commit comments

Comments
 (0)