Zulip Chat Archive

Stream: Is there code for X?

Topic: replacement of `finset.sum_hom`


Jon Eugster (Feb 13 2022 at 20:01):

import data.polynomial

variables {A K: Type*} [comm_ring A] [is_domain A] [field K] [algebra A K]

example (p:polynomial A) (y:K) (d: K):
  d * (p.support.sum (λ (n : ), (algebra_map A K) ((p.coeff n)) * y ^ n)) = (p.support.sum (λ (n : ), d * (algebra_map A K) ((p.coeff n)) * y ^ n)) :=
begin
  sorry
end
-- Old proof: (polynomial.support p).sum_hom(has_mul.mul d)

I did some calculations with polynomials about a year ago and I used finset.sum_hom. Now I updated mathlib and it is gone, could you help me finding what the replacement would be? Is there a neat way to search old versions of mathlib or would I have to dig manually into the git-tree?

Yaël Dillies (Feb 13 2022 at 20:04):

Is it docs#add_monoid_hom.map_sum by any chance?

Reid Barton (Feb 13 2022 at 20:15):

Have you tried library_search?

Jon Eugster (Feb 13 2022 at 20:36):

Yaël Dillies said:

Is it docs#add_monoid_hom.map_sum by any chance?

Yes, I think that's almost it, thanks! Now I just have some problems actually using it, hmm...

Yaël Dillies (Feb 13 2022 at 20:37):

This lemma is soon getting refactoring as part of the hom refactor. Maybe your problem is related?

Yaël Dillies (Feb 13 2022 at 20:38):

You'll need to use docs#add_monoid_hom.mul_left btw

Jon Eugster (Feb 13 2022 at 20:44):

import algebra.big_operators
import data.polynomial

variables {A K: Type*} [comm_ring A] [is_domain A] [field K] [algebra A K]

example (p:polynomial A) (y:K) (d: ):
  d * (p.support.sum (λ (n : ), y ^ n)) = (p.support.sum (λ (n : ), d * y ^ n)) :=
begin
  apply add_monoid_hom.map_sum (add_monoid_hom.mul_left (d:K)) (λ(n:), y ^ n) p.support,
end

Thank you Yaël, that worked!


Last updated: Dec 20 2023 at 11:08 UTC