@@ -12,13 +12,41 @@ import Mathlib.Algebra.MvPolynomial.Eval
12
12
13
13
# Formal (multivariate) power series - Truncation
14
14
15
- `MvPowerSeries.trunc n φ` truncates a formal multivariate power series
15
+ * `MvPowerSeries.trunc n φ` truncates a formal multivariate power series
16
16
to the multivariate polynomial that has the same coefficients as `φ`,
17
17
for all `m < n`, and `0` otherwise.
18
18
19
19
Note that here, `m` and `n` have types `σ →₀ ℕ`,
20
20
so that `m < n` means that `m ≠ n` and `m s ≤ n s` for all `s : σ`.
21
21
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
+
22
50
-/
23
51
24
52
@@ -32,7 +60,7 @@ open Finsupp
32
60
33
61
variable {σ R S : Type *}
34
62
35
- section Trunc
63
+ section TruncLT
36
64
37
65
variable [CommSemiring R] (n : σ →₀ ℕ)
38
66
@@ -47,7 +75,12 @@ theorem coeff_truncFun (m : σ →₀ ℕ) (φ : MvPowerSeries σ R) :
47
75
48
76
variable (R)
49
77
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`. -/
51
84
def trunc : MvPowerSeries σ R →+ MvPolynomial σ R where
52
85
toFun := truncFun n
53
86
map_zero' := by
@@ -58,10 +91,7 @@ def trunc : MvPowerSeries σ R →+ MvPolynomial σ R where
58
91
classical
59
92
intros x y
60
93
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]
65
95
66
96
variable {R}
67
97
@@ -71,7 +101,7 @@ theorem coeff_trunc (m : σ →₀ ℕ) (φ : MvPowerSeries σ R) :
71
101
72
102
@[simp]
73
103
theorem trunc_one (n : σ →₀ ℕ) (hnn : n ≠ 0 ) : trunc R n 1 = 1 :=
74
- MvPolynomial.ext _ _ fun m => by
104
+ MvPolynomial.ext _ _ fun m ↦ by
75
105
classical
76
106
rw [coeff_trunc, coeff_one]
77
107
split_ifs with H H'
@@ -88,8 +118,8 @@ theorem trunc_one (n : σ →₀ ℕ) (hnn : n ≠ 0) : trunc R n 1 = 1 :=
88
118
exact Ne.bot_lt hnn
89
119
90
120
@[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
93
123
classical
94
124
rw [coeff_trunc, coeff_C, MvPolynomial.coeff_C]
95
125
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
105
135
trunc S n (map σ f p) = MvPolynomial.map f (trunc R n p) := by
106
136
ext m; simp [coeff_trunc, MvPolynomial.coeff_map, apply_ite f]
107
137
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
109
227
110
228
end MvPowerSeries
111
229
0 commit comments