Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 2c4300b

Browse files
feat(data/polynomial): adds map_comp (#3736)
Adds lemma saying that the map of the composition of two polynomials is the composition of the maps, as mentioned [here](https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/Polynomial.20composition.20and.20map.20commute). Co-authored-by: Thomas Browning tb65536@uw.edu Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
1 parent ac2f011 commit 2c4300b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/algebra/big_operators/basic.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,14 @@ begin
549549
exact ⟨x, (mem_filter.1 hx).1, (mem_filter.1 hx).2
550550
end
551551

552+
@[to_additive]
553+
lemma prod_subset_one_on_sdiff [decidable_eq α] (h : s₁ ⊆ s₂) (hg : ∀ x ∈ (s₂ \ s₁), g x = 1)
554+
(hfg : ∀ x ∈ s₁, f x = g x) : ∏ i in s₁, f i = ∏ i in s₂, g i :=
555+
begin
556+
rw [← prod_sdiff h, prod_eq_one hg, one_mul],
557+
exact prod_congr rfl hfg
558+
end
559+
552560
lemma sum_range_succ {β} [add_comm_monoid β] (f : ℕ → β) (n : ℕ) :
553561
(∑ x in range (n + 1), f x) = f n + (∑ x in range n, f x) :=
554562
by rw [range_succ, sum_insert not_mem_range_self]

src/data/polynomial/eval.lean

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,28 @@ lemma map_prod {ι : Type*} (g : ι → polynomial R) (s : finset ι) :
447447
(∏ i in s, g i).map f = ∏ i in s, (g i).map f :=
448448
eq.symm $ prod_hom _ _
449449

450+
lemma map_sum {ι : Type*} (g : ι → polynomial R) (s : finset ι) :
451+
(∑ i in s, g i).map f = ∑ i in s, (g i).map f :=
452+
eq.symm $ sum_hom _ _
453+
454+
lemma support_map_subset (p : polynomial R) : (map f p).support ⊆ p.support :=
455+
begin
456+
intros x,
457+
simp only [mem_support_iff],
458+
contrapose!,
459+
change p.coeff x = 0 → (map f p).coeff x = 0,
460+
rw coeff_map,
461+
intro hx,
462+
rw hx,
463+
exact ring_hom.map_zero f,
464+
end
465+
466+
lemma map_comp (p q : polynomial R) : map f (p.comp q) = (map f p).comp (map f q) :=
467+
polynomial.induction_on p
468+
(by simp)
469+
(by simp {contextual := tt})
470+
(by simp [pow_succ', ← mul_assoc, polynomial.comp] {contextual := tt})
471+
450472
end map
451473

452474
end comm_semiring

0 commit comments

Comments
 (0)