Zulip Chat Archive
Stream: Is there code for X?
Topic: tsum_const
Gareth Ma (Jul 27 2024 at 14:10):
Is there code for
import Mathlib
open scoped ENNReal
example {α : Type*} {s : Set α} [Countable s] (c : ℝ≥0∞) :
(∑' x : s, c) = s.encard.toENNReal • c := by
sorry
?
Yaël Dillies (Jul 27 2024 at 14:12):
Gareth Ma (Jul 27 2024 at 14:32):
no because ENNReal
is not a group (the c
)
Gareth Ma (Jul 27 2024 at 14:32):
And also in that setting the sum will be treated as 0 (since the Nat.card is 0). But maybe I can split cases on whether s
is finite or not... let me try
Yaël Dillies (Jul 27 2024 at 14:33):
Yaël Dillies (Jul 27 2024 at 14:33):
A bit weird that it invokes measure theory, but I'm sure you could extract your statement from the current proof
Gareth Ma (Jul 27 2024 at 14:34):
Looks like it, might need to figure out some details but yea, thanks :D
Yaël Dillies (Jul 27 2024 at 14:34):
Thank https://leanprover-community.github.io/mathlib4_docs, not me :smile:
Gareth Ma (Jul 27 2024 at 14:35):
Lol yeah I didn't look closely enough
Edward van de Meent (Jul 27 2024 at 14:43):
there is a version of this in the #Carleson project, i believe
Edward van de Meent (Jul 27 2024 at 14:44):
yup, check this file
Edward van de Meent (Jul 27 2024 at 14:44):
minus the countable assumption, that is
Gareth Ma (Jul 27 2024 at 14:44):
Amaazing, thanks! ENNReal.tsum_const_eq'
is what I need
Edward van de Meent (Jul 27 2024 at 14:45):
written by yours truly :heart:
Floris van Doorn (Jul 27 2024 at 14:47):
Please PR this to Mathlib! (either Edward or Gareth if Edward is fine with it)
Edward van de Meent (Jul 27 2024 at 14:57):
sure, i'll do it
Gareth Ma (Jul 27 2024 at 15:29):
Oops, I missed the message. PR'ing would be great, thanks a lot in advance.
Edward van de Meent (Jul 27 2024 at 15:57):
i can't seem to find a good file for this... Data.Set.card
(which contains Set.encard
) is hardly ever used, meaning that the home for these lemmas would be Mathlib
:face_with_peeking_eye: ... #min_imports
suggests three imports...
import Mathlib.Data.Real.ENatENNReal
import Mathlib.Data.Set.Card
import Mathlib.Topology.Instances.ENNReal
Damiano Testa (Jul 27 2024 at 15:59):
#min_imports
is a lower bound, #find_home!
are upper bounds: try with that and import Mathlib
.
Edward van de Meent (Jul 27 2024 at 15:59):
that's what i was doing already...
Gareth Ma (Jul 27 2024 at 15:59):
Data.Set.card
(which containsSet.encard
) is hardly ever used
:(
Edward van de Meent (Jul 27 2024 at 15:59):
when i try #find_home!
while importing Mathlib
it suggests Mathlib
Damiano Testa (Jul 27 2024 at 16:00):
Ok, I misunderstood your previous comment, sorry.
Damiano Testa (Jul 27 2024 at 16:01):
In fact, Mathlib.Data.Real.ENatENNReal
is also not imported anywhere, other than Mathlib
.
Edward van de Meent (Jul 27 2024 at 16:01):
ah, so it is...
Damiano Testa (Jul 27 2024 at 16:03):
So it looks like either a new file, or adding an import. I think that the latter would require a little bit of explaining why adding an import is preferred to a new file.
Edward van de Meent (Jul 27 2024 at 16:06):
i suppose the real question would be if this lemma is even wanted in mathlib then, seeing as its requirements are scarcely or not used
Gareth Ma (Jul 27 2024 at 16:07):
Yes I think it should be. If this basic lemma are not added, no one will work on using these "scarcely used requirements"
Edward van de Meent (Jul 27 2024 at 16:08):
i mean that it is thinkable that these requirements are scarcely used because they are part of a pattern that is concidered bad
Damiano Testa (Jul 27 2024 at 16:09):
New files with new lemmas are constantly added: the review process is a good place to see if the new lemmas are wanted. Besides, Floris already supported the lemma -- that is a big vote of confidence!
Edward van de Meent (Jul 27 2024 at 16:11):
very well. then remains the question of where to put this new file...
Edward van de Meent (Jul 27 2024 at 16:12):
somewhere in the Mathlib.Topology.Algebra.InfiniteSum
folder i think?
Edward van de Meent (Jul 27 2024 at 16:12):
although i'm not sure that this is algebra...
Edward van de Meent (Jul 27 2024 at 16:14):
i'll make the file Mathlib.Topology.Algebra.InfiniteSum.ENNReal
Edward van de Meent (Jul 27 2024 at 20:48):
ok, it's at #15214
Yury G. Kudryashov (Jul 28 2024 at 03:08):
Yaël Dillies said:
A bit weird that it invokes measure theory, but I'm sure you could extract your statement from the current proof
At the time it was added, we didn't have ENat
s (more precisely, PartENat
s were called enat
and we didn't have much theory about this type).
Yury G. Kudryashov (Jul 28 2024 at 03:09):
Currently, facts about tsum
and ENNReal
s are in Topology/Instances/ENNReal
. It would be nice to move them to a new file (and drop this dependency in Topology/Instances/ENNReal
).
Yury G. Kudryashov (Jul 28 2024 at 03:09):
But this should be a separate "move only" PR, not the same PR that adds new lemma(s).
Edward van de Meent (Jul 28 2024 at 09:10):
with regards to the current docs#ENNReal.tsum_const_eq , i think that maybe it is better replaced with a lemma saying that for [MeasurableSingletonClass α], casting Set.encard
is the same as Measure.count
or something along those lines...
Edward van de Meent (Jul 28 2024 at 09:10):
assuming that #15214 gets merged, that is
Edward van de Meent (Aug 09 2024 at 14:31):
PR is sent off to bors, for those interested :tada:
Last updated: May 02 2025 at 03:31 UTC