finiteness rules for discrete distributions #
Mathlib's finiteness proves goals x ≠ ∞ in ℝ≥0∞ from the syntax of x, with rules for
powers, quotients, inverses, casts and finite measures. This module adds the rules that bounds on
discrete distributions need: the mass p a of an outcome and the probability
p.toOuterMeasure s of an event are finite, and so are finite sums and finite products of finite
terms. With them the side conditions of ENNReal.toReal_add, ENNReal.toReal_mono and
ENNReal.toNNReal_mono in probability bounds are by finiteness, whatever the shape of the bound.
It also applies hypotheses such as ∀ i, f i ≠ ∞, and keeps Mathlib's proof of x ≠ ∞ from a
hypothesis x < _ working alongside the sum rule.
Main results #
ENNReal.Finiteness.sum_ne_top: a finite sum of finite terms is finite, as afinitenessrule.ENNReal.prod_ne_top: registered as an unsafefinitenessrule (matchingENNReal.mul_ne_top, since0 * ∞ = 0).PMF.apply_ne_top,Cslib.Probability.PMF.toOuterMeasure_ne_top: registered asfinitenessrules.
Implementation notes #
The rules have penalty -10, so Aesop tries them before Mathlib's default-penalty rules. One of
those, ENNReal.ofNat_ne_top, concludes OfNat.ofNat ?n ≠ ∞ and is tried on every goal; its
failed unification with ∑ s : Fin m, f s ≠ ∞ unfolds the sum to List.foldr, which made it
most of the cost of finiteness on sums.
A safe rule is never undone, so the sum rule would commit ∑ a ∈ s, f a ≠ ∞ to the termwise
goal even when the context proves the sum finite as a whole, by h : ∑ a ∈ s, f a < ∞, which
Mathlib's ne_top_of_lt (unsafe) uses. The rule x ≠ ⊤ from a hypothesis x < _, with penalty
-20, keeps that proof. It matches the hypothesis up to reducible unfolding: at default
transparency, the failed matches against the other hypotheses cost more than the sum rule saves.
Hypotheses are also applied, as an unsafe rule, so that h : ∀ i, f i ≠ ∞ gives the terms of a
sum.
A finite sum of finite terms is finite: the forward direction of ENNReal.sum_ne_top, as a
finiteness rule.