Stat.Sample.FiniteStratumMarkedRatioMse
This module collects totalized finite-stratum arm means, their fixed-set population targets and missing-arm decompositions, exact missing-count moments, and boundary-safe mean-squared-error bounds for real square-integra
Basic 23 core · 7 supporting This module defines zero-safe empirical arm means, their occupancy-weighted fixed-set scores, the corresponding population quantities, and the exact centered-noise/mass-fluctuation/missing-arm decomposition. ★ fixedStratumArmScore_sub_centerTarget_decomposition
Fixed finite-stratum marked ratio statistics
This module defines zero-safe empirical arm means, their occupancy-weighted fixed-set scores, the corresponding population quantities, and the exact centered-noise/mass-fluctuation/missing-arm decomposition. Empty samples, empty cells, and zero population cell masses are totalized by the definitions.
For a nonnegative integer sample size, the safe real sample size is one when the sample is empty and otherwise equals the ordinary sample size.
For a category-label function, a Boolean arm-label function, a finite sample, an arm value, and a category, the empirical arm--category count is the number of sample coordinates having both specified labels.
For a category-label function, a Boolean arm-label function, a finite sample, and a category, the empirical category count is the number of sample coordinates in that category across both arm values.
Definition (Lean source)
For a category-label function, a Boolean arm-label function, an arm value, and a category, the arm--category event is the set of observations with both requested labels.
Definition (Lean source)
For a category-label function and a category, the category event is the set of observations assigned that category.
Definition (Lean source)
For a measure on the observation space, a category-label function, and a category, the population category mass is the real-valued measure of the category event.
Definition (Lean source)
For a measure on the observation space, a category-label function, a Boolean arm-label function, an arm value, and a category, the population arm--category mass is the real-valued measure of their joint-label event.
For a category-label function, a Boolean arm-label function, a real-valued mark, an arm value, and a category, the supported arm mark equals the mark on the corresponding arm--category event and zero outside it.
For a category-label function, a Boolean arm-label function, a real-valued mark, a finite sample, an arm value, and a category, the empirical arm--category mark sum is the sum of supported marks over all sample coordinates.
For a category-label function, a Boolean arm-label function, a real-valued mark, a finite sample, an arm value, and a category, the totalized empirical arm mean is the arm--category mark sum divided by its count when that count is positive, and zero otherwise.
Definition (Lean source)
For a measure on the observation space, a category-label function, a Boolean arm-label function, a real-valued mark, an arm value, and a category, the population arm--category mean is the mark integral over that cell divided by its positive mass, and zero when its mass is zero.
Definition (Lean source)
For a category-label function, a Boolean arm-label function, a real-valued mark, a finite set of categories, an arm value, and a finite sample, the fixed-stratum arm score is the sum of totalized arm means weighted by empirical category occupancy divided by the nominal sample size.
For a category-label function, a Boolean arm-label function, a real-valued mark, a finite set of categories, and a finite sample, the fixed-stratum marked ratio is the fixed-stratum arm score for the true arm minus that for the false arm.
For a measure on the observation space, a category-label function, a Boolean arm-label function, a real-valued mark, a finite set of categories, and an arm value, the fixed-stratum arm target is the sum of population arm--category means weighted by population category masses.
Definition (Lean source)
For a measure on the observation space, a category-label function, a Boolean arm-label function, a real-valued mark, and a finite set of categories, the fixed-stratum marked target is the true-arm target minus the false-arm target.
For a measure on the observation space, a category-label function, a finite set of categories, an arm-and-category center function, and an arm value, the fixed-stratum arm center target is the sum of category masses multiplied by the corresponding supplied centers.
For a category-label function, a Boolean arm-label function, a real-valued mark, an arm-and-category center function, an arm value, and a category, the supported arm residual is the mark minus its supplied cell center on that cell and zero outside it.
Definition (Lean source)
For a category-label function, a Boolean arm-label function, a real-valued mark, an arm-and-category center function, a finite sample, an arm value, and a category, the totalized empirical residual mean is zero for an empty arm--category cell and otherwise averages its supported centered residuals.
Definition (Lean source)
For a category-label function, a Boolean arm-label function, a finite sample, an arm value, and a category, the missing-arm count is the category occupancy when the requested arm--category count is zero, and zero otherwise.
Definition (Lean source)
For a category-label function, a Boolean arm-label function, a real-valued mark, an arm-and-category center function, a finite set of categories, an arm value, and a finite sample, the fixed-stratum arm centered noise is the occupancy-weighted sum of totalized cell residual means.
Definition (Lean source)
For a category-label function, a Boolean arm-label function, an arm-and-category center function, a finite set of categories, an arm value, and a finite sample, the fixed-stratum arm missing remainder is the nominal-sample-size-normalized sum of cell centers times category occupancies whose requested arm is absent.
For a measure on the observation space, a category-label function, a Boolean arm-label function, an arm-and-category center function, a finite set of categories, an arm value, and a finite sample, the fixed-stratum arm mass fluctuation is the sum of each center multiplied by empirical category occupancy divided by nominal sample size minus population category mass.
The single-arm empirical score error around a supplied center target is exactly centered ratio noise plus empirical-mass fluctuation minus the explicit missing-arm remainder.
Formal statement
Proof (Lean source)
7 supporting declarations (lemmas, instances)
-
measurable_categoryArmCounttheorem — Measurable group and arm labels make every fixed empirical arm/category count measurable on the product sample space.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :group :Omega → kappaarm :Omega → Boolhgroup :Measurable groupharm :Measurable arma :k :kappaconclusionProof (Lean source)
@[fun_prop] theorem measurable_categoryArmCount {m : Nat} (group : Omega → kappa) (arm : Omega → Bool) (hgroup : Measurable group) (harm : Measurable arm) (a : Bool) (k : kappa) : Measurable (fun z : Fin m → Omega => categoryArmCount group arm z a k) := by exact measurable_groupArmCount group arm hgroup harm a k -
measurable_categoryCounttheorem — Measurable group and arm labels make every fixed empirical category count measurable on the product sample space.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :group :Omega → kappaarm :Omega → Boolhgroup :Measurable groupharm :Measurable armk :kappaconclusionProof (Lean source)
@[fun_prop] theorem measurable_categoryCount {m : Nat} (group : Omega → kappa) (arm : Omega → Bool) (hgroup : Measurable group) (harm : Measurable arm) (k : kappa) : Measurable (fun z : Fin m → Omega => categoryCount group arm z k) := by exact measurable_groupCount group arm hgroup harm k -
measurable_armMarkSumtheorem — Measurable group and arm labels and a measurable mark make every empirical arm/category mark sum measurable.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :group :Omega → kappaarm :Omega → BoolY :Omega → Realhgroup :Measurable groupharm :Measurable armhY :a :k :kappaconclusionProof (Lean source)
@[fun_prop] theorem measurable_armMarkSum {m : Nat} (group : Omega → kappa) (arm : Omega → Bool) (Y : Omega → Real) (hgroup : Measurable group) (harm : Measurable arm) (hY : Measurable Y) (a : Bool) (k : kappa) : Measurable (fun z : Fin m → Omega => armMarkSum group arm Y z a k) := by classical unfold armMarkSum supportedArmMark apply measurable_sum intro i hi exact (hY.indicator (measurableSet_armGroupEvent group arm hgroup harm a k)).comp (measurable_pi_apply i : Measurable fun z : Fin m → Omega => z i) -
measurable_totalizedArmMeantheorem — Measurable group and arm labels and a measurable mark make every totalized empirical arm/category mark mean measurable, including at zero count.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :group :Omega → kappaarm :Omega → BoolY :Omega → Realhgroup :Measurable groupharm :Measurable armhY :a :k :kappaconclusionProof (Lean source)
@[fun_prop] theorem measurable_totalizedArmMean {m : Nat} (group : Omega → kappa) (arm : Omega → Bool) (Y : Omega → Real) (hgroup : Measurable group) (harm : Measurable arm) (hY : Measurable Y) (a : Bool) (k : kappa) : Measurable (fun z : Fin m → Omega => totalizedArmMean group arm Y z a k) := by have hcount := measurable_categoryArmCount (m := m) group arm hgroup harm a k have hpos : MeasurableSet {z : Fin m → Omega | 0 < categoryArmCount group arm z a k} := measurableSet_lt measurable_const hcount have hcast : Measurable (fun z : Fin m → Omega => (categoryArmCount group arm z a k : Real)) := (Measurable.of_discrete : Measurable fun n : Nat => (n : Real)).comp hcount unfold totalizedArmMean exact Measurable.ite hpos (hcast.inv.mul (measurable_armMarkSum group arm Y hgroup harm hY a k)) measurable_const -
measurable_fixedStratumMarkedRatiotheorem — Measurable group and arm labels and a measurable mark make the fixed-set marked ratio score measurable.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :group :Omega → kappaarm :Omega → BoolY :Omega → RealH :Finset kappahgroup :Measurable groupharm :Measurable armhY :conclusionMeasurable (fixedStratumMarkedRatio (m := m) group arm Y H)Proof (Lean source)
@[fun_prop] theorem measurable_fixedStratumMarkedRatio {m : Nat} (group : Omega → kappa) (arm : Omega → Bool) (Y : Omega → Real) (H : Finset kappa) (hgroup : Measurable group) (harm : Measurable arm) (hY : Measurable Y) : Measurable (fixedStratumMarkedRatio (m := m) group arm Y H) := by classical have harmScore : ∀ a : Bool, Measurable (fixedStratumArmScore (m := m) group arm Y H a) := by intro a unfold fixedStratumArmScore apply measurable_sum intro k hk have hcount := measurable_categoryCount (m := m) group arm hgroup harm k have hcast : Measurable (fun z : Fin m → Omega => (categoryCount group arm z k : Real)) := (Measurable.of_discrete : Measurable fun n : Nat => (n : Real)).comp hcount exact (hcast.div_const (m : Real)).mul (measurable_totalizedArmMean group arm Y hgroup harm hY a k) unfold fixedStratumMarkedRatio exact (harmScore true).sub (harmScore false) -
measurable_missingArmCounttheorem — Measurable group and arm labels make each missing-arm category count measurable.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :group :Omega → kappaarm :Omega → Boolhgroup :Measurable groupharm :Measurable arma :k :kappaconclusionProof (Lean source)
@[fun_prop] theorem measurable_missingArmCount {m : Nat} (group : Omega → kappa) (arm : Omega → Bool) (hgroup : Measurable group) (harm : Measurable arm) (a : Bool) (k : kappa) : Measurable (fun z : Fin m → Omega => missingArmCount group arm z a k) := by have harmCount := measurable_categoryArmCount (m := m) group arm hgroup harm a k have hzero : MeasurableSet {z : Fin m → Omega | categoryArmCount group arm z a k = 0} := measurableSet_eq_fun harmCount measurable_const unfold missingArmCount exact Measurable.ite hzero (measurable_categoryCount (m := m) group arm hgroup harm k) measurable_const -
fixedStratumArmCenterTarget_eq_targettheorem — Measurable group and arm labels, square-integrable supported residuals, cellwise residual centering, and positive arm mass in every selected positive-mass category ensure that the center-weighted target equals the population arm target.hypothesesOmega :sharedType u_1kappa :sharedType u_2mu :Measure Omegagroup :Omega → kappaarm :Omega → BoolY :Omega → RealH :Finset kappaa :hgroup :Measurable groupharm :Measurable armhmem :∀ k, MemLp (supportedArmResidual group arm Y center a k) 2 muhcenter :∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ∂mu = 0hpositive :∀ k ∈ Hif0 < categoryMass mu group kthen0 < armCategoryMass mu group arm a kconclusionfixedStratumArmCenterTarget mu group H center a = fixedStratumArmTarget mu group arm Y H aProof (Lean source)
theorem fixedStratumArmCenterTarget_eq_target (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (Y : Omega → Real) (center : Bool → kappa → Real) (H : Finset kappa) (a : Bool) (hgroup : Measurable group) (harm : Measurable arm) (hmem : ∀ k, MemLp (supportedArmResidual group arm Y center a k) 2 mu) (hcenter : ∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ∂mu = 0) (hpositive : ∀ k ∈ H, 0 < categoryMass mu group k → 0 < armCategoryMass mu group arm a k) : fixedStratumArmCenterTarget mu group H center a = fixedStratumArmTarget mu group arm Y H a := by classical unfold fixedStratumArmCenterTarget fixedStratumArmTarget apply Finset.sum_congr rfl intro k hk by_cases hp : 0 < categoryMass mu group k · have hq := hpositive k hk hp have hcell : MeasurableSet (armCategoryEvent group arm a k) := Causalean.Stat.measurableSet_armGroupEvent group arm hgroup harm a k have hres : IntegrableOn (fun omega ↦ Y omega - center a k) (armCategoryEvent group arm a k) mu := by apply (integrable_indicator_iff hcell).mp change Integrable (supportedArmResidual group arm Y center a k) mu exact (hmem k).integrable (by norm_num) have hYint : IntegrableOn Y (armCategoryEvent group arm a k) mu := by have := hres.add (integrableOn_const (C := center a k)) exact this.congr (Filter.Eventually.of_forall fun omega ↦ sub_add_cancel _ _) have heq : ∫ omega in armCategoryEvent group arm a k, Y omega ∂mu = armCategoryMass mu group arm a k * center a k := by have hz := hcenter k rw [integral_sub hYint (integrableOn_const (C := center a k)), setIntegral_const] at hz change (∫ omega in armCategoryEvent group arm a k, Y omega ∂mu) - armCategoryMass mu group arm a k * center a k = 0 at hz linarith unfold populationArmMean rw [if_pos hq, heq] field_simp [hq.ne'] · have hp0 : categoryMass mu group k = 0 := le_antisymm (le_of_not_gt hp) ENNReal.toReal_nonneg rw [hp0] simp
MissingMoments 3 core · 4 supporting This module computes the first, second, and cross moments of category occupancy on an empty empirical arm. ★ integral_missingArmCount_sq_eq
Missing-arm moments for finite-stratum samples
This module computes the first, second, and cross moments of category occupancy on an empty empirical arm. It also packages an exponentially damped aggregate envelope and its boundary-safe deterministic lower-mass relaxation.
Measurable group and arm labels imply that the exact second moment of one missing-arm category count is the sum of its one-coordinate diagonal and ordered two-coordinate contributions.
Formal statement
Proof (Lean source)
For a measure on the observation space, a category-label function, a nonnegative integer sample size, a real overlap margin, and a finite set of categories, the missing-arm exponential envelope is the sum, over selected categories, of category mass times the exponential decay determined by the sample size, overlap margin, and that mass.
For a measure on the observation space, a category-label function, a nonnegative integer sample size, a real overlap margin, a real mass lower bound, and a finite set of categories, the lower-mass missing envelope first sets its squared overlap denominator to the squared half-adjusted sample-size overlap margin times the mass lower bound, and then uses the number of selected categories divided by that denominator when it is positive, and their total category mass otherwise. This totalization keeps the envelope defined for small samples, zero overlap, and a zero mass lower bound.
4 supporting declarations (lemmas, instances)
-
integral_missingArmCount_eqtheorem — Measurable group and arm labels imply that the expected category occupancy retained only when one arm is absent equals the sample size times the off-arm category mass times the empty-arm probability for the other coordinates.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → Boolhgroup :Measurable groupharm :Measurable arma :k :kappaconclusion= (m : Real) * (categoryMass mu group k - armCategoryMass mu group arm a k) * (1 - armCategoryMass mu group arm a k) ^ (m - 1)Proof (Lean source)
theorem integral_missingArmCount_eq {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (hgroup : Measurable group) (harm : Measurable arm) (a : Bool) (k : kappa) : ∫ z : Fin m → Omega, (missingArmCount group arm z a k : Real) ∂(Measure.pi (fun _ : Fin m => mu)) = (m : Real) * (categoryMass mu group k - armCategoryMass mu group arm a k) * (1 - armCategoryMass mu group arm a k) ^ (m - 1) := by classical let C := categoryEvent group k let R := armCategoryEvent group arm a k let S := C \ R have hC : MeasurableSet C := Causalean.Stat.measurableSet_groupEvent group hgroup k have hR : MeasurableSet R := Causalean.Stat.measurableSet_armGroupEvent group arm hgroup harm a k have hRC : R ⊆ C := armCategoryEvent_subset_categoryEvent group arm a k have hSR : Disjoint S R := Set.disjoint_sdiff_left rw [show (fun z : Fin m → Omega => (missingArmCount group arm z a k : ℝ)) = fun z => ∑ i : Fin m, (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z by funext z exact missingArmCount_eq_sum_indicator group arm z a k] have hintg (i : Fin m) : Integrable ((oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ))) (Measure.pi (fun _ : Fin m => mu)) := (integrable_const (1 : ℝ)).indicator (measurableSet_oneSelectedAvoidSetEvent i (hC.diff hR) hR) rw [integral_finset_sum univ (fun i _ => hintg i)] have hint (i : Fin m) : ∫ z : Fin m → Omega, (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z ∂(Measure.pi (fun _ : Fin m => mu)) = (Measure.pi (fun _ : Fin m => mu)).real (oneSelectedAvoidSetEvent i S R) := integral_indicator_one (measurableSet_oneSelectedAvoidSetEvent i (hC.diff hR) hR) simp_rw [hint, measureReal_def, measure_oneSelectedAvoidSetEvent mu _ S R hSR] simp only [ENNReal.toReal_mul, ENNReal.toReal_pow, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] have hSreal : (mu S).toReal = categoryMass mu group k - armCategoryMass mu group arm a k := by change mu.real S = mu.real C - mu.real R exact measureReal_sdiff hRC hR have hRcompl : (mu Rᶜ).toReal = 1 - armCategoryMass mu group arm a k := by rw [← measureReal_def, measureReal_compl hR, probReal_univ] rfl rw [hSreal, hRcompl] simp only [Fintype.card_fin] ring -
integral_missingArmCount_mul_eqtheorem — Measurable group and arm labels and distinct categories imply that their missing-arm counts have the exact ordered-pair cross moment obtained by excluding the union of the two arm/category cells.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → Boolhgroup :Measurable groupharm :Measurable arma :k l :kappahkl :k ≠ lconclusion∫ z : Fin m → Omega, (missingArmCount group arm z a k : Real) * (missingArmCount group arm z a l : Real) ∂(Measure.pi (fun _ : Fin m => mu))= (m.descFactorial 2 : Real) * (categoryMass mu group k - armCategoryMass mu group arm a k) * (categoryMass mu group l - armCategoryMass mu group arm a l) * (1 - armCategoryMass mu group arm a k - armCategoryMass mu group arm a l) ^ (m - 2)Proof (Lean source)
theorem integral_missingArmCount_mul_eq {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (hgroup : Measurable group) (harm : Measurable arm) (a : Bool) {k l : kappa} (hkl : k ≠ l) : ∫ z : Fin m → Omega, (missingArmCount group arm z a k : Real) * (missingArmCount group arm z a l : Real) ∂(Measure.pi (fun _ : Fin m => mu)) = (m.descFactorial 2 : Real) * (categoryMass mu group k - armCategoryMass mu group arm a k) * (categoryMass mu group l - armCategoryMass mu group arm a l) * (1 - armCategoryMass mu group arm a k - armCategoryMass mu group arm a l) ^ (m - 2) := by classical let C := categoryEvent group k let D := categoryEvent group l let R := armCategoryEvent group arm a k let Q := armCategoryEvent group arm a l let S := C \ R let T := D \ Q let U := R ∪ Q have hC : MeasurableSet C := Causalean.Stat.measurableSet_groupEvent group hgroup k have hD : MeasurableSet D := Causalean.Stat.measurableSet_groupEvent group hgroup l have hR : MeasurableSet R := Causalean.Stat.measurableSet_armGroupEvent group arm hgroup harm a k have hQ : MeasurableSet Q := Causalean.Stat.measurableSet_armGroupEvent group arm hgroup harm a l have hRC : R ⊆ C := armCategoryEvent_subset_categoryEvent group arm a k have hQD : Q ⊆ D := armCategoryEvent_subset_categoryEvent group arm a l have hCD : Disjoint C D := categoryEvent_disjoint_of_ne group hkl have hRQ : Disjoint R Q := hCD.mono hRC hQD have hSU : Disjoint S U := by rw [Set.disjoint_left] intro omega hS hU rcases hU with hR' | hQ' · exact hS.2 hR' · exact Set.disjoint_left.1 hCD hS.1 (hQD hQ') have hTU : Disjoint T U := by rw [Set.disjoint_left] intro omega hT hU rcases hU with hR' | hQ' · exact Set.disjoint_left.1 hCD (hRC hR') hT.1 · exact hT.2 hQ' rw [show (fun z : Fin m → Omega => (missingArmCount group arm z a k : ℝ) * (missingArmCount group arm z a l : ℝ)) = fun z => ∑ i : Fin m, ∑ j ∈ (Finset.univ : Finset (Fin m)).erase i, (twoSelectedAvoidSetsEvent i j S T U).indicator (fun _ => (1 : ℝ)) z by funext z exact missingArmCount_mul_eq_sum_indicator group arm z a hkl] have hintg (i j : Fin m) : Integrable ((twoSelectedAvoidSetsEvent i j S T U).indicator (fun _ => (1 : ℝ))) (Measure.pi (fun _ : Fin m => mu)) := (integrable_const (1 : ℝ)).indicator (measurableSet_twoSelectedAvoidSetsEvent i j (hC.diff hR) (hD.diff hQ) (hR.union hQ)) rw [integral_finset_sum Finset.univ (fun i _ => integrable_finset_sum ((Finset.univ : Finset (Fin m)).erase i) (fun j _ => hintg i j))] simp_rw [integral_finset_sum ((Finset.univ : Finset (Fin m)).erase _) (fun j _ => hintg _ j)] have hint (i j : Fin m) : ∫ z : Fin m → Omega, (twoSelectedAvoidSetsEvent i j S T U).indicator (fun _ => (1 : ℝ)) z ∂(Measure.pi (fun _ : Fin m => mu)) = (Measure.pi (fun _ : Fin m => mu)).real (twoSelectedAvoidSetsEvent i j S T U) := integral_indicator_one (measurableSet_twoSelectedAvoidSetsEvent i j (hC.diff hR) (hD.diff hQ) (hR.union hQ)) simp_rw [hint, measureReal_def] have hmeasure (i j : Fin m) (hj : j ∈ (Finset.univ : Finset (Fin m)).erase i) : (Measure.pi (fun _ : Fin m => mu)) (twoSelectedAvoidSetsEvent i j S T U) = mu S * mu T * mu (Uᶜ) ^ (m - 2) := measure_twoSelectedAvoidSetsEvent mu i j S T U (Finset.ne_of_mem_erase hj).symm hSU hTU have hcross : (∑ i : Fin m, ∑ j ∈ (Finset.univ : Finset (Fin m)).erase i, ((Measure.pi (fun _ : Fin m => mu)) (twoSelectedAvoidSetsEvent i j S T U)).toReal) = ∑ i : Fin m, ∑ _j ∈ (Finset.univ : Finset (Fin m)).erase i, (mu S * mu T * mu (Uᶜ) ^ (m - 2)).toReal := by apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro j hj rw [hmeasure i j hj] rw [hcross] simp only [ENNReal.toReal_mul, ENNReal.toReal_pow, Finset.sum_const, Finset.card_erase_of_mem, Finset.mem_univ, nsmul_eq_mul, Finset.card_univ] have hdesc : m.descFactorial 2 = m * (m - 1) := by cases m <;> simp [descFactorial, Nat.mul_comm] have hSreal : (mu S).toReal = categoryMass mu group k - armCategoryMass mu group arm a k := by change mu.real S = mu.real C - mu.real R exact measureReal_sdiff hRC hR have hTreal : (mu T).toReal = categoryMass mu group l - armCategoryMass mu group arm a l := by change mu.real T = mu.real D - mu.real Q exact measureReal_sdiff hQD hQ have hUcompl : (mu Uᶜ).toReal = 1 - armCategoryMass mu group arm a k - armCategoryMass mu group arm a l := by rw [← measureReal_def, measureReal_compl (hR.union hQ), probReal_univ, measureReal_union hRQ hQ] change 1 - (armCategoryMass mu group arm a k + armCategoryMass mu group arm a l) = _ ring rw [hSreal, hTreal, hUcompl, hdesc, Nat.cast_mul] simp only [Fintype.card_fin] ring -
missingArmExponentialEnvelope_le_lowerMasstheorem — A measurable group label, a positive overlap margin, and a deterministic lower bound on every selected category mass ensure that the exponential missing-arm envelope is at most the boundary-safe lower-mass envelope.hypothesesOmega :sharedType u_1kappa :sharedType u_2mu :Measure Omegagroup :Omega → kappahgroup :Measurable groupm :epsilon B :H :Finset kappahepsilon :0 < epsilonhp :∀ k ∈ H, B ≤ categoryMass mu group kconclusionmissingArmExponentialEnvelope mu group m epsilon H≤ lowerMassMissingEnvelope mu group m epsilon B HProof (Lean source)
theorem missingArmExponentialEnvelope_le_lowerMass (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (hgroup : Measurable group) (m : Nat) (epsilon B : Real) (H : Finset kappa) (hepsilon : 0 < epsilon) (hp : ∀ k ∈ H, B ≤ categoryMass mu group k) : missingArmExponentialEnvelope mu group m epsilon H ≤ lowerMassMissingEnvelope mu group m epsilon B H := by classical let u : ℝ := ((m - 2 : Nat) : ℝ) / 2 * epsilon let D : ℝ := u ^ 2 * B have hu0 : 0 ≤ u := by dsimp [u] positivity have hp0 (k : kappa) : 0 ≤ categoryMass mu group k := ENNReal.toReal_nonneg unfold missingArmExponentialEnvelope lowerMassMissingEnvelope change (∑ k ∈ H, categoryMass mu group k * exp (-(u * categoryMass mu group k))) ≤ if 0 < D then (H.card : ℝ) / D else ∑ k ∈ H, categoryMass mu group k by_cases hD : 0 < D · rw [if_pos hD] have hBpos : 0 < B := by by_contra hn have hBle : B ≤ 0 := le_of_not_gt hn have hDle : D ≤ 0 := by dsimp [D] exact mul_nonpos_of_nonneg_of_nonpos (sq_nonneg u) hBle exact (not_lt_of_ge hDle) hD have hu_ne : u ≠ 0 := by intro huz simp [D, huz] at hD have hu : 0 < u := lt_of_le_of_ne hu0 (Ne.symm hu_ne) calc (∑ k ∈ H, categoryMass mu group k * exp (-(u * categoryMass mu group k))) ≤ ∑ _k ∈ H, 1 / D := by apply Finset.sum_le_sum intro k hk have hpk : 0 < categoryMass mu group k := hBpos.trans_le (hp k hk) have hut : 0 < u * categoryMass mu group k := mul_pos hu hpk calc categoryMass mu group k * exp (-(u * categoryMass mu group k)) ≤ categoryMass mu group k * ((u * categoryMass mu group k) ^ 2)⁻¹ := by gcongr exact exp_neg_le_inv_sq (u * categoryMass mu group k) hut _ = 1 / (u ^ 2 * categoryMass mu group k) := by field_simp [hu.ne', hpk.ne'] _ ≤ 1 / (u ^ 2 * B) := by apply one_div_le_one_div_of_le · positivity · gcongr exact hp k hk _ = 1 / D := by rfl _ = (H.card : ℝ) / D := by simp [div_eq_mul_inv] · rw [if_neg hD] apply Finset.sum_le_sum intro k hk simpa only [mul_one] using mul_le_mul_of_nonneg_left (Real.exp_le_one_iff.mpr (neg_nonpos.mpr (mul_nonneg hu0 (hp0 k)))) (hp0 k) -
lowerMassMissingEnvelope_eq_of_postheorem — A sample size of at least three, a positive overlap margin, and a positive category-mass lower bound make the boundary-safe lower-mass envelope equal its inverse-polynomial expression.hypothesesOmega :sharedType u_1kappa :sharedType u_2mu :Measure Omegagroup :Omega → kappam :epsilon B :H :Finset kappahm :3 ≤ mhepsilon :0 < epsilonhB :0 < BconclusionlowerMassMissingEnvelope mu group m epsilon B HProof (Lean source)
theorem lowerMassMissingEnvelope_eq_of_pos (mu : Measure Omega) (group : Omega → kappa) {m : Nat} {epsilon B : Real} (H : Finset kappa) (hm : 3 ≤ m) (hepsilon : 0 < epsilon) (hB : 0 < B) : lowerMassMissingEnvelope mu group m epsilon B H = (H.card : Real) / (((((m - 2 : Nat) : Real) / 2 * epsilon) ^ 2) * B) := by unfold lowerMassMissingEnvelope dsimp only rw [if_pos] have hm2 : 0 < m - 2 := by omega positivity
CenteredNoiseBound 1 core · 0 supporting This module proves the fixed-stratum selected-arm centered-noise second-moment bound. ★ integral_fixedStratumArmCenteredNoise_sq_le
Selected-arm centered ratio-noise bound
This module proves the fixed-stratum selected-arm centered-noise second-moment bound. It uses a zero extension on the unselected arm, coordinate orthogonality, and a nested finite-product inverse-count estimate.
Measurable group and arm labels and a measurable mark, square-integrable supported residuals, cellwise residual centering, the stated cellwise second-moment envelope, a positive overlap margin, and arm mass at least that margin times category mass imply that the occupancy-weighted centered ratio noise has second moment at most twice the squared envelope times selected mass, divided by safe sample size and overlap.
Formal statement
Proof (Lean source)
Main 1 core · 5 supporting This module proves square integrability and bounds centered ratio noise, empirical category-mass fluctuation, and the explicit empty-arm remainder. ★ integral_fixedStratumMarkedRatio_error_sq_le
MSE bounds for fixed finite-stratum marked ratios
This module proves square integrability and bounds centered ratio noise, empirical category-mass fluctuation, and the explicit empty-arm remainder. It combines them into single-arm and signed two-arm fixed-set MSE bounds that remain meaningful at every totalized boundary.
Measurable group and arm labels and a measurable mark, square-integrable supported residuals in both arms, cellwise residual centering, the stated residual second-moment envelope, bounded cell centers, a positive overlap margin, both arm masses at least that margin times category mass, and a deterministic lower bound on every selected category mass imply that the treated-minus-control fixed-set score obeys the boundary-safe mean-squared-error bound at the same parametric and missing-arm scale, up to the universal two-arm factor.
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
fixedStratumMarkedRatio_memLp_twotheorem — Measurable group and arm labels and a measurable mark together with finite second moments for every supported residual cell imply finite second moments for the treated-minus-control fixed-set score.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → BoolY :Omega → RealH :Finset kappahgroup :Measurable groupharm :Measurable armhY :hmem :∀ a k, MemLp (supportedArmResidual group arm Y center a k) 2 muconclusionProof (Lean source)
theorem fixedStratumMarkedRatio_memLp_two {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (Y : Omega → Real) (center : Bool → kappa → Real) (H : Finset kappa) (hgroup : Measurable group) (harm : Measurable arm) (hY : Measurable Y) (hmem : ∀ a k, MemLp (supportedArmResidual group arm Y center a k) 2 mu) : MemLp (fixedStratumMarkedRatio (m := m) group arm Y H) 2 (Measure.pi (fun _ : Fin m => mu)) := by classical have hmark (a : Bool) (k : kappa) : MemLp (supportedArmMark group arm Y a k) 2 mu := by have hcell : MeasurableSet (armCategoryEvent group arm a k) := Causalean.Stat.measurableSet_armGroupEvent group arm hgroup harm a k have hc : MemLp ((armCategoryEvent group arm a k).indicator (fun _ ↦ center a k)) 2 mu := (memLp_const _).indicator hcell have hadd := (hmem a k).add hc convert hadd using 1 funext omega by_cases ho : group omega = k ∧ arm omega = a <;> simp [supportedArmMark, supportedArmResidual, armCategoryEvent, supportedArmGroupResidual, armGroupEvent, armGroupResidual, ho] have hcellTerm (a : Bool) (k : kappa) : MemLp (fun z : Fin m → Omega ↦ (categoryCount group arm z k : Real) / (m : Real) * totalizedArmMean group arm Y z a k) 2 (Measure.pi (fun _ : Fin m ↦ mu)) := by let W : (Fin m → kappa × Bool) → Real := fun d ↦ (Causalean.Stat.groupCount Prod.fst Prod.snd d k : Real) / (m : Real) * if 0 < Causalean.Stat.groupArmCount Prod.fst Prod.snd d a k then (Causalean.Stat.groupArmCount Prod.fst Prod.snd d a k : Real)⁻¹ else 0 have hw := memLp_designWeight_coordinate_sum mu group arm hgroup harm (supportedArmMark group arm Y a k) (hmark a k) (by exact (hY.indicator (Causalean.Stat.measurableSet_armGroupEvent group arm hgroup harm a k))) W convert hw using 1 funext z unfold totalizedArmMean armMarkSum categoryCount categoryArmCount dsimp [W] have hgc : Causalean.Stat.groupCount Prod.fst Prod.snd (sampleDesign group arm z) k = Causalean.Stat.groupCount group arm z k := rfl have hga : Causalean.Stat.groupArmCount Prod.fst Prod.snd (sampleDesign group arm z) a k = Causalean.Stat.groupArmCount group arm z a k := rfl rw [hgc, hga] by_cases hp : 0 < Causalean.Stat.groupArmCount group arm z a k · rw [if_pos hp, if_pos hp] rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro i hi ring · rw [if_neg hp, if_neg hp] simp have harmScore (a : Bool) : MemLp (fixedStratumArmScore (m := m) group arm Y H a) 2 (Measure.pi (fun _ : Fin m ↦ mu)) := by unfold fixedStratumArmScore exact memLp_finsetSum H fun k _ ↦ hcellTerm a k exact (harmScore true).sub (harmScore false) -
integral_fixedStratumArmMassFluctuation_sq_letheorem — Measurable group and arm labels and cell centers bounded in absolute value by the envelope imply that the empirical category-mass fluctuation has second moment at most the squared envelope divided by the safe sample size, including for an empty sample.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → BoolH :Finset kappaa :M :hgroup :Measurable groupharm :Measurable armhcenterBound :∀ k, |center a k| ≤ Mconclusion∫ z : Fin m → Omega, (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu))≤ M ^ 2 / safeSampleSize mProof (Lean source)
theorem integral_fixedStratumArmMassFluctuation_sq_le {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (center : Bool → kappa → Real) (H : Finset kappa) (a : Bool) (M : Real) (hgroup : Measurable group) (harm : Measurable arm) (hcenterBound : ∀ k, |center a k| ≤ M) : ∫ z : Fin m → Omega, (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu)) ≤ M ^ 2 / safeSampleSize m := by classical by_cases hH : H.Nonempty · obtain ⟨k0, hk0⟩ := hH have hM : 0 ≤ M := (abs_nonneg (center a k0)).trans (hcenterBound k0) let xi : Omega → Real := fun omega ↦ ∑ k ∈ H, (categoryEvent group k).indicator (fun _ ↦ center a k) omega have hxiMeas : Measurable xi := by dsimp [xi] apply measurable_sum intro k hk exact measurable_const.indicator (measurableSet_groupEvent group hgroup k) have hxiBound (omega : Omega) : |xi omega| ≤ M := by by_cases hg : group omega ∈ H · rw [show xi omega = center a (group omega) by dsimp [xi] rw [Finset.sum_eq_single (group omega)] · simp [categoryEvent, groupEvent] · intro k hk hne simp [categoryEvent, groupEvent, hne.symm] · exact fun h ↦ (h hg).elim] exact hcenterBound (group omega) · rw [show xi omega = 0 by dsimp [xi] apply Finset.sum_eq_zero intro k hk have hne : group omega ≠ k := fun heq ↦ hg (heq ▸ hk) simp [categoryEvent, groupEvent, hne]] simpa using hM have hxi : MemLp xi 2 mu := MemLp.of_bound hxiMeas.aestronglyMeasurable M (Filter.Eventually.of_forall fun omega ↦ by simpa [Real.norm_eq_abs] using hxiBound omega) have hxiSq : ∫ omega, (xi omega) ^ 2 ∂mu ≤ M ^ 2 := by calc (∫ omega, (xi omega) ^ 2 ∂mu) ≤ ∫ _omega, M ^ 2 ∂mu := by apply integral_mono (hxi.integrable_sq) (integrable_const (M ^ 2)) intro omega simpa only [sq_abs] using pow_le_pow_left₀ (abs_nonneg (xi omega)) (hxiBound omega) 2 _ = M ^ 2 := by simp have hxiIntegral : (∫ omega, xi omega ∂mu) = ∑ k ∈ H, categoryMass mu group k * center a k := by dsimp [xi] rw [integral_finset_sum H] · apply Finset.sum_congr rfl intro k hk change (∫ omega, (groupEvent group k).indicator (fun _ ↦ center a k) omega ∂mu) = (mu (groupEvent group k)).toReal * center a k rw [integral_indicator (measurableSet_groupEvent group hgroup k), setIntegral_const] simp [Measure.real, smul_eq_mul] · intro k hk exact (integrable_const (center a k)).indicator (measurableSet_groupEvent group hgroup k) have hsample (z : Fin m → Omega) : (m : Real)⁻¹ * ∑ i, xi (z i) - ∫ omega, xi omega ∂mu = fixedStratumArmMassFluctuation mu group arm center H a z := by rw [hxiIntegral] unfold fixedStratumArmMassFluctuation have hemp : (m : Real)⁻¹ * ∑ i, xi (z i) = (m : Real)⁻¹ * ∑ k ∈ H, (categoryCount group arm z k : Real) * center a k := by congr 1 dsimp [xi] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro k hk unfold categoryCount groupCount groupArmCount simp only [Finset.card_filter, Nat.cast_add, Nat.cast_sum, Nat.cast_ite, cast_one, cast_zero] rw [← Finset.sum_add_distrib, Finset.sum_mul] apply Finset.sum_congr rfl intro i hi cases h : arm (z i) <;> by_cases hg : group (z i) = k <;> simp [categoryEvent, groupEvent, indicator, h, hg] calc (m : Real)⁻¹ * ∑ i, xi (z i) - ∑ k ∈ H, categoryMass mu group k * center a k = (∑ k ∈ H, (categoryCount group arm z k : Real) / (m : Real) * center a k) - ∑ k ∈ H, categoryMass mu group k * center a k := by rw [hemp, Finset.mul_sum] congr 1 apply Finset.sum_congr rfl intro k hk ring _ = ∑ k ∈ H, ((categoryCount group arm z k : Real) / (m : Real) - categoryMass mu group k) * center a k := by rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro k hk ring by_cases hm : m = 0 · subst m have hmeanSq : (∫ omega, xi omega ∂mu) ^ 2 ≤ ∫ omega, (xi omega) ^ 2 ∂mu := by have hv := ProbabilityTheory.variance_nonneg xi mu rw [ProbabilityTheory.variance_eq_sub hxi] at hv change 0 ≤ (∫ omega, (xi omega) ^ 2 ∂mu) - (∫ omega, xi omega ∂mu) ^ 2 at hv linarith unfold safeSampleSize norm_num change (∫ z : Fin 0 → Omega, (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin 0 ↦ mu))) ≤ M ^ 2 calc (∫ z : Fin 0 → Omega, (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin 0 ↦ mu))) = ∫ _z : Fin 0 → Omega, (∫ omega, xi omega ∂mu) ^ 2 ∂(Measure.pi (fun _ : Fin 0 ↦ mu)) := by apply integral_congr_ae filter_upwards [] with z rw [← hsample z] simp _ = (∫ omega, xi omega ∂mu) ^ 2 := by simp _ ≤ ∫ omega, (xi omega) ^ 2 ∂mu := hmeanSq _ ≤ M ^ 2 := hxiSq · have hmpos : 0 < m := Nat.pos_of_ne_zero hm calc (∫ z : Fin m → Omega, (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m ↦ mu))) = ∫ z : Fin m → Omega, ((m : Real)⁻¹ * ∑ i, xi (z i) - ∫ omega, xi omega ∂mu) ^ 2 ∂(Measure.pi (fun _ : Fin m ↦ mu)) := by apply integral_congr_ae filter_upwards [] with z rw [hsample] _ ≤ (∫ omega, (xi omega) ^ 2 ∂mu) / (m : Real) := iid_mean_sq_le mu hmpos xi hxi _ ≤ M ^ 2 / (m : Real) := div_le_div_of_nonneg_right hxiSq (by positivity) _ = M ^ 2 / safeSampleSize m := by unfold safeSampleSize rw [max_eq_right (Nat.one_le_iff_ne_zero.mpr hm)] · have hH0 : H = ∅ := Finset.not_nonempty_iff_eq_empty.mp hH subst H simp [fixedStratumArmMassFluctuation] unfold safeSampleSize positivity -
integral_fixedStratumArmMissingRemainder_sq_letheorem — Measurable group and arm labels, cell centers bounded in absolute value by the envelope, a positive overlap margin, and arm mass at least that margin times category mass imply that the normalized aggregate empty-arm remainder has second moment bounded by a parametric diagonal term plus the squared exponentially damped missing-arm envelope.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → BoolH :Finset kappaa :M epsilon :hgroup :Measurable groupharm :Measurable armhcenterBound :∀ k, |center a k| ≤ Mhepsilon :0 < epsilonhoverlap :∀ kif0 < categoryMass mu group kthenepsilon * categoryMass mu group k ≤ armCategoryMass mu group arm a kconclusion∫ z : Fin m → Omega, (fixedStratumArmMissingRemainder group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu))≤ M ^ 2 * (1 / safeSampleSize m + (missingArmExponentialEnvelope mu group m epsilon H) ^ 2)Proof (Lean source)
theorem integral_fixedStratumArmMissingRemainder_sq_le {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (center : Bool → kappa → Real) (H : Finset kappa) (a : Bool) (M epsilon : Real) (hgroup : Measurable group) (harm : Measurable arm) (hcenterBound : ∀ k, |center a k| ≤ M) (hepsilon : 0 < epsilon) (hoverlap : ∀ k, 0 < categoryMass mu group k → epsilon * categoryMass mu group k ≤ armCategoryMass mu group arm a k) : ∫ z : Fin m → Omega, (fixedStratumArmMissingRemainder group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu)) ≤ M ^ 2 * (1 / safeSampleSize m + (missingArmExponentialEnvelope mu group m epsilon H) ^ 2) := by exact integral_fixedStratumArmMissingRemainder_sq_le_aux mu group arm center H a M epsilon hgroup harm hcenterBound hepsilon hoverlap -
integral_fixedStratumArm_error_sq_le_exponentialtheorem — Measurable group and arm labels and a measurable mark, square-integrable supported residuals, cellwise residual centering, the stated residual second-moment envelope, bounded cell centers, a positive overlap margin, and arm mass at least that margin times category mass imply a uniform one-arm fixed-set mean-squared-error bound with an explicit exponentially damped missing-arm remainder.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → BoolY :Omega → RealH :Finset kappaa :M epsilon :hgroup :Measurable groupharm :Measurable armhY :hmem :∀ k, MemLp (supportedArmResidual group arm Y center a k) 2 muhcenter :∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ∂mu = 0hsq :∀ k,∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ^ 2 ∂mu≤ armCategoryMass mu group arm a k * M ^ 2hcenterBound :∀ k, |center a k| ≤ Mhepsilon :0 < epsilonhoverlap :∀ kif0 < categoryMass mu group kthenepsilon * categoryMass mu group k ≤ armCategoryMass mu group arm a kconclusion∫ z : Fin m → Omega, (fixedStratumArmScore group arm Y H a z - fixedStratumArmTarget mu group arm Y H a) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu))≤ M ^ 2 * (8 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon) + 6 / safeSampleSize m + 4 * (missingArmExponentialEnvelope mu group m epsilon H) ^ 2)Proof (Lean source)
theorem integral_fixedStratumArm_error_sq_le_exponential {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (Y : Omega → Real) (center : Bool → kappa → Real) (H : Finset kappa) (a : Bool) (M epsilon : Real) (hgroup : Measurable group) (harm : Measurable arm) (hY : Measurable Y) (hmem : ∀ k, MemLp (supportedArmResidual group arm Y center a k) 2 mu) (hcenter : ∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ∂mu = 0) (hsq : ∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ^ 2 ∂mu ≤ armCategoryMass mu group arm a k * M ^ 2) (hcenterBound : ∀ k, |center a k| ≤ M) (hepsilon : 0 < epsilon) (hoverlap : ∀ k, 0 < categoryMass mu group k → epsilon * categoryMass mu group k ≤ armCategoryMass mu group arm a k) : ∫ z : Fin m → Omega, (fixedStratumArmScore group arm Y H a z - fixedStratumArmTarget mu group arm Y H a) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu)) ≤ M ^ 2 * (8 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon) + 6 / safeSampleSize m + 4 * (missingArmExponentialEnvelope mu group m epsilon H) ^ 2) := by -- Proof plan: identify the center target with the population target, rewrite -- by `fixedStratumArmScore_sub_centerTarget_decomposition`, and apply -- `(x+y-z)^2 ≤ 4x^2 + 2y^2 + 4z^2`. Integrate using the three component -- bounds above and finish by nonnegative arithmetic, retaining the explicit -- missing-arm envelope. classical have hpositive : ∀ k ∈ H, 0 < categoryMass mu group k → 0 < armCategoryMass mu group arm a k := by intro k hk hpk exact (mul_pos hepsilon hpk).trans_le (hoverlap k hpk) have htarget := fixedStratumArmCenterTarget_eq_target_of_measurable mu group arm Y center H a hgroup harm hmem hcenter hpositive have hscoreMem := fixedStratumArmScore_memLp_two (m := m) mu group arm Y center H a hgroup harm hY hmem have hmassMem := fixedStratumArmMassFluctuation_memLp_two (m := m) mu group arm center H a hgroup harm have hmissingMem := fixedStratumArmMissingRemainder_memLp_two (m := m) mu group arm center H a hgroup harm have hnoiseMem : MemLp (fixedStratumArmCenteredNoise (m := m) group arm Y center H a) 2 (Measure.pi (fun _ : Fin m ↦ mu)) := by have hcomb := ((hscoreMem.sub (memLp_const (fixedStratumArmCenterTarget mu group H center a))).sub hmassMem).add hmissingMem convert hcomb using 1 funext z change fixedStratumArmCenteredNoise group arm Y center H a z = (fixedStratumArmScore group arm Y H a z - fixedStratumArmCenterTarget mu group H center a) - fixedStratumArmMassFluctuation mu group arm center H a z + fixedStratumArmMissingRemainder group arm center H a z have hdecomp := fixedStratumArmScore_sub_centerTarget_decomposition mu group arm Y center H a z linarith have hnoise := integral_fixedStratumArmCenteredNoise_sq_le (m := m) mu group arm Y center H a M epsilon hgroup harm hY hmem hcenter hsq hepsilon hoverlap have hmass := integral_fixedStratumArmMassFluctuation_sq_le (m := m) mu group arm center H a M hgroup harm hcenterBound have hmissing := integral_fixedStratumArmMissingRemainder_sq_le (m := m) mu group arm center H a M epsilon hgroup harm hcenterBound hepsilon hoverlap have hpoint (z : Fin m → Omega) : (fixedStratumArmScore group arm Y H a z - fixedStratumArmTarget mu group arm Y H a) ^ 2 ≤ 4 * (fixedStratumArmCenteredNoise group arm Y center H a z) ^ 2 + 2 * (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 + 4 * (fixedStratumArmMissingRemainder group arm center H a z) ^ 2 := by rw [← htarget, fixedStratumArmScore_sub_centerTarget_decomposition] nlinarith [sq_nonneg ((fixedStratumArmCenteredNoise group arm Y center H a z - fixedStratumArmMissingRemainder group arm center H a z) - fixedStratumArmMassFluctuation mu group arm center H a z), sq_nonneg (fixedStratumArmCenteredNoise group arm Y center H a z + fixedStratumArmMissingRemainder group arm center H a z)] calc (∫ z : Fin m → Omega, (fixedStratumArmScore group arm Y H a z - fixedStratumArmTarget mu group arm Y H a) ^ 2 ∂(Measure.pi (fun _ : Fin m ↦ mu))) ≤ ∫ z : Fin m → Omega, (4 * (fixedStratumArmCenteredNoise group arm Y center H a z) ^ 2 + 2 * (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 + 4 * (fixedStratumArmMissingRemainder group arm center H a z) ^ 2) ∂(Measure.pi (fun _ : Fin m ↦ mu)) := by apply integral_mono · exact (hscoreMem.sub (memLp_const _)).integrable_sq · exact ((hnoiseMem.integrable_sq.const_mul 4).add (hmassMem.integrable_sq.const_mul 2)).add (hmissingMem.integrable_sq.const_mul 4) · exact hpoint _ = 4 * (∫ z : Fin m → Omega, (fixedStratumArmCenteredNoise group arm Y center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m ↦ mu))) + 2 * (∫ z : Fin m → Omega, (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m ↦ mu))) + 4 * (∫ z : Fin m → Omega, (fixedStratumArmMissingRemainder group arm center H a z) ^ 2 ∂(Measure.pi (fun _ : Fin m ↦ mu))) := by let fn : (Fin m → Omega) → Real := fun z ↦ 4 * (fixedStratumArmCenteredNoise group arm Y center H a z) ^ 2 let ff : (Fin m → Omega) → Real := fun z ↦ 2 * (fixedStratumArmMassFluctuation mu group arm center H a z) ^ 2 let fr : (Fin m → Omega) → Real := fun z ↦ 4 * (fixedStratumArmMissingRemainder group arm center H a z) ^ 2 have hn4 : Integrable fn (Measure.pi (fun _ : Fin m ↦ mu)) := by simpa [fn] using hnoiseMem.integrable_sq.const_mul 4 have hf2 : Integrable ff (Measure.pi (fun _ : Fin m ↦ mu)) := by simpa [ff] using hmassMem.integrable_sq.const_mul 2 have hr4 : Integrable fr (Measure.pi (fun _ : Fin m ↦ mu)) := by simpa [fr] using hmissingMem.integrable_sq.const_mul 4 change (∫ z : Fin m → Omega, ((fn + ff) + fr) z ∂(Measure.pi (fun _ : Fin m ↦ mu))) = _ calc (∫ z : Fin m → Omega, ((fn + ff) + fr) z ∂(Measure.pi (fun _ : Fin m ↦ mu))) = (∫ z : Fin m → Omega, (fn + ff) z ∂(Measure.pi (fun _ : Fin m ↦ mu))) + ∫ z : Fin m → Omega, fr z ∂(Measure.pi (fun _ : Fin m ↦ mu)) := integral_add (hn4.add hf2) hr4 _ = ((∫ z : Fin m → Omega, fn z ∂(Measure.pi (fun _ : Fin m ↦ mu))) + ∫ z : Fin m → Omega, ff z ∂(Measure.pi (fun _ : Fin m ↦ mu))) + ∫ z : Fin m → Omega, fr z ∂(Measure.pi (fun _ : Fin m ↦ mu)) := by have hadd : (∫ z : Fin m → Omega, (fn + ff) z ∂(Measure.pi (fun _ : Fin m ↦ mu))) = (∫ z : Fin m → Omega, fn z ∂(Measure.pi (fun _ : Fin m ↦ mu))) + ∫ z : Fin m → Omega, ff z ∂(Measure.pi (fun _ : Fin m ↦ mu)) := by simpa only [Pi.add_apply] using integral_add hn4 hf2 rw [hadd] _ = _ := by simp only [fn, ff, fr, integral_const_mul] _ ≤ 4 * (2 * M ^ 2 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon)) + 2 * (M ^ 2 / safeSampleSize m) + 4 * (M ^ 2 * (1 / safeSampleSize m + (missingArmExponentialEnvelope mu group m epsilon H) ^ 2)) := by linarith _ = M ^ 2 * (8 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon) + 6 / safeSampleSize m + 4 * (missingArmExponentialEnvelope mu group m epsilon H) ^ 2) := by ring -
integral_fixedStratumArm_error_sq_letheorem — Measurable group and arm labels and a measurable mark, square-integrable supported residuals, cellwise residual centering, the stated residual second-moment envelope, bounded cell centers, a positive overlap margin, arm mass at least that margin times category mass, and a deterministic lower bound on every selected category mass imply the boundary-safe one-arm mean-squared-error bound with an inverse-polynomial missing-arm envelope.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → BoolY :Omega → RealH :Finset kappaa :M epsilon B :hgroup :Measurable groupharm :Measurable armhY :hmem :∀ k, MemLp (supportedArmResidual group arm Y center a k) 2 muhcenter :∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ∂mu = 0hsq :∀ k,∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ^ 2 ∂mu≤ armCategoryMass mu group arm a k * M ^ 2hcenterBound :∀ k, |center a k| ≤ Mhepsilon :0 < epsilonhoverlap :∀ kif0 < categoryMass mu group kthenepsilon * categoryMass mu group k ≤ armCategoryMass mu group arm a khp :∀ k ∈ H, B ≤ categoryMass mu group kconclusion∫ z : Fin m → Omega, (fixedStratumArmScore group arm Y H a z - fixedStratumArmTarget mu group arm Y H a) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu))≤ M ^ 2 * (8 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon) + 6 / safeSampleSize m + 4 * (lowerMassMissingEnvelope mu group m epsilon B H) ^ 2)Proof (Lean source)
theorem integral_fixedStratumArm_error_sq_le {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (Y : Omega → Real) (center : Bool → kappa → Real) (H : Finset kappa) (a : Bool) (M epsilon B : Real) (hgroup : Measurable group) (harm : Measurable arm) (hY : Measurable Y) (hmem : ∀ k, MemLp (supportedArmResidual group arm Y center a k) 2 mu) (hcenter : ∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ∂mu = 0) (hsq : ∀ k, ∫ omega in armCategoryEvent group arm a k, (Y omega - center a k) ^ 2 ∂mu ≤ armCategoryMass mu group arm a k * M ^ 2) (hcenterBound : ∀ k, |center a k| ≤ M) (hepsilon : 0 < epsilon) (hoverlap : ∀ k, 0 < categoryMass mu group k → epsilon * categoryMass mu group k ≤ armCategoryMass mu group arm a k) (hp : ∀ k ∈ H, B ≤ categoryMass mu group k) : ∫ z : Fin m → Omega, (fixedStratumArmScore group arm Y H a z - fixedStratumArmTarget mu group arm Y H a) ^ 2 ∂(Measure.pi (fun _ : Fin m => mu)) ≤ M ^ 2 * (8 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon) + 6 / safeSampleSize m + 4 * (lowerMassMissingEnvelope mu group m epsilon B H) ^ 2) := by -- Proof plan: apply the exponential one-arm theorem, then use -- `missingArmExponentialEnvelope_le_lowerMass`; prove both envelopes are -- nonnegative before squaring the comparison. classical have hbase := integral_fixedStratumArm_error_sq_le_exponential (m := m) mu group arm Y center H a M epsilon hgroup harm hY hmem hcenter hsq hcenterBound hepsilon hoverlap have henv := missingArmExponentialEnvelope_le_lowerMass mu group hgroup m epsilon B H hepsilon hp have hexp0 : 0 ≤ missingArmExponentialEnvelope mu group m epsilon H := by unfold missingArmExponentialEnvelope exact Finset.sum_nonneg fun k _ ↦ mul_nonneg ENNReal.toReal_nonneg (Real.exp_pos _).le have hlower0 : 0 ≤ lowerMassMissingEnvelope mu group m epsilon B H := by unfold lowerMassMissingEnvelope dsimp only split_ifs with hD · exact div_nonneg (Nat.cast_nonneg _) hD.le · exact Finset.sum_nonneg fun k _ ↦ ENNReal.toReal_nonneg have hsqenv : (missingArmExponentialEnvelope mu group m epsilon H) ^ 2 ≤ (lowerMassMissingEnvelope mu group m epsilon B H) ^ 2 := pow_le_pow_left₀ hexp0 henv 2 calc (∫ z : Fin m → Omega, (fixedStratumArmScore group arm Y H a z - fixedStratumArmTarget mu group arm Y H a) ^ 2 ∂(Measure.pi (fun _ : Fin m ↦ mu))) ≤ M ^ 2 * (8 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon) + 6 / safeSampleSize m + 4 * (missingArmExponentialEnvelope mu group m epsilon H) ^ 2) := hbase _ ≤ M ^ 2 * (8 * (∑ k ∈ H, categoryMass mu group k) / (safeSampleSize m * epsilon) + 6 / safeSampleSize m + 4 * (lowerMassMissingEnvelope mu group m epsilon B H) ^ 2) := by apply mul_le_mul_of_nonneg_left _ (sq_nonneg M) linarith
MissingBound 1 core · 1 supporting This module bounds the aggregate missing-arm count by separating its one-coordinate diagonal contribution from its ordered two-coordinate contribution and applying overlap-driven exponential decay. ★ integral_fixedStratumArmMissingRemainder_sq_le_aux
Second-moment bound for the missing-arm remainder
This module bounds the aggregate missing-arm count by separating its one-coordinate diagonal contribution from its ordered two-coordinate contribution and applying overlap-driven exponential decay.
Measurable group and arm labels, cell centers bounded in absolute value by the envelope, a positive overlap margin, and arm mass at least that margin times category mass imply that the missing-arm remainder has a boundary-safe diagonal-plus-exponential second-moment bound.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
integrable_missingArmCount_mullemma — When the stratum label and the arm assignment are measurable, the product of the counts of missing arm/category cells for two categories is integrable over the product sample, because the two counts are bounded by the sample size.hypothesesOmega :sharedType u_1kappa :sharedType u_2m :mu :Measure Omegagroup :Omega → kappaarm :Omega → Boolhgroup :Measurable groupharm :Measurable arma :k l :kappaconclusionIntegrable (fun z : Fin m → Omega ↦ (missingArmCount group arm z a k : Real) * (missingArmCount group arm z a l : Real)) (Measure.pi (fun _ : Fin m ↦ mu))Proof (Lean source)
@[fun_prop] lemma integrable_missingArmCount_mul {m : Nat} (mu : Measure Omega) [IsProbabilityMeasure mu] (group : Omega → kappa) (arm : Omega → Bool) (hgroup : Measurable group) (harm : Measurable arm) (a : Bool) (k l : kappa) : Integrable (fun z : Fin m → Omega ↦ (missingArmCount group arm z a k : Real) * (missingArmCount group arm z a l : Real)) (Measure.pi (fun _ : Fin m ↦ mu)) := by apply Integrable.of_bound (((Measurable.of_discrete : Measurable fun n : Nat => (n : Real)).comp (measurable_missingArmCount (m := m) group arm hgroup harm a k)).mul ((Measurable.of_discrete : Measurable fun n : Nat => (n : Real)).comp (measurable_missingArmCount (m := m) group arm hgroup harm a l))).aestronglyMeasurable ((m : Real) ^ 2) filter_upwards [] with z change ‖(missingArmCount group arm z a k : Real) * (missingArmCount group arm z a l : Real)‖ ≤ (m : Real) ^ 2 rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _))] have hk : (missingArmCount group arm z a k : Real) ≤ (m : Real) := by exact_mod_cast missingArmCount_le_sampleSize group arm z a k have hl : (missingArmCount group arm z a l : Real) ≤ (m : Real) := by exact_mod_cast missingArmCount_le_sampleSize group arm z a l nlinarith [(Nat.cast_nonneg (missingArmCount group arm z a k) : (0 : Real) ≤ (missingArmCount group arm z a k : Real)), (Nat.cast_nonneg (missingArmCount group arm z a l) : (0 : Real) ≤ (missingArmCount group arm z a l : Real)), (Nat.cast_nonneg m : (0 : Real) ≤ (m : Real))]
NestedCountBound 2 core · 0 supporting This module proves the zero-safe reciprocal-count estimate used by a fixed stratum ratio. ★ integral_nested_count_sq_mul_totalized_inverse_le
A nested finite-product count bound
This module proves the zero-safe reciprocal-count estimate used by a fixed stratum ratio. It enumerates the outer and inner index sets, exposing the conditional binomial law of the inner count without using a conditional probability API.
Given a finite index set, an observation space, an observation assigned to each index, and a set of observations, the sample index set is the finite set of precisely those indices whose assigned observation belongs to that set.
Measurable outer and inner events, nesting of the inner event inside the outer event, a positive overlap margin, and inner-event mass at least that margin times outer-event mass imply that the expected squared outer count times the zero-safe inverse inner count is at most twice sample size times outer-event mass divided by the margin.