Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean
For arbitrary probability laws and measurable nested events, the total mean identity multiplies the success-fraction expectation by containing-event mass.
NestedEventRatioMean 1 core · 1 supporting For arbitrary probability laws and measurable nested events, the total mean identity multiplies the success-fraction expectation by containing-event mass. ★ finitePoisson_successFraction_mean_mul
Finite Poisson nested-event ratio mean
For arbitrary probability laws and measurable nested events, the total mean identity multiplies the success-fraction expectation by containing-event mass. It covers zero event mass and zero intensity without division. The module also exposes the positive-mass quotient formula and explicit degenerate cases.
Under an observation probability law, a nonnegative Poisson intensity, two events with measurable membership, and containment of the first in the second, containing-event probability times the expected total success fraction equals smaller-event probability times one minus the probability that no sample point falls in the containing event, namely one minus the exponential of minus the intensity times the containing-event probability. The success fraction is the smaller-event count divided by the containing-event count, set to zero when the latter count is zero.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
finitePoisson_successFraction_meantheorem — Under an observation probability law, a nonnegative Poisson intensity, two events with measurable membership, containment of the first in the second, and positive containing-event probability, the expected total success fraction equals the event-probability ratio times the nonempty-count probability.hypothesesconclusion(∫ s, successFraction A B s ∂finitePoissonSampleLaw P lambda)= (P.real A / P.real B) * (1 - exp (-(lambda : ℝ) * P.real B))Proof (Lean source)
theorem finitePoisson_successFraction_mean (P : Measure X) [IsProbabilityMeasure P] (lambda : ℝ≥0) {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (hPB : 0 < P.real B) : (∫ s, successFraction A B s ∂finitePoissonSampleLaw P lambda) = (P.real A / P.real B) * (1 - exp (-(lambda : ℝ) * P.real B)) := by have h := finitePoisson_successFraction_mean_mul P lambda hA hB hAB calc (∫ s, successFraction A B s ∂finitePoissonSampleLaw P lambda) = (P.real A * (1 - exp (-(lambda : ℝ) * P.real B))) / P.real B := by apply (eq_div_iff (ne_of_gt hPB)).2 simpa only [mul_comm] using h _ = (P.real A / P.real B) * (1 - exp (-(lambda : ℝ) * P.real B)) := by ring
Basic 4 core · 7 supporting Real event counts are sums of zero-one indicators. ★ successFraction_bounds
Total success fractions in finite samples
Real event counts are sums of zero-one indicators. The success fraction is zero when the containing-event count is zero. This module supplies pointwise bounds, measurability, and integrability without any positivity assumption on event mass.
An event and a fixed observation tuple determine its real-valued count, given by summing over the tuple's positions the zero-one indicators that the observation lies in the event.
An event and a finite sample determine its real-valued event count, given by the count in the sample's observation tuple.
Definition (Lean source)
Two events and a finite sample determine the total success fraction, given by the first event's count divided by the second event's count when that count is nonzero and by zero otherwise.
Definition (Lean source)
Containment of one event in another and a finite sample imply that the total success fraction lies between zero and one.
Formal statement
Proof (Lean source)
7 supporting declarations (lemmas, instances)
-
eventCount_boundstheorem — An event and a finite sample have an event count between zero and the sample size.hypothesesconclusionconclusion 10 ≤ eventCount A sconclusion 2eventCount A s ≤ (s.count : ℝ)Proof (Lean source)
theorem eventCount_bounds (A : Set X) (s : FiniteSample X) : 0 ≤ eventCount A s ∧ eventCount A s ≤ (s.count : ℝ) := by classical unfold eventCount iidEventCount constructor · exact Finset.sum_nonneg fun i _ => by split_ifs <;> norm_num · calc (∑ i : Fin s.count, if s.points i ∈ A then (1 : ℝ) else 0) ≤ ∑ _i : Fin s.count, (1 : ℝ) := Finset.sum_le_sum fun i _ => by split_ifs <;> norm_num _ = (s.count : ℝ) := by simp -
eventCount_monotheorem — Containment of one event in another and a finite sample imply that the smaller-event count is no larger than the containing-event count.hypothesesconclusioneventCount A s ≤ eventCount B sProof (Lean source)
theorem eventCount_mono {A B : Set X} (hAB : A ⊆ B) (s : FiniteSample X) : eventCount A s ≤ eventCount B s := by classical unfold eventCount iidEventCount apply Finset.sum_le_sum intro i hi by_cases hA : s.points i ∈ A · simp [hA, hAB hA] · simp only [hA, ite_false] split_ifs <;> norm_num -
measurable_iidEventCounttheorem — Measurable membership of an event and a tuple size make the real-valued event count on tuples measurable.hypothesesconclusionMeasurable (iidEventCount A : (Fin n → X) → ℝ)Proof (Lean source)
@[fun_prop] theorem measurable_iidEventCount {A : Set X} (hA : MeasurableSet A) (n : ℕ) : Measurable (iidEventCount A : (Fin n → X) → ℝ) := by -- Write each summand as a measurable indicator of a coordinate preimage. classical unfold iidEventCount apply Finset.measurable_sum intro i hi exact Measurable.ite (hA.preimage (measurable_pi_apply i)) measurable_const measurable_const -
measurable_eventCounttheorem — Measurable membership of an event makes the real-valued event count on finite samples measurable.Proof (Lean source)
@[fun_prop] theorem measurable_eventCount {A : Set X} (hA : MeasurableSet A) : Measurable (eventCount A : FiniteSample X → ℝ) := by -- Use the measurable sigma-space criterion and measurable_iidEventCount. intro t ht rw [MeasurableSpace.measurableSet_iInf] intro n exact measurable_iidEventCount hA n ht -
measurable_successFractiontheorem — Measurable membership of the two events makes their total success fraction measurable.hypothesesconclusionMeasurable (successFraction A B : FiniteSample X → ℝ)Proof (Lean source)
@[fun_prop] theorem measurable_successFraction {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) : Measurable (successFraction A B : FiniteSample X → ℝ) := by -- The zero-count branch is a measurable piecewise real quotient. classical unfold successFraction exact Measurable.ite ((measurable_eventCount hB) (measurableSet_singleton 0)) measurable_const ((measurable_eventCount hA).div (measurable_eventCount hB)) -
integrable_successFractiontheorem — Under a finite measure on finite samples, measurable membership of two events, and their containment relation, the total success fraction is integrable.hypothesesconclusionIntegrable (successFraction A B) μProof (Lean source)
theorem integrable_successFraction (μ : Measure (FiniteSample X)) [IsFiniteMeasure μ] {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) : Integrable (successFraction A B) μ := by exact Integrable.of_mem_Icc 0 1 (measurable_successFraction hA hB).aemeasurable (Filter.Eventually.of_forall fun s => successFraction_bounds hAB s) -
eventCount_fixedSizeEmbedtheorem — An event, a tuple size, and a fixed observation tuple have the same real-valued event count before and after finite-sample embedding.hypothesesconclusioneventCount A (fixedSizeEmbed n x) = iidEventCount A xProof (Lean source)
@[simp] theorem eventCount_fixedSizeEmbed (A : Set X) (n : ℕ) (x : Fin n → X) : eventCount A (fixedSizeEmbed n x) = iidEventCount A x := by rfl
FixedCount 1 core · 2 supporting The unnormalised count-fibre first moment avoids division by event mass or fibre mass. ★ iid_successFraction_mean_mul
Nested-event ratio means for fixed-size iid samples
The unnormalised count-fibre first moment avoids division by event mass or fibre mass. Its ratio form expresses the conditional mean on every positive count fibre. Summing those fibres gives the fixed-size success-fraction mean.
Under an observation probability law, a fixed sample size, two events with measurable membership, and containment of the first in the second, containing-event probability times the iid total success-fraction mean equals smaller-event probability times the probability that at least one observation falls in the containing event, namely one minus the complement probability of the containing event raised to the sample size.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
iid_nested_count_fibre_first_momenttheorem — Under an observation probability law, a tuple size and count-fibre index, two events with measurable membership, and containment of the first in the second, the iid smaller-event count moment on that fibre satisfies the division-free ratio identity.hypothesesconclusionP.real B * (∫ x : Fin n → X, iidEventCount A x ∂(Measure.pi (fun _ : Fin n => P)).restrict {x | iidEventCount B x = (k : ℝ)})Proof (Lean source)
theorem iid_nested_count_fibre_first_moment (P : Measure X) [IsProbabilityMeasure P] (n k : ℕ) {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) : P.real B * (∫ x : Fin n → X, iidEventCount A x ∂(Measure.pi (fun _ : Fin n => P)).restrict {x | iidEventCount B x = (k : ℝ)}) = P.real A * (k : ℝ) * (Measure.pi (fun _ : Fin n => P)).real {x | iidEventCount B x = (k : ℝ)} := by /- Use iid_nested_pattern_first_moment from PatternFirstMoment.lean. For U : Finset (Fin n), the corresponding rectangle prescribes exactly those coordinates in B. These rectangles are pairwise disjoint and measurable; iidEventCount B is U.card on each. The k-fibre is their finite union over U.card = k. Sum restricted integrals with integral_biUnion_finset and sum probabilities with measureReal_biUnion_finset. This handles k=0 and k>n without dividing by P(B) or by k. Keep the finite set manipulations in private helpers if they would make this proof bulky; do not duplicate the rectangle integral argument. `integral_biUnion_finset` takes measurability, pairwise disjointness, and IntegrableOn on every piece; measureReal_biUnion_finset takes the same disjointness/measurability and finite masses (automatic here). A convenient index is Finset.univ.filter (fun U : Finset (Fin n) => U.card = k). For a tuple x, use Ux := Finset.univ.filter (fun i => x i ∈ B). Expanding iidEventCount gives iidEventCount B x = (Ux.card : ℝ). This proves the union equality and the constant count on each rectangle. Distinct patterns differ at a coordinate, so their rectangles are disjoint. Each restricted count is integrable by its measurable bound [0,n], using eventCount_bounds on fixedSizeEmbed. All arguments also cover n=0 and k>n. -/ classical let T := Finset.univ.filter (fun U : Finset (Fin n) => U.card = k) let R := fun U : Finset (Fin n) => Set.univ.pi (fun i => if i ∈ U then B else Bᶜ) have hset : {x : Fin n → X | iidEventCount B x = (k : ℝ)} = ⋃ U ∈ T, R U := by ext x simp only [Set.mem_ofPred_eq, Set.mem_iUnion] constructor · intro hx refine ⟨Finset.univ.filter (fun i => x i ∈ B), ?_, ?_⟩ · simp only [T, mem_filter, Finset.mem_univ, true_and] exact_mod_cast (count_eq_card B x).symm.trans hx · exact (mem_pattern_iff B _ x).mpr rfl · rintro ⟨U, hU, hx⟩ have hcard : U.card = k := (Finset.mem_filter.mp hU).2 rw [count_eq_card B x, (mem_pattern_iff B U x).mp hx, hcard] have hm : ∀ U ∈ T, MeasurableSet (R U) := fun U _ => measurable_pattern hB U have hd : PairwiseDisjoint (↑T) R := fun U _ V _ hUV => disjoint_patterns B U V hUV rw [hset, integral_biUnion_finset T hm hd (fun _ _ => (integrable_count P hA n).integrableOn), measureReal_biUnion_finset hd hm, Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro U hU have hcard : U.card = k := (Finset.mem_filter.mp hU).2 simpa [R, hcard] using iid_nested_pattern_first_moment P n U hA hAB -
iid_successFraction_count_fibretheorem — Under an observation probability law, a tuple size, a positive containing-event count, two events with measurable membership, containment of the first in the second, and positive containing-event probability, the total success-fraction integral on that count fibre equals the event-probability ratio times its probability.hypothesesconclusion(∫ x : Fin n → X, successFraction A B (fixedSizeEmbed n x) ∂(Measure.pi (fun _ : Fin n => P)).restrict {x | iidEventCount B x = (k : ℝ)})Proof (Lean source)
theorem iid_successFraction_count_fibre (P : Measure X) [IsProbabilityMeasure P] (n k : ℕ) (hk : 0 < k) {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (hPB : 0 < P.real B) : (∫ x : Fin n → X, successFraction A B (fixedSizeEmbed n x) ∂(Measure.pi (fun _ : Fin n => P)).restrict {x | iidEventCount B x = (k : ℝ)}) = (P.real A / P.real B) * (Measure.pi (fun _ : Fin n => P)).real {x | iidEventCount B x = (k : ℝ)} := by /- The fibre is measurable by measurable_iidEventCount. Use ae_restrict_mem and integral_congr_ae to replace the success fraction by iidEventCount A / k on that fibre; the cast of hk makes its zero branch false. integral_div then reduces the claim to iid_nested_count_fibre_first_moment. Cancel only the positive real numbers k and P.real B, never the fibre probability: that probability may vanish even with positive event mass. -/ classical have hf : MeasurableSet {x : Fin n → X | iidEventCount B x = (k : ℝ)} := (measurable_iidEventCount hB n) (measurableSet_singleton _) have hk0 : (k : ℝ) ≠ 0 := by exact_mod_cast hk.ne' have heq : (fun x : Fin n → X => successFraction A B (fixedSizeEmbed n x)) =ᵐ[ (Measure.pi (fun _ : Fin n => P)).restrict {x | iidEventCount B x = (k : ℝ)}] (fun x => iidEventCount A x / (k : ℝ)) := by filter_upwards [ae_restrict_mem hf] with x hx simp [successFraction, hx, hk0] rw [integral_congr_ae heq, integral_div] have hm := iid_nested_count_fibre_first_moment P n k hA hB hAB apply (div_eq_iff hk0).mpr apply (mul_left_cancel₀ hPB.ne') rw [← mul_assoc, hm] field_simp
PatternFirstMoment 1 core · 0 supporting A membership-pattern rectangle fixes the positions lying in the containing event. ★ iid_nested_pattern_first_moment
Nested-event first moments on iid membership patterns
A membership-pattern rectangle fixes the positions lying in the containing event. The smaller-event first moment on this rectangle has a division-free identity. This is the analytic input to the count-fibre identity; aggregating patterns of the same cardinality is a separate finite-partition argument.
Under an observation probability law, a tuple size, a set of prescribed positions, two events with the first measurable, and containment of the first in the second, containing-event probability times the iid integral of the smaller-event count over the rectangle on which exactly the prescribed positions fall in the containing event equals smaller-event probability times the number of prescribed positions times the iid probability of that rectangle.
Formal statement
Proof (Lean source)
PoissonMixture 1 core · 1 supporting This independent module supplies the bounded finite-sample mixture identity and the scalar Poisson generating-function calculation, including zero rate. ★ integral_finitePoissonSampleLaw_eq_integral_iid
Bounded-statistic averaging over finite Poisson sample sizes
This independent module supplies the bounded finite-sample mixture identity and the scalar Poisson generating-function calculation, including zero rate. The exact iid count-fibre law is supplied by FinitePartition.Basic.
Under an observation probability law, a nonnegative Poisson intensity, a finite-sample statistic with measurable dependence on the sample, and a uniform real bound, its finite-Poisson expectation equals the Poisson average of its fixed-size iid expectations.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
poisson_integral_one_sub_powtheorem — A nonnegative Poisson intensity and a real number give the Poisson average of one minus its complement raised to the random sample size.hypotheseslambda :ℝ≥0p :ℝconclusion(∫ n : ℕ, (1 - (1 - p) ^ n) ∂poissonMeasure lambda) = 1 - exp (-(lambda : ℝ) * p)Proof (Lean source)
theorem poisson_integral_one_sub_pow (lambda : ℝ≥0) (p : ℝ) : (∫ n : ℕ, (1 - (1 - p) ^ n) ∂poissonMeasure lambda) = 1 - exp (-(lambda : ℝ) * p) := by have hpow : HasSum (fun n : ℕ => (exp (-(lambda : ℝ)) * (lambda : ℝ) ^ n / (n.factorial : ℝ)) * (1 - p) ^ n) (exp (-(lambda : ℝ) * p)) := by convert! (NormedSpace.expSeries_div_hasSum_exp ((lambda : ℝ) * (1 - p))).mul_left (exp (-(lambda : ℝ))) using 1 · ext n rw [mul_pow] ring · rw [← Real.exp_eq_exp_ℝ, ← Real.exp_add] congr 1 ring have hsum := (hasSum_one_poissonMeasure lambda).sub hpow rw [integral_poissonMeasure] convert hsum.tsum_eq using 1 congr 1 ext n simp only [smul_eq_mul] ring
ZeroCases 1 core · 4 supporting The iid zero-count event is a product of complement events. ★ finitePoisson_eventCount_zero_probability
Zero-count probabilities and degenerate success-fraction means
The iid zero-count event is a product of complement events. Averaging its probability over a Poisson size gives the exponential empty-event probability. Zero containing-event mass and zero intensity then yield zero success fractions almost surely or in expectation, independently of the positive-count ratio proof.
Under an observation probability law, a nonnegative Poisson intensity, and an event with measurable membership, the probability of no sample point in the event equals the exponential of minus the intensity times the event's probability.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
iid_eventCount_zero_probabilitytheorem — Under an observation probability law, a tuple size, and an event with measurable membership, the probability that its iid event count is zero equals the complement probability raised to the tuple size.hypothesesconclusionProof (Lean source)
theorem iid_eventCount_zero_probability (P : Measure X) [IsProbabilityMeasure P] (n : ℕ) {B : Set X} (hB : MeasurableSet B) : (Measure.pi (fun _ : Fin n => P)).real {x | iidEventCount B x = 0} = (1 - P.real B) ^ n := by /- Identify the zero-count set with Set.univ.pi (fun _ : Fin n => Bᶜ) using nonnegativity of every zero-one summand. Apply Measure.pi_pi, ENNReal.toReal_prod, measureReal_compl, and probability mass of univ. This is a product probability calculation, with no ratio lemma dependency. -/ classical have hset : {x : Fin n → X | iidEventCount B x = 0} = Set.univ.pi (fun _ : Fin n => Bᶜ) := by ext x simp only [Set.mem_ofPred_eq, Set.mem_univ_pi, Set.mem_compl_iff, iidEventCount] rw [Finset.sum_eq_zero_iff_of_nonneg (fun i _ => by split_ifs <;> norm_num)] simp rw [hset, measureReal_def, Measure.pi_pi, ENNReal.toReal_prod] simp [← measureReal_def, measureReal_compl hB] -
successFraction_ae_zero_of_mass_zerotheorem — Under an observation probability law, a nonnegative Poisson intensity, two events with the second measurable and of zero mass, the total success fraction is almost surely zero.hypothesesconclusionsuccessFraction A B =ᵐ[finitePoissonSampleLaw P lambda] (fun _ => 0)Proof (Lean source)
theorem successFraction_ae_zero_of_mass_zero (P : Measure X) [IsProbabilityMeasure P] (lambda : ℝ≥0) {A B : Set X} (hB : MeasurableSet B) (hPB : P B = 0) : successFraction A B =ᵐ[finitePoissonSampleLaw P lambda] (fun _ => 0) := by /- Use finitePoisson_eventCount_zero_probability with P.real B=0 to show the measurable zero-count event has probability one. On that event the explicit successFraction branch is zero. A private helper converting real probability one of a measurable set to almost-sure membership can also discharge the zero-intensity theorem. No cancellation of event mass or use of the open ratio-mean identity is allowed here. -/ classical have hE : MeasurableSet {s : FiniteSample X | eventCount B s = 0} := (measurable_eventCount hB) (measurableSet_singleton 0) have hprob := finitePoisson_eventCount_zero_probability P lambda hB have hreal : P.real B = 0 := by simp [measureReal_def, hPB] rw [hreal, mul_zero, Real.exp_zero] at hprob have hae := (mem_ae_iff_prob_eq_one hE).2 ((ENNReal.toReal_eq_one_iff _).1 hprob) filter_upwards [hae] with s hs simp [successFraction, Set.mem_ofPred_eq.mp hs] -
finitePoisson_successFraction_mean_of_mass_zerotheorem — Under an observation probability law, a nonnegative Poisson intensity, two events, measurability of the second, and zero mass of the second event, the expected total success fraction is zero.hypothesesconclusion(∫ s, successFraction A B s ∂finitePoissonSampleLaw P lambda) = 0Proof (Lean source)
theorem finitePoisson_successFraction_mean_of_mass_zero (P : Measure X) [IsProbabilityMeasure P] (lambda : ℝ≥0) {A B : Set X} (hB : MeasurableSet B) (hPB : P B = 0) : (∫ s, successFraction A B s ∂finitePoissonSampleLaw P lambda) = 0 := by rw [integral_congr_ae (successFraction_ae_zero_of_mass_zero P lambda hB hPB)] simp -
finitePoisson_successFraction_mean_zero_intensitytheorem — Under an observation probability law, two events with the second measurable, the expected total success fraction at zero Poisson intensity is zero.hypothesesconclusion(∫ s, successFraction A B s ∂finitePoissonSampleLaw P 0) = 0Proof (Lean source)
theorem finitePoisson_successFraction_mean_zero_intensity (P : Measure X) [IsProbabilityMeasure P] {A B : Set X} (hB : MeasurableSet B) : (∫ s, successFraction A B s ∂finitePoissonSampleLaw P 0) = 0 := by /- finitePoisson_eventCount_zero_probability at rate zero gives probability one of zero B-count, irrespective of P(B). Conclude the integrand is ae zero by its zero branch and use integral_congr_ae. Alternatively apply the closed bounded mixture identity and the scalar zero-rate Dirac law. Do not depend on the headline ratio mean (which belongs to a later import layer). -/ classical have hE : MeasurableSet {s : FiniteSample X | eventCount B s = 0} := (measurable_eventCount hB) (measurableSet_singleton 0) have hprob := finitePoisson_eventCount_zero_probability P 0 hB simp only [NNReal.coe_zero, neg_zero, zero_mul, Real.exp_zero] at hprob have hae := (mem_ae_iff_prob_eq_one hE).2 ((ENNReal.toReal_eq_one_iff _).1 hprob) have hzero : successFraction A B =ᵐ[finitePoissonSampleLaw P 0] (fun _ => 0) := by filter_upwards [hae] with s hs simp [successFraction, Set.mem_ofPred_eq.mp hs] rw [integral_congr_ae hzero] simp