@@ -72,6 +72,8 @@ variables [comm_semiring α] {p q : mv_polynomial σ α}
72
72
73
73
section degrees
74
74
75
+ /-! ### `degrees` -/
76
+
75
77
/--
76
78
The maximal degrees of each variable in a multi-variable polynomial, expressed as a multiset.
77
79
@@ -204,6 +206,8 @@ end degrees
204
206
205
207
section vars
206
208
209
+ /-! ### `vars` -/
210
+
207
211
/-- `vars p` is the set of variables appearing in the polynomial `p` -/
208
212
def vars (p : mv_polynomial σ α) : finset σ := p.degrees.to_finset
209
213
@@ -219,6 +223,10 @@ by rw [vars, degrees_C, multiset.to_finset_zero]
219
223
@[simp] lemma vars_X (h : 0 ≠ (1 : α)) : (X n : mv_polynomial σ α).vars = {n} :=
220
224
by rw [X, vars_monomial h.symm, finsupp.support_single_ne_zero (one_ne_zero : 1 ≠ 0 )]
221
225
226
+ lemma mem_vars (i : σ) :
227
+ i ∈ p.vars ↔ ∃ (d : σ →₀ ℕ) (H : d ∈ p.support), i ∈ d.support :=
228
+ by simp only [vars, multiset.mem_to_finset, mem_degrees, coeff, finsupp.mem_support_iff, exists_prop]
229
+
222
230
lemma mem_support_not_mem_vars_zero {f : mv_polynomial σ α} {x : σ →₀ ℕ} (H : x ∈ f.support) {v : σ} (h : v ∉ vars f) :
223
231
x v = 0 :=
224
232
begin
@@ -251,6 +259,71 @@ begin
251
259
exact hx
252
260
end
253
261
262
+ section mul
263
+
264
+ lemma vars_mul (φ ψ : mv_polynomial σ α) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars :=
265
+ begin
266
+ intro i,
267
+ simp only [mem_vars, finset.mem_union],
268
+ rintro ⟨d, hd, hi⟩,
269
+ rw [finsupp.mem_support_iff, ← coeff, coeff_mul] at hd,
270
+ contrapose! hd, cases hd,
271
+ rw finset.sum_eq_zero,
272
+ rintro ⟨d₁, d₂⟩ H,
273
+ rw finsupp.mem_antidiagonal_support at H,
274
+ subst H,
275
+ obtain H|H : i ∈ d₁.support ∨ i ∈ d₂.support,
276
+ { simpa only [finset.mem_union] using finsupp.support_add hi, },
277
+ { suffices : coeff d₁ φ = 0 , by simp [this ],
278
+ rw [coeff, ← finsupp.not_mem_support_iff], intro, solve_by_elim, },
279
+ { suffices : coeff d₂ ψ = 0 , by simp [this ],
280
+ rw [coeff, ← finsupp.not_mem_support_iff], intro, solve_by_elim, },
281
+ end
282
+
283
+ @[simp] lemma vars_one : (1 : mv_polynomial σ α).vars = ∅ :=
284
+ vars_C
285
+
286
+ lemma vars_pow (φ : mv_polynomial σ α) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars :=
287
+ begin
288
+ induction n with n ih,
289
+ { simp },
290
+ { rw pow_succ,
291
+ apply finset.subset.trans (vars_mul _ _),
292
+ exact finset.union_subset (finset.subset.refl _) ih }
293
+ end
294
+
295
+ /--
296
+ The variables of the product of a family of polynomials
297
+ are a subset of the union of the sets of variables of each polynomial.
298
+ -/
299
+ lemma vars_prod {ι : Type *} {s : finset ι} (f : ι → mv_polynomial σ α) :
300
+ (∏ i in s, f i).vars ⊆ s.bind (λ i, (f i).vars) :=
301
+ begin
302
+ apply s.induction_on,
303
+ { simp },
304
+ { intros a s hs hsub,
305
+ simp only [hs, finset.bind_insert, finset.prod_insert, not_false_iff],
306
+ apply finset.subset.trans (vars_mul _ _),
307
+ exact finset.union_subset_union (finset.subset.refl _) hsub }
308
+ end
309
+
310
+ section integral_domain
311
+ variables {A : Type *} [integral_domain A]
312
+
313
+ lemma vars_C_mul (a : A) (ha : a ≠ 0 ) (φ : mv_polynomial σ A) : (C a * φ).vars = φ.vars :=
314
+ begin
315
+ ext1 i,
316
+ simp only [mem_vars, exists_prop, finsupp.mem_support_iff],
317
+ apply exists_congr,
318
+ intro d,
319
+ apply and_congr _ iff.rfl,
320
+ rw [← coeff, ← coeff, coeff_C_mul, mul_ne_zero_iff, eq_true_intro ha, true_and],
321
+ end
322
+
323
+ end integral_domain
324
+
325
+ end mul
326
+
254
327
section sum
255
328
256
329
variables {ι : Type *} (t : finset ι) (φ : ι → mv_polynomial σ α)
@@ -304,10 +377,6 @@ lemma vars_monomial_single (i : σ) {e : ℕ} {r : α} (he : e ≠ 0) (hr : r
304
377
(monomial (finsupp.single i e) r).vars = {i} :=
305
378
by rw [vars_monomial hr, finsupp.support_single_ne_zero he]
306
379
307
- lemma mem_vars (i : σ) :
308
- i ∈ p.vars ↔ ∃ (d : σ →₀ ℕ) (H : d ∈ p.support), i ∈ d.support :=
309
- by simp only [vars, multiset.mem_to_finset, mem_degrees, coeff, finsupp.mem_support_iff, exists_prop]
310
-
311
380
lemma vars_eq_support_bind_support : p.vars = p.support.bind finsupp.support :=
312
381
by { ext i, rw [mem_vars, finset.mem_bind] }
313
382
@@ -317,12 +386,17 @@ end vars
317
386
318
387
section degree_of
319
388
389
+ /-! ### `degree_of` -/
390
+
320
391
/-- `degree_of n p` gives the highest power of X_n that appears in `p` -/
321
392
def degree_of (n : σ) (p : mv_polynomial σ α) : ℕ := p.degrees.count n
322
393
323
394
end degree_of
324
395
325
396
section total_degree
397
+
398
+ /-! ### `total_degree` -/
399
+
326
400
/-- `total_degree p` gives the maximum |s| over the monomials X^s in `p` -/
327
401
def total_degree (p : mv_polynomial σ α) : ℕ := p.support.sup (λs, s.sum $ λn e, e)
328
402
@@ -451,6 +525,8 @@ end total_degree
451
525
452
526
section eval_vars
453
527
528
+ /-! ### `vars` and `eval` -/
529
+
454
530
variables {R : Type u} {A : Type v} {S : Type w} (f : σ → A)
455
531
variables [comm_semiring R] [comm_semiring A] [algebra R A] [comm_semiring S]
456
532
0 commit comments