Skip to content

Commit 65a039a

Browse files
committed
feat(MvPolynomial/Expand): more lemmas (#28833)
1 parent bd73402 commit 65a039a

File tree

2 files changed

+92
-20
lines changed

2 files changed

+92
-20
lines changed

Mathlib/Algebra/MvPolynomial/Eval.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,15 @@ theorem aeval_eq_eval₂Hom (p : MvPolynomial σ R) : aeval f p = eval₂Hom (al
558558
rfl
559559

560560
@[simp]
561-
lemma coe_aeval_eq_eval : RingHomClass.toRingHom (MvPolynomial.aeval f) = MvPolynomial.eval f :=
561+
lemma coe_aeval_eq_eval :
562+
RingHomClass.toRingHom (aeval f : MvPolynomial σ S₁ →ₐ[S₁] S₁) = eval f :=
562563
rfl
563564

564565
@[simp]
565-
theorem aeval_X (s : σ) : aeval f (X s : MvPolynomial _ R) = f s :=
566+
lemma aeval_eq_eval : (aeval f : MvPolynomial σ S₁ → S₁) = eval f := rfl
567+
568+
@[simp]
569+
theorem aeval_X (s : σ) : aeval f (X s : MvPolynomial σ R) = f s :=
566570
eval₂_X _ _ _
567571

568572
theorem aeval_C (r : R) : aeval f (C r) = algebraMap R S₁ r :=

Mathlib/Algebra/MvPolynomial/Expand.lean

Lines changed: 86 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ variable {σ τ R S : Type*} [CommSemiring R] [CommSemiring S]
2626
2727
See also `Polynomial.expand`. -/
2828
noncomputable def expand (p : ℕ) : MvPolynomial σ R →ₐ[R] MvPolynomial σ R :=
29-
{ (eval₂Hom C fun i ↦ X i ^ p : MvPolynomial σ R →+* MvPolynomial σ R) with
30-
commutes' := fun _ ↦ eval₂Hom_C _ _ _ }
29+
bind₁ fun i ↦ X i ^ p
3130

3231
theorem expand_C (p : ℕ) (r : R) : expand p (C r : MvPolynomial σ R) = C r :=
3332
eval₂Hom_C _ _ _
@@ -38,22 +37,31 @@ theorem expand_X (p : ℕ) (i : σ) : expand p (X i : MvPolynomial σ R) = X i ^
3837

3938
@[simp]
4039
theorem expand_monomial (p : ℕ) (d : σ →₀ ℕ) (r : R) :
41-
expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i :=
42-
bind₁_monomial _ _ _
40+
expand p (monomial d r) = monomial (p • d) r := by
41+
rw [expand, bind₁_monomial, monomial_eq, Finsupp.prod_of_support_subset _ Finsupp.support_smul]
42+
· simp [pow_mul]
43+
· simp
4344

44-
theorem expand_one_apply (f : MvPolynomial σ R) : expand 1 f = f := by
45-
simp only [expand, pow_one, eval₂Hom_eq_bind₂, bind₂_C_left, AlgHom.coe_mk, RingHom.id_apply]
45+
@[simp]
46+
lemma expand_zero :
47+
expand 0 (σ := σ) (R := R) = .comp (Algebra.ofId R _) (MvPolynomial.aeval (1 : σ → R)) := by
48+
ext1 i
49+
simp
50+
51+
lemma expand_zero_apply (p : MvPolynomial σ R) : expand 0 p = .C (MvPolynomial.eval 1 p) := by
52+
simp
4653

4754
@[simp]
4855
theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial σ R) := by
49-
ext1 f
50-
rw [expand_one_apply, AlgHom.id_apply]
56+
ext1 i
57+
simp
58+
59+
theorem expand_one_apply (f : MvPolynomial σ R) : expand 1 f = f := by simp
5160

5261
theorem expand_comp_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) :
5362
(expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by
54-
apply algHom_ext
55-
intro i
56-
simp only [AlgHom.comp_apply, bind₁_X_right]
63+
ext1 i
64+
simp
5765

5866
theorem expand_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) (φ : MvPolynomial σ R) :
5967
expand p (bind₁ f φ) = bind₁ (fun i ↦ expand p (f i)) φ := by
@@ -63,16 +71,76 @@ theorem expand_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) (φ : MvPolynomi
6371
theorem map_expand (f : R →+* S) (p : ℕ) (φ : MvPolynomial σ R) :
6472
map f (expand p φ) = expand p (map f φ) := by simp [expand, map_bind₁]
6573

66-
@[simp]
67-
theorem rename_expand (f : σ → τ) (p : ℕ) (φ : MvPolynomial σ R) :
68-
rename f (expand p φ) = expand p (rename f φ) := by
69-
simp [expand, bind₁_rename, rename_bind₁, Function.comp_def]
70-
7174
@[simp]
7275
theorem rename_comp_expand (f : σ → τ) (p : ℕ) :
7376
(rename f).comp (expand p) =
7477
(expand p).comp (rename f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) := by
75-
ext1 φ
76-
simp only [rename_expand, AlgHom.comp_apply]
78+
ext1 i
79+
simp
80+
81+
@[simp]
82+
theorem rename_expand (f : σ → τ) (p : ℕ) (φ : MvPolynomial σ R) :
83+
rename f (expand p φ) = expand p (rename f φ) :=
84+
DFunLike.congr_fun (rename_comp_expand f p) φ
85+
86+
lemma eval₂Hom_comp_expand (f : R →+* S) (g : σ → S) (p : ℕ) :
87+
(eval₂Hom f g).comp (expand p (σ := σ) (R := R) : MvPolynomial σ R →+* MvPolynomial σ R) =
88+
eval₂Hom f (g ^ p) := by
89+
ext <;> simp
90+
91+
@[simp]
92+
lemma eval₂_expand (f : R →+* S) (g : σ → S) (φ : MvPolynomial σ R) (p : ℕ) :
93+
eval₂ f g (expand p φ) = eval₂ f (g ^ p) φ :=
94+
DFunLike.congr_fun (eval₂Hom_comp_expand f g p) φ
95+
96+
@[simp]
97+
lemma aeval_comp_expand {A : Type*} [CommSemiring A] [Algebra R A] (f : σ → A) (p : ℕ) :
98+
(aeval f).comp (expand p) = aeval (R := R) (f ^ p) := by
99+
ext; simp
100+
101+
@[simp]
102+
lemma aeval_expand {A : Type*} [CommSemiring A] [Algebra R A]
103+
(f : σ → A) (φ : MvPolynomial σ R) (p : ℕ) :
104+
aeval f (expand p φ) = aeval (f ^ p) φ :=
105+
eval₂_expand ..
106+
107+
@[simp]
108+
lemma eval_expand (f : σ → R) (φ : MvPolynomial σ R) (p : ℕ) :
109+
eval f (expand p φ) = eval (f ^ p) φ :=
110+
eval₂_expand ..
111+
112+
theorem expand_mul_eq_comp (p q : ℕ) :
113+
expand (σ := σ) (R := R) (p * q) = (expand p).comp (expand q) := by
114+
ext1 i
115+
simp [pow_mul]
116+
117+
theorem expand_mul (p q : ℕ) (φ : MvPolynomial σ R) : φ.expand (p * q) = (φ.expand q).expand p :=
118+
DFunLike.congr_fun (expand_mul_eq_comp p q) φ
119+
120+
@[simp]
121+
lemma coeff_expand_smul (φ : MvPolynomial σ R) {p : ℕ} (hp : p ≠ 0) (m : σ →₀ ℕ) :
122+
(expand p φ).coeff (p • m) = φ.coeff m := by
123+
classical
124+
induction φ using induction_on' <;> simp [*, nsmul_right_inj hp]
125+
126+
lemma support_expand_subset [DecidableEq σ] (φ : MvPolynomial σ R) (p : ℕ) :
127+
(expand p φ).support ⊆ φ.support.image (p • ·) := by
128+
conv_lhs => rw [φ.as_sum]
129+
simp only [map_sum, expand_monomial]
130+
refine MvPolynomial.support_sum.trans ?_
131+
aesop (add simp Finset.subset_iff)
132+
133+
lemma coeff_expand_of_not_dvd (φ : MvPolynomial σ R) {p : ℕ} {m : σ →₀ ℕ} {i : σ} (h : ¬(p ∣ m i)) :
134+
(expand p φ).coeff m = 0 := by
135+
classical
136+
contrapose! h
137+
grw [← mem_support_iff, support_expand_subset, Finset.mem_image] at h
138+
rcases h with ⟨a, -, rfl⟩
139+
exact ⟨a i, by simp⟩
140+
141+
lemma support_expand [DecidableEq σ] (φ : MvPolynomial σ R) {p : ℕ} (hp : p ≠ 0) :
142+
(expand p φ).support = φ.support.image (p • ·) := by
143+
refine (support_expand_subset φ p).antisymm ?_
144+
simp [Finset.image_subset_iff, hp]
77145

78146
end MvPolynomial

0 commit comments

Comments
 (0)