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

Commit 6e4fe98

Browse files
riccardobrascaurkud
andcommitted
chore(data/polynomial/{degree/basic, eval}): Some trivial lemmas about polynomials (#4768)
I have added the lemma `supp_card_le_succ_nat_degree` about the cardinality of the support of a polynomial and removed the useless commutativity assumptio in `map_sum` and `map_neg`. Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
1 parent 4036212 commit 6e4fe98

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/data/polynomial/degree/basic.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,15 @@ lemma le_nat_degree_of_mem_supp (a : ℕ) :
317317
a ∈ p.support → a ≤ nat_degree p:=
318318
le_nat_degree_of_ne_zero ∘ mem_support_iff_coeff_ne_zero.mp
319319

320+
lemma supp_subset_range_nat_degree_succ : p.support ⊆ finset.range (nat_degree p + 1) :=
321+
λ n hn, mem_range.2 $ nat.lt_succ_of_le $ le_nat_degree_of_mem_supp _ hn
322+
323+
lemma card_supp_le_succ_nat_degree (p : polynomial R) : p.support.card ≤ p.nat_degree + 1 :=
324+
begin
325+
rw ← finset.card_range (p.nat_degree + 1),
326+
exact finset.card_le_of_subset supp_subset_range_nat_degree_succ,
327+
end
328+
320329
lemma le_degree_of_mem_supp (a : ℕ) :
321330
a ∈ p.support → ↑a ≤ degree p :=
322331
le_degree_of_ne_zero ∘ mem_support_iff_coeff_ne_zero.mp

src/data/polynomial/eval.lean

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,10 @@ end
440440
lemma eval_map (x : S) : (p.map f).eval x = p.eval₂ f x :=
441441
eval₂_map f (ring_hom.id _) x
442442

443+
lemma map_sum {ι : Type*} (g : ι → polynomial R) (s : finset ι) :
444+
(∑ i in s, g i).map f = ∑ i in s, (g i).map f :=
445+
eq.symm $ sum_hom _ _
446+
443447
end map
444448

445449
/-!
@@ -522,10 +526,6 @@ lemma map_prod {ι : Type*} (g : ι → polynomial R) (s : finset ι) :
522526
(∏ i in s, g i).map f = ∏ i in s, (g i).map f :=
523527
eq.symm $ prod_hom _ _
524528

525-
lemma map_sum {ι : Type*} (g : ι → polynomial R) (s : finset ι) :
526-
(∑ i in s, g i).map f = ∑ i in s, (g i).map f :=
527-
eq.symm $ sum_hom _ _
528-
529529
lemma support_map_subset (p : polynomial R) : (map f p).support ⊆ p.support :=
530530
begin
531531
intros x,
@@ -562,14 +562,18 @@ lemma C_sub : C (a - b) = C a - C b := ring_hom.map_sub C a b
562562
instance map.is_ring_hom {S} [ring S] (f : R →+* S) : is_ring_hom (map f) :=
563563
by apply is_ring_hom.of_semiring
564564

565-
@[simp] lemma map_sub {S} [comm_ring S] (f : R →+* S) :
565+
@[simp] lemma map_sub {S} [ring S] (f : R →+* S) :
566566
(p - q).map f = p.map f - q.map f :=
567567
is_ring_hom.map_sub _
568568

569-
@[simp] lemma map_neg {S} [comm_ring S] (f : R →+* S) :
569+
@[simp] lemma map_neg {S} [ring S] (f : R →+* S) :
570570
(-p).map f = -(p.map f) :=
571571
is_ring_hom.map_neg _
572572

573+
@[simp] lemma map_int_cast {S} [ring S] (f : R →+* S) (n : ℤ) :
574+
map f ↑n = ↑n :=
575+
(ring_hom.of (map f)).map_int_cast n
576+
573577
@[simp] lemma eval_int_cast {n : ℤ} {x : R} : (n : polynomial R).eval x = n :=
574578
by simp only [←C_eq_int_cast, eval_C]
575579

0 commit comments

Comments
 (0)