Mathlib.Probability.Poisson.PairSecondMoment
Exact second-moment tools for bilinear sums over two independent finite Poisson samples, including fixed-count coincidence formulas and count-mixture identities.
Basic 2 core · 0 supporting The bilinear statistic is defined for arbitrary finite samples. ★ pairSum_sq_le_count_mul_sum_sq
A finite bilinear sum and its pointwise square bound
The bilinear statistic is defined for arbitrary finite samples. Its square is bounded by the number of index pairs times the sum of squared kernel values.
Given a real kernel and two finite samples, the bilinear pair sum is given by adding the kernel over every ordered left-right pair.
Definition (Lean source)
Given a real kernel and two finite samples, the squared bilinear sum is bounded by its ordered-pair count times the sum of squared kernel values.
Formal statement
Proof (Lean source)
Algebra 1 core · 1 supporting This file isolates the finite combinatorial expansion behind second moments of bilinear statistics of two independent Poisson streams. ★ integral_bilinearSum_sq_eq_coincidence
Coincidence expansion for bilinear finite sums
This file isolates the finite combinatorial expansion behind second moments of bilinear statistics of two independent Poisson streams. The four terms correspond to coincidence in both stream indices, only the second index, only the first index, and neither index.
Given a measure, a finite array of real summands, and integrable products of every two summands, the integral of its squared bilinear sum is the four-class coincidence expansion.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
bilinearSum_sq_eq_coincidencetheorem — Given a finite real array, its squared bilinear sum is the sum of its four index-coincidence classes.hypothesesι κ :K :ι → κ → ℝconclusion(∑ i, ∑ j, K i j) ^ 2= (∑ i, ∑ j, K i j * K i j)+ (∑ i, ∑ j, ∑ l ∈ (Finset.univ.erase j), K i j * K i l)+ (∑ i, ∑ j, ∑ k ∈ (Finset.univ.erase i), K i j * K k j)+ (∑ i, ∑ j, ∑ k ∈ (Finset.univ.erase i), ∑ l ∈ (Finset.univ.erase j), K i j * K k l)Proof (Lean source)
theorem bilinearSum_sq_eq_coincidence {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] (K : ι → κ → ℝ) : (∑ i, ∑ j, K i j) ^ 2 = (∑ i, ∑ j, K i j * K i j) + (∑ i, ∑ j, ∑ l ∈ (Finset.univ.erase j), K i j * K i l) + (∑ i, ∑ j, ∑ k ∈ (Finset.univ.erase i), K i j * K k j) + (∑ i, ∑ j, ∑ k ∈ (Finset.univ.erase i), ∑ l ∈ (Finset.univ.erase j), K i j * K k l) := by classical rw [pow_two, Finset.sum_mul] simp_rw [Finset.sum_mul, Finset.mul_sum] simp only [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i _ apply Finset.sum_congr rfl intro j _ rw [← Finset.add_sum_erase univ (fun k => ∑ l, K i j * K k l) (Finset.mem_univ i)] rw [← Finset.add_sum_erase univ (fun l => K i j * K i l) (Finset.mem_univ j)] simp_rw [← Finset.add_sum_erase univ (fun l => K i j * K _ l) (Finset.mem_univ j)] rw [Finset.sum_add_distrib] ring
Coordinates 1 core · 4 supporting The four coincidence patterns in a bilinear square have different coordinate laws. ★ integral_fixedCount_both_distinct
Coordinate integrals for two independent iid arrays
The four coincidence patterns in a bilinear square have different coordinate laws. These lemmas keep the left and right observations independent, and use two fresh coordinates within a stream whenever its indices differ.
Given two probability laws, a measurable real kernel, an integrable kernel square, two fixed array lengths, and distinct selected positions in each array, the product of the two kernel evaluations has the four-independent-coordinate integral.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
integrable_fixedCount_kernelProducttheorem — Given two probability laws, a real kernel, two fixed array lengths, a measurable kernel, an integrable kernel square, and two selected positions in each array, the product of the two kernel evaluations is integrable.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :K :X → Y → ℝm n :ℕhK :Measurable (uncurry K)hK2 :Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)i k :Fin mj l :Fin nProof (Lean source)
theorem integrable_fixedCount_kernelProduct (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (K : X → Y → ℝ) (m n : ℕ) (hK : Measurable (uncurry K)) (hK2 : Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)) (i k : Fin m) (j l : Fin n) : Integrable (fun p : (Fin m → X) × (Fin n → Y) => K (p.1 i) (p.2 j) * K (p.1 k) (p.2 l)) ((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q)) := by let μ := (Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q) let f := fun p : (Fin m → X) × (Fin n → Y) => K (p.1 i) (p.2 j) let g := fun p : (Fin m → X) × (Fin n → Y) => K (p.1 k) (p.2 l) have hfmeas : Measurable f := by change Measurable ((uncurry K) ∘ fun p : (Fin m → X) × (Fin n → Y) => (p.1 i, p.2 j)) exact hK.comp (((measurable_pi_apply i).comp measurable_fst).prodMk ((measurable_pi_apply j).comp measurable_snd)) have hgmeas : Measurable g := by change Measurable ((uncurry K) ∘ fun p : (Fin m → X) × (Fin n → Y) => (p.1 k, p.2 l)) exact hK.comp (((measurable_pi_apply k).comp measurable_fst).prodMk ((measurable_pi_apply l).comp measurable_snd)) have hfsq : Integrable (fun p => f p ^ 2) μ := by simpa only [f, Function.comp_def] using (measurePreserving_fixedCount_pair P Q m n i j).integrable_comp_of_integrable hK2 have hgsq : Integrable (fun p => g p ^ 2) μ := by simpa only [g, Function.comp_def] using (measurePreserving_fixedCount_pair P Q m n k l).integrable_comp_of_integrable hK2 have hf : MemLp f 2 μ := (memLp_two_iff_integrable_sq hfmeas.aestronglyMeasurable).2 hfsq have hg : MemLp g 2 μ := (memLp_two_iff_integrable_sq hgmeas.aestronglyMeasurable).2 hgsq change Integrable (f * g) μ exact hf.integrable_mul hg -
integral_fixedCount_both_equaltheorem — Given two probability laws, a measurable real kernel, an integrable kernel square, two fixed array lengths, and one selected position in each array, coincident evaluations integrate as one independent point-pair kernel square.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :K :X → Y → ℝm n :ℕhK :Measurable (uncurry K)hK2 :Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)i :Fin mj :Fin nProof (Lean source)
theorem integral_fixedCount_both_equal (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (K : X → Y → ℝ) (m n : ℕ) (hK : Measurable (uncurry K)) (hK2 : Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)) (i : Fin m) (j : Fin n) : (∫ p : (Fin m → X) × (Fin n → Y), K (p.1 i) (p.2 j) * K (p.1 i) (p.2 j) ∂((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q))) = ∫ x, ∫ y, K x y * K x y ∂Q ∂P := by let φ : ((Fin m → X) × (Fin n → Y)) → X × Y := fun p => (p.1 i, p.2 j) have hφ := measurePreserving_fixedCount_pair P Q m n i j have hprod : Integrable (fun z : X × Y => K z.1 z.2 * K z.1 z.2) (P.prod Q) := by simpa only [← pow_two] using hK2 calc _ = ∫ z : X × Y, K z.1 z.2 * K z.1 z.2 ∂(P.prod Q) := by have e := integral_map (μ := (Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q)) (φ := φ) hφ.measurable.aemeasurable (f := fun z : X × Y => K z.1 z.2 * K z.1 z.2) (hK.mul hK).aestronglyMeasurable rw [hφ.map_eq] at e exact e.symm _ = _ := integral_prod _ hprod
CountEnvelope 1 core · 0 supporting The product of two scalar Poisson count laws gives a finite weighted double series of squared counts. ★ poisson_pair_count_sq_series_lt_top
Summability of the two independent squared Poisson counts
The product of two scalar Poisson count laws gives a finite weighted double series of squared counts. This is the count envelope used for the square of a bilinear sum over independent finite samples.
Given two nonnegative Poisson rates, the double series weighted by both squared counts is finite.
Formal statement
Proof (Lean source)
FixedCount 1 core · 2 supporting Two independently sampled finite arrays have a bilinear square whose four terms are indexed by the two possible equality decisions in each stream. ★ integral_fixedCount_pairSum_sq
Second moment of a bilinear sum on fixed iid arrays
Two independently sampled finite arrays have a bilinear square whose four terms are indexed by the two possible equality decisions in each stream.
Given two probability laws, a measurable real kernel, an integrable kernel square, and two fixed array lengths, the expected squared bilinear sum over two independent iid arrays is the sum of four terms: m·n times the mean squared kernel; m·n(n-1) times the mean product of two kernel values sharing the left point with independent right points; m(m-1)·n times the mean product sharing the right point with independent left points; and m(m-1)·n(n-1) times the mean product at four independent points.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
integrable_fixedCount_pairSum_sqtheorem — Given two probability laws, a real kernel, two fixed array lengths, a measurable kernel, and an integrable kernel square, the squared bilinear array sum is integrable.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :K :X → Y → ℝm n :ℕhK :Measurable (uncurry K)hK2 :Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)Proof (Lean source)
theorem integrable_fixedCount_pairSum_sq (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (K : X → Y → ℝ) (m n : ℕ) (hK : Measurable (uncurry K)) (hK2 : Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)) : Integrable (fun p : (Fin m → X) × (Fin n → Y) => (∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) ^ 2) ((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q)) := by classical let μ := (Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q) have hprod (i k : Fin m) (j l : Fin n) := integrable_fixedCount_kernelProduct P Q K m n hK hK2 i k j l change Integrable (fun p => (∑ i, ∑ j, K (p.1 i) (p.2 j)) ^ 2) μ simp_rw [bilinearSum_sq_eq_coincidence] refine Integrable.add (Integrable.add (Integrable.add ?_ ?_) ?_) ?_ · apply integrable_finsetSum intro i _ apply integrable_finsetSum intro j _ exact hprod i i j j · apply integrable_finsetSum intro i _ apply integrable_finsetSum intro j _ apply integrable_finsetSum intro l _ exact hprod i i j l · apply integrable_finsetSum intro i _ apply integrable_finsetSum intro j _ apply integrable_finsetSum intro k _ exact hprod i k j j · apply integrable_finsetSum intro i _ apply integrable_finsetSum intro j _ apply integrable_finsetSum intro k _ apply integrable_finsetSum intro l _ exact hprod i k j l -
integral_fixedCount_sum_kernel_sqtheorem — Given two probability laws, a measurable real kernel, an integrable kernel square, and two fixed array lengths, the expected sum of squared kernel values is the length product times the one-pair squared-kernel integral.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :K :X → Y → ℝm n :ℕhK :Measurable (uncurry K)hK2 :Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)Proof (Lean source)
theorem integral_fixedCount_sum_kernel_sq (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (K : X → Y → ℝ) (m n : ℕ) (hK : Measurable (uncurry K)) (hK2 : Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)) : (∫ p : (Fin m → X) × (Fin n → Y), (∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j) ^ 2) ∂((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q))) = (m : ℝ) * (n : ℝ) * (∫ x, ∫ y, K x y ^ 2 ∂Q ∂P) := by classical let μ := (Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q) have hterm (i : Fin m) (j : Fin n) : Integrable (fun p : (Fin m → X) × (Fin n → Y) => K (p.1 i) (p.2 j) ^ 2) μ := by simpa only [pow_two] using (integrable_fixedCount_kernelProduct P Q K m n hK hK2 i i j j) have hinner (i : Fin m) : Integrable (fun p : (Fin m → X) × (Fin n → Y) => ∑ j : Fin n, K (p.1 i) (p.2 j) ^ 2) μ := integrable_finsetSum univ (by intro j _; exact hterm i j) calc (∫ p, ∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j) ^ 2 ∂μ) = ∑ i : Fin m, ∫ p, ∑ j : Fin n, K (p.1 i) (p.2 j) ^ 2 ∂μ := integral_finsetSum univ (by intro i _; exact hinner i) _ = ∑ i : Fin m, ∑ j : Fin n, ∫ p, K (p.1 i) (p.2 j) ^ 2 ∂μ := by congr 1 ext i exact integral_finsetSum univ (by intro j _; exact hterm i j) _ = _ := by simp_rw [show ∀ (i : Fin m) (j : Fin n), (∫ p, K (p.1 i) (p.2 j) ^ 2 ∂μ) = (∫ x, ∫ y, K x y ^ 2 ∂Q ∂P) from by intro i j simpa only [pow_two] using integral_fixedCount_both_equal P Q K m n hK hK2 i j] simp [Finset.sum_const, nsmul_eq_mul, mul_assoc]
Integrability 1 core · 3 supporting The squared bilinear statistic is bounded on each fixed-count fibre by the count product squared times the one-pair squared-kernel moment. ★ lintegral_pairSum_sq_lt_top
Measurability and count envelopes for a Poisson pair sum
The squared bilinear statistic is bounded on each fixed-count fibre by the count product squared times the one-pair squared-kernel moment. This provides the summable nonnegative envelope for the two independent Poisson counts.
Given two probability laws, their nonnegative Poisson rates, a measurable real kernel, and an integrable kernel square, the nonnegative integral of the squared bilinear sample sum is finite.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
measurable_pairSumtheorem — Given a real kernel with a measurable uncurried form, its bilinear sum over pairs of finite samples is measurable.hypothesesconclusionProof (Lean source)
@[fun_prop] theorem measurable_pairSum (K : X → Y → ℝ) (hK : Measurable (uncurry K)) : Measurable (fun p : FiniteSample X × FiniteSample Y => pairSum K p.1 p.2) := by -- Use the sigma-type measurable-space constructor: on each pair of count -- fibres this is a finite sum of measurable coordinate evaluations. classical have hEmbedX (k : ℕ) : MeasurableEmbedding (fixedSizeEmbed (X := X) k) := by refine ⟨?_, measurable_fixedSizeEmbed k, ?_⟩ · intro x y h simpa [fixedSizeEmbed] using h · intro s hs change MeasurableSet[⨅ a, MeasurableSpace.map (@Sigma.mk ℕ (fun r => Fin r → X) a) inferInstance] (@Sigma.mk ℕ (fun r => Fin r → X) k '' s) simp only [MeasurableSpace.measurableSet_iInf] intro a change MeasurableSet ((@Sigma.mk ℕ (fun r => Fin r → X) a) ⁻¹' (@Sigma.mk ℕ (fun r => Fin r → X) k '' s)) by_cases h : a = k · subst a have hinj : Injective (@Sigma.mk ℕ (fun r => Fin r → X) k) := by intro x y hxy simpa using hxy rw [hinj.preimage_image] exact hs · rw [Set.preimage_image_sigmaMk_of_ne h] exact MeasurableSet.empty have hEmbedY (k : ℕ) : MeasurableEmbedding (fixedSizeEmbed (X := Y) k) := by refine ⟨?_, measurable_fixedSizeEmbed k, ?_⟩ · intro x y h simpa [fixedSizeEmbed] using h · intro s hs change MeasurableSet[⨅ a, MeasurableSpace.map (@Sigma.mk ℕ (fun r => Fin r → Y) a) inferInstance] (@Sigma.mk ℕ (fun r => Fin r → Y) k '' s) simp only [MeasurableSpace.measurableSet_iInf] intro a change MeasurableSet ((@Sigma.mk ℕ (fun r => Fin r → Y) a) ⁻¹' (@Sigma.mk ℕ (fun r => Fin r → Y) k '' s)) by_cases h : a = k · subst a have hinj : Injective (@Sigma.mk ℕ (fun r => Fin r → Y) k) := by intro x y hxy simpa using hxy rw [hinj.preimage_image] exact hs · rw [Set.preimage_image_sigmaMk_of_ne h] exact MeasurableSet.empty have hfiber (m n : ℕ) : Measurable (fun p : (Fin m → X) × (Fin n → Y) => ∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) := by apply Finset.measurable_sum intro i _ apply Finset.measurable_sum intro j _ have hpair : Measurable (fun p : (Fin m → X) × (Fin n → Y) => (p.1 i, p.2 j)) := ((measurable_pi_apply i).comp measurable_fst).prodMk ((measurable_pi_apply j).comp measurable_snd) simpa only [Function.comp_def, uncurry] using hK.comp hpair intro s hs have hpre : (fun p : FiniteSample X × FiniteSample Y => pairSum K p.1 p.2) ⁻¹' s = ⋃ m : ℕ, ⋃ n : ℕ, (map (fixedSizeEmbed (X := X) m) (fixedSizeEmbed (X := Y) n)) '' ((fun p : (Fin m → X) × (Fin n → Y) => ∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) ⁻¹' s) := by ext p rcases p with ⟨⟨m, x⟩, ⟨n, y⟩⟩ constructor · intro hp refine Set.mem_iUnion.mpr ⟨m, Set.mem_iUnion.mpr ⟨n, ?_⟩⟩ refine ⟨(x, y), ?_, ?_⟩ · simpa [pairSum] using hp · rfl · simp only [Set.mem_iUnion, Set.mem_image, Set.mem_preimage] at * rintro ⟨m', n', q, hq, heq⟩ change (fun p : FiniteSample X × FiniteSample Y => pairSum K p.1 p.2) (⟨m, x⟩, ⟨n, y⟩) ∈ s rw [← heq] change (∑ i : Fin m', ∑ j : Fin n', K (q.1 i) (q.2 j)) ∈ s exact hq rw [hpre] exact MeasurableSet.iUnion fun m => MeasurableSet.iUnion fun n => ((hEmbedX m).prodMap (hEmbedY n)).measurableSet_image.mpr ((hfiber m n) hs) -
integral_fixedCount_pairSum_sq_letheorem — Given two probability laws, a measurable real kernel, an integrable kernel square, and two fixed array lengths, the expected squared bilinear sum is bounded by the squared length product times the one-pair squared-kernel moment.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :K :X → Y → ℝm n :ℕhK :Measurable (uncurry K)hK2 :Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)Proof (Lean source)
theorem integral_fixedCount_pairSum_sq_le (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (K : X → Y → ℝ) (m n : ℕ) (hK : Measurable (uncurry K)) (hK2 : Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)) : (∫ p : (Fin m → X) × (Fin n → Y), (∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) ^ 2 ∂((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q))) ≤ (m : ℝ) ^ 2 * (n : ℝ) ^ 2 * (∫ x, ∫ y, K x y ^ 2 ∂Q ∂P) := by -- Integrate `pairSum_sq_le_count_mul_sum_sq`, using -- `integrable_fixedCount_pairSum_sq` and the termwise integrability from -- `integral_fixedCount_sum_kernel_sq`; then evaluate the finite sum. classical let μ := (Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q) have hsum : Integrable (fun p : (Fin m → X) × (Fin n → Y) => ∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j) ^ 2) μ := by apply integrable_finsetSum intro i _ apply integrable_finsetSum intro j _ simpa only [pow_two] using (integrable_fixedCount_kernelProduct P Q K m n hK hK2 i i j j) have hle := integral_mono (integrable_fixedCount_pairSum_sq P Q K m n hK hK2) (hsum.const_mul ((m : ℝ) * (n : ℝ))) (fun p => pairSum_sq_le_count_mul_sum_sq K ⟨m, p.1⟩ ⟨n, p.2⟩) change (∫ p, (∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) ^ 2 ∂μ) ≤ _ at hle ⊢ rw [integral_const_mul, integral_fixedCount_sum_kernel_sq P Q K m n hK hK2] at hle nlinarith [hle] -
lintegral_fixedCount_pairSum_sq_letheorem — Given two probability laws, a measurable real kernel, an integrable kernel square, and two fixed array lengths, the nonnegative squared-sum integral is bounded by the two squared counts times the one-pair squared-kernel integral.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :K :X → Y → ℝm n :ℕhK :Measurable (uncurry K)hK2 :Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)Proof (Lean source)
theorem lintegral_fixedCount_pairSum_sq_le (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (K : X → Y → ℝ) (m n : ℕ) (hK : Measurable (uncurry K)) (hK2 : Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)) : (∫⁻ p : (Fin m → X) × (Fin n → Y), ofReal ((∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) ^ 2) ∂((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q))) ≤ (m : ℝ≥0∞) ^ 2 * (n : ℝ≥0∞) ^ 2 * (∫⁻ p : X × Y, ofReal (K p.1 p.2 ^ 2) ∂(P.prod Q)) := by -- Convert both nonnegative lintegrals to real integrals with -- `ofReal_integral_eq_lintegral_ofReal`; use the proved fixed-count real -- bound, `integral_prod`, and nonnegativity of each square. Reassociate -- `ofReal` products using nonnegative factors. classical let μ := (Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q) have hfixed := ofReal_integral_eq_lintegral_ofReal (integrable_fixedCount_pairSum_sq P Q K m n hK hK2) (Filter.Eventually.of_forall fun p => sq_nonneg (∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j))) have hpair := ofReal_integral_eq_lintegral_ofReal hK2 (Filter.Eventually.of_forall fun p => sq_nonneg (K p.1 p.2)) have hbound := integral_fixedCount_pairSum_sq_le P Q K m n hK hK2 rw [← integral_prod _ hK2] at hbound change (∫ p, (∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) ^ 2 ∂μ) ≤ _ at hbound change (∫⁻ p, ofReal ((∑ i : Fin m, ∑ j : Fin n, K (p.1 i) (p.2 j)) ^ 2) ∂μ) ≤ _ rw [← hfixed, ← hpair] rw [← ENNReal.ofReal_natCast, ← ENNReal.ofReal_natCast] rw [← ENNReal.ofReal_pow, ← ENNReal.ofReal_pow, ← ENNReal.ofReal_mul (by positivity : 0 ≤ (m : ℝ) ^ 2), ← ENNReal.ofReal_mul (by positivity : 0 ≤ (m : ℝ) ^ 2 * (n : ℝ) ^ 2)] all_goals first | exact ENNReal.ofReal_le_ofReal hbound | positivity
Main 1 core · 1 supporting The bilinear statistic over two independent streams splits into the four index-coincidence patterns. ★ integral_pairSum_sq
Exact second moment for two independent finite Poisson samples
The bilinear statistic over two independent streams splits into the four index-coincidence patterns. Separate count laws supply the two rate factors.
Given two probability laws, their nonnegative Poisson rates, a measurable real kernel, and an integrable kernel square, the expected squared bilinear sum over two independent finite Poisson samples is the sum of four terms: the product of the two rates times the mean squared kernel; the first rate times the squared second rate times the mean product of two kernel values sharing the left point with independent right points; the squared first rate times the second rate times the mean product sharing the right point with independent left points; and the product of the squared rates times the mean product at four independent points.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
integrable_pairSum_sqtheorem — Given two probability laws, their nonnegative Poisson rates, a measurable real kernel, and an integrable kernel square, the squared bilinear finite-Poisson sum is integrable.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :rateA rateB :ℝ≥0K :X → Y → ℝhK :Measurable (uncurry K)hK2 :Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)conclusionIntegrable (fun p : FiniteSample X × FiniteSample Y => pairSum K p.1 p.2 ^ 2) ((finitePoissonSampleLaw P rateA).prod (finitePoissonSampleLaw Q rateB))Proof (Lean source)
theorem integrable_pairSum_sq (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (rateA rateB : ℝ≥0) (K : X → Y → ℝ) (hK : Measurable (uncurry K)) (hK2 : Integrable (fun p : X × Y => K p.1 p.2 ^ 2) (P.prod Q)) : Integrable (fun p : FiniteSample X × FiniteSample Y => pairSum K p.1 p.2 ^ 2) ((finitePoissonSampleLaw P rateA).prod (finitePoissonSampleLaw Q rateB)) := by -- Use `measurable_pairSum` for the measurability part of integrability. -- `lintegral_pairSum_sq_lt_top` supplies finite absolute integral because -- a real square is nonnegative. apply (lintegral_ofReal_ne_top_iff_integrable ((measurable_pairSum K hK).pow_const 2).aestronglyMeasurable (Filter.Eventually.of_forall fun p => sq_nonneg (pairSum K p.1 p.2))).mp exact (lintegral_pairSum_sq_lt_top P Q rateA rateB K hK hK2).ne
Mixture 1 core · 1 supporting The nonnegative integral of a statistic of two independent finite Poisson samples is a double mixture of fixed-size iid-array integrals. ★ integral_pair_count_mixture
Two independent finite Poisson count fibres
The nonnegative integral of a statistic of two independent finite Poisson samples is a double mixture of fixed-size iid-array integrals. This isolates the count decomposition needed for real-valued moment calculations.
Given two probability observation laws, their nonnegative Poisson rates, and an integrable real statistic of their finite samples, its expectation is the double Poisson-weighted series of fixed-count iid-array expectations.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
lintegral_pair_count_mixturetheorem — Given two probability observation laws, their nonnegative Poisson rates, and a measurable nonnegative statistic of their finite samples, its integral is the double Poisson-weighted series of fixed-count iid-array integrals.hypothesesX :sharedType u_1Y :sharedType u_2P :Q :rateA rateB :ℝ≥0f :FiniteSample X × FiniteSample Y → ℝ≥0∞hf :conclusion= ∑' m : ℕ, ∑' n : ℕ, (poissonMeasure rateA) ({m} : Set ℕ) * (poissonMeasure rateB) ({n} : Set ℕ) * (∫⁻ p : (Fin m → X) × (Fin n → Y), f (⟨m, p.1⟩, ⟨n, p.2⟩) ∂((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q)))Proof (Lean source)
theorem lintegral_pair_count_mixture (P : Measure X) [IsProbabilityMeasure P] (Q : Measure Y) [IsProbabilityMeasure Q] (rateA rateB : ℝ≥0) (f : FiniteSample X × FiniteSample Y → ℝ≥0∞) (hf : Measurable f) : (∫⁻ p, f p ∂((finitePoissonSampleLaw P rateA).prod (finitePoissonSampleLaw Q rateB))) = ∑' m : ℕ, ∑' n : ℕ, (poissonMeasure rateA) ({m} : Set ℕ) * (poissonMeasure rateB) ({n} : Set ℕ) * (∫⁻ p : (Fin m → X) × (Fin n → Y), f (⟨m, p.1⟩, ⟨n, p.2⟩) ∂((Measure.pi fun _ : Fin m => P).prod (Measure.pi fun _ : Fin n => Q))) := by let μA := finitePoissonSampleLaw P rateA let μB := finitePoissonSampleLaw Q rateB change ∫⁻ p, f p ∂(μA.prod μB) = _ rw [finiteSample_count_sum μA, finiteSample_count_sum μB, Measure.prod_sum, lintegral_sum_measure, ENNReal.tsum_prod'] congr 1 funext m congr 1 funext n rw [finitePoissonSampleLaw_restrict_count_eq, finitePoissonSampleLaw_restrict_count_eq, Measure.prod_smul_left, Measure.prod_smul_right, Measure.map_prod_map _ _ (measurable_fixedSizeEmbed m) (measurable_fixedSizeEmbed n), lintegral_smul_measure, lintegral_smul_measure, lintegral_map hf ((measurable_fixedSizeEmbed m).prodMap (measurable_fixedSizeEmbed n))] simp only [smul_eq_mul, map, fixedSizeEmbed, mul_assoc]
Moments 1 core · 4 supporting This module supplies the first, ordered-pair, and raw second moments of a scalar Poisson count used to weight the count fibres of a finite Poisson sample. ★ poisson_ordered_pairs_second_moment
Scalar factorial moments of a Poisson count
This module supplies the first, ordered-pair, and raw second moments of a scalar Poisson count used to weight the count fibres of a finite Poisson sample.
Under a Poisson law with nonnegative rate, the expected number of ordered pairs of distinct positions, the count times the count minus one, equals the squared rate.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
poisson_count_first_momenttheorem — Under a Poisson law with nonnegative rate, the expected count equals that rate.hypothesesrate :ℝ≥0conclusion(∫ n : ℕ, (n : ℝ) ∂poissonMeasure rate) = (rate : ℝ)Proof (Lean source)
theorem poisson_count_first_moment (rate : ℝ≥0) : (∫ n : ℕ, (n : ℝ) ∂poissonMeasure rate) = (rate : ℝ) := poisson_natCast_first_moment rate -
integrable_poisson_ordered_pairstheorem — Under a Poisson law with nonnegative rate, the ordered count of two distinct positions is integrable.hypothesesrate :ℝ≥0conclusionIntegrable (fun n : ℕ => (n : ℝ) * ((n : ℝ) - 1)) (poissonMeasure rate)Proof (Lean source)
theorem integrable_poisson_ordered_pairs (rate : ℝ≥0) : Integrable (fun n : ℕ => (n : ℝ) * ((n : ℝ) - 1)) (poissonMeasure rate) := by have hsq := (poisson_natCast_memLp_two rate).integrable_sq have hfirst := (poisson_natCast_memLp_two rate).integrable (by norm_num) rw [show (fun n : ℕ => (n : ℝ) * ((n : ℝ) - 1)) = (fun n : ℕ => (n : ℝ) ^ 2 - (n : ℝ)) by funext n ring] exact hsq.sub hfirst -
integrable_poisson_count_sqtheorem — Under a Poisson law with nonnegative rate, the squared count is integrable.Proof (Lean source)
theorem integrable_poisson_count_sq (rate : ℝ≥0) : Integrable (fun n : ℕ => (n : ℝ) ^ 2) (poissonMeasure rate) := (poisson_natCast_memLp_two rate).integrable_sq -
poisson_count_second_momenttheorem — Under a Poisson law with nonnegative rate, the expected squared count is its squared rate plus its rate.hypothesesrate :ℝ≥0conclusion(∫ n : ℕ, (n : ℝ) ^ 2 ∂poissonMeasure rate) = (rate : ℝ) ^ 2 + (rate : ℝ)Proof (Lean source)
theorem poisson_count_second_moment (rate : ℝ≥0) : (∫ n : ℕ, (n : ℝ) ^ 2 ∂poissonMeasure rate) = (rate : ℝ) ^ 2 + (rate : ℝ) := by have h : (fun n : ℕ => (n : ℝ) ^ 2) = (fun n : ℕ => (n : ℝ) * ((n : ℝ) - 1) + (n : ℝ)) := by funext n ring rw [h, integral_add (integrable_poisson_ordered_pairs rate) ((poisson_natCast_memLp_two rate).integrable (by norm_num))] rw [poisson_ordered_pairs_second_moment, poisson_count_first_moment]
Series 1 core · 0 supporting An integrable function of each count has a product expectation under two independent scalar Poisson laws. ★ poisson_pair_weighted_tsum_mul
Factoring the two independent Poisson count series
An integrable function of each count has a product expectation under two independent scalar Poisson laws. The iterated count series uses the weights that occur in the finite-sample count-mixture formula.
Given two nonnegative Poisson rates, two scalar count functions, and their integrability under the respective Poisson laws, the weighted double count series factors into their two expectations.