Stat.Sample.OccupancyWeightedMean.ObservedRisk
This module packages finite-cell matched-arm occupancy controls, real-mark residual algebra, and the observed-law collision-estimator mean-square bound.
Basic 11 core · 0 supporting The statistics and assumptions in this module depend only on one observed probability law and the measurable cell, arm, and real-outcome maps.
Observed finite-cell collision statistics
The statistics and assumptions in this module depend only on one observed probability law and the measurable cell, arm, and real-outcome maps. All sample ratios are guarded at zero. No potential-outcome variables occur here.
The observed mass of a cell is the probability that the measured cell label equals it.
Definition (Lean source)
The observed mass of an arm-cell pair is its joint probability under the observed law.
Definition (Lean source)
The guarded arm-cell count is the number of sample observations in that arm and cell.
Definition (Lean source)
The guarded arm-cell sum adds real outcomes in the requested arm and cell.
Definition (Lean source)
The guarded arm-cell mean is the arm-cell outcome sum divided by its positive count, and is zero when the count vanishes.
Definition (Lean source)
A cell is matched when both observed treatment arms appear in it.
Definition (Lean source)
The usable total counts all observations in matched cells, and is zero if none match.
Definition (Lean source)
The cell-count-weighted collision estimator averages matched-cell arm contrasts, with value zero when no cell is matched.
Definition (Lean source)
The population contrast is the sum over cells of the cell's observed mass times the difference between the supplied treated-arm centre and control-arm centre of that cell.
The design center replaces empirical arm means by their observed arm-cell centers, retaining the same matched-cell weights and zero-denominator guard.
Definition (Lean source)
The observed-law assumptions on a probability law with a cell label, a Boolean arm label, a real outcome, supplied arm-and-cell centres, an overlap margin ε, an envelope M and a heterogeneity level ρ require all of the following. The margin ε is strictly between zero and one half, and the cell label, arm label and outcome are measurable. Overlap: in every cell of positive mass, each arm-cell pair has mass at least ε times the cell mass. Every centre is at most M in absolute value. On each arm-cell event the residual (outcome minus that arm-cell's centre) is square-integrable, integrates to zero, and has integral of its square at most the arm-cell mass times M². Approximate homogeneity: in every cell of positive mass, the treated-minus-control centre contrast differs from the population contrast by at most M·ρ in absolute value. Nothing is required of cells of zero mass beyond the centre bound and the (then trivial) residual conditions.
Definition (Lean source)
PoissonCell 3 core · 1 supporting These observed-design lemmas isolate the light- and heavy-cell estimates for two independent Poisson arm counts. ★ poissonCellLaplace_heavy_rate
One-cell Poisson occupancy estimates
These observed-design lemmas isolate the light- and heavy-cell estimates for two independent Poisson arm counts. They are the local inputs to the finite partition Laplace argument; neither potential outcomes nor a causal model appear in their statements.
The usable count of an independent Poisson arm-count pair is their sum when both counts are positive, and zero otherwise.
Definition (Lean source)
The one-cell Laplace factor averages the exponential of minus the usable count under independent Poisson arm counts.
Definition (Lean source)
For an overlap margin ε strictly between zero and one half, there is a positive constant c, depending only on ε, such that for any two nonnegative Poisson arm intensities with total x, if each intensity is at least ε·x and the total x is at least one, then the one-cell Laplace factor (the expectation of exp(−usable count) under independent Poisson arm counts with those intensities) is at most exp(−c·x).
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
poissonCellLaplace_light_ratetheorem — If a cell's total Poisson intensity is at most one and each arm receives at least an epsilon fraction, its usable-count Laplace factor loses at least a positive multiple of the squared total intensity. The coefficient depends only on epsilon, including the zero-intensity case.hypothesesepsilon :ℝhepsilon :0 < epsilonconclusion∃ c : ℝ,0 < cconclusion 1u v :ℝ≥0x :ℝ(u : ℝ) + (v : ℝ) = xepsilon * x ≤ (u : ℝ)epsilon * x ≤ (v : ℝ)x ≤ 1poissonCellLaplace u v ≤ exp (-(c * x ^ 2))Proof (Lean source)
theorem poissonCellLaplace_light_rate (epsilon : ℝ) (hepsilon : 0 < epsilon) : ∃ c : ℝ, 0 < c ∧ ∀ (u v : ℝ≥0) (x : ℝ), (u : ℝ) + (v : ℝ) = x → epsilon * x ≤ (u : ℝ) → epsilon * x ≤ (v : ℝ) → x ≤ 1 → poissonCellLaplace u v ≤ exp (-(c * x ^ 2)) := by -- The (1,1) atom has mass exp (-x) * u * v. On x ≤ 1 this is -- uniformly at least exp (-1) * epsilon² * x². Bound 1-y by exp (-y). let c : ℝ := (1 - exp (-2)) * exp (-1) * epsilon ^ 2 have hc₀ : 0 ≤ 1 - exp (-2 : ℝ) := by have : exp (-2 : ℝ) ≤ 1 := by rw [Real.exp_le_one_iff]; norm_num linarith have hc : 0 < c := by have : exp (-2 : ℝ) < 1 := by rw [← Real.exp_zero] exact Real.exp_lt_exp.mpr (by norm_num) dsimp [c] positivity refine ⟨c, hc, ?_⟩ intro u v x hx hu hv hx₁ let μ := (poissonMeasure u).prod (poissonMeasure v) let ind : ℕ × ℕ → ℝ := fun r ↦ if r = (1, 1) then 1 else 0 have hpoint (r : ℕ × ℕ) : exp (-(usablePoissonPairCount r : ℝ)) ≤ 1 - (1 - exp (-2)) * ind r := by by_cases hr : r = (1, 1) · subst r norm_num [usablePoissonPairCount, ind] · simp only [ind, if_neg hr, mul_zero, sub_zero] rw [Real.exp_le_one_iff] exact neg_nonpos.mpr (Nat.cast_nonneg _) have hfun : Integrable (fun r : ℕ × ℕ ↦ exp (-(usablePoissonPairCount r : ℝ))) μ := by refine (integrable_const (1 : ℝ)).mono (by fun_prop) ?_ filter_upwards with r rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), norm_one] rw [Real.exp_le_one_iff] exact neg_nonpos.mpr (Nat.cast_nonneg _) have hind : Integrable ind μ := by refine (integrable_const (1 : ℝ)).mono (by fun_prop) ?_ filter_upwards with r dsimp [ind] split <;> simp have hmono : poissonCellLaplace u v ≤ 1 - (1 - exp (-2)) * (∫ r, ind r ∂μ) := by have henv : Integrable (fun r : ℕ × ℕ ↦ 1 - (1 - exp (-2)) * ind r) μ := (integrable_const (1 : ℝ)).sub (hind.const_mul _) have hle := integral_mono_ae hfun henv (Filter.Eventually.of_forall hpoint) unfold poissonCellLaplace calc _ ≤ ∫ r, (1 - (1 - exp (-2)) * ind r) ∂μ := hle _ = 1 - (1 - exp (-2)) * (∫ r, ind r ∂μ) := by rw [integral_sub (integrable_const (1 : ℝ)) (hind.const_mul _)] rw [integral_const_mul] simp have hOne (a : ℝ≥0) : (∫ n : ℕ, (if n = 1 then (1 : ℝ) else 0) ∂poissonMeasure a) = exp (-(a : ℝ)) * a := by rw [integral_poissonMeasure] simp only [smul_eq_mul] rw [tsum_eq_single 1] · norm_num · intro n hn simp [hn] have hatom : (∫ r, ind r ∂μ) = exp (-x) * (u : ℝ) * (v : ℝ) := by calc (∫ r, ind r ∂μ) = (∫ r : ℕ × ℕ, (if r.1 = 1 then (1 : ℝ) else 0) * (if r.2 = 1 then (1 : ℝ) else 0) ∂μ) := by congr with r rcases r with ⟨m, n⟩ simp only [ind, Prod.mk.injEq] by_cases hm : m = 1 <;> by_cases hn : n = 1 <;> simp [hm, hn] _ = (∫ m : ℕ, (if m = 1 then (1 : ℝ) else 0) ∂poissonMeasure u) * (∫ n : ℕ, (if n = 1 then (1 : ℝ) else 0) ∂poissonMeasure v) := by simpa only [μ] using (integral_prod_mul (μ := poissonMeasure u) (ν := poissonMeasure v) (L := ℝ) (fun m : ℕ ↦ if m = 1 then (1 : ℝ) else 0) (fun n : ℕ ↦ if n = 1 then (1 : ℝ) else 0)) _ = _ := by rw [hOne, hOne] have he : exp (-(u : ℝ)) * exp (-(v : ℝ)) = exp (-x) := by rw [← Real.exp_add] congr 1 linarith calc exp (-(u : ℝ)) * (u : ℝ) * (exp (-(v : ℝ)) * (v : ℝ)) = (exp (-(u : ℝ)) * exp (-(v : ℝ))) * (u : ℝ) * (v : ℝ) := by ring _ = _ := by rw [he] have hx₀ : 0 ≤ x := by rw [← hx]; positivity have hprod : epsilon ^ 2 * x ^ 2 ≤ (u : ℝ) * (v : ℝ) := by have h := mul_le_mul hu hv (mul_nonneg hepsilon.le hx₀) (by positivity) nlinarith have hexp : exp (-1) ≤ exp (-x) := Real.exp_le_exp.mpr (by linarith) have hcore : c * x ^ 2 ≤ (1 - exp (-2)) * (exp (-x) * (u : ℝ) * (v : ℝ)) := by dsimp [c] have h := mul_le_mul hexp hprod (by positivity) (Real.exp_pos _).le nlinarith [mul_le_mul_of_nonneg_left h hc₀] calc poissonCellLaplace u v ≤ 1 - (1 - exp (-2)) * (exp (-x) * (u : ℝ) * (v : ℝ)) := by simpa only [hatom] using hmono _ ≤ 1 - c * x ^ 2 := by linarith _ ≤ exp (-(c * x ^ 2)) := Real.one_sub_le_exp_neg _
LaplaceRate 1 core · 3 supporting These inequalities convert a birthday-scale exponential bound into the 1/n + d/n² rate and control the guarded reciprocal at zero. ★ birthday_reciprocal_rate
Scalar consequences of a usable-occupancy Laplace bound
These inequalities convert a birthday-scale exponential bound into the
1/n + d/n² rate and control the guarded reciprocal at zero. They do not
depend on an observed law or on a choice of cell alphabet.
For a positive exponent constant c, there is a positive constant B, depending only on c, such that for every positive sample size n and every cell count d, the scalar expression 2·max(n,d)/(c·n²) + 2·exp(−c·n²/(2·max(n,d))) is at most B·(1/n + d/n²). This is a purely numerical inequality: it converts a birthday-scale exponential bound into the 1/n + d/n² rate.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
birthday_laplace_ratetheorem — A birthday-scale exponential bound is at most a constant times 1/n + d/n², uniformly over positive sample sizes and all finite dimensions, including dimension zero.hypothesesc :ℝhc :0 < cProof (Lean source)
theorem birthday_laplace_rate (c : ℝ) (hc : 0 < c) : ∃ B : ℝ, 0 < B ∧ ∀ (n d : ℕ), 0 < n → 2 * exp (-(c * (n : ℝ) ^ 2 / max (n : ℝ) (d : ℝ))) ≤ B * (1 / (n : ℝ) + (d : ℝ) / (n : ℝ) ^ 2) := by refine ⟨2 / c, by positivity, ?_⟩ intro n d hn let N : ℝ := n let D : ℝ := d have hN : 0 < N := by dsimp [N]; exact_mod_cast hn have hD : 0 ≤ D := Nat.cast_nonneg d have hM : 0 < max N D := lt_of_lt_of_le hN (le_max_left _ _) have hC : 0 < c * N ^ 2 := mul_pos hc (sq_pos_of_pos hN) have hq : 0 < c * N ^ 2 / max N D := div_pos hC hM have hexp := Real.add_one_le_exp (c * N ^ 2 / max N D) have hprod : (c * N ^ 2 / max N D) * exp (-(c * N ^ 2 / max N D)) ≤ 1 := by have he := mul_le_mul_of_nonneg_right hexp (le_of_lt (Real.exp_pos (-(c * N ^ 2 / max N D)))) rw [add_mul, ← Real.exp_add] at he simp only [add_neg_cancel, Real.exp_zero, one_mul] at he nlinarith [Real.exp_pos (-(c * N ^ 2 / max N D))] have hbound : exp (-(c * N ^ 2 / max N D)) ≤ max N D / (c * N ^ 2) := by apply (le_div_iff₀ hC).2 have hh := (div_le_iff₀ hM).1 (show c * N ^ 2 * exp (-(c * N ^ 2 / max N D)) / max N D ≤ 1 by simpa [div_mul_eq_mul_div] using hprod) nlinarith have hmax : max N D ≤ N + D := max_le (by linarith) (by linarith) change 2 * exp (-(c * N ^ 2 / max N D)) ≤ (2 / c) * (1 / N + D / N ^ 2) have hrhs : (2 / c) * (1 / N + D / N ^ 2) = 2 * (N + D) / (c * N ^ 2) := by field_simp rw [hrhs] calc 2 * exp (-(c * N ^ 2 / max N D)) ≤ 2 * max N D / (c * N ^ 2) := by calc _ ≤ 2 * (max N D / (c * N ^ 2)) := mul_le_mul_of_nonneg_left hbound (by norm_num) _ = _ := by ring _ ≤ 2 * (N + D) / (c * N ^ 2) := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hmax (by norm_num)) hC.le -
guarded_inverse_le_exptheorem — The reciprocal of a positive integer, totalized to zero at zero, is bounded by a reciprocal threshold plus an exponential tail at that threshold.hypothesest :ℝht :0 < tm :ℕProof (Lean source)
theorem guarded_inverse_le_exp (t : ℝ) (ht : 0 < t) (m : ℕ) : (if 0 < m then (m : ℝ)⁻¹ else 0) ≤ t⁻¹ + exp t * exp (-(m : ℝ)) := by by_cases hm : m = 0 · simpa [hm] using (show (0 : ℝ) ≤ t⁻¹ + exp t by positivity) have hm0 : 0 < m := Nat.pos_of_ne_zero hm have hmR : 0 < (m : ℝ) := by exact_mod_cast hm0 simp only [hm0, ↓reduceIte] by_cases htm : t ≤ (m : ℝ) · have hi : (m : ℝ)⁻¹ ≤ t⁻¹ := (inv_le_inv₀ hmR ht).2 htm nlinarith [Real.exp_pos t, Real.exp_pos (-(m : ℝ))] · have hmt : (m : ℝ) < t := lt_of_not_ge htm have hm1 : (1 : ℝ) ≤ m := by exact_mod_cast hm0 have hi : (m : ℝ)⁻¹ ≤ 1 := (inv_le_one₀ hmR).2 hm1 have he : 1 ≤ exp t * exp (-(m : ℝ)) := by rw [← Real.exp_add] exact Real.one_le_exp (by linarith) nlinarith [inv_nonneg.mpr ht.le] -
zero_indicator_le_exptheorem — At zero occupancy, the indicator of the bad event is bounded by the Laplace kernel; at positive occupancy its left side is zero.Proof (Lean source)
theorem zero_indicator_le_exp (m : ℕ) : (if m = 0 then (1 : ℝ) else 0) ≤ exp (-(m : ℝ)) := by by_cases hm : m = 0 · simp [hm] · simp [hm, Real.exp_nonneg]
ObservedTransport 1 core · 1 supporting These lemmas transport the finite cell-arm design bounds to measurable labels of an arbitrary observed probability space. ★ observed_reciprocal_occupancy_rate
Occupancy bounds for an observed law
These lemmas transport the finite cell-arm design bounds to measurable labels of an arbitrary observed probability space. The marks and their distribution play no role. In particular, null cells and zero usable totals retain the guards used by the design bounds.
For an overlap margin ε strictly between zero and one half, there is a positive constant B, depending only on ε, such that the following holds for every probability law, every measurable label into a finite set of cells, every measurable Boolean arm label, and every positive sample size n: if in each cell of positive mass both arm-cell pairs have mass at least ε times the cell mass, then under n independent draws the expectation of the reciprocal of the usable total (the number of observations in cells containing both arms), with the reciprocal read as zero when the usable total is zero, is at most B·(1/n + card(κ)/n²), where card(κ) is the number of cells.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
observed_bad_occupancy_ratetheorem — For any observed probability law and measurable finite cell and arm labels, occupied-cell overlap bounds the probability of no matched cell by a uniform constant times 1/n + card(κ)/n².hypothesesepsilon :ℝhepsilon :0 < epsilonhepsilon_half :epsilon < 1 / 2conclusion∃ B : ℝ,0 < Bconclusion 1Ω κ :TypeFintype κμ :Measure ΩX :Ω → κA :Ω → Booln :ℕ0 < n(∀ a k, 0 < cellMass μ X k → epsilon * cellMass μ X k ≤ armCellMass μ X A a k)≤ B * (1 / (n : ℝ) + (Fintype.card κ : ℝ) / (n : ℝ) ^ 2)Proof (Lean source)
theorem observed_bad_occupancy_rate (epsilon : ℝ) (hepsilon : 0 < epsilon) (hepsilon_half : epsilon < 1 / 2) : ∃ B : ℝ, 0 < B ∧ ∀ (Ω κ : Type) [MeasurableSpace Ω] [Fintype κ] [DecidableEq κ] [MeasurableSpace κ] [MeasurableSingletonClass κ] (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (n : ℕ), Measurable X → Measurable A → 0 < n → (∀ a k, 0 < cellMass μ X k → epsilon * cellMass μ X k ≤ armCellMass μ X A a k) → ((Measure.pi (fun _ : Fin n => μ)) {z | usableTotal X A z = 0}).toReal ≤ B * (1 / (n : ℝ) + (Fintype.card κ : ℝ) / (n : ℝ) ^ 2) := by classical obtain ⟨B, hB, hrate⟩ := bad_occupancy_rate epsilon hepsilon hepsilon_half refine ⟨B, hB, ?_⟩ intro Ω κ _ _ _ _ _ μ _ X A n hX hA hn hoverlap let f : Ω → κ × Bool := fun ω => (X ω, A ω) let ν : Measure (κ × Bool) := μ.map f have hf : Measurable f := hX.prodMk hA haveI : IsProbabilityMeasure ν := Measure.isProbabilityMeasure_map hf.aemeasurable have hcell (k : κ) : cellMass ν (fun v : κ × Bool => v.1) k = cellMass μ X k := by unfold cellMass ν change ((μ.map f) {v : κ × Bool | v.1 = k}).toReal = (μ {ω | X ω = k}).toReal rw [Measure.map_apply hf (measurableSet_eq_fun measurable_fst measurable_const)] rfl have harm (a : Bool) (k : κ) : armCellMass ν (fun v : κ × Bool => v.1) (fun v => v.2) a k = armCellMass μ X A a k := by unfold armCellMass ν change ((μ.map f) {v : κ × Bool | v.1 = k ∧ v.2 = a}).toReal = (μ {ω | X ω = k ∧ A ω = a}).toReal rw [Measure.map_apply hf (Set.Finite.measurableSet (Set.toFinite _))] rfl have hoverlap' : ∀ a k, 0 < cellMass ν (fun v : κ × Bool => v.1) k → epsilon * cellMass ν (fun v => v.1) k ≤ armCellMass ν (fun v => v.1) (fun v => v.2) a k := by intro a k hk rw [hcell, harm] exact hoverlap a k (hcell k ▸ hk) let F : (Fin n → Ω) → (Fin n → κ × Bool) := fun z i => f (z i) have hF : Measurable F := measurable_pi_lambda _ (fun i => hf.comp (measurable_pi_apply i)) have hpi : (Measure.pi (fun _ : Fin n => μ)).map F = Measure.pi (fun _ : Fin n => ν) := iid_design_marginal n μ X A hX hA have hE : MeasurableSet {z : Fin n → κ × Bool | usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z = 0} := measurableSet_eq_fun (measurable_usableGroupTotal (fun v : κ × Bool => v.1) (fun v => v.2) measurable_fst measurable_snd) measurable_const have htransport : ((Measure.pi (fun _ : Fin n => μ)) {z | usableTotal X A z = 0}).toReal = ((Measure.pi (fun _ : Fin n => ν)) {z | usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z = 0}).toReal := by rw [← hpi, Measure.map_apply hF hE] rfl rw [htransport] exact hrate κ ν n hn hoverlap'
Occupancy 1 core · 3 supporting These estimates concern only the finite observed design law on cell-arm pairs. ★ reciprocal_occupancy_rate
Uniform usable-occupancy controls
These estimates concern only the finite observed design law on cell-arm pairs. The constants are chosen before the cell alphabet, its masses, and sample size. The finite-product transport lemma moves them to any measurable observed law.
For an overlap margin ε strictly between zero and one half, there is a positive constant B, depending only on ε, such that the following holds for every finite set of cells, every probability law on cell-arm pairs, and every positive sample size n: if in each cell of positive mass both arm-cell pairs have mass at least ε times the cell mass, then under n independent draws the expectation of the reciprocal of the usable total (the number of observations in cells containing both arms), with the reciprocal read as zero when the usable total is zero, is at most B·(1/n + card(κ)/n²), where card(κ) is the number of cells.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
iid_design_marginaltheorem — Applying the measured cell and arm labels to every iid observation gives iid draws from the observed cell-arm marginal.hypothesesProof (Lean source)
theorem iid_design_marginal {Ω κ : Type} [MeasurableSpace Ω] [MeasurableSpace κ] (n : ℕ) (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (hX : Measurable X) (hA : Measurable A) : (Measure.pi (fun _ : Fin n => μ)).map (fun z : Fin n → Ω => fun i => (X (z i), A (z i))) = Measure.pi (fun _ : Fin n => μ.map (fun ω => (X ω, A ω))) := by exact map_pi_finCoordinatewise n μ (hX.prodMk hA) -
fixed_design_laplace_ratetheorem — The fixed-size Laplace transform of usable occupancy has a birthday-scale bound for every finite measurable cell alphabet, including null cells. The constant depends only on occupied-cell overlap.hypothesesepsilon :ℝhepsilon :0 < epsilonhepsilon_half :epsilon < 1 / 2conclusion∃ c : ℝ,0 < cconclusion 1κ :TypeFintype κn :ℕ0 < n(∀ a k, 0 < cellMass ν (fun z : κ × Bool => z.1) k → epsilon * cellMass ν (fun z : κ × Bool => z.1) k ≤ armCellMass ν (fun z => z.1) (fun z => z.2) a k)Proof (Lean source)
theorem fixed_design_laplace_rate (epsilon : ℝ) (hepsilon : 0 < epsilon) (hepsilon_half : epsilon < 1 / 2) : ∃ c : ℝ, 0 < c ∧ ∀ (κ : Type) [Fintype κ] [DecidableEq κ] [MeasurableSpace κ] [MeasurableSingletonClass κ] (ν : Measure (κ × Bool)) [IsProbabilityMeasure ν] (n : ℕ), 0 < n → (∀ a k, 0 < cellMass ν (fun z : κ × Bool => z.1) k → epsilon * cellMass ν (fun z : κ × Bool => z.1) k ≤ armCellMass ν (fun z => z.1) (fun z => z.2) a k) → (∫ z : Fin n → κ × Bool, exp (-(usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z : ℝ)) ∂Measure.pi (fun _ : Fin n => ν)) ≤ 2 * exp (-(c * (n : ℝ) ^ 2 / max (n : ℝ) (Fintype.card κ : ℝ))) := by classical obtain ⟨c, hc, hrate⟩ := poissonized_design_laplace_rate epsilon hepsilon hepsilon_half refine ⟨c, hc, ?_⟩ intro κ _ _ _ _ ν _ n hn hoverlap let e : κ ≃ Fin (Fintype.card κ) := Fintype.equivFin κ let em : κ ≃ᵐ Fin (Fintype.card κ) := MeasurableEquiv.mk e (measurable_of_countable _) (measurable_of_countable _) let ep : (κ × Bool) ≃ᵐ (Fin (Fintype.card κ) × Bool) := em.prodCongr (MeasurableEquiv.refl Bool) let ν' : Measure (Fin (Fintype.card κ) × Bool) := ν.map ep have : IsProbabilityMeasure ν' := Measure.isProbabilityMeasure_map ep.measurable.aemeasurable have hcell (k : κ) : cellMass ν' (fun v : Fin (Fintype.card κ) × Bool => v.1) (e k) = cellMass ν (fun v : κ × Bool => v.1) k := by unfold cellMass ν' rw [Measure.map_apply ep.measurable (Set.Finite.measurableSet (Set.toFinite _))] congr 1 apply congrArg ν ext v change e v.1 = e k ↔ v.1 = k exact e.injective.eq_iff have harm (a : Bool) (k : κ) : armCellMass ν' (fun v : Fin (Fintype.card κ) × Bool => v.1) (fun v => v.2) a (e k) = armCellMass ν (fun v : κ × Bool => v.1) (fun v => v.2) a k := by unfold armCellMass ν' rw [Measure.map_apply ep.measurable (Set.Finite.measurableSet (Set.toFinite _))] congr 1 apply congrArg ν ext v change e v.1 = e k ∧ v.2 = a ↔ v.1 = k ∧ v.2 = a simp only [e.injective.eq_iff] have hoverlap' : ∀ a k, 0 < cellMass ν' (fun v : Fin (Fintype.card κ) × Bool => v.1) k → epsilon * cellMass ν' (fun v => v.1) k ≤ armCellMass ν' (fun v => v.1) (fun v => v.2) a k := by intro a k hk obtain ⟨j, rfl⟩ := e.surjective k rw [hcell, harm] exact hoverlap a j (hcell j ▸ hk) have hcount (z : Fin n → κ × Bool) (a : Bool) (k : κ) : groupArmCount (fun v : Fin (Fintype.card κ) × Bool => v.1) (fun v => v.2) (fun i => ep (z i)) a (e k) = groupArmCount (fun v : κ × Bool => v.1) (fun v => v.2) z a k := by unfold groupArmCount congr 1 ext i simp only [mem_filter, Finset.mem_univ, true_and] change e (z i).1 = e k ∧ (z i).2 = a ↔ (z i).1 = k ∧ (z i).2 = a simp only [e.injective.eq_iff] have htotal (z : Fin n → κ × Bool) : usableTotal (fun v : Fin (Fintype.card κ) × Bool => v.1) (fun v => v.2) (fun i => ep (z i)) = usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z := by unfold usableTotal usableGroupTotal rw [← e.sum_comp] apply Finset.sum_congr rfl intro k _ simp only [usableGroup, groupCount, hcount] by_cases h : 0 < groupArmCount (fun v : κ × Bool => v.1) (fun v => v.2) z false k ∧ 0 < groupArmCount (fun v : κ × Bool => v.1) (fun v => v.2) z true k · simp [h] · simp [h] have hpi := Causalean.Stat.map_pi_finCoordinatewise n ν ep.measurable have htransport : (∫ z : Fin n → Fin (Fintype.card κ) × Bool, exp (-(usableTotal (fun v : Fin (Fintype.card κ) × Bool => v.1) (fun v => v.2) z : ℝ)) ∂Measure.pi (fun _ : Fin n => ν')) = (∫ z : Fin n → κ × Bool, exp (-(usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z : ℝ)) ∂Measure.pi (fun _ : Fin n => ν)) := by rw [← hpi] let es : (Fin n → κ × Bool) ≃ᵐ (Fin n → Fin (Fintype.card κ) × Bool) := MeasurableEquiv.piCongrRight (fun _ => ep) rw [show (fun z : Fin n → κ × Bool => fun i => ep (z i)) = es from rfl] rw [integral_map_equiv es] have hes (z : Fin n → κ × Bool) : es z = fun i => ep (z i) := rfl simp only [hes, htotal] rw [← htransport] exact (fixed_design_laplace_le_poisson ν').trans (mul_le_mul_of_nonneg_left (hrate _ ν' n hn hoverlap') (by norm_num)) -
bad_occupancy_ratetheorem — Under occupied-cell overlap, the probability of no matched cell is bounded uniformly by a constant depending only on the overlap margin times 1/n + card(κ)/n², including null cells and the zero-usable case.hypothesesepsilon :ℝhepsilon :0 < epsilonhepsilon_half :epsilon < 1 / 2conclusion∃ B : ℝ,0 < Bconclusion 1κ :TypeFintype κn :ℕ0 < n(∀ a k, 0 < cellMass ν (fun z : κ × Bool => z.1) k → epsilon * cellMass ν (fun z : κ × Bool => z.1) k ≤ armCellMass ν (fun z => z.1) (fun z => z.2) a k)((Measure.pi (fun _ : Fin n => ν)) {z | usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z = 0}).toReal≤ B * (1 / (n : ℝ) + (Fintype.card κ : ℝ) / (n : ℝ) ^ 2)Proof (Lean source)
theorem bad_occupancy_rate (epsilon : ℝ) (hepsilon : 0 < epsilon) (hepsilon_half : epsilon < 1 / 2) : ∃ B : ℝ, 0 < B ∧ ∀ (κ : Type) [Fintype κ] [DecidableEq κ] [MeasurableSpace κ] [MeasurableSingletonClass κ] (ν : Measure (κ × Bool)) [IsProbabilityMeasure ν] (n : ℕ), 0 < n → (∀ a k, 0 < cellMass ν (fun z : κ × Bool => z.1) k → epsilon * cellMass ν (fun z : κ × Bool => z.1) k ≤ armCellMass ν (fun z => z.1) (fun z => z.2) a k) → ((Measure.pi (fun _ : Fin n => ν)) {z | usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z = 0}).toReal ≤ B * (1 / (n : ℝ) + (Fintype.card κ : ℝ) / (n : ℝ) ^ 2) := by classical obtain ⟨c, hc, hlap⟩ := fixed_design_laplace_rate epsilon hepsilon hepsilon_half obtain ⟨B, hB, hrate⟩ := birthday_laplace_rate c hc refine ⟨B, hB, ?_⟩ intro κ _ _ _ _ ν _ n hn hoverlap let P : Measure (Fin n → κ × Bool) := Measure.pi (fun _ : Fin n => ν) let T (z : Fin n → κ × Bool) := usableTotal (fun v : κ × Bool => v.1) (fun v => v.2) z let E : Set (Fin n → κ × Bool) := {z | T z = 0} have hE : MeasurableSet E := by exact measurableSet_eq_fun (measurable_usableGroupTotal (n := n) (fun v : κ × Bool => v.1) (fun v => v.2) measurable_fst measurable_snd) measurable_const have hmono : (∫ z, E.indicator (1 : (Fin n → κ × Bool) → ℝ) z ∂P) ≤ ∫ z, exp (-(T z : ℝ)) ∂P := by apply integral_mono Integrable.of_finite Integrable.of_finite intro z simpa [E, T, indicator, Set.indicator_apply] using zero_indicator_le_exp (T z) have hprob : P.real E = ∫ z, E.indicator (1 : (Fin n → κ × Bool) → ℝ) z ∂P := (integral_indicator_one hE).symm change P.real E ≤ _ calc P.real E = ∫ z, E.indicator (1 : (Fin n → κ × Bool) → ℝ) z ∂P := hprob _ ≤ ∫ z, exp (-(T z : ℝ)) ∂P := hmono _ ≤ 2 * exp (-(c * (n : ℝ) ^ 2 / max (n : ℝ) (Fintype.card κ : ℝ))) := hlap κ ν n hn hoverlap _ ≤ B * (1 / (n : ℝ) + (Fintype.card κ : ℝ) / (n : ℝ) ^ 2) := hrate n (Fintype.card κ) hn
OccupancyBridge 1 core · 2 supporting This module separates the deterministic prefix monotonicity, independent Poisson occupancy estimate, and half-intensity de-Poissonization needed for uniform fixed-sample collision bounds. ★ fixed_design_laplace_le_poisson
Poissonization bridge for finite observed designs
This module separates the deterministic prefix monotonicity, independent Poisson occupancy estimate, and half-intensity de-Poissonization needed for uniform fixed-sample collision bounds. All laws here concern observed cell and arm labels.
Given a finite cell count and sample size and an observed probability law on cell-arm pairs, the expectation of exp(−usable total) under n independent draws is at most twice the expectation of the same quantity for a Poissonized sample, in which the number of independent draws is itself Poisson with mean n/2. The usable total is the number of observations in cells containing both arms; no overlap condition is assumed.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
usableTotal_prefix_monotheorem — Adding observations cannot decrease the number of observations lying in cells where both observed arms are present. This includes the case in which a previously unmatched cell becomes matched.hypothesesconclusionProof (Lean source)
theorem usableTotal_prefix_mono {Ω κ : Type} [Fintype κ] [DecidableEq κ] {n N : ℕ} (hnN : n ≤ N) (X : Ω → κ) (A : Ω → Bool) (z : Fin N → Ω) : usableTotal X A (fun i : Fin n => z (castLE hnN i)) ≤ usableTotal X A z := by classical have hcount (a : Bool) (k : κ) : groupArmCount X A (fun i : Fin n => z (castLE hnN i)) a k ≤ groupArmCount X A z a k := by unfold groupArmCount apply Finset.card_le_card_of_injOn (castLE hnN) · intro i hi simpa using hi · intro i _ j _ hij exact Fin.castLE_injective hnN hij unfold usableTotal usableGroupTotal apply Finset.sum_le_sum intro k _ by_cases hp : usableGroup X A (fun i : Fin n => z (castLE hnN i)) k · have hfull : usableGroup X A z k := by exact ⟨lt_of_lt_of_le hp.1 (hcount false k), lt_of_lt_of_le hp.2 (hcount true k)⟩ simp only [if_pos hp, if_pos hfull, groupCount] have hf := hcount false k have ht := hcount true k omega · simp [hp] -
poissonized_design_laplace_ratetheorem — The half-intensity Poisson sample has an exponentially small Laplace transform of usable occupancy, uniformly over finite observed cell masses and null cells under arm-cell overlap. The positive exponent constant depends only on the overlap margin.hypothesesepsilon :ℝhepsilon :0 < epsilonhepsilon_half :epsilon < 1 / 2conclusion∃ c : ℝ,0 < cconclusion 1d :ℕn :ℕ0 < n(∀ a k, 0 < cellMass ν (fun v : Fin d × Bool => v.1) k → epsilon * cellMass ν (fun v : Fin d × Bool => v.1) k ≤ armCellMass ν (fun v => v.1) (fun v => v.2) a k)(∫ s : FiniteSample (Fin d × Bool), exp (-(usableTotal (fun v : Fin d × Bool => v.1) (fun v => v.2) s.2 : ℝ)) ∂finitePoissonSampleLaw ν ((n : ℝ≥0) / 2))Proof (Lean source)
theorem poissonized_design_laplace_rate (epsilon : ℝ) (hepsilon : 0 < epsilon) (hepsilon_half : epsilon < 1 / 2) : ∃ c : ℝ, 0 < c ∧ ∀ (d : ℕ) (ν : Measure (Fin d × Bool)) [IsProbabilityMeasure ν] (n : ℕ), 0 < n → (∀ a k, 0 < cellMass ν (fun v : Fin d × Bool => v.1) k → epsilon * cellMass ν (fun v : Fin d × Bool => v.1) k ≤ armCellMass ν (fun v => v.1) (fun v => v.2) a k) → (∫ s : FiniteSample (Fin d × Bool), exp (-(usableTotal (fun v : Fin d × Bool => v.1) (fun v => v.2) s.2 : ℝ)) ∂finitePoissonSampleLaw ν ((n : ℝ≥0) / 2)) ≤ exp (-(c * (n : ℝ) ^ 2 / max (n : ℝ) (d : ℝ))) := by classical obtain ⟨c₀, hc₀, hrate⟩ := independent_poisson_laplace_rate epsilon hepsilon hepsilon_half refine ⟨c₀ / 4, by positivity, ?_⟩ intro d ν _ n hn hoverlap have hd : 0 < d := by by_contra h have hzero : d = 0 := by omega subst d have hempty : (Set.univ : Set (Fin 0 × Bool)) = ∅ := by ext ⟨k, a⟩ exact elim0 k have hprob := measure_univ (μ := ν) rw [hempty, measure_empty] at hprob exact zero_ne_one hprob let lam : ℝ≥0 := (n : ℝ≥0) / 2 let u : Fin d → ℝ≥0 := fun k => lam * (ν {(k, false)}).toNNReal let v : Fin d → ℝ≥0 := fun k => lam * (ν {(k, true)}).toNNReal let x : Fin d → ℝ := fun k => (u k : ℝ) + v k have hsplit (k : Fin d) : ν {(k, false)} + ν {(k, true)} = ν (groupEvent (fun w : Fin d × Bool => w.1) k) := by rw [← measure_union (by simp) (measurableSet_singleton _)] congr 1 ext ⟨j, a⟩ cases a <;> simp [groupEvent] have hx (k : Fin d) : x k = (lam : ℝ) * cellMass ν (fun w => w.1) k := by simp only [x, u, v, cellMass] rw [← NNReal.coe_add, ← mul_add, ← ENNReal.toNNReal_add (measure_ne_top ν _) (measure_ne_top ν _), hsplit] rfl have hsum : ∑ k, x k = (lam : ℝ) := by let p : FiniteMeasurablePartition (Fin d × Bool) (Fin d) := ⟨Prod.fst, measurable_fst⟩ have hp : ∑ k, cellMass ν (fun w : Fin d × Bool => w.1) k = 1 := by have h := p.sum_cellMass ν apply_fun (fun t : ℝ≥0 => (t : ℝ)) at h norm_cast at h calc _ = ∑ k, (p.cellMass ν k : ℝ) := by apply Finset.sum_congr rfl intro k _ rfl _ = 1 := by exact_mod_cast h simp_rw [hx] rw [← Finset.mul_sum, hp, mul_one] have hu (k : Fin d) : epsilon * x k ≤ u k := by by_cases hk : 0 < cellMass ν (fun w : Fin d × Bool => w.1) k · have hh := hoverlap false k hk rw [hx] have hle : (lam : ℝ) * (epsilon * cellMass ν (fun w => w.1) k) ≤ (lam : ℝ) * armCellMass ν (fun w => w.1) (fun w => w.2) false k := mul_le_mul_of_nonneg_left hh (by positivity) convert hle using 1 · ring · have hevent : armGroupEvent (fun w : Fin d × Bool => w.1) (fun w => w.2) false k = {(k, false)} := by ext ⟨j, a⟩ cases a <;> simp [armGroupEvent] simp [u, armCellMass, hevent, toReal] · have hz : cellMass ν (fun w : Fin d × Bool => w.1) k = 0 := by have : 0 ≤ cellMass ν (fun w : Fin d × Bool => w.1) k := by unfold cellMass positivity exact le_antisymm (le_of_not_gt hk) this simp [hx, hz] have hv (k : Fin d) : epsilon * x k ≤ v k := by by_cases hk : 0 < cellMass ν (fun w : Fin d × Bool => w.1) k · have hh := hoverlap true k hk rw [hx] have hle : (lam : ℝ) * (epsilon * cellMass ν (fun w => w.1) k) ≤ (lam : ℝ) * armCellMass ν (fun w => w.1) (fun w => w.2) true k := mul_le_mul_of_nonneg_left hh (by positivity) convert hle using 1 · ring · have hevent : armGroupEvent (fun w : Fin d × Bool => w.1) (fun w => w.2) true k = {(k, true)} := by ext ⟨j, a⟩ cases a <;> simp [armGroupEvent] simp [v, armCellMass, hevent, toReal] · have hz : cellMass ν (fun w : Fin d × Bool => w.1) k = 0 := by have : 0 ≤ cellMass ν (fun w : Fin d × Bool => w.1) k := by unfold cellMass positivity exact le_antisymm (le_of_not_gt hk) this simp [hx, hz] have hbound := hrate d hd u v x (lam : ℝ) (fun k => rfl) hu hv hsum let H : FiniteSample (Fin d × Bool) → Fin d → ℕ × ℕ := fun s k => (groupArmCount (fun w : Fin d × Bool => w.1) (fun w => w.2) s.2 false k, groupArmCount (fun w : Fin d × Bool => w.1) (fun w => w.2) s.2 true k) have hH : Measurable H := by intro t ht rw [MeasurableSpace.measurableSet_iInf] intro m change MeasurableSet ((fun z : Fin m → Fin d × Bool => H ⟨m, z⟩) ⁻¹' t) exact (Set.to_countable _).measurableSet have hcount (s : FiniteSample (Fin d × Bool)) : (usableTotal (fun w : Fin d × Bool => w.1) (fun w => w.2) s.2 : ℝ) = ∑ k, (usablePoissonPairCount (H s k) : ℝ) := by unfold usableTotal usableGroupTotal usablePoissonPairCount usableGroup groupCount H push_cast rfl have htransport : (∫ s : FiniteSample (Fin d × Bool), exp (-(usableTotal (fun w : Fin d × Bool => w.1) (fun w => w.2) s.2 : ℝ)) ∂finitePoissonSampleLaw ν lam) = ∫ z : Fin d → ℕ × ℕ, exp (-(∑ k, (usablePoissonPairCount (z k) : ℝ))) ∂Measure.pi (fun k => (poissonMeasure (u k)).prod (poissonMeasure (v k))) := by rw [← poisson_arm_cell_count_law ν lam] rw [integral_map hH.aemeasurable (measurable_of_countable _).aestronglyMeasurable] congr 1 funext s rw [hcount] rw [htransport] have hlam : (lam : ℝ) = (n : ℝ) / 2 := by simp [lam, NNReal.coe_div] rw [hlam] at hbound have hnreal : (0 : ℝ) < n := by exact_mod_cast hn have hdreal : (0 : ℝ) ≤ d := by positivity have hmax : 0 < max (n : ℝ) (d : ℝ) := lt_of_lt_of_le hnreal (le_max_left _ _) have hr : c₀ / 4 * (n : ℝ) ^ 2 / max (n : ℝ) (d : ℝ) ≤ c₀ * ((n : ℝ) / 2) ^ 2 / max ((n : ℝ) / 2) (d : ℝ) := by have hmaxle : max ((n : ℝ) / 2) (d : ℝ) ≤ max (n : ℝ) (d : ℝ) := max_le_max_right _ (by linarith) have hmaxhalf : 0 < max ((n : ℝ) / 2) (d : ℝ) := by apply lt_of_lt_of_le (by linarith : (0 : ℝ) < (n : ℝ) / 2) exact le_max_left _ _ apply (div_le_div_iff₀ hmax hmaxhalf).2 nlinarith [mul_nonneg (show 0 ≤ c₀ * (n : ℝ) ^ 2 by positivity) (sub_nonneg.mpr hmaxle)] exact le_trans hbound (Real.exp_le_exp.mpr (neg_le_neg hr))
PoissonAggregate 1 core · 1 supporting The deterministic light and heavy mass split and the resulting product-law Laplace estimate are separated from transport of the finite Poisson sample. ★ independent_poisson_laplace_rate
Aggregating independent Poisson cells
The deterministic light and heavy mass split and the resulting product-law Laplace estimate are separated from transport of the finite Poisson sample.
For an overlap margin ε strictly between zero and one half, there is a positive constant c, depending only on ε, such that the following holds for every positive number d of cells and every table of nonnegative control and treated Poisson intensities whose cell totals are x and whose grand total is T: if in each cell both intensities are at least ε times the cell total, then, for independent Poisson arm counts with those intensities, the expectation of exp(−sum over cells of the usable count) is at most exp(−c·T²/max(T, d)). The usable count of a cell is the sum of its two arm counts when both are positive, and zero otherwise.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
lightHeavyExponent_ge_birthdayScaletheorem — For nonnegative cell intensities summing to total, the quadratic cost in cells of intensity at most one and linear cost in the other cells dominate the birthday-scale quantity total² / max total d. This includes zero intensity and null cells.hypothesesd :ℕhd :0 < dtotal a b :ℝhtotal :0 ≤ totalha :0 ≤ ahb :0 ≤ bx :Fin d → ℝhx :∀ k, 0 ≤ x khsum :∑ k, x k = totalProof (Lean source)
theorem lightHeavyExponent_ge_birthdayScale {d : ℕ} (hd : 0 < d) {total a b : ℝ} (htotal : 0 ≤ total) (ha : 0 ≤ a) (hb : 0 ≤ b) (x : Fin d → ℝ) (hx : ∀ k, 0 ≤ x k) (hsum : ∑ k, x k = total) : min (a / 4) (b / 2) * total ^ 2 / max total (d : ℝ) ≤ a * ∑ k ∈ Finset.univ.filter (fun k ↦ x k ≤ 1), x k ^ 2 + b * ∑ k ∈ Finset.univ.filter (fun k ↦ 1 < x k), x k := by let light : Finset (Fin d) := Finset.univ.filter (fun k ↦ x k ≤ 1) let heavy : Finset (Fin d) := Finset.univ.filter (fun k ↦ 1 < x k) have hpartition : (∑ k ∈ light, x k) + ∑ k ∈ heavy, x k = total := by rw [← hsum] classical rw [← Finset.sum_filter_add_sum_filter_not univ (fun k ↦ x k ≤ 1) x] simp only [light, heavy, not_le] have hmax_pos : 0 < max total (d : ℝ) := lt_of_lt_of_le (by exact_mod_cast hd) (le_max_right _ _) have htotal_rate : total ^ 2 / max total (d : ℝ) ≤ total := by apply (div_le_iff₀ hmax_pos).2 nlinarith [le_max_left total (d : ℝ)] by_cases hheavy : total / 2 ≤ ∑ k ∈ heavy, x k · have hc_le : min (a / 4) (b / 2) ≤ b / 2 := min_le_right _ _ have hleft : min (a / 4) (b / 2) * total ^ 2 / max total (d : ℝ) ≤ b * (total / 2) := by calc min (a / 4) (b / 2) * total ^ 2 / max total (d : ℝ) = min (a / 4) (b / 2) * (total ^ 2 / max total (d : ℝ)) := by ring _ ≤ min (a / 4) (b / 2) * total := mul_le_mul_of_nonneg_left htotal_rate (le_min (by positivity) (by positivity)) _ ≤ (b / 2) * total := mul_le_mul_of_nonneg_right hc_le htotal _ = b * (total / 2) := by ring have hlight_nonneg : 0 ≤ a * ∑ k ∈ light, x k ^ 2 := by positivity have := mul_le_mul_of_nonneg_left hheavy hb change min (a / 4) (b / 2) * total ^ 2 / max total (d : ℝ) ≤ a * ∑ k ∈ light, x k ^ 2 + b * ∑ k ∈ heavy, x k nlinarith · have hlight_mass : total / 2 < ∑ k ∈ light, x k := by linarith have hcauchy : (∑ k ∈ light, x k) ^ 2 ≤ (light.card : ℝ) * ∑ k ∈ light, x k ^ 2 := by simpa using sq_sum_le_card_mul_sum_sq (s := light) (f := x) have hcard : (light.card : ℝ) ≤ d := by have hcardNat : light.card ≤ card (Fin d) := light.card_le_univ rw [Fintype.card_fin] at hcardNat exact_mod_cast hcardNat have hsquares_nonneg : 0 ≤ ∑ k ∈ light, x k ^ 2 := by positivity have hcauchy_d : (∑ k ∈ light, x k) ^ 2 ≤ (d : ℝ) * ∑ k ∈ light, x k ^ 2 := hcauchy.trans (mul_le_mul_of_nonneg_right hcard hsquares_nonneg) have hhalf_sq : (total / 2) ^ 2 ≤ (∑ k ∈ light, x k) ^ 2 := by nlinarith [Finset.sum_nonneg (s := light) (fun k _ ↦ hx k)] have hsquares : total ^ 2 / (4 * d) ≤ ∑ k ∈ light, x k ^ 2 := by have hdreal : (0 : ℝ) < d := by exact_mod_cast hd apply (div_le_iff₀ (by positivity : (0 : ℝ) < 4 * d)).2 nlinarith have hrate_d : total ^ 2 / max total (d : ℝ) ≤ total ^ 2 / d := by exact div_le_div_of_nonneg_left (sq_nonneg total) (by exact_mod_cast hd) (le_max_right _ _) have hc_le : min (a / 4) (b / 2) ≤ a / 4 := min_le_left _ _ have hleft : min (a / 4) (b / 2) * total ^ 2 / max total (d : ℝ) ≤ a * (total ^ 2 / (4 * d)) := by calc min (a / 4) (b / 2) * total ^ 2 / max total (d : ℝ) = min (a / 4) (b / 2) * (total ^ 2 / max total (d : ℝ)) := by ring _ ≤ min (a / 4) (b / 2) * (total ^ 2 / d) := mul_le_mul_of_nonneg_left hrate_d (le_min (by positivity) (by positivity)) _ ≤ (a / 4) * (total ^ 2 / d) := mul_le_mul_of_nonneg_right hc_le (by positivity) _ = a * (total ^ 2 / (4 * d)) := by ring have hheavy_nonneg : 0 ≤ b * ∑ k ∈ heavy, x k := by exact mul_nonneg hb (Finset.sum_nonneg fun k _ ↦ hx k) dsimp [light, heavy] at * nlinarith [mul_le_mul_of_nonneg_left hsquares ha]
PoissonProduct 1 core · 1 supporting These lemmas separate the independent-coordinate integral identity from the finite product comparison used in the birthday-scale occupancy estimate. ★ poisson_cell_product_le_exp_sum
Product-law Poisson occupancy bounds
These lemmas separate the independent-coordinate integral identity from the finite product comparison used in the birthday-scale occupancy estimate.
Take two vectors of Poisson arm intensities over finitely many cells, a real number x attached to each cell, and two real exponents a and b. If every cell with x at most one has one-cell Laplace factor at most exp(−a·x²) and every cell with x above one has one-cell Laplace factor at most exp(−b·x), then the product of the one-cell Laplace factors over all cells is at most exp(−(a·S₂ + b·S₁)), where S₂ is the sum of x² over the cells with x at most one and S₁ is the sum of x over the cells with x above one.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
poisson_usable_integral_eq_prodtheorem — The Laplace transform of the sum of usable counts from independent two-arm Poisson cells is the product of the individual cell transforms, including an empty alphabet and zero-intensity cells.hypothesesd :ℕu v :Fin d → ℝ≥0conclusion(∫ z : Fin d → ℕ × ℕ, exp (-(∑ k, (usablePoissonPairCount (z k) : ℝ))) ∂Measure.pi (fun k => (poissonMeasure (u k)).prod (poissonMeasure (v k))))= ∏ k, poissonCellLaplace (u k) (v k)Proof (Lean source)
theorem poisson_usable_integral_eq_prod {d : ℕ} (u v : Fin d → ℝ≥0) : (∫ z : Fin d → ℕ × ℕ, exp (-(∑ k, (usablePoissonPairCount (z k) : ℝ))) ∂Measure.pi (fun k => (poissonMeasure (u k)).prod (poissonMeasure (v k)))) = ∏ k, poissonCellLaplace (u k) (v k) := by -- Rewrite exp of the finite sum as a finite product and apply -- `integral_fintype_prod_eq_prod` from Mathlib.MeasureTheory.Integral.Pi. have hfun : (fun z : Fin d → ℕ × ℕ => exp (-(∑ k, (usablePoissonPairCount (z k) : ℝ)))) = (fun z => ∏ k, exp (-(usablePoissonPairCount (z k) : ℝ))) := by funext z rw [← Finset.sum_neg_distrib, Real.exp_sum] rw [hfun] simpa only [poissonCellLaplace] using (MeasureTheory.integral_fintype_prod_eq_prod (fun _ (r : ℕ × ℕ) => exp (-(usablePoissonPairCount r : ℝ))) (μ := fun k => (poissonMeasure (u k)).prod (poissonMeasure (v k))))
PoissonTransport 1 core · 0 supporting The count-law identity transports an observed finite Poisson sample to its independent Poisson arm-cell histogram, including cells of zero mass. ★ poisson_arm_cell_count_law
Poisson sample to independent arm-cell counts
The count-law identity transports an observed finite Poisson sample to its independent Poisson arm-cell histogram, including cells of zero mass.
Given a finite cell count, an observed probability law, and a nonnegative Poisson mean λ, draw a Poisson(λ) number of independent observations from the law. Then the table of control and treated counts in each cell has independent entries across cells and arms, the count of each arm-cell pair being Poisson with mean λ times that pair's probability; a pair of zero probability has the degenerate Poisson law with mean zero.
Formal statement
Proof (Lean source)
Prefix 1 core · 1 supporting A deterministic prefix of a larger iid sample has the finite product law used by the observed collision-risk theorem. ★ integral_prefix_collision_error_sq
Deterministic iid pilot prefixes
A deterministic prefix of a larger iid sample has the finite product law used by the observed collision-risk theorem. The squared-risk identity records the transport needed by a paper-local pilot estimator.
Given an observed probability law and finite cell setting, measurable cell, arm, and outcome maps with centers, and sample sizes n ≤ N, the expected squared difference between the collision estimator and the population contrast is the same whether the estimator is computed from the first n observations of N independent draws or from n independent draws.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
iid_prefix_maptheorem — Selecting the first n coordinates of an N-observation iid sample pushes its law forward to the n-fold observed product law.hypothesesProof (Lean source)
theorem iid_prefix_map {Ω : Type} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] {n N : ℕ} (hnN : n ≤ N) : (Measure.pi (fun _ : Fin N => μ)).map (fun z : Fin N → Ω => fun i : Fin n => z (castLE hnN i)) = Measure.pi (fun _ : Fin n => μ) := by let e : {i : Fin N // (i : ℕ) < n} ≃ Fin n := (Fin.castLEquiv hnN).symm have h₁ := measurePreserving_pi_restrict μ (fun i : Fin N => (i : ℕ) < n) have h₂ := measurePreserving_piCongrLeft (α := fun _ : Fin n => Ω) (fun _ : Fin n => μ) e have h := h₂.comp h₁ convert h.map_eq using 1 congr 1
Risk 1 core · 2 supporting This module combines a design-only usable-occupancy estimate with centered real-mark variance and approximate homogeneity. ★ observed_collision_mse_le
Observed-law collision mean-square risk
This module combines a design-only usable-occupancy estimate with centered real-mark variance and approximate homogeneity. Its estimator and every hypothesis are functions of the observed law alone.
For an overlap margin ε strictly between zero and one half, there is a positive constant C, depending only on ε, such that the following holds for every probability law with a label into a finite set of cells, a Boolean arm label, a real outcome, supplied arm-and-cell centres, an envelope M, a heterogeneity level ρ, and every positive sample size n: if the observed-law assumptions hold with these ε, M and ρ, then under n independent draws the expected squared difference between the cell-count-weighted collision estimator and the population contrast is at most C·M²·(1/n + ρ² + card(κ)/n²), where card(κ) is the number of cells. The observed-law assumptions are occupied-cell overlap at margin ε, centres bounded by M, arm-cell residuals that are centred with second moment at most M², and occupied-cell contrasts within M·ρ of the population contrast.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
integral_collision_noise_sq_letheorem — Centered observed arm-cell residuals bound the collision estimator's integrated noise by the expected reciprocal usable total, with a constant depending only on overlap.hypothesesΩ :sharedTypeκ :sharedTypen :ℕμ :X :Ω → κA :Ω → BoolY :Ω → ℝcenter :Bool → κ → ℝepsilon M rho :ℝh :ObservedAssumptions μ X A Y center epsilon M rhoconclusion(∫ z : Fin n → Ω, (collisionEstimator X A Y z - designCenter X A center z) ^ 2 ∂Measure.pi (fun _ : Fin n => μ))≤ (16 / (epsilon ^ 2 * (1 - epsilon))) * M ^ 2 * ∫ z : Fin n → Ω, inverseUsableGroupTotal X A z ∂Measure.pi (fun _ : Fin n => μ)Proof (Lean source)
theorem integral_collision_noise_sq_le {n : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (center : Bool → κ → ℝ) (epsilon M rho : ℝ) (h : ObservedAssumptions μ X A Y center epsilon M rho) : (∫ z : Fin n → Ω, (collisionEstimator X A Y z - designCenter X A center z) ^ 2 ∂Measure.pi (fun _ : Fin n => μ)) ≤ (16 / (epsilon ^ 2 * (1 - epsilon))) * M ^ 2 * ∫ z : Fin n → Ω, inverseUsableGroupTotal X A z ∂Measure.pi (fun _ : Fin n => μ) := by -- Rewrite noise as Causalean's occupancyWeightedResidual and apply -- integral_occupancyWeightedResidual_sq_le_reciprocal directly to h's -- measurable maps, L2, centered residual, second moment, and overlap fields. have hnoise := integral_occupancyWeightedResidual_sq_le_reciprocal (n := n) μ X A Y center M epsilon h.X_measurable h.A_measurable h.Y_measurable h.residual_L2 h.residual_centered (by simpa only [armCellMass] using h.residual_second_moment) h.epsilon_pos h.epsilon_lt_half.le (by intro k hk a; exact h.overlap a k hk) simpa only [← collision_sub_designCenter_eq_residual, inverseUsableGroupTotal] using hnoise -
integral_designCenter_bias_sq_letheorem — The integrated squared design bias is bounded by homogeneity plus the probability that no observed cell contains both arms.hypothesesΩ :sharedTypeκ :sharedTypen :ℕμ :X :Ω → κA :Ω → BoolY :Ω → ℝcenter :Bool → κ → ℝepsilon M rho :ℝh :ObservedAssumptions μ X A Y center epsilon M rhoconclusion(∫ z : Fin n → Ω, (designCenter X A center z - populationContrast μ X center) ^ 2 ∂Measure.pi (fun _ : Fin n => μ))Proof (Lean source)
theorem integral_designCenter_bias_sq_le {n : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (center : Bool → κ → ℝ) (epsilon M rho : ℝ) (h : ObservedAssumptions μ X A Y center epsilon M rho) : (∫ z : Fin n → Ω, (designCenter X A center z - populationContrast μ X center) ^ 2 ∂Measure.pi (fun _ : Fin n => μ)) ≤ M ^ 2 * (rho ^ 2 + 4 * ((Measure.pi (fun _ : Fin n => μ)) {z | usableTotal X A z = 0}).toReal) := by classical let ν : Measure (Fin n → Ω) := Measure.pi (fun _ : Fin n => μ) let S : Set (Fin n → Ω) := {z | usableTotal X A z = 0} have hS : MeasurableSet S := (measurable_usableGroupTotal X A h.X_measurable h.A_measurable) (measurableSet_singleton 0) have hleft : Integrable (fun z : Fin n → Ω => (designCenter X A center z - populationContrast μ X center) ^ 2) ν := (designCenter_sub_target_memLp μ X A Y center epsilon M rho h).integrable_sq have hright : Integrable (fun z : Fin n → Ω => M ^ 2 * rho ^ 2 + S.indicator (fun _ => 4 * M ^ 2) z) ν := (integrable_const (M ^ 2 * rho ^ 2)).add ((integrable_const (4 * M ^ 2)).indicator hS) have hpoint : ∀ᵐ z ∂ν, (designCenter X A center z - populationContrast μ X center) ^ 2 ≤ M ^ 2 * rho ^ 2 + S.indicator (fun _ => 4 * M ^ 2) z := by filter_upwards [usable_supported_ae μ X A n] with z hz have hb := designCenter_bias_sq_le μ X A Y center epsilon M rho h z hz by_cases hz0 : usableTotal X A z = 0 · simpa [S, indicator, hz0, mul_add, mul_comm] using hb · simpa [S, indicator, hz0, mul_add] using hb have hbound := integral_mono_ae hleft hright hpoint have hright_integral : (∫ z : Fin n → Ω, M ^ 2 * rho ^ 2 + S.indicator (fun _ => 4 * M ^ 2) z ∂ν) = M ^ 2 * (rho ^ 2 + 4 * (ν S).toReal) := by rw [integral_add (integrable_const _) ((integrable_const _).indicator hS)] rw [integral_const, integral_indicator_const _ hS] simp only [smul_eq_mul] have hνuniv : ν.real univ = 1 := by simp [Measure.real, ν] rw [hνuniv] simp only [Measure.real] ring simpa only [ν, S, hright_integral] using hbound
RiskAlgebra 1 core · 7 supporting The identities and elementary bounds here separate outcome noise from the matched-cell design center. ★ collision_sub_target_memLp
Real-mark collision-risk algebra
The identities and elementary bounds here separate outcome noise from the matched-cell design center. They use only an observed law and include the zero-usable fallback and population-null cells.
Given a sample size, observed probability law, finite cell setting, observed maps, centers, and envelope parameters and the observed-law assumptions, the collision error has a finite second moment.
Formal statement
Proof (Lean source)
7 supporting declarations (lemmas, instances)
-
center_envelope_nonnegtheorem — The observed arm-center envelope itself forces the real scale to be nonnegative under a probability law, since some measurable cell is inhabited.hypothesesΩ :sharedTypeκ :sharedTypeμ :X :Ω → κA :Ω → BoolY :Ω → ℝcenter :Bool → κ → ℝepsilon M rho :ℝh :ObservedAssumptions μ X A Y center epsilon M rhoconclusion0 ≤ MProof (Lean source)
theorem center_envelope_nonneg (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (center : Bool → κ → ℝ) (epsilon M rho : ℝ) (h : ObservedAssumptions μ X A Y center epsilon M rho) : 0 ≤ M := by -- A probability law makes Ω, hence κ via X, nonempty. Then use -- 0 ≤ |center a k| ≤ M. obtain ⟨ω⟩ := nonempty_of_isProbabilityMeasure μ exact le_trans (abs_nonneg _) (h.center_envelope true (X ω)) -
populationContrast_abs_letheorem — The observed population contrast has magnitude at most twice the arm-center envelope under a probability law.hypothesesΩ :sharedTypeκ :sharedTypeμ :X :Ω → κA :Ω → BoolY :Ω → ℝcenter :Bool → κ → ℝepsilon M rho :ℝh :ObservedAssumptions μ X A Y center epsilon M rhoconclusion|populationContrast μ X center| ≤ 2 * MProof (Lean source)
theorem populationContrast_abs_le (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (center : Bool → κ → ℝ) (epsilon M rho : ℝ) (h : ObservedAssumptions μ X A Y center epsilon M rho) : |populationContrast μ X center| ≤ 2 * M := by -- Sum the cell masses to one; each contrast has absolute value at most 2M. classical have hmass : (∑ k : κ, cellMass μ X k) = 1 := by have hsum := sum_measureReal_preimage_singleton (μ := μ) (s := (Finset.univ : Finset κ)) (f := X) (hf := by intro k hk; exact h.X_measurable (measurableSet_singleton k)) (h := by intro k hk exact ne_of_lt <| lt_of_le_of_lt (measure_mono (Set.subset_univ _)) (by simp [IsProbabilityMeasure.measure_univ])) simpa [cellMass, groupEvent, Measure.real, preimage] using hsum have hM : 0 ≤ M := center_envelope_nonneg μ X A Y center epsilon M rho h have hbound (k : κ) : |cellMass μ X k * (center true k - center false k)| ≤ cellMass μ X k * (2 * M) := by have hcell : 0 ≤ cellMass μ X k := ENNReal.toReal_nonneg have htrue := h.center_envelope true k have hfalse := h.center_envelope false k rw [abs_mul, abs_of_nonneg hcell] apply mul_le_mul_of_nonneg_left _ hcell rw [abs_le] constructor <;> rcases abs_le.mp htrue with ⟨htl, htu⟩ <;> rcases abs_le.mp hfalse with ⟨hfl, hfu⟩ <;> linarith calc |populationContrast μ X center| = |∑ k : κ, cellMass μ X k * (center true k - center false k)| := rfl _ ≤ ∑ k : κ, |cellMass μ X k * (center true k - center false k)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k : κ, cellMass μ X k * (2 * M) := Finset.sum_le_sum (by intro k hk; exact hbound k) _ = 2 * M := by rw [← Finset.sum_mul, hmass, one_mul] -
usable_supported_aetheorem — Almost every iid sample places observations only in cells of positive observed population mass; hence every empirically matched cell is supported. The finite-cell hypothesis is essential: an atomless cell law gives zero mass to every realized singleton. Prove the claim by taking the finite union of null cell events, then the finite union over sample coordinates.hypothesesconclusion∀ᵐ z ∂Measure.pi (fun _ : Fin n => μ), ∀ k, matchedCell X A z k → 0 < cellMass μ X kProof (Lean source)
theorem usable_supported_ae (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (n : ℕ) : ∀ᵐ z ∂Measure.pi (fun _ : Fin n => μ), ∀ k, matchedCell X A z k → 0 < cellMass μ X k := by classical have hcell (k : κ) (hk : cellMass μ X k = 0) : ∀ᵐ ω ∂μ, X ω ≠ k := by have hfinite : μ (groupEvent X k) ≠ ⊤ := by exact ne_of_lt (lt_of_le_of_lt (measure_mono (Set.subset_univ _)) (by simp [IsProbabilityMeasure.measure_univ])) have hnull : μ (groupEvent X k) = 0 := (measureReal_eq_zero_iff (s := groupEvent X k)).mp (by simpa [cellMass, Measure.real] using hk) exact ae_iff.mpr (by simpa [groupEvent] using hnull) have hall : ∀ᵐ ω ∂μ, ∀ k : κ, X ω = k → 0 < cellMass μ X k := by rw [Filter.eventually_all] intro k by_cases hk : cellMass μ X k = 0 · exact (hcell k hk).mono (by intro ω hω heq; exact False.elim (hω heq)) · filter_upwards [] with ω intro _ exact lt_of_le_of_ne ENNReal.toReal_nonneg (Ne.symm hk) have hcoords : ∀ᵐ z ∂Measure.pi (fun _ : Fin n => μ), ∀ i : Fin n, ∀ k : κ, X (z i) = k → 0 < cellMass μ X k := (Filter.eventually_all.2 fun i => (Measure.tendsto_eval_ae_ae (μ := fun _ : Fin n => μ) (i := i)).eventually hall) filter_upwards [hcoords] with z hz k hk obtain ⟨i, hi⟩ : ∃ i : Fin n, X (z i) = k := by have hcount : 0 < groupArmCount X A z false k := hk.1 obtain ⟨i, hi⟩ := Finset.card_pos.mp hcount exact ⟨i, (Finset.mem_filter.mp hi).2.1⟩ exact hz i k hi -
collision_sub_designCenter_eq_residualtheorem — The collision estimator minus its design center is exactly the occupancy-weighted difference of guarded arm-cell residual means, even when the usable total is zero.hypothesesΩ :sharedTypeκ :sharedTypen :ℕμ :Measure ΩX :Ω → κA :Ω → BoolY :Ω → ℝcenter :Bool → κ → ℝz :Fin n → ΩconclusioncollisionEstimator X A Y z - designCenter X A center z= occupancyWeightedResidual μ X A Y center zProof (Lean source)
theorem collision_sub_designCenter_eq_residual {n : ℕ} (μ : Measure Ω) (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (center : Bool → κ → ℝ) (z : Fin n → Ω) : collisionEstimator X A Y z - designCenter X A center z = occupancyWeightedResidual μ X A Y center z := by classical have hsum (a : Bool) (k : κ) : armSum X A Y z a k = armResidualSum X A Y center z a k + (groupArmCount X A z a k : ℝ) * center a k := by simp only [armSum, armResidualSum, supportedArmGroupResidual, groupArmCount] rw [Finset.card_eq_sum_ones] push_cast rw [Finset.sum_mul] simp_rw [Finset.sum_filter] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i hi by_cases h : X (z i) = k ∧ A (z i) = a <;> simp [armGroupEvent, armGroupResidual, h] have hmean (a : Bool) (k : κ) (hc : 0 < groupArmCount X A z a k) : armMean X A Y z a k = armResidualMean X A Y center z a k + center a k := by have hne : (groupArmCount X A z a k : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hc) unfold armMean armResidualMean rw [if_pos hc, if_pos hc] change (groupArmCount X A z a k : ℝ)⁻¹ * armSum X A Y z a k = (groupArmCount X A z a k : ℝ)⁻¹ * armResidualSum X A Y center z a k + center a k rw [hsum] field_simp by_cases ht : 0 < usableTotal X A z · unfold collisionEstimator designCenter occupancyWeightedResidual simp only [ht, ↓reduceIte, div_eq_inv_mul] rw [← mul_sub] congr 1 rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro k hk by_cases hu : matchedCell X A z k · simp only [hu, ↓reduceIte] rw [hmean true k hu.2, hmean false k hu.1] ring · simp [hu] · unfold collisionEstimator designCenter occupancyWeightedResidual simp [ht] -
designCenter_bias_sq_letheorem — Approximate homogeneity bounds squared design bias on supported samples; if no cell is usable, the zero fallback incurs at most four envelope squares.hypothesesΩ :sharedTypeκ :sharedTypen :ℕμ :X :Ω → κA :Ω → BoolY :Ω → ℝcenter :Bool → κ → ℝepsilon M rho :ℝh :ObservedAssumptions μ X A Y center epsilon M rhoz :Fin n → Ωhsupport :∀ kifmatchedCell X A z kthen0 < cellMass μ X kconclusion(designCenter X A center z - populationContrast μ X center) ^ 2≤ M ^ 2 * (rho ^ 2 + if usableTotal X A z = 0 then 4 else 0)Proof (Lean source)
theorem designCenter_bias_sq_le {n : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (center : Bool → κ → ℝ) (epsilon M rho : ℝ) (h : ObservedAssumptions μ X A Y center epsilon M rho) (z : Fin n → Ω) (hsupport : ∀ k, matchedCell X A z k → 0 < cellMass μ X k) : (designCenter X A center z - populationContrast μ X center) ^ 2 ≤ M ^ 2 * (rho ^ 2 + if usableTotal X A z = 0 then 4 else 0) := by -- Positive total: use a nonnegative weighted average of deviations. -- Zero total: designCenter=0 and populationContrast_abs_le gives 4M². classical let p := populationContrast μ X center let B := M * rho let w : κ → ℝ := fun k => if matchedCell X A z k then (groupCount X A z k : ℝ) else 0 let d : κ → ℝ := fun k => center true k - center false k - p have htotal : (∑ k : κ, w k) = (usableTotal X A z : ℝ) := by dsimp [w] exact_mod_cast (show (∑ k : κ, if matchedCell X A z k then groupCount X A z k else 0) = usableTotal X A z from rfl) by_cases ht : 0 < usableTotal X A z · have htR : (0 : ℝ) < (usableTotal X A z : ℝ) := by exact_mod_cast ht have hnum : (∑ k : κ, w k * d k) = (∑ k : κ, if matchedCell X A z k then (groupCount X A z k : ℝ) * (center true k - center false k) else 0) - (usableTotal X A z : ℝ) * p := by rw [← htotal, Finset.sum_mul, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro k hk by_cases hu : matchedCell X A z k <;> simp [w, d, hu]; ring have hcenter : designCenter X A center z - p = (∑ k : κ, w k * d k) / (usableTotal X A z : ℝ) := by rw [hnum] unfold designCenter simp only [ht, ↓reduceIte] field_simp have hterm (k : κ) : |w k * d k| ≤ w k * B := by by_cases hu : matchedCell X A z k · have hc := h.homogeneity k (hsupport k hu) dsimp [w, d, B] simp only [hu, ↓reduceIte, abs_mul] rw [abs_of_nonneg (show 0 ≤ (groupCount X A z k : ℝ) by positivity)] simpa [p] using mul_le_mul_of_nonneg_left hc (show 0 ≤ (groupCount X A z k : ℝ) by positivity) · simp [w, hu] have hbound : |∑ k : κ, w k * d k| ≤ (usableTotal X A z : ℝ) * B := by calc |∑ k : κ, w k * d k| ≤ ∑ k : κ, |w k * d k| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k : κ, w k * B := Finset.sum_le_sum (by intro k hk; exact hterm k) _ = (usableTotal X A z : ℝ) * B := by rw [← Finset.sum_mul, htotal] have habs : |designCenter X A center z - p| ≤ B := by rw [hcenter, abs_div, abs_of_pos htR] exact (div_le_iff₀ htR).2 (by simpa [mul_comm] using hbound) have hB : 0 ≤ B := le_trans (abs_nonneg _) habs have hsq := (sq_le_sq₀ (abs_nonneg _) hB).2 habs rw [sq_abs] at hsq simpa [p, B, (Nat.ne_of_gt ht), mul_pow] using hsq · have ht0 : usableTotal X A z = 0 := by omega have hp := populationContrast_abs_le μ X A Y center epsilon M rho h have hM : 0 ≤ M := center_envelope_nonneg μ X A Y center epsilon M rho h have hsq := (sq_le_sq₀ (abs_nonneg _) (by positivity : 0 ≤ 2 * M)).2 hp rw [sq_abs] at hsq have hdesign : designCenter X A center z = 0 := by simp [designCenter, ht0] rw [hdesign, ht0] simp only [ite_true, zero_sub, neg_sq] nlinarith [mul_nonneg (sq_nonneg M) (sq_nonneg rho)] -
measurable_collisionEstimatortheorem — Measurable cell, arm, and outcome maps make the guarded collision estimator measurable on every finite iid sample space.hypothesesconclusionMeasurable (collisionEstimator (n := n) X A Y)Proof (Lean source)
@[fun_prop] theorem measurable_collisionEstimator {n : ℕ} (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (hX : Measurable X) (hA : Measurable A) (hY : Measurable Y) : Measurable (collisionEstimator (n := n) X A Y) := by classical have heq : collisionEstimator (n := n) X A Y = occupancyWeightedResidual (n := n) (0 : Measure Ω) X A Y (fun _ _ => 0) := by funext z unfold collisionEstimator occupancyWeightedResidual split_ifs <;> simp only [armMean, div_eq_inv_mul] rw [heq] exact measurable_occupancyWeightedResidual (0 : Measure Ω) X A Y (fun _ _ => 0) hX hA hY -
designCenter_sub_target_memLptheorem — The centered design statistic has a finite second moment under bounded arm-cell centers and an observed probability law.hypothesesΩ :sharedTypeκ :sharedTypen :ℕμ :X :Ω → κA :Ω → BoolY :Ω → ℝcenter :Bool → κ → ℝepsilon M rho :ℝh :ObservedAssumptions μ X A Y center epsilon M rhoconclusionMemLp (fun z : Fin n → Ω => designCenter X A center z - populationContrast μ X center) 2 (Measure.pi (fun _ : Fin n => μ))Proof (Lean source)
theorem designCenter_sub_target_memLp {n : ℕ} (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → κ) (A : Ω → Bool) (Y : Ω → ℝ) (center : Bool → κ → ℝ) (epsilon M rho : ℝ) (h : ObservedAssumptions μ X A Y center epsilon M rho) : MemLp (fun z : Fin n → Ω => designCenter X A center z - populationContrast μ X center) 2 (Measure.pi (fun _ : Fin n => μ)) := by -- The design center is a convex average of contrasts bounded by 2M, -- or zero. Combine with populationContrast_abs_le and MemLp.of_bound. classical have hM : 0 ≤ M := center_envelope_nonneg μ X A Y center epsilon M rho h have hmeas : Measurable (designCenter (n := n) X A center) := by unfold designCenter have ht := measurable_usableGroupTotal (n := n) X A h.X_measurable h.A_measurable apply Measurable.ite (measurableSet_lt measurable_const ht) · apply Measurable.div · apply Finset.measurable_sum intro k hk apply Measurable.ite (measurableSet_usableGroup X A h.X_measurable h.A_measurable k) · exact ((Measurable.of_discrete : Measurable fun m : ℕ => (m : ℝ)).comp (measurable_groupCount X A h.X_measurable h.A_measurable k)).mul measurable_const · exact measurable_const · exact (Measurable.of_discrete : Measurable fun m : ℕ => (m : ℝ)).comp ht · exact measurable_const have hbound (z : Fin n → Ω) : |designCenter X A center z| ≤ 2 * M := by by_cases ht : 0 < usableTotal X A z · have htR : (0 : ℝ) < usableTotal X A z := by exact_mod_cast ht have hterm (k : κ) : |(if matchedCell X A z k then (groupCount X A z k : ℝ) * (center true k - center false k) else 0)| ≤ (if matchedCell X A z k then (groupCount X A z k : ℝ) else 0) * (2 * M) := by by_cases hk : matchedCell X A z k · simp only [hk, ↓reduceIte, abs_mul] rw [abs_of_nonneg (by positivity : 0 ≤ (groupCount X A z k : ℝ))] have hc : |center true k - center false k| ≤ 2 * M := by rw [abs_le] constructor <;> rcases abs_le.mp (h.center_envelope true k) with ⟨htl, htu⟩ <;> rcases abs_le.mp (h.center_envelope false k) with ⟨hfl, hfu⟩ <;> linarith exact mul_le_mul_of_nonneg_left hc (by positivity) · simp [hk] have hsum : |∑ k : κ, if matchedCell X A z k then (groupCount X A z k : ℝ) * (center true k - center false k) else 0| ≤ (usableTotal X A z : ℝ) * (2 * M) := by calc _ ≤ ∑ k : κ, |if matchedCell X A z k then (groupCount X A z k : ℝ) * (center true k - center false k) else 0| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k : κ, (if matchedCell X A z k then (groupCount X A z k : ℝ) else 0) * (2 * M) := Finset.sum_le_sum (by intro k hk; exact hterm k) _ = (usableTotal X A z : ℝ) * (2 * M) := by rw [← Finset.sum_mul] congr 1 exact_mod_cast (show (∑ k : κ, if matchedCell X A z k then groupCount X A z k else 0) = usableTotal X A z from rfl) unfold designCenter simp only [ht, ↓reduceIte, abs_div, abs_of_pos htR] exact (div_le_iff₀ htR).2 (by simpa [mul_comm] using hsum) · have ht0 : usableTotal X A z = 0 := by omega simp [designCenter, ht0, hM] have hp := populationContrast_abs_le μ X A Y center epsilon M rho h apply MemLp.of_bound (hmeas.sub measurable_const).aestronglyMeasurable (4 * M) filter_upwards [] with z rw [Real.norm_eq_abs] exact (abs_sub _ _).trans (by linarith [hbound z])