Zulip Chat Archive

Stream: maths

Topic: Currying in tsum_prod definition


Devon Tuma (Jan 10 2023 at 15:54):

The current statement of ennreal.tsum_prod differs from the more general tsum_prod' lemma in that it doesn't curry the arguments to the sum function. This means it doesn't work in situations like this:

open_locale ennreal
-- Current version
lemma ennreal.tsum_prod₁ {α β : Type*} {f : α  β  0} :
  ∑' p : α × β, f p.1 p.2 = ∑' a b, f a b :=
tsum_prod' ennreal.summable $ λ _, ennreal.summable

lemma ennreal.tsum_prod₂ {α β : Type*} {f : α × β  0} :
  ∑' p : α × β, f p = ∑' a b, f (a, b) :=
tsum_prod' ennreal.summable $ λ _, ennreal.summable

example {α β γ : Type} (f : α  β) (g : β × γ  0) :
  ∑' x, g (prod.map f id x) = ∑' y z, g (f y, z) :=
by simp_rw [ennreal.tsum_prod₂, prod_map, id.def]

Is there any reason not to change this to use the second definition?

Floris van Doorn (Jan 10 2023 at 16:01):

The second version is also good to have. For sigma we have both: docs#ennreal.tsum_sigma docs#ennreal.tsum_sigma'
The first version is sometimes useful if you're picky about the exact form of the right-hand side, so it's better to just have both versions.

Devon Tuma (Jan 10 2023 at 16:07):

Sure, that makes sense. I'll open a PR to add the other version alongside it then

Eric Wieser (Jan 10 2023 at 16:13):

The first one is best for backwards rewrites, the second is best for forwards rewrites

Eric Wieser (Jan 10 2023 at 16:14):

A bit like docs#prod.exists vs docs#prod.exists'


Last updated: Dec 20 2023 at 11:08 UTC