Zulip Chat Archive

Stream: Is there code for X?

Topic: Tannery's theorem


Oskar Goldhahn (Nov 20 2023 at 15:56):

Is there code for Tannery's theorem or something like it?

I'm indexing over an arbitrary type in the sum and taking the limit in the extended positive reals.

Oskar Goldhahn (Nov 20 2023 at 16:24):

I'm working in Lean4

Riccardo Brasca (Nov 20 2023 at 16:25):

If you are referring to this, we have docs#MeasureTheory.tendsto_integral_of_dominated_convergence that is a generalization

Oskar Goldhahn (Nov 20 2023 at 21:19):

I saw that, but I'm struggling to get it in the form I need.

Oskar Goldhahn (Nov 20 2023 at 21:25):

The amount of measure theory I have to wade through here makes it challenging

David Loeffler (Nov 21 2023 at 15:36):

Something like this, maybe?

import Mathlib

open Filter Topology MeasureTheory

/-- Auxiliary lemma to translate integrability statements into summability -/
lemma integrable_count_iff {๐“š G : Type*} [Countable ๐“š] [NormedAddCommGroup G] [NormedSpace โ„ G]
    [CompleteSpace G] [SecondCountableTopology G] {f : ๐“š โ†’ G} :
    Integrable f (@Measure.count _ โŠค) โ†” Summable (fun k โ†ฆ โ€–f kโ€–) := by
  letI : MeasurableSpace G := borel G
  haveI : BorelSpace G := โŸจrflโŸฉ
  letI : MeasurableSpace ๐“š := โŠค
  simp_rw [Integrable, eq_true_intro (MeasurableSpace.Top.measurable f).aestronglyMeasurable,
    true_and, HasFiniteIntegral, lintegral_count, lt_top_iff_ne_top,
    ENNReal.tsum_coe_ne_top_iff_summable, โ† NNReal.summable_coe, coe_nnnorm]

/-- **Tannery's theorem**: countable sums commutes with limits when the norm of the summand is uniformly
bounded by a summable function.

(This is the special case of the Lebesgue dominated convergence
theorem for the counting measure on a discrete countable set.) -/
lemma tendsto_tsum_of_dominated {๐“š G : Type*} [Countable ๐“š]
   [NormedAddCommGroup G] [NormedSpace โ„ G] [CompleteSpace G] [SecondCountableTopology G]
    {a : ๐“š โ†’ โ„• โ†’ G} {b : ๐“š โ†’ G} {bound : ๐“š โ†’ โ„} (h_sum : Summable bound)
    (hab : โˆ€ k, Tendsto (a k) atTop (๐“ (b k))) (h_bound : โˆ€ k n, โ€–a k nโ€– โ‰ค bound k) :
    Tendsto (fun n โ†ฆ โˆ‘' k, a k n : โ„• โ†’ G) atTop (๐“ (tsum b)) := by
  -- choose measure space structures
  letI : MeasurableSpace G := borel G
  haveI : BorelSpace G := โŸจrflโŸฉ
  letI : MeasurableSpace ๐“š := โŠค
  letI : MeasureSpace ๐“š := โŸจMeasure.countโŸฉ
  -- set up hypotheses for dominated convergence
  have bound_int : Integrable bound
  ยท simpa only [integrable_count_iff] using h_sum.norm
  have b_int : Summable (fun k โ†ฆ โ€–b kโ€–)
  ยท refine h_sum.of_norm_bounded _ (fun k โ†ฆ ?_)
    simp_rw [norm_norm]
    exact le_of_tendsto ((continuous_norm.tendsto _).comp (hab k))
      (eventually_of_forall (h_bound k))
  -- apply dominated convergence
  have DC := tendsto_integral_of_dominated_convergence _
    (fun _ โ†ฆ (MeasurableSpace.Top.measurable _).aestronglyMeasurable)
    bound_int
    (fun n โ†ฆ eventually_of_forall (Function.swap h_bound n))
    (eventually_of_forall hab)
  -- massage integrals back to sums in the result
  simp_rw [integral_countable' (integrable_count_iff.mpr b_int),
    Measure.count_singleton, ENNReal.one_toReal, one_smul] at DC
  convert DC using 2 with n
  rw [integral_countable']
  ยท simp [Measure.count_singleton]
  ยท rw [integrable_count_iff]
    refine h_sum.of_norm_bounded _ ?_
    simpa only [norm_norm] using (fun k โ†ฆ h_bound k n)

Oskar Goldhahn (Nov 21 2023 at 16:33):

That's great, thanks a lot!

It seems to me like it should be possible to get rid of the countability assumption because summability of the bound implies that a has countable support. Am I wrong?

David Loeffler (Nov 21 2023 at 16:56):

Oskar Goldhahn said:

That's great, thanks a lot!

It seems to me like it should be possible to get rid of the countability assumption because summability of the bound implies that a has countable support. Am I wrong?

Sounds like an exercise for the reader :smile:

Oskar Goldhahn (Nov 21 2023 at 16:56):

I'll give it a try.

Thanks again!

Oskar Goldhahn (Nov 25 2023 at 16:36):

I managed to get rid of the countability as well. It seems to me like countability is also unneeded in some of the adjacent theorems, such as integral_countable'.

Does it make sense to try to get this added to Mathlib?

Here's the resulting code, which can surely be shortened (I'm comfortable with proof assistants in general but not used to Lean specifically):

import Mathlib
open Filter Topology MeasureTheory

/-- Auxiliary lemma to translate integrability statements into summability -/
lemma integrable_count_iff {๐“š G : Type*} [NormedAddCommGroup G] [NormedSpace โ„ G]
    [SecondCountableTopology G] {f : ๐“š โ†’ G} :
    Integrable f (@Measure.count _ โŠค) โ†” Summable (fun k โ†ฆ โ€–f kโ€–) := by
  letI : MeasurableSpace G := borel G
  haveI : BorelSpace G := โŸจrflโŸฉ
  letI : MeasurableSpace ๐“š := โŠค
  simp_rw [Integrable, eq_true_intro (MeasurableSpace.Top.measurable f).aestronglyMeasurable,
    true_and, HasFiniteIntegral, lintegral_count, lt_top_iff_ne_top,
    ENNReal.tsum_coe_ne_top_iff_summable, โ† NNReal.summable_coe, coe_nnnorm]

/-- **Tannery's theorem**: countable sums commutes with limits when the norm of the summand is uniformly
bounded by a summable function.

(This is the special case of the Lebesgue dominated convergence
theorem for the counting measure on a discrete countable set.) -/
lemma tendsto_tsum_of_dominated {๐“š G : Type*}
   [NormedAddCommGroup G] [NormedSpace โ„ G] [CompleteSpace G] [SecondCountableTopology G]
    {a : ๐“š โ†’ โ„• โ†’ G} {b : ๐“š โ†’ G} {bound : ๐“š โ†’ โ„} (h_sum : Summable bound)
    (hab : โˆ€ k, Tendsto (a k) atTop (๐“ (b k))) (h_bound : โˆ€ k n, โ€–a k nโ€– โ‰ค bound k) :
    Tendsto (fun n โ†ฆ โˆ‘' k, a k n : โ„• โ†’ G) atTop (๐“ (tsum b)) := by
  -- handle uncountable ๐“š
  have bound_supp_sub_a_supp n k : bound k = 0 โ†’ a k n = 0
  ยท intros bound_eq_zero
    suffices : โ€–a k nโ€– โ‰ค 0
    ยท simpa
    rw [โ†bound_eq_zero]
    exact h_bound k n
  have count_a_supp : Countable bound.support
  ยท apply Set.Countable.to_subtype
    apply Summable.countable_support h_sum
  let b' (k: bound.support) : G := b k
  let bound' (k: bound.support) : โ„ := bound k
  let h_sum': Summable bound'
  ยท match h_sum with
    | โŸจx, pโŸฉ => (
      exists x
      rw [โ†hasSum_subtype_support] at p
      have bound_eq : bound' = bound โˆ˜ Subtype.val := rfl
      rw [bound_eq]
      exact p
    )
  let hab' (k : bound.support): Tendsto (a k) atTop (๐“ (b k)) := hab k
  let h_bound' (k : bound.support) (n : โ„•) : โ€–a k nโ€– โ‰ค bound k := h_bound k n
  -- choose measure space structures
  letI : MeasurableSpace G := borel G
  haveI : BorelSpace G := โŸจrflโŸฉ
  letI : MeasurableSpace bound.support := โŠค
  letI : MeasureSpace bound.support := โŸจMeasure.countโŸฉ
  -- set up hypotheses for dominated convergence
  have bound_int : Integrable bound'
  ยท simpa only [integrable_count_iff] using h_sum'.norm
  have b_int : Summable (fun k โ†ฆ โ€–b' kโ€–)
  ยท refine h_sum'.of_norm_bounded _ (fun k โ†ฆ ?_)
    simp_rw [norm_norm]
    exact le_of_tendsto ((continuous_norm.tendsto _).comp (hab k))
      (eventually_of_forall (h_bound k))
  -- apply dominated convergence
  have DC := tendsto_integral_of_dominated_convergence _
    (fun _ โ†ฆ (MeasurableSpace.Top.measurable _).aestronglyMeasurable)
    bound_int
    (fun n โ†ฆ eventually_of_forall (Function.swap h_bound' n))
    (eventually_of_forall hab')
  -- massage integrals back to sums in the result
  simp_rw [integral_countable' (integrable_count_iff.mpr b_int),
    Measure.count_singleton, ENNReal.one_toReal, one_smul] at DC
  convert DC using 2 with n
  rw [integral_countable']
  ยท simp [Measure.count_singleton]
    rw [โ†tsum_subtype_eq_of_support_subset]
    simp
    intros k
    contrapose
    simp
    intros H
    apply bound_supp_sub_a_supp
    rw [H]
  ยท rw [integrable_count_iff]
    refine h_sum'.of_norm_bounded _ ?_
    simpa only [norm_norm] using (fun k โ†ฆ h_bound' k n)
  ยท simp_all
    apply Eq.symm
    rw [tsum_subtype_eq_of_support_subset]
    simp
    intros k
    contrapose
    simp
    intros bound_eq0
    have tendsto0 : Tendsto (a โ†‘k) atTop (๐“ (0))
    ยท have ak_const : a k = fun n => 0
      ยท funext n
        apply bound_supp_sub_a_supp
        exact bound_eq0
      rw [ak_const]
      exact tendsto_const_nhds
    apply tendsto_nhds_unique (hab k) tendsto0

David Loeffler (Dec 10 2023 at 15:19):

Sorry, I only just saw this. I think this would be a nice addition to mathlib; but the result is kind of non-optimal, because it only applies when the "limit" variable n is varying over the natural numbers.

I think the result is actually true with all the limits along atTop โ„• replaced by limits along an arbitrary filter. That would be an awesome thing to have in mathlib, but would need a different proof.


Last updated: Dec 20 2023 at 11:08 UTC