Stat.Finite­Rao­Blackwell.Poisson.Finite­Partition.Nested­Event­Moment

The fixed-count identity is mixed over the Poisson sample size to give a total, division-free joint factorial moment.

Nested­Event­Moment 1 core · 2 supporting The fixed-count identity is mixed over the Poisson sample size to give a total, division-free joint factorial moment. ★ finitePoisson_nestedEvent_factorialMoment

Nested-event factorial moment of a finite Poisson sample

The fixed-count identity is mixed over the Poisson sample size to give a total, division-free joint factorial moment. A positive-mass corollary expresses the same identity as a conditional-mean proportion of the larger-event moment.

theorem finitePoisson_nestedEvent_factorialMoment reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

Under an observation probability law, a Poisson intensity, two events with measurable membership and the first contained in the second, and an order with positive order, the expectation, under the finite Poisson sample law, of the smaller-event count times the falling factorial of order one less than the given order of the larger-event count minus one equals the intensity raised to the order, times the smaller-event probability, times the larger-event probability raised to the order minus one.

Formal statement
X :
Type u_1
shared
lam :
ℝ≥0
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
v :
ℕ
hv :
1 ≤ v
(∫ s, weightedFactorial A B v s ∂finitePoissonSampleLaw P lam)
= (lam : ℝ) ^ v * (P A).toReal * (P B).toReal ^ (v - 1)
Proof (Lean source)
theorem finitePoisson_nestedEvent_factorialMoment (P : Measure X) [IsProbabilityMeasure P] (lam : ℝ≥0) (A B : Set X) (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (v : ℕ) (hv : 1 ≤ v) : (∫ s, weightedFactorial A B v s ∂finitePoissonSampleLaw P lam) = (lam : ℝ) ^ v * (P A).toReal * (P B).toReal ^ (v - 1) := by /- Disintegrate along the measurable sample count. On fibre n, use integral_weightedFactorial_countFibre. The resulting Poisson sum is the scalar descFactorial moment. The integrability lemma licenses countable integral interchange. -/ let μ := finitePoissonSampleLaw P lam let S : ℕ → Set (FiniteSample X) := fun n => FiniteSample.count ⁻¹' ({n} : Set ℕ) have hdis : Pairwise (onFun Disjoint S) := by intro i j hij apply Set.disjoint_left.mpr intro s hi hj exact hij (hi.symm.trans hj) have hcover : (⋃ n, S n) = univ := by ext s simp [S] have hsum : μ = Measure.sum (fun n => μ.restrict (S n)) := by calc μ = μ.restrict univ := (Measure.restrict_univ).symm _ = μ.restrict (⋃ n, S n) := by rw [hcover] _ = Measure.sum (fun n => μ.restrict (S n)) := Measure.restrict_iUnion hdis (fun n => measurable_finiteSample_count (MeasurableSet.singleton n)) have hf : Integrable (weightedFactorial A B v) μ := integrable_weightedFactorial P lam A B hA hB hAB v hv have hscalar : Integrable (fun n : ℕ => (n.descFactorial v : ℝ)) (poissonMeasure lam) := Causalean.Stat.Concentration.Poisson.poisson_descFactorial_integrable lam v have hs : Summable (fun n : ℕ => ((poissonMeasure lam) {n}).toReal * (n.descFactorial v : ℝ)) := by rw [← Measure.sum_smul_dirac (poissonMeasure lam)] at hscalar simpa using hscalar.summable_of_dirac calc (∫ s, weightedFactorial A B v s ∂μ) = ∑' n, ∫ s, weightedFactorial A B v s ∂μ.restrict (S n) := by conv_lhs => rw [hsum] exact integral_sum_measure (hsum ▸ hf) _ = ∑' n, (((poissonMeasure lam) {n}).toReal * (n.descFactorial v : ℝ)) * ((P A).toReal * (P B).toReal ^ (v - 1)) := by congr 1 funext n rw [integral_weightedFactorial_countFibre P lam A B hA hB hAB v n hv] ring _ = (∑' n, ((poissonMeasure lam) {n}).toReal * (n.descFactorial v : ℝ)) * ((P A).toReal * (P B).toReal ^ (v - 1)) := hs.tsum_mul_right _ _ = (lam : ℝ) ^ v * (P A).toReal * (P B).toReal ^ (v - 1) := by have hm := poisson_descFactorial_moment lam v rw [integral_countable hscalar] at hm have hseries : (∑' n, ((poissonMeasure lam) {n}).toReal * (n.descFactorial v : ℝ)) = (lam : ℝ) ^ v := by simpa only [measureReal_def, smul_eq_mul] using hm rw [hseries] ring
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.finitePoisson_nestedEvent_factorialMoment · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment.lean:53 · uses FiniteSample , finitePoissonSampleLaw , weightedFactorial
2 supporting declarations (lemmas, instances)
Basic 4 core · 0 supporting This module defines event counts in a finite sample and a weighted falling factorial. ★ weightedFactorial_eq_injectiveTupleSum

Counts of nested events and their ordered-tuple expansion

This module defines event counts in a finite sample and a weighted falling factorial. The key combinatorial statement expands that statistic as a sum over injective ordered tuples, with the first point in the smaller event and every remaining point in the larger event.

def eventCount reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

A finite sample and an event determine the event count, given by the number of sample positions whose observation lies in the event.

Definition (Lean source)
X :
Type u_1
shared
s :
A :
Set X
eventCount s A :
ℕ
by classical exact (Finset.univ.filter fun i : Fin s.count => s.points i ∈ A).card
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment/Basic.lean:25 · uses FiniteSample
def weightedFactorial reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

Two events, an order, and a finite sample determine the weighted nested-event factorial count, given by the count of the first event times the falling factorial, of order one less than the given order, of the count of the second event minus one. Both subtractions are natural-number subtractions truncated at zero, so order zero is treated like order one and an empty second-event count is treated like a count of one.

Definition (Lean source)
X :
Type u_1
shared
A B :
Set X
v :
ℕ
s :
weightedFactorial A B v s :
ℝ
(eventCount s A : ℝ) * ((eventCount s B - 1).descFactorial (v - 1) : ℝ)
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.weightedFactorial · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment/Basic.lean:31 · uses FiniteSample
def nestedEventKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

Two events, an order with positive order, and an ordered observation tuple determine the nested-event kernel, given by one when its first observation is in the first event and all remaining observations are in the second event, and zero otherwise.

Definition (Lean source)
X :
Type u_1
shared
A B :
Set X
v :
ℕ
hv :
1 ≤ v
x :
Fin v → X
nestedEventKernel A B v hv x :
ℝ
by classical exact if x ⟨0, hv⟩ ∈ A ∧ ∀ j : Fin v, j.val ≠ 0 → x j ∈ B then 1 else 0
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.nestedEventKernel · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment/Basic.lean:41
theorem weightedFactorial_eq_injectiveTupleSum reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

Given two events with the first contained in the second, an order with positive order, a sample size, and fixed observations, the weighted nested-event factorial equals the sum of the nested-event kernel over injective ordered position tuples.

Formal statement
X :
Type u_1
shared
A B :
Set X
hAB :
A ⊆ B
v n :
ℕ
hv :
1 ≤ v
x :
Fin n → X
= ∑ t ∈ injectiveTuples v n, nestedEventKernel A B v hv (fun j => x (t j))
Proof (Lean source)
theorem weightedFactorial_eq_injectiveTupleSum (A B : Set X) (hAB : A ⊆ B) (v n : ℕ) (hv : 1 ≤ v) (x : Fin n → X) : weightedFactorial A B v (fixedSizeEmbed n x) = ∑ t ∈ injectiveTuples v n, nestedEventKernel A B v hv (fun j => x (t j)) := by classical cases v with | zero => omega | succ k => let sA : Finset (Fin n) := Finset.univ.filter (fun i => x i ∈ A) let sB : Finset (Fin n) := Finset.univ.filter (fun i => x i ∈ B) have htail (t : Fin (k + 1) → Fin n) : (∀ j : Fin (k + 1), j.val ≠ 0 → x (t j) ∈ B) ↔ ∀ j : Fin k, x (t j.succ) ∈ B := by constructor · intro h j exact h j.succ (by simp) · intro h j hj induction j using Fin.cases with | zero => exact False.elim (hj rfl) | succ a => exact h a have hinner (i : Fin n) : (∑ t ∈ (injectiveTuples (k + 1) n).filter (fun t => t 0 = i), nestedEventKernel A B (k + 1) hv (fun j => x (t j))) = if x i ∈ A then ((sB.card - 1).descFactorial k : ℝ) else 0 := by by_cases hiA : x i ∈ A · have hiB : i ∈ sB := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hAB hiA⟩ simp only [hiA, ite_true] have hpoint : ∀ t ∈ (injectiveTuples (k + 1) n).filter (fun t => t 0 = i), nestedEventKernel A B (k + 1) hv (fun j => x (t j)) = if ∀ j : Fin k, x (t j.succ) ∈ B then 1 else 0 := by intro t ht have hfirst : t 0 = i := (Finset.mem_filter.mp ht).2 change (if x (t 0) ∈ A ∧ (∀ j : Fin (k + 1), j.val ≠ 0 → x (t j) ∈ B) then (1 : ℝ) else 0) = _ simp only [hfirst, hiA, true_and, htail] rw [Finset.sum_congr rfl hpoint] rw [Finset.sum_boole] have hfilt : ((injectiveTuples (k + 1) n).filter (fun t => t 0 = i)).filter (fun t => ∀ j : Fin k, x (t j.succ) ∈ B) = (injectiveTuples (k + 1) n).filter (fun t => t 0 = i ∧ ∀ j : Fin k, t j.succ ∈ sB) := by ext t simp [sB, Finset.filter_filter] rw [hfilt, card_injectiveTuples_first k n sB i hiB] · simp only [hiA, ite_false] apply Finset.sum_eq_zero intro t ht have hfirst : t 0 = i := (Finset.mem_filter.mp ht).2 simp [nestedEventKernel, hfirst, hiA] have hsum : (∑ t ∈ injectiveTuples (k + 1) n, nestedEventKernel A B (k + 1) hv (fun j => x (t j))) = ∑ i : Fin n, if x i ∈ A then ((sB.card - 1).descFactorial k : ℝ) else 0 := by calc _ = ∑ i : Fin n, ∑ t ∈ (injectiveTuples (k + 1) n).filter (fun t => t 0 = i), nestedEventKernel A B (k + 1) hv (fun j => x (t j)) := (Finset.sum_fiberwise (injectiveTuples (k + 1) n) (fun t => t 0) (fun t => nestedEventKernel A B (k + 1) hv (fun j => x (t j)))).symm _ = _ := by simp only [hinner] rw [hsum] change (sA.card : ℝ) * ((sB.card - 1).descFactorial k : ℝ) = ∑ i : Fin n, if x i ∈ A then ((sB.card - 1).descFactorial k : ℝ) else 0 rw [← Finset.sum_filter] change (sA.card : ℝ) * ((sB.card - 1).descFactorial k : ℝ) = ∑ _i ∈ sA, ((sB.card - 1).descFactorial k : ℝ) simp
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.weightedFactorial_eq_injectiveTupleSum · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment/Basic.lean:124 · uses fixedSizeEmbed , nestedEventKernel , weightedFactorial , injectiveTuples
Envelope 1 core · 2 supporting These lemmas provide the pointwise and measurable envelope needed to integrate weighted factorial counts under a finite Poisson sample law. ★ weightedFactorial_nonneg_le_countFactorial

Measurability and scalar bound for nested-event counts

These lemmas provide the pointwise and measurable envelope needed to integrate weighted factorial counts under a finite Poisson sample law.

theorem weightedFactorial_nonneg_le_countFactorial reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

Two events with the first contained in the second, an order with positive order, and a finite sample have a nonnegative weighted factorial count bounded by the sample-size falling factorial.

Formal statement
X :
Type u_1
shared
A B :
Set X
hAB :
A ⊆ B
v :
ℕ
hv :
1 ≤ v
s :
conclusion 1
0 ≤ weightedFactorial A B v s
conclusion 2
weightedFactorial A B v s ≤ (s.count.descFactorial v : ℝ)
Proof (Lean source)
theorem weightedFactorial_nonneg_le_countFactorial (A B : Set X) (hAB : A ⊆ B) (v : ℕ) (hv : 1 ≤ v) (s : FiniteSample X) : 0 ≤ weightedFactorial A B v s ∧ weightedFactorial A B v s ≤ (s.count.descFactorial v : ℝ) := by classical rcases s with ⟨n, x⟩ change 0 ≤ weightedFactorial A B v (fixedSizeEmbed n x) ∧ weightedFactorial A B v (fixedSizeEmbed n x) ≤ (n.descFactorial v : ℝ) rw [weightedFactorial_eq_injectiveTupleSum A B hAB v n hv x] have hkernel (t : Fin v → Fin n) : 0 ≤ nestedEventKernel A B v hv (fun j => x (t j)) ∧ nestedEventKernel A B v hv (fun j => x (t j)) ≤ 1 := by unfold nestedEventKernel split_ifs <;> norm_num constructor · exact Finset.sum_nonneg fun t ht => hkernel t |>.1 · calc (∑ t ∈ injectiveTuples v n, nestedEventKernel A B v hv (fun j => x (t j))) ≤ ∑ _t ∈ injectiveTuples v n, (1 : ℝ) := by apply Finset.sum_le_sum intro t ht exact (hkernel t).2 _ = (n.descFactorial v : ℝ) := by simp [injectiveTuples_card_eq_descFactorial]
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.weightedFactorial_nonneg_le_countFactorial · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment/Envelope.lean:63 · uses FiniteSample , count , weightedFactorial
2 supporting declarations (lemmas, instances)
Fibre 1 core · 0 supporting The fixed-count iid identity is transported to each count fibre of the finite Poisson sample law. ★ integral_weightedFactorial_countFibre

Exact-count fibres for nested-event factorial moments

The fixed-count iid identity is transported to each count fibre of the finite Poisson sample law. The result is total at zero Poisson mass and zero event mass.

theorem integral_weightedFactorial_countFibre reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

Under an observation probability law, a Poisson intensity, two events with measurable membership and the first contained in the second, an order with positive order, and a sample-size fibre, the integral of the weighted nested-event factorial over the samples of exactly that size, under the finite Poisson sample law, equals the Poisson probability of that size times the falling factorial of the size of the given order, times the smaller-event probability, times the larger-event probability raised to the order minus one.

Formal statement
X :
Type u_1
shared
lam :
ℝ≥0
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
v n :
ℕ
hv :
1 ≤ v
(∫ s, weightedFactorial A B v s ∂ (finitePoissonSampleLaw P lam).restrict (FiniteSample.count ⁻¹' ({n} : Set ℕ)))
= ((poissonMeasure lam) ({n} : Set ℕ)).toReal * (n.descFactorial v : ℝ) * (P A).toReal * (P B).toReal ^ (v - 1)
Proof (Lean source)
theorem integral_weightedFactorial_countFibre (P : Measure X) [IsProbabilityMeasure P] (lam : ℝ≥0) (A B : Set X) (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (v n : ℕ) (hv : 1 ≤ v) : (∫ s, weightedFactorial A B v s ∂ (finitePoissonSampleLaw P lam).restrict (FiniteSample.count ⁻¹' ({n} : Set ℕ))) = ((poissonMeasure lam) ({n} : Set ℕ)).toReal * (n.descFactorial v : ℝ) * (P A).toReal * (P B).toReal ^ (v - 1) := by rw [finitePoissonSampleLaw_restrict_count_eq, integral_smul_measure] rw [integral_map (measurable_fixedSizeEmbed n).aemeasurable (measurable_weightedFactorial A B hA hB v).aestronglyMeasurable] rw [integral_weightedFactorial_fixedCount P A B hA hB hAB v n hv] simp only [smul_eq_mul] ring
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.integral_weightedFactorial_countFibre · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment/Fibre.lean:23 · uses FiniteSample , count , finitePoissonSampleLaw , weightedFactorial
Fixed­Count 1 core · 3 supporting This module evaluates the ordered event kernel under a product probability law and then evaluates the weighted nested-event statistic on each fixed-size iid sample fibre. ★ integral_weightedFactorial_fixedCount

Fixed-count iid nested-event factorial moment

This module evaluates the ordered event kernel under a product probability law and then evaluates the weighted nested-event statistic on each fixed-size iid sample fibre.

theorem integral_weightedFactorial_fixedCount reviewed
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment

Under an observation probability law, two events with measurable membership and the first contained in the second, an order with positive order, and a fixed sample size, the iid mean of the weighted nested-event factorial equals the falling factorial of the sample size of the given order, times the smaller-event probability, times the larger-event probability raised to the order minus one.

Formal statement
X :
Type u_1
shared
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
v n :
ℕ
hv :
1 ≤ v
(∫ x : Fin n → X, weightedFactorial A B v (fixedSizeEmbed n x) ∂Measure.pi (fun _ : Fin n => P))
= (n.descFactorial v : ℝ) * (P A).toReal * (P B).toReal ^ (v - 1)
Proof (Lean source)
theorem integral_weightedFactorial_fixedCount (P : Measure X) [IsProbabilityMeasure P] (A B : Set X) (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (v n : ℕ) (hv : 1 ≤ v) : (∫ x : Fin n → X, weightedFactorial A B v (fixedSizeEmbed n x) ∂Measure.pi (fun _ : Fin n => P)) = (n.descFactorial v : ℝ) * (P A).toReal * (P B).toReal ^ (v - 1) := by /- Rewrite by weightedFactorial_eq_injectiveTupleSum. For each injective t : Fin v → Fin n, the coordinate projection x ↦ fun j => x (t j) pushes the finite product law P^n to P^v. Prove this using `iIndepFun_pi` and `iIndepFun_iff_map_fun_eq_pi_map` (or a finite-product marginal theorem); then transfer integrability and the kernel integral. Sum over injectiveTuples and use injectiveTuples_card_eq_descFactorial. This also handles n < v because the tuple finset is empty and n.descFactorial v = 0. The IIDSample theorem in OrderM.Variance is a useful analogue but its sample interface is indexed by ℕ, unlike this finite product fibre. -/ classical let μ : Measure (Fin n → X) := Measure.pi (fun _ : Fin n => P) let ν : Measure (Fin v → X) := Measure.pi (fun _ : Fin v => P) let f (t : Fin v → Fin n) (x : Fin n → X) : Fin v → X := fun j => x (t j) have hproj (t : Fin v → Fin n) (ht : Injective t) : μ.map (f t) = ν := by have hind : iIndepFun (fun j : Fin v => Function.eval (t j)) μ := (iIndepFun_pi (X := fun _ : Fin n => id) (fun _ => measurable_id.aemeasurable)).precomp ht have hmap := (iIndepFun_iff_map_fun_eq_pi_map (fun j : Fin v => (measurable_pi_apply (t j)).aemeasurable)).mp hind calc μ.map (f t) = Measure.pi (fun j : Fin v => μ.map (Function.eval (t j))) := hmap _ = ν := by congr 1 funext j exact (measurePreserving_eval (fun _ : Fin n => P) (t j)).map_eq have hterm (t : Fin v → Fin n) (ht : t ∈ injectiveTuples v n) : (∫ x : Fin n → X, nestedEventKernel A B v hv (f t x) ∂μ) = (P A).toReal * (P B).toReal ^ (v - 1) := by have hti : Injective t := by simpa [injectiveTuples] using ht have hm : Measurable (f t) := measurable_pi_lambda _ (fun j => measurable_pi_apply (t j)) have hk := (integrable_nestedEventKernel P A B hA hB v hv).aestronglyMeasurable calc _ = ∫ y : Fin v → X, nestedEventKernel A B v hv y ∂(μ.map (f t)) := (integral_map hm.aemeasurable (by simpa [hproj t hti, ν] using hk)).symm _ = _ := by rw [hproj t hti]; exact integral_nestedEventKernel P A B hA hB v hv rw [show (fun x : Fin n → X => weightedFactorial A B v (fixedSizeEmbed n x)) = (fun x => ∑ t ∈ injectiveTuples v n, nestedEventKernel A B v hv (f t x)) by funext x exact weightedFactorial_eq_injectiveTupleSum A B hAB v n hv x] rw [integral_finsetSum] · have hsum : (∑ t ∈ injectiveTuples v n, ∫ x : Fin n → X, nestedEventKernel A B v hv (f t x) ∂μ) = ∑ t ∈ injectiveTuples v n, (P A).toReal * (P B).toReal ^ (v - 1) := by apply Finset.sum_congr rfl intro t ht exact hterm t ht rw [show Measure.pi (fun _ : Fin n => P) = μ by rfl, hsum] simp only [Finset.sum_const, nsmul_eq_mul] rw [injectiveTuples_card_eq_descFactorial] ring · intro t ht have hti : Injective t := by simpa [injectiveTuples] using ht have hm : Measurable (f t) := measurable_pi_lambda _ (fun j => measurable_pi_apply (t j)) have hk := integrable_nestedEventKernel P A B hA hB v hv have hkmap : Integrable (nestedEventKernel A B v hv) (μ.map (f t)) := by rw [hproj t hti] exact hk exact (integrable_map_measure hkmap.aestronglyMeasurable hm.aemeasurable).mp hkmap
Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.integral_weightedFactorial_fixedCount · Causalean/Stat/FiniteRaoBlackwell/Poisson/FinitePartition/NestedEventMoment/FixedCount.lean:144 · uses fixedSizeEmbed , weightedFactorial
3 supporting declarations (lemmas, instances)