Zulip Chat Archive

Stream: Is there code for X?

Topic: coercion over Finset summing?


Alex Kontorovich (Apr 15 2024 at 19:42):

Is there a way to easily convert between summing over and over ? E.g.:

import Mathlib

open BigOperators

lemma Finset_coe_Nat_Int (f :   ) (m n : ) :
    ( x in Finset.Ioc m n, f x) =  x in Finset.Ioc (m : ) n, f x := by
  sorry

Thanks!

Daniel Weber (Apr 15 2024 at 19:45):

You should be able to use docs#Finset.sum_nbij' (or perhaps docs#Finset.sum_nbij would be easier) fairly easily, I'm not sure if there's an easier way

Yaël Dillies (Apr 15 2024 at 19:55):

No, don't use sum_bij (or friends) here! That's overkill

Yaël Dillies (Apr 15 2024 at 19:56):

What you usually want to use in such a situation is docs#Finset.sum_map

Yaël Dillies (Apr 15 2024 at 19:56):

For this, you will need a version of docs#Nat.image_cast_int_Ioc stated using docs#Finset.map. That should be very easy to do

Alex Kontorovich (Apr 15 2024 at 19:57):

Oh. I already did it...

Yaël Dillies (Apr 15 2024 at 19:58):

Well, at least you now know what the mathlib PR should look like :smile:


Last updated: May 02 2025 at 03:31 UTC