@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Johannes Hölzl, Johan Commelin, Mario Carneiro
5
5
-/
6
6
7
- import data.mv_polynomial.basic
7
+ import data.mv_polynomial.monad
8
8
import data.set.disjointed
9
9
10
10
/-!
@@ -38,14 +38,14 @@ monomial of $P$.
38
38
39
39
As in other polynomial files, we typically use the notation:
40
40
41
- + `σ : Type*` (indexing the variables)
41
+ + `σ τ : Type*` (indexing the variables)
42
42
43
43
+ `R : Type*` `[comm_semiring R]` (the coefficients)
44
44
45
45
+ `s : σ →₀ ℕ`, a function from `σ` to `ℕ` which is zero away from a finite set.
46
46
This will give rise to a monomial in `mv_polynomial σ R` which mathematicians might call `X^s`
47
47
48
- + `a : R`
48
+ + `r : R`
49
49
50
50
+ `i : σ`, with corresponding monomial `X i`, often denoted `X_i` by mathematicians
51
51
@@ -64,7 +64,7 @@ universes u v w
64
64
variables {R : Type u} {S : Type v}
65
65
66
66
namespace mv_polynomial
67
- variables {σ : Type *} {a a' a₁ a₂ : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
67
+ variables {σ τ : Type *} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
68
68
69
69
section comm_semiring
70
70
variables [comm_semiring R] {p q : mv_polynomial σ R}
@@ -198,6 +198,23 @@ begin
198
198
apply mv_polynomial.support_map_subset
199
199
end
200
200
201
+ lemma degrees_rename (f : σ → τ) (φ : mv_polynomial σ R) :
202
+ (rename f φ).degrees ⊆ (φ.degrees.map f) :=
203
+ begin
204
+ intros i,
205
+ rw [mem_degrees, multiset.mem_map],
206
+ rintro ⟨d, hd, hi⟩,
207
+ obtain ⟨x, rfl, hx⟩ := coeff_rename_ne_zero _ _ _ hd,
208
+ simp only [map_domain, mem_support_iff] at hi,
209
+ rw [sum_apply, finsupp.sum] at hi,
210
+ contrapose! hi,
211
+ rw [finset.sum_eq_zero],
212
+ intros j hj,
213
+ simp only [exists_prop, mem_degrees] at hi,
214
+ specialize hi j ⟨x, hx, hj⟩,
215
+ rw [single_apply, if_neg hi],
216
+ end
217
+
201
218
lemma degrees_map_of_injective [comm_semiring S] (p : mv_polynomial σ R)
202
219
{f : R →+* S} (hf : injective f) : (map f p).degrees = p.degrees :=
203
220
by simp only [degrees, mv_polynomial.support_map_of_injective _ hf]
@@ -214,10 +231,10 @@ def vars (p : mv_polynomial σ R) : finset σ := p.degrees.to_finset
214
231
@[simp] lemma vars_0 : (0 : mv_polynomial σ R).vars = ∅ :=
215
232
by rw [vars, degrees_zero, multiset.to_finset_zero]
216
233
217
- @[simp] lemma vars_monomial (h : a ≠ 0 ) : (monomial s a ).vars = s.support :=
234
+ @[simp] lemma vars_monomial (h : r ≠ 0 ) : (monomial s r ).vars = s.support :=
218
235
by rw [vars, degrees_monomial_eq _ _ h, finsupp.to_finset_to_multiset]
219
236
220
- @[simp] lemma vars_C : (C a : mv_polynomial σ R).vars = ∅ :=
237
+ @[simp] lemma vars_C : (C r : mv_polynomial σ R).vars = ∅ :=
221
238
by rw [vars, degrees_C, multiset.to_finset_zero]
222
239
223
240
@[simp] lemma vars_X (h : 0 ≠ (1 : R)) : (X n : mv_polynomial σ R).vars = {n} :=
@@ -521,16 +538,30 @@ begin
521
538
{ exact lt_of_le_of_lt (nat.zero_le _) h, }
522
539
end
523
540
541
+ lemma total_degree_rename_le (f : σ → τ) (p : mv_polynomial σ R) :
542
+ (rename f p).total_degree ≤ p.total_degree :=
543
+ finset.sup_le $ assume b,
544
+ begin
545
+ assume h,
546
+ rw rename_eq at h,
547
+ have h' := finsupp.map_domain_support h,
548
+ rw finset.mem_image at h',
549
+ rcases h' with ⟨s, hs, rfl⟩,
550
+ rw finsupp.sum_map_domain_index,
551
+ exact le_trans (le_refl _) (finset.le_sup hs),
552
+ exact assume _, rfl,
553
+ exact assume _ _ _, rfl
554
+ end
555
+
524
556
end total_degree
525
557
526
558
section eval_vars
527
559
528
560
/-! ### `vars` and `eval` -/
529
561
530
- variables {S₁ : Type v} {S₂ : Type w} (f : σ → S₁)
531
- variables [comm_semiring S₁] [algebra R S₁] [comm_semiring S₂]
562
+ variables [comm_semiring S]
532
563
533
- lemma eval₂_hom_eq_constant_coeff_of_vars (f : R →+* S₂ ) {g : σ → S₂ }
564
+ lemma eval₂_hom_eq_constant_coeff_of_vars (f : R →+* S) {g : σ → S}
534
565
{p : mv_polynomial σ R} (hp : ∀ i ∈ p.vars, g i = 0 ) :
535
566
eval₂_hom f g p = f (constant_coeff p) :=
536
567
begin
@@ -558,11 +589,65 @@ begin
558
589
intro, contradiction }
559
590
end
560
591
561
- lemma aeval_eq_constant_coeff_of_vars [algebra R S₂ ] {g : σ → S₂ }
592
+ lemma aeval_eq_constant_coeff_of_vars [algebra R S] {g : σ → S}
562
593
{p : mv_polynomial σ R} (hp : ∀ i ∈ p.vars, g i = 0 ) :
563
594
aeval g p = algebra_map _ _ (constant_coeff p) :=
564
595
eval₂_hom_eq_constant_coeff_of_vars _ hp
565
596
597
+ lemma eval₂_hom_congr' {f₁ f₂ : R →+* S} {g₁ g₂ : σ → S} {p₁ p₂ : mv_polynomial σ R} :
598
+ f₁ = f₂ → (∀ i, i ∈ p₁.vars → i ∈ p₂.vars → g₁ i = g₂ i) → p₁ = p₂ →
599
+ eval₂_hom f₁ g₁ p₁ = eval₂_hom f₂ g₂ p₂ :=
600
+ begin
601
+ rintro rfl h rfl,
602
+ rename [p₁ p, f₁ f],
603
+ rw p.as_sum,
604
+ simp only [ring_hom.map_sum, eval₂_hom_monomial],
605
+ apply finset.sum_congr rfl,
606
+ intros d hd,
607
+ congr' 1 ,
608
+ simp only [finsupp.prod],
609
+ apply finset.prod_congr rfl,
610
+ intros i hi,
611
+ have : i ∈ p.vars, { rw mem_vars, exact ⟨d, hd, hi⟩ },
612
+ rw h i this this ,
613
+ end
614
+
615
+ lemma vars_bind₁ (f : σ → mv_polynomial τ R) (φ : mv_polynomial σ R) :
616
+ (bind₁ f φ).vars ⊆ φ.vars.bind (λ i, (f i).vars) :=
617
+ begin
618
+ calc (bind₁ f φ).vars
619
+ = (φ.support.sum (λ (x : σ →₀ ℕ), (bind₁ f) (monomial x (coeff x φ)))).vars :
620
+ by { rw [← alg_hom.map_sum, ← φ.as_sum], }
621
+ ... ≤ φ.support.bind (λ (i : σ →₀ ℕ), ((bind₁ f) (monomial i (coeff i φ))).vars) : vars_sum_subset _ _
622
+ ... = φ.support.bind (λ (d : σ →₀ ℕ), (C (coeff d φ) * ∏ i in d.support, f i ^ d i).vars) :
623
+ by simp only [bind₁_monomial]
624
+ ... ≤ φ.support.bind (λ (d : σ →₀ ℕ), d.support.bind (λ i, (f i).vars)) : _ -- proof below
625
+ ... ≤ φ.vars.bind (λ (i : σ), (f i).vars) : _, -- proof below
626
+ { apply finset.bind_mono,
627
+ intros d hd,
628
+ calc (C (coeff d φ) * ∏ (i : σ) in d.support, f i ^ d i).vars
629
+ ≤ (C (coeff d φ)).vars ∪ (∏ (i : σ) in d.support, f i ^ d i).vars : vars_mul _ _
630
+ ... ≤ (∏ (i : σ) in d.support, f i ^ d i).vars :
631
+ by simp only [finset.empty_union, vars_C, finset.le_iff_subset, finset.subset.refl]
632
+ ... ≤ d.support.bind (λ (i : σ), (f i ^ d i).vars) : vars_prod _
633
+ ... ≤ d.support.bind (λ (i : σ), (f i).vars) : _,
634
+ apply finset.bind_mono,
635
+ intros i hi,
636
+ apply vars_pow, },
637
+ { intro j,
638
+ simp_rw finset.mem_bind,
639
+ rintro ⟨d, hd, ⟨i, hi, hj⟩⟩,
640
+ exact ⟨i, (mem_vars _).mpr ⟨d, hd, hi⟩, hj⟩ }
641
+ end
642
+
643
+ lemma vars_rename (f : σ → τ) (φ : mv_polynomial σ R) :
644
+ (rename f φ).vars ⊆ (φ.vars.image f) :=
645
+ begin
646
+ intros i hi,
647
+ simp only [vars, exists_prop, multiset.mem_to_finset, finset.mem_image] at hi ⊢,
648
+ simpa only [multiset.mem_map] using degrees_rename _ _ hi
649
+ end
650
+
566
651
end eval_vars
567
652
568
653
end comm_semiring
0 commit comments